-
-
Notifications
You must be signed in to change notification settings - Fork 65
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
Add non-root user for running uwsgi in Dockerfile #388
Conversation
The error in CI is this
There was one point in time where we were writing logs to a file on the filesystem. But then we later realized we were deploying to kubernetes and that logging to stdout would be better for other tools to consume it. There's some dead code around logging to a file. If you want, you can open a separate PR to remove that code, and rebase this after we merge that which should fix the permissions issue |
I merged #391 so you should be able to rebase and fix this |
The problem that's popping up right now is due to
In the docker compose file, it overwrites the permissions of the docker container with the current permissions of the host files which leads to the current errors |
@aaron-suarez I think in order for us to fix this is to either add a separate docker-compose file for development and a separate one for production (which we could test with) Or just simply add an additional action in the CI config to change the ownership of the current directory to the new user (uwsgi). It shouldn't throw an error even if the user doesn't exist yet so it should work, but I am not sure. What do you think? |
Thank you @Kandeel4411 for your expert advice. I tried following many paths down the non-root rabbithole but none seems to go anywhere:
|
fwiw, I pulled down your branch and couldn't reproduce the current error locally. If you also can't figure it out, it might be something to do with the CircleCI user, and maybe we can make a special |
@platipo thanks :) thought I am by no means an expert! You did really great - I encountered this error before and I think its mostly related to permissions being overridden which sadly can't be helped ( as far as I know ) with docker-compose since it always uses the host permissions when mounting it as a volume. I think our main issue with the permissions was because of the
Which made the host files permissions be only to the
and in the Dockerfile when creating the user we assign the above
Since |
You could cherry pick or make the same edit here and it should be able to work. We have to test it on staging though to check if there is no issues running there (hence it being a CircleCI problem only) |
Sounds good to me. I also should have branch permissions so if you need me to cherry pick the commit and push it to this branch, I can. Just let me know @platipo |
Thanks @Kandeel4411 and @aaron-suarez for your kind support! I have been thinking for a bit on a cleaner solution to the permission problem and came up with two alternatives:
|
I think we could go with the current solution for this and open a new issue with those alternatives to decide later as they do seem quite cleaner, or we could just implement one here. What do you think @aaron-suarez? |
@platipo I'm good with this solution. Please rebase and we'll merge it. Thanks for this!! If you want to follow up with any clean ups like the orb and all that, feel free to |
Bumps [flake8](https://gitlab.com/pycqa/flake8) from 3.8.3 to 3.8.4. - [Release notes](https://gitlab.com/pycqa/flake8/tags) - [Commits](https://gitlab.com/pycqa/flake8/compare/3.8.3...3.8.4) Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.1.0 to 6.1.1. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/master/CHANGELOG.rst) - [Commits](pytest-dev/pytest@6.1.0...6.1.1) Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
* Remove log directory creation * Remove unused import
This problem seems to be already known in docker/compose#3270 (comment)
@aaron-suarez all done! Do you think it's better to open another issue for the cleanup to keep things clean? |
@platipo either open an issue or just open a pull request. If you're going to do it yourself, no need for an issue. If you think there's a chance you'll never come back to it, opening an issue allows someone else to pick it up |
Fixes #383