diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 000000000..baf2907c5 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,59 @@ +# This release drafter follows the conventions +# from https://keepachangelog.com + +name-template: 'v$RESOLVED_VERSION' +tag-template: 'v$RESOLVED_VERSION' +template: | + ## What Changed 👀 + + $CHANGES + + **Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION + +categories: + - title: 🚀 Features + labels: + - feature + - enhancement + - title: 🐛 Bug Fixes + labels: + - fix + - bug + - title: ⚠️ Changes + labels: + - changed + - title: ⛔️ Deprecated + labels: + - deprecated + - title: 🗑 Removed + labels: + - removed + - title: 🔐 Security + labels: + - security + - title: 📄 Documentation + labels: + - docs + - documentation + - title: 🧩 Dependency Updates + labels: + - deps + - dependencies + collapse-after: 5 + +change-template: '- $TITLE @$AUTHOR (#$NUMBER)' +change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. +version-resolver: + major: + labels: + - major + minor: + labels: + - minor + patch: + labels: + - patch + default: patch + +exclude-labels: + - skip-changelog diff --git a/.github/workflows/build_docker.yaml b/.github/workflows/build_docker.yaml new file mode 100644 index 000000000..1cccbad97 --- /dev/null +++ b/.github/workflows/build_docker.yaml @@ -0,0 +1,68 @@ +name: Build Docker Image + +on: + workflow_call: + inputs: + DOCKERFILE: + required: true + type: string + REPOSITORY: + required: true + type: string + BUILD_ARGS: + required: false + type: string + default: '' + +env: + REGISTRY: split.azurecr.io + TAG: ${{ github.sha }} + +jobs: + build_docker: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Context for Buildx + run: | + docker context create builders + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + with: + endpoint: builders + + - uses: azure/docker-login@v1 + with: + login-server: ${{ env.REGISTRY }} + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_PASSWORD }} + + - name: Setup Docker metadata + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ inputs.REPOSITORY }} + tags: | + type=raw,value=${{ env.TAG }} + type=raw,value=cache + + - name: Build and Push + uses: docker/build-push-action@v3 + with: + context: . + file: ${{ inputs.DOCKERFILE }} + push: true + target: production + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: | + type=registry,ref=${{ env.REGISTRY }}/${{ inputs.REPOSITORY }}:${{ env.TAG }} + type=registry,ref=${{ env.REGISTRY }}/${{ inputs.REPOSITORY }}:cache + cache-to: type=inline + build-args: ${{ inputs.BUILD_ARGS }} \ No newline at end of file diff --git a/.github/workflows/deploy_backend.yml b/.github/workflows/deploy_backend.yml deleted file mode 100644 index 2f8172858..000000000 --- a/.github/workflows/deploy_backend.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Deploy backend - -on: - push: - branches: [ main ] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - uses: azure/docker-login@v1 - with: - login-server: split.azurecr.io - username: ${{ secrets.REGISTRY_USERNAME }} - password: ${{ secrets.REGISTRY_PASSWORD }} - - - run: | - docker build ./backend -f ./backend/docker/prod/Dockerfile -t split.azurecr.io/backend:latest - docker push split.azurecr.io/backend:latest - - - uses: azure/webapps-deploy@v2 - with: - app-name: 'split-be' - publish-profile: ${{ secrets.AZURE_BACKEND_PUBLISH_PROFILE }} - images: 'split.azurecr.io/backend:latest' diff --git a/.github/workflows/deploy_backend_frontend.yml b/.github/workflows/deploy_backend_frontend.yml new file mode 100644 index 000000000..e32a59c14 --- /dev/null +++ b/.github/workflows/deploy_backend_frontend.yml @@ -0,0 +1,114 @@ +name: Build and Deploy + +on: + push: + branches: + - main + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + build_backend: + name: Build backend + uses: ./.github/workflows/build_docker.yaml + with: + DOCKERFILE: ./backend/docker/prod/Dockerfile + REPOSITORY: backend + + build_frontend: + name: Build frontend + uses: ./.github/workflows/build_docker.yaml + with: + DOCKERFILE: ./frontend/docker/prod/Dockerfile + REPOSITORY: frontend + BUILD_ARGS: | + NEXT_PUBLIC_BACKEND_URL=${{secrets.NEXT_PUBLIC_BACKEND_URL}} + NEXT_PUBLIC_NEXTAUTH_URL=${{secrets.NEXT_PUBLIC_NEXTAUTH_URL}} + NEXT_PUBLIC_EXPIRATION_TIME=${{secrets.NEXT_PUBLIC_EXPIRATION_TIME}} + NEXT_PUBLIC_ENABLE_AZURE=${{secrets.NEXT_PUBLIC_ENABLE_AZURE}} + + deploy_backend_dev: + name: Deploy backend DEV + needs: build_backend + uses: ./.github/workflows/on_call_deploy.yaml + with: + ENVIRONMENT: dev + APP_NAME: split-be-dev + PUBLISH_PROFILE: ${{ secrets.AZURE_BACKEND_PUBLISH_PROFILE }} + REPOSITORY: backend + + deploy_frontend_dev: + name: Deploy frontend DEV + needs: build_frontend + uses: ./.github/workflows/on_call_deploy.yaml + with: + ENVIRONMENT: dev + APP_NAME: split-fe-dev + PUBLISH_PROFILE: ${{ secrets.AZURE_FRONTEND_PUBLISH_PROFILE }} + REPOSITORY: frontend + + deploy_backend_prod: + name: Deploy backend PROD + needs: deploy_backend_dev + uses: ./.github/workflows/on_call_deploy.yaml + with: + ENVIRONMENT: prod + APP_NAME: split-be + PUBLISH_PROFILE: ${{ secrets.AZURE_BACKEND_PUBLISH_PROFILE }} + REPOSITORY: backend + + deploy_frontend_prod: + name: Deploy frontend PROD + needs: deploy_frontend_dev + uses: ./.github/workflows/on_call_deploy.yaml + with: + ENVIRONMENT: prod + APP_NAME: split-fe + PUBLISH_PROFILE: ${{ secrets.AZURE_FRONTEND_PUBLISH_PROFILE }} + REPOSITORY: frontend + + update_release_draft: + name: Release Drafter + runs-on: ubuntu-latest + needs: + - deploy_backend_dev + - deploy_frontend_dev + steps: + - name: Update release draft + uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + pre_release: + name: Create Pre Release + runs-on: ubuntu-latest + permissions: + contents: write + needs: + - deploy_backend_dev + - deploy_frontend_dev + steps: + - name: Update release draft + uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + prerelease: true + + release: + name: Create Release + runs-on: ubuntu-latest + permissions: + contents: write + needs: + - deploy_backend_prod + - deploy_frontend_prod + steps: + - name: Update release draft + uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + publish: true \ No newline at end of file diff --git a/.github/workflows/deploy_frontend.yml b/.github/workflows/deploy_frontend.yml deleted file mode 100644 index 22c640ad9..000000000 --- a/.github/workflows/deploy_frontend.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Deploy frontend - -on: - push: - branches: [main] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - uses: azure/docker-login@v1 - with: - login-server: split.azurecr.io - username: ${{ secrets.REGISTRY_USERNAME }} - password: ${{ secrets.REGISTRY_PASSWORD }} - - - run: | - docker build ./frontend -f ./frontend/docker/prod/Dockerfile --build-arg NEXT_PUBLIC_BACKEND_URL=${{secrets.NEXT_PUBLIC_BACKEND_URL}} --build-arg NEXT_PUBLIC_NEXTAUTH_URL=${{secrets.NEXT_PUBLIC_NEXTAUTH_URL}} --build-arg NEXT_PUBLIC_EXPIRATION_TIME=${{secrets.NEXT_PUBLIC_EXPIRATION_TIME}} --build-arg NEXT_PUBLIC_ENABLE_AZURE=${{secrets.NEXT_PUBLIC_ENABLE_AZURE}} -t split.azurecr.io/frontend:latest - docker push split.azurecr.io/frontend:latest - - - uses: azure/webapps-deploy@v2 - with: - app-name: 'split-fe' - publish-profile: ${{ secrets.AZURE_FRONTEND_PUBLISH_PROFILE }} - images: 'split.azurecr.io/frontend:latest' diff --git a/.github/workflows/on_call_deploy.yaml b/.github/workflows/on_call_deploy.yaml new file mode 100644 index 000000000..38230a71f --- /dev/null +++ b/.github/workflows/on_call_deploy.yaml @@ -0,0 +1,31 @@ +name: Deploy + +on: + workflow_call: + inputs: + ENVIRONMENT: + required: true + type: string + APP_NAME: + required: true + type: string + PUBLISH_PROFILE: + required: true + type: string + REPOSITORY: + required: true + type: string + +env: + TAG: ${{ github.sha }} + +jobs: + deploy: + runs-on: ubuntu-latest + environment: ${{ inputs.ENVIRONMENT }} + steps: + - uses: azure/webapps-deploy@v2 + with: + app-name: ${{ inputs.APP_NAME }} + publish-profile: ${{ inputs.PUBLISH_PROFILE }} + images: split.azurecr.io/${{ inputs.REPOSITORY }}:${{ env.TAG }} \ No newline at end of file diff --git a/.github/workflows/on_release.yaml b/.github/workflows/on_release.yaml new file mode 100644 index 000000000..3552d7ef2 --- /dev/null +++ b/.github/workflows/on_release.yaml @@ -0,0 +1,28 @@ +name: Update Changelog + +on: + release: + types: + - published + +jobs: + update: + name: Update Changelog + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Update Changelog + uses: stefanzweifel/changelog-updater-action@v1 + with: + release-notes: ${{ github.event.release.body }} + latest-version: ${{ github.event.release.name }} + + - name: Commit changes + uses: stefanzweifel/git-auto-commit-action@v4 + with: + branch: main + commit_message: 'ci: update version to ${{ github.event.release.name }} [skip ci]' + push_options: --force diff --git a/.github/workflows/tests_backend_frontend.yml b/.github/workflows/tests_backend_frontend.yml index d2b2aa39f..17c9f95e2 100644 --- a/.github/workflows/tests_backend_frontend.yml +++ b/.github/workflows/tests_backend_frontend.yml @@ -1,51 +1,176 @@ -# This is a basic workflow to help you get started with Actions +name: Test & Build -name: CI - -# Controls when the workflow will run on: - # Triggers the workflow on push or pull request events but only for the main branch - push: - branches: [main] - pull_request: - branches: [main] + pull_request: + branches: + - main + + workflow_dispatch: + +env: + NODE_VERSION: 18.x - workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true -# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - # This workflow contains a single job called "build" - build_test: - # The type of runner that the job will run on - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [16.x] - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - - name: Cache multiple paths - uses: actions/cache@v2 - with: - path: ${{ github.workspace }}/.next/cache - key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} - restore-keys: | - ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}- - - name: npm ci and test - run: | - cd backend - npm ci - npm test - - name: npm ci and test frontend - run: | - cd frontend - npm ci - npm run jest + install: + name: Install Dependencies + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Use Node.js ${{ env.NODE_VERSION}} + uses: actions/setup-node@v2 + with: + node-version: ${{ env.NODE_VERSION}} + cache: "npm" + + - name: Cache multiple paths + uses: actions/cache@v3 + id: cache + with: + path: | + **/node_modules + ${{ steps.cache.outputs.dir }} + key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-npm- + + - name: Install + if: steps.cache.outputs.cache-hit != 'true' + run: npm ci + + build_backend: + name: Build Backend + runs-on: ubuntu-latest + needs: install + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Use Node.js ${{ env.NODE_VERSION}} + uses: actions/setup-node@v2 + with: + node-version: ${{ env.NODE_VERSION}} + cache: "npm" + + - name: Cache multiple paths + uses: actions/cache@v3 + id: cache + with: + path: | + **/node_modules + ${{ steps.cache.outputs.dir }} + key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-npm- + + - name: Install + if: steps.cache.outputs.cache-hit != 'true' + run: npm ci + + - name: Build + run: npm run build + working-directory: backend + + test_backend: + name: Test Backend + runs-on: ubuntu-latest + needs: install + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Use Node.js ${{ env.NODE_VERSION}} + uses: actions/setup-node@v2 + with: + node-version: ${{ env.NODE_VERSION}} + cache: "npm" + + - name: Cache multiple paths + uses: actions/cache@v3 + id: cache + with: + path: | + **/node_modules + ${{ steps.cache.outputs.dir }} + key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-npm- + + - name: Install + if: steps.cache.outputs.cache-hit != 'true' + run: npm ci + + - name: Test + run: npm run test:cov + working-directory: backend + + build_frontend: + name: Build Frontend + runs-on: ubuntu-latest + needs: install + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Use Node.js ${{ env.NODE_VERSION}} + uses: actions/setup-node@v2 + with: + node-version: ${{ env.NODE_VERSION}} + cache: "npm" + + - name: Cache multiple paths + uses: actions/cache@v3 + id: cache + with: + path: | + **/node_modules + ${{ steps.cache.outputs.dir }} + key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-npm- + + - name: Install + if: steps.cache.outputs.cache-hit != 'true' + run: npm ci + + - name: Build + run: npm run build + working-directory: frontend + + test_frontend: + name: Test Frontend + runs-on: ubuntu-latest + needs: install + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Use Node.js ${{ env.NODE_VERSION}} + uses: actions/setup-node@v2 + with: + node-version: ${{ env.NODE_VERSION}} + cache: "npm" + + - name: Cache multiple paths + uses: actions/cache@v3 + id: cache + with: + path: | + **/node_modules + ${{ steps.cache.outputs.dir }} + key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-npm- + + - name: Install + if: steps.cache.outputs.cache-hit != 'true' + run: npm ci + + - name: Test + run: npm run jest -- --coverage + working-directory: frontend \ No newline at end of file diff --git a/backend/.env.example b/backend/.env.example index c1d30488e..3fe606f11 100644 --- a/backend/.env.example +++ b/backend/.env.example @@ -3,7 +3,7 @@ BACKEND_PORT=3200 # NODE ENV -NODE_ENV=dev +NODE_ENV=local # -> Daatabase <- # # db user diff --git a/backend/docker/dev/Dockerfile b/backend/docker/local/Dockerfile similarity index 77% rename from backend/docker/dev/Dockerfile rename to backend/docker/local/Dockerfile index 1d53b74e2..d28e2000b 100644 --- a/backend/docker/dev/Dockerfile +++ b/backend/docker/local/Dockerfile @@ -1,5 +1,5 @@ # Dev Environment -FROM node:16-alpine AS development +FROM node:16-alpine AS local # Container Dir WORKDIR /app/backend @@ -8,7 +8,7 @@ WORKDIR /app/backend COPY package.json ./ # Install the packages (on the package.json) -RUN yarn +RUN npm i # Copy all files COPY ./ . @@ -17,4 +17,4 @@ COPY ./ . EXPOSE 3200 # Run in dev mode -CMD ["yarn", "start:dev"] \ No newline at end of file +CMD ["npm", "start:dev"] \ No newline at end of file diff --git a/backend/docker/prod/Dockerfile b/backend/docker/prod/Dockerfile index 58c5ef249..c22c2239f 100644 --- a/backend/docker/prod/Dockerfile +++ b/backend/docker/prod/Dockerfile @@ -1,35 +1,22 @@ -FROM node:16-alpine +ARG TAG=18.12.1-alpine -ENV NODE_ENV build +FROM node:$TAG AS builder -WORKDIR /backend - -COPY package*.json ./ +WORKDIR /app +COPY . . RUN npm ci - -COPY ./ ./ - RUN npm run build - -ARG NODE_ENV -ENV NODE_ENV=${NODE_ENV} - -EXPOSE 3200 -ENV PORT 3200 - -CMD ["node", "dist/src/main.js"] +RUN npm prune --production # --- -# FROM node:16-alpine - +FROM node:$TAG AS production -# USER node -# WORKDIR /backend +WORKDIR /app -# COPY --from=builder ./package*.json /backend/ -# COPY --from=builder ./node_modules /backend/node_modules/ -# COPY --from=builder ./dist /backend/dist +COPY --from=builder /app/package*.json ./ +COPY --from=builder /app/dist ./dist +COPY --from=builder /app/node_modules ./node_modules -# CMD ["node", "dist/src/main.js"] \ No newline at end of file +CMD npm run start:prod \ No newline at end of file diff --git a/backend/package-lock.json b/backend/package-lock.json index e4da9e621..54a63e74d 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -6077,9 +6077,9 @@ } }, "node_modules/engine.io": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.2.0.tgz", - "integrity": "sha512-4KzwW3F3bk+KlzSOY57fj/Jx6LyRQ1nbcyIadehl+AnXjKT7gDO0ORdRi/84ixvMKTym6ZKuxvbzN62HDDU1Lg==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.2.1.tgz", + "integrity": "sha512-ECceEFcAaNRybd3lsGQKas3ZlMVjN3cyWwMP25D2i0zWfyiytVbTpRPa34qrr+FHddtpBVOmq4H/DCv1O0lZRA==", "dependencies": { "@types/cookie": "^0.4.1", "@types/cors": "^2.8.12", @@ -20806,9 +20806,9 @@ } }, "engine.io": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.2.0.tgz", - "integrity": "sha512-4KzwW3F3bk+KlzSOY57fj/Jx6LyRQ1nbcyIadehl+AnXjKT7gDO0ORdRi/84ixvMKTym6ZKuxvbzN62HDDU1Lg==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.2.1.tgz", + "integrity": "sha512-ECceEFcAaNRybd3lsGQKas3ZlMVjN3cyWwMP25D2i0zWfyiytVbTpRPa34qrr+FHddtpBVOmq4H/DCv1O0lZRA==", "requires": { "@types/cookie": "^0.4.1", "@types/cors": "^2.8.12", diff --git a/backend/package.json b/backend/package.json index 311ce50fc..1bf2c9bbb 100644 --- a/backend/package.json +++ b/backend/package.json @@ -10,7 +10,7 @@ "build": "nest build", "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", "start": "nest start", - "start:dev": "NODE_ENV=dev nest start --watch", + "start:dev": "NODE_ENV=local nest start --watch", "start:staging": "NODE_ENV=staging nest start --watch", "start:debug": "nest start --debug --watch", "start:prod": "NODE_ENV=prod nest start --watch", diff --git a/backend/src/infrastructure/config/config.module.ts b/backend/src/infrastructure/config/config.module.ts index ab1aada0a..ba9ed3a35 100644 --- a/backend/src/infrastructure/config/config.module.ts +++ b/backend/src/infrastructure/config/config.module.ts @@ -12,18 +12,18 @@ const NODE_ENV = process.env.NODE_ENV; envFilePath: !NODE_ENV || NODE_ENV === 'dev' ? '.env' : `.env.${NODE_ENV}`, load: [configuration], validationSchema: Joi.object({ - NODE_ENV: Joi.string().valid('dev', 'prod', 'test', 'staging').default('dev'), + NODE_ENV: Joi.string().valid('dev', 'prod', 'test', 'staging', 'local').default('local'), DB_HOST: Joi.string().required(), DB_USER: Joi.string().required(), DB_PASSWORD: Joi.string().required(), DB_NAME: Joi.string().required(), DB_PORT: Joi.any().when('NODE_ENV', { - is: 'dev', + is: 'local', then: Joi.required(), otherwise: Joi.optional() }), DB_REPLICA_SET: Joi.any().when('NODE_ENV', { - is: 'dev', + is: 'local', then: Joi.required(), otherwise: Joi.optional() }), diff --git a/backend/src/infrastructure/config/configuration.ts b/backend/src/infrastructure/config/configuration.ts index eb907d4ec..e5ec98ec1 100644 --- a/backend/src/infrastructure/config/configuration.ts +++ b/backend/src/infrastructure/config/configuration.ts @@ -13,7 +13,7 @@ export const configuration = (): Configuration => { }, database: { uri: - NODE_ENV === 'dev' + NODE_ENV === 'local' ? `mongodb://${process.env.DB_USER}:${process.env.DB_PASSWORD}@${process.env.DB_HOST}:${process.env.DB_PORT}/${process.env.DB_NAME}?authSource=admin&replicaSet=${process.env.DB_REPLICA_SET}&readPreference=primary&directConnection=true` : `mongodb://${process.env.DB_USER}:${process.env.DB_PASSWORD}@${process.env.DB_HOST}:${process.env.DB_PORT}/${process.env.DB_NAME}?ssl=true&replicaSet=globaldb&retrywrites=false&maxIdleTimeMS=120000&appName=@${process.env.DB_USER}@` }, diff --git a/docker-compose.dev.yaml b/docker-compose.local.yaml similarity index 84% rename from docker-compose.dev.yaml rename to docker-compose.local.yaml index 4936340e2..e14ff061f 100644 --- a/docker-compose.dev.yaml +++ b/docker-compose.local.yaml @@ -4,17 +4,17 @@ services: backend: build: context: backend # starts on backend folder instead on root - target: development # choose development part from Dockerfile - dockerfile: docker/dev/Dockerfile + target: local # choose development part from Dockerfile + dockerfile: docker/local/Dockerfile # image name - image: dc-dev-backend + image: split-dev-backend # container name container_name: dev-backend networks: - - dc-network + - split-network depends_on: - mongo @@ -36,16 +36,16 @@ services: frontend: build: context: frontend # to start on frontend folder - dockerfile: docker/dev/Dockerfile # path to dev Dockerfile + dockerfile: docker/local/Dockerfile # path to dev Dockerfile # set image name - image: dc-dev-frontend + image: split-dev-frontend # set container name container_name: dev-frontend networks: - - dc-network + - split-network depends_on: - backend @@ -68,7 +68,7 @@ services: restart: always container_name: mongo2 networks: - - dc-network + - split-network ports: - "27018:27017" entrypoint: "bash -c '/usr/bin/mongod --replSet $${MONGO_REPLICA_NAME} --journal --bind_ip_all'" @@ -83,7 +83,7 @@ services: volumes: - ./database/rs-init.sh:/scripts/rs-init.sh networks: - - dc-network + - split-network links: - mongo2 command: "bash -c '/usr/bin/mongod --replSet $${MONGO_REPLICA_NAME} --journal --bind_ip_all'" @@ -106,5 +106,5 @@ volumes: # Networks networks: - dc-network: + split-network: driver: bridge diff --git a/docker-compose.yaml b/docker-compose.yaml index d9e6b850f..6bbdef6f9 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -7,7 +7,7 @@ services: dockerfile: docker/prod/Dockerfile # set image name - image: dc-backend + image: split-backend # set container name container_name: backend @@ -20,7 +20,7 @@ services: restart: unless-stopped networks: - - dc-network + - split-network depends_on: - mongo frontend: @@ -33,7 +33,7 @@ services: - NEXT_PUBLIC_ENABLE_AZURE=${NEXT_PUBLIC_ENABLE_AZURE} # set image name - image: dc-frontend + image: split-frontend # set container name container_name: frontend @@ -46,7 +46,7 @@ services: restart: unless-stopped networks: - - dc-network + - split-network depends_on: - backend mongo2: @@ -54,7 +54,7 @@ services: restart: always container_name: mongo2 networks: - - dc-network + - split-network ports: - "27018:27017" entrypoint: "bash -c '/usr/bin/mongod --replSet $${MONGO_REPLICA_NAME} --journal --bind_ip_all'" @@ -71,13 +71,24 @@ services: volumes: - ./database/rs-init.sh:/scripts/rs-init.sh networks: - - dc-network + - split-network links: - mongo2 command: "bash -c '/usr/bin/mongod --replSet $${MONGO_REPLICA_NAME} --journal --bind_ip_all'" env_file: - ./database/.env + + redis: + container_name: redis + image: redis + command: /bin/sh -c "redis-server --requirepass $$REDIS_PASSWORD" + environment: + - REDIS_DISABLE_COMMANDS=FLUSHDB,FLUSHALL + ports: + - '6379:6379' + env_file: + - ./database/redis/.env networks: - dc-network: + split-network: driver: bridge diff --git a/frontend/docker/dev/Dockerfile b/frontend/docker/local/Dockerfile similarity index 100% rename from frontend/docker/dev/Dockerfile rename to frontend/docker/local/Dockerfile diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 53d8e76fd..fa3a653a8 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -10253,9 +10253,9 @@ } }, "node_modules/loader-utils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.2.tgz", - "integrity": "sha512-TM57VeHptv569d/GKh6TAYdzKblwDNiumOdkFnejjD0XwTH87K90w3O7AiJRqdQoXygvi1VQTJTLGhJl7WqA7A==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.4.tgz", + "integrity": "sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==", "dev": true, "dependencies": { "big.js": "^5.2.2", @@ -21101,9 +21101,9 @@ "integrity": "sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==" }, "loader-utils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.2.tgz", - "integrity": "sha512-TM57VeHptv569d/GKh6TAYdzKblwDNiumOdkFnejjD0XwTH87K90w3O7AiJRqdQoXygvi1VQTJTLGhJl7WqA7A==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.4.tgz", + "integrity": "sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==", "dev": true, "requires": { "big.js": "^5.2.2",