diff --git a/README.md b/README.md index f31967d..8d67bc8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # 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 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. 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 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 atomically. `CONTENT_BRANCH` must match `backend.branch` in the CMS config. diff --git a/deploy/README.md b/deploy/README.md index a3cadba..62adb8b 100644 --- a/deploy/README.md +++ b/deploy/README.md @@ -29,27 +29,28 @@ missing). Everything else runs inside containers. | 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) | -## 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 - content branch. Copy `sample-content/pages/*.md` and +1. In a checkout of `ctao/content`, switch to `main`. Copy the missing + Example files from `sample-content/pages/` and `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 loads only the four Example files. -2. Push the content branch to Gitea as `ctao/content:simple`, and the code - branch as `ctao/portal:simple`. These are separate pushes; Bitbucket is +2. Push the content branch to Gitea as `ctao/content:main`, and the code + branch as `ctao/portal:main`. These are separate pushes; Bitbucket is not the deployment remote. 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 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 `uploads/`, clears the previous news overlay, and runs `npm run check` before the atomic release switch. Missing Example pages fail the build. 5. Verify the four `/example/…/` pages and empty `/news/`. Sign in at `/admin/`, 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 `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, update the site origin, OAuth redirect, and Gitea CORS together. -To roll back, restore the previous deployed release and the previous worker -script/service configuration. The original content `main` branch is retained. +To undo the simplification in shared code history, use +`git revert -m 1 ` 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) @@ -84,12 +90,12 @@ script/service configuration. The original content `main` branch is retained. password never lands in a file or shell history: `podman exec -it ctao-demo-gitea gitea admin user create --admin --username --email --random-password` 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. Then, from your workstation, push both over the vhost with a repo-scoped token: - `git push https://:@astro-git.isl-dev.grid.cyfronet.pl/ctao/portal.git simple` - `git push https://:@astro-git.isl-dev.grid.cyfronet.pl/ctao/content.git simple` + `git push https://:@astro-git.isl-dev.grid.cyfronet.pl/ctao/portal.git main` + `git push https://:@astro-git.isl-dev.grid.cyfronet.pl/ctao/content.git main` 8. **[W]** `systemctl --user enable --now ctao-portal-build.timer`. The first run clones + `npm ci` + builds (minutes); later runs are seconds. Wait until `journalctl --user -u ctao-portal-build -n 5` shows `published ` diff --git a/deploy/build.sh b/deploy/build.sh index 211e8f8..9beec2d 100755 --- a/deploy/build.sh +++ b/deploy/build.sh @@ -17,8 +17,8 @@ BASE="${BASE:-$HOME/ctao-portal-demo}" GITEA_URL="${GITEA_URL:-http://localhost:3000}" # published by ctao-demo-gitea CODE_REPO="${CODE_REPO:-ctao/portal}" # owner/repo in Gitea CONTENT_REPO="${CONTENT_REPO:-ctao/content}" -CODE_BRANCH="${CODE_BRANCH:-simple}" -CONTENT_BRANCH="${CONTENT_BRANCH:-simple}" +CODE_BRANCH="${CODE_BRANCH:-main}" +CONTENT_BRANCH="${CONTENT_BRANCH:-main}" BUILD_IMAGE="${BUILD_IMAGE:-localhost/ctao-portal-build:1}" # The build joins the Gitea container's network namespace: localhost inside # the build = Gitea's loopback (port 3000), host loopback stays unreachable. diff --git a/deploy/ctao-portal-build.service b/deploy/ctao-portal-build.service index 145bb24..6bb458d 100644 --- a/deploy/ctao-portal-build.service +++ b/deploy/ctao-portal-build.service @@ -8,8 +8,8 @@ Description=CTAO portal demo — rebuild if the code or content repo has new com [Service] Type=oneshot -Environment=CODE_BRANCH=simple -Environment=CONTENT_BRANCH=simple +Environment=CODE_BRANCH=main +Environment=CONTENT_BRANCH=main ExecStart=%h/ctao-portal-demo/bin/build.sh # Polite neighbour on the shared VM: Nice=10 diff --git a/public/admin/config.yml b/public/admin/config.yml index ca1c1c1..a8bc9b5 100644 --- a/public/admin/config.yml +++ b/public/admin/config.yml @@ -7,7 +7,7 @@ backend: # Keep this branch in sync with CONTENT_BRANCH in deploy/build.sh. # Seed the content branch from sample-content/ before deploying. repo: ctao/content - branch: simple + branch: main base_url: https://astro-git.isl-dev.grid.cyfronet.pl api_root: https://astro-git.isl-dev.grid.cyfronet.pl/api/v1 app_id: cf1c44ac-ebe6-4a97-bf2f-f7f26ef1126c diff --git a/scripts/local-content.mjs b/scripts/local-content.mjs index e6acb87..a75714f 100644 --- a/scripts/local-content.mjs +++ b/scripts/local-content.mjs @@ -12,7 +12,7 @@ if (!existsSync(local)) { cpSync(join(root, 'sample-content/uploads'), join(local, 'uploads'), { recursive: true }); } 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' }); console.log(`In Sveltia, choose Work with Local Repository and select: ${local}`);