Metadata-Version: 2.5
Name: cognitivesystems
Version: 1.1.8
Summary: CognitiveSystems: a swizzin-style Docker app deployer with a web panel.
Project-URL: Homepage, https://github.com/automationnexus/CognitiveSystems
Project-URL: Source, https://github.com/automationnexus/CognitiveSystems
Author: Tahasanul Abraham
License-Expression: MIT
Keywords: compose,deploy,docker,homeserver,self-hosted
Classifier: Environment :: Console
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: System :: Installation/Setup
Requires-Python: >=3.12
Requires-Dist: argon2-cffi>=23.1
Requires-Dist: bcrypt>=4
Requires-Dist: cryptography>=42
Requires-Dist: docker<8,>=7
Requires-Dist: fastapi>=0.115
Requires-Dist: jinja2<4,>=3.1
Requires-Dist: pydantic>=2
Requires-Dist: pyyaml>=6
Requires-Dist: uvicorn[standard]>=0.30
Provides-Extra: dev
Requires-Dist: httpx2>=2.0; extra == 'dev'
Requires-Dist: pytest-cov>=5; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: ruff>=0.5; extra == 'dev'
Description-Content-Type: text/markdown

# CognitiveSystems

> **v1 operators: do not upgrade in place.** This release is published under the same PyPI name,
> `cognitivesystems`, so `pip install -U cognitivesystems` on a v1 host replaces v1 without a
> migration. Pin `cognitivesystems<1` on every v1 host until you migrate, and follow the migration
> guide (`docs/migration-from-v1.md` in the repository), which installs this release with
> `install.sh` into its own venv and moves your apps with `cs migrate`.
>
> **If it already happened:** `cs`, run from v1's venv on a v1 host, refuses every verb except
> `--version`, `doctor` and `migrate --dry-run`, and prints the recovery. Reinstall v1 (for example
> `pipx install --force cognitivesystems==0.1.5`), then install this release with `install.sh`.

CognitiveSystems installs and runs self-hosted apps on one Linux host with Docker, in the spirit of
swizzin: pick an app, it is deployed, wired to the apps it works with, published behind one login,
kept up to date and backed up. Everything is managed from a web panel or the `cs` command line.

- **An app store** of bundled apps (media servers, the Arr stack, download clients, mail, tools),
  plus custom apps of your own.
- **Links:** installed apps are configured to talk to each other (API keys, download clients,
  indexers) and kept that way.
- **A built-in Traefik edge** with Let's Encrypt certificates (HTTP-01 or Cloudflare DNS-01,
  wildcards) and one panel login (SSO) in front of the apps you publish.
- **App updates with rollback**, by image digest, inside an update window; the manager updates
  itself the same way.
- **Backups** of the manager and every app's config, encrypted at rest by default.
- **Networking:** one dual-stack Docker bridge, static addresses, host ports, extra networks, a
  VPN tunnel per app or shared, and GPU access per app.
- **Notifications** to ntfy, Discord, Telegram or SMTP.

## Supported hosts

- Linux with **systemd**, on **amd64 or arm64**, run as **root**.
- **Docker Engine 28.0 or newer** (rootful) with the **Compose plugin 2.33 or newer**. Rootless
  Docker, Docker Desktop and Podman are not supported.
- cgroup v2 recommended. For IPv6 NAT (the default), Docker's `ip6tables` must be on.
- No Python on the host is needed: the installer brings its own.

`install.sh` checks all of this before it changes anything, and `cs doctor` keeps checking it.

## Install

The repository is private, so fetch `install.sh` at a **release tag** with an authenticated GitHub
CLI (`gh`, with read access to the repository). Never fetch it from a branch head.

```
gh api -H "Accept: application/vnd.github.raw" "repos/AutomationNexus/CognitiveSystems/contents/install.sh?ref=v<X.Y.Z>" > install.sh
less install.sh
sudo bash install.sh
```

The installer checks the host, installs a pinned `uv` and Python into `/opt/cognitivesystems`,
installs this package from PyPI hash-pinned into its own venv, writes the systemd unit
`cognitivesystems.service`, starts it and prints a **setup token**. Running it again repairs the
install. Useful flags: `--version X.Y.Z`, `--port N` (default 8800), `--wheel FILE` and
`--offline` for a host without internet access.

## First login

1. The panel listens on `127.0.0.1:8800`. From another machine, tunnel to it:
   `ssh -L 8800:127.0.0.1:8800 root@<host>`, then open `http://127.0.0.1:8800/`.
2. Enter the setup token (valid 24 hours, single use; `cs setup --issue-token` prints a new one)
   and create the admin account.
3. The setup wizard walks through the paths, the network, the domain and certificates (staging
   first), and the first apps.
4. Enrol the second factor (Settings, Auth) before you publish the panel on a domain.

## Getting help

- `cs doctor` (or the panel's Doctor page) runs every host, network, storage and app check and
  prints a fix for each problem.
- `cs --help` and `cs <verb> --help` describe every command.
- The repository's `docs/` directory has the guides: install, apps, networking, storage,
  certificates, updates and backups, security, troubleshooting, the CLI reference, the migration
  from v1 and the release notes.

## Uninstall

`sudo cs uninstall` removes the program and keeps your state, app config, app data and running apps.
`--purge-state` and `--purge-apps` remove more, each after a typed confirmation phrase. Your
`config_root` and `data_root` are never deleted.
