2017-02-03 20:04:55 -06:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# When you change this file, you must take manual action. Read this doc:
|
|
|
|
# - https://docs.sandstorm.io/en/latest/vagrant-spk/customizing/#setupsh
|
2018-01-16 14:34:36 -06:00
|
|
|
echo "Now in setup.sh"
|
2017-02-03 20:04:55 -06:00
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
|
|
|
# install packages so we can install apt-add-repository.
|
|
|
|
apt-get update
|
|
|
|
apt-get install -y python-software-properties software-properties-common
|
|
|
|
|
2017-10-29 10:05:22 -05:00
|
|
|
# install all languages
|
2019-02-23 07:32:24 -06:00
|
|
|
#en_US
|
2018-12-23 12:21:54 -06:00
|
|
|
sed -i 's/# es_ES.UTF-8 UTF-8/es_ES.UTF-8 UTF-8/g' /etc/locale.gen
|
2017-10-29 10:05:22 -05:00
|
|
|
sed -i 's/# de_DE.UTF-8 UTF-8/de_DE.UTF-8 UTF-8/g' /etc/locale.gen
|
|
|
|
sed -i 's/# fr_FR.UTF-8 UTF-8/fr_FR.UTF-8 UTF-8/g' /etc/locale.gen
|
2018-04-01 23:56:19 -05:00
|
|
|
sed -i 's/# it_IT.UTF-8 UTF-8/it_IT.UTF-8 UTF-8/g' /etc/locale.gen
|
2017-12-08 12:40:30 -06:00
|
|
|
sed -i 's/# nl_NL.UTF-8 UTF-8/nl_NL.UTF-8 UTF-8/g' /etc/locale.gen
|
|
|
|
sed -i 's/# pl_PL.UTF-8 UTF-8/pl_PL.UTF-8 UTF-8/g' /etc/locale.gen
|
2018-04-01 23:56:19 -05:00
|
|
|
sed -i 's/# pt_BR.UTF-8 UTF-8/pt_BR.UTF-8 UTF-8/g' /etc/locale.gen
|
2018-01-15 10:48:20 -06:00
|
|
|
sed -i 's/# ru_RU.UTF-8 UTF-8/ru_RU.UTF-8 UTF-8/g' /etc/locale.gen
|
2018-12-23 12:21:54 -06:00
|
|
|
sed -i 's/# zh_TW.UTF-8 UTF-8/zh_TW.UTF-8 UTF-8/g' /etc/locale.gen
|
2019-02-23 07:32:24 -06:00
|
|
|
sed -i 's/# zh_CN.UTF-8 UTF-8/zh_CN.UTF-8 UTF-8/g' /etc/locale.gen
|
2019-03-17 03:17:07 -05:00
|
|
|
sed -i 's/# nb_NO.UTF-8 UTF-8/nb_NO.UTF-8 UTF-8/g' /etc/locale.gen
|
2019-03-22 12:29:34 -05:00
|
|
|
sed -i 's/# ro_RO.UTF-8 UTF-8/ro_RO.UTF-8 UTF-8/g' /etc/locale.gen
|
2019-08-09 11:06:16 -05:00
|
|
|
sed -i 's/# cs_CZ.UTF-8 UTF-8/cs_CZ.UTF-8 UTF-8/g' /etc/locale.gen
|
|
|
|
sed -i 's/# id_ID.UTF-8 UTF-8/id_ID.UTF-8 UTF-8/g' /etc/locale.gen
|
|
|
|
sed -i 's/# hu_HU.UTF-8 UTF-8/hu_HU.UTF-8 UTF-8/g' /etc/locale.gen
|
2019-09-06 23:23:26 -05:00
|
|
|
sed -i 's/# el_GR.UTF-8 UTF-8/el_GR.UTF-8 UTF-8/g' /etc/locale.gen
|
2018-04-01 23:56:19 -05:00
|
|
|
|
2017-10-29 10:05:22 -05:00
|
|
|
dpkg-reconfigure --frontend=noninteractive locales
|
|
|
|
|
2017-02-03 20:04:55 -06:00
|
|
|
# actually add repository
|
|
|
|
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E9C74FEEA2098A6E
|
|
|
|
add-apt-repository "deb http://packages.dotdeb.org jessie all"
|
|
|
|
|
2017-10-20 07:21:47 -05:00
|
|
|
# add another repos
|
2018-07-24 12:14:35 -05:00
|
|
|
apt-get install -y apt-transport-https lsb-release ca-certificates
|
2017-10-20 07:21:47 -05:00
|
|
|
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
|
|
|
|
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list
|
|
|
|
|
2017-02-03 20:04:55 -06:00
|
|
|
# install packages.
|
2018-09-27 10:28:23 -05:00
|
|
|
apt-get update
|
2018-12-23 12:21:54 -06:00
|
|
|
apt-get install -y nginx php7.2-fpm php7.2-mysql php7.2-gd php7.2-cli php7.2-curl php7.2-ldap git php7.2-dev php7.2-zip php7.2-intl php7.2-dom php7.2-mbstring php7.2-bcmath mysql-server
|
2017-02-03 20:04:55 -06:00
|
|
|
service nginx stop
|
2018-09-27 09:33:08 -05:00
|
|
|
service php7.2-fpm stop
|
2017-02-03 20:04:55 -06:00
|
|
|
service mysql stop
|
|
|
|
systemctl disable nginx
|
2018-09-27 09:33:08 -05:00
|
|
|
systemctl disable php7.2-fpm
|
2017-02-03 20:04:55 -06:00
|
|
|
systemctl disable mysql
|
2017-10-29 14:02:34 -05:00
|
|
|
|
|
|
|
# make php.ini display errors:
|
2018-09-27 09:33:08 -05:00
|
|
|
sed -i 's/display_errors = Off/display_errors = On/g' /etc/php/7.2/fpm/php.ini
|
2017-10-29 14:02:34 -05:00
|
|
|
|
2018-09-27 09:33:08 -05:00
|
|
|
# patch /etc/php/7.2/fpm/pool.d/www.conf to not change uid/gid to www-data
|
2017-02-03 20:04:55 -06:00
|
|
|
sed --in-place='' \
|
|
|
|
--expression='s/^listen.owner = www-data/;listen.owner = www-data/' \
|
|
|
|
--expression='s/^listen.group = www-data/;listen.group = www-data/' \
|
2018-09-27 09:33:08 -05:00
|
|
|
/etc/php/7.2/fpm/pool.d/www.conf
|
|
|
|
# patch /etc/php/7.2/fpm/php-fpm.conf to not have a pidfile
|
2017-02-03 20:04:55 -06:00
|
|
|
sed --in-place='' \
|
|
|
|
--expression='s/^pid =/;pid =/' \
|
2018-09-27 09:33:08 -05:00
|
|
|
/etc/php/7.2/fpm/php-fpm.conf
|
2017-02-03 20:04:55 -06:00
|
|
|
|
|
|
|
# move sock file to better dir:
|
|
|
|
sed --in-place='' \
|
2018-09-27 09:33:08 -05:00
|
|
|
--expression='s/^listen = \/run\/php\/php7.2-fpm.sock/listen = \/var\/run\/php7.2-fpm.sock/' \
|
|
|
|
/etc/php/7.2/fpm/pool.d/www.conf
|
2017-02-03 20:04:55 -06:00
|
|
|
|
2018-09-27 09:33:08 -05:00
|
|
|
# patch /etc/php/7.2/fpm/pool.d/www.conf to no clear environment variables
|
2017-02-03 20:04:55 -06:00
|
|
|
# so we can pass in SANDSTORM=1 to apps
|
|
|
|
sed --in-place='' \
|
|
|
|
--expression='s/^;clear_env = no/clear_env=no/' \
|
2018-09-27 09:33:08 -05:00
|
|
|
/etc/php/7.2/fpm/pool.d/www.conf
|
2017-02-03 20:04:55 -06:00
|
|
|
# patch mysql conf to not change uid, and to use /var/tmp over /tmp
|
|
|
|
# for secure-file-priv see https://github.com/sandstorm-io/vagrant-spk/issues/195
|
|
|
|
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 = ""\' \
|
|
|
|
/etc/mysql/my.cnf
|
|
|
|
# patch mysql conf to use smaller transaction logs to save disk space
|
|
|
|
cat <<EOF > /etc/mysql/conf.d/sandstorm.cnf
|
|
|
|
[mysqld]
|
|
|
|
# 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
|
|
|
|
EOF
|
2017-10-29 14:02:34 -05:00
|
|
|
|
|
|
|
|