Skip to content

Instantly share code, notes, and snippets.

@sourovroy
Created May 7, 2020 11:59
Show Gist options
  • Save sourovroy/3d34e69b051853b22feefedfea82750e to your computer and use it in GitHub Desktop.
Save sourovroy/3d34e69b051853b22feefedfea82750e to your computer and use it in GitHub Desktop.
Ubuntu webhook and Supervisor setup
[
{
"id": "laravel-deploy",
"execute-command": "/home/sourov/hooks/laravel-deploy.sh",
"command-working-directory": "/home/sourov/sites/github-actions",
"trigger-rule": {
"match": {
"type": "value",
"value": "development",
"parameter": {
"source": "payload",
"name": "ref"
}
}
},
"include-command-output-in-response": true,
"include-command-output-in-response-on-error": true
}
]
#!/bin/bash
set -e
export COMPOSER_HOME="/home/sourov/.composer";
cd /home/sourov/sites/github-actions
echo ""
echo -e "\e[1m** Pull master branch of git repository\e[0m"
git pull origin master
echo ""
echo -e "\e[1m** Install composer packages\e[0m"
composer install --no-dev --no-interaction 2>&1
echo ""
echo -e "\e[1m** Run migration\e[0m"
php artisan migrate 2>&1
echo ""
echo -e "\e[1m** Clear cache\e[0m"
php artisan optimize 2>&1
php artisan view:clear 2>&1
echo ""
echo -e "\e[1m***** Deploy finished successfuly *****\e[0m"
[program:webhook]
command=/usr/bin/webhook -hooks /home/sourov/hooks/script.json -port 8081 -verbose -hotreload
process_name=%(program_name)s
autostart=true
autorestart=true
user=sourov
stdout_logfile=/home/sourov/hooks/logs/stdout.log
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=5
stdout_capture_maxbytes=1MB
stdout_events_enabled=false
stderr_logfile=/home/sourov/hooks/logs/stderr.log
stderr_logfile_maxbytes=1MB
stderr_logfile_backups=5
stderr_capture_maxbytes=1MB
stderr_events_enabled=false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment