CureNet/docker/startup.sh

58 lines
1.8 KiB
Bash

#!/bin/bash
#echo "> Configure cache"
# mkdir -p /tmp/app/vendor
# ln -s /tmp/app/vendor /web/backend/vendor
echo "> Configure user"
useradd developer
chown developer:developer /web/frontend -R
chown developer:developer /web/backend -R
echo "> Configure logs"
mkdir -p /var/log/{apache2,nginx,pgadmin,postgresql}
chown postgres:adm /var/log/postgresql -R
chown root:postgres /var/log/postgresql
#echo "> Configure volumes"
# [ -e /web/frontend/node_modules ] || ln -s /web/node /web/frontend/node_modules
# [ -e /web/backend/var ] || ln -s /web/var /web/backend/var
# [ -e /web/backend/vendor ] || ln -s /web/vendor /web/backend/vendor
echo "> Starting php8.0-fpm server"
[ -e /etc/php/8.0/fpm/conf.d/20-xdebug.ini ] && rm /etc/php/8.0/fpm/conf.d/20-xdebug.ini || echo OK
[ -e /etc/php/8.0/cli/conf.d/20-xdebug.ini ] && rm /etc/php/8.0/cli/conf.d/20-xdebug.ini || echo OK
cp /web/config/php8.0/xdebug-fpm.ini /etc/php/8.0/fpm/conf.d/20-xdebug.ini
cp /web/config/php8.0/xdebug-cli.ini /etc/php/8.0/cli/conf.d/20-xdebug.ini
service php8.0-fpm start
echo "> Starting nginx server"
service nginx start
echo "> Starting apache2 server for pgAdmin4"
service apache2 start
echo "> Starting postgresql database"
service postgresql start
echo "> Starting ssh server"
service ssh start
echo "> Configure database"
su postgres -c psql postgres < /web/config/postgres/init-data.sql
echo "> Configure symfony"
cd /web/backend
composer install
php bin/console doctrine:schema:update --force
php php bin/console lexik:jwt:generate-keypair --skip-if-exists
echo "> Configure angular"
cd /web/frontend
time su developer -c 'npm ci'
echo "> Starting angular"
su developer -c 'ng serve --disable-host-check --host 0.0.0.0 --poll'
echo "> Waiting"
sleep Infinity