Warning, /webapps/ocs-apiserver/Vagrantfile is written in an unsupported language. File is not indexed.

0001 # -*- mode: ruby -*-
0002 # vi: set ft=ruby :
0003 
0004 VAGRANTFILE_API_VERSION = '2'
0005 
0006 @script = <<SCRIPT
0007 
0008 BOX_USER="vagrant"
0009 BOX_DBPASS="vagrant"
0010 
0011 debconf-set-selections <<< "mysql-server mysql-server/root_password password $BOX_DBPASS"
0012 debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $BOX_DBPASS"
0013 
0014 # Install dependencies
0015 apt-get update
0016 apt-get install -y apache2 git curl php7.0 php7.0-bcmath php7.0-bz2 php7.0-cli php7.0-curl php7.0-intl php7.0-json php7.0-mbstring php7.0-opcache php7.0-soap php7.0-xml php7.0-xsl php7.0-zip libapache2-mod-php7.0 php-mysql
0017 apt-get install -y memcached php-memcache
0018 apt-get install -y mysql-server mysql-client php-xdebug
0019 
0020 # Configure XDebug
0021 echo '
0022 zend_extension=xdebug.so
0023 
0024 xdebug.remote_enable=true
0025 xdebug.remote_connect_back=true
0026 xdebug.idekey=vagrant ' > /etc/php/7.0/mods-available/xdebug.ini
0027 
0028 if [ ! -d /var/www/public ]; then
0029     mkdir /var/www/public
0030 fi
0031 
0032 # Configure Apache
0033 echo '<VirtualHost *:80>
0034         DocumentRoot /var/www/public
0035         AllowEncodedSlashes On
0036 
0037         <Directory /var/www/public>
0038                 Options +Indexes +FollowSymLinks
0039                 DirectoryIndex index.php index.html
0040                 Order allow,deny
0041                 Allow from all
0042                 AllowOverride All
0043         </Directory>
0044 
0045         ErrorLog ${APACHE_LOG_DIR}/error.log
0046         CustomLog ${APACHE_LOG_DIR}/access.log combined
0047 </VirtualHost>' > /etc/apache2/sites-available/000-default.conf
0048 a2enmod rewrite
0049 a2enmod env
0050 service apache2 restart
0051 
0052 sudo -s mysql --user="root" --password="$BOX_DBPASS" -e 'grant all on *.* to vagrant@localhost identified by "vagrant" with grant option;'
0053 sudo service mysql restart
0054 mysql --user="$BOX_USER" --password="$BOX_DBPASS" < /var/www/scripts/sql/init_schema.sql
0055 
0056 if [ -e /usr/local/bin/composer ]; then
0057     /usr/local/bin/composer self-update
0058 else
0059     curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
0060 fi
0061 
0062 # Reset home directory of vagrant user
0063 if ! grep -q "cd /var/www" /home/vagrant/.profile; then
0064     echo "cd /var/www" >> /home/vagrant/.profile
0065 fi
0066 
0067 #echo "** [ZF] Run the following command to install dependencies, if you have not already:"
0068 #echo "    vagrant ssh -c 'composer install'"
0069 echo "** [ZF] Visit http://localhost:8080 in your browser for to view the application **"
0070 SCRIPT
0071 
0072 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
0073   config.vm.box = 'bento/ubuntu-16.04'
0074   config.vm.network "forwarded_port", guest: 80, host: 8080
0075   config.vm.synced_folder '.', '/var/www'
0076   config.vm.provision 'shell', inline: @script
0077 
0078   config.vm.provider "virtualbox" do |vb|
0079     vb.customize ["modifyvm", :id, "--memory", "1024"]
0080     vb.customize ["modifyvm", :id, "--name", "pling-ocs-api - Ubuntu 16.04"]
0081   end
0082 end