Mirror from bluesky-social/pds

Update the installer script for production network usage (#39)

* update the installer script for production network usage

* installer: prompt user to create an account after installation

* fix incorrectly named env

authored by

Jake Gold and committed by
GitHub
643a9ffa 307e2353

+39 -18
+39 -18
installer.sh
··· 18 18 # The Docker compose file. 19 19 COMPOSE_URL="https://raw.githubusercontent.com/bluesky-social/pds/main/compose.yaml" 20 20 21 + # The pdsadmin script. 22 + PDSADMIN_URL="https://raw.githubusercontent.com/bluesky-social/pds/main/pdsadmin.sh" 23 + 21 24 # System dependencies. 22 25 REQUIRED_SYSTEM_PACKAGES=" 23 26 ca-certificates 24 27 curl 25 28 gnupg 29 + jq 26 30 lsb-release 27 31 openssl 28 32 xxd 29 33 " 30 34 # Docker packages. 31 35 REQUIRED_DOCKER_PACKAGES=" 36 + containerd.io 32 37 docker-ce 33 38 docker-ce-cli 34 39 docker-compose-plugin 35 - containerd.io 36 40 " 37 41 38 42 PUBLIC_IP="" ··· 45 49 PDS_DATADIR="${1:-/pds}" 46 50 PDS_HOSTNAME="${2:-}" 47 51 PDS_ADMIN_EMAIL="${3:-}" 48 - PDS_DID_PLC_URL="https://plc.bsky-sandbox.dev" 49 - PDS_BSKY_APP_VIEW_ENDPOINT="https://api.bsky-sandbox.dev" 50 - PDS_BSKY_APP_VIEW_DID="did:web:api.bsky-sandbox.dev" 51 - PDS_CRAWLERS="https://bgs.bsky-sandbox.dev" 52 + PDS_DID_PLC_URL="https://plc.directory" 53 + PDS_BSKY_APP_VIEW_URL="https://api.bsky.app" 54 + PDS_BSKY_APP_VIEW_DID="did:web:api.bsky.app" 55 + PDS_CRAWLERS="https://bsky.network" 52 56 53 57 function usage { 54 58 local error="${1}" ··· 102 106 exit 1 103 107 fi 104 108 109 + # Enforce that the data directory is /pds since we're assuming it for now. 110 + # Later we can make this actually configurable. 111 + if [[ "${PDS_DATADIR}" != "/pds" ]]; then 112 + usage "The data directory must be /pds. Exiting..." 113 + fi 114 + 105 115 # Check if PDS is already installed. 106 116 if [[ -e "${PDS_DATADIR}/pds.sqlite" ]]; then 107 117 echo ··· 124 134 echo "For assistance, check https://github.com/bluesky-social/pds" 125 135 exit 1 126 136 fi 127 - 128 137 129 138 # 130 139 # Attempt to determine server's public IP. ··· 212 221 if [[ -z "${PDS_ADMIN_EMAIL}" ]]; then 213 222 usage "No admin email specified" 214 223 fi 215 - 216 224 217 225 # 218 226 # Install system packages. ··· 295 303 { 296 304 email ${PDS_ADMIN_EMAIL} 297 305 on_demand_tls { 298 - ask http://localhost:3000 306 + ask http://localhost:3000/check-handle 299 307 } 300 308 } 301 309 ··· 321 329 PDS_DB_SQLITE_LOCATION=${PDS_DATADIR}/pds.sqlite 322 330 PDS_BLOBSTORE_DISK_LOCATION=${PDS_DATADIR}/blocks 323 331 PDS_DID_PLC_URL=${PDS_DID_PLC_URL} 324 - PDS_BSKY_APP_VIEW_ENDPOINT=${PDS_BSKY_APP_VIEW_ENDPOINT} 332 + PDS_BSKY_APP_VIEW_URL=${PDS_BSKY_APP_VIEW_ENDPOINT} 325 333 PDS_BSKY_APP_VIEW_DID=${PDS_BSKY_APP_VIEW_DID} 326 334 PDS_CRAWLERS=${PDS_CRAWLERS} 327 335 PDS_CONFIG ··· 378 386 fi 379 387 fi 380 388 389 + # 390 + # Download and install pdadmin. 391 + # 392 + echo "* Downloading pdsadmin" 393 + curl \ 394 + --silent \ 395 + --show-error \ 396 + --fail \ 397 + --output "/usr/local/bin/pdsadmin" \ 398 + "${PDSADMIN_URL}" 399 + chmod +x /usr/local/bin/pdsadmin 400 + 381 401 cat <<INSTALLER_MESSAGE 382 402 ======================================================================== 383 403 PDS installation successful! ··· 386 406 Check service status : sudo systemctl status pds 387 407 Watch service logs : sudo docker logs -f pds 388 408 Backup service data : ${PDS_DATADIR} 409 + PDS Admin command : pdsadmin 389 410 390 411 Required Firewall Ports 391 412 ------------------------------------------------------------------------ ··· 403 424 404 425 Detected public IP of this server: ${PUBLIC_IP} 405 426 406 - # To create an invite code, run the following command: 407 - 408 - curl --silent \\ 409 - --show-error \\ 410 - --request POST \\ 411 - --user "admin:${PDS_ADMIN_PASSWORD}" \\ 412 - --header "Content-Type: application/json" \\ 413 - --data '{"useCount": 1}' \\ 414 - https://${PDS_HOSTNAME}/xrpc/com.atproto.server.createInviteCode 427 + To see pdsadmin commands, run "pdsadmin help" 415 428 416 429 ======================================================================== 417 430 INSTALLER_MESSAGE 431 + 432 + CREATE_ACCOUNT_PROMPT="" 433 + read -p "Create a PDS user account? (y/N): " CREATE_ACCOUNT_PROMPT 434 + 435 + if [[ "${CREATE_ACCOUNT_PROMPT}" =~ ^[Yy] ]]; then 436 + pdsadmin account create 437 + fi 438 + 418 439 } 419 440 420 441 # Run main function.