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

Use consistent Docker user names #1145

Closed
dhruvkb opened this issue Apr 6, 2023 · 5 comments · Fixed by #5238
Closed

Use consistent Docker user names #1145

dhruvkb opened this issue Apr 6, 2023 · 5 comments · Fixed by #5238
Labels
💻 aspect: code Concerns the software code in the repository ✨ goal: improvement Improvement to an existing user-facing feature good first issue New-contributor friendly help wanted Open to participation from the community 🟩 priority: low Low priority and doesn't need to be rushed 🧱 stack: api Related to the Django API 🧱 stack: catalog Related to the catalog and Airflow DAGs 🧱 stack: ingestion server Related to the ingestion/data refresh server 🐳 tech: docker Involves Docker

Comments

@dhruvkb
Copy link
Member

dhruvkb commented Apr 6, 2023

Problem

Our services use an interesting mix of usernames for users created inside Docker.

Service Username
api opener
ingestion_server ingestionu
catalog airflow

Description

We should use the same, or a similar format of, names for these users.

@dhruvkb dhruvkb added 🟩 priority: low Low priority and doesn't need to be rushed ✨ goal: improvement Improvement to an existing user-facing feature 💻 aspect: code Concerns the software code in the repository 🐳 tech: docker Involves Docker 🧱 stack: api Related to the Django API 🧱 stack: ingestion server Related to the ingestion/data refresh server 🧱 stack: catalog Related to the catalog and Airflow DAGs labels Apr 6, 2023
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Openverse Backlog Apr 6, 2023
@krysal krysal added good first issue New-contributor friendly help wanted Open to participation from the community labels Aug 4, 2023
@sarayourfriend
Copy link
Collaborator

@krysal Can you add more details about how to do this/what it will take to do? It's labelled good first issue now but I'm not sure I would know where to start 😅. I kind of assume there would be complications with this too 🤔

@tejaswarathe
Copy link
Contributor

@dhruvkb Does a naming scheme like apiuser, ingestionuser, airflowuser?

Does the below change look good or do we need to check more impact?

RUN useradd --create-home apiuser \
  && chown -R apiuser /static
USER apiuser

COPY --chown=apiuser --from=packages openverse-attribution /packages/python/openverse-attribution/

COPY --chown=apiuser . /api/

@dhruvkb
Copy link
Member Author

dhruvkb commented Nov 30, 2024

@tejaswarathe I think a naming scheme of service + "_user" would be a good place to start.

After changing a name, do a search in the entire codebase (git grep) to see if that username appears anywhere else in the repo. That will give you an idea of where else it has been used.

One more way to check and be more confident in the change would be to open a PR with your changes. That would let our CI + CD job check everything and determine if everything is working normally.

@sarayourfriend
Copy link
Collaborator

What is the utility in using a different username per service? Wouldn't that complicate scripts using docker compose exec?

@dhruvkb
Copy link
Member Author

dhruvkb commented Dec 1, 2024

That's true @sarayourfriend and I agree. I was recommending different usernames because it's closer to what's currently happening. We're already setting the DC_USER env var in the justfiles for the API and the catalog so it would be a matter of finding-and-replacing the username for both of those services.

@tejaswarathe maybe just using the same username everywhere might be better, something like "ov_user" maybe? "opener" is too informal and is a name we use to refer to ourselves so not ideal for a container username.

@openverse-bot openverse-bot moved this from 📋 Backlog to 🏗 In Progress in Openverse Backlog Dec 2, 2024
@openverse-bot openverse-bot moved this from 🏗 In Progress to ✅ Done in Openverse Backlog Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 aspect: code Concerns the software code in the repository ✨ goal: improvement Improvement to an existing user-facing feature good first issue New-contributor friendly help wanted Open to participation from the community 🟩 priority: low Low priority and doesn't need to be rushed 🧱 stack: api Related to the Django API 🧱 stack: catalog Related to the catalog and Airflow DAGs 🧱 stack: ingestion server Related to the ingestion/data refresh server 🐳 tech: docker Involves Docker
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants