drdaeman, (edited )
@drdaeman@lemmy.zhukov.al avatar

I don’t mean to discourage you - this is a good hack. But as a seasoned code monkey, I see a few things that can be possibly improved so they will have less chances of biting you in the future. Please feel free to disregard this, of course.

s/500/…/g

This is a bit overbroad, as it replaces any “500” in those files. It works now, as this is probably only occurrence is the limit you want to tweak, but it’s a crude approach that may inadvertently break at any moment.

docker exec

Those changes are ephemeral and won’t survive if container is re-created for any reason (unless /opt/mastodon is a volume - I guess this is how it survives docker container restart?). I would rather recommend building your own custom image. Start by making a patch file:

<pre style="background-color:#ffffff;">
<span style="color:#323232;">docker run -it --rm -user root <mastodon image> bash
</span><span style="color:#323232;">cp -r /opt/mastodon /opt/mastodon.vanilla
</span><span style="color:#323232;">sed <your-updates-here> # or you can run vi or nano or any other editor
</span><span style="color:#323232;">diff -urN /opt/mastodon.vanilla /opt/mastodon
</span><span style="color:#323232;">exit
</span>

Take diff’s output, save it to fix-limits.patch in a new empty directory, then write a brief Dockerfile next to it, that goes like this:

<pre style="background-color:#ffffff;">
<span style="color:#323232;">FROM <base-mastodon-image>
</span><span style="color:#323232;">COPY fix-limits.patch ./
</span><span style="color:#323232;">RUN patch -p2 fix-limits.patch
</span>

And finally run docker build -t my-mastodon . and use my-mastodon as a replacement image. This will ensure your changes will persist, plus you’ll have a proper patch file that you can use with any version (point is, it will warn you if something would change in a way that the patch would no longer apply cleanly).

I’m writing this on a phone, from scratch, without any testing, so you may need to tweak things a little bit. E.g. I’m not sure what’s the WORKDIR in the base image - just assuming its /opt/mastodon (which it probably is), but you may need to edit the COPY command’s second argument and/or -p parameter to patch.> docker container restart

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • wartaberita
  • uselessserver093
  • Food
  • aaaaaaacccccccce
  • [email protected]
  • test
  • CafeMeta
  • testmag
  • MUD
  • RhythmGameZone
  • RSS
  • dabs
  • TheResearchGuardian
  • Ask_kbincafe
  • KbinCafe
  • Testmaggi
  • Socialism
  • feritale
  • oklahoma
  • SuperSentai
  • KamenRider
  • All magazines