Metadata-Version: 2.4
Name: orbitctl
Version: 0.1.0
Summary: Run your own web server like a hosting panel, with every change in git: Laravel, PHP, static and Next.js sites on one Ubuntu box.
Author: Marco Insabato
License-Expression: MIT
Project-URL: Homepage, https://github.com/marcoinsabato/orbitctl
Project-URL: Documentation, https://github.com/marcoinsabato/orbitctl/tree/main/docs
Project-URL: Issues, https://github.com/marcoinsabato/orbitctl/issues
Project-URL: Security, https://github.com/marcoinsabato/orbitctl/security/policy
Project-URL: Releases, https://github.com/marcoinsabato/orbitctl/releases
Keywords: server,hosting,laravel,nginx,deploy,gitops,ploi,forge
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: System Administrators
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: System :: Systems Administration
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: ui
Requires-Dist: textual==8.2.8; extra == "ui"
Dynamic: license-file

# orbitctl

Run your own web server like a hosting panel, with every change in git.

`orbit` manages one Ubuntu 24.04 server and the sites on it: Laravel, plain PHP,
static and Next.js. It handles:
- nginx, PHP-FPM pools and supervisor workers;
- cron, Let's Encrypt certificates and deploy keys;
- MySQL and Redis;
- backups with restic;
- monitoring with push notifications;
- DNS records.

There is no panel and no daemon. Each site is a folder of plain files in your
own git repository. `orbit plan` shows what would change on the server as a
diff. `orbit apply` makes the change.

```
$ orbit plan example.com
example.com: 1 changes
  ~ /etc/supervisor/conf.d/example.conf: content
      --- current
      +++ new
      @@ -1,5 +1,5 @@
       [program:example-queue]
      -command=php8.4 /home/example/example.com/artisan queue:work --sleep=3 --tries=3
      +command=php8.4 /home/example/example.com/artisan queue:work --sleep=3 --tries=5
       directory=/home/example/example.com
       user=example
       numprocs=1
```

## Why

Hosted panels like Forge, Ploi or RunCloud are convenient, but your server's
state lives in their database:
- you can't review a change before it happens;
- you can't see who changed what;
- the server's configuration isn't in git.

orbit keeps the convenience and moves that state into files.

- **The repository is the truth.** Sites, workers, crons and nginx are files.
  To change something, you edit a file, commit it and run `orbit apply`.
- **Look before you touch.** `plan` is a real diff against the live server, and
  `apply` does exactly what `plan` shows. Then it tests the configuration with
  `nginx -t` and `php-fpm -t`, and puts the old files back if a test fails.
- **Built for scripts and LLM agents.**
  - no interactive prompts;
  - `--json` on every command that reads;
  - meaningful exit codes;
  - errors that say what to do next;
  - `--yes` required for destructive commands.
- **Secrets stay out of the CLI.** orbit shows only the *names* of a site's
  `.env` variables, and new values arrive on stdin. An agent can manage a site
  without ever seeing a password.
- **Nothing to install on the server.** orbit is Python 3 with only the standard
  library, which Ubuntu already ships. It runs only when you call it.

## What it does

| Area | What you get |
|---|---|
| Sites | one Linux user and isolated home per site, a PHP-FPM pool per site, nginx with HTTPS, aliases redirected to the main domain |
| Site types | `laravel`, `php`, `static` (with an optional build step), `nextjs` (`next start` under supervisor) |
| Deploys | a root-owned deploy script per site, started by GitHub Actions over SSH with a key that can run only that script |
| Runtimes | several PHP, Node and Python versions side by side, one per site in `site.env` |
| Data | MySQL 8 per site (database, user, password written into `.env`), SQLite, Redis per site on a private socket |
| Backups | nightly restic snapshots per site (`.env`, databases, uploads) to S3-compatible storage |
| Monitoring | `orbit doctor` checks every 5 minutes, alerts on your phone through [ntfy](https://ntfy.sh) |
| Security | firewall, fail2ban, key-only SSH, automatic security updates, a nightly audit of each site's dependencies against [OSV](https://osv.dev) |
| DNS | records through the provider's API (OVH for now), including moving a site's records from an old server |
| Dashboard | `orbit ui`: a terminal dashboard with the server, the sites, logs, and a command on each key |
| Migration | a read-only inventory of an old Ploi server, and a copy of a site's `.env`, database and files from it |

## How it works

```
  your computer                                   the server
  ─────────────                                   ──────────

  orbit plan example.com
    │ 1. packs the project and orbit (tar)
    │    and sends it over ssh ──────────────────▶ /root/server (replaced as a whole)
    │ 2. runs itself on the server ──────────────▶ orbit --local plan example.com
    │                                                reads the real state and compares
    ◀──────────────────────── output (text or JSON) ─┘
```

On your computer, orbit changes nothing: it ships the project and forwards the
command. On the server, it reads and changes the system. If nothing changed since
the last command, orbit skips the upload, and most commands take a fraction of a
second. More in [docs/architecture.md](docs/architecture.md).

## Requirements

- **The server:** a fresh Ubuntu 24.04, with root SSH access by key and ports 22,
  80 and 443 open.
- **Your computer:** macOS or Linux, with Python 3.11 or later, `ssh` and `git`.
- **Optional:**
  - [`gh`](https://cli.github.com), to add deploy keys to GitHub automatically;
  - [Textual](https://textual.textualize.io), for the dashboard.

## Install

```bash
pipx install orbitctl           # the CLI: standard library only
pipx install 'orbitctl[ui]'     # with the terminal dashboard, orbit ui
```

## Quick start

A *project* is a git repository that describes one server. orbit finds it in the
`ORBIT_PROJECT` environment variable. Without that variable, it looks for a
`server.env` in the current directory and then in each parent directory.

```bash
mkdir my-server && cd my-server && git init
cat > server.env <<'EOF'
HOST=203.0.113.10
SSH_USER=root
TIMEZONE=Europe/Berlin
EOF
git add server.env && git commit -m "chore: my server"

orbit status        # ships orbit to /root/server; fails until the server is prepared
ssh root@203.0.113.10 'PHP_VERSIONS="8.4" /root/server/orbitctl/bootstrap.sh'
orbit doctor        # the server's checks
```

Then add a site:

```bash
orbit site new example.com --repo git@github.com:you/example.git --cert-email you@example.com
git add sites/example.com && git commit -m "feat: example.com"
orbit site create example.com       # user, deploy key on GitHub, clone, apply
orbit env set example.com APP_KEY   # asks for the value without echo; one per variable
orbit deploy example.com
# point the DNS of example.com and www.example.com to the server, then:
orbit cert example.com
```

[docs/getting-started.md](docs/getting-started.md) walks through every step,
including automatic deploys from GitHub Actions.

## Every day

```bash
orbit sites                         # every site: PHP, certificate, workers, last deploy and apply
orbit doctor                        # what is wrong, and what to do about it
orbit logs example.com laravel -f   # follow a log
orbit artisan example.com -- migrate:status
orbit env keys example.com          # variable names, never values
$EDITOR sites/example.com/supervisor.conf && orbit plan example.com
git commit -am "config: example.com, more retries" && orbit apply example.com
```

## Documentation

| | |
|---|---|
| [Getting started](docs/getting-started.md) | from an empty server to a site deployed from GitHub |
| [Architecture](docs/architecture.md) | how orbit works, the project layout, the files on the server |
| [Commands](docs/commands.md) | every command, `doctor`, `audit`, exit codes |
| [Site configuration](docs/site-config.md) | `site.env`, site types, workers, crons, nginx and PHP settings, templates |
| [Sites](docs/site.md) | `site new`, `create`, `migrate` and `remove` |
| [apply](docs/apply.md) | what `apply` writes, site isolation, reloads and rollback |
| [Deploys](docs/deploy.md) | deploy scripts, deploy keys, GitHub Actions |
| [Server setup](docs/bootstrap.md) | what `bootstrap.sh` installs and configures |
| [Certificates](docs/cert.md) | Let's Encrypt |
| [Runtimes](docs/runtimes.md) | PHP, Node and Python versions, OPcache |
| [MySQL](docs/db.md), [Redis](docs/redis.md) | databases and Redis for each site |
| [Backups](docs/backup.md) | restic, restore, disaster recovery |
| [Monitoring](docs/monitor.md) | alerts with ntfy |
| [DNS](docs/dns.md) | DNS providers, moving a site to the new server |
| [Dashboard](docs/ui.md) | `orbit ui` |
| [LLM agents](docs/agents.md) | rules and permissions for coding agents |

## Status

orbit runs its author's production server, but it is young:
- version 0.1;
- one server per project;
- Ubuntu 24.04 only;
- OVH is the only DNS provider.

Expect changes before 1.0. Ideas and bug reports are welcome, see
[CONTRIBUTING.md](CONTRIBUTING.md). For security issues, see
[SECURITY.md](SECURITY.md).

## License

MIT
