Custom front end for Mastodon
Go to file
aschmitz 97c02c3389 Make IdsToBigints (mostly!) non-blocking (#5088)
* Make IdsToBigints (mostly!) non-blocking

This pulls in GitLab's MigrationHelpers, which include code to make
column changes in ways that Postgres can do without locking. In general,
this involves creating a new column, adding an index and any foreign
keys as appropriate, adding a trigger to keep it populated alongside
the old column, and then progressively copying data over to the new
column, before removing the old column and replacing it with the new
one.

A few changes to GitLab's MigrationHelpers were necessary:

* Some changes were made to remove dependencies on other GitLab code.
* We explicitly wait for index creation before forging ahead on column
  replacements.
* We use different temporary column names, to avoid running into index
  name length limits.
* We rename the generated indices back to what they "should" be after
  replacing columns.
* We rename the generated foreign keys to use the new column names when
  we had to create them. (This allows the migration to be rolled back
  without incident.)

# Big Scary Warning

There are two things here that may trip up large instances:

1. The change for tables' "id" columns is not concurrent. In
   particular, the stream_entries table may be big, and does not
   concurrently migrate its id column. (On the other hand, x_id type
   columns are all concurrent.)
2. This migration will take a long time to run, *but it should not
   lock tables during that time* (with the exception of the "id"
   columns as described above). That means this should probably be run
   in `screen` or some other session that can be run for a long time.
   Notably, the migration will take *longer* than it would without
   these changes, but the website will still be responsive during that
   time.

These changes were tested on a relatively large statuses table (256k
entries), and the service remained responsive during the migration.
Migrations both forward and backward were tested.

* Rubocop fixes

* MigrationHelpers: Support ID columns in some cases

This doesn't work in cases where the ID column is referred to as a
foreign key by another table.

* MigrationHelpers: support foreign keys for ID cols

Note that this does not yet support foreign keys on non-primary-key
columns, but Mastodon also doesn't yet have any that we've needed to
migrate.

This means we can perform fully "concurrent" migrations to change ID
column types, and the IdsToBigints migration can happen with effectively
no downtime. (A few operations require a transaction, such as renaming
columns or deleting them, but these transactions should not block for
noticeable amounts of time.)

The algorithm for generating foreign key names has changed with this,
and therefore all of those changed in schema.rb.

* Provide status, allow for interruptions

The MigrationHelpers now allow restarting the rename of a column if it
was interrupted, by removing the old "new column" and re-starting the
process.

Along with this, they now provide status updates on the changes which
are happening, as well as indications about when the changes can be
safely interrupted (when there are at least 10 seconds estimated to be
left before copying data is complete).

The IdsToBigints migration now also sorts the columns it migrates by
size, starting with the largest tables. This should provide
administrators a worst-case scenario estimate for the length of
migrations: each successive change will get faster, giving admins a
chance to abort early on if they need to run the migration later. The
idea is that this does not force them to try to time interruptions
between smaller migrations.

* Fix column sorting in IdsToBigints

Not a significant change, but it impacts the order of columns in the
database and db/schema.rb.

* Actually pause before IdsToBigints
2017-10-02 21:28:59 +02:00
app Make IdsToBigints (mostly!) non-blocking (#5088) 2017-10-02 21:28:59 +02:00
bin Upgrade Webpacker to version 3.0.1 (#5122) 2017-09-27 14:41:54 +02:00
config l10n Update OC: reorganization pref. page (#5168) 2017-10-01 19:09:45 +02:00
db Make IdsToBigints (mostly!) non-blocking (#5088) 2017-10-02 21:28:59 +02:00
docs Fix redirect link on Tuning.md (#1595) 2017-04-12 12:40:37 +02:00
lib Make IdsToBigints (mostly!) non-blocking (#5088) 2017-10-02 21:28:59 +02:00
log Initial commit 2016-02-20 22:53:20 +01:00
nanobox [nanobox] Allow Full-size Uploads (#4123) 2017-07-09 02:52:36 +02:00
public New error page graphic. Other error page improvements (#5099) 2017-09-25 23:05:54 +02:00
spec Make Chrome splash screen same color as web UI's background color (#5169) 2017-10-02 01:23:32 +02:00
streaming Fix streaming API double-JSON-encoding status IDs for deletes (#5069) 2017-09-24 15:31:03 +02:00
vendor/assets Initial commit 2016-02-20 22:53:20 +01:00
.babelrc 🎄🔨 Force tree shake emojione (#4202) 2017-07-14 20:30:12 +02:00
.buildpacks Add heroku APT buildpack for scalingo. (#3051) 2017-05-14 12:57:13 +02:00
.codeclimate.yml Enable CodeClimate SCSS Lint checks (#2886) 2017-05-07 20:47:31 +02:00
.dockerignore Remove Storybook (#4397) 2017-07-27 22:30:27 +02:00
.editorconfig Add final newline to locale files (#2890) 2017-05-07 19:55:47 +02:00
.env.nanobox [nanobox] Add Automated Backups (#4023) 2017-07-07 00:46:45 +02:00
.env.production.sample Document REDIS_NAMESPACE (#5038) 2017-09-22 06:44:39 +02:00
.env.test Add recovery code support for two-factor auth (#1773) 2017-04-15 13:26:03 +02:00
.env.vagrant Add a default LOCAL_DOMAIN=mastodon.dev to .env.vagrant 2017-01-26 19:22:59 +11:00
.eslintignore Dev Tooling fixes (eslint/editorconfig) (#1398) 2017-04-11 00:36:03 +02:00
.eslintrc.yml Remove eslint-disable comments (#4681) 2017-08-24 12:15:36 +02:00
.foreman Replace sprockets/browserify with Webpack (#2617) 2017-05-03 02:04:16 +02:00
.gitattributes Add .gitattributes file to avoid unwanted CRLF (#3954) 2017-06-26 13:15:24 +02:00
.gitignore Generate 500.html with assets:precompile, remove loading from Google Fonts (#5067) 2017-09-25 04:04:04 +02:00
.haml-lint.yml Added haml-lint and fix warnings (#2773) 2017-05-08 03:35:25 +02:00
.nanoignore Remove Storybook (#4397) 2017-07-27 22:30:27 +02:00
.nvmrc update Node to 6.x LTS (#1228) 2017-04-15 02:05:41 +02:00
.postcssrc.yml Add object-fit polyfill for Edge (#4182) 2017-07-14 01:59:34 +02:00
.profile Add ffmpeg and dependent packages as well as LD_LIBRARY_PATHs (#3276) 2017-05-24 17:57:33 +02:00
.rspec Adding a Mention model, test stubs 2016-02-25 00:17:01 +01:00
.rubocop.yml Add handling of Linked Data Signatures in payloads (#4687) 2017-08-26 13:47:38 +02:00
.ruby-version Bump ruby version to 2.4.2 (#4958) 2017-09-18 04:55:57 +02:00
.scss-lint.yml Enable CodeClimate SCSS Lint checks (#2886) 2017-05-07 20:47:31 +02:00
.slugignore Remove Storybook (#4397) 2017-07-27 22:30:27 +02:00
.travis.yml Remove ubuntu-toolchain-r-test (#5005) 2017-09-19 05:06:27 +02:00
.yarnclean Reduce container size with clean yarn (#3506) 2017-09-30 22:05:24 +02:00
app.json Change logo URL for Heroku and Scalingo (#4476) 2017-08-01 05:59:11 +02:00
Aptfile Specify libicu explicitly in Aptfile (#4920) 2017-09-13 09:30:13 +02:00
boxfile.yml [nanobox] Minor tweaks for 1.5 (#4395) 2017-07-27 15:13:32 +02:00
Capfile remove capistrano/faster_assets from Capfile (#2737) 2017-05-03 12:14:52 +02:00
CODEOWNERS Introduce CODEOWNERS file (#4670) 2017-08-23 15:21:00 +02:00
config.ru Fix rubocop issues, introduce usage of frozen literal to improve performance 2016-11-15 16:56:29 +01:00
CONTRIBUTING.md README tidy up (#2026) 2017-04-17 21:28:31 +02:00
docker_entrypoint.sh Some Dockerfile improvements (#3182) 2017-05-20 20:01:05 +02:00
docker-compose.yml Switch docker-compose to version 3. (#2747) 2017-05-04 15:56:05 +02:00
Dockerfile Reduce container size with clean yarn (#3506) 2017-09-30 22:05:24 +02:00
Gemfile Replace self-rolled statsd instrumention with localshred/nsa (#5118) 2017-09-29 03:16:44 +02:00
Gemfile.lock Replace self-rolled statsd instrumention with localshred/nsa (#5118) 2017-09-29 03:16:44 +02:00
ISSUE_TEMPLATE.md Adds note for instance admins. (#1925) 2017-04-16 16:59:53 +02:00
LICENSE Fix #49 - License changed from GPL-2.0 to AGPL-3.0 2016-09-21 23:04:34 +02:00
package.json Upgrade to React 16 (#5119) 2017-09-30 04:29:56 +02:00
Procfile More robust PuSH subscription refreshes (#2799) 2017-05-05 02:23:01 +02:00
Procfile.dev Upgrade Webpacker to version 3.0.1 (#5122) 2017-09-27 14:41:54 +02:00
Rakefile Initial commit 2016-02-20 22:53:20 +01:00
README.md s/PubSubHubbub/WebSub/g (#4372) 2017-07-26 13:47:41 +02:00
scalingo.json Change logo URL for Heroku and Scalingo (#4476) 2017-08-01 05:59:11 +02:00
Vagrantfile Install libidn11-dev in Vagrant (#4238) 2017-07-18 00:31:43 +02:00
yarn.lock Update react-router-scroll at yarn.lock (#5154) 2017-09-30 15:50:02 +02:00

Mastodon

Build Status Code Climate

Mastodon is a free, open-source social network server. A decentralized solution to commercial platforms, it avoids the risks of a single company monopolizing your communication. Anyone can run Mastodon and participate in the social network seamlessly.

An alternative implementation of the GNU social project. Based on ActivityStreams, Webfinger, WebSub and Salmon.

Click on the screenshot to watch a demo of the UI:

Screenshot

The project focus is a clean REST API and a good user interface. Ruby on Rails is used for the back-end, while React.js and Redux are used for the dynamic front-end. A static front-end for public resources (profiles and statuses) is also provided.

If you would like, you can support the development of this project on Patreon. Alternatively, you can donate to this BTC address: 17j2g7vpgHhLuXhN4bueZFCvdxxieyRVWd

Resources

Features

  • Fully interoperable with GNU social and any OStatus platform Whatever implements Atom feeds, ActivityStreams, Salmon, WebSub and Webfinger is part of the network
  • Real-time timeline updates See the updates of people you're following appear in real-time in the UI via WebSockets
  • Federated thread resolving If someone you follow replies to a user unknown to the server, the server fetches the full thread so you can view it without leaving the UI
  • Media attachments like images and WebM Upload and view images and WebM videos attached to the updates
  • OAuth2 and a straightforward REST API Mastodon acts as an OAuth2 provider so 3rd party apps can use the API, which is RESTful and simple
  • Background processing for long-running tasks Mastodon tries to be as fast and responsive as possible, so all long-running tasks that can be delegated to background processing, are
  • Deployable via Docker You don't need to mess with dependencies and configuration if you want to try Mastodon, if you have Docker and Docker Compose the deployment is extremely easy

Development

Please follow the development guide from the documentation repository.

Deployment

There are guides in the documentation repository for deploying on various platforms.

Contributing

You can open issues for bugs you've found or features you think are missing. You can also submit pull requests to this repository. Here are the guidelines for code contributions

IRC channel: #mastodon on irc.freenode.net

Extra credits

  • The Emoji One pack has been used for the emojis
  • The error page image courtesy of Dopatwo

Mastodon error image