scripts up and install

This commit is contained in:
Baptiste Lemoine 2018-08-29 11:08:05 +02:00
parent 45caf62d4a
commit 3501cf503f
2 changed files with 71 additions and 21 deletions

View File

@ -1,37 +1,85 @@
#!/bin/bash #!/bin/bash
echo "################################"; echo "################################";
echo "start INSTALL of symfony project"; echo "start UPDATE of symfony project";
echo "################################"; echo "################################";
echo "checking requirements"; echo " ";
echo "####### fix file permissions ######";
sudo apt install acl -y `which setfacl` > TEST
echo "fix file permissions"; if [ echo $TEST == 'acl not found' ]; then
echo "acl is not installed"
sudo apt install acl -y
exit
else
echo "acl est bien là"
acl -v
fi
HTTPDUSER=$(ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1) HTTPDUSER=$(ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1)
sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:$(whoami):rwX var sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:$(whoami):rwX var
sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:$(whoami):rwX var sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:$(whoami):rwX var
sudo npm i -g yarn echo "####### phpunit test suite ######";
`which phpunit` > TEST
if [ echo $TEST == 'phpunit not found' ]; then
echo "phpunit is not installed"
sudo apt install phpunit -y
exit
else
echo "phpunit est bien là"
phpunit -v
fi
composer --version echo "####### node packages ######";
yarn --version `which npm` > TEST
acl --varsion if [ echo $TEST == 'npm not found' ]; then
echo "npm is not installed"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" sudo apt install npm -y
php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" exit
php composer-setup.php else
php -r "unlink('composer-setup.php');" echo "npm est bien là"
npm -v
fi
echo "installing symfony project for ubuntu environnement"; `which yarn` > TEST
composer install && yarn install; if [ echo $TEST == 'yarn not found' ]; then
yarn run encore dev echo "yarn is not installed"
sudo npm i -g yarn
exit
else
echo "yarn est bien là"
yarn -v
echo "update database"; echo "####### build front end with yarn ######";
yarn
yarn run encore production
fi
echo "####### symfony vendor packages ######";
`which composer` > TEST
if [ echo $TEST == 'composer not found' ]; then
echo "composer is not installed"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
exit
else
echo "composer est bien là"
composer -v
composer self-update
composer update
fi
echo "####### symfony database ######";
php bin/console doctrine:schema:update --dump-sql php bin/console doctrine:schema:update --dump-sql
php bin/console doctrine:schema:update --force php bin/console doctrine:schema:update --force
php bin/console cache:clear -eprod
php bin/console cache:warmup -eprod
echo "################################"; echo "################################";
echo "end INSTALL of symfony project"; echo "end UPDATE of symfony project";
echo "################################"; echo "################################";

View File

@ -4,6 +4,8 @@ echo "start update of symfony project";
echo "###############################"; echo "###############################";
git pull origin master --strategy-option theirs git pull origin master --strategy-option theirs
composer --version composer --version
composer self-update
composer update
yarn --version yarn --version
yarn run encore production yarn run encore production