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

[Vote] FPM support #33

Open
polarathene opened this issue Aug 10, 2019 · 5 comments
Open

[Vote] FPM support #33

polarathene opened this issue Aug 10, 2019 · 5 comments
Labels
feature request Vote with a thumb up or down for this feature request

Comments

@polarathene
Copy link

Is there a reason for opting for php:alpine over php:fpm-alpine or not offering the fpm variant as well?

It doesn't seem straight-forward to extend this image to add that fpm support looking at the Dockerfile for fpm variant(there's additional args run from an env var during the build).

Forking this repo just to replace the base image with the variant should work, but that doesn't seem like the right way to go about it.

@lorisleiva
Copy link
Owner

Hi there 👋

To be honest, I originally created this image for continuous integration tools so I never really needed FPM but I'm willing to consider using it as a new set of images.

My primary goal for this image is to stay as small as possible whilst covering the 80% use cases of Laravel users. FPM being a pretty important part of PHP, I think you make a good point.

Could I ask you why you need FPM in your case? Are you using this image in a production server?

@fgilio Franco, do you have any strong opinion on this?

@polarathene
Copy link
Author

polarathene commented Aug 11, 2019

Are you using this image in a production server?

Just recently added it to a server due to a request from a PHP dev for a Laravel setup, it's not serving a production site or service at present. Other PHP based containers I have been using are all this trafex/alpine-nginx-php7 image, which also bundled nginx as their webservers, which are used in combination with nginx-proxy.

In future, I plan to migrate the reverse-proxy to Traefik, and not being too familiar with PHP environments myself(this is a non-profit community rather than commercial). I've only recently been aware that nginx can be separated out to it's own container while using the fpm related part of nginx config.

When I set these PHP containers up for their community a couple years back, I recall FPM being important / helpful improvement, it has about 1,000 active users, not that big, but not too small either. Most guides for using nginx with PHP mention with FPM afaik, so it may have been related to that as well.

Presently the container is setup like so with docker-compose(I know that artisan is not meant to be used for production, and will switch it when I've had time to figure out how):

  laravel:
    image: lorisleiva/laravel-docker:7.3
    container_name: test_laravel
    restart: always
    ports:
      - 8000:8000
    links:
      - db
    environment:
      VIRTUAL_PORT: 8000
      VIRTUAL_HOST: laravel.example.tld
      LETSENCRYPT_HOST: laravel.example.tld
      LETSENCRYPT_EMAIL: ${ADMIN_EMAIL}
    volumes:
      - ./websites/laravel/hello_world:/var/www/laravel
    working_dir: /var/www/laravel/
    command: php artisan serve --port=8000 --host=0.0.0.0

The host param for artisan needed to be 0.0.0.0(listen on all interfaces, not just loopback/localhost of the container), otherwise the docker host would get connection failures when making a request to the container despite the port mapping.

The working_dir, was because of the default one has an "html" directory and I'm mounting the laravel project(I could have gone with anything else like /srv/laravel too I guess). I'm not sure if the "html" dir mattered or not when mounting a volume, but wanted to avoid dealing with any potential surprises later.

I originally created this image for continuous integration tools

There doesn't appear to be any official Laravel images on DockerHub and yours seemed to be a reasonably popular and still maintained image, after evaluating several others out there I decided yours was most appropriate for getting something up and going with minimal fuss.

Your CI with GitLab Pipelines article also helped influence the choice as I'd like to go over that to get some automated deployments going. Presently any docker related changes are manually managed on the server with docker-compose commands, while project code is managed with git(and GitLab), it's sync'd to the project folders by the devs when they have production updates.

@fgilio
Copy link
Contributor

fgilio commented Aug 12, 2019

Hmmm I don't really have a lot of experience in this front. One thing that comes to mind if that using an FPM enabled version of the PHP image would be all that's required.
Sorry I can't be of more help, I'll be following the discussion closely.

@8ctopus
Copy link

8ctopus commented May 16, 2020

I was facing the same limitation with Loris' docker image so I created another docker image which adds apache and php-fpm. if interested you can check it out here https://github.com/8ctopus/apache-php-fpm-alpine.

@lorisleiva lorisleiva added enhancement New feature or request feature request Vote with a thumb up or down for this feature request and removed enhancement New feature or request labels May 23, 2020
@sean7218
Copy link

sean7218 commented Sep 20, 2020

can i use this image for production on AWS with artisan serve?

@lorisleiva lorisleiva changed the title FPM support [Vote] FPM support Mar 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Vote with a thumb up or down for this feature request
Projects
None yet
Development

No branches or pull requests

5 participants