Easily deploy a Laravel application with Docker
Вставка
- Опубліковано 19 сер 2024
- Want to learn more about how to develop and deploy Laravel applications with Docker? I've released a premium course featuring 23 videos for just $29! Check it out here: laraveldocker.com
Alternatively, you can join as a member and receive that course, along with any others I release in the future, for free: www.youtube.co...
In this 21 minute video, I'll show you how to easily deploy a Laravel application using Docker and two separate methods to get source files on a server.
Join my weekly newsletter for tips on Laravel + more: aschmelyun.sub...
Docker installation tutorial for Ubuntu 18.04: www.digitaloce...
Docker Compose install tutorial for Ubuntu 18.04: www.digitaloce...
You'll learn how to:
- Set up Docker and Docker Compose on a remote Ubuntu server
- Send files to a server using rsync
- Use git and GitHub to commit, push, and pull files to a remote server
- Run docker-compose on the remote server to deploy your app
Follow me on Twitter! / aschmelyun
Thanks Patreon supporters!
- Sam Ross
- PK
- Melissa Kipp
Directly support these videos @ / aschmelyun
Still a Premium Course in 2024 - I bought the course recently, worked through it and am VERY happy that I did:
Everything it teaches is still valid, you will learn the basics and how to become comfortable with hosting/running your Laravel App through Docker.
Thank you for making awesome content Andrew 👍👍👍
1:35 $ cp docker-compose.yml docker-compose.prod.yml
1:38 Adjust the nginx port to 80:80
1:47 Harden mysql passwords!
4:05 Deployment options: 4:20 rsync
8:19 Just after you've uploaded your Laravel project to the src/ folder ... However you wanted to (rsync, git, ftp, shell, putty, cmder, bitwise, etc)
9:06 $ docker-compose -f docker-compose.prod.yml up -d --build
9:30 how to add the laravel user to the docker group
10:23 Update the Laravel's .env file for database credentials, app domain, etc.
11:10 Run the migrations with $ docker-compose run --rm artisan migrate
14:40 Deploy with git
17:45 Cloning Laravel project into the src/ folder
18:09 Editing .env file
19:10 Run composer install: $ docker-compose run --rm composer install
19:23 $ docker-compose run --rm artisan migrate
19:33 $ docker-compose run --rm artisan db:seed
20:43 : Everybody wondering ... where is the domain setup, SSL let's encrypt, Redis, memcached, supervisor, ... part ?
Would be nice to see a production-grade docker/kubernetes config, with some settings that are secured and optimized - or just some info of how to do it wrong in a production setup, and what kind of things to keep in mind - like for example having ports open only internally, or settings to make sure opcache is set properly.
For someone like me who has been itching to deploy my laravel projects your content has been a really good source of info.
These Laravel Docker videos have been a lifesaver for me. I'm happily buying your course, thank you!
I love this, the kind of learning I salute like teaching from 0 to production. ❤.
Very informative indeed! Clarity in your step-by-step flow makes the learning process easy to understand. I can now swiftly get my laravel projects to live env. Thanks alot Andrew🙏
You missed few things for complex projects.
1.) Deploy to actual domain.
2.) SSL for that domain.
3.) Socket connection.
4.) Using SSL with socket connection.
5.) Redis
6.) Memcached
7.) Digital ocean Spaces for reliable storage.
8.) MySQL data will be lost once you bring docker down, how to solve that?
I'm hoping part 2 to cover these problems.
This was definitely just an introductory video, additional parts covering those items will be coming up!
It would be great to see that info.....
@@aschmelyun Looking forward to this. Nice tutorial though
Great. Im waiting comming soon
Hopefully can have a video to cover these.
Andrew, cannot thank you enough!
I have been playing recently with docker and your videos are the best, once again thank you and keep it up!
BTW. do you consider any tutorials for Kubernetes?
Thank you very much! Waiting for CI/CD bitbucket or GitLab pipelines for docker deploy! :D
It's coming up soon!
Thanks for the nice tutorial about how to easily deploy a laravel app with docker!
This was the video I was waiting for... It is great... Thank you for this...
That what i'm talking about, i have been spent so much time for looking great tutorial. Thank u so much
Thank you, Andrew! How about adding Let's Encrypt and domain? Or have already uploaded a video about it?
Cool to see my own answer on the DigitalOcean forum in the video 🎉
Great explanation! Keep up the good work! 🙏
Dude this is amazing! Great resource!
Hi Andrew!
Could you please make a video on how to build an image from production so I can push that to a repository?
Man, awesome tutorial. Thank you. I'm following every step you take, however, when I try to instal dependencies with composer I get this:
In Filesystem.php line 260:
/var/www/html/vendor does not exist and could not be created
What am I doing wrong?
is there still this repo link, i love that you handled the composer and artisan containers, one thing that would change its that instead use nginx of server it self as service, if you have multiable sites
Hey Andrew, can you share how to deploy Laravel+Vue in a single docker file? Thanks
Thanks!!! This was extremely helpful
So clear! Thank you
when you were typing commands at the bottom of the screen, i just want to tell you. I could still see them, next time to be sure to hide whatever you are typing because people might learn what you are typing.
Excellent tutorial, very well done.
Great tutorial!
Andrew, can you maka a video for file uploading in laravel within docker container.It is hard to understand how to view uploaded files and how to create symlink correctly.If you can make a videos it is helpfull
Awesome tutorial, thanks!!
where do you see the database ? on local ?
Thank you so much for this video
I have a question about the database.
What is we want to move site to different server with existing database ?
Wonderful thanks mate.
Awesome.. just what i wanted.
wait , so we dont have to make the laravel ,nginx , mysql as an image , and push to docker hub , then pull to the server to automacly run ? , just like put on github , pull on vps server , then do the rebuild like on the local ??
Hey there, that would be very kind of you if you share docker-compose file.
Great Video!
I want to do this but with Ubuntu as core image then nginx and php on it which run the container need help
can you make video using OS Ubuntu server in aws, and make deploy laravel app, nginx, and mysql in docker
Hello, when running docker-compose locally is doesn't set laravel sessions, also the cookies can't be set. The only cookie available is the code editor's (phpstorm). What would be the issue
Excellent stuff!
What about having .env file that contains containers exposed ports for both dev and prod environments?
Thank you
Any chances you can do a same video but using docker swarm?
How to automically do migrations with Docker?
Hello, in the course you are selling you have to make a reverse proxy to store several laravel applications on the same server, that is, with Docker?
Perfect
i need to install puppeteer as welll
Where can I find your docker-compose file?
11:29 docker-compose run --rm artisan migrate throws an error: ERROR: no such service: artisan
In my case I had to use the name of the service you declared in the docker compose file so laravel.test or the container id. So the entire command looked like this: docker exec php artisan migrate
Thanks man
Github repository please!
Thanks
Awesome thanks
How awesome!
"easily"... looks pretty hard to me
Thank you Andrew for this, but for deploying to server can git-ftp work for that??
I'm pretty sure you can use git-ftp, I'll have to look into it deeper though!
Can you show us how we can deploy with heroku?
Sure thing! It's a bit of a different process, but I'd be happy to try and show it off in a future video.
NIce, but one app on one droplet is a waste of money and resources, imo. A multi-app solution would be nice (inc. DNS, reverse-proxy ?)
Hi, how to laravel schedule:run in docker?
You could create a cron job on the server to run docker-compose run --rm artisan schedule:run every minute and it should give you the same outcome.
I'll make a note of this use case and create a follow-up video in the near future.
You could just setup bare git repo on server so we don't need to pull every time..
Definitely! For anyone interested in that, this guide is super helpful for setting up hooks on a server: hackernoon.com/deploy-website-to-remote-server-using-git-da6048805637
Hi, @Andrew Schmelyun. Can you make a video that deploys the Laravel app using Nginx and PHP-fpm in one Dockerfile and MySQL to another Dockerfile in the production environment? I had been researching about it and tried to make my own Dockerfile, but wanna see from your perspective and your opinion. Nice video
Can you pass on that setting I am also working on that
Like repo link
Sir I have a question
If we do docker down then it will shut down the container the what happens to the database ?
If there are no volumes, database info is gone.
@@latlov use volume
Amazing
Hi Andrew, can you make this system with tools using deployer or capistrano or using github actions.
That's coming soon! I'll be doing a whole video on deploying with Docker and CI/CD systems.
@@aschmelyun thanks andrew.
Is it possible to make this repository public?
your editor is phpstorm? if so, which theme is that?
Yes, it's PHPStorm! And the theme I am using is called Material Theme UI with the Atom One Dark color scheme.
hi, i am building a website with laravel, it implements video calling and chatting, and to use socket.io i have to use node server in my project, but i am confused about how to deploy the project in a platform like aws or digital ocean?
useful
deploy with kubernetes please 😀
do not use rsync in your professional work life. instead learn ci/cd workflow
Thanks for the video but it didn't work at all anything of what you have done. I literally follow your first video and this second video and nothing.
Github repository please!