@setup //user on ver server $user = 'root'; $timezone = 'Europe/Kiev'; //path to the directory on server $path = '/var/www/html/pravdatut.com'; $repo = "git@bitbucket.org:AlexBackYQ/pravdatut.com.git"; $current = $path . '/current'; $branch = 'master'; $date = new DateTime('now', new DateTimeZone($timezone)); $release = $path . '/releases/' . $date->format('YmdHis'); @endsetup @servers(['staging' => $user . '@194.58.92.193']) @task('clone', ['on' => $on]) mkdir -p {{ $release }} git clone --depth 1 -b {{ $branch }} "{{ $repo }}" {{ $release }} echo "#1 - Repository has been cloned" @endtask @task('composer', ['on' => $on]) cd {{ $release }} composer install --no-interaction --prefer-dist echo "#2 - Composer dependevices have been installed" @endtask @task('artisan', ['on' => $on]) cd {{ $release }} ln -nfs {{ $path }}/.env .env; ln -nfs {{ $path }}/uploads public/uploads; php artisan config:clear php artisan migrate php artisan clear-compiled {{--php artisan optimize--}} echo "#3 - Staging dependencies have been installed" @endtask @task('chmod', ['on' => $on]) chmod -R 777 {{ $release }}/storage chmod -R 777 {{ $release }}/bootstrap chmod -R 777 {{ $release }}/public/img @endtask @task('update_symlinks') ln -nfs {{ $release }} {{ $current }}; {{--chgrp -h www-data {{$current}};--}} echo "#5 - Symlink has been set" @endtask @macro('deploy', ['on' => 'staging']) clone composer artisan chmod update_symlinks @endmacro @endtask