File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515 with :
1616 fetch-depth : 0
1717
18- - name : Deploy via SSH
18+ - name : Install Ansible
19+ run : sudo apt-get update && sudo apt-get install -y ansible
20+
21+ - name : Deploy via SSH and Ansible
1922 uses : appleboy/ssh-action@v1
2023 with :
2124 host : ${{ secrets.SERVER_IP }}
2427 script : |
2528 cd /opt/CookieLess/backend
2629 git pull origin main
27- sudo docker-compose down
28- sudo docker-compose up -d --build
30+ export MONGO_INITDB_ROOT_USERNAME="${{ secrets.MONGO_INITDB_ROOT_USERNAME }}"
31+ export MONGO_INITDB_ROOT_PASSWORD="${{ secrets.MONGO_INITDB_ROOT_PASSWORD }}"
32+ ansible-playbook ansible/playbook.yml
Original file line number Diff line number Diff line change 1818 src : ../backend
1919 dest : /opt/cookieless
2020
21+ - name : Create .env file for docker-compose
22+ copy :
23+ dest : /opt/cookieless/backend/.env
24+ content : |
25+ MONGO_INITDB_ROOT_USERNAME={{ lookup('env', 'MONGO_INITDB_ROOT_USERNAME') }}
26+ MONGO_INITDB_ROOT_PASSWORD={{ lookup('env', 'MONGO_INITDB_ROOT_PASSWORD') }}
27+
2128 - name : Start containers
2229 command : docker-compose -f /opt/cookieless/docker-compose.yml up -d
Original file line number Diff line number Diff line change @@ -16,8 +16,8 @@ services:
1616 ports :
1717 - " 27017:27017"
1818 environment :
19- MONGO_INITDB_ROOT_USERNAME : ${{ secrets. MONGO_INITDB_ROOT_USERNAME } }
20- MONGO_INITDB_ROOT_PASSWORD : ${{ secrets. MONGO_INITDB_ROOT_PASSWORD } }
19+ MONGO_INITDB_ROOT_USERNAME : ${MONGO_INITDB_ROOT_USERNAME}
20+ MONGO_INITDB_ROOT_PASSWORD : ${MONGO_INITDB_ROOT_PASSWORD}
2121
2222 nginx :
2323 image : nginx:latest
@@ -31,4 +31,4 @@ services:
3131
3232volumes :
3333 mongodb_data :
34- stats_data :
34+ stats_data:
You can’t perform that action at this time.
0 commit comments