Skip to content

Instantly share code, notes, and snippets.

@artemrogov
Created February 8, 2018 09:42
Show Gist options
  • Save artemrogov/4656df83bed964b1f234298c10adfb91 to your computer and use it in GitHub Desktop.
Save artemrogov/4656df83bed964b1f234298c10adfb91 to your computer and use it in GitHub Desktop.
таск менеджер для деплоя проекта на фреймворке ларавел
@setup
// user on web-server
$user = 'ci90599';
$timezone = 'Europe/Moscow';
// path to the directory on web-server
$path = '/home/c/ci90599';
$current = $path . '/current';
// where take your code (git repository)
$repo = "https://[email protected]/chine_shop/promo_chian.git";
$branch = 'master';
// Directory and files with chmod 775
$chmods = [
'storage/logs'
];
$date = new DateTime('now', new DateTimeZone($timezone));
$release = $path .'/releases/'. $date->format('YmdHis');
@endsetup
@servers(['production' => $user . '@vh16.timeweb.ru'])
@task('clone', ['on' => $on])
mkdir -p {{ $release }}
git clone --depth 1 -b {{ $branch }} "{{ $repo }}" {{ $release }}
echo "#1 - Repository has been cloned"
@endtask
{{-- Runs a fresh installation --}}
@task('composer', ['on' => $on])
composer self-update
cd {{ $release }}
composer install --no-interaction --no-dev --prefer-dist
echo "#2 - Composer dependencies have been installed"
@endtask
{{-- Updates composer, then runs a fresh installation --}}
@task('artisan', ['on' => $on])
cd {{ $release }}
ln -nfs {{ $path }}/.env .env;
chgrp -h www-data .env;
php artisan config:clear
php artisan migrate
php artisan clear-compiled --env=production;
php artisan optimize --env=production;
echo "#3 - Production dependencies have been installed"
@endtask
{{-- Set permissions for various files and directories --}}
{{-- Run all deployment tasks --}}
@macro('deploy', ['on' => 'production'])
clone
composer
artisan
chmod
update_symlinks
@endmacro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment