This repository has been archived by the owner on Jul 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
168 lines (150 loc) · 6.02 KB
/
sandbox_build_and_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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
name: Sandbox Build and Deploy
on:
push:
branches:
- "sandbox"
paths:
- "**"
env:
# DOMAIN: jellyroom.membrane.work
# BE_HOST: server.jellyroom.membrane.work
# PROJECT: staging
# COMPOSE_FILE_NAME: docker-compose-deploy.yaml
DOMAIN: jellyroom.membrane.ovh
# JF1_HOST: jellyfish.membrane.ovh
# JF2_HOST: jellyfish1.membrane.ovh
BE_HOST: server.jellyroom.membrane.ovh
PROJECT: sandbox
COMPOSE_FILE_NAME: docker-compose-deploy.yaml
jobs:
deploy1:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set versions
id: versions
run: |
cat << EOF >> $GITHUB_OUTPUT
jellyroom=${GITHUB_SHA:0:7}
jellyfish=$(cat .jellyfish-version)
EOF
- name: Prepare .env file for the deployment
id: variables_population
run: |
echo "DOMAIN=${{env.DOMAIN}}
JELLYROOM_VERSION=${{ steps.versions.outputs.jellyroom }}
JELLYFISH_VERSION=${{ steps.versions.outputs.jellyfish }}
JF_SERVER_API_TOKEN=${{secrets.SERVER_API_TOKEN_CLOUD_SANDBOX}}
BE_HOST=${{env.BE_HOST}}
BE_JF_SECURE_CONNECTION=true
BE_JF_ADDRESSES=${{vars.JF_HOST_CLOUD_SANDBOX}}" > .env
- name: Remove old containers on first host
uses: JimCronqvist/action-ssh@master
with:
hosts: ${{ secrets.SANDBOX_IP }}
privateKey: ${{ secrets.SSH_PRIV_KEY }}
command: |
docker ps -aq | xargs -r docker stop | xargs -r docker rm
- name: Deploy docker compose to a pre-configured server on first host
uses: TapTap21/[email protected]
with:
remote_docker_host: ${{ secrets.SANDBOX_IP }}
ssh_private_key: ${{ secrets.SSH_PRIV_KEY }}
ssh_public_key: ${{ secrets.SSH_PUB_KEY }}
stack_file_name: ${{ env.COMPOSE_FILE_NAME }}
args: -p ${{ env.PROJECT }} --env-file .env up -d --remove-orphans --build frontend backend
# name: Sandbox Build and Deploy
# on:
# push:
# branches:
# - "sandbox"
# paths:
# - "**"
# env:
# DOMAIN: jellyroom.membrane.ovh
# JF1_HOST: jellyfish.membrane.ovh
# JF2_HOST: jellyfish1.membrane.ovh
# BE_HOST: server.jellyroom.membrane.ovh
# PROJECT: sandbox
# COMPOSE_FILE_NAME: docker-compose-deploy.yaml
# jobs:
# deploy1:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - name: Set versions
# id: versions
# run: |
# cat << EOF >> $GITHUB_OUTPUT
# jellyroom=${GITHUB_SHA:0:7}
# jellyfish=$(cat .jellyfish-version)
# EOF
# - name: Prepare .env file for the deployment
# id: variables_population
# run: |
# echo "DOMAIN=${{env.DOMAIN}}
# JELLYROOM_VERSION=${{ steps.versions.outputs.jellyroom }}
# JELLYFISH_VERSION=${{ steps.versions.outputs.jellyfish }}
# JF_SERVER_API_TOKEN=${{secrets.SERVER_API_TOKEN}}
# JF_CHECK_ORIGIN=false
# JF_PORT=5002
# JF1_IP=${{secrets.SANDBOX_IP}}
# JF2_IP=${{secrets.SANDBOX2_IP}}
# JF1_HOST=${{env.JF1_HOST}}
# JF2_HOST=${{env.JF2_HOST}}
# BE_HOST=${{env.BE_HOST}}
# BE_JF_SECURE_CONNECTION=true
# BE_JF_ADDRESSES=${{env.JF1_HOST}} ${{env.JF2_HOST}}
# PROM_JELLYFISH_TARGETS=jellyfish1:9568,${{secrets.SANDBOX2_IP}}:9568
# PROM_NODE_TARGETS=172.17.0.1:9100,${{secrets.SANDBOX2_IP}}:9100
# LOKI_ADDRESS=loki
# GF_SECURITY_ADMIN_PASSWORD=${{secrets.GF_SECURITY_ADMIN_PASSWORD}}
# GF_SECURITY_ADMIN_USER=${{secrets.GF_SECURITY_ADMIN_USER}}" > .env
# - name: Remove old containers on first host
# uses: JimCronqvist/action-ssh@master
# with:
# hosts: ${{ secrets.SANDBOX_IP }}
# privateKey: ${{ secrets.SSH_PRIV_KEY }}
# command: |
# docker ps -aq | xargs -r docker stop | xargs -r docker rm
# - name: Deploy docker compose to a pre-configured server on first host
# uses: TapTap21/[email protected]
# with:
# remote_docker_host: ${{ secrets.SANDBOX_IP }}
# ssh_private_key: ${{ secrets.SSH_PRIV_KEY }}
# ssh_public_key: ${{ secrets.SSH_PUB_KEY }}
# stack_file_name: ${{ env.COMPOSE_FILE_NAME }}
# args: -p ${{ env.PROJECT }} --env-file .env up -d --remove-orphans --build jellyfish1 node-exporter1 frontend backend prometheus grafana promtail loki
# deploy2:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - name: Set versions
# id: versions
# run: echo "jellyfish=$(cat .jellyfish-version)" >> $GITHUB_OUTPUT
# - name: Prepare .env file for the deployment
# id: variables_population
# run: |
# echo "JF_SERVER_API_TOKEN=${{secrets.SERVER_API_TOKEN}}
# JELLYFISH_VERSION=${{ steps.versions.outputs.jellyfish }}
# JF_CHECK_ORIGIN=false
# JF_PORT=5002
# JF1_IP=${{secrets.SANDBOX_IP}}
# JF2_IP=${{secrets.SANDBOX2_IP}}
# LOKI_ADDRESS=${{secrets.SANDBOX_IP}}
# JF2_HOST=${{env.JF2_HOST}}" > .env
# - name: Remove old containers on second host
# uses: JimCronqvist/action-ssh@master
# with:
# hosts: ${{ secrets.SANDBOX2_IP }}
# privateKey: ${{ secrets.SSH_PRIV_KEY }}
# command: |
# docker ps -aq | xargs -r docker stop | xargs -r docker rm
# - name: Deploy docker compose to a pre-configured server on second host
# uses: TapTap21/[email protected]
# with:
# remote_docker_host: ${{ secrets.SANDBOX2_IP }}
# ssh_private_key: ${{ secrets.SSH_PRIV_KEY }}
# ssh_public_key: ${{ secrets.SSH_PUB_KEY }}
# stack_file_name: ${{ env.COMPOSE_FILE_NAME }}
# args: -p ${{ env.PROJECT }} --env-file .env up -d --remove-orphans --build jellyfish2 node-exporter2 promtail