@plexus-ms/cli 0.130.0 → 0.132.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/plx.js +2393 -1459
- package/dist/templates/app-nextjs/files/.gitignore.jinja +6 -0
- package/dist/templates/app-nextjs/files/PLEXUS.md.jinja +5 -0
- package/dist/templates/app-nextjs/files/docker/Dockerfile +39 -0
- package/dist/templates/app-nextjs/files/docker/compose.ci.yaml.jinja +22 -0
- package/dist/templates/app-nextjs/files/docker/compose.yaml.jinja +50 -0
- package/dist/templates/app-nextjs/files/next.config.ts +16 -0
- package/dist/templates/app-nextjs/files/package.json.jinja +28 -0
- package/dist/templates/app-nextjs/files/postcss.config.mjs +7 -0
- package/dist/templates/app-nextjs/files/src/app/healthz/route.ts +7 -0
- package/dist/templates/app-nextjs/files/src/app/layout.tsx +7 -0
- package/dist/templates/app-nextjs/files/src/app/page.tsx.jinja +3 -0
- package/dist/templates/app-nextjs/files/tsconfig.json +10 -0
- package/dist/templates/app-nextjs/template.yml +29 -0
- package/dist/templates/repo-operations/files/.github/workflows/deploy.yml.jinja +37 -0
- package/dist/templates/repo-operations/files/.github/workflows/on_commit.yml.jinja +25 -0
- package/dist/templates/repo-operations/files/.github/workflows/on_pr.yml.jinja +24 -0
- package/dist/templates/repo-operations/files/.github/workflows/plx-update.yml.jinja +30 -0
- package/dist/templates/repo-operations/files/.github/workflows/{% if ci_strategy == 'hybrid' or ci_registry == 'own' %}housekeeping.yml{% endif %}.jinja +30 -0
- package/dist/templates/repo-operations/files/.gitignore.jinja +2 -0
- package/dist/templates/repo-operations/files/PLEXUS.md.jinja +3 -0
- package/dist/templates/repo-operations/files/ansible-playbookw +17 -0
- package/dist/templates/repo-operations/files/ansible.cfg +4 -0
- package/dist/templates/repo-operations/files/apps/.gitkeep +0 -0
- package/dist/templates/repo-operations/files/hk.pkl +21 -0
- package/dist/templates/repo-operations/files/inventory/group_vars/all.yml.jinja +6 -0
- package/dist/templates/repo-operations/files/inventory/group_vars/platform.yml.jinja +13 -0
- package/dist/templates/repo-operations/files/inventory/hosts.yml.jinja +21 -0
- package/dist/templates/repo-operations/files/mise.toml.jinja +102 -0
- package/dist/templates/repo-operations/files/platform.yml.jinja +6 -0
- package/dist/templates/repo-operations/files/renovate.json.jinja +5 -0
- package/dist/templates/repo-operations/files/requirements.yml +15 -0
- package/dist/templates/repo-operations/files/secrets.env.jinja +3 -0
- package/dist/templates/repo-operations/files/{% if ci_strategy != 'github' %}ci.yml{% endif %}.jinja +6 -0
- package/dist/templates/repo-operations/files/{% if infrastructure %}infrastructure.yml{% endif %}.jinja +6 -0
- package/dist/templates/repo-operations/template.yml +70 -0
- package/dist/templates/repo-turbo/files/.github/workflows/on_pr.yml.jinja +91 -0
- package/dist/templates/repo-turbo/files/.github/workflows/on_push.yml.jinja +109 -0
- package/dist/templates/repo-turbo/files/.github/workflows/plx-update.yml.jinja +30 -0
- package/dist/templates/repo-turbo/files/.github/workflows/{% if not publishes_packages %}on_commit.yml{% endif %}.jinja +28 -0
- package/dist/templates/repo-turbo/files/.github/workflows/{% if not publishes_packages and ci_registry == 'ghcr' %}housekeeping.yml{% endif %}.jinja +28 -0
- package/dist/templates/repo-turbo/files/.gitignore.jinja +7 -0
- package/dist/templates/repo-turbo/files/PLEXUS.md.jinja +11 -0
- package/dist/templates/repo-turbo/files/biome.json +4 -0
- package/dist/templates/repo-turbo/files/hk.pkl +22 -0
- package/dist/templates/repo-turbo/files/mise.toml.jinja +134 -0
- package/dist/templates/repo-turbo/files/package.json.jinja +11 -0
- package/dist/templates/repo-turbo/files/packages/.gitkeep +0 -0
- package/dist/templates/repo-turbo/files/pnpm-workspace.yaml.jinja +18 -0
- package/dist/templates/repo-turbo/files/renovate.json.jinja +14 -0
- package/dist/templates/repo-turbo/files/turbo.json.jinja +23 -0
- package/dist/templates/repo-turbo/files/{% if not publishes_packages %}.dockerignore{% endif %} +9 -0
- package/dist/templates/repo-turbo/files/{% if not publishes_packages %}apps{% endif %}/.gitkeep +0 -0
- package/dist/templates/repo-turbo/files/{% if publishes_packages %}.changeset{% endif %}/config.json.jinja +11 -0
- package/dist/templates/repo-turbo/template.yml +101 -0
- package/package.json +3 -2
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
- `{{ name }}`, a Next.js app: `docker/Dockerfile` builds its image and `docker/compose.yaml` runs it on its host.
|
|
2
|
+
- Its verbs are the repo root's: `mise :dev <app>`, `mise :build <app>` and `mise :verify <app>`, `<app>` being this directory's name.
|
|
3
|
+
{%- if profile == 'stateful' %}
|
|
4
|
+
- The `migrate` and `seed` scripts in `package.json` fail until they are written: the deploy verb runs `migrate` in the image, through the compose file's `migrate` service, and `seed` loads development data and never runs on a host.
|
|
5
|
+
{%- endif %}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# syntax=docker/dockerfile:1
|
|
2
|
+
# Generated from plexus-ms/tooling, templates/app-nextjs.
|
|
3
|
+
# The image build of a Next.js standalone app in the monorepo, from its root or a pruned context (PLX-App/Dockerfile).
|
|
4
|
+
FROM node:24-slim@sha256:c86ecead9e55a5210ac1727de38a4ca840bf03dcaf34dc9749addbf383b1920c AS builder
|
|
5
|
+
ARG APP
|
|
6
|
+
WORKDIR /repo
|
|
7
|
+
ENV CI=1
|
|
8
|
+
ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0
|
|
9
|
+
RUN corepack enable
|
|
10
|
+
# package.json comes along so that corepack runs the pnpm its packageManager pins.
|
|
11
|
+
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
|
|
12
|
+
# The npmrc secret is the token of the tenant's private package registry, for a repo that installs
|
|
13
|
+
# from one (§ 5 PLX-Delivery); a build without the secret mounts nothing.
|
|
14
|
+
RUN --mount=type=secret,id=npmrc,target=/root/.npmrc pnpm fetch
|
|
15
|
+
COPY turbo.json ./
|
|
16
|
+
COPY packages packages
|
|
17
|
+
COPY apps/${APP} apps/${APP}
|
|
18
|
+
# public/ is optional; an empty one lets the runner stage copy it unconditionally.
|
|
19
|
+
RUN mkdir -p apps/${APP}/public
|
|
20
|
+
RUN --mount=type=secret,id=npmrc,target=/root/.npmrc pnpm install --frozen-lockfile --prefer-offline
|
|
21
|
+
# pnpm, not Turbo, whose strict environment would hide BUILD_HASH and the key from `next build`;
|
|
22
|
+
# the filter's trailing `...` builds the app's workspace dependencies first, as `^build` would.
|
|
23
|
+
ARG BUILD_HASH
|
|
24
|
+
RUN --mount=type=secret,id=next-server-actions-encryption-key,env=NEXT_SERVER_ACTIONS_ENCRYPTION_KEY \
|
|
25
|
+
BUILD_HASH=${BUILD_HASH} pnpm --filter "{./apps/${APP}}..." run build
|
|
26
|
+
|
|
27
|
+
FROM node:24-slim@sha256:c86ecead9e55a5210ac1727de38a4ca840bf03dcaf34dc9749addbf383b1920c AS runner
|
|
28
|
+
ARG APP
|
|
29
|
+
WORKDIR /repo
|
|
30
|
+
ENV NODE_ENV=production
|
|
31
|
+
# The standalone output keeps the monorepo's layout; the static files and public/ go in beside it.
|
|
32
|
+
COPY --from=builder --chown=node:node /repo/apps/${APP}/.next/standalone ./
|
|
33
|
+
COPY --from=builder --chown=node:node /repo/apps/${APP}/.next/static ./apps/${APP}/.next/static
|
|
34
|
+
COPY --from=builder --chown=node:node /repo/apps/${APP}/public ./apps/${APP}/public
|
|
35
|
+
WORKDIR /repo/apps/${APP}
|
|
36
|
+
USER node
|
|
37
|
+
EXPOSE 3000
|
|
38
|
+
ENV HOSTNAME=0.0.0.0
|
|
39
|
+
ENTRYPOINT ["node", "server.js"]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Generated from plexus-ms/tooling, templates/app-nextjs.
|
|
2
|
+
# The override of compose.yaml that `plx-ci test` reads beside it, never the deploy verb (§ 1 PLX-Delivery).
|
|
3
|
+
|
|
4
|
+
# Added to the environment the specs run in, on the runner beside the stack, to CI, PLEXUS_LOOPBACK_PORT and E2E_BASE_URL.
|
|
5
|
+
x-plexus-ci:
|
|
6
|
+
env: {}
|
|
7
|
+
|
|
8
|
+
# Stands in for .env and .env.secret, with throwaway values.
|
|
9
|
+
x-ci-env: &ci-env
|
|
10
|
+
PUBLIC_URL: http://127.0.0.1:${PLEXUS_LOOPBACK_PORT:?set by plx-ci test}
|
|
11
|
+
|
|
12
|
+
services:
|
|
13
|
+
web:
|
|
14
|
+
environment: *ci-env
|
|
15
|
+
restart: "no"
|
|
16
|
+
{%- if profile == "stateful" %}
|
|
17
|
+
# plx-ci test runs migrate once before `up`.
|
|
18
|
+
migrate:
|
|
19
|
+
environment: *ci-env
|
|
20
|
+
# Data services go here, published on 127.0.0.1 for the specs and kept in RAM (`volumes: !override []`
|
|
21
|
+
# and a tmpfs for the data directory), with the database URL in x-plexus-ci.env above.
|
|
22
|
+
{%- endif %}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
services:
|
|
2
|
+
web:
|
|
3
|
+
image: ${PLEXUS_DEPLOYMENT_IMAGE:?rendered by the deploy verb}
|
|
4
|
+
restart: unless-stopped
|
|
5
|
+
environment:
|
|
6
|
+
NODE_ENV: production
|
|
7
|
+
# What the deployment says about itself, pinned by the deploy verb (PLX-Releases): the display version,
|
|
8
|
+
# where the repo has them, and the commit it was started from. Empty where none is handed over.
|
|
9
|
+
PLEXUS_DISPLAY_VERSION: ${PLEXUS_DISPLAY_VERSION:-}
|
|
10
|
+
PLEXUS_COMMIT_SHA: ${PLEXUS_COMMIT_SHA:-}
|
|
11
|
+
env_file:
|
|
12
|
+
- path: .env
|
|
13
|
+
required: false
|
|
14
|
+
- path: .env.secret
|
|
15
|
+
required: false
|
|
16
|
+
ports:
|
|
17
|
+
- "127.0.0.1:${PLEXUS_LOOPBACK_PORT:?set by the platform playbook}:3000"
|
|
18
|
+
labels:
|
|
19
|
+
plexus.tenant: {{ tenant }}
|
|
20
|
+
healthcheck:
|
|
21
|
+
test:
|
|
22
|
+
- CMD
|
|
23
|
+
- node
|
|
24
|
+
- -e
|
|
25
|
+
- "fetch('http://127.0.0.1:3000/healthz').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"
|
|
26
|
+
interval: 30s
|
|
27
|
+
timeout: 5s
|
|
28
|
+
retries: 3
|
|
29
|
+
start_period: 60s
|
|
30
|
+
start_interval: 1s
|
|
31
|
+
{%- if profile == "stateful" %}
|
|
32
|
+
|
|
33
|
+
migrate:
|
|
34
|
+
image: ${PLEXUS_DEPLOYMENT_IMAGE:?rendered by the deploy verb}
|
|
35
|
+
profiles: ["migrate"]
|
|
36
|
+
# npm, not pnpm: the image holds node and the standalone build and nothing else.
|
|
37
|
+
entrypoint: ["npm", "run", "migrate"]
|
|
38
|
+
environment:
|
|
39
|
+
NODE_ENV: production
|
|
40
|
+
env_file:
|
|
41
|
+
- path: .env
|
|
42
|
+
required: false
|
|
43
|
+
- path: .env.secret
|
|
44
|
+
required: false
|
|
45
|
+
labels:
|
|
46
|
+
plexus.tenant: {{ tenant }}
|
|
47
|
+
|
|
48
|
+
# Data services go here, each a dependency of web and migrate, with its data in a named volume,
|
|
49
|
+
# never in a bind-mounted directory (§ 9.1 PLX-App).
|
|
50
|
+
{%- endif %}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url';
|
|
2
|
+
import type { NextConfig } from 'next';
|
|
3
|
+
|
|
4
|
+
// The workspace root, two levels up from this app; under `plx umbrella` it is the umbrella's,
|
|
5
|
+
// where the dependencies are then installed.
|
|
6
|
+
const root = process.env.PLX_UMBRELLA_ROOT || fileURLToPath(new URL('../../', import.meta.url));
|
|
7
|
+
|
|
8
|
+
const nextConfig: NextConfig = {
|
|
9
|
+
output: 'standalone',
|
|
10
|
+
// BUILD_HASH comes from the image build; without it Next draws a random ID, as in development.
|
|
11
|
+
generateBuildId: () => process.env.BUILD_HASH || null,
|
|
12
|
+
outputFileTracingRoot: root,
|
|
13
|
+
turbopack: { root },
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default nextConfig;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{ name }}",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "next dev",
|
|
7
|
+
"build": "next build",
|
|
8
|
+
"start": "next start",
|
|
9
|
+
"check": "next typegen && tsc --noEmit"{% if profile == 'stateful' %},
|
|
10
|
+
"migrate": "echo 'migrate: not written yet. Name the migration command here; the migrate service of docker/compose.yaml runs it in the image, which holds node and the standalone build.' >&2; exit 1",
|
|
11
|
+
"seed": "echo 'seed: not written yet. Name the command here that loads development sample data into a fresh, migrated database.' >&2; exit 1"{% endif %}
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@plexus-ms/std": "^0.2.0",
|
|
15
|
+
"next": "^16",
|
|
16
|
+
"react": "^19",
|
|
17
|
+
"react-dom": "^19"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@plexus-ms/config": "catalog:plexus",
|
|
21
|
+
"@tailwindcss/postcss": "^4",
|
|
22
|
+
"@types/node": "^24",
|
|
23
|
+
"@types/react": "^19",
|
|
24
|
+
"@types/react-dom": "^19",
|
|
25
|
+
"tailwindcss": "^4",
|
|
26
|
+
"typescript": "catalog:"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "@plexus-ms/config/tsconfig-next",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"paths": {
|
|
5
|
+
"@/*": ["./src/*"]
|
|
6
|
+
}
|
|
7
|
+
},
|
|
8
|
+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", ".next/dev/types/**/*.ts", "**/*.mts"],
|
|
9
|
+
"exclude": ["node_modules"]
|
|
10
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# files/.gitignore.jinja is a .gitignore: npm leaves a file of that name out of a package, so the
|
|
2
|
+
# template carries it with the suffix, which renders it to the same bytes.
|
|
3
|
+
name: app-nextjs
|
|
4
|
+
|
|
5
|
+
# The enclosing repo's answer; whoever renders the app passes it.
|
|
6
|
+
reads:
|
|
7
|
+
tenant:
|
|
8
|
+
|
|
9
|
+
questions:
|
|
10
|
+
name:
|
|
11
|
+
type: str
|
|
12
|
+
help: "App name (for package.json)"
|
|
13
|
+
|
|
14
|
+
profile:
|
|
15
|
+
type: str
|
|
16
|
+
help: "The app's profile (§§ 8 and 9 PLX-App), which its marker states: stateless, an app holding no state of its own; stateful, an app with data services of its own, which gets a migrate service in its compose file and migrate and seed scripts to write"
|
|
17
|
+
choices:
|
|
18
|
+
- stateless
|
|
19
|
+
- stateful
|
|
20
|
+
default: stateless
|
|
21
|
+
|
|
22
|
+
policies:
|
|
23
|
+
# The app's source and its marker are rendered at birth only: an update would fight what the author
|
|
24
|
+
# wrote, or add a root layout to an app whose route groups hold their own; the marker's frontmatter is
|
|
25
|
+
# plx's.
|
|
26
|
+
PLEXUS.md.jinja: born-once
|
|
27
|
+
src/app/layout.tsx: born-once
|
|
28
|
+
src/app/page.tsx.jinja: born-once
|
|
29
|
+
src/app/healthz/route.ts: born-once
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{% raw %}name: deploy
|
|
2
|
+
|
|
3
|
+
# Generated from plexus-ms/tooling, templates/repo-operations: edit the template, never this file.
|
|
4
|
+
# Mounts the deploy verb for the third-party apps under apps/ (PLX-App/SourceRepo, § 6 PLX-Delivery).
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: [main]
|
|
9
|
+
paths: ['apps/**']
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
deploy-targets:
|
|
17
|
+
uses: plexus-ms/tooling/.github/workflows/_deploy-targets.yml@0.132.0
|
|
18
|
+
with:
|
|
19
|
+
strategy: ${{ vars.CI_STRATEGY || '{% endraw %}{{ ci_strategy }}{% raw %}' }}
|
|
20
|
+
|
|
21
|
+
deploy:
|
|
22
|
+
needs: deploy-targets
|
|
23
|
+
# An empty matrix is an error, not a no-op.
|
|
24
|
+
if: ${{ needs.deploy-targets.outputs.matrix != '[]' }}
|
|
25
|
+
strategy:
|
|
26
|
+
fail-fast: false
|
|
27
|
+
matrix:
|
|
28
|
+
include: ${{ fromJSON(needs.deploy-targets.outputs.matrix) }}
|
|
29
|
+
uses: plexus-ms/tooling/.github/workflows/_deploy.yml@0.132.0
|
|
30
|
+
with:
|
|
31
|
+
strategy: ${{ vars.CI_STRATEGY || '{% endraw %}{{ ci_strategy }}{% raw %}' }}
|
|
32
|
+
app: ${{ matrix.app }}
|
|
33
|
+
host: ${{ matrix.host }}
|
|
34
|
+
overlay: {% endraw %}{{ ci_overlay }}{% raw %}
|
|
35
|
+
secrets:
|
|
36
|
+
op-service-account-token: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
|
|
37
|
+
{% endraw %}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{% raw %}name: on_commit
|
|
2
|
+
|
|
3
|
+
# Generated from plexus-ms/tooling, templates/repo-operations: edit the template, never this file.
|
|
4
|
+
# The check of a push to main, the trunk that takes an operator's direct pushes (§ 2 PLX-Delivery).
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: [main]
|
|
9
|
+
paths-ignore: ['**/*.md']
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
|
|
14
|
+
concurrency:
|
|
15
|
+
group: on_commit-${{ github.ref }}
|
|
16
|
+
cancel-in-progress: true
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
check:
|
|
20
|
+
uses: plexus-ms/tooling/.github/workflows/_check.yml@0.132.0
|
|
21
|
+
with:
|
|
22
|
+
strategy: ${{ vars.CI_STRATEGY || '{% endraw %}{{ ci_strategy }}{% raw %}' }}
|
|
23
|
+
size: small
|
|
24
|
+
tasks: verify
|
|
25
|
+
{% endraw %}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{% raw %}name: on_pr
|
|
2
|
+
|
|
3
|
+
# Generated from plexus-ms/tooling, templates/repo-operations: edit the template, never this file.
|
|
4
|
+
# The check of a pull request, as the merge result (§ 2 PLX-Delivery).
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
pull_request:
|
|
8
|
+
paths-ignore: ['**/*.md']
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
|
|
13
|
+
concurrency:
|
|
14
|
+
group: on_pr-${{ github.ref }}
|
|
15
|
+
cancel-in-progress: true
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
check:
|
|
19
|
+
uses: plexus-ms/tooling/.github/workflows/_check.yml@0.132.0
|
|
20
|
+
with:
|
|
21
|
+
strategy: ${{ vars.CI_STRATEGY || '{% endraw %}{{ ci_strategy }}{% raw %}' }}
|
|
22
|
+
size: small
|
|
23
|
+
tasks: verify
|
|
24
|
+
{% endraw %}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{% raw %}name: plx-update
|
|
2
|
+
|
|
3
|
+
# Generated from plexus-ms/tooling, templates/repo-operations: edit the template, never this file.
|
|
4
|
+
# Mounts the update verb, `plx update` (§ 3 PLX-Updates).
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
schedule:
|
|
8
|
+
- cron: '23 6 * * *'
|
|
9
|
+
workflow_dispatch:
|
|
10
|
+
inputs:
|
|
11
|
+
version:
|
|
12
|
+
description: "The version to take (default: the newest)"
|
|
13
|
+
required: false
|
|
14
|
+
default: ''
|
|
15
|
+
|
|
16
|
+
permissions:
|
|
17
|
+
contents: read
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
update:
|
|
21
|
+
uses: plexus-ms/tooling/.github/workflows/_plx-update.yml@0.132.0
|
|
22
|
+
with:
|
|
23
|
+
version: ${{ inputs.version || '' }}
|
|
24
|
+
now: ${{ github.event_name == 'workflow_dispatch' }}
|
|
25
|
+
gh-client-id: ${{ vars.GH_CLIENT_ID }}
|
|
26
|
+
strategy: ${{ vars.CI_STRATEGY || '{% endraw %}{{ ci_strategy }}{% raw %}' }}
|
|
27
|
+
secrets:
|
|
28
|
+
gh-private-key: ${{ secrets.GH_PRIVATE_KEY }}
|
|
29
|
+
op-service-account-token: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
|
|
30
|
+
{%- endraw %}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{% raw %}name: housekeeping
|
|
2
|
+
|
|
3
|
+
# Generated from plexus-ms/tooling, templates/repo-operations: edit the template, never this file.
|
|
4
|
+
# The daily housekeeping of the tenant's CI: its throwaway instances, its registry buckets (§ 8 PLX-Delivery).
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
schedule:
|
|
8
|
+
- cron: '17 4 * * *'
|
|
9
|
+
workflow_dispatch:
|
|
10
|
+
inputs:
|
|
11
|
+
dry_run:
|
|
12
|
+
description: Only list what would be deleted
|
|
13
|
+
type: boolean
|
|
14
|
+
default: false
|
|
15
|
+
|
|
16
|
+
permissions:
|
|
17
|
+
contents: read
|
|
18
|
+
packages: write
|
|
19
|
+
|
|
20
|
+
jobs:
|
|
21
|
+
housekeeping:
|
|
22
|
+
uses: plexus-ms/tooling/.github/workflows/_housekeeping.yml@0.132.0
|
|
23
|
+
with:
|
|
24
|
+
strategy: ${{ vars.CI_STRATEGY || '{% endraw %}{{ ci_strategy }}{% raw %}' }}
|
|
25
|
+
registry: {% endraw %}{{ 'own' if ci_registry == 'own' else 'none' }}{% raw %}
|
|
26
|
+
dry-run: ${{ inputs.dry_run || false }}
|
|
27
|
+
alerts-email: '{% endraw %}{{ alerts_email }}{% raw %}'
|
|
28
|
+
secrets:
|
|
29
|
+
op-service-account-token: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
|
|
30
|
+
{% endraw %}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
- The operations repo of `{{ tenant }}`: the playbooks that mount the `plexus.*` collections, one per layer, the inventory they run on, and the third-party apps under `apps/`, each with a marker of its own.
|
|
2
|
+
- `mise :platform` applies the platform layer{% if infrastructure %}, `mise :infrastructure` the infrastructure layer{% endif %}{% if ci_strategy != 'github' %}, `mise :ci` the runner host{% endif %}; `mise :verify` checks the repo.
|
|
3
|
+
- The Plexus version the repo is on is the `version` of this marker, and its `plx` pin in `mise.toml` follows it, the collections in `requirements.yml` pinned to the same.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Generated from plexus-ms/tooling, templates/repo-operations.
|
|
3
|
+
# Runs a playbook with the op:// pointers of secrets.env resolved (§ 1 PLX-Secrets): ./ansible-playbookw <playbook> [args...]
|
|
4
|
+
|
|
5
|
+
playbook="${1:?Usage: $0 <playbook> [extra args...]}"
|
|
6
|
+
shift
|
|
7
|
+
|
|
8
|
+
SECRETS_FILE="$(dirname "$playbook")/secrets.env"
|
|
9
|
+
if [ -f "$SECRETS_FILE" ]; then
|
|
10
|
+
SECRETS_ARG="--env-file $SECRETS_FILE"
|
|
11
|
+
else
|
|
12
|
+
SECRETS_ARG=""
|
|
13
|
+
fi
|
|
14
|
+
|
|
15
|
+
op run --no-masking $SECRETS_ARG -- \
|
|
16
|
+
ansible-playbook \
|
|
17
|
+
"./$playbook" "$@"
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
amends "package://github.com/jdx/hk/releases/download/v1.48.0/hk@1.48.0#/Config.pkl"
|
|
2
|
+
|
|
3
|
+
hooks {
|
|
4
|
+
["pre-commit"] {
|
|
5
|
+
fix = true
|
|
6
|
+
stash = true
|
|
7
|
+
steps {
|
|
8
|
+
["lint"] {
|
|
9
|
+
check = "mise :lint {{ files }}"
|
|
10
|
+
fix = "mise :lint --write {{ files }}"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
["pre-push"] {
|
|
15
|
+
steps {
|
|
16
|
+
["check"] {
|
|
17
|
+
check = "mise :check"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Generated from plexus-ms/tooling, templates/repo-operations.
|
|
2
|
+
# What the hosts that run this tenant's apps get; their apps are per host, in host_vars (§ 3 PLX-Platform).
|
|
3
|
+
|
|
4
|
+
plexus_deploy_user: plexus
|
|
5
|
+
plexus_deploy_root: /opt/stacks
|
|
6
|
+
|
|
7
|
+
plexus_up: true
|
|
8
|
+
|
|
9
|
+
plexus_apps: []
|
|
10
|
+
|
|
11
|
+
plexus_deploy_pubkey: "{% raw %}{{ lookup('env', 'DEPLOY_PUBKEY') | default('', true) }}{% endraw %}"
|
|
12
|
+
plexus_ghcr_user: "{% raw %}{{ lookup('env', 'GHCR_USER') | default('', true) }}{% endraw %}"
|
|
13
|
+
plexus_ghcr_token: "{% raw %}{{ lookup('env', 'GHCR_TOKEN') | default('', true) }}{% endraw %}"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Generated from plexus-ms/tooling, templates/repo-operations.
|
|
2
|
+
# The groups the shipped playbooks target (§ 1 PLX-Platform); a host's own facts go to host_vars/<host>.yml.
|
|
3
|
+
platform:
|
|
4
|
+
hosts:
|
|
5
|
+
host01.{{ tenant }}.example:
|
|
6
|
+
{%- if ci_strategy != 'github' %}
|
|
7
|
+
|
|
8
|
+
ci:
|
|
9
|
+
hosts: {}
|
|
10
|
+
{%- endif %}
|
|
11
|
+
{%- if infrastructure %}
|
|
12
|
+
|
|
13
|
+
proxmox:
|
|
14
|
+
hosts: {}
|
|
15
|
+
pbs:
|
|
16
|
+
hosts: {}
|
|
17
|
+
haproxy:
|
|
18
|
+
hosts: {}
|
|
19
|
+
guests:
|
|
20
|
+
hosts: {}
|
|
21
|
+
{%- endif %}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Generated from plexus-ms/tooling, templates/repo-operations.
|
|
2
|
+
# The verbs of the operations repo (PLX-Tenancy/OperationsRepo): one per layer's playbook, and the contract verbs.
|
|
3
|
+
|
|
4
|
+
# `mise :verb` needs the root marker, though the repo has no sub-projects (§ 2 PLX-Repo).
|
|
5
|
+
monorepo_root = true
|
|
6
|
+
# The root is the one project: mise does not walk the tree for others.
|
|
7
|
+
[monorepo]
|
|
8
|
+
config_roots = ["."]
|
|
9
|
+
|
|
10
|
+
[tools]
|
|
11
|
+
node = "24"
|
|
12
|
+
hk = "latest"
|
|
13
|
+
python = "3.14"
|
|
14
|
+
uv = "latest"
|
|
15
|
+
ansible = { version = "latest", uvx = true }
|
|
16
|
+
# The plx pins are written with each Plexus version, never by the update bot (§ 1 PLX-Updates);
|
|
17
|
+
# allow_low_downloads only waives npm's young-package heuristics.
|
|
18
|
+
"npm:@plexus-ms/cli" = { version = "0.132.0", allow_low_downloads = true }
|
|
19
|
+
{%- if ci_strategy == 'hybrid' or ci_registry == 'own' %}
|
|
20
|
+
"npm:@plexus-ms/cli-ci" = { version = "0.132.0", allow_low_downloads = true }
|
|
21
|
+
{%- endif %}
|
|
22
|
+
|
|
23
|
+
[hooks]
|
|
24
|
+
# hk is absent on a CI runner whose mise installs only the tools a job names.
|
|
25
|
+
postinstall = "if command -v hk >/dev/null; then hk install --mise; fi"
|
|
26
|
+
|
|
27
|
+
# A layer's verb passes what follows `--` to ansible-playbook: `mise platform -- --tags apps --limit vm101`.
|
|
28
|
+
[tasks.platform]
|
|
29
|
+
depends = ["collections"]
|
|
30
|
+
description = "The platform layer on the app hosts (PLX-Platform): host baseline, deploy user, ingress, secrets, apps; --tags for a part"
|
|
31
|
+
run = './ansible-playbookw platform.yml'
|
|
32
|
+
|
|
33
|
+
{% if infrastructure -%}
|
|
34
|
+
[tasks.infrastructure]
|
|
35
|
+
depends = ["collections"]
|
|
36
|
+
description = "The infrastructure layer under the hosts (PLX-Infrastructure): hypervisor, guests, backup server, ingress VM; --tags for a part"
|
|
37
|
+
run = './ansible-playbookw infrastructure.yml'
|
|
38
|
+
|
|
39
|
+
{% endif -%}
|
|
40
|
+
{% if ci_strategy != 'github' -%}
|
|
41
|
+
[tasks.ci]
|
|
42
|
+
depends = ["collections"]
|
|
43
|
+
description = "The tenant's CI capacity (§ 8 PLX-Delivery): the runner host and its slots; --tags for a part"
|
|
44
|
+
run = './ansible-playbookw ci.yml'
|
|
45
|
+
|
|
46
|
+
{% endif -%}
|
|
47
|
+
[tasks.dev]
|
|
48
|
+
description = "No-op: an operations repo has no development environment to start"
|
|
49
|
+
run = 'echo "dev: nothing to start in an operations repo"'
|
|
50
|
+
|
|
51
|
+
[tasks.build]
|
|
52
|
+
description = "No-op: an operations repo produces no artifact; third-party apps pin published images"
|
|
53
|
+
run = 'echo "build: nothing to build in an operations repo"'
|
|
54
|
+
|
|
55
|
+
[tasks.lint]
|
|
56
|
+
description = "Formatting of the text files: no trailing whitespace, one final newline, one kind of line ending"
|
|
57
|
+
usage = '''
|
|
58
|
+
flag "--write" help="Fix the files in place"
|
|
59
|
+
arg "<paths>" var=#true default="." help="Files or directories to lint (defaults to the whole repo)"
|
|
60
|
+
'''
|
|
61
|
+
# hk's own fixers, so that lint needs no tool beyond the pinned ones.
|
|
62
|
+
run = '''
|
|
63
|
+
eval "set -- $usage_paths"
|
|
64
|
+
files=$(git ls-files --cached --others --exclude-standard -- "$@" | grep -E '\.(ya?ml|toml|md|json|cfg|pkl|env|j2|sh)$|(^|/)ansible-playbookw$' || true)
|
|
65
|
+
[ -n "$files" ] || exit 0
|
|
66
|
+
status=0
|
|
67
|
+
for fixer in trailing-whitespace end-of-file-fixer mixed-line-ending; do
|
|
68
|
+
printf '%s\n' "$files" | tr '\n' '\0' | xargs -0 hk util "$fixer" ${usage_write:+--fix} || status=1
|
|
69
|
+
done
|
|
70
|
+
[ "$status" = 0 ] || echo "lint: \`mise :lint --write\` fixes these in place" >&2
|
|
71
|
+
exit "$status"
|
|
72
|
+
'''
|
|
73
|
+
|
|
74
|
+
[tasks.check]
|
|
75
|
+
depends = ["collections"]
|
|
76
|
+
description = "Static checks: lint, the contracts' checks (plx doctor), then playbook syntax against the pinned collections"
|
|
77
|
+
run = [
|
|
78
|
+
'mise run lint',
|
|
79
|
+
'plx doctor',
|
|
80
|
+
'ansible-playbook --syntax-check platform.yml',
|
|
81
|
+
{%- if infrastructure %}
|
|
82
|
+
'ansible-playbook --syntax-check infrastructure.yml',
|
|
83
|
+
{%- endif %}
|
|
84
|
+
{%- if ci_strategy != 'github' %}
|
|
85
|
+
'ansible-playbook --syntax-check ci.yml',
|
|
86
|
+
{%- endif %}
|
|
87
|
+
]
|
|
88
|
+
|
|
89
|
+
[tasks.test]
|
|
90
|
+
description = "No-op: an operations repo has no tests that gate a deploy"
|
|
91
|
+
run = 'echo "test: nothing to test in an operations repo"'
|
|
92
|
+
|
|
93
|
+
[tasks.verify]
|
|
94
|
+
description = "Perform all steps that verify code quality"
|
|
95
|
+
run = ['mise run check', 'mise run test']
|
|
96
|
+
|
|
97
|
+
[tasks.collections]
|
|
98
|
+
description = "Install the pinned plexus.* collections"
|
|
99
|
+
hide = true
|
|
100
|
+
run = 'ansible-galaxy collection install -r requirements.yml'
|
|
101
|
+
sources = ["requirements.yml"]
|
|
102
|
+
outputs = { auto = true }
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
---
|
|
2
|
+
# Generated from plexus-ms/tooling, templates/repo-operations.
|
|
3
|
+
# Mounts plexus.platform.playbook for the app hosts of the group `platform` (§ 1 PLX-Platform): `mise platform`.
|
|
4
|
+
- import_playbook: plexus.platform.playbook
|
|
5
|
+
|
|
6
|
+
# Plays of this tenant's own go below, tagged like the shipped ones.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
|
3
|
+
"extends": ["github>plexus-ms/tooling//renovate/default", "github>plexus-ms/tooling//renovate/operations"]{% if pr_reviewers %},
|
|
4
|
+
"reviewers": [{% for r in pr_reviewers.split(',') %}"{{ r.strip() }}"{% if not loop.last %}, {% endif %}{% endfor %}]{% endif %}
|
|
5
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Generated from plexus-ms/tooling, templates/repo-operations.
|
|
2
|
+
# The plexus.* collections at the Plexus version (§ 1.5 PLX), moved only by the pull request that takes a version.
|
|
3
|
+
collections:
|
|
4
|
+
- name: https://github.com/plexus-ms/tooling.git#/ansible/host/
|
|
5
|
+
type: git
|
|
6
|
+
version: 0.132.0
|
|
7
|
+
- name: https://github.com/plexus-ms/tooling.git#/ansible/platform/
|
|
8
|
+
type: git
|
|
9
|
+
version: 0.132.0
|
|
10
|
+
- name: https://github.com/plexus-ms/tooling.git#/ansible/infrastructure/
|
|
11
|
+
type: git
|
|
12
|
+
version: 0.132.0
|
|
13
|
+
- name: https://github.com/plexus-ms/tooling.git#/ansible/ci/
|
|
14
|
+
type: git
|
|
15
|
+
version: 0.132.0
|
package/dist/templates/repo-operations/files/{% if ci_strategy != 'github' %}ci.yml{% endif %}.jinja
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
---
|
|
2
|
+
# Generated from plexus-ms/tooling, templates/repo-operations.
|
|
3
|
+
# Mounts plexus.ci.playbook for the runner host of the group `ci` (§ 8 PLX-Delivery): `mise ci`.
|
|
4
|
+
- import_playbook: plexus.ci.playbook
|
|
5
|
+
|
|
6
|
+
# Plays of this tenant's own go below, tagged like the shipped ones.
|