-
-
Notifications
You must be signed in to change notification settings - Fork 4
124 lines (98 loc) · 6.7 KB
/
cloud_deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: Deploy to Cloud
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
# - name: Set up SSH
# run: |
# mkdir -p ~/.ssh/
# echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
# chmod 600 ~/.ssh/id_rsa
# ssh-keyscan -H ${{ secrets.DROPLET_IP }} >> ~/.ssh/known_hosts
# cat ~/.ssh/known_hosts
- name: Docker Login
run: |
echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
- name: Clone appsettings repository
env:
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
run: |
git clone https://oauth2:${{ secrets.GITLAB_TOKEN }}@gitlab.com/distributed-asp-net-core-blazor-social-app/events_apsettings_dev.git /tmp/events_public_settings
ls -la /tmp/events_public_settings
- name: Copy appsettings to the correct locations
run: |
cp /tmp/events_public_settings/APIGateway/appsettings.json ./MiniSpace.APIGateway/src/MiniSpace.APIGateway/
cp /tmp/events_public_settings/APIGateway/appsettings.docker.json ./MiniSpace.APIGateway/src/MiniSpace.APIGateway/
cp /tmp/events_public_settings/Services.Comments/appsettings.json ./MiniSpace.Services.Comments/src/MiniSpace.Services.Comments.Api/
cp /tmp/events_public_settings/Services.Comments/appsettings.docker.json ./MiniSpace.Services.Comments/src/MiniSpace.Services.Comments.Api/
cp /tmp/events_public_settings/Services.Email/appsettings.json ./MiniSpace.Services.Email/src/MiniSpace.Services.Email.Api/
cp /tmp/events_public_settings/Services.Email/appsettings.docker.json ./MiniSpace.Services.Email/src/MiniSpace.Services.Email.Api/
cp /tmp/events_public_settings/Services.Events/appsettings.json ./MiniSpace.Services.Events/src/MiniSpace.Services.Events.Api/
cp /tmp/events_public_settings/Services.Events/appsettings.docker.json ./MiniSpace.Services.Events/src/MiniSpace.Services.Events.Api/
cp /tmp/events_public_settings/Services.Friends/appsettings.json ./MiniSpace.Services.Friends/src/MiniSpace.Services.Friends.Api/
cp /tmp/events_public_settings/Services.Friends/appsettings.docker.json ./MiniSpace.Services.Friends/src/MiniSpace.Services.Friends.Api/
cp /tmp/events_public_settings/Services.Identity/appsettings.json ./MiniSpace.Services.Identity/src/MiniSpace.Services.Identity.Api/
cp /tmp/events_public_settings/Services.Identity/appsettings.docker.json ./MiniSpace.Services.Identity/src/MiniSpace.Services.Identity.Api/
cp /tmp/events_public_settings/Services.MediaFiles/appsettings.json ./MiniSpace.Services.MediaFiles/src/MiniSpace.Services.MediaFiles.Api/
cp /tmp/events_public_settings/Services.MediaFiles/appsettings.docker.json ./MiniSpace.Services.MediaFiles/src/MiniSpace.Services.MediaFiles.Api/
cp /tmp/events_public_settings/Services.Notifications/appsettings.json ./MiniSpace.Services.Notifications/src/MiniSpace.Services.Notifications.Api/
cp /tmp/events_public_settings/Services.Notifications/appsettings.docker.json ./MiniSpace.Services.Notifications/src/MiniSpace.Services.Notifications.Api/
cp /tmp/events_public_settings/Services.Organizations/appsettings.json ./MiniSpace.Services.Organizations/src/MiniSpace.Services.Organizations.Api/
cp /tmp/events_public_settings/Services.Organizations/appsettings.docker.json ./MiniSpace.Services.Organizations/src/MiniSpace.Services.Organizations.Api/
cp /tmp/events_public_settings/Services.Posts/appsettings.json ./MiniSpace.Services.Posts/src/MiniSpace.Services.Posts.Api/
cp /tmp/events_public_settings/Services.Posts/appsettings.docker.json ./MiniSpace.Services.Posts/src/MiniSpace.Services.Posts.Api/
cp /tmp/events_public_settings/Services.Reactions/appsettings.json ./MiniSpace.Services.Reactions/src/MiniSpace.Services.Reactions.Api/
cp /tmp/events_public_settings/Services.Reactions/appsettings.docker.json ./MiniSpace.Services.Reactions/src/MiniSpace.Services.Reactions.Api/
cp /tmp/events_public_settings/Services.Reports/appsettings.json ./MiniSpace.Services.Reports/src/MiniSpace.Services.Reports.Api/
cp /tmp/events_public_settings/Services.Reports/appsettings.docker.json ./MiniSpace.Services.Reports/src/MiniSpace.Services.Reports.Api/
cp /tmp/events_public_settings/Services.Students/appsettings.json ./MiniSpace.Services.Students/src/MiniSpace.Services.Students.Api/
cp /tmp/events_public_settings/Services.Students/appsettings.docker.json ./MiniSpace.Services.Students/src/MiniSpace.Services.Students.Api/
cp /tmp/events_public_settings/Web/appsettings.json ./MiniSpace.Web/src/MiniSpace.Web/
cp /tmp/events_public_settings/Web/appsettings.Development.json ./MiniSpace.Web/src/MiniSpace.Web/
ls -la ./MiniSpace/
- name: Run dockerize_all.sh
run: |
chmod +x ./MiniSpace/scripts/dockerize-all.sh
./MiniSpace/scripts/dockerize-all.sh
- name: Check the structure
run: |
pwd
ls -la
# - name: Test SSH Connection
# run: |
# ssh -vvv ${{ secrets.DROPLET_USER }}@${{ secrets.DROPLET_IP }} "echo SSH Connection Successful"
# - name: Copy and recreate deployment files
# run: |
# scp -r ./MiniSpace/compose/infrastructure.yml ${{ secrets.DROPLET_USER }}@${{ secrets.DROPLET_IP }}:/root/social_net_app/
# scp -r ./MiniSpace/compose/services.yml ${{ secrets.DROPLET_USER }}@${{ secrets.DROPLET_IP }}:/root/social_net_app/
# scp -r ./MiniSpace/compose/prometheus ${{ secrets.DROPLET_USER }}@${{ secrets.DROPLET_IP }}:/root/social_net_app/
# scp -r ./MiniSpace/compose/rabbitmq ${{ secrets.DROPLET_USER }}@${{ secrets.DROPLET_IP }}:/root/social_net_app/
# - name: Deploy containers with the infrastructure images
# run: |
# ssh -T ${{ secrets.DROPLET_USER }}@${{ secrets.DROPLET_IP }} << EOF
# cd /root/social_net_app
# docker-compose -f infrastructure.yml up -d
# docker ps -a
# EOF
# - name: Pull latest images for services
# run: |
# ssh -T ${{ secrets.DROPLET_USER }}@${{ secrets.DROPLET_IP }} << EOF
# cd /root/social_net_app
# docker-compose -f services.yml pull
# EOF
# - name: Deploy containers with the services images
# run: |
# ssh -T ${{ secrets.DROPLET_USER }}@${{ secrets.DROPLET_IP }} << EOF
# cd /root/social_net_app
# docker-compose -f services.yml up -d
# docker ps -a
# EOF