Skip to content

Commit

Permalink
Update add enviroment variable step to deploy role
Browse files Browse the repository at this point in the history
  • Loading branch information
longbui98 committed Nov 5, 2023
1 parent a6645fe commit 7f15594
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
8 changes: 7 additions & 1 deletion .circleci/ansible/roles/deploy/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,17 @@
cd /home/ubuntu
tar xvzf artifact.tar.gz -C .
- name: Add environment variable
become: true
shell: |
echo -e "NODE_ENV=local\nVERSION=1\nTYPEORM_CONNECTION=${TYPEORM_CONNECTION}\nTYPEORM_MIGRATIONS_DIR=${TYPEORM_MIGRATIONS_DIR}\nTYPEORM_ENTITIES=${TYPEORM_ENTITIES}\nTYPEORM_MIGRATIONS=${TYPEORM_MIGRATIONS}\nTYPEORM_HOST=${TYPEORM_HOST}\nTYPEORM_PORT=${TYPEORM_PORT}\nTYPEORM_USERNAME=${TYPEORM_USERNAME}\nTYPEORM_PASSWORD=${TYPEORM_PASSWORD}\nTYPEORM_DATABASE=${TYPEORM_DATABASE}"
>> /home/ubuntu/.env
- name: "start server"
become: true
become_method: sudo
become_user: root
shell:
shell: |
cd /home/ubuntu
npm install
pm2 stop default
Expand Down
13 changes: 0 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,6 @@ commands:
npm install
npm run migration:revert
fi
ensure-backend-env-exists:
description: Add .env file due to connection problems
steps:
- run:
name: Create backend .env
command: |
echo -e "NODE_ENV=local\nVERSION=1\nTYPEORM_CONNECTION=${TYPEORM_CONNECTION}\nTYPEORM_MIGRATIONS_DIR=${TYPEORM_MIGRATIONS_DIR}\nTYPEORM_ENTITIES=${TYPEORM_ENTITIES}\nTYPEORM_MIGRATIONS=${TYPEORM_MIGRATIONS}\nTYPEORM_HOST=${TYPEORM_HOST}\nTYPEORM_PORT=${TYPEORM_PORT}\nTYPEORM_USERNAME=${TYPEORM_USERNAME}\nTYPEORM_PASSWORD=${TYPEORM_PASSWORD}\nTYPEORM_DATABASE=${TYPEORM_DATABASE}"
>> ~/project/backend/.env
jobs:
build-frontend:
docker:
Expand Down Expand Up @@ -222,11 +214,6 @@ jobs:
name: Accessing key from kvdb.io
command: |
curl --insecure https://kvdb.io/VZNDWCZz5NPBkEr81irH3u/migration_${CIRCLE_WORKFLOW_ID:0:7}
- ensure-backend-env-exists
- persist_to_workspace:
root: ~/
paths:
- project/
- destroy-environment

deploy-frontend:
Expand Down

0 comments on commit 7f15594

Please sign in to comment.