Skip to content

Commit

Permalink
Merge pull request #44 from rossbruniges/ammend-readme
Browse files Browse the repository at this point in the history
Removing the deployment instructions - as this isn't for general usage
  • Loading branch information
rossbruniges committed Dec 11, 2012
2 parents bb8557d + 9033345 commit 24b7de0
Showing 1 changed file with 0 additions and 92 deletions.
92 changes: 0 additions & 92 deletions README.md
Expand Up @@ -46,98 +46,6 @@ GeoDjango is installed as part of Django. You need to take a look at the install
instructions at [https://docs.djangoproject.com/en/1.3/ref/contrib/gis/install/#post-installation]
to get PostGIS configured properly with Django. Ubuntu's version ships with a postgis-template generation script, which you can see used in `./puppet/manifests/classes/postgis.pp`

Deployment
==========

We're making heavy use of [Fabric][fab] and [Puppet][] to automate deployment. Deployment has been tested on a Ubuntu 10.04 box, and puppet recipes will likely fail on later versions of Ubuntu (or any Debian version), and certainly would on RHEL / CentOS systems.

[fab]: http://docs.fabfile.org/
[Puppet]: http://puppetlabs.com/

Note that we're using Puppet 0.25, because that's what comes with Ubuntu 10.04. It's old, you'll find a lot of newer recipes and examples out on the web won't run unmodified on it.

Prequisites
-----------

* A machine set up for local development

* A user with `sudo` access on a Ubuntu 10.04 box with `openssh-server` installed and running. No other pre-puppet dependencies.

* The machine you want to deploy to listed in the hosts dict in `fabfile.py`
* The SSH pubkey of any developers who should have deploy access contained in `puppet/files/deploy_keys` (this will become the `.ssh/authorized_keys` file for the server user the app runs as.

Initial setup
-------------

```bash
fab puppet.setup
fab puppet.apply
fab deploy.cold
```

`fab puppet.setup` installs the Puppet packages on the box.
`fab puppet.apply` uploads and applies the current puppet recipes. Note that this is not done from Git, but from the deployers working directory, so be careful about uncommitted changes.
`fab deploy.cold` Actually deploys the app, performing first-run setup and running DB migrations.

If you're not deploying to the default server (you can change the default on line 21 of `fabfile.py`) then you need to specify which set of hosts to use:

```
TO=production fab puppet.setup
TO=production fab puppet.apply
TO=production fab deploy.cold
```

If your sudoer's username on the box you're deploying too doesn't match your local username:

```
fab -u remote_username puppet.setup
```

If you need to do both the above mods:

```
TO=production fab -u remote_username puppet.setup
```

Updates to Puppet
----------------

```bash
fab puppet.apply
```

Provided there are no bugs in the puppet recipes, running `fab puppet.apply` should only do something if there's a change to apply - it's safe to run multiple times, and even if there are no new changes.

Regular deployment
------------------

````bash
fab deploy
```
This doesn't run the Migrations. To deploy and run migrations run:
```bash
fab deploy_with_migrations
```
Notes on the Puppet setup
-------------------------
The main Puppet manifest is `puppet/manifests/dev.pp`, which in turn includes all the rest of the resources in a single class, then includes that class - puppet then tries to make sure all the resources described in `puppet/manifests/classes/*.pp` are included and brought up to date. If you need to add more things to the Puppet recipes, add them in a file in `puppet/manifests/classes` and then put an include line into `puppet/manifests/dev.pp`
E.g., add resources to `puppet/manifests/classes/my_file.pp` and then, in `dev.pp`:
```
class dev {
include app_users
...
include my_file
}
```
I don't think this is an entirely standard way of doing things, but it works well with a single-machine single-OS deployment.
playdoh: about the framework
============================

Expand Down

0 comments on commit 24b7de0

Please sign in to comment.