Issue running docker in production mode #1153
Replies: 17 comments 5 replies
-
Production mode has additional checks (they are cached, overall behaviour may one day change under #630). As for the issue you are seeing, it sounds like the permissions were changed in a "wrong" manner. Without seeing the command used to change the permissions (and the context they are run in) I can't help much. To hazard a guess, it looks like the permission change has blocked the user account within the container context. That is, there is an ownership issue. From memory there are some considerations for setting file permissions in a |
Beta Was this translation helpful? Give feedback.
-
Thanks for the detailed answer. Just out of curiosity, under the dev mode, is it possible to enable logs to stderr from php-fpm in the container As per your second paragraph's answer, I may have broken something as I got stuck with this for few hours and tried few things. I have deployed the solution from scratch again and ended up with the same issue when hitting localhost:8591:
Not sure if someone can point me to the right direction here. The folder permissions from the
|
Beta Was this translation helpful? Give feedback.
-
Dev mode is generally a lot more permissive (e.g. allowing certain folders to be writable). Production on the other hand has checks in place intended to guard against potential security issues. They aren't comprehensive, being more intended to push people into using best security practises rather than providing another layer of security. My mastery of Unix permissions is non-existent so I'll defer to @lcharette on this front. |
Beta Was this translation helpful? Give feedback.
-
@raserma |
Beta Was this translation helpful? Give feedback.
-
Maybe @phillmac could help ? |
Beta Was this translation helpful? Give feedback.
-
E.g. My dockerfile looks something like this:
The only caveat to this approach is needing to manage asset bundles separately e.g.
where the .sh script looks something like this:
|
Beta Was this translation helpful? Give feedback.
-
The end result is a bunch of switching users and messing about, but the critical thing is running |
Beta Was this translation helpful? Give feedback.
-
The final stage of my docker build looks something like this:
|
Beta Was this translation helpful? Give feedback.
-
I really should move the asset builds to separate stage to cut down on the weight of nodejs I guess, But seeing as I use the same image for both dev and production, being able to quickly add assets in dev for the sake of testing is kinda handy too |
Beta Was this translation helpful? Give feedback.
-
Thank you guys! @phillmac thanks for the Dockerfiles. I think I also executed those chmod/chown commands when debugging the container and nothing changed. However I will try these steps all over again later with a fresher brain in case I missed something. |
Beta Was this translation helpful? Give feedback.
-
FYI, there is an |
Beta Was this translation helpful? Give feedback.
-
@lcharette Thoughts on converting this into a discussion? (the GitHub feature that is) |
Beta Was this translation helpful? Give feedback.
-
I agree, we can try. Docker seems a complex topic not it's own that might or no have a definitive answer. |
Beta Was this translation helpful? Give feedback.
-
Perhaps we should investigate some minimal reproduction steps here then push it to docker hub as an example of what to do / not do? |
Beta Was this translation helpful? Give feedback.
-
I could redact a docker-compose config + ancillary configs that's actually in production and post here if it's any help. |
Beta Was this translation helpful? Give feedback.
-
I'm just curious as to what infra / hardware is needed if we intend to dockerise the demo site. |
Beta Was this translation helpful? Give feedback.
-
e.g. do we need to run a redis service or is running without a cache fine? |
Beta Was this translation helpful? Give feedback.
-
Hi,
We got Userfrosting running on our systems and I'd like to migrate it to Docker.
So I am trying to deploy Userfrosting in docker using the UF_MODE=production. However, after the installation, the frontend application fails with:
I have tried to give those folders read-only permissions, but then the frontend fails with the following:
Am I supposed to run production mode with Docker?
If I switch back to
development
mode before making those folder read-only, and restart the container, the portal loads successfully and I am able to login. However, with development mode enabled, theapp
container doesn't log anything from php-fpm service, which is not ideal.Beta Was this translation helpful? Give feedback.
All reactions