Update byparr-lxc-setup.sh
This commit is contained in:
@@ -15,7 +15,6 @@ TEMPLATE="local:vztmpl/debian-12-standard_12.7-1_amd64.tar.zst" # Debian 12 temp
|
||||
|
||||
# Byparr-specific variables
|
||||
BYPARR_PORT="8191" # Default Byparr port
|
||||
COMPOSE_VERSION="2.29.2" # Docker Compose version
|
||||
|
||||
# Step 1: Create LXC container
|
||||
echo "Creating LXC container with ID ${CTID}..."
|
||||
@@ -38,11 +37,14 @@ fi
|
||||
echo "Starting LXC container ${CTID}..."
|
||||
pct start ${CTID}
|
||||
|
||||
# Step 3: Update container and install dependencies
|
||||
# Step 3: Update container, configure locale, and install dependencies
|
||||
echo "Updating container and installing dependencies..."
|
||||
pct exec ${CTID} -- bash -c "
|
||||
apt-get update && apt-get upgrade -y &&
|
||||
apt-get install -y curl ca-certificates gnupg
|
||||
apt-get install -y curl ca-certificates gnupg locales &&
|
||||
echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen &&
|
||||
locale-gen en_US.UTF-8 &&
|
||||
update-locale LANG=en_US.UTF-8
|
||||
"
|
||||
|
||||
# Step 4: Install Docker inside the LXC container
|
||||
@@ -53,14 +55,7 @@ pct exec ${CTID} -- bash -c "
|
||||
rm get-docker.sh
|
||||
"
|
||||
|
||||
# Step 5: Install Docker Compose
|
||||
echo "Installing Docker Compose v${COMPOSE_VERSION}..."
|
||||
pct exec ${CTID} -- bash -c "
|
||||
curl -L \"https://github.com/docker/compose/releases/download/v${COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)\" -o /usr/local/bin/docker-compose &&
|
||||
chmod +x /usr/local/bin/docker-compose
|
||||
"
|
||||
|
||||
# Step 6: Create directory for Byparr and set up Docker Compose configuration
|
||||
# Step 5: Create directory for Byparr and set up Docker Compose configuration
|
||||
echo "Setting up Byparr Docker Compose configuration..."
|
||||
pct exec ${CTID} -- bash -c "
|
||||
mkdir -p /root/byparr &&
|
||||
@@ -83,24 +78,24 @@ services:
|
||||
EOF
|
||||
"
|
||||
|
||||
# Step 7: Pull and run Byparr using Docker Compose
|
||||
# Step 6: Pull and run Byparr using Docker Compose
|
||||
echo "Pulling and starting Byparr container..."
|
||||
pct exec ${CTID} -- bash -c "
|
||||
cd /root/byparr &&
|
||||
docker-compose pull &&
|
||||
docker-compose up -d
|
||||
docker compose pull &&
|
||||
docker compose up -d
|
||||
"
|
||||
|
||||
# Step 8: Verify Byparr is running
|
||||
# Step 7: Verify Byparr is running
|
||||
echo "Verifying Byparr service..."
|
||||
sleep 5 # Wait for the service to start
|
||||
pct exec ${CTID} -- bash -c "
|
||||
curl -s http://localhost:${BYPARR_PORT}/health | grep -q 'OK' && echo 'Byparr is running successfully!' || echo 'Error: Byparr failed to start.'
|
||||
"
|
||||
|
||||
# Step 9: Display access information
|
||||
# Step 8: Display access information
|
||||
IP_ADDRESS=$(pct exec ${CTID} -- bash -c "ip addr show eth0 | grep 'inet ' | awk '{print \$2}' | cut -d'/' -f1")
|
||||
echo "Setup complete! Byparr is accessible at http://${IP_ADDRESS}:${BYPARR_PORT}"
|
||||
echo "API documentation is available at http://${IP_ADDRESS}:${BYPARR_PORT}/docs"
|
||||
echo "To stop the container, run: pct stop ${CTID}"
|
||||
echo "To start the container later, run: pct start ${CTID} && pct exec ${CTID} -- bash -c 'cd /root/byparr && docker-compose up -d'"
|
||||
echo "To start the container later, run: pct start ${CTID} && pct exec ${CTID} -- bash -c 'cd /root/byparr && docker compose up -d'"
|
||||
Reference in New Issue
Block a user