diff --git a/prod/nginx/packer/nginx.json b/prod/nginx/packer/nginx.json new file mode 100644 index 0000000..75ad389 --- /dev/null +++ b/prod/nginx/packer/nginx.json @@ -0,0 +1,26 @@ +{ + "builders": [ + { + "type": "digitalocean", + "image": "ubuntu-18-04-x64", + "region": "nyc1", + "size": "s-1vcpu-1gb", + "snapshot_name": "packer-nginx-{{timestamp}}", + "ssh_username": "root" + } + ], + "provisioners": [ + { + "type": "shell", + "script": "scripts/dependencies.sh" + }, + { + "type": "file", + "source": "files/nginx.conf" + }, + { + "type": "shell", + "script": "scripts/nginx.sh" + } + ] +} diff --git a/prod/nginx/packer/scripts/dependencies.sh b/prod/nginx/packer/scripts/dependencies.sh new file mode 100644 index 0000000..83696df --- /dev/null +++ b/prod/nginx/packer/scripts/dependencies.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +set -xe + +sudo apt-get update +sudo apt-get install -y nginx diff --git a/prod/nginx/packer/scripts/nginx.sh b/prod/nginx/packer/scripts/nginx.sh new file mode 100644 index 0000000..aaa2e54 --- /dev/null +++ b/prod/nginx/packer/scripts/nginx.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -xe + +sudo systemctl enable nginx