diff --git a/infra/README.md b/infra/README.md index 18ea65e11..330247180 100644 --- a/infra/README.md +++ b/infra/README.md @@ -25,7 +25,8 @@ contain nothing environment-specific: per-environment values are runtime ## Daemon requirements -- piqueld with in-container HTTP probes and local previews (`main` after #219). +- piqueld with in-container HTTP probes, local previews and manifest-declared + environments (`main` after #233). - Managed ingress with the private apps node, and a DNS provider for `piquel.fr`: private routes get DNS-01 certificates (`*.dev.piquel.fr` covers every preview). @@ -40,24 +41,23 @@ contain nothing environment-specific: per-environment values are runtime ## Setup +The manifest declares both environments and where each deploys from: staging +follows pushes to `main` (`sync = true`), production is `promote_from = +"staging"`. Saving it creates them, or converts an existing application's, and +every later save or push to `main` keeps them in line; edit the manifest rather +than running `piquelctl env create`, `env source` or `env sync`. + Once, after this manifest is on `main`: ```sh -piquelctl app apply --file infra/piqueld.toml --yes -piquelctl env create piquel-fr staging --branch main --yes -piquelctl env source piquel-fr production --promote-from staging --yes -piquelctl env sync piquel-fr staging on +piquelctl --timeout 30m app apply --file infra/piqueld.toml --deploy --yes # deploys staging piquelctl app repository webhook rotate piquel-fr # prints the secret once piquelctl app repository webhook show piquel-fr # prints the payload URL ``` Add a GitHub webhook to this repository with that URL and secret, -`application/json`, and the `push` event. Then deploy staging once; it follows -`main` from then on: - -```sh -piquelctl --timeout 30m env deploy piquel-fr staging --yes -``` +`application/json`, and the `push` event. Staging follows `main` from then on; +production waits for its first promotion. ## Releasing diff --git a/infra/piqueld.toml b/infra/piqueld.toml index 04f7a599f..61f9a09fd 100644 --- a/infra/piqueld.toml +++ b/infra/piqueld.toml @@ -1,7 +1,8 @@ #:schema https://raw.githubusercontent.com/piquel-fr/piqueld/main/docs/application-manifest.schema.json -# piquel.fr on piqueld. Staging builds `main` on every push, production only -# receives releases promoted from staging, and previews deploy branches or local -# worktrees. See infra/README.md. +# piquel.fr on piqueld. The environments below are the application's only ones: +# staging builds `main` on every push, production only receives releases +# promoted from staging, and previews deploy branches or local worktrees. See +# infra/README.md. api_version = "piqueld.dev/v1alpha1" kind = "Application" @@ -21,12 +22,16 @@ branch = "main" [spec.variables] invite_required = "true" +[spec.environments.production] +promote_from = "staging" + [spec.environments.production.variables] web_host = "piquel.fr" auth_host = "auth.piquel.fr" www_host = "www.piquel.fr" [spec.environments.staging] +sync = true visibility = "private" [spec.environments.staging.variables]