Update versions.json
All checks were successful
Test and Publish Templates / test-and-publish (push) Successful in 35s
All checks were successful
Test and Publish Templates / test-and-publish (push) Successful in 35s
This commit is contained in:
42
cloudflare-tunnel/install.sh
Executable file
42
cloudflare-tunnel/install.sh
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
# shellcheck disable=SC1091
|
||||
source "${AGENT_PATH}/common.sh"
|
||||
_check_required_env_vars "CONTAINER_NAME" "IMAGE_REGISTRY" "IMAGE_REPO" "IMAGE_TAG" "TUNNEL_TOKEN"
|
||||
|
||||
# Check if tunnel token is set
|
||||
if [ -z "$TUNNEL_TOKEN" ] || [ "$TUNNEL_TOKEN" = "" ]; then
|
||||
_die "TUNNEL_TOKEN is not set in config/service.env! Please add your Cloudflare Tunnel token."
|
||||
fi
|
||||
|
||||
# Validate token format (basic check - should be a long base64-ish string)
|
||||
if [ ${#TUNNEL_TOKEN} -lt 100 ]; then
|
||||
echo "Warning: TUNNEL_TOKEN seems too short. Ensure you copied the entire token."
|
||||
fi
|
||||
|
||||
_check_docker_installed || _die "Docker test failed, aborting installation..."
|
||||
|
||||
echo "Pulling Cloudflare Tunnel image..."
|
||||
docker pull "$IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG" || _die "Failed to pull image $IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG"
|
||||
|
||||
# Stop and remove existing container if it exists
|
||||
if _is_container_exists "$CONTAINER_NAME"; then
|
||||
echo "Removing existing container..."
|
||||
bash ./stop.sh 2>/dev/null || true
|
||||
_remove_container "$CONTAINER_NAME" || true
|
||||
fi
|
||||
|
||||
# Start the tunnel
|
||||
bash ./start.sh || _die "Failed to start Cloudflare Tunnel"
|
||||
|
||||
echo ""
|
||||
echo "=========================================="
|
||||
echo "Cloudflare Tunnel installation complete!"
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo "1. Check tunnel status: ds status [server] cloudflare-tunnel"
|
||||
echo "2. View logs: ds logs [server] cloudflare-tunnel"
|
||||
echo "3. Configure routes in Cloudflare dashboard:"
|
||||
echo " https://one.dash.cloudflare.com/ -> Zero Trust -> Access -> Tunnels"
|
||||
echo ""
|
||||
echo "Your tunnel should appear as 'Active' in the dashboard within 30 seconds."
|
Reference in New Issue
Block a user