Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get a Mastodon instance running #290

Closed
simonw opened this issue Nov 2, 2022 · 25 comments
Closed

Get a Mastodon instance running #290

simonw opened this issue Nov 2, 2022 · 25 comments

Comments

@simonw
Copy link
Owner

simonw commented Nov 2, 2022

@simonw
Copy link
Owner Author

simonw commented Nov 2, 2022

OK, I got an account on masto.host and set up a CNAME in Cloudflare:

CleanShot 2022-11-02 at 14 35 44@2x

https://fedi.simonwillison.net/ is live now!

I'll have to jump through some extra hoops to get simonwillison.net working. I think I'll follow Andrew's method: https://aeracode.org/2022/11/01/fediverse-custom-domains/

@simonw
Copy link
Owner Author

simonw commented Nov 2, 2022

I created an account manually through the welcome screen there, then used this interface to set myself as an administrator:

https://my.masto.host/hosting -> find "Change User Role"

CleanShot 2022-11-02 at 14 43 08@2x

@simonw
Copy link
Owner Author

simonw commented Nov 2, 2022

Looks like that unlocked this interface for me: https://fedi.simonwillison.net/admin/dashboard

@simonw
Copy link
Owner Author

simonw commented Nov 2, 2022

Changing https://fedi.simonwillison.net/admin/settings/edit a bit - only I can sign up for starters.

CleanShot 2022-11-02 at 14 46 38@2x

Bit annoyed that "business email" is required and gets shown publicly on https://fedi.simonwillison.net/about/more

I'm going to create a throwaway email address for that using icloud.

@simonw
Copy link
Owner Author

simonw commented Nov 2, 2022

Playing with the API - I could automate posting TILs to it.

https://fedi.simonwillison.net/settings/applications/new

image

image

https://fedi.simonwillison.net/settings/applications/2

Gives me:

CleanShot 2022-11-02 at 14 53 02@2x

@simonw
Copy link
Owner Author

simonw commented Nov 2, 2022

I'm following Andrew and Jacob but their content isn't showing up yet in my instance. Caching issue?

@simonw
Copy link
Owner Author

simonw commented Nov 2, 2022

@simonw
Copy link
Owner Author

simonw commented Nov 2, 2022

I want to publish my blog content and TILs to it automatically.

https://github.com/edsu/feediverse looks like an easy way to do that.

@simonw
Copy link
Owner Author

simonw commented Nov 2, 2022

That script didn't work for me... on digging around I spotted this error by adding more prints to it:

feed obj is {'bozo': True, 'entries': [], 'feed': {}, 'headers': {}, 'bozo_exception': URLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)'))}

Something went wrong with pipx install feediverse then.

@simonw
Copy link
Owner Author

simonw commented Nov 2, 2022

Tried this fix: https://stackoverflow.com/questions/40666767/how-to-fix-ssl-certificate-verify-failed-feedparser

# Added to the top of feediverse.py
import ssl
ssl._create_default_https_context=ssl._create_unverified_context

This almost worked! Got an error from Mastodon instead though:

mastodon.Mastodon.MastodonUnauthorizedError: ('Mastodon API returned error', 401, 'Unauthorized', 'The access token is invalid')

(The fix to that was that I had some trailing whitespace in my config file).

@simonw
Copy link
Owner Author

simonw commented Nov 2, 2022

Just got my first post from someone I follow, from Jacob! Looks like following doesn't back-fill their previous posts, it only shows new posts they submit after you follow them.

@simonw
Copy link
Owner Author

simonw commented Nov 2, 2022

Also managed to get all my blog and TIL content published using that feediverse script (with the ssl patch).

@simonw
Copy link
Owner Author

simonw commented Nov 2, 2022

Here's the config file I used:

access_token: 6HT_Vhu4qETbQ_VMBLXFtwXUnM1y0JRQqDkQoeQNUs8
client_id: ...
client_secret: ...
feeds:
- template: '{title} {url}'
  url: https://simonwillison.net/atom/everything/
- template: '{title} {link}'
  url: https://til.simonwillison.net/tils/feed.atom
name: feediverse
updated: '2022-11-01T02:51:46+00:00'
url: https://fedi.simonwillison.net

I had to use {title} {link} for my TILs feed - {title} {url} posted the ID elements instead.

@simonw
Copy link
Owner Author

simonw commented Nov 2, 2022

@simonw
Copy link
Owner Author

simonw commented Nov 2, 2022

Annoyingly, running fediverse command multiple times seems to publish multiple entries - it's not supposed to do that, not sure what's going wrong.

@simonw
Copy link
Owner Author

simonw commented Nov 2, 2022

Spotted this at the bottom of https://fedi.simonwillison.net/web/@[email protected]

image

@simonw
Copy link
Owner Author

simonw commented Nov 2, 2022

Got rate limited trying to delete my duplicate TILs! Can't find an admin option to relax the rate limit, so I guess I have to wait a few minutes to finish deleting them.

Despite being rate limited on deletes I can still post new statuses.

@simonw
Copy link
Owner Author

simonw commented Nov 2, 2022

I'm going to roll my own mechanism for posting my stuff to Mastodon - which I'll setup with the goal of posting to other things too in the future.

@simonw
Copy link
Owner Author

simonw commented Nov 2, 2022

Last step: vanity simonwillison.net thing as seen in https://aeracode.org/2022/11/01/fediverse-custom-domains/

@simonw
Copy link
Owner Author

simonw commented Nov 2, 2022

https://simonwillison.net/.well-known/nodeinfo works correctly now.

simonw added a commit that referenced this issue Nov 2, 2022
@simonw
Copy link
Owner Author

simonw commented Nov 2, 2022

@simonw
Copy link
Owner Author

simonw commented Nov 2, 2022

@simonw
Copy link
Owner Author

simonw commented Nov 2, 2022

They fixed that for me within minutes! @[email protected] now works.

@simonw simonw closed this as completed Nov 2, 2022
@simonw
Copy link
Owner Author

simonw commented Nov 3, 2022

https://simonwillison.net/.well-known/webfinger?resource=acct:[email protected] returns this:

{
  "subject": "acct:[email protected]",
  "aliases": [
    "https://fedi.simonwillison.net/@simon",
    "https://fedi.simonwillison.net/users/simon"
  ],
  "links": [
    {
      "rel": "http://webfinger.net/rel/profile-page",
      "type": "text/html",
      "href": "https://fedi.simonwillison.net/@simon"
    },
    {
      "rel": "self",
      "type": "application/activity+json",
      "href": "https://fedi.simonwillison.net/users/simon"
    },
    {
      "rel": "http://ostatus.org/schema/1.0/subscribe",
      "template": "https://fedi.simonwillison.net/authorize_interaction?uri={uri}"
    }
  ]
}

@simonw
Copy link
Owner Author

simonw commented Nov 3, 2022

curl 'https://fedi.simonwillison.net/users/simon' -H 'Accept: application/json' | jq
{
  "@context": [
    "https://www.w3.org/ns/activitystreams",
    "https://w3id.org/security/v1",
    {
      "manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
      "toot": "http://joinmastodon.org/ns#",
      "featured": {
        "@id": "toot:featured",
        "@type": "@id"
      },
      "featuredTags": {
        "@id": "toot:featuredTags",
        "@type": "@id"
      },
      "alsoKnownAs": {
        "@id": "as:alsoKnownAs",
        "@type": "@id"
      },
      "movedTo": {
        "@id": "as:movedTo",
        "@type": "@id"
      },
      "schema": "http://schema.org#",
      "PropertyValue": "schema:PropertyValue",
      "value": "schema:value",
      "discoverable": "toot:discoverable",
      "Device": "toot:Device",
      "Ed25519Signature": "toot:Ed25519Signature",
      "Ed25519Key": "toot:Ed25519Key",
      "Curve25519Key": "toot:Curve25519Key",
      "EncryptedMessage": "toot:EncryptedMessage",
      "publicKeyBase64": "toot:publicKeyBase64",
      "deviceId": "toot:deviceId",
      "claim": {
        "@type": "@id",
        "@id": "toot:claim"
      },
      "fingerprintKey": {
        "@type": "@id",
        "@id": "toot:fingerprintKey"
      },
      "identityKey": {
        "@type": "@id",
        "@id": "toot:identityKey"
      },
      "devices": {
        "@type": "@id",
        "@id": "toot:devices"
      },
      "messageFranking": "toot:messageFranking",
      "messageType": "toot:messageType",
      "cipherText": "toot:cipherText",
      "suspended": "toot:suspended",
      "focalPoint": {
        "@container": "@list",
        "@id": "toot:focalPoint"
      }
    }
  ],
  "id": "https://fedi.simonwillison.net/users/simon",
  "type": "Person",
  "following": "https://fedi.simonwillison.net/users/simon/following",
  "followers": "https://fedi.simonwillison.net/users/simon/followers",
  "inbox": "https://fedi.simonwillison.net/users/simon/inbox",
  "outbox": "https://fedi.simonwillison.net/users/simon/outbox",
  "featured": "https://fedi.simonwillison.net/users/simon/collections/featured",
  "featuredTags": "https://fedi.simonwillison.net/users/simon/collections/tags",
  "preferredUsername": "simon",
  "name": "Simon Willison",
  "summary": "<p><a href=\"https://simonwillison.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><span class=\"invisible\">https://</span><span class=\"\">simonwillison.net/</span><span class=\"invisible\"></span></a></p>",
  "url": "https://fedi.simonwillison.net/@simon",
  "manuallyApprovesFollowers": false,
  "discoverable": true,
  "published": "2022-11-02T00:00:00Z",
  "devices": "https://fedi.simonwillison.net/users/simon/collections/devices",
  "publicKey": {
    "id": "https://fedi.simonwillison.net/users/simon#main-key",
    "owner": "https://fedi.simonwillison.net/users/simon",
    "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzfQLsIvjI2C0oFHAXMgQ\nk77HQ5zz7bwS/mOFSfudlOl15hQHBfShQKRD09Q+Vqn3N4NLs0QcdlKxHhJ7KcZR\nYNdulI6Jd5G5jWE2J8ETWRqnibo0DnQmpXzNhdSg/y4XAwRBf6ZXjm3s/+EQDy7D\nkNFpmE2BX8oOqgwDTDcxPa2IvUykZS1LxuUVy3LfTLzI7LSm2xKH0C/BJSz6LOIA\nRQ0Pz9By9SwM5WjUBcoWdXVqpP3hF2q9G1GIiLAsXMquU1oAoycgEndtNW/4wPHp\nh98BIzqexGfJlq8yi3rTnF8/G/Ih9VQFe4aiNRubv08oI3K98OBNYWHI58SK56En\nHwIDAQAB\n-----END PUBLIC KEY-----\n"
  },
  "tag": [],
  "attachment": [
    {
      "type": "PropertyValue",
      "name": "Blog",
      "value": "<a href=\"https://simonwillison.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer me\"><span class=\"invisible\">https://</span><span class=\"\">simonwillison.net/</span><span class=\"invisible\"></span></a>"
    },
    {
      "type": "PropertyValue",
      "name": "GitHub",
      "value": "<a href=\"https://github.com/simonw\" target=\"_blank\" rel=\"nofollow noopener noreferrer me\"><span class=\"invisible\">https://</span><span class=\"\">github.com/simonw</span><span class=\"invisible\"></span></a>"
    },
    {
      "type": "PropertyValue",
      "name": "Twitter",
      "value": "<a href=\"https://twitter.com/simonw\" target=\"_blank\" rel=\"nofollow noopener noreferrer me\"><span class=\"invisible\">https://</span><span class=\"\">twitter.com/simonw</span><span class=\"invisible\"></span></a>"
    },
    {
      "type": "PropertyValue",
      "name": "TIL",
      "value": "<a href=\"https://til.simonwillison.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer me\"><span class=\"invisible\">https://</span><span class=\"\">til.simonwillison.net/</span><span class=\"invisible\"></span></a>"
    }
  ],
  "endpoints": {
    "sharedInbox": "https://fedi.simonwillison.net/inbox"
  },
  "icon": {
    "type": "Image",
    "mediaType": "image/jpeg",
    "url": "https://cdn.masto.host/fedisimonwillisonnet/accounts/avatars/109/276/369/291/252/172/original/210673cf3d17fda9.jpg"
  },
  "image": {
    "type": "Image",
    "mediaType": "image/jpeg",
    "url": "https://cdn.masto.host/fedisimonwillisonnet/accounts/headers/109/276/369/291/252/172/original/e8b97aaf13f1291d.jpeg"
  }
}

simonw added a commit that referenced this issue Nov 4, 2022
simonw added a commit to simonw/til that referenced this issue Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant