diff --git a/bootstrap.sh b/bootstrap.sh index a32ff72..adb0f5c 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -16,6 +16,8 @@ if [ "${UPGRADE_PACKAGES}" != "none" ]; then sudo apt-get upgrade -y fi +sudo ufw allow 60000:60020/udp + sudo apt-get install -qy \ curl \ default-jdk \ @@ -23,6 +25,7 @@ sudo apt-get install -qy \ jq \ libz-dev \ maven \ + mosh \ nodejs \ npm \ perl \ diff --git a/scripts/digital_ocean_client.py b/scripts/digital_ocean_client.py index eb41311..aaa2a26 100644 --- a/scripts/digital_ocean_client.py +++ b/scripts/digital_ocean_client.py @@ -2,6 +2,7 @@ import json import time import rest_client +import os class DigitalOceanClient(): BASE_URL = 'https://api.digitalocean.com' @@ -81,6 +82,11 @@ def get_droplet_info(self, image): apt install update && apt install upgrade apt install -y mosh sudo ufw allow 60000:60020/udp''' + + if os.path.exists('bootstrap.sh'): + with open('bootstrap.sh') as f: + user_data = ''.join(f.read()) + payload = {'name' : self.droplet_name, 'region' : 'nyc1', @@ -164,4 +170,4 @@ def clean_snapshots(self, snapshot_name): for snapshot in snapshots: name = snapshot.get('name') if self.droplet_name in name and name != snapshot_name: - self.delete_snapshot(snapshot) + self.delete_snapshot(snapshot) \ No newline at end of file