code moved from scripts repo;
dump works
This commit is contained in:
46
rin/wallet/web/start_web_wallet.sh
Normal file
46
rin/wallet/web/start_web_wallet.sh
Normal file
@@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR=$(cd -- "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
CONTAINER="rincoin-node2"
|
||||
|
||||
if ! sudo docker ps --format '{{.Names}}' | grep -q "^${CONTAINER}$"; then
|
||||
echo "Error: ${CONTAINER} container is not running. Start it with 'sudo docker start ${CONTAINER}'."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check prerequisites
|
||||
if ! command -v python3 >/dev/null 2>&1; then
|
||||
echo "Error: python3 is required but not installed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! python3 -c "import venv" 2>/dev/null; then
|
||||
echo "Error: python3-venv is required. Install with 'sudo apt install python3-venv' (Ubuntu/Debian) or equivalent."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Setup virtual environment
|
||||
VENV_DIR="${SCRIPT_DIR}/venv"
|
||||
if [ ! -d "$VENV_DIR" ]; then
|
||||
echo "Creating virtual environment..."
|
||||
python3 -m venv "$VENV_DIR"
|
||||
fi
|
||||
|
||||
# Activate virtual environment
|
||||
echo "Activating virtual environment..."
|
||||
source "$VENV_DIR/bin/activate"
|
||||
|
||||
# Install/update dependencies
|
||||
echo "Installing/updating dependencies..."
|
||||
pip install --quiet -r "${SCRIPT_DIR}/requirements.txt"
|
||||
|
||||
echo "Starting RinCoin web wallet on http://127.0.0.1:8787"
|
||||
export FLASK_APP="${SCRIPT_DIR}/server.py"
|
||||
export FLASK_ENV=production
|
||||
export PYTHONPATH="${SCRIPT_DIR}"
|
||||
flask run --host 127.0.0.1 --port 8787
|
||||
|
||||
# Note: To clean up the virtual environment, run: rm -rf "${SCRIPT_DIR}/venv"
|
||||
|
||||
Reference in New Issue
Block a user