Skip to content

delta/aor-backend

Repository files navigation

aot-backend

Setup

  1. Install Rust

  2. Install rustfmt and clippy:

    rustup component add rustfmt clippy
  3. Clone and change directory into this repo

  4. Install pre-commit hooks

    • Install Python and pip
    • Install pre-commit package:
    pip install pre-commit
    pre-commit install
  5. Run:

    cp .env.example .env

    and fill the env variables

With Docker

  1. Install Docker and Docker Compose

  2. Start the services:

    docker-compose up
  3. To generate migrations or run any command on the rust container, prefix it with docker-compose exec server like so:

    docker-compose exec server diesel migration generate <migration-name>

Bare metal

  1. Install PostgreSQL

  2. Install diesel_cli:

    cargo install diesel_cli --no-default-features --features postgres
  3. Install cargo-watch for hot reload (optional):

    cargo install cargo-watch
  4. To run migrations,

    diesel migration run
  5. Run:

    cargo watch -i logs -x run

    to start the server with hot reload, otherwise

    cargo run

Seed the dummy data using:

psql -U aot --set ON_ERROR_STOP=on < dummy_data.sql

For docker, prefix the above command with docker-compose exec -T db

Deployment

  1. Run:

    cp .env.example .env

    and fill the env variables

  2. Start the services:

    ./prod-run.sh up

    and build the images again with

    ./prod-run.sh up build
  3. Down the services:

    ./prod-run.sh down
  4. Logs for the services:

    ./prod-run.sh logs

You can attach to containers with:

docker attach <container-name>

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages