ci: Deploy built container images

This commit is contained in:
Adam Szkoda 2023-02-13 13:59:35 +01:00 committed by Alexis Sellier
parent ee513ccf7e
commit 3b0d838846
No known key found for this signature in database
3 changed files with 35 additions and 3 deletions

1
.env.seed Normal file
View File

@ -0,0 +1 @@
RADICLE_DOMAIN=seed.radicle.xyz

View File

@ -39,3 +39,34 @@ jobs:
tags: gcr.io/radicle-services/radicle-httpd:latest,gcr.io/radicle-services/radicle-httpd:${{ github.sha }}
cache-from: type=registry,ref=gcr.io/radicle-services/radicle-httpd:latest
cache-to: type=inline
deploy-seed-node:
runs-on: ubuntu-latest
needs: build-and-push-images
permissions:
contents: 'read'
id-token: 'write'
strategy:
matrix:
host: [seed]
include:
- host: seed
zone: europe-west4-c
steps:
- id: 'auth'
uses: 'google-github-actions/auth@v0'
with:
workload_identity_provider: 'projects/281042598092/locations/global/workloadIdentityPools/github-actions/providers/google-cloud'
service_account: 'github-actions@radicle-services.iam.gserviceaccount.com'
- name: Fetch host .env file
run: gcloud beta compute ssh --zone ${{ matrix.zone }} "github-actions@alt-clients-${{ matrix.host }}" --project "radicle-services" --command="curl https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/.env.${{ matrix.host }} >.env"
- name: Fetch docker-compose.yml
run: gcloud beta compute ssh --zone ${{ matrix.zone }} "github-actions@alt-clients-${{ matrix.host }}" --project "radicle-services" --command="curl https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/docker-compose.yml >docker-compose.yml"
- name: Make room for new images
run: gcloud beta compute ssh --zone ${{ matrix.zone }} "github-actions@alt-clients-${{ matrix.host }}" --project "radicle-services" --command="docker system prune --all --force"
- name: Pull container images
run: gcloud beta compute ssh --zone ${{ matrix.zone }} "github-actions@alt-clients-${{ matrix.host }}" --project "radicle-services" --command="RADICLE_IMAGE_TAG=${{ github.sha }} docker-compose --file docker-compose.yml pull"
- name: Stop services
run: gcloud beta compute ssh --zone ${{ matrix.zone }} "github-actions@alt-clients-${{ matrix.host }}" --project "radicle-services" --command="RADICLE_IMAGE_TAG=${{ github.sha }} docker-compose --file docker-compose.yml down"
- name: Restart services
run: gcloud beta compute ssh --zone ${{ matrix.zone }} "github-actions@alt-clients-${{ matrix.host }}" --project "radicle-services" --command="RADICLE_IMAGE_TAG=${{ github.sha }} docker-compose --file docker-compose.yml up --detach"

View File

@ -9,7 +9,7 @@ services:
RUST_LOG: debug
RAD_PASSPHRASE: seed
volumes:
- /var/opt/radicle:/root/.radicle
- /mnt/radicle/heartwood:/root/
init: true
container_name: radicle-node
restart: unless-stopped
@ -29,7 +29,7 @@ services:
environment:
RUST_LOG: debug
volumes:
- /var/opt/radicle:/root/.radicle
- /mnt/radicle/heartwood:/root/
init: true
container_name: radicle-httpd
restart: unless-stopped
@ -46,7 +46,7 @@ services:
- -euc
- |
cat <<EOF >/etc/caddy/Caddyfile
{$RADICLE_DOMAIN} {
$RADICLE_DOMAIN {
reverse_proxy radicle-httpd:8080
}
EOF