Docker-Swarm-Loadbalancer/php/nginx/php-fpm.runit
Matthew Baggett 6db6395f66
Trunk linter ()
* linting is fun

* mis-detection of missing healthcheck staements.

* typo

* disable tagging vanity tags on non-main branch

* Unbugger node build?

* Add gitleaks detector, remove an expired secret.

* More linting-derived cleanup

* Fiddle with trivy

* Fiddle with trivy

* add a readme

* Fix build bug with php flavours

* Marshall should build other flavours of ubuntu.

* Fiddle with act cache location.

* Add concurrency checks

* Composer version gubbins for 7.0/7.1

* ubuntu is just a label, and injected over the top of.

* Composer version gubbins for 7.0/7.1

* Run when workflow is altered too please.

* Hopefully fix composer stage.

* setup tooling meta-tooling.

* Add trunk

* Disable mirror mode, its being problematic, and increase retries to 5.

* Revisit how ghcr login works.

* Add trunk checks.

* All hail the linter

* Heavilly revise workflow

* Fettling

* Fettling

* Fettling

* Fettling

* Fettling

* Cleanup

* Cleanup

* Fettling.. Why does mitm build but not redis?

* Fettling.. Why does mitm build but not redis?

* Debuggin

* Fettling.

* Fix build?

* Permissions are a pain

* Switch around some should_push logic because envs aren't available that early.

* Permissionssssss

* Trivy, bane of my life

* Fix merge?

* Fix labels

* Help node along, among other things

* Redis 6.1 & 7.1 aren't a thing any more.

* Ffff USER nonsense

* latest-openssl doesn't exist.

* fixup mysqlproxy.

* Fix labels

* uurrgh

* uurrgh

* Didn't need to add the mitmproxy user, it exists

* Missing ghcr login

* Missing backtick

* Fix build?

* Add validate build step to bouncer.

* Fix bouncer build

* Disable laravel build

* Missing env

* Fix swarm mon build

* Scout just doesn't seem to work.
2024-02-07 16:21:14 +01:00

38 lines
1.8 KiB
Bash
Executable file

#!/usr/bin/env bash
# Load envs into PHP-fpm's env.conf.
# shellcheck disable=SC1083,SC2312
env | sed "s/\(.*\)=\(.*\)/env[\1]='\2'/" >/etc/php/{{PHP}}/fpm/conf.d/env.conf
if [[ ${DEBUG_MODE,,} == "on" ]]; then
ENABLE_DEBUG_MODE=true
PHP_MEMORY_LIMIT="${PHP_MEMORY_LIMIT:-1024M}"
else
ENABLE_DEBUG_MODE=false
PHP_MEMORY_LIMIT="${PHP_MEMORY_LIMIT:-128M}"
fi
PHP_CLI_MEMORY_LIMIT="${PHP_CLI_MEMORY_LIMIT:-${PHP_MEMORY_LIMIT}}"
sed -i "s|memory_limit = .*|memory_limit = ${PHP_MEMORY_LIMIT}|g" /etc/php/{{PHP}}/fpm/php.ini
sed -i "s|\[memory_limit\] = .*|\[memory_limit\] = ${PHP_MEMORY_LIMIT}|g" /etc/php/{{PHP}}/fpm/pool.d/www.conf
sed -i "s|memory_limit = .*|memory_limit = ${PHP_CLI_MEMORY_LIMIT}|g" /etc/php/{{PHP}}/cli/php.ini
if [[ ${ENABLE_DEBUG_MODE} == true ]]; then
echo -e "#Controlled via DEBUG_MODE environment variable\nzend_extension=xdebug.so\n[xdebug]\n\
xdebug.mode=debug\n\
xdebug.discover_client_host=true\n\
xdebug.client_host=host.docker.internal\n" >/etc/php/{{PHP}}/mods-available/xdebug.ini
ln -s /etc/php/{{PHP}}/mods-available/xdebug.ini /etc/php/{{PHP}}/fpm/conf.d/20-xdebug.ini || true
sed -i "s|php_flag\[display_errors\].*|php_flag\[display_errors\] = on|g" /etc/php/{{PHP}}/fpm/pool.d/www.conf
echo -e "PHP is running in \e[31mDEBUG MODE\e[0m\nError output will be VISIBLE."
else
rm -f /etc/php/{{PHP}}/mods-available/xdebug.ini /etc/php/{{PHP}}/fpm/conf.d/*-xdebug.ini
touch /etc/php/{{PHP}}/mods-available/xdebug.ini
sed -i "s|php_flag\[display_errors\].*|php_flag\[display_errors\] = off|g" /etc/php/{{PHP}}/fpm/pool.d/www.conf
echo -e "PHP is running in \e[32mPRODUCTION MODE\e[0m\nError output will be suppressed."
fi
echo "To change this, change the value of DEBUG_MODE to either 'on' or 'off'"
# shellcheck disable=SC2288
/usr/sbin/php-fpm{{PHP}} -F -R