diff --git a/docker/bluesky-pds.md b/docker/bluesky-pds.md index 7b25a27..8311e1d 100644 --- a/docker/bluesky-pds.md +++ b/docker/bluesky-pds.md @@ -18,7 +18,7 @@ docker pull code.modernleft.org/gravityfargo/bluesky-pds:latest A self-contained Docker image for the [Bluesky PDS (Personal Data Server) ](https://github.com/bluesky-social/pds) for use with Traefik. This image is pinned to v0.4.74. -It is required to run the instance behind a proxy (like traefik) to generate SSL certificates. This will not work otherwise. The standard pds install includes caddy to handle this. A wildcard DNS assignment along with a wildcard SSL certificate is required. I use Cloudflare for this, see the screenshot below. +It is required to run the instance behind a proxy (like [Traefik](https://doc.traefik.io/traefik/)) to generate SSL certificates. This will not work otherwise. The standard pds install includes caddy to handle this. A wildcard DNS assignment along with a wildcard SSL certificate is required. I use Cloudflare for this, see the screenshot below. This is not intended for production, and I am not responsible for any data loss or security issues. This is a personal project, and I am not affiliated with Bluesky. @@ -26,9 +26,9 @@ This is not intended for production, and I am not responsible for any data loss Before changing images or upgrading, always backup the files made in the volume. -### Reqirements +### Requirements -I haven't verified these are the minimum requirements, but they are what I found to be necessary after starting this readme. I probably had some dependencies installed already. +I haven't verified these are the minimum requirements, but they are what I found to be necessary during development. I probably had some dependencies installed already. #### Manjaro/Arch @@ -41,3 +41,26 @@ sudo pacman -S jq ```bash sudo apt install make xxd ``` + +### Setup + +Generate secrets and add them to `.env` file. See [example.env](example.env) as an example. + +```bash +# Generate secret environment variables +echo PDS_ADMIN_PASSWORD: $(openssl rand --hex 16) + +echo PDS_JWT_SECRET: $(openssl rand --hex 16) + +echo PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX: $(openssl ecparam --name secp256k1 --genkey --noout --outform DER | tail --bytes=+8 | head --bytes=32 | xxd --plain --cols 32) +``` + +### Docker Compose Setup + +Full list of additional Environment Variables provided by bluesky upstream can be found in the [packages/pds/src/config/env.ts](https://github.com/bluesky-social/atproto/blob/main/packages/pds/src/config/env.ts) + +By default, the image uses 1000:1000 as the UID:GID for the user. This can be changed by setting the `PUID` and `PGID` environment variables. + +The compose element `hostname` must be the same value as `PDS_HOSTNAME`. + +![[docker-compose]] \ No newline at end of file diff --git a/docker/bluesky-pds/docker-compose.md b/docker/bluesky-pds/docker-compose.md new file mode 100644 index 0000000..fa1db2f --- /dev/null +++ b/docker/bluesky-pds/docker-compose.md @@ -0,0 +1,35 @@ +```yaml title="docker-compose.yml" +# Traefik Proxy +services: + bluesky-pds: + container_name: bluesky-pds + image: gravityfargo/bluesky-pds:0.4.74 + hostname: example.com + extra_hosts: + - "example.com:0.0.0.0" # domain:external_ip + networks: + - proxy + environment: + # Define variables here or in a .env file + PDS_JWT_SECRET: ... + PDS_ADMIN_PASSWORD: ... + PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX: ... + PDS_HOSTNAME: example.com + PDS_EMAIL_SMTP_URL: smtps://resend:@smtp.resend.com:465/ + PDS_EMAIL_FROM_ADDRESS: admin@your.domain + PUID: 1000 + PGID: 1001 + volumes: + - ./bluesky-pds:/pds + labels: + traefik.enable: "true" + traefik.http.routers.bluesky-pds-insecure.entrypoints: http + traefik.http.routers.bluesky-pds-insecure.rule: HostRegexp(`^.+\.${URL_NAME}\.${URL_SUFFIX}$`) || Host(`${PDS_HOSTNAME}`) + # traefik.http.routers.bluesky-pds-insecure.middlewares: BlueskyHeaders@file + traefik.http.routers.bluesky-pds-secure.entrypoints: https + traefik.http.routers.bluesky-pds-secure.rule: HostRegexp(`^.+\.${URL_NAME}\.${URL_SUFFIX}$`) || Host(`${PDS_HOSTNAME}`) + traefik.http.routers.bluesky-pds-secure.tls: "true" + traefik.http.services.bluesky-pds.loadbalancer.server.scheme: http + traefik.http.services.bluesky-pds.loadbalancer.server.port: 3000 + # traefik.http.routers.bluesky-pds-secure.middlewares: BlueskyHeaders@file +```