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

Merged
3wordchant merged 2 commits from escuela-comun/mastodon:fix/character-limit-run-as-mastodon into main 2026-11-27 03:12:40 +00:00
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
3wordchant added 1 commit 2026-11-27 03:12:33 +00:00
Merge branch 'main' into fix/character-limit-run-as-mastodon
continuous-integration/drone/pr Build is failing
4c95890dc2
3wordchant merged commit 2577a92c50 into main 2026-11-27 03:12:40 +00:00
Owner

¡En mi ordenador funciona!

¡En mi ordenador funciona!
Sign in to join this conversation.