Docker
DraftSmith can be installed and configured entirely through Docker, this will include the API, database and Web App:
git clone https://github.com/RyanGreenup/draftsmith_rscd draftsmith_rs/containers/maindocker compose up# must go down and up again to create the databasedocker compose downdocker compose up -dDetails
This will build a container with some dependencies and:
- A clone of:
- Compiled version of
- CLI for draftsmith_rs_api
- Virtual Environment for draftsmith_flask
The docker-compose.yml will create 3 services:
postgres- The database storing all the data
app- This is the REST API that communicates with the database
scripts/entrypoint.shwill check for a marker file and if it’s not found:- Create a database
- Initialize that database with tables etc. (using Diesel migrations)
web-app- The web application communicating with the REST API
scripts/web_entrypoint.shwill source the virtual environment (created in the image) and run the web app
- The web application communicating with the REST API
Interactions
Users can jump inside the container to interact directly with the REST API or database if they wish:
docker compose exec -it app /bin/sh# Ordocker compose exec -it app /bin/fishdocker compose exec -it app /usr/sbin/nuOr call the client without forwarding the REST API to the system:
# change this according to the docker-composeAPI_PORT=37242docker compose exec -it app draftsmith client --url 'http://localhost:'$API_PORT notes tree | jq