Fetching contributors…
Cannot retrieve contributors at this time
executable file 74 lines (67 sloc) 2.76 KB
set -euo pipefail
export DEBIAN_FRONTEND=noninteractive
# Add latest nodejs sources
curl -sL | bash -
apt-get update
apt-get install -y nginx php5-fpm php5-mysql php5-cli php5-dev php5-gd php5-mcrypt php5-ldap mysql-server nodejs git
# Install bower and gulp
npm install -g gulp bower
# Enable mcrypt for PHP
php5enmod mcrypt
# Stop and disable services
service nginx stop
service php5-fpm stop
service mysql stop
systemctl disable nginx
systemctl disable php5-fpm
systemctl disable mysql
# patch /etc/php5/fpm/pool.d/www.conf to not change uid/gid to www-data
sed --in-place='' \
--expression='s/^listen.owner = www-data/;listen.owner = www-data/' \
--expression='s/^ = www-data/; = www-data/' \
--expression='s/^user = www-data/;user = www-data/' \
--expression='s/^group = www-data/;group = www-data/' \
# patch /etc/php5/fpm/php-fpm.conf to not have a pidfile
sed --in-place='' \
--expression='s/^pid =/;pid =/' \
# patch /etc/php5/fpm/pool.d/www.conf to no clear environment variables
# so we can pass in SANDSTORM=1 to apps
sed --in-place='' \
--expression='s/^;clear_env = no/clear_env=no/' \
# patch /etc/php5/fpm/php.ini to allow backup uploads up to 100MB in Paperwork
sed --in-place='' \
--expression='s/^post_max_size =.*/post_max_size = 20M/' \
--expression='s/^upload_max_filesize =.*/upload_max_filesize = 20M/' \
--expression='s/^max_execution_time =.*/max_execution_time = 300/' \
--expression='s/^max_input_time =.*/max_input_time = 360/' \
# patch mysql conf to not change uid, and to use /var/tmp over /tmp
# see
sed --in-place='' \
--expression='s/^user\t\t= mysql/#user\t\t= mysql/' \
--expression='s,^tmpdir\t\t= /tmp,tmpdir\t\t= /var/tmp,' \
--expression='/\[mysqld]/ a\ secure-file-priv = ""\' \
# patch mysql conf to use smaller transaction logs to save disk space
cat <<EOF > /etc/mysql/conf.d/sandstorm.cnf
# Set the transaction log file to the minimum allowed size to save disk space.
innodb_log_file_size = 1048576
# Set the main data file to grow by 1MB at a time, rather than 8MB at a time.
innodb_autoextend_increment = 1
# Go to app directory
cd /opt/app/
# Purge git repository just in case it is there
rm -rf /opt/app/paperwork
# Clone git repository for master build
git clone
# Clone other repos & checkout branches for tests
#git clone
#cd /opt/app/paperwork/
#git checkout branch-name
exit 0