{
  "path": "/3m7236ql3as2u",
  "site": "at://did:plc:ml6hwrktvr7r5nhxs7f7eoz4/site.standard.publication/3m6prszcmtk2z",
  "$type": "site.standard.document",
  "title": "Migrating self-hosted PDS from one domain to another",
  "content": {
    "$type": "pub.leaflet.content",
    "pages": [
      {
        "id": "019acc72-b5be-7dd2-9683-a684219085ef",
        "$type": "pub.leaflet.pages.linearDocument",
        "blocks": [
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "facets": [],
              "plaintext": "It turns out that having an account on a PDS that shares the same root domain as an AppView is problematic, and not currently a good idea."
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "facets": [
                {
                  "index": {
                    "byteEnd": 164,
                    "byteStart": 145
                  },
                  "features": [
                    {
                      "$type": "pub.leaflet.richtext.facet#code"
                    }
                  ]
                },
                {
                  "index": {
                    "byteEnd": 207,
                    "byteStart": 177
                  },
                  "features": [
                    {
                      "uri": "https://pds.your-domain.social",
                      "$type": "pub.leaflet.richtext.facet#link"
                    }
                  ]
                },
                {
                  "index": {
                    "byteEnd": 283,
                    "byteStart": 257
                  },
                  "features": [
                    {
                      "uri": "https://your-domain.social",
                      "$type": "pub.leaflet.richtext.facet#link"
                    }
                  ]
                }
              ],
              "plaintext": "You'll likely only notice this if you're trying to access your AppView with an account hosted on the same domain name, e.g. having an account at @your-domain.social hosted on a https://pds.your-domain.social while trying to trying to access your AppView at https://your-domain.social."
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "facets": [
                {
                  "index": {
                    "byteEnd": 59,
                    "byteStart": 47
                  },
                  "features": [
                    {
                      "uri": "https://bsky.app/profile/stellz.club",
                      "$type": "pub.leaflet.richtext.facet#link"
                    }
                  ]
                }
              ],
              "plaintext": "I remember reading about this on Bluesky, when @stellz.club posted a few months ago:"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.bskyPost",
              "postRef": {
                "cid": "bafyreihceuf7yd73qofl4e7nk7gldz3qvhpdejsuuqlw2wtcbxv2q7kzxu",
                "uri": "at://did:web:stellz.club/app.bsky.feed.post/3lturvd6vrc2l"
              }
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "facets": [
                {
                  "index": {
                    "byteEnd": 31,
                    "byteStart": 12
                  },
                  "features": [
                    {
                      "uri": "https://bsky.app/profile/matthieu.bsky.team",
                      "$type": "pub.leaflet.richtext.facet#link"
                    }
                  ]
                }
              ],
              "plaintext": "Fortunately @matthieu.bsky.team posted the reasons for this feature, so we can understand a bit more about why this happens:"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.bskyPost",
              "postRef": {
                "cid": "bafyreih7qg6oi47hfet23sjzuu3cczbbt5qihfex6hhgowyy2vzmvvu4zm",
                "uri": "at://did:plc:linrigsaay5zenhg756ca6tg/app.bsky.feed.post/3ltwtbxud2k2s"
              }
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "facets": [],
              "plaintext": ""
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.header",
              "level": 2,
              "facets": [],
              "plaintext": "Steps to migrate a PDS to a new domain"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "facets": [],
              "plaintext": ""
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "facets": [],
              "plaintext": "In order to resolve this issue, you'll need to migrate your PDS to a new root domain. Below are the steps to do this."
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.header",
              "level": 3,
              "facets": [],
              "plaintext": "Modify your DNS records to point the new domain to the server."
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "facets": [
                {
                  "index": {
                    "byteEnd": 40,
                    "byteStart": 39
                  },
                  "features": [
                    {
                      "$type": "pub.leaflet.richtext.facet#code"
                    }
                  ]
                },
                {
                  "index": {
                    "byteEnd": 94,
                    "byteStart": 73
                  },
                  "features": [
                    {
                      "$type": "pub.leaflet.richtext.facet#code"
                    }
                  ]
                }
              ],
              "plaintext": "Login to your DNS provider, and add an A record for the new domain, e.g. pds.new-domain.social pointing to the IP address of the server"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "facets": [],
              "plaintext": "This may take a few minutes for the DNS records to propagate."
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "facets": [
                {
                  "index": {
                    "byteEnd": 32,
                    "byteStart": 31
                  },
                  "features": [
                    {
                      "$type": "pub.leaflet.richtext.facet#code"
                    }
                  ]
                },
                {
                  "index": {
                    "byteEnd": 95,
                    "byteStart": 74
                  },
                  "features": [
                    {
                      "$type": "pub.leaflet.richtext.facet#code"
                    }
                  ]
                }
              ],
              "plaintext": "As a note, I left the original A record pointing from the old domain e.g. pds.old-domain.social to the server."
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "facets": [],
              "plaintext": ""
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.header",
              "level": 3,
              "facets": [],
              "plaintext": "Modify the Caddyfile to add the new domain."
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "facets": [
                {
                  "index": {
                    "byteEnd": 49,
                    "byteStart": 19
                  },
                  "features": [
                    {
                      "$type": "pub.leaflet.richtext.facet#code"
                    }
                  ]
                }
              ],
              "plaintext": "My Caddyfile is at /pds/caddy/etc/caddy/Caddyfile."
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.code",
              "language": "plaintext",
              "plaintext": "{\n\temail info@new-domain.social\n\ton_demand_tls {\n\t\task http://127.0.0.1:3000/tls-check\n\t}\n}\n\n# Bluesky PDS - with on-demand TLS for user subdomains\n*.pds.old-domain.social, old-domain.social, *.pds.new-domain.social, new-domain.social  {\n\ttls {\n\t\ton_demand\n\t}\n\treverse_proxy http://127.0.0.1:3000\n}",
              "syntaxHighlightingTheme": "github-dark-dimmed"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "facets": [],
              "plaintext": ""
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.header",
              "level": 3,
              "facets": [],
              "plaintext": "Modify the pds.env file to add the new domain."
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "facets": [
                {
                  "index": {
                    "byteEnd": 34,
                    "byteStart": 22
                  },
                  "features": [
                    {
                      "$type": "pub.leaflet.richtext.facet#code"
                    }
                  ]
                }
              ],
              "plaintext": "My pds.env file is at /pds/pds.env."
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.code",
              "language": "plaintext",
              "plaintext": "PDS_HOSTNAME=new-domain.social",
              "syntaxHighlightingTheme": "github-dark-dimmed"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "facets": [],
              "plaintext": ""
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.header",
              "level": 3,
              "facets": [],
              "plaintext": "Restart the docker containers"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "facets": [],
              "plaintext": "Simply restarting the docker containers, or stopping and then starting the docker containers won't change the ENV values."
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "facets": [],
              "plaintext": "You'll need to stop and then use docker composer to start a new container to apply the new ENV values."
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.code",
              "plaintext": "docker stop pds caddy\ndocker compose up -d",
              "syntaxHighlightingTheme": "github-dark-dimmed"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "facets": [],
              "plaintext": ""
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.header",
              "level": 3,
              "facets": [],
              "plaintext": "Try loading the PDS in the browser"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "facets": [
                {
                  "index": {
                    "byteEnd": 35,
                    "byteStart": 6
                  },
                  "features": [
                    {
                      "$type": "pub.leaflet.richtext.facet#code"
                    }
                  ]
                }
              ],
              "plaintext": "Visit https://pds.new-domain.social to see if the everything is up and running."
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "facets": [],
              "plaintext": ""
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.header",
              "level": 3,
              "facets": [],
              "plaintext": "Manually apply the PLC records to the new domain"
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "facets": [
                {
                  "index": {
                    "byteEnd": 11,
                    "byteStart": 0
                  },
                  "features": [
                    {
                      "uri": "https://bsky.app/profile/mary.my.id",
                      "$type": "pub.leaflet.richtext.facet#link"
                    }
                  ]
                },
                {
                  "index": {
                    "byteEnd": 22,
                    "byteStart": 18
                  },
                  "features": [
                    {
                      "$type": "pub.leaflet.richtext.facet#bold"
                    },
                    {
                      "$type": "pub.leaflet.richtext.facet#italic"
                    }
                  ]
                },
                {
                  "index": {
                    "byteEnd": 74,
                    "byteStart": 66
                  },
                  "features": [
                    {
                      "uri": "https://bsky.app/profile/iame.li",
                      "$type": "pub.leaflet.richtext.facet#link"
                    }
                  ]
                },
                {
                  "index": {
                    "byteEnd": 125,
                    "byteStart": 111
                  },
                  "features": [
                    {
                      "uri": "https://boat.kelinci.net/plc-applicator",
                      "$type": "pub.leaflet.richtext.facet#link"
                    }
                  ]
                }
              ],
              "plaintext": "@mary.my.id has a boat load of tools for AT Protocol. Shoutout to @iame.li for pointing me to this. I used the plc-applicator to apply the PLC records to the new domain."
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.unorderedList",
              "children": [
                {
                  "$type": "pub.leaflet.blocks.unorderedList#listItem",
                  "content": {
                    "$type": "pub.leaflet.blocks.text",
                    "facets": [
                      {
                        "index": {
                          "byteEnd": 24,
                          "byteStart": 10
                        },
                        "features": [
                          {
                            "uri": "https://boat.kelinci.net/plc-applicator",
                            "$type": "pub.leaflet.richtext.facet#link"
                          }
                        ]
                      }
                    ],
                    "plaintext": "Go to the plc-applicator"
                  },
                  "children": []
                },
                {
                  "$type": "pub.leaflet.blocks.unorderedList#listItem",
                  "content": {
                    "$type": "pub.leaflet.blocks.text",
                    "facets": [],
                    "plaintext": "Enter the handle of the account you want to migrate to the new domain"
                  },
                  "children": []
                },
                {
                  "$type": "pub.leaflet.blocks.unorderedList#listItem",
                  "content": {
                    "$type": "pub.leaflet.blocks.text",
                    "facets": [
                      {
                        "index": {
                          "byteEnd": 103,
                          "byteStart": 84
                        },
                        "features": [
                          {
                            "uri": "https://bsky.app/profile/baileytownsend.dev",
                            "$type": "pub.leaflet.richtext.facet#link"
                          }
                        ]
                      },
                      {
                        "index": {
                          "byteEnd": 116,
                          "byteStart": 106
                        },
                        "features": [
                          {
                            "uri": "https://pdsmoover.com/",
                            "$type": "pub.leaflet.richtext.facet#link"
                          }
                        ]
                      }
                    ],
                    "plaintext": "I used the rotation key I made when I moved the PDS from Bluesky to my domain using @baileytownsend.dev's PDS MOOver tool."
                  },
                  "children": []
                },
                {
                  "$type": "pub.leaflet.blocks.unorderedList#listItem",
                  "content": {
                    "$type": "pub.leaflet.blocks.text",
                    "facets": [
                      {
                        "index": {
                          "byteEnd": 94,
                          "byteStart": 65
                        },
                        "features": [
                          {
                            "$type": "pub.leaflet.richtext.facet#code"
                          }
                        ]
                      }
                    ],
                    "plaintext": "Change the value of the \"endpoint\" field to the new domain, e.g. https://pds.new-domain.social"
                  },
                  "children": []
                },
                {
                  "$type": "pub.leaflet.blocks.unorderedList#listItem",
                  "content": {
                    "$type": "pub.leaflet.blocks.text",
                    "facets": [],
                    "plaintext": "Click next, enter the 3 confirmation codes, and click \"Apply\"."
                  },
                  "children": []
                }
              ]
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "facets": [],
              "plaintext": ""
            }
          },
          {
            "$type": "pub.leaflet.pages.linearDocument#block",
            "block": {
              "$type": "pub.leaflet.blocks.text",
              "facets": [
                {
                  "index": {
                    "byteEnd": 49,
                    "byteStart": 39
                  },
                  "features": [
                    {
                      "uri": "https://bsky.app/profile/iame.li/post/3m6sgopqoik2t",
                      "$type": "pub.leaflet.richtext.facet#link"
                    }
                  ]
                }
              ],
              "plaintext": "That should be it! Massive shoutout to @mmatt.net for providing all these steps in a more succinct post on Bluesky!"
            }
          }
        ]
      }
    ]
  },
  "bskyPostRef": {
    "cid": "bafyreifrmmeisidoiaaekawgemohd5pjgufv4f2g2e73vwgau4nia2cfmy",
    "uri": "at://did:plc:ml6hwrktvr7r5nhxs7f7eoz4/app.bsky.feed.post/3m7236vdi7c2u",
    "commit": {
      "cid": "bafyreifrg6q6avkw6pqrhdsliazsaqm6ck4gupezd3bamua5otzyilcn34",
      "rev": "3m7236vgoqr2a"
    },
    "validationStatus": "valid"
  },
  "description": "",
  "publishedAt": "2025-12-02T23:16:34.167Z"
}