|
1 | 1 | # Copilot Run Instructions – Minecraft Server on Proxmox (Simulation Mode) |
2 | 2 |
|
3 | | -## Context |
4 | | -Do not execute locally. Explain only. Provide simulated steps and risks. |
| 3 | +## Zweck |
| 4 | +Nur erklären und Änderungen als **Diff** erzeugen. **Keine** Skripte ausführen. **Kein Build**. Ziel ist ein durchgängiger CLI-Ablauf mit GitHub Copilot CLI. |
5 | 5 |
|
6 | | -This repository contains **shell scripts** (not a buildable project). |
7 | | -There is **no `build` task**. In this workspace we operate in **simulation-only mode**: do not execute commands on this machine. |
| 6 | +## Voraussetzungen |
| 7 | +1) Git, GitHub CLI und Copilot CLI sind eingerichtet. |
| 8 | +2) Du arbeitest im Repo-Klon. |
8 | 9 |
|
9 | | -## Execution Options |
| 10 | +```bash |
| 11 | +cd "$HOME/github_repos/minecraft-server-Proxmox" |
| 12 | +git status |
| 13 | +```` |
| 14 | + |
| 15 | +--- |
| 16 | + |
| 17 | +## Antworten auf „Run/Build?“ |
10 | 18 |
|
11 | | -When asked “Run/Build”, provide these options as example commands (explanation/simulation only; do not execute here): |
| 19 | +Immer Simulation. Nur Beispiele zeigen, nichts lokal ausführen. |
12 | 20 |
|
13 | | -### Option 1: Java server in VM |
| 21 | +**Option 1: Java in VM** |
14 | 22 |
|
15 | 23 | ```bash |
16 | 24 | chmod +x setup_minecraft.sh |
17 | 25 | ./setup_minecraft.sh |
18 | 26 | sudo -u minecraft screen -r minecraft |
19 | 27 | ``` |
20 | 28 |
|
21 | | -### Option 2: Java server in LXC/Container |
| 29 | +**Option 2: Java in LXC** |
22 | 30 |
|
23 | 31 | ```bash |
24 | 32 | chmod +x setup_minecraft_lxc.sh |
25 | 33 | ./setup_minecraft_lxc.sh |
26 | 34 | sudo -u minecraft screen -r minecraft |
27 | 35 | ``` |
28 | 36 |
|
29 | | -### Option 3: Bedrock server |
| 37 | +**Option 3: Bedrock** |
30 | 38 |
|
31 | 39 | ```bash |
32 | 40 | chmod +x setup_bedrock.sh |
33 | 41 | ./setup_bedrock.sh |
34 | 42 | sudo -u minecraft screen -r bedrock |
35 | 43 | ``` |
36 | 44 |
|
37 | | -### Option 4: Update existing Java server (PaperMC) |
| 45 | +**Option 4: Java aktualisieren (PaperMC)** |
38 | 46 |
|
39 | 47 | ```bash |
40 | 48 | chmod +x update.sh |
41 | 49 | ./update.sh |
42 | 50 | ``` |
43 | 51 |
|
44 | | -### Option 5 (optional, Java only): Enable systemd auto-start |
| 52 | +**Option 5: systemd Autostart (optional, Java)** |
45 | 53 |
|
46 | 54 | ```bash |
47 | 55 | sudo cp minecraft.service /etc/systemd/system/minecraft.service |
48 | 56 | sudo systemctl daemon-reload |
49 | 57 | sudo systemctl enable --now minecraft |
50 | 58 | ``` |
51 | 59 |
|
52 | | -## Notes |
| 60 | +> Diese Befehle sind **Beispiele** für externe Systeme. In dieser Umgebung nur erklären. Details siehe `SIMULATION.md`. |
| 61 | + |
| 62 | +--- |
| 63 | + |
| 64 | +## Safe-Workflow mit Copilot CLI |
| 65 | + |
| 66 | +### 1) Arbeitszweig vorbereiten |
| 67 | + |
| 68 | +```bash |
| 69 | +cd "$HOME/github_repos/minecraft-server-Proxmox" |
| 70 | +git switch -c copilot/refactor-sim || git switch copilot/refactor-sim |
| 71 | +``` |
| 72 | + |
| 73 | +### 2) Audit + Refactor per Ein-Prompt (nur Diff ausgeben lassen) |
| 74 | + |
| 75 | +```bash |
| 76 | +gh copilot chat -p ' |
| 77 | +Refactor this repo in SIMULATION ONLY. Do not execute anything. Output a single unified diff file named refactor.diff (git apply -p0 friendly). Scope: |
| 78 | +
|
| 79 | +1) setup_minecraft.sh + setup_minecraft_lxc.sh |
| 80 | + - If OpenJDK 21 missing on Debian 12, add fallback: install Amazon Corretto 21 via APT with /usr/share/keyrings keyring and signed-by pin. |
| 81 | + - Auto-size JVM memory from /proc/meminfo: -Xms = 1/4, -Xmx = 1/2 of RAM (min 1G/2G). |
| 82 | + - Ensure /run/screen exists (chmod 775, root:utmp) before screen -dmS. |
| 83 | +
|
| 84 | +2) setup_bedrock.sh |
| 85 | + - Regex for artifact: bedrock-server-[0-9.]+\.zip |
| 86 | + - HEAD check: Content-Type must be application/zip before download. |
| 87 | + - Enforce checksum by default: REQUIRE_BEDROCK_SHA=1 and REQUIRED_BEDROCK_SHA256 mandatory. |
| 88 | + - Create /run/screen as above. |
| 89 | +
|
| 90 | +3) minecraft.service |
| 91 | + - Run as User/Group=minecraft. |
| 92 | + - Hardening: NoNewPrivileges=true, ProtectSystem=full, ProtectHome=true, PrivateTmp=true, |
| 93 | + ProtectKernelTunables=true, ProtectKernelModules=true, ProtectControlGroups=true, |
| 94 | + RestrictSUIDSGID=true, RestrictNamespaces=true, CapabilityBoundingSet=, |
| 95 | + AmbientCapabilities=, ReadWritePaths=/opt/minecraft. |
| 96 | +
|
| 97 | +4) Backups |
| 98 | + - Add RETAIN_DAYS env default=7 and ExecStartPost cleanup with find … -mtime +$RETAIN_DAYS -delete. |
| 99 | +
|
| 100 | +5) Docs |
| 101 | + - Create COPILOT_RUN_INSTRUCTIONS.md (this file) summary link in README. |
| 102 | + - README: mention Java 21 requirement with Corretto fallback, UFW install before ufw commands, memory auto-sizing note, |
| 103 | + Bedrock checksum enforcement note, and link to SIMULATION.md. |
| 104 | +
|
| 105 | +Constraints: |
| 106 | +- Do NOT run or simulate shell in this environment. Produce only a single file: refactor.diff. |
| 107 | +- Touch only the files above + README.md + new COPILOT_RUN_INSTRUCTIONS.md as needed. |
| 108 | +- Keep changes minimal and consistent with current style. |
| 109 | +' |
| 110 | +``` |
| 111 | + |
| 112 | +### 3) Diff holen und prüfen |
| 113 | + |
| 114 | +Copilot legt die Datei an oder zeigt sie an. Wenn als Datei erstellt: |
| 115 | + |
| 116 | +```bash |
| 117 | +ls -lh refactor.diff |
| 118 | +``` |
| 119 | + |
| 120 | +Wenn nur als Chat-Ausgabe kam, speichere sie: |
| 121 | + |
| 122 | +```bash |
| 123 | +nano refactor.diff |
| 124 | +# Inhalt aus der Copilot-Antwort einfügen, speichern |
| 125 | +``` |
| 126 | + |
| 127 | +### 4) Diff anwenden und committen |
| 128 | + |
| 129 | +```bash |
| 130 | +git apply -p0 refactor.diff |
| 131 | +git status |
| 132 | +git add -A |
| 133 | +git commit -m "refactor(simulation): Corretto21 fallback, RAM autosize, Bedrock checksum, systemd hardening, docs" |
| 134 | +``` |
| 135 | + |
| 136 | +### 5) Rückweg bei Problemen |
| 137 | + |
| 138 | +```bash |
| 139 | +git restore -SW :/ |
| 140 | +git reset --hard HEAD |
| 141 | +``` |
| 142 | + |
| 143 | +### 6) Push und PR (optional) |
| 144 | + |
| 145 | +```bash |
| 146 | +git push -u origin copilot/refactor-sim |
| 147 | +gh pr create --fill --title "Refactor (simulation)" --body "Simulation-mode changes per COPILOT_RUN_INSTRUCTIONS.md" |
| 148 | +``` |
| 149 | + |
| 150 | +--- |
| 151 | + |
| 152 | +## Hinweise |
| 153 | + |
| 154 | +* Keine lokalen Installationen anstoßen. Copilot erzeugt **nur** einen Diff. |
| 155 | +* In Antworten immer klarstellen: Beispiele dienen externer Ausführung. |
| 156 | +* Für Schritt-für-Schritt-Effekte der Skripte siehe `SIMULATION.md`. |
| 157 | +* CI-Erweiterungen (ShellCheck, Markdown-Lint, Link-Check) bitte in separatem PR ergänzen. |
53 | 158 |
|
54 | | -* Options 1–3 perform `apt` installs and system changes — explain but do not execute in this environment. |
55 | | -* Only show these five options; do **not** suggest any `build`/`compile` steps. |
56 | | -* Always show the full shell commands for the user's host (`chmod +x` before execution), but clarify they are examples for external execution only. |
57 | | -* For detailed step-by-step effects of each script, refer to `SIMULATION.md`. |
58 | 159 |
|
| 160 | +::contentReference[oaicite:0]{index=0} |
59 | 161 |
|
0 commit comments