Summary
A portal is a static website that opens on Linkr with a workspace already loaded: its projects, mapping projects, ETL pipelines, schemas and databases. Linkr Portal builds it from the workspace’s Git repository and its linked repositories, then publishes it on GitLab Pages. The site rebuilds every week: a newly linked item shows up without any change to the portal.
How it works
A portal repository holds no content. It only names the workspace to publish, in a portal.conf file. Each build:
- fetches Linkr, at the version set in
portal.conf; - clones the workspace and reads its
git-links.json, the list of items linked to their own repository (see Versioning and collaboration); - clones each of those repositories and places its content in the workspace;
- builds the site and publishes it.
Every build takes the current state of the workspace and of each linked repository. To publish a new item, link it to its repository in Linkr and push the workspace: the next build picks it up. Nothing needs changing in the portal, and nothing needs configuring in the linked repositories.
The site runs entirely in the browser, like the client-only install: there is no server to host. Visitors work on their own copy of the data, which stays in their browser.
Before you start
- A workspace pushed to a Git repository from Linkr (the workspace’s Git Remote tab), with the items to publish linked to their own repositories.
- A GitLab account (gitlab.com, or a GitLab instance with Pages) and an empty project for the portal.
- If the content is private: the Owner role on the GitLab group that holds the content repositories, to create the access token in step 3.
Set up the portal
Create the portal repository
Create an empty GitLab project, for example my-org/linkr-portal-my-workspace, then start from the linkr-portal template:
git clone https://framagit.org/interhop/linkr/linkr-portal.git linkr-portal-my-workspace
cd linkr-portal-my-workspace
git remote rename origin template
git remote add origin git@gitlab.com:my-org/linkr-portal-my-workspace.gitThe template stays reachable as template, so you can pull its improvements later.
Point it at the workspace
In portal.conf, set the HTTPS address of the workspace repository and a short name for it:
: "${WORKSPACE_URL:=https://gitlab.com/my-org/linkr-content/workspaces/my-workspace}"
: "${WORKSPACE_FOLDER:=my-workspace}"Use the HTTPS address, not SSH: the build authenticates over HTTPS. Once the portal is in use, keep WORKSPACE_FOLDER unchanged: visitors’ browsers store their copy of the data under that name.
Give access to private repositories
Skip this step if the workspace and every linked repository are public.
If they are private, you give the build one read-only key for the whole group that holds them. You do not authorise each repository in turn.
Create the token. On the GitLab group of the content repositories, open Settings > Repository > Deploy tokens > Add token:
| Field | Value |
|---|---|
| Name | linkr-portals |
| Expiration date | empty (no expiry), or a date you will renew it by |
| Username | empty: GitLab generates one (gitlab+deploy-token-…) |
| Scopes | read_repository only |
Write down the username and the token (gldt-…): the token is shown only once. This deploy token reads every repository of the group and its subgroups, including those created later.
Store it in the portal. In the portal project, not the group, open Settings > CI/CD > Variables > Add variable, twice:
| Key | Value | Visibility | Protect variable |
|---|---|---|---|
CONTENT_TOKEN_USER | the token’s username | Visible | checked |
CONTENT_TOKEN | the token | Masked and hidden | checked |
Leave Expand variable reference unchecked.
- Masked hides the token in build logs.
- Protect variable passes it only to the
mainbranch, protected by default. - A group variable would be readable by every project in the group, including content repositories many people can push to. That is why the token goes in the portal project alone.
Push and check the first build
git push -u origin mainThe push starts the pages job (Build > Pipelines). In its log, check that:
- every
[default-data] … cloningline passes, with noERROR; - the list of repositories and their versions is printed;
- the log ends with
[portal] Done.
The same list is kept in the job’s build-info.txt file.
Open the site and choose who sees it
Deploy > Pages gives the site’s address, for example https://linkr-portal-my-workspace-a1b2c3.gitlab.io/.
If the content is private, restrict access: in Settings > General > Visibility, project features, permissions, under Pages, choose Only project members. Visitors then sign in to GitLab and must be members of the portal project.
Schedule the weekly rebuild
Build > Pipeline schedules > New schedule:
| Field | Value |
|---|---|
| Description | Weekly rebuild |
| Interval pattern | 0 6 * * 1 (Mondays, 06:00) |
| Target branch | main |
If a build fails, GitLab emails the schedule’s owner, and the version already published stays online.
The portal is in place
From now on, link an item in Linkr and push the workspace: it appears on the portal at the next rebuild. To publish right away, run a build by hand (Build > Pipelines > Run pipeline).
What the token lets the portal publish
Any repository in the token’s group that the workspace’s git-links.json names gets published, and anyone who can push the workspace can edit that file. Outside the group, only public repositories can be cloned. Choose the group accordingly: a narrower subgroup narrows what the portal can publish.
Day-to-day
| To… | Do |
|---|---|
| Publish a newly linked item | Link it in Linkr and push the workspace. Wait for the weekly rebuild, or run one by hand. |
| Publish changes right away | Build > Pipelines > Run pipeline on main. |
| Move to a new Linkr version | Change LINKR_REF in portal.conf and push. |
| Know what a build contained | Download its job’s build-info.txt. |
Public and private content
Keep public and private apart in the structure itself: two content groups, and one portal per visibility.
- A public portal, with no token, reading
linkr-content-public. It cannot clone a private repository, even one linked by mistake: its build fails instead of leaking it. - A private portal, whose token covers only
linkr-content-private, and whose site is restricted to project members.
Troubleshooting
could not clone … Authentication failed. The repository is private and the build cannot read it. Possible causes: variables missing or misspelled, main branch not protected, token expired, or repository outside the token’s group.
tracks files with git-lfs, but git lfs pull failed. Same checks. A database’s data files (Parquet) are stored with Git LFS and go through the same token.
content needs a newer Linkr than this build. A linked repository was saved by a newer Linkr. Raise LINKR_REF in portal.conf.
JavaScript heap out of memory. The build machine is short of memory. Use a runner (the machine that runs GitLab jobs) with at least 8 GB of RAM.
Further reading
- Versioning and collaboration — linking an item to its own repository, and what
git-links.jsonholds. - Deployment modes — what a client-only site can and cannot do.
- linkr-portal — the template, with the full configuration reference and local builds.