Automatic Deployment of a Laravel Application with Buddy.works
I guess we all know Laravel Forge and Laravel Envoyer, which is probably the best combination of hosting and deploying Laravel applications.
However, maybe you don't use Laravel Forge because you have your own dedicated server on which you host several Laravel apps. And also, you need to only deploy your Laravel app when all tests are green, and that should be done automatically on any commit.
Laravel Envoyer doesn't run your tests, unfortunately, so you can't fully automate a deployment on any commit.
This is where https://app.buddy.works comes into action ! And best thing is, it has a free plan (as long as you don't setup more than 5 projects).
I assume the following:
Ok ! If that's what your looking here's the detail of my deployment plan :
In the "Run Commands" section, copy paste theses lines :
# Prepare .env file
cp .env.example .env
sed -i "s/127.0.0.1/mysql/g" .env
sed -i "s/DB_USERNAME=homestead/DB_USERNAME=root/g" .env
sed -i "s/DB_PASSWORD=secret/DB_PASSWORD=qwerty/g" .env
# Install Composer
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
# Setup Database
echo "create database homestead" | mysql --host=mysql --user=root --password=qwerty
# Run Laravel commands
composer install
php artisan key:generate
php artisan migrate
php artisan db:seed
./vendor/bin/phpunit
I assume your .env.example file in your project look like this
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
In the Configuration > Environment section, you need to use this docker image
The Package Setup section :
And in the "Services" section, you simply need to add a Mysql Service and that's it :)
The Slack step is actually so easy that you don't need screenshots :)
Enjoy !
I consider myself as an IT Business Artisan. Or Consultant CTO. I'm a self-taught Web Developper, coach and teacher. My main work is helping and guiding digital startups.
more about meBTC
18SY81ejLGFuJ9KMWQu5zPrDGuR5rDiauM
ETH
0x519e0eaa9bc83018bb306880548b79fc0794cd08
XMR
895bSneY4eoZjsr2hN2CAALkUrMExHEV5Pbg8TJb6ejnMLN7js1gLAXQySqbSbfzjWHQpQhQpvFtojbkdZQZmM9qCFz7BXU
2024 © My Dynamic Production SRL All rights Reserved.