platypus-server 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- platypus_server-0.2.0/LICENSE +21 -0
- platypus_server-0.2.0/PKG-INFO +497 -0
- platypus_server-0.2.0/README.md +469 -0
- platypus_server-0.2.0/dashboard/__init__.py +11 -0
- platypus_server-0.2.0/dashboard/__main__.py +6 -0
- platypus_server-0.2.0/dashboard/app.py +498 -0
- platypus_server-0.2.0/dashboard/auth.py +35 -0
- platypus_server-0.2.0/dashboard/compose.py +102 -0
- platypus_server-0.2.0/dashboard/dockerctl.py +152 -0
- platypus_server-0.2.0/dashboard/firewall.py +57 -0
- platypus_server-0.2.0/dashboard/metrics.py +132 -0
- platypus_server-0.2.0/dashboard/services.py +18 -0
- platypus_server-0.2.0/dashboard/static/index.html +620 -0
- platypus_server-0.2.0/dashboard/static/login.html +136 -0
- platypus_server-0.2.0/dashboard/systemd.py +72 -0
- platypus_server-0.2.0/doctor.py +354 -0
- platypus_server-0.2.0/platypus_cli/__init__.py +1 -0
- platypus_server-0.2.0/platypus_cli/cli.py +60 -0
- platypus_server-0.2.0/platypus_server.egg-info/PKG-INFO +497 -0
- platypus_server-0.2.0/platypus_server.egg-info/SOURCES.txt +74 -0
- platypus_server-0.2.0/platypus_server.egg-info/dependency_links.txt +1 -0
- platypus_server-0.2.0/platypus_server.egg-info/entry_points.txt +7 -0
- platypus_server-0.2.0/platypus_server.egg-info/requires.txt +10 -0
- platypus_server-0.2.0/platypus_server.egg-info/top_level.txt +6 -0
- platypus_server-0.2.0/pyproject.toml +56 -0
- platypus_server-0.2.0/recipe/__init__.py +2 -0
- platypus_server-0.2.0/recipe/caddy.py +145 -0
- platypus_server-0.2.0/recipe/cli.py +216 -0
- platypus_server-0.2.0/recipe/model.py +143 -0
- platypus_server-0.2.0/recipe/renderer.py +86 -0
- platypus_server-0.2.0/recipe/roles/assetto-corsa/questions.yml +58 -0
- platypus_server-0.2.0/recipe/roles/assetto-corsa/template.yml +51 -0
- platypus_server-0.2.0/recipe/roles/jellyfin/questions.yml +28 -0
- platypus_server-0.2.0/recipe/roles/jellyfin/template.yml +38 -0
- platypus_server-0.2.0/recipe/roles/minecraft-server/questions.yml +42 -0
- platypus_server-0.2.0/recipe/roles/minecraft-server/template.yml +62 -0
- platypus_server-0.2.0/recipe/roles/pihole/questions.yml +33 -0
- platypus_server-0.2.0/recipe/roles/pihole/template.yml +45 -0
- platypus_server-0.2.0/recipe/roles/storage-nextcloud/questions.yml +34 -0
- platypus_server-0.2.0/recipe/roles/storage-nextcloud/template.yml +73 -0
- platypus_server-0.2.0/recipe/roles/storage-samba/questions.yml +24 -0
- platypus_server-0.2.0/recipe/roles/storage-samba/template.yml +36 -0
- platypus_server-0.2.0/recipe/roles/syncthing/questions.yml +23 -0
- platypus_server-0.2.0/recipe/roles/syncthing/template.yml +39 -0
- platypus_server-0.2.0/recipe/shutdown.py +168 -0
- platypus_server-0.2.0/recipe/state.py +119 -0
- platypus_server-0.2.0/recipe/transition.py +338 -0
- platypus_server-0.2.0/setup.cfg +4 -0
- platypus_server-0.2.0/tests/test_caddy.py +89 -0
- platypus_server-0.2.0/tests/test_cli_entries.py +52 -0
- platypus_server-0.2.0/tests/test_doctor.py +155 -0
- platypus_server-0.2.0/tests/test_packaging.py +65 -0
- platypus_server-0.2.0/tests/test_platypus_cli.py +58 -0
- platypus_server-0.2.0/tests/test_recipe_roles.py +54 -0
- platypus_server-0.2.0/tests/test_settings.py +113 -0
- platypus_server-0.2.0/tests/test_tui.py +145 -0
- platypus_server-0.2.0/tui/__init__.py +11 -0
- platypus_server-0.2.0/tui/__main__.py +6 -0
- platypus_server-0.2.0/tui/app.py +823 -0
- platypus_server-0.2.0/tui/settings.py +110 -0
- platypus_server-0.2.0/tui/tasks/__init__.py +101 -0
- platypus_server-0.2.0/tui/tasks/backup.py +84 -0
- platypus_server-0.2.0/tui/tasks/base.py +23 -0
- platypus_server-0.2.0/tui/tasks/caddy.py +37 -0
- platypus_server-0.2.0/tui/tasks/docker.py +35 -0
- platypus_server-0.2.0/tui/tasks/firewall.py +30 -0
- platypus_server-0.2.0/tui/tasks/packages.py +138 -0
- platypus_server-0.2.0/tui/tasks/ssh.py +35 -0
- platypus_server-0.2.0/tui/tasks/sysupdate.py +44 -0
- platypus_server-0.2.0/tui/tasks/vpn.py +63 -0
- platypus_server-0.2.0/zero2server/__init__.py +11 -0
- platypus_server-0.2.0/zero2server/__main__.py +6 -0
- platypus_server-0.2.0/zero2server/catalog.py +95 -0
- platypus_server-0.2.0/zero2server/cli.py +157 -0
- platypus_server-0.2.0/zero2server/generator.py +110 -0
- platypus_server-0.2.0/zero2server/runner.py +101 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 platypus-server contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,497 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: platypus-server
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Interactive TUI and web dashboard for Linux server setup and monitoring
|
|
5
|
+
Author: aebayav
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/aebayav/platypus-server
|
|
8
|
+
Project-URL: Repository, https://github.com/aebayav/platypus-server
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/aebayav/platypus-server/issues
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Environment :: Console
|
|
16
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: textual>=0.77.0
|
|
21
|
+
Requires-Dist: pyyaml>=6.0
|
|
22
|
+
Requires-Dist: flask>=3.0
|
|
23
|
+
Requires-Dist: psutil>=5.9
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
26
|
+
Requires-Dist: tomli>=2.0; python_version < "3.11" and extra == "dev"
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# platypus-server
|
|
30
|
+
|
|
31
|
+
Tools for setting up and operating a Linux home server: an interactive TUI,
|
|
32
|
+
a web dashboard, a swappable server-role system, a docker-compose generator,
|
|
33
|
+
and an Ansible configuration layer.
|
|
34
|
+
|
|
35
|
+
## Components
|
|
36
|
+
|
|
37
|
+
| Component | Command | Purpose |
|
|
38
|
+
|---|---|---|
|
|
39
|
+
| TUI | `platypus-tui` | Interactive Linux server setup (Textual) |
|
|
40
|
+
| Web dashboard | `platypus-dashboard` | Services, metrics and container management (Flask) |
|
|
41
|
+
| Server roles | `platypus-server` | Switch the server between pre-built roles |
|
|
42
|
+
| Compose generator | `zero-to-server` | Generate docker-compose.yml and Caddyfile |
|
|
43
|
+
| Ansible layer | playbooks, inventory | Configuration management for dev/prod |
|
|
44
|
+
|
|
45
|
+
## Requirements
|
|
46
|
+
|
|
47
|
+
- Python 3.10+
|
|
48
|
+
- Docker (optional: dashboard container controls, Molecule role tests)
|
|
49
|
+
|
|
50
|
+
## One-line server bootstrap
|
|
51
|
+
|
|
52
|
+
On the server itself, run a single command — it installs the system packages,
|
|
53
|
+
clones the repository to `/opt/platypus-server`, creates a virtual environment,
|
|
54
|
+
installs Ansible and the required collections, and runs the playbook locally
|
|
55
|
+
(`ansible_connection: local`):
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
curl -fsSL https://raw.githubusercontent.com/aebayav/platypus-server/main/bootstrap.sh | sudo bash
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Supported distros: Debian/Ubuntu, Fedora/RHEL, Alpine, Arch and openSUSE.
|
|
62
|
+
|
|
63
|
+
The installation steps adapt to the kind of server with `PLATYPUS_TARGET`:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Home server behind NAT (default): Tailscale firewall rule, no fail2ban
|
|
67
|
+
curl -fsSL https://raw.githubusercontent.com/aebayav/platypus-server/main/bootstrap.sh | sudo bash
|
|
68
|
+
|
|
69
|
+
# Public VPS: fail2ban for SSH, HTTP/HTTPS opened for the reverse proxy
|
|
70
|
+
curl -fsSL https://raw.githubusercontent.com/aebayav/platypus-server/main/bootstrap.sh | sudo env PLATYPUS_TARGET=vps bash
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Options:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Development environment instead of production
|
|
77
|
+
curl -fsSL https://raw.githubusercontent.com/aebayav/platypus-server/main/bootstrap.sh | sudo env PLATYPUS_ENV=dev bash
|
|
78
|
+
|
|
79
|
+
# Dry run (extra arguments after `--` go to ansible-playbook)
|
|
80
|
+
curl -fsSL https://raw.githubusercontent.com/aebayav/platypus-server/main/bootstrap.sh | sudo bash -s -- --check
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Re-running is safe: the script updates the existing checkout, reuses the
|
|
84
|
+
virtual environment and re-applies the idempotent playbook.
|
|
85
|
+
|
|
86
|
+
### Pre-flight checks (`platypus doctor`)
|
|
87
|
+
|
|
88
|
+
Before touching anything, run the pre-flight checks — they verify the OS,
|
|
89
|
+
sudo rights, Python version, free disk and RAM, internet access, and that
|
|
90
|
+
the ports the stack needs (80, 443, 5050, 8080) are free:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# standalone — no installation needed
|
|
94
|
+
curl -fsSL https://raw.githubusercontent.com/aebayav/platypus-server/main/doctor.py | python3 -
|
|
95
|
+
|
|
96
|
+
# or, once the repository is installed
|
|
97
|
+
platypus doctor
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
The bootstrap above runs the same checks automatically, so a missing sudo
|
|
101
|
+
right or a blocked port fails **before** the installation starts instead of
|
|
102
|
+
halfway through. The default port list depends on the target — a VPS checks
|
|
103
|
+
`80,443,5050,8080`, a home server `5050,8080` (`--target` or the
|
|
104
|
+
`PLATYPUS_TARGET` environment variable selects it). Custom port list:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
platypus doctor --ports 80,443,5050,8080,25565
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Installation
|
|
111
|
+
|
|
112
|
+
### Windows (PowerShell)
|
|
113
|
+
|
|
114
|
+
```powershell
|
|
115
|
+
powershell -ExecutionPolicy Bypass -File setup.ps1
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Then activate the environment:
|
|
119
|
+
|
|
120
|
+
```powershell
|
|
121
|
+
.\.venv\Scripts\Activate.ps1
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Linux / macOS / WSL
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
make setup
|
|
128
|
+
source .venv/bin/activate
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Install the package
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
pip install -e .
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Optional extras: `.[dashboard]` (Flask, psutil) and `.[zero2server]` (PyYAML).
|
|
138
|
+
Textual, the TUI dependency, is installed by default.
|
|
139
|
+
|
|
140
|
+
## Profiles and settings
|
|
141
|
+
|
|
142
|
+
Two settings keep the interfaces from getting overwhelming. Both are
|
|
143
|
+
changeable in the TUI itself (**Settings**, the last entry of the main menu)
|
|
144
|
+
and persist in `~/.config/platypus/config.yml` (relocatable with
|
|
145
|
+
`PLATYPUS_CONFIG`):
|
|
146
|
+
|
|
147
|
+
| Setting | Values | Effect |
|
|
148
|
+
|---|---|---|
|
|
149
|
+
| `mode` | `simple`, `full` | `simple` shows the essentials only and hides advanced tasks (WireGuard, PostgreSQL, Redis, Nginx, Certbot, Backup) |
|
|
150
|
+
| `target` | `home`, `vps` | picks the relevant tasks and installation steps for a home server behind NAT or a public VPS |
|
|
151
|
+
|
|
152
|
+
Target differences at a glance:
|
|
153
|
+
|
|
154
|
+
- **home** — VPN stage (Tailscale/WireGuard) in Sequential Setup, Tailscale
|
|
155
|
+
firewall rule, ports `5050,8080` checked by the doctor
|
|
156
|
+
- **vps** — no VPN stage (public IP already), Nginx/Certbot tasks instead of
|
|
157
|
+
Tailscale, fail2ban + open HTTP/HTTPS in the Ansible run, ports
|
|
158
|
+
`80,443,5050,8080` checked by the doctor
|
|
159
|
+
|
|
160
|
+
Values resolve with this precedence: **command-line flags > environment
|
|
161
|
+
variables (`PLATYPUS_MODE`, `PLATYPUS_TARGET`) > config file > defaults
|
|
162
|
+
(`full`, `home`)**. Examples:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
platypus-tui --mode simple --target vps
|
|
166
|
+
PLATYPUS_TARGET=vps platypus doctor
|
|
167
|
+
sudo env PLATYPUS_TARGET=vps bash bootstrap.sh
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Directory Structure
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
platypus-server/
|
|
174
|
+
├── tui/ # Textual TUI (server setup)
|
|
175
|
+
│ └── settings.py # mode (simple/full) + target (home/vps) settings
|
|
176
|
+
├── dashboard/ # Flask web dashboard
|
|
177
|
+
├── recipe/ # Server-role switch system
|
|
178
|
+
├── zero2server/ # docker-compose + Caddyfile generator
|
|
179
|
+
├── roles/
|
|
180
|
+
│ ├── common/ # Ansible role: base server configuration
|
|
181
|
+
│ │ └── molecule/ # Ansible role tests
|
|
182
|
+
│ ├── platypus/ # Ansible role: application deployment
|
|
183
|
+
│ ├── security/ # Ansible role: SSH hardening, UFW, target steps
|
|
184
|
+
│ ├── minecraft-server/ # Recipe role: template.yml + questions.yml
|
|
185
|
+
│ ├── storage-nextcloud/ # Recipe role
|
|
186
|
+
│ ├── storage-samba/ # Recipe role
|
|
187
|
+
│ ├── pihole/ # Recipe role
|
|
188
|
+
│ ├── syncthing/ # Recipe role
|
|
189
|
+
│ ├── jellyfin/ # Recipe role
|
|
190
|
+
│ └── assetto-corsa/ # Recipe role
|
|
191
|
+
├── playbooks/
|
|
192
|
+
│ └── site.yml # Main playbook
|
|
193
|
+
├── inventory/
|
|
194
|
+
│ ├── dev/ # Development environment
|
|
195
|
+
│ │ ├── hosts.yml
|
|
196
|
+
│ │ └── group_vars/
|
|
197
|
+
│ └── prod/ # Production environment
|
|
198
|
+
│ ├── hosts.yml
|
|
199
|
+
│ └── group_vars/
|
|
200
|
+
├── scripts/ # Backup and service install scripts
|
|
201
|
+
├── tests/ # pytest suite
|
|
202
|
+
├── doctor.py # Pre-flight checks (platypus doctor)
|
|
203
|
+
├── bootstrap.sh # One-line server installer
|
|
204
|
+
├── ansible.cfg # Ansible configuration
|
|
205
|
+
├── requirements.txt # Ansible/testing Python dependencies
|
|
206
|
+
├── requirements.yml # Ansible collections
|
|
207
|
+
├── Makefile # Helper commands
|
|
208
|
+
├── setup.ps1 # Windows setup script
|
|
209
|
+
├── .ansible-lint.yml
|
|
210
|
+
└── .yamllint.yml
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## Ansible
|
|
214
|
+
|
|
215
|
+
The `ansible.cfg`, `playbooks/`, `inventory/` and Ansible role directories
|
|
216
|
+
provide a ready-to-use configuration management environment. Ansible runs
|
|
217
|
+
directly on the server itself with `ansible_connection: local` — no SSH
|
|
218
|
+
needed. The one-line bootstrap above is the quickest way to set a server up;
|
|
219
|
+
the commands below are the manual equivalent for development.
|
|
220
|
+
|
|
221
|
+
The playbook applies `common`, `security` and `platypus`. The `security`
|
|
222
|
+
role hardens SSH and configures UFW for every target, then diverges:
|
|
223
|
+
fail2ban and open HTTP/HTTPS ports on a VPS (`-e platypus_target=vps`),
|
|
224
|
+
a Tailscale firewall rule on a home server (the default).
|
|
225
|
+
|
|
226
|
+
### Check the environment
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
ansible --version
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Ping the local environment
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
ansible localhost -i inventory/dev -m ping
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Run the playbook
|
|
239
|
+
|
|
240
|
+
Use `-i inventory/dev` on a development box or `-i inventory/prod` on the
|
|
241
|
+
production server:
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
# Syntax check
|
|
245
|
+
ansible-playbook --syntax-check playbooks/site.yml -i inventory/dev
|
|
246
|
+
|
|
247
|
+
# Dry run
|
|
248
|
+
ansible-playbook playbooks/site.yml -i inventory/dev --check
|
|
249
|
+
|
|
250
|
+
# Real run
|
|
251
|
+
ansible-playbook playbooks/site.yml -i inventory/dev
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### Lint
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
ansible-lint
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### Role testing (Molecule)
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
cd roles/common
|
|
264
|
+
molecule test
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
## Creating a New Ansible Role
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
ansible-galaxy role init roles/new-role
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
Add the generated role to the `roles:` list in `playbooks/site.yml`.
|
|
274
|
+
|
|
275
|
+
## Secrets (Vault)
|
|
276
|
+
|
|
277
|
+
To encrypt sensitive variables:
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
ansible-vault encrypt_string 'secret-value' --name 'db_password'
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
Add the encrypted value to the relevant `group_vars` file and run with:
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
ansible-playbook playbooks/site.yml -i inventory/dev --ask-vault-pass
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
## TUI (Text User Interface)
|
|
290
|
+
|
|
291
|
+
A Textual-based TUI is included for configuring a Linux server interactively. It covers:
|
|
292
|
+
|
|
293
|
+
- **Docker + Docker Compose** — installation via the official convenience script
|
|
294
|
+
- **Caddy Reverse Proxy** — installation from the official apt repository
|
|
295
|
+
- **SSH Hardening** — disable password/root login via a drop-in config
|
|
296
|
+
- **UFW Firewall** — safe defaults with SSH/HTTP/HTTPS allowed
|
|
297
|
+
- **Tailscale / WireGuard** — secure remote access
|
|
298
|
+
|
|
299
|
+
The first menu entry, **Sequential Setup (step-by-step)**, runs the full setup
|
|
300
|
+
in a safe order — Docker → Caddy → SSH hardening → UFW → VPN. It asks for
|
|
301
|
+
confirmation before the SSH and UFW stages and lets you pick Tailscale,
|
|
302
|
+
WireGuard, or skip the VPN stage entirely. On a VPS there is no VPN stage
|
|
303
|
+
(the server already has a public IP); the exact task list follows the
|
|
304
|
+
`target`/`mode` settings — see [Profiles and settings](#profiles-and-settings).
|
|
305
|
+
|
|
306
|
+
### Install and run
|
|
307
|
+
|
|
308
|
+
```bash
|
|
309
|
+
# inside the project virtual environment
|
|
310
|
+
pip install -e .
|
|
311
|
+
platypus-tui
|
|
312
|
+
# or, with explicit settings (flags > env vars > saved config)
|
|
313
|
+
platypus-tui --mode simple --target vps
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
Or without installing:
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
python -m tui
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
Run with sudo for the best experience (otherwise privileged steps use `sudo -n`):
|
|
323
|
+
|
|
324
|
+
```bash
|
|
325
|
+
sudo -E .venv/bin/platypus-tui
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
> The TUI performs **real system changes**. Run it directly on the Linux server
|
|
329
|
+
> you want to configure — it is not intended for Windows hosts.
|
|
330
|
+
|
|
331
|
+
## Web Dashboard
|
|
332
|
+
|
|
333
|
+
A web dashboard (Flask + psutil) for the local server, behind a simple login
|
|
334
|
+
(default `admin` / `platypus`; override with the `DASHBOARD_USER` and
|
|
335
|
+
`DASHBOARD_PASSWORD` environment variables):
|
|
336
|
+
|
|
337
|
+
- **Services** — Portainer, Uptime Kuma, and your own projects (up/down status)
|
|
338
|
+
- **System** — CPU, memory, disk usage, temperatures and metric history
|
|
339
|
+
- **Containers** — list, run, start/stop/restart, remove, logs, stats, images
|
|
340
|
+
- **Compose** — manage docker compose stacks
|
|
341
|
+
- **Systemd** — service status and control
|
|
342
|
+
- **Firewall** — UFW rule overview
|
|
343
|
+
- **Roles** — active and dormant server roles
|
|
344
|
+
|
|
345
|
+
A public `/health` endpoint reports `ok` / `degraded` for monitoring tools.
|
|
346
|
+
|
|
347
|
+
### Configure services
|
|
348
|
+
|
|
349
|
+
Edit `dashboard/services.py` to list your services:
|
|
350
|
+
|
|
351
|
+
```python
|
|
352
|
+
SERVICES = [
|
|
353
|
+
{"name": "Portainer", "url": "http://localhost:9000"},
|
|
354
|
+
{"name": "Uptime Kuma", "url": "http://localhost:3001"},
|
|
355
|
+
{"name": "My App", "url": "http://localhost:8080"},
|
|
356
|
+
]
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
### Run
|
|
360
|
+
|
|
361
|
+
```bash
|
|
362
|
+
pip install -e ".[dashboard]"
|
|
363
|
+
python -m dashboard
|
|
364
|
+
# or
|
|
365
|
+
platypus-dashboard
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
Then open http://localhost:5050. Override the host/port with `DASHBOARD_HOST`
|
|
369
|
+
and `DASHBOARD_PORT` environment variables.
|
|
370
|
+
|
|
371
|
+
### Run as a systemd service (auto-start on boot)
|
|
372
|
+
|
|
373
|
+
```bash
|
|
374
|
+
sudo ./scripts/install-dashboard-service.sh
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
This creates a `platypus-dashboard.service` that starts the dashboard
|
|
378
|
+
automatically on boot and restarts it if it crashes:
|
|
379
|
+
|
|
380
|
+
```bash
|
|
381
|
+
systemctl status platypus-dashboard
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
## Server Roles (recipe system)
|
|
385
|
+
|
|
386
|
+
`platypus-server` switches the whole server between pre-built roles. Each role
|
|
387
|
+
is defined by two files under `roles/<name>/`:
|
|
388
|
+
|
|
389
|
+
- `template.yml` — docker-compose template, hooks and an optional Caddy route
|
|
390
|
+
- `questions.yml` — questions asked during first-time setup
|
|
391
|
+
|
|
392
|
+
### Built-in roles
|
|
393
|
+
|
|
394
|
+
| Role | Image | Description |
|
|
395
|
+
|---|---|---|
|
|
396
|
+
| `minecraft-server` | itzg/minecraft-server | Minecraft Java Edition with RCON-safe shutdown |
|
|
397
|
+
| `storage-nextcloud` | nextcloud:28-apache + mariadb:10.11 | Personal cloud storage |
|
|
398
|
+
| `storage-samba` | dperson/samba | SMB/CIFS file sharing |
|
|
399
|
+
| `pihole` | pihole/pihole | Network-wide ad blocking (DNS sinkhole) |
|
|
400
|
+
| `syncthing` | syncthing/syncthing | File synchronization between devices |
|
|
401
|
+
| `jellyfin` | jellyfin/jellyfin | Media server (movies, TV, music) |
|
|
402
|
+
| `assetto-corsa` | germanrcuriel/assetto-corsa-server | Assetto Corsa dedicated racing server |
|
|
403
|
+
|
|
404
|
+
### Usage
|
|
405
|
+
|
|
406
|
+
```bash
|
|
407
|
+
# Switch to a role (prompts for answers on first run)
|
|
408
|
+
platypus-server switch minecraft-server
|
|
409
|
+
|
|
410
|
+
# Show active role, dormant roles and transition history
|
|
411
|
+
platypus-server status
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
During a switch, the current role is stopped (including its `pre_remove`
|
|
415
|
+
hooks, e.g. RCON save for Minecraft), the new role's `docker-compose.yml` is
|
|
416
|
+
rendered from the template and answers, the stack is started, the Caddy route
|
|
417
|
+
is updated, and the state is recorded in `/opt/platypus/state.yml`. Existing
|
|
418
|
+
answers are reused on later switches, and a transition lock with rollback
|
|
419
|
+
protects against interrupted switches.
|
|
420
|
+
|
|
421
|
+
Runtime data lives under `/opt/platypus/roles/<role>/` (`answers.yml`,
|
|
422
|
+
`docker-compose.yml`, bind-mounted `./data`). The role system targets Linux
|
|
423
|
+
hosts.
|
|
424
|
+
|
|
425
|
+
## zero-to-server CLI
|
|
426
|
+
|
|
427
|
+
An interactive CLI that generates a personalized `docker-compose.yml` plus a
|
|
428
|
+
`Caddyfile` by asking which services you want, your domain, and whether to
|
|
429
|
+
enable HTTPS. Available services in the catalog: Portainer, Uptime Kuma,
|
|
430
|
+
Caddy, Watchtower, PostgreSQL and Redis.
|
|
431
|
+
|
|
432
|
+
### Run
|
|
433
|
+
|
|
434
|
+
```bash
|
|
435
|
+
pip install -e ".[zero2server]"
|
|
436
|
+
zero-to-server
|
|
437
|
+
# or
|
|
438
|
+
python -m zero2server
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
Answer the prompts — it writes `docker-compose.yml` and, when Caddy is
|
|
442
|
+
selected, a `Caddyfile` with subdomain routes (e.g. `portainer.example.com`)
|
|
443
|
+
and automatic Let's Encrypt HTTPS.
|
|
444
|
+
|
|
445
|
+
Useful flags: `--run` starts the stack right away with `docker compose up -d`,
|
|
446
|
+
`--install-cron` installs a daily cron job that restarts Watchtower, and
|
|
447
|
+
`--out-dir DIR` sets the output directory.
|
|
448
|
+
|
|
449
|
+
## Scripts
|
|
450
|
+
|
|
451
|
+
| Script | Purpose |
|
|
452
|
+
|---|---|
|
|
453
|
+
| `bootstrap.sh` | One-line installer: system packages + repo + venv + Ansible + playbook |
|
|
454
|
+
| `scripts/backup.sh` | Archives `BACKUP_DIRS` to `BACKUP_DEST`, keeps `BACKUP_RETENTION` days of backups, optional S3 upload (`S3_BUCKET`) |
|
|
455
|
+
| `scripts/install-backup-cron.sh` | Installs the `/etc/cron.d/platypus-backup` cron job |
|
|
456
|
+
| `scripts/install-dashboard-service.sh` | Registers `platypus-dashboard.service` (starts on boot) |
|
|
457
|
+
|
|
458
|
+
Run a backup directly:
|
|
459
|
+
|
|
460
|
+
```bash
|
|
461
|
+
sudo ./scripts/backup.sh
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
## Testing & CI
|
|
465
|
+
|
|
466
|
+
A GitHub Actions workflow (`.github/workflows/ci.yml`) runs on every push and
|
|
467
|
+
pull request:
|
|
468
|
+
|
|
469
|
+
- `ansible-playbook --syntax-check`
|
|
470
|
+
- `ansible-lint` and `yamllint`
|
|
471
|
+
- Headless TUI smoke tests (`pytest`)
|
|
472
|
+
|
|
473
|
+
To run the same checks locally:
|
|
474
|
+
|
|
475
|
+
```bash
|
|
476
|
+
pip install -r requirements.txt
|
|
477
|
+
pip install -e ".[dev]"
|
|
478
|
+
ansible-galaxy collection install -r requirements.yml -p collections
|
|
479
|
+
ansible-playbook --syntax-check playbooks/site.yml -i inventory/dev
|
|
480
|
+
ansible-lint
|
|
481
|
+
yamllint .
|
|
482
|
+
pytest -q
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
Molecule role tests require Docker and are run on demand (e.g. on a Linux VM):
|
|
486
|
+
|
|
487
|
+
```bash
|
|
488
|
+
cd roles/common
|
|
489
|
+
molecule test
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
## Notes
|
|
493
|
+
|
|
494
|
+
- Ansible runs on the server itself via `ansible_connection: local` — there is no SSH or remote inventory to configure.
|
|
495
|
+
- Pick environment variables with `-i inventory/dev` (development) or `-i inventory/prod` (production).
|
|
496
|
+
- Collections are installed into `./collections` and are not committed to git (see `.gitignore`).
|
|
497
|
+
- The `roles/` directory holds both Ansible roles (`common`, `security`, `platypus`) and recipe role templates (the ones with `template.yml` and `questions.yml`).
|