Skip to content

Commit 66493b1

Browse files
committed
Updated docs and only test for avahi-daemon on Linux.
1 parent 691461d commit 66493b1

6 files changed

Lines changed: 51 additions & 42 deletions

File tree

Berksfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
"locked_version": "2.2.2"
1111
},
1212
"deis": {
13-
"locked_version": "0.1.2",
13+
"locked_version": "0.2.1",
1414
"git": "https://github.com/opdemand/deis-cookbook.git",
15-
"ref": "3277d069b61d261b6ebcab319041442fe38a2ae3"
15+
"ref": "617d5a2627fdee92ade9499b4a87c6ff85a99c66"
1616
}
1717
}
1818
}

Vagrantfile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,9 @@
22
Vagrant.configure("2") do |config|
33
config.vm.box = "deis-node"
44

5-
# This is the vanilla Ubunutu 12.04 Precise box. It's about 350MB
5+
# This is a preloaded Deis Ubuntu 12.04 Precise box. It's about 1GB
66
config.vm.box_url = "https://s3-us-west-2.amazonaws.com/opdemand/deis-node.box"
77

8-
# This is a premade Deis controller box, probably 12.04, need to check. It's about 1.1GB
9-
# config.vm.box_url = "https://s3-us-west-2.amazonaws.com/opdemand/deis-controller.box"
10-
118
# Avahi-daemon will broadcast the server's address as deis-controller.local
129
config.vm.host_name = "deis-controller"
1310

client/deis.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1758,9 +1758,11 @@ def providers_discover(self, args): # noqa
17581758
except subprocess.CalledProcessError:
17591759
print("Error detecting username and host address.")
17601760
sys.exit(1)
1761+
if not hostname.endswith('.local'):
1762+
hostname += '.local'
17611763
creds = {
17621764
'user': user,
1763-
'host': hostname + ".local"
1765+
'host': hostname
17641766
}
17651767
body = {'creds': json.dumps(creds)}
17661768
sys.stdout.write('Activating Vagrant as a provider... ')

contrib/vagrant/provision-controller.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@ if [ ! -f /etc/ssh/sshd_config ] && [ ! -f /etc/sshd_config ]; then
2121
fi
2222

2323
# Make sure avahi-daemon is installed and running
24-
if ! pgrep avahi-daemon >/dev/null; then
25-
echo 'Please install avahi-daemon to broadcast your hostname to the local network.'
26-
exit 1
24+
if [[ `uname -s` =~ Linux ]]; then
25+
if ! pgrep avahi-daemon >/dev/null; then
26+
echo 'Please install avahi-daemon to broadcast your hostname to the local network.'
27+
exit 1
28+
fi
2729
fi
2830

2931
#################

docs/installation/vagrant.rst

Lines changed: 37 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -16,49 +16,58 @@ VirtualBox.
1616
------------------------------
1717

1818
The ``Vagrantfile`` in the project root has the configuration for a Deis
19-
controller. It will first need to download a base image "deis-base," which
19+
controller. Vagrant will first need to download a base image "deis-base," which
2020
may take a while.
2121

22-
Run the Vagrant provisioning script, which takes several minutes to complete:
22+
Run the Vagrant provisioning script, which takes several minutes to complete.
23+
Pay attention, because it will ask for confirmation that an SSH key can be
24+
added to your $HOME/.ssh/authorized_keys file:
2325

2426
.. code-block:: console
2527
26-
$ ./contrib/ec2/provision-ec2-controller.sh us-west-2
27-
Creating security group: deis-controller
28-
+ ec2-create-group deis-controller -d 'Created by Deis'
29-
GROUP sg-fe82aaaa deis-controller Created by Deis
30-
+ set +x
31-
Authorizing TCP ports 22,80,443,514 from 0.0.0.0/0...
32-
+ ec2-authorize deis-controller -P tcp -p 22 -s 0.0.0.0/0
33-
+ ec2-authorize deis-controller -P tcp -p 80 -s 0.0.0.0/0
28+
$ ./contrib/vagrant/provision-controller.sh
29+
Created data_bag[deis-users]
30+
Created data_bag[deis-formations]
31+
Created data_bag[deis-apps]
32+
Booting deis-controller with 'vagrant up'
33+
~/Projects/deis ~/Projects/deis
34+
Bringing machine 'default' up with 'virtualbox' provider...
35+
[default] Importing base box 'deis-node'...
36+
[default] Matching MAC address for NAT networking...
37+
...
38+
[default] Running: inline script
39+
stdin: is not a tty
40+
avahi-daemon stop/waiting
41+
avahi-daemon start/running, process 1366
42+
Add the Deis Controller's SSH key to your authorized_keys file? y
43+
Generating public/private rsa key pair.
44+
Your identification has been saved in /home/vagrant/.ssh/id_rsa.
3445
...
35-
ec2-198-51-100-22.us-west-2.compute.amazonaws.com
36-
ec2-198-51-100-22.us-west-2.compute.amazonaws.com Chef Client finished, 74 resources updated
37-
Instance ID: i-2be2411c
38-
Flavor: m1.large
39-
Image: ami-ca63fafa
40-
Region: us-west-2
41-
Availability Zone: us-west-2b
42-
Security Groups: deis-controller
43-
Public DNS Name: ec2-198-51-100-22.us-west-2.compute.amazonaws.com
44-
Public IP Address: 198.51.100.22
45-
Run List: recipe[deis::controller]
46+
deis-controller.local - execute "bash" "/tmp/chef-script20131107-1476-la5wbp"
47+
deis-controller.local
48+
deis-controller.local
49+
deis-controller.local
50+
deis-controller.local Chef Client finished, 77 resources updated
51+
deis-controller.local
4652
+ set +x
53+
Updating Django site object from 'example.com' to 'deis-controller'...
54+
Site object updated.
55+
~/Projects/deis
4756
Please ensure that "deis-controller" is added to the Chef "admins" group.
4857
4958
.. include:: steps3-4.txt
5059

5160
5. Register With the Controller
5261
-------------------------------
5362

54-
Registration will discover SSH keys automatically and use the
55-
`standard environment variables`_ **AWS_ACCESS_KEY** and **AWS_SECRET_KEY** to
56-
configure the EC2 provider with your credentials.
63+
Registration will discover the local Deis controller running in Vagrant and
64+
set up the necessary provider entry so that the controller can SSH back to
65+
the host, which is necessary to run "vagrant up" and thus scale nodes.
5766

5867
.. code-block:: console
5968
6069
$ sudo pip install deis
61-
$ deis register http://deis.example.com
70+
$ deis register http://deis-controller.local
6271
username: myuser
6372
password:
6473
password (confirm):
@@ -71,9 +80,8 @@ configure the EC2 provider with your credentials.
7180
Which would you like to use with Deis? 1
7281
Uploading /Users/myuser/.ssh/id_rsa.pub to Deis... done
7382
74-
Found EC2 credentials: AKIAJTVXXXXXXXXXXXXX
75-
Import these credentials? (y/n) : y
76-
Uploading EC2 credentials... done
83+
Detected locally running Deis Controller VM
84+
Activating Vagrant as a provider... done
7785
7886
6. Deploy a Formation and App
7987
-----------------------------
@@ -82,10 +90,8 @@ Create a formation and scale it:
8290

8391
.. code-block:: console
8492
85-
$ deis formations:create dev --flavor=ec2-us-west-2
93+
$ deis formations:create dev --flavor=vagrant-1024
8694
$ deis nodes:scale dev runtime=1
8795
8896
.. include:: step6.txt
8997

90-
.. _`Amazon EC2 API Tools`: http://aws.amazon.com/developertools/Amazon-EC2/351
91-
.. _`standard environment variables`: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/SettingUp_CommandLine.html#set_aws_credentials_linux

provider/vagrant.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ def build_node(node):
101101
)
102102

103103
provider_id = uid
104-
fqdn = provider_id + '.local' # hostname is broadcast via avahi-daemon
104+
fqdn = provider_id
105+
if not fqdn.endswith('.local'):
106+
fqdn += '.local' # hostname is broadcast via avahi-daemon
105107
metadata = {
106108
'id': uid,
107109
'fqdn': fqdn,

0 commit comments

Comments
 (0)