Created
January 30, 2018 18:55
-
-
Save mr4torr/b9a6011c4c81a6a00c61cfffd800f484 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Entrar no servidor e fora da pasta do projeto | |
$ cd /home/webmaster/ | |
$ mkdir repository && cd repository | |
$ mkdir site.git && cd site.git | |
$ git init --bare | |
$ cd hooks | |
$ vim post-receive | |
## Adicionar no arquivo | |
``` | |
#!/bin/sh | |
git --work-tree=/home/webmaster/project --git-dir=/home/webmaster/repository/site.git checkout -f | |
``` | |
$ chmod +x post-receive | |
> /home/webmaster/site = pasta aonde esta o projeto | |
> /home/webmaster/repository/site.git = pasta aonde ficara o hook do git | |
$ vim post-update | |
## Adicionar no arquivo | |
``` | |
#!/bin/sh | |
# | |
# An example hook script to prepare a packed repository for use over | |
# dumb transports. | |
# | |
# To enable this hook, rename this file to "post-update". | |
echo '####################### START ################################' | |
echo "--> Access Directory" | |
cd /home/manager/project | |
#echo "--> Load Composer" | |
#/usr/local/bin/composer install --no-scripts --no-dev --no-interaction --prefer-dist | |
echo "--> Autoloader Optimization" | |
/usr/local/bin/composer install --optimize-autoloader | |
echo "--> Migration" | |
/usr/bin/php artisan migrate --force | |
echo "--> Optimizing Configuration via Artisan" | |
/usr/bin/php artisan optimize | |
echo "--> Optimizing Configuration Loading" | |
/usr/bin/php artisan config:cache | |
echo "--> Optimizing Route Loading" | |
/usr/bin/php artisan route:cache | |
echo '####################### END ################################' | |
exec git update-server-info | |
``` | |
$ chmod +x post-update | |
# no servidor local | |
git remote add production ssh://[email protected]/home/repo/site.git | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment