CureNet/docker/startup.sh

56 lines
1.8 KiB
Bash
Raw Normal View History

#!/bin/bash
2021-07-26 14:43:18 +00:00
echo "> Configure cache"
2021-07-27 11:45:22 +00:00
mkdir -p /tmp/app/{vendor,node_modules}
2021-07-26 14:43:18 +00:00
ln -s /tmp/app/node_modules /web/frontend/node_modules
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
echo "> Configure angular"
cd /web/frontend
2021-07-26 14:43:18 +00:00
su developer -c 'time npm ci'
echo "> Starting angular"
2021-07-26 14:43:18 +00:00
su developer -c 'ng serve --disable-host-check --host 0.0.0.0 --poll'