Skip to content

Instantly share code, notes, and snippets.

@nelson6e65
Created April 7, 2017 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nelson6e65/b68182a4d36a672669e0ba5bf39149d0 to your computer and use it in GitHub Desktop.
Save nelson6e65/b68182a4d36a672669e0ba5bf39149d0 to your computer and use it in GitHub Desktop.
Actualizar configuración y caché de Laravel después de actualizar con `git pull`
#!/usr/bin/env bash
# -*- ENCODING: UTF-8 -*-
#
# Copyright © 2017 Nelson Martell (http://nelson6e65.github.io)
#
# Licensed under The MIT License (MIT)
#
# For full copyright and license information, please see the LICENSE
# Redistributions of files must retain the above copyright notice.
#
# Deployment script for app.
# Para después de hacer git pull
declare CURRENT_DIR=
declare ROOT_DIR=
declare SERVER_USER=${1:-'www-data'} #Ubuntu
CURRENT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
ROOT_DIR=$( dirname "${CURRENT_DIR}")
cd "${ROOT_DIR}"
# Corregir permisos iniciales
sudo chown "${USER}" "bower_components/" -R
sudo chown "${USER}" "node_modules/" -R
sudo chown "${USER}:${SERVER_USER}" "public/" -R
sudo chown "${USER}:${SERVER_USER}" "vendor/" -R
sudo chown "${USER}:${SERVER_USER}" "bootstrap/cache" -R
sudo chown "${USER}:${SERVER_USER}" "storage/" -R
sudo chmod 775 "storage/" -R
sudo chmod 775 "bootstrap/cache" -R
php artisan down
composer install --optimize-autoloader
composer dump-autoload --optimize
php artisan cache:clear
php artisan config:cache
php artisan route:cache
php artisan migrate
bower update && gulp
php artisan up
# Volver a los permisos del SERVER_USER
sudo chown "${SERVER_USER}:${USER}" "public/" -R
sudo chown "${SERVER_USER}:${USER}" "vendor/" -R
sudo chown "${SERVER_USER}:${USER}" "bootstrap/cache" -R
sudo chown "${SERVER_USER}:${USER}" "storage/" -R
unset CURRENT_DIR
unset ROOT_DIR
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment