Any tools and tutorials on rails and activitypub?

I recently discovered pump.io, activitypub and the concept of “federated” networks. One of my friends invited me to the network mastodon.
I realized mastodon itself is written in ruby. I’m curious, is there anyway to make our rails apps federated? I did a bit of search but I found some of those projects are discontinued. And if yes, is there any tutorials?

1 Like

there is this from last year that should be a good starting point https://blog.joinmastodon.org/2018/06/how-to-implement-a-basic-activitypub-server/

I read this, but I actually understood less by reading more :smiley:

1 Like

A post was split to a new topic: Getting Started with ActivityPub in PHP

I’ve found this document VERY helpful in planning my ruby code: https://www.w3.org/TR/activitypub/#Overview

I’ve been looking into Ruby and ActivityPub, especially the Mastodon code: it should be doable to extract some of it to the Ruby gem dedicated to AP support, but AFAIK the current code is highly dependent on Mastodon modeling and code base.

Actually there are a number of ongoing Ruby projects to support ActivityPub besides Mastodon:

mxb made a gem for Prismo:
https://rubygems.org/gems/activitypub-rails/versions/0.1.0

There’s also a dead project to support AP from Rack (which sounds like a good idea).

@RubyGoddess did you find more material since your post?

2 Likes

I’m currently working on something. It’s really a draft for now, but the goal is to create a Rails engine to bring federation to exiting Rails apps.

My roadmap is as follow:

  • Create a simple Rails app with users/actors/notes
  • Extract relevant code into an engine to work with a site with only users/notes
  • Make the engine flexible enough to support more kinds of actors and contents through configuration file.

For now, I have:

  • “Site”
    • user
    • notes CRUD
    • local actors (tied to users for now)
    • activities: a kind of log to use for outboxes and feeds later
    • distant actors, fetched via webfinger calls
    • follow actors (with manual accepts)
    • follow distant actors (without accept confirmation)
    • personal activity feed:
      • local followed actors activity
      • distant followers actors activity
    • display distant actors:
      • generic info
      • followers
      • outbox
  • Federation
    • webfinger (find and some other endpoints)
    • actor endpoint
    • inbox
    • outbox
    • followers endpoint
    • following endpoint

So for now, the app is publishing content, nothing more

In my first attempt, I wanted to be compatible with Mastodon, and I stopped that : too much overhead for a beginning, so I started again from scratch, trying to stick to the simplest ActivityPub specs.

It’s all evolving really slowly as i’m tired these days. I can publish the code on Gitlab if you’re interested.

2 Likes

Hi, are you still working on this project? I’d be interested in a git repo of the code

1 Like

The project is in standby for now; i’m waiting to see how Mastodon implements end-to-end encryption before continuing with ActivityPub.

I’ll publish the code I have this day.

… And it will be is here : https://gitlab.com/experimentslabs/experimentations/rails-activitypub-server

There’s only two branches: master and UI, which is the most up to date one.

If you want I can add to either AP Watchlist or AP Dev Watchlist, but I’ll need info on desired location, category, license and description.

That’s nice, but for now I consider it as a draft so I don’t know if it has any place in a watchlist :slight_smile: . It may be used as reference for people wanting to develop something similar.

I added an MIT license.

Reference is always good, and we have few Ruby code-related stuff. If it is usable we can add, especially if you intend to mature it further. But you can always give a heads up and I’ll add it then.

1 Like

@manu thanks a bunch! I just noticed your post now, but will look into the repo in the next days

1 Like

@manu are you still working on ActivityPub Ruby implementation?

@how Sadly, no, I don’t have much time for it now. I’m still thinking of a project in which to implement it but that’s not for now (connecting gardeners and their gardens).

On the other hand, if the demand to have a Ruby On Rail engine to add ActivityPub support to websites is high, I’d be happy to help/take part.

Actually there’s been a wishlist to implement ActivityPub support in #software:discourse for too long. This is something that we can find funding for if you’re interested.

I’ll get my hands in my two-years-old code this week, to have a status on what is left to do.

A way to fund the development would be a good way to secure some time on it, i’m open to discussion :slight_smile:

A nice thing to have is a working https://test.activitypub.dev/, or a link to the sources of it to pop an instance somewhere…

I’m updating everything

  • rails:
    • 6.1
    • 7.0
  • Gems:
    • Rubocop + fixes (neverending task :upside_down_face:)
    • Rspsec-rails-api (the gem needs some fixes) I’m on it right now
  • Node packages

Are you working on this in private or is Experiments Labs / Experimentations / Rails - activitypub server · GitLab not the place to check out your work?