mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
Purge old vagrant config
This commit is contained in:
@@ -1,7 +1,3 @@
|
|||||||
*.sqlite3
|
*.sqlite3
|
||||||
*.scss
|
*.scss
|
||||||
*.md
|
*.md
|
||||||
*.rb
|
|
||||||
Vagrantfile
|
|
||||||
config/vagrant/*
|
|
||||||
config/vagrant.yml
|
|
||||||
|
|||||||
134
Vagrantfile
vendored
134
Vagrantfile
vendored
@@ -1,134 +0,0 @@
|
|||||||
# -*- mode: ruby -*-
|
|
||||||
# vi: set ft=ruby :
|
|
||||||
require 'yaml'
|
|
||||||
|
|
||||||
unless File.exist?('config/vagrant.yml')
|
|
||||||
raise "There is no config/vagrant.yml file.\nCopy config/vagrant.template.yml, make any changes you need, then try again."
|
|
||||||
end
|
|
||||||
|
|
||||||
settings = YAML.load_file 'config/vagrant.yml'
|
|
||||||
|
|
||||||
$script = <<SCRIPT
|
|
||||||
echo Beginning Vagrant provisioning...
|
|
||||||
date > /etc/vagrant_provisioned_at
|
|
||||||
SCRIPT
|
|
||||||
|
|
||||||
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
|
|
||||||
VAGRANTFILE_API_VERSION = '2'
|
|
||||||
|
|
||||||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
|
||||||
# The most common configuration options are documented and commented below.
|
|
||||||
# For a complete reference, please see the online documentation at
|
|
||||||
# https://docs.vagrantup.com.
|
|
||||||
|
|
||||||
config.vm.provision 'shell', inline: $script
|
|
||||||
|
|
||||||
# Every Vagrant development environment requires a box. You can search for
|
|
||||||
# boxes at https://atlas.hashicorp.com/search.
|
|
||||||
config.vm.box = 'ubuntu/trusty64'
|
|
||||||
|
|
||||||
# Share an additional folder to the guest VM. The first argument is
|
|
||||||
# the path on the host to the actual folder. The second argument is
|
|
||||||
# the path on the guest to mount the folder. And the optional third
|
|
||||||
# argument is a set of non-required options.
|
|
||||||
config.vm.synced_folder ".", "/vagrant"
|
|
||||||
|
|
||||||
# Create a forwarded port mapping which allows access to a specific port
|
|
||||||
# within the machine from a port on the host machine. In the example below,
|
|
||||||
# accessing "localhost:5000" will access port 5000 on the guest machine.
|
|
||||||
config.vm.network "forwarded_port", guest: 5000, host: 5000
|
|
||||||
|
|
||||||
# PostgreSQL Server port forwarding
|
|
||||||
config.vm.network "forwarded_port", host: 15432, guest: 5432
|
|
||||||
|
|
||||||
# You can provision with just one of these scripts by user its name, eg:
|
|
||||||
# $ vagrant provision --provision-with postgresql
|
|
||||||
|
|
||||||
config.vm.provision 'build',
|
|
||||||
type: 'shell',
|
|
||||||
path: 'config/vagrant/build_dependency_setup.sh'
|
|
||||||
|
|
||||||
config.vm.provision 'git',
|
|
||||||
type: 'shell',
|
|
||||||
path: 'config/vagrant/git_setup.sh'
|
|
||||||
|
|
||||||
config.vm.provision 'postgresql',
|
|
||||||
type: 'shell',
|
|
||||||
path: 'config/vagrant/postgresql_setup.sh',
|
|
||||||
args: [
|
|
||||||
settings['db']['name'],
|
|
||||||
settings['db']['user'],
|
|
||||||
settings['db']['password'],
|
|
||||||
]
|
|
||||||
|
|
||||||
config.vm.provision 'python',
|
|
||||||
type: 'shell',
|
|
||||||
path: 'config/vagrant/python_setup.sh'
|
|
||||||
|
|
||||||
config.vm.provision 'virtualenv',
|
|
||||||
type: 'shell',
|
|
||||||
path: 'config/vagrant/virtualenv_setup.sh',
|
|
||||||
args: [
|
|
||||||
settings['virtualenv']['envname'],
|
|
||||||
]
|
|
||||||
|
|
||||||
# Will install foreman and, if there's a Procfile, start it:
|
|
||||||
config.vm.provision 'foreman',
|
|
||||||
type: 'shell',
|
|
||||||
path: 'config/vagrant/foreman_setup.sh',
|
|
||||||
run: 'always',
|
|
||||||
args: [
|
|
||||||
settings['virtualenv']['envname'],
|
|
||||||
settings['django']['settings_module'],
|
|
||||||
settings['foreman']['procfile'],
|
|
||||||
]
|
|
||||||
|
|
||||||
# Disable automatic box update checking. If you disable this, then
|
|
||||||
# boxes will only be checked for updates when the user runs
|
|
||||||
# `vagrant box outdated`. This is not recommended.
|
|
||||||
# config.vm.box_check_update = false
|
|
||||||
|
|
||||||
# Create a forwarded port mapping which allows access to a specific port
|
|
||||||
# within the machine from a port on the host machine. In the example below,
|
|
||||||
# accessing "localhost:8080" will access port 80 on the guest machine.
|
|
||||||
# config.vm.network "forwarded_port", guest: 80, host: 8080
|
|
||||||
|
|
||||||
# Create a private network, which allows host-only access to the machine
|
|
||||||
# using a specific IP.
|
|
||||||
# config.vm.network "private_network", ip: "192.168.33.10"
|
|
||||||
|
|
||||||
# Create a public network, which generally matched to bridged network.
|
|
||||||
# Bridged networks make the machine appear as another physical device on
|
|
||||||
# your network.
|
|
||||||
# config.vm.network "public_network"
|
|
||||||
|
|
||||||
# Provider-specific configuration so you can fine-tune various
|
|
||||||
# backing providers for Vagrant. These expose provider-specific options.
|
|
||||||
# Example for VirtualBox:
|
|
||||||
#
|
|
||||||
config.vm.provider "virtualbox" do |vb|
|
|
||||||
# # Display the VirtualBox GUI when booting the machine
|
|
||||||
# vb.gui = true
|
|
||||||
#
|
|
||||||
# # Customize the amount of memory on the VM:
|
|
||||||
vb.memory = "1024"
|
|
||||||
end
|
|
||||||
#
|
|
||||||
# View the documentation for the provider you are using for more
|
|
||||||
# information on available options.
|
|
||||||
|
|
||||||
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
|
|
||||||
# such as FTP and Heroku are also available. See the documentation at
|
|
||||||
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
|
|
||||||
# config.push.define "atlas" do |push|
|
|
||||||
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
|
|
||||||
# end
|
|
||||||
|
|
||||||
# Enable provisioning with a shell script. Additional provisioners such as
|
|
||||||
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
|
|
||||||
# documentation for more information about their specific syntax and use.
|
|
||||||
# config.vm.provision "shell", inline: <<-SHELL
|
|
||||||
# sudo apt-get update
|
|
||||||
# sudo apt-get install -y apache2
|
|
||||||
# SHELL
|
|
||||||
end
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
django:
|
|
||||||
settings_module: PyRIGS.settings
|
|
||||||
virtualenv:
|
|
||||||
envname: myvirtualenv
|
|
||||||
foreman:
|
|
||||||
procfile: Procfile
|
|
||||||
db:
|
|
||||||
name: postgres_db
|
|
||||||
user: postgres_db
|
|
||||||
password: postgres_db
|
|
||||||
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Via https://github.com/kiere/vagrant-heroku-cedar-14/blob/master/config/vagrant/build_dependency_setup.sh
|
|
||||||
|
|
||||||
echo "=== Begin Vagrant Provisioning using 'config/vagrant/build_dependency_setup.sh'"
|
|
||||||
|
|
||||||
# Install build dependencies for a sane build environment
|
|
||||||
apt-get -y update
|
|
||||||
apt-get -y install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev
|
|
||||||
|
|
||||||
# Other things that we may need installed before anything else.
|
|
||||||
apt-get install -y libmemcached-dev
|
|
||||||
apt-get build-dep python-lxml
|
|
||||||
|
|
||||||
echo "=== End Vagrant Provisioning using 'config/vagrant/build_dependency_setup.sh'"
|
|
||||||
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Install and (if there's a Procfile) start foreman.
|
|
||||||
# Needs to come after the virtualenv has been set up.
|
|
||||||
|
|
||||||
# Expects three arguments:
|
|
||||||
VIRTUALENV_NAME=$1
|
|
||||||
DJANGO_SETTINGS_MODULE=$2
|
|
||||||
PROCFILE=$3
|
|
||||||
|
|
||||||
echo "=== Begin Vagrant Provisioning using 'config/vagrant/foreman_setup.sh'"
|
|
||||||
|
|
||||||
gem install foreman --no-ri --no-rdoc
|
|
||||||
|
|
||||||
if ! grep -Fq "DJANGO_SETTINGS_MODULE" /home/vagrant/.bashrc; then
|
|
||||||
echo "export DJANGO_SETTINGS_MODULE=${DJANGO_SETTINGS_MODULE}" >> /home/vagrant/.bashrc
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
if [[ -f /vagrant/$PROCFILE ]]; then
|
|
||||||
echo "Procfile found; starting foreman."
|
|
||||||
|
|
||||||
export DJANGO_SETTINGS_MODULE="$DJANGO_SETTINGS_MODULE"
|
|
||||||
|
|
||||||
# Ensure the virtualenv settings in .profile are loaded:
|
|
||||||
source /home/vagrant/.profile
|
|
||||||
|
|
||||||
# Run with & to release the terminal.
|
|
||||||
# Although that may also rely on the Procfile's processes having their
|
|
||||||
# output sent to a file, not stdout/stderr.
|
|
||||||
foreman start -f /vagrant/$PROCFILE &
|
|
||||||
else
|
|
||||||
echo "No Procfile found; not starting foreman."
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "=== End Vagrant Provisioning using 'config/vagrant/foreman_setup.sh'"
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Via https://github.com/kiere/vagrant-heroku-cedar-14/blob/master/config/vagrant/git_setup.sh
|
|
||||||
|
|
||||||
echo "=== Begin Vagrant Provisioning using 'config/vagrant/git_setup.sh'"
|
|
||||||
|
|
||||||
# Install Git if not available
|
|
||||||
if [ -z `which git` ]; then
|
|
||||||
echo "===== Installing Git"
|
|
||||||
apt-get -y update
|
|
||||||
apt-get -y install git-core
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "=== End Vagrant Provisioning using 'config/vagrant/git_setup.sh'"
|
|
||||||
@@ -1,112 +0,0 @@
|
|||||||
#!/bin/sh -e
|
|
||||||
|
|
||||||
# Expects three arguments:
|
|
||||||
# $1 - database name
|
|
||||||
# $2 - database user
|
|
||||||
# #3 - database user password
|
|
||||||
|
|
||||||
# Via https://github.com/kiere/vagrant-heroku-cedar-14/blob/master/config/vagrant/postgresql_setup.sh
|
|
||||||
|
|
||||||
echo "=== Begin Vagrant Provisioning using 'config/vagrant/postgresql_setup.sh'"
|
|
||||||
|
|
||||||
APP_DB_NAME=$1
|
|
||||||
APP_DB_USER=$2
|
|
||||||
APP_DB_PASS=$3
|
|
||||||
|
|
||||||
# Edit the following to change the version of PostgreSQL that is installed
|
|
||||||
PG_VERSION=9.4
|
|
||||||
|
|
||||||
###########################################################
|
|
||||||
# Changes below this line are probably not necessary
|
|
||||||
###########################################################
|
|
||||||
print_db_usage () {
|
|
||||||
echo "Your PostgreSQL database has been setup and can be accessed on your local machine on the forwarded port (default: 15432)"
|
|
||||||
echo " Host: localhost"
|
|
||||||
echo " Port: 15432"
|
|
||||||
echo " Database: $APP_DB_NAME"
|
|
||||||
echo " Username: $APP_DB_USER"
|
|
||||||
echo " Password: $APP_DB_PASS"
|
|
||||||
echo ""
|
|
||||||
echo "Admin access to postgres user via VM:"
|
|
||||||
echo " vagrant ssh"
|
|
||||||
echo " sudo su - postgres"
|
|
||||||
echo ""
|
|
||||||
echo "psql access to app database user via VM:"
|
|
||||||
echo " vagrant ssh"
|
|
||||||
echo " sudo su - postgres"
|
|
||||||
echo " PGUSER=$APP_DB_USER PGPASSWORD=$APP_DB_PASS psql -h localhost $APP_DB_NAME"
|
|
||||||
echo ""
|
|
||||||
echo "Env variable for application development:"
|
|
||||||
echo " DATABASE_URL=postgresql://$APP_DB_USER:$APP_DB_PASS@localhost:15432/$APP_DB_NAME"
|
|
||||||
echo ""
|
|
||||||
echo "Local command to access the database via psql:"
|
|
||||||
echo " PGUSER=$APP_DB_USER PGPASSWORD=$APP_DB_PASS psql -h localhost -p 15432 $APP_DB_NAME"
|
|
||||||
}
|
|
||||||
|
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
|
||||||
|
|
||||||
PROVISIONED_ON=/etc/vm_provision_on_timestamp
|
|
||||||
if [ -f "$PROVISIONED_ON" ]
|
|
||||||
then
|
|
||||||
echo "VM was already provisioned at: $(cat $PROVISIONED_ON)"
|
|
||||||
echo "To run system updates manually login via 'vagrant ssh' and run 'apt-get update && apt-get upgrade'"
|
|
||||||
echo ""
|
|
||||||
print_db_usage
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
PG_REPO_APT_SOURCE=/etc/apt/sources.list.d/pgdg.list
|
|
||||||
if [ ! -f "$PG_REPO_APT_SOURCE" ]
|
|
||||||
then
|
|
||||||
# Add PG apt repo:
|
|
||||||
echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" > "$PG_REPO_APT_SOURCE"
|
|
||||||
|
|
||||||
# Add PGDG repo key:
|
|
||||||
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | apt-key add -
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Update package list and upgrade all packages
|
|
||||||
apt-get update
|
|
||||||
apt-get -y upgrade
|
|
||||||
|
|
||||||
apt-get -y install "postgresql-$PG_VERSION" "postgresql-contrib-$PG_VERSION"
|
|
||||||
apt-get -y install libpq-dev # For building ruby 'pg' gem
|
|
||||||
|
|
||||||
PG_CONF="/etc/postgresql/$PG_VERSION/main/postgresql.conf"
|
|
||||||
PG_HBA="/etc/postgresql/$PG_VERSION/main/pg_hba.conf"
|
|
||||||
PG_DIR="/var/lib/postgresql/$PG_VERSION/main"
|
|
||||||
|
|
||||||
# Edit postgresql.conf to change listen address to '*':
|
|
||||||
sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '*'/" "$PG_CONF"
|
|
||||||
|
|
||||||
# Append to pg_hba.conf to add password auth:
|
|
||||||
echo "host all all all md5" >> "$PG_HBA"
|
|
||||||
|
|
||||||
# Explicitly set default client_encoding
|
|
||||||
echo "client_encoding = utf8" >> "$PG_CONF"
|
|
||||||
|
|
||||||
# Restart so that all new config is loaded:
|
|
||||||
service postgresql restart
|
|
||||||
|
|
||||||
cat << EOF | su - postgres -c psql
|
|
||||||
-- Create the database user:
|
|
||||||
CREATE USER $APP_DB_USER PASSWORD '$APP_DB_PASS';
|
|
||||||
EOF
|
|
||||||
|
|
||||||
cat << EOF | su - postgres -c psql
|
|
||||||
-- Create the database:
|
|
||||||
CREATE DATABASE $APP_DB_NAME WITH OWNER=$APP_DB_USER
|
|
||||||
LC_COLLATE='en_US.utf8'
|
|
||||||
LC_CTYPE='en_US.utf8'
|
|
||||||
ENCODING='UTF8'
|
|
||||||
TEMPLATE=template0;
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Tag the provision time:
|
|
||||||
date > "$PROVISIONED_ON"
|
|
||||||
|
|
||||||
echo "Successfully created PostgreSQL dev virtual machine."
|
|
||||||
echo ""
|
|
||||||
print_db_usage
|
|
||||||
|
|
||||||
echo "=== End Vagrant Provisioning using 'config/vagrant/postgresql_setup.sh'"
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Install python and required python modules.
|
|
||||||
# pip and virtualenv are in virtualenv_setup.sh
|
|
||||||
|
|
||||||
# Initial part of this via
|
|
||||||
# https://github.com/torchbox/vagrant-django-base/blob/master/install.sh
|
|
||||||
|
|
||||||
echo "=== Begin Vagrant Provisioning using 'config/vagrant/python_setup.sh'"
|
|
||||||
|
|
||||||
apt-get update -y
|
|
||||||
|
|
||||||
# Python dev packages
|
|
||||||
apt-get install -y python python-dev python-setuptools python-pip
|
|
||||||
|
|
||||||
# Dependencies for image processing with Pillow (drop-in replacement for PIL)
|
|
||||||
# supporting: jpeg, tiff, png, freetype, littlecms
|
|
||||||
apt-get install -y libjpeg-dev libtiff-dev zlib1g-dev libfreetype6-dev liblcms2-dev
|
|
||||||
|
|
||||||
# lxml dependencies
|
|
||||||
apt-get install -y libxml2-dev libxslt1-dev python-dev
|
|
||||||
|
|
||||||
echo "=== End Vagrant Provisioning using 'config/vagrant/python_setup.sh'"
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# This will:
|
|
||||||
# * Install pip, virtualenv and virtualenvwrapper.
|
|
||||||
# * Set up virtualenvwrapper's paths etc.
|
|
||||||
# * Create a new virtualenv.
|
|
||||||
# * Install any pip requirements from the requirements.txt file.
|
|
||||||
|
|
||||||
# Expects one argument, the name of the virtualenv.
|
|
||||||
|
|
||||||
# The name we'll use for the virtualenv in which we'll install requirements:
|
|
||||||
VENV_NAME=$1
|
|
||||||
|
|
||||||
echo "=== Begin Vagrant Provisioning using 'config/vagrant/virtualenv_setup.sh'"
|
|
||||||
|
|
||||||
# virtualenv global setup
|
|
||||||
if ! command -v pip; then
|
|
||||||
easy_install -U pip
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -f /usr/local/bin/virtualenv ]]; then
|
|
||||||
easy_install virtualenv virtualenvwrapper
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# If it doesn't look like .bashrc has the required virtualenvwrapper lines in,
|
|
||||||
# then add them.
|
|
||||||
if ! grep -Fq "WORKON_HOME" /home/vagrant/.profile; then
|
|
||||||
echo "Adding virtualenvwrapper locations to .profile"
|
|
||||||
|
|
||||||
if [[ -d /vagrant/config/virtualenvwrapper/vagrant ]]; then
|
|
||||||
echo "export VIRTUALENVWRAPPER_HOOK_DIR=/vagrant/config/virtualenvwrapper/vagrant" >> /home/vagrant/.profile
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "export WORKON_HOME=/home/vagrant/.virtualenvs" >> /home/vagrant/.profile
|
|
||||||
echo "export PROJECT_HOME=/home/vagrant/Devel" >> /home/vagrant/.profile
|
|
||||||
echo "source /usr/local/bin/virtualenvwrapper.sh" >> /home/vagrant/.profile
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Get .virtualenvwrapper env variables set up:
|
|
||||||
source /home/vagrant/.profile
|
|
||||||
|
|
||||||
if [[ -d /home/vagrant/.virtualenvs/$VENV_NAME ]]; then
|
|
||||||
echo "Activating virtualenv $VENV_NAME."
|
|
||||||
workon $VENV_NAME
|
|
||||||
else
|
|
||||||
echo "Making new virtualenv $VENV_NAME."
|
|
||||||
# Also switches to the virtualenv:
|
|
||||||
mkvirtualenv $VENV_NAME
|
|
||||||
|
|
||||||
# So that we can install things with pip while ssh'd in as vagrant user:
|
|
||||||
sudo chown -R vagrant:vagrant /home/vagrant/.virtualenvs/$VENV_NAME/
|
|
||||||
|
|
||||||
# Automatically switch to the virtual env on log in:
|
|
||||||
echo "workon $VENV_NAME" >> /home/vagrant/.profile
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# If we have a requirements.txt file in this project, then install
|
|
||||||
# everything in it with pip in a new virtualenv.
|
|
||||||
if [[ -f /vagrant/requirements.txt ]]; then
|
|
||||||
echo "Installing from ./requirements.txt with pip."
|
|
||||||
pip install -r /vagrant/requirements.txt
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "=== End Vagrant Provisioning using 'config/vagrant/virtualenv_setup.sh'"
|
|
||||||
Reference in New Issue
Block a user