Story-Schematics service




This is a quickstart document to test the project locally.
You can find the API documentation on the repository GitHub page.
Want to contribute? Check the contribution guidelines.
Use in a project
You can import this application as a docker image. Below is an example using
podman compose.
services:
json-keys-postgres:
image: docker.io/library/postgres:17
networks:
- api
environment:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: json-keys
POSTGRES_HOST_AUTH_METHOD: scram-sha-256
POSTGRES_INITDB_ARGS: --auth=scram-sha-256
volumes:
- json-keys-postgres-data:/var/lib/postgresql/data/
story-schematics-postgres:
image: docker.io/library/postgres:17
networks:
- api
environment:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: story-schematics
POSTGRES_HOST_AUTH_METHOD: scram-sha-256
POSTGRES_INITDB_ARGS: --auth=scram-sha-256
volumes:
- story-schematics-postgres-data:/var/lib/postgresql/data/
json-keys-service:
image: ghcr.io/a-novel/service-json-keys/standalone:v0
depends_on:
- json-keys-postgres
ports:
# Expose the service on port 4001 on the local machine.
- "4021:8080"
environment:
PORT: 8080
ENV: local
APP_NAME: json-keys-service
DSN: postgres://postgres:postgres@json-keys-postgres:5432/json-keys?sslmode=disable
# Dummy key used only for local environment. Consider using a secure, private key in production.
MASTER_KEY: fec0681a2f57242211c559ca347721766f8a3acd8ed2e63b36b3768051c702ca
# Used for tracing purposes, can be omitted.
# SENTRY_DSN: [your_sentry_dsn]
# SERVER_NAME: json-keys-service-prod
# RELEASE: v0.1.2
# Set the following if you want to debug the service locally.
# DEBUG: true
networks:
- api
story-schematics-service:
image: ghcr.io/a-novel/service-story-schematics/api:v0
depends_on:
- story-schematics-postgres
- json-keys-service
ports:
# Expose the service on port 4001 on the local machine.
- "4001:8080"
environment:
PORT: 8080
ENV: local
APP_NAME: story-schematics-service
DSN: postgres://postgres:postgres@story-schematics-postgres:5432/story-schematics?sslmode=disable
# In sandbox mode, mails are logged in the server logs rather than being sent. Alternatively, you need to provide
# a valid SMTP server configuration.
SMTP_SANDBOX: true
# SMTP_PASSWORD: your_smtp_password
# SMTP_SENDER: noreply@agoradesecrivains.com
# SMTP_DOMAIN: smtp-relay.gmail.com
# SMTP_ADDRESS: smtp-relay.gmail.com:587
AUTH_PLATFORM_URL_UPDATE_EMAIL: http://localhost:4001/update-email
AUTH_PLATFORM_URL_UPDATE_PASSWORD: http://localhost:4001/update-password
AUTH_PLATFORM_URL_REGISTER: http://localhost:4001/register
# Used for tracing purposes, can be omitted.
# SENTRY_DSN: [your_sentry_dsn]
# SERVER_NAME: story-schematics-service-prod
# RELEASE: v0.1.2
# Set the following if you want to debug the service locally.
# DEBUG: true
networks:
- api
networks:
api: {}
volumes:
story-schematics-postgres-data:
json-keys-postgres-data:
Available tags includes:
latest: latest versioned image
vx: versioned images, pointing to a specific version. Partial versions are supported. When provided, the
latest subversion is used.
examples: v0, v0.1, v0.1.2
branch: get the latest version pushed to a branch. Any valid branch name can be used.
examples: master, fix/something
Run locally
Pre-requisites
Setup environment
Create a .envrc file from the template:
cp .envrc.template .envrc
Then fill the missing secret variables. Once your file is ready:
source .envrc
You may use tools such as direnv, otherwise you'll need to source the env file on each new
terminal session.
Install the external dependencies:
make install
Run infrastructure
make run-infra
# To turn down:
# make run-infra-down
You may skip this step if you already have the global infrastructure running.
Et Voilà!
make run-api