From 3c102089d38400caf634bea9d15c7725d7c38d49 Mon Sep 17 00:00:00 2001 From: Michael Aguiar Date: Tue, 13 Oct 2026 16:09:56 -0700 Subject: [PATCH 1/2] Rename alios-cli to Ingot The dev environment tool is useful to people who never use Alios, so it becomes its own product: Ingot (aliasproject/ingot). Everything is renamed with no fallbacks to the old names: - module github.com/aliasproject/ingot; binary `ingot` at /usr/local/bin/ingot; release assets ingot-- - containers ingot_php_, ingot_dns, ingot_proxy (was alios-reverse-proxy), ingot_mail, ingot_, ingot_idle, ingot_share*; compose project and network ingot / ingot_internal - volumes ingot_certs, ingot_vhosts, ingot_-, ingot_state - labels ingot.project.*, ingot.share.*, ingot.idle.*, ingot.service.* - env vars INGOT_*; Caddy snippets ingot_wake / ingot_stopped; headers X-Ingot-Project / X-Ingot-Share; Caddy CA display name "Ingot Local CA"; host files ingot.conf (resolver) and ingot-ca.crt - idle service image ghcr.io/aliasproject/ingot-idle (cmd/ingot-idle) The shared images ghcr.io/aliasproject/{php,caddy,dns,openssl} keep their names; production Alios uses them too. Code comments that describe conventions copied from the Alios platform still name it, and CLAUDE.md explains why. The README and CLAUDE.md intros now describe a standalone tool, and the "No project here" page shows a text wordmark instead of the Alios logo. --- .gitignore | 2 +- CLAUDE.md | 24 +-- Dockerfile.idle | 14 +- README.md | 161 ++++++++++---------- cmd/{alios-idle => ingot-idle}/main.go | 16 +- cmd/main.go | 16 +- docs/IDLE.md | 78 +++++----- docs/SHARING.md | 36 ++--- docs/UPDATES.md | 38 ++--- go.mod | 2 +- internal/commands/doctor.go | 112 +++++++------- internal/commands/handler.go | 196 ++++++++++++------------- internal/commands/idle.go | 62 ++++---- internal/commands/installer.go | 62 ++++---- internal/commands/pause.go | 24 +-- internal/commands/share.go | 22 +-- internal/config/config.go | 46 +++--- internal/github/client.go | 4 +- internal/idle/engine.go | 8 +- internal/idle/policy.go | 10 +- internal/idle/policy_test.go | 4 +- internal/idle/waker.go | 18 +-- internal/idle/waker_test.go | 16 +- internal/idle/watcher.go | 6 +- internal/idle/watcher_test.go | 2 +- internal/project/env.go | 6 +- internal/project/idle.go | 14 +- internal/project/manager.go | 106 ++++++------- internal/services/default_page.go | 2 +- internal/services/default_page.html | 27 ++-- internal/services/idle.go | 28 ++-- internal/services/manager.go | 108 +++++++------- internal/share/manager.go | 54 +++---- internal/ssl/manager.go | 124 ++++++++-------- internal/ssl/vhost_test.go | 6 +- internal/state/state.go | 8 +- internal/updater/updater.go | 22 +-- internal/utils/utils.go | 16 +- scripts/release.sh | 28 ++-- 39 files changed, 760 insertions(+), 768 deletions(-) rename cmd/{alios-idle => ingot-idle}/main.go (81%) diff --git a/.gitignore b/.gitignore index f211431..18684ac 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ .env -alios +ingot .DS_Store scripts/build diff --git a/CLAUDE.md b/CLAUDE.md index 8de81b5..8614adf 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -4,14 +4,14 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co ## What this is -Alios CLI (`alios`) is a single-binary Go CLI that manages a local Docker-based PHP development environment: per-project PHP (FrankenPHP) containers, global shared services (DNS, Caddy reverse proxy, MailHog), optional MySQL/PostgreSQL databases, and locally-trusted SSL certificates for `*.test` domains. It has no server component — every command shells out to the `docker` CLI on the user's machine. +Ingot (`ingot`) is a single-binary Go CLI that manages a local Docker-based PHP development environment: per-project PHP (FrankenPHP) containers, global shared services (DNS, Caddy reverse proxy, MailHog), optional MySQL/PostgreSQL databases, and locally-trusted SSL certificates for `*.test` domains. It has no server component — every command shells out to the `docker` CLI on the user's machine. -Alios CLI is the local-dev counterpart to Alios, a separate production server-management platform (Laravel app + Go microservices) that provisions servers and deploys Docker apps. Where practical, this CLI mirrors production's conventions (image selection vocabulary, Caddy as the reverse proxy) so a project's local dev environment structurally resembles what it runs as in production — but the two are independent codebases; this repo has no dependency on the production platform. +Ingot is a standalone tool for any PHP developer. It started as the local-dev companion to Alios, Alias Project's server-management platform, and was renamed and split out so it can be used without Alios. That's why some code comments refer to "production Alios" or "the Alios platform repo": the conventions here (image-selection vocabulary, Caddy as the reverse proxy, env injection) were copied from it so local projects look like production. There is no code dependency on Alios, and none should be added. Alios-specific features belong in a future Alios CLI that can build on Ingot. ## Build & run ```bash -go build -o alios ./cmd # build the binary +go build -o ingot ./cmd # build the binary go run ./cmd # run without building, e.g. go run ./cmd status go vet ./... # static checks ``` @@ -22,27 +22,27 @@ Releases are cut with `scripts/release.sh [notes]`, which patches `int ## Architecture -**Entry point**: `cmd/main.go` builds a `config.Config` (singleton, env-var driven) and a `docker.Client`, then hands off to `commands.Handler`, which is the dispatch table for every CLI subcommand (`internal/commands/handler.go`). First run (no binary at `/usr/local/bin/alios`) triggers `commands.Installer` (`internal/commands/installer.go`) instead of normal command dispatch. +**Entry point**: `cmd/main.go` builds a `config.Config` (singleton, env-var driven) and a `docker.Client`, then hands off to `commands.Handler`, which is the dispatch table for every CLI subcommand (`internal/commands/handler.go`). First run (no binary at `/usr/local/bin/ingot`) triggers `commands.Installer` (`internal/commands/installer.go`) instead of normal command dispatch. **No persisted config files.** This is deliberate, not incomplete: `config.Config.Save()` is a no-op. All state lives in one of two places: -- Environment variables (`GITHUB_TOKEN`, `ALIOS_*`) for user settings — see `internal/config/config.go`. -- Docker container labels (`alios.project.name`, `alios.project.php_version`, `alios.project.server_root`, `alios.project.image_type`, `alios.project.framework`, etc.) for per-project state — projects are *discovered* by inspecting containers, not read from disk. `project.Manager.GetCurrentProject()` derives project identity from the current working directory name plus the `alios_php_` container's labels/state; there is no separate "project database." +- Environment variables (`GITHUB_TOKEN`, `INGOT_*`) for user settings — see `internal/config/config.go`. +- Docker container labels (`ingot.project.name`, `ingot.project.php_version`, `ingot.project.server_root`, `ingot.project.image_type`, `ingot.project.framework`, etc.) for per-project state — projects are *discovered* by inspecting containers, not read from disk. `project.Manager.GetCurrentProject()` derives project identity from the current working directory name plus the `ingot_php_` container's labels/state; there is no separate "project database." **`internal/docker/client.go`** is the only layer that shells out to the `docker` binary (`exec.Command`). Every other package goes through `*docker.Client` rather than calling `os/exec` directly for container operations. **Two tiers of containers**, both Docker-labeled so they're discoverable without local state: -- *Project containers* (`internal/project/manager.go`): one `alios_php_` container per project directory, created directly via `docker.Client.RunContainer` (not compose) — or, for a project with `image_type=custom` and a build-from-Dockerfile choice, via `docker.Client.BuildImage` first. Changing PHP version, image choice, or server root means destroying and recreating the container, not reconfiguring it in place. -- *Global services* (`internal/services/manager.go`): `alios_dns`, `alios-reverse-proxy`, `alios_mail`, plus any configured databases, all managed as one Docker Compose project (`name: alios`) whose YAML is generated inline in Go (`generateComposeConfig`) rather than read from a file. Adding/removing a database rewrites and re-applies the whole compose config, which restarts the group. +- *Project containers* (`internal/project/manager.go`): one `ingot_php_` container per project directory, created directly via `docker.Client.RunContainer` (not compose) — or, for a project with `image_type=custom` and a build-from-Dockerfile choice, via `docker.Client.BuildImage` first. Changing PHP version, image choice, or server root means destroying and recreating the container, not reconfiguring it in place. +- *Global services* (`internal/services/manager.go`): `ingot_dns`, `ingot_proxy`, `ingot_mail`, plus any configured databases, all managed as one Docker Compose project (`name: ingot`) whose YAML is generated inline in Go (`generateComposeConfig`) rather than read from a file. Adding/removing a database rewrites and re-applies the whole compose config, which restarts the group. **Images come from a private GHCR registry** (`ghcr.io/aliasproject/{php,dns,caddy,openssl}`), so most flows depend on GitHub auth being set up first (`internal/github/client.go` — supports PAT, OAuth device flow, or delegating to `gh auth token`, then does the `docker login ghcr.io` for image pulls). The `php` image comes in several variant tags per PHP version (`-frankenphp-dev`, `-frankenphp-wordpress-dev`, ...), selected in `project.Manager.createContainer` based on the project's detected/chosen `framework` and `image_type` labels. -**SSL** (`internal/ssl/manager.go`): a CA cert and per-domain certs are generated by running the `ghcr.io/aliasproject/openssl` image against the `alios_certs` volume (not via a Go TLS library) — self-signed, not Let's Encrypt, since `.test` domains are IANA-reserved and never publicly resolvable so ACME has no path to succeed. Per-project Caddy vhost files (`.caddyfile`) are written directly into the `alios_vhosts` volume, which is mounted at `/etc/caddy` in the `alios-reverse-proxy` container alongside a base `Caddyfile` (written by `services.Manager.Start`) that does `import /etc/caddy/*.caddyfile` — adding or removing a project is just adding/removing one file plus `caddy reload`, no full-file rewrite. There's no templating engine, just Go `fmt.Sprintf` strings. The base Caddyfile also has host-less `https://`/`http://` catch-all sites that serve a branded "No project here" 404 page (`internal/services/default_page.html`, embedded in the binary and written to `alios_vhosts/default/`) for any `*.test` host without a vhost. Its HTTPS side can't use a static cert (browsers reject a wildcard directly under a TLD like `*.test`), so it uses Caddy's on-demand internal issuer with the alios CA as its root (the `pki` global block; `ssl.Manager.PrepareCAForCaddy` makes the CA key readable to Caddy before start), minting an exact cert per requested host that chains to the already-trusted CA. +**SSL** (`internal/ssl/manager.go`): a CA cert and per-domain certs are generated by running the `ghcr.io/aliasproject/openssl` image against the `ingot_certs` volume (not via a Go TLS library) — self-signed, not Let's Encrypt, since `.test` domains are IANA-reserved and never publicly resolvable so ACME has no path to succeed. Per-project Caddy vhost files (`.caddyfile`) are written directly into the `ingot_vhosts` volume, which is mounted at `/etc/caddy` in the `ingot_proxy` container alongside a base `Caddyfile` (written by `services.Manager.Start`) that does `import /etc/caddy/*.caddyfile` — adding or removing a project is just adding/removing one file plus `caddy reload`, no full-file rewrite. There's no templating engine, just Go `fmt.Sprintf` strings. The base Caddyfile also has host-less `https://`/`http://` catch-all sites that serve a branded "No project here" 404 page (`internal/services/default_page.html`, embedded in the binary and written to `ingot_vhosts/default/`) for any `*.test` host without a vhost. Its HTTPS side can't use a static cert (browsers reject a wildcard directly under a TLD like `*.test`), so it uses Caddy's on-demand internal issuer with the ingot CA as its root (the `pki` global block; `ssl.Manager.PrepareCAForCaddy` makes the CA key readable to Caddy before start), minting an exact cert per requested host that chains to the already-trusted CA. -**Sharing** (`internal/share/manager.go`, `alios share`): exposes a project publicly through a Cloudflare Tunnel. A `cloudflared` container on `alios_internal` sends traffic to Caddy over plain HTTP, and a `.share.caddyfile` vhost matching the exact public host proxies it on to the project. That vhost file is the only record of a share's URL, mode and auth. The tunnel containers carry `alios.share.*` labels only so leftovers can be found and removed, and they're deliberately not global services, so `global restart` doesn't bounce them. Quick mode (default) runs one `alios_share_` container per share with a random trycloudflare.com URL. Named mode (`ALIOS_SHARE_TUNNEL_TOKEN` + `ALIOS_SHARE_DOMAIN`) runs one shared `alios_share` container whose `*.` ingress is configured in the Cloudflare dashboard. See `docs/SHARING.md`. +**Sharing** (`internal/share/manager.go`, `ingot share`): exposes a project publicly through a Cloudflare Tunnel. A `cloudflared` container on `ingot_internal` sends traffic to Caddy over plain HTTP, and a `.share.caddyfile` vhost matching the exact public host proxies it on to the project. That vhost file is the only record of a share's URL, mode and auth. The tunnel containers carry `ingot.share.*` labels only so leftovers can be found and removed, and they're deliberately not global services, so `global restart` doesn't bounce them. Quick mode (default) runs one `ingot_share_` container per share with a random trycloudflare.com URL. Named mode (`INGOT_SHARE_TUNNEL_TOKEN` + `INGOT_SHARE_DOMAIN`) runs one shared `ingot_share` container whose `*.` ingress is configured in the Cloudflare dashboard. See `docs/SHARING.md`. -**Scale to zero** (`internal/idle`, `cmd/alios-idle`, `alios idle`): the `alios_idle` global service stops project containers that have been idle for `ALIOS_IDLE_TIMEOUT` (default 30m; the per-project `alios.project.idle` label overrides it) and starts them again when Caddy can't reach them. Every project and share vhost ends with `import alios_wake `, a snippet in the base Caddyfile that sends 502/503/504 errors to the waker, which starts the container and 307-redirects back to the same URL. `alios stop` swaps that line for `import alios_stopped ` (a "stopped" page), so a project stopped by hand stays down until `alios start`; the vhost is the only record of which state a project is in (`ssl.SetProjectStopped`). Idle means no network traffic, no CPU and no exec'd processes over the timeout (`idle.Tracker`, unit-tested). `alios_idle` is deliberately not a compose service or in `GlobalServices`: it's optional, and compose aborts the whole `up` when one image can't be pulled (`services/idle.go`). The service runs from its own image (`Dockerfile.idle`, pushed by `scripts/release.sh` as `ghcr.io/aliasproject/alios-idle:`), and it is the one place that talks to the Docker Engine API over the socket directly instead of through `docker.Client`, because its scratch image has no docker CLI. See `docs/IDLE.md`. +**Scale to zero** (`internal/idle`, `cmd/ingot-idle`, `ingot idle`): the `ingot_idle` global service stops project containers that have been idle for `INGOT_IDLE_TIMEOUT` (default 30m; the per-project `ingot.project.idle` label overrides it) and starts them again when Caddy can't reach them. Every project and share vhost ends with `import ingot_wake `, a snippet in the base Caddyfile that sends 502/503/504 errors to the waker, which starts the container and 307-redirects back to the same URL. `ingot stop` swaps that line for `import ingot_stopped ` (a "stopped" page), so a project stopped by hand stays down until `ingot start`; the vhost is the only record of which state a project is in (`ssl.SetProjectStopped`). Idle means no network traffic, no CPU and no exec'd processes over the timeout (`idle.Tracker`, unit-tested). `ingot_idle` is deliberately not a compose service or in `GlobalServices`: it's optional, and compose aborts the whole `up` when one image can't be pulled (`services/idle.go`). The service runs from its own image (`Dockerfile.idle`, pushed by `scripts/release.sh` as `ghcr.io/aliasproject/ingot-idle:`), and it is the one place that talks to the Docker Engine API over the socket directly instead of through `docker.Client`, because its scratch image has no docker CLI. See `docs/IDLE.md`. -**Networking**: all alios containers share one Docker bridge network (`alios_internal`, see `config.GetNetworkConfig()`). The `alios_dns` container resolves `*.test` to the host so `https://.test` reaches Caddy, which reverse-proxies to `alios_php_` by container name (Caddy resolves Docker container names on the shared network natively — no explicit resolver directive needed). Project containers get `alios_dns`'s live container IP injected as their DNS server (resolved at container-creation time, not hardcoded) so they can resolve other `.test` domains from inside. +**Networking**: all ingot containers share one Docker bridge network (`ingot_internal`, see `config.GetNetworkConfig()`). The `ingot_dns` container resolves `*.test` to the host so `https://.test` reaches Caddy, which reverse-proxies to `ingot_php_` by container name (Caddy resolves Docker container names on the shared network natively — no explicit resolver directive needed). Project containers get `ingot_dns`'s live container IP injected as their DNS server (resolved at container-creation time, not hardcoded) so they can resolve other `.test` domains from inside. **Self-update** (`internal/updater/updater.go`): checks GitHub Releases (private repo, needs `GITHUB_TOKEN`) first, then falls back to a public S3/R2-hosted `manifest.json`. Replaces the running binary atomically, escalating to `sudo`/Windows UAC if the install path isn't writable. diff --git a/Dockerfile.idle b/Dockerfile.idle index 5ab0d66..f3abab2 100644 --- a/Dockerfile.idle +++ b/Dockerfile.idle @@ -1,17 +1,17 @@ -# The alios_idle global service (cmd/alios-idle). Published as -# ghcr.io/aliasproject/alios-idle: by scripts/release.sh, tagged with +# The ingot_idle global service (cmd/ingot-idle). Published as +# ghcr.io/aliasproject/ingot-idle: by scripts/release.sh, tagged with # the CLI version so a CLI always runs the service it was built against. FROM golang:1.23-alpine AS build WORKDIR /src COPY go.mod ./ -COPY cmd/alios-idle ./cmd/alios-idle +COPY cmd/ingot-idle ./cmd/ingot-idle COPY internal/idle ./internal/idle ARG TARGETOS TARGETARCH RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH \ - go build -trimpath -ldflags="-s -w" -o /alios-idle ./cmd/alios-idle + go build -trimpath -ldflags="-s -w" -o /ingot-idle ./cmd/ingot-idle FROM scratch -COPY --from=build /alios-idle /alios-idle +COPY --from=build /ingot-idle /ingot-idle EXPOSE 8080 -HEALTHCHECK --interval=30s --timeout=3s --start-period=5s CMD ["/alios-idle", "healthcheck"] -ENTRYPOINT ["/alios-idle"] +HEALTHCHECK --interval=30s --timeout=3s --start-period=5s CMD ["/ingot-idle", "healthcheck"] +ENTRYPOINT ["/ingot-idle"] diff --git a/README.md b/README.md index 80bf11d..cce2510 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,10 @@ -# Alios CLI +# Ingot -Alios CLI (`alios`) is a single-binary local development environment manager -for PHP projects. It's the local-dev companion to -[Alios](https://alios.app), the cloud infrastructure and -application management platform — local environments are built to mirror -production as closely as possible: the same Caddy reverse proxy, the same -prebuilt-vs-custom-Dockerfile image model, the same config-injection pattern. +Ingot (`ingot`) is a single-binary local development environment manager +for PHP projects. Every project gets its own production-like container +(FrankenPHP behind a shared Caddy reverse proxy) with real, locally-trusted +HTTPS on a `*.test` domain, and projects nobody is using sleep until the +next visit. No server component, no config files. Every command shells out to Docker on your machine; all state lives in environment variables or Docker container @@ -37,18 +36,18 @@ saves that silently as if it succeeded unless you pass `-f`). Use the authentication for you - e.g. for Linux/amd64: ```bash -gh release download --repo aliasproject/alios-cli -p alios-linux-amd64 -O alios -chmod +x alios -./alios +gh release download --repo aliasproject/ingot -p ingot-linux-amd64 -O ingot +chmod +x ingot +./ingot ``` -Other platforms: swap `alios-linux-amd64` for `alios-linux-arm64`, -`alios-darwin-amd64`, `alios-darwin-arm64`, or `alios-windows-amd64.exe`. +Other platforms: swap `ingot-linux-amd64` for `ingot-linux-arm64`, +`ingot-darwin-amd64`, `ingot-darwin-arm64`, or `ingot-windows-amd64.exe`. -On first run, `alios` installs itself to `/usr/local/bin/alios` and walks +On first run, `ingot` installs itself to `/usr/local/bin/ingot` and walks you through database configuration and GitHub authentication (needed to pull private images from GHCR). If it's interrupted partway through, just run -`alios install` again — every step is safe to repeat, so it picks up from +`ingot install` again — every step is safe to repeat, so it picks up from wherever it left off rather than starting over. ### Requirements @@ -61,13 +60,13 @@ wherever it left off rather than starting over. ```bash cd /path/to/your/project -alios start +ingot start ``` -On the first `alios start` for a project you'll be asked: +On the first `ingot start` for a project you'll be asked: 1. **How to build the image** — only if a `Dockerfile` is found in the - project root: use it, use the prebuilt Alios image, or pull a different + project root: use it, use the prebuilt Ingot image, or pull a different image entirely. No Dockerfile → straight to prebuilt. 2. **PHP version** — only for the prebuilt path; a custom Dockerfile or pulled image brings its own PHP version. @@ -81,34 +80,34 @@ container labels. Your project is then available at `https://.test`. ### Project lifecycle ``` -alios start [version] Start (or create) the project container -alios stop Stop the project container -alios restart Restart the project container -alios remove / rm Remove the project container -alios status Show detailed status for this project -alios list / ls List every project +ingot start [version] Start (or create) the project container +ingot stop Stop the project container +ingot restart Restart the project container +ingot remove / rm Remove the project container +ingot status Show detailed status for this project +ingot list / ls List every project ``` ### Changing configuration ``` -alios php [version] Change PHP version (prebuilt projects only) -alios server-root [path] Change the server root directory -alios image [mode] Switch image mode without recreating from scratch +ingot php [version] Change PHP version (prebuilt projects only) +ingot server-root [path] Change the server root directory +ingot image [mode] Switch image mode without recreating from scratch ``` -`alios image` takes `prebuilt`, `dockerfile`, or `pull` (with a second arg +`ingot image` takes `prebuilt`, `dockerfile`, or `pull` (with a second arg for the image to pull), or run it bare for an interactive prompt. Useful for -going back and forth while testing — e.g. `alios image dockerfile` to try -your production build, `alios image prebuilt` to switch back. +going back and forth while testing — e.g. `ingot image dockerfile` to try +your production build, `ingot image prebuilt` to switch back. ### Logs, exec, and shell ``` -alios logs -alios exec composer install -alios shell # shell as your host user -alios shell --user=root # shell as root +ingot logs +ingot exec composer install +ingot shell # shell as your host user +ingot shell --user=root # shell as root ``` ### Global services @@ -117,25 +116,25 @@ DNS, Caddy, MailHog, and any configured databases are shared across every project: ``` -alios global start -alios global stop -alios global restart -alios global status +ingot global start +ingot global stop +ingot global restart +ingot global status ``` ### Scale to zero -Projects nobody is using are stopped after 30 minutes (`ALIOS_IDLE_TIMEOUT`), +Projects nobody is using are stopped after 30 minutes (`INGOT_IDLE_TIMEOUT`), and the next request to one starts it again. The first page load takes a second or two longer. `exec`, `shell` and `share` start a sleeping project -too. A project stopped with `alios stop` stays down until `alios start`. See +too. A project stopped with `ingot stop` stays down until `ingot start`. See [docs/IDLE.md](docs/IDLE.md) for how idle is detected. ``` -alios idle # show this project's setting -alios idle off # never stop it (e.g. it runs a queue worker) -alios idle 2h # its own timeout -alios idle on # back to ALIOS_IDLE_TIMEOUT +ingot idle # show this project's setting +ingot idle off # never stop it (e.g. it runs a queue worker) +ingot idle 2h # its own timeout +ingot idle on # back to INGOT_IDLE_TIMEOUT ``` ### Pause & resume @@ -144,44 +143,44 @@ Stop everything at once to free up CPU/RAM, then bring back exactly what was running: ``` -alios pause -alios resume +ingot pause +ingot resume ``` ### Databases ``` -alios database add -alios database remove -alios database list +ingot database add +ingot database remove +ingot database list ``` MySQL databases get an empty root password. PostgreSQL databases get user -`alios`, password `alios`, database `alios`. +`ingot`, password `ingot`, database `ingot`. ### SSL ``` -alios cert install # Install the CA into your system trust store -alios cert verify # Check whether it's installed -alios cert debug # Detailed certificate/Caddy diagnostics -alios cert repair # Regenerate vhosts and restart Caddy +ingot cert install # Install the CA into your system trust store +ingot cert verify # Check whether it's installed +ingot cert debug # Detailed certificate/Caddy diagnostics +ingot cert repair # Regenerate vhosts and restart Caddy ``` ### Everything else ``` -alios status Full system status (services, network, install) -alios github-auth (Re-)authenticate with GitHub -alios update Update to the latest version -alios check-update Check for an available update -alios uninstall Uninstall Alios CLI -alios help Show all commands +ingot status Full system status (services, network, install) +ingot github-auth (Re-)authenticate with GitHub +ingot update Update to the latest version +ingot check-update Check for an available update +ingot uninstall Uninstall Ingot +ingot help Show all commands ``` ## Image selection -`alios` mirrors production's own model for how a project's container image +`ingot` mirrors production's own model for how a project's container image is built: - **Prebuilt** (default) — `ghcr.io/aliasproject/php:-frankenphp-dev`, @@ -193,7 +192,7 @@ is built: nothing is silently reused from your GitHub auth or anything else. - **Custom pull** — pulls a specific image you name. -Switch between them any time with `alios image ` — no need to remove +Switch between them any time with `ingot image ` — no need to remove and recreate the project. ## Env vars @@ -203,9 +202,9 @@ production supplies a site's config as plain environment variables — set them explicitly: ``` -alios env set APP_DEBUG=true DB_HOST=alios_mysql -alios env unset APP_DEBUG -alios env list +ingot env set APP_DEBUG=true DB_HOST=ingot_mysql +ingot env unset APP_DEBUG +ingot env list ``` Values live in the container's labels, not in a file, and `set`/`unset` @@ -213,29 +212,29 @@ recreate the container so the change takes effect immediately (Docker has no way to update a running container's environment in place, and neither does production). A stopped project stays stopped. -Alios CLI deliberately does **not** read your project's `.env`. The project +Ingot deliberately does **not** read your project's `.env`. The project directory is bind-mounted, so a framework that reads `.env` itself (Laravel, for example) already sees every edit instantly with no restart. Injecting those same keys as real env vars would only shadow the file with a stale copy. -`SERVER_NAME`, `SERVER_ROOT`, `HTTPS`, and `PORT` are reserved for Alios CLI -itself and can't be set with `alios env set`. +`SERVER_NAME`, `SERVER_ROOT`, `HTTPS`, and `PORT` are reserved for Ingot +itself and can't be set with `ingot env set`. ## Environment variables -Alios CLI has no config file — these are the only settings, read from your +Ingot has no config file — these are the only settings, read from your shell environment: ``` GITHUB_TOKEN GitHub token for pulling private images -ALIOS_DEFAULT_PHP_VERSION Default PHP version for new projects -ALIOS_HOST_IP Override auto-detected host IP -ALIOS_DNS_PORT DNS listener port (default: 53) -ALIOS_ENABLE_SSL Enable/disable SSL setup (default: true) -ALIOS_ENABLE_DNS Enable/disable DNS setup (default: true) -ALIOS_AUTO_START_GLOBAL Auto-start global services (default: true) -ALIOS_IDLE_TIMEOUT Stop projects idle this long, e.g. 30m, 2h, or +INGOT_DEFAULT_PHP_VERSION Default PHP version for new projects +INGOT_HOST_IP Override auto-detected host IP +INGOT_DNS_PORT DNS listener port (default: 53) +INGOT_ENABLE_SSL Enable/disable SSL setup (default: true) +INGOT_ENABLE_DNS Enable/disable DNS setup (default: true) +INGOT_AUTO_START_GLOBAL Auto-start global services (default: true) +INGOT_IDLE_TIMEOUT Stop projects idle this long, e.g. 30m, 2h, or off (default: 30m; applied by 'global restart', kept when unset) ``` @@ -249,9 +248,9 @@ ALIOS_IDLE_TIMEOUT Stop projects idle this long, e.g. 30m, 2h, or ## Building from source ```bash -git clone git@github.com:aliasproject/alios-cli.git -cd alios-cli -go build -o alios ./cmd # build the binary +git clone git@github.com:aliasproject/ingot.git +cd ingot +go build -o ingot ./cmd # build the binary go run ./cmd status # or run directly without building go vet ./... # static checks ``` @@ -264,12 +263,12 @@ on the CLI itself. **`Error: Docker is not installed or not running`** — start Docker first. -**SSL warnings in the browser** — `alios cert verify`, then `alios cert +**SSL warnings in the browser** — `ingot cert verify`, then `ingot cert repair` if the CA isn't installed. -**`alios install` seems stuck partway through** — just run it again; every +**`ingot install` seems stuck partway through** — just run it again; every step is safe to repeat and picks up from where it stopped. -**Container pull denied** — re-authenticate with `alios github-auth`, or if +**Container pull denied** — re-authenticate with `ingot github-auth`, or if you're on a fresh `gh` CLI login, make sure it has `read:packages` scope (`gh auth refresh -h github.com -s read:packages`). diff --git a/cmd/alios-idle/main.go b/cmd/ingot-idle/main.go similarity index 81% rename from cmd/alios-idle/main.go rename to cmd/ingot-idle/main.go index b589f67..9d7afb9 100644 --- a/cmd/alios-idle/main.go +++ b/cmd/ingot-idle/main.go @@ -1,4 +1,4 @@ -// Command alios-idle is the alios_idle global service: it stops project +// Command ingot-idle is the ingot_idle global service: it stops project // containers that have gone idle and wakes them on the next request. It runs // in its own container (see Dockerfile.idle); the CLI starts it with the other // global services and configures it through environment variables. @@ -13,12 +13,12 @@ import ( "syscall" "time" - "github.com/aliasproject/alios-cli/internal/idle" + "github.com/aliasproject/ingot/internal/idle" ) func main() { logger := log.New(os.Stdout, "", log.LstdFlags) - listen := envOr("ALIOS_IDLE_LISTEN", ":8080") + listen := envOr("INGOT_IDLE_LISTEN", ":8080") // The image has no shell or wget for a Docker healthcheck, so the binary // checks itself. @@ -30,8 +30,8 @@ func main() { return } - timeout := duration(logger, "ALIOS_IDLE_TIMEOUT", idle.DefaultTimeout) - engine := idle.NewSocketEngine(envOr("ALIOS_IDLE_DOCKER_SOCKET", "/var/run/docker.sock")) + timeout := duration(logger, "INGOT_IDLE_TIMEOUT", idle.DefaultTimeout) + engine := idle.NewSocketEngine(envOr("INGOT_IDLE_DOCKER_SOCKET", "/var/run/docker.sock")) ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGTERM, os.Interrupt) defer stop() @@ -39,9 +39,9 @@ func main() { watcher := &idle.Watcher{ Engine: engine, Tracker: idle.NewTracker(idle.DefaultThresholds), - Interval: duration(logger, "ALIOS_IDLE_INTERVAL", 30*time.Second), + Interval: duration(logger, "INGOT_IDLE_INTERVAL", 30*time.Second), Timeout: timeout, - BusyWarnAfter: duration(logger, "ALIOS_IDLE_BUSY_WARN", 2*time.Hour), + BusyWarnAfter: duration(logger, "INGOT_IDLE_BUSY_WARN", 2*time.Hour), Log: logger, } if watcher.Interval <= 0 { @@ -53,7 +53,7 @@ func main() { Addr: listen, Handler: &idle.Waker{ Engine: engine, - WakeTimeout: duration(logger, "ALIOS_IDLE_WAKE_TIMEOUT", 60*time.Second), + WakeTimeout: duration(logger, "INGOT_IDLE_WAKE_TIMEOUT", 60*time.Second), Log: logger, }, ReadHeaderTimeout: 10 * time.Second, diff --git a/cmd/main.go b/cmd/main.go index c5b01a3..11d1f18 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -4,10 +4,10 @@ import ( "fmt" "os" - "github.com/aliasproject/alios-cli/internal/commands" - "github.com/aliasproject/alios-cli/internal/config" - "github.com/aliasproject/alios-cli/internal/docker" - "github.com/aliasproject/alios-cli/internal/utils" + "github.com/aliasproject/ingot/internal/commands" + "github.com/aliasproject/ingot/internal/config" + "github.com/aliasproject/ingot/internal/docker" + "github.com/aliasproject/ingot/internal/utils" ) func main() { @@ -48,15 +48,15 @@ func main() { // Check for first-time installation if !cfg.IsInstalled() { - fmt.Println(utils.Colorize("[ALIOS]", utils.ColorCyan) + " Welcome to Alios! Installing for first-time use...") + fmt.Println(utils.Colorize("[INGOT]", utils.ColorCyan) + " Welcome to Ingot! Installing for first-time use...") installer := commands.NewInstaller(dockerClient, cfg, handler.GetServices(), handler.GetSSL(), handler.GetGitHub()) if err := installer.Install(); err != nil { fmt.Fprintf(os.Stderr, "Error during installation: %v\n", err) - fmt.Fprintln(os.Stderr, "Run 'alios install' to retry - it resumes from wherever this left off.") + fmt.Fprintln(os.Stderr, "Run 'ingot install' to retry - it resumes from wherever this left off.") os.Exit(1) } - fmt.Println("\n" + utils.Colorize("[SUCCESS]", utils.ColorGreen) + " Installation complete! You can now use Alios.") - fmt.Println("\nRun 'alios help' to see available commands.") + fmt.Println("\n" + utils.Colorize("[SUCCESS]", utils.ColorGreen) + " Installation complete! You can now use Ingot.") + fmt.Println("\nRun 'ingot help' to see available commands.") return } diff --git a/docs/IDLE.md b/docs/IDLE.md index df36474..c3d7a63 100644 --- a/docs/IDLE.md +++ b/docs/IDLE.md @@ -5,23 +5,23 @@ it again. Only the projects you're actually working on use CPU and memory, so you can keep many sites set up without running them all. ``` -alios idle # show this project's setting -alios idle off # never stop it -alios idle 2h # stop it after 2h idle instead of the default -alios idle on # back to the default (ALIOS_IDLE_TIMEOUT) +ingot idle # show this project's setting +ingot idle off # never stop it +ingot idle 2h # stop it after 2h idle instead of the default +ingot idle on # back to the default (INGOT_IDLE_TIMEOUT) ``` -The default is 30 minutes. To change it, set `ALIOS_IDLE_TIMEOUT` (for -example `1h`, or `off`) and run `alios global restart`. The service keeps that +The default is 30 minutes. To change it, set `INGOT_IDLE_TIMEOUT` (for +example `1h`, or `off`) and run `ingot global restart`. The service keeps that value until a later global start runs with the variable set to something -else, so a terminal without it never resets the timeout. `alios status`, -`alios idle` and `alios doctor` report the value the service is actually -running with. `alios idle` stores a project's own setting in a container -label, the same way `alios env` does, so changing it recreates the container. +else, so a terminal without it never resets the timeout. `ingot status`, +`ingot idle` and `ingot doctor` report the value the service is actually +running with. `ingot idle` stores a project's own setting in a container +label, the same way `ingot env` does, so changing it recreates the container. ## How it works -A global service, `alios_idle`, runs next to Caddy and does two jobs. +A global service, `ingot_idle`, runs next to Caddy and does two jobs. **Stopping.** Every 30 seconds it reads each running project's counters from the Docker API and treats the project as active if any of these is true: @@ -32,7 +32,7 @@ the Docker API and treats the project as active if any of these is true: 0.1%. - **Exec sessions:** any process that was exec'd into the container rather than started by its server, seen in two samples in a row. That covers - `alios exec` and `alios shell` for as long as they're open, including an + `ingot exec` and `ingot shell` for as long as they're open, including an idle shell, which uses no CPU or traffic. A health check that happens to be running when a sample is taken doesn't count. Processes the server itself starts, such as its workers or a supervisor's queue workers, aren't exec @@ -42,9 +42,9 @@ A project that stays quiet on all three for the timeout is stopped. Docker remembers that it was stopped, so it stays stopped after a reboot, and only the projects you were using come back. -**Waking.** A project's vhost ends with `import alios_wake `. When the +**Waking.** A project's vhost ends with `import ingot_wake `. When the container is stopped, Caddy can't reach it, and the request goes to -`alios_idle` instead. It starts the container, waits until it accepts +`ingot_idle` instead. It starts the container, waits until it accepts connections (usually under a second), then replies with a `307` redirect to the same URL so the browser tries again. With a `307` the browser resends the original method and body, so a form POST or an API call is resubmitted, not @@ -52,42 +52,42 @@ turned into a GET. The waker itself only ever sees a bodiless GET. Only Caddy's own upstream failures (502, 503, 504) go to the waker, so an app's error pages and a share's basic-auth prompt pass through untouched. -`alios_idle` is optional. It runs outside the compose group, so if its image -can't be pulled, `alios global start` warns and carries on. DNS, Caddy and +`ingot_idle` is optional. It runs outside the compose group, so if its image +can't be pulled, `ingot global start` warns and carries on. DNS, Caddy and your projects still work, and nothing is stopped or woken. A stopped project -then shows Caddy's empty 502 until `alios_idle` is running again, and -`alios doctor` reports it. `alios pause` stops it before the projects, so a +then shows Caddy's empty 502 until `ingot_idle` is running again, and +`ingot doctor` reports it. `ingot pause` stops it before the projects, so a request arriving mid-pause can't start one again. -`alios exec`, `alios shell` and `alios share` start a sleeping project -themselves. `alios list` and `alios status` show such a project as +`ingot exec`, `ingot shell` and `ingot share` start a sleeping project +themselves. `ingot list` and `ingot status` show such a project as "sleeping". ## Sleeping vs stopped A project the watcher stopped for being idle is **sleeping**: the next visit -starts it. A project you stop with `alios stop` is **stopped**: it stays down -until `alios start`. A visit gets a short "stopped" page instead, and `exec`, +starts it. A project you stop with `ingot stop` is **stopped**: it stays down +until `ingot start`. A visit gets a short "stopped" page instead, and `exec`, `shell` and `share` ask you to start it first. That way, a browser tab that keeps polling the project can't undo the stop. -The difference is recorded in the project's vhost: `alios stop` swaps its -`import alios_wake ` line for `import alios_stopped `, and -`alios start` swaps it back, and so do the other commands that start the -container (`restart`, `rebuild`, `php`, `image`). `alios pause`/`resume`, -`alios cert repair` and `alios cert remove` keep it. +The difference is recorded in the project's vhost: `ingot stop` swaps its +`import ingot_wake ` line for `import ingot_stopped `, and +`ingot start` swaps it back, and so do the other commands that start the +container (`restart`, `rebuild`, `php`, `image`). `ingot pause`/`resume`, +`ingot cert repair` and `ingot cert remove` keep it. ## Busy without traffic A project that keeps using CPU for 2 hours with no traffic at all is either -running a long job or stuck. (An open but idle `alios shell` keeps a project -awake without counting as busy.) `alios_idle` keeps it running -either way, and logs a `busy-warning` line, which `alios doctor` shows. Check -it with `alios logs` or `docker top alios_php_`. +running a long job or stuck. (An open but idle `ingot shell` keeps a project +awake without counting as busy.) `ingot_idle` keeps it running +either way, and logs a `busy-warning` line, which `ingot doctor` shows. Check +it with `ingot logs` or `docker top ingot_php_`. ## When to turn it off -Use `alios idle off` for a project that has to keep running with no requests: +Use `ingot idle off` for a project that has to keep running with no requests: one with a queue worker or scheduler running inside its container, for example. A worker the container's server starts isn't an exec session, so only its CPU and traffic count, and its polling may be too light to register, @@ -95,21 +95,21 @@ so the project can be stopped while the worker waits for jobs. ## Upgrading -Vhosts written by an older alios don't have the `import alios_wake` line, so +Vhosts written by an older ingot don't have the `import ingot_wake` line, so visiting one of those projects while it's stopped shows Caddy's error instead -of starting it. Each vhost is rewritten on that project's next `alios start`, -or run `alios cert repair` to update them all; it writes the base Caddyfile -with the snippet first. `alios global start` and `alios doctor` point out any +of starting it. Each vhost is rewritten on that project's next `ingot start`, +or run `ingot cert repair` to update them all; it writes the base Caddyfile +with the snippet first. `ingot global start` and `ingot doctor` point out any that are left. A shared project's share vhost picks up the snippet the next time it's shared. ## Security -`alios_idle` mounts the Docker socket so that it can read stats and start and +`ingot_idle` mounts the Docker socket so that it can read stats and start and stop containers. Mounting the socket gives a container root-equivalent access to the host. The service only ever starts a container named -`alios_php_` that carries the matching `alios.project.name` label. -Its waker listens only on the internal `alios_internal` network, with no port +`ingot_php_` that carries the matching `ingot.project.name` label. +Its waker listens only on the internal `ingot_internal` network, with no port published to the host. Rootless Docker isn't supported yet: the socket path is fixed at `/var/run/docker.sock`, which Docker Desktop also provides on macOS and Windows. diff --git a/docs/SHARING.md b/docs/SHARING.md index fd1c54b..4558889 100644 --- a/docs/SHARING.md +++ b/docs/SHARING.md @@ -1,15 +1,15 @@ -# Sharing local sites (`alios share`) +# Sharing local sites (`ingot share`) -`alios share` gives the current project a public HTTPS URL through a Cloudflare Tunnel, so clients, teammates and your own phone can reach it without touching DNS, certificates or your router. +`ingot share` gives the current project a public HTTPS URL through a Cloudflare Tunnel, so clients, teammates and your own phone can reach it without touching DNS, certificates or your router. ```bash -alios share # public URL for the current project -alios share --auth demo:secret # same, behind HTTP basic auth -alios share list # every active share -alios share stop # stop sharing the current project +ingot share # public URL for the current project +ingot share --auth demo:secret # same, behind HTTP basic auth +ingot share list # every active share +ingot share stop # stop sharing the current project ``` -A share is also ended automatically by `alios stop`, `alios remove`, `alios pause`, `alios global stop` and `alios uninstall`. Shares are not restored by `alios resume`. `alios restart` and `alios global restart` keep the share and its URL. +A share is also ended automatically by `ingot stop`, `ingot remove`, `ingot pause`, `ingot global stop` and `ingot uninstall`. Shares are not restored by `ingot resume`. `ingot restart` and `ingot global restart` keep the share and its URL. > **Anyone with the URL can reach your dev site**, including debug pages and error dumps. Use `--auth` for anything that isn't throwaway. @@ -17,48 +17,48 @@ A share is also ended automatically by `alios stop`, `alios remove`, `alios paus ``` browser ──https──▶ Cloudflare edge ──tunnel──▶ cloudflared container - ──http──▶ alios-reverse-proxy (Caddy) ──▶ alios_php_:80 + ──http──▶ ingot_proxy (Caddy) ──▶ ingot_php_:80 ``` -- `cloudflared` runs in a container on the `alios_internal` network and forwards traffic to Caddy. -- Each share is a single vhost file, `.share.caddyfile`, in the `alios_vhosts` volume. It matches the public hostname exactly. +- `cloudflared` runs in a container on the `ingot_internal` network and forwards traffic to Caddy. +- Each share is a single vhost file, `.share.caddyfile`, in the `ingot_vhosts` volume. It matches the public hostname exactly. - That file is the only record of a share. `status`, `list`, `stop` and `doctor` all read it back. - The app receives the public host in `Host` / `X-Forwarded-Host`, plus `X-Forwarded-Proto: https`. - The visitor's IP arrives in `X-Real-IP` / `X-Forwarded-For`, taken from Cloudflare's `Cf-Connecting-Ip` header. -- Every shared request also carries `X-Alios-Share: 1`. Caddy sets it itself, so visitors can't forge or strip it. An image or app can check it to tell shared requests apart from local ones. +- Every shared request also carries `X-Ingot-Share: 1`. Caddy sets it itself, so visitors can't forge or strip it. An image or app can check it to tell shared requests apart from local ones. ## Quick tunnels (default) -No account or setup is needed. Each share runs its own `alios_share_` container and gets a random `https://.trycloudflare.com` URL. +No account or setup is needed. Each share runs its own `ingot_share_` container and gets a random `https://.trycloudflare.com` URL. - The URL changes every time you share. - Cloudflare offers quick tunnels with no uptime guarantee. - Quick tunnels allow about 200 concurrent requests and don't support Server-Sent Events. -If the tunnel container dies (for example after a reboot), the share is shown as `[STALE]` in `alios status` and `alios doctor`. Run `alios share stop`, then `alios share` again. +If the tunnel container dies (for example after a reboot), the share is shown as `[STALE]` in `ingot status` and `ingot doctor`. Run `ingot share stop`, then `ingot share` again. ## Named tunnels (stable URLs) Set both of these to give every project a stable `https://.` URL: ```bash -export ALIOS_SHARE_TUNNEL_TOKEN=eyJh... # tunnel token from the Cloudflare dashboard -export ALIOS_SHARE_DOMAIN=acme-dev.com +export INGOT_SHARE_TUNNEL_TOKEN=eyJh... # tunnel token from the Cloudflare dashboard +export INGOT_SHARE_DOMAIN=acme-dev.com ``` **One-time setup in the Cloudflare dashboard** (Zero Trust → Networks → Tunnels): 1. Create a tunnel (cloudflared connector) and copy its token. -2. Add a **public hostname** `*.acme-dev.com` with service `HTTP` → `alios-reverse-proxy:80`. +2. Add a **public hostname** `*.acme-dev.com` with service `HTTP` → `ingot_proxy:80`. 3. Make sure a proxied wildcard DNS record `*` → `.cfargotunnel.com` exists in the zone. The dashboard normally creates it. How it runs: -- All named shares share one `alios_share` container. +- All named shares share one `ingot_share` container. - That container is removed when the last named share stops. Leaving it running would bounce hosts that aren't shared through Caddy's http→https redirect in a loop. - Project names are turned into a single DNS label, e.g. `michaelaguiar.dev` → `michaelaguiar-dev.acme-dev.com`. -**Use a zone apex for `ALIOS_SHARE_DOMAIN`**, ideally a dedicated domain: +**Use a zone apex for `INGOT_SHARE_DOMAIN`**, ideally a dedicated domain: - Cloudflare's free Universal SSL certificate only covers first-level wildcards (`*.acme-dev.com`). - So `share.acme.com` would need a paid Advanced Certificate for `*.share.acme.com`. diff --git a/docs/UPDATES.md b/docs/UPDATES.md index b493f90..cb2db05 100644 --- a/docs/UPDATES.md +++ b/docs/UPDATES.md @@ -1,6 +1,6 @@ -# Alios CLI Update System +# Ingot Update System -A minimal, efficient auto-update system for distributing Alios CLI binaries. +A minimal, efficient auto-update system for distributing Ingot binaries. ## Overview @@ -16,17 +16,17 @@ The update system uses a simple architecture: #### Option A: AWS S3 (Most Common) ```bash # Create bucket -aws s3 mb s3://alios-cli-updates +aws s3 mb s3://ingot-updates # Make bucket public (for free downloads) -aws s3api put-bucket-policy --bucket alios-cli-updates --policy '{ +aws s3api put-bucket-policy --bucket ingot-updates --policy '{ "Version": "2012-10-17", "Statement": [{ "Sid": "PublicRead", "Effect": "Allow", "Principal": "*", "Action": "s3:GetObject", - "Resource": "arn:aws:s3:::alios-cli-updates/*" + "Resource": "arn:aws:s3:::ingot-updates/*" }] }' ``` @@ -37,19 +37,19 @@ aws s3api put-bucket-policy --bucket alios-cli-updates --policy '{ npm install -g wrangler # Create bucket -wrangler r2 bucket create alios-cli-updates +wrangler r2 bucket create ingot-updates # Enable public access via R2.dev subdomain -wrangler r2 bucket update alios-cli-updates --public +wrangler r2 bucket update ingot-updates --public ``` #### Option C: Google Cloud Storage ```bash # Create bucket -gsutil mb gs://alios-cli-updates +gsutil mb gs://ingot-updates # Make public -gsutil iam ch allUsers:objectViewer gs://alios-cli-updates +gsutil iam ch allUsers:objectViewer gs://ingot-updates ``` ### 2. Build and Release @@ -71,13 +71,13 @@ Set the manifest URL in your environment: ```bash # AWS S3 -export ALIOS_UPDATE_URL="https://alios-cli-updates.s3.amazonaws.com/stable/manifest.json" +export INGOT_UPDATE_URL="https://ingot-updates.s3.amazonaws.com/stable/manifest.json" # Cloudflare R2 -export ALIOS_UPDATE_URL="https://your-account.r2.dev/stable/manifest.json" +export INGOT_UPDATE_URL="https://your-account.r2.dev/stable/manifest.json" # Custom domain -export ALIOS_UPDATE_URL="https://updates.yourdomain.com/stable/manifest.json" +export INGOT_UPDATE_URL="https://updates.yourdomain.com/stable/manifest.json" ``` ## Manifest Structure @@ -92,17 +92,17 @@ The `manifest.json` file contains all update information: "critical": false, "downloads": { "darwin_amd64": { - "url": "https://bucket.s3.amazonaws.com/stable/1.0.0/alios-darwin-amd64", + "url": "https://bucket.s3.amazonaws.com/stable/1.0.0/ingot-darwin-amd64", "sha256": "abc123...", "size": 15728640 }, "darwin_arm64": { - "url": "https://bucket.s3.amazonaws.com/stable/1.0.0/alios-darwin-arm64", + "url": "https://bucket.s3.amazonaws.com/stable/1.0.0/ingot-darwin-arm64", "sha256": "def456...", "size": 15728640 }, "linux_amd64": { - "url": "https://bucket.s3.amazonaws.com/stable/1.0.0/alios-linux-amd64", + "url": "https://bucket.s3.amazonaws.com/stable/1.0.0/ingot-linux-amd64", "sha256": "ghi789...", "size": 15728640 } @@ -116,10 +116,10 @@ Users can update with a simple command: ```bash # Check for updates and install if available -alios update +ingot update # Force reinstall current version -alios update --force +ingot update --force ``` ## Security Features @@ -153,10 +153,10 @@ cd build python3 -m http.server 8080 # In another terminal, set update URL -export ALIOS_UPDATE_URL="http://localhost:8080/manifest.json" +export INGOT_UPDATE_URL="http://localhost:8080/manifest.json" # Test update -alios update +ingot update ``` ## Monitoring diff --git a/go.mod b/go.mod index c7a7128..adff2e0 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ -module github.com/aliasproject/alios-cli +module github.com/aliasproject/ingot go 1.23.1 diff --git a/internal/commands/doctor.go b/internal/commands/doctor.go index 43a59b1..096e548 100644 --- a/internal/commands/doctor.go +++ b/internal/commands/doctor.go @@ -13,15 +13,15 @@ import ( "strings" "time" - "github.com/aliasproject/alios-cli/internal/config" - "github.com/aliasproject/alios-cli/internal/github" - "github.com/aliasproject/alios-cli/internal/project" - "github.com/aliasproject/alios-cli/internal/services" - "github.com/aliasproject/alios-cli/internal/utils" + "github.com/aliasproject/ingot/internal/config" + "github.com/aliasproject/ingot/internal/github" + "github.com/aliasproject/ingot/internal/project" + "github.com/aliasproject/ingot/internal/services" + "github.com/aliasproject/ingot/internal/utils" ) // doctorProbeImage is the image used to test registry read access. It's the -// smallest image alios always needs, so if this can't be read nothing else +// smallest image ingot always needs, so if this can't be read nothing else // from ghcr.io/aliasproject can either. const doctorProbeImage = "ghcr.io/aliasproject/dns:latest" @@ -70,7 +70,7 @@ func (r *doctorReport) summary() error { return fmt.Errorf("%d check(s) failed", r.failed) } if r.warned > 0 { - fmt.Println(utils.Colorize("[INFO]", utils.ColorBlue) + " Warnings won't stop alios from working but may explain odd behaviour") + fmt.Println(utils.Colorize("[INFO]", utils.ColorBlue) + " Warnings won't stop ingot from working but may explain odd behaviour") } else { fmt.Println(utils.Colorize("[SUCCESS]", utils.ColorGreen) + " Everything looks healthy") } @@ -78,7 +78,7 @@ func (r *doctorReport) summary() error { } func doctorHeader() { - fmt.Printf("Alios v%s - Doctor\n", config.Version) + fmt.Printf("Ingot v%s - Doctor\n", config.Version) fmt.Println(strings.Repeat("=", 50)) } @@ -108,7 +108,7 @@ func dockerFix() string { } } -// handleDoctor runs every environment check alios depends on and prints a +// handleDoctor runs every environment check ingot depends on and prints a // pass/warn/fail line for each, with a fix for anything that isn't OK. // It's read-only: nothing is started, pulled, or changed. func (h *Handler) handleDoctor() error { @@ -150,22 +150,22 @@ func (h *Handler) doctorInstall(r *doctorReport) { r.section("INSTALL") if h.config.IsInstalled() { - r.ok("Binary installed at %s", config.AliosBinary) + r.ok("Binary installed at %s", config.IngotBinary) } else { - r.fail(fmt.Sprintf("Binary not installed at %s", config.AliosBinary), "alios install") + r.fail(fmt.Sprintf("Binary not installed at %s", config.IngotBinary), "ingot install") } if exe, err := os.Executable(); err == nil { if resolved, err := filepath.EvalSymlinks(exe); err == nil { exe = resolved } - if exe != config.AliosBinary { + if exe != config.IngotBinary { r.info("Running %s rather than the installed binary", exe) } } - if _, err := exec.LookPath("alios"); err != nil { - r.warn("'alios' is not on your PATH", fmt.Sprintf("add %s to PATH", filepath.Dir(config.AliosBinary))) + if _, err := exec.LookPath("ingot"); err != nil { + r.warn("'ingot' is not on your PATH", fmt.Sprintf("add %s to PATH", filepath.Dir(config.IngotBinary))) } } @@ -178,13 +178,13 @@ func (h *Handler) doctorGitHub(r *doctorReport) bool { token, source := h.github.FindToken() if token == "" { r.fail("No GitHub token found (checked GITHUB_TOKEN and 'gh auth token')", - "alios github-auth, or export GITHUB_TOKEN=") + "ingot github-auth, or export GITHUB_TOKEN=") return false } r.ok("Token found via %s", source) if err := h.github.ValidateToken(token); err != nil { - r.fail(fmt.Sprintf("Token rejected by GitHub: %v", err), "alios github-auth (or 'gh auth login' again)") + r.fail(fmt.Sprintf("Token rejected by GitHub: %v", err), "ingot github-auth (or 'gh auth login' again)") return false } r.ok("Token valid for GitHub user %s", h.github.Username(token)) @@ -207,13 +207,13 @@ func (h *Handler) doctorGitHub(r *doctorReport) bool { if dockerLoggedIntoGHCR() { r.ok("Docker has stored credentials for ghcr.io") } else { - r.fail("Docker is not logged into ghcr.io", "alios github-auth (runs 'docker login ghcr.io' with your token)") + r.fail("Docker is not logged into ghcr.io", "ingot github-auth (runs 'docker login ghcr.io' with your token)") } if err := h.docker.CheckRegistryAccess(doctorProbeImage); err != nil { - fix := "alios github-auth" + fix := "ingot github-auth" if !scopeOK { - fix = "grant read:packages (see above), then alios github-auth to re-login docker" + fix = "grant read:packages (see above), then ingot github-auth to re-login docker" } else if strings.Contains(strings.ToLower(err.Error()), "denied") { fix = "the token's owner may need access to the aliasproject packages, or SSO authorization for the org" } @@ -250,7 +250,7 @@ func (h *Handler) doctorNetwork(r *doctorReport) { if h.docker.NetworkExists(bridge) { r.ok("Docker network %s exists", bridge) } else { - r.fail(fmt.Sprintf("Docker network %s missing", bridge), "alios global start (recreates it)") + r.fail(fmt.Sprintf("Docker network %s missing", bridge), "ingot global start (recreates it)") } if hostIP, err := services.GetHostIP(); err == nil { @@ -260,29 +260,29 @@ func (h *Handler) doctorNetwork(r *doctorReport) { } if configured, detail := utils.TestDomainResolverStatus(); configured { - r.ok("Host resolver routes .test to alios_dns (%s)", detail) + r.ok("Host resolver routes .test to ingot_dns (%s)", detail) } else { - r.fail("Host resolver not configured for .test ("+detail+")", "alios dns-setup") + r.fail("Host resolver not configured for .test ("+detail+")", "ingot dns-setup") } - probe := "alios-doctor-probe.test" + probe := "ingot-doctor-probe.test" if addrs, err := lookupVia(probe, "127.0.0.1:5354"); err == nil && len(addrs) > 0 { - r.ok("alios_dns answers for .test on 127.0.0.1:5354 (%s -> %s)", probe, addrs[0]) + r.ok("ingot_dns answers for .test on 127.0.0.1:5354 (%s -> %s)", probe, addrs[0]) } else { - r.fail("alios_dns is not answering on 127.0.0.1:5354", "alios global restart") + r.fail("ingot_dns is not answering on 127.0.0.1:5354", "ingot global restart") } if addrs, err := lookupVia(probe, ""); err == nil && len(addrs) > 0 { r.ok("System resolver resolves .test (%s -> %s)", probe, addrs[0]) } else { r.fail("System resolver does not resolve .test domains (browsers won't reach https://.test)", - "alios dns-setup, then restart the resolver (systemd-resolved/dnsmasq)") + "ingot dns-setup, then restart the resolver (systemd-resolved/dnsmasq)") } } // lookupVia resolves a name either through the system resolver (empty // server) or by sending the query straight to one nameserver, so the report -// can tell "alios_dns is down" apart from "the host isn't asking it". +// can tell "ingot_dns is down" apart from "the host isn't asking it". func lookupVia(name, server string) ([]string, error) { ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) defer cancel() @@ -305,7 +305,7 @@ func (h *Handler) doctorServices(r *doctorReport) { svcs, err := h.services.Status() if err != nil { - r.fail(fmt.Sprintf("Could not inspect global services: %v", err), "alios global start") + r.fail(fmt.Sprintf("Could not inspect global services: %v", err), "ingot global start") return } for _, svc := range svcs { @@ -316,14 +316,14 @@ func (h *Handler) doctorServices(r *doctorReport) { r.ok("%s running (%s)", svc.Name, svc.Container) continue } - r.fail(fmt.Sprintf("%s is %s (%s)", svc.Name, svc.Status, svc.Container), "alios global start") + r.fail(fmt.Sprintf("%s is %s (%s)", svc.Name, svc.Status, svc.Container), "ingot global start") } - for _, volume := range []string{"alios_certs", "alios_vhosts"} { + for _, volume := range []string{"ingot_certs", "ingot_vhosts"} { if h.docker.VolumeExists(volume) { r.ok("Volume %s exists", volume) } else { - r.fail(fmt.Sprintf("Volume %s missing", volume), "alios global start") + r.fail(fmt.Sprintf("Volume %s missing", volume), "ingot global start") } } } @@ -332,34 +332,34 @@ func (h *Handler) doctorSSL(r *doctorReport) { r.section("SSL") if h.ssl.CAExists() { - r.ok("CA certificate present in alios_certs") + r.ok("CA certificate present in ingot_certs") } else { - r.fail("CA certificate missing from alios_certs", "alios cert install (generates the CA first)") + r.fail("CA certificate missing from ingot_certs", "ingot cert install (generates the CA first)") return } if h.ssl.IsCertificateInstalled() { r.ok("CA trusted by the system certificate store") } else { - r.fail("CA not trusted by the system certificate store (browsers will warn on https://*.test)", "alios cert install") + r.fail("CA not trusted by the system certificate store (browsers will warn on https://*.test)", "ingot cert install") } if present, checkable, installed := h.ssl.ChromeNSSDBStatus(); present { switch { case !checkable: r.warn("Chrome's NSS database (~/.pki/nssdb) exists but certutil isn't installed, so its trust can't be checked or set", - "install the 'nss' package (provides certutil), then alios cert install") + "install the 'nss' package (provides certutil), then ingot cert install") case installed: r.ok("CA trusted in Chrome's NSS database (~/.pki/nssdb)") default: r.warn("CA missing from Chrome's NSS database (~/.pki/nssdb) - Chrome/Chromium ignore the system store on Linux", - "alios cert install, then fully quit and reopen Chrome") + "ingot cert install, then fully quit and reopen Chrome") } } } // doctorProject checks the project in the current directory. For an -// uninitialized one it pre-flights what `alios start` would do - which +// uninitialized one it pre-flights what `ingot start` would do - which // image it would use and whether that image is reachable - since that's // exactly the failure that's hardest to read from init's own output. func (h *Handler) doctorProject(r *doctorReport, registryOK bool) { @@ -380,15 +380,15 @@ func (h *Handler) doctorProject(r *doctorReport, registryOK bool) { r.ok("Detected framework: %s", proj.Framework) } image := h.projects.ImageReference(proj) - h.doctorImage(r, image, registryOK, "alios start would use") - r.info("Run 'alios start' to create it") + h.doctorImage(r, image, registryOK, "ingot start would use") + r.info("Run 'ingot start' to create it") return } if proj.Status == "running" { r.ok("Container %s running (PHP %s)", proj.Container, proj.PHPVersion) } else { - r.warn(fmt.Sprintf("Container %s is %s", proj.Container, proj.Status), "alios start") + r.warn(fmt.Sprintf("Container %s is %s", proj.Container, proj.Status), "ingot start") } image := h.projects.ImageReference(proj) @@ -396,7 +396,7 @@ func (h *Handler) doctorProject(r *doctorReport, registryOK bool) { if h.docker.ImageExists(image) { r.ok("Locally built image %s present", image) } else { - r.fail(fmt.Sprintf("Locally built image %s missing", image), "alios rebuild") + r.fail(fmt.Sprintf("Locally built image %s missing", image), "ingot rebuild") } } else { h.doctorImage(r, image, registryOK, "project uses") @@ -407,35 +407,35 @@ func (h *Handler) doctorProject(r *doctorReport, registryOK bool) { if utils.StringSliceContains(info.Networks, bridge) { r.ok("Container attached to %s", bridge) } else { - r.fail(fmt.Sprintf("Container not on %s (Caddy can't reach it)", bridge), "alios rebuild") + r.fail(fmt.Sprintf("Container not on %s (Caddy can't reach it)", bridge), "ingot rebuild") } } domain := proj.Name + ".test" - if vhost, err := h.docker.ReadFileFromVolume("alios_vhosts", proj.Name+".caddyfile"); err == nil { + if vhost, err := h.docker.ReadFileFromVolume("ingot_vhosts", proj.Name+".caddyfile"); err == nil { r.ok("Caddy vhost %s.caddyfile present", proj.Name) switch { - case strings.Contains(vhost, "import alios_stopped"): - r.info("Stopped with 'alios stop': visits won't start it until 'alios start'") - case !strings.Contains(vhost, "import alios_wake"): + case strings.Contains(vhost, "import ingot_stopped"): + r.info("Stopped with 'ingot stop': visits won't start it until 'ingot start'") + case !strings.Contains(vhost, "import ingot_wake"): r.warn("Vhost predates scale to zero, so visiting the project while it's asleep won't start it", - "alios cert repair") + "ingot cert repair") } } else { - r.fail("Caddy vhost missing (https://"+domain+" will hit the 'No project here' page)", "alios cert repair") + r.fail("Caddy vhost missing (https://"+domain+" will hit the 'No project here' page)", "ingot cert repair") } if h.ssl.CertificateExists(domain) { r.ok("Certificate for %s present", domain) } else { - r.fail("Certificate for "+domain+" missing", "alios cert repair") + r.fail("Certificate for "+domain+" missing", "ingot cert repair") } if proj.Status == "running" { if code, err := probeHTTPS(proj.URL); err != nil { - r.fail(fmt.Sprintf("%s unreachable: %v", proj.URL, err), "alios global restart, then alios restart") + r.fail(fmt.Sprintf("%s unreachable: %v", proj.URL, err), "ingot global restart, then ingot restart") } else if code >= 500 { - r.warn(fmt.Sprintf("%s responded %d (Caddy is up but the app errored)", proj.URL, code), "alios logs") + r.warn(fmt.Sprintf("%s responded %d (Caddy is up but the app errored)", proj.URL, code), "ingot logs") } else { r.ok("%s responded %d", proj.URL, code) } @@ -452,7 +452,7 @@ func (h *Handler) doctorImage(r *doctorReport, image string, registryOK bool, ve if !registryOK { if !local { r.fail(fmt.Sprintf("Image %s is not cached locally and registry access failed (%s)", image, verb), - "fix the GITHUB section above; alios can't pull this image until then") + "fix the GITHUB section above; ingot can't pull this image until then") } return } @@ -496,15 +496,15 @@ func (h *Handler) doctorShare(r *doctorReport) { token, domain := h.config.ShareTunnelToken != "", h.config.ShareDomain != "" switch { case token && domain && !h.config.ShareDomainValid(): - r.fail(fmt.Sprintf("ALIOS_SHARE_DOMAIN %q isn't a valid domain, so Caddy will reject named shares", h.config.ShareDomain), + r.fail(fmt.Sprintf("INGOT_SHARE_DOMAIN %q isn't a valid domain, so Caddy will reject named shares", h.config.ShareDomain), "set it to the bare domain, e.g. acme-dev.com") case token && domain: r.ok("Named tunnel configured (https://.%s)", h.config.ShareDomain) case token != domain: - r.warn("Only one of ALIOS_SHARE_TUNNEL_TOKEN / ALIOS_SHARE_DOMAIN is set, so shares use quick tunnels", + r.warn("Only one of INGOT_SHARE_TUNNEL_TOKEN / INGOT_SHARE_DOMAIN is set, so shares use quick tunnels", "set both for stable named-tunnel URLs, or unset the other (see docs/SHARING.md)") default: - r.info("Using quick tunnels (set ALIOS_SHARE_TUNNEL_TOKEN and ALIOS_SHARE_DOMAIN for stable URLs)") + r.info("Using quick tunnels (set INGOT_SHARE_TUNNEL_TOKEN and INGOT_SHARE_DOMAIN for stable URLs)") } shares, err := h.share.List() @@ -521,7 +521,7 @@ func (h *Handler) doctorShare(r *doctorReport) { r.ok("%s shared at %s", sh.Project, sh.URL) } else { r.warn(fmt.Sprintf("%s has a share vhost but its tunnel isn't running", sh.Project), - fmt.Sprintf("cd into %s and run 'alios share stop' (then 'alios share' to reshare)", sh.Project)) + fmt.Sprintf("cd into %s and run 'ingot share stop' (then 'ingot share' to reshare)", sh.Project)) } } } diff --git a/internal/commands/handler.go b/internal/commands/handler.go index cc975fe..39a0164 100644 --- a/internal/commands/handler.go +++ b/internal/commands/handler.go @@ -7,15 +7,15 @@ import ( "path/filepath" "strings" - "github.com/aliasproject/alios-cli/internal/config" - "github.com/aliasproject/alios-cli/internal/docker" - "github.com/aliasproject/alios-cli/internal/github" - "github.com/aliasproject/alios-cli/internal/project" - "github.com/aliasproject/alios-cli/internal/services" - "github.com/aliasproject/alios-cli/internal/share" - "github.com/aliasproject/alios-cli/internal/ssl" - "github.com/aliasproject/alios-cli/internal/updater" - "github.com/aliasproject/alios-cli/internal/utils" + "github.com/aliasproject/ingot/internal/config" + "github.com/aliasproject/ingot/internal/docker" + "github.com/aliasproject/ingot/internal/github" + "github.com/aliasproject/ingot/internal/project" + "github.com/aliasproject/ingot/internal/services" + "github.com/aliasproject/ingot/internal/share" + "github.com/aliasproject/ingot/internal/ssl" + "github.com/aliasproject/ingot/internal/updater" + "github.com/aliasproject/ingot/internal/utils" ) // Handler manages command execution @@ -176,8 +176,8 @@ func (h *Handler) handleDefaultCommand() error { return h.showProjectStatus(project) } - fmt.Println(utils.Colorize("[INFO]", utils.ColorBlue) + " No alios project found in this directory") - fmt.Println("Run 'alios start' to set up a project here, or 'alios help' for more information") + fmt.Println(utils.Colorize("[INFO]", utils.ColorBlue) + " No ingot project found in this directory") + fmt.Println("Run 'ingot start' to set up a project here, or 'ingot help' for more information") return nil } @@ -316,8 +316,8 @@ func (h *Handler) handleCertRepair() error { fmt.Printf(utils.Colorize("[RESTARTING]", utils.ColorCyan)+" Repairing SSL/vhost configuration for %d project(s)...\n", len(names)) - // The vhosts import the alios_wake snippet from the base Caddyfile; - // rewrite it first, or a base file from an older alios would leave Caddy + // The vhosts import the ingot_wake snippet from the base Caddyfile; + // rewrite it first, or a base file from an older ingot would leave Caddy // unable to start on the new vhosts. if err := h.services.WriteBaseConfig(); err != nil { return fmt.Errorf("failed to write the base Caddyfile: %w", err) @@ -337,10 +337,10 @@ func (h *Handler) handleCertRepair() error { return nil } -// handleInstall installs Alios +// handleInstall installs Ingot func (h *Handler) handleInstall() error { if h.isFullySetUp() { - fmt.Printf(utils.Colorize("[SUCCESS]", utils.ColorGreen)+" Alios is already installed (v%s)\n", config.Version) + fmt.Printf(utils.Colorize("[SUCCESS]", utils.ColorGreen)+" Ingot is already installed (v%s)\n", config.Version) return h.showStatus() } @@ -381,7 +381,7 @@ func (h *Handler) ensureUpdaterAuthenticated() { fmt.Println("🔍 Checking for updates...") if err := h.github.EnsureAuthenticated(); err != nil { fmt.Printf(utils.Colorize("[WARNING]", utils.ColorYellow) + " Warning: No GitHub authentication available.\n") - fmt.Printf(" Run 'alios github-auth' to authenticate for access to releases.\n\n") + fmt.Printf(" Run 'ingot github-auth' to authenticate for access to releases.\n\n") return } @@ -391,7 +391,7 @@ func (h *Handler) ensureUpdaterAuthenticated() { } } -// handleUpdate updates Alios to the latest version +// handleUpdate updates Ingot to the latest version func (h *Handler) handleUpdate() error { h.ensureUpdaterAuthenticated() @@ -420,22 +420,22 @@ func (h *Handler) handleCheckUpdate() error { if release.Notes != "" { fmt.Printf("\nRelease notes:\n%s\n", release.Notes) } - fmt.Printf("\nRun 'alios update' to install the latest version.\n") + fmt.Printf("\nRun 'ingot update' to install the latest version.\n") return nil } -// handleUninstall uninstalls Alios +// handleUninstall uninstalls Ingot func (h *Handler) handleUninstall() error { - if !utils.PromptYesNo("Are you sure you want to uninstall Alios?") { + if !utils.PromptYesNo("Are you sure you want to uninstall Ingot?") { fmt.Println("Uninstall cancelled") return nil } - fmt.Println("🗑 Uninstalling Alios...") + fmt.Println("🗑 Uninstalling Ingot...") // Shares first: the named tunnel restarts with Docker and would keep - // the Cloudflare connection open with no alios left to stop it. + // the Cloudflare connection open with no ingot left to stop it. h.stopAllSharesQuietly() // Stop all services @@ -452,19 +452,19 @@ func (h *Handler) handleUninstall() error { utils.CleanupDNS() // Remove binary - os.Remove(config.AliosBinary) + os.Remove(config.IngotBinary) // No local configuration directory to remove since we use environment variables only fmt.Println(utils.Colorize("[INFO]", utils.ColorBlue) + " Configuration is stored in environment variables and project directories only") - fmt.Println(utils.Colorize("[SUCCESS]", utils.ColorGreen) + " Alios uninstalled") + fmt.Println(utils.Colorize("[SUCCESS]", utils.ColorGreen) + " Ingot uninstalled") return nil } // handleInit initializes a new project func (h *Handler) handleInit(args []string) error { // Init is now just an alias for start with PHP version selection - fmt.Println(utils.Colorize("[INFO]", utils.ColorBlue) + " 'alios init' is deprecated. Using 'alios start' instead...") + fmt.Println(utils.Colorize("[INFO]", utils.ColorBlue) + " 'ingot init' is deprecated. Using 'ingot start' instead...") return h.handleStart(args...) } @@ -490,7 +490,7 @@ func (h *Handler) handleStart(args ...string) error { if project.HasDockerfile(proj.Path) { choice := utils.SelectOption("A Dockerfile was found in this project. How should it be used?", []string{ "Use this project's Dockerfile", - "Use a prebuilt Alios image", + "Use a prebuilt image", "Pull a different image", }) switch choice { @@ -541,7 +541,7 @@ func (h *Handler) handleStart(args ...string) error { // Setup cleanup function that will be called on any failure cleanupOnFailure := func(reason string) { fmt.Printf(utils.Colorize("[CLEANUP]", utils.ColorCyan)+" Cleaning up after failure: %s\n", reason) - containerName := fmt.Sprintf("alios_php_%s", proj.Name) + containerName := fmt.Sprintf("ingot_php_%s", proj.Name) // Try to stop the container first if stopErr := h.docker.Run("stop", containerName); stopErr != nil { @@ -579,12 +579,12 @@ func (h *Handler) handleStart(args ...string) error { // The vhost written below imports snippets from the base Caddyfile, and // EnsureRunning skips rewriting it when services are already up - after - // an alios update that would leave Caddy unable to load the new vhost. + // an ingot update that would leave Caddy unable to load the new vhost. if err := h.services.WriteBaseConfig(); err != nil { fmt.Printf(utils.Colorize("[WARNING]", utils.ColorYellow)+" Warning: Failed to update the base Caddyfile: %v\n", err) } - // The SSL setup below rewrites the vhost, which also clears an `alios + // The SSL setup below rewrites the vhost, which also clears an `ingot // stop`; without SSL, clear it directly (the base config was just // written, so skip clearStopped's rewrite). if !h.config.EnableSSL { @@ -601,21 +601,21 @@ func (h *Handler) handleStart(args ...string) error { cleanupOnFailure("SSL certificate setup failed") return fmt.Errorf("project startup failed due to SSL certificate error. Please check:\n"+ - " 1. Caddy container is running (alios global status)\n"+ - " 2. CA certificate exists (alios cert verify)\n"+ - " 3. Try running: alios global restart\n"+ + " 1. Caddy container is running (ingot global status)\n"+ + " 2. CA certificate exists (ingot cert verify)\n"+ + " 3. Try running: ingot global restart\n"+ "Error details: %w", err) } // The certificate just generated is only valid in the browser if the // CA that signed it is trusted on this host - that's a separate, - // one-time step (`alios cert install`) that can be skipped or + // one-time step (`ingot cert install`) that can be skipped or // interrupted independently of SSL setup succeeding here. Surface it // now rather than let the user discover it as a silent "Not Secure" // warning in Chrome. if !h.ssl.IsCertificateInstalled() { fmt.Printf(utils.Colorize("[WARNING]", utils.ColorYellow) + " The CA certificate isn't trusted on this machine yet - your browser will show this site as untrusted.\n") - fmt.Println(" Run 'alios cert install' to trust it, then restart your browser.") + fmt.Println(" Run 'ingot cert install' to trust it, then restart your browser.") } } @@ -635,7 +635,7 @@ func (h *Handler) handleStart(args ...string) error { // Something went wrong if we get here cleanupOnFailure("project started but status is unclear") - return fmt.Errorf("project started but status is unclear. Run 'alios status' to check") + return fmt.Errorf("project started but status is unclear. Run 'ingot status' to check") } // promptForBuildArgs asks for a value for each ARG a Dockerfile declares @@ -672,7 +672,7 @@ func (h *Handler) handleImage(args []string) error { } if proj.Status == "not initialized" { - return fmt.Errorf("project not initialized. Run 'alios start' first") + return fmt.Errorf("project not initialized. Run 'ingot start' first") } mode := "" @@ -733,7 +733,7 @@ func (h *Handler) handleImage(args []string) error { return h.showProjectStatus(updated) } -// handleStop stops the current project until the next `alios start`: it +// handleStop stops the current project until the next `ingot start`: it // ends the share and marks the vhost stopped, so a visit doesn't start it // again the way it would a project that went to sleep for being idle. func (h *Handler) handleStop() error { @@ -776,7 +776,7 @@ func (h *Handler) stopProject(manual bool) error { fmt.Println(utils.Colorize("[SUCCESS]", utils.ColorGreen) + " Project stopped") if marked { - fmt.Println(" It stays stopped until 'alios start'.") + fmt.Println(" It stays stopped until 'ingot start'.") } return nil } @@ -872,7 +872,7 @@ func (h *Handler) handleList() error { } // Telling asleep from stopped costs a throwaway container, so only look - // when some project is down and alios_idle could wake it. If the vhosts + // when some project is down and ingot_idle could wake it. If the vhosts // can't be read, call none of them asleep rather than all of them. waking := false var stopped map[string]bool @@ -909,7 +909,7 @@ func (h *Handler) handlePHPVersion(args []string) error { } if proj.Status == "not initialized" { - return fmt.Errorf("project not initialized. Run 'alios start' first") + return fmt.Errorf("project not initialized. Run 'ingot start' first") } // PHP version only means anything on the prebuilt path - it's just the @@ -918,8 +918,8 @@ func (h *Handler) handlePHPVersion(args []string) error { // actually change anything running; better to say so plainly than let // someone pick a version and wonder why nothing happened. if proj.ImageType == "custom" { - fmt.Printf(utils.Colorize("[INFO]", utils.ColorBlue)+" '%s' is running a custom image (%s), not the prebuilt PHP image - PHP version isn't something alios-cli controls here.\n", proj.Name, proj.ImageSource) - fmt.Println("Run 'alios image prebuilt' first if you want to switch back and manage the PHP version through alios-cli.") + fmt.Printf(utils.Colorize("[INFO]", utils.ColorBlue)+" '%s' is running a custom image (%s), not the prebuilt PHP image - PHP version isn't something ingot controls here.\n", proj.Name, proj.ImageSource) + fmt.Println("Run 'ingot image prebuilt' first if you want to switch back and manage the PHP version through ingot.") return nil } @@ -946,7 +946,7 @@ func (h *Handler) handlePHPVersion(args []string) error { h.clearStopped(proj.Name) fmt.Printf(utils.Colorize("[SUCCESS]", utils.ColorGreen)+" PHP version changed to %s\n", newVersion) - fmt.Println("Run 'alios start' to start with the new version") + fmt.Println("Run 'ingot start' to start with the new version") return nil } @@ -958,7 +958,7 @@ func (h *Handler) handleServerRoot(args []string) error { } if proj.Status == "not initialized" { - return fmt.Errorf("project not initialized. Run 'alios start' first") + return fmt.Errorf("project not initialized. Run 'ingot start' first") } // Get current server root from config @@ -1000,18 +1000,18 @@ func (h *Handler) handleServerRoot(args []string) error { return fmt.Errorf("failed to restart container: %w", err) } } else { - fmt.Println("Run 'alios start' to start with the new server root") + fmt.Println("Run 'ingot start' to start with the new server root") } return nil } // handleEnv manages the env vars injected into the project container: // -// alios env list -// alios env set KEY=VALUE [KEY2=VALUE2 ...] -// alios env unset KEY [KEY2 ...] +// ingot env list +// ingot env set KEY=VALUE [KEY2=VALUE2 ...] +// ingot env unset KEY [KEY2 ...] // -// Values persist in the container's alios.project.env label; set/unset +// Values persist in the container's ingot.project.env label; set/unset // recreate the container so the change takes effect immediately. func (h *Handler) handleEnv(args []string) error { if len(args) == 0 { @@ -1024,13 +1024,13 @@ func (h *Handler) handleEnv(args []string) error { } if proj.Status == "not initialized" { - return fmt.Errorf("project not initialized. Run 'alios start' first") + return fmt.Errorf("project not initialized. Run 'ingot start' first") } switch args[0] { case "list", "ls": if len(proj.Env) == 0 { - fmt.Println("No env vars set. Use 'alios env set KEY=VALUE' to add one") + fmt.Println("No env vars set. Use 'ingot env set KEY=VALUE' to add one") return nil } for _, key := range project.SortedEnvKeys(proj.Env) { @@ -1102,7 +1102,7 @@ func (h *Handler) printEnvApplied(proj *project.Project) { if proj.Status == "running" { fmt.Println(utils.Colorize("[RESTARTING]", utils.ColorCyan) + " Container recreated to apply the change") } else { - fmt.Println("Run 'alios start' to start with the new env vars") + fmt.Println("Run 'ingot start' to start with the new env vars") } } @@ -1127,7 +1127,7 @@ func (h *Handler) handleContainerExec(command string, args []string) error { if err != nil { // If the error indicates the command wasn't found, provide a helpful message if strings.Contains(err.Error(), "not found") { - return fmt.Errorf("'%s' is not an alios command or available in the container\nTry 'alios help' for available commands or 'alios shell' to explore the container", command) + return fmt.Errorf("'%s' is not an ingot command or available in the container\nTry 'ingot help' for available commands or 'ingot shell' to explore the container", command) } } return err @@ -1136,7 +1136,7 @@ func (h *Handler) handleContainerExec(command string, args []string) error { // handleExec explicitly executes a command in the project container func (h *Handler) handleExec(args []string) error { if len(args) == 0 { - return fmt.Errorf("no command specified. Usage: alios exec [args...]") + return fmt.Errorf("no command specified. Usage: ingot exec [args...]") } project, err := h.projects.GetCurrentProject() @@ -1145,7 +1145,7 @@ func (h *Handler) handleExec(args []string) error { } if project.Status == "not initialized" { - return fmt.Errorf("project not initialized. Run 'alios start' first") + return fmt.Errorf("project not initialized. Run 'ingot start' first") } if err := h.wakeForCommand(); err != nil { @@ -1176,7 +1176,7 @@ func (h *Handler) handleShell(args []string) error { } if project.Status == "not initialized" { - return fmt.Errorf("project not initialized. Run 'alios start' first") + return fmt.Errorf("project not initialized. Run 'ingot start' first") } if err := h.wakeForCommand(); err != nil { @@ -1213,8 +1213,8 @@ func (h *Handler) handleLogs(args []string) error { // Show specific container logs container := args[0] - if !strings.HasPrefix(container, "alios_") { - container = "alios_" + container + if !strings.HasPrefix(container, "ingot_") { + container = "ingot_" + container } return h.docker.StreamOutput( @@ -1280,7 +1280,7 @@ func (h *Handler) handleGitHubVerify() error { token := h.config.GetGithubToken() if token == "" { fmt.Println(utils.Colorize("[ERROR]", utils.ColorRed) + " No GitHub token found") - fmt.Println("\nRun 'alios github-auth' to authenticate") + fmt.Println("\nRun 'ingot github-auth' to authenticate") return fmt.Errorf("not authenticated") } @@ -1298,7 +1298,7 @@ func (h *Handler) handleGitHubVerify() error { fmt.Println("\n[INFO] Troubleshooting:") fmt.Println(" 1. Verify Docker login: docker login ghcr.io") fmt.Println(" 2. Check token permissions: needs 'read:packages' scope") - fmt.Println(" 3. Try re-authenticating: alios github-auth") + fmt.Println(" 3. Try re-authenticating: ingot github-auth") return fmt.Errorf("ghcr.io access failed") } @@ -1341,7 +1341,7 @@ func (h *Handler) handleDatabaseAdd() error { if dbType == "mysql" { fmt.Println(utils.Colorize("[USER]", utils.ColorCyan) + " User: root (no password)") } else { - fmt.Println(utils.Colorize("[USER]", utils.ColorCyan) + " User: alios, Password: alios, Database: alios") + fmt.Println(utils.Colorize("[USER]", utils.ColorCyan) + " User: ingot, Password: ingot, Database: ingot") } return nil @@ -1403,7 +1403,7 @@ func (h *Handler) handleDatabaseList() error { if len(databases) == 0 { fmt.Println("No databases configured") - fmt.Println("\nUse 'alios database add' to add a database") + fmt.Println("\nUse 'ingot database add' to add a database") return nil } @@ -1434,7 +1434,7 @@ func (h *Handler) handleDatabaseList() error { // Helper methods for displaying information func (h *Handler) showVersion() error { - fmt.Printf("Alios v%s\n", config.Version) + fmt.Printf("Ingot v%s\n", config.Version) return nil } @@ -1444,12 +1444,12 @@ func (h *Handler) showHelp() error { } func (h *Handler) showStatus() error { - fmt.Printf("Alios v%s - System Status\n", config.Version) + fmt.Printf("Ingot v%s - System Status\n", config.Version) fmt.Println(strings.Repeat("=", 50)) // Installation status fmt.Printf("\n" + utils.Colorize("[PACKAGE]", utils.ColorCyan) + " Installation:\n") - fmt.Printf(" Binary: %s %s\n", config.AliosBinary, utils.BoolStatus(h.config.IsInstalled())) + fmt.Printf(" Binary: %s %s\n", config.IngotBinary, utils.BoolStatus(h.config.IsInstalled())) fmt.Printf(" Config: Environment variables %s\n", utils.BoolStatus(h.config.GetGithubToken() != "")) // Global services status @@ -1543,10 +1543,10 @@ func (h *Handler) showServicesStatus() error { // ShowHelp displays the help message func ShowHelp() { - fmt.Printf(`Alios v%s - Development Environment Manager + fmt.Printf(`Ingot v%s - Development Environment Manager USAGE: - alios [command] [options] + ingot [command] [options] COMMANDS: Project Management: @@ -1568,10 +1568,10 @@ COMMANDS: share stop Stop sharing the current project share list List every active share idle Show when the project is stopped for being idle - idle off|on| Never stop it / use ALIOS_IDLE_TIMEOUT / own timeout + idle off|on| Never stop it / use INGOT_IDLE_TIMEOUT / own timeout Machine Lifecycle: - pause Stop every alios container (projects + global services) + pause Stop every ingot container (projects + global services) resume Restart exactly what was paused Container Commands: @@ -1600,32 +1600,32 @@ COMMANDS: System: doctor Check Docker, GitHub/GHCR access, DNS, services, SSL, and the current project, with a fix for each failure - install Install Alios + install Install Ingot update Update to latest version check-update Check for available updates - uninstall Uninstall Alios + uninstall Uninstall Ingot EXAMPLES: - alios start # Start project with default/saved PHP version - alios start 8.2 # Start project with PHP 8.2 - alios server-root public # Change server root to 'public' directory - alios image prebuilt # Switch back to the prebuilt image - alios image dockerfile # Switch to building from the project's Dockerfile - alios env set APP_DEBUG=true DB_HOST=alios_mysql # Inject env vars - alios env unset APP_DEBUG # Remove an env var - alios share # Get a public URL for the current project - alios share --auth demo:secret # Same, behind a username/password - alios idle off # Keep a project with a queue worker running - alios doctor # Diagnose why something isn't working - alios check-update # Check for available updates - alios update # Update to latest version - alios pause # Stop everything, free up all CPU/RAM - alios resume # Bring back exactly what was paused - alios exec composer install # Run composer install in container - alios exec npm run dev # Run npm dev script in container - alios shell # Open shell as your host user - alios shell --user=root # Open shell as root - alios logs # View container logs + ingot start # Start project with default/saved PHP version + ingot start 8.2 # Start project with PHP 8.2 + ingot server-root public # Change server root to 'public' directory + ingot image prebuilt # Switch back to the prebuilt image + ingot image dockerfile # Switch to building from the project's Dockerfile + ingot env set APP_DEBUG=true DB_HOST=ingot_mysql # Inject env vars + ingot env unset APP_DEBUG # Remove an env var + ingot share # Get a public URL for the current project + ingot share --auth demo:secret # Same, behind a username/password + ingot idle off # Keep a project with a queue worker running + ingot doctor # Diagnose why something isn't working + ingot check-update # Check for available updates + ingot update # Update to latest version + ingot pause # Stop everything, free up all CPU/RAM + ingot resume # Bring back exactly what was paused + ingot exec composer install # Run composer install in container + ingot exec npm run dev # Run npm dev script in container + ingot shell # Open shell as your host user + ingot shell --user=root # Open shell as root + ingot logs # View container logs version Show version information help Show this help message @@ -1643,17 +1643,17 @@ EXAMPLES: QUICK START: 1. Navigate to your project directory - 2. Run 'alios start' to set it up and launch it (first run asks for + 2. Run 'ingot start' to set it up and launch it (first run asks for PHP version, server root, and image) 3. Access at https://[project-name].test EXAMPLES: - alios start 8.4 # First start with PHP 8.4 - alios start # Start current project - alios global start # Start global services - alios database add # Add a database - alios php 8.2 # Change to PHP 8.2 + ingot start 8.4 # First start with PHP 8.4 + ingot start # Start current project + ingot global start # Start global services + ingot database add # Add a database + ingot php 8.2 # Change to PHP 8.2 -For more information, visit: https://alios.app +For more information, visit: https://github.com/aliasproject/ingot `, config.Version) } diff --git a/internal/commands/idle.go b/internal/commands/idle.go index 4c2a34c..23faee7 100644 --- a/internal/commands/idle.go +++ b/internal/commands/idle.go @@ -5,36 +5,36 @@ import ( "strings" "time" - "github.com/aliasproject/alios-cli/internal/idle" - "github.com/aliasproject/alios-cli/internal/project" - "github.com/aliasproject/alios-cli/internal/services" - "github.com/aliasproject/alios-cli/internal/utils" + "github.com/aliasproject/ingot/internal/idle" + "github.com/aliasproject/ingot/internal/project" + "github.com/aliasproject/ingot/internal/services" + "github.com/aliasproject/ingot/internal/utils" ) // handleIdle shows or changes the current project's scale-to-zero setting: // -// alios idle show it -// alios idle off never stop this project (e.g. it runs a queue worker) -// alios idle on use the global ALIOS_IDLE_TIMEOUT again -// alios idle 2h stop it after its own idle timeout +// ingot idle show it +// ingot idle off never stop this project (e.g. it runs a queue worker) +// ingot idle on use the global INGOT_IDLE_TIMEOUT again +// ingot idle 2h stop it after its own idle timeout func (h *Handler) handleIdle(args []string) error { proj, err := h.projects.GetCurrentProject() if err != nil { return err } if proj.Status == "not initialized" { - return fmt.Errorf("project not initialized. Run 'alios start' first") + return fmt.Errorf("project not initialized. Run 'ingot start' first") } if len(args) == 0 { fmt.Printf("%s: %s\n", proj.Name, h.describeIdle(proj.Idle)) if !h.docker.IsContainerRunning(services.IdleContainer) { - fmt.Println(utils.Colorize("[WARNING]", utils.ColorYellow) + " alios_idle isn't running, so nothing is stopped or woken. Run 'alios global start'.") + fmt.Println(utils.Colorize("[WARNING]", utils.ColorYellow) + " ingot_idle isn't running, so nothing is stopped or woken. Run 'ingot global start'.") } return nil } if len(args) > 1 { - return fmt.Errorf("usage: alios idle [on|off|]") + return fmt.Errorf("usage: ingot idle [on|off|]") } setting := strings.TrimSpace(args[0]) @@ -56,7 +56,7 @@ func (h *Handler) handleIdle(args []string) error { // wakeForCommand starts the current project if it's asleep, for commands // that need its container running: exec, shell, share. A project stopped -// with `alios stop` stays stopped. +// with `ingot stop` stays stopped. func (h *Handler) wakeForCommand() error { proj, err := h.projects.GetCurrentProject() if err != nil { @@ -66,7 +66,7 @@ func (h *Handler) wakeForCommand() error { // it: the command was asked for explicitly. if proj.Status == "stopped" { if stopped, err := h.ssl.StoppedProjects(); err == nil && stopped[proj.Name] { - return fmt.Errorf("project is stopped. Run 'alios start' first") + return fmt.Errorf("project is stopped. Run 'ingot start' first") } } woke, err := h.projects.Wake() @@ -77,15 +77,15 @@ func (h *Handler) wakeForCommand() error { } // describeIdle explains a project setting against the timeout the running -// alios_idle service actually uses, not this shell's ALIOS_IDLE_TIMEOUT. +// ingot_idle service actually uses, not this shell's INGOT_IDLE_TIMEOUT. func (h *Handler) describeIdle(setting string) string { global, _ := h.services.IdleTimeoutSetting() return project.DescribeIdle(setting, global) } -// markStopped records an `alios stop` (or clears it) in the project's vhost. +// markStopped records an `ingot stop` (or clears it) in the project's vhost. // The base Caddyfile is rewritten first so the snippet the vhost will import -// exists even if services were started by an older alios. +// exists even if services were started by an older ingot. func (h *Handler) markStopped(name string, stopped bool) error { if err := h.services.WriteBaseConfig(); err != nil { return err @@ -94,7 +94,7 @@ func (h *Handler) markStopped(name string, stopped bool) error { } // clearStopped makes a project wake on visits again, for commands that start -// it other than `alios start` (rebuild, php, image). +// it other than `ingot start` (rebuild, php, image). func (h *Handler) clearStopped(name string) { if err := h.markStopped(name, false); err != nil { fmt.Printf(utils.Colorize("[WARNING]", utils.ColorYellow)+" Warning: Failed to re-enable waking for the project: %v\n", err) @@ -102,7 +102,7 @@ func (h *Handler) clearStopped(name string) { } // projectAsleep reports whether a stopped project starts again on the next -// visit: alios_idle is running and the project wasn't stopped with `alios +// visit: ingot_idle is running and the project wasn't stopped with `ingot // stop`. func (h *Handler) projectAsleep(name, status string) bool { if status != "stopped" || !h.docker.IsContainerRunning(services.IdleContainer) { @@ -123,16 +123,16 @@ func (h *Handler) formatProjectStatus(status string, asleep bool) string { // hintVhostsWithoutWake points out project vhosts written before scale to // zero, which don't start a stopped project on a visit. Each is rewritten on -// that project's next `alios start`; `alios cert repair` does them all. +// that project's next `ingot start`; `ingot cert repair` does them all. func (h *Handler) hintVhostsWithoutWake() { - output, err := h.docker.RunWithOutput("run", "--rm", "-v", "alios_vhosts:/vhosts:ro", "alpine:latest", - "sh", "-c", "cd /vhosts && grep -LE 'import alios_(wake|stopped)' *.caddyfile 2>/dev/null; true") + output, err := h.docker.RunWithOutput("run", "--rm", "-v", "ingot_vhosts:/vhosts:ro", "alpine:latest", + "sh", "-c", "cd /vhosts && grep -LE 'import ingot_(wake|stopped)' *.caddyfile 2>/dev/null; true") if err != nil { return } // Output can include docker's own pull messages, so count only file // names. Share vhosts are skipped: cert repair doesn't rewrite them (the - // next `alios share` does), so counting them would repeat the hint. + // next `ingot share` does), so counting them would repeat the hint. n := 0 for _, line := range strings.Split(output, "\n") { line = strings.TrimSpace(line) @@ -143,7 +143,7 @@ func (h *Handler) hintVhostsWithoutWake() { if n == 0 { return } - fmt.Printf(utils.Colorize("[INFO]", utils.ColorBlue)+" %d vhost(s) predate scale to zero, so those projects won't start on a visit. Run 'alios cert repair' to update them.\n", n) + fmt.Printf(utils.Colorize("[INFO]", utils.ColorBlue)+" %d vhost(s) predate scale to zero, so those projects won't start on a visit. Run 'ingot cert repair' to update them.\n", n) } // doctorIdle checks the scale-to-zero service and reports projects it has @@ -152,25 +152,25 @@ func (h *Handler) doctorIdle(r *doctorReport) { r.section("SCALE TO ZERO") if _, err := idle.ParseTimeout(h.config.IdleTimeout, idle.DefaultTimeout); err != nil { - r.fail(fmt.Sprintf("ALIOS_IDLE_TIMEOUT=%q isn't a duration", h.config.IdleTimeout), - "set it to e.g. 30m or 2h, or off, then run 'alios global restart'") + r.fail(fmt.Sprintf("INGOT_IDLE_TIMEOUT=%q isn't a duration", h.config.IdleTimeout), + "set it to e.g. 30m or 2h, or off, then run 'ingot global restart'") } running, ok := h.services.IdleTimeoutSetting() if !ok { - r.fail("alios_idle isn't running: idle projects aren't stopped, and stopped ones aren't started on a visit", - "alios global start (its output says why it couldn't start, e.g. the image couldn't be pulled)") + r.fail("ingot_idle isn't running: idle projects aren't stopped, and stopped ones aren't started on a visit", + "ingot global start (its output says why it couldn't start, e.g. the image couldn't be pulled)") return } if h.config.IdleTimeout != "" && h.config.IdleTimeout != running { - r.warn(fmt.Sprintf("ALIOS_IDLE_TIMEOUT is %q here but alios_idle runs with %q", h.config.IdleTimeout, running), - "alios global restart, to apply this shell's value") + r.warn(fmt.Sprintf("INGOT_IDLE_TIMEOUT is %q here but ingot_idle runs with %q", h.config.IdleTimeout, running), + "ingot global restart, to apply this shell's value") } - r.ok("alios_idle running (%s)", strings.TrimPrefix(h.describeIdle(""), "stops ")) + r.ok("ingot_idle running (%s)", strings.TrimPrefix(h.describeIdle(""), "stops ")) logs, err := h.docker.RunWithOutput("logs", "--since", "24h", services.IdleContainer) if err != nil { - r.warn(fmt.Sprintf("Could not read alios_idle logs: %v", err), "") + r.warn(fmt.Sprintf("Could not read ingot_idle logs: %v", err), "") return } busy := 0 diff --git a/internal/commands/installer.go b/internal/commands/installer.go index 2ced712..94928c1 100644 --- a/internal/commands/installer.go +++ b/internal/commands/installer.go @@ -6,15 +6,15 @@ import ( "os/exec" "path/filepath" - "github.com/aliasproject/alios-cli/internal/config" - "github.com/aliasproject/alios-cli/internal/docker" - "github.com/aliasproject/alios-cli/internal/github" - "github.com/aliasproject/alios-cli/internal/services" - "github.com/aliasproject/alios-cli/internal/ssl" - "github.com/aliasproject/alios-cli/internal/utils" + "github.com/aliasproject/ingot/internal/config" + "github.com/aliasproject/ingot/internal/docker" + "github.com/aliasproject/ingot/internal/github" + "github.com/aliasproject/ingot/internal/services" + "github.com/aliasproject/ingot/internal/ssl" + "github.com/aliasproject/ingot/internal/utils" ) -// Installer handles the Alios installation process +// Installer handles the Ingot installation process type Installer struct { docker *docker.Client config *config.Config @@ -34,7 +34,7 @@ func NewInstaller(dockerClient *docker.Client, cfg *config.Config, svc *services } } -// Install performs the Alios installation. Safe to call more than once: every +// Install performs the Ingot installation. Safe to call more than once: every // step it runs skips work that's already done (or is a harmless no-op to // repeat), so if a previous attempt failed partway through, calling this // again resumes from wherever it left off instead of starting over. @@ -43,7 +43,7 @@ func (i *Installer) Install() error { if i.config.IsInstalled() { verb = "Resuming setup for" } - fmt.Println(utils.Colorize("[STARTING]", utils.ColorCyan) + " " + verb + " Alios Development Environment") + fmt.Println(utils.Colorize("[STARTING]", utils.ColorCyan) + " " + verb + " Ingot Development Environment") fmt.Println("=" + utils.PadString("", 48)) fmt.Println() @@ -156,7 +156,7 @@ func (i *Installer) configureDatabase() error { // setupGitHubAuth handles GitHub authentication setup func (i *Installer) setupGitHubAuth() error { // Check for an existing, working token before asking anything - on a - // resumed install (or a re-run of `alios install`) this is almost always + // resumed install (or a re-run of `ingot install`) this is almost always // already done, and re-prompting for something already finished is // exactly the friction resuming is supposed to avoid. if err := i.github.EnsureAuthenticated(); err == nil { @@ -173,7 +173,7 @@ func (i *Installer) setupGitHubAuth() error { return i.github.Authenticate() } -// installBinary installs the alios binary +// installBinary installs the ingot binary func (i *Installer) installBinary() error { // Get current executable path currentBinary, err := os.Executable() @@ -188,17 +188,17 @@ func (i *Installer) installBinary() error { } // Check if already installed at target location - if currentBinary == config.AliosBinary { - fmt.Println(" Already installed at " + config.AliosBinary) + if currentBinary == config.IngotBinary { + fmt.Println(" Already installed at " + config.IngotBinary) return nil } // Try to copy directly - if err := utils.CopyFile(currentBinary, config.AliosBinary); err != nil { + if err := utils.CopyFile(currentBinary, config.IngotBinary); err != nil { // If copy fails, try with sudo fmt.Println(" Administrator privileges required") - cmd := exec.Command("sudo", "cp", currentBinary, config.AliosBinary) + cmd := exec.Command("sudo", "cp", currentBinary, config.IngotBinary) cmd.Stdin = os.Stdin cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr @@ -208,13 +208,13 @@ func (i *Installer) installBinary() error { } // Set permissions - exec.Command("sudo", "chmod", "755", config.AliosBinary).Run() + exec.Command("sudo", "chmod", "755", config.IngotBinary).Run() } else { // Set permissions - os.Chmod(config.AliosBinary, 0755) + os.Chmod(config.IngotBinary, 0755) } - fmt.Printf(" "+utils.Colorize("[RUNNING]", utils.ColorGreen)+" Installed to %s\n", config.AliosBinary) + fmt.Printf(" "+utils.Colorize("[RUNNING]", utils.ColorGreen)+" Installed to %s\n", config.IngotBinary) // Check if in PATH if !i.isInPath() { @@ -236,7 +236,7 @@ func (i *Installer) isInPath() bool { func (i *Installer) showSuccessMessage() { fmt.Println() fmt.Println("=" + utils.PadString("", 60)) - utils.PrintSuccess("Alios installed successfully!") + utils.PrintSuccess("Ingot installed successfully!") fmt.Println("=" + utils.PadString("", 60)) fmt.Println() @@ -246,7 +246,7 @@ func (i *Installer) showSuccessMessage() { fmt.Println(" cd /path/to/your/project") fmt.Println() fmt.Println(" 2. Start the project (first run sets it up):") - fmt.Println(" alios start") + fmt.Println(" ingot start") fmt.Println() fmt.Println(" 4. Access your project:") fmt.Printf(" https://[project-name].test\n") @@ -267,9 +267,9 @@ func (i *Installer) showSuccessMessage() { fmt.Println() fmt.Println(utils.Colorize("[DOCS]", utils.ColorCyan) + " For more information:") - fmt.Println(" alios help - Show all commands") - fmt.Println(" alios status - Show system status") - fmt.Println(" alios network-help - Network configuration help") + fmt.Println(" ingot help - Show all commands") + fmt.Println(" ingot status - Show system status") + fmt.Println(" ingot network-help - Network configuration help") fmt.Println() // Show network info @@ -279,9 +279,9 @@ func (i *Installer) showSuccessMessage() { } } -// Uninstall performs the Alios uninstallation +// Uninstall performs the Ingot uninstallation func (i *Installer) Uninstall(removeConfig bool) error { - fmt.Println("🗑 Uninstalling Alios...") + fmt.Println("🗑 Uninstalling Ingot...") // Stop all services fmt.Println("Stopping services...") @@ -292,21 +292,21 @@ func (i *Installer) Uninstall(removeConfig bool) error { utils.CleanupDNS() // Remove binary - if utils.FileExists(config.AliosBinary) { - fmt.Printf("Removing binary from %s...\n", config.AliosBinary) - if err := os.Remove(config.AliosBinary); err != nil { + if utils.FileExists(config.IngotBinary) { + fmt.Printf("Removing binary from %s...\n", config.IngotBinary) + if err := os.Remove(config.IngotBinary); err != nil { // Try with sudo - exec.Command("sudo", "rm", "-f", config.AliosBinary).Run() + exec.Command("sudo", "rm", "-f", config.IngotBinary).Run() } } // No local configuration directory to remove since we use environment variables only if removeConfig { fmt.Println(utils.Colorize("[INFO]", utils.ColorBlue) + " Configuration is stored in environment variables and project directories only") - fmt.Println(" To completely remove alios configuration:") + fmt.Println(" To completely remove ingot configuration:") fmt.Println(" - Unset GITHUB_TOKEN environment variable") } - utils.PrintSuccess("Alios uninstalled") + utils.PrintSuccess("Ingot uninstalled") return nil } diff --git a/internal/commands/pause.go b/internal/commands/pause.go index 4ee31e6..307098d 100644 --- a/internal/commands/pause.go +++ b/internal/commands/pause.go @@ -3,16 +3,16 @@ package commands import ( "fmt" - "github.com/aliasproject/alios-cli/internal/state" - "github.com/aliasproject/alios-cli/internal/utils" + "github.com/aliasproject/ingot/internal/state" + "github.com/aliasproject/ingot/internal/utils" ) -// handlePause stops every alios-managed container on the machine - all project +// handlePause stops every ingot-managed container on the machine - all project // containers across all project directories, plus the shared global services // (dns, caddy, mail, databases) - and remembers exactly what was running so that // handleResume can bring back only that set. func (h *Handler) handlePause() error { - fmt.Println(utils.Colorize("[STOPPING]", utils.ColorYellow) + " Pausing alios...") + fmt.Println(utils.Colorize("[STOPPING]", utils.ColorYellow) + " Pausing ingot...") // Shares aren't restored on resume: a quick tunnel would come back at a // different URL anyway, so end them rather than leave stale vhosts. @@ -44,22 +44,22 @@ func (h *Handler) handlePause() error { store := state.NewStore(h.docker) if err := store.SavePauseState(stoppedProjects, stoppedServices); err != nil { fmt.Printf(utils.Colorize("[WARNING]", utils.ColorYellow)+" Warning: Failed to save pause state: %v\n", err) - fmt.Println(" 'alios resume' won't know what to bring back. Run 'alios global start' and start each project manually.") + fmt.Println(" 'ingot resume' won't know what to bring back. Run 'ingot global start' and start each project manually.") } - fmt.Println(utils.Colorize("[SUCCESS]", utils.ColorGreen) + " Alios paused") + fmt.Println(utils.Colorize("[SUCCESS]", utils.ColorGreen) + " Ingot paused") fmt.Printf(" %d project container(s) stopped\n", len(stoppedProjects)) fmt.Printf(" %d global service container(s) stopped\n", len(stoppedServices)) if len(stoppedShares) > 0 { - fmt.Printf(" %d share(s) ended (run 'alios share' again after resuming)\n", len(stoppedShares)) + fmt.Printf(" %d share(s) ended (run 'ingot share' again after resuming)\n", len(stoppedShares)) } - fmt.Println("\nRun 'alios resume' when you're ready to start working again") + fmt.Println("\nRun 'ingot resume' when you're ready to start working again") return nil } // handleResume restores exactly the containers that were running at the last -// alios pause. +// ingot pause. func (h *Handler) handleResume() error { store := state.NewStore(h.docker) ps, err := store.LoadPauseState() @@ -68,11 +68,11 @@ func (h *Handler) handleResume() error { } if ps == nil || (len(ps.Projects) == 0 && len(ps.Services) == 0) { - fmt.Println(utils.Colorize("[INFO]", utils.ColorBlue) + " No paused alios session found") + fmt.Println(utils.Colorize("[INFO]", utils.ColorBlue) + " No paused ingot session found") return nil } - fmt.Println(utils.Colorize("[STARTING]", utils.ColorCyan) + " Resuming alios...") + fmt.Println(utils.Colorize("[STARTING]", utils.ColorCyan) + " Resuming ingot...") if err := h.services.Resume(ps.Services); err != nil { return fmt.Errorf("failed to resume global services: %w", err) @@ -87,7 +87,7 @@ func (h *Handler) handleResume() error { fmt.Printf(utils.Colorize("[WARNING]", utils.ColorYellow)+" Warning: Failed to clear pause state: %v\n", err) } - fmt.Println(utils.Colorize("[SUCCESS]", utils.ColorGreen) + " Alios resumed") + fmt.Println(utils.Colorize("[SUCCESS]", utils.ColorGreen) + " Ingot resumed") fmt.Printf(" %d global service container(s) started\n", len(ps.Services)) fmt.Printf(" %d project container(s) started\n", len(startedProjects)) diff --git a/internal/commands/share.go b/internal/commands/share.go index 33f009a..3e007d2 100644 --- a/internal/commands/share.go +++ b/internal/commands/share.go @@ -5,16 +5,16 @@ import ( "fmt" "os" - "github.com/aliasproject/alios-cli/internal/share" - "github.com/aliasproject/alios-cli/internal/utils" + "github.com/aliasproject/ingot/internal/share" + "github.com/aliasproject/ingot/internal/utils" ) // handleShare exposes the current project at a public URL through a // Cloudflare Tunnel: // -// alios share [--auth user:pass] -// alios share stop -// alios share list +// ingot share [--auth user:pass] +// ingot share stop +// ingot share list func (h *Handler) handleShare(args []string) error { if len(args) > 0 { switch args[0] { @@ -49,7 +49,7 @@ func (h *Handler) handleShare(args []string) error { return err } if project.Status == "not initialized" { - return fmt.Errorf("project not initialized. Run 'alios start' first") + return fmt.Errorf("project not initialized. Run 'ingot start' first") } if err := h.wakeForCommand(); err != nil { return err @@ -69,7 +69,7 @@ func (h *Handler) handleShare(args []string) error { if !started { fmt.Println(utils.Colorize("[INFO]", utils.ColorBlue) + " Already shared") if creds != nil { - fmt.Println(" --auth ignored for an existing share. Run 'alios share stop' first to change it") + fmt.Println(" --auth ignored for an existing share. Run 'ingot share stop' first to change it") } } else { fmt.Println(utils.Colorize("[SUCCESS]", utils.ColorGreen) + " Project shared") @@ -81,12 +81,12 @@ func (h *Handler) handleShare(args []string) error { fmt.Println(utils.Colorize("[WARNING]", utils.ColorYellow) + " This URL is reachable from the internet (protected by basic auth)") } else { fmt.Println(utils.Colorize("[WARNING]", utils.ColorYellow) + " Anyone with this URL can reach your dev site, including debug pages") - fmt.Println(" Use 'alios share --auth user:pass' to require a login") + fmt.Println(" Use 'ingot share --auth user:pass' to require a login") } if sh.Mode == share.ModeQuick { fmt.Println(" Quick tunnel URLs change each time you share") } - fmt.Println(" Run 'alios share stop' to stop sharing") + fmt.Println(" Run 'ingot share stop' to stop sharing") return nil } @@ -117,7 +117,7 @@ func (h *Handler) handleShareList() error { } if len(shares) == 0 { - fmt.Println("No projects are shared. Run 'alios share' in a project to share it") + fmt.Println("No projects are shared. Run 'ingot share' in a project to share it") return nil } @@ -172,7 +172,7 @@ func formatShare(sh *share.Share, tunnelRunning bool) string { } line += ")" if !tunnelRunning { - line += " " + utils.Colorize("[STALE]", utils.ColorRed) + " tunnel not running, run 'alios share stop'" + line += " " + utils.Colorize("[STALE]", utils.ColorRed) + " tunnel not running, run 'ingot share stop'" } return line } diff --git a/internal/config/config.go b/internal/config/config.go index e30dc26..af5b828 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -7,7 +7,7 @@ import ( ) const ( - // Version is the current version of Alios CLI + // Version is the current version of Ingot Version = "1.3.0" // ClientID is the GitHub OAuth application client ID @@ -16,12 +16,12 @@ const ( // DefaultPHPVersion is the default PHP version for new projects DefaultPHPVersion = "8.4" - // AliosBinary is the installation path for the alios binary - AliosBinary = "/usr/local/bin/alios" + // IngotBinary is the installation path for the ingot binary + IngotBinary = "/usr/local/bin/ingot" - // IdleImage is the alios_idle service's image, tagged with the CLI + // IdleImage is the ingot_idle service's image, tagged with the CLI // version so each CLI runs the service built from the same source. - IdleImage = "ghcr.io/aliasproject/alios-idle:" + Version + IdleImage = "ghcr.io/aliasproject/ingot-idle:" + Version ) // Config holds the application configuration @@ -42,20 +42,20 @@ type Config struct { EnableSSL bool EnableDNS bool - // Sharing (alios share). When both are set, shares use a named Cloudflare + // Sharing (ingot share). When both are set, shares use a named Cloudflare // Tunnel with stable . hostnames instead of a // throwaway trycloudflare.com quick tunnel. ShareTunnelToken string ShareDomain string - // IdleTimeout is how long a project may sit idle before alios_idle stops - // it (ALIOS_IDLE_TIMEOUT: a Go duration such as "30m", or "off"). Empty + // IdleTimeout is how long a project may sit idle before ingot_idle stops + // it (INGOT_IDLE_TIMEOUT: a Go duration such as "30m", or "off"). Empty // means the service's own default. Passed through to the service as-is; // it validates the value. IdleTimeout string } -// ShareNamedMode reports whether alios share should use a named tunnel. +// ShareNamedMode reports whether ingot share should use a named tunnel. func (c *Config) ShareNamedMode() bool { return c.ShareTunnelToken != "" && c.ShareDomain != "" } @@ -92,7 +92,7 @@ func (c *Config) initialize() { c.Databases = make(map[string]DatabaseConfig) // Network detection - use default or environment variable - if hostIP := os.Getenv("ALIOS_HOST_IP"); hostIP != "" { + if hostIP := os.Getenv("INGOT_HOST_IP"); hostIP != "" { c.HostIP = hostIP } else { c.HostIP = "127.0.0.1" // default @@ -164,39 +164,39 @@ func (c *Config) RemoveDatabase(name string) error { // loadFromEnvironment loads configuration from environment variables func (c *Config) loadFromEnvironment() { // Default PHP version - if version := os.Getenv("ALIOS_DEFAULT_PHP_VERSION"); version != "" { + if version := os.Getenv("INGOT_DEFAULT_PHP_VERSION"); version != "" { c.DefaultPHPVersion = version } // Network settings - if hostIP := os.Getenv("ALIOS_HOST_IP"); hostIP != "" { + if hostIP := os.Getenv("INGOT_HOST_IP"); hostIP != "" { c.HostIP = hostIP } - if dnsPort := os.Getenv("ALIOS_DNS_PORT"); dnsPort != "" { + if dnsPort := os.Getenv("INGOT_DNS_PORT"); dnsPort != "" { c.DNSPort = dnsPort } // Feature flags - if enableSSL := os.Getenv("ALIOS_ENABLE_SSL"); enableSSL != "" { + if enableSSL := os.Getenv("INGOT_ENABLE_SSL"); enableSSL != "" { c.EnableSSL = enableSSL == "true" || enableSSL == "1" } - if enableDNS := os.Getenv("ALIOS_ENABLE_DNS"); enableDNS != "" { + if enableDNS := os.Getenv("INGOT_ENABLE_DNS"); enableDNS != "" { c.EnableDNS = enableDNS == "true" || enableDNS == "1" } // Auto start global services - if autoStart := os.Getenv("ALIOS_AUTO_START_GLOBAL"); autoStart != "" { + if autoStart := os.Getenv("INGOT_AUTO_START_GLOBAL"); autoStart != "" { c.AutoStartGlobal = autoStart == "true" || autoStart == "1" } // Named-tunnel sharing - c.ShareTunnelToken = os.Getenv("ALIOS_SHARE_TUNNEL_TOKEN") - c.ShareDomain = normalizeShareDomain(os.Getenv("ALIOS_SHARE_DOMAIN")) + c.ShareTunnelToken = os.Getenv("INGOT_SHARE_TUNNEL_TOKEN") + c.ShareDomain = normalizeShareDomain(os.Getenv("INGOT_SHARE_DOMAIN")) // Scale to zero - c.IdleTimeout = strings.TrimSpace(os.Getenv("ALIOS_IDLE_TIMEOUT")) + c.IdleTimeout = strings.TrimSpace(os.Getenv("INGOT_IDLE_TIMEOUT")) } // normalizeShareDomain accepts the forms people paste - "*.acme-dev.com" (the @@ -241,9 +241,9 @@ func (c *Config) GetDatabases() map[string]DatabaseConfig { return databases } -// IsInstalled checks if Alios is installed +// IsInstalled checks if Ingot is installed func (c *Config) IsInstalled() bool { - _, err := os.Stat(AliosBinary) + _, err := os.Stat(IngotBinary) return err == nil } @@ -261,7 +261,7 @@ type NetworkConfig struct { // GetNetworkConfig returns the default network configuration func GetNetworkConfig() *NetworkConfig { return &NetworkConfig{ - BridgeName: "alios_internal", - InternalNet: "alios_internal", + BridgeName: "ingot_internal", + InternalNet: "ingot_internal", } } diff --git a/internal/github/client.go b/internal/github/client.go index e7e8816..cf8ec47 100644 --- a/internal/github/client.go +++ b/internal/github/client.go @@ -10,8 +10,8 @@ import ( "strings" "time" - "github.com/aliasproject/alios-cli/internal/config" - "github.com/aliasproject/alios-cli/internal/utils" + "github.com/aliasproject/ingot/internal/config" + "github.com/aliasproject/ingot/internal/utils" ) // Client handles GitHub authentication and API operations diff --git a/internal/idle/engine.go b/internal/idle/engine.go index cee2832..84b5777 100644 --- a/internal/idle/engine.go +++ b/internal/idle/engine.go @@ -12,12 +12,12 @@ import ( "time" ) -// ProjectLabel marks a container as an alios project; IdleLabel holds its +// ProjectLabel marks a container as an ingot project; IdleLabel holds its // per-project setting ("off", or a timeout such as "2h"). Both are written by // project.Manager.createContainer. const ( - ProjectLabel = "alios.project.name" - IdleLabel = "alios.project.idle" + ProjectLabel = "ingot.project.name" + IdleLabel = "ingot.project.idle" ) // Container is the part of a container's state the service needs. @@ -94,7 +94,7 @@ func (e *SocketEngine) do(ctx context.Context, method, path string, out any) (in return resp.StatusCode, nil } -// ListProjects returns every alios project container, running or not. +// ListProjects returns every ingot project container, running or not. func (e *SocketEngine) ListProjects(ctx context.Context) ([]Container, error) { filters := url.QueryEscape(fmt.Sprintf(`{"label":[%q]}`, ProjectLabel)) var list []struct { diff --git a/internal/idle/policy.go b/internal/idle/policy.go index ae7e14a..5fb8278 100644 --- a/internal/idle/policy.go +++ b/internal/idle/policy.go @@ -1,7 +1,7 @@ -// Package idle is the alios_idle service: it stops project containers that +// Package idle is the ingot_idle service: it stops project containers that // have gone quiet and starts them again when a request arrives for them. // -// It runs as its own container (cmd/alios-idle) next to the other global +// It runs as its own container (cmd/ingot-idle) next to the other global // services, and talks to the Docker Engine API over the mounted socket // directly rather than through internal/docker.Client: that client shells out // to the docker CLI, which the service's image doesn't ship. @@ -15,7 +15,7 @@ import ( // Sample is one reading of a container's raw counters. CPU and network are // cumulative since the container started. ExecProcs counts processes that // don't descend from the container's main process: `docker exec` sessions -// (alios exec, alios shell) and health checks. +// (ingot exec, ingot shell) and health checks. type Sample struct { At time.Time CPUNanos uint64 @@ -35,7 +35,7 @@ type Thresholds struct { NetBytesPerMinute uint64 } -// DefaultThresholds are tuned against idle alios_php_* containers, which use +// DefaultThresholds are tuned against idle ingot_php_* containers, which use // about 0.1% of a core and a few hundred bytes of traffic an hour. var DefaultThresholds = Thresholds{ CPUFraction: 0.01, @@ -108,7 +108,7 @@ func (t *Tracker) Observe(id, startedAt string, s Sample) Activity { // An exec'd process counts only when seen twice in a row, so a health // check that happens to be running at the moment of a sample doesn't // reset the timer. Real work that short shows up as CPU anyway. An idle - // `alios shell` uses no CPU or container network, so this is the only + // `ingot shell` uses no CPU or container network, so this is the only // signal that keeps a project with an open shell awake. if exec && inst.execBefore { reasons = append(reasons, "exec") diff --git a/internal/idle/policy_test.go b/internal/idle/policy_test.go index e8491ac..c9a2a72 100644 --- a/internal/idle/policy_test.go +++ b/internal/idle/policy_test.go @@ -80,7 +80,7 @@ func TestSingleExecBlipIsIgnored(t *testing.T) { } func TestShellOpenFromTheStartKeepsItAwake(t *testing.T) { - // `alios shell` on a sleeping project starts the container and execs a + // `ingot shell` on a sleeping project starts the container and execs a // shell before the watcher's first sample. An idle shell uses no CPU or // container network; it must still count for as long as it's open. b := base() @@ -128,7 +128,7 @@ func TestForgetDropsRemovedContainers(t *testing.T) { } func TestIdleShellIsNotBusyWithoutTraffic(t *testing.T) { - // An open `alios shell` keeps the project awake, but it isn't a stuck + // An open `ingot shell` keeps the project awake, but it isn't a stuck // job: it must not trigger busy warnings. steps := []func(*Sample){} for i := 0; i < 10; i++ { diff --git a/internal/idle/waker.go b/internal/idle/waker.go index b8c3c5e..01a0ef8 100644 --- a/internal/idle/waker.go +++ b/internal/idle/waker.go @@ -15,9 +15,9 @@ import ( ) // ProjectHeader names the project a woken request is for. The vhost's -// alios_wake snippet sets it (see services.baseCaddyfile), so the waker never +// ingot_wake snippet sets it (see services.baseCaddyfile), so the waker never // has to guess the project from a Host that might be a share's public name. -const ProjectHeader = "X-Alios-Project" +const ProjectHeader = "X-Ingot-Project" var validProject = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9_.-]*$`) @@ -40,7 +40,7 @@ type Waker struct { // assumed to be one Caddy sent while it was down, rather than a running // project failing. Requests for a page's assets arrive in a burst, and the // later ones can reach the waker after the first one already woke it; a -// visit right after `alios start` or `alios exec` started it is the same. +// visit right after `ingot start` or `ingot exec` started it is the same. const recentStart = 15 * time.Second // wake is one start in progress. Concurrent requests for the same project @@ -65,10 +65,10 @@ func (w *Waker) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } ctx := r.Context() - c, err := w.Engine.Inspect(ctx, "alios_php_"+project) + c, err := w.Engine.Inspect(ctx, "ingot_php_"+project) if errors.Is(err, ErrNotFound) || (err == nil && c.Project != project) { - // Only ever start containers alios created for this project. - page(rw, http.StatusNotFound, "No project here", fmt.Sprintf("There's no container for %s. Run 'alios start' in the project.", project)) + // Only ever start containers ingot created for this project. + page(rw, http.StatusNotFound, "No project here", fmt.Sprintf("There's no container for %s. Run 'ingot start' in the project.", project)) return } if err != nil { @@ -82,7 +82,7 @@ func (w *Waker) ServeHTTP(rw http.ResponseWriter, r *http.Request) { if err := w.wakeOnce(c); err != nil { w.Log.Printf("waking %s: %v", project, err) page(rw, http.StatusGatewayTimeout, "Project didn't start", - fmt.Sprintf("%s: %v. Check 'alios logs'.", project, err)) + fmt.Sprintf("%s: %v. Check 'ingot logs'.", project, err)) return } case !c.StartedWithin(recentStart, time.Now()): @@ -90,7 +90,7 @@ func (w *Waker) ServeHTTP(rw http.ResponseWriter, r *http.Request) { // for a while, so starting it again won't help - and redirecting // would loop. page(rw, http.StatusBadGateway, "Project isn't responding", - fmt.Sprintf("%s is running but the request to it failed. Check 'alios logs'.", project)) + fmt.Sprintf("%s is running but the request to it failed. Check 'ingot logs'.", project)) return } // Otherwise it's up because a wake just finished: retry as well. @@ -162,7 +162,7 @@ func (w *Waker) start(ctx context.Context, c *Container) error { case <-time.After(100 * time.Millisecond): } // A container that was being stopped when the request came in - // (by the watcher, or `alios stop`) still counted as running, so + // (by the watcher, or `ingot stop`) still counted as running, so // Start was a no-op. Once the stop finishes, start it for real. if i%10 == 0 { if cur, err := w.Engine.Inspect(ctx, c.ID); err == nil && !cur.Running { diff --git a/internal/idle/waker_test.go b/internal/idle/waker_test.go index f010bbe..7cf9063 100644 --- a/internal/idle/waker_test.go +++ b/internal/idle/waker_test.go @@ -14,7 +14,7 @@ import ( // shop is a project container that, if running, has been up for an hour. func shop(running bool) Container { - return Container{ID: "id-shop", Name: "alios_php_shop", Project: "shop", Running: running, + return Container{ID: "id-shop", Name: "ingot_php_shop", Project: "shop", Running: running, StartedAt: time.Now().Add(-time.Hour).UTC().Format(time.RFC3339Nano)} } @@ -52,7 +52,7 @@ func TestWakeStartsContainerAndRedirectsToSameURL(t *testing.T) { if loc := rw.Header().Get("Location"); loc != "/cart/add?id=7" { t.Fatalf("Location = %q, want the original path and query", loc) } - if f.starts != 1 || !f.containers["alios_php_shop"].Running { + if f.starts != 1 || !f.containers["ingot_php_shop"].Running { t.Fatal("container wasn't started") } } @@ -73,8 +73,8 @@ func TestRunningButUnreachableDoesNotRedirectLoop(t *testing.T) { } func TestOnlyStartsContainersOfTheNamedProject(t *testing.T) { - // alios_php_shop exists but belongs to some other project label - never - // start a container alios didn't create for this project. + // ingot_php_shop exists but belongs to some other project label - never + // start a container ingot didn't create for this project. other := shop(false) other.Project = "not-shop" cases := map[string]*fakeEngine{ @@ -185,7 +185,7 @@ func TestRequestJustAfterAWakeIsRetriedNotFailed(t *testing.T) { } func TestRequestJustAfterAnotherStartIsRetried(t *testing.T) { - // Started a moment ago by `alios start` or `alios exec`, not by the + // Started a moment ago by `ingot start` or `ingot exec`, not by the // waker: a request Caddy failed while it was down is still retried. c := shop(true) c.StartedAt = time.Now().Add(-2 * time.Second).UTC().Format(time.RFC3339Nano) @@ -221,7 +221,7 @@ func TestRedirectNeverLeavesTheSite(t *testing.T) { } func TestWakeDuringAStopStartsItOnceTheStopFinishes(t *testing.T) { - // The watcher (or `alios stop`) is stopping the container when the + // The watcher (or `ingot stop`) is stopping the container when the // request arrives: it still counts as running, so the first Start is a // no-op. Once it has exited, the waker must start it again rather than // wait for a port that will never open. @@ -234,11 +234,11 @@ func TestWakeDuringAStopStartsItOnceTheStopFinishes(t *testing.T) { go func() { time.Sleep(300 * time.Millisecond) f.mu.Lock() - f.containers["alios_php_shop"].Running = false // the stop completes + f.containers["ingot_php_shop"].Running = false // the stop completes f.mu.Unlock() for { f.mu.Lock() - up := f.containers["alios_php_shop"].Running + up := f.containers["ingot_php_shop"].Running f.mu.Unlock() if up { ready.Store(true) diff --git a/internal/idle/watcher.go b/internal/idle/watcher.go index 0a78bc8..e2a01ef 100644 --- a/internal/idle/watcher.go +++ b/internal/idle/watcher.go @@ -8,7 +8,7 @@ import ( ) // BusyWarning starts the log line the watcher writes when a container has -// been busy for a long time with no traffic. `alios doctor` looks for it. +// been busy for a long time with no traffic. `ingot doctor` looks for it. const BusyWarning = "busy-warning" // Watcher stops project containers once they've been idle for their timeout. @@ -130,12 +130,12 @@ func (w *Watcher) warnIfBusy(c *Container, a Activity) { return } w.warned[c.ID] = true - w.Log.Printf("%s %s: busy for %s with no traffic (%s); check it's not stuck with 'alios logs' or 'docker top %s'", + w.Log.Printf("%s %s: busy for %s with no traffic (%s); check it's not stuck with 'ingot logs' or 'docker top %s'", BusyWarning, c.Project, a.BusyWithoutTrafficFor.Round(time.Minute), strings.Join(a.Reasons, ", "), c.Name) } // DefaultTimeout is how long a project may sit idle before it's stopped when -// ALIOS_IDLE_TIMEOUT isn't set. +// INGOT_IDLE_TIMEOUT isn't set. const DefaultTimeout = 30 * time.Minute // ParseTimeout reads a timeout setting: a Go duration, or "off"/"0" to diff --git a/internal/idle/watcher_test.go b/internal/idle/watcher_test.go index a6aab74..f8a8a1f 100644 --- a/internal/idle/watcher_test.go +++ b/internal/idle/watcher_test.go @@ -10,7 +10,7 @@ import ( ) func project(name, idle string) Container { - return Container{ID: "id-" + name, Name: "alios_php_" + name, Project: name, Idle: idle, Running: true, StartedAt: "run1"} + return Container{ID: "id-" + name, Name: "ingot_php_" + name, Project: name, Idle: idle, Running: true, StartedAt: "run1"} } // quietSamples returns n samples 30s apart with background-noise deltas. diff --git a/internal/project/env.go b/internal/project/env.go index d135c7f..c1780e3 100644 --- a/internal/project/env.go +++ b/internal/project/env.go @@ -13,10 +13,10 @@ import ( // equals signs. Like every other per-project setting, this lives on the // container itself, not in a file on disk (see CLAUDE.md's "no persisted // config files" invariant). -const envLabel = "alios.project.env" +const envLabel = "ingot.project.env" // reservedEnvKeys are the infra vars createContainer always sets itself, last, -// so a user var can never override what alios needs to route traffic to the +// so a user var can never override what ingot needs to route traffic to the // container. Rejected up front by SetEnv rather than silently clobbered. var reservedEnvKeys = map[string]bool{ "SERVER_NAME": true, @@ -25,7 +25,7 @@ var reservedEnvKeys = map[string]bool{ "PORT": true, } -// IsReservedEnvKey reports whether key is one of alios's own infra vars. +// IsReservedEnvKey reports whether key is one of ingot's own infra vars. func IsReservedEnvKey(key string) bool { return reservedEnvKeys[key] } diff --git a/internal/project/idle.go b/internal/project/idle.go index 6bcd23b..48ccc78 100644 --- a/internal/project/idle.go +++ b/internal/project/idle.go @@ -4,11 +4,11 @@ import ( "fmt" "time" - "github.com/aliasproject/alios-cli/internal/idle" + "github.com/aliasproject/ingot/internal/idle" ) // SetIdle changes the current project's scale-to-zero setting and recreates -// the container to store it: "" uses the global ALIOS_IDLE_TIMEOUT, "off" +// the container to store it: "" uses the global INGOT_IDLE_TIMEOUT, "off" // keeps the project running, a duration ("2h") is its own idle timeout. func (m *Manager) SetIdle(setting string) error { if setting != "" && setting != "off" { @@ -42,7 +42,7 @@ func (m *Manager) Wake() (woke bool, err error) { return false, err } if project.Status == "not initialized" { - return false, fmt.Errorf("project not initialized. Run 'alios start' first") + return false, fmt.Errorf("project not initialized. Run 'ingot start' first") } if project.Status == "running" { return false, nil @@ -56,21 +56,21 @@ func (m *Manager) Wake() (woke bool, err error) { return true, nil } } - return false, fmt.Errorf("project container didn't start; check 'alios logs'") + return false, fmt.Errorf("project container didn't start; check 'ingot logs'") } // DescribeIdle explains a project's idle setting for status output. func DescribeIdle(setting, globalTimeout string) string { switch setting { case "off": - return "never stopped (alios idle off)" + return "never stopped (ingot idle off)" case "": timeout, err := idle.ParseTimeout(globalTimeout, idle.DefaultTimeout) if err != nil { - return "stops when idle (invalid ALIOS_IDLE_TIMEOUT, using the default)" + return "stops when idle (invalid INGOT_IDLE_TIMEOUT, using the default)" } if timeout == 0 { - return "never stopped (ALIOS_IDLE_TIMEOUT=off)" + return "never stopped (INGOT_IDLE_TIMEOUT=off)" } return fmt.Sprintf("stops after %s idle", timeout) } diff --git a/internal/project/manager.go b/internal/project/manager.go index 8e8aadf..bf97795 100644 --- a/internal/project/manager.go +++ b/internal/project/manager.go @@ -9,10 +9,10 @@ import ( "sync" "time" - "github.com/aliasproject/alios-cli/internal/config" - "github.com/aliasproject/alios-cli/internal/docker" - "github.com/aliasproject/alios-cli/internal/idle" - "github.com/aliasproject/alios-cli/internal/utils" + "github.com/aliasproject/ingot/internal/config" + "github.com/aliasproject/ingot/internal/docker" + "github.com/aliasproject/ingot/internal/idle" + "github.com/aliasproject/ingot/internal/utils" ) // Manager handles project operations @@ -30,7 +30,7 @@ func NewManager(dockerClient *docker.Client) *Manager { } } -// Project represents a Alios project +// Project represents a Ingot project type Project struct { Name string Path string @@ -55,11 +55,11 @@ type Project struct { Framework string // "" or "wordpress"; detected from the project directory // Env holds user-supplied env vars for the container, managed with - // `alios env set/unset` and stored in the alios.project.env label. This + // `ingot env set/unset` and stored in the ingot.project.env label. This // is how a project gets config into its container the same way // production supplies it (plain KEY=VALUE vars on `docker run`, see // RunDockerContainer's buildEnvironmentVariables in the Alios platform - // repo). Alios deliberately does not read the project's own .env: the + // repo). Ingot deliberately does not read the project's own .env: the // project directory is bind-mounted, so an app that reads .env itself // (Laravel, etc.) already sees edits instantly, and injecting the same // keys as real env vars would only shadow the file with a stale copy @@ -67,8 +67,8 @@ type Project struct { Env map[string]string // Idle is the project's scale-to-zero setting, from the - // alios.project.idle label (`alios idle`): "" for the global - // ALIOS_IDLE_TIMEOUT, "off" to never stop it, or its own timeout. + // ingot.project.idle label (`ingot idle`): "" for the global + // INGOT_IDLE_TIMEOUT, "off" to never stop it, or its own timeout. Idle string } @@ -118,32 +118,32 @@ func (m *Manager) GetCurrentProject() (*Project, error) { } // Get configuration from Docker labels - phpVersion := info.Labels["alios.project.php_version"] + phpVersion := info.Labels["ingot.project.php_version"] if phpVersion == "" { phpVersion = config.DefaultPHPVersion } - serverRoot := info.Labels["alios.project.server_root"] + serverRoot := info.Labels["ingot.project.server_root"] if serverRoot == "" { serverRoot = "public" // default } - imageType := info.Labels["alios.project.image_type"] + imageType := info.Labels["ingot.project.image_type"] if imageType == "" { imageType = "prebuilt" } - dockerfilePath := info.Labels["alios.project.dockerfile_path"] + dockerfilePath := info.Labels["ingot.project.dockerfile_path"] if dockerfilePath == "" { dockerfilePath = "Dockerfile" } - buildContext := info.Labels["alios.project.build_context"] + buildContext := info.Labels["ingot.project.build_context"] if buildContext == "" { buildContext = "." } - buildArgs := parseBuildArgs(info.Labels["alios.project.build_args"]) + buildArgs := parseBuildArgs(info.Labels["ingot.project.build_args"]) env := parseEnv(info.Labels[envLabel]) status := "stopped" @@ -162,12 +162,12 @@ func (m *Manager) GetCurrentProject() (*Project, error) { CreatedAt: info.CreatedAt, UpdatedAt: info.StartedAt, ImageType: imageType, - ImageSource: info.Labels["alios.project.image_source"], - ImageURL: info.Labels["alios.project.image_url"], + ImageSource: info.Labels["ingot.project.image_source"], + ImageURL: info.Labels["ingot.project.image_url"], DockerfilePath: dockerfilePath, BuildContext: buildContext, BuildArgs: buildArgs, - Framework: info.Labels["alios.project.framework"], + Framework: info.Labels["ingot.project.framework"], Env: env, Idle: info.Labels[idle.IdleLabel], }, nil @@ -280,12 +280,12 @@ func (m *Manager) Start(phpVersion string, imageChoice ImageChoice, serverRoot . // Check if container exists if m.docker.ContainerExists(project.Container) { // Check if the existing container's PHP version is still current. - // Env var changes never surface here: `alios env set/unset` recreates + // Env var changes never surface here: `ingot env set/unset` recreates // the container itself (Docker has no way to patch env vars into a // running one, and neither does production's RunAndSwapContainer). info, err := m.docker.InspectContainer(project.Container) if err == nil { - existingVersion := info.Labels["alios.project.php_version"] + existingVersion := info.Labels["ingot.project.php_version"] versionChanged := existingVersion != "" && existingVersion != desiredPHPVersion // Only worth a registry round-trip when nothing else already @@ -531,7 +531,7 @@ func (m *Manager) ChangeServerRoot(newServerRoot string) error { func (m *Manager) SetEnv(vars map[string]string) error { for key := range vars { if IsReservedEnvKey(key) { - return fmt.Errorf("%s is set by alios itself and cannot be overridden", key) + return fmt.Errorf("%s is set by ingot itself and cannot be overridden", key) } } @@ -607,9 +607,9 @@ func (m *Manager) recreate(project *Project) error { return nil } -// List returns all Alios projects +// List returns all Ingot projects func (m *Manager) List() ([]*Project, error) { - containers, err := m.docker.ListContainers("label=alios.project.name") + containers, err := m.docker.ListContainers("label=ingot.project.name") if err != nil { return nil, fmt.Errorf("failed to list containers: %w", err) } @@ -626,12 +626,12 @@ func (m *Manager) List() ([]*Project, error) { continue } - name := info.Labels["alios.project.name"] + name := info.Labels["ingot.project.name"] if name == "" { - name = strings.TrimPrefix(containerName, "alios_php_") + name = strings.TrimPrefix(containerName, "ingot_php_") } - phpVersion := info.Labels["alios.project.php_version"] + phpVersion := info.Labels["ingot.project.php_version"] if phpVersion == "" { phpVersion = config.DefaultPHPVersion } @@ -643,7 +643,7 @@ func (m *Manager) List() ([]*Project, error) { projects = append(projects, &Project{ Name: name, - Path: info.Labels["alios.project.path"], + Path: info.Labels["ingot.project.path"], PHPVersion: phpVersion, Status: status, Container: containerName, @@ -656,7 +656,7 @@ func (m *Manager) List() ([]*Project, error) { return projects, nil } -// ListRunning returns all Alios project containers that are currently running, +// ListRunning returns all Ingot project containers that are currently running, // system-wide (not just the one for the current working directory). func (m *Manager) ListRunning() ([]*Project, error) { projects, err := m.List() @@ -737,7 +737,7 @@ func (m *Manager) Exec(command []string, interactive bool) error { if len(command) > 0 { cmdName = command[0] } - return fmt.Errorf("command '%s' not found in container. Try 'alios shell' to explore available commands", cmdName) + return fmt.Errorf("command '%s' not found in container. Try 'ingot shell' to explore available commands", cmdName) } if strings.Contains(errStr, "OCI runtime exec failed") { // Extract just the useful part of the error @@ -886,7 +886,7 @@ func (m *Manager) resolveImage(project *Project) (string, error) { // ImageReference returns the image a project's container runs, without // pulling or building anything. This is the pure half of resolveImage, so -// `alios doctor` can report (and probe registry access for) the exact tag +// `ingot doctor` can report (and probe registry access for) the exact tag // a not-yet-initialized project would use. func (m *Manager) ImageReference(project *Project) string { if project.ImageType == "custom" { @@ -929,11 +929,11 @@ func (m *Manager) pullOrUseLocal(image string) error { msg += "\n The registry refused access. Your GitHub token is probably missing the 'read:packages' scope" + "\n (docker login accepts any valid token, but GHCR only serves private images to one with read:packages)." + "\n Fix: gh auth refresh -h github.com -s read:packages (or export GITHUB_TOKEN with read:packages)" + - "\n Then run 'alios doctor' to confirm registry access." + "\n Then run 'ingot doctor' to confirm registry access." } else if strings.Contains(lower, "not found") || strings.Contains(lower, "manifest unknown") { - msg += "\n The registry has no such tag. Run 'alios doctor' to see which image this project resolves to." + msg += "\n The registry has no such tag. Run 'ingot doctor' to see which image this project resolves to." } else { - msg += "\n Run 'alios doctor' to check Docker, GitHub, and registry access." + msg += "\n Run 'ingot doctor' to check Docker, GitHub, and registry access." } return fmt.Errorf("%s", msg) } @@ -1000,17 +1000,17 @@ func (m *Manager) createContainer(project *Project) error { // Resolve the DNS container's live IP on the internal network rather than // relying on a hardcoded address that may belong to a different container. dnsServers := []string{"1.1.1.1", "8.8.8.8"} // fallback to public resolvers - if dnsIP, err := m.docker.GetContainerIP("alios_dns", networkConfig.BridgeName); err == nil && dnsIP != "" { + if dnsIP, err := m.docker.GetContainerIP("ingot_dns", networkConfig.BridgeName); err == nil && dnsIP != "" { dnsServers = []string{dnsIP, "1.1.1.1", "8.8.8.8"} } else { - fmt.Printf(utils.Colorize("[WARNING]", utils.ColorYellow)+" Warning: Could not resolve alios_dns IP (%v); falling back to public DNS. .test domains will not resolve.\n", err) + fmt.Printf(utils.Colorize("[WARNING]", utils.ColorYellow)+" Warning: Could not resolve ingot_dns IP (%v); falling back to public DNS. .test domains will not resolve.\n", err) } - // Inject the project's user env vars (`alios env set`) the same way + // Inject the project's user env vars (`ingot env set`) the same way // production supplies a site's config: plain KEY=VALUE env vars on the // container (see RunDockerContainer's buildEnvironmentVariables in the // Alios platform repo), just sourced from the container label instead of - // a database-backed setting. Alios's own infra vars are set after them + // a database-backed setting. Ingot's own infra vars are set after them // so they always win - mirrors production setting SERVER_ROOT last, // specifically so a stray env var can never silently override it (SetEnv // also rejects these keys up front). PORT matters beyond the prebuilt @@ -1042,17 +1042,17 @@ func (m *Manager) createContainer(project *Project) error { }, Environment: envVars, Labels: map[string]string{ - "alios.project.name": project.Name, - "alios.project.path": project.Path, - "alios.project.php_version": project.PHPVersion, - "alios.project.server_root": project.ServerRoot, - "alios.project.image_type": project.ImageType, - "alios.project.image_source": project.ImageSource, - "alios.project.image_url": project.ImageURL, - "alios.project.dockerfile_path": project.DockerfilePath, - "alios.project.build_context": project.BuildContext, - "alios.project.build_args": serializeBuildArgs(project.BuildArgs), - "alios.project.framework": project.Framework, + "ingot.project.name": project.Name, + "ingot.project.path": project.Path, + "ingot.project.php_version": project.PHPVersion, + "ingot.project.server_root": project.ServerRoot, + "ingot.project.image_type": project.ImageType, + "ingot.project.image_source": project.ImageSource, + "ingot.project.image_url": project.ImageURL, + "ingot.project.dockerfile_path": project.DockerfilePath, + "ingot.project.build_context": project.BuildContext, + "ingot.project.build_args": serializeBuildArgs(project.BuildArgs), + "ingot.project.framework": project.Framework, envLabel: serializeEnv(project.Env), idle.IdleLabel: project.Idle, }, @@ -1086,7 +1086,7 @@ func hostUser() string { // getContainerName returns the container name for a project func (m *Manager) getContainerName(projectName string) string { - return fmt.Sprintf("alios_php_%s", projectName) + return fmt.Sprintf("ingot_php_%s", projectName) } // ValidatePHPVersion checks if a PHP version is valid @@ -1107,16 +1107,16 @@ func GetAvailablePHPVersions() []string { // getRunningDatabases returns a list of currently running database services func (m *Manager) getRunningDatabases() ([]string, error) { - containers, err := m.docker.ListContainers("label=alios.service.type=database") + containers, err := m.docker.ListContainers("label=ingot.service.type=database") if err != nil { return nil, err } var databases []string for _, container := range containers { - // Extract database name from container name (alios_mysql -> mysql) - if strings.HasPrefix(container, "alios_") && !strings.Contains(container, "_caddy") && !strings.Contains(container, "_mailhog") { - dbName := strings.TrimPrefix(container, "alios_") + // Extract database name from container name (ingot_mysql -> mysql) + if strings.HasPrefix(container, "ingot_") && !strings.Contains(container, "_caddy") && !strings.Contains(container, "_mailhog") { + dbName := strings.TrimPrefix(container, "ingot_") databases = append(databases, dbName) } } diff --git a/internal/services/default_page.go b/internal/services/default_page.go index ac020aa..d48eacd 100644 --- a/internal/services/default_page.go +++ b/internal/services/default_page.go @@ -5,7 +5,7 @@ import _ "embed" // defaultPage is served by the reverse proxy's catch-all site for any host // that has no project vhost (a typo'd domain, or a project that was never // started) - the equivalent of the branded default server the old nginx -// image shipped. Compiled into the binary and written into the alios_vhosts +// image shipped. Compiled into the binary and written into the ingot_vhosts // volume on every global-services start, so it's a static asset, not a // config file on disk. // diff --git a/internal/services/default_page.html b/internal/services/default_page.html index b8cd118..47e3172 100644 --- a/internal/services/default_page.html +++ b/internal/services/default_page.html @@ -50,14 +50,13 @@ ); } - .alios-logo { + .ingot-logo { display: block; - width: 120px; margin: 0 auto 40px; - } - - #alios-dark { - display: none; + font: 600 28px/1 ui-monospace, SFMono-Regular, Menlo, monospace; + letter-spacing: -0.02em; + color: #000; + text-decoration: none; } h1 { @@ -104,11 +103,8 @@ rgba(0, 0, 0, 0) 100% ); } - #alios-dark { - display: block; - } - #alios-light { - display: none; + .ingot-logo { + color: #fff; } h1, b, @@ -121,17 +117,14 @@
-

No project here

Nothing is running at this address.

- To serve it, run alios start from the project's + To serve it, run ingot start from the project's directory.

diff --git a/internal/services/idle.go b/internal/services/idle.go index bfc2f36..d8a37b6 100644 --- a/internal/services/idle.go +++ b/internal/services/idle.go @@ -3,28 +3,28 @@ package services import ( "fmt" - "github.com/aliasproject/alios-cli/internal/config" - "github.com/aliasproject/alios-cli/internal/docker" + "github.com/aliasproject/ingot/internal/config" + "github.com/aliasproject/ingot/internal/docker" ) -// IdleContainer is the alios_idle service, which stops idle projects and -// wakes them on the next request (cmd/alios-idle, internal/idle). +// IdleContainer is the ingot_idle service, which stops idle projects and +// wakes them on the next request (cmd/ingot-idle, internal/idle). // // It's run with `docker run` rather than in the compose group: it's // optional, and compose aborts the whole `up` when one image can't be -// pulled, so an unpublished or unreachable alios-idle image would otherwise +// pulled, so an unpublished or unreachable ingot-idle image would otherwise // take every global service down with it. -const IdleContainer = "alios_idle" +const IdleContainer = "ingot_idle" -// idleTimeoutLabel records the ALIOS_IDLE_TIMEOUT the running service was +// idleTimeoutLabel records the INGOT_IDLE_TIMEOUT the running service was // started with, so status output can report the service's real setting // rather than whatever the current shell happens to have. -const idleTimeoutLabel = "alios.idle.timeout" +const idleTimeoutLabel = "ingot.idle.timeout" -// startIdle makes sure alios_idle is running the image this CLI expects. +// startIdle makes sure ingot_idle is running the image this CLI expects. // -// The timeout is only changed when ALIOS_IDLE_TIMEOUT is set in this -// shell. Global services also start implicitly (`alios start` calls +// The timeout is only changed when INGOT_IDLE_TIMEOUT is set in this +// shell. Global services also start implicitly (`ingot start` calls // EnsureRunning), and a terminal without the variable mustn't silently // reset a timeout chosen in another. func (m *Manager) startIdle() error { @@ -74,12 +74,12 @@ func (m *Manager) startIdle() error { // Docker Desktop maps this path to its VM's socket on macOS and // Windows too. Rootless Docker isn't supported yet. Volumes: []string{"/var/run/docker.sock:/var/run/docker.sock"}, - Environment: map[string]string{"ALIOS_IDLE_TIMEOUT": timeout}, + Environment: map[string]string{"INGOT_IDLE_TIMEOUT": timeout}, Labels: map[string]string{idleTimeoutLabel: timeout}, }) } -// StopIdle stops alios_idle if it's running and returns its name, so a pause +// StopIdle stops ingot_idle if it's running and returns its name, so a pause // can stop it before the projects (otherwise a request arriving mid-pause // wakes a project that was just stopped) and still resume it afterwards. func (m *Manager) StopIdle() []string { @@ -92,7 +92,7 @@ func (m *Manager) StopIdle() []string { return []string{IdleContainer} } -// IdleTimeoutSetting returns the ALIOS_IDLE_TIMEOUT alios_idle was started +// IdleTimeoutSetting returns the INGOT_IDLE_TIMEOUT ingot_idle was started // with ("" for its default), and whether the service is running. func (m *Manager) IdleTimeoutSetting() (string, bool) { info, err := m.docker.InspectContainer(IdleContainer) diff --git a/internal/services/manager.go b/internal/services/manager.go index 2b2d031..76d748d 100644 --- a/internal/services/manager.go +++ b/internal/services/manager.go @@ -2,15 +2,15 @@ package services import ( "fmt" - "github.com/aliasproject/alios-cli/internal/utils" + "github.com/aliasproject/ingot/internal/utils" "net" "strings" "sync" "time" - "github.com/aliasproject/alios-cli/internal/config" - "github.com/aliasproject/alios-cli/internal/docker" - "github.com/aliasproject/alios-cli/internal/ssl" + "github.com/aliasproject/ingot/internal/config" + "github.com/aliasproject/ingot/internal/docker" + "github.com/aliasproject/ingot/internal/ssl" ) // Manager handles global services operations @@ -22,7 +22,7 @@ type Manager struct { } // NewManager creates a new services manager. The SSL manager is needed -// because the reverse proxy's base Caddyfile loads the alios CA for its +// because the reverse proxy's base Caddyfile loads the ingot CA for its // catch-all site's on-demand certs, so the CA has to exist and be readable // before Caddy can start. func NewManager(dockerClient *docker.Client, sslManager *ssl.Manager) *Manager { @@ -44,7 +44,7 @@ type Service struct { } // baseCaddyfile is the reverse proxy's root config. Per-project vhosts are -// imported from the alios_vhosts volume; anything that doesn't match one of +// imported from the ingot_vhosts volume; anything that doesn't match one of // them falls through to the host-less catch-all sites, which serve the // branded default page with a 404 instead of a bare TLS or connection error. // Caddy always routes host-matched sites ahead of host-less ones, so the @@ -53,7 +53,7 @@ type Service struct { // TLS for unknown hosts: a static cert can't cover them - browsers (and // curl) reject a wildcard directly under a TLD like *.test - so the https:// // catch-all uses on-demand issuance from Caddy's internal CA, with that CA -// rooted at the same alios CA that signs every project cert (the pki block; +// rooted at the same ingot CA that signs every project cert (the pki block; // see ssl.Manager.PrepareCAForCaddy for the key permissions). Caddy mints an // exact cert for whatever host was requested at handshake time, chained to // a root the browser already trusts, so the 404 page loads with no warning. @@ -70,8 +70,8 @@ type Service struct { const baseCaddyfile = `{ skip_install_trust pki { - ca alios { - name "Alios Local CA" + ca ingot { + name "Ingot Local CA" root { cert /etc/caddy/ssl/` + ssl.CACertFile + ` key /etc/caddy/ssl/` + ssl.CAKeyFile + ` @@ -80,9 +80,9 @@ const baseCaddyfile = `{ } } -# Project vhosts end with "import alios_wake ". When the project's +# Project vhosts end with "import ingot_wake ". When the project's # container is stopped, Caddy can't reach it and the request goes to -# alios_idle instead, which starts the container and redirects the browser +# ingot_idle instead, which starts the container and redirects the browser # back to the same URL. Scoped to upstream failures so the app's own error # pages, and a share's basic-auth 401, pass through untouched. Defined before # the import below, since Caddy needs a snippet declared before it's used. @@ -91,26 +91,26 @@ const baseCaddyfile = `{ # is always asked with a bodiless GET; forwarding a POST would fail on the # closed body. The browser resends the original method and body itself, # because the waker answers with a 307. -(alios_wake) { +(ingot_wake) { handle_errors 502 503 504 { request_header -Content-Length request_header -Content-Type request_header -Transfer-Encoding reverse_proxy ` + IdleContainer + `:8080 { method GET - header_up X-Alios-Project {args[0]} + header_up X-Ingot-Project {args[0]} } } } -# "alios stop" swaps a vhost's alios_wake import for this one: a project -# stopped by hand stays down until "alios start", rather than being started +# "ingot stop" swaps a vhost's ingot_wake import for this one: a project +# stopped by hand stays down until "ingot start", rather than being started # by the next visit (a polling tab would otherwise undo the stop at once). -(alios_stopped) { +(ingot_stopped) { handle_errors 502 503 504 { header Content-Type "text/plain; charset=utf-8" header Cache-Control no-store - respond "{args[0]} is stopped. Run 'alios start' in the project to start it again." 503 + respond "{args[0]} is stopped. Run 'ingot start' in the project to start it again." 503 } } @@ -119,7 +119,7 @@ import /etc/caddy/*.caddyfile https:// { tls { issuer internal { - ca alios + ca ingot } on_demand } @@ -135,13 +135,13 @@ http:// { } ` -// GlobalServices defines the core global services. alios_idle isn't one of +// GlobalServices defines the core global services. ingot_idle isn't one of // them: it's optional (see idle.go), so a missing image never takes down // DNS, Caddy and every project with it. var GlobalServices = []string{ - "alios_dns", - "alios-reverse-proxy", // matches the name production uses for the same role - "alios_mail", + "ingot_dns", + "ingot_proxy", + "ingot_mail", } // Start starts all global services @@ -156,7 +156,7 @@ func (m *Manager) Start() error { } // The base Caddyfile's catch-all site (see baseCaddyfile) issues certs - // for unknown hosts from the alios CA, which Caddy loads at startup - so + // for unknown hosts from the ingot CA, which Caddy loads at startup - so // the CA has to exist and be readable before the container does. This // also creates the CA on a fresh install, so ordering against // ssl.SetupSSL doesn't matter. @@ -184,7 +184,7 @@ func (m *Manager) Start() error { // Caddy only reads /etc/caddy/Caddyfile at startup. If compose judged the // container unchanged and left it running (same image, same mounts), the // base Caddyfile just rewritten above is not yet live - e.g. right after - // an alios update that changed it - so reload explicitly. A no-op when + // an ingot update that changed it - so reload explicitly. A no-op when // the container was freshly created or the config is unchanged. if err := m.ssl.ReloadCaddy(); err != nil { fmt.Printf(utils.Colorize("[WARNING]", utils.ColorYellow)+" Warning: Failed to reload Caddy config: %v\n", err) @@ -200,15 +200,15 @@ func (m *Manager) Start() error { // WriteBaseConfig writes the base Caddyfile and the default page into the // vhosts volume. The published caddy image's own baked-in Caddyfile only // serves a landing page and has no knowledge of per-project vhosts; mounting -// alios_vhosts at /etc/caddy replaces that entirely, so this file must exist +// ingot_vhosts at /etc/caddy replaces that entirely, so this file must exist // in the volume (even empty of any project) or Caddy has nothing to run. // Rewritten on every start, and before `cert repair` rewrites vhosts, so it -// can't drift from what those vhosts expect (the alios_wake snippet). +// can't drift from what those vhosts expect (the ingot_wake snippet). func (m *Manager) WriteBaseConfig() error { - if err := m.docker.WriteFileToVolume("alios_vhosts", "default/index.html", defaultPage); err != nil { + if err := m.docker.WriteFileToVolume("ingot_vhosts", "default/index.html", defaultPage); err != nil { return fmt.Errorf("failed to write default page: %w", err) } - if err := m.docker.WriteFileToVolume("alios_vhosts", "Caddyfile", []byte(baseCaddyfile)); err != nil { + if err := m.docker.WriteFileToVolume("ingot_vhosts", "Caddyfile", []byte(baseCaddyfile)); err != nil { return fmt.Errorf("failed to write base Caddyfile: %w", err) } return nil @@ -269,12 +269,12 @@ func (m *Manager) Status() ([]*Service, error) { services := make([]*Service, 0) - // Check core services, plus the optional alios_idle so a stopped or + // Check core services, plus the optional ingot_idle so a stopped or // crashed one shows up in status rather than silently disabling scale // to zero. for _, containerName := range append(GlobalServices[:len(GlobalServices):len(GlobalServices)], IdleContainer) { - displayName := strings.TrimPrefix(containerName, "alios_") - if displayName == "alios-reverse-proxy" { + displayName := strings.TrimPrefix(containerName, "ingot_") + if displayName == "ingot_proxy" { displayName = "caddy" } service := &Service{ @@ -309,7 +309,7 @@ func (m *Manager) Status() ([]*Service, error) { databases := m.config.GetDatabases() for name := range databases { displayName := name - dbContainer := "alios_" + name + dbContainer := "ingot_" + name service := &Service{ Name: displayName, Container: dbContainer, @@ -383,8 +383,8 @@ func (m *Manager) waitForContainers(containers []string, timeout time.Duration) // ListManagedContainers enumerates every global-service container (dns, // the reverse proxy, mail, and any database): GlobalServices members by -// exact name, everything else (databases) by the "alios_" name prefix, -// excluding project containers ("alios_php_*"). Discovery is done by name +// exact name, everything else (databases) by the "ingot_" name prefix, +// excluding project containers ("ingot_php_*"). Discovery is done by name // rather than by label or in-process config because pause/resume run as // separate CLI invocations that don't share config.Config.Databases with // each other. @@ -394,8 +394,8 @@ func (m *Manager) ListManagedContainers() ([]string, error) { return nil, fmt.Errorf("failed to list containers: %w", err) } - // The reverse proxy uses production's own name (alios-reverse-proxy), - // not the alios_ prefix everything else here follows, so it wouldn't + // The reverse proxy uses production's own name (ingot_proxy), + // not the ingot_ prefix everything else here follows, so it wouldn't // match the prefix check below on its own - check GlobalServices // membership explicitly first so it's still tracked for pause/resume. globalServiceNames := make(map[string]bool, len(GlobalServices)) @@ -408,14 +408,14 @@ func (m *Manager) ListManagedContainers() ([]string, error) { if name == "" { continue } - // Share tunnels (alios_share, alios_share_) aren't global + // Share tunnels (ingot_share, ingot_share_) aren't global // services: restarting a quick tunnel gives it a new public URL, which // would leave its vhost pointing at a host nothing routes to. They're - // ended by `alios pause` and `alios share stop` instead. - if strings.HasPrefix(name, "alios_share") { + // ended by `ingot pause` and `ingot share stop` instead. + if strings.HasPrefix(name, "ingot_share") { continue } - if globalServiceNames[name] || (strings.HasPrefix(name, "alios_") && !strings.HasPrefix(name, "alios_php_")) { + if globalServiceNames[name] || (strings.HasPrefix(name, "ingot_") && !strings.HasPrefix(name, "ingot_php_")) { managed = append(managed, name) } } @@ -497,10 +497,10 @@ func (m *Manager) Resume(containerNames []string) error { func (m *Manager) generateComposeConfig(hostIP string) string { databases := m.config.GetDatabases() - compose := fmt.Sprintf(`name: alios + compose := fmt.Sprintf(`name: ingot services: dns: - container_name: alios_dns + container_name: ingot_dns image: ghcr.io/aliasproject/dns:latest restart: unless-stopped ports: @@ -514,7 +514,7 @@ services: - 8.8.8.8 caddy: - container_name: alios-reverse-proxy + container_name: ingot_proxy image: ghcr.io/aliasproject/caddy:2.10-alpine restart: unless-stopped volumes: @@ -529,7 +529,7 @@ services: - dns mail: - container_name: alios_mail + container_name: ingot_mail image: mailhog/mailhog:latest platform: linux/amd64 restart: on-failure @@ -545,7 +545,7 @@ services: if dbConfig.Type == "mysql" { compose += fmt.Sprintf(` %s: - container_name: alios_%s + container_name: ingot_%s image: mysql:%s platform: linux/amd64 restart: unless-stopped @@ -562,13 +562,13 @@ services: } else if dbConfig.Type == "postgresql" { compose += fmt.Sprintf(` %s: - container_name: alios_%s + container_name: ingot_%s image: postgres:%s restart: unless-stopped environment: - - POSTGRES_USER=alios - - POSTGRES_PASSWORD=alios - - POSTGRES_DB=alios + - POSTGRES_USER=ingot + - POSTGRES_PASSWORD=ingot + - POSTGRES_DB=ingot ports: - "%s:5432" networks: @@ -583,15 +583,15 @@ services: compose += ` volumes: certs: - name: alios_certs + name: ingot_certs vhosts: - name: alios_vhosts` + name: ingot_vhosts` // Add volumes for each database for name, dbConfig := range databases { compose += fmt.Sprintf(` %s-%s: - name: alios_%s-%s`, name, dbConfig.Version, name, dbConfig.Version) + name: ingot_%s-%s`, name, dbConfig.Version, name, dbConfig.Version) } // Add networks @@ -632,7 +632,7 @@ func (m *Manager) AddDatabase(name, dbType, version string) error { } // Create volume - volumeName := fmt.Sprintf("alios_%s-%s", name, version) + volumeName := fmt.Sprintf("ingot_%s-%s", name, version) if err := m.docker.CreateVolume(volumeName); err != nil { m.mu.Unlock() return fmt.Errorf("failed to create volume: %w", err) @@ -718,7 +718,7 @@ func (m *Manager) GetDatabases() ([]*Service, error) { databases := m.config.GetDatabases() for name, dbConfig := range databases { - container := "alios_" + name + container := "ingot_" + name service := &Service{ Name: name, diff --git a/internal/share/manager.go b/internal/share/manager.go index 1bc4920..e00264e 100644 --- a/internal/share/manager.go +++ b/internal/share/manager.go @@ -1,19 +1,19 @@ // Package share exposes running projects to the internet through Cloudflare -// Tunnels (alios share). +// Tunnels (ingot share). // -// Traffic path: cloudflared (a container on alios_internal) -> Caddy -// (http://alios-reverse-proxy:80) -> alios_php_:80. Each share is one -// .share.caddyfile vhost in the alios_vhosts volume, matched on the +// Traffic path: cloudflared (a container on ingot_internal) -> Caddy +// (http://ingot_proxy:80) -> ingot_php_:80. Each share is one +// .share.caddyfile vhost in the ingot_vhosts volume, matched on the // exact public hostname so it wins over the base Caddyfile's http:// redirect // catch-all. That vhost file is the only record of a share: status, list and // stop all read it back, so there's no other state to keep in sync. // // Two modes: -// - quick (default): one alios_share_ container running a +// - quick (default): one ingot_share_ container running a // trycloudflare.com quick tunnel. No account needed; the URL is random and // changes every time the tunnel starts. -// - named (ALIOS_SHARE_TUNNEL_TOKEN + ALIOS_SHARE_DOMAIN): one shared -// alios_share container running a remotely-managed tunnel whose +// - named (INGOT_SHARE_TUNNEL_TOKEN + INGOT_SHARE_DOMAIN): one shared +// ingot_share container running a remotely-managed tunnel whose // `*.` public hostname points at Caddy, giving each project a // stable https://. URL. package share @@ -28,9 +28,9 @@ import ( "strings" "time" - "github.com/aliasproject/alios-cli/internal/config" - "github.com/aliasproject/alios-cli/internal/docker" - "github.com/aliasproject/alios-cli/internal/ssl" + "github.com/aliasproject/ingot/internal/config" + "github.com/aliasproject/ingot/internal/docker" + "github.com/aliasproject/ingot/internal/ssl" ) const ( @@ -39,19 +39,19 @@ const ( Image = "cloudflare/cloudflared:2026.9.3" // NamedContainer is the single shared container used in named mode. - NamedContainer = "alios_share" + NamedContainer = "ingot_share" // ModeQuick and ModeNamed identify how a share is tunnelled. ModeQuick = "quick" ModeNamed = "named" - vhostVolume = "alios_vhosts" + vhostVolume = "ingot_vhosts" vhostSuffix = ".share.caddyfile" - proxyContainer = "alios-reverse-proxy" + proxyContainer = "ingot_proxy" proxyOrigin = "http://" + proxyContainer + ":80" - projectLabel = "alios.share.project" - modeLabel = "alios.share.mode" - tokenLabel = "alios.share.token_sha256" + projectLabel = "ingot.share.project" + modeLabel = "ingot.share.mode" + tokenLabel = "ingot.share.token_sha256" quickURLTimeout = 30 * time.Second ) @@ -109,7 +109,7 @@ func NewManager(dockerClient *docker.Client, cfg *config.Config, sslManager *ssl // QuickContainer is the tunnel container name for a quick-mode share. func QuickContainer(projectName string) string { - return "alios_share_" + projectName + return "ingot_share_" + projectName } // Get returns the project's active share, or nil if it isn't shared. @@ -174,7 +174,7 @@ func (m *Manager) Start(projectName string, auth *Credentials) (share *Share, st } if !m.docker.IsContainerRunning(proxyContainer) { - return nil, false, fmt.Errorf("reverse proxy is not running. Run 'alios global start' first") + return nil, false, fmt.Errorf("reverse proxy is not running. Run 'ingot global start' first") } // Hash before starting a tunnel so a bad password never leaves a @@ -242,7 +242,7 @@ func (m *Manager) Stop(projectName string) (bool, error) { // stay public. Report that rather than claiming the share ended. if err := m.reloadCaddy(); err != nil { m.teardownTunnel(projectName, share.Mode) - return false, fmt.Errorf("removed the share vhost but Caddy failed to reload, so it may still be served; run 'alios global restart': %w", err) + return false, fmt.Errorf("removed the share vhost but Caddy failed to reload, so it may still be served; run 'ingot global restart': %w", err) } } @@ -390,7 +390,7 @@ func (m *Manager) startQuickTunnel(projectName string) (string, error) { } // ensureNamedTunnel makes sure the shared named-tunnel container is running. -// A container started with a different ALIOS_SHARE_TUNNEL_TOKEN (rotated +// A container started with a different INGOT_SHARE_TUNNEL_TOKEN (rotated // since) is replaced rather than reused. func (m *Manager) ensureNamedTunnel() error { fingerprint := tokenFingerprint(m.config.ShareTunnelToken) @@ -437,7 +437,7 @@ func (m *Manager) checkNamedTunnelUp() error { if !m.docker.IsContainerRunning(NamedContainer) { logs, _ := m.docker.RunWithOutput("logs", NamedContainer) m.docker.RemoveContainer(NamedContainer, true) - return fmt.Errorf("named tunnel exited on startup (check ALIOS_SHARE_TUNNEL_TOKEN). Last output:\n%s", lastLines(logs, 10)) + return fmt.Errorf("named tunnel exited on startup (check INGOT_SHARE_TUNNEL_TOKEN). Last output:\n%s", lastLines(logs, 10)) } return nil @@ -466,9 +466,9 @@ func (m *Manager) teardownTunnel(projectName, mode string) { } func (m *Manager) writeVhost(projectName, host, mode, authLine string) error { - vhost := fmt.Sprintf(`# alios share: mode=%s + vhost := fmt.Sprintf(`# ingot share: mode=%s http://%s { -%s reverse_proxy alios_php_%s:80 { +%s reverse_proxy ingot_php_%s:80 { header_up Host {host} header_up X-Forwarded-Host {host} header_up X-Forwarded-Proto https @@ -476,12 +476,12 @@ http://%s { header_up X-Forwarded-For {header.Cf-Connecting-Ip} # Tells the image or app that the request came through a share. # Set here, so visitors can't forge or strip it. - header_up X-Alios-Share 1 + header_up X-Ingot-Share 1 } # Wakes the project if it's asleep. The snippet only handles upstream # failures, so basic_auth's 401 and its challenge pass through. - import alios_wake %s + import ingot_wake %s } `, mode, host, authLine, projectName, projectName) @@ -508,7 +508,7 @@ func (m *Manager) reloadCaddy() error { } // hashPassword bcrypt-hashes a basic-auth password with Caddy's own tool, so -// alios doesn't need a bcrypt dependency. +// ingot doesn't need a bcrypt dependency. func (m *Manager) hashPassword(password string) (string, error) { // Sent on stdin rather than --plaintext, so it never shows in `ps`. output, err := m.docker.RunWithInput(password+"\n", "exec", "-i", proxyContainer, "caddy", "hash-password") @@ -529,7 +529,7 @@ func parseVhost(projectName, content string) *Share { for _, line := range strings.Split(content, "\n") { line = strings.TrimSpace(line) switch { - case strings.HasPrefix(line, "# alios share:") && strings.Contains(line, "mode="+ModeNamed): + case strings.HasPrefix(line, "# ingot share:") && strings.Contains(line, "mode="+ModeNamed): share.Mode = ModeNamed case strings.HasPrefix(line, "http://") && share.URL == "": host := strings.TrimSpace(strings.TrimSuffix(strings.TrimPrefix(line, "http://"), "{")) diff --git a/internal/ssl/manager.go b/internal/ssl/manager.go index 67d5c3d..fbe37b6 100644 --- a/internal/ssl/manager.go +++ b/internal/ssl/manager.go @@ -2,15 +2,15 @@ package ssl import ( "fmt" - "github.com/aliasproject/alios-cli/internal/utils" + "github.com/aliasproject/ingot/internal/utils" "os" "os/exec" "path/filepath" "runtime" "strings" - "github.com/aliasproject/alios-cli/internal/config" - "github.com/aliasproject/alios-cli/internal/docker" + "github.com/aliasproject/ingot/internal/config" + "github.com/aliasproject/ingot/internal/docker" ) // Manager handles SSL certificate operations @@ -32,7 +32,7 @@ func (m *Manager) SetupSSL() error { fmt.Println("🔒 Setting up SSL certificates...") // Create certificates volume - if err := m.docker.CreateVolume("alios_certs"); err != nil { + if err := m.docker.CreateVolume("ingot_certs"); err != nil { return fmt.Errorf("failed to create certificates volume: %w", err) } @@ -51,7 +51,7 @@ func (m *Manager) SetupSSL() error { return nil } -// CACertFile and CAKeyFile are the CA's filenames inside the alios_certs +// CACertFile and CAKeyFile are the CA's filenames inside the ingot_certs // volume, as written by the openssl image's entrypoint. const ( CACertFile = "AliasProjectCASelfSigned.pem" @@ -73,7 +73,7 @@ func (m *Manager) PrepareCAForCaddy() error { } } return m.docker.Run("run", "--rm", - "-v", "alios_certs:/certificates", + "-v", "ingot_certs:/certificates", "alpine:latest", "sh", "-c", "chgrp 0 /certificates/"+CAKeyFile+" && chmod 640 /certificates/"+CAKeyFile, ) @@ -87,21 +87,21 @@ func (m *Manager) SetupProjectSSL(projectName string) error { // Check if CA certificate exists first if !m.caExistsInVolume() { - return fmt.Errorf("CA certificate not found. Run 'alios cert install' first") + return fmt.Errorf("CA certificate not found. Run 'ingot cert install' first") } // Check if Caddy is running - if !m.docker.ContainerExists("alios-reverse-proxy") { - return fmt.Errorf("Caddy container not found. Run 'alios global start' first") + if !m.docker.ContainerExists("ingot_proxy") { + return fmt.Errorf("Caddy container not found. Run 'ingot global start' first") } // Check Caddy container is actually running - info, err := m.docker.InspectContainer("alios-reverse-proxy") + info, err := m.docker.InspectContainer("ingot_proxy") if err != nil { return fmt.Errorf("failed to inspect Caddy container: %w", err) } if info.State != "running" { - return fmt.Errorf("Caddy container is not running. Run 'alios global start' first") + return fmt.Errorf("Caddy container is not running. Run 'ingot global start' first") } // Generate certificate for domain @@ -115,8 +115,8 @@ func (m *Manager) SetupProjectSSL(projectName string) error { } // Create Caddy vhost configuration - // Called by `alios start`, so the project wakes on visits again even if - // it was stopped with `alios stop`. + // Called by `ingot start`, so the project wakes on visits again even if + // it was stopped with `ingot stop`. if err := m.createCaddyVhost(projectName, domain, false); err != nil { return fmt.Errorf("failed to create Caddy vhost: %w", err) } @@ -140,10 +140,10 @@ func (m *Manager) SetupProjectSSL(projectName string) error { // successfully; per-project failures are collected but do not stop the rest. func (m *Manager) RepairVhosts(projectNames []string) (int, error) { if !m.caExistsInVolume() { - return 0, fmt.Errorf("CA certificate not found. Run 'alios cert install' first") + return 0, fmt.Errorf("CA certificate not found. Run 'ingot cert install' first") } - // Keep projects stopped with `alios stop` stopped: a repair only fixes + // Keep projects stopped with `ingot stop` stopped: a repair only fixes // configuration, it shouldn't make a visit start them again. stopped, err := m.StoppedProjects() if err != nil { @@ -188,7 +188,7 @@ func (m *Manager) RepairVhosts(projectNames []string) (int, error) { // changes even if it's currently crash-looping (unlike reloadCaddy, which // requires Caddy to already be in a running state to accept `docker exec`). func (m *Manager) RestartCaddy() error { - return m.docker.Run("restart", "alios-reverse-proxy") + return m.docker.Run("restart", "ingot_proxy") } // ReloadCaddy makes the running reverse proxy re-read /etc/caddy/Caddyfile @@ -201,13 +201,13 @@ func (m *Manager) ReloadCaddy() error { func (m *Manager) RemoveProjectSSL(projectName string) error { domain := projectName + ".test" - // Remove certificate files directly from alios_certs volume. Includes + // Remove certificate files directly from ingot_certs volume. Includes // .csr alongside .crt/.key: the openssl image only (re)generates each of // key/csr/crt when that specific file is missing, so leaving a stale // .csr behind means a future generation reuses it as-is - signing it // produces a .crt that doesn't match the freshly generated .key. // This works regardless of Caddy container state - if err := m.docker.Run("run", "--rm", "-v", "alios_certs:/certs", "alpine:latest", + if err := m.docker.Run("run", "--rm", "-v", "ingot_certs:/certs", "alpine:latest", "sh", "-c", fmt.Sprintf("rm -f /certs/%s.crt /certs/%s.key /certs/%s.csr", domain, domain, domain)); err != nil { fmt.Printf(utils.Colorize("[WARNING]", utils.ColorYellow)+" Warning: Failed to remove certificate files: %v\n", err) } @@ -222,15 +222,15 @@ func (m *Manager) RemoveProjectSSL(projectName string) error { // RemoveProjectVhost removes the Caddy vhost configuration for a project func (m *Manager) RemoveProjectVhost(projectName string) error { - // Remove vhost file directly from alios_vhosts volume + // Remove vhost file directly from ingot_vhosts volume // This works regardless of Caddy container state - if err := m.docker.Run("run", "--rm", "-v", "alios_vhosts:/vhosts", "alpine:latest", + if err := m.docker.Run("run", "--rm", "-v", "ingot_vhosts:/vhosts", "alpine:latest", "rm", "-f", fmt.Sprintf("/vhosts/%s.caddyfile", projectName)); err != nil { fmt.Printf(utils.Colorize("[WARNING]", utils.ColorYellow)+" Warning: Failed to remove vhost configuration: %v\n", err) } // Reload Caddy to apply configuration changes if it's running - if m.docker.ContainerExists("alios-reverse-proxy") && m.docker.IsContainerRunning("alios-reverse-proxy") { + if m.docker.ContainerExists("ingot_proxy") && m.docker.IsContainerRunning("ingot_proxy") { if err := m.reloadCaddy(); err != nil { fmt.Printf(utils.Colorize("[WARNING]", utils.ColorYellow)+" Warning: Failed to reload Caddy: %v\n", err) } @@ -241,10 +241,10 @@ func (m *Manager) RemoveProjectVhost(projectName string) error { // updateVhostToHTTP updates a project's vhost configuration to use HTTP instead of HTTPS func (m *Manager) updateVhostToHTTP(projectName string) error { - // Keep an `alios stop`: removing the certificate shouldn't make a visit + // Keep an `ingot stop`: removing the certificate shouldn't make a visit // start the project again. ending := wakeImport - if current, err := m.docker.ReadFileFromVolume("alios_vhosts", projectName+".caddyfile"); err == nil && + if current, err := m.docker.ReadFileFromVolume("ingot_vhosts", projectName+".caddyfile"); err == nil && strings.Contains(current, stoppedImport+projectName) { ending = stoppedImport } @@ -253,7 +253,7 @@ func (m *Manager) updateVhostToHTTP(projectName string) error { // this site block in plaintext instead of attempting automatic HTTPS (which // can't work for .test domains anyway; see createCaddyVhost). httpVhostConfig := fmt.Sprintf(`http://%s.test { - reverse_proxy alios_php_%s:80 { + reverse_proxy ingot_php_%s:80 { header_up Host {host} header_up X-Real-IP {remote} header_up X-Forwarded-For {remote} @@ -264,12 +264,12 @@ func (m *Manager) updateVhostToHTTP(projectName string) error { `, projectName, projectName, projectName) // Write HTTP vhost configuration to volume - if err := m.docker.WriteFileToVolume("alios_vhosts", projectName+".caddyfile", []byte(httpVhostConfig)); err != nil { + if err := m.docker.WriteFileToVolume("ingot_vhosts", projectName+".caddyfile", []byte(httpVhostConfig)); err != nil { return fmt.Errorf("failed to write HTTP vhost configuration: %w", err) } // Reload Caddy to apply configuration changes if it's running - if m.docker.ContainerExists("alios-reverse-proxy") && m.docker.IsContainerRunning("alios-reverse-proxy") { + if m.docker.ContainerExists("ingot_proxy") && m.docker.IsContainerRunning("ingot_proxy") { if err := m.reloadCaddy(); err != nil { fmt.Printf(utils.Colorize("[WARNING]", utils.ColorYellow)+" Warning: Failed to reload Caddy: %v\n", err) } @@ -283,7 +283,7 @@ func (m *Manager) GenerateCertificate(domain string) error { // Run openssl container to generate certificate with output cmd := exec.Command("docker", "run", "--rm", "-e", "DOMAIN="+domain, - "-v", "alios_certs:/certificates", + "-v", "ingot_certs:/certificates", "ghcr.io/aliasproject/openssl:latest") output, err := cmd.CombinedOutput() @@ -305,7 +305,7 @@ func (m *Manager) GenerateCertificate(domain string) error { // all when loading the tls directive. func (m *Manager) fixCertPermissions(domain string) error { return m.docker.Run("run", "--rm", - "-v", "alios_certs:/certificates", + "-v", "ingot_certs:/certificates", "alpine:latest", "sh", "-c", fmt.Sprintf("chgrp 0 /certificates/%s.key && chmod 640 /certificates/%s.key", domain, domain), ) @@ -314,7 +314,7 @@ func (m *Manager) fixCertPermissions(domain string) error { // InstallCertificate installs the CA certificate to the system func (m *Manager) InstallCertificate() error { // Create temporary file for CA certificate - tmpFile, err := os.CreateTemp("", "alios-ca-*.pem") + tmpFile, err := os.CreateTemp("", "ingot-ca-*.pem") if err != nil { return fmt.Errorf("failed to create temp file: %w", err) } @@ -359,7 +359,7 @@ func (m *Manager) VerifyCertificate() error { fmt.Println(utils.Colorize("[SUCCESS]", utils.ColorGreen) + " CA certificate is installed in the system") } else { fmt.Println(utils.Colorize("[ERROR]", utils.ColorRed) + " CA certificate is not installed") - fmt.Println("Run 'alios cert install' to install it") + fmt.Println("Run 'ingot cert install' to install it") } // System trust (checked above) doesn't imply Chrome/Firefox trust it too @@ -372,7 +372,7 @@ func (m *Manager) VerifyCertificate() error { fmt.Println(utils.Colorize("[SUCCESS]", utils.ColorGreen) + " CA certificate is trusted by Chrome/Chromium (NSS)") } else { fmt.Println(utils.Colorize("[ERROR]", utils.ColorRed) + " CA certificate is not trusted by Chrome/Chromium (NSS) - it may still show as untrusted in the browser even though the system trusts it") - fmt.Println("Run 'alios cert install' to fix it") + fmt.Println("Run 'ingot cert install' to fix it") } } @@ -381,7 +381,7 @@ func (m *Manager) VerifyCertificate() error { fmt.Println(utils.Colorize("[SUCCESS]", utils.ColorGreen) + " CA certificate exists in Docker volume") } else { fmt.Println(utils.Colorize("[ERROR]", utils.ColorRed) + " CA certificate not found in Docker volume") - fmt.Println("Run 'alios global start' to generate it") + fmt.Println("Run 'ingot global start' to generate it") } return nil @@ -419,11 +419,11 @@ func (m *Manager) DebugCertificate() error { // Check Caddy container fmt.Println("\nCaddy Container:") - if m.docker.IsContainerRunning("alios-reverse-proxy") { + if m.docker.IsContainerRunning("ingot_proxy") { fmt.Println(" [SUCCESS] Running") // List certificates in Caddy - output, err := m.docker.RunWithOutput("exec", "alios-reverse-proxy", "ls", "-la", "/etc/caddy/ssl/") + output, err := m.docker.RunWithOutput("exec", "ingot_proxy", "ls", "-la", "/etc/caddy/ssl/") if err == nil { fmt.Println(" Certificates:") lines := strings.Split(output, "\n") @@ -452,7 +452,7 @@ func (m *Manager) CAExists() bool { // caExistsInVolume checks if CA certificate exists in volume func (m *Manager) caExistsInVolume() bool { err := m.docker.Run("run", "--rm", - "-v", "alios_certs:/certificates", + "-v", "ingot_certs:/certificates", "alpine:latest", "test", "-f", "/certificates/AliasProjectCASelfSigned.pem", ) @@ -463,13 +463,13 @@ func (m *Manager) caExistsInVolume() bool { func (m *Manager) certificateExists(domain string) bool { // Check for both certificate and key certCheck := m.docker.Run("run", "--rm", - "-v", "alios_certs:/certificates", + "-v", "ingot_certs:/certificates", "alpine:latest", "test", "-f", fmt.Sprintf("/certificates/%s.crt", domain), ) keyCheck := m.docker.Run("run", "--rm", - "-v", "alios_certs:/certificates", + "-v", "ingot_certs:/certificates", "alpine:latest", "test", "-f", fmt.Sprintf("/certificates/%s.key", domain), ) @@ -480,7 +480,7 @@ func (m *Manager) certificateExists(domain string) bool { func (m *Manager) generateCA() error { return m.docker.Run("run", "--rm", "-e", "DOMAIN=init", - "-v", "alios_certs:/certificates", + "-v", "ingot_certs:/certificates", "ghcr.io/aliasproject/openssl:latest", ) } @@ -489,7 +489,7 @@ func (m *Manager) generateCA() error { func (m *Manager) copyCAToTempFile(tmpPath string) error { // Copy CA from volume to temporary file return m.docker.Run("run", "--rm", - "-v", "alios_certs:/source", + "-v", "ingot_certs:/source", "-v", filepath.Dir(tmpPath)+":/dest", "alpine:latest", "cp", "/source/AliasProjectCASelfSigned.pem", "/dest/"+filepath.Base(tmpPath), @@ -514,7 +514,7 @@ func (m *Manager) createCaddyVhost(projectName, domain string, stopped bool) err vhostConfig := fmt.Sprintf(`%s { tls /etc/caddy/ssl/%s.crt /etc/caddy/ssl/%s.key - reverse_proxy alios_php_%s:80 { + reverse_proxy ingot_php_%s:80 { header_up Host {host} header_up X-Real-IP {remote} header_up X-Forwarded-For {remote} @@ -525,30 +525,30 @@ func (m *Manager) createCaddyVhost(projectName, domain string, stopped bool) err } `, domain, domain, domain, projectName, projectName) - // Write directly to the alios_vhosts volume rather than docker exec-ing into + // Write directly to the ingot_vhosts volume rather than docker exec-ing into // the Caddy container, so vhosts can be written/repaired even when Caddy isn't // currently running (e.g. it's down because a stale vhost is crash-looping it). // The volume is mounted at /etc/caddy in the Caddy container (see // services.Manager.generateComposeConfig), alongside the base Caddyfile that // imports every *.caddyfile written here. - return m.docker.WriteFileToVolume("alios_vhosts", projectName+".caddyfile", []byte(vhostConfig)) + return m.docker.WriteFileToVolume("ingot_vhosts", projectName+".caddyfile", []byte(vhostConfig)) } // Each project vhost ends with exactly one of these lines; see the -// alios_wake and alios_stopped snippets in services.baseCaddyfile. +// ingot_wake and ingot_stopped snippets in services.baseCaddyfile. const ( - wakeImport = "import alios_wake " - stoppedImport = "import alios_stopped " + wakeImport = "import ingot_wake " + stoppedImport = "import ingot_stopped " ) // SetProjectStopped switches a project's vhost between waking it on a visit -// (asleep) and answering that it's stopped (stopped with `alios stop`). The +// (asleep) and answering that it's stopped (stopped with `ingot stop`). The // vhost is the record of which: like a share, it's routing state that lives // where Caddy reads it, with no label or file of its own. A project without // a vhost, or with one from before scale to zero, is left alone. func (m *Manager) SetProjectStopped(projectName string, stopped bool) error { file := projectName + ".caddyfile" - content, err := m.docker.ReadFileFromVolume("alios_vhosts", file) + content, err := m.docker.ReadFileFromVolume("ingot_vhosts", file) if err == docker.ErrFileNotFound { return nil } @@ -560,22 +560,22 @@ func (m *Manager) SetProjectStopped(projectName string, stopped bool) error { if !changed { return nil } - if err := m.docker.WriteFileToVolume("alios_vhosts", file, []byte(updated)); err != nil { + if err := m.docker.WriteFileToVolume("ingot_vhosts", file, []byte(updated)); err != nil { return err } - if m.docker.IsContainerRunning("alios-reverse-proxy") { + if m.docker.IsContainerRunning("ingot_proxy") { if err := m.reloadCaddy(); err != nil { // Caddy keeps its old config, but the file it would load on // its next start is the one it just rejected: put it back. - m.docker.WriteFileToVolume("alios_vhosts", file, []byte(content+"\n")) + m.docker.WriteFileToVolume("ingot_vhosts", file, []byte(content+"\n")) return fmt.Errorf("Caddy rejected the change: %w", err) } } return nil } -// swapVhostEnding switches a vhost's final import between alios_wake and -// alios_stopped. It matches the whole line, so a vhost that merely mentions +// swapVhostEnding switches a vhost's final import between ingot_wake and +// ingot_stopped. It matches the whole line, so a vhost that merely mentions // another project whose name starts with this one's can't be changed. func swapVhostEnding(content, projectName string, stopped bool) (string, bool) { from, to := wakeImport+projectName, stoppedImport+projectName @@ -592,10 +592,10 @@ func swapVhostEnding(content, projectName string, stopped bool) (string, bool) { return content, false } -// StoppedProjects returns the projects stopped with `alios stop`, read from +// StoppedProjects returns the projects stopped with `ingot stop`, read from // every vhost with one throwaway container. func (m *Manager) StoppedProjects() (map[string]bool, error) { - output, err := m.docker.RunWithOutput("run", "--rm", "-v", "alios_vhosts:/vhosts:ro", "alpine:latest", + output, err := m.docker.RunWithOutput("run", "--rm", "-v", "ingot_vhosts:/vhosts:ro", "alpine:latest", "sh", "-c", "cd /vhosts && grep -l '"+strings.TrimSpace(stoppedImport)+"' *.caddyfile 2>/dev/null; true") if err != nil { return nil, err @@ -611,7 +611,7 @@ func (m *Manager) StoppedProjects() (map[string]bool, error) { } func (m *Manager) reloadCaddy() error { - return m.docker.Run("exec", "alios-reverse-proxy", "caddy", "reload", "--config", "/etc/caddy/Caddyfile") + return m.docker.Run("exec", "ingot_proxy", "caddy", "reload", "--config", "/etc/caddy/Caddyfile") } func (m *Manager) installCertMacOS(caPath string) error { @@ -662,7 +662,7 @@ func (m *Manager) installCertLinux(caPath string) error { } } else { // Copy to system certificate store - destPath := "/usr/local/share/ca-certificates/alios-ca.crt" + destPath := "/usr/local/share/ca-certificates/ingot-ca.crt" cmd := exec.Command("sudo", "cp", caPath, destPath) if err := cmd.Run(); err != nil { @@ -765,9 +765,9 @@ func (m *Manager) installCertWindows(caPath string) error { // IsCertificateInstalled reports whether the CA certificate is trusted on // this host - distinct from CAExists, which only checks that the CA file -// has been generated into the alios_certs volume. A CA can exist without +// has been generated into the ingot_certs volume. A CA can exist without // being trusted (e.g. the user declined the install prompt, or a prior -// `alios install` was interrupted between generating it and trusting it), +// `ingot install` was interrupted between generating it and trusting it), // in which case every certificate it signs still shows as untrusted in the // browser even though every other setup step succeeded. func (m *Manager) IsCertificateInstalled() bool { @@ -784,7 +784,7 @@ func (m *Manager) IsCertificateInstalled() bool { if _, err := exec.LookPath("trust"); err == nil { return m.isCertificateInstalledViaTrust() } - return fileExists("/usr/local/share/ca-certificates/alios-ca.crt") + return fileExists("/usr/local/share/ca-certificates/ingot-ca.crt") case "windows": cmd := exec.Command("powershell", "-Command", "Get-ChildItem -Path Cert:\\LocalMachine\\Root | Where-Object { $_.Subject -like '*AliasProjectCASelfSigned*' }") @@ -814,7 +814,7 @@ func (m *Manager) isCertificateInstalledViaTrust() bool { // consults. See installCertIntoNSSDatabases for why the two can disagree. // ChromeNSSDBStatus reports whether Chrome/Chromium's per-user NSS database // exists on this machine (Linux only; needs certutil to inspect) and, if so, -// whether the alios CA is in it. Chrome on Linux trusts this database, not +// whether the ingot CA is in it. Chrome on Linux trusts this database, not // the system anchor store, so `cert verify` passing is not enough for it. // // Returns present=false when there is no database to check (non-Linux, or @@ -839,7 +839,7 @@ func (m *Manager) ChromeNSSDBStatus() (present bool, checkable bool, installed b } // CertificateExists reports whether a per-domain cert and key exist in the -// alios_certs volume. +// ingot_certs volume. func (m *Manager) CertificateExists(domain string) bool { return m.certificateExists(domain) } @@ -869,7 +869,7 @@ func (m *Manager) showSystemCertificateInfo() { case "linux": if _, err := exec.LookPath("trust"); err == nil && m.isCertificateInstalledViaTrust() { fmt.Println(" Location: p11-kit trust store (trust anchor)") - } else if fileExists("/usr/local/share/ca-certificates/alios-ca.crt") { + } else if fileExists("/usr/local/share/ca-certificates/ingot-ca.crt") { fmt.Println(" Location: /usr/local/share/ca-certificates/") } case "windows": diff --git a/internal/ssl/vhost_test.go b/internal/ssl/vhost_test.go index eb13e2e..9af51e6 100644 --- a/internal/ssl/vhost_test.go +++ b/internal/ssl/vhost_test.go @@ -5,11 +5,11 @@ import ( "testing" ) -const shopVhost = "shop.test {\n reverse_proxy alios_php_shop:80\n\n import alios_wake shop\n}\n" +const shopVhost = "shop.test {\n reverse_proxy ingot_php_shop:80\n\n import ingot_wake shop\n}\n" func TestSwapVhostEnding(t *testing.T) { stopped, changed := swapVhostEnding(shopVhost, "shop", true) - if !changed || !strings.Contains(stopped, " import alios_stopped shop\n") || strings.Contains(stopped, "alios_wake") { + if !changed || !strings.Contains(stopped, " import ingot_stopped shop\n") || strings.Contains(stopped, "ingot_wake") { t.Fatalf("stop: changed=%v\n%s", changed, stopped) } back, changed := swapVhostEnding(stopped, "shop", false) @@ -27,7 +27,7 @@ func TestSwapVhostEndingMatchesWholeLine(t *testing.T) { t.Fatalf("prefix project changed another vhost:\n%s", out) } // A vhost from before scale to zero has neither import; leave it alone. - old := "shop.test {\n reverse_proxy alios_php_shop:80\n}\n" + old := "shop.test {\n reverse_proxy ingot_php_shop:80\n}\n" if _, changed := swapVhostEnding(old, "shop", true); changed { t.Fatal("pre-scale-to-zero vhost was changed") } diff --git a/internal/state/state.go b/internal/state/state.go index 657121f..7e6c26e 100644 --- a/internal/state/state.go +++ b/internal/state/state.go @@ -7,18 +7,18 @@ import ( "encoding/json" "time" - "github.com/aliasproject/alios-cli/internal/docker" + "github.com/aliasproject/ingot/internal/docker" ) const ( - // VolumeName is the Docker volume used to store alios runtime state. - VolumeName = "alios_state" + // VolumeName is the Docker volume used to store ingot runtime state. + VolumeName = "ingot_state" // PauseFile is the file within VolumeName holding the pause snapshot. PauseFile = "pause-state.json" ) -// PauseState records which containers were running at the moment `alios pause` ran. +// PauseState records which containers were running at the moment `ingot pause` ran. type PauseState struct { PausedAt time.Time `json:"paused_at"` Services []string `json:"services"` diff --git a/internal/updater/updater.go b/internal/updater/updater.go index 571ca0d..7fa0966 100644 --- a/internal/updater/updater.go +++ b/internal/updater/updater.go @@ -5,7 +5,7 @@ import ( "encoding/hex" "encoding/json" "fmt" - "github.com/aliasproject/alios-cli/internal/utils" + "github.com/aliasproject/ingot/internal/utils" "io" "net/http" "os" @@ -15,7 +15,7 @@ import ( "strings" "time" - "github.com/aliasproject/alios-cli/internal/config" + "github.com/aliasproject/ingot/internal/config" ) // Release contains minimal update information @@ -60,9 +60,9 @@ type Updater struct { // New creates a new updater instance func New() *Updater { // Get GitHub configuration - githubRepo := os.Getenv("ALIOS_GITHUB_REPO") + githubRepo := os.Getenv("INGOT_GITHUB_REPO") if githubRepo == "" { - githubRepo = "aliasproject/alios-cli" // default repo + githubRepo = "aliasproject/ingot" // default repo } return &Updater{ @@ -246,9 +246,9 @@ func (u *Updater) detectPlatformFromAssetName(filename string) string { return "windows_amd64" } - // If filename is just "alios" or similar generic name, return empty + // If filename is just "ingot" or similar generic name, return empty // The caller will handle this case by using it as fallback for current platform - if filename == "alios" || filename == original { + if filename == "ingot" || filename == original { return "" } @@ -258,7 +258,7 @@ func (u *Updater) detectPlatformFromAssetName(filename string) string { // performUpdate downloads and replaces the binary func (u *Updater) performUpdate(binary *Binary) error { // Create temp file - tmpFile, err := os.CreateTemp("", "alios-update-*") + tmpFile, err := os.CreateTemp("", "ingot-update-*") if err != nil { return fmt.Errorf("failed to create temp file: %w", err) } @@ -319,12 +319,12 @@ func (u *Updater) replaceBinary(tmpPath, realPath string) error { // permission error if we can't write there at all - then rename that // over realPath, which is guaranteed same-filesystem and therefore safe // even though realPath may still be executing. - stagedPath := filepath.Join(filepath.Dir(realPath), ".alios-update-staged") + stagedPath := filepath.Join(filepath.Dir(realPath), ".ingot-update-staged") defer os.Remove(stagedPath) // no-op once the rename below succeeds if err := copyFile(tmpPath, stagedPath); err != nil { if os.IsPermission(err) && u.isSystemInstall(realPath) { - fmt.Printf(utils.Colorize("[AUTH]", utils.ColorBlue)+" Alios is installed system-wide at %s\n", realPath) + fmt.Printf(utils.Colorize("[AUTH]", utils.ColorBlue)+" Ingot is installed system-wide at %s\n", realPath) fmt.Printf(" Requesting administrator privileges to update...\n") return u.updateWithSudo(tmpPath, realPath) @@ -362,7 +362,7 @@ func (u *Updater) updateWithSudo(tmpPath, realPath string) error { return u.updateWithWindowsElevation(tmpPath, realPath) } - stagedPath := filepath.Join(filepath.Dir(realPath), ".alios-update-staged") + stagedPath := filepath.Join(filepath.Dir(realPath), ".ingot-update-staged") cmd := exec.Command("sudo", "cp", tmpPath, stagedPath) cmd.Stdout = os.Stdout @@ -422,7 +422,7 @@ func (u *Updater) downloadFile(url string, dest *os.File, expectedSHA256 string) // For GitHub API asset downloads req.Header.Set("Authorization", "token "+u.githubToken) req.Header.Set("Accept", "application/octet-stream") - req.Header.Set("User-Agent", "alios-cli-updater") + req.Header.Set("User-Agent", "ingot-updater") } resp, err := u.httpClient.Do(req) diff --git a/internal/utils/utils.go b/internal/utils/utils.go index 2599190..582e0c1 100644 --- a/internal/utils/utils.go +++ b/internal/utils/utils.go @@ -185,15 +185,15 @@ func cleanupDNSLinux() error { // Remove systemd-resolved configuration if it exists if CommandExists("resolvectl") || CommandExists("systemd-resolve") { // Remove the DNS configuration drop-in file - exec.Command("sudo", "rm", "-f", "/etc/systemd/resolved.conf.d/alios.conf").Run() + exec.Command("sudo", "rm", "-f", "/etc/systemd/resolved.conf.d/ingot.conf").Run() // Restart systemd-resolved exec.Command("sudo", "systemctl", "restart", "systemd-resolved").Run() } // Remove dnsmasq configuration if it exists - if FileExists("/etc/dnsmasq.d/alios.conf") { - exec.Command("sudo", "rm", "-f", "/etc/dnsmasq.d/alios.conf").Run() + if FileExists("/etc/dnsmasq.d/ingot.conf") { + exec.Command("sudo", "rm", "-f", "/etc/dnsmasq.d/ingot.conf").Run() if CommandExists("systemctl") { exec.Command("sudo", "systemctl", "restart", "dnsmasq").Run() } else { @@ -212,7 +212,7 @@ func cleanupDNSLinux() error { } // TestDomainResolverStatus reports whether the host's resolver has been -// pointed at alios_dns for .test (the counterpart of SetupTestDomainResolver) +// pointed at ingot_dns for .test (the counterpart of SetupTestDomainResolver) // and which config file does it. On platforms the setup doesn't handle it // returns configured=false with an explanatory detail. func TestDomainResolverStatus() (configured bool, detail string) { @@ -223,12 +223,12 @@ func TestDomainResolverStatus() (configured bool, detail string) { } return false, "/etc/resolver/test missing" case "linux": - for _, path := range []string{"/etc/systemd/resolved.conf.d/alios.conf", "/etc/dnsmasq.d/alios.conf"} { + for _, path := range []string{"/etc/systemd/resolved.conf.d/ingot.conf", "/etc/dnsmasq.d/ingot.conf"} { if FileExists(path) { return true, path } } - return false, "no alios.conf under /etc/systemd/resolved.conf.d or /etc/dnsmasq.d" + return false, "no ingot.conf under /etc/systemd/resolved.conf.d or /etc/dnsmasq.d" default: return false, "automatic resolver setup is not supported on " + runtime.GOOS } @@ -310,7 +310,7 @@ Domains=~test ` // Write configuration file - cmd := exec.Command("sudo", "tee", "/etc/systemd/resolved.conf.d/alios.conf") + cmd := exec.Command("sudo", "tee", "/etc/systemd/resolved.conf.d/ingot.conf") cmd.Stdin = strings.NewReader(config) if err := cmd.Run(); err != nil { return fmt.Errorf("failed to write resolved configuration: %w", err) @@ -342,7 +342,7 @@ func setupDnsmasq() error { config := "server=/test/127.0.0.1#5354\n" // Write configuration file - cmd := exec.Command("sudo", "tee", "/etc/dnsmasq.d/alios.conf") + cmd := exec.Command("sudo", "tee", "/etc/dnsmasq.d/ingot.conf") cmd.Stdin = strings.NewReader(config) if err := cmd.Run(); err != nil { return fmt.Errorf("failed to write dnsmasq configuration: %w", err) diff --git a/scripts/release.sh b/scripts/release.sh index f2e5793..b090576 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Release script for Alios CLI: bumps the version, builds binaries for every +# Release script for Ingot: bumps the version, builds binaries for every # platform, then commits + tags the bump and publishes a GitHub release with # the binaries attached. Releases are distributed via GitHub Releases # directly (internal/updater checks the GitHub API) -- there's no separate @@ -34,7 +34,7 @@ if [ -n "$(git -C "$REPO_ROOT" status --porcelain)" ]; then exit 1 fi -echo -e "${GREEN}Building Alios v${VERSION}${NC}" +echo -e "${GREEN}Building Ingot v${VERSION}${NC}" # Update version in code. Anchored to a line starting with "Version" (after # leading whitespace) specifically so it doesn't also match DefaultPHPVersion @@ -58,7 +58,7 @@ echo -e "${YELLOW}Building binaries...${NC}" build_binary() { local GOOS=$1 local GOARCH=$2 - local OUTPUT="alios-${GOOS}-${GOARCH}" + local OUTPUT="ingot-${GOOS}-${GOARCH}" if [ "$GOOS" = "windows" ]; then OUTPUT="${OUTPUT}.exe" @@ -67,7 +67,7 @@ build_binary() { echo " → ${GOOS}/${GOARCH}" GOOS=$GOOS GOARCH=$GOARCH go build \ - -ldflags="-s -w -X github.com/aliasproject/alios-cli/internal/config.Version=${VERSION}" \ + -ldflags="-s -w -X github.com/aliasproject/ingot/internal/config.Version=${VERSION}" \ -o "$BUILD_DIR/$OUTPUT" \ ../cmd/main.go @@ -84,14 +84,14 @@ build_binary "windows" "amd64" echo -e "${GREEN}✓ Build complete!${NC}" -# The alios_idle service image. The CLI runs the tag matching its own +# The ingot_idle service image. The CLI runs the tag matching its own # version (config.IdleImage), so it must be pushed before the release is # published. Needs `docker buildx` and a ghcr.io login with write:packages. -echo -e "${YELLOW}Building and pushing ghcr.io/aliasproject/alios-idle:${VERSION}...${NC}" +echo -e "${YELLOW}Building and pushing ghcr.io/aliasproject/ingot-idle:${VERSION}...${NC}" docker buildx build \ --platform linux/amd64,linux/arm64 \ -f "$REPO_ROOT/Dockerfile.idle" \ - -t "ghcr.io/aliasproject/alios-idle:${VERSION}" \ + -t "ghcr.io/aliasproject/ingot-idle:${VERSION}" \ --push \ "$REPO_ROOT" echo "" @@ -106,14 +106,14 @@ git -C "$REPO_ROOT" tag "v${VERSION}" git -C "$REPO_ROOT" push origin "v${VERSION}" gh release create "v${VERSION}" \ - "$BUILD_DIR"/alios-darwin-amd64 \ - "$BUILD_DIR"/alios-darwin-arm64 \ - "$BUILD_DIR"/alios-linux-amd64 \ - "$BUILD_DIR"/alios-linux-arm64 \ - "$BUILD_DIR"/alios-windows-amd64.exe \ - --repo aliasproject/alios-cli \ + "$BUILD_DIR"/ingot-darwin-amd64 \ + "$BUILD_DIR"/ingot-darwin-arm64 \ + "$BUILD_DIR"/ingot-linux-amd64 \ + "$BUILD_DIR"/ingot-linux-arm64 \ + "$BUILD_DIR"/ingot-windows-amd64.exe \ + --repo aliasproject/ingot \ --title "v${VERSION}" \ --notes "$NOTES" echo "" -echo -e "${GREEN}✓ Released v${VERSION}: https://github.com/aliasproject/alios-cli/releases/tag/v${VERSION}${NC}" +echo -e "${GREEN}✓ Released v${VERSION}: https://github.com/aliasproject/ingot/releases/tag/v${VERSION}${NC}" From efd788475b44933a7ce2067dc8a16eac99f77cea Mon Sep 17 00:00:00 2001 From: Michael Aguiar Date: Tue, 13 Oct 2026 16:13:09 -0700 Subject: [PATCH 2/2] Fix the proxy's status name, a stale comment, and the default page's private link --- internal/services/default_page.html | 4 +--- internal/services/manager.go | 9 ++++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/internal/services/default_page.html b/internal/services/default_page.html index 47e3172..54ac027 100644 --- a/internal/services/default_page.html +++ b/internal/services/default_page.html @@ -117,9 +117,7 @@
- +

No project here

Nothing is running at this address.

diff --git a/internal/services/manager.go b/internal/services/manager.go index 76d748d..3f0487c 100644 --- a/internal/services/manager.go +++ b/internal/services/manager.go @@ -274,7 +274,7 @@ func (m *Manager) Status() ([]*Service, error) { // to zero. for _, containerName := range append(GlobalServices[:len(GlobalServices):len(GlobalServices)], IdleContainer) { displayName := strings.TrimPrefix(containerName, "ingot_") - if displayName == "ingot_proxy" { + if displayName == "proxy" { displayName = "caddy" } service := &Service{ @@ -394,10 +394,9 @@ func (m *Manager) ListManagedContainers() ([]string, error) { return nil, fmt.Errorf("failed to list containers: %w", err) } - // The reverse proxy uses production's own name (ingot_proxy), - // not the ingot_ prefix everything else here follows, so it wouldn't - // match the prefix check below on its own - check GlobalServices - // membership explicitly first so it's still tracked for pause/resume. + // Global services all share the ingot_ prefix today; checking + // GlobalServices membership as well keeps one that ever doesn't + // tracked for pause/resume. globalServiceNames := make(map[string]bool, len(GlobalServices)) for _, n := range GlobalServices { globalServiceNames[n] = true