Skip to content

Commit ae55a13

Browse files
committed
chore: update deployment resources
Signed-off-by: Ruben Romero Montes <[email protected]>
1 parent a8c449e commit ae55a13

12 files changed

+287
-441
lines changed

deploy/README-docker.md

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
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+
```
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
version: '3.8'
2+
3+
services:
4+
trust-da:
5+
image: trust-da:latest
6+
container_name: trustify-trust-da
7+
ports:
8+
- "8081:8080" # Application port
9+
- "9001:9000" # Management port
10+
environment:
11+
# Monitoring
12+
MONITORING_ENABLED: "false"
13+
14+
# Database
15+
DB_REDIS_HOST: redis
16+
DB_REDIS_PORT: 6379
17+
18+
# Trustify
19+
TRUSTIFY_HOST: ${TRUSTIFY_HOST:-https://rhtpa.stage.devshift.net/api/v2/}
20+
TRUSTIFY_CLIENT_ID: ${TRUSTIFY_CLIENT_ID:-your-trustify-client-id}
21+
TRUSTIFY_CLIENT_SECRET: ${TRUSTIFY_CLIENT_SECRET:-your-trustify-client-secret}
22+
TRUSTIFY_AUTH_SERVER_URL: http://keycloak:8080
23+
depends_on:
24+
redis:
25+
condition: service_healthy
26+
keycloak:
27+
condition: service_healthy
28+
healthcheck:
29+
test: ["CMD", "curl", "-f", "http://localhost:9000/q/health/ready"]
30+
interval: 30s
31+
timeout: 10s
32+
retries: 3
33+
restart: unless-stopped
34+
35+
networks:
36+
default:
37+
name: trustify-network
38+
external: true
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
version: '3.8'
2+
3+
services:
4+
keycloak:
5+
image: quay.io/keycloak/keycloak:26.4
6+
container_name: trustify-keycloak
7+
ports:
8+
- "8080:8080"
9+
environment:
10+
KEYCLOAK_ADMIN: admin
11+
KEYCLOAK_ADMIN_PASSWORD: admin123
12+
KC_DB: postgres
13+
KC_DB_URL: jdbc:postgresql://postgres:5432/trustify
14+
KC_DB_USERNAME: trustify
15+
KC_DB_PASSWORD: trustify123
16+
command: start-dev
17+
depends_on:
18+
postgres:
19+
condition: service_healthy
20+
healthcheck:
21+
test: ["CMD", "curl", "-f", "http://localhost:8080/health/ready"]
22+
interval: 30s
23+
timeout: 10s
24+
retries: 3
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
version: '3.8'
2+
3+
services:
4+
redis:
5+
image: redis:8-alpine
6+
container_name: trustify-redis
7+
ports:
8+
- "6379:6379"
9+
volumes:
10+
- redis_data:/data
11+
environment:
12+
- REDIS_PASSWORD=trustify123
13+
command: redis-server --requirepass trustify123
14+
healthcheck:
15+
test: ["CMD", "redis-cli", "--raw", "incr", "ping"]
16+
interval: 30s
17+
timeout: 10s
18+
retries: 3
19+
20+
postgres:
21+
image: postgres:18-alpine
22+
container_name: trustify-postgres
23+
ports:
24+
- "5432:5432"
25+
environment:
26+
POSTGRES_DB: trustify
27+
POSTGRES_USER: trustify
28+
POSTGRES_PASSWORD: trustify123
29+
volumes:
30+
- postgres_data:/var/lib/postgresql/data
31+
healthcheck:
32+
test: ["CMD-SHELL", "pg_isready -U trustify -d trustify"]
33+
interval: 30s
34+
timeout: 10s
35+
retries: 3
36+
37+
volumes:
38+
redis_data:
39+
postgres_data:

deploy/env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Trustify Configuration
2+
TRUSTIFY_HOST=http://trustify.example.com/api/v2/
3+
TRUSTIFY_CLIENT_ID=your-trustify-client-id
4+
TRUSTIFY_CLIENT_SECRET=your-trustify-client-secret

deploy/monitoring.yaml

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)