1.- Get into the src folder, download & extract nginx source
cd ~/srccurl -O http://nginx.org/download/nginx-1.7.0.tar.gztar -xzvf nginx-1.7.0.tar.gzcd nginx-1.7.0
2.- Configuring the source
./configure --prefix=$HOME/local/nginx \
| # -*- mode: ruby -*- | |
| # vi: set ft=ruby : | |
| Vagrant::Config.run do |config| | |
| # Base box to build off, and download URL for when it doesn't exist on the user's system already | |
| config.vm.box = "wagtail-base-v0.1" | |
| config.vm.box_url = "http://downloads.torchbox.com/wagtail-base-v0.1.box" | |
| # You can also build from a vanilla precise32 box, although it'll take longer |
| #!/bin/bash | |
| DJANGO_VERSION=1.4 | |
| VENV="django$DJANGO_VERSION" | |
| # create virtualenv: "django<version>" e.g. django1.4 | |
| mkdir lib | |
| cd lib | |
| virtualenv --system-site-packages $VENV | |
| cd $VENV |
| - name: set swap_file variable | |
| set_fact: | |
| swap_file: /mnt/{{ swap_space }}.swap | |
| - name: check if swap file exists | |
| stat: | |
| path: "{{ swap_file }}" | |
| register: swap_file_check | |
| - name: create swap file |
1.- Get into the src folder, download & extract nginx source
cd ~/srccurl -O http://nginx.org/download/nginx-1.7.0.tar.gztar -xzvf nginx-1.7.0.tar.gzcd nginx-1.7.02.- Configuring the source
./configure --prefix=$HOME/local/nginx \
| #! /usr/bin/python | |
| """ | |
| This simple script makes it easy to create server certificates | |
| that are signed by your own Certificate Authority. | |
| Mostly, this script just automates the workflow explained | |
| in http://www.tc.umn.edu/~brams006/selfsign.html. | |
| Before using this script, you'll need to create a private |
| [unix_http_server] | |
| file=/tmp/supervisor.sock ; path to your socket file | |
| [supervisord] | |
| logfile=/var/log/supervisord/supervisord.log ; supervisord log file | |
| logfile_maxbytes=50MB ; maximum size of logfile before rotation | |
| logfile_backups=10 ; number of backed up logfiles | |
| loglevel=error ; info, debug, warn, trace | |
| pidfile=/var/run/supervisord.pid ; pidfile location | |
| nodaemon=false ; run supervisord as a daemon |
Packer
Packer is used to build image from a base image, perform provisions and store (commit) the final image.
We use provisioners and Packer templates to do the actual work to create the final image.
We use Ansible for provisioning.
| # sudo su and run the following | |
| sudo aptitude update | |
| # install all dependencies | |
| sudo aptitude -y install \ | |
| python-pip \ | |
| python2.7-dev \ | |
| libssl-dev \ | |
| libcurl4-openssl-dev \ |
| # Logging settings for django projects, works with django 1.5+ | |
| # If DEBUG=True, all logs (including django logs) will be | |
| # written to console and to debug_file. | |
| # If DEBUG=False, logs with level INFO or higher will be | |
| # saved to production_file. | |
| # Logging usage: | |
| # import logging | |
| # logger = logging.getLogger(__name__) | |
| # logger.info("Log this message") |
| import multiprocessing | |
| # split a list into evenly sized chunks | |
| def chunks(l, n): | |
| return [l[i:i+n] for i in range(0, len(l), n)] | |
| def do_job(job_id, data_slice): | |
| for item in data_slice: | |
| print "job", job_id, item |