diff --git a/.gitignore b/.gitignore index fba2c057304a91e4f2067d6fe80dd1e03deb6a91..2ab75b5e02b4978e2e38a0fc132c7e6666f747ad 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ composer.phar import/solrmarc.log node_modules public/swagger-ui +.vagrant \ No newline at end of file diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000000000000000000000000000000000000..544c26a124ff410901fec96006a8904cf484750e --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,69 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# 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", inline: <<-SHELL + + # Configure mysql-server package credential values. + # NOTE: Please don't use these default values in any situation where security is a concern. + debconf-set-selections <<< 'mysql-server mysql-server/root_password password root' + debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root' + + # Install package dependencies. + apt-get update + apt-get install -y git zip unzip apache2 default-jdk mysql-server + apt-get install -y libapache2-mod-php php-mbstring php-pear php php-dev php-gd php-intl php-json php-ldap php-mysql php-xml php-curl + + # Install composer. + php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" + php -r "if (hash_file('SHA384', 'composer-setup.php') === trim(file_get_contents('https://composer.github.io/installer.sig'))) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" + php composer-setup.php + php -r "unlink('composer-setup.php');" + mv composer.phar /usr/local/bin/composer + + # Check out and set up VuFind. + mkdir -p /vufindlocal/cache/cli /vufindlocal/config/vufind + chown -R ubuntu:ubuntu /vufindlocal + su - ubuntu -c 'cd /vagrant && composer install && php install.php --non-interactive --overridedir=/vufindlocal' + ln -s /vufindlocal/httpd-vufind.conf /etc/apache2/conf-enabled/vufind.conf + a2enmod rewrite + systemctl restart apache2 + + # Set up cache and config permissions. + chown -R www-data:www-data /vufindlocal/cache /vufindlocal/config/vufind + chmod 777 /vufindlocal/cache/cli + + # Set up profile for command line. + echo export VUFIND_HOME=/vagrant > /etc/profile.d/vufind.sh + echo export VUFIND_LOCAL_DIR=/vufindlocal >> /etc/profile.d/vufind.sh + SHELL +end