Closed jaydrogers closed 6 months ago
so I sorta nuked my whole dev environment because I have traefik running and now I think if I'm looking at the docker-php stuff correctly that ports for nginx have now changed, but I'm not sure what I need to change on my end.
But just wondering where I should look for updates/fixes...I think technically this is a spin issue, but it's connected to the beta release of docker-php?
so I sorta nuked my whole dev environment because I have traefik running and now I think if I'm looking at the docker-php stuff correctly that ports for nginx have now changed, but I'm not sure what I need to change on my end.
But just wondering where I should look for updates/fixes...I think technically this is a spin issue, but it's connected to the beta release of docker-php?
I got it working and wrote my steps in the discord channel: https://discord.com/channels/910287105714954251/1232230895331704893
My changes are: Dockerfile
# Learn more about the Server Side Up PHP Docker Images at:
# https://serversideup.net/open-source/docker-php/
FROM serversideup/php:beta-8.3-fpm-nginx as base
####################################################
# Development
####################################################
FROM base as development
####################################################
# CI
####################################################
FROM base as ci
# Switch to the root user
USER root
# Set our user and group to www-data for
# FPM so it doesn't fail on startup
RUN echo "user = www-data" >> /usr/local/etc/php-fpm.d/docker-php-serversideup-pool.conf && \
echo "group = www-data" >> /usr/local/etc/php-fpm.d/docker-php-serversideup-pool.conf
####################################################
# Production
####################################################
FROM base as deploy
# Switch to the root user
USER root
RUN chown www-data:www-data /var/www
# Drop back to our unprivileged user
USER www-data
COPY --chown=www-data:www-data . /var/www/html
The docker-compose.ci.yml
targets now the CI
services:
php:
build:
target: ci
Traefik uses the port 8080
now in docker-compose.dev.yml
and docker-compose.prod.yml
and the env variable was changed from PHP_FPM_NAME
to PHP_FPM_POOL_NAME
services:
php:
environment:
PHP_FPM_POOL_NAME: "my-php-app"
labels:
- "traefik.http.services.my-php-app.loadbalancer.server.port=8080"
I also called this script on the server but I am not sure if this is really needed: https://github.com/serversideup/docker-volume-change-permission-script?tab=readme-ov-file
Maybe that helps
thanks for this, I'll check it out and post any updates I have to this too!
Working on a solution to this right now 😃
Just published this Dockerfile example on Docker PHP, but I have to push the updates for the Docker Compose templates for Spin:
https://serversideup.net/open-source/docker-php/docs/guide/migrating-from-v2-to-v3#cicd
Be sure to watch updates for both repositories as Docker PHP v3 beta is nearing it's stable release:
A fix has been deployed in the latest release!
https://github.com/serversideup/spin/releases/tag/v2.0.0-beta4
See this commit for the changes you'll need to make for your existing projects: https://github.com/serversideup/spin/commit/153eab6f36681f59b293c7fc170129c009424ede
thanks for the quick fix on this! Just pushed a very minor PR to you guys, where it was missing the change to USER root
for development
. Once I added that, I've got my environment working again!
Thanks for the fix! Just came across a minor issue when trying to run a Tinker session in development (using docker exec -it <container> php artisan tinker
), where I'm receiving a permission error, causing the Tinker session to abort:
Writing to directory /var/www/.config/psysh is not allowed.
at vendor/psy/psysh/src/ConfigPaths.php:327
323â–• @\mkdir($dir, 0700, true);
324â–• }
325â–•
326â–• if (!\is_dir($dir) || !\is_writable($dir)) {
➜ 327▕ \trigger_error(\sprintf('Writing to directory %s is not allowed.', $dir), \E_USER_NOTICE);
328â–•
329â–• return false;
330â–• }
331â–•
I fixed this by chowning the /var/www/
directory to www-data as well.
RUN chown www-data:www-data /var/www
In this https://github.com/serversideup/spin/issues/76#issuecomment-2074143365 I noticed ps-20x ran this as well.
Problem
Solution