fix bgs downgrade
This commit is contained in:
@@ -86,6 +86,7 @@ services:
|
||||
depends_on:
|
||||
database:
|
||||
condition: service_healthy
|
||||
#command: ["/bigsky", "--crawl-insecure-ws"]
|
||||
|
||||
social-app:
|
||||
ports:
|
||||
|
||||
99
install.zsh
99
install.zsh
@@ -52,6 +52,12 @@ function at-repos-env() {
|
||||
name=${host%%.*}
|
||||
domain=${host##*.}
|
||||
dport=5000
|
||||
|
||||
typeset -A PINNED_COMMITS
|
||||
PINNED_COMMITS=(
|
||||
[indigo]="d49b454196351c988ceb5ce1f5e21b689487b5ab"
|
||||
[atproto]="104e6ed37b0589cc000109dc76316be35b2257e1"
|
||||
)
|
||||
}
|
||||
|
||||
# Arrays for patch management
|
||||
@@ -120,31 +126,23 @@ function at-repos-pull() {
|
||||
cd $d
|
||||
}
|
||||
|
||||
function at-repos-social-app-ios-patch() {
|
||||
$d/ios/setup.zsh
|
||||
function at-repos-checkout-pinned() {
|
||||
echo "🔒 Checking out pinned commits..."
|
||||
cd $d/repos
|
||||
for repo_name pinned_commit in ${(kv)PINNED_COMMITS}; do
|
||||
if [ -n "$pinned_commit" ] && [ -d "$d/repos/$repo_name" ]; then
|
||||
echo " 📌 $repo_name -> $pinned_commit"
|
||||
cd $d/repos/$repo_name
|
||||
git fetch origin
|
||||
git checkout $pinned_commit
|
||||
cd $d/repos
|
||||
fi
|
||||
done
|
||||
cd $d
|
||||
}
|
||||
|
||||
function at-repos-social-app-avatar-write() {
|
||||
did_admin=did:plc:6qyecktefllvenje24fcxnie
|
||||
dt=$d/repos/social-app/src
|
||||
cd $dt
|
||||
grep -R syu.is .|cut -d : -f 1|sort -u|xargs sediment "s/syu.is/${host}/g"
|
||||
grep -R web.syu.is .|cut -d : -f 1|sort -u|xargs sediment "s/web.syu.is/web.${host}/g"
|
||||
f=$dt/lib/constants.ts
|
||||
sediment "s#export const BSKY_SERVICE = 'https://bsky.social'#export const BSKY_SERVICE = 'https://${host}'#g" $f
|
||||
sediment "s#export const BSKY_SERVICE_DID = 'did:web:bsky.social'#export const BSKY_SERVICE_DID = 'did:web:${host}'#g" $f
|
||||
sediment "s#export const PUBLIC_BSKY_SERVICE = 'https://public.api.bsky.app'#export const PUBLIC_BSKY_SERVICE = 'https://bsky.${host}'#g" $f
|
||||
sediment "s#export const PUBLIC_APPVIEW = 'https://api.bsky.app'#export const PUBLIC_APPVIEW = 'https://bsky.${host}'#g" $f
|
||||
sediment "s#export const PUBLIC_APPVIEW_DID = 'did:web:api.bsky.app'#export const PUBLIC_APPVIEW_DID = 'did:web:bsky.${host}'#g" $f
|
||||
|
||||
f=$dt/view/com/util/UserAvatar.tsx
|
||||
curl -sL https://raw.githubusercontent.com/bluesky-social/social-app/refs/heads/main/src/view/com/util/UserAvatar.tsx -o $f
|
||||
sediment "s#/img/avatar/plain/#https://cdn.web.syu.is/img/avatar/plain/#g" $f
|
||||
sediment "s#/img/avatar_thumbnail/plain/#https://bsky.${host}/img/avatar/plain/#g" $f
|
||||
sediment "s#source={{uri: avatar}}#source={{ uri: hackModifyThumbnailPath(avatar, 1 > 0), }}#g" $f
|
||||
curl -sL https://raw.githubusercontent.com/bluesky-social/social-app/refs/heads/main/src/lib/strings/url-helpers.ts -o $dt/lib/strings/url-helpers.ts
|
||||
sediment "s#https://go.web.syu.is/redirect?u=\${encodeURIComponent(url)}#\${url}#g" $dt/lib/strings/url-helpers.ts
|
||||
grep -R $did_admin .|cut -d : -f 1|sort -u|xargs sediment "s/${did_admin}/${did}/g"
|
||||
function at-repos-social-app-ios-patch() {
|
||||
$d/ios/setup.zsh
|
||||
}
|
||||
|
||||
# Common patch function with status detection
|
||||
@@ -340,6 +338,9 @@ function at-repos-build-docker-atproto() {
|
||||
for ((i=1; i<=${#services}; i++)); do
|
||||
service=${services[$i]}
|
||||
docker compose build --no-cache $service
|
||||
if [ "$service" = "ozone" ]; then
|
||||
docker compose build --no-cache ${service}-web
|
||||
fi
|
||||
done
|
||||
else
|
||||
docker compose build --no-cache $1
|
||||
@@ -361,12 +362,11 @@ function at-repos-push-reset() {
|
||||
}
|
||||
|
||||
function at-repos-push-docker() {
|
||||
if [ -z "$1" ];then
|
||||
for ((i=1; i<=${#services}; i++)); do
|
||||
service=${services[$i]}
|
||||
if [ -z "$1" ] || [ "$1" = "push" ]; then
|
||||
for service in "${services[@]}"; do
|
||||
docker tag at-${service}:latest localhost:${dport}/${service}:latest
|
||||
docker push localhost:${dport}/${service}:latest
|
||||
if [ "$service" == "ozone" ];then
|
||||
if [ "$service" = "ozone" ]; then
|
||||
docker tag at-${service}-web:latest localhost:${dport}/${service}-web:latest
|
||||
docker push localhost:${dport}/${service}-web:latest
|
||||
fi
|
||||
@@ -411,28 +411,55 @@ function at-repos-reset-bgs-db() {
|
||||
echo "⚙️ Updating Slurp Config..."
|
||||
docker exec -i $dp psql -U postgres -d bgs -c "UPDATE slurp_configs SET new_subs_disabled = false, new_pds_per_day_limit = 1000 WHERE id = 1;"
|
||||
|
||||
echo "🔗 Registering Trusted Domain & Resetting Repos..."
|
||||
# host=pds:3000
|
||||
echo "🔗 Registering Trusted Domain..."
|
||||
# Retry loop for addTrustedDomain as BGS might still be warming up
|
||||
for i in {1..5}; do
|
||||
if curl -f -X POST "https://bgs.${host}/admin/pds/addTrustedDomain?domain=${host}" -H "Authorization: Bearer ${BGS_ADMIN_KEY}"; then
|
||||
echo ""
|
||||
echo "✅ Trusted domain registered"
|
||||
break
|
||||
fi
|
||||
echo "Bot failed to contact BGS (attempt $i/5)... waiting 5s"
|
||||
echo "Failed to contact BGS (attempt $i/5)... waiting 5s"
|
||||
sleep 5
|
||||
done
|
||||
|
||||
echo "🔗 Requesting PDS Crawl..."
|
||||
# Request BGS to crawl the PDS - this registers the PDS and starts subscription
|
||||
for i in {1..5}; do
|
||||
result=$(curl -s -X POST "https://bgs.${host}/admin/pds/requestCrawl" \
|
||||
-H "Authorization: Bearer ${BGS_ADMIN_KEY}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"hostname\":\"{$host}\"}" \
|
||||
-w "%{http_code}" -o /dev/null)
|
||||
if [ "$result" = "200" ]; then
|
||||
echo "✅ PDS crawl requested successfully"
|
||||
break
|
||||
fi
|
||||
echo "Failed to request crawl (attempt $i/5, status: $result)... waiting 5s"
|
||||
sleep 5
|
||||
done
|
||||
|
||||
echo "⏳ Waiting 5s for BGS to connect to PDS..."
|
||||
sleep 5
|
||||
|
||||
echo "🔄 Triggering repo sync for existing users..."
|
||||
for ((i=1; i<=${#handles}; i++)); do
|
||||
handle=${handles[$i]}
|
||||
did=`curl -sL "https://${host}/xrpc/com.atproto.repo.describeRepo?repo=${handle}" |jq -r .did`
|
||||
if [ ! -z "$did" ] && [ "$did" != "null" ]; then
|
||||
echo "Resetting repo: $handle ($did)"
|
||||
curl -X POST "https://bgs.${host}/admin/repo/reset?did=${did}" \
|
||||
-H "Authorization: Bearer ${BGS_ADMIN_KEY}"
|
||||
did=$(curl -sL "https://${host}/xrpc/com.atproto.repo.describeRepo?repo=${handle}" | jq -r .did)
|
||||
if [ -n "$did" ] && [ "$did" != "null" ]; then
|
||||
echo " Syncing repo: $handle ($did)"
|
||||
# Use takedown=false to trigger a resync without actually taking down
|
||||
curl -s -X POST "https://bgs.${host}/admin/repo/takedown?did=${did}&takedown=false" \
|
||||
-H "Authorization: Bearer ${BGS_ADMIN_KEY}" || true
|
||||
else
|
||||
echo "Skipping reset for $handle (DID not found)"
|
||||
echo " Skipping $handle (DID not found)"
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "✅ BGS reset complete!"
|
||||
echo " PDS should now be subscribed and syncing repos."
|
||||
}
|
||||
|
||||
function at-repos-feed-generator-start-push() {
|
||||
@@ -543,8 +570,8 @@ case "`cat /etc/hostname`" in
|
||||
*)
|
||||
at-repos-clone
|
||||
at-repos-pull
|
||||
at-repos-checkout-pinned
|
||||
at-repos-social-app-ios-patch
|
||||
#at-repos-social-app-avatar-write
|
||||
at-repos-patch-apply-all
|
||||
at-repos-ozone-patch
|
||||
show-failed-patches
|
||||
|
||||
Reference in New Issue
Block a user