Add gcloud build and deploy workflow (#4)
* Add gcloud workflow to build, push, and deploy single container image instance * Add 'seeder' tag to instance The existing firewall rule 'allow-inbound-dns' should be applied automatically to instances with this tag. * Use machine type n1-highcpu-4 * Add seeder-zfnd-org-startup-script.sh, use that in deploy * Add additional seeders
This commit is contained in:
parent
4bd1ae2a09
commit
048f11288e
|
@ -0,0 +1,52 @@
|
|||
name: gcloud
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
env:
|
||||
PROJECT_ID: ecosystem-infrastructure
|
||||
GCLOUD_ZONE: us-central1-a
|
||||
|
||||
jobs:
|
||||
build-deploy:
|
||||
name: Google Cloud Build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@master
|
||||
|
||||
- name: Set project and image names
|
||||
run: |
|
||||
BRANCH_NAME=$GITHUB_REPOSITORY/$(expr $GITHUB_REF : '.*/\(.*\)') && \
|
||||
BRANCH_NAME=${BRANCH_NAME,,} && \
|
||||
echo "::set-env name=BRANCH_NAME::$BRANCH_NAME" && \
|
||||
echo "::set-env name=SHA7::$(git rev-parse --short=7 $GITHUB_SHA)"
|
||||
|
||||
# Setup gcloud CLI
|
||||
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
|
||||
with:
|
||||
version: '295.0.0'
|
||||
project_id: ${{ env.PROJECT_ID }}
|
||||
service_account_key: ${{ secrets.GCLOUD_SA_KEY }}
|
||||
|
||||
# Build and push image to Google Container Registry
|
||||
- name: Build
|
||||
# Tagging w/ the commit SHA blocks the :latest tag on GCR
|
||||
run: |
|
||||
gcloud builds submit \
|
||||
--tag "gcr.io/$PROJECT_ID/$BRANCH_NAME:$SHA7"
|
||||
|
||||
# Deploy image to Compute Engine
|
||||
- name: Deploy
|
||||
run: |
|
||||
gcloud compute instances create-with-container "zfnd-seeder-$SHA7" \
|
||||
--zone "$GCLOUD_ZONE" \
|
||||
--service-account instance-service-account@ecosystem-infrastructure.iam.gserviceaccount.com \
|
||||
--scopes cloud-platform \
|
||||
--machine-type n1-highcpu-4 \
|
||||
--container-image "gcr.io/$PROJECT_ID/$BRANCH_NAME:$SHA7" \
|
||||
--tags seeder \
|
||||
--metadata-from-file startup-script=scripts/seeder-zfnd-org-startup.sh \
|
||||
--container-mount-host-path mount-path=/etc/dnsseeder,host-path=/etc/dnsseeder,mode=ro
|
|
@ -0,0 +1 @@
|
|||
*~
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/bash
|
||||
|
||||
systemctl stop systemd-resolved
|
||||
|
||||
if [ ! -d /etc/dnsseeder ]; then
|
||||
mkdir -p /etc/dnsseeder
|
||||
fi
|
||||
|
||||
cat <<EOF > /etc/dnsseeder/Corefile
|
||||
mainnet.seeder.zfnd.org {
|
||||
dnsseed {
|
||||
network mainnet
|
||||
bootstrap_peers mainnet.z.cash:8233 dnsseed.str4d.xyz:8233 mainnet.is.yolo.money:8233 mainnet.seeder.zfnd.org:8233
|
||||
crawl_interval 30m
|
||||
record_ttl 600
|
||||
}
|
||||
}
|
||||
|
||||
testnet.seeder.zfnd.org {
|
||||
dnsseed {
|
||||
network testnet
|
||||
bootstrap_peers testnet.z.cash:18233 testnet.is.yolo.money:18233 testnet.seeder.zfnd.org:18233
|
||||
crawl_interval 15m
|
||||
record_ttl 300
|
||||
}
|
||||
}
|
||||
EOF
|
Loading…
Reference in New Issue