Skip to content

Instantly share code, notes, and snippets.

@ngerakines
Last active February 23, 2024 20:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ngerakines/e5daf2f5cd075504352cf8d54229c4e5 to your computer and use it in GitHub Desktop.
Save ngerakines/e5daf2f5cd075504352cf8d54229c4e5 to your computer and use it in GitHub Desktop.
Running your own atproto pds

README

First, understand a few things:

  1. Every identity has a unique did (distributed identifier) that looks like this: did:plc:cbkjy5n7bk3ax2wplmtjofq2

  2. You can alias a domain to your did.

    dig +short TXT _atproto.ngerakines.me
    "did=did:plc:cbkjy5n7bk3ax2wplmtjofq2"
    

Bare Domain

This is a standard setup where you have a base domain with users as subdomains.

First, run the PDS with the following configuration:

PDS_HOSTNAME=cauda.cloud

Second, run the reverse proxy with the following configuration:

{
  email your_email_address
  on_demand_tls {
    ask http://127.0.0.1:3000/tls-check
  }
}

*.cauda.cloud, cauda.cloud {
  reverse_proxy 127.0.0.1:3000
  tls {
    on_demand
  }
}

WWW domain with redirection

Additionally, if you want to setup a site on www.cauda.cloud, you can configure that in caddy.

www.cauda.cloud {
	root * /opt/cauda-cloud/www
	file_server
	log {
		output file /var/log/caddy/www-cauda-cloud.log
	}
}

*.cauda.cloud, cauda.cloud {
	@towww {
		not path /xrpc/*
		not path /.well-known/*
	}
	redir @towww https://www.cauda.cloud{uri}
	reverse_proxy 127.0.0.1:3000
	tls {
		on_demand
	}
	log {
		output file /var/log/caddy/cauda-cloud.log
	}
}

The above matchers in caddy would proxy all ^/xrpc/.*$ requests to pds, and then any other requests to the bare domain are redirected to the www subdomain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment