veza/config/incus/scripts/start-backend-api.sh

21 lines
741 B
Bash
Raw Normal View History

#!/bin/bash
# Wrapper script to start backend-api with environment variables loaded
# Also ensure network is configured (IP address may be lost on container restart)
# Note: stdout/stderr are automatically redirected to journald by systemd via StandardOutput=journal
# Configure network if eth0 doesn't have IP address
if ! ip addr show eth0 | grep -q "inet 10.10.10.2/24"; then
ip addr flush dev eth0 2>/dev/null || true
ip addr add 10.10.10.2/24 dev eth0 2>/dev/null || true
ip link set eth0 up 2>/dev/null || true
ip route add default via 10.10.10.1 dev eth0 2>/dev/null || true
fi
# Load environment variables
set -a
source /etc/veza/backend-api.env
set +a
# Start the application
exec /usr/local/bin/veza-backend-api