Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP-FPM for Sail in production #123

Closed
dbelyaeff opened this issue May 5, 2021 · 16 comments
Closed

PHP-FPM for Sail in production #123

dbelyaeff opened this issue May 5, 2021 · 16 comments

Comments

@dbelyaeff
Copy link

I'm started to use Sail in production and it's great!

But it lacks of one thing – an ability to use PHP-FPM as server instead of php development one (with artisan serve).

Development team, please, update dockers build file to have an ability to work through php-fpm.

@driesvints
Copy link
Member

Hi @dbelyaeff. Sail is meant as a development tool and not as a production tool.

@falur
Copy link

falur commented May 13, 2021

sometimes I need testing api some services, and they want https. If you will add nginx + php-fpm will great

@alagiesellu
Copy link

alagiesellu commented Sep 3, 2021

But are there know dangers of using Sail in production env?

@finagin
Copy link
Contributor

finagin commented Sep 3, 2021

@dbelyaeff, you can publish and override Dockerfile and docker-compose.yml or using traefik

@mmdglmr
Copy link

mmdglmr commented Nov 1, 2021

@driesvints: would you answer to above questions, please? specific @alagiesellu question.

@driesvints
Copy link
Member

@mmdglmr I already answered those. Sail is a development tool, not a production tool.

@jayenne
Copy link

jayenne commented Jan 7, 2022

a very kind & open request...

Accepting that Sail is a development tool, is there a tutorial, howto, dummys guide to transitioning from Sail to production?

I, like many others, have such limited expeience with Docker, we use Sail to develop on. now, once we are in a position to push to production, I for one, have no idea where to start the transition.

do i rip Sail out?
do i edit the Sail docker files to include nginx and any other bits needed like ffmpeg, gmp etc?

*is Sail just the CLI part and so not actually part of the docker thing anyways?

Would you or someone who understands please help demistify the process for us. ty.

@ammardev
Copy link

ammardev commented Jan 8, 2022

a very kind & open request...

Accepting that Sail is a development tool, is there a tutorial, howto, dummys guide to transitioning from Sail to production?

I, like many others, have such limited expeience with Docker, we use Sail to develop on. now, once we are in a position to push to production, I for one, have no idea where to start the transition.

do i rip Sail out? do i edit the Sail docker files to include nginx and any other bits needed like ffmpeg, gmp etc?

*is Sail just the CLI part and so not actually part of the docker thing anyways?

Would you or someone who understands please help demistify the process for us. ty.

Sail has nothing to do with the production environment. It uses php artisan serve command to run the webserver so you can't use Nginx config files.

If you need docker for production you can build your own image. If you don't need it at all, you can use Nginx for production.

The following link documents the needed configurations:
https://laravel.com/docs/8.x/deployment

@metadeck
Copy link

metadeck commented Feb 4, 2022

We are currently using sail for development and docker based deployments on Laravel Vapor. We have a requirement for FFMPEG so we've updated our sail container to build FFMPEG. This works well and we have spent a lot of time ironing out issues during development. We also followed the advice at https://blog.laravel.com/vapor-docker-based-deployments to add ffmpeg to our vapor container.

Our problem is that we have different versions of ffmpeg installed on development and on vapor. These version mismatches are causing intermittent errors on staging and production that are extrememly difficult to debug.

We are relatively new to docker and thats why we used Laravel Sail. We chose this as we believed the benefits were that our production, staging and local environments would behave exactly the same.

Some potential options below

  1. Can we deploy the sail 8.0/Dockerfile so that our production environment is exactly the same as our local?
  2. Can we use the laravelphp/vapor:php80 locally within sail so that our local environment matches our production and staging?

If I am missing something please point me in the correct direction to understand my options here.

TIA

@brad-tilmor
Copy link

brad-tilmor commented May 11, 2022

Sail really should have an option to convert it to a production-ready container, or at least to publish Sail's dockerfiles or something similar. Making it development-only largely defeats the purpose of having a containerized workflow. One of the key selling-points of containerization is to have consistent and predictable environments. Not giving users the ability to deploy their Sail-based applications directly is a huge miss, imo. Having to essentially roll your own containers for production makes using Sail pointless, since we might as well just use those same containers for development as well.

@alagiesellu
Copy link

I found a very amazing tool for Laravel deployment LaraSail

https://github.com/thedevdojo/larasail

Does the work well.

@ahmedsayedabdelsalam
Copy link

what is the purpose for containerization then :D

@amitleuva1987
Copy link

I found a very amazing tool for Laravel deployment LaraSail

https://github.com/thedevdojo/larasail

Does the work well.

This is 'DigitalOceon' Specific. May not work for other hosting providers (AWS, Azure, GCP)

@amitleuva1987
Copy link

Well,

Below could be one of the solution.

1 . Install docker on your hosting machine (aws, azure, gcp, etc...)
2 . go to the root directory of your app
3 . type below command to install software dependencies.

docker run --rm \
    -u "$(id -u):$(id -g)" \
    -v $(pwd):/var/www/html \
    -w /var/www/html \
    laravelsail/php81-composer:latest \
    composer install --ignore-platform-reqs

4 . make docker container run in the detach mode (sail up -d)

@amitleuva1987
Copy link

Refer this url for deploying laravel sail over aws,

@vibonacci
Copy link

Laravel offers paid service - Laravel Forge - for serving Laravel applications for production using real webservers.
If they would include a sail build-for-production-with-nginx command, and extend the docker setup with Nginx and PHP-FPM, it would kill their business of their paid services...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests