STAGE=${1:-developers}

shopt -s nocasematch

echo "Deploying";
USER="root"
PASSWORD="%D5B3xjV&5"
# SERVER="51.77.158.134" # serveur dev
SERVER="51.91.99.241" #serveur prod
PROJECT_PATH="/var/www/pipcke.fr"

ssh -tt -C ${USER}:${PASSWORD}@${SERVER} -p 2221 \
    "mkdir -p ${PROJECT_PATH}  \
    && cd ${PROJECT_PATH} \
    && git reset --hard origin/master \
    && git pull origin master \
    && composer install \
    && composer dumpautoload \
    && chmod -R ug+rwx public  \
    && chgrp -R www-data storage bootstrap/cache \
    && chmod -R ug+rwx storage bootstrap/cache \
    && chgrp -R www-data storage bootstrap/cache \
    && php artisan optimize:clear \
    && df -h \
    && exit";
 


    # && php artisan migrate:fresh --seed \

    # && chmod -R 777 storage/* \
    # && chmod -R ug+rwx public  \
    # && chgrp -R www-data storage bootstrap/cache \
    # && chmod -R ug+rwx storage bootstrap/cache \
    # && chgrp -R www-data storage bootstrap/cache \






# adduser blog --shell /bin/false --home /var/www/pipcke.fr/public/idee-deco
# Blog**2020 ou blog**2020


