From 31ff60484d101d73ff30ca9d00eb6fe9d8704cc9 Mon Sep 17 00:00:00 2001 From: TimofeyTst Date: Sun, 8 Oct 2023 17:30:06 +0300 Subject: [PATCH 01/31] self hosted --- .github/workflows/deploy-runners.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-runners.yml b/.github/workflows/deploy-runners.yml index d4a1a5e..904b852 100644 --- a/.github/workflows/deploy-runners.yml +++ b/.github/workflows/deploy-runners.yml @@ -7,7 +7,7 @@ on: jobs: deploy: - runs-on: ubuntu-latest + runs-on: self-hosted steps: - name: Echo info run: | From 3099fd7b7cf4546beacb849d994a9afe328fbe43 Mon Sep 17 00:00:00 2001 From: TimofeyTst Date: Sun, 8 Oct 2023 17:36:24 +0300 Subject: [PATCH 02/31] name fix --- docker-compose.prod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 475dfed..97c55a7 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -3,7 +3,7 @@ version: '3.8' services: web-ui: - image: timofeytst/eat_place:web_ui_prod + image: timofeytst/eat-place:web_ui_prod ports: - "3000:80" restart: always From 82caa207e9c7beb081d5998ae72c01335acdb3ed Mon Sep 17 00:00:00 2001 From: TimofeyTst Date: Sun, 8 Oct 2023 18:17:19 +0300 Subject: [PATCH 03/31] rest_api added --- docker-compose.prod.yml | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 97c55a7..be845e0 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -1,15 +1,6 @@ version: '3.8' services: - - web-ui: - image: timofeytst/eat-place:web_ui_prod - ports: - - "3000:80" - restart: always - environment: - REACT_APP_DEV: prod - db: container_name: db hostname: db @@ -34,6 +25,28 @@ services: ports: - 6379:6379 + + rest_api: + image: timofeytst/eat-place:rest_api_prod + ports: + - "9000:9000" + restart: always + env_file: + - .prod.env + depends_on: + - db + - redis + + web_ui: + image: timofeytst/eat-place:web_ui_prod + ports: + - "3000:80" + restart: always + environment: + REACT_APP_DEV: prod + depends_on: + - rest_api + volumes: eat_place_pg_data: driver: "local" From 94f99574a1b7a8aa68ab10d06f41e6e9023b4b16 Mon Sep 17 00:00:00 2001 From: TimofeyTst Date: Sun, 8 Oct 2023 18:34:39 +0300 Subject: [PATCH 04/31] env file delete --- docker-compose.prod.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index be845e0..7762f41 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -31,8 +31,8 @@ services: ports: - "9000:9000" restart: always - env_file: - - .prod.env + environment: + - ENVIRONMENT: PRODUCTION depends_on: - db - redis From 0720ece6d653a475d35aac0e83b649d8c54940fc Mon Sep 17 00:00:00 2001 From: TimofeyTst Date: Sun, 8 Oct 2023 18:35:26 +0300 Subject: [PATCH 05/31] env fix --- docker-compose.prod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 7762f41..f4dfb14 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -32,7 +32,7 @@ services: - "9000:9000" restart: always environment: - - ENVIRONMENT: PRODUCTION + - ENVIRONMENT="PRODUCTION" depends_on: - db - redis From 7be5ef0d803fa3f78985ae460996552ff55a0c77 Mon Sep 17 00:00:00 2001 From: TimofeyTst Date: Sun, 8 Oct 2023 18:49:43 +0300 Subject: [PATCH 06/31] env var test --- docker-compose.prod.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index f4dfb14..b643121 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -33,6 +33,7 @@ services: restart: always environment: - ENVIRONMENT="PRODUCTION" + - JWT_SECRET: JWT_SECRET depends_on: - db - redis From 0efffcb83cf4615abb86e3c0639895ca59bd0861 Mon Sep 17 00:00:00 2001 From: TimofeyTst Date: Sun, 8 Oct 2023 19:06:39 +0300 Subject: [PATCH 07/31] Create env added --- .github/workflows/deploy-runners.yml | 25 +++++++++++++------------ docker-compose.prod.yml | 5 ++--- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/deploy-runners.yml b/.github/workflows/deploy-runners.yml index 904b852..c45dd92 100644 --- a/.github/workflows/deploy-runners.yml +++ b/.github/workflows/deploy-runners.yml @@ -15,18 +15,19 @@ jobs: - name: checkout repo uses: actions/checkout@v4 - # - name: Make envfile - # uses: SpicyPizza/create-envfile@v2.0 - # with: - # envkey_MYSQL_PASSWORD: ${{ secrets.MYSQL_PASSWORD }} - # envkey_MONGODB_PASSWORD: ${{ secrets.MONGODB_PASSWORD }} - # envkey_RABBIT_PASSWORD: ${{ secrets.RABBIT_PASSWORD }} - # envkey_BOT_NAME: ${{ secrets.BOT_NAME }} - # envkey_BOT_TOKEN: ${{ secrets.BOT_TOKEN }} - # file_name: .env - # directory: "./" - # fail_on_empty: false - # sort_keys: false + - name: Make envfile + uses: SpicyPizza/create-envfile@v2.0 + with: + envkey_JWT_SECRET: ${{ secrets.JWT_SECRET }} + envkey_POSTGRES_USER: ${{ secrets.POSTGRES_USER }} + envkey_POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} + envkey_POSTGRES_HOST: ${{ secrets.POSTGRES_HOST }} + envkey_POSTGRES_PORT: ${{ secrets.POSTGRES_PORT }} + envkey_POSTGRES_DB: ${{ secrets.POSTGRES_DB }} + file_name: .env + directory: "./" + fail_on_empty: false + sort_keys: false - name: pull images run: docker-compose -f docker-compose.prod.yml pull diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index b643121..be845e0 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -31,9 +31,8 @@ services: ports: - "9000:9000" restart: always - environment: - - ENVIRONMENT="PRODUCTION" - - JWT_SECRET: JWT_SECRET + env_file: + - .prod.env depends_on: - db - redis From c3066958e0a64a4b574fa6e6678f8a6054cf671b Mon Sep 17 00:00:00 2001 From: TimofeyTst Date: Sun, 8 Oct 2023 19:07:36 +0300 Subject: [PATCH 08/31] .prod --- .github/workflows/deploy-runners.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-runners.yml b/.github/workflows/deploy-runners.yml index c45dd92..f8ea995 100644 --- a/.github/workflows/deploy-runners.yml +++ b/.github/workflows/deploy-runners.yml @@ -24,7 +24,7 @@ jobs: envkey_POSTGRES_HOST: ${{ secrets.POSTGRES_HOST }} envkey_POSTGRES_PORT: ${{ secrets.POSTGRES_PORT }} envkey_POSTGRES_DB: ${{ secrets.POSTGRES_DB }} - file_name: .env + file_name: .prod.env directory: "./" fail_on_empty: false sort_keys: false From ebd1b6f5a039cec8ba78150a2c37835c894d882e Mon Sep 17 00:00:00 2001 From: TimofeyTst Date: Sun, 8 Oct 2023 19:14:26 +0300 Subject: [PATCH 09/31] All env --- .github/workflows/deploy-runners.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/deploy-runners.yml b/.github/workflows/deploy-runners.yml index f8ea995..8fcb87d 100644 --- a/.github/workflows/deploy-runners.yml +++ b/.github/workflows/deploy-runners.yml @@ -19,11 +19,31 @@ jobs: uses: SpicyPizza/create-envfile@v2.0 with: envkey_JWT_SECRET: ${{ secrets.JWT_SECRET }} + envkey_GOOGLE_OAUTH_CLIENT_ID: ${{ secrets.GOOGLE_OAUTH_CLIENT_ID }} + envkey_GOOGLE_OAUTH_CLIENT_SECRET: ${{ secrets.GOOGLE_OAUTH_CLIENT_SECRET }} + + envkey_AUTH_TOKEN_EXP: ${{ secrets.AUTH_TOKEN_EXP }} + envkey_RESET_PASSWORD_TOKEN_EXP: ${{ secrets.RESET_PASSWORD_TOKEN_EXP }} + envkey_VERIFY_TOKEN_EXP: ${{ secrets.VERIFY_TOKEN_EXP }} + envkey_POSTGRES_USER: ${{ secrets.POSTGRES_USER }} envkey_POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} envkey_POSTGRES_HOST: ${{ secrets.POSTGRES_HOST }} envkey_POSTGRES_PORT: ${{ secrets.POSTGRES_PORT }} envkey_POSTGRES_DB: ${{ secrets.POSTGRES_DB }} + + envkey_REDIS_HOST: ${{ secrets.REDIS_HOST }} + envkey_REDIS_PORT: ${{ secrets.REDIS_PORT }} + envkey_REDIS_PASSWORD: ${{ secrets.REDIS_PASSWORD }} + + envkey_SITE_DOMAIN: ${{ secrets.SITE_DOMAIN }} + envkey_SECURE_COOKIES: ${{ secrets.SECURE_COOKIES }} + + envkey_SENTRY_DSN: ${{ secrets.SENTRY_DSN }} + + envkey_CORS_HEADERS: ${{ secrets.CORS_HEADERS }} + envkey_CORS_ORIGINS: ${{ secrets.CORS_ORIGINS }} + file_name: .prod.env directory: "./" fail_on_empty: false From 667a5a69311a4e74c0d00bcf29883fbbc258c44e Mon Sep 17 00:00:00 2001 From: TimofeyTst Date: Sun, 8 Oct 2023 19:17:26 +0300 Subject: [PATCH 10/31] env rest_api --- docker-compose.prod.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index be845e0..52383b8 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -33,6 +33,8 @@ services: restart: always env_file: - .prod.env + environment: + ENVIRONMENT: PRODUCTION depends_on: - db - redis From 5fc639f2d7e1746260a01182380685cd7e73ea6b Mon Sep 17 00:00:00 2001 From: TimofeyTst Date: Sun, 8 Oct 2023 19:19:52 +0300 Subject: [PATCH 11/31] prod env --- .github/workflows/deploy-runners.yml | 2 ++ docker-compose.prod.yml | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-runners.yml b/.github/workflows/deploy-runners.yml index 8fcb87d..362c5ae 100644 --- a/.github/workflows/deploy-runners.yml +++ b/.github/workflows/deploy-runners.yml @@ -44,6 +44,8 @@ jobs: envkey_CORS_HEADERS: ${{ secrets.CORS_HEADERS }} envkey_CORS_ORIGINS: ${{ secrets.CORS_ORIGINS }} + envkey_ENVIRONMENT: PRODUCTION + file_name: .prod.env directory: "./" fail_on_empty: false diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 52383b8..be845e0 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -33,8 +33,6 @@ services: restart: always env_file: - .prod.env - environment: - ENVIRONMENT: PRODUCTION depends_on: - db - redis From a836e8cb17e9e7449a00fc6571c500d6335a26eb Mon Sep 17 00:00:00 2001 From: TimofeyTst Date: Sun, 8 Oct 2023 19:21:32 +0300 Subject: [PATCH 12/31] env --- .github/workflows/deploy-runners.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-runners.yml b/.github/workflows/deploy-runners.yml index 362c5ae..2a8b595 100644 --- a/.github/workflows/deploy-runners.yml +++ b/.github/workflows/deploy-runners.yml @@ -44,7 +44,7 @@ jobs: envkey_CORS_HEADERS: ${{ secrets.CORS_HEADERS }} envkey_CORS_ORIGINS: ${{ secrets.CORS_ORIGINS }} - envkey_ENVIRONMENT: PRODUCTION + envkey_ENVIRONMENT: ${{ secrets.ENVIRONMENT }} file_name: .prod.env directory: "./" From c96650947f5be13f0ce3aacf0c2aa46d93d21681 Mon Sep 17 00:00:00 2001 From: TimofeyTst Date: Sun, 8 Oct 2023 19:30:06 +0300 Subject: [PATCH 13/31] deleted jwt secret --- .github/workflows/deploy-runners.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/deploy-runners.yml b/.github/workflows/deploy-runners.yml index 2a8b595..49c566e 100644 --- a/.github/workflows/deploy-runners.yml +++ b/.github/workflows/deploy-runners.yml @@ -9,16 +9,13 @@ jobs: deploy: runs-on: self-hosted steps: - - name: Echo info - run: | - echo "Started deploying..." - name: checkout repo uses: actions/checkout@v4 - name: Make envfile uses: SpicyPizza/create-envfile@v2.0 with: - envkey_JWT_SECRET: ${{ secrets.JWT_SECRET }} + # envkey_JWT_SECRET: ${{ secrets.JWT_SECRET }} envkey_GOOGLE_OAUTH_CLIENT_ID: ${{ secrets.GOOGLE_OAUTH_CLIENT_ID }} envkey_GOOGLE_OAUTH_CLIENT_SECRET: ${{ secrets.GOOGLE_OAUTH_CLIENT_SECRET }} From 8bea0c1c225758b2c04c9535aff96b42e7f5b6e7 Mon Sep 17 00:00:00 2001 From: TimofeyTst Date: Sun, 8 Oct 2023 19:31:56 +0300 Subject: [PATCH 14/31] PRODUCTION ENV --- .github/workflows/deploy-runners.yml | 2 +- docker-compose.prod.yml | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-runners.yml b/.github/workflows/deploy-runners.yml index 49c566e..577c1a7 100644 --- a/.github/workflows/deploy-runners.yml +++ b/.github/workflows/deploy-runners.yml @@ -15,7 +15,7 @@ jobs: - name: Make envfile uses: SpicyPizza/create-envfile@v2.0 with: - # envkey_JWT_SECRET: ${{ secrets.JWT_SECRET }} + envkey_JWT_SECRET: ${{ secrets.JWT_SECRET }} envkey_GOOGLE_OAUTH_CLIENT_ID: ${{ secrets.GOOGLE_OAUTH_CLIENT_ID }} envkey_GOOGLE_OAUTH_CLIENT_SECRET: ${{ secrets.GOOGLE_OAUTH_CLIENT_SECRET }} diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index be845e0..a1e40f0 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -30,7 +30,9 @@ services: image: timofeytst/eat-place:rest_api_prod ports: - "9000:9000" - restart: always + restart: always + environment: + ENVIRONMENT: PRODUCTION env_file: - .prod.env depends_on: From 5715c8f137d0c820877cd6018c1c91c35293f04d Mon Sep 17 00:00:00 2001 From: TimofeyTst Date: Sun, 8 Oct 2023 19:35:00 +0300 Subject: [PATCH 15/31] test --- .github/workflows/deploy-runners.yml | 2 +- docker-compose.prod.yml | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-runners.yml b/.github/workflows/deploy-runners.yml index 577c1a7..e9f3274 100644 --- a/.github/workflows/deploy-runners.yml +++ b/.github/workflows/deploy-runners.yml @@ -27,7 +27,7 @@ jobs: envkey_POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} envkey_POSTGRES_HOST: ${{ secrets.POSTGRES_HOST }} envkey_POSTGRES_PORT: ${{ secrets.POSTGRES_PORT }} - envkey_POSTGRES_DB: ${{ secrets.POSTGRES_DB }} + # envkey_POSTGRES_DB: ${{ secrets.POSTGRES_DB }} envkey_REDIS_HOST: ${{ secrets.REDIS_HOST }} envkey_REDIS_PORT: ${{ secrets.REDIS_PORT }} diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index a1e40f0..98b7ee7 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -30,9 +30,8 @@ services: image: timofeytst/eat-place:rest_api_prod ports: - "9000:9000" + - "8000:8000" restart: always - environment: - ENVIRONMENT: PRODUCTION env_file: - .prod.env depends_on: From ec9f4a066ff6420618d8630995352d7232ad23de Mon Sep 17 00:00:00 2001 From: TimofeyTst Date: Sun, 8 Oct 2023 19:39:28 +0300 Subject: [PATCH 16/31] TEST 2 --- .github/workflows/deploy-runners.yml | 2 +- docker-compose.prod.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-runners.yml b/.github/workflows/deploy-runners.yml index e9f3274..577c1a7 100644 --- a/.github/workflows/deploy-runners.yml +++ b/.github/workflows/deploy-runners.yml @@ -27,7 +27,7 @@ jobs: envkey_POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} envkey_POSTGRES_HOST: ${{ secrets.POSTGRES_HOST }} envkey_POSTGRES_PORT: ${{ secrets.POSTGRES_PORT }} - # envkey_POSTGRES_DB: ${{ secrets.POSTGRES_DB }} + envkey_POSTGRES_DB: ${{ secrets.POSTGRES_DB }} envkey_REDIS_HOST: ${{ secrets.REDIS_HOST }} envkey_REDIS_PORT: ${{ secrets.REDIS_PORT }} diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 98b7ee7..b0ad46c 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -30,8 +30,8 @@ services: image: timofeytst/eat-place:rest_api_prod ports: - "9000:9000" - - "8000:8000" restart: always + env_file: - .prod.env depends_on: From 7b9bd6c7efdc0062e9de0768791c83f305ffd4a6 Mon Sep 17 00:00:00 2001 From: TimofeyTst Date: Sun, 8 Oct 2023 19:41:41 +0300 Subject: [PATCH 17/31] test 3 --- docker-compose.prod.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index b0ad46c..b76e85c 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -30,6 +30,7 @@ services: image: timofeytst/eat-place:rest_api_prod ports: - "9000:9000" + - "8000:8000" restart: always env_file: From acc05c0d1610ce0c386a53a7445d7d47764b0c49 Mon Sep 17 00:00:00 2001 From: TimofeyTst Date: Sun, 8 Oct 2023 19:43:22 +0300 Subject: [PATCH 18/31] test 3 --- .github/workflows/deploy-runners.yml | 2 +- docker-compose.prod.yml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/deploy-runners.yml b/.github/workflows/deploy-runners.yml index 577c1a7..e9af429 100644 --- a/.github/workflows/deploy-runners.yml +++ b/.github/workflows/deploy-runners.yml @@ -41,7 +41,7 @@ jobs: envkey_CORS_HEADERS: ${{ secrets.CORS_HEADERS }} envkey_CORS_ORIGINS: ${{ secrets.CORS_ORIGINS }} - envkey_ENVIRONMENT: ${{ secrets.ENVIRONMENT }} + envkey_ENVIRONMENT: PRODUCTION file_name: .prod.env directory: "./" diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index b76e85c..b0ad46c 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -30,7 +30,6 @@ services: image: timofeytst/eat-place:rest_api_prod ports: - "9000:9000" - - "8000:8000" restart: always env_file: From 4491f6297789200a89b82bfe3fa4a510757d6c36 Mon Sep 17 00:00:00 2001 From: TimofeyTst Date: Sun, 8 Oct 2023 19:56:30 +0300 Subject: [PATCH 19/31] Db passwords --- docker-compose.prod.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index b0ad46c..4d61971 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -7,9 +7,9 @@ services: image: library/postgres:14.1 environment: - - POSTGRES_USER=rest - - POSTGRES_PASSWORD=rest - - POSTGRES_DB=rest + - POSTGRES_USER=${POSTGRES_USER} + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} + - POSTGRES_DB=${POSTGRES_DB} volumes: - eat_place_pg_data:/var/lib/postgresql/data ports: @@ -21,7 +21,7 @@ services: container_name: redis command: - 'redis-server' - - '--requirepass myStrongPassword' + - '--requirepass ${REDIS_PASSWORD}' ports: - 6379:6379 From d083adc88ffbb6230e6e07f1fac1b883664ef1f5 Mon Sep 17 00:00:00 2001 From: TimofeyTst Date: Sun, 8 Oct 2023 20:00:19 +0300 Subject: [PATCH 20/31] redis pswd --- docker-compose.prod.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 4d61971..ac67f55 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -19,9 +19,7 @@ services: image: redis:6.2-alpine hostname: redis container_name: redis - command: - - 'redis-server' - - '--requirepass ${REDIS_PASSWORD}' + command: ['redis-server', '--requirepass', '${REDIS_PASSWORD}'] ports: - 6379:6379 From 4b643e6bdc692b0f386db22b59ee1087ca66cc94 Mon Sep 17 00:00:00 2001 From: TimofeyTst Date: Sun, 8 Oct 2023 20:08:26 +0300 Subject: [PATCH 21/31] redis pswd 2 --- docker-compose.prod.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index ac67f55..1045a57 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -19,7 +19,8 @@ services: image: redis:6.2-alpine hostname: redis container_name: redis - command: ['redis-server', '--requirepass', '${REDIS_PASSWORD}'] + command: > + --requirepass ${REDIS_PASSWORD} ports: - 6379:6379 From 90a1b11ee535230fa38e254ddc36b4c24031dbdc Mon Sep 17 00:00:00 2001 From: TimofeyTst Date: Sun, 8 Oct 2023 20:10:38 +0300 Subject: [PATCH 22/31] redis pswd 3 --- docker-compose.prod.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 1045a57..0d1c70b 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -19,8 +19,7 @@ services: image: redis:6.2-alpine hostname: redis container_name: redis - command: > - --requirepass ${REDIS_PASSWORD} + command: redis-server --requirepass $${REDIS_PASSWORD} ports: - 6379:6379 From 6a22e4f1133f225ecfa089fdef50fd80c2c93f55 Mon Sep 17 00:00:00 2001 From: TimofeyTst Date: Sun, 8 Oct 2023 20:15:19 +0300 Subject: [PATCH 23/31] redis pswd 4 --- docker-compose.prod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 0d1c70b..10cd2f8 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -19,7 +19,7 @@ services: image: redis:6.2-alpine hostname: redis container_name: redis - command: redis-server --requirepass $${REDIS_PASSWORD} + command: /bin/sh -c "redis-server --requirepass $$REDIS_PASSWORD" ports: - 6379:6379 From 709584c515878bf86f513246c9f852fc1ba957bf Mon Sep 17 00:00:00 2001 From: TimofeyTst Date: Sun, 8 Oct 2023 20:16:21 +0300 Subject: [PATCH 24/31] redis 5 --- docker-compose.prod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 10cd2f8..e99c4f4 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -19,7 +19,7 @@ services: image: redis:6.2-alpine hostname: redis container_name: redis - command: /bin/sh -c "redis-server --requirepass $$REDIS_PASSWORD" + command: /bin/sh -c "redis-server --requirepass ${REDIS_PASSWORD}" ports: - 6379:6379 From b415bd00e813e8a332d0eba4af69513d7ac03407 Mon Sep 17 00:00:00 2001 From: TimofeyTst Date: Sun, 8 Oct 2023 20:24:42 +0300 Subject: [PATCH 25/31] redis 5 --- docker-compose.prod.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index e99c4f4..85126f7 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -19,6 +19,8 @@ services: image: redis:6.2-alpine hostname: redis container_name: redis + environment: + - REDIS_PASSWORD=${REDIS_PASSWORD} command: /bin/sh -c "redis-server --requirepass ${REDIS_PASSWORD}" ports: - 6379:6379 From db6d50bcf1e0e4eebb39e8888dd7e9ff3819c79e Mon Sep 17 00:00:00 2001 From: TimofeyTst Date: Sun, 8 Oct 2023 20:26:28 +0300 Subject: [PATCH 26/31] redis 6 --- docker-compose.prod.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 85126f7..6cfed85 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -21,7 +21,8 @@ services: container_name: redis environment: - REDIS_PASSWORD=${REDIS_PASSWORD} - command: /bin/sh -c "redis-server --requirepass ${REDIS_PASSWORD}" + # command: /bin/sh -c "redis-server --requirepass ${REDIS_PASSWORD}" + command: redis-server --requirepass $REDIS_PASSWORD ports: - 6379:6379 From 9af903d5a17446fe05c152a104f3f8556b147c3d Mon Sep 17 00:00:00 2001 From: TimofeyTst Date: Sun, 8 Oct 2023 20:29:37 +0300 Subject: [PATCH 27/31] redis 7 --- docker-compose.prod.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 6cfed85..9975355 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -22,7 +22,11 @@ services: environment: - REDIS_PASSWORD=${REDIS_PASSWORD} # command: /bin/sh -c "redis-server --requirepass ${REDIS_PASSWORD}" - command: redis-server --requirepass $REDIS_PASSWORD + # command: redis-server --requirepass $REDIS_PASSWORD + command: + - /bin/sh + - -c + - redis-server --requirepass "$${REDIS_PASSWORD:?REDIS_PASSWORD variable is not set}" ports: - 6379:6379 From e65d4b25d97a79ebd5ad0fb4cb59302f8fdd712e Mon Sep 17 00:00:00 2001 From: TimofeyTst Date: Sun, 8 Oct 2023 20:31:15 +0300 Subject: [PATCH 28/31] redis 8 --- docker-compose.prod.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 9975355..4013305 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -19,8 +19,10 @@ services: image: redis:6.2-alpine hostname: redis container_name: redis - environment: - - REDIS_PASSWORD=${REDIS_PASSWORD} + # environment: + # - REDIS_PASSWORD=${REDIS_PASSWORD} + env_file: + - .prod.env # command: /bin/sh -c "redis-server --requirepass ${REDIS_PASSWORD}" # command: redis-server --requirepass $REDIS_PASSWORD command: From a6a261bfbbb3324727ab6865a57db8e5e2232025 Mon Sep 17 00:00:00 2001 From: TimofeyTst Date: Sun, 8 Oct 2023 20:33:05 +0300 Subject: [PATCH 29/31] redis prelast --- docker-compose.prod.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 4013305..faca432 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -19,16 +19,14 @@ services: image: redis:6.2-alpine hostname: redis container_name: redis - # environment: - # - REDIS_PASSWORD=${REDIS_PASSWORD} env_file: - .prod.env - # command: /bin/sh -c "redis-server --requirepass ${REDIS_PASSWORD}" + command: /bin/sh -c "redis-server --requirepass ${REDIS_PASSWORD}" # command: redis-server --requirepass $REDIS_PASSWORD - command: - - /bin/sh - - -c - - redis-server --requirepass "$${REDIS_PASSWORD:?REDIS_PASSWORD variable is not set}" + # command: + # - /bin/sh + # - -c + # - redis-server --requirepass "$${REDIS_PASSWORD:?REDIS_PASSWORD variable is not set}" ports: - 6379:6379 From 996b3793e10a7ada79d16c3c4102f316fa2d5703 Mon Sep 17 00:00:00 2001 From: TimofeyTst Date: Sun, 8 Oct 2023 20:34:25 +0300 Subject: [PATCH 30/31] redis last --- docker-compose.prod.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index faca432..2d8f1e2 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -21,12 +21,10 @@ services: container_name: redis env_file: - .prod.env - command: /bin/sh -c "redis-server --requirepass ${REDIS_PASSWORD}" - # command: redis-server --requirepass $REDIS_PASSWORD - # command: - # - /bin/sh - # - -c - # - redis-server --requirepass "$${REDIS_PASSWORD:?REDIS_PASSWORD variable is not set}" + command: + - /bin/sh + - -c + - redis-server --requirepass "$${REDIS_PASSWORD:?REDIS_PASSWORD variable is not set}" ports: - 6379:6379 From 09b2b4599745f66ae192b8cace8146b437304104 Mon Sep 17 00:00:00 2001 From: TimofeyTst Date: Sun, 8 Oct 2023 21:03:53 +0300 Subject: [PATCH 31/31] All done --- README.md | 25 ++++++++++++-- docker-compose.dev.yml | 78 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+), 2 deletions(-) create mode 100644 docker-compose.dev.yml diff --git a/README.md b/README.md index c740dcf..c8b9e47 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,35 @@ # Deploy -Создайте файл .env по шаблону .env.example ## Development +- Подразумевает, что все нужные репозитории отклонированы в одну папку +- Требуется создать файл `.env` по шаблону `.env.example` +- Поддерживает изменения на лету, максимально удобен для разработки ```bash docker-compose up -d docker compose exec rest_api migrate ``` +## Development pulling +- Нужен только репозиторий deploy +- Сборка dev образов с Docker Hub +```bash +docker-compose -f docker-compose.dev.yml up -d +docker compose exec rest_api migrate +``` + +## Production pulling +- Нужен только репозиторий deploy +- Сборка prod образов с Docker Hub + +```bash +docker-compose -f docker-compose.prod.yml up -d +docker compose exec rest_api migrate +``` + ## Release -В этом режиме собирается готовый образ для production +- Подразумевает, что все нужные репозитории отклонированы в одну папку +- Требуется создать файл `.prod.env` по шаблону `.env.example` +- В этом режиме собирается готовый compose для production ```bash docker-compose -f docker-compose.release.yml up -d --build docker compose exec rest_api migrate diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml new file mode 100644 index 0000000..7019c79 --- /dev/null +++ b/docker-compose.dev.yml @@ -0,0 +1,78 @@ +version: '3.8' + +services: + db: + container_name: db + hostname: db + image: library/postgres:14.1 + + environment: + - POSTGRES_USER=${POSTGRES_USER} + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} + - POSTGRES_DB=${POSTGRES_DB} + volumes: + - eat_place_pg_data:/var/lib/postgresql/data + ports: + - "5432:5432" + + test_db: + container_name: test_db + hostname: test_db + image: library/postgres:14.1 + + environment: + - POSTGRES_USER=rest + - POSTGRES_PASSWORD=rest + - POSTGRES_DB=rest + volumes: + - eat_place_test_pg_data:/var/lib/postgresql/data + ports: + - "5433:5432" + + redis: + image: redis:6.2-alpine + hostname: redis + container_name: redis + env_file: + - .env + command: + - /bin/sh + - -c + - redis-server --requirepass "$${REDIS_PASSWORD:?REDIS_PASSWORD variable is not set}" + ports: + - 6379:6379 + + + rest_api: + image: timofeytst/eat-place:rest_api_dev + ports: + - "8000:8000" + restart: always + + env_file: + - .env + depends_on: + - db + - redis + + web_ui: + image: timofeytst/eat-place:web_ui_dev + ports: + - "3000:3000" + restart: always + environment: + REACT_APP_DEV: dev + depends_on: + - rest_api + +volumes: + eat_place_pg_data: + driver: "local" + + eat_place_test_pg_data: + driver: "local" + +networks: + default: + external: true + name: eat_place