14 KiB
Terminology Portal
Quick Overview
An opensource Terminology portal which anybody can set up (hopefully without much trouble).
The main instance is available at https://terminoloski.slovenscina.eu.
You can use your own instance completely independently or link it with other such instances, including the main one, and have them share dictionaries and their entries.
Likewise, the included consultancy module can use its built-in, fully featured tools for your consultants to process terminology questions (default) or simply be linked with the one at ISJFR, ZRC SAZU so that their professional consultants will answer the questions.
Setting up your own instance of the portal
The guide is written for Ubuntu 22.04 LTS. Adjust according to your OS.
1. Install external dependencies first
- Install the Docker Engine.
- Install the Term Candidate Extraction API.
- Make sure you have a SMTP server/service available, which the portal will require.
- Install a reverse proxy (e.g. Nginx).
2. Reconfigure the docker engine
By default, docker engine doesn't perform log rotation, which will eventually lead to disk exhaustion. Search indexes will prevent all write operations at 90% full which will make many operations on the portal fail until disk usage falls under 85% again.
Also, by default, image build process is not optimized.
To address both of the above, it is suggested to add the following to the /etc/docker/daemon.json :
{
"log-driver": "local",
"features": {
"buildkit": true
}
}
Even better, set "log-driver": "journald" instead, so the logs get sent straight to your journald.
Alternatively, set your own preferred log aggregator as per the official documentation.
You need to restart the engine for the settings to take effect. Run: sudo systemctl restart docker.service
3. Get and configure the portal
- Using git transfer the portal code into desired directory with
git clone https://github.com/clarinsi/rsdo_term_portal.git <directory path> - Navigate into that directory and copy the .env file from the dev folder one level up (into the root directory of the portal).
- Open the copied .env file in a text editor and adjust the parameters of your portal.
4. (Advanced/optional) Adjust data storage locations or other host-specific settings
By default, all data is stored and persisted inside Docker's volumes
on your host's root partition. If you have a setup where for any reason you want to store data
elsewhere, e.g. using bind mounts, or need other
host-specific tweaks (resource limits, etc.), do not edit docker-compose.prod.yml directly.
Instead, copy docker-compose.prod.override.example.yml to docker-compose.prod.override.yml next to
it and adjust only the keys that need to differ on this host. ./run-prod.sh (see next step)
automatically layers this override file in when present, so it never needs to be manually re-applied
after pulling changes to docker-compose.prod.yml. docker-compose.prod.override.yml is gitignored on
purpose — it's host-specific and shouldn't be tracked or committed.
5. Start the portal service cluster
- Inside the portal directory, run the following command in CLI:
./run-prod.sh --profile concordancer-manager up -d --build - It's going to take some time for all the resources to get downloaded and built. Wait for control to be returned to CLI before continuing.
6. First time concordancer setup
- Open a bash session inside the concordancer-manager container by running:
docker exec -it $(docker ps --format "{{.Names}}" | grep concordancer-manager) bash - In that session, run:
dotnet Rsdo.Concordancer.SystemManager.dll createMasterDb --connectionString="Host=postgres;Username=concordancer;Password=<POSTGRES_CONCORDANCER_PASSWORD>;Database=postgres". Replace<POSTGRES_CONCORDANCER_PASSWORD>with the value you set for it in the .env file. - After that, also in that session, run:
dotnet Rsdo.Concordancer.SystemManager.dll importSloleks --sourceFile=/sloleks/Sloleks2.0.LMF/sloleks_clarin_2.0.xml. This command takes a bit more time than the previous one to finish. - Close the session (Ctrl + D)
7. Reverse proxy setup
- Forward the majority of trafic to the the main port, set appropriate headers, needed for normal functioning of the webserver and increase the maximum allowed request body size. Example location block for Nginx config:
location / {
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 1100M;
proxy_pass http://127.0.0.1:<EXPRESS_LISTEN_PORT>;
}
Replace <EXPRESS_LISTEN_PORT> with whichever port you set as EXPRESS_LISTEN_PORT in the .env file, or even change the IP address or protocol if you've done done some changes to docker-compose.prod.yml or other system wide configuration and generally know, what you're doing.
- Forward concordancer client trafic to the /korpus path Example location block for Nginx config:
location /korpus/ {
proxy_pass http://127.0.0.1:<CONCORDANCER_LISTEN_PORT>/;
}
Same as above, except replace <CONCORDANCER_LISTEN_PORT> with the value of CONCORDANCER_LISTEN_PORT.
-
Don't forget setting up proper SSL termination, compression, ...
-
Also don't forget to make your changes take effect. For Nginx,
sudo systemctl reload nginx.serviceis usually the easiest way.
8. Done
Your portal should now be available at whichever address/domain your reverse proxy is set to listen to.
Automated deployment (CI/CD)
The generic guide above builds images on the host with up -d --build. For a maintainer who
runs one or more long-lived environments (e.g. staging + production VPSs), there is an automated
pipeline built on Gitea Actions and the Gitea container registry. It builds the three
custom images (express, opensearch, concordancer) once, pushes them to the registry, and
each host pulls them instead of building — no more copying files around or building on the VPS.
Flow:
- Push to the default branch → CI builds + pushes images tagged
sha-<short>→ auto-deploys to staging. - Push a version tag
vX.Y.Z→ CI promotes the exact staging-tested images to that tag (no rebuild) → deploys to production. Pushing the tag is the deliberate human release gate. - Rollback / ad-hoc deploy → run the deploy-dispatch workflow with a previous tag.
The pieces live in the repo:
docker-compose.prod.yml— each built service has both animage:(registry ref, via${REGISTRY}/${IMAGE_TAG}) and itsbuild:block. Unset, the vars default to a local name so the genericup --buildpath still works untouched..gitea/workflows/build-and-stage.yml,release-prod.yml,deploy-dispatch.yml.dev/ci/build.sh(buildx build + push, registry layer cache),dev/ci/promote.sh(retag without rebuild),dev/ci/deploy.sh(runner side: SSH the target the tag to deploy),dev/ci/ci-deploy-wrapper.sh(host side: the forced command that validates the tag and runsgit checkout+run-prod.sh pull+up -d). The CI key is pinned to that wrapper, so a leaked key can only ever trigger a tag deploy on one host — never an arbitrary command (seedev/ci/README.md).
One-time setup
- Enable Gitea Actions and confirm the container registry is on (both are usually default in recent Gitea).
- Register a runner. On a build host — ideally a machine that is not your public production
server but has Docker, disk, and internet (the concordancer build downloads a large lexicon) —
install the Gitea Runner (
gitea/runner; formerlyact_runner) and register it repo-scoped with theself-hostedlabel the workflows target. The runner only needs outbound reachability to Gitea and SSH reachability to the deploy hosts. Full step-by-step + smoke tests:dev/ci/README.md. - Prepare each target host (staging, prod):
- Create a dedicated
deployuser (keeps automation out of your personal account and gives clean audit/revocation); add it to thedockergroup. git clonethe repo to a stable path, e.g./opt/termportal-stagingor/opt/termportal-prod.- Put the host-only
.env(withREGISTRY=<gitea-host>/<owner>set) and, if used,docker-compose.prod.override.ymlin that directory. Both are gitignored, sogit checkoutduring deploys never touches them. docker login <gitea-host>once with a read-only registry token sopullworks.- Install the hardened deploy key + forced-command wrapper — full commands in
dev/ci/README.md. In short: a dedicated CI keypair (never your personal key), its public half pinned in the deploy user'sauthorized_keyswithfrom="<runner-ip>",restrict,command="…/ci-deploy-wrapper.sh", and its private half stored as the Gitea secret below. - Do the first-time concordancer setup (section 6 above) once, as usual.
- Create a dedicated
- Add Gitea Actions secrets (repo → Settings → Actions → Secrets):
REGISTRY_TOKEN— a Personal Access Token withwrite:packagescope, used by CI to push images (the automaticGITEA_TOKENis not authorized to push packages); plusSTAGING_SSH_HOST,STAGING_SSH_USER,STAGING_SSH_KEYand thePROD_*equivalents; alsoSTAGING_SSH_PORT/PROD_SSH_PORTif a host's sshd doesn't listen on the default port 22 (both default to 22 when unset). (No*_DIRsecret is needed — each host's wrapper owns its checkout path viaci-deploy.conf.)
Day-to-day
- Deploy to staging:
git pushto the default branch. - Release to production:
git tag -a v1.2.3 -m "…" && git push origin v1.2.3(tag a commit already built on the default branch, so itssha-<short>images exist to promote). Use an annotated tag (-a), not a lightweight one — this repo's release tags carry a tagger, date, and message as a record of what shipped and why, which a lightweight tag (a bare pointer) doesn't have. Both tag kinds trigger therelease-prodworkflow the same way, since it matches on the ref name (refs/tags/v*); this only affects the tag's own metadata, not the deploy. - Rollback: run the deploy-dispatch workflow with the previous
vX.Y.Z(orsha-…) tag. Note: this rolls back application code only — database/schema changes are forward-only (there is no migration framework), so back up and treat schema changes deliberately.
Break-glass manual deploy
If CI is unavailable, SSH into the host and run the same wrapper the pipeline triggers:
/home/deploy/ci-deploy-wrapper.sh v1.2.3 # checkout, pull, up -d for that tag
Or drive the steps by hand (equivalent):
cd /opt/termportal-prod
git fetch --tags origin && git checkout --force v1.2.3
export IMAGE_TAG=v1.2.3 # REGISTRY comes from this host's .env
./run-prod.sh pull
./run-prod.sh up -d
Linking your instance with others
-
Using a web browser, navigate to your portal's main page.
-
In the upper right corner, change language to English. (the instructions are written using english UI labels)
-
Log in as the portal admin user.
-
Navigate Menu -> Administration -> Links -> Add link.
-
Fill in all the fields:
-
Portal name - your choice; it'll be displayed as the source of found entries, when the users use the portal's search tool.
-
Portal label - a 2 letter code of your choice; same as portal name, except a shorter version.
-
URL (dictionaries sync) - Format: <target_portal_origin>/api/v1/system/inter-instance-sync/dictionaries
Replace <target_portal_origin> with the origin of the portal, the dictionaries of which you wish to add to your portal.
To link the main instance of the portal, for example, you would enter: https://terminoloski.slovenscina.eu/api/v1/system/inter-instance-sync/dictionaries
-
URL (dictionary entries sync) - Format: <target_portal_origin>/api/v1/system/inter-instance-sync/dictionary/$SOURCE_ID/entries?lastSynced=$SINCE
<target_portal_origin> should be the same as for previous URL.
To link the main instance of the portal, for example, you would enter: https://terminoloski.slovenscina.eu/api/v1/system/inter-instance-sync/dictionary/$SOURCE_ID/entries?lastSynced=$SINCE
-
-
Click Add link. You will be returned to the list of linked portals, where the newly created portal will now be listed.
-
Click Dictionaries to see the list of all available dictionaries of the target portal. Enable the ones you wish to be added to your portal, click Save.
-
The selected dictionaries and all their entries will be automatically synchronized each night.
Linking to ZRC SAZU Terminological counselling
If you wish professional counselors to answer your users' terminological questions, you can do so by simply toggling a switch in the administration console.
- As previously described, navigate to the Menu -> Administration -> Basic settings -> Consultancy.
- Select ZRC SAZU Terminological counselling.
- Click Save.
That's it. Your questions will now be automatically forwarded to ZRC SAZU Terminological counselling and their answers back to your portal.