ai/at
1
0
This commit is contained in:
2024-10-18 23:46:53 +09:00
parent c675fe0fd3
commit 6b12d8318b
16 changed files with 278 additions and 1 deletions

View File

@@ -29,6 +29,8 @@
2. https://${host}/xrpc/com.atproto.sync.getBlob?did=${did}&cid=${cid} 2. https://${host}/xrpc/com.atproto.sync.getBlob?did=${did}&cid=${cid}
``` ```
docker composeはportsを書かなければ公開されません。内部間のみ有効になります。公開するもののみportsをつけましょう。
## api ## api
```sh ```sh
@@ -36,7 +38,7 @@
$ curl -X POST -H "Content-Type: application/json" -sL https://${pds}/xrpc/com.atproto.server.createAccount -d "{\"email\": \"$email\", \"handle\": \"$handle\", \"password\": \"$password\"}" $ curl -X POST -H "Content-Type: application/json" -sL https://${pds}/xrpc/com.atproto.server.createAccount -d "{\"email\": \"$email\", \"handle\": \"$handle\", \"password\": \"$password\"}"
``` ```
3文字以下の名前を使用するには`pds/handle`を変更します。また、social-app(web client)からは3文字以下のアカウントを作成できません。apiから作成してください。 3文字以下の名前を使用するには`src/pds/handle`を変更します。また、social-app(web client)からは3文字以下のアカウントを作成できません。apiから作成してください。
- [/atproto/packages/pds/src/handle/index.ts](https://github.com/bluesky-social/atproto/blame/d4d5a6edba972c0e9976289bde8bc0b42ff547ca/packages/pds/src/handle/index.ts#L86-L88) - [/atproto/packages/pds/src/handle/index.ts](https://github.com/bluesky-social/atproto/blame/d4d5a6edba972c0e9976289bde8bc0b42ff547ca/packages/pds/src/handle/index.ts#L86-L88)

7
build.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/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

153
compose.yaml Normal file
View 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

View 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
View 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
View 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
View 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
View 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
View 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
View 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
View File

@@ -0,0 +1 @@
ATP_APPVIEW_HOST=https://bsky.${host}

0
repos/.keep Normal file
View File

1
repos/atproto Submodule

Submodule repos/atproto added at 7f26b17652

1
repos/did-method-plc Submodule

Submodule repos/did-method-plc added at 13da315787

1
repos/feed-generator Submodule

Submodule repos/feed-generator added at 9a887dd8f2

1
repos/social-app Submodule

Submodule repos/social-app added at fd2e94f353