Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
ci: Use local deploy script instead of CI
Alexis Sellier committed 3 years ago
commit c1d4e87d25785697218fa4280f85635c6d6bab12
parent b29321dbf7999ec7ec9b7ac9192071e512ada407
3 files changed +24 -33
modified .github/workflows/deploy.yml
@@ -39,34 +39,3 @@ 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"
modified docker-compose.yml
@@ -10,8 +10,6 @@ services:
      RUST_LOG: debug
      RAD_PASSPHRASE: seed
      RUST_BACKTRACE: 1
-
      GIT_TRACE: 1
-
      GIT_TRACE_PACKET: 1
    volumes:
      - /mnt/radicle/heartwood:/root/
    init: true
added scripts/deploy-seed
@@ -0,0 +1,24 @@
+
#!/bin/sh
+
set -e
+

+
HOST=seed.radicle.xyz
+
BRANCH="$(git rev-parse --abbrev-ref HEAD)"
+
HEAD="$(git rev-parse HEAD)"
+

+
if [ "$BRANCH" != "master" ]; then
+
  echo "You must be on the master branch to run this script."
+
  exit 1
+
fi
+

+
echo "Using commit $HEAD"
+
echo "Copying files.."
+
scp .env.seed          root@"$HOST":.env
+
scp docker-compose.yml root@"$HOST":docker-compose.yml
+

+
echo "Deploying.."
+
ssh root@$HOST << EOF
+
 docker system prune --all --force
+
 RADICLE_IMAGE_TAG=$HEAD docker-compose --file docker-compose.yml pull
+
 RADICLE_IMAGE_TAG=$HEAD docker-compose --file docker-compose.yml down
+
 RADICLE_IMAGE_TAG=$HEAD docker-compose --file docker-compose.yml up --detach
+
EOF