fix
This commit is contained in:
80
README.md
80
README.md
@@ -0,0 +1,80 @@
|
|||||||
|
# atproto(at protocol)
|
||||||
|
|
||||||
|
[@ai.syu.is](https://web.syu.is/profile/ai.syu.is)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ curl -sL syu.is/xrpc/_health
|
||||||
|
{"version":"0.4.65"}
|
||||||
|
|
||||||
|
# latest
|
||||||
|
$ curl -sL https://raw.githubusercontent.com/bluesky-social/atproto/refs/heads/main/packages/pds/package.json |jq -r .version
|
||||||
|
```
|
||||||
|
|
||||||
|
- @
|
||||||
|
- [at]mosphere
|
||||||
|
- at://domain
|
||||||
|
|
||||||
|
## account
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ curl -sL "syu.is/xrpc/com.atproto.repo.describeRepo?repo=ai.syu.is" |jq -r .did
|
||||||
|
did:plc:6qyecktefllvenje24fcxnie
|
||||||
|
|
||||||
|
$ curl -sL "syu.is/xrpc/com.atproto.repo.listRecords?repo=ai.syu.is&collection=app.bsky.feed.post&reverse=true&limit=1"
|
||||||
|
{"records":[{"uri":"at://did:plc:6qyecktefllvenje24fcxnie/app.bsky.feed.post/3l6s2riuouk2j","cid":"bafyreibjohl7va4upkibw5twaxdd4jg3l6rmfatu4dpjjfd5xkb2ijtlx4","value":{"text":"hello","$type":"app.bsky.feed.post","langs":["ja"],"createdAt":"2024-10-18T13:21:39.809Z"}}],"cursor":"3l6s2riuouk2j"}
|
||||||
|
```
|
||||||
|
|
||||||
|
## link
|
||||||
|
|
||||||
|
- https://github.com/bluesky-social/atproto
|
||||||
|
- https://github.com/itaru2622/bluesky-selfhost-env
|
||||||
|
- https://github.com/bluesky-social/atproto/discussions/2026
|
||||||
|
|
||||||
|
## self-host
|
||||||
|
|
||||||
|
currently, bsky and bsync require patches to function properly. additionally, social-app is not displaying avatars. for components that are not working, it's recommended to use [itaru2622/bluesky-selfhost-env](https://github.com/itaru2622/bluesky-selfhost-env). this repository provides an environment for self-hosting bluesky.
|
||||||
|
|
||||||
|
- bsky = appview
|
||||||
|
- ozone = mod
|
||||||
|
|
||||||
|
|name|service|patch|
|
||||||
|
|---|---|---|
|
||||||
|
|pds|https://github.com/bluesky-social/atproto/blob/main/services/pds/Dockerfile||
|
||||||
|
|bsky|https://github.com/bluesky-social/atproto/blob/main/services/bsky/Dockerfile|[itaru2622/bluesky-atproto-bsky](https://hub.docker.com/r/itaru2622/bluesky-atproto-bsky)|
|
||||||
|
|bsync|https://github.com/bluesky-social/atproto/blob/main/services/bsync/Dockerfile||
|
||||||
|
|ozone|https://github.com/bluesky-social/atproto/blob/main/services/ozone/Dockerfile||
|
||||||
|
|plc|https://github.com/did-method-plc/did-method-plc/tree/main/packages/server||
|
||||||
|
|bgs|https://github.com/bluesky-social/indigo/tree/main/cmd/bigsky||
|
||||||
|
|feed|https://github.com/bluesky-social/feed-generator||
|
||||||
|
|web|https://github.com/bluesky-social/social-app|[itaru2622/bluesky-social-app](https://hub.docker.com/r/itaru2622/bluesky-social-app)|
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# BSKY_IMG_URI_ENDPOINT, BSKY_BLOB_CACHE_LOC
|
||||||
|
# avatar link example
|
||||||
|
1. https://appview.${host}/img/avatar/plain/${did}/${cid}@jpeg
|
||||||
|
2. https://${host}/xrpc/com.atproto.sync.getBlob?did=${did}&cid=${cid}
|
||||||
|
```
|
||||||
|
|
||||||
|
docker compose will not be published unless you write ports. it is only valid internally. add ports only for what you want to publish.
|
||||||
|
|
||||||
|
## api
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# create account
|
||||||
|
url=https://${pds}/xrpc/com.atproto.server.createAccount
|
||||||
|
json="{\"email\": \"$email\", \"handle\": \"$handle\", \"password\": \"$password\"}"
|
||||||
|
curl -X POST -H "Content-Type: application/json" -d $json -sL $url
|
||||||
|
```
|
||||||
|
|
||||||
|
change `src/pds/handle` to use a name of 3 characters or less. also, you cannot create an account with a name of 3 characters or less from social-app (web client). please create it from api.
|
||||||
|
|
||||||
|
- [/atproto/packages/pds/src/handle/index.ts](https://github.com/bluesky-social/atproto/blame/d4d5a6edba972c0e9976289bde8bc0b42ff547ca/packages/pds/src/handle/index.ts#L86-L88)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# invite code
|
||||||
|
admin_password=xxx
|
||||||
|
url=https://$host/xrpc/com.atproto.server.createInviteCode
|
||||||
|
json="{\"useCount\":1}"
|
||||||
|
curl -X POST -u admin:${admin_password} -H "Content-Type: application/json" -d "$json" -sL $url
|
||||||
|
```
|
||||||
|
|
||||||
|
8
build.sh
Executable file
8
build.sh
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
cd ./repos
|
||||||
|
git clone https://github.com/bluesky-social/atproto
|
||||||
|
git clone https://github.com/did-method-plc/did-method-plc
|
||||||
|
git clone https://github.com/bluesky-social/feed-generator
|
||||||
|
git clone https://github.com/bluesky-social/social-app
|
||||||
|
git clone https://github.com/itaru2622/bluesky-selfhost-env
|
153
compose.yaml
Normal file
153
compose.yaml
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
services:
|
||||||
|
|
||||||
|
database:
|
||||||
|
image: postgres:16-alpine
|
||||||
|
restart: always
|
||||||
|
env_file:
|
||||||
|
- ./envs/postgres
|
||||||
|
volumes:
|
||||||
|
- ./configs/postgres/init/:/docker-entrypoint-initdb.d/
|
||||||
|
- ./data/postgres/:/var/lib/postgresql/data/
|
||||||
|
healthcheck:
|
||||||
|
test: "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"
|
||||||
|
interval: 5s
|
||||||
|
retries: 20
|
||||||
|
|
||||||
|
redis:
|
||||||
|
image: redis:alpine
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- ./data/redis/:/data/
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "redis-cli", "ping", "|", "grep", "PONG"]
|
||||||
|
interval: 1s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
|
||||||
|
pds-fix-permission:
|
||||||
|
image: alpine:latest
|
||||||
|
volumes:
|
||||||
|
- ./data/pds/:/data/
|
||||||
|
command: chown 1000.1000 /data
|
||||||
|
|
||||||
|
bsky-fix-permission:
|
||||||
|
image: alpine:latest
|
||||||
|
volumes:
|
||||||
|
- ./data/bsky/:/data/
|
||||||
|
command: chown 1000.1000 /data
|
||||||
|
|
||||||
|
opensearch-fix-permission:
|
||||||
|
image: alpine:latest
|
||||||
|
volumes:
|
||||||
|
- ./data/opensearch/:/data/
|
||||||
|
command: chown 1000.1000 /data/
|
||||||
|
|
||||||
|
plc:
|
||||||
|
ports:
|
||||||
|
- 2582:3000
|
||||||
|
build:
|
||||||
|
context: ./repos/did-method-plc/
|
||||||
|
dockerfile: packages/server/Dockerfile
|
||||||
|
restart: always
|
||||||
|
env_file:
|
||||||
|
- ./envs/plc
|
||||||
|
depends_on:
|
||||||
|
database:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
|
pds:
|
||||||
|
ports:
|
||||||
|
- 2583:3000
|
||||||
|
build:
|
||||||
|
context: ./repos/atproto/
|
||||||
|
dockerfile: services/pds/Dockerfile
|
||||||
|
restart: always
|
||||||
|
env_file:
|
||||||
|
- ./envs/pds
|
||||||
|
volumes:
|
||||||
|
- ./data/pds/:/data/
|
||||||
|
depends_on:
|
||||||
|
database:
|
||||||
|
condition: service_healthy
|
||||||
|
pds-fix-permission:
|
||||||
|
condition: service_completed_successfully
|
||||||
|
|
||||||
|
bgs:
|
||||||
|
ports:
|
||||||
|
- 2470:2470
|
||||||
|
build:
|
||||||
|
context: ./repos/indigo/
|
||||||
|
dockerfile: cmd/bigsky/Dockerfile
|
||||||
|
restart: always
|
||||||
|
env_file:
|
||||||
|
- ./envs/bgs
|
||||||
|
volumes:
|
||||||
|
- ./data/bgs/:/data/
|
||||||
|
depends_on:
|
||||||
|
database:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
|
ozone:
|
||||||
|
ports:
|
||||||
|
- 2585:3000
|
||||||
|
build:
|
||||||
|
context: ./repos/atproto/
|
||||||
|
dockerfile: services/ozone/Dockerfile
|
||||||
|
restart: always
|
||||||
|
command: node --enable-source-maps api.js
|
||||||
|
volumes:
|
||||||
|
- ./data/ozone/:/data/
|
||||||
|
# - ./repos/ozone.js:/app/services/ozone/api.js:ro
|
||||||
|
env_file:
|
||||||
|
- ./envs/ozone
|
||||||
|
healthcheck:
|
||||||
|
test: "wget -q --spider http://localhost:3000/xrpc/_health"
|
||||||
|
interval: 5s
|
||||||
|
retries: 20
|
||||||
|
depends_on:
|
||||||
|
database:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
|
ozone-daemon:
|
||||||
|
build:
|
||||||
|
context: ./repos/atproto/
|
||||||
|
dockerfile: services/ozone/Dockerfile
|
||||||
|
restart: always
|
||||||
|
command: node --enable-source-maps daemon.js
|
||||||
|
env_file:
|
||||||
|
- ./envs/ozone
|
||||||
|
depends_on:
|
||||||
|
ozone:
|
||||||
|
condition: service_healthy
|
||||||
|
database:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
|
social-app:
|
||||||
|
ports:
|
||||||
|
- 8100:8100
|
||||||
|
image: itaru2622/bluesky-social-app
|
||||||
|
restart: always
|
||||||
|
env_file:
|
||||||
|
- ./envs/social-app
|
||||||
|
command: "/usr/bin/bskyweb serve"
|
||||||
|
|
||||||
|
bsky:
|
||||||
|
ports:
|
||||||
|
- 2584:2584
|
||||||
|
image: itaru2622/bluesky-atproto-bsky
|
||||||
|
restart: always
|
||||||
|
env_file:
|
||||||
|
- ./envs/bsky
|
||||||
|
user: root
|
||||||
|
volumes:
|
||||||
|
- ./data/bsky/:/data/
|
||||||
|
# - ./repos/bsky.js:/app/services/bsky/api.js:ro
|
||||||
|
command: node --enable-source-maps api.js
|
||||||
|
depends_on:
|
||||||
|
database:
|
||||||
|
condition: service_healthy
|
||||||
|
redis:
|
||||||
|
condition: service_healthy
|
||||||
|
bsky-fix-permission:
|
||||||
|
condition: service_completed_successfully
|
||||||
|
|
35
configs/postgres/init/init.sql
Normal file
35
configs/postgres/init/init.sql
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
-- PLC
|
||||||
|
CREATE DATABASE plc;
|
||||||
|
GRANT ALL PRIVILEGES ON DATABASE plc TO postgres;
|
||||||
|
|
||||||
|
-- BGS
|
||||||
|
CREATE DATABASE bgs;
|
||||||
|
CREATE DATABASE carstore;
|
||||||
|
GRANT ALL PRIVILEGES ON DATABASE bgs TO postgres;
|
||||||
|
GRANT ALL PRIVILEGES ON DATABASE carstore TO postgres;
|
||||||
|
|
||||||
|
-- bsky(AppView)
|
||||||
|
--CREATE DATABASE appview;
|
||||||
|
--GRANT ALL PRIVILEGES ON DATABASE appview TO postgres;
|
||||||
|
CREATE DATABASE bsky;
|
||||||
|
GRANT ALL PRIVILEGES ON DATABASE bsky TO postgres;
|
||||||
|
|
||||||
|
-- ozone(Moderation)
|
||||||
|
--CREATE DATABASE moderation;
|
||||||
|
--GRANT ALL PRIVILEGES ON DATABASE moderation TO postgres;
|
||||||
|
CREATE DATABASE ozone;
|
||||||
|
GRANT ALL PRIVILEGES ON DATABASE ozone TO postgres;
|
||||||
|
|
||||||
|
-- search(palomar)
|
||||||
|
CREATE DATABASE search;
|
||||||
|
GRANT ALL PRIVILEGES ON DATABASE search TO postgres;
|
||||||
|
--CREATE DATABASE palomar;
|
||||||
|
--GRANT ALL PRIVILEGES ON DATABASE palomar TO postgres;
|
||||||
|
|
||||||
|
-- PDS
|
||||||
|
CREATE DATABASE pds;
|
||||||
|
GRANT ALL PRIVILEGES ON DATABASE pds TO postgres;
|
||||||
|
|
||||||
|
-- BSYNC
|
||||||
|
CREATE DATABASE bsync;
|
||||||
|
GRANT ALL PRIVILEGES ON DATABASE bsync TO postgres;
|
6
envs/bgs
Normal file
6
envs/bgs
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
DATABASE_URL=postgres://postgres:postgres@database/bgs
|
||||||
|
CARSTORE_DATABASE_URL=postgres://postgres:postgres@database/carstore
|
||||||
|
DATA_DIR=/data
|
||||||
|
ATP_PLC_HOST=https://plc.${host}
|
||||||
|
|
||||||
|
BGS_ADMIN_KEY
|
19
envs/bsky
Normal file
19
envs/bsky
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
BSKY_PORT=2584
|
||||||
|
BSKY_BLOB_CACHE_LOC=/data/
|
||||||
|
BSKY_BSYNC_HTTP_VERSION=1.1
|
||||||
|
BSKY_BSYNC_PORT=3002
|
||||||
|
BSKY_BSYNC_URL=http://bsky:3002
|
||||||
|
BSKY_COURIER_URL=http://fake-courier.example.invalid/
|
||||||
|
BSKY_DATAPLANE_HTTP_VERSION=1.1
|
||||||
|
BSKY_DATAPLANE_PORT=3001
|
||||||
|
BSKY_DATAPLANE_URLS=http://bsky:3001
|
||||||
|
BSKY_DB_POSTGRES_URL=postgres://postgres:postgres@database/bsky
|
||||||
|
BSKY_DID_PLC_URL=https://plc.${host}
|
||||||
|
BSKY_PUBLIC_URL=https://bsky.${host}
|
||||||
|
BSKY_REPO_PROVIDER=wss://bgs.${host}
|
||||||
|
BSKY_SERVER_DID=did:web:bsky.${host}
|
||||||
|
MOD_SERVICE_DID=did:web:ozone.${host}
|
||||||
|
|
||||||
|
#BSKY_IMG_URI_ENDPOINT=https://bsky.${host}/img
|
||||||
|
BSKY_ADMIN_PASSWORDS
|
||||||
|
BSKY_SERVICE_SIGNING_KEY
|
21
envs/ozone
Normal file
21
envs/ozone
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
OZONE_SERVER_DID=did:web:ozone.${host}
|
||||||
|
OZONE_PUBLIC_URL=https://ozone.${host}
|
||||||
|
OZONE_ADMIN_HANDLE=${user}.${host}
|
||||||
|
OZONE_MODERATOR_DIDS=${did}
|
||||||
|
OZONE_ADMIN_DIDS=${did}
|
||||||
|
OZONE_DB_POSTGRES_URL=postgres://postgres:postgres@database/ozone
|
||||||
|
OZONE_DID_PLC_URL=https://plc.${host}
|
||||||
|
NEXT_PUBLIC_PLC_DIRECTORY_URL=https://plc.${host}
|
||||||
|
NEXT_PUBLIC_OZONE_SERVICE_DID=did:web:ozone.${host}
|
||||||
|
NEXT_PUBLIC_SOCIAL_APP_DOMAIN=mod.${host}
|
||||||
|
NEXT_PUBLIC_SOCIAL_APP_URL=https://mod.${host}
|
||||||
|
OZONE_APPVIEW_DID=did:web:bsky.${host}
|
||||||
|
OZONE_APPVIEW_URL=https://bsky.${host}
|
||||||
|
OZONE_APPVIEW_PUSH_EVENTS=false
|
||||||
|
OZONE_PDS_DID=did:web:${host}
|
||||||
|
OZONE_PDS_URL=https://${host}
|
||||||
|
OZONE_DEV_MODE=true
|
||||||
|
OZONE_DB_MIGRATE=1
|
||||||
|
|
||||||
|
OZONE_ADMIN_PASSWORD
|
||||||
|
OZONE_SIGNING_KEY_HEX
|
21
envs/pds
Normal file
21
envs/pds
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
PDS_HOSTNAME=${host}
|
||||||
|
PDS_DB_POSTGRES_URL=postgres://postgres:postgres@database/pds
|
||||||
|
PDS_DATA_DIRECTORY=/data
|
||||||
|
PDS_BLOBSTORE_DISK_LOCATION=/data/img/static
|
||||||
|
#PDS_BLOBSTORE_DISK_TMP_LOCATION=/data/img/tmp
|
||||||
|
PDS_BSKY_APP_VIEW_DID=did:web:bsky.${host}
|
||||||
|
PDS_BSKY_APP_VIEW_URL=https://bsky.${host}
|
||||||
|
PDS_CRAWLERS=https://bgs.${host}
|
||||||
|
PDS_DEV_MODE=true
|
||||||
|
PDS_DID_PLC_URL=https://plc.${host}
|
||||||
|
PDS_ENABLE_DID_DOC_WITH_SESSION=true
|
||||||
|
PDS_INVITE_INTERVAL=604800000
|
||||||
|
PDS_SERVICE_DID=did:web:${host}
|
||||||
|
PDS_EMAIL_FROM_ADDRESS=no-reply@${host}
|
||||||
|
|
||||||
|
PDS_INVITE_REQUIRED=true
|
||||||
|
PDS_EMAIL_SMTP_URL=smtps://${user}:${app_password}@smtp.gmail.com
|
||||||
|
PDS_ADMIN_PASSWORD
|
||||||
|
PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX
|
||||||
|
PDS_REPO_SIGNING_KEY_K256_PRIVATE_KEY_HEX
|
||||||
|
PDS_JWT_SECRET
|
4
envs/plc
Normal file
4
envs/plc
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
DATABASE_URL=postgres://postgres:postgres@database/plc
|
||||||
|
DB_CREDS_JSON='{"username":"postgres","password":"postgres","host":"database","port":"5432","database":"plc"}'
|
||||||
|
ENABLE_MIGRATIONS=true
|
||||||
|
DB_MIGRATE_CREDS_JSON='{"username":"postgres","password":"postgres","host":"database","port":"5432","database":"plc"}'
|
4
envs/postgres
Normal file
4
envs/postgres
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#POSTGRES_INITDB_ARGS=--encoding=UTF-8 --lc-collate=C --lc-ctype=C
|
||||||
|
POSTGRES_USER=postgres
|
||||||
|
POSTGRES_PASSWORD=postgres
|
||||||
|
POSTGRES_DB=healthcheck
|
1
envs/social-app
Normal file
1
envs/social-app
Normal file
@@ -0,0 +1 @@
|
|||||||
|
ATP_APPVIEW_HOST=https://bsky.${host}
|
0
repos/.keep
Normal file
0
repos/.keep
Normal file
1
repos/atproto
Submodule
1
repos/atproto
Submodule
Submodule repos/atproto added at 7f26b17652
1
repos/did-method-plc
Submodule
1
repos/did-method-plc
Submodule
Submodule repos/did-method-plc added at 13da315787
1
repos/feed-generator
Submodule
1
repos/feed-generator
Submodule
Submodule repos/feed-generator added at 9a887dd8f2
1
repos/social-app
Submodule
1
repos/social-app
Submodule
Submodule repos/social-app added at fd2e94f353
Reference in New Issue
Block a user