Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 26 additions & 19 deletions deployment/mc-deploy-wizard.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ set -euo pipefail

# Minecraft Server Setup
# Maintained at: https://github.com/ulen7/mc_servermanager/new/main/current
# Version: 2.0.0
# Version: 2.0.1

# === 0. Constants & Defaults ===
DEFAULT_SERVER_NAME="mc_server"
Expand Down Expand Up @@ -540,18 +540,7 @@ if [ "$ENABLE_WEB_CONSOLE" == "yes" ]; then
fi
echo ""

# === 5. Confirmation & Action ===
CONFIRMATION=$(prompt_yes_no "Proceed with this configuration? (y/n) [y]: " "y")
if [ "$CONFIRMATION" == "no" ]; then
log "INFO" "Setup cancelled by user"
echo "Setup cancelled by user."
exit 1
fi

cd "$SERVER_DIR" || exit 1

# === Modified Docker Compose Generation ===
# This replaces the existing docker-compose.yml generation section
# === 4.1 Docker Compose Generation ===

generate_docker_compose() {
log "INFO" "Generating docker-compose file in $SERVER_DIR"
Expand Down Expand Up @@ -805,7 +794,20 @@ EOF
log "INFO" "docker-compose.yml created in: $SERVER_DIR"
}

# Verify file was created successfully
# === 5. Confirmation & Docker compose file generation ===
CONFIRMATION=$(prompt_yes_no "Proceed with this configuration? (y/n) [y]: " "y")
if [ "$CONFIRMATION" == "no" ]; then
log "INFO" "Setup cancelled by user"
echo "Setup cancelled by user."
exit 1
fi

cd "$SERVER_DIR" || exit 1

generate_docker_compose

# === 5.1 Docker compose file verification ===

if [ -f "$COMPOSE_FILE" ]; then
echo "✓ docker-compose.yml created successfully!"
log "INFO" "docker-compose.yml created in: $SERVER_DIR"
Expand All @@ -823,8 +825,7 @@ else
echo " docker compose up -d"
fi

# === 7. Launch & Final Configuration ===

# === 6. Launch and deployment ===

launch_services() {
if [ "$LAUNCH_NOW" == "no" ]; then
Expand Down Expand Up @@ -918,9 +919,14 @@ launch_services() {
log "INFO" "Server has initialized successfully."
}

generate_docker_compose
# === 6.1 Launch Confirmation ===

LAUNCH_NOW=$(prompt_yes_no "Would you like to start the server now? (y/n) [y]: " "y")

launch_services

# === 7. Geyser Configuration ===

# Configure Geyser / copying floodgate key with improved timing
if [ "$USE_GEYSER" == "yes" ]; then
echo ""
Expand Down Expand Up @@ -958,6 +964,7 @@ if [ "$USE_GEYSER" == "yes" ]; then
fi

# === 8. Backup Configuration ===

if [ "$ENABLE_BACKUPS" == "yes" ]; then
echo ""
echo "=== Configuring Backups ==="
Expand Down Expand Up @@ -1015,7 +1022,7 @@ fi



# Generate Backup Script
# === 8.1 Backup script generation ===

if [ "$ENABLE_BACKUPS" == "yes" ]; then
log "INFO" "Generating backup script"
Expand Down Expand Up @@ -1148,7 +1155,7 @@ EOF
fi


# === 8. Completion Message ===
# === 9. Completion Message ===

# Display the backup instruction if it was generated
if [ -n "$BACKUP_INSTRUCTION" ]; then
Expand Down
2 changes: 2 additions & 0 deletions deployment/templates/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
docker-compose.yml
.env
1 change: 1 addition & 0 deletions deployment/templates/web-console/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ logs/
*.sock
docker-compose.override.yml
docker/entrypoint.sh.bak
docker-compose.yml

# === OS and Editor Junk ===
.DS_Store
Expand Down
Loading