I have used this script for a year now, excellent ;) It should be updated because github's set-output is getting deprecated and removed soon (FYI the link to the blog post points to 404).
Hi Philo, thanks for this excellent tutorial on CI/CD with Laravel. I've been searching for a video like this for some time now. I love how you explained each step. Thanks, once again.
Hi Philo,This is great tutorial I've followed it continous 2 days to get setup final working model.Thanks a lot for your great effort to build this nice tutorial.
Hey Philo! This is great. I have been looking for something like this. Hopefully my days with FTP-uploads and forgetting files are gone. I will test this with a minor project I am currently working on.
The parsing of the deployment-config.json fails for me. I get an error that says Error when evaluating 'strategy' for job 'prepare-release-on-servers'. (Line: 54, Col: 17): After parsing a value an unexpected character was encountered: {. Path '[0]', line 2, position 5.,(Line: 54, Col: 17): Unexpected value '' I've tried modifying the json ond tweaking the action parsing code but can't get it to work.
Hi David, This error often occurs when the JSON is multi-line so I'm thinking that for some reason the JSON is not escaped. Could you verify the "Export deployment matrix" step? You can find the source code here: philo.dev/how-to-use-github-actions-build-matrix-to-deploy-artifacts-to-multiple-servers/
Hey Philo, this is amazing content, also, would be great to see how did you set up your phpstorm IDE that it fires the autocomplition on yml files, this is really amazing. Thanks!
Hi Philo! Thx you for your efforts to make a good video.I have one important question to you: I am very inexperienced with deployment but I find it very dangerous to store the credentials in a json and upload it to the repository. Is that normal? I would have stored the crendetials as keys in GitHub secrets and only addressed them via variables in my deployment yml. What do you think?
Agreed! This was just for the tutorial to make it a bit easier. If you check out the blog article it will explain how to use SSH keys instead :) philo.dev/how-to-use-github-actions-build-matrix-to-deploy-artifacts-to-multiple-servers/
Nice video! Very, very useful! But I have a problem. I'm trying to deploy an existing full Laravel app, and I get a composer install error. composer install --no-dev --no-interaction --prefer-dist ..... ..... ..... SQLSTATE[HY000] [2002] Connection refused (SQL: select column_name as `column_name` from information_schema.columns where table_schema = ***** and table_name = roles) Has anybody this same error? Thank you!!
It was an error of "postAutoloadDump". I've temporary solved with composer install --no-dev --verbose --prefer-dist --optimize-autoloader --no-interaction --no-scripts;
Thanks a lot Philo for the great tutorial. Can we use another directory outside public root to store artifacts, releases, storage and .env file? I think there is an security issue having .env in public root directory
Thanks! Your .env is not in the public root directory. You should set the root directory to your-project/current/public (this is your Laravel's public folder, this doesn't contain the .env)
@@rickbeniers667 not sure about that I’m not using Kubernetes. I guess it is somewhat similar but instead you build, push and deploy an image instead of a zip file.
Hi Philo thank you for this amazing tutorial! Just one questions regarding the deployments-config.json file that you commit in your repo and exposes all your servers sensitive data? do you think it could be a security risk? is there any way to have that file saved like github secrets or somewhere else where is more secure? thank you!!
Hey Miguel, I'm happy to hear you liked the tutorial! Keeping sensitive data out of your repository is definitely good practice. Instead of loading the JSON file from your repository you can indeed put the contents of the file in a github secret as well and reference this in the deployment workflow.
@@chetankharel4435 Thanks for your feedback; I 100% agree. I'm trying to find the right balance between what to explain in-depth and what to keep simple. I think I can spend hours talking about server provisioning as well haha.
Hey Philo, this was an amazing tutorial, I did have one issue, I have breezed installed and pushed, but my login and register routes don't work, any thoughts?
Thanks! Do any of your other routes work? This workflow should not have any effect on your routes. I'm using this exact same set up for all my applications without any routes issues.
@@PhiloDev thanks for the response, really appreciate it. I installed Laravel breeze on local, then after I pushed to server using the flow, the login and register routes returns nginx 404 not found.
I finally made this work, I had to vi into my nginx config file and add this line: try_files $uri $uri/ /index.php$is_args$args; I don't know why it happened, but this fixed the nginx 404 not found error on my routes. Thanks again Philo for sharing this.
Getting error: create folder /artifacts /var/www/html/artifacts 23 untar file c5yHb7EvxL.tar 24 error: tar: /var/www/html/artifacts: Not found in archive 25 tar: Exiting with failure status due to previous errors
If you shared hosting has SSH support it will work just the same. If it doesn't I would recommend switching to a hosting provider that provides a VPS like DigitalOcean or AWS.
The blog article has been updated to include how to use SSH keys instead philo.dev/how-to-use-github-actions-build-matrix-to-deploy-artifacts-to-multiple-servers/
Hi Philo, this is a great tutorial, thank you. I have an issue on appleboy/scp-action , when scp to server I get: drone-scp error: stdin: is not a tty. Have you some ideas how to solve it?
Thanks Stefano! It’s challenging to determine what causes that issue without knowing all the details. I would try the latest ubuntu distro and see if that solves the issue.
Thanks for the comment! The tutorial is over 2 years old, but it still works. However, you will get some deprecation errors. Luckily it only requires a few minor changes, which can be found in the blog article :) philo.dev/how-to-use-github-actions-build-matrix-to-deploy-artifacts-to-multiple-servers/
@@PhiloDev for me the actions/checkout@v3 is not working with npm install and npm run dev/prod so I commented out the lines for npm and it worked, my app doens't need npm so i commented out but if someone's code need this, it has error
Hi Philo, I am at 27:51 and the tutorial is going amazing, but I got stuck now, I am having error when pushed my code error is : tar all files into /tmp/2785375458/AmqnRwzLKN.tar scp file to server. create folder /var/www/html//artifacts // /var/www/html/artifacts untar file AmqnRwzLKN.tar error: tar: /: Not found in archive tar: /var/www/html/artifacts: Not found in archive tar: Exiting with failure status due to previous errors drone-scp error: Process exited with status 2 drone-scp rollback: remove all target tmp file remove file AmqnRwzLKN.tar 2022/08/18 10:39:20 Process exited with status 2 can you help me with this, please? Regards Hasan Mehdi
Seems like you may have made a typo. You can also use the article as a reference and check if everything is correct philo.dev/how-to-use-github-actions-build-matrix-to-deploy-artifacts-to-multiple-servers/
@@hassucigar if you want to use Laravel and Docker I recommend Laravel Sail. If you want to use Docker in production, Laravel Vapor or Fly.io are great solutions that takes care of all the things Docker related.
I have to thank you here too. This is the more detailed guide that I found on this subject. Thank you very much.
Thanks Wisliy!
I have used this script for a year now, excellent ;)
It should be updated because github's set-output is getting deprecated and removed soon (FYI the link to the blog post points to 404).
The article has been updated to include the changes :) Also fixed the link, thanks!
Hi Philo, thanks for this excellent tutorial on CI/CD with Laravel. I've been searching for a video like this for some time now. I love how you explained each step. Thanks, once again.
Thanks! Glad it was helpful!
This is one of the best tutorials. Thanks for this excellent tutorial.
I searched for this for a really long time. You helped me alot.
Hi Philo,This is great tutorial I've followed it continous 2 days to get setup final working model.Thanks a lot for your great effort to build this nice tutorial.
couldn't skip a sec it was that good & detailed. Thanks Phil ♥
Hey Philo! This is great. I have been looking for something like this. Hopefully my days with FTP-uploads and forgetting files are gone. I will test this with a minor project I am currently working on.
Very detailed explanation thank you buddy, do more like this on UA-cam please...
Thank you very much, Philo!
Thanks for leaving a comment 🙌🏼 I'm happy to hear that you enjoyed the video! More videos are coming so don't forget to subscribe 😄
Thanks a lot Philo, A really informative and excellent explanation on CI/CD.
Subscribed
Thanks! That’s great to hear!
Amazing content, thanks for sharing!
Glad you enjoyed it!
You are doing a great job.
Thank you!
Awesome tutorial, really helpful.
Glad it was helpful!
Hi Philo.. im waiting for next vidio pleaseeee
Love it
Thanks Sudhir! 😄
Awesome video Philo!
Really, really awesome tutorial
Thanks!
Very good quality! Nice job
Thanks!
The parsing of the deployment-config.json fails for me. I get an error that says
Error when evaluating 'strategy' for job 'prepare-release-on-servers'. (Line: 54, Col: 17): After parsing a value an unexpected character was encountered: {. Path '[0]', line 2, position 5.,(Line: 54, Col: 17): Unexpected value ''
I've tried modifying the json ond tweaking the action parsing code but can't get it to work.
Hi David, This error often occurs when the JSON is multi-line so I'm thinking that for some reason the JSON is not escaped. Could you verify the "Export deployment matrix" step? You can find the source code here: philo.dev/how-to-use-github-actions-build-matrix-to-deploy-artifacts-to-multiple-servers/
This worked for me: echo "::set-output name=deployment-matrix::$(echo $JSON)"
Also its written like this in the docs
I got same problem here, extra one space, indetation may solve.
@@buggxs Worked for me too! Thank you Andre!
id: export-deployment-matrix
run: |
JSON="$(cat ./deployment-config.json)"
JSON="${JSON//'%'/'%25'}"
JSON="${JSON//'
'/'%0A'}"
JSON="${JSON//'
'/'%0D'}"
echo "::set-output name=deployment-matrix::$(echo $JSON)"
Awesome stuff Philo
Thanks Pubudu! :)
Damn FrontPage, we are old man!
Thanks for sharing
So good
Awesome Video! This tutorial is still works right now? for Laravel with Vite.
Yes! Still works, there is one minor change but you can see the updated blog article for more information 😄
Awesome tutorial, keep up
Thanks, will do!
Hey Philo, this is amazing content, also, would be great to see how did you set up your phpstorm IDE that it fires the autocomplition on yml files, this is really amazing. Thanks!
Hey Mike, thanks for your comment! I did a quick check but the autocompletion of the yml files is something phpstorm does automatically.
@@PhiloDev Thank you for checking this out, I double checked as well and it doesn't seem to autocomplete on my side:(
@@mikeglobal9084 it might be worth checking if the YAML plugin is enabled. Plugins -> YAML(this should be enabled by default though)
Hi Philo! Thx you for your efforts to make a good video.I have one important question to you:
I am very inexperienced with deployment but I find it very dangerous to store the credentials in a json and upload it to the repository. Is that normal? I would have stored the crendetials as keys in GitHub secrets and only addressed them via variables in my deployment yml. What do you think?
Agreed! This was just for the tutorial to make it a bit easier. If you check out the blog article it will explain how to use SSH keys instead :)
philo.dev/how-to-use-github-actions-build-matrix-to-deploy-artifacts-to-multiple-servers/
Hi Philo, great video! Let me know if you are interested in a Laravel project...
Nice video! Very, very useful!
But I have a problem. I'm trying to deploy an existing full Laravel app, and I get a composer install error.
composer install --no-dev --no-interaction --prefer-dist
.....
.....
.....
SQLSTATE[HY000] [2002] Connection refused (SQL: select column_name as `column_name` from information_schema.columns where table_schema = ***** and table_name = roles)
Has anybody this same error?
Thank you!!
It was an error of "postAutoloadDump". I've temporary solved with
composer install --no-dev --verbose --prefer-dist --optimize-autoloader --no-interaction --no-scripts;
Happy to hear you enjoyed the video and solved the problem.
Awesome video keep on.
Thanks, will do!
Thanks a lot Philo for the great tutorial.
Can we use another directory outside public root to store artifacts, releases, storage and .env file? I think there is an security issue having .env in public root directory
Thanks! Your .env is not in the public root directory. You should set the root directory to your-project/current/public (this is your Laravel's public folder, this doesn't contain the .env)
is deploying to kubernetets cluster around the same as for the services you are using?
@@rickbeniers667 not sure about that I’m not using Kubernetes. I guess it is somewhat similar but instead you build, push and deploy an image instead of a zip file.
@@PhiloDev ahh okay. I was playing around with docker images earlier so will try that next. thanks for the tip!
Hi Philo thank you for this amazing tutorial! Just one questions regarding the deployments-config.json file that you commit in your repo and exposes all your servers sensitive data? do you think it could be a security risk? is there any way to have that file saved like github secrets or somewhere else where is more secure? thank you!!
Hey Miguel, I'm happy to hear you liked the tutorial! Keeping sensitive data out of your repository is definitely good practice. Instead of loading the JSON file from your repository you can indeed put the contents of the file in a github secret as well and reference this in the deployment workflow.
Loved it
Thanks Chentan!
Loved everything but permission can create security issues I think. www-data would be better in place of 0777
@@chetankharel4435 Thanks for your feedback; I 100% agree. I'm trying to find the right balance between what to explain in-depth and what to keep simple. I think I can spend hours talking about server provisioning as well haha.
@@PhiloDev Great I searched every videos on UA-cam to implement it finally cudos to you thanks 😊
Hey Philo, this was an amazing tutorial, I did have one issue, I have breezed installed and pushed, but my login and register routes don't work, any thoughts?
Thanks! Do any of your other routes work? This workflow should not have any effect on your routes. I'm using this exact same set up for all my applications without any routes issues.
@@PhiloDev thanks for the response, really appreciate it. I installed Laravel breeze on local, then after I pushed to server using the flow, the login and register routes returns nginx 404 not found.
I finally made this work, I had to vi into my nginx config file and add this line: try_files $uri $uri/ /index.php$is_args$args; I don't know why it happened, but this fixed the nginx 404 not found error on my routes. Thanks again Philo for sharing this.
Kindly share the YML file
Getting error:
create folder /artifacts /var/www/html/artifacts
23
untar file c5yHb7EvxL.tar
24
error: tar: /var/www/html/artifacts: Not found in archive
25
tar: Exiting with failure status due to previous errors
Gave your user permission to create folder inside /var/www/html folder
This is an excellent tutorial; however, I was wondering if it could also be used with shared hosting.
Yes, it could work if your hosting supports ssh access.
Amazing content,loved every bit.
How do I configure it on a shared hosting server(Apache)
If you shared hosting has SSH support it will work just the same. If it doesn't I would recommend switching to a hosting provider that provides a VPS like DigitalOcean or AWS.
@@PhiloDev thanks
And ... .could you explain how to use ssh keys instead of name and password as access to production server?
The blog article has been updated to include how to use SSH keys instead philo.dev/how-to-use-github-actions-build-matrix-to-deploy-artifacts-to-multiple-servers/
can you help me, links are not working and give me 404 error what di i do ?
Which links?
@@PhiloDev all the links login register about contact
every link in the laravel application
i'm using laravel+vuejs+inertia
@@PhiloDev i have fixed the problem it was in the nginx config thnak you
Hi Philo, this is a great tutorial, thank you. I have an issue on appleboy/scp-action , when scp to server I get: drone-scp error: stdin: is not a tty. Have you some ideas how to solve it?
Thanks Stefano! It’s challenging to determine what causes that issue without knowing all the details. I would try the latest ubuntu distro and see if that solves the issue.
@@PhiloDev Thanks, I'll try that.
Is there any github repo for full code? Thanks
No repo but you can find the code in the blog article :)
keren banget
hey, what if i use ssh key?
See the following tutorial philo.dev/how-to-use-github-actions-build-matrix-to-deploy-artifacts-to-multiple-servers/
It is outdated now, not working
Github updates some actions and hence the code in yml file followed with is now no longer working and giving deprecation errors
Thanks for the comment! The tutorial is over 2 years old, but it still works. However, you will get some deprecation errors. Luckily it only requires a few minor changes, which can be found in the blog article :)
philo.dev/how-to-use-github-actions-build-matrix-to-deploy-artifacts-to-multiple-servers/
@@PhiloDev Thanks, for the link. I will check this :)
@@PhiloDev can you please give me the url to this updated .yml file? I'm lost and didn't know why I'm getting errors.
@@PhiloDev for me the actions/checkout@v3 is not working with npm install and npm run dev/prod so I commented out the lines for npm and it worked, my app doens't need npm so i commented out but if someone's code need this, it has error
Hi Philo,
I am at 27:51 and the tutorial is going amazing, but I got stuck now, I am having error when pushed my code error is :
tar all files into /tmp/2785375458/AmqnRwzLKN.tar
scp file to server.
create folder /var/www/html//artifacts // /var/www/html/artifacts
untar file AmqnRwzLKN.tar
error: tar: /: Not found in archive
tar: /var/www/html/artifacts: Not found in archive
tar: Exiting with failure status due to previous errors
drone-scp error: Process exited with status 2
drone-scp rollback: remove all target tmp file
remove file AmqnRwzLKN.tar
2022/08/18 10:39:20 Process exited with status 2
can you help me with this, please?
Regards
Hasan Mehdi
Seems like you may have made a typo. You can also use the article as a reference and check if everything is correct philo.dev/how-to-use-github-actions-build-matrix-to-deploy-artifacts-to-multiple-servers/
@@PhiloDev Thanks alot. Can you make video on how to setup docker with laravel ?
@@hassucigar if you want to use Laravel and Docker I recommend Laravel Sail. If you want to use Docker in production, Laravel Vapor or Fly.io are great solutions that takes care of all the things Docker related.
Amazing content, thanks for sharing!
Awesome tutorial, really helpful.