fix install.zsh
This commit is contained in:
74
install.zsh
74
install.zsh
@@ -381,20 +381,66 @@ EOF
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
}
|
||||
|
||||
function at-repos-docker-verify() {
|
||||
local service=$1
|
||||
local image="at-${service}:latest"
|
||||
local check_file=""
|
||||
case $service in
|
||||
pds) check_file="/app/services/pds/index.js" ;;
|
||||
bsky) check_file="/app/services/bsky/api.js" ;;
|
||||
ozone) check_file="/app/services/ozone/api.js" ;;
|
||||
bgs) check_file="/bigsky" ;;
|
||||
plc) check_file="/app/packages/server/dist/index.js" ;;
|
||||
*) return 0 ;;
|
||||
esac
|
||||
if docker run --rm "$image" test -f "$check_file" 2>/dev/null; then
|
||||
echo " ✅ Verified: $check_file exists"
|
||||
return 0
|
||||
else
|
||||
echo " ❌ FAILED: $check_file not found in $image"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function at-repos-build-docker-atproto() {
|
||||
cd $d
|
||||
docker image prune -a
|
||||
local failed=()
|
||||
if [ -z "$1" ];then
|
||||
for ((i=1; i<=${#services}; i++)); do
|
||||
service=${services[$i]}
|
||||
docker compose build --no-cache $service
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo "🔨 Building: $service"
|
||||
if ! docker compose build --no-cache $service; then
|
||||
echo " ❌ Build failed: $service"
|
||||
failed+=($service)
|
||||
continue
|
||||
fi
|
||||
if ! at-repos-docker-verify $service; then
|
||||
failed+=($service)
|
||||
continue
|
||||
fi
|
||||
if [ "$service" = "ozone" ]; then
|
||||
docker compose build --no-cache ${service}-web
|
||||
fi
|
||||
done
|
||||
else
|
||||
docker compose build --no-cache $1
|
||||
echo "🔨 Building: $1"
|
||||
if ! docker compose build --no-cache $1; then
|
||||
echo "❌ Build failed: $1"
|
||||
return 1
|
||||
fi
|
||||
if ! at-repos-docker-verify $1; then
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
if [ ${#failed[@]} -gt 0 ]; then
|
||||
echo ""
|
||||
echo "❌ Failed builds: ${failed[*]}"
|
||||
echo "⚠️ Do NOT push these images."
|
||||
return 1
|
||||
fi
|
||||
echo ""
|
||||
echo "✅ All builds verified successfully."
|
||||
}
|
||||
|
||||
function at-repos-push-reset() {
|
||||
@@ -412,25 +458,41 @@ function at-repos-push-reset() {
|
||||
}
|
||||
|
||||
function at-repos-push-docker() {
|
||||
local dtag=$(date +%Y%m%d)
|
||||
if [ -z "$1" ] || [ "$1" = "push" ]; then
|
||||
for service in "${services[@]}"; do
|
||||
if ! at-repos-docker-verify $service; then
|
||||
echo "⚠️ Skipping push: $service (verification failed)"
|
||||
continue
|
||||
fi
|
||||
docker tag at-${service}:latest localhost:${dport}/${service}:latest
|
||||
docker tag at-${service}:latest localhost:${dport}/${service}:${dtag}
|
||||
docker push localhost:${dport}/${service}:latest
|
||||
docker push localhost:${dport}/${service}:${dtag}
|
||||
if [ "$service" = "ozone" ]; then
|
||||
docker tag at-${service}-web:latest localhost:${dport}/${service}-web:latest
|
||||
docker tag at-${service}-web:latest localhost:${dport}/${service}-web:${dtag}
|
||||
docker push localhost:${dport}/${service}-web:latest
|
||||
docker push localhost:${dport}/${service}-web:${dtag}
|
||||
fi
|
||||
done
|
||||
else
|
||||
docker tag at-${1}:latest localhost:${dport}/${1}:latest
|
||||
docker push localhost:${dport}/${1}:latest
|
||||
if ! at-repos-docker-verify $1; then
|
||||
echo "❌ Push aborted: $1 (verification failed)"
|
||||
return 1
|
||||
fi
|
||||
docker tag at-${1}:latest localhost:${dport}/${1}:latest
|
||||
docker tag at-${1}:latest localhost:${dport}/${1}:${dtag}
|
||||
docker push localhost:${dport}/${1}:latest
|
||||
docker push localhost:${dport}/${1}:${dtag}
|
||||
fi
|
||||
echo "📦 Pushed with tags: latest, ${dtag}"
|
||||
}
|
||||
|
||||
function at-repos-pull-docker() {
|
||||
cd $d
|
||||
docker image prune -a
|
||||
docker compose up -d --pull always
|
||||
echo "💡 Run 'docker image prune' manually to clean up old images."
|
||||
}
|
||||
|
||||
function at-repos-reset-bgs-db() {
|
||||
|
||||
Reference in New Issue
Block a user