Skip to content

Instantly share code, notes, and snippets.

@gcollazo
Forked from jpadilla/bootstrap.sh
Created March 2, 2011 02:31

Revisions

  1. Giovanni Collazo revised this gist Mar 5, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    #!/bin/bash

    # To run do:
    # wget http://url.com/bootstrap.sh && chmod +x bootstrap.sh && ./bootstrap.sh && source ~/.profile
    # wget https://gist.github.com/raw/850359/ea02e22f021b7ebf2f602811461677ab4a3f2a9e/bootstrap.sh && chmod +x bootstrap.sh && ./bootstrap.sh && source ~/.profile
    #
    # Based on Amazon EC2 AMI ID ami-ccf405a5 Ubuntu Server 10.10
    # This script will:
  2. Giovanni Collazo revised this gist Mar 5, 2011. 1 changed file with 0 additions and 5 deletions.
    5 changes: 0 additions & 5 deletions bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -188,11 +188,6 @@ sudo apt-get -qq install git
    git config --global user.name $git_name
    git config --global user.email $email

    # Git-flow - TODO:Fix it!
    # git clone --recursive git://github.com/nvie/gitflow.git
    # sudo make -f ~/gitflow/Makefile install
    # rm -Rf ./gitflow

    # Create django.wsgi
    echo "import os
    import sys
  3. Giovanni Collazo revised this gist Mar 2, 2011. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,7 @@
    #!/bin/bash

    # To run do: curl https://example.com/bootstrap.sh | bash && source ~/.profile
    # To run do:
    # wget http://url.com/bootstrap.sh && chmod +x bootstrap.sh && ./bootstrap.sh && source ~/.profile
    #
    # Based on Amazon EC2 AMI ID ami-ccf405a5 Ubuntu Server 10.10
    # This script will:
  4. Giovanni Collazo revised this gist Mar 2, 2011. 1 changed file with 10 additions and 24 deletions.
    34 changes: 10 additions & 24 deletions bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -30,39 +30,25 @@ clear

    # Define user settings
    read -p "Enter project name [project]: " project_name
    if [[ $project_name = "" ]]; then
    project_name="project"
    fi
    if [[ $project_name = "" ]]; then project_name="project"; fi

    read -p "Enter apps directory [/var/webapps]: " apps_dir
    if [[ $apps_dir = "" ]]; then
    apps_dir="/var/webapps"
    fi
    if [[ $apps_dir = "" ]]; then apps_dir="/var/webapps"; fi

    read -p "Enter domains separated by space [example.com www.example.com]: " domains
    if [[ $domains = "" ]]; then
    domains="example.com www.example.com"
    fi
    if [[ $domains = "" ]]; then domains="example.com www.example.com"; fi

    read -p "Enter password for mysql's root user [password]: " dbpass
    if [[ $dbpass = "" ]]; then
    dbpass="password"
    fi
    if [[ $dbpass = "" ]]; then dbpass="password"; fi

    read -p "Enter path for virtualenvs [/var/virtualenvs]: " virtualenv_dir
    if [[ $virtualenv_dir = "" ]]; then
    virtualenv_dir="/var/virtualenvs"
    fi
    if [[ $virtualenv_dir = "" ]]; then virtualenv_dir="/var/virtualenvs"; fi

    read -p "Git user name [Server]: " git_name
    if [[ $git_name = "" ]]; then
    git_name="Server"
    fi
    if [[ $git_name = "" ]]; then git_name="Server"; fi

    read -p "Git user email [root@localhost]: " git_email
    if [[ $git_email = "" ]]; then
    git_email="root@localhost"
    fi
    read -p "Git user email [webmaster@localhost]: " git_email
    if [[ $email = "" ]]; then email="webmaster@localhost"; fi


    # Do the dirty work
    @@ -86,7 +72,7 @@ sudo pip install virtualenvwrapper
    # /etc/apache2/sites-available/default
    touch ~/default
    echo "<VirtualHost *:8080>
    ServerAdmin webmaster@localhost
    ServerAdmin $email
    WSGIScriptAlias / $apps_dir/$project_name/django.wsgi
    <Directory />
    Order allow,deny
    @@ -199,7 +185,7 @@ sudo chown -R www-data:www-data $apps_dir
    # Git
    sudo apt-get -qq install git
    git config --global user.name $git_name
    git config --global user.email $git_email
    git config --global user.email $email

    # Git-flow - TODO:Fix it!
    # git clone --recursive git://github.com/nvie/gitflow.git
  5. Giovanni Collazo revised this gist Mar 2, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -189,7 +189,7 @@ sudo /etc/init.d/nginx restart
    # Make virtualenvwrapper work
    sudo mkdir $virtualenv_dir
    sudo chown -R ubuntu:ubuntu $virtualenv_dir
    echo "export WORKON_HOME=/var/virtualenvs" >> ~/.profile
    echo "export WORKON_HOME=$virtualenv_dir" >> ~/.profile
    echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.profile

    # Create WebApps Folder
  6. Giovanni Collazo revised this gist Mar 2, 2011. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -87,7 +87,7 @@ sudo pip install virtualenvwrapper
    touch ~/default
    echo "<VirtualHost *:8080>
    ServerAdmin webmaster@localhost
    WSGIScriptAlias / /var/webapps/$project_name/django.wsgi
    WSGIScriptAlias / $apps_dir/$project_name/django.wsgi
    <Directory />
    Order allow,deny
    Allow from all
    @@ -156,7 +156,7 @@ echo "server {
    include /etc/nginx/proxy.conf;
    }
    location /static/ {
    root /var/webapps/$project_name/;
    root $apps_dir/$project_name/;
    }
    }" > ~/default
    sudo rm -rf /etc/nginx/sites-available/default
  7. Giovanni Collazo revised this gist Mar 2, 2011. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -19,7 +19,8 @@
    # Once this setup is completed you must do the following to complete deployment:
    # * Clone your project into $apps_dir
    # - Static files must be in $apps_dir/$project_name/static
    # - If you are using the admin app create a symlink to its media files in $apps_dir/$project_name/static
    # - If you are using the admin app create a symlink to its media files in
    # $apps_dir/$project_name/static
    # * Move the ~/django.wsgi file to $apps_dir/$project_name/django.wsgi
    # * sudo chown -R www-data:www-data $apps_dir
    # * Restart apache
  8. Giovanni Collazo revised this gist Mar 2, 2011. 1 changed file with 8 additions and 15 deletions.
    23 changes: 8 additions & 15 deletions bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -20,52 +20,45 @@
    # * Clone your project into $apps_dir
    # - Static files must be in $apps_dir/$project_name/static
    # - If you are using the admin app create a symlink to its media files in $apps_dir/$project_name/static
    # * Move the django.wsgi file to $apps_dir/$project_name/django.wsgi
    # * Move the ~/django.wsgi file to $apps_dir/$project_name/django.wsgi
    # * sudo chown -R www-data:www-data $apps_dir
    # * Restart apache

    # Clean prompt
    clear

    # Define user settings
    echo "Enter project name [project]:"
    read project_name
    read -p "Enter project name [project]: " project_name
    if [[ $project_name = "" ]]; then
    project_name="project"
    fi

    echo "Enter apps directory [/var/webapps]:"
    read apps_dir
    read -p "Enter apps directory [/var/webapps]: " apps_dir
    if [[ $apps_dir = "" ]]; then
    apps_dir="/var/webapps"
    fi

    echo "Enter domains separated by space [example.com www.example.com]:"
    read domains
    read -p "Enter domains separated by space [example.com www.example.com]: " domains
    if [[ $domains = "" ]]; then
    domains="example.com www.example.com"
    fi

    echo "Enter password for mysql's root user [password]:"
    read dbpass
    read -p "Enter password for mysql's root user [password]: " dbpass
    if [[ $dbpass = "" ]]; then
    dbpass="password"
    fi

    echo "Enter path for virtualenvs [/var/virtualenvs]"
    read virtualenv_dir
    read -p "Enter path for virtualenvs [/var/virtualenvs]: " virtualenv_dir
    if [[ $virtualenv_dir = "" ]]; then
    virtualenv_dir="/var/virtualenvs"
    fi

    echo "Git user name [Server]:"
    read git_name
    read -p "Git user name [Server]: " git_name
    if [[ $git_name = "" ]]; then
    git_name="Server"
    fi

    echo "Git user email [root@localhost]:"
    read git_email
    read -p "Git user email [root@localhost]: " git_email
    if [[ $git_email = "" ]]; then
    git_email="root@localhost"
    fi
  9. Giovanni Collazo revised this gist Mar 2, 2011. 1 changed file with 12 additions and 1 deletion.
    13 changes: 12 additions & 1 deletion bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -14,12 +14,13 @@
    # * create webapps folder
    # * install/config git
    # * install git-flow
    # * create the django.wsgi you will need in ~/django.wsgi
    #
    # Once this setup is completed you must do the following to complete deployment:
    # * Clone your project into $apps_dir
    # - Static files must be in $apps_dir/$project_name/static
    # - If you are using the admin app create a symlink to its media files in $apps_dir/$project_name/static
    # * Create a django.wsgi file in $apps_dir/$project_name/django.wsgi
    # * Move the django.wsgi file to $apps_dir/$project_name/django.wsgi
    # * sudo chown -R www-data:www-data $apps_dir
    # * Restart apache

    @@ -211,4 +212,14 @@ git config --global user.email $git_email
    # sudo make -f ~/gitflow/Makefile install
    # rm -Rf ./gitflow

    # Create django.wsgi
    echo "import os
    import sys
    path = '$apps_dir'
    if path not in sys.path:
    sys.path.append(path)
    os.environ['DJANGO_SETTINGS_MODULE'] = '$project_name.settings'
    import django.core.handlers.wsgi
    application = django.core.handlers.wsgi.WSGIHandler()" > ~/django.wsgi

    echo "All done now!"
  10. Giovanni Collazo revised this gist Mar 2, 2011. 1 changed file with 9 additions and 7 deletions.
    16 changes: 9 additions & 7 deletions bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -23,47 +23,49 @@
    # * sudo chown -R www-data:www-data $apps_dir
    # * Restart apache

    # Clean prompt
    clear

    # Define user settings
    echo "Enter project name [project]:"
    read project_name
    if ["$project_name" = ""]; then
    if [[ $project_name = "" ]]; then
    project_name="project"
    fi

    echo "Enter apps directory [/var/webapps]:"
    read apps_dir
    if ["$apps_dir" = ""]; then
    if [[ $apps_dir = "" ]]; then
    apps_dir="/var/webapps"
    fi

    echo "Enter domains separated by space [example.com www.example.com]:"
    read domains
    if ["$domains" = ""]; then
    if [[ $domains = "" ]]; then
    domains="example.com www.example.com"
    fi

    echo "Enter password for mysql's root user [password]:"
    read dbpass
    if ["$dbpass" = ""]; then
    if [[ $dbpass = "" ]]; then
    dbpass="password"
    fi

    echo "Enter path for virtualenvs [/var/virtualenvs]"
    read virtualenv_dir
    if ["$virtualenv_dir" = ""]; then
    if [[ $virtualenv_dir = "" ]]; then
    virtualenv_dir="/var/virtualenvs"
    fi

    echo "Git user name [Server]:"
    read git_name
    if ["$git_name" = ""]; then
    if [[ $git_name = "" ]]; then
    git_name="Server"
    fi

    echo "Git user email [root@localhost]:"
    read git_email
    if ["$git_email" = ""]; then
    if [[ $git_email = "" ]]; then
    git_email="root@localhost"
    fi

  11. Giovanni Collazo revised this gist Mar 2, 2011. 1 changed file with 65 additions and 28 deletions.
    93 changes: 65 additions & 28 deletions bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -1,37 +1,72 @@
    #!/bin/bash

    # To run do: curl https://theurl.com/bootstrap.sh | bash && source ~/.profile
    # To run do: curl https://example.com/bootstrap.sh | bash && source ~/.profile
    #
    # Based on Amazon EC2 AMI ID ami-ccf405a5 Ubuntu Server 10.10
    # This script must install the following requirements
    # * apache2
    # * mod_wsgi
    # * mysql
    # * pip
    # * virtualenv
    # * virtualenvwrapper
    # * virtualenvwrapper setup
    # * make webapps folder
    # * install git
    # * setup git
    # This script will:
    # * install/config apache2
    # * install mod_wsgi
    # * install/config nginx
    # * install/config mysql
    # * isntall pip
    # * install virtualenv
    # * install/config virtualenvwrapper
    # * create webapps folder
    # * install/config git
    # * install git-flow
    #
    # Once this setup is completed you must do the following to complete deployment:
    # * Clone your project into $apps_dir
    # - Static files must be in $apps_dir/$project_name/static
    # - If you are using the admin app create a symlink to its media files in $apps_dir/$project_name/static
    # * Create a django.wsgi file in $apps_dir/$project_name/django.wsgi
    # * sudo chown -R www-data:www-data $apps_dir
    # * Restart apache


    # Define user settings
    echo "Enter project name [project]:"
    read project_name
    if ["$project_name" = ""]; then
    project_name="project"
    fi

    echo "Enter apps directory [/var/webapps]:"
    read apps_dir
    if ["$apps_dir" = ""]; then
    apps_dir="/var/webapps"
    fi

    echo "Enter domains separated by space [example.com www.example.com]:"
    read domains
    if ["$domains" = ""]; then
    domains="example.com www.example.com"
    fi

    echo "Enter password for mysql's root user [password]:"
    read dbpass
    if ["$dbpass" = ""]; then
    dbpass="password"
    fi

    echo "Enter path for virtualenvs [/var/virtualenvs]"
    read virtualenv_dir
    if ["$virtualenv_dir" = ""]; then
    virtualenv_dir="/var/virtualenvs"
    fi

    echo "Git user name [Server]:"
    read git_name
    if ["$git_name" = ""]; then
    git_name="Server"
    fi

    echo "Git user email [root@localhost]:"
    read git_email
    if ["$git_email" = ""]; then
    git_email="root@localhost"
    fi

    # TODO:
    # create django.wsgi
    # create vhost
    # add symlink to admin folder
    # restart apache
    # done!


    # Define your settings
    project_name="elweb"
    domains="www.elweb.co elweb.co"
    dbpass="password"
    virtualenv_dir="/var/virtualenvs"
    apps_dir="/var/webapps"
    git_name="Server1"
    git_email="root@localhost"

    # Do the dirty work
    echo "This will take a few minutes..."
    @@ -45,6 +80,8 @@ sudo apt-get install -qq apache2 libapache2-mod-wsgi
    sudo apt-get install -qq nginx
    sudo apt-get install -qq python-setuptools python-dev build-essential python-pip
    sudo apt-get install -qq nginx
    sudo pip install django
    sudo pip install fabric
    sudo pip install virtualenv
    sudo pip install virtualenvwrapper

  12. Giovanni Collazo revised this gist Mar 2, 2011. 1 changed file with 119 additions and 17 deletions.
    136 changes: 119 additions & 17 deletions bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -12,17 +12,11 @@
    # * virtualenvwrapper
    # * virtualenvwrapper setup
    # * make webapps folder
    # * install git
    # * setup git
    # * install git-flow

    # TODO:
    # install git
    # setup git
    # install git-flow
    # set deployment ssh key
    # pull master of project
    # create virtualenv based on env.info file in project
    # activate virtualenv
    # install dependencies with pip
    # migrate data using south
    # create django.wsgi
    # create vhost
    # add symlink to admin folder
    @@ -31,11 +25,13 @@


    # Define your settings
    project_name="elweb"
    domains="www.elweb.co elweb.co"
    dbpass="password"
    virtualenv_dir="/var/virtualenvs"
    apps_dir="/var/webapps"
    git_name=""
    git_email=""
    git_name="Server1"
    git_email="root@localhost"

    # Do the dirty work
    echo "This will take a few minutes..."
    @@ -46,10 +42,116 @@ echo "mysql-server mysql-server/root_password_again select $dbpass" | sudo debco
    sudo apt-get install -qq mysql-server
    sudo apt-get install -qq mysql-client
    sudo apt-get install -qq apache2 libapache2-mod-wsgi
    sudo apt-get install -qq nginx
    sudo apt-get install -qq python-setuptools python-dev build-essential python-pip
    sudo apt-get install -qq nginx
    sudo pip install virtualenv
    sudo pip install virtualenvwrapper

    # Apache setup: serv application with mod_wsgi
    # /etc/apache2/sites-available/default
    touch ~/default
    echo "<VirtualHost *:8080>
    ServerAdmin webmaster@localhost
    WSGIScriptAlias / /var/webapps/$project_name/django.wsgi
    <Directory />
    Order allow,deny
    Allow from all
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    </VirtualHost>" > ~/default
    sudo rm -rf /etc/apache2/sites-available/default
    sudo mv ~/default /etc/apache2/sites-available/default
    sudo chown root:root /etc/apache2/sites-available/default

    # /etc/apache2/ports.conf
    touch ~/ports.conf
    echo "NameVirtualHost *:8080
    Listen 8080
    <IfModule mod_ssl.c>
    Listen 443
    </IfModule>
    <IfModule mod_gnutls.c>
    Listen 443
    </IfModule>" > ~/ports.conf
    sudo rm -rf /etc/apache2/ports.conf
    sudo mv ~/ports.conf /etc/apache2/ports.conf
    sudo chown root:root /etc/apache2/ports.conf

    # restart apache
    sudo /etc/init.d/apache2 restart

    # Nginx setup: serv media files and proxy all other request
    # /etc/nginx/nginx.conf
    touch ~/nginx.conf
    echo "user www-data;
    worker_processes 2;
    error_log /var/log/nginx/error.log;
    pid /var/run/nginx.pid;
    events {
    worker_connections 1024;
    }
    http {
    include /etc/nginx/mime.types;
    default_type application/octet-stream;
    access_log /var/log/nginx/access.log;
    sendfile on;
    tcp_nopush on;
    keepalive_timeout 65;
    tcp_nodelay on;
    gzip on;
    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
    }" > ~/nginx.conf
    sudo rm -rf /etc/nginx/nginx.conf
    sudo mv ~/nginx.conf /etc/nginx/nginx.conf
    sudo chown root:root /etc/nginx/nginx.conf

    # /etc/nginx/sites-enabled/default
    touch ~/default
    echo "server {
    listen 80; ## listen for ipv4
    listen [::]:80 default ipv6only=on; ## listen for ipv6
    server_name $domains;
    access_log /var/log/nginx/localhost.access.log;
    error_log /var/log/nginx/localhost.error.log;
    location / {
    proxy_pass http://127.0.0.1:8080;
    include /etc/nginx/proxy.conf;
    }
    location /static/ {
    root /var/webapps/$project_name/;
    }
    }" > ~/default
    sudo rm -rf /etc/nginx/sites-available/default
    sudo mv ~/default /etc/nginx/sites-available/default
    sudo chown root:root /etc/nginx/sites-available/default

    # /etc/nginx/proxy.conf
    touch ~/proxy.conf
    echo 'proxy_redirect off;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    client_max_body_size 10m;
    client_body_buffer_size 128k;
    proxy_connect_timeout 90;
    proxy_send_timeout 90;
    proxy_read_timeout 90;
    proxy_buffer_size 4k;
    proxy_buffers 4 32k;
    proxy_busy_buffers_size 64k;
    proxy_temp_file_write_size 64k;
    ' > ~/proxy.conf
    sudo rm -rf /etc/nginx/proxy.conf
    sudo mv ~/proxy.conf /etc/nginx/proxy.conf
    sudo chown root:root /etc/nginx/proxy.conf

    # restart nginx
    sudo /etc/init.d/nginx restart

    # Make virtualenvwrapper work
    sudo mkdir $virtualenv_dir
    sudo chown -R ubuntu:ubuntu $virtualenv_dir
    @@ -58,16 +160,16 @@ echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.profile

    # Create WebApps Folder
    sudo mkdir $apps_dir
    sudo chown -R ubuntu:ubuntu $apps_dir
    sudo chown -R www-data:www-data $apps_dir

    # Git
    sudo apt-get install git-core
    sudo apt-get -qq install git
    git config --global user.name $git_name
    git config --global user.email $git_email

    # Git-flow
    git clone --recursive git://github.com/nvie/gitflow.git
    sudo make -f ./gitflow/Makefile install
    rm -Rf ./gitflow
    # Git-flow - TODO:Fix it!
    # git clone --recursive git://github.com/nvie/gitflow.git
    # sudo make -f ~/gitflow/Makefile install
    # rm -Rf ./gitflow

    echo "All done now!"
  13. @jpadilla jpadilla revised this gist Mar 2, 2011. 1 changed file with 6 additions and 2 deletions.
    8 changes: 6 additions & 2 deletions bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -15,8 +15,8 @@

    # TODO:
    # install git
    # install git-flow
    # setup git
    # install git-flow
    # set deployment ssh key
    # pull master of project
    # create virtualenv based on env.info file in project
    @@ -55,7 +55,6 @@ sudo mkdir $virtualenv_dir
    sudo chown -R ubuntu:ubuntu $virtualenv_dir
    echo "export WORKON_HOME=/var/virtualenvs" >> ~/.profile
    echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.profile
    source ~/.profile

    # Create WebApps Folder
    sudo mkdir $apps_dir
    @@ -66,4 +65,9 @@ sudo apt-get install git-core
    git config --global user.name $git_name
    git config --global user.email $git_email

    # Git-flow
    git clone --recursive git://github.com/nvie/gitflow.git
    sudo make -f ./gitflow/Makefile install
    rm -Rf ./gitflow

    echo "All done now!"
  14. @jpadilla jpadilla revised this gist Mar 2, 2011. 1 changed file with 9 additions and 0 deletions.
    9 changes: 9 additions & 0 deletions bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -15,6 +15,7 @@

    # TODO:
    # install git
    # install git-flow
    # setup git
    # set deployment ssh key
    # pull master of project
    @@ -24,6 +25,7 @@
    # migrate data using south
    # create django.wsgi
    # create vhost
    # add symlink to admin folder
    # restart apache
    # done!

    @@ -32,6 +34,8 @@
    dbpass="password"
    virtualenv_dir="/var/virtualenvs"
    apps_dir="/var/webapps"
    git_name=""
    git_email=""

    # Do the dirty work
    echo "This will take a few minutes..."
    @@ -57,4 +61,9 @@ source ~/.profile
    sudo mkdir $apps_dir
    sudo chown -R ubuntu:ubuntu $apps_dir

    # Git
    sudo apt-get install git-core
    git config --global user.name $git_name
    git config --global user.email $git_email

    echo "All done now!"
  15. Giovanni Collazo revised this gist Mar 1, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -51,7 +51,7 @@ sudo mkdir $virtualenv_dir
    sudo chown -R ubuntu:ubuntu $virtualenv_dir
    echo "export WORKON_HOME=/var/virtualenvs" >> ~/.profile
    echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.profile
    && source ~/.profile
    source ~/.profile

    # Create WebApps Folder
    sudo mkdir $apps_dir
  16. Giovanni Collazo revised this gist Mar 1, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -51,7 +51,7 @@ sudo mkdir $virtualenv_dir
    sudo chown -R ubuntu:ubuntu $virtualenv_dir
    echo "export WORKON_HOME=/var/virtualenvs" >> ~/.profile
    echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.profile
    source ~/.profile
    && source ~/.profile

    # Create WebApps Folder
    sudo mkdir $apps_dir
  17. Giovanni Collazo revised this gist Mar 1, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    #!/bin/bash

    # To run do: curl https://example.com/bootstrap.sh | bash
    # To run do: curl https://theurl.com/bootstrap.sh | bash && source ~/.profile
    #
    # Based on Amazon EC2 AMI ID ami-ccf405a5 Ubuntu Server 10.10
    # This script must install the following requirements
  18. Giovanni Collazo revised this gist Mar 1, 2011. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -52,7 +52,6 @@ sudo chown -R ubuntu:ubuntu $virtualenv_dir
    echo "export WORKON_HOME=/var/virtualenvs" >> ~/.profile
    echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.profile
    source ~/.profile
    source ~/.profile

    # Create WebApps Folder
    sudo mkdir $apps_dir
  19. Giovanni Collazo revised this gist Mar 1, 2011. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -52,6 +52,7 @@ sudo chown -R ubuntu:ubuntu $virtualenv_dir
    echo "export WORKON_HOME=/var/virtualenvs" >> ~/.profile
    echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.profile
    source ~/.profile
    source ~/.profile

    # Create WebApps Folder
    sudo mkdir $apps_dir
  20. Giovanni Collazo revised this gist Mar 1, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    #!/bin/bash

    # To run do: curl https://theurl.com/bootstrap.sh | bash
    # To run do: curl https://example.com/bootstrap.sh | bash
    #
    # Based on Amazon EC2 AMI ID ami-ccf405a5 Ubuntu Server 10.10
    # This script must install the following requirements
  21. Giovanni Collazo revised this gist Mar 1, 2011. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,7 @@
    #!/bin/bash

    # To run do: curl https://theurl.com/bootstrap.sh | bash
    #
    # Based on Amazon EC2 AMI ID ami-ccf405a5 Ubuntu Server 10.10
    # This script must install the following requirements
    # * apache2
  22. Giovanni Collazo revised this gist Mar 1, 2011. 1 changed file with 18 additions and 4 deletions.
    22 changes: 18 additions & 4 deletions bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -11,6 +11,20 @@
    # * virtualenvwrapper setup
    # * make webapps folder

    # TODO:
    # install git
    # setup git
    # set deployment ssh key
    # pull master of project
    # create virtualenv based on env.info file in project
    # activate virtualenv
    # install dependencies with pip
    # migrate data using south
    # create django.wsgi
    # create vhost
    # restart apache
    # done!


    # Define your settings
    dbpass="password"
    @@ -21,13 +35,12 @@ apps_dir="/var/webapps"
    echo "This will take a few minutes..."
    sudo apt-get update -qq
    sudo apt-get upgrade -qq
    echo "mysql-server mysql-server/root_password select $dbpass" | debconf-set-selections
    echo "mysql-server mysql-server/root_password_again select $dbpass" | debconf-set-selections
    echo "mysql-server mysql-server/root_password select $dbpass" | sudo debconf-set-selections
    echo "mysql-server mysql-server/root_password_again select $dbpass" | sudo debconf-set-selections
    sudo apt-get install -qq mysql-server
    sudo apt-get install -qq mysql-client
    sudo apt-get install -qq apache2 libapache2-mod-wsgi
    sudo apt-get install -qq python-setuptools python-dev build-essential
    sudo apt-get install -qq python-pip
    sudo apt-get install -qq python-setuptools python-dev build-essential python-pip
    sudo pip install virtualenv
    sudo pip install virtualenvwrapper

    @@ -40,5 +53,6 @@ source ~/.profile

    # Create WebApps Folder
    sudo mkdir $apps_dir
    sudo chown -R ubuntu:ubuntu $apps_dir

    echo "All done now!"
  23. Giovanni Collazo renamed this gist Feb 28, 2011. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  24. Giovanni Collazo revised this gist Feb 28, 2011. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions gistfile1.eclass
    Original file line number Diff line number Diff line change
    @@ -36,6 +36,7 @@ sudo mkdir $virtualenv_dir
    sudo chown -R ubuntu:ubuntu $virtualenv_dir
    echo "export WORKON_HOME=/var/virtualenvs" >> ~/.profile
    echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.profile
    source ~/.profile

    # Create WebApps Folder
    sudo mkdir $apps_dir
  25. Giovanni Collazo created this gist Feb 28, 2011.
    43 changes: 43 additions & 0 deletions gistfile1.eclass
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,43 @@
    #!/bin/bash

    # Based on Amazon EC2 AMI ID ami-ccf405a5 Ubuntu Server 10.10
    # This script must install the following requirements
    # * apache2
    # * mod_wsgi
    # * mysql
    # * pip
    # * virtualenv
    # * virtualenvwrapper
    # * virtualenvwrapper setup
    # * make webapps folder


    # Define your settings
    dbpass="password"
    virtualenv_dir="/var/virtualenvs"
    apps_dir="/var/webapps"

    # Do the dirty work
    echo "This will take a few minutes..."
    sudo apt-get update -qq
    sudo apt-get upgrade -qq
    echo "mysql-server mysql-server/root_password select $dbpass" | debconf-set-selections
    echo "mysql-server mysql-server/root_password_again select $dbpass" | debconf-set-selections
    sudo apt-get install -qq mysql-server
    sudo apt-get install -qq mysql-client
    sudo apt-get install -qq apache2 libapache2-mod-wsgi
    sudo apt-get install -qq python-setuptools python-dev build-essential
    sudo apt-get install -qq python-pip
    sudo pip install virtualenv
    sudo pip install virtualenvwrapper

    # Make virtualenvwrapper work
    sudo mkdir $virtualenv_dir
    sudo chown -R ubuntu:ubuntu $virtualenv_dir
    echo "export WORKON_HOME=/var/virtualenvs" >> ~/.profile
    echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.profile

    # Create WebApps Folder
    sudo mkdir $apps_dir

    echo "All done now!"