e70047ca0f
Using fizzy.localhost causes CORS errors when using minio for Active Storage because the minio endpoint is at minio.fizzy.localhost — a sibling subdomain, not a subdomain of the app host. Switching to app.fizzy.localhost makes both hosts subdomains of fizzy.localhost, resolving the CORS issue. See #2814 for the related minio CORS fix. fizzy.localhost will continue to work if people want to use it, but all docs and scripts have been updated to point to app.fizzy.localhost.
67 lines
1.8 KiB
Bash
Executable File
67 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env sh
|
|
|
|
PORT=3006
|
|
USE_TAILSCALE=0
|
|
USE_PUSH=0
|
|
|
|
for arg in "$@"; do
|
|
case $arg in
|
|
--tailscale) USE_TAILSCALE=1 ;;
|
|
--push) USE_PUSH=1 ;;
|
|
esac
|
|
done
|
|
|
|
if [ "$USE_PUSH" = "1" ]; then
|
|
if [ ! -f tmp/saas.txt ]; then
|
|
echo "Enabling SaaS mode for push notifications..."
|
|
./bin/rails saas:enable
|
|
fi
|
|
echo "Loading push credentials from 1Password..."
|
|
if ! eval "$(BUNDLE_GEMFILE=Gemfile.saas bundle exec push-dev)"; then
|
|
echo "Error: failed to load push credentials. Are you signed into 1Password?" >&2
|
|
exit 1
|
|
fi
|
|
if [ -z "$APNS_ENCRYPTION_KEY_B64" ] || [ -z "$APNS_KEY_ID" ]; then
|
|
echo "Error: Push credentials not set. Missing APNS_ENCRYPTION_KEY_B64 or APNS_KEY_ID." >&2
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
if [ ! -f tmp/solid-queue.txt ]; then
|
|
export SOLID_QUEUE_IN_PUMA=false
|
|
fi
|
|
|
|
if [ -f tmp/oss-config.txt ]; then
|
|
export OSS_CONFIG=1
|
|
fi
|
|
|
|
if [ "$USE_TAILSCALE" = "1" ]; then
|
|
if ! command -v tailscale >/dev/null 2>&1; then
|
|
echo "Error: tailscale not found" >&2
|
|
exit 1
|
|
fi
|
|
|
|
TS_STATUS=$(tailscale status --self --json 2>/dev/null)
|
|
if [ $? -ne 0 ]; then
|
|
echo "Error: tailscale not logged in" >&2
|
|
exit 1
|
|
fi
|
|
|
|
TS_HOSTNAME=$(echo "$TS_STATUS" | jq -r '.Self.DNSName | rtrimstr(".")')
|
|
TS_PORT="4$PORT"
|
|
|
|
stop_tailscale() { tailscale serve --https=$TS_PORT off >/dev/null 2>&1; }
|
|
trap stop_tailscale EXIT INT TERM
|
|
|
|
tailscale serve --bg --https=$TS_PORT localhost:$PORT >/dev/null 2>&1
|
|
if ! tailscale serve status --json 2>/dev/null | jq -e ".TCP.\"$TS_PORT\"" >/dev/null 2>&1; then
|
|
echo "Error: tailscale serve failed. On Linux, run once: sudo tailscale set --operator=\$USER" >&2
|
|
exit 1
|
|
fi
|
|
echo "Login with david@example.com to: https://$TS_HOSTNAME:$TS_PORT/"
|
|
else
|
|
echo "Login with david@example.com to: http://app.fizzy.localhost:$PORT/"
|
|
fi
|
|
|
|
./bin/rails server -b 0.0.0.0 -p $PORT
|