Skip to content

Instantly share code, notes, and snippets.

@atotto
Created May 12, 2018 08:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atotto/5465ef3a40bfc5431bfe62a3c706b187 to your computer and use it in GitHub Desktop.
Save atotto/5465ef3a40bfc5431bfe62a3c706b187 to your computer and use it in GitHub Desktop.
influxdb gce deploy with cloud-init
#cloud-config
#see: https://cloud.google.com/container-optimized-os/docs/how-to/create-configure-instance
write_files:
- path: /etc/systemd/system/influxdb.service
permissions: 0644
owner: root
content: |
[Unit]
Description=Start influxdb docker container
[Service]
ExecStart=/usr/bin/docker run --rm --name influxdb -p 80:8086 influxdb:latest
ExecStop=/usr/bin/docker stop influxdb
ExecStopPost=/usr/bin/docker rm influxdb
runcmd:
- systemctl daemon-reload
- systemctl start influxdb.service
@atotto
Copy link
Author

atotto commented May 12, 2018

export PROJECT="your project"

gcloud compute instances create us-instance-1 --project ${PROJECT} --zone us-central1-f --image cos-stable-66-10452-89-0 --image-project cos-cloud --machine-type f1-micro --metadata-from-file user-data=cloud.cfg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment