Skip to content

Instantly share code, notes, and snippets.

@0xjjpa
Created October 29, 2020 06:04
Show Gist options
  • Save 0xjjpa/0c09407682aec5d1a26c6ebe80404dc1 to your computer and use it in GitHub Desktop.
Save 0xjjpa/0c09407682aec5d1a26c6ebe80404dc1 to your computer and use it in GitHub Desktop.
gcloud scripts to deploy virtual machines as containers
#!/bin/bash
# Requires gcloud
# Create generic VM with a given container and a static IP while creating a disk
INSTANCE_NAME=basodino-develop-bootstrap-hoprd-1-17-6-02
DISK_NAME=$INSTANCE_NAME
SERVER_TAGS=hopr-node,grpc-server,web-client,envoy-server
DOCKER_IMAGE=gcr.io/hoprassociation/hoprd:1.17.6
IP=
gcloud compute instances create-with-container $INSTANCE_NAME \
--zone=europe-west6-a --machine-type=e2-medium \
--network-interface=address=$IP,network-tier=PREMIUM,subnet=default \
--metadata=google-logging-enabled=true --maintenance-policy=MIGRATE \
--create-disk name=$DISK_NAME,size=10GB,type=pd-ssd,mode=rw \
--container-mount-disk mount-path="/app/db"
--tags=$SERVER_TAGS \
--boot-disk-size=10GB --boot-disk-type=pd-standard \
--container-image=$DOCKER_IMAGE --container-restart-policy=always
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment