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

User names inconsistent between core and contrib #606

Open
mowies opened this issue Jul 23, 2024 · 5 comments
Open

User names inconsistent between core and contrib #606

mowies opened this issue Jul 23, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@mowies
Copy link
Member

mowies commented Jul 23, 2024

I just noticed that the user names for the linux services for otelcol and otelcol-contrib are not consistently named.

distro username
otelcol otel
otelcol-contrib otelcol-contrib
@dosubot dosubot bot added the bug Something isn't working label Jul 23, 2024
Copy link

dosubot bot commented Jul 23, 2024

Привет, @mowies! Я здесь, чтобы помочь вам решить проблему. Я бот, который может помочь вам исправить ошибки, ответить на вопросы и стать участником.

To standardize the usernames for the otelcol and otelcol-contrib services across different distributions, you can ensure that both services use the same User and Group settings in their respective service files. For example, if you decide to use otel as the username, the service files should look like this:

For otelcol:

[Unit]
Description=OpenTelemetry Collector
After=network.target

[Service]
EnvironmentFile=/etc/otelcol/otelcol.conf
ExecStart=/usr/bin/otelcol $OTELCOL_OPTIONS
KillMode=mixed
Restart=on-failure
Type=simple
User=otel
Group=otel

[Install]
WantedBy=multi-user.target

For otelcol-contrib:

[Unit]
Description=OpenTelemetry Collector Contrib
After=network.target

[Service]
EnvironmentFile=/etc/otelcol-contrib/otelcol-contrib.conf
ExecStart=/usr/bin/otelcol-contrib $OTELCOL_CONTRIB_OPTIONS
KillMode=mixed
Restart=on-failure
Type=simple
User=otel
Group=otel

[Install]
WantedBy=multi-user.target

Additionally, in the Dockerfile for otelcol-contrib, you can set the user to otel by using the USER directive with a specific UID. For example:

FROM alpine:3.19 as certs
RUN apk --update add ca-certificates

FROM scratch

ARG USER_UID=10001
USER ${USER_UID}

COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --chmod=755 otelcol-contrib /otelcol-contrib
COPY config.yaml /etc/otelcol-contrib/config.yaml
ENTRYPOINT ["/otelcol-contrib"]
CMD ["--config", "/etc/otelcol-contrib/config.yaml"]
EXPOSE 4317 55678 55679

By setting User=otel and Group=otel in both service files and ensuring the Dockerfile uses a consistent UID, you can standardize the usernames across different distributions [1][2].

To continue talking to Dosu, mention @dosu.

@jpkrohling
Copy link
Member

I believe this is a bug :-)

@mowies
Copy link
Member Author

mowies commented Jul 24, 2024

Changing the username sounds like a potentially breaking change to me. Do I need to keep anything in mind while fixing this?

@jpkrohling
Copy link
Member

I can't think of anything important other than taking care of the files created by the previous user, like the persistent sending queue files.

@mowies
Copy link
Member Author

mowies commented Jul 29, 2024

i guess this is a duplicate of #417

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants