- docker-compose.pull.yml: production compose with pre-built images, health checks, env var config, service dependencies - docker-compose.local.yml: override for mounting existing chain data - docker-compose.ecosystem.yml: build-from-source compose with pool, LNS, Redis added - Chain Dockerfile: add curl for health checks, swagger API resources - Pool Dockerfile: Ubuntu 24.04, Boost 1.83, native ProgPoWZ compilation - .env.example: configurable passwords, ports, hostname - pool-config.json: Docker-networked pool config - health.sh: one-command stack health check - deploy.sh: remote server deployment script - lethean-testnet.service: systemd auto-start unit - README.md: quickstart, mining guide, backup, troubleshooting All 8 services tested and running in Docker: daemon, wallet, explorer, trade-api, trade-frontend, pool, LNS, docs Co-Authored-By: Charon <charon@lethean.io>
66 lines
2.2 KiB
Bash
Executable file
66 lines
2.2 KiB
Bash
Executable file
#!/bin/bash
|
|
# Lethean Testnet — Production Deploy Script
|
|
# Transfers images and config to a remote server and starts the stack.
|
|
#
|
|
# Usage:
|
|
# bash deploy.sh user@server
|
|
# bash deploy.sh user@server /opt/lethean/docker
|
|
#
|
|
# Prerequisites on the remote server:
|
|
# - Docker + Docker Compose v2
|
|
# - SSH access
|
|
|
|
set -e
|
|
|
|
REMOTE="${1:?Usage: deploy.sh user@server [install_dir]}"
|
|
INSTALL_DIR="${2:-/opt/lethean/docker}"
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
IMAGES="$SCRIPT_DIR/dist/lethean-testnet-images.tar.gz"
|
|
|
|
if [ ! -f "$IMAGES" ]; then
|
|
echo "Building image bundle..."
|
|
mkdir -p "$SCRIPT_DIR/dist"
|
|
docker save \
|
|
lthn/chain:testnet \
|
|
lthn/explorer:testnet \
|
|
lthn/trade-api:testnet \
|
|
lthn/trade-frontend:testnet \
|
|
lthn/pool:testnet \
|
|
lthn/lns:testnet \
|
|
lthn/docs:testnet \
|
|
| gzip > "$IMAGES"
|
|
fi
|
|
|
|
echo "Image bundle: $(du -h "$IMAGES" | cut -f1)"
|
|
echo "Deploying to $REMOTE:$INSTALL_DIR"
|
|
echo ""
|
|
|
|
# Create remote directory
|
|
ssh "$REMOTE" "mkdir -p $INSTALL_DIR"
|
|
|
|
# Transfer files
|
|
echo "Transferring config files..."
|
|
scp "$SCRIPT_DIR/docker-compose.pull.yml" "$REMOTE:$INSTALL_DIR/"
|
|
scp "$SCRIPT_DIR/.env.example" "$REMOTE:$INSTALL_DIR/"
|
|
scp "$SCRIPT_DIR/pool-config.json" "$REMOTE:$INSTALL_DIR/"
|
|
scp "$SCRIPT_DIR/health.sh" "$REMOTE:$INSTALL_DIR/"
|
|
scp "$SCRIPT_DIR/lethean-testnet.service" "$REMOTE:$INSTALL_DIR/"
|
|
|
|
# Create .env if it doesn't exist
|
|
ssh "$REMOTE" "[ -f $INSTALL_DIR/.env ] || cp $INSTALL_DIR/.env.example $INSTALL_DIR/.env"
|
|
|
|
echo "Transferring images (~$(du -h "$IMAGES" | cut -f1))... this may take a while"
|
|
scp "$IMAGES" "$REMOTE:/tmp/lethean-testnet-images.tar.gz"
|
|
|
|
echo "Loading images on remote..."
|
|
ssh "$REMOTE" "docker load < /tmp/lethean-testnet-images.tar.gz && rm /tmp/lethean-testnet-images.tar.gz"
|
|
|
|
echo "Starting stack..."
|
|
ssh "$REMOTE" "cd $INSTALL_DIR && docker compose -f docker-compose.pull.yml up -d"
|
|
|
|
echo ""
|
|
echo "Deploy complete. Run health check:"
|
|
echo " ssh $REMOTE 'cd $INSTALL_DIR && bash health.sh'"
|
|
echo ""
|
|
echo "Install systemd service (optional):"
|
|
echo " ssh $REMOTE 'sudo cp $INSTALL_DIR/lethean-testnet.service /etc/systemd/system/ && sudo systemctl daemon-reload && sudo systemctl enable lethean-testnet'"
|