2024-12-03 01:35:55 +00:00
# bluesky-pds-docker
2024-12-10 17:29:27 +00:00
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.
2024-12-03 01:43:49 +00:00
2024-12-03 22:48:12 +00:00
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.
2024-12-10 17:29:27 +00:00
I can confirm it works behind Cloudflare's DNS Proxy with Full (strict).
2024-12-02 00:15:39 +00:00
## Deployment
2024-12-10 17:29:27 +00:00
### Reqirements (to)
#### Manjaro/Arch
2024-12-02 00:15:39 +00:00
```bash
2024-12-10 17:29:27 +00:00
sudo pacman -Syu install jq
```
2024-12-02 00:15:39 +00:00
2024-12-10 17:29:27 +00:00
#### Debian/Ubunut
2024-12-03 22:48:12 +00:00
2024-12-10 17:29:27 +00:00
```bash
sudo apt install make xxd
2024-12-02 00:15:39 +00:00
```
2024-12-03 23:39:25 +00:00
2024-12-10 17:29:27 +00:00
### Setup
2024-12-03 23:39:25 +00:00
2024-12-10 17:29:27 +00:00
Generate secrets and add them to `.env` file. See [example.env ](example.env ) as an example.
2024-12-03 22:48:12 +00:00
2024-12-10 17:29:27 +00:00
```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)
```
2024-12-02 00:15:39 +00:00
2024-12-10 17:29:27 +00:00
### Standalone
2024-12-02 00:15:39 +00:00
2024-12-03 22:48:12 +00:00
Full list of additional Environment Variables 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 )
2024-12-03 23:39:25 +00:00
2024-12-02 00:15:39 +00:00
```yaml
2024-12-10 17:29:27 +00:00
# Standalone, you'll need to add a proxy in front of this with SSL.
2024-12-02 00:15:39 +00:00
services:
bluesky-pds:
2024-12-03 01:35:55 +00:00
container_name: bluesky-pds
2024-12-03 22:48:12 +00:00
image: forgejo.gravityfargo.dev/gravityfargo/bluesky-pds
environment:
2024-12-10 17:29:27 +00:00
# Define variables here or in a .env file
2024-12-03 22:48:12 +00:00
PDS_JWT_SECRET: ...
PDS_ADMIN_PASSWORD: ...
PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX: ...
PDS_HOSTNAME: ...
2024-12-03 23:39:25 +00:00
PDS_EMAIL_SMTP_URL: ""
PDS_EMAIL_FROM_ADDRESS: ""
2024-12-02 00:15:39 +00:00
volumes:
2024-12-03 23:39:25 +00:00
- ./bluesky-pds:/pds
2024-12-02 00:15:39 +00:00
```
2024-12-03 01:43:49 +00:00
2024-12-10 17:29:27 +00:00
### Traefik
2024-12-03 01:43:49 +00:00
2024-12-03 22:48:12 +00:00
```yaml
2024-12-10 17:29:27 +00:00
# Traefik Proxy
2024-12-03 22:48:12 +00:00
services:
bluesky-pds:
container_name: bluesky-pds
image: forgejo.gravityfargo.dev/gravityfargo/bluesky-pds:latest
env_file:
2024-12-10 17:29:27 +00:00
- .env
2024-12-03 22:48:12 +00:00
volumes:
2024-12-03 23:39:25 +00:00
- ./bluesky-pds:/pds
2024-12-03 22:48:12 +00:00
labels:
traefik.enable: "true"
2024-12-03 23:39:25 +00:00
traefik.http.routers.bluesky-pds-insecure.entrypoints: http
2024-12-10 17:29:27 +00:00
traefik.http.routers.bluesky-pds-insecure.rule: HostRegexp(`^.+\.example\.com$`)
2024-12-03 22:48:12 +00:00
traefik.http.routers.bluesky-pds-secure.entrypoints: https
2024-12-10 17:29:27 +00:00
traefik.http.routers.bluesky-pds-secure.rule: HostRegexp(`^.+\.example\.com$`)
2024-12-03 22:48:12 +00:00
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
traefik.http.routers.bluesky-pds-insecure.middlewares: BlueskyHeaders@file
```
2024-12-03 23:39:25 +00:00
2024-12-03 22:48:12 +00:00
#### Middleware
2024-12-03 23:39:25 +00:00
2024-12-03 22:48:12 +00:00
I think file configs are cleaner than having a billion labels.
2024-12-03 23:39:25 +00:00
2024-12-03 22:48:12 +00:00
```yaml
2024-12-10 17:29:27 +00:00
# middleware.yaml
2024-12-03 22:48:12 +00:00
http:
middlewares:
BlueskyHeaders:
headers:
accessControlAllowMethods:
- GET
- OPTIONS
- PUT
- POST
- DELETE
accessControlAllowHeaders: "*"
accessControlAllowOriginList: "*"
addVaryHeader: true
stsSeconds: 63072000
```
2024-12-03 23:39:25 +00:00
2024-12-10 17:29:27 +00:00
#### Optional Proxy Network
2024-12-03 01:43:49 +00:00
2024-12-03 22:48:12 +00:00
```bash
2024-12-10 17:29:27 +00:00
docker network create --subnet=192.168.1.0/24 --ipv6 --attachable proxy
# /etc/docker/daemon.json
# {
# "ipv6": true,
# "fixed-cidr-v6": "2001:db8:1::/64"
# }
2024-12-03 22:48:12 +00:00
```
2024-12-10 17:29:27 +00:00
#### Cloudflare DNS
![alt text ](assets/image.png )