fix: run Mastodon app as mastodon user with character limit override #64

Open
ChasquiLabo wants to merge 1 commits from escuela-comun/mastodon:fix/character-limit-run-as-mastodon into main
First-time contributor

The issue comes from compose.character-limit.yml.

The app service needs to start as root in order to apply the sed
changes for the custom character limit. However, the current command:

su -c "RAILS_ENV=production bundle exec rails s -p 3000"

also leaves Rails/Puma running as root.
As a result, uploaded media files can be created as root:root, while
Sidekiq runs as the mastodon user (991:991). This causes video
post-processing to fail because Sidekiq cannot correctly process some
of the generated media files.
This changes the final command to:

exec su -s /bin/sh -c \
  "RAILS_ENV=production bundle exec rails s -p 3000" \
  mastodon

The container can still perform the initial setup as root, but
Rails/Puma then runs as mastodon.
Tested on a real Co-op Cloud Mastodon deployment with Mastodon 4.5.18.
After the change:

  • Rails/Puma runs as mastodon
  • media files are created with compatible ownership
  • Sidekiq can process uploaded videos correctly
  • video uploads work again

Related to #63.
Fix made with LLM Chatgpt

The issue comes from `compose.character-limit.yml`. The `app` service needs to start as `root` in order to apply the `sed` changes for the custom character limit. However, the current command: ```sh su -c "RAILS_ENV=production bundle exec rails s -p 3000" ``` also leaves Rails/Puma running as root. As a result, uploaded media files can be created as root:root, while Sidekiq runs as the mastodon user (991:991). This causes video post-processing to fail because Sidekiq cannot correctly process some of the generated media files. This changes the final command to: ```sh exec su -s /bin/sh -c \ "RAILS_ENV=production bundle exec rails s -p 3000" \ mastodon ``` The container can still perform the initial setup as root, but Rails/Puma then runs as mastodon. Tested on a real Co-op Cloud Mastodon deployment with Mastodon 4.5.18. After the change: - Rails/Puma runs as mastodon - media files are created with compatible ownership - Sidekiq can process uploaded videos correctly - video uploads work again Related to #63. Fix made with LLM Chatgpt
ChasquiLabo added 1 commit 2026-09-29 18:31:10 +00:00
Some required checks failed
continuous-integration/drone/pr Build is failing
You are not authorized to merge this pull request.
This pull request can be merged automatically.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u https://git.coopcloud.tech/escuela-comun/mastodon fix/character-limit-run-as-mastodon:escuela-comun-fix/character-limit-run-as-mastodon
git checkout escuela-comun-fix/character-limit-run-as-mastodon
Sign in to join this conversation.