• Stars
    star
    142
  • Rank 249,430 (Top 6 %)
  • Language Mustache
  • License
    GNU Affero Genera...
  • Created over 1 year ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Helm chart for Mastodon deployment in Kubernetes

Introduction

This is a Helm chart for installing Mastodon into a Kubernetes cluster. The basic usage is:

  1. edit values.yaml or create a separate yaml file for custom values
  2. helm dep update
  3. helm install --namespace mastodon --create-namespace my-mastodon ./ -f path/to/additional/values.yaml

This chart is tested with k8s 1.21+ and helm 3.6.0+.

Configuration

The variables that must be configured are:

  • password and keys in the mastodon.secrets, postgresql, and redis groups; if left blank, some of those values will be autogenerated, but will not persist across upgrades.

  • SMTP settings for your mailer in the mastodon.smtp group.

If your PersistentVolumeClaim is ReadWriteOnce and you're unable to use a S3-compatible service or run a self-hosted compatible service like Minio then you need to set the pod affinity so the web and sidekiq pods are scheduled to the same node.

Example configuration:

podAffinity:
  requiredDuringSchedulingIgnoredDuringExecution:
    - labelSelector:
        matchExpressions:
          - key: app.kubernetes.io/part-of
            operator: In
            values:
              - rails
      topologyKey: kubernetes.io/hostname

Administration

You can run admin CLI commands in the web deployment.

kubectl -n mastodon exec -it deployment/mastodon-web -- bash
tootctl accounts modify admin --reset-password

or

kubectl -n mastodon exec -it deployment/mastodon-web -- tootctl accounts modify admin --reset-password

Missing features

Currently this chart does not support:

  • Hidden services
  • Swift

Upgrading

Because database migrations are managed as a Job separate from the Rails and Sidekiq deployments, it’s possible they will occur in the wrong order. After upgrading Mastodon versions, it may sometimes be necessary to manually delete the Rails and Sidekiq pods so that they are recreated against the latest migration.

Upgrades in 2.1.0

ingressClassName and tls-acme changes

The annotations previously defaulting to nginx have been removed and support for ingressClassName has been added.

ingress:
  annotations:
    kubernetes.io/ingress.class: nginx
    kubernetes.io/tls-acme: "true"

To restore the old functionality simply add the above snippet to your values.yaml, but the recommendation is to replace these with ingress.ingressClassName and use cert-manager's issuer/cluster-issuer instead of tls-acme. If you're uncertain about your current setup leave ingressClassName empty and add kubernetes.io/tls-acme to ingress.annotations in your values.yaml.

Upgrades in 2.0.0

Fixed labels

Because of the changes in #19706 the upgrade may fail with the following error: Error: UPGRADE FAILED: cannot patch "mastodon-sidekiq"

If you want an easy upgrade and you're comfortable with some downtime then simply delete the -sidekiq, -web, and -streaming Deployments manually.

If you require a no-downtime upgrade then:

  1. run helm template instead of helm upgrade
  2. Copy the new -web and -streaming services into services.yml
  3. Copy the new -web and -streaming deployments into deployments.yml
  4. Append -temp to the name of each deployment in deployments.yml
  5. kubectl apply -f deployments.yml then wait until all pods are ready
  6. kubectl apply -f services.yml
  7. Delete the old -sidekiq, -web, and -streaming deployments manually
  8. helm upgrade like normal
  9. kubectl delete -f deployments.yml to clear out the temporary deployments

PostgreSQL passwords

If you've previously installed the chart and you're having problems with postgres not accepting your password then make sure to set username to postgres and password and postgresPassword to the same passwords.

postgresql:
  auth:
    username: postgres
    password: <same password>
    postgresPassword: <same password>

And make sure to set password to the same value as postgres-password in your mastodon-postgresql secret: kubectl edit secret mastodon-postgresql

More Repositories

1

mastodon

Your self-hosted, globally interconnected microblogging community
Ruby
45,816
star
2

mastodon-ios

Official iOS app for Mastodon
Swift
1,965
star
3

documentation

Mastodon documentation
SCSS
1,688
star
4

mastodon-android

Official Android app for Mastodon
Java
1,583
star
5

joinmastodon

The official Mastodon project homepage
TypeScript
230
star
6

mastodon-api

A ruby interface for the Mastodon API
Ruby
167
star
7

mastodon-ansible

Ansible playbook for installing Mastodon
Jinja
158
star
8

mastodon-native

Mobile Mastodon app using React Native
JavaScript
97
star
9

flodgatt

A blazingly fast drop-in replacement for the Mastodon streaming API server
Rust
86
star
10

mastodon-bridge

Moved to https://source.joinmastodon.org/mastodon/bridge
Ruby
62
star
11

blog

The official Mastodon blog
HTML
35
star
12

omniauth-mastodon

OmniAuth strategy for Mastodon
Ruby
34
star
13

ostatus2

A Ruby toolset for interacting with the OStatus suite of protocols
Ruby
32
star
14

goldfinger

A Webfinger utility for Ruby
Ruby
31
star
15

gamo

An image proxy and optimization server
Go
26
star
16

mastodon-vagrant-box

A Vagrant base box for Mastodon
Shell
19
star
17

webpush-fcm-relay

Relay encrypted WebPush notifications to Firebase Cloud Messaging.
Go
11
star
18

packer

Build automation for DigitalOcean 1-click Install Image
Shell
8
star
19

terraform-fastly-service

Terraform module for more easily defining a Fastly service, following Mastodon common use cases.
VCL
4
star
20

terraform-hetzner-k8s-kubeone

Terraform module for deploying kubernetes clusters in Hetzner Cloud.
HCL
4
star
21

terraform-fastly-files-service

Terraform module for creating a fastly service for Mastodon's files backend
HCL
3
star
22

terraform-fastly-joinmastodon

Terraform module for setting up fastly services that make up the joinmastodon.org domain
HCL
2
star
23

.github

Mastodon org-level files
2
star
24

fastly-globeviz-data

Backend server for Fastly Globeviz app (https://dev.to/fastly/visualize-your-fastly-traffic-on-a-real-time-globe-using-glitch-9di)
Go
2
star
25

helm-charts

Smarty
2
star
26

terraform-hetzner-ssh

Terraform module for managing SSH keys in Hetzner Cloud
HCL
1
star