For local development against locally running services:
For local development against cloud services:
If you want to set up a locally running Postgres to connect to.
Install postgres (on Ubuntu, sudo apt get install postgresql
)
On MacOS, if you get an error, you may need to create or modify your /etc/sysctl.conf
file and allow more "shared memory". An explanation can be found in this article.
Create a database
createdb <DATABASE-NAME>
Create a superuser with permissions on the database
CREATE USER <USER-GOES-HERE> WITH PASSWORD <PASSWORD-GOES-HERE>;
GRANT ALL PRIVILEGES ON SCHEMA PUBLIC TO <USER-GOES-HERE>;
On Linux, if you just installed postgresql, you may need to change some permissions to be able to log on as a superuser to create a db or new user
First edit pg_hba.conf and modify to "trust".
Then you should be able to restart postgres and login.
service postgres stop
service postgres start
sudo su - postgres
Set environment variables to allow you to connect to the database. An example configuration is below
ANDREWSLAI_DB_HOST=localhost
ANDREWSLAI_DB_USER=andrewslai
ANDREWSLAI_DB_PASSWORD=andrewslai
ANDREWSLAI_DB_NAME=andrewslai
ANDREWSLAI_DB_PORT=5432
Setup steps
Create an uberjar and build the docker container. Start keycloak
lein do clean, uberjar
docker build -t andrewslai .
docker run --network host \
-e DB_USER=keycloak \
-e DB_PASSWORD=keycloak \
-e DB_DATABASE=keycloak \
-e DB_VENDOR=POSTGRES \
-e DB_ADDR="" \
jboss/keycloak -Djgroups.bind_addr=127.0.0.1
Startup
Edit the .env.local
file to provide env vars.
docker run -d --rm --network host --env-file=.env.local -p 5000:5000 andrewslai
There is a template for what the .env.local
in env.local.example
ANDREWSLAI_AUTH_TYPE=none ANDREWSLAI_DB_TYPE=embedded-h2 ANDREWSLAI_STATIC_CONTENT_TYPE=local ANDREWSLAI_STATIC_CONTENT_FOLDER='../andrewslai-frontend/resources/public' lein run
Setup steps
Create an uberjar and build the docker container.
lein do clean, uberjar
docker build -t andrewslai .
Startup
Edit the .env.aws
file to provide the correct environment variables.
docker run -d --rm --env-file=.env.aws -p 5000:5000 andrewslai
Can you improve this documentation? These fine people already did:
Andrew Lai & ALai57Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close