-
Notifications
You must be signed in to change notification settings - Fork 13
chore: cosmetic cleanup #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,161 +1,34 @@ | ||
| # Copilot Run Instructions – Minecraft Server on Proxmox (Simulation Mode) | ||
|
|
||
| ## Zweck | ||
| 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. | ||
|
|
||
| ## Voraussetzungen | ||
| 1) Git, GitHub CLI und Copilot CLI sind eingerichtet. | ||
| 2) Du arbeitest im Repo-Klon. | ||
|
|
||
| ```bash | ||
| cd "$HOME/github_repos/minecraft-server-Proxmox" | ||
| git status | ||
| ```` | ||
|
|
||
| --- | ||
|
|
||
| ## Antworten auf „Run/Build?“ | ||
|
|
||
| Immer Simulation. Nur Beispiele zeigen, nichts lokal ausführen. | ||
|
|
||
| **Option 1: Java in VM** | ||
|
|
||
| ```bash | ||
| chmod +x setup_minecraft.sh | ||
| ./setup_minecraft.sh | ||
| sudo -u minecraft screen -r minecraft | ||
| ``` | ||
|
|
||
| **Option 2: Java in LXC** | ||
|
|
||
| ```bash | ||
| chmod +x setup_minecraft_lxc.sh | ||
| ./setup_minecraft_lxc.sh | ||
| sudo -u minecraft screen -r minecraft | ||
| ``` | ||
|
|
||
| **Option 3: Bedrock** | ||
|
|
||
| ```bash | ||
| chmod +x setup_bedrock.sh | ||
| ./setup_bedrock.sh | ||
| sudo -u minecraft screen -r bedrock | ||
| ``` | ||
|
|
||
| **Option 4: Java aktualisieren (PaperMC)** | ||
|
|
||
| ```bash | ||
| chmod +x update.sh | ||
| ./update.sh | ||
| ``` | ||
|
|
||
| **Option 5: systemd Autostart (optional, Java)** | ||
|
|
||
| ```bash | ||
| sudo cp minecraft.service /etc/systemd/system/minecraft.service | ||
| sudo systemctl daemon-reload | ||
| sudo systemctl enable --now minecraft | ||
| ``` | ||
|
|
||
| > Diese Befehle sind **Beispiele** für externe Systeme. In dieser Umgebung nur erklären. Details siehe `SIMULATION.md`. | ||
|
|
||
| --- | ||
|
|
||
| ## Safe-Workflow mit Copilot CLI | ||
|
|
||
| ### 1) Arbeitszweig vorbereiten | ||
|
|
||
| ```bash | ||
| cd "$HOME/github_repos/minecraft-server-Proxmox" | ||
| git switch -c copilot/refactor-sim || git switch copilot/refactor-sim | ||
| ``` | ||
|
|
||
| ### 2) Audit + Refactor per Ein-Prompt (nur Diff ausgeben lassen) | ||
|
|
||
| ```bash | ||
| gh copilot chat -p ' | ||
| Refactor this repo in SIMULATION ONLY. Do not execute anything. Output a single unified diff file named refactor.diff (git apply -p0 friendly). Scope: | ||
|
|
||
| 1) setup_minecraft.sh + setup_minecraft_lxc.sh | ||
| - If OpenJDK 21 missing on Debian 12, add fallback: install Amazon Corretto 21 via APT with /usr/share/keyrings keyring and signed-by pin. | ||
| - Auto-size JVM memory from /proc/meminfo: -Xms = 1/4, -Xmx = 1/2 of RAM (min 1G/2G). | ||
| - Ensure /run/screen exists (chmod 775, root:utmp) before screen -dmS. | ||
|
|
||
| 2) setup_bedrock.sh | ||
| - Regex for artifact: bedrock-server-[0-9.]+\.zip | ||
| - HEAD check: Content-Type must be application/zip before download. | ||
| - Enforce checksum by default: REQUIRE_BEDROCK_SHA=1 and REQUIRED_BEDROCK_SHA256 mandatory. | ||
| - Create /run/screen as above. | ||
|
|
||
| 3) minecraft.service | ||
| - Run as User/Group=minecraft. | ||
| - Hardening: NoNewPrivileges=true, ProtectSystem=full, ProtectHome=true, PrivateTmp=true, | ||
| ProtectKernelTunables=true, ProtectKernelModules=true, ProtectControlGroups=true, | ||
| RestrictSUIDSGID=true, RestrictNamespaces=true, CapabilityBoundingSet=, | ||
| AmbientCapabilities=, ReadWritePaths=/opt/minecraft. | ||
|
|
||
| 4) Backups | ||
| - Add RETAIN_DAYS env default=7 and ExecStartPost cleanup with find … -mtime +$RETAIN_DAYS -delete. | ||
|
|
||
| 5) Docs | ||
| - Create COPILOT_RUN_INSTRUCTIONS.md (this file) summary link in README. | ||
| - README: mention Java 21 requirement with Corretto fallback, UFW install before ufw commands, memory auto-sizing note, | ||
| Bedrock checksum enforcement note, and link to SIMULATION.md. | ||
|
|
||
| Constraints: | ||
| - Do NOT run or simulate shell in this environment. Produce only a single file: refactor.diff. | ||
| - Touch only the files above + README.md + new COPILOT_RUN_INSTRUCTIONS.md as needed. | ||
| - Keep changes minimal and consistent with current style. | ||
| ' | ||
| ``` | ||
|
|
||
| ### 3) Diff holen und prüfen | ||
|
|
||
| Copilot legt die Datei an oder zeigt sie an. Wenn als Datei erstellt: | ||
|
|
||
| ```bash | ||
| ls -lh refactor.diff | ||
| ``` | ||
|
|
||
| Wenn nur als Chat-Ausgabe kam, speichere sie: | ||
|
|
||
| ```bash | ||
| nano refactor.diff | ||
| # Inhalt aus der Copilot-Antwort einfügen, speichern | ||
| ``` | ||
|
|
||
| ### 4) Diff anwenden und committen | ||
|
|
||
| ```bash | ||
| git apply -p0 refactor.diff | ||
| git status | ||
| git add -A | ||
| git commit -m "refactor(simulation): Corretto21 fallback, RAM autosize, Bedrock checksum, systemd hardening, docs" | ||
| ``` | ||
|
|
||
| ### 5) Rückweg bei Problemen | ||
|
|
||
| ```bash | ||
| git restore -SW :/ | ||
| git reset --hard HEAD | ||
| ``` | ||
|
|
||
| ### 6) Push und PR (optional) | ||
|
|
||
| ```bash | ||
| git push -u origin copilot/refactor-sim | ||
| gh pr create --fill --title "Refactor (simulation)" --body "Simulation-mode changes per COPILOT_RUN_INSTRUCTIONS.md" | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Hinweise | ||
|
|
||
| * Keine lokalen Installationen anstoßen. Copilot erzeugt **nur** einen Diff. | ||
| * In Antworten immer klarstellen: Beispiele dienen externer Ausführung. | ||
| * Für Schritt-für-Schritt-Effekte der Skripte siehe `SIMULATION.md`. | ||
| * CI-Erweiterungen (ShellCheck, Markdown-Lint, Link-Check) bitte in separatem PR ergänzen. | ||
|
|
||
|
|
||
| ::contentReference[oaicite:0]{index=0} | ||
|
|
||
| # Copilot Instructions (AI Coding Agents) | ||
|
|
||
| ## Big Picture | ||
| Dieses Repo sind defensive **Bash-Installer/Updater** für Minecraft auf Proxmox-Gästen: | ||
| - **Java (PaperMC)**: Provisionierung nach `/opt/minecraft`, Start via `screen`. | ||
| - **Bedrock**: Provisionierung nach `/opt/minecraft-bedrock`, Start via `screen`. | ||
| - Optionaler Autostart über systemd (`minecraft.service`, `minecraft-bedrock.service`). | ||
|
|
||
| ## Simulation-Only (nicht ausführen) | ||
| - **Keine Side-Effects** in dieser Workspace-Umgebung: kein `apt`, `systemctl`, `curl/wget` (wenn es Dinge installiert/ändert), keine `./setup_*.sh`. | ||
| - Bei „run/build“ nur **Beispiel-Kommandos für externe Hosts** zeigen und kurz erklären. Siehe [SIMULATION.md](SIMULATION.md). | ||
| - Für Copilot-CLI-/Diff-Workflow: [COPILOT_RUN_INSTRUCTIONS.md](COPILOT_RUN_INSTRUCTIONS.md). | ||
|
|
||
| ## Entry Points | ||
| - Java VM Installer: `setup_minecraft.sh` | ||
| - Java LXC Installer: `setup_minecraft_lxc.sh` | ||
| - Bedrock Installer: `setup_bedrock.sh` | ||
| - Java Updater: `update.sh` | ||
| - systemd Units: `minecraft.service`, `minecraft-bedrock.service` | ||
| - Doku: `README.md`, `SIMULATION.md`, `docs/BEDROCK_NETWORKING.md` | ||
|
|
||
| ## Repo-spezifische Patterns (bitte beibehalten) | ||
| - Shell: `#!/usr/bin/env bash` + `set -euo pipefail` (z. B. in `setup_minecraft.sh`, `setup_bedrock.sh`). | ||
| - Java 21: erst **OpenJDK 21**, Fallback auf **Amazon Corretto 21 via APT keyring + signed-by** (`ensure_java()` in `setup_minecraft.sh`). | ||
| - JVM Autosize: aus `/proc/meminfo` → `-Xms ≈ RAM/4`, `-Xmx ≈ RAM/2`, Floors `1024M/2048M`, `Xmx`-Cap `≤16G` (generiertes `start.sh`). | ||
| - PaperMC Integrität: PaperMC API (`curl`+`jq`) liefert SHA256; Download prüft SHA + Mindestgröße `>5MB` gegen HTML-Fehlerseiten (`setup_minecraft.sh`, `update.sh`). | ||
| - Bedrock Integrität: Mojang-URL per Regex; **HTTP HEAD Content-Type** muss `application/zip|octet-stream` sein; Checksum standardmäßig **erzwingend** (`REQUIRE_BEDROCK_SHA=1`, `REQUIRED_BEDROCK_SHA256`) (`setup_bedrock.sh`). | ||
| - screen Socket: `/run/screen` muss existieren (`root:utmp`, `0775`) und via `systemd-tmpfiles` persistiert werden, sonst scheitert `screen` auf Debian 12/13. | ||
| - systemd Hardening: `minecraft.service` nutzt `User/Group=minecraft`, Hardening-Flags und `ReadWritePaths=/opt/minecraft`. | ||
|
|
||
| ## Änderungen am Repo | ||
| - Minimal ändern, Stil beibehalten; keine neuen UX-Flows erfinden. | ||
| - Neue Env-Variablen/Optionen immer kurz in `README.md` und/oder `SIMULATION.md` dokumentieren. | ||
| - Keine Artefakte wie `*.bak`/`*.rej`/Report-Dateien einchecken (falls relevant: `.gitignore` ergänzen). | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,3 +12,6 @@ fix_all_issues.sh | |
| vendor/bundle/ | ||
| .bundle/ | ||
| .npm-cache/ | ||
| *.bak | ||
| *.rej | ||
| shellcheck_report.txt | ||
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammar issue: The verb form should agree with the plural subject. The sentence should read "Dieses Repo enthält defensive" or "Diese Repos sind defensive" depending on whether treating "Repo" as singular or plural.