-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup-env.sh
More file actions
executable file
·72 lines (64 loc) · 2.36 KB
/
Copy pathsetup-env.sh
File metadata and controls
executable file
·72 lines (64 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
# Setup script for Haven Relay Umbrel App
# Supports both Docker and Podman
set -e
echo "Haven Relay - Environment Setup"
echo "================================"
echo ""
# Detect container runtime (set CONTAINER_RUNTIME=docker|podman to override,
# e.g. when both are installed)
if [ -n "${CONTAINER_RUNTIME:-}" ] && command -v "${CONTAINER_RUNTIME}" &> /dev/null; then
RUNTIME="${CONTAINER_RUNTIME}"
echo "✓ Using runtime from CONTAINER_RUNTIME: $RUNTIME"
elif command -v podman &> /dev/null; then
RUNTIME="podman"
echo "✓ Detected: Podman"
elif command -v docker &> /dev/null; then
RUNTIME="docker"
echo "✓ Detected: Docker"
else
echo "✗ Error: Neither Docker nor Podman found"
echo "Please install Docker or Podman first"
exit 1
fi
# Set up environment variables
export APP_DATA_DIR="${APP_DATA_DIR:-$(pwd)/data}"
echo "✓ Data directory: $APP_DATA_DIR"
# Set socket path for Podman
if [ "$RUNTIME" = "podman" ]; then
if [ -S "/run/user/$UID/podman/podman.sock" ]; then
export DOCKER_SOCK="/run/user/$UID/podman/podman.sock"
echo "✓ Using rootless Podman socket: $DOCKER_SOCK"
elif [ -S "/run/podman/podman.sock" ]; then
export DOCKER_SOCK="/run/podman/podman.sock"
echo "✓ Using rootful Podman socket: $DOCKER_SOCK"
else
echo "⚠ Warning: Podman socket not found. Starting Podman socket service..."
systemctl --user enable --now podman.socket 2>/dev/null || true
export DOCKER_SOCK="/run/user/$UID/podman/podman.sock"
echo "✓ Podman socket: $DOCKER_SOCK"
fi
else
export DOCKER_SOCK="${DOCKER_SOCK:-/var/run/docker.sock}"
echo "✓ Docker socket: $DOCKER_SOCK"
fi
# Create data directories (tor is used by the optional docker-compose.tor.yml
# overlay; Podman does not auto-create missing bind-mount sources)
mkdir -p "$APP_DATA_DIR"/{config,blossom,db,templates,tor}
echo "✓ Created data directories"
# Write environment to .env file for docker-compose
cat > .env <<EOF
APP_DATA_DIR=$APP_DATA_DIR
DOCKER_SOCK=$DOCKER_SOCK
CONTAINER_RUNTIME=$RUNTIME
APP_HAVEN_CONFIG_UI_PORT=8080
EOF
echo "✓ Created .env file"
echo ""
echo "Environment setup complete!"
echo ""
echo "Next steps:"
echo " 1. Build and start: ${RUNTIME}-compose up -d"
echo " 2. View logs: ${RUNTIME}-compose logs -f"
echo " 3. Access config UI: http://localhost:8080"
echo ""