Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing the deployment instructions - as this isn't for general usage #44

Merged
merged 1 commit into from Dec 11, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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