Use main branch to simpyfy config
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
# CTAO Science Portal — simple proof of concept
|
# CTAO Science Portal — simple proof of concept
|
||||||
|
|
||||||
The `simple` branch uses the sibling `mockup` project's layout, assets, CSS,
|
The `main` branch uses the sibling `mockup` project's layout, assets, CSS,
|
||||||
and header interactions. Astro generates a static site. Sveltia CMS edits
|
and header interactions. Astro generates a static site. Sveltia CMS edits
|
||||||
exactly four Markdown pages in the separate `ctao/content` repository.
|
exactly four Markdown pages in the separate `ctao/content` repository.
|
||||||
|
|
||||||
@@ -80,10 +80,10 @@ needed to display the button. A Markdown blockquote receives the mockup's
|
|||||||
highlight styling. Images without alternative text are treated as decorative.
|
highlight styling. Images without alternative text are treated as decorative.
|
||||||
Menu labels, ordering, URLs, and the shared site layout remain code-controlled.
|
Menu labels, ordering, URLs, and the shared site layout remain code-controlled.
|
||||||
|
|
||||||
Remote editing uses Gitea OAuth and saves to **`ctao/content`, branch `simple`**.
|
Remote editing uses Gitea OAuth and saves to **`ctao/content`, branch `main`**.
|
||||||
That branch must contain the four files from `sample-content/pages/` and the
|
That branch must contain the four files from `sample-content/pages/` and the
|
||||||
sample upload before publishing this version. The code mirror is
|
sample upload before publishing this version. The code mirror is
|
||||||
**`ctao/portal`, branch `simple`**. Deployment independently selects
|
**`ctao/portal`, branch `main`**. Deployment independently selects
|
||||||
`CODE_BRANCH` and `CONTENT_BRANCH`, overlays content, runs checks, and publishes
|
`CODE_BRANCH` and `CONTENT_BRANCH`, overlays content, runs checks, and publishes
|
||||||
atomically. `CONTENT_BRANCH` must match `backend.branch` in the CMS config.
|
atomically. `CONTENT_BRANCH` must match `backend.branch` in the CMS config.
|
||||||
|
|
||||||
|
|||||||
+19
-13
@@ -29,27 +29,28 @@ missing). Everything else runs inside containers.
|
|||||||
| 3000 | Gitea | https://astro-git.isl-dev.grid.cyfronet.pl (ingress vhost) |
|
| 3000 | Gitea | https://astro-git.isl-dev.grid.cyfronet.pl (ingress vhost) |
|
||||||
| 8080 | portal (nginx, static) | https://astro.isl-dev.grid.cyfronet.pl (ingress vhost) |
|
| 8080 | portal (nginx, static) | https://astro.isl-dev.grid.cyfronet.pl (ingress vhost) |
|
||||||
|
|
||||||
## Switch an existing demo to `simple`
|
## Publish the simplified portal from `main`
|
||||||
|
|
||||||
1. In a checkout of `ctao/content`, create a `simple` branch from the existing
|
1. In a checkout of `ctao/content`, switch to `main`. Copy the missing
|
||||||
content branch. Copy `sample-content/pages/*.md` and
|
Example files from `sample-content/pages/` and
|
||||||
`sample-content/uploads/hero.jpg` from this code repository into its root
|
`sample-content/uploads/hero.jpg` from this code repository into its root
|
||||||
`pages/` and `uploads/` directories, then commit the seed files. Existing
|
`pages/` and `uploads/` directories, then commit the seed files. Preserve
|
||||||
|
any existing editorial versions of these files. Existing
|
||||||
news or other page files can remain in the content history; this portal
|
news or other page files can remain in the content history; this portal
|
||||||
loads only the four Example files.
|
loads only the four Example files.
|
||||||
2. Push the content branch to Gitea as `ctao/content:simple`, and the code
|
2. Push the content branch to Gitea as `ctao/content:main`, and the code
|
||||||
branch as `ctao/portal:simple`. These are separate pushes; Bitbucket is
|
branch as `ctao/portal:main`. These are separate pushes; Bitbucket is
|
||||||
not the deployment remote.
|
not the deployment remote.
|
||||||
3. Copy the updated `build.sh` to `~/ctao-portal-demo/bin/build.sh` and the
|
3. Copy the updated `build.sh` to `~/ctao-portal-demo/bin/build.sh` and the
|
||||||
updated `ctao-portal-build.service` to `~/.config/systemd/user/`. Reload
|
updated `ctao-portal-build.service` to `~/.config/systemd/user/`. Reload
|
||||||
systemd with `systemctl --user daemon-reload`. The service explicitly sets
|
systemd with `systemctl --user daemon-reload`. The service explicitly sets
|
||||||
`CODE_BRANCH=simple` and `CONTENT_BRANCH=simple`; the script defaults agree.
|
`CODE_BRANCH=main` and `CONTENT_BRANCH=main`; the script defaults agree.
|
||||||
4. Start the build service or let its timer run. It overlays `pages/` and
|
4. Start the build service or let its timer run. It overlays `pages/` and
|
||||||
`uploads/`, clears the previous news overlay, and runs `npm run check`
|
`uploads/`, clears the previous news overlay, and runs `npm run check`
|
||||||
before the atomic release switch. Missing Example pages fail the build.
|
before the atomic release switch. Missing Example pages fail the build.
|
||||||
5. Verify the four `/example/…/` pages and empty `/news/`. Sign in at `/admin/`,
|
5. Verify the four `/example/…/` pages and empty `/news/`. Sign in at `/admin/`,
|
||||||
save an Example title, and check that a commit appears on
|
save an Example title, and check that a commit appears on
|
||||||
`ctao/content:simple` and the rebuilt page reflects it.
|
`ctao/content:main` and the rebuilt page reflects it.
|
||||||
|
|
||||||
The OAuth client and public portal origin stay the same. Sveltia's
|
The OAuth client and public portal origin stay the same. Sveltia's
|
||||||
`backend.branch` in `public/admin/config.yml` must always match
|
`backend.branch` in `public/admin/config.yml` must always match
|
||||||
@@ -57,8 +58,13 @@ The OAuth client and public portal origin stay the same. Sveltia's
|
|||||||
environment variable is no longer used. For a separate preview hostname,
|
environment variable is no longer used. For a separate preview hostname,
|
||||||
update the site origin, OAuth redirect, and Gitea CORS together.
|
update the site origin, OAuth redirect, and Gitea CORS together.
|
||||||
|
|
||||||
To roll back, restore the previous deployed release and the previous worker
|
To undo the simplification in shared code history, use
|
||||||
script/service configuration. The original content `main` branch is retained.
|
`git revert -m 1 <simplification-merge-commit>` on `main` and publish the
|
||||||
|
resulting commit. The previous portal code is also preserved at `0772462`.
|
||||||
|
For an immediate deployment rollback, restore the previous release and worker
|
||||||
|
script/service configuration. Content has its own history: reverting a code
|
||||||
|
commit does not revert CMS edits. Keep the old content files available if
|
||||||
|
the previous portal may be restored.
|
||||||
|
|
||||||
## Install (each step reviewed before running; [W] = writes to the machine)
|
## Install (each step reviewed before running; [W] = writes to the machine)
|
||||||
|
|
||||||
@@ -84,12 +90,12 @@ script/service configuration. The original content `main` branch is retained.
|
|||||||
password never lands in a file or shell history:
|
password never lands in a file or shell history:
|
||||||
`podman exec -it ctao-demo-gitea gitea admin user create --admin --username <you> --email <you@…> --random-password`
|
`podman exec -it ctao-demo-gitea gitea admin user create --admin --username <you> --email <you@…> --random-password`
|
||||||
7. **[W]** In the Gitea UI: create org `ctao` with repos `portal` and
|
7. **[W]** In the Gitea UI: create org `ctao` with repos `portal` and
|
||||||
`content` (both public read). Seed the content `simple` branch with
|
`content` (both public read). Seed the content `main` branch with
|
||||||
`sample-content/pages/` and `sample-content/uploads/` as described above.
|
`sample-content/pages/` and `sample-content/uploads/` as described above.
|
||||||
Then, from your workstation, push both over
|
Then, from your workstation, push both over
|
||||||
the vhost with a repo-scoped token:
|
the vhost with a repo-scoped token:
|
||||||
`git push https://<user>:<token>@astro-git.isl-dev.grid.cyfronet.pl/ctao/portal.git simple`
|
`git push https://<user>:<token>@astro-git.isl-dev.grid.cyfronet.pl/ctao/portal.git main`
|
||||||
`git push https://<user>:<token>@astro-git.isl-dev.grid.cyfronet.pl/ctao/content.git simple`
|
`git push https://<user>:<token>@astro-git.isl-dev.grid.cyfronet.pl/ctao/content.git main`
|
||||||
8. **[W]** `systemctl --user enable --now ctao-portal-build.timer`. The first run
|
8. **[W]** `systemctl --user enable --now ctao-portal-build.timer`. The first run
|
||||||
clones + `npm ci` + builds (minutes); later runs are seconds. Wait until
|
clones + `npm ci` + builds (minutes); later runs are seconds. Wait until
|
||||||
`journalctl --user -u ctao-portal-build -n 5` shows `published <sha>`
|
`journalctl --user -u ctao-portal-build -n 5` shows `published <sha>`
|
||||||
|
|||||||
+2
-2
@@ -17,8 +17,8 @@ BASE="${BASE:-$HOME/ctao-portal-demo}"
|
|||||||
GITEA_URL="${GITEA_URL:-http://localhost:3000}" # published by ctao-demo-gitea
|
GITEA_URL="${GITEA_URL:-http://localhost:3000}" # published by ctao-demo-gitea
|
||||||
CODE_REPO="${CODE_REPO:-ctao/portal}" # owner/repo in Gitea
|
CODE_REPO="${CODE_REPO:-ctao/portal}" # owner/repo in Gitea
|
||||||
CONTENT_REPO="${CONTENT_REPO:-ctao/content}"
|
CONTENT_REPO="${CONTENT_REPO:-ctao/content}"
|
||||||
CODE_BRANCH="${CODE_BRANCH:-simple}"
|
CODE_BRANCH="${CODE_BRANCH:-main}"
|
||||||
CONTENT_BRANCH="${CONTENT_BRANCH:-simple}"
|
CONTENT_BRANCH="${CONTENT_BRANCH:-main}"
|
||||||
BUILD_IMAGE="${BUILD_IMAGE:-localhost/ctao-portal-build:1}"
|
BUILD_IMAGE="${BUILD_IMAGE:-localhost/ctao-portal-build:1}"
|
||||||
# The build joins the Gitea container's network namespace: localhost inside
|
# The build joins the Gitea container's network namespace: localhost inside
|
||||||
# the build = Gitea's loopback (port 3000), host loopback stays unreachable.
|
# the build = Gitea's loopback (port 3000), host loopback stays unreachable.
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ Description=CTAO portal demo — rebuild if the code or content repo has new com
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
Environment=CODE_BRANCH=simple
|
Environment=CODE_BRANCH=main
|
||||||
Environment=CONTENT_BRANCH=simple
|
Environment=CONTENT_BRANCH=main
|
||||||
ExecStart=%h/ctao-portal-demo/bin/build.sh
|
ExecStart=%h/ctao-portal-demo/bin/build.sh
|
||||||
# Polite neighbour on the shared VM:
|
# Polite neighbour on the shared VM:
|
||||||
Nice=10
|
Nice=10
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ backend:
|
|||||||
# Keep this branch in sync with CONTENT_BRANCH in deploy/build.sh.
|
# Keep this branch in sync with CONTENT_BRANCH in deploy/build.sh.
|
||||||
# Seed the content branch from sample-content/ before deploying.
|
# Seed the content branch from sample-content/ before deploying.
|
||||||
repo: ctao/content
|
repo: ctao/content
|
||||||
branch: simple
|
branch: main
|
||||||
base_url: https://astro-git.isl-dev.grid.cyfronet.pl
|
base_url: https://astro-git.isl-dev.grid.cyfronet.pl
|
||||||
api_root: https://astro-git.isl-dev.grid.cyfronet.pl/api/v1
|
api_root: https://astro-git.isl-dev.grid.cyfronet.pl/api/v1
|
||||||
app_id: cf1c44ac-ebe6-4a97-bf2f-f7f26ef1126c
|
app_id: cf1c44ac-ebe6-4a97-bf2f-f7f26ef1126c
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ if (!existsSync(local)) {
|
|||||||
cpSync(join(root, 'sample-content/uploads'), join(local, 'uploads'), { recursive: true });
|
cpSync(join(root, 'sample-content/uploads'), join(local, 'uploads'), { recursive: true });
|
||||||
}
|
}
|
||||||
if (!existsSync(join(local, '.git'))) {
|
if (!existsSync(join(local, '.git'))) {
|
||||||
execFileSync('git', ['init', '--quiet', '--initial-branch=simple', local], { stdio: 'inherit' });
|
execFileSync('git', ['init', '--quiet', '--initial-branch=main', local], { stdio: 'inherit' });
|
||||||
}
|
}
|
||||||
execFileSync(process.execPath, [join(root, 'scripts/content.mjs'), local], { stdio: 'inherit' });
|
execFileSync(process.execPath, [join(root, 'scripts/content.mjs'), local], { stdio: 'inherit' });
|
||||||
console.log(`In Sveltia, choose Work with Local Repository and select: ${local}`);
|
console.log(`In Sveltia, choose Work with Local Repository and select: ${local}`);
|
||||||
|
|||||||
Reference in New Issue
Block a user