Skip to content

Commit a99eefe

Browse files
Fix: Improve Docker Compose configuration and security (#911)
Co-authored-by: Dave Earley <[email protected]>
1 parent bd6b8bd commit a99eefe

File tree

4 files changed

+25
-27
lines changed

4 files changed

+25
-27
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
/.idea/**
66
frontend/.env
77
backend/.env
8+
docker/all-in-one/.env
89
todo.md
910
CLAUDE.md
1011
/prompts/**

docker/all-in-one/.env renamed to docker/all-in-one/.env.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ APP_DISABLE_REGISTRATION=false
2323
APP_SAAS_MODE_ENABLED=false
2424
APP_SAAS_STRIPE_APPLICATION_FEE_PERCENT=0
2525
APP_SAAS_STRIPE_APPLICATION_FEE_FIXED=0
26+
APP_EMAIL_LOGO_URL=
27+
APP_EMAIL_LOGO_LINK_URL=
2628

2729
# Email settings (Using log mailer for local testing)
2830
MAIL_MAILER=log
@@ -40,6 +42,9 @@ FILESYSTEM_PUBLIC_DISK=public
4042
FILESYSTEM_PRIVATE_DISK=local
4143

4244
# Database settings
45+
POSTGRES_DB=hi-events
46+
POSTGRES_USER=postgres
47+
POSTGRES_PASSWORD=secret
4348
DATABASE_URL=postgresql://postgres:secret@postgres:5432/hi-events
4449

4550
# Stripe settings (Replace with valid test keys if necessary)

docker/all-in-one/README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@ git clone [email protected]:HiEventsDev/hi.events.git
1616
cd hi.events/docker/all-in-one
1717
```
1818

19-
### Step 2: Generate the `APP_KEY` and `JWT_SECRET`
19+
### Step 2: Copy the Environment File
20+
21+
```bash
22+
cp .env.example .env
23+
```
24+
25+
### Step 3: Generate the `APP_KEY` and `JWT_SECRET`
2026

2127
Generate the keys using the following commands:
2228

@@ -38,7 +44,7 @@ for /f "tokens=*" %i in ('openssl rand -base64 32') do @echo JWT_SECRET=%i
3844
[Convert]::ToBase64String([System.Security.Cryptography.RandomNumberGenerator]::GetBytes(32)) # For JWT_SECRET
3945
```
4046

41-
### Step 3: Update the `.env` File
47+
### Step 4: Update the `.env` File
4248

4349
Update the `.env` file located in `./docker/all-in-one/.env` with the generated `APP_KEY` and `JWT_SECRET`:
4450

@@ -47,13 +53,13 @@ APP_KEY=your_generated_app_key
4753
JWT_SECRET=your_generated_jwt_secret
4854
```
4955

50-
### Step 4: Start the Docker Containers
56+
### Step 5: Start the Docker Containers
5157

5258
```bash
5359
docker compose up -d
5460
```
5561

56-
### Step 5: Create an Account
62+
### Step 6: Create an Account
5763

5864
Visit [http://localhost:8123/auth/register](http://localhost:8123/auth/register) to create an account.
5965

docker/all-in-one/docker-compose.yml

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@ services:
33
build:
44
context: ./../../
55
dockerfile: Dockerfile.all-in-one
6-
container_name: all-in-one
6+
restart: unless-stopped
77
ports:
88
- "8123:80"
9-
networks:
10-
- hi-events-network
119
environment:
1210
- VITE_FRONTEND_URL=${VITE_FRONTEND_URL}
1311
- VITE_API_URL_CLIENT=${VITE_API_URL_CLIENT}
@@ -37,7 +35,7 @@ services:
3735
- MAIL_FROM_NAME=${MAIL_FROM_NAME}
3836
- FILESYSTEM_PUBLIC_DISK=${FILESYSTEM_PUBLIC_DISK}
3937
- FILESYSTEM_PRIVATE_DISK=${FILESYSTEM_PRIVATE_DISK}
40-
- DATABASE_URL=postgresql://postgres:secret@postgres:5432/hi-events
38+
- DATABASE_URL=postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-secret}@postgres:5432/${POSTGRES_DB:-hi-events}
4139
- REDIS_HOST=redis
4240
- REDIS_PASSWORD=
4341
- REDIS_PORT=6379
@@ -53,43 +51,31 @@ services:
5351
condition: service_healthy
5452

5553
redis:
56-
image: redis:latest
57-
container_name: redis
58-
networks:
59-
- hi-events-network
54+
image: redis:7-alpine
55+
restart: unless-stopped
6056
healthcheck:
6157
test: [ "CMD", "redis-cli", "ping" ]
6258
interval: 10s
6359
timeout: 5s
6460
retries: 5
65-
ports:
66-
- "6379:6379"
6761
volumes:
6862
- redisdata:/data
6963

7064
postgres:
71-
image: postgres:17
72-
container_name: postgres
73-
networks:
74-
- hi-events-network
65+
image: postgres:17-alpine
66+
restart: unless-stopped
7567
healthcheck:
7668
test: [ "CMD-SHELL", "pg_isready -U postgres" ]
7769
interval: 10s
7870
timeout: 5s
7971
retries: 5
8072
environment:
81-
POSTGRES_DB: hi-events
82-
POSTGRES_USER: postgres
83-
POSTGRES_PASSWORD: secret
73+
POSTGRES_DB: ${POSTGRES_DB:-hi-events}
74+
POSTGRES_USER: ${POSTGRES_USER:-postgres}
75+
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-secret}
8476
volumes:
8577
- pgdata:/var/lib/postgresql/data
8678

87-
networks:
88-
hi-events-network:
89-
driver: bridge
90-
9179
volumes:
9280
pgdata:
93-
driver: local
9481
redisdata:
95-
driver: local

0 commit comments

Comments
 (0)