toykity Claude Opus 4.7 commited on
Commit
ddcfdbb
·
1 Parent(s): 2107f70

add endpoint connectivity diagnostic

Browse files

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

Dockerfile CHANGED
@@ -1,22 +1,20 @@
1
- # Postiz - Custom image with cloudflared for HF Spaces
2
- # Uses pre-built image from Docker Hub (includes cloudflared binary)
3
  FROM toykitpostiz/postiz:tunnel
4
 
5
  USER root
6
 
7
- # Replace nginx config (port 7860 only, no gRPC block)
8
  COPY var/docker/nginx.conf /etc/nginx/nginx.conf
9
 
10
- # Temporal mTLS client certificates
11
  COPY var/docker/temporal/temporal-mtls/client.crt /etc/nginx/ssl/client.crt
12
  COPY var/docker/temporal/temporal-mtls/client.key /etc/nginx/ssl/client.key
13
  COPY var/docker/temporal/temporal-mtls/ca.crt /etc/nginx/ssl/ca.crt
14
  RUN chmod 600 /etc/nginx/ssl/client.key
15
 
16
- # Ensure /data dir exists for HF Spaces persistence
17
  RUN mkdir -p /data
18
 
19
- # Startup script: cloudflared proxy + Temporal mTLS patch + original entrypoint
 
 
20
  COPY var/docker/start.sh /app/start.sh
21
  RUN chmod +x /app/start.sh
22
 
 
1
+ # Postiz - Custom image for HF Spaces
 
2
  FROM toykitpostiz/postiz:tunnel
3
 
4
  USER root
5
 
 
6
  COPY var/docker/nginx.conf /etc/nginx/nginx.conf
7
 
 
8
  COPY var/docker/temporal/temporal-mtls/client.crt /etc/nginx/ssl/client.crt
9
  COPY var/docker/temporal/temporal-mtls/client.key /etc/nginx/ssl/client.key
10
  COPY var/docker/temporal/temporal-mtls/ca.crt /etc/nginx/ssl/ca.crt
11
  RUN chmod 600 /etc/nginx/ssl/client.key
12
 
 
13
  RUN mkdir -p /data
14
 
15
+ COPY var/docker/endpoint-check.sh /app/endpoint-check.sh
16
+ RUN chmod +x /app/endpoint-check.sh
17
+
18
  COPY var/docker/start.sh /app/start.sh
19
  RUN chmod +x /app/start.sh
20
 
var/docker/endpoint-check.sh ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ # Endpoint connectivity check - tests external API reachability from this environment
3
+ # Results are logged for diagnostic purposes
4
+
5
+ echo "=== Endpoint Connectivity Check ==="
6
+
7
+ ENDPOINTS="
8
+ api.x.com
9
+ api.linkedin.com
10
+ oauth.reddit.com
11
+ open.tiktokapis.com
12
+ api.pinterest.com
13
+ slack.com
14
+ api.twitch.tv
15
+ api.kick.com
16
+ bsky.social
17
+ api.dribbble.com
18
+ api.medium.com
19
+ api.vk.com
20
+ api.whop.com
21
+ api2.skool.com
22
+ mastodon.social
23
+ warpcast.com
24
+ primal.net
25
+ dev.to
26
+ mewe.com
27
+ www.moltbook.com
28
+ "
29
+
30
+ for ep in $ENDPOINTS; do
31
+ result=$(curl -s -o /dev/null -w "%{http_code}:%{time_total}" --max-time 10 "https://$ep" 2>/dev/null || echo "000:timeout")
32
+ code=$(echo "$result" | cut -d: -f1)
33
+ time=$(echo "$result" | cut -d: -f2)
34
+ if [ "$code" = "000" ]; then
35
+ echo "[endpoint-check] $ep -> UNREACHABLE ($time)"
36
+ else
37
+ echo "[endpoint-check] $ep -> OK ($code, ${time}s)"
38
+ fi
39
+ done
40
+
41
+ echo "=== Check Complete ==="
var/docker/start.sh CHANGED
@@ -3,6 +3,9 @@ set -e
3
 
4
  echo "=== Postiz HF Space Startup ==="
5
 
 
 
 
6
  # Start cloudflared access tcp proxy for PostgreSQL (if configured)
7
  if [ -n "$TUNNEL_SERVICE_TOKEN_ID" ] && [ -n "$CF_TUNNEL_HOSTNAME" ]; then
8
  echo "Starting cloudflared access tcp proxy -> $CF_TUNNEL_HOSTNAME (PG)"
 
3
 
4
  echo "=== Postiz HF Space Startup ==="
5
 
6
+ # Run endpoint connectivity check (diagnostic)
7
+ bash /app/endpoint-check.sh || true
8
+
9
  # Start cloudflared access tcp proxy for PostgreSQL (if configured)
10
  if [ -n "$TUNNEL_SERVICE_TOKEN_ID" ] && [ -n "$CF_TUNNEL_HOSTNAME" ]; then
11
  echo "Starting cloudflared access tcp proxy -> $CF_TUNNEL_HOSTNAME (PG)"