docs: add bilingual README and MIT license

This commit is contained in:
2026-05-31 13:41:32 +03:00
parent a7f7d2375c
commit ae84678f60
3 changed files with 375 additions and 0 deletions

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2026 AstraDeploy contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

177
README.md Normal file
View File

@@ -0,0 +1,177 @@
# AstraDeploy
`AstraDeploy` is a Bash installer for Minecraft server cores (Java and Bedrock) with:
- interactive beginner mode (`--easy`);
- non-interactive/automation-friendly flags (`--yes`, `--non-interactive`);
- optional report callback and debug logging;
- service modes for headless hosting (`systemd`, `tmux-systemd`, `screen`, `none`);
- step-by-step output suitable for bot-driven progress tracking;
- built-in license and EULA acknowledgement flow;
- rollback and dry-run mode.
Current version: `v0.1.0`.
## Requirements
- Bash 4+
- `sudo` / root privileges
- Internet access for downloading binaries/artifacts
## Supported cores
| Core | Default directory | Default port | Runtime | Protocol | Notes |
|---|---|---:|---|---|---|
| `pmmp` | `/opt/minecraft/pmmp` | `19132` | PHP | UDP | PocketMine Bedrock |
| `paper` | `/opt/minecraft/paper` | `25565` | Java 21 | TCP | Requires Minecraft Java EULA acceptance |
| `purpur` | `/opt/minecraft/purpur` | `25565` | Java 21 | TCP | Requires Minecraft Java EULA acceptance |
| `velocity` | `/opt/minecraft/velocity` | `25577` | Java 21 | TCP | Requires Minecraft Java EULA acceptance |
| `powernukkitx` | `/opt/minecraft/powernukkitx` | `19132` | Java 21 | UDP | Requires Minecraft Java EULA acceptance |
| `nethergamesmc` | `/opt/minecraft/nethergamesmc` | `19132` | PHP | UDP | Prompts for PHP build and PocketMine-MCPE version |
> Service mode `screen` is available and handled in the service layer with the current installer version.
## Quick start
```bash
sudo bash install.sh --easy --core paper
```
The command above:
1. Runs in easy mode;
2. Prints a short planned checklist;
3. Uses safe defaults (`/opt/minecraft/<core>`, default port, `tmux-systemd`, `minecraft` user);
4. Installs dependencies, downloads the selected core, writes startup scripts and service.
## Non-interactive usage (bot / CI)
```bash
sudo bash install.sh \
--yes \
--core paper \
--dir /opt/minecraft/paper \
--port 25565 \
--service tmux-systemd \
--ram 4G \
--firewall yes \
--accept-eula yes \
--accept-license yes \
--locale en
```
## Step-by-step progress (for n00b-friendly UX and bot updates)
Every major action emits a step label via logs and report callbacks:
- script parses arguments and validates environment;
- checks OS/package manager;
- validates license and EULA;
- validates ports and directory;
- installs base dependencies / Java (if needed);
- deploys selected core;
- configures service and permissions.
If a bot needs to send human-readable status updates, this is intended to be mapped to the step stream.
### Reporting callback
```
--report-url <url> [--report-token <token>]
```
The installer sends `started`, `step`, `success`, and `failed` events. Network errors on callback are non-fatal by design.
## Logs
Run output is mirrored with `tee` and saved to:
```bash
/var/log/astra-deploy/install-YYYY-MM-DD-HH-MM-SS.log
```
## Installation modes and useful flags
### Core selection and versions
- `--core <pmmp|paper|purpur|velocity|powernukkitx|nethergamesmc>`
- `--mc-version <latest|version>`
- `--build <latest|tag>` (for `nethergamesmc`, PHP build)
- legacy aliases: `--version`, `--core-version` for MC version
### Directory and runtime
- `--dir <path>`
- `--port <port>`
- `--ram <2G>` (RAM string for Java cores)
- `--user <username>` (service user)
- `--service <systemd|tmux-systemd|screen|none>`
- `--firewall <yes|no>`
### Safety and existing directory handling
- `--allow-existing` continue if directory is non-empty
- `--backup-existing` copy directory to `.backup-<timestamp>` first
- `--force-clean` clear target directory before install
- by default, non-empty directory without these flags in non-interactive mode fails
### Execution options
- `--easy` / `-E` guided beginner mode with defaults and plan preview
- `--yes` / `-y` assume positive answers
- `--non-interactive` explicit non-ask mode
- `--dry-run` simulate actions
- `--debug` verbose output
### Agreements
- `--accept-license yes|no` / `--license` (legacy)
- `--accept-eula yes|no` / `--eula` for Java-based cores
You **must** accept these in automation workflows (`--yes` mode) before install proceeds.
## Example for NetherGamesMC
```bash
sudo bash install.sh \
--easy \
--core nethergamesmc \
--dir /opt/minecraft/nethergamesmc \
--build latest \
--mc-version latest \
--service tmux-systemd
```
`nethergamesmc` flow includes:
1. PHP build resolution and download
2. Composer preparation
3. `PocketMine-MP` clone/build flow
4. Server startup script generation
## Update mode
`--update` switches workflow to update mode. The installer validates existing directory first and replaces server artifacts via the core-specific update path where supported.
## Locales
- `--locale en|ru` or `--lang en|ru`
- script also reads `LANGUAGE` / `LANG` environment fallback
## Safety notes
- Script is designed with guardrails but still executes privileged operations (packages/services/firewall/files).
- Backup critical data before running on production systems.
- If callback API is unavailable, installation continues and writes local log details.
## License
This repository is distributed under the **MIT License**.
See [`LICENSE`](LICENSE) for the full text and disclaimers.
## Version
```bash
sudo bash install.sh --version
```

177
README.ru.md Normal file
View File

@@ -0,0 +1,177 @@
# AstraDeploy
`AstraDeploy` — это bash-инсталлятор для Minecraft ядер (Java и Bedrock) с акцентом на простую установку и автоматизацию:
- режим для нубов (`--easy`);
- non-interactive/бот-режим (`--yes`, `--non-interactive`);
- отчёты в callback и локальный лог;
- сервисные режимы `systemd`, `tmux-systemd`, `screen`, `none`;
- пошаговый прогресс (удобно для отправки статусов пользователю из бота);
- отдельные соглашения по лицензии/ EULA;
- rollback и dry-run.
Текущая версия: `v0.1.0`.
## Требования
- Bash 4+
- права `root` (или `sudo`)
- доступ в интернет для загрузки артефактов
## Поддерживаемые ядра
| Ядро | Директория по умолчанию | Порт | Runtime | Протокол | Примечание |
|---|---|---:|---|---|---|
| `pmmp` | `/opt/minecraft/pmmp` | `19132` | PHP | UDP | PocketMine Bedrock |
| `paper` | `/opt/minecraft/paper` | `25565` | Java 21 | TCP | Нужна явная обработка/подтверждение EULA Java |
| `purpur` | `/opt/minecraft/purpur` | `25565` | Java 21 | TCP | Нужна явная обработка/подтверждение EULA Java |
| `velocity` | `/opt/minecraft/velocity` | `25577` | Java 21 | TCP | Нужна явная обработка/подтверждение EULA Java |
| `powernukkitx` | `/opt/minecraft/powernukkitx` | `19132` | Java 21 | UDP | Нужна явная обработка/подтверждение EULA Java |
| `nethergamesmc` | `/opt/minecraft/nethergamesmc` | `19132` | PHP | UDP | Доп. вопросы по PHP build и версии PocketMine-MCPE |
> Режим `screen` доступен в текущей версии и настраивается через слой сервисов.
## Быстрый старт
```bash
sudo bash install.sh --easy --core paper
```
Скрипт в этом режиме:
1. Предложит короткий план установки;
2. Подставит безопасные значения по умолчанию (`/opt/minecraft/<core>`, дефолтный порт, `tmux-systemd`, пользователь `minecraft`);
3. Установит зависимости, скачает выбранное ядро и создаст service.
## Non-interactive / бот / CI
```bash
sudo bash install.sh \
--yes \
--core paper \
--dir /opt/minecraft/paper \
--port 25565 \
--service tmux-systemd \
--ram 4G \
--firewall yes \
--accept-eula yes \
--accept-license yes \
--locale ru
```
## Пошаговая выдача (для «бота для нубов»)
Скрипт пишет этапы:
- разбор аргументов и проверка окружения;
- определение ОС/пакетного менеджера;
- проверка лицензии и EULA;
- проверка доступности порта;
- подготовка папки и пользователя;
- установка зависимостей / Java (для Java ядер);
- деплой ядра;
- настройка сервиса и прав.
На этот вывод удобно мапить сообщения для отправки пользователю по шагам.
### Callback-отчёты
```bash
--report-url <url> [--report-token <token>]
```
Скрипт шлёт статусы `started`, `step`, `success`, `failed`. Ошибки сети не прерывают установку.
## Логи
Вывод зеркалится в `/var/log/astra-deploy`:
```bash
/var/log/astra-deploy/install-YYYY-MM-DD-HH-MM-SS.log
```
## Флаги и режимы
### Ядро и версии
- `--core <pmmp|paper|purpur|velocity|powernukkitx|nethergamesmc>`
- `--mc-version <latest|version>`
- `--build <latest|tag>` (для `nethergamesmc`, версия PHP)
- legacy алиасы: `--version`, `--core-version`
### Каталог и рантайм
- `--dir <path>`
- `--port <port>`
- `--ram <2G>`
- `--user <username>`
- `--service <systemd|tmux-systemd|screen|none>`
- `--firewall <yes|no>`
### Безопасность существующей папки
- `--allow-existing` — продолжить, если папка не пуста;
- `--backup-existing` — создать backup `*.backup-<timestamp>`;
- `--force-clean` — удалить содержимое и начать с чистого листа;
- без этих флагов в non-interactive, если папка не пустая, установка останавливается.
### Режимы запуска инсталлера
- `--easy` / `-E` — быстрый guided режим с предпросмотром плана;
- `--yes` / `-y` — автоматические подтверждения;
- `--non-interactive` — полностью без вопросов;
- `--dry-run` — безопасный прогон;
- `--debug` — подробный лог.
### Соглашения
- `--accept-license yes|no` / `--license`
- `--accept-eula yes|no` / `--eula` для Java ядер
В автоматическом режиме (`--yes`) соглашения должны быть явно подтверждены.
## Пример для NetherGamesMC
```bash
sudo bash install.sh \
--easy \
--core nethergamesmc \
--dir /opt/minecraft/nethergamesmc \
--build latest \
--mc-version latest \
--service tmux-systemd
```
Путь для `nethergamesmc`:
1. разрешение PHP build;
2. загрузка/подготовка PHP + Composer;
3. клонирование `PocketMine-MP`;
4. сборка/подготовка запуска.
## Режим обновления
`--update` переводит в режим обновления. Сначала проверяется существование и непустота директории, затем выполняется core-специфичный апдейт.
## Локализация
- `--locale en|ru` или `--lang en|ru`
- автоматический fallback из `LANGUAGE` / `LANG`
## Важные замечания
- Скрипт работает с повышенными правами и может менять сервисы, firewall, пакеты, файлы.
- На проде обязательно иметь актуальный backup перед запуском.
- Если API callback недоступен, установка продолжится с локальными логами.
## Лицензия
Репозиторий распространяется под **MIT License**.
Полный текст — в файле [`LICENSE`](LICENSE).
## Проверка версии скрипта
```bash
sudo bash install.sh --version
```