This guide explains how to run PulseData services using Docker and Docker Compose.
- Docker Desktop (or Docker + Docker Compose)
- At least 2GB RAM available for containers
To start just the PostgreSQL database and pgAdmin:
docker-compose up -dThis will start:
- PostgreSQL: Database server on
localhost:5432 - pgAdmin: Web UI for database management on
http://localhost:8080
To include the API service:
docker-compose --profile with-api up -dThis will additionally start:
- PulseData API: REST API on
http://localhost:8000
# Stop all services
docker-compose down
# Stop and remove volumes (clears database)
docker-compose down -v- Container:
pulsedata_db - Host:
localhost(from host machine) orpostgres(from other containers) - Port:
5432 - Database:
pulsedata - Username:
pulsedata_user - Password:
pulsedata_pass(default, change in.env) - Initialization: Automatic schema creation and seeding on first run
Health Check: Auto-restarts if unhealthy
- Container:
pulsedata_pgadmin - URL:
http://localhost:8080 - Email:
admin@pulsedata.local - Password:
admin
- Open
http://localhost:8080 - Login with credentials above
- Right-click "Servers" -> "Create" -> "Server"
- General Tab:
- Name:
PulseData
- Name:
- Connection Tab:
- Host name/address:
postgres - Port:
5432 - Maintenance database:
pulsedata - Username:
pulsedata_user - Password:
pulsedata_pass - Save password: yes
- Host name/address:
- Container:
pulsedata_api - URL:
http://localhost:8000 - API Documentation:
http://localhost:8000/swagger/index.html(if Swagger is enabled) - Liveness Check:
http://localhost:8000/api/health/live - Readiness Check:
http://localhost:8000/api/health/ready
Note: Requires database to be running and healthy before starting.
Copy .env.example to .env and customize:
cp .env.example .envKey variables:
POSTGRES_PASSWORD: Database passwordPGADMIN_DEFAULT_PASSWORD: pgAdmin admin passwordASPNETCORE_ENVIRONMENT: API environment (Development/Production)ConnectionStrings__DefaultConnection: API database connection string
To use custom .env file:
docker-compose --env-file .env up -dOr simply place .env in the same directory as docker-compose.yml (automatic).
# All services
docker-compose logs -f
# Specific service
docker-compose logs -f postgres
docker-compose logs -f api
# Last 100 lines
docker-compose logs --tail=100Using psql:
psql -h localhost -U pulsedata_user -d pulsedatadocker exec pulsedata_db psql -U pulsedata_user -d pulsedata -c "SELECT * FROM customers LIMIT 5;"# Rebuild API image
docker-compose build api
# Rebuild and restart
docker-compose up -d --builddocker-compose down -v
docker volume rm pulsedata_postgres_data 2>/dev/null || true
docker-compose up -d# PostgreSQL container
docker exec -it pulsedata_db sh
# pgAdmin container
docker exec -it pulsedata_pgadmin sh
# API container (if running)
docker exec -it pulsedata_api sh# Start services
docker-compose up
# In another terminal, run API locally
cd src/PulseData.API
dotnet runConnection string for local API:
Server=localhost;Database=pulsedata;User Id=pulsedata_user;Password=pulsedata_pass;Port=5432;
docker-compose --profile with-api up -d
# View logs
docker-compose logs -f apiSolution: Ensure API container is running:
docker-compose ps
docker-compose logs apiSolution: Check volume permissions:
docker volume ls
docker volume inspect pulsedata_postgres_dataSolution: Change ports in docker-compose.yml:
ports:
- '5433:5432' # PostgreSQL on 5433
- '8081:80' # pgAdmin on 8081
- '8001:8000' # API on 8001Solution: Clean up Docker resources:
docker system prune -a -vThis setup uses profiles to make services optional:
- No profile (default): PostgreSQL + pgAdmin
- with-api: All services including API
Examples:
# Start default services only
docker-compose up
# Start with API
docker-compose --profile with-api up -d
# Stop only API but keep database
docker-compose --profile with-api down
# Activate multiple profiles
docker-compose --profile profile1 --profile profile2 up -dFor production deployments:
-
Security:
- Change all default passwords in
.env - Use environment-specific secrets management
- Enable https/tls for API
- Change all default passwords in
-
Resources:
- Set memory limits in
docker-compose.yml - Configure CPU limits
- Use volume backups
- Set memory limits in
-
Monitoring:
- Monitor container health
- Set up centralized logging
- Implement metrics collection
-
Database:
- Enable regular automated backups
- Configure replication for high availability
- Implement connection pooling
-
API:
- Set
ASPNETCORE_ENVIRONMENT=Production - Disable Swagger in production
- Enable proper error handling
- Set