I Want to deploy my laravel project through ci/cd gitlab, I have a problem with deploying my project. i am trying to deploy my laravel project to cpanel through gitlab CI. I am using deployer package in this project but when i push my commit to gitlab and pipeline got failed.
I got this error when I push my commit to gitlab and got this error in my pipeline error image
here is my deploy.php code
<?php
declare(strict_types=1);
return [
'default' => 'basic',
'strategies' => [
],
'hooks' => [
'start' => [
],
'build' => [
],
'ready' => [
'artisan:storage:link',
'artisan:view:clear',
'artisan:config:cache',
'artisan:migrate',
'artisan:horizon:terminate',
],
'done' => [
'fpm:reload',
],
'success' => [
],
'fail' => [
],
'rollback' => [
'fpm:reload',
],
],
'options' => [
'application' => env('APP_NAME', 'Laravel'),
'repository' => 'git@gitlab.com/mygroup/project.git',
'php_fpm_service' => 'php7.4-fpm',
],
'hosts' => [
'mywebsite.com' => [
'deploy_path' => '/home/sfd/public_html/nas',
'user' => 'deployer',
],
],
'localhost' => [
],
'include' => [
],
'custom_deployer_file' => false,
];
this is my gitlab-ci.yml code
image: edbizarro/gitlab-ci-pipeline-php:7.4
stages:
- preparation
- building
- deploy
composer:
stage: preparation
script:
- php -v
- composer install --prefer-dist --no-ansi --no-interaction --no-progress --no-scripts --no-suggest
- cp .env.example .env
- php artisan key:generate
artifacts:
paths:
- vendor/
- .env
expire_in: 1 days
when: always
cache:
paths:
- vendor/
yarn:
stage: preparation
script:
- yarn --version
- yarn install --pure-lockfile
artifacts:
paths:
- node_modules/
expire_in: 1 days
when: always
.build-production-assets:
stage: building
dependencies:
- composer
- yarn
script:
- cp .env.example .env
- echo "PUSHER_APP_ID=$PUSHER_LIVE_APP_ID" >> .env
- echo "PUSHER_APP_KEY=$PUSHER_LIVE_APP_KEY" >> .env
- echo "PUSHER_APP_SECRET=$PUSHER_LIVE_APP_SECRET" >> .env
- yarn --version
- yarn run production --progress false
artifacts:
paths:
- public/css/
- public/js/
- public/fonts/
- public/mix-manifest.json
expire_in: 1 days
when: always
only:
- dev
.init_ssh_live: &init_ssh_live |
mkdir -p ~/.ssh
echo -e "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
deploy:
stage: deploy
script:
- *init_ssh_live
- php artisan deploy my-website.com -s upload
environment:
name: live
url: https://my-website.com
only:
- dev