Giter Club home page Giter Club logo

fabulous's Introduction

Fabulous Logo

Deploy django apps to Amazon EC2 with ONE command

First clone the project

$ git clone https://github.com/gcollazo/Fabulous.git fabfile

Just change the values of fabulous_conf.py and optionally cookbook.py:

$ fab ulous

Make sure the cloned folder is called fabfile

Fabulous will create an EC2 instance, install everything and deploy a blank django app. All in less than 2 minutes.

Process

  • Create server on EC2
  • Wait a few seconds for server to boot
  • Install packages
  • Create virtualenv
  • Install django in virtualenv
  • Install gunicorn in virtualenv
  • Setup and run supervisor

The setup

  • nginx
  • gunicorn
  • supervisor
  • memcached
  • virtualenv
  • virtualenvwrapper
  • git

Requirements

  • Python 2.6.1
  • Fabric 0.9.3
  • Boto 2.0b4

Credits

The unicorn logo is a courtesy of Mac McRae. You can find his work at http://macmcrae.com/.

License

The MIT License (MIT)

Copyright (c) 2011 Giovanni Collazo

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

fabulous's People

Contributors

gcollazo avatar jannkleen avatar jpadilla avatar mo-mughrabi avatar nicferrier avatar toffer avatar yuvadm 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

fabulous's Issues

Add init.d to run Supervisor at startup

Supervisor is not running at startup. You can configure an init.d script to do this.

sudo vi /etc/init.d/supervisord

Add the following:

# Supervisord auto-start
#
# description: Auto-starts supervisord
# processname: supervisord
# pidfile: /var/run/supervisord.pid

SUPERVISORD=/usr/local/bin/supervisord
SUPERVISORCTL=/usr/local/bin/supervisorctl

case $1 in
start)
        echo -n "Starting supervisord: "
        $SUPERVISORD
        echo
        ;;
stop)
        echo -n "Stopping supervisord: "
        $SUPERVISORCTL shutdown
        echo
        ;;
restart)
        echo -n "Stopping supervisord: "
        $SUPERVISORCTL shutdown
        echo
        echo -n "Starting supervisord: "
        $SUPERVISORD
        echo
        ;;
esac

And then...

sudo chmod +x /etc/init.d/supervisord
sudo update-rc.d supervisord defaults
sudo /etc/init.d/supervisord start

Obviously, this should probably go as added actions on cookbook.py and the init.d script as a template

Add init.d to run Supervisor at startup

Supervisor is not running at startup. You can configure an init.d script to do this.

sudo vi /etc/init.d/supervisord

Add the following:

SUPERVISORD=/usr/local/bin/supervisord
SUPERVISORCTL=/usr/local/bin/supervisorctl

case $1 in
start)
        echo -n "Starting supervisord: "
        $SUPERVISORD
        echo
        ;;
stop)
        echo -n "Stopping supervisord: "
        $SUPERVISORCTL shutdown
        echo
        ;;
restart)
        echo -n "Stopping supervisord: "
        $SUPERVISORCTL shutdown
        echo
        echo -n "Starting supervisord: "
        $SUPERVISORD
        echo
        ;;
esac

And then...

sudo chmod +x /etc/init.d/supervisord
sudo update-rc.d supervisord defaults
sudo /etc/init.d/supervisord start

Obviously, this should probably go as added actions on cookbook.py and the init.d script as a template

'sudo /etc/init.d/supervisord start' outputs error message

The command 'sudo /etc/init.d/supervisord start', which is the last commend executed as part of the cookbook, causes this error to output:

[ec2-xxxx.compute-1.amazonaws.com] sudo: /etc/init.d/supervisord start
[ec2-xxxx.compute-1.amazonaws.com] out: Starting supervisord: Error: Another program is already listening on a port that one of our HTTP servers is configured to use. Shut this program down first befor[ec2-75-101-218-250.compute-1.amazonaws.com] out:
[ec2-xxxx.compute-1.amazonaws.com] out: For help, use /usr/local/bin/supervisord -h
[ec2-xxxx.compute-1.amazonaws.com] out:
[ec2-xxxx.compute-1.amazonaws.com] out:

Running the command on the remote server after deployment has finished produces the same error message.

The supervisord daemon runs without a hitch & performs as expected, though.

Doesn't deploy github app

Perhaps I'm missing something, but it looks like GITHUB_REPO is never referenced, and no github app is ever deployed.

Django 1.7.1

Hello there,

The idea of this project is amazing! I'm quite new to django deployment and I could not find any good resource to start setting up my own server.

I'm using Django 1.7.1 with Python 3.2. All good tutorials are still pointing to Django 1.6 and Python 2.

Do you know what is necessary to change in this project in order to create proper up-to-date server instances?

Thanks a lot!

gunicorn executes as 'root'

The file '/etc/supervisord.conf' contains the following section for managing the Django/gunicorn app:

[program:polls]
command=/home/ubuntu/.virtualenvs/polls/bin/gunicorn_django -c gunicorn.conf.py settings.py
directory=/home/ubuntu/webapps/polls
user=root
autostart=true
autorestart=true
redirect_stderr=true

This implies that the gunicorn processes execute as root, which is easily verified using 'top'.

This is incredibly dangerous. Is there some reason why it doesn't execute as 'www-data' or some other user?

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.