Skip to content

Commit 2f6ea93

Browse files
committed
Merge pull request #363 from opdemand/docker-0.7
Update App.run for docker 0.7 and slugrunner syntax
2 parents 9f18138 + 362f95b commit 2f6ea93

6 files changed

Lines changed: 47 additions & 47 deletions

File tree

api/models.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,7 @@ def logs(self):
531531

532532
def run(self, command):
533533
"""Run a one-off command in an ephemeral app container."""
534+
# TODO: add support for interactive shell
534535
nodes = self.formation.node_set.filter(layer__runtime=True).order_by('?')
535536
if not nodes:
536537
raise EnvironmentError('No nodes available to run command')
@@ -539,12 +540,9 @@ def run(self, command):
539540
# prepare ssh command
540541
version = release.version
541542
docker_args = ' '.join(
542-
['-v',
543-
'/opt/deis/runtime/slugs/{app_id}-{version}/app:/app'.format(**locals()),
544-
release.build.image])
545-
base_cmd = "export HOME=/app; cd /app && for profile in " \
546-
"`find /app/.profile.d/*.sh -type f`; do . $profile; done"
547-
command = "/bin/sh -c '{base_cmd} && {command}'".format(**locals())
543+
['-a', 'stdout', '-a', 'stderr',
544+
'-v', '/opt/deis/runtime/slugs/{app_id}-v{version}:/app'.format(**locals()),
545+
'deis/slugrunner'])
548546
command = "sudo docker run {docker_args} {command}".format(**locals())
549547
return node.run(command)
550548

contrib/ec2/prepare-ubuntu-ami.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ apt-get update
3939
apt-get dist-upgrade -yq
4040

4141
# install required packages
42-
apt-get install lxc-docker-0.6.4 curl git make python-setuptools python-pip -yq
43-
44-
# create buildstep docker image
45-
git clone -b deis https://github.com/opdemand/buildstep.git
46-
cd buildstep
47-
git checkout deis
48-
make
49-
cd ..
50-
rm -rf buildstep
42+
apt-get install lxc-docker-0.7.1 curl git make python-setuptools python-pip -yq
43+
44+
# wait for docker to start
45+
while [ ! -e /var/run/docker.sock ] ; do
46+
inotifywait -t 2 -e create $(dirname /var/run/docker.sock)
47+
done
48+
49+
# pull progrium/cedarish docker image
50+
docker pull progrium/cedarish
5151

5252
# install chef 11.x deps
5353
apt-get install -yq ruby1.9.1 ruby1.9.1-dev make

contrib/ec2/provision-ec2-controller.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,21 @@ region=$1
4545
# see contrib/prepare-ubuntu-ami.sh for instructions
4646
# on creating your own deis-optmized AMIs
4747
if [ "$region" == "ap-northeast-1" ]; then
48-
image=ami-2bd9bf2a
48+
image=ami-6399f962
4949
elif [ "$region" == "ap-southeast-1" ]; then
50-
image=ami-2821757a
50+
image=ami-0a87d358
5151
elif [ "$region" == "ap-southeast-2" ]; then
52-
image=ami-4dfd6277
52+
image=ami-c3bd22f9
5353
elif [ "$region" == "eu-west-1" ]; then
54-
image=ami-0452be73
54+
image=ami-4826c83f
5555
elif [ "$region" == "sa-east-1" ]; then
56-
image=ami-87f9589a
56+
image=ami-79bf1e64
5757
elif [ "$region" == "us-east-1" ]; then
58-
image=ami-5f84a536
58+
image=ami-e7af828e
5959
elif [ "$region" == "us-west-1" ]; then
60-
image=ami-f80c3dbd
60+
image=ami-a06e5ee5
6161
elif [ "$region" == "us-west-2" ]; then
62-
image=ami-76ad3746
62+
image=ami-28abce18
6363
else
6464
echo "Cannot find AMI for region: $region"
6565
exit 1

contrib/rackspace/prepare-rackspace-image.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,15 @@ apt-get update
4040
apt-get dist-upgrade -yq
4141

4242
# install required packages
43-
apt-get install lxc-docker-0.6.4 curl git make python-setuptools python-pip -yq
44-
45-
# create buildstep docker image
46-
git clone -b deis https://github.com/opdemand/buildstep.git
47-
cd buildstep
48-
make
49-
cd ..
50-
rm -rf buildstep
43+
apt-get install lxc-docker-0.7.1 curl git make python-setuptools python-pip -yq
44+
45+
# wait for docker to start
46+
while [ ! -e /var/run/docker.sock ] ; do
47+
inotifywait -t 2 -e create $(dirname /var/run/docker.sock)
48+
done
49+
50+
# pull progrium/cedarish docker image
51+
docker pull progrium/cedarish
5152

5253
# install chef 11.x deps
5354
apt-get install -yq ruby1.9.1 ruby1.9.1-dev make

contrib/vagrant/prepare-ubuntu-box.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,15 @@ apt-get update
4242
apt-get dist-upgrade -yq
4343

4444
# install required packages
45-
apt-get install lxc-docker-0.6.4 git make python-setuptools python-pip -yq
46-
47-
# create buildstep docker image
48-
git clone -b deis https://github.com/opdemand/buildstep.git
49-
cd buildstep
50-
make
51-
cd ..
52-
rm -rf buildstep
45+
apt-get install lxc-docker-0.7.1 git make python-setuptools python-pip -yq
46+
47+
# wait for docker to start
48+
while [ ! -e /var/run/docker.sock ] ; do
49+
inotifywait -t 2 -e create $(dirname /var/run/docker.sock)
50+
done
51+
52+
# pull progrium/cedarish docker image
53+
docker pull progrium/cedarish
5354

5455
# install chef 11.x deps
5556
apt-get install -yq ruby1.9.1 ruby1.9.1-dev make

provider/ec2.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
# Deis-optimized EC2 amis -- with 3.8 kernel, chef 11 deps,
1818
# and large docker images (e.g. buildstep) pre-installed
1919
IMAGE_MAP = {
20-
'ap-northeast-1': 'ami-2bd9bf2a',
21-
'ap-southeast-1': 'ami-2821757a',
22-
'ap-southeast-2': 'ami-4dfd6277',
23-
'eu-west-1': 'ami-0452be73',
24-
'sa-east-1': 'ami-87f9589a',
25-
'us-east-1': 'ami-5f84a536',
26-
'us-west-1': 'ami-f80c3dbd',
27-
'us-west-2': 'ami-76ad3746',
20+
'ap-northeast-1': 'ami-6399f962',
21+
'ap-southeast-1': 'ami-0a87d358',
22+
'ap-southeast-2': 'ami-c3bd22f9',
23+
'eu-west-1': 'ami-4826c83f',
24+
'sa-east-1': 'ami-79bf1e64',
25+
'us-east-1': 'ami-e7af828e',
26+
'us-west-1': 'ami-a06e5ee5',
27+
'us-west-2': 'ami-28abce18',
2828
}
2929

3030

0 commit comments

Comments
 (0)