This document describes how to run the Groups application using Docker.
The application consists of two main services:
- PostgreSQL Database: Persistent data storage
- Web Application: Rust/Actix-web server
# Start PostgreSQL database
task db-up
# Run application locally
task dev# Build the application image
task docker-build
# Start complete stack (database + application)
task docker-up
# View logs
task docker-logs
# Stop the stack
task docker-down| Command | Description |
|---|---|
task docker-build |
Build Docker image for the application |
task docker-up |
Start full application stack |
task docker-down |
Stop full application stack |
task docker-logs |
Show application logs |
task docker-logs-db |
Show database logs |
task docker-restart |
Restart the application container |
task docker-shell |
Open shell in application container |
task docker-rebuild |
Rebuild and restart the application |
task docker-clean |
Clean up Docker containers and volumes |
- Image: Built from local Dockerfile
- Port: 8080 (mapped to host 8080)
- Environment: Production configuration
- Profile:
app(not started by default) - Dependencies: Waits for PostgreSQL to be healthy
- Image: postgres:16-alpine
- Port: 5432 (mapped to host 5432)
- Database: groups_dev
- Credentials: groups_user/groups_password
- Volume: Persistent data storage
- Image: postgres:16-alpine
- Port: 5433 (mapped to host 5433)
- Database: groups_test
- Profile:
test(started only when testing)
The application uses the following environment variables in Docker:
| Variable | Default | Description |
|---|---|---|
DATABASE_URL |
postgres://... | PostgreSQL connection string |
RUST_LOG |
info | Logging level |
HOST |
0.0.0.0 | Server bind address |
PORT |
8080 | Server port |
SESSION_SECRET_KEY |
(required) | Session encryption key (64+ chars) |
- Run
task devfor local development - Uses
.envfile for configuration - PostgreSQL runs in Docker, application runs locally
- Hot reload with
cargo run
- Run
task docker-upfor containerized deployment - Uses
.env.productionconfiguration - Both database and application run in Docker
- Optimized release build
- Ensure Docker has sufficient memory (4GB+ recommended)
- Build takes 5-10 minutes on first run due to Rust compilation
- Use
task docker-cleanto reset if builds fail
- Verify PostgreSQL is healthy:
docker compose ps - Check database logs:
task docker-logs-db - Ensure
.env.productionhas correct DATABASE_URL
- Check application logs:
task docker-logs - Verify environment variables are set correctly
- Use
task docker-shellto debug inside container
- Change
SESSION_SECRET_KEYin production - Use proper PostgreSQL credentials in production
- Consider using Docker secrets for sensitive data
- The application runs as non-root user (appuser) inside container