added docker-compose.yml
All checks were successful
CI / build (push) Successful in 1m22s

This commit is contained in:
2025-07-04 19:21:29 +08:00
parent e3f89f8dfb
commit d961c61b80
3 changed files with 55 additions and 5 deletions

View File

@@ -2,3 +2,4 @@
target
README.md
Dockerfile
docker-compose.yml

View File

@@ -24,10 +24,19 @@ Intrasys is an internal financial transfers application built with Rust and Axum
## Quick Start
### 1. Ensure you have rust installed
Foolow the steps described [here](https://www.rust-lang.org/tools/install) if you don't
### Using docker compose
Just run
### 2. Provision PostgreSQL Database
```bash
docker compose up
```
### Build locally
#### Ensure you have rust installed
Follow the steps described [here](https://www.rust-lang.org/tools/install) if you don't
#### Provision PostgreSQL Database
The easiest way is to run a PostgreSQL container with Docker:
@@ -35,7 +44,7 @@ The easiest way is to run a PostgreSQL container with Docker:
docker run --name intrasys-pg -d -e POSTGRES_PASSWORD=password -p 127.0.0.1:5432:5432 postgres:alpine
```
### 2. Run the Application
#### Run the Application
```bash
cargo run
@@ -87,7 +96,7 @@ The following variables affect the application behavior:
- `INTRASYS_PORT` is the port the HTTP server will listen to
- any of the environmental variables mentioned [here](https://docs.rs/sqlx/latest/sqlx/postgres/struct.PgConnectOptions.html#method.options) affects the postgres database connection
## Running unit tests
## Running tests
Make sure you have an available postgres database and edit `DATABASE_URL` variable in the `.env` file accordingly. If you've used the docker command mentioned in the *Quickstart*
section you don't need to change anything.

40
docker-compose.yml Normal file
View File

@@ -0,0 +1,40 @@
volumes:
postgres-data:
driver: local
services:
postgres:
image: postgres:alpine
restart: unless-stopped
environment:
- POSTGRES_PASSWORD=password
volumes:
- postgres-data:/var/lib/postgresql/data
deploy:
resources:
limits:
cpus: 1.00
memory: 256M
healthcheck:
test: ["CMD", "pg_isready", "-U", "postgres"]
interval: 30s
timeout: 60s
retries: 5
start_period: 5s
intrasys:
image: gitea.woggioni.net/woggioni/intrasys:latest
environment:
- PGHOST=postgres
- PGUSER=postgres
- PGPASSWORD=password
- INTRASYS_LOG=trace
ports:
- "127.0.0.1:8080:8080"
deploy:
resources:
limits:
cpus: 1.00
memory: 32M
depends_on:
postgres:
condition: service_healthy