GuixSD: mastodon. An experiment in theoretic packaging. (very early draft/thoughtcollection)

Today we are going to “package” Mastodon, as requested. Or at least document the theory before being put to practice (I actually lack the resources to run a public test node).

Requirement

We are going the “No Docker” route here first:

  • NodeJS
  • imagemagick
  • ffmpeg
  • libpq-dev
  • libxml2-dev
  • libxslt1-dev
  • nodejs
  • file
  • git
  • curl
  • curl -sL https://deb.nodesource.com/setup_4.x | sudo bash –
  • sudo apt-get install nodejs
  • sudo npm install -g yarn
  • sudo apt-get install redis-server redis-tools
  • sudo apt-get install postgresql postgresql-contrib
  • pidentd
  • git (to check out the source)
  • It is recommended to install “rbenv”. I’m not a ruby hacker, but I’m pretty sure with Guix if we manage to roll out a package for mastodon, we don’t need this:

    Use rbenv to pick a Ruby version for your application and guarantee that your development environment matches production. Put rbenv to work with Bundler for painless Ruby upgrades and bulletproof deployments.

    as Guix can use all kinds of versions in parallel.
    It is suggested to roll with ruby 2.4.1

  • gem install bundler
  • bundle install –deployment –without development test
  • yarn install

Missing packages in Guix: pidentd, node 4.x. We do have node 6.x though and 4.x (in theory) is only a matter of getting back to it.

Setup

And set up the database for the first time, this will create the tables and basic data:
RAILS_ENV=production bundle exec rails db:setup
Finally, pre-compile all CSS and JavaScript files:
RAILS_ENV=production bundle exec rails assets:precompile

Breaking up the language specific requirements

(as this is the Guix way, unbundling where possible)
gem ‘pkg-config’
gem ‘rails’, ‘~> 5.0.2’
gem ‘sass-rails’, ‘~> 5.0’
gem ‘uglifier’, ‘>= 1.3.0’
gem ‘jquery-rails’
gem ‘puma’
gem ‘hamlit-rails’
gem ‘pg’
gem ‘pghero’
gem ‘dotenv-rails’
gem ‘font-awesome-rails’
gem ‘best_in_place’, ‘~> 3.0.1’
gem ‘paperclip’, ‘~> 5.1’
gem ‘paperclip-av-transcoder’
gem ‘aws-sdk’, ‘>= 2.0’
gem ‘addressable’
gem ‘devise’
gem ‘devise-two-factor’
gem ‘doorkeeper’
gem ‘fast_blank’
gem ‘goldfinger’
gem ‘hiredis’
gem ‘htmlentities’
gem ‘http’
gem ‘http_accept_language’
gem ‘httplog’
gem ‘kaminari’
gem ‘link_header’
gem ‘nokogiri’
gem ‘oj’
gem ‘ostatus2’, ‘~> 1.1’
gem ‘ox’
gem ‘rabl’
gem ‘rack-attack’
gem ‘rack-cors’, require: ‘rack/cors’
gem ‘rack-timeout’
gem ‘rails-i18n’
gem ‘rails-settings-cached’
gem ‘redis’, ‘~>3.2’, require: [‘redis’, ‘redis/connection/hiredis’]
gem ‘rqrcode’
gem ‘ruby-oembed’, require: ‘oembed’
gem ‘sidekiq’
gem ‘sidekiq-unique-jobs’
gem ‘simple-navigation’
gem ‘simple_form’
gem ‘sprockets-rails’, :require => ‘sprockets/railtie’
gem ‘statsd-instrument’
gem ‘twitter-text’
gem ‘tzinfo-data’
gem ‘whatlanguage’
gem ‘react-rails’
gem ‘browserify-rails’
gem ‘autoprefixer-rails’
gem ‘rails_12factor’
gem ‘redis-rails’
gem ‘lograge’

Most of these gems and their dependencies are not available. So it’s mostly a matter of spending time to package gems.

For npm / nodejs the current recommendation seems to be: Give up, just embed a large binary blob for each direct dependency.

Conclusion

1. Packaging mastodon is not trivial.
2. Packaging the gems: I stopped setting deadlines in packaging, but my first impression is that it will take long.
3. The other effort will be to get the npm build system merged or get enough info so that we can rebase and use a branch based on jelle’s GSoC branch. Get more info on the state of it, etc.

Credits

Catonano

Flattr this!