Implement backend API and database services in Docker setup
- Added a new `api` service for the NestJS backend, including health checks and dependencies on PostgreSQL, Redis, and MinIO. - Introduced PostgreSQL and Redis services with health checks and configurations for data persistence. - Added MinIO for S3-compatible object storage and a one-shot service to initialize required buckets. - Updated the Nginx configuration to proxy requests to the new backend API and MinIO storage. - Enhanced the Dockerfile to support the new API environment variables and configurations. - Updated the `package.json` and `package-lock.json` to include new dependencies for QR code generation and other utilities. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
57
backend/.github/workflows/production-bff.yml
vendored
Normal file
57
backend/.github/workflows/production-bff.yml
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
name: Deploy to Production BFF
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [production-bff]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build Image
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Configure AWS credentials
|
||||
uses: aws-actions/configure-aws-credentials@v1
|
||||
with:
|
||||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
aws-region: us-west-1
|
||||
|
||||
- name: Login to Amazon ECR
|
||||
id: login-ecr
|
||||
uses: aws-actions/amazon-ecr-login@v1
|
||||
|
||||
- name: Build image
|
||||
env:
|
||||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
|
||||
ECR_REPOSITORY: indeehub_ecr_repo_production_bff
|
||||
IMAGE_TAG: latest
|
||||
run: |
|
||||
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
|
||||
|
||||
- name: Tag image
|
||||
env:
|
||||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
|
||||
ECR_REPOSITORY: indeehub_ecr_repo_production_bff
|
||||
IMAGE_TAG: latest
|
||||
run: |
|
||||
CURRENT_SHA=${GITHUB_SHA::8}
|
||||
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:${CURRENT_SHA}
|
||||
|
||||
- name: Push image to Amazon ECR
|
||||
env:
|
||||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
|
||||
ECR_REPOSITORY: indeehub_ecr_repo_production_bff
|
||||
IMAGE_TAG: latest
|
||||
run: |
|
||||
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
|
||||
|
||||
- name: Restart ECS Cluster
|
||||
env:
|
||||
CLUSTER_NAME: indeehub-cluster-production-bff
|
||||
SERVICE_NAME: indeehub-api-service-production-bff
|
||||
run: |
|
||||
aws ecs update-service --cluster $CLUSTER_NAME --service $SERVICE_NAME --force-new-deployment
|
||||
57
backend/.github/workflows/production.yml
vendored
Normal file
57
backend/.github/workflows/production.yml
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
name: Deploy to Production
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [production]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build Image
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Configure AWS credentials
|
||||
uses: aws-actions/configure-aws-credentials@v1
|
||||
with:
|
||||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
aws-region: us-west-1
|
||||
|
||||
- name: Login to Amazon ECR
|
||||
id: login-ecr
|
||||
uses: aws-actions/amazon-ecr-login@v1
|
||||
|
||||
- name: Build image
|
||||
env:
|
||||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
|
||||
ECR_REPOSITORY: indeehub_ecr_repo_production
|
||||
IMAGE_TAG: latest
|
||||
run: |
|
||||
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
|
||||
|
||||
- name: Tag image
|
||||
env:
|
||||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
|
||||
ECR_REPOSITORY: indeehub_ecr_repo_production
|
||||
IMAGE_TAG: latest
|
||||
run: |
|
||||
CURRENT_SHA=${GITHUB_SHA::8}
|
||||
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:${CURRENT_SHA}
|
||||
|
||||
- name: Push image to Amazon ECR
|
||||
env:
|
||||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
|
||||
ECR_REPOSITORY: indeehub_ecr_repo_production
|
||||
IMAGE_TAG: latest
|
||||
run: |
|
||||
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
|
||||
|
||||
- name: Restart ECS Cluster
|
||||
env:
|
||||
CLUSTER_NAME: indeehub-cluster-production
|
||||
SERVICE_NAME: indeehub-api-service-production
|
||||
run: |
|
||||
aws ecs update-service --cluster $CLUSTER_NAME --service $SERVICE_NAME --force-new-deployment
|
||||
101
backend/.github/workflows/staging.yml
vendored
Normal file
101
backend/.github/workflows/staging.yml
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
name: Deploy to Staging
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [staging]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build Image
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Configure AWS credentials
|
||||
uses: aws-actions/configure-aws-credentials@v1
|
||||
with:
|
||||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
aws-region: us-west-1
|
||||
|
||||
- name: Login to Amazon ECR
|
||||
id: login-ecr
|
||||
uses: aws-actions/amazon-ecr-login@v1
|
||||
|
||||
- name: Build image
|
||||
env:
|
||||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
|
||||
ECR_REPOSITORY: indeehub_ecr_repo_staging
|
||||
IMAGE_TAG: latest
|
||||
run: |
|
||||
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
|
||||
|
||||
- name: Tag image
|
||||
env:
|
||||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
|
||||
ECR_REPOSITORY: indeehub_ecr_repo_staging
|
||||
IMAGE_TAG: latest
|
||||
run: |
|
||||
CURRENT_SHA=${GITHUB_SHA::8}
|
||||
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:${CURRENT_SHA}
|
||||
|
||||
- name: Push image to Amazon ECR
|
||||
env:
|
||||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
|
||||
ECR_REPOSITORY: indeehub_ecr_repo_staging
|
||||
IMAGE_TAG: latest
|
||||
run: |
|
||||
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
|
||||
|
||||
- name: Restart ECS Cluster
|
||||
env:
|
||||
CLUSTER_NAME: indeehub-cluster-staging
|
||||
SERVICE_NAME: indeehub-api-service-staging
|
||||
run: |
|
||||
aws ecs update-service --cluster $CLUSTER_NAME --service $SERVICE_NAME --force-new-deployment
|
||||
sentry:
|
||||
name: Deploy to Sentry
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: '18'
|
||||
|
||||
- name: Build and Install Dependencies
|
||||
run: npm install && npm run build
|
||||
|
||||
- name: Install Sentry CLI
|
||||
run: npm install -g @sentry/cli
|
||||
|
||||
- name: Inject and Upload Sentry Source Maps
|
||||
env:
|
||||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
||||
SENTRY_ORG: indeehub
|
||||
SENTRY_PROJECT: indeehub-api
|
||||
run: |
|
||||
sentry-cli sourcemaps inject --org $SENTRY_ORG --project $SENTRY_PROJECT ./dist
|
||||
sentry-cli sourcemaps upload --org $SENTRY_ORG --project $SENTRY_PROJECT ./dist
|
||||
|
||||
- name: Set up Sentry Release
|
||||
env:
|
||||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
||||
SENTRY_ORG: indeehub
|
||||
SENTRY_PROJECT: indeehub-api
|
||||
run: |
|
||||
sentry-cli releases new "$GITHUB_SHA"
|
||||
sentry-cli releases set-commits --auto "$GITHUB_SHA" --ignore-missing
|
||||
|
||||
- name: Notify Sentry Deployment
|
||||
env:
|
||||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
||||
SENTRY_ORG: indeehub
|
||||
SENTRY_PROJECT: indeehub-api
|
||||
run: |
|
||||
sentry-cli releases deploys "$GITHUB_SHA" new -e staging
|
||||
Reference in New Issue
Block a user