From 93e2f5050bdf69dde8f1d460be7855afc8c3d46d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luukas=20P=C3=B6rtfors?= Date: Thu, 24 Oct 2024 17:15:28 +0300 Subject: [PATCH] docs: improve README --- README.md | 47 +++++++++++++++++++++------------------------- docker-compose.yml | 29 ++++++++++++++-------------- 2 files changed, 36 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index 20c5aa6..2c589bd 100644 --- a/README.md +++ b/README.md @@ -2,40 +2,35 @@ This is the laskugeneraattoori backend written in Rust. -The application is based on [axum](https://github.com/tokio-rs/axum): +The application is based on [axum](https://github.com/tokio-rs/axum). +PDF generation is based on [typst](https://github.com/typst/typst). -## Development +## Configuration -You need a local Postgres setup or (maybe preferably) use [Docker Compose](https://docs.docker.com/compose/gettingstarted/) or any other container runtime +The following variables can be configured in the environment (or the .env file) ```sh -docker compose up -d +# VARIABLE="default value" + +PORT=3000 +BIND_ADDR=127.0.0.1 +ALLOWED_ORIGINS= # comma separated list of urls +MAILGUN_URL= +MAILGUN_USER= +MAILGUN_PASSWORD= +MAILGUN_TO= +MAILGUN_FROM= ``` -You need diesel CLI for running migrations: +## Running laskugeneraattori +### With cargo ```sh -cargo install diesel_cli +cargo run ``` -Nith the DB up, run migrations: - -```sh -diesel migration run -``` - -Now the tests should pass: - +### With Docker ```sh -cargo test -``` - -## Features/TODO: - -- [x] create invoice + validation -- [ ] create user + authentication -- [x] list invoices -- [ ] edit invoice -- [ ] ratelimits -- [ ] generate pdf -- [ ] write documentation +docker build . -t laskugeneraattori +docker run laskugeneraattori +`` diff --git a/docker-compose.yml b/docker-compose.yml index b944842..ef472a9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,16 +1,17 @@ -version: "3" - services: - postgres: - image: postgres:latest - ports: - - "5432:5432" - volumes: - - data:/var/lib/postgresql/data + laskugeneraattori: + build: + context: . + dockerfile: Dockerfile environment: - - POSTGRES_PASSWORD=postgres - - POSTGRES_USER=postgres - - POSTGRES_DB=laskugeneraattori - -volumes: - data: + - PORT=3000 + - BIND_ADDR=0.0.0.0 + - ALLOWED_ORIGINS= + - MAILGUN_URL= + - MAILGUN_USER= + - MAILGUN_PASSWORD= + - MAILGUN_TO= + - MAILGUN_FROM= + ports: + - "3000:3000" + restart: always