-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup
More file actions
executable file
·59 lines (46 loc) · 1.41 KB
/
setup
File metadata and controls
executable file
·59 lines (46 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env bash
# CyberPower PDU Bridge
# Created by Matthew Valancy, Valpatel Software LLC
# Copyright 2026 GPL-3.0 License
# https://github.com/mvalancy/CyberPower-PDU
set -euo pipefail
cd "$(dirname "$0")"
source lib/common.sh
check_help "${1:-}" "./setup" "Prepare the Docker stack for deployment" \
"Usage: ./setup
Checks for Docker, creates .env from template if missing,
pulls container images, and builds the bridge container.
Run ./start afterward to start the stack."
setup_log "setup"
banner
step "Setting up CyberPower PDU Bridge"
# Check for docker
if ! command -v docker &>/dev/null; then
error "Docker is not installed. Run ./bootstrap first."
exit 1
fi
if ! docker compose version &>/dev/null; then
error "docker compose plugin not found. Run ./bootstrap first."
exit 1
fi
success "Docker and docker compose found"
# Create .env from example if missing
if [ ! -f .env ]; then
cp .env.example .env
success "Created .env from .env.example — edit it with your PDU's IP address"
else
success ".env already exists"
fi
# Create data directories
mkdir -p mosquitto/data mosquitto/log
success "Data directories ready"
# Pull images and build
step "Pulling container images"
docker compose pull --ignore-buildable
step "Building bridge container"
docker compose build
echo ""
success "Setup complete"
success "Log saved to $LOG_FILE"
echo ""
info "Next step: review .env, then run ./start"