{ "builders": [ { "type": "digitalocean", "image": "ubuntu-18-04-x64", "region": "nyc1", "size": "s-1vcpu-1gb", "snapshot_name": "syncthing-packer-{{timestamp}}", "ssh_username": "root" } ], "provisioners": [ { "type": "file", "source": "syncthing@.service", "destination": "/tmp/syncthing@.service" }, { "type": "shell", "inline": [ "sudo useradd -m syncthing", "curl -s https://syncthing.net/release-key.txt | sudo apt-key add -", "echo \"deb https://apt.syncthing.net/ syncthing stable\" | sudo tee /etc/apt/sources.list.d/syncthing.list", "sudo apt-get update", "sudo apt-get install -y syncthing", "sudo mv /tmp/syncthing@.service /etc/systemd/system/syncthing@.service", "sudo systemctl daemon-reload", "sudo systemctl enable syncthing@syncthing" ] }, { "type": "file", "source": "syncthing.conf", "destination": "/tmp/syncthing.conf" }, { "type": "shell", "inline": [ "sudo apt-get install -y nginx", "sudo mv /tmp/syncthing.conf /etc/nginx/sites-available/syncthing.conf", "sudo ln -s /etc/nginx/sites-available/syncthing.conf /etc/nginx/sites-enabled/", "sudo unlink /etc/nginx/sites-enabled/default", "sudo systemctl enable nginx" ] } ] }