|
|
@ -2,6 +2,7 @@ |
|
|
|
|
|
|
|
|
# CONSTANTS |
|
|
# CONSTANTS |
|
|
|
|
|
|
|
|
|
|
|
MANDATORY_PACKAGES=(nginx php-cli php-fpm php-mysql php-curl php-xml php-imagick php-zip php-gd php-intl composer mariadb-client) |
|
|
UPLOAD_MAX_SIZE=${UPLOAD_MAX_SIZE-256M} #TODO: allow passing environment variables from `miaou-recipe` |
|
|
UPLOAD_MAX_SIZE=${UPLOAD_MAX_SIZE-256M} #TODO: allow passing environment variables from `miaou-recipe` |
|
|
FORCE=false |
|
|
FORCE=false |
|
|
WP_NAME= |
|
|
WP_NAME= |
|
|
@ -49,13 +50,11 @@ function install_mariadb { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function install_php { |
|
|
function install_php { |
|
|
local php_version=php --version | head -n1 | cut -d' ' -f2 | grep -o '^[[:digit:]]*\.[[:digit:]]*' |
|
|
|
|
|
|
|
|
local php_version=$(php --version | head -n1 | cut -d' ' -f2 | grep -o '^[[:digit:]]*\.[[:digit:]]*') |
|
|
local php_service="php$php_version-fpm" |
|
|
local php_service="php$php_version-fpm" |
|
|
|
|
|
|
|
|
if $FORCE || ! systemctl is-active "$php_service" --quiet; then |
|
|
if $FORCE || ! systemctl is-active "$php_service" --quiet; then |
|
|
apt-get install -y php-fpm php-mysql php-curl php-dom php-imagick php-mbstring php-zip php-gd php-intl |
|
|
apt-get install -y php-fpm php-mysql php-curl php-dom php-imagick php-mbstring php-zip php-gd php-intl |
|
|
php_version=php --version | head -n1 | cut -d' ' -f2 | grep -o '^[[:digit:]]*\.[[:digit:]]*' |
|
|
|
|
|
|
|
|
|
|
|
sed -i "s/^post_max_size = 8M/post_max_size = $UPLOAD_MAX_SIZE/g" /etc/php/$php_version/fpm/php.ini |
|
|
sed -i "s/^post_max_size = 8M/post_max_size = $UPLOAD_MAX_SIZE/g" /etc/php/$php_version/fpm/php.ini |
|
|
sed -i "s/^upload_max_filesize = 2M/upload_max_filesize = $UPLOAD_MAX_SIZE/g" /etc/php/$php_version/fpm/php.ini |
|
|
sed -i "s/^upload_max_filesize = 2M/upload_max_filesize = $UPLOAD_MAX_SIZE/g" /etc/php/$php_version/fpm/php.ini |
|
|
systemctl enable "$php_service" --now |
|
|
systemctl enable "$php_service" --now |
|
|
@ -66,8 +65,10 @@ function install_php { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function install_nginx_host { |
|
|
function install_nginx_host { |
|
|
if $FORCE || [[ ! -f /etc/nginx/sites-available/sympa.conf ]]; then |
|
|
|
|
|
cat << EOF > /etc/nginx/sites-available/sympa.conf |
|
|
|
|
|
|
|
|
local wp_conf="wp-${WP_NAME}.conf" |
|
|
|
|
|
local conf_file="/etc/nginx/sites-available/${wp_conf}" |
|
|
|
|
|
if $FORCE || [[ ! -f ${conf_file} ]]; then |
|
|
|
|
|
cat <<EOF >$conf_file |
|
|
|
|
|
|
|
|
server { |
|
|
server { |
|
|
listen {{ env.APP_PORT }} default_server; |
|
|
listen {{ env.APP_PORT }} default_server; |
|
|
@ -116,13 +117,15 @@ EOF |
|
|
fi |
|
|
fi |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function install_wordpress { |
|
|
|
|
|
apt-get install -qqy "${MANDATORY_PACKAGES[@]}" |
|
|
|
|
|
echo mandatory OK |
|
|
|
|
|
} |
|
|
# MAIN |
|
|
# MAIN |
|
|
|
|
|
|
|
|
set -Eue -o pipefail |
|
|
set -Eue -o pipefail |
|
|
parse_options "$@" |
|
|
parse_options "$@" |
|
|
exit 0 |
|
|
|
|
|
|
|
|
|
|
|
install_mariadb |
|
|
install_mariadb |
|
|
install_php |
|
|
install_php |
|
|
# install_wordpress |
|
|
|
|
|
# install_nginx_host |
|
|
|
|
|
|
|
|
install_wordpress |
|
|
|
|
|
install_nginx_host |