Files
worldwideview/setup.sh
T
Antigravity AI 0156ead243 fix(deployment): resolve stale image issues and legacy migration commands
- Bump version to 2.1.6
- fix: update setup scripts to pull latest image before starting
- fix: set pull_policy to always in self-host compose file
- fix: auto-detect compose container for legacy migration script in setup UI
2026-05-10 01:20:22 +12:00

57 lines
2.0 KiB
Bash
Executable File

#!/bin/bash
set -e
echo "🌍 Setting up WorldWideView for local self-hosting..."
# Check if docker is actually available and running
if ! docker info > /dev/null 2>&1; then
echo "❌ Error: Docker is not running or not accessible."
echo "If you are on Windows using WSL, ensure Docker Desktop is running and WSL integration is enabled for your default distro."
echo "Please install or start Docker Desktop: https://docs.docker.com/get-docker/"
exit 1
fi
# Check for docker compose plugin
if ! docker compose version > /dev/null 2>&1; then
echo "❌ Error: Docker Compose is not installed or accessible."
exit 1
fi
# 1. Download docker-compose.yml
echo "📦 Downloading docker-compose.yml..."
curl -fsSL -o docker-compose.yml https://raw.githubusercontent.com/silvertakana/worldwideview/main/self-host/docker-compose.yml
# 2. Generate .env with a persistent secret
if [ ! -f .env ]; then
echo "🔐 Generating new .env file with AUTH_SECRET..."
# Use openssl if available, otherwise use urandom
if command -v openssl &> /dev/null; then
SECRET=$(openssl rand -hex 32)
else
SECRET=$(head -c 32 /dev/urandom | xxd -p)
fi
echo "📥 Downloading .env template..."
curl -fsSL -o .env https://raw.githubusercontent.com/silvertakana/worldwideview/main/.env.example
# Replace AUTH_SECRET= with the generated secret
# (macOS sed requires an empty string backup extension, Linux does not. Perl is safer across platforms)
perl -pi -e "s/^AUTH_SECRET=.*$/AUTH_SECRET=$SECRET/" .env
else
echo "✅ .env already exists, skipping generation."
fi
# 3. Start it
echo "📥 Pulling latest image updates..."
docker compose pull
echo "🚀 Starting Docker container..."
docker compose up -d
echo ""
echo "✅ WorldWideView is running at http://localhost:3000"
echo " Data is persisted in Docker volume 'wwv-data'"
echo " Auth secret is saved in .env (don't delete this file)"
echo ""
echo "To stop the server: docker compose down"
echo "To view logs: docker compose logs -f wwv"