- add: docker-compose.yml to run the services

- add: .env.example for the config for docker
This commit is contained in:
2024-12-15 01:50:55 -05:00
parent 1b2d6bdac2
commit 277d25a820
2 changed files with 119 additions and 0 deletions

21
.env.example Executable file
View File

@@ -0,0 +1,21 @@
LOG_LEVEL=info
REDIS_URL=redis://:super_safe_password@127.0.0.1:6379/0
LISTEN_ADDR=0.0.0.0
CONSUL_URL=http://consul:8500
POSTGRES_USER=osirose
POSTGRES_PASSWORD=super_safe_postgres_password
POSTGRES_DB=osirose
# Define service addresses for consul.
# This will set the service address in consul to what ever is placed here.
# This can be a IP address or the container name in docker
AUTH_SERVICE_ADDR=auth-service
API_SERVICE_ADDR=api-service
CHARACTER_SERVICE_ADDR=character-service
DATABASE_SERVICE_ADDR=database-service
PACKET_SERVICE_ADDR=packet-service
WORLD_SERVICE_ADDR=world-service
#<Service Name>_SERVICE_PORT=<PORT> # Replace Service name with the service and port with the port you want to run it on. Ex. AUTH_SERVICE_PORT=30000
#JWT_SECRET=safe_jwt_secret # This is only used for auth-service and is required.
#HEALTH_CHECK_PORT=8080 # This will change the health check port for the services

98
docker-compose.yml Executable file
View File

@@ -0,0 +1,98 @@
services:
auth-service:
build:
context: ./
dockerfile: ./auth-service/Dockerfile
ports:
- "50051:50051"
env_file:
- ./auth-service/.env
- .env
environment:
- HEALTH_CHECK_PORT=8080
depends_on:
- database-service
- consul
api-service:
build:
context: ./
dockerfile: ./api-service/Dockerfile
ports:
- "8080:8080"
env_file:
- ./api-service/.env
- .env
depends_on:
- auth-service
- consul
database-service:
build:
context: ./
dockerfile: ./database-service/Dockerfile
ports:
- "50052:50052"
env_file:
- ./database-service/.env
- .env
depends_on:
- db
- consul
character-service:
build:
context: ./
dockerfile: ./character-service/Dockerfile
ports:
- "50053:50053"
env_file:
- ./character-service/.env
- .env
depends_on:
- auth-service
- consul
world-service:
build:
context: ./
dockerfile: ./world-service/Dockerfile
ports:
- "50054:50054"
env_file:
- ./world-service/.env
- .env
depends_on:
- auth-service
- consul
packet-service:
build:
context: ./
dockerfile: ./packet-service/Dockerfile
ports:
- "4000:4000"
env_file:
- ./packet-service/.env
- .env
depends_on:
- auth-service
- consul
db:
image: postgres:17
env_file:
- .env
ports:
- "5432:5432"
volumes:
- db_data:/var/lib/postgresql/data
consul:
image: consul:1.15.4
command: agent -dev -client=0.0.0.0
ports:
- "8500:8500"
volumes:
db_data: