2023-09-16 19:36:42 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2023-09-26 21:39:49 +02:00
|
|
|
if [ -z "$USER_UID" ] or [ -z "$USER_GID" ]; then
|
|
|
|
echo "USER_UID and USER_GID should be set"
|
|
|
|
exit 1
|
|
|
|
fi
|
2023-09-16 19:36:42 +02:00
|
|
|
|
|
|
|
echo "Installing Composer packages..."
|
|
|
|
if [ -f .env ]; then
|
|
|
|
composer install
|
|
|
|
else
|
|
|
|
composer create-project
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Installing NPM packages..."
|
|
|
|
(cd multi && npm install)
|
|
|
|
|
|
|
|
echo "Installing Yarn packages..."
|
|
|
|
(cd public/static && yarn install)
|
|
|
|
|
|
|
|
echo "Migrating DB..."
|
|
|
|
./mapg db:migrate
|
|
|
|
|
2023-09-26 21:39:49 +02:00
|
|
|
echo "Set runner user..."
|
|
|
|
groupadd --gid $USER_GID mapg
|
|
|
|
useradd --uid $USER_UID --gid $USER_GID mapg
|
|
|
|
sed -i -e "s/^user = .*$/user = mapg/g" -e "s/^group = .*$/group = mapg/g" /etc/php/7.4/fpm/pool.d/www.conf
|
|
|
|
|
2023-09-16 19:36:42 +02:00
|
|
|
set +e
|
|
|
|
|
|
|
|
/usr/sbin/php-fpm7.4 -F &
|
|
|
|
/usr/sbin/nginx -g 'daemon off;' &
|
2023-09-26 21:39:49 +02:00
|
|
|
sudo -u mapg -g mapg /usr/bin/node --inspect=0.0.0.0:9229 multi &
|
2023-09-16 19:36:42 +02:00
|
|
|
|
|
|
|
wait -n
|
|
|
|
|
|
|
|
exit $?
|