mstdmstd
Новичок
Всем привет,
Получаю ошибку при запуске envoy скрипта
1) [[email protected]]: chmod: cannot read directory '/var/www/html/VotesDeployed/release/20190330182151': Permission denied
при установке chmod на созданный подкаталог
Погулив я нашел как пользователю предоставить права root-а
или
и непомагает. Систему (ubuntu18) перзапускал
А как правильно ?
2) Я нагуглил то из консоли можно передать переменную в скрипт
и в блоке @setup ее получить :
но переменная была пуста и не равна дефолтовому значению
3) При запуске каждого таска мне приходилось вводить пароль для lardeployer. Как сделать чтобы пароль вводить только один раз ?
Envoy.blade.php :
Спасибо !
Получаю ошибку при запуске envoy скрипта
Код:
envoy run VotesDeploy --lardeployer_password=mypass1112233
при установке chmod на созданный подкаталог
Погулив я нашел как пользователю предоставить права root-а
Код:
sudo usermod -a -G sudo lardeployer
Код:
visudo
lardeployer ALL=(ALL:ALL) ALL
А как правильно ?
2) Я нагуглил то из консоли можно передать переменную в скрипт
Код:
envoy run VotesDeploy --lardeployer_password=mypass1112233
Код:
$user_password = isset($lardeployer_password) ? $lardeployer_password : "Not Defined";
3) При запуске каждого таска мне приходилось вводить пароль для lardeployer. Как сделать чтобы пароль вводить только один раз ?
Envoy.blade.php :
Код:
@setup
$server_login_user= 'lardeployer';
$user_password = isset($lardeployer_password) ? $lardeployer_password : "Not Defined";
$timezone= 'Europe/Kiev';
$path= '/var/www/html/VotesDeployed';
$current = $path . '/current';
$repo= '[email protected]:myaccount/votes.git';
$branch= 'master';
// Directory and files with chmod 755
$writableDirs= [
'storage/logs',
'bootstrap/cache'
];
$now_date = new DateTime('now', new DateTimeZone($timezone));
$release_number = $path . '/release/' . $now_date->format('YmdHis');
$git_clone_command = 'git clone --depth 1 -b '.$branch.' "'.$repo.'" '.' "'.$release_number.'"';
$database_factories_path= $release_number.'/database/factories';
@endsetup
@servers(['production' => $server_login_user.'@NNN.NN.NNN.NN'])
@task( 'clone_project', ['on'=>$on] )
echo '$user_password password ::';
echo $user_password;
{{--echo ( isset(lardeployer_password) ? lardeployer_password : "Not Defined" );--}}
echo '$release_number :: {{ $release_number }}';
echo '$database_factories_path :: {{ $database_factories_path }}';
echo '$git_clone_command {{ $git_clone_command }}::';
mkdir -p {{$release_number}}
{{ $git_clone_command }}
mkdir -p {{$database_factories_path}}
echo "Step # 1 : Repository has been cloned";
@endtask
@task( 'composer_installing', ['on'=>$on] )
cd {{ $release_number }}
echo "Step # 2 start : composer_installing dependencies installing";
composer install --no-interaction --no-dev --prefer-dist
echo "Step # 2 : composer_installing dependencies has been installed";
@endtask
@task( 'artisan_running', ['on'=>$on] )
echo "Step # 3 : Production dependencies installing";
cd {{ $release_number }}
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 "Step # 3 : Production dependencies has been installed";
@endtask
@task( 'chmod_settings', ['on'=>$on] )
echo "Step # 4 : chmod_settings = Permissions setting";
chgrp -R www-data {{ $release_number }}
echo "Step # 40 $release_number :: {{ $release_number }}";
chmod -R ug-rwx {{ $release_number }}
echo "Step # 4 : chmod_settings = Permissions setting";
@foreach($writableDirs as $file)
echo "Step # 41";
chmod -R 775 {{ $release_number }}/{{ $file }}
chown -R {{ $server_login_user }}:www-data {{ $release_number }}/{{ $file }}
echo "Permissions has been for file {{ $file }}";
@endforeach
echo "Step # 4 : chmod_settings = Permissions has been set";
@endtask
@task( 'update_symlinks' )
echo "Step # 5 : Symlink set";
ln -nfs {{ $release_number }} {{ $current }};
echo "Step # 50";
chgrp -h www-data {{ $current }};
echo "Step # 5 : Symlink has been set";
@endtask
@macro('VotesDeploy',['on'=>'production'])
clone_project
composer_installing
artisan_running
chmod_settings
update_symlinks
@endmacro