Skip to content

Instantly share code, notes, and snippets.

@miku
Created January 18, 2018 15:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miku/002e1d52c764fb0b4ddee6e2bbf309e3 to your computer and use it in GitHub Desktop.
Save miku/002e1d52c764fb0b4ddee6e2bbf309e3 to your computer and use it in GitHub Desktop.
Alternative Vagrantfile for VuFind with VUFIND_LOCAL_DIR under $HOME/vufind
# -*- mode: ruby -*-
# vi: set ft=ruby :
# VM for VuFind
# =============
#
# $ git clone git@github.com:vufind-org/vufind.git
# $ cd vufind
# $ vagrant up
#
# Start SOLR manually.
#
# $ vagrant ssh
# $ cd /vagrant
# $ ./solr.sh start
#
# Configure at http://localhost:4567/vufind/Install/Home
#
# Note: If you use NoILS without any ILS, set `mode = ils-none` in
# /home/vagrant/vufind/config/vufind/NoILS.ini.
# All Vagrant configuration is done below.
Vagrant.configure("2") 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.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "ubuntu/xenial64"
# 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 resources on the VM:
vb.cpus = 2
vb.memory = "2048"
end
# Network configuration to forward ports.
config.vm.network :forwarded_port, guest: 80, host: 4567
config.vm.network :forwarded_port, guest: 8080, host: 4568
# 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", privileged: false, inline: <<-SHELL
# Configure mysql-server package credential values.
# NOTE: Please don't use these default values in any situation where security is a concern.
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'
# Install package dependencies.
sudo apt-get update
sudo apt-get install -y git zip unzip apache2 default-jdk mysql-server
sudo apt-get install -y libapache2-mod-php php-mbstring php-pear
sudo apt-get install -y php php-dev php-gd php-intl
sudo apt-get install -y php-json php-ldap php-mysql php-xml php-curl
# Install composer.
curl -s https://getcomposer.org/installer > composer-setup.php
[ "$(curl -s https://composer.github.io/installer.sig)" == "$(sha384sum composer-setup.php | cut -c 1-96)" ] || echo "composer installation failed" && exit 1
php composer-setup.php
rm -f composer-setup.php
sudo mv composer.phar /usr/local/bin/composer
# Check out and set up VuFind.
VUFIND_LOCAL_DIR=$HOME/vufind
VUFIND_HOME=/vagrant
mkdir -p $VUFIND_LOCAL_DIR/cache/cli
mkdir -p $VUFIND_LOCAL_DIR/config/vufind
(cd /vagrant && composer install && php install.php --non-interactive --overridedir=$VUFIND_LOCAL_DIR)
sudo ln -s $VUFIND_LOCAL_DIR/httpd-vufind.conf /etc/apache2/conf-enabled/vufind.conf
sudo a2enmod rewrite
sudo systemctl restart apache2
sudo chown -R www-data:www-data $VUFIND_LOCAL_DIR/cache $VUFIND_LOCAL_DIR/config/vufind
sudo chmod 777 $VUFIND_LOCAL_DIR/cache/cli
sudo bash -c "echo export VUFIND_HOME=$VUFIND_HOME > /etc/profile.d/vufind.sh"
sudo bash -c "echo export VUFIND_LOCAL_DIR=$VUFIND_LOCAL_DIR >> /etc/profile.d/vufind.sh"
SHELL
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment