Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While Docker isn't officially supported by Hometown, leaving the Mastodon 3.5.5 Docker configuration in place with the new 4.0.2 code is a bad idea. At minimum, you'll have a stale Node install that's months behind on security updates. There are some minor tweaks to the default configuration, but they're flagged by comments so they're easy to revert or modify as necessary.
Running Hometown on Docker
I'll by typing up my own longer blog post in due time, but there's no harm dropping a cheat sheet here. By following this outline, I was able to upgrade a Hometown 1.0.8 install to 1.1.0 with nothing worse than a minute or two of downtime.
My configuration uses the GitHub repository as its source, rather than images drawn from DockerHub. I like to tweak and fiddle with my setup, especially the themes, and I'm happy to sacrifice some disk space for the privilege.
Installing from Scratch
This is by far the easiest approach, you just follow one of the existing guides for running Mastodon via Docker, pause after you've set up
.env.production
, add any Hometown-specific features to it as per the Wiki, then resume what the guide says to do.If you're enabling ElastiSearch, the second of the two guides has some additional actions you'll need to do, plus be aware of this bug in Mastodon which can quietly block ES from working at all.
Upgrading from Hometown 1.0.8
Here's how I accomplished this. I committed any leftover changes, then ran these commands from the non-Docker instructions in the root of my local Hometown repository:
This "wiped out" my customizations, but as I committed them all to a branch I can reconstruct them later via diffs. I then ran:
to build the new image. The old image will continue running in the background, as per usual. I like adding
2>&1 | less
to the end and mashingPgDn
, as if a compilation error happens it almost invariably requires scrolling back a few screens to find the issue.If the build succeeded, we're almost clear to start the dangerous portion. If you're running on the cloud, now would be a great time to take a snapshot. Whatever the case, you should back up the existing database. If you haven't changed the defaults from the Dockerfile, then
should do the trick. If you have changed the defaults, you may need to use
sudo docker ps
to figure out the name of the PostgreSQL image to swap in place of "hometown_db_1", then browse through.env.production
to extract the username to place after-U
and the database name to place after-Fc
. The Hometown docs don't say how to restore the database should the process go South, but after reading a manpage or two I think the magic words are roughlyNow we're ready for the scary "you could destroy everything" part. All the earlier commands are trivial to roll back, but after this point any delay could cause data corruption. As per the Hometown docs, run the pre-deployment database migrations.
where
web
is the name of the webserver image indocker-compose.yml
. The docs state you should precompile all assets next, but I'm 95% sure they were already built when you ransudo docker-compose build
. If you're paranoid and want to be absolutely sure precompilation is done, then at this stage run:Here, the Hometown docs say you should run the post-deployment migrations. In Docker-ese:
Finally, we need to stop the old images and spin up the new ones. Run:
and give Docker some time to finish rotating. A quick
sudo docker ps
should confirm the new images are booting up, and in a short while (10-15 seconds for the teeny-tiny instance I manage) you should be back to fully functional.