From f6d35c94da062ada0101fb16fd833bc211549bb2 Mon Sep 17 00:00:00 2001 From: Ryan Uber Date: Thu, 24 Sep 2015 12:03:28 -0700 Subject: [PATCH] demo/digitalocean: add statsite --- .../digitalocean/packer/statsite/default.conf | 2 + demo/digitalocean/packer/statsite/packer.json | 50 +++++++++++++++++++ .../packer/statsite/upstart.statsite | 10 ++++ 3 files changed, 62 insertions(+) create mode 100644 demo/digitalocean/packer/statsite/default.conf create mode 100644 demo/digitalocean/packer/statsite/packer.json create mode 100644 demo/digitalocean/packer/statsite/upstart.statsite diff --git a/demo/digitalocean/packer/statsite/default.conf b/demo/digitalocean/packer/statsite/default.conf new file mode 100644 index 000000000..c463054e3 --- /dev/null +++ b/demo/digitalocean/packer/statsite/default.conf @@ -0,0 +1,2 @@ +[statsite] +stream_cmd = cat >> /opt/statsite.out diff --git a/demo/digitalocean/packer/statsite/packer.json b/demo/digitalocean/packer/statsite/packer.json new file mode 100644 index 000000000..cc60336b5 --- /dev/null +++ b/demo/digitalocean/packer/statsite/packer.json @@ -0,0 +1,50 @@ +{ + "variables": { + "bin_url": "{{ env `STATSITE_URL` }}" + }, + "builders": [ + { + "type": "digitalocean", + "image": "ubuntu-12-04-x64", + "region": "nyc3", + "size": "512mb", + "snapshot_name": "nomad-{{timestamp}}" + } + ], + "provisioners": [ + { + "type": "shell", + "inline": [ + "sudo apt-get -y update", + "sudo apt-get -y install unzip build-essential scons", + "curl -o /tmp/statsite.zip -L {{ user `bin_url` }}", + "mkdir -p /tmp/statsite", + "unzip -d /tmp/statsite /tmp/statsite.zip", + "cd /tmp/statsite/* && make", + "mv /tmp/statsite/*/statsite /usr/local/bin", + "rm -rf /tmp/statsite" + ] + }, + { + "type": "file", + "source": "upstart.statsite", + "destination": "/etc/init/statsite.conf" + }, + { + "type": "file", + "source": "default.conf", + "destination": "/usr/local/etc/statsite.conf" + } + ], + "post-processors": [ + { + "type": "atlas", + "artifact": "hashicorp/noad-demo-statsite", + "artifact_type": "digitalocean.image" + } + ], + "push": { + "name": "hashicorp/nomad-demo-statsite", + "vcs": true + } +} diff --git a/demo/digitalocean/packer/statsite/upstart.statsite b/demo/digitalocean/packer/statsite/upstart.statsite new file mode 100644 index 000000000..8ab0673fc --- /dev/null +++ b/demo/digitalocean/packer/statsite/upstart.statsite @@ -0,0 +1,10 @@ +description "Statsite" + +start on runlevel [2345] +stop on runlevel [!2345] + +respawn + +script + exec /usr/local/bin/statsite -f /usr/local/etc/statsite.conf >> /var/log/statsite.log 2>&1 +end script