Giter VIP home page Giter VIP logo

django-chef's Introduction

django-chef

django-chef is a project that will help you provision a server for your Django app. It will install all the pieces of a modern web application and give you the tools to deploy with a single command.

You can use this project as a starting point. It includes a vagrant configuration which allows you to test your configuration and develop inside the same environment that you would in production.

Quick start

$ git clone git://github.com/honza/django-chef.git
$ cd django-chef
# add yourself to the "users" array in the Vagrantfile
$ sudo echo "127.0.0.1 example.example.com" >> /etc/hosts
$ vagrant up
$ fab vagrant:honza bootstrap  # replace with your name
$ vagrant ssh
$ run

Then open your browser to http://example.example.com:3456.

What it installs

  • nginx
  • postgresql
  • redis
  • git

How it works

Your django project goes into the src/ directory. Right now it includes a simple bare-bones project. You should place your files there.

The name of your application is assumed to be example. It's used throughout.

You can then use the included Chef cookbooks to provision a local VM.

It will install your application into /opt/example. The structure of that directory is something like this

/opt/example
    /apps
        /example
            # Your Django project here
    /venvs
        /example

Each developer on your team should be added to the users list in the Vagrantfile and the node file so that they can access the server.

Developing

If you want to develop in vagrant, it's as simple as provisioning the VM, logging in and typing in run. Instead of using supervisor to daemonize the gunicorn process that servers your Django application, you will use Django's built-in server. This is great because it will reload your application when it detects changes to the source code.

To facilitate this, there is a bit of special stuff in the nginx directive. But that's it. Everything else is the same as it would be in production.

When developing, you don't need to commit your changes in order to see if a bug was fixed. This project takes advantage of vagrant's shared folders. The source code on the host machine is symlinked to the /opt directory.

Deployment

Deploying is as easy as issue ia single Fabric command.

$ fab vagrant:honza deploy
# or
$ fab staging:honza deploy

Deployments are based around git. When you deploy, the script will run git push to your server so make sure your local changes are committed before deploying. Deploying with git is useful because the server knows which revision is currently live.

Todo

  • RabbitMQ + celery
  • Install patched postgresql

License

BSD, short and sweet

django-chef's People

Contributors

honza avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

django-chef's Issues

symlink to /opt directory

Hello Honza,

First, tanks for the repository I've been using for some of my projects and works pretty great.

I've only one doubt, in the read-me you say:

The source code on the host machine is symlinked to the /opt directory.

Can you tell me where in the configuration you do the symlink?

Install error

Hi Honza,

I am running into this issue. I think you ran into it as well on another thread. I am not sure if you were able to resolve it or not.

I am running this on lucid 64.

I cloned your repo and did a vagrant up.

Any help would be much appreciated.

Thanks
David

[default] Importing base box 'base'...
[default] The guest additions on this VM do not match the install version of
VirtualBox! This may cause things such as forwarded ports, shared
folders, and more to not work properly. If any of those things fail on
this machine, please update the guest additions and repackage the
box.

Guest Additions Version: 4.1.0
VirtualBox Version: 4.1.2
[default] Matching MAC address for NAT networking...
[default] Clearing any previously set forwarded ports...
[default] Forwarding ports...
[default] -- ssh: 22 => 2222 (adapter 1)
[default] -- http: 80 => 8080 (adapter 1)
[default] -- web: 9999 => 9999 (adapter 1)
[default] Creating shared folders metadata...
[default] Running any VM customizations...
[default] Booting VM...
[default] Waiting for VM to boot. This can take a few minutes.
[default] VM booted and ready for use!
[default] Mounting shared folders...
[default] -- v-root: /vagrant
[default] -- v-csc-1: /tmp/vagrant-chef-1/chef-solo-1
[default] Running provisioner: Vagrant::Provisioners::ChefSolo...
[default] Generating chef JSON and uploading...
[default] Running chef-solo...
[default] stdin: is not a tty
: stderr
[default] [Sun, 20 Nov 2011 04:47:00 -0800] INFO: *** Chef 0.10.2 ***
: stdout
[default] [Sun, 20 Nov 2011 04:47:01 -0800] INFO: Setting the run_list to ["recipe[djangoapp::default]"] from JSON
: stdout
[default] [Sun, 20 Nov 2011 04:47:01 -0800] INFO: Run List is [recipe[djangoapp::default]]
: stdout
[default] [Sun, 20 Nov 2011 04:47:01 -0800] INFO: Run List expands to [djangoapp::default]
[Sun, 20 Nov 2011 04:47:01 -0800] INFO: Starting Chef Run for lucid64
: stdout
[default] [Sun, 20 Nov 2011 04:47:02 -0800] ERROR: Running exception handlers
: stdout
[default] [Sun, 20 Nov 2011 04:47:02 -0800] ERROR: Exception handlers complete
: stdout
[default] [Sun, 20 Nov 2011 04:47:02 -0800] FATAL: Stacktrace dumped to /tmp/vagrant-chef-1/chef-stacktrace.out
: stdout
[default] [Sun, 20 Nov 2011 04:47:02 -0800] FATAL: NoMethodError: undefined method `apt_repository' for #Chef::Recipe:0x7f84d1871e20
: stdout
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

chef-solo -c /tmp/vagrant-chef-1/solo.rb -j /tmp/vagrant-chef-1/dna.json

The output of the command prior to failing is outputted below:

[no output]

git-based or fabric-based deployments

I'm currently rewriting the bulk of this project: upgrading the os, the packages, fixing issues, etc.

The question that I have right now is how to handle deployments.

  • Heroku-style git push
  • Fabric-style fab deploy

Any strong thoughts?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.