Dev Deployment
The dev deployment provides a complete infrastructure stack without the Safebucket application container, designed for contributors and developers actively working on the Safebucket codebase.
Overview
What's Included
This deployment includes all the infrastructure services Safebucket needs:
- PostgreSQL 18 - Main database
- RustFS - High-performance S3-compatible object storage
- Valkey 9 - Caching layer
- NATS JetStream - Event streaming
- Loki - Activity logging
- Mailpit - Email testing
- Grafana (optional) - Logs visualization for debugging
Prerequisites
- Docker and Docker Compose
- Go 1.24.x installed locally
- Node.js 22.x (if building the frontend)
- Git for cloning the repository
- At least 1GB RAM available for containers
Quick Start
-
Clone the repository:
git clone https://github.com/safebucket/safebucket
cd safebucket/deployments/dev -
Start the infrastructure:
docker compose up -d -
Verify services are running:
docker compose ps -
Run Safebucket locally:
# Build the frontend
cd web
npm install
npm run dev
# Run the backend
cd ..
go run main.go -
Access Safebucket: Open http://localhost:3000 in your browser
Services Overview
| Service | Port | Purpose |
|---|---|---|
| PostgreSQL | 5432 | Main database |
| RustFS API | 9000 | Object storage API |
| RustFS Console | 9001 | RustFS web console |
| Valkey | 6379 | Caching layer |
| NATS | 4222 | Event streaming |
| Loki | 3100 | Activity logging |
| Mailpit Web | 8025 | Email testing UI |
| Mailpit SMTP | 1025 | Email testing SMTP |
| Grafana* | 3200 | Logs visualization |
* Grafana only starts with --profile debug
Running Safebucket Locally
Step-by-Step Guide
1. Start Infrastructure
cd deployments/dev
docker compose up -d
Wait for all services to be healthy:
docker compose ps
You should see (healthy) status for database and bucket services.
3. Build Frontend (First Time)
cd web
npm install
npm run build
cd ..
This creates a production build in web/dist that the backend will serve.
4. Run Backend
From the project root:
go run main.go
The application will:
- Connect to the database
- Run migrations
- Initialize services
- Start the HTTP server on port 8080
5. Access the Application
Open http://localhost:3000 and log in with:
- Email: [email protected]
- Password: ChangeMePlease
Connection Endpoints
When running Safebucket locally, use these connection strings:
| Service | Endpoint | Credentials |
|---|---|---|
| PostgreSQL | localhost:5432 | User: safebucket-userPass: safebucket-passwordDB: safebucket |
| RustFS API | localhost:9000 | Access Key: rustfsadminSecret: rustfsadmin |
| Valkey | localhost:6379 | Password: safebucket-password |
| NATS | localhost:4222 | No auth |
| Loki | http://localhost:3100 | No auth |
| Mailpit Web | http://localhost:8025 | No auth |
| Mailpit SMTP | localhost:1025 | No auth |
Running Tests
# Run all tests
go test ./...
# Run specific package tests
go test ./internal/services
# Run with coverage
go test -cover ./...
Testing Email
Mailpit captures all emails sent by Safebucket:
- Open http://localhost:8025
- Perform actions that send emails (user invites, password resets)
- View emails in Mailpit UI
Accessing Storage
RustFS provides S3-compatible storage without a web console. To manage buckets and files, you can use:
-
AWS CLI: Configure with RustFS credentials
aws configure --profile rustfs
# Access Key: rustfsadmin
# Secret Key: rustfsadmin
# Region: us-east-1
# Output: json
aws --profile rustfs --endpoint-url http://localhost:9000 s3 ls s3://safebucket -
S3 Browser Tools: Any S3-compatible client (e.g., Cyberduck, S3 Browser)
Architecture Differences: Dev vs Local
| Feature | Dev Deployment | Local Deployment |
|---|---|---|
| Safebucket App | Run locally from source | Dockerized container |
| Purpose | Active development | Testing, demos |
| Iteration Speed | Fast (no rebuild) | Slower (rebuild image) |
| Debugging | Full IDE support | Log-based |
| Hot Reload | Yes (with Air/CompileDaemon) | No |
| Resource Usage | Lower (no app container) | Higher |
| Container Images | Official images | Same |
| Health Checks | Same infrastructure reliability | Same |
| Best For | Development, contributing | Integration testing, demos |
Configuration Files
The dev deployment uses:
deployments/dev/docker-compose.yml: Service definitionsdeployments/dev/.env: Infrastructure environment variablesconfig.yamlor app-level.env: Your local Safebucket configuration
Note: Infrastructure .env configures Docker services. App configuration should be set separately when running locally.