Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Darkly)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Uncategorized
  3. That’s a great idea.

That’s a great idea.

Scheduled Pinned Locked Moved Uncategorized
1 Posts 1 Posters 0 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • KrakenA This user is from outside of this forum
    KrakenA This user is from outside of this forum
    Kraken
    wrote last edited by
    #1

    That’s a great idea. English is the universal language for sysadmins, and having this documented will help anyone running Mastodon on Coolify or Docker Compose.

    Here is the professional documentation with clear comments and logic.

    ---

    # 📑 Guide: Changing Mastodon Character Limit (Docker/Coolify) Without Forking

    This method allows you to increase the character limit (e.g., from 500 to 7500) while keeping your instance on the **official** Mastodon Docker images. This ensures easy updates and prevents the "merge hell" of custom forks.

    ### 1. Prepare Modified Files on the Host

    Instead of editing files inside the container (which are wiped on every update), we create local copies on your server (e.g., in `/root/`).

    #### A. Backend Validator (`/root/status_length_validator.rb`)

    Change the `MAX_CHARS` constant to your desired limit.

    ```ruby
    # frozen_string_literal: true
    class StatusLengthValidator < ActiveModel::Validator
    MAX_CHARS = 7500 # Set your limit here
    URL_PLACEHOLDER_CHARS = 23
    URL_PLACEHOLDER = 'x' * 23
    # ... (keep the rest of the file as is)

    ```

    #### B. Frontend Container (`/root/compose_form_container.js`)

    Locate the line where the frontend fetches the character limit and set the fallback value to match your limit.

    ```javascript
    // Search for 'max_characters' and change the fallback 500 to 7500
    maxChars: state.getIn(['server', 'server', 'configuration', 'statuses', 'max_characters'], 7500),

    ```

    ---

    ### 2. Update Docker Compose Configuration

    In **Coolify** (or your `docker-compose.yml`), modify the **web** service. We use **Volumes** to "overlay" our custom files onto the container's filesystem.

    ```yaml
    web:
    image: 'tootsuite/mastodon:v4.5.5'
    # 1. Environment Variables: Tell the API to report the new limit
    environment:
    - MAX_TOOT_CHARS=7500
    - MAX_STATUS_CHARS=7500
    # 2. Volume Mounts: Inject the modified files
    volumes:
    - 'mastodon_system:/opt/mastodon/public/system'
    - '/root/status_length_validator.rb:/opt/mastodon/app/validators/status_length_validator.rb'
    - '/root/compose_form_container.js:/opt/mastodon/app/javascript/mastodon/features/compose/containers/compose_form_container.js'

    ```

    ---

    ### 3. Why This Works (v4.3+ Logic)

    Modern Mastodon versions (v4.3, v4.4, v4.5+) are more dynamic:

    * **Environment Variables**: Setting `MAX_TOOT_CHARS` forces the `/api/v1/instance` endpoint to report the new limit. Mobile apps (like Tusky or Ivory) read this and unlock the limit automatically.
    * **Volumes**: Overlaying the Ruby file ensures the backend validates the length correctly. Overlaying the JS file ensures the web interface doesn't block the "Publish" button at 500 characters.

    ---

    ### 4. Apply and Verify

    1. **Save** the configuration in Coolify.
    2. **Redeploy**: A simple restart is not enough; a redeploy is required to create the new volume mounts.
    3. **Clear Browser Cache**: Use **Ctrl + F5** to ensure the new JavaScript is loaded.

    #### Verification

    To confirm the server is broadcasting the new limit, visit:
    `https://your-domain.com/api/v1/instance`

    Search for `"max_characters": 7500`. If you see it, the backend, frontend, and mobile apps are all synced.

    ---

    ### 💡 Why this is better than a Fork:

    * ✅ **Update-proof**: When a new Mastodon version is released, just click "Update" in Coolify. Your custom volumes will stay in place.
    * ✅ **No Build Time**: You don't have to wait hours for a custom Docker image to build.
    * ✅ **Clean**: You stay on the official security-patched images.

    ---

    **Is there anything else you'd like to add to this documentation, or maybe another part of Mastodon you want to optimize?**

    1 Reply Last reply
    1
    0
    • R ActivityRelay shared this topic
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    Powered by NodeBB Contributors
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups