Skip to content

Commit

Permalink
Upgrade to Ubuntu 17.10 (Artful Aardvark)
Browse files Browse the repository at this point in the history
  • Loading branch information
gasman committed Jul 31, 2018
1 parent b304c23 commit 8ae29fb
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 13 deletions.
6 changes: 4 additions & 2 deletions README.md
Expand Up @@ -5,10 +5,12 @@ A script to painlessly set up a Vagrant environment for development of Wagtail.

Features
--------
* An Ubuntu 17.10 (Artful Aardvark) base image
* Checkouts of Wagtail, bakerydemo, django-modelcluster and Willow ready to develop against
* Node.js / npm toolchain for front-end asset building
* Optional packages installed (PostgreSQL, ElasticSearch, Embedly, Sphinx...)
* Virtualenv for Python 3
* Elasticsearch 5 installed (but disabled by default to make the VM less resource-heavy)
* Optional packages installed (PostgreSQL, Embedly, Sphinx...)
* Virtualenv for Python 3.6

This script currently uses a `wagtail-2.0` branch of bakerydemo to test breaking changes in Wagtail 2.0.

Expand Down
4 changes: 2 additions & 2 deletions Vagrantfile
Expand Up @@ -12,8 +12,8 @@ Vagrant.configure(2) do |config|

# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "torchbox/wagtail"
config.vm.box_version = "~> 1.0"
config.vm.box = "ubuntu/artful32"
config.vm.box_version = "~> 20180718.0.0"

# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
Expand Down
56 changes: 47 additions & 9 deletions vagrant/provision.sh
Expand Up @@ -9,24 +9,49 @@ VIRTUALENV_DIR=/home/vagrant/.virtualenvs/bakerydemo
PYTHON=$VIRTUALENV_DIR/bin/python
PIP=$VIRTUALENV_DIR/bin/pip

# bring up a PostgreSQL-enabled bakerydemo instance using the current release version of wagtail
PROJECT_DIR=$BAKERYDEMO_ROOT USE_POSTGRESQL=1 $BAKERYDEMO_ROOT/vagrant/provision.sh bakerydemo
# silence "dpkg-preconfigure: unable to re-open stdin" warnings
export DEBIAN_FRONTEND=noninteractive

# Update APT database
apt-get update -y

# useful tools
apt-get install -y vim git curl gettext build-essential
# Python 3
apt-get install -y python3 python3-dev python3-pip python3-venv
# PIL dependencies
apt-get install -y libjpeg-dev libtiff-dev zlib1g-dev libfreetype6-dev liblcms2-dev
# Redis and PostgreSQL
apt-get install -y redis-server postgresql libpq-dev
# libenchant (spellcheck library for docs)
apt-get install -y libenchant-dev
# Java for Elasticsearch
apt-get install -y openjdk-8-jre-headless

# Create pgsql superuser
su - postgres -c "createuser -s vagrant"

pip3 install -U pip
pip install virtualenvwrapper

# install system-wide developer dependencies
apt-get update
apt-get install -y libenchant-dev ruby2.0
gem2.0 install scss_lint
# Set up virtualenvwrapper in .bashrc
cat << EOF >> /home/vagrant/.bashrc
export WORKON_HOME=/home/vagrant/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=python3
source /usr/local/bin/virtualenvwrapper.sh
EOF

#Update pip
su - vagrant -c "$PIP install -U pip"

# bring up a PostgreSQL-enabled bakerydemo instance using the current release version of wagtail
PROJECT_DIR=$BAKERYDEMO_ROOT DEV_USER=vagrant USE_POSTGRESQL=1 $BAKERYDEMO_ROOT/vagrant/provision.sh bakerydemo

# install additional dependencies (including developer-specific ones)
# of wagtail master

su - vagrant -c "cd $WAGTAIL_ROOT && $PIP install -e .[testing,docs] -U"

# install optional packages (so that the full test suite runs)
su - vagrant -c "$PIP install embedly elasticsearch django-sendfile"
su - vagrant -c "$PIP install embedly \"elasticsearch>=5.0,<6.0\" django-sendfile"

# install Node.js (for front-end asset building)
# as per instructions on https://github.com/nodesource/distributions
Expand All @@ -43,3 +68,16 @@ su - vagrant -c "cd $WAGTAIL_ROOT && npm install && npm run build"

# run additional migrations in wagtail master
su - vagrant -c "$PYTHON $BAKERYDEMO_ROOT/manage.py migrate --noinput"

# Elasticsearch (disabled by default, as it's a resource hog)
echo "Downloading Elasticsearch..."
wget -q https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.3.3.deb
dpkg -i elasticsearch-5.3.3.deb
rm elasticsearch-5.3.3.deb
# reduce JVM heap size from 2g to 512m
sed -i 's/^\(-Xm[sx]\)2g$/\1512m/g' /etc/elasticsearch/jvm.options
# to enable:
# systemctl enable elasticsearch
# systemctl start elasticsearch

echo "Vagrant setup complete. You can now log in with: vagrant ssh"

0 comments on commit 8ae29fb

Please sign in to comment.