Backend Service for docs.clj.codes.
This file has all the backend configurations:
:webserver/port
or PORT env var which port the webserver will open and expose:webserver/allowed-origins
an array with allowed base domains for cors:database
config to build the postgres connection string::dbname
or DB_NAME env var:username
or DB_USER env var:password
or DB_PASS env var:host
or DB_HOST env var:port
or DB_PORT env var
:db-docs
coordinates to db-docs component downloads the latest extracted db:dir
where it will download and extract the database zip:url
base github releases url to build the download url:version
used to build the download url and set where inside:dir
the database will be saved:file-name
used to build the download url- Note: Before downloading the component checks if the path
:dir
/:version
exists and has the database, so you could manually copy your database files and start the server it will use this instead downloading a new one.
:github
where to set client-id (or GH_CLIENT_ID) and client-secret (or GH_CLIENT_SECRET) for login with github:jwt
jwt encryption secret used to encrypt and decrypt the jwt returned to the frontend after login
Check the project backlog, issues and ongoing tasks
To open a nrepl
clj -M:nrepl
To open a nrepl with all test extra-deps on it
clj -M:dev:nrepl
Then, eval for instrument malli. Malli instrumentation enables input/output validation and clj-kondo lint annotations.
(start)
To run unit tests inside ./test/unit
clj -M:dev:test :unit
To run integration tests inside ./test/integration
clj -M:dev:test :integration
To run all tests inside ./test
clj -M:dev:test
To generate a coverage report
clj -M:dev:test --plugin kaocha.plugin/cloverage
clj -M:clojure-lsp format
clj -M:clojure-lsp clean-ns
clj -M:clojure-lsp diagnostics
To create a new migration with a name
clj -M:migratus create migration-name
To execute all pending migrations
clj -M:migratus migrate
To rollback the latest migration
clj -M:migratus rollback
See Migratus Usage for documentation on each command.
Start containers with postgres user: postgres, password: postgres, hostname: db, port: 5432
and pg-admin email: pg@pg.cc, password: pg, port: 5433
docker-compose -f docker/docker-compose.yml up -d
Stop containers
docker-compose -f docker/docker-compose.yml stop
First you need to have the database running, for this you can use the docker command in the step above.
You can start a repl open and evaluate the file src/microservice_boilerplate/server.clj
and execute following code:
(start-system! (build-system-map))
You can generate an uberjar and execute it via java in the terminal:
# genarate a target/service.jar
clj -T:build uberjar
# execute it via java
java -jar target/service.jar
This is free and unencumbered software released into the public domain.
For more information, please refer to http://unlicense.org