11# Docker Deployment Guide
22
3- This guide covers deploying the Accord Chat application (backend and web application) using Docker and Docker Compose.
3+ This guide covers deploying the Accordion Chat application (backend and web application) using Docker and Docker Compose.
44
55## Quick Start
66
@@ -68,13 +68,13 @@ nano .env # or use your preferred editor
6868** Important** : The webapp uses TWO sets of backend URLs:
6969
70701 . ** Server-side URLs** (webapp server → backend server, internal Docker network):
71- - ` ACCORD_BACKEND_URL ` : Backend API base URL (default: ` http://backend:8080 ` )
72- - ` ACCORD_BACKEND_WS_URL ` : Backend WebSocket URL (default: ` http://backend:8080/ws ` )
71+ - ` ACCORDION_BACKEND_URL ` : Backend API base URL (default: ` http://backend:8080 ` )
72+ - ` ACCORDION_BACKEND_WS_URL ` : Backend WebSocket URL (default: ` http://backend:8080/ws ` )
7373 - Uses Docker service name ` backend ` for internal communication
7474
75752 . ** Client-side URLs** (browser → backend server, must be publicly accessible):
76- - ` ACCORD_BACKEND_CLIENT_URL ` : Backend API base URL for browser (default: ` http://localhost:8080 ` )
77- - ` ACCORD_BACKEND_CLIENT_WS_URL ` : Backend WebSocket URL for browser (default: ` http://localhost:8080/ws ` )
76+ - ` ACCORDION_BACKEND_CLIENT_URL ` : Backend API base URL for browser (default: ` http://localhost:8080 ` )
77+ - ` ACCORDION_BACKEND_CLIENT_WS_URL ` : Backend WebSocket URL for browser (default: ` http://localhost:8080/ws ` )
7878 - ** Must use ` localhost ` or your public domain** - browsers cannot resolve Docker service names
7979
8080### Example: Custom Ports
@@ -89,12 +89,12 @@ WEBAPP_PORT=4000 # Host port for webapp
8989WEBAPP_SERVER_PORT=4000 # Container port for webapp
9090
9191# Server-side backend URLs (webapp server → backend, internal Docker network)
92- ACCORD_BACKEND_URL =http://backend:9090
93- ACCORD_BACKEND_WS_URL =http://backend:9090/ws
92+ ACCORDION_BACKEND_URL =http://backend:9090
93+ ACCORDION_BACKEND_WS_URL =http://backend:9090/ws
9494
9595# Client-side backend URLs (browser → backend, must use localhost or public domain)
96- ACCORD_BACKEND_CLIENT_URL =http://localhost:9090
97- ACCORD_BACKEND_CLIENT_WS_URL =http://localhost:9090/ws
96+ ACCORDION_BACKEND_CLIENT_URL =http://localhost:9090
97+ ACCORDION_BACKEND_CLIENT_WS_URL =http://localhost:9090/ws
9898```
9999
100100** Important Notes:**
@@ -129,39 +129,39 @@ The `compose.yml` file provides a complete configuration for running both servic
129129### Building the Image
130130
131131``` bash
132- docker build -t accord -backend:latest .
132+ docker build -t accordion -backend:latest .
133133```
134134
135135### Running the Container
136136
137137``` bash
138138docker run -d \
139139 -p 8080:8080 \
140- --name accord -backend \
141- accord -backend:latest
140+ --name accordion -backend \
141+ accordion -backend:latest
142142```
143143
144144### Viewing Logs
145145
146146``` bash
147147# Follow logs
148- docker logs -f accord -backend
148+ docker logs -f accordion -backend
149149
150150# View last 100 lines
151- docker logs --tail 100 accord -backend
151+ docker logs --tail 100 accordion -backend
152152```
153153
154154### Stopping and Removing
155155
156156``` bash
157157# Stop the container
158- docker stop accord -backend
158+ docker stop accordion -backend
159159
160160# Remove the container
161- docker rm accord -backend
161+ docker rm accordion -backend
162162
163163# Remove the image
164- docker rmi accord -backend:latest
164+ docker rmi accordion -backend:latest
165165```
166166
167167## Environment Variables
@@ -174,8 +174,8 @@ Configure the application using environment variables:
174174docker run -d \
175175 -p 8080:8080 \
176176 -e APP_CORS_ALLOWED_ORIGINS=" https://yourdomain.com,https://app.yourdomain.com" \
177- --name accord -backend \
178- accord -backend:latest
177+ --name accordion -backend \
178+ accordion -backend:latest
179179```
180180
181181### Validation Configuration
@@ -186,8 +186,8 @@ docker run -d \
186186 -e APP_USERNAME_MIN_LENGTH=5 \
187187 -e APP_USERNAME_MAX_LENGTH=30 \
188188 -e APP_MESSAGE_MAX_LENGTH=500 \
189- --name accord -backend \
190- accord -backend:latest
189+ --name accordion -backend \
190+ accordion -backend:latest
191191```
192192
193193### All Available Environment Variables
@@ -209,7 +209,7 @@ The container includes automatic health checks that ping the `/api/messages` end
209209Check health status:
210210
211211``` bash
212- docker inspect --format=' {{.State.Health.Status}}' accord -backend
212+ docker inspect --format=' {{.State.Health.Status}}' accordion -backend
213213```
214214
215215## Production Deployment
@@ -248,8 +248,8 @@ For production, replace H2 with PostgreSQL or MySQL:
248248services :
249249 backend :
250250 environment :
251- - SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/accorddb
252- - SPRING_DATASOURCE_USERNAME=accord
251+ - SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/accordiondb
252+ - SPRING_DATASOURCE_USERNAME=accordion
253253 - SPRING_DATASOURCE_PASSWORD=secure_password
254254 - SPRING_JPA_DATABASE_PLATFORM=org.hibernate.dialect.PostgreSQLDialect
255255 depends_on :
@@ -258,8 +258,8 @@ services:
258258 postgres :
259259 image : postgres:15-alpine
260260 environment :
261- - POSTGRES_DB=accorddb
262- - POSTGRES_USER=accord
261+ - POSTGRES_DB=accordiondb
262+ - POSTGRES_USER=accordion
263263 - POSTGRES_PASSWORD=secure_password
264264 volumes :
265265 - postgres_data:/var/lib/postgresql/data
@@ -276,23 +276,23 @@ When running the frontend on the host machine and backend in Docker:
276276
277277` ` ` bash
278278# Frontend connects to backend
279- ./gradlew desktop:run -Daccord .websocket.url=ws://localhost:8080/ws
279+ ./gradlew desktop:run -Daccordion .websocket.url=ws://localhost:8080/ws
280280```
281281
282282### Running Multiple Services
283283
284- The compose configuration uses a bridge network (` accord -network` ) that allows for future service expansion:
284+ The compose configuration uses a bridge network (` accordion -network` ) that allows for future service expansion:
285285
286286``` yaml
287287services :
288288 backend :
289289 networks :
290- - accord -network
290+ - accordion -network
291291
292292 # Add more services here
293293 # frontend-web:
294294 # networks:
295- # - accord -network
295+ # - accordion -network
296296```
297297
298298## Troubleshooting
@@ -308,13 +308,13 @@ If the web application shows "Could not connect to server" errors:
3083081 . ** Check your ` .env ` file has BOTH URL sets** :
309309 ``` bash
310310 # Server-side URLs (webapp server → backend, internal Docker network)
311- ACCORD_BACKEND_URL =http://backend:8080
312- ACCORD_BACKEND_WS_URL =http://backend:8080/ws
311+ ACCORDION_BACKEND_URL =http://backend:8080
312+ ACCORDION_BACKEND_WS_URL =http://backend:8080/ws
313313
314314 # Client-side URLs (browser → backend, must use localhost or public domain)
315315 DOCKER_HOST_IP=localhost
316- ACCORD_BACKEND_CLIENT_URL =http://localhost:8080
317- ACCORD_BACKEND_CLIENT_WS_URL =http://localhost:8080/ws
316+ ACCORDION_BACKEND_CLIENT_URL =http://localhost:8080
317+ ACCORDION_BACKEND_CLIENT_WS_URL =http://localhost:8080/ws
318318 ```
319319
3203202 . ** If using custom ports** , update the client URLs:
@@ -323,15 +323,15 @@ If the web application shows "Could not connect to server" errors:
323323 BACKEND_PORT=9090
324324 SERVER_PORT=9090
325325 DOCKER_HOST_IP=localhost
326- ACCORD_BACKEND_CLIENT_URL =http://${DOCKER_HOST_IP} :9090
327- ACCORD_BACKEND_CLIENT_WS_URL =http://${DOCKER_HOST_IP} :9090/ws
326+ ACCORDION_BACKEND_CLIENT_URL =http://${DOCKER_HOST_IP} :9090
327+ ACCORDION_BACKEND_CLIENT_WS_URL =http://${DOCKER_HOST_IP} :9090/ws
328328 ```
329329
3303303 . ** For production with a public domain** :
331331 ``` bash
332332 DOCKER_HOST_IP=yourdomain.com
333- ACCORD_BACKEND_CLIENT_URL =https://${DOCKER_HOST_IP}
334- ACCORD_BACKEND_CLIENT_WS_URL =https://${DOCKER_HOST_IP} /ws
333+ ACCORDION_BACKEND_CLIENT_URL =https://${DOCKER_HOST_IP}
334+ ACCORDION_BACKEND_CLIENT_WS_URL =https://${DOCKER_HOST_IP} /ws
335335 ```
336336
3373374 . ** Rebuild and restart** :
@@ -361,8 +361,8 @@ To access the web application from other devices on your local network (e.g., ph
361361 ``` bash
362362 DOCKER_HOST_IP=192.168.1.100
363363 # URLs will automatically resolve using the DOCKER_HOST_IP variable:
364- # ACCORD_BACKEND_CLIENT_URL =http://${DOCKER_HOST_IP}:8080
365- # ACCORD_BACKEND_CLIENT_WS_URL =http://${DOCKER_HOST_IP}:8080/ws
364+ # ACCORDION_BACKEND_CLIENT_URL =http://${DOCKER_HOST_IP}:8080
365+ # ACCORDION_BACKEND_CLIENT_WS_URL =http://${DOCKER_HOST_IP}:8080/ws
366366 ```
367367
3683683 . ** Update CORS to allow network access** :
@@ -398,10 +398,10 @@ If you change ports and the backend service hangs or the health check fails:
398398 ``` bash
399399 # In .env file
400400 SERVER_PORT=9090
401- ACCORD_BACKEND_URL =http://backend:9090
402- ACCORD_BACKEND_WS_URL =http://backend:9090/ws
403- ACCORD_BACKEND_CLIENT_URL =http://localhost:9090
404- ACCORD_BACKEND_CLIENT_WS_URL =http://localhost:9090/ws
401+ ACCORDION_BACKEND_URL =http://backend:9090
402+ ACCORDION_BACKEND_WS_URL =http://backend:9090/ws
403+ ACCORDION_BACKEND_CLIENT_URL =http://localhost:9090
404+ ACCORDION_BACKEND_CLIENT_WS_URL =http://localhost:9090/ws
405405 ```
406406
4074072 . ** Use matching internal/external ports for simplicity** :
@@ -472,8 +472,8 @@ For development, mount the source code as a volume:
472472docker run -d \
473473 -p 8080:8080 \
474474 -v $( pwd) /backend/src:/app/src \
475- --name accord -backend-dev \
476- accord -backend:latest
475+ --name accordion -backend-dev \
476+ accordion -backend:latest
477477```
478478
479479### Debugging
@@ -485,8 +485,8 @@ docker run -d \
485485 -p 8080:8080 \
486486 -p 5005:5005 \
487487 -e JAVA_TOOL_OPTIONS=" -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005" \
488- --name accord -backend \
489- accord -backend:latest
488+ --name accordion -backend \
489+ accordion -backend:latest
490490```
491491
492492Connect your IDE debugger to ` localhost:5005 ` .
@@ -505,12 +505,12 @@ The Dockerfile uses multi-stage builds to create a minimal runtime image:
505505
506506``` yaml
507507- name : Build Docker Image
508- run : docker build -t accord -backend:${{ github.sha }} .
508+ run : docker build -t accordion -backend:${{ github.sha }} .
509509
510510- name : Push to Registry
511511 run : |
512- docker tag accord -backend:${{ github.sha }} ghcr.io/username/accord -backend:latest
513- docker push ghcr.io/username/accord -backend:latest
512+ docker tag accordion -backend:${{ github.sha }} ghcr.io/username/accordion -backend:latest
513+ docker push ghcr.io/username/accordion -backend:latest
514514` ` `
515515
516516## Additional Resources
0 commit comments