a year ago
Hi, this isn't really a problem, but this SecurityWarning in the logs just irritates me and makes me feel like something is wrong. I'm running the backend with Celery and FastAPI without Docker.
1) I tried adding --uid=1000 to startCommand in railway.toml, but after that Celery doesn't start.
2) I tried to simply suppress the warning using
os.environ['C_FORCE_ROOT'] = 'true' in celery_app.py
or
C_FORCE_ROOT = "true" in railway.toml
but that didn't work either.
I'm referring to this warning:Starting Container
/opt/venv/lib/python3.12/site-packages/celery/platforms.py:829: SecurityWarning: You're running the worker with superuser privileges: this is
absolutely not recommended!
Please specify a different user using the --uid option.
User information: uid=0 euid=0 gid=0 egid=0
warnings.warn(SecurityWarning(ROOT_DISCOURAGED.format(
-------------- worker2@b4229696d121 v5.3.6 (emerald-rush)
--- ***** -----
-- ******* ---- Linux-6.1.0-25-cloud-amd64-x86_64-with-glibc2.40 2025-04-02 07:46:19
- *** --- * ---
- ** ---------- [config]
- ** ---------- .> app: aitma_worker:0x7f7d2b4f00b0
- ---------- .> transport: redis://default:@redis.railway.internal:6379//
- ---------- .> results: redis://default:@redis.railway.internal:6379/
- *** --- * --- .> concurrency: 12 (prefork)
-- ******* ---- .> task events: ON
--- ***** -----
-------------- [queues]
.> generations exchange=generations(direct) key=generations
[tasks]
. app.tasks.generation_tasks.process_generation
. app.tasks.heartbeat.check_worker_health
. app.tasks.schedule_tasks.update_average_job_times
So what can be done about this?
3 Replies
a year ago
You should be able to change the RAILWAY_RUN_UID service variable if you don't want your service to run as a super user
more info here: https://docs.railway.com/reference/variables
dev
You should be able to change the RAILWAY_RUN_UID service variable if you don't want your service to run as a super usermore info here: https://docs.railway.com/reference/variables
a year ago
I would like it so that not my entire backend service, but only Celery, would run under a different user. Is this possible? How do I do it? Sorry, I'm a newbie.
a year ago
You'll need to do a custom Dockerfile build and run the Celery processes under a different (linux) user.
Status changed to Awaiting User Response Railway • 11 months ago
7 months ago
This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!
Status changed to Solved Railway • 7 months ago