https://github.com/delta/aor-backend
https://github.com/delta/aor-backend
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/delta/aor-backend
- Owner: delta
- Created: 2021-10-25T10:08:31.000Z (over 4 years ago)
- Default Branch: aor25
- Last Pushed: 2025-02-14T08:10:47.000Z (over 1 year ago)
- Last Synced: 2025-02-14T09:24:08.615Z (over 1 year ago)
- Language: Rust
- Size: 770 KB
- Stars: 4
- Watchers: 27
- Forks: 13
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# aot-backend
## Setup
1. Install [Rust](https://www.rust-lang.org/tools/install)
2. Install [rustfmt](https://github.com/rust-lang/rustfmt) and [clippy](https://github.com/rust-lang/rust-clippy):
```bash
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:
```bash
pip install pre-commit
pre-commit install
```
5. Run:
```bash
cp .env.example .env
```
and fill the env variables
### With Docker
6. Install [Docker](https://docs.docker.com/engine/install/) and [Docker Compose](https://docs.docker.com/compose/install/)
7. Start the services:
```bash
docker-compose up
```
8. To generate migrations or run any command on the rust container, prefix it with `docker-compose exec server` like so:
```bash
docker-compose exec server diesel migration generate
```
### Bare metal
6. Install [PostgreSQL](https://www.postgresql.org/download/)
7. Install diesel_cli:
```bash
cargo install diesel_cli --no-default-features --features postgres
```
8. Install [cargo-watch](https://github.com/watchexec/cargo-watch) for hot reload (optional):
```bash
cargo install cargo-watch
```
9. To run migrations,
```bash
diesel migration run
```
10. Run:
```bash
cargo watch -i logs -x run
```
to start the server with hot reload, otherwise
```bash
cargo run
```
Seed the dummy data using:
```bash
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:
```bash
cp .env.example .env
```
and fill the env variables
2. Start the services:
```bash
./prod-run.sh up
```
and build the images again with
```bash
./prod-run.sh up build
```
3. Down the services:
```bash
./prod-run.sh down
```
4. Logs for the services:
```bash
./prod-run.sh logs
```
You can attach to containers with:
```bash
docker attach
```