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

Speed up php-fpm container on MacOS #560

Closed
wants to merge 1 commit into from

Conversation

tonicospinelli
Copy link

The script setup_native_nfs_docker_osx.sh will activate the NFS enabling
to speed up the mounted storage.

Adding health check for php-fpm container, just running the command
docker-compose ps it will show if the container is healthiness.

The HEALTHCHECK instruction tells Docker how to test a container
to check that it is still working. This can detect cases such as a
web server stuck in an infinite loop and unable to handle new
connections, even though the server process is still running.

Separating some commands into RUN instructions allow the Docker to cache
the instruction result to reuse in another moment.
https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#leverage-build-cache

Co-authored-by: Kévin Dunglas [email protected]
Co-authored-by: arti0090 [email protected]

@tonicospinelli tonicospinelli requested a review from a team as a code owner May 27, 2021 09:22
@tonicospinelli
Copy link
Author

Facing many issues over docker provision, I think MacOS users may use docker containers without so much pain and a slow interface.

I made this branch from 1.9 just because the master is under construction to migrate to PHP 8.

this PR was inspired by a good job made by @arti0090 on #536

COPY docker/php/docker-healthcheck.sh /usr/local/bin/docker-healthcheck
RUN chmod +x /usr/local/bin/docker-healthcheck

HEALTHCHECK --interval=10s --timeout=3s --retries=3 CMD ["docker-healthcheck"]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it helps to know when php-fpm is ready

DATABASE_URL=mysql://[email protected]/sylius_%kernel.environment%
DATABASE_URL=mysql://sylius:nopassword@mysql/sylius
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @tonicospinelli , may I ask why would you want to change it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it to give a smooth experience for new adopters because the docker is not parameterized for multi-environment yet.

composer install --prefer-dist --no-progress --no-suggest --no-interaction
bin/console assets:install --no-interaction
bin/console sylius:theme:assets:install public --no-interaction
fi
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all these commands already ran during the container build. so, if you need to update some file, just run docker-composer build php to update files inside the container

@vvasiloi
Copy link
Contributor

@tonicospinelli @arti0090 guys, maybe join forces and split your changes so at least some can be merged sooner.

@vvasiloi
Copy link
Contributor

And remove composer.lock until there is a resolution on this #505

The script setup_native_nfs_docker_osx.sh will activate the NFS enabling
to speed up the mounted storage.

Adding health check for php-fpm container, just running the command
`docker-compose ps` it will show if the container is healthiness.

The HEALTHCHECK instruction tells Docker how to test a container
to check that it is still working. This can detect cases such as a
web server stuck in an infinite loop and unable to handle new
connections, even though the server process is still running.

Separating some commands into RUN instructions allow the Docker to cache
the instruction result to reuse in another moment.
https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#leverage-build-cache

Co-authored-by: Kévin Dunglas <[email protected]>
Co-authored-by: arti0090 <[email protected]>
@tonicospinelli
Copy link
Author

I'm closing it to keep only changes related to NFS approach, see you on next PR.

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

Successfully merging this pull request may close these issues.

3 participants