···
echo "Certificates generated in ./certs/"
···
# Run Caddy with the specified Caddyfile
${pkgs.caddy}/bin/caddy run --config "$CADDYFILE"
+
# Script to start bluesky-pds
+
pds = pkgs.writeShellScriptBin "pds" ''
+
# Default port for bluesky-pds
+
PORT=''${BLUESKY_PDS_PORT:-3000}
+
# Create data directories
+
mkdir -p ./data/pds/blocks
+
echo "Starting Bluesky PDS on port $PORT..."
+
echo "Data directory: ./data/pds"
+
# Configure for local disk storage
+
export PDS_DATA_DIRECTORY="./data/pds"
+
export PDS_BLOBSTORE_DISK_LOCATION="./data/pds/blocks"
+
export PDS_DB_SQLITE_LOCATION="./data/pds/db/pds.sqlite"
+
export PDS_PORT="$PORT"
+
# Generate or use existing PLC rotation key
+
if [ ! -f "./data/pds/plc-rotation-key.txt" ]; then
+
echo "Generating PLC rotation key..."
+
openssl rand -hex 32 > ./data/pds/plc-rotation-key.txt
+
export PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX="$(cat ./data/pds/plc-rotation-key.txt)"
+
# Generate or use existing JWT secret
+
if [ ! -f "./data/pds/jwt-secret.txt" ]; then
+
echo "Generating JWT secret..."
+
openssl rand -hex 32 > ./data/pds/jwt-secret.txt
+
export PDS_JWT_SECRET="$(cat ./data/pds/jwt-secret.txt)"
+
export PDS_ADMIN_PASSWORD="admin"
+
# Set hostname and URL scheme (using example.org domain)
+
export PDS_HOSTNAME="pds.example.org:8443"
+
export PDS_SERVICE_URL="https://pds.example.org:8443"
+
# Enable development mode
+
export PDS_DEV_MODE="true"
+
${pkgs.bluesky-pds}/bin/pds
···
+
echo "Caddy development environment with Bluesky PDS"
echo "Available commands:"
echo " nix run .#generate-certs - Generate test certificates"
echo " nix run .#caddy-proxy - Start Caddy with full config"
+
echo " nix run .#pds - Start Bluesky PDS server"
+
echo " Bluesky PDS: https://pds.example.org:8443 (proxied from port 3000)"
+
echo " DID PLC: https://plc.example.org:8444 (proxied from port 2582)"
+
echo "Environment variables:"
+
echo " BLUESKY_PDS_PORT=3000 - Port for Bluesky PDS (default: 3000)"
+
echo " 1. Add these lines to your /etc/hosts file:"
+
echo " 127.0.0.1 pds.example.org"
+
echo " 127.0.0.1 plc.example.org"
+
echo " 2. Run 'nix run .#generate-certs' to create certificates"
+
echo " 3. Run 'nix run .#did-plc-server' in one terminal (if needed)"
+
echo " 4. Run 'nix run .#pds' in another terminal"
+
echo " 5. Run 'nix run .#caddy-proxy' in another terminal"
+
echo " 6. Access services at:"
+
echo " - Bluesky PDS: https://pds.example.org:8443"
+
echo " - DID PLC: https://plc.example.org:8444"