diff --git a/auth-domain/docker-compose.dev.yml b/auth-domain/docker-compose.dev.yml new file mode 100644 index 0000000..8600468 --- /dev/null +++ b/auth-domain/docker-compose.dev.yml @@ -0,0 +1,27 @@ +version: '3.8' + +services: + usermanager-api-dev: + extends: + file: docker-template.yml + service: usermanager-api + container_name: fids_usermanager_api_dev + environment: + - DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASS}@usermanager-db-dev/${POSTGRES_DB} + depends_on: + usermanager-db-dev: + condition: service_healthy + networks: + - auth-dev + + usermanager-db-dev: + extends: + file: docker-template.yml + service: usermanager-db + container_name: fids_usermanager_db_dev + networks: + - auth-dev + +networks: + auth-dev: + driver: bridge diff --git a/auth-domain/docker-compose.yml b/auth-domain/docker-compose.yml index ed2403d..c6686cc 100644 --- a/auth-domain/docker-compose.yml +++ b/auth-domain/docker-compose.yml @@ -2,19 +2,9 @@ version: '3.8' services: usermanager-api: - container_name: fids_usermanager_api - image: ${API_IMAGE} - healthcheck: - test: ["CMD", "nc", "-vz", "-w1", "localhost", "5000"] - interval: 2s - timeout: 2s - retries: 5 - start_period: 2s - environment: - - TEST_TARGET=${TEST_TARGET} - - PORT=5000 - - DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASS}@usermanager-db/${POSTGRES_DB} - - APP_SETTINGS=${APP_SETTINGS} + extends: + file: docker-template.yml + service: usermanager-api depends_on: usermanager-db: condition: service_healthy @@ -22,24 +12,17 @@ services: - auth usermanager-db: - container_name: fids_usermanager_db - build: - context: ./db - dockerfile: Dockerfile - healthcheck: - test: psql postgres --command "select 1" -U ${POSTGRES_USER} - interval: 2s - timeout: 10s - retries: 10 - start_period: 2s - expose: - - 5432 - environment: - - POSTGRES_USER=${POSTGRES_USER} - - POSTGRES_PASSWORD=${POSTGRES_PASS} + extends: + file: docker-template.yml + service: usermanager-db + volumes: + - flights_db:/var/lib/postgresql/data networks: - auth networks: auth: driver: bridge + +volumes: + flights_db: diff --git a/auth-domain/docker-template.yml b/auth-domain/docker-template.yml new file mode 100644 index 0000000..ac70624 --- /dev/null +++ b/auth-domain/docker-template.yml @@ -0,0 +1,34 @@ +version: '3.8' + +services: + usermanager-api: + container_name: fids_usermanager_api + image: ${API_IMAGE} + healthcheck: + test: ["CMD", "nc", "-vz", "-w1", "localhost", "5000"] + interval: 2s + timeout: 2s + retries: 5 + start_period: 2s + environment: + - TEST_TARGET=${TEST_TARGET} + - PORT=5000 + - DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASS}@usermanager-db/${POSTGRES_DB} + - APP_SETTINGS=${APP_SETTINGS} + + usermanager-db: + container_name: fids_usermanager_db + build: + context: ./db + dockerfile: Dockerfile + healthcheck: + test: psql postgres --command "select 1" -U ${POSTGRES_USER} + interval: 2s + timeout: 10s + retries: 10 + start_period: 2s + expose: + - 5432 + environment: + - POSTGRES_USER=${POSTGRES_USER} + - POSTGRES_PASSWORD=${POSTGRES_PASS} diff --git a/auth-domain/user-manager/src/config.py b/auth-domain/user-manager/src/config.py index 7387ace..a7ba373 100644 --- a/auth-domain/user-manager/src/config.py +++ b/auth-domain/user-manager/src/config.py @@ -16,7 +16,7 @@ class DevelopmentConfig(BaseConfig): class TestingConfig(BaseConfig): TESTING = True - SQLALCHEMY_DATABASE_URI = os.environ.get("DATABASE_TEST_URL") + SQLALCHEMY_DATABASE_URI = os.environ.get("DATABASE_URL") BCRYPT_LOG_ROUNDS = 4 ACCESS_TOKEN_EXPIRATION = 5 REFRESH_TOKEN_EXPIRATION = 5 diff --git a/flights-domain/docker-compose.dev.yml b/flights-domain/docker-compose.dev.yml new file mode 100644 index 0000000..1f78cb7 --- /dev/null +++ b/flights-domain/docker-compose.dev.yml @@ -0,0 +1,31 @@ +version: '3.8' + +services: + flights-api-dev: + extends: + file: docker-template.yml + service: flights-api + container_name: fids_flights_api_dev + environment: + - DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASS}@flights-api-db-dev/${POSTGRES_DB} + depends_on: + flights-api-db-dev: + condition: service_healthy + networks: + - flights-dev + - subscriptions-dev + + flights-api-db-dev: + extends: + file: docker-template.yml + service: flights-api-db + container_name: fids_flights_db_dev + networks: + - flights-dev + +networks: + subscriptions-dev: + name: subscription-domain_subscriptions-dev + external: true + flights-dev: + driver: bridge diff --git a/flights-domain/docker-compose.yml b/flights-domain/docker-compose.yml index 22a2ee4..6a605a3 100644 --- a/flights-domain/docker-compose.yml +++ b/flights-domain/docker-compose.yml @@ -1,21 +1,10 @@ version: '3.8' services: - flights-api: - container_name: fids_flights_api - image: ${API_IMAGE} - healthcheck: - test: ["CMD", "nc", "-vz", "-w1", "localhost", "5000"] - interval: 2s - timeout: 2s - retries: 5 - start_period: 2s - environment: - - TEST_TARGET=${TEST_TARGET} - - PORT=5000 - - DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASS}@flights-api-db/${POSTGRES_DB} - - APP_SETTINGS=${APP_SETTINGS} + extends: + file: docker-template.yml + service: flights-api depends_on: flights-api-db: condition: service_healthy @@ -24,21 +13,11 @@ services: - subscriptions flights-api-db: - container_name: fids_flights_db - build: - context: ./db - dockerfile: Dockerfile - healthcheck: - test: psql postgres --command "select 1" -U ${POSTGRES_USER} - interval: 2s - timeout: 10s - retries: 10 - start_period: 2s - expose: - - 5432 - environment: - - POSTGRES_USER=${POSTGRES_USER} - - POSTGRES_PASSWORD=${POSTGRES_PASS} + extends: + file: docker-template.yml + service: flights-api-db + volumes: + - flights_db:/var/lib/postgresql/data networks: - flights @@ -48,3 +27,6 @@ networks: external: true flights: driver: bridge + +volumes: + flights_db: diff --git a/flights-domain/docker-template.yml b/flights-domain/docker-template.yml new file mode 100644 index 0000000..e3f1e76 --- /dev/null +++ b/flights-domain/docker-template.yml @@ -0,0 +1,34 @@ +version: '3.8' + +services: + flights-api: + container_name: fids_flights_api + image: ${API_IMAGE} + healthcheck: + test: ["CMD", "nc", "-vz", "-w1", "localhost", "5000"] + interval: 2s + timeout: 2s + retries: 5 + start_period: 2s + environment: + - TEST_TARGET=${TEST_TARGET} + - PORT=5000 + - DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASS}@flights-api-db/${POSTGRES_DB} + - APP_SETTINGS=${APP_SETTINGS} + + flights-api-db: + container_name: fids_flights_db + build: + context: ./db + dockerfile: Dockerfile + healthcheck: + test: psql postgres --command "select 1" -U ${POSTGRES_USER} + interval: 2s + timeout: 10s + retries: 10 + start_period: 2s + expose: + - 5432 + environment: + - POSTGRES_USER=${POSTGRES_USER} + - POSTGRES_PASSWORD=${POSTGRES_PASS} diff --git a/flights-domain/flights-information/src/config.py b/flights-domain/flights-information/src/config.py index 7387ace..2b8d03d 100644 --- a/flights-domain/flights-information/src/config.py +++ b/flights-domain/flights-information/src/config.py @@ -4,31 +4,21 @@ import os class BaseConfig: TESTING = False SQLALCHEMY_TRACK_MODIFICATIONS = False - SECRET_KEY = "my_precious" - ACCESS_TOKEN_EXPIRATION = 900 # 15 minutes - REFRESH_TOKEN_EXPIRATION = 2592000 # 30 days class DevelopmentConfig(BaseConfig): SQLALCHEMY_DATABASE_URI = os.environ.get("DATABASE_URL") - BCRYPT_LOG_ROUNDS = 4 class TestingConfig(BaseConfig): TESTING = True - SQLALCHEMY_DATABASE_URI = os.environ.get("DATABASE_TEST_URL") - BCRYPT_LOG_ROUNDS = 4 - ACCESS_TOKEN_EXPIRATION = 5 - REFRESH_TOKEN_EXPIRATION = 5 + SQLALCHEMY_DATABASE_URI = os.environ.get("DATABASE_URL") class ProductionConfig(BaseConfig): - BCRYPT_LOG_ROUNDS = 13 SQLALCHEMY_DATABASE_URI = os.environ.get("DATABASE_URL") - SECRET_KEY = os.getenv("SECRET_KEY", "my_precious") def __init__(self): - self.SECRET_KEY = os.getenv("SECRET_KEY", "my_precious") url = os.environ.get("DATABASE_URL") if url is not None and url.startswith("postgres://"): url = url.replace("postgres://", "postgresql://", 1) diff --git a/gateway/docker-compose.dev.yml b/gateway/docker-compose.dev.yml new file mode 100644 index 0000000..334c491 --- /dev/null +++ b/gateway/docker-compose.dev.yml @@ -0,0 +1,28 @@ +version: '3.8' + +services: + api-gateway-dev: + extends: + file: docker-template.yml + service: api-gateway + container_name: fids_api_gateway_dev + ports: + - 5001:5002 + networks: + - auth-dev + - flights-dev + - gateway-dev + - subscriptions-dev + +networks: + auth-dev: + name: auth-domain_auth-dev + external: true + flights-dev: + name: flights-domain_flights-dev + external: true + subscriptions-dev: + name: subscription-domain_subscriptions-dev + external: true + gateway-dev: + driver: bridge diff --git a/gateway/docker-compose.yml b/gateway/docker-compose.yml index c2db139..f510a22 100644 --- a/gateway/docker-compose.yml +++ b/gateway/docker-compose.yml @@ -1,22 +1,12 @@ version: '3.8' services: - api-gateway: - container_name: fids_api_gateway - image: ${API_IMAGE} + extends: + file: docker-template.yml + service: api-gateway ports: - 5000:5002 - healthcheck: - test: ["CMD", "nc", "-vz", "-w1", "localhost", "5002"] - interval: 2s - timeout: 2s - retries: 5 - start_period: 2s - environment: - - TEST_TARGET=${TEST_TARGET} - - PORT=5000 - - APP_SETTINGS=${APP_SETTINGS} networks: - auth - flights diff --git a/gateway/docker-template.yml b/gateway/docker-template.yml new file mode 100644 index 0000000..0f487a7 --- /dev/null +++ b/gateway/docker-template.yml @@ -0,0 +1,15 @@ +version: '3.8' + +services: + api-gateway: + container_name: fids_api_gateway + image: ${API_IMAGE} + healthcheck: + test: ["CMD", "nc", "-vz", "-w1", "localhost", "5002"] + interval: 2s + timeout: 2s + retries: 5 + start_period: 2s + environment: + - TEST_TARGET=${TEST_TARGET} + - APP_SETTINGS=${APP_SETTINGS} diff --git a/subscription-domain/docker-compose.dev.yml b/subscription-domain/docker-compose.dev.yml new file mode 100644 index 0000000..16ea41a --- /dev/null +++ b/subscription-domain/docker-compose.dev.yml @@ -0,0 +1,27 @@ +version: '3.8' + +services: + subscriptions-api-dev: + extends: + file: docker-template.yml + service: subscriptions-api + container_name: fids_subscriptions_api_dev + environment: + - DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASS}@subscriptions-db-dev/${POSTGRES_DB} + depends_on: + subscriptions-db-dev: + condition: service_healthy + networks: + - subscriptions-dev + + subscriptions-db-dev: + extends: + file: docker-template.yml + service: subscriptions-db + container_name: fids_subscriptions_db_dev + networks: + - subscriptions-dev + +networks: + subscriptions-dev: + driver: bridge diff --git a/subscription-domain/docker-compose.yml b/subscription-domain/docker-compose.yml index 9b7da0f..b839a9f 100644 --- a/subscription-domain/docker-compose.yml +++ b/subscription-domain/docker-compose.yml @@ -1,49 +1,28 @@ version: '3.8' services: - subscriptions-api: - container_name: fids_subscriptions_api - image: ${API_IMAGE} - ports: - - 5002:5000 - healthcheck: - test: ["CMD", "nc", "-vz", "-w1", "localhost", "5000"] - interval: 2s - timeout: 2s - retries: 5 - start_period: 2s - environment: - - TEST_TARGET=${TEST_TARGET} - - PORT=5000 - - DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASS}@subscriptions-api-db/${POSTGRES_DB} - - APP_SETTINGS=${APP_SETTINGS} - - TOKEN=${TOKEN} + extends: + file: docker-template.yml + service: subscriptions-api depends_on: - subscriptions-api-db: + subscriptions-db: condition: service_healthy networks: - subscriptions - subscriptions-api-db: - container_name: fids_subscriptions_db - build: - context: ./db - dockerfile: Dockerfile - healthcheck: - test: psql postgres --command "select 1" -U ${POSTGRES_USER} - interval: 2s - timeout: 10s - retries: 10 - start_period: 2s - expose: - - 5432 - environment: - - POSTGRES_USER=${POSTGRES_USER} - - POSTGRES_PASSWORD=${POSTGRES_PASS} + subscriptions-db: + extends: + file: docker-template.yml + service: subscriptions-db + volumes: + - subscriptions_db:/var/lib/postgresql/data networks: - subscriptions networks: subscriptions: driver: bridge + +volumes: + subscriptions_db: diff --git a/subscription-domain/docker-template.yml b/subscription-domain/docker-template.yml new file mode 100644 index 0000000..2bbaa27 --- /dev/null +++ b/subscription-domain/docker-template.yml @@ -0,0 +1,35 @@ +version: '3.8' + +services: + subscriptions-api: + container_name: fids_subscriptions_api + image: ${API_IMAGE} + healthcheck: + test: ["CMD", "nc", "-vz", "-w1", "localhost", "5000"] + interval: 2s + timeout: 2s + retries: 5 + start_period: 2s + environment: + - TEST_TARGET=${TEST_TARGET} + - PORT=5000 + - DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASS}@subscriptions-db/${POSTGRES_DB} + - APP_SETTINGS=${APP_SETTINGS} + - TOKEN=${TOKEN} + + subscriptions-db: + container_name: fids_subscriptions_db + build: + context: ./db + dockerfile: Dockerfile + healthcheck: + test: psql postgres --command "select 1" -U ${POSTGRES_USER} + interval: 2s + timeout: 10s + retries: 10 + start_period: 2s + expose: + - 5432 + environment: + - POSTGRES_USER=${POSTGRES_USER} + - POSTGRES_PASSWORD=${POSTGRES_PASS} diff --git a/subscription-domain/subscription-manager/src/config.py b/subscription-domain/subscription-manager/src/config.py index 7387ace..2b8d03d 100644 --- a/subscription-domain/subscription-manager/src/config.py +++ b/subscription-domain/subscription-manager/src/config.py @@ -4,31 +4,21 @@ import os class BaseConfig: TESTING = False SQLALCHEMY_TRACK_MODIFICATIONS = False - SECRET_KEY = "my_precious" - ACCESS_TOKEN_EXPIRATION = 900 # 15 minutes - REFRESH_TOKEN_EXPIRATION = 2592000 # 30 days class DevelopmentConfig(BaseConfig): SQLALCHEMY_DATABASE_URI = os.environ.get("DATABASE_URL") - BCRYPT_LOG_ROUNDS = 4 class TestingConfig(BaseConfig): TESTING = True - SQLALCHEMY_DATABASE_URI = os.environ.get("DATABASE_TEST_URL") - BCRYPT_LOG_ROUNDS = 4 - ACCESS_TOKEN_EXPIRATION = 5 - REFRESH_TOKEN_EXPIRATION = 5 + SQLALCHEMY_DATABASE_URI = os.environ.get("DATABASE_URL") class ProductionConfig(BaseConfig): - BCRYPT_LOG_ROUNDS = 13 SQLALCHEMY_DATABASE_URI = os.environ.get("DATABASE_URL") - SECRET_KEY = os.getenv("SECRET_KEY", "my_precious") def __init__(self): - self.SECRET_KEY = os.getenv("SECRET_KEY", "my_precious") url = os.environ.get("DATABASE_URL") if url is not None and url.startswith("postgres://"): url = url.replace("postgres://", "postgresql://", 1)