Skip to content

Commit

Permalink
Turns off unattended-upgrades (#46)
Browse files Browse the repository at this point in the history
* Fixes issue #45

Turns of unattended-upgrades
Updates build instructions
Remove obsolete ~/.aws/config

* Fix typo in instructions

* Fix typo in instructions
  • Loading branch information
rappdw authored and mikekwright committed Apr 19, 2019
1 parent c1eaf54 commit 756d657
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 27 deletions.
5 changes: 0 additions & 5 deletions packer/aws_config.cfg

This file was deleted.

3 changes: 3 additions & 0 deletions packer/disable-unattended-upgrades.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

sudo sed -i 's/APT::Periodic::Unattended-Upgrade "1";/APT::Periodic::Unattended-Upgrade "0";/' /etc/apt/apt.conf.d/20auto-upgrades
64 changes: 52 additions & 12 deletions packer/notes.dlami.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,59 @@
# Notes on using the AWS DL AMI as the base image
# How to Build/Deploy a Resero-labs dlami

We are using verison 22.0 (ami-01a4e5be5f289dd12) currently, but have modified it (by hand) to create our base image
The modifications are as follows:

1) ssh into image
2) Wait for /var/log/unattended-upgrades/unattended-upgrades.log to emit a line
1) create instance of DLAMI. (Watch for updates [Deep Learning AMI (Ubuntu)](https://aws.amazon.com/marketplace/pp/B077GCH38C).)

`create-dock -a ami-01a4e5be5f289dd12 -s -m base-ami -i p3.2xlarge`
2) ssh into image.

`ssh-dock base-ami`
3) Wait for /var/log/unattended-upgrades/unattended-upgrades.log to emit a line.
that looks like: `2019-01-24 17:52:10,320 INFO All upgrades installed` (should be aobut 15 minutes)
3) reboot
4) run upgrade.sh script

Because this takes such a long time, go ahead and create an image from this instance
and use that as the base instead of building it into the packer script.
4) reboot

```bash
stop-dock base-ami
start-dock base-ami
```
5) run upgrade.sh script

```bash
scp upgrade.sh <base-ami-ip>:~/
ssh-dock base-ami
./upgrade.sh
```
6) reboot and ensure that nvidia drivers still good

`nvidia-smi`
7) Create an image from this instance

`aws ec2 create-image --instance-id i-0238495638422d858 --name resero-labs-dlami-base-22.0-2019.04`

(Instance id can be found in the console or in `~/.docker/<ip-addr>/connection_config.txt`.
AMI name should follow the convention `resero-labs-dlami-base-<dlami-version>-<date-created>`)
8) Terminate the base-ami dock

`destroy-dock base-ami -f`
9) Use the ami from previous step as the base ami in the packer script

```bash
edit resero-labs-dl.packer and update both the "name" and "source_ami" values appropriately
packer build resero-labs-dl.packer
```

10) Validate the new ami

```bash
create-dock -a <resero-labs-dlami-candidate> -m test-ami -i p3.2xlarge
source dock test-ami
docker images
ssh-dock
nvidia-smi
castoff
destroy-dock test-ami -f
```

Optionally, we may want to consider running the upgrade-docker script in this
directory, but we are not currently doing so.
11) Switch names of previous resero-labs-dlami with the one just created

## Watch for updates
[Deep Learning AMI (Ubuntu)](https://aws.amazon.com/marketplace/pp/B077GCH38C)
16 changes: 6 additions & 10 deletions packer/resero-labs-dl.packer
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"builders": [
{
"ami_name": "resero-labs-dlami-2019.03-b22.0",
"ami_name": "resero-labs-dlami-2019.03-b22.0-2019.04",
"type": "amazon-ebs",
"force_deregister": "true",
"instance_type": "p3.2xlarge",
Expand All @@ -22,7 +22,7 @@
"sg-b93e0dc2",
"sg-1bd90461"
],
"source_ami": "ami-06d194a9639948a4c",
"source_ami": "ami-0ba505ea799c46918",
"ssh_username": "ubuntu",
"iam_instance_profile": "lanista-app",
"subnet_id": "subnet-b8b440de",
Expand Down Expand Up @@ -53,26 +53,22 @@
"source": "jupyter_notebook_config.py",
"destination": "/home/ubuntu/.jupyter/jupyter_notebook_config.py"
},
{
"type": "shell",
"inline": [
"mkdir /home/ubuntu/.aws"
]
},
{
"type": "file",
"source": "aws_config.cfg",
"destination": "/home/ubuntu/.aws/config"
"source": "disable-unattended-upgrades.sh",
"destination": "/home/ubuntu/disable-unattended-upgrades.sh"
},
{
"type": "shell",
"inline": [
"/home/ubuntu/configure-docker.sh",
"/home/ubuntu/update-anaconda.sh",
"/home/ubuntu/configure-jupyter.sh",
"/home/ubuntu/disable-unattended-upgrades.sh",
"rm /home/ubuntu/configure-docker.sh",
"rm /home/ubuntu/update-anaconda.sh",
"rm /home/ubuntu/configure-jupyter.sh",
"rm /home/ubuntu/disable-unattended-upgrades.sh",
"sudo mkdir -p /data/workspaces",
"sudo chown -R ubuntu /data"
]
Expand Down

0 comments on commit 756d657

Please sign in to comment.