Reputation: 1354
Nowadays I'm interested in deploying my laravel application on my custom VPS using gitlab ci cd and I wanted to do it without docker. But every tutorial I find is using docker. I was searching for a sample of .gitlab.ci.yml that will cover my situation. P.S. I've already configured my vps for laravel.
Upvotes: 4
Views: 3831
Reputation: 1354
Finally after some research in gitlab itself and trials, I figured it out. I used gitlab-runner which executes the jobs in .gitlab-ci.yml
And wrote this yml file for the very beginning:
before_script:
- echo "Before script"
- cd /var/www/html/project
building:
stage: build
script:
- git pull origin develop
- composer install
- cp .env.example .env
- php artisan key:generate
- php artisan migrate --seed
- sudo chown -R my-user:www-data /var/www/html/project/
- find /var/www/html/project -type f -exec chmod 664 {} \;
- find /var/www/html/project -type d -exec chmod 775 {} \;
- chgrp -R www-data storage bootstrap/cache
- chmod -R ug+rwx storage bootstrap/cache
testing:
stage: test
script:
- php ./vendor/bin/phpunit
deploying:
stage: deploy
script:
- echo "Deployed"
If you have a better solution, you can write here.
Upvotes: 9