|
| 1 | +# Trustify Docker Compose Deployment |
| 2 | + |
| 3 | +This directory contains Docker Compose files for local development deployment of Trustify with its required infrastructure components. |
| 4 | + |
| 5 | +## Files |
| 6 | + |
| 7 | +- `docker-compose.infrastructure.yml` - Infrastructure services (Redis, PostgreSQL) |
| 8 | +- `docker-compose.infra-sso.yml` - Infrastructure services (Keycloak) |
| 9 | +- `docker-compose.application.yml` - Application service (trust-da) |
| 10 | +- `env.example` - Environment variables template |
| 11 | + |
| 12 | +## Quick Start |
| 13 | + |
| 14 | +### 1. Start Infrastructure Services |
| 15 | + |
| 16 | +```bash |
| 17 | +# Start Redis, PostgreSQL, and Keycloak |
| 18 | +docker-compose -f docker-compose.infrastructure.yml up -d |
| 19 | + |
| 20 | +# Start Keycloak |
| 21 | +docker-compose -f docker-compose.infra-sso.yml up -d |
| 22 | + |
| 23 | +# Check if services are healthy |
| 24 | +docker-compose -f docker-compose.infrastructure.yml ps |
| 25 | +``` |
| 26 | + |
| 27 | +### 2. Configure Environment (Optional) |
| 28 | + |
| 29 | +```bash |
| 30 | +# Copy environment template |
| 31 | +cp env.example .env |
| 32 | + |
| 33 | +# Edit .env with your actual values |
| 34 | +nano .env |
| 35 | +``` |
| 36 | + |
| 37 | +### 3. Start Application |
| 38 | + |
| 39 | +```bash |
| 40 | +# Start the trust-da application |
| 41 | +docker-compose -f docker-compose.application.yml up -d |
| 42 | + |
| 43 | +# Check application status |
| 44 | +docker-compose -f docker-compose.application.yml ps |
| 45 | +``` |
| 46 | + |
| 47 | +## Services |
| 48 | + |
| 49 | +### Infrastructure Services |
| 50 | + |
| 51 | +| Service | Port | Description | |
| 52 | +|---------|------|-------------| |
| 53 | +| Redis | 6379 | Cache and session storage | |
| 54 | +| PostgreSQL | 5432 | Database for Keycloak and application | |
| 55 | +| Keycloak | 8080 | Identity and access management | |
| 56 | + |
| 57 | +### Application Services |
| 58 | + |
| 59 | +| Service | Port | Description | |
| 60 | +|---------|------|-------------| |
| 61 | +| trust-da | 8081 | Main application (mapped from 8080) | |
| 62 | +| trust-da | 9001 | Management/health endpoints (mapped from 9000) | |
| 63 | + |
| 64 | +## Access Points |
| 65 | + |
| 66 | +- **Application**: http://localhost:8081 |
| 67 | +- **Keycloak Admin**: http://localhost:8080 |
| 68 | + - Username: `admin` |
| 69 | + - Password: `admin123` |
| 70 | +- **PostgreSQL**: localhost:5432 |
| 71 | + - Database: `trustify` |
| 72 | + - Username: `trustify` |
| 73 | + - Password: `trustify123` |
| 74 | +- **Redis**: localhost:6379 |
| 75 | + - Password: `trustify123` |
| 76 | + |
| 77 | +## Health Checks |
| 78 | + |
| 79 | +All services include health checks. You can monitor them with: |
| 80 | + |
| 81 | +```bash |
| 82 | +# Check infrastructure health |
| 83 | +docker-compose -f docker-compose.infrastructure.yml ps |
| 84 | + |
| 85 | +# Check Keycloak health |
| 86 | +docker-compose -f docker-compose.infra-sso.yml ps |
| 87 | + |
| 88 | +# Check application health |
| 89 | +docker-compose -f docker-compose.application.yml ps |
| 90 | +``` |
| 91 | + |
| 92 | +## Logs |
| 93 | + |
| 94 | +```bash |
| 95 | +# View infrastructure logs |
| 96 | +docker-compose -f docker-compose.infrastructure.yml logs -f |
| 97 | + |
| 98 | +# View Keycloak logs |
| 99 | +docker-compose -f docker-compose.infra-sso.yml logs -f |
| 100 | + |
| 101 | +# View application logs |
| 102 | +docker-compose -f docker-compose.application.yml logs -f |
| 103 | + |
| 104 | +# View specific service logs |
| 105 | +docker-compose -f docker-compose.application.yml logs -f trust-da |
| 106 | +``` |
| 107 | + |
| 108 | +## Stopping Services |
| 109 | + |
| 110 | +```bash |
| 111 | +# Stop application |
| 112 | +docker-compose -f docker-compose.application.yml down |
| 113 | +# Stop Keycloak |
| 114 | +docker-compose -f docker-compose.infa-sso.yml down |
| 115 | +# Stop infrastructure |
| 116 | +docker-compose -f docker-compose.infrastructure.yml down |
| 117 | + |
| 118 | +# Stop everything and remove volumes |
| 119 | +docker-compose -f docker-compose.infrastructure.yml down -v |
| 120 | +docker-compose -f docker-compose.infra-sso.yml down |
| 121 | +docker-compose -f docker-compose.application.yml down |
| 122 | +``` |
| 123 | + |
| 124 | +## Data Persistence |
| 125 | + |
| 126 | +- **PostgreSQL data**: Stored in Docker volume `postgres_data` |
| 127 | +- **Redis data**: Stored in Docker volume `redis_data` |
| 128 | + |
| 129 | +To reset all data: |
| 130 | + |
| 131 | +```bash |
| 132 | +docker-compose -f docker-compose.infrastructure.yml down -v |
| 133 | +``` |
| 134 | + |
| 135 | +## Environment Variables |
| 136 | + |
| 137 | +Create a `.env` file based on `env.example` to customize: |
| 138 | + |
| 139 | +- `TRUSTIFY_CLIENT_ID`: Your Trustify client ID |
| 140 | +- `TRUSTIFY_CLIENT_SECRET`: Your Trustify client secret |
| 141 | +- `SENTRY_DSN`: Sentry DSN for error tracking |
| 142 | +- `TELEMETRY_WRITE_KEY`: Telemetry write key |
| 143 | + |
| 144 | +## Troubleshooting |
| 145 | + |
| 146 | +### Services not starting |
| 147 | + |
| 148 | +```bash |
| 149 | +# Check logs for errors |
| 150 | +docker-compose -f docker-compose.infrastructure.yml logs |
| 151 | +docker-compose -f docker-compose.application.yml logs |
| 152 | + |
| 153 | +# Restart services |
| 154 | +docker-compose -f docker-compose.infrastructure.yml restart |
| 155 | +docker-compose -f docker-compose.application.yml restart |
| 156 | +``` |
| 157 | + |
| 158 | +### Port conflicts |
| 159 | + |
| 160 | +If you have port conflicts, modify the port mappings in the compose files: |
| 161 | + |
| 162 | +```yaml |
| 163 | +ports: |
| 164 | + - "8082:8080" # Change 8081 to 8082 |
| 165 | +``` |
| 166 | +
|
| 167 | +### Network issues |
| 168 | +
|
| 169 | +The application uses an external network. If you encounter network issues: |
| 170 | +
|
| 171 | +```bash |
| 172 | +# Create the network manually |
| 173 | +docker network create trustify-network |
| 174 | +``` |
0 commit comments