dokuwiki-sandstorm/.sandstorm/setup.sh

50 lines
1.8 KiB
Bash
Raw Permalink Normal View History

2015-11-16 03:57:07 +00:00
#!/bin/bash
2016-10-13 23:04:44 +00:00
# When you change this file, you must take manual action. Read this doc:
# - https://docs.sandstorm.io/en/latest/vagrant-spk/customizing/#setupsh
2015-11-16 03:57:07 +00:00
set -euo pipefail
export DEBIAN_FRONTEND=noninteractive
apt-get update
2020-06-03 14:32:15 +00:00
apt-get install -y nginx php7.0-fpm php7.0-cli php7.0-curl git php7.0-dev libleveldb-dev
cd /usr/local/src
2020-06-03 14:32:15 +00:00
if [ ! -d php-leveldb ]; then
git clone https://github.com/reeze/php-leveldb.git
fi
cd php-leveldb
phpize
./configure
make
make install
2020-06-03 14:32:15 +00:00
cp /opt/app/leveldb.ini /etc/php/7.0/mods-available
phpenmod leveldb
2015-11-16 03:57:07 +00:00
service nginx stop
2020-06-03 14:32:15 +00:00
service php7.0-fpm stop
2015-11-16 03:57:07 +00:00
systemctl disable nginx
2020-06-03 14:32:15 +00:00
systemctl disable php7.0-fpm
# patch /etc/php/7.0/fpm/pool.d/www.conf to not change uid/gid to www-data
2015-11-16 03:57:07 +00:00
sed --in-place='' \
2020-06-03 14:32:15 +00:00
--expression='s/^listen.owner = www-data/;listen.owner = www-data/' \
--expression='s/^listen.group = www-data/;listen.group = www-data/' \
--expression='s#^listen = .*#listen = /var/run/php-fpm7.0.sock#' \
--expression='s/^user = www-data/;user = www-data/' \
--expression='s/^group = www-data/;group = www-data/' \
/etc/php/7.0/fpm/pool.d/www.conf
# patch /etc/php7.0/fpm/php-fpm.conf to not have a pidfile
2015-11-16 03:57:07 +00:00
sed --in-place='' \
2020-06-03 14:32:15 +00:00
--expression='s/^pid =/;pid =/' \
/etc/php/7.0/fpm/php-fpm.conf
# patch /etc/php/7.0/fpm/pool.d/www.conf to no clear environment variables
2015-11-16 03:57:07 +00:00
# so we can pass in SANDSTORM=1 to apps
sed --in-place='' \
--expression='s/^;clear_env = no/clear_env=no/' \
2020-06-03 14:32:15 +00:00
/etc/php/7.0/fpm/pool.d/www.conf
2015-11-16 03:57:07 +00:00
# Adjust fastcgi_params to use the patched fe_https
sed --in-place='' \
--expression 's/^fastcgi_param *HTTPS.*$/fastcgi_param HTTPS \$fe_https if_not_empty;/' \
/etc/nginx/fastcgi_params
mkdir -p /var/lib/dokuwiki/{conf,data,lib/plugins,lib/tpl}
chown -R vagrant.vagrant /var/lib/dokuwiki