generated at
PDSをUbuntuに立ててみる
UbuntuDockerAWS を使わずに PDS をたてたので手順を以下に記す

・postgresqlのインストール&起動

・nginxのインストール&起動
リバースプロキシにする。port443にきたリクエストをlocalhost:3000に流す
.conf
map $http_upgrade $connection_upgrade { default upgrade; '' close; } server { listen 443 ssl; server_name ${公開するURL}; ssl_certificate /etc/ssl/certs/server-crt.pem; #←Let's Encryptなどで ssl_certificate_key /etc/ssl/private/server-key.pem; #←Let's Encryptなどで location / { proxy_pass http://localhost:3000/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; }


・node.jsのインストール
aptでインストールすると古いバージョンしか入らないので、
nodeのバージョン管理ツール「n」でインストールする

・npmのインストール

・pnpmのインストール

・Githubからソースの取得
$ git clone https://github.com/bluesky-social/atproto.git
$ cd atproto

・モジュールのインストール
$ pnpm install --frozen-lockfile

・ビルド
$ NODE_OPTIONS="--max-old-space-size=1024" pnpm build
$ pnpm update-main-to-dist
$ rm -rf node_modules
$ pnpm install --prod --shamefully-hoist --frozen-lockfile --prefer-offline
※NODE_OPTIONSはメモリが少ない場合指定する。

・ufwで443ポートを開放する

・PDSを起動する。
$ cd /home/pds/atproto/services/pds
$ node --heapsnapshot-signal=SIGUSR2 --enable-source-maps index.js
必要な環境変数についての情報はKingYoSunのhttps://scrapbox.io/Bluesky/PDS%E3%82%92AWS%E3%81%AB%E7%AB%8B%E3%81%A6%E3%81%A6%E3%81%BF%E3%82%8B を参照(かなり役立ちました)
https://atproto.foraza7.org で設定している環境変数は以下。(空白のところも設定要、SERVER_DIDは変更要、ドメインの設定は残しましたので書き換えてください。)
.env
DB_POSTGRES_URL=postgres://postgres:postgres@localhost:5432/postgres DB_POSTGRES_SCHEMA=postgres DB_CREDS_JSON='{"username":"postgres","password":"パスワード","host":"localhost","port":"5432"}' DB_MIGRATE_CREDS_JSON='{"username":"postgres","password":"パスワード","host":"localhost","port":"5432"}' DEBUG_MODE=1 LOG_ENABLED=true LOG_LEVEL=info LOG_DESTINATION=/home/pds/logs/pds.log AVAILABLE_USER_DOMAINS=.forza7.org REPO_SIGNING_KEY= RECOVERY_KEY_ID= SERVER_DID=did:plc:3e3rxvkqjus7hdhtyxzhvbyafyesxt5kw7bemthlg26ml3yxhlkq PORT=3000 SMTP_HOST= SMTP_USERNAME= SMTP_PASSWORD= BLOB_CACHE_LOC=/home/pds/blob/chache BLOBSTORE_LOC=/home/pds/blob/image BLOBSTORE_TMP=/home/pds/blob/tmp DID_PLC_URL=https://plc.directory PUBLIC_URL=https://atproto.forza7.org IMG_URL_ENDPOINT=https://atproto.forza7.org IMG_URI_SALT= IMG_URI_KEY= EMAIL_NO_REPLY_ADDRESS=no-reply@atproto.forza7.org ADMIN_PASSWORD=

(サービス化したい場合はこんな感じ)
*.service
[Unit] Description=PDS After=network.target [Service] ExecStart=pnpm run start | pnpm exec pino-pretty User=pds Group=pds Restart=always EnvironmentFile=/home/pds/.env [Install] WantedBy=multi-user.target
サービス化する場合は環境変数は.envに指定する