Deployment
The backend need to be deployed first before run the frontend container.
Docker compose for backend
In order to deploy in docker compose, the backend with all 5 microservices need to be deployed in one signal docker compose and the frontend needs to be running standalone and plug into the docker compose network. In this case the docker compose network names is atos_network
Here is a YAML of docker compose for the backend deployment
version: '3.8'
services:
zookeeper:
container_name: zookeeper
image: confluentinc/cp-zookeeper:latest
depends_on:
- card-service-db
- gameappbff-db
- game-service-db
- round-service-db
- lobby-service-db
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
ports:
- 22181:2181
networks:
- atos_network
healthcheck:
test: nc -z zookeeper 2181 || exit -1
start_period: 15s
interval: 5s
timeout: 10s
retries: 10
kafka:
image: confluentinc/cp-kafka:latest
container_name: kafka
depends_on:
- zookeeper
- card-service-db
- gameappbff-db
- game-service-db
- round-service-db
- lobby-service-db
ports:
- 29092:29092
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,PLAINTEXT_HOST://localhost:29092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
deploy:
restart_policy:
condition: on-failure
delay: 45s
max_attempts: 3
window: 180s
networks:
- atos_network
healthcheck:
test: nc -z kafka 9092 || exit -1
start_period: 15s
interval: 5s
timeout: 10s
retries: 10
kpow:
image: factorhouse/kpow-ce
container_name: kpow
ports:
- 3000:3000
deploy:
restart_policy:
condition: on-failure
delay: 45s
max_attempts: 3
window: 180s
networks:
- atos_network
card-service-db:
image: mysql:latest
container_name: card-service-db
command: --default-authentication-plugin=mysql_native_password
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: card_db
MYSQL_USER: myuser
MYSQL_PASSWORD: mypassword
ports:
- 3307:3306
deploy:
restart_policy:
condition: on-failure
delay: 45s
max_attempts: 3
window: 180s
networks:
- atos_network
round-service-db:
image: mysql:latest
container_name: round-service-db
command: --default-authentication-plugin=mysql_native_password
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: round_db
MYSQL_USER: myuser
MYSQL_PASSWORD: mypassword
ports:
- 3308:3306
deploy:
restart_policy:
condition: on-failure
delay: 45s
max_attempts: 3
window: 180s
networks:
- atos_network
lobby-service-db:
image: mysql:latest
container_name: lobby-service-db
command: --default-authentication-plugin=mysql_native_password
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: lobby_db
MYSQL_USER: myuser
MYSQL_PASSWORD: mypassword
ports:
- 3309:3306
deploy:
restart_policy:
condition: on-failure
delay: 45s
max_attempts: 3
window: 180s
networks:
- atos_network
gameappbff-db:
image: mysql:latest
container_name: gameappbff-db
command: --default-authentication-plugin=mysql_native_password
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: gameappbff_db
MYSQL_USER: myuser
MYSQL_PASSWORD: mypassword
ports:
- 3310:3306
deploy:
restart_policy:
condition: on-failure
delay: 45s
max_attempts: 3
window: 180s
networks:
- atos_network
game-service-db:
image: mysql:latest
container_name: game-service-db
command: --default-authentication-plugin=mysql_native_password
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: game_db
MYSQL_USER: myuser
MYSQL_PASSWORD: mypassword
ports:
- 3312:3306
deploy:
restart_policy:
condition: on-failure
delay: 45s
max_attempts: 3
window: 180s
volumes:
- db:/var/lib/mysql
networks:
- atos_network
adminer:
image: adminer:latest
container_name: adminer
ports:
- 8080:8080
deploy:
restart_policy:
condition: on-failure
delay: 45s
max_attempts: 3
window: 180s
networks:
- atos_network
game-app:
image: fhictdev/eviden-game_app-fe:latest
container_name: game-app
ports:
- 80:80
environment:
- PORT=3001
- HTTPS=false
- REACT_APP_SERVER_HOST_IP="0.0.0.0"
depends_on:
- game-service
- gameappbff
- round-service
- lobby-service
- card-service
restart: no
deploy:
restart_policy:
condition: on-failure
delay: 45s
max_attempts: 3
window: 180s
networks:
- atos_network
card-service:
image: fhictdev/eviden-card-svc:csr-v3
container_name: card-service
ports:
- 8001:8001
environment:
- SPRING_DATASOURCE_URL=jdbc:mysql://card-service-db/card_db?useSSL=false
- SPRING_KAFKA_BOOTSTRAP_SERVERS=kafka:9092
- SPRING_DATASOURCE_USERNAME=root
- SPRING_DATASOURCE_PASSWORD=root
- SPRING_RESOURCES_STATIC_LOCATIONS=classpath:/data.cards/
depends_on:
kafka:
condition: service_healthy
restart: no
deploy:
restart_policy:
condition: on-failure
delay: 45s
max_attempts: 3
window: 180s
networks:
- atos_network
gameappbff:
image: fhictdev/eviden-game-app-bff:csr-v3
container_name: gameappbff
ports:
- 8004:8004
environment:
- SPRING_DATASOURCE_URL=jdbc:mysql://gameappbff-db/gameappbff_db?useSSL=false
- SPRING_KAFKA_BOOTSTRAP_SERVERS=kafka:9092
- SPRING_DATASOURCE_USERNAME=myuser
- SPRING_DATASOURCE_PASSWORD=mypassword
restart: no
deploy:
restart_policy:
condition: on-failure
delay: 45s
max_attempts: 3
window: 180s
depends_on:
kafka:
condition: service_healthy
networks:
- atos_network
round-service:
image: fhictdev/eviden-round-svc:csr-v3
container_name: round-service
ports:
- 8002:8002
environment:
- SPRING_DATASOURCE_URL=jdbc:mysql://round-service-db:3306/round_db?useSSL=false
- SPRING_KAFKA_BOOTSTRAP_SERVERS=kafka:9092
- SPRING_DATASOURCE_USERNAME=myuser
- SPRING_DATASOURCE_PASSWORD=mypassword
depends_on:
kafka:
condition: service_healthy
restart: no
deploy:
restart_policy:
condition: on-failure
delay: 45s
max_attempts: 3
window: 180s
networks:
- atos_network
lobby-service:
image: fhictdev/eviden-lobby-svs:csr-v3
container_name: lobby-service
ports:
- 8006:8006
environment:
- SPRING_DATASOURCE_URL=jdbc:mysql://lobby-service-db:3306/lobby_db?useSSL=false
- SPRING_KAFKA_BOOTSTRAP_SERVERS=kafka:9092
- SPRING_DATASOURCE_USERNAME=myuser
- SPRING_DATASOURCE_PASSWORD=mypassword
depends_on:
kafka:
condition: service_healthy
restart: no
networks:
- atos_network
game-service:
image: fhictdev/eviden-game-svc:csr-v3
container_name: game-service
ports:
- 8005:8005
environment:
- SPRING_DATASOURCE_URL=jdbc:mysql://game-service-db:3306/game_db?useSSL=false
- SPRING_KAFKA_BOOTSTRAP_SERVERS=kafka:9092
- SPRING_DATASOURCE_USERNAME=root
- SPRING_DATASOURCE_PASSWORD=root
depends_on:
kafka:
condition: service_healthy
restart: no
networks:
- atos_network
volumes:
db:
networks:
atos_network:
driver: bridge
Docker Container Frontend
For the frontend the docker container need to be running standalone and connect to the same docker network as the docker compose that is setup during the previous steps.
Here is an example of how to run the container and connect to the same docker network in one go.
Networking with standalone docker containers by Docker Docs (opens in a new tab).
docker run -d -p 80:3001 --network=atos_network fhictdev/eviden-game_fewith env file
docker run -d -p 80:3001 --network=atos_network fhictdev/eviden-game_fe --env-file=.envEnvironment file example
PORT=3001
HTTPS=false
REACT_APP_SERVER_HOST_IP="10.10.10.100"