diff --git a/.env.standalone.example b/.env.standalone.example index 63bdd3f..71318bc 100644 --- a/.env.standalone.example +++ b/.env.standalone.example @@ -1,7 +1,7 @@ REDIS_USERNAME= REDIS_PASSWORD= -DB_HOST= +DB_HOST=postgres-service:5432 DB_NAME= DB_USERNAME= DB_PASSWORD= diff --git a/docker-compose.yml b/docker-compose.yml index e099155..71a9056 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,11 +6,12 @@ volumes: services: redis: + env_file: + - .env image: redis/redis-stack-server:7.4.0-v0 environment: # CHANGE THE PASSWORD TO A PASSWORD YOU WANT TO USE REDIS_ARGS: "--requirepass ${REDIS_PASSWORD} --user ${REDIS_USERNAME} on >${REDIS_PASSWORD} ~* allcommands" - healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 5s @@ -21,17 +22,21 @@ services: volumes: - redis-volume:/data - postgres: + postgres-service: + env_file: + - .env image: postgres:15.7 environment: POSTGRES_DB: ${DB_NAME} POSTGRES_USER: ${DB_USERNAME} POSTGRES_PASSWORD: ${DB_PASSWORD} healthcheck: - test: usr/bin/pg_isready + test: ["CMD-SHELL", "pg_isready -U ${DB_USERNAME}"] interval: 5s timeout: 5s retries: 5 + ports: + - "5432:5432" expose: - 5432 volumes: @@ -106,11 +111,12 @@ services: condition: service_healthy worker-api: + env_file: + - .env + platform: linux/amd64 build: context: . dockerfile: Dockerfile - env_file: - - .env environment: RUNTIME_ENV: local SERVER_PORT: 8081 @@ -118,34 +124,39 @@ services: VALIDATOR_MIN_STAKE: 20000 CORS_ALLOWED_ORIGINS: http://localhost* SUBSTRATE_API_URL: sidecar:8080 - ETHEREUM_NODE: ${ETHEREUM_NODE} # authentication TOKEN_EXPIRY: 24 - JWT_SECRET: ${JWT_SECRET} - # postgres - DB_NAME: ${DB_NAME} - DB_HOST: ${DB_HOST} - DB_USERNAME: ${DB_USERNAME} - DB_PASSWORD: ${DB_PASSWORD} - DATABASE_URL: postgresql://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOST}/${DB_NAME} - # aws s3 setup - AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID} - AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY} - AWS_S3_BUCKET_NAME: ${AWS_S3_BUCKET_NAME} - S3_PUBLIC_URL: ${S3_PUBLIC_URL} - # redis - REDIS_USERNAME: ${REDIS_USERNAME} - REDIS_PASSWORD: ${REDIS_PASSWORD} REDIS_HOST: localhost REDIS_PORT: 6379 - + # these envs get sourced from .env so we dont need to rebuild + # # postgres + # ETHEREUM_NODE: ${ETHEREUM_NODE} + # JWT_SECRET: ${JWT_SECRET} + # DB_NAME: ${DB_NAME} + # DB_HOST: ${DB_HOST} + # DB_USERNAME: ${DB_USERNAME} + # DB_PASSWORD: ${DB_PASSWORD} + # DATABASE_URL: postgresql://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOST}/${DB_NAME} + # # aws s3 setup + # AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID} + # AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY} + # AWS_S3_BUCKET_NAME: ${AWS_S3_BUCKET_NAME} + # S3_PUBLIC_URL: ${S3_PUBLIC_URL} + # # redis + # REDIS_USERNAME: ${REDIS_USERNAME} + # REDIS_PASSWORD: ${REDIS_PASSWORD} ports: - - "8081:8080" + - "8080:8081" depends_on: redis: condition: service_healthy - postgres: + postgres-service: condition: service_healthy sidecar: condition: service_healthy - command: ["./service"] + command: ["./service", "--debug"] + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8081"] + interval: 10s + timeout: 10s + retries: 5