From 54facce19e2928c7840cf5d8b9a8fe294ed1d10b Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 12 Aug 2024 14:13:57 +0000 Subject: [PATCH] ci: set all environemnt compose --- .gitignore | 4 ++-- dockerfile => Dockerfile | 0 compose.dev.yaml | 17 +++++++++++++++++ compose.override.yaml | 4 ++++ compose.prod.yaml | 17 +++++++++++++++++ compose.staging.yaml | 17 +++++++++++++++++ compose.yaml | 8 +++----- docker-compose.prod.yml | 33 --------------------------------- docker-compose.staging.yml | 33 --------------------------------- 9 files changed, 60 insertions(+), 73 deletions(-) rename dockerfile => Dockerfile (100%) create mode 100644 compose.dev.yaml create mode 100644 compose.override.yaml create mode 100644 compose.prod.yaml create mode 100644 compose.staging.yaml delete mode 100644 docker-compose.prod.yml delete mode 100644 docker-compose.staging.yml diff --git a/.gitignore b/.gitignore index f85daeb0b..412e13690 100644 --- a/.gitignore +++ b/.gitignore @@ -389,9 +389,9 @@ Temporary Items # Local dist /.env -/.env.*.local +/.env.* *._local.ts # Migrations /db/migrations/*-migration.ts -/db \ No newline at end of file +/db diff --git a/dockerfile b/Dockerfile similarity index 100% rename from dockerfile rename to Dockerfile diff --git a/compose.dev.yaml b/compose.dev.yaml new file mode 100644 index 000000000..555a3d039 --- /dev/null +++ b/compose.dev.yaml @@ -0,0 +1,17 @@ +name: nestjs_dev + +services: + app: + env_file: + - .env.dev + + db: + env_file: + - .env.dev + + redis: + env_file: + - .env.dev + nginx: + ports: + - 5000:80 diff --git a/compose.override.yaml b/compose.override.yaml new file mode 100644 index 000000000..a6e378b04 --- /dev/null +++ b/compose.override.yaml @@ -0,0 +1,4 @@ +services: + nginx: + ports: + - 5000:80 diff --git a/compose.prod.yaml b/compose.prod.yaml new file mode 100644 index 000000000..b09ecd3f7 --- /dev/null +++ b/compose.prod.yaml @@ -0,0 +1,17 @@ +name: nestjs_prod + +services: + app: + env_file: + - .env.prod + + db: + env_file: + - .env.prod + + redis: + env_file: + - .env.prod + nginx: + ports: + - 5002:80 diff --git a/compose.staging.yaml b/compose.staging.yaml new file mode 100644 index 000000000..d4cc2f434 --- /dev/null +++ b/compose.staging.yaml @@ -0,0 +1,17 @@ +name: nestjs_staging + +services: + app: + env_file: + - .env.staging + + db: + env_file: + - .env.staging + + redis: + env_file: + - .env.staging + nginx: + ports: + - 5001:80 diff --git a/compose.yaml b/compose.yaml index 42e9e2c1f..ad18eebb5 100644 --- a/compose.yaml +++ b/compose.yaml @@ -12,9 +12,9 @@ services: redis: condition: service_healthy healthcheck: - test: "wget -qO- http://app:5000" - interval: 5s - timeout: 5s + test: "wget -qO- http://app:${PORT}" + interval: 10s + timeout: 10s retries: 3 db: @@ -49,8 +49,6 @@ services: nginx: image: nginx:alpine - ports: - - 5000:80 volumes: - ./nginx.conf:/etc/nginx/nginx.conf depends_on: diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml deleted file mode 100644 index 297001a2e..000000000 --- a/docker-compose.prod.yml +++ /dev/null @@ -1,33 +0,0 @@ -version: '3.3' - -services: - # NestJS Application Service - app: - build: . - container_name: team-alpha - ports: - - '3200:3200' - # entrypoint: ./start.sh - env_file: - - ./.env - depends_on: - - db - - redis - - # PostgreSQL Service - db: - image: postgres:16 - container_name: postgres-db - env_file: - - ./.env - ports: - - '5679:5432' - volumes: - - /var/lib/postgresql/data:/var/lib/postgres> - - # Redis Service - redis: - image: redis:7 - container_name: redis-server - ports: - - '6377:6379' diff --git a/docker-compose.staging.yml b/docker-compose.staging.yml deleted file mode 100644 index eb5a9adfe..000000000 --- a/docker-compose.staging.yml +++ /dev/null @@ -1,33 +0,0 @@ -version: '3.3' - -services: - # NestJS Application Service - app: - build: . - container_name: team-alpha - ports: - - '3100:3100' - # entrypoint: ./start.sh - env_file: - - ./.env - depends_on: - - db - - redis - - # PostgreSQL Service - db: - image: postgres:16 - container_name: postgres-db - env_file: - - ./.env - ports: - - '5678:5432' - volumes: - - /var/lib/postgresql/data:/var/lib/postgres> - - # Redis Service - redis: - image: redis:7 - container_name: redis-server - ports: - - '6378:6379'