Skip to content

Commit

Permalink
Make small updates to the Mastodon guides
Browse files Browse the repository at this point in the history
  • Loading branch information
renatolond committed Jan 31, 2019
1 parent ad72730 commit 1be00d3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 19 deletions.
28 changes: 15 additions & 13 deletions _posts/2018-07-13-running-a-mastodon-instance-using-archlinux.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ tags:
- Linux
---

It's been a while now that I've been running [masto.donte.com.br](https://masto.donte.com.br){:target="_blank"} using Arch Linux and since the [official guide](https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Production-guide.md){:target="_blank"} recommends using Ubuntu 16.04, I figured that describing what I did could help someone out there. If in doubt, use the official guide instructions instead, since they're more likely to be up to date.
It's been a while now that I've been running [masto.donte.com.br](https://masto.donte.com.br){:target="_blank"} using Arch Linux and since the [official guide](https://docs.joinmastodon.org/administration/installation/){:target="_blank"} recommends using Ubuntu 18.04, I figured that describing what I did could help someone out there. If in doubt, use the official guide instructions instead, since they're more likely to be up to date.

*This was last updated on 31st of January, 2019.*

<h2>Notes about some choices made in this guide</h2>

Expand Down Expand Up @@ -276,7 +278,7 @@ server {
}
```

⚠️ It's a good idea to take a look if something changed in relation to the [official guide](https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Production-guide.md#nginx-configuration){:target="_blank"} ⚠️
⚠️ It's a good idea to take a look if something changed in relation to the [official guide](https://docs.joinmastodon.org/administration/installation/#setting-up-nginx){:target="_blank"} ⚠️

At this point `nginx` still doesn't know about our instance (because we're including files from `/etc/nginx/sites-enabled` and we created the file in `/etc/nginx/sites-available`), however, we should be able to start `nginx` already.

Expand Down Expand Up @@ -468,7 +470,7 @@ source /home/mastodon/.rvm/scripts/rvm
With `rvm` installed, we can then install the ruby version that Mastodon uses:

```
rvm install 2.5.1 -C --with-jemalloc
rvm install 2.6.1 -C --with-jemalloc
```

Note that the `-C --with-jemalloc` parameter is there so that we use jemalloc instead the standard memory allocation library, since it's more efficient in Mastodon's case. Now, this will take some time, drink some water, stretch and come back.
Expand Down Expand Up @@ -519,14 +521,14 @@ git clone https://github.com/tootsuite/mastodon.git live

Now, it's highly recommended to run a stable release. Why? Stable releases are bundles of finished features, if you're running an instance for day-to-day use, they are the most recommended for being the less likely to have breaking bugs.

The stable release is the latest on [tootsuite's releases](https://github.com/tootsuite/mastodon/releases/){:target="_blank"} without any "rc". At the time of writing the latest one is `v2.4.5`.
The stable release is the latest on [tootsuite's releases](https://github.com/tootsuite/mastodon/releases/){:target="_blank"} without any "rc". At the time of writing the latest one is `v2.7.1`.
With that in mind, we will do:

```
# Change directory to ~/live
cd ~/live
# Checkout to the latest stable branch
git checkout v2.4.5
git checkout v2.7.1
```

And then, we will install the dependencies of the project:
Expand Down Expand Up @@ -641,7 +643,7 @@ Other subfolders will also be readable by other users if they know what to searc

### Mastodon systemd service files

Now, you can go back to your user and we'll create service files for Mastodon. You again should compare with the [official guide](https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Production-guide.md#mastodon-systemd-service-files){:target="_blank"} to see if something changed, but have in mind that since we're using `rvm` and `nvm` in this guide the final result will be a bit different.
Now, you can go back to your user and we'll create service files for Mastodon. You again should compare with the [official guide](https://docs.joinmastodon.org/administration/installation/#setting-up-systemd-services){:target="_blank"} to see if something changed, but have in mind that since we're using `rvm` and `nvm` in this guide the final result will be a bit different.

This is what our services will look like, first the one in `/etc/systemd/system/mastodon-web.service`, responsible for Mastodon's frontend and API:

Expand Down Expand Up @@ -805,7 +807,7 @@ sudo systemctl enable certbot.timer

### Updating between Mastodon versions

Okay, you set it all up, everything is running and then Mastodon `v2.5.0` comes out. What do you do?
Okay, you set it all up, everything is running and then Mastodon `v2.8.0` comes out. What do you do?

Do not despair, dear reader, all is well.

Expand All @@ -821,22 +823,22 @@ Okay, first things first, let's go into the live directory and get the new versi
```
cd ~/live
git fetch origin --tags
git checkout v2.5.0
git checkout v2.8.0
cd . # This is to force rvm to check if we're in the right ruby version
```

Now, suppose the ruby version changed, since the last time you were here and instead of `2.5.1` is now `2.5.2`. After you do `cd .`, rvm will complain:
Now, suppose the ruby version changed, since the last time you were here and instead of `2.6.1` is now `2.6.2`. After you do `cd .`, rvm will complain:

```
$ cd .
Required ruby-2.5.2 is not installed.
To install do: 'rvm install "ruby-2.5.2"'
Required ruby-2.6.2 is not installed.
To install do: 'rvm install "ruby-2.6.2"'
```

In this case, we will need to use rvm to install the new version. The command is the same as last time:

```
rvm install 2.5.2 -C --with-jemalloc
rvm install 2.6.2 -C --with-jemalloc
```

Everything will take some time and at the end you will be ready to follow through. Notice that this won't happen very often. Also, after you make sure everything is running as expected, you can remove the old ruby version with `rvm remove <version>`. Wait for you to be sure that the new version is running, though!
Expand Down Expand Up @@ -894,7 +896,7 @@ bundle pristine

This will take a little while but will recompile needed gems. When in doubt, do that after a system upgrade.

I had issues in the past with gems that Mastodon uses which have native extensions and are being installed straight from git, namely `posix-spawn` and `http_parser.rb`. They were not reinstalled with `bundle pristine` and I had to manually rebuild them. To do that, find where they are installed doing:
I had issues in the past with gems that Mastodon uses which have native extensions and are being installed straight from git, namely `posix-spawn` and `http_parser.rb`. They were not reinstalled with `bundle pristine` and I had to manually rebuild them. This seems to fixed in the most recent rvm, but in case you need to do that, find where they are installed doing:

```
bundle show posix-spawn
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ There is also an {% external_link {"text": "official guide to setting up your en

This guide is focused on Mastodon, but most of the setup done here will work for other ruby on rails projects you might want to contribute to.

*This was last updated on 31st of January, 2019.*

---

<h3>Note on the choices made in this guide</h3>
Expand Down Expand Up @@ -64,7 +66,7 @@ From the official guide:
When trying to fix a bug or implement a new feature, it is a good idea to branch off the `master` branch with a new branch and then submit your pull request using that branch.

A good way to see that your environment is working as it should is to check out the latest stable release (for instance, at the time of writing the latest stable release is `v2.4.3`) and then run tests as suggested in the [tests](#tests) session. They should all pass because the tests in stable releases should always be working.
A good way to see that your environment is working as it should is to check out the latest stable release (for instance, at the time of writing the latest stable release is `v2.7.1`) and then run tests as suggested in the [tests](#tests) session. They should all pass because the tests in stable releases should always be working.

---

Expand Down Expand Up @@ -156,7 +158,7 @@ source $HOME/.rvm/scripts/rvm
With `rvm` installed, we can then install the ruby version that Mastodon uses:

```
rvm install 2.5.1
rvm install 2.6.1
```

Now, this will take some time, drink some water, stretch and come back.
Expand Down Expand Up @@ -320,18 +322,18 @@ ActiveRecord::PendingMigrationError - Migrations are pending. To resolve this is

This will appear on your console, but also on your browser.

If the ruby being used in the project is updated, you will also see some complaints from rvm (in this example, with a hypothetical ruby 2.5.2):
If the ruby being used in the project is updated, you will also see some complaints from rvm (in this example, with a hypothetical ruby 2.6.2):

```
$ cd .
Required ruby-2.5.2 is not installed.
To install do: 'rvm install "ruby-2.5.2"'
Required ruby-2.6.2 is not installed.
To install do: 'rvm install "ruby-2.6.2"'
```

In that case we need to do the same as we did to install it the first time, that is:

```
rvm install 2.5.2
rvm install 2.6.2
```

And since rvm manages gems by ruby version, you'll need to install the dependencies again using `bundle install`.
Expand Down

0 comments on commit 1be00d3

Please sign in to comment.