Skip to content

Commit

Permalink
remove stale env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
khanzadimahdi committed Jan 11, 2025
1 parent 29f8945 commit af8fdf4
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 40 deletions.
2 changes: 0 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ NATS_URL=nats:4222
INTERNAL_BACKEND_BASE_URL=https://backend.tarhche.com
NEXT_PUBLIC_FILES_PROTOCOL=https
NEXT_PUBLIC_FILES_HOST=backend.tarhche.com
NEXT_PUBLIC_FILES_PORT=80

## frontend local
# INTERNAL_BACKEND_BASE_URL=http://app
# NEXT_PUBLIC_FILES_PROTOCOL=http
# NEXT_PUBLIC_FILES_HOST=127.0.0.1
# NEXT_PUBLIC_FILES_PORT=8000
54 changes: 27 additions & 27 deletions .github/workflows/backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
- name: Deploy services
run: |
# Setup ssh key
echo "${{ secrets.EC2_SSH_PRIVATE_KEY }}" > ~/ec2-key.pem
echo '${{ secrets.EC2_SSH_PRIVATE_KEY }}' > ~/ec2-key.pem
chmod 400 ~/ec2-key.pem
mkdir -p ~/.ssh
Expand All @@ -109,32 +109,32 @@ jobs:
# Connect and deploy services
ssh -q -i ~/ec2-key.pem -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $EC2_SSH_ENDPOINT > /dev/null 2>&1 << 'EOF'
export MONGO_USERNAME="${{ secrets.MONGO_USERNAME }}"
export MONGO_PASSWORD="${{ secrets.MONGO_PASSWORD }}"
export BACKEND_NATS_URL="${{ secrets.BACKEND_NATS_URL }}"
export BACKEND_PRIVATE_KEY="${{ secrets.BACKEND_PRIVATE_KEY }}"
export BACKEND_MONGO_HOST="mongodb"
export BACKEND_MONGO_PORT="27017"
export BACKEND_MONGO_SCHEME="mongodb"
export BACKEND_MONGO_DATABASE_NAME="${{ secrets.BACKEND_MONGO_DATABASE_NAME }}"
export BACKEND_MONGO_USERNAME="${{ secrets.MONGO_USERNAME }}"
export BACKEND_MONGO_PASSWORD="${{ secrets.MONGO_PASSWORD }}"
export BACKEND_MAIL_SMTP_PASSWORD="${{ secrets.BACKEND_MAIL_SMTP_PASSWORD }}"
export BACKEND_MAIL_SMTP_HOST="${{ secrets.BACKEND_MAIL_SMTP_HOST }}"
export BACKEND_MAIL_SMTP_FROM="${{ secrets.BACKEND_MAIL_SMTP_FROM }}"
export BACKEND_MAIL_SMTP_USERNAME="${{ secrets.BACKEND_MAIL_SMTP_USERNAME }}"
export BACKEND_MAIL_SMTP_PORT="${{ secrets.BACKEND_MAIL_SMTP_PORT }}"
export BACKEND_S3_ENDPOINT="${{ secrets.BACKEND_S3_ENDPOINT }}"
export BACKEND_S3_SECRET_KEY="${{ secrets.BACKEND_S3_SECRET_KEY }}"
export BACKEND_S3_ACCESS_KEY="${{ secrets.BACKEND_S3_ACCESS_KEY }}"
export BACKEND_S3_USE_SSL="${{ secrets.BACKEND_S3_USE_SSL }}"
export BACKEND_S3_BUCKET_NAME="${{ secrets.BACKEND_S3_BUCKET_NAME }}"
export APP_IMAGE="${{ secrets.APP_IMAGE }}"
export MONGO_USERNAME='${{ secrets.MONGO_USERNAME }}'
export MONGO_PASSWORD='${{ secrets.MONGO_PASSWORD }}'
export BACKEND_NATS_URL='${{ secrets.BACKEND_NATS_URL }}'
export BACKEND_PRIVATE_KEY='${{ secrets.BACKEND_PRIVATE_KEY }}'
export BACKEND_MONGO_HOST='mongodb'
export BACKEND_MONGO_PORT='27017'
export BACKEND_MONGO_SCHEME='mongodb'
export BACKEND_MONGO_DATABASE_NAME='${{ secrets.BACKEND_MONGO_DATABASE_NAME }}'
export BACKEND_MONGO_USERNAME='${{ secrets.MONGO_USERNAME }}'
export BACKEND_MONGO_PASSWORD='${{ secrets.MONGO_PASSWORD }}'
export BACKEND_MAIL_SMTP_PASSWORD='${{ secrets.BACKEND_MAIL_SMTP_PASSWORD }}'
export BACKEND_MAIL_SMTP_HOST='${{ secrets.BACKEND_MAIL_SMTP_HOST }}'
export BACKEND_MAIL_SMTP_FROM='${{ secrets.BACKEND_MAIL_SMTP_FROM }}'
export BACKEND_MAIL_SMTP_USERNAME='${{ secrets.BACKEND_MAIL_SMTP_USERNAME }}'
export BACKEND_MAIL_SMTP_PORT='${{ secrets.BACKEND_MAIL_SMTP_PORT }}'
export BACKEND_S3_ENDPOINT='${{ secrets.BACKEND_S3_ENDPOINT }}'
export BACKEND_S3_SECRET_KEY='${{ secrets.BACKEND_S3_SECRET_KEY }}'
export BACKEND_S3_ACCESS_KEY='${{ secrets.BACKEND_S3_ACCESS_KEY }}'
export BACKEND_S3_USE_SSL='${{ secrets.BACKEND_S3_USE_SSL }}'
export BACKEND_S3_BUCKET_NAME='${{ secrets.BACKEND_S3_BUCKET_NAME }}'
export APP_IMAGE='${{ secrets.APP_IMAGE }}'
# Run Docker Compose
cd /tmp/deployment_backend/
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/frontend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ env:
EC2_SSH_ADDRESS: ${{ secrets.EC2_SSH_ADDRESS }}
EC2_SSH_ENDPOINT: ${{ secrets.EC2_SSH_USER }}@${{ secrets.EC2_SSH_ADDRESS }}

INTERNAL_BACKEND_BASE_URL: ${{ secrets.INTERNAL_BACKEND_BASE_URL }}
NEXT_PUBLIC_FILES_PROTOCOL: https
NEXT_PUBLIC_FILES_HOST: ${{ secrets.NEXT_PUBLIC_FILES_HOST }}

jobs:
ci:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -82,7 +86,7 @@ jobs:
- name: Deploy services
run: |
# Setup ssh key
echo "${{ secrets.EC2_SSH_PRIVATE_KEY }}" > ~/ec2-key.pem
echo '${{ secrets.EC2_SSH_PRIVATE_KEY }}' > ~/ec2-key.pem
chmod 400 ~/ec2-key.pem
mkdir -p ~/.ssh
Expand All @@ -99,10 +103,10 @@ jobs:
# Connect and deploy services
ssh -q -i ~/ec2-key.pem -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $EC2_SSH_ENDPOINT > /dev/null 2>&1 << 'EOF'
export FRONTEND_IMAGE="${{ secrets.FRONTEND_IMAGE }}"
export NEXT_PUBLIC_EXTERNAL_BACKEND_BASE_URL="${{ secrets.NEXT_PUBLIC_EXTERNAL_BACKEND_BASE_URL }}"
export INTERNAL_BACKEND_BASE_URL="${{ secrets.INTERNAL_BACKEND_BASE_URL }}"
export NEXT_PUBLIC_FILES_BASE_URL="${{ secrets.NEXT_PUBLIC_FILES_BASE_URL }}"
export FRONTEND_IMAGE='${{ secrets.FRONTEND_IMAGE }}'
export INTERNAL_BACKEND_BASE_URL='${{ env.INTERNAL_BACKEND_BASE_URL }}'
export NEXT_PUBLIC_FILES_PROTOCOL='${{ env.NEXT_PUBLIC_FILES_PROTOCOL }}'
export NEXT_PUBLIC_FILES_HOST='${{ env.NEXT_PUBLIC_FILES_HOST }}'
# Run Docker Compose
cd /tmp/deployment_frontend/
Expand Down
1 change: 0 additions & 1 deletion compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ services:
INTERNAL_BACKEND_BASE_URL: ${INTERNAL_BACKEND_BASE_URL}
NEXT_PUBLIC_FILES_PROTOCOL: ${NEXT_PUBLIC_FILES_PROTOCOL}
NEXT_PUBLIC_FILES_HOST: ${NEXT_PUBLIC_FILES_HOST}
NEXT_PUBLIC_FILES_PORT: ${NEXT_PUBLIC_FILES_PORT}
command: >
sh -c "npm install; npm run dev -- --hostname \"0.0.0.0\" --port 3000"
Expand Down
1 change: 0 additions & 1 deletion frontend/.env.local.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
INTERNAL_BACKEND_BASE_URL=https://backend.tarhche.com
NEXT_PUBLIC_FILES_PROTOCOL=https
NEXT_PUBLIC_FILES_HOST=backend.tarhche.com
NEXT_PUBLIC_FILES_PORT=80
4 changes: 2 additions & 2 deletions frontend/compose.frontend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ services:
delay: 5s
max_attempts: 3
environment:
NEXT_PUBLIC_EXTERNAL_BACKEND_BASE_URL: ${NEXT_PUBLIC_EXTERNAL_BACKEND_BASE_URL}
INTERNAL_BACKEND_BASE_URL: ${INTERNAL_BACKEND_BASE_URL}
NEXT_PUBLIC_FILES_BASE_URL: ${NEXT_PUBLIC_FILES_BASE_URL}
NEXT_PUBLIC_FILES_PROTOCOL: ${NEXT_PUBLIC_FILES_PROTOCOL}
NEXT_PUBLIC_FILES_HOST: ${NEXT_PUBLIC_FILES_HOST}

networks:
frontend:
Expand Down
1 change: 0 additions & 1 deletion frontend/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const nextConfig = {
{
protocol: process.env.NEXT_PUBLIC_FILES_PROTOCOL,
hostname: process.env.NEXT_PUBLIC_FILES_HOST,
port: process.env.NEXT_PUBLIC_FILES_PORT,
},
],
},
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/constants/envs.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const INTERNAL_BACKEND_URL = process.env.INTERNAL_BACKEND_BASE_URL;
export const FILES_PUBLIC_URL = `${process.env.NEXT_PUBLIC_FILES_PROTOCOL}://${process.env.NEXT_PUBLIC_FILES_HOST}:${process.env.NEXT_PUBLIC_FILES_PORT}/files`;
export const FILES_PUBLIC_URL = `${process.env.NEXT_PUBLIC_FILES_PROTOCOL}://${process.env.NEXT_PUBLIC_FILES_HOST}/files`;

0 comments on commit af8fdf4

Please sign in to comment.