fix(install): skip d3v-net in compose when Forgejo is not installed
generate_docker_compose now only adds the d3v-net network section if the network actually exists on the host. Servers without Forgejo no longer fail with "network declared as external, but could not be found". Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
04a22dcc7d
commit
2e9ed07708
1 changed files with 14 additions and 8 deletions
22
install.sh
22
install.sh
|
|
@ -145,7 +145,7 @@ generate_docker_compose() {
|
|||
fi
|
||||
|
||||
log_step "Generating docker-compose.yml..."
|
||||
|
||||
|
||||
local custom_ports_block=""
|
||||
if [ -f ".custom_ports" ]; then
|
||||
while IFS= read -r port_mapping; do
|
||||
|
|
@ -155,6 +155,18 @@ generate_docker_compose() {
|
|||
done < ".custom_ports"
|
||||
fi
|
||||
|
||||
# Only include d3v-net if the network already exists (i.e. Forgejo is installed)
|
||||
local network_block=""
|
||||
if docker network ls --format '{{.Name}}' 2>/dev/null | grep -q "^${DOCKER_NETWORK}$"; then
|
||||
network_block=" networks:
|
||||
- d3v-net
|
||||
|
||||
networks:
|
||||
d3v-net:
|
||||
external: true
|
||||
name: ${DOCKER_NETWORK}"
|
||||
fi
|
||||
|
||||
cat > "$COMPOSE_FILE" <<YAML
|
||||
services:
|
||||
d3v-npmwg:
|
||||
|
|
@ -178,13 +190,7 @@ $(echo -e "$custom_ports_block" | sed '/^$/d') volumes:
|
|||
- ./wireguard:/etc/wireguard
|
||||
environment:
|
||||
WG_HOST: "${host}"
|
||||
networks:
|
||||
- d3v-net
|
||||
|
||||
networks:
|
||||
d3v-net:
|
||||
external: true
|
||||
name: ${DOCKER_NETWORK}
|
||||
${network_block}
|
||||
YAML
|
||||
log_ok "docker-compose.yml created/updated."
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue