The Keycloak Environment For Clojure

ngrok
ngrok will allow us to access Keycloak from this notebook.
curl -sS https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip -o ngrok.zipunzip /ngrok.zipSettings for the ngrok configuration file. The addr setting forwards traffic to the local port number or network address. It is set to 8080. Make sure the Keycloak default ports are free:
HTTP management interface listening on http://127.0.0.1:9990/management
Admin console listening on http://127.0.0.1:9990
regionusconsole_uitruetunnels btf protohttp addr8080 subdomainbtfGrab your authtoken from ngrok, store the token in your Nextjournal secret vault, and add it to the environment. The token will authenticate this notebook with the ngrok service.
Prepend the authtoken to the configuration file above, ngrok.yml.
echo 'authtoken:' $ngrok | cat - ngrok.yml > /tmp/out && mv /tmp/out ngrok.ymlRun ngrok in the background using nohup. Unfortunately, there are no plans to offer a daemon service in the basic ngrok package.
nohup /ngrok start --all --config="/ngrok.yml" &> /tmp/ngrok.log & sleep 1tail /tmp/ngrok.logPlace the URL into a browser and the tunnel will be visible. Anything served from port 8080 will appear here.
Keycloak
curl -LO https://github.com/keycloak/keycloak/releases/download/15.0.1/keycloak-15.0.1.zip && unzip keycloak-15.0.1.zip Start keycloak with keycloak’s bin/standalone.sh. This runs on port 8080, make sure it is available on your machine.
nohup /keycloak-15.0.1/bin/standalone.sh &> /tmp/keycloak.log & sleep 1tail /tmp/keycloak.logKeycloak needs a default admin user as a basis. Create the admin user. I found out the hard way that keycloak is reserved.
keycloak-15.0.1/bin/add-user-keycloak.sh -r master -u nextjournal -p nextjournal > /tmp/add-user-keycloak.txtAdministration
Open http://btf.ngrok.io/auth/. The getting started tutorial on Keycloak's official website gives detailed instructions on how to use the admin console.

To stop the ngrok tunnel or Keycloak process, use the kill command with the process ID: kill <PID> or kill -9 "$(pgrep ngrok)".
ps auxAppendix
{:deps {org.clojure/clojure {:mvn/version "1.10.1"} ;; complient is used for autocompletion ;; add your libs here (and restart the runtime to pick up changes) compliment/compliment {:mvn/version "0.3.9"}}}