Description
Article:
We received the following comments:
Running laravel in production using serve is considered bad practice.
— boris_eve
RUN php artisan key:generate
You should only run this one.....it should be retrieved from a secret or else things like already set cookies get funky on rebuild of the container.
RUN php artisan serve --host=0.0.0.0 --port=8181
Shouldn't this be CMD?
Also no explanation that "php artisan serve" should not be used for anything outside development and that requires a bit more kubernetes work to serve laravel without it.
— delfinom
RUN php artisan key:generate
If this is generating a secret key, this looks very wrong, because it would embed a secret key into an image that gets pushed to a registry.
If the key is ephemeral (doesn’t need to survive the containers’ lifetimes) it’s better to create it when the container runs. If it’s a persistent secret then Kubernetes has a secrets feature that is appropriate.
— sacundim
I think we should fix the content. I'm not sure what's considered to be best practice in the Laravel world.
Also, we should tweak the title again — I know what you're thinking, we went live already.
I think this article is not one-off. It isn't one of those articles that are forgotten after a while (like How to optimise your Docker images).
More and more people will look for this kind of content in the long run.
In that respect, I suggest we rename the article, but still retain most of the original one.
- Introduction to Kubernetes: How to Deploy a Laravel 5 application
- Getting started with Laravel 5 on Kubernetes
- Deploy a Laravel 5 application to Kubernetes
The titles are variations of articles already published for Heroku — i.e. I google "laravel heroku" and generated variations of the titles.
@keithmifsud let me know what you think.