CureNet/docker/startup.sh

46 lines
1.4 KiB
Bash

#!/bin/bash
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
echo "> Configure angular"
cd /web/frontend
npm ci
echo "> Starting angular"
ng serve --disable-host-check --host 0.0.0.0 --poll