Created
July 23, 2015 23:22
-
-
Save johnpauljanecek/1252a4b0c626bbc62410 to your computer and use it in GitHub Desktop.
Digital Ocean Notebook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"import digitalocean,servers.secret,urllib3\n", | |
"manager = digitalocean.Manager(token=servers.secret.digitalOceanToken)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [], | |
"source": [ | |
"import servers.digitalocean_config\n", | |
"reload(servers.digitalocean_config)\n", | |
"import servers.digitalocean_config as doConfig" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"#display digitalocean data" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/html": [ | |
"<table><tr><th>index</th><th>name</th><th>type</th><th>created_at</th><th>min_size</th><th>min_disk_size</th></tr><tr><td>0</td><td>dockersnap</td><td>snapshot</td><td>2015-07-14T16:20:19Z</td><td>None</td><td>20</td></tr><tr><td>1</td><td>Docker-10</td><td>snapshot</td><td>2015-07-16T11:11:32Z</td><td>None</td><td>20</td></tr><tr><td>2</td><td>docker-20 with videos</td><td>snapshot</td><td>2015-07-19T13:41:35Z</td><td>None</td><td>40</td></tr><tr><td>3</td><td>Video Manager 80</td><td>snapshot</td><td>2015-07-19T14:17:27Z</td><td>None</td><td>80</td></tr><tr><td>4</td><td>docker-80-search</td><td>snapshot</td><td>2015-07-19T16:51:46Z</td><td>None</td><td>80</td></tr><tr><td>5</td><td>Docker-80-1-back</td><td>snapshot</td><td>2015-07-20T23:20:43Z</td><td>None</td><td>80</td></tr><tr><td>6</td><td>Docker-80-2-back</td><td>snapshot</td><td>2015-07-20T23:41:10Z</td><td>None</td><td>80</td></tr><tr><td>7</td><td>Docker-80-4-back</td><td>snapshot</td><td>2015-07-20T23:44:33Z</td><td>None</td><td>80</td></tr><tr><td>8</td><td>docker-10-search-july-23</td><td>snapshot</td><td>2015-07-23T00:14:34Z</td><td>None</td><td>30</td></tr></table>" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"execution_count": 6, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"doConfig.display_images(manager)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 7, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/html": [ | |
"<table><tr><th>index</th><th>price_monthly</th><th>price_hourly</th><th>vcpus</th><th>memory</th><th>disk</th></tr><tr><td>0</td><td>5.0</td><td>0.00744</td><td>1</td><td>512</td><td>20</td></tr><tr><td>1</td><td>10.0</td><td>0.01488</td><td>1</td><td>1024</td><td>30</td></tr><tr><td>2</td><td>20.0</td><td>0.02976</td><td>2</td><td>2048</td><td>40</td></tr><tr><td>3</td><td>40.0</td><td>0.05952</td><td>2</td><td>4096</td><td>60</td></tr><tr><td>4</td><td>80.0</td><td>0.11905</td><td>4</td><td>8192</td><td>80</td></tr><tr><td>5</td><td>160.0</td><td>0.2381</td><td>8</td><td>16384</td><td>160</td></tr><tr><td>6</td><td>320.0</td><td>0.47619</td><td>12</td><td>32768</td><td>320</td></tr><tr><td>7</td><td>480.0</td><td>0.71429</td><td>16</td><td>49152</td><td>480</td></tr><tr><td>8</td><td>640.0</td><td>0.95238</td><td>20</td><td>65536</td><td>640</td></tr></table>" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"execution_count": 7, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"doConfig.display_sizes(manager)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"#Creating a droplet from backup" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 30, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"images = manager.get_my_images()\n", | |
"sshKeys = manager.get_all_sshkeys()\n", | |
"slugSizes = manager.get_all_sizes()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 31, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"u'Docker-80-2-back'" | |
] | |
}, | |
"execution_count": 31, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"restoreImage = images[6]\n", | |
"restoreImage.name" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 32, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"droplet80 = digitalocean.Droplet(token=servers.secret.digitalOceanToken,\n", | |
" name = restoreImage.name,\n", | |
" region= restoreImage.regions[0], \n", | |
" image= restoreImage.id, \n", | |
" size_slug= slugSizes[4].slug,\n", | |
" ssh_keys = sshKeys,\n", | |
" backups = False)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 34, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [], | |
"source": [ | |
"droplet80.create()" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Checked the status of the creation of the droplet" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 36, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"u'in-progress'" | |
] | |
}, | |
"execution_count": 36, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"action = droplet80.get_actions()[0]\n", | |
"action.status" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"When it is complete it should say complete" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 39, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"u'completed'" | |
] | |
}, | |
"execution_count": 39, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"action = droplet80.get_actions()[0]\n", | |
"action.status" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"#Display the droplets we have ip there" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 40, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/html": [ | |
"<table><tr><th>index</th><th>name</th><th>ip_address</th><th>created_at</th><th>image</th><th>size</th></tr><tr><td>0</td><td>mongo-5</td><td>128.199.217.2</td><td>2015-07-18T15:07:32Z</td><td>{u'min_disk_size': 20, u'slug': u'mongodb', u'name': u'MongoDB 3.0.4 on 14.04', u'created_at': u'2015-06-24T20:11:39Z', u'id': 12467027, u'regions': [u'nyc1', u'ams1', u'sfo1', u'nyc2', u'ams2', u'sgp1', u'lon1', u'nyc3', u'ams3', u'fra1'], u'distribution': u'Ubuntu', u'type': u'snapshot', u'public': True}</td><td>{u'price_monthly': 5.0, u'available': True, u'transfer': 1.0, u'price_hourly': 0.00744, u'regions': [u'nyc1', u'sgp1', u'ams1', u'sfo1', u'nyc2', u'lon1', u'nyc3', u'ams3', u'ams2', u'fra1'], u'vcpus': 1, u'memory': 512, u'disk': 20, u'slug': u'512mb'}</td></tr><tr><td>1</td><td>Docker-80-2-back</td><td>128.199.76.33</td><td>2015-07-23T20:20:28Z</td><td>{u'min_disk_size': 80, u'slug': None, u'name': u'Docker-80-2-back', u'created_at': u'2015-07-20T23:41:10Z', u'id': 12830635, u'regions': [u'sgp1'], u'distribution': u'Ubuntu', u'type': u'snapshot', u'public': False}</td><td>{u'price_monthly': 80.0, u'available': True, u'transfer': 5.0, u'price_hourly': 0.11905, u'regions': [u'nyc2', u'sgp1', u'ams1', u'nyc1', u'lon1', u'nyc3', u'ams3', u'ams2', u'sfo1', u'fra1'], u'vcpus': 4, u'memory': 8192, u'disk': 80, u'slug': u'8gb'}</td></tr></table>" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"execution_count": 40, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"droplets = manager.get_all_droplets()\n", | |
"doConfig.display_droplets(droplets)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"rewrite the .ssh files so we can ssh to the droplets" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 41, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"(u'128.199.217.2', u'mongo-5')\n", | |
"(u'128.199.76.33', u'Docker-80-2-back')\n" | |
] | |
} | |
], | |
"source": [ | |
"#setup .ssh, has to be in this order\n", | |
"doConfig.create_ssh_config(droplets)\n", | |
"doConfig.add_to_known_hosts(droplets)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"This creates a list of plumbum SshMachines \n", | |
"https://plumbum.readthedocs.org/en/latest/remote.html#remote-machines" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 8, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"sshRems = doConfig.create_ssh(droplets,keyfile = None)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 9, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"ssh1 = sshRems[1]" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 10, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"u'Docker-80-2-back\\n'" | |
] | |
}, | |
"execution_count": 10, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"ssh1[\"hostname\"]()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 11, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"from rpyc.utils.zerodeploy import DeployedServer" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"now we can start running command on the droplet" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 45, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"u'Ign http://mirrors.digitalocean.com trusty InRelease\\nIgn http://mirrors.digitalocean.com trusty-updates InRelease\\nIgn http://security.ubuntu.com trusty-security InRelease\\nHit http://mirrors.digitalocean.com trusty Release.gpg\\nGet:1 http://mirrors.digitalocean.com trusty-updates Release.gpg [933 B]\\nGet:2 http://security.ubuntu.com trusty-security Release.gpg [933 B]\\nHit http://mirrors.digitalocean.com trusty Release\\nGet:3 http://mirrors.digitalocean.com trusty-updates Release [63.5 kB]\\nGet:4 http://security.ubuntu.com trusty-security Release [63.5 kB]\\nHit http://mirrors.digitalocean.com trusty/main Sources\\nHit http://mirrors.digitalocean.com trusty/universe Sources\\nGet:5 https://get.docker.com docker InRelease\\nHit http://mirrors.digitalocean.com trusty/main amd64 Packages\\nHit http://mirrors.digitalocean.com trusty/universe amd64 Packages\\nHit http://mirrors.digitalocean.com trusty/main i386 Packages\\nHit http://mirrors.digitalocean.com trusty/universe i386 Packages\\nIgn https://get.docker.com docker InRelease\\nHit http://mirrors.digitalocean.com trusty/main Translation-en\\nGet:6 http://security.ubuntu.com trusty-security/main Sources [88.7 kB]\\nHit https://get.docker.com docker Release.gpg\\nHit http://mirrors.digitalocean.com trusty/universe Translation-en\\nHit https://get.docker.com docker Release\\nGet:7 http://mirrors.digitalocean.com trusty-updates/main Sources [215 kB]\\nGet:8 http://mirrors.digitalocean.com trusty-updates/universe Sources [125 kB]\\nGet:9 http://mirrors.digitalocean.com trusty-updates/main amd64 Packages [575 kB]\\nHit https://get.docker.com docker/main amd64 Packages\\nGet:10 http://security.ubuntu.com trusty-security/universe Sources [28.1 kB]\\nGet:11 http://mirrors.digitalocean.com trusty-updates/universe amd64 Packages [296 kB]\\nHit https://get.docker.com docker/main i386 Packages\\nGet:12 http://security.ubuntu.com trusty-security/main amd64 Packages [315 kB]\\nGet:13 http://mirrors.digitalocean.com trusty-updates/main i386 Packages [559 kB]\\nGet:14 http://mirrors.digitalocean.com trusty-updates/universe i386 Packages [296 kB]\\nGet:15 https://get.docker.com docker/main Translation-en_US\\nGet:16 http://mirrors.digitalocean.com trusty-updates/main Translation-en [278 kB]\\nHit http://mirrors.digitalocean.com trusty-updates/universe Translation-en\\nIgn http://mirrors.digitalocean.com trusty/main Translation-en_US\\nIgn http://mirrors.digitalocean.com trusty/universe Translation-en_US\\nGet:17 http://security.ubuntu.com trusty-security/universe amd64 Packages [111 kB]\\nGet:18 http://security.ubuntu.com trusty-security/main i386 Packages [300 kB]\\nGet:19 http://security.ubuntu.com trusty-security/universe i386 Packages [111 kB]\\nGet:20 http://security.ubuntu.com trusty-security/main Translation-en [169 kB]\\nHit http://security.ubuntu.com trusty-security/universe Translation-en\\nIgn https://get.docker.com docker/main Translation-en_US\\nIgn https://get.docker.com docker/main Translation-en\\nFetched 3,596 kB in 17s (207 kB/s)\\nReading package lists...\\n'" | |
] | |
}, | |
"execution_count": 45, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"ssh1[\"apt-get\"](\"update\")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 46, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"u'Reading package lists...\\nBuilding dependency tree...\\nReading state information...\\nThe following extra packages will be installed:\\n binutils build-essential dpkg-dev fakeroot g++ g++-4.8 gcc gcc-4.8\\n libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl\\n libasan0 libatomic1 libc-dev-bin libc6-dev libdpkg-perl libfakeroot\\n libfile-fcntllock-perl libgcc-4.8-dev libgomp1 libitm1 libquadmath0\\n libstdc++-4.8-dev libtsan0 linux-libc-dev make manpages-dev\\n python-chardet-whl python-colorama python-colorama-whl python-distlib\\n python-distlib-whl python-html5lib python-html5lib-whl python-pip-whl\\n python-requests-whl python-setuptools python-setuptools-whl python-six-whl\\n python-urllib3-whl python-wheel python3-pkg-resources\\nSuggested packages:\\n binutils-doc debian-keyring g++-multilib g++-4.8-multilib gcc-4.8-doc\\n libstdc++6-4.8-dbg gcc-multilib autoconf automake1.9 libtool flex bison gdb\\n gcc-doc gcc-4.8-multilib gcc-4.8-locales libgcc1-dbg libgomp1-dbg\\n libitm1-dbg libatomic1-dbg libasan0-dbg libtsan0-dbg libquadmath0-dbg\\n glibc-doc libstdc++-4.8-doc make-doc python-genshi python-lxml\\n python3-setuptools\\nRecommended packages:\\n python-dev-all\\nThe following NEW packages will be installed:\\n binutils build-essential dpkg-dev fakeroot g++ g++-4.8 gcc gcc-4.8\\n libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl\\n libasan0 libatomic1 libc-dev-bin libc6-dev libdpkg-perl libfakeroot\\n libfile-fcntllock-perl libgcc-4.8-dev libgomp1 libitm1 libquadmath0\\n libstdc++-4.8-dev libtsan0 linux-libc-dev make manpages-dev\\n python-chardet-whl python-colorama python-colorama-whl python-distlib\\n python-distlib-whl python-html5lib python-html5lib-whl python-pip\\n python-pip-whl python-requests-whl python-setuptools python-setuptools-whl\\n python-six-whl python-urllib3-whl python-wheel python3-pkg-resources\\n0 upgraded, 43 newly installed, 0 to remove and 4 not upgraded.\\nNeed to get 32.7 MB of archives.\\nAfter this operation, 98.7 MB of additional disk space will be used.\\nGet:1 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/main libasan0 amd64 4.8.4-2ubuntu1~14.04 [63.0 kB]\\nGet:2 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/main libatomic1 amd64 4.8.4-2ubuntu1~14.04 [8,650 B]\\nGet:3 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/main libgomp1 amd64 4.8.4-2ubuntu1~14.04 [23.1 kB]\\nGet:4 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/main libitm1 amd64 4.8.4-2ubuntu1~14.04 [28.6 kB]\\nGet:5 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/main libquadmath0 amd64 4.8.4-2ubuntu1~14.04 [126 kB]\\nGet:6 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/main libtsan0 amd64 4.8.4-2ubuntu1~14.04 [94.7 kB]\\nGet:7 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/main binutils amd64 2.24-5ubuntu13 [2,076 kB]\\nGet:8 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/main libc-dev-bin amd64 2.19-0ubuntu6.6 [68.9 kB]\\nGet:9 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/main linux-libc-dev amd64 3.13.0-58.97 [774 kB]\\nGet:10 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/main libc6-dev amd64 2.19-0ubuntu6.6 [1,910 kB]\\nGet:11 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/main libgcc-4.8-dev amd64 4.8.4-2ubuntu1~14.04 [1,687 kB]\\nGet:12 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/main gcc-4.8 amd64 4.8.4-2ubuntu1~14.04 [5,049 kB]\\nGet:13 http://mirrors.digitalocean.com/ubuntu/ trusty/main gcc amd64 4:4.8.2-1ubuntu6 [5,098 B]\\nGet:14 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/main libstdc++-4.8-dev amd64 4.8.4-2ubuntu1~14.04 [1,052 kB]\\nGet:15 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/main g++-4.8 amd64 4.8.4-2ubuntu1~14.04 [15.0 MB]\\nGet:16 http://mirrors.digitalocean.com/ubuntu/ trusty/main g++ amd64 4:4.8.2-1ubuntu6 [1,490 B]\\nGet:17 http://mirrors.digitalocean.com/ubuntu/ trusty/main make amd64 3.81-8.2ubuntu3 [119 kB]\\nGet:18 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/main libdpkg-perl all 1.17.5ubuntu5.4 [179 kB]\\nGet:19 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/main dpkg-dev all 1.17.5ubuntu5.4 [726 kB]\\nGet:20 http://mirrors.digitalocean.com/ubuntu/ trusty/main build-essential amd64 11.6ubuntu6 [4,838 B]\\nGet:21 http://mirrors.digitalocean.com/ubuntu/ trusty/main libfakeroot amd64 1.20-3ubuntu2 [25.4 kB]\\nGet:22 http://mirrors.digitalocean.com/ubuntu/ trusty/main fakeroot amd64 1.20-3ubuntu2 [55.0 kB]\\nGet:23 http://mirrors.digitalocean.com/ubuntu/ trusty/main libalgorithm-diff-perl all 1.19.02-3 [50.0 kB]\\nGet:24 http://mirrors.digitalocean.com/ubuntu/ trusty/main libalgorithm-diff-xs-perl amd64 0.04-2build4 [12.6 kB]\\nGet:25 http://mirrors.digitalocean.com/ubuntu/ trusty/main libalgorithm-merge-perl all 0.08-2 [12.7 kB]\\nGet:26 http://mirrors.digitalocean.com/ubuntu/ trusty/main libfile-fcntllock-perl amd64 0.14-2build1 [15.9 kB]\\nGet:27 http://mirrors.digitalocean.com/ubuntu/ trusty/main manpages-dev all 3.54-1ubuntu1 [1,820 kB]\\nGet:28 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/main python3-pkg-resources all 3.3-1ubuntu2 [31.7 kB]\\nGet:29 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/universe python-chardet-whl all 2.2.1-2~ubuntu1 [170 kB]\\nGet:30 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/universe python-colorama all 0.2.5-0.1ubuntu2 [18.4 kB]\\nGet:31 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/universe python-colorama-whl all 0.2.5-0.1ubuntu2 [18.2 kB]\\nGet:32 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/universe python-distlib all 0.1.8-1ubuntu1 [113 kB]\\nGet:33 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/universe python-distlib-whl all 0.1.8-1ubuntu1 [140 kB]\\nGet:34 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/main python-html5lib all 0.999-3~ubuntu1 [83.5 kB]\\nGet:35 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/main python-html5lib-whl all 0.999-3~ubuntu1 [109 kB]\\nGet:36 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/main python-six-whl all 1.5.2-1ubuntu1 [10.5 kB]\\nGet:37 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/main python-urllib3-whl all 1.7.1-1ubuntu3 [64.0 kB]\\nGet:38 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/main python-requests-whl all 2.2.1-1ubuntu0.3 [227 kB]\\nGet:39 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/main python-setuptools-whl all 3.3-1ubuntu2 [244 kB]\\nGet:40 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/universe python-pip-whl all 1.5.4-1ubuntu3 [111 kB]\\nGet:41 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/main python-setuptools all 3.3-1ubuntu2 [230 kB]\\nGet:42 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/universe python-pip all 1.5.4-1ubuntu3 [97.2 kB]\\nGet:43 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/main python-wheel all 0.24.0-1~ubuntu1 [44.7 kB]\\nFetched 32.7 MB in 1s (25.9 MB/s)\\nSelecting previously unselected package libasan0:amd64.\\n(Reading database ... 117599 files and directories currently installed.)\\nPreparing to unpack .../libasan0_4.8.4-2ubuntu1~14.04_amd64.deb ...\\nUnpacking libasan0:amd64 (4.8.4-2ubuntu1~14.04) ...\\nSelecting previously unselected package libatomic1:amd64.\\nPreparing to unpack .../libatomic1_4.8.4-2ubuntu1~14.04_amd64.deb ...\\nUnpacking libatomic1:amd64 (4.8.4-2ubuntu1~14.04) ...\\nSelecting previously unselected package libgomp1:amd64.\\nPreparing to unpack .../libgomp1_4.8.4-2ubuntu1~14.04_amd64.deb ...\\nUnpacking libgomp1:amd64 (4.8.4-2ubuntu1~14.04) ...\\nSelecting previously unselected package libitm1:amd64.\\nPreparing to unpack .../libitm1_4.8.4-2ubuntu1~14.04_amd64.deb ...\\nUnpacking libitm1:amd64 (4.8.4-2ubuntu1~14.04) ...\\nSelecting previously unselected package libquadmath0:amd64.\\nPreparing to unpack .../libquadmath0_4.8.4-2ubuntu1~14.04_amd64.deb ...\\nUnpacking libquadmath0:amd64 (4.8.4-2ubuntu1~14.04) ...\\nSelecting previously unselected package libtsan0:amd64.\\nPreparing to unpack .../libtsan0_4.8.4-2ubuntu1~14.04_amd64.deb ...\\nUnpacking libtsan0:amd64 (4.8.4-2ubuntu1~14.04) ...\\nSelecting previously unselected package binutils.\\nPreparing to unpack .../binutils_2.24-5ubuntu13_amd64.deb ...\\nUnpacking binutils (2.24-5ubuntu13) ...\\nSelecting previously unselected package libc-dev-bin.\\nPreparing to unpack .../libc-dev-bin_2.19-0ubuntu6.6_amd64.deb ...\\nUnpacking libc-dev-bin (2.19-0ubuntu6.6) ...\\nSelecting previously unselected package linux-libc-dev:amd64.\\nPreparing to unpack .../linux-libc-dev_3.13.0-58.97_amd64.deb ...\\nUnpacking linux-libc-dev:amd64 (3.13.0-58.97) ...\\nSelecting previously unselected package libc6-dev:amd64.\\nPreparing to unpack .../libc6-dev_2.19-0ubuntu6.6_amd64.deb ...\\nUnpacking libc6-dev:amd64 (2.19-0ubuntu6.6) ...\\nSelecting previously unselected package libgcc-4.8-dev:amd64.\\nPreparing to unpack .../libgcc-4.8-dev_4.8.4-2ubuntu1~14.04_amd64.deb ...\\nUnpacking libgcc-4.8-dev:amd64 (4.8.4-2ubuntu1~14.04) ...\\nSelecting previously unselected package gcc-4.8.\\nPreparing to unpack .../gcc-4.8_4.8.4-2ubuntu1~14.04_amd64.deb ...\\nUnpacking gcc-4.8 (4.8.4-2ubuntu1~14.04) ...\\nSelecting previously unselected package gcc.\\nPreparing to unpack .../gcc_4%3a4.8.2-1ubuntu6_amd64.deb ...\\nUnpacking gcc (4:4.8.2-1ubuntu6) ...\\nSelecting previously unselected package libstdc++-4.8-dev:amd64.\\nPreparing to unpack .../libstdc++-4.8-dev_4.8.4-2ubuntu1~14.04_amd64.deb ...\\nUnpacking libstdc++-4.8-dev:amd64 (4.8.4-2ubuntu1~14.04) ...\\nSelecting previously unselected package g++-4.8.\\nPreparing to unpack .../g++-4.8_4.8.4-2ubuntu1~14.04_amd64.deb ...\\nUnpacking g++-4.8 (4.8.4-2ubuntu1~14.04) ...\\nSelecting previously unselected package g++.\\nPreparing to unpack .../g++_4%3a4.8.2-1ubuntu6_amd64.deb ...\\nUnpacking g++ (4:4.8.2-1ubuntu6) ...\\nSelecting previously unselected package make.\\nPreparing to unpack .../make_3.81-8.2ubuntu3_amd64.deb ...\\nUnpacking make (3.81-8.2ubuntu3) ...\\nSelecting previously unselected package libdpkg-perl.\\nPreparing to unpack .../libdpkg-perl_1.17.5ubuntu5.4_all.deb ...\\nUnpacking libdpkg-perl (1.17.5ubuntu5.4) ...\\nSelecting previously unselected package dpkg-dev.\\nPreparing to unpack .../dpkg-dev_1.17.5ubuntu5.4_all.deb ...\\nUnpacking dpkg-dev (1.17.5ubuntu5.4) ...\\nSelecting previously unselected package build-essential.\\nPreparing to unpack .../build-essential_11.6ubuntu6_amd64.deb ...\\nUnpacking build-essential (11.6ubuntu6) ...\\nSelecting previously unselected package libfakeroot:amd64.\\nPreparing to unpack .../libfakeroot_1.20-3ubuntu2_amd64.deb ...\\nUnpacking libfakeroot:amd64 (1.20-3ubuntu2) ...\\nSelecting previously unselected package fakeroot.\\nPreparing to unpack .../fakeroot_1.20-3ubuntu2_amd64.deb ...\\nUnpacking fakeroot (1.20-3ubuntu2) ...\\nSelecting previously unselected package libalgorithm-diff-perl.\\nPreparing to unpack .../libalgorithm-diff-perl_1.19.02-3_all.deb ...\\nUnpacking libalgorithm-diff-perl (1.19.02-3) ...\\nSelecting previously unselected package libalgorithm-diff-xs-perl.\\nPreparing to unpack .../libalgorithm-diff-xs-perl_0.04-2build4_amd64.deb ...\\nUnpacking libalgorithm-diff-xs-perl (0.04-2build4) ...\\nSelecting previously unselected package libalgorithm-merge-perl.\\nPreparing to unpack .../libalgorithm-merge-perl_0.08-2_all.deb ...\\nUnpacking libalgorithm-merge-perl (0.08-2) ...\\nSelecting previously unselected package libfile-fcntllock-perl.\\nPreparing to unpack .../libfile-fcntllock-perl_0.14-2build1_amd64.deb ...\\nUnpacking libfile-fcntllock-perl (0.14-2build1) ...\\nSelecting previously unselected package manpages-dev.\\nPreparing to unpack .../manpages-dev_3.54-1ubuntu1_all.deb ...\\nUnpacking manpages-dev (3.54-1ubuntu1) ...\\nSelecting previously unselected package python3-pkg-resources.\\nPreparing to unpack .../python3-pkg-resources_3.3-1ubuntu2_all.deb ...\\nUnpacking python3-pkg-resources (3.3-1ubuntu2) ...\\nSelecting previously unselected package python-chardet-whl.\\nPreparing to unpack .../python-chardet-whl_2.2.1-2~ubuntu1_all.deb ...\\nUnpacking python-chardet-whl (2.2.1-2~ubuntu1) ...\\nSelecting previously unselected package python-colorama.\\nPreparing to unpack .../python-colorama_0.2.5-0.1ubuntu2_all.deb ...\\nUnpacking python-colorama (0.2.5-0.1ubuntu2) ...\\nSelecting previously unselected package python-colorama-whl.\\nPreparing to unpack .../python-colorama-whl_0.2.5-0.1ubuntu2_all.deb ...\\nUnpacking python-colorama-whl (0.2.5-0.1ubuntu2) ...\\nSelecting previously unselected package python-distlib.\\nPreparing to unpack .../python-distlib_0.1.8-1ubuntu1_all.deb ...\\nUnpacking python-distlib (0.1.8-1ubuntu1) ...\\nSelecting previously unselected package python-distlib-whl.\\nPreparing to unpack .../python-distlib-whl_0.1.8-1ubuntu1_all.deb ...\\nUnpacking python-distlib-whl (0.1.8-1ubuntu1) ...\\nSelecting previously unselected package python-html5lib.\\nPreparing to unpack .../python-html5lib_0.999-3~ubuntu1_all.deb ...\\nUnpacking python-html5lib (0.999-3~ubuntu1) ...\\nSelecting previously unselected package python-html5lib-whl.\\nPreparing to unpack .../python-html5lib-whl_0.999-3~ubuntu1_all.deb ...\\nUnpacking python-html5lib-whl (0.999-3~ubuntu1) ...\\nSelecting previously unselected package python-six-whl.\\nPreparing to unpack .../python-six-whl_1.5.2-1ubuntu1_all.deb ...\\nUnpacking python-six-whl (1.5.2-1ubuntu1) ...\\nSelecting previously unselected package python-urllib3-whl.\\nPreparing to unpack .../python-urllib3-whl_1.7.1-1ubuntu3_all.deb ...\\nUnpacking python-urllib3-whl (1.7.1-1ubuntu3) ...\\nSelecting previously unselected package python-requests-whl.\\nPreparing to unpack .../python-requests-whl_2.2.1-1ubuntu0.3_all.deb ...\\nUnpacking python-requests-whl (2.2.1-1ubuntu0.3) ...\\nSelecting previously unselected package python-setuptools-whl.\\nPreparing to unpack .../python-setuptools-whl_3.3-1ubuntu2_all.deb ...\\nUnpacking python-setuptools-whl (3.3-1ubuntu2) ...\\nSelecting previously unselected package python-pip-whl.\\nPreparing to unpack .../python-pip-whl_1.5.4-1ubuntu3_all.deb ...\\nUnpacking python-pip-whl (1.5.4-1ubuntu3) ...\\nSelecting previously unselected package python-setuptools.\\nPreparing to unpack .../python-setuptools_3.3-1ubuntu2_all.deb ...\\nUnpacking python-setuptools (3.3-1ubuntu2) ...\\nSelecting previously unselected package python-pip.\\nPreparing to unpack .../python-pip_1.5.4-1ubuntu3_all.deb ...\\nUnpacking python-pip (1.5.4-1ubuntu3) ...\\nSelecting previously unselected package python-wheel.\\nPreparing to unpack .../python-wheel_0.24.0-1~ubuntu1_all.deb ...\\nUnpacking python-wheel (0.24.0-1~ubuntu1) ...\\nProcessing triggers for man-db (2.6.7.1-1ubuntu1) ...\\nSetting up libasan0:amd64 (4.8.4-2ubuntu1~14.04) ...\\nSetting up libatomic1:amd64 (4.8.4-2ubuntu1~14.04) ...\\nSetting up libgomp1:amd64 (4.8.4-2ubuntu1~14.04) ...\\nSetting up libitm1:amd64 (4.8.4-2ubuntu1~14.04) ...\\nSetting up libquadmath0:amd64 (4.8.4-2ubuntu1~14.04) ...\\nSetting up libtsan0:amd64 (4.8.4-2ubuntu1~14.04) ...\\nSetting up binutils (2.24-5ubuntu13) ...\\nSetting up libc-dev-bin (2.19-0ubuntu6.6) ...\\nSetting up linux-libc-dev:amd64 (3.13.0-58.97) ...\\nSetting up libc6-dev:amd64 (2.19-0ubuntu6.6) ...\\nSetting up libgcc-4.8-dev:amd64 (4.8.4-2ubuntu1~14.04) ...\\nSetting up gcc-4.8 (4.8.4-2ubuntu1~14.04) ...\\nSetting up gcc (4:4.8.2-1ubuntu6) ...\\nSetting up libstdc++-4.8-dev:amd64 (4.8.4-2ubuntu1~14.04) ...\\nSetting up g++-4.8 (4.8.4-2ubuntu1~14.04) ...\\nSetting up g++ (4:4.8.2-1ubuntu6) ...\\nupdate-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode\\nSetting up make (3.81-8.2ubuntu3) ...\\nSetting up libdpkg-perl (1.17.5ubuntu5.4) ...\\nSetting up dpkg-dev (1.17.5ubuntu5.4) ...\\nSetting up build-essential (11.6ubuntu6) ...\\nSetting up libfakeroot:amd64 (1.20-3ubuntu2) ...\\nSetting up fakeroot (1.20-3ubuntu2) ...\\nupdate-alternatives: using /usr/bin/fakeroot-sysv to provide /usr/bin/fakeroot (fakeroot) in auto mode\\nSetting up libalgorithm-diff-perl (1.19.02-3) ...\\nSetting up libalgorithm-diff-xs-perl (0.04-2build4) ...\\nSetting up libalgorithm-merge-perl (0.08-2) ...\\nSetting up libfile-fcntllock-perl (0.14-2build1) ...\\nSetting up manpages-dev (3.54-1ubuntu1) ...\\nSetting up python3-pkg-resources (3.3-1ubuntu2) ...\\nSetting up python-chardet-whl (2.2.1-2~ubuntu1) ...\\nSetting up python-colorama (0.2.5-0.1ubuntu2) ...\\nSetting up python-colorama-whl (0.2.5-0.1ubuntu2) ...\\nSetting up python-distlib (0.1.8-1ubuntu1) ...\\nSetting up python-distlib-whl (0.1.8-1ubuntu1) ...\\nSetting up python-html5lib (0.999-3~ubuntu1) ...\\nSetting up python-html5lib-whl (0.999-3~ubuntu1) ...\\nSetting up python-six-whl (1.5.2-1ubuntu1) ...\\nSetting up python-urllib3-whl (1.7.1-1ubuntu3) ...\\nSetting up python-requests-whl (2.2.1-1ubuntu0.3) ...\\nSetting up python-setuptools-whl (3.3-1ubuntu2) ...\\nSetting up python-pip-whl (1.5.4-1ubuntu3) ...\\nSetting up python-setuptools (3.3-1ubuntu2) ...\\nSetting up python-pip (1.5.4-1ubuntu3) ...\\nSetting up python-wheel (0.24.0-1~ubuntu1) ...\\nProcessing triggers for libc-bin (2.19-0ubuntu6.6) ...\\n'" | |
] | |
}, | |
"execution_count": 46, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"ssh1[\"apt-get\"][\"install\"][\"-y\"](\"python-pip\")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 47, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"u'Downloading/unpacking plumbum\\n Running setup.py (path:/tmp/pip_build_root/plumbum/setup.py) egg_info for package plumbum\\n \\nDownloading/unpacking boto\\nInstalling collected packages: plumbum, boto\\n Running setup.py install for plumbum\\n \\nSuccessfully installed plumbum boto\\nCleaning up...\\n'" | |
] | |
}, | |
"execution_count": 47, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"ssh1[\"pip\"][\"install\"][\"plumbum\"][\"boto\"]()" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"#destroy the droplet or take a snapshot etc." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"droplet80.destroy()" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 2", | |
"language": "python", | |
"name": "python2" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 2 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython2", | |
"version": "2.7.6" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment