55
66Local Development
77=================
8- We have tried to make it simple to hack on Deis, but as an open PaaS
9- there are necessarily several moving pieces and some setup required.
10- We welcome any suggestions for automating or simplifying this process.
8+
9+ We have tried to make it simple to hack on Deis, but as an open PaaS, there are
10+ necessarily several moving pieces and some setup required. We welcome any suggestions for
11+ automating or simplifying this process.
1112
1213Prerequisites
1314-------------
14- We strongly recommend using `Vagrant `_ with `VirtualBox `_ so you can
15- develop inside a set of isolated virtual machines. You will need:
15+
16+ We strongly recommend using `Vagrant `_ with `VirtualBox `_ so you can develop inside a set
17+ of isolated virtual machines. You will need:
1618
1719 * Vagrant 1.3.5+
1820 * VirtualBox 4.2+
1921
2022Fork the Repository
2123-------------------
22- To get Deis running locally, first `fork the Deis repository `_ at GitHub.com.
23- Then clone your fork of the repository for local development:
24+
25+ To get Deis running locally, first `fork the Deis repository `_, then clone your fork of
26+ the repository for local development:
2427
2528.. code-block :: console
2629
27- $ git clone https:// github.com/ <username>/deis.git
30+ $ git clone git@ github.com: <username>/deis.git
2831 $ cd deis
2932 $ export DEIS_DIR=`pwd` # to use in future commands
3033
3134 Configure a Chef Server
3235-----------------------
33- Deis relies on Chef Server to provide a battle-tested foundation for
34- hosting ` cookbooks `_ used to configure :ref: ` Nodes < node >` and
35- `data bags `_ used to store cluster configuration.
36- You can run a local Chef Server or use a Hosted Chef Server.
36+
37+ Deis relies on a Chef Server to provide a battle-tested foundation for hosting
38+ `cookbooks `_ used to configure :ref: ` Nodes < node >` and ` data bags `_ used to store cluster
39+ configuration. You can host your own Chef Server or use a Hosted Chef Server.
3740
3841Local Chef Server
3942`````````````````
40- For development purposes, you can spin up a local Chef Server using Vagrant.
41- Please note it will take up at least 1GB of RAM. From your workstation:
43+
44+ For development purposes, you can spin up a local Chef Server using Vagrant. Please note
45+ that it will take up at least 1GB of RAM. From your workstation:
4246
4347.. code-block :: console
4448
@@ -61,8 +65,8 @@ Now use ``knife client list`` to test connectivity to the local Chef Server:
6165 Self-hosted Chef Server
6266```````````````````````
6367
64- Alternatively, you can `host your own Chef server `_ on your own hardware.
65- From your server:
68+ Alternatively, you can `host your own Chef server `_ on your own hardware. From your
69+ server:
6670
6771 * visit `the Chef install page `_ in your web browser
6872 * Click on the "Chef Server" tab and then select the menus that match your operating system
@@ -73,12 +77,15 @@ From your server:
7377 * configure your admin key and validator
7478 * configure the knife command with :code: `knife configure --initial `
7579
76- You should now have a Chef server and a separate workstation to create your configurations.
80+ You should now have a Chef server and a separate workstation to create your
81+ client configuration.
7782
7883Hosted Chef Server
7984``````````````````
85+
8086If you don't want to run your own Chef server, you can
81- `sign up for a free Hosted Chef account `_.
87+ `sign up for a free Hosted Chef account `_. This is a free service for up to 5 nodes. After
88+ that, you'll have to start paying.
8289
8390 * `Login to the Chef Server <https://preview.opscode.com/login >`_
8491 * Click on the ``Administration `` tab and choose your organization
@@ -92,11 +99,12 @@ Now use ``knife client list`` to test connectivity to the local Chef Server:
9299 $ knife client list
93100 gabrtv-validator
94101
95- You should see at least the validator key for your Chef organization.
96- If not, your `knife.rb `_ configuration or Chef keys are probably incorrect.
102+ You should see at least the validator key for your Chef organization. If not, your
103+ `knife.rb `_ configuration or Chef keys are probably incorrect.
97104
98105Upload Cookbooks
99106----------------
107+
100108Upload the current Deis cookbooks using Berkshelf:
101109
102110.. code-block :: console
@@ -106,23 +114,35 @@ Upload the current Deis cookbooks using Berkshelf:
106114 $ berks install # install cookbooks to your local berkshelf
107115 $ berks upload # upload berkshelf cookbooks to the chef server
108116
117+ SSH Access
118+ ----------
119+
120+ The Controller needs to be able to run Vagrant commands on your host machine. It does
121+ this via SSH. Therefore you will need a running SSH server open on port 22 and a means to
122+ broadcast your hostname to local DNS.
123+
124+ * On Mac OSX you just need to go to "System Preferences > Sharing" and enable "Remote Login"
125+ * On Debian-flavoured Linux you just need to ``sudo apt-get install openssh-server avahi-daemon ``
126+
109127Provision the Controller
110128------------------------
111- Now that the Chef Server is in place with the latest version of our cookbooks,
112- we can provision the :ref: `controller `.
129+
130+ Now that the Chef Server is in place with the latest version of our cookbooks, we can
131+ provision the :ref: `controller `.
113132
114133.. code-block :: console
115134
116135 $ cd $DEIS_DIR/contrib/vagrant
117- $ ./provision-controller.sh
136+ $ ./provision-vagrant- controller.sh
118137
119- The provisioning process will ask a few questions and then run a
120- `` knife bootstrap `` of the controller.
138+ The provisioning process will ask a few questions and then run a `` knife bootstrap `` of
139+ the controller.
121140
122141Add Controller to Admin Group
123142`````````````````````````````
124- In order for the controller to delete records on the Chef Server,
125- it must be part of the Admin group.
143+
144+ In order for the controller to delete records on the Chef Server, it must be part of the
145+ Admin group.
126146
127147For a Local Chef Server
128148
@@ -138,19 +158,12 @@ For a Hosted Chef Server
138158 * Under "Clients" heading, toggle the "deis-controller" radio button
139159 * Save changes
140160
141- SSH Access
142- ``````````
143- The Controller needs to be able to run Vagrant commands on your host machine.
144- It does this via SSH. Therefore you will need a running SSH server open on port 22
145- and a means to broadcast your hostname to local DNS.
146-
147- * On Mac OSX you just need to go to "System Preferences > Sharing" and enable "Remote Login"
148- * On Debian-flavoured Linux you just need to ``sudo apt-get install openssh-server avahi-daemon ``
149-
150161Install the Client
151162------------------
152- In a development environment you'll want to use the latest version of the client.
153- Install its dependencies by using the Makefile and symlinking ``client/deis.py `` to ``deis `` on your local workstation.
163+
164+ In a development environment you'll want to use the latest version of the client. Install
165+ its dependencies by using the Makefile and symlinking ``client/deis.py `` to ``deis `` on
166+ your local workstation.
154167
155168.. code-block :: console
156169
@@ -162,8 +175,9 @@ Install its dependencies by using the Makefile and symlinking ``client/deis.py``
162175
163176 Register an Admin User
164177----------------------
165- Use the Deis client to register a new user on the controller.
166- As the first user, you will receive full admin permissions.
178+
179+ Use the Deis client to register a new user on the controller. As the first user, you will
180+ receive full admin permissions.
167181
168182.. code-block :: console
169183
@@ -175,6 +189,15 @@ As the first user, you will receive full admin permissions.
175189 Registered myuser
176190 Logged in as myuser
177191
192+ .. note ::
193+
194+ As of v0.5.1, the proxy was removed for Deis platform services. It has yet to be added
195+ back in. See `issue 535 `_ for more details.
196+
197+ As a workaround, use the following:
198+
199+ :code: `deis register http://deis-controller.local:8000 `
200+
178201Once the user is registered, activate the Vagrant provider with:
179202
180203.. code-block :: console
@@ -198,40 +221,45 @@ Add your SSH key for ``git push`` access using:
198221
199222 Deploy a Vagrant Formation
200223--------------------------
201- These are 3 default flavors of Vagrant nodes: 512MB, 1024MB and 2048MB.
202- To create a formation with a 512MB nodes:
224+
225+ These are 3 default flavors of Vagrant nodes: 512MB, 1024MB and 2048MB. To create a
226+ formation with a 512MB nodes:
203227
204228.. code-block :: console
205229
206230 $ deis formations:create dev --flavor=vagrant-512
207231 $ deis nodes:scale dev runtime=1
208232
209- This will use the Deis :ref: `Provider ` API to spin up a new Vagrant node as
210- part of a single-host formation. The scaling process can take ~ 5 min
211- as Vagrant boots a host and runs through the first Chef converge.
233+ This will use the Deis :ref: `Provider ` API to spin up a new Vagrant node as part of a
234+ single-host formation. The scaling process can take ~ 5 min as Vagrant boots a host and
235+ runs through the first Chef converge.
212236
213- Once ``nodes:scale `` returns, your local development environment is running!
214- Follow the rest of the :ref: `Developer Guide <developer >` to
215- deploy your first application.
237+ Once ``nodes:scale `` returns, your local development environment is running! Follow the
238+ rest of the :ref: `Developer Guide <developer >` to deploy your first application.
216239
217240Useful Commands
218241---------------
242+
219243Once your controller is running, here are some helpful commands.
220244
221245Tail Logs
222246`````````
247+
223248.. code-block :: console
224249
225- $ vagrant ssh -c 'sudo tail -f /var/log/upstart/deis-* /var/log/deis/*'
250+ $ vagrant ssh -c 'sudo docker logs --follow=true deis-server'
251+ $ vagrant ssh -c 'sudo docker logs --follow=true deis-worker'
226252
227253 Restart Services
228254````````````````
255+
229256.. code-block :: console
230257
231258 $ vagrant ssh -c 'sudo restart deis-worker && sudo restart deis-server'
232259
233260 Django Admin
234261````````````
262+
235263.. code-block :: console
236264
237265 $ vagrant ssh # SSH into the controller
@@ -244,6 +272,7 @@ Have commands other Deis developers might find useful? Send us a PR!
244272
245273Standards & Test Coverage
246274-------------------------
275+
247276When changing Python code in the Deis project, keep in mind our :ref: `standards `.
248277Specifically, when you change local code, you must run
249278``make flake8 && make coverage ``, then check the HTML report to see
@@ -272,6 +301,7 @@ that test coverage has improved as a result of your changes and new unit tests.
272301
273302 Pull Requests
274303-------------
304+
275305Please create a GitHub `pull request `_ for any code changes that will benefit Deis users
276306in general. This workflow helps changesets map well to discrete features.
277307
@@ -280,6 +310,7 @@ ensure the pull request doesn't break any tests or reduce code coverage.
280310
281311Cookbook Development
282312--------------------
313+
283314If you want to modify Deis' Chef recipes, you should also clone the `deis-cookbook `_
284315repository:
285316
@@ -300,3 +331,4 @@ Please see `deis-cookbook`_ for information about contributing Chef code to Deis
300331.. _`fork the Deis repository` : https://github.com/opdemand/deis/fork
301332.. _`deis-cookbook` : https://github.com/opdemand/deis-cookbook
302333.. _`pull request` : https://github.com/opdemand/deis/pulls
334+ .. _`issue 535` : https://github.com/opdemand/deis/issues/535
0 commit comments