Skip to main content

Notes engine on a server

Run your notes’ R sessions on a bigger server while OmicsBase stays on your machine.

A local installation runs your notes’ R sessions on the machine it is installed on. To use a bigger machine, start the notes engine on a server and point your installation at it with ENGINE_URL.

Your installation connects to the server, and the server never connects back, so the installation can stay on a laptop behind a home router.

This moves notes only. To run Reports on another machine, see Reports on your own computer.

What you need

  • A working OmicsBase installation. See Install on your own machine.
  • A server with Docker and Compose v2.
  • A DNS name pointing at the server, for example engine.example.org.
  • Ports 80 and 443 open on the server, so it can get an HTTPS certificate and receive connections.

The engine must be reached at a public HTTPS address. An engine on a private address, such as a machine on your local network, is refused by OmicsBase.

1. Set up the server

On the server, download the three setup files into a new folder:

mkdir omicsbase-engine && cd omicsbase-engine
for f in docker-compose.yml Caddyfile .env.example; do
  curl -fsSLO https://raw.githubusercontent.com/0xMuluh/omicsbase/main/local/engine-server/$f
done
cp .env.example .env
chmod 600 .env

2. Fill in the server’s .env

Open .env on the server and set:

Variable Set it to
ENGINE_DOMAIN The server’s DNS name, for example engine.example.org
OMICSBASE_ENGINE_SECRET The value of OMICSBASE_ENGINE_SECRET in ~/omicsbase/.env on your installation
OMICSBASE_VERSION The image version, latest by default. If you pinned a version on your installation, use the same one.

Copy the secret from ~/omicsbase/.env; the two must match.

3. Start the engine

On the server, in the omicsbase-engine folder:

docker compose up -d

This starts two containers: the engine, and Caddy in front of it. Caddy gets the HTTPS certificate for ENGINE_DOMAIN by itself.

4. Point OmicsBase at the server

On the machine where OmicsBase is installed, add this line to ~/omicsbase/.env, with your server’s name:

ENGINE_URL=https://engine.example.org

Then restart OmicsBase:

cd ~/omicsbase && docker compose up -d

New notes now run on the server. Files of notes made before stay on the machine that ran them.

The engine does not answer

You see in a note, while a cell runs:

The notes engine is not answering. Still trying…

The cell keeps trying for about a minute. If the engine answers again, the cell carries on. If not, or if the engine cannot be reached when the cell starts, the cell ends with:

Could not reach the notes engine at engine.example.org. Check that the server is running and that ENGINE_URL in ~/omicsbase/.env is right, then run the cell again.

OmicsBase also checks the engine once each time it starts. To see the result, run this on the machine where OmicsBase is installed:

cd ~/omicsbase && docker compose logs api | grep "notes engine"

It says either The notes engine at engine.example.org answers. or The notes engine at engine.example.org does not answer: followed by the reason.

To find the cause:

  1. Ask the engine yourself. Open its health address, with your server’s name, in a browser or with curl:

    curl https://engine.example.org/health

    A running engine answers {"status":"ok"}. The health address needs no secret and starts no R.

  2. If the health address does not answer, check the server. In the omicsbase-engine folder:

    docker compose ps
    docker compose logs engine caddy

    Both containers must be running. Check also that the DNS name points at the server and that ports 80 and 443 are open.

  3. If the health address answers but cells still fail, check ENGINE_URL in ~/omicsbase/.env on your installation. It must be the same address, starting with https://. After a change, restart OmicsBase:

    cd ~/omicsbase && docker compose up -d

Then run the cell again.

Where your data lives

With ENGINE_URL set, your notes’ R sessions, files and plots live on the server, in the omicsbase-engine folder:

Folder What it holds
data/projects/ Files of notes: data, figures and results
data/engine-cache/ Downloaded ExperimentHub and AnnotationHub data
data/caddy/ Caddy’s HTTPS certificate

Your accounts and the notes’ messages stay in ~/omicsbase/data/ on your machine.

Security

  • The secret is the key to the server. Anyone holding OMICSBASE_ENGINE_SECRET can run R on the engine. Keep .env private on both machines, and never share or commit it.
  • The server is on the internet. Caddy publishes the engine on ports 80 and 443 of the server’s name. The engine runs R only for requests that carry the secret; its health address answers without one.
  • One installation per secret. Give the server the secret of the installation that uses it. If you think the secret has leaked, set a new value in ~/omicsbase/.env (from openssl rand -hex 32), copy it to the server’s .env, and run docker compose up -d on both.

Update the server

On the server, in the omicsbase-engine folder:

docker compose pull
docker compose up -d

Update the server when you update OmicsBase, so both run the same version. See Updating and backups.

Go back to the engine on your machine

Remove the ENGINE_URL line from ~/omicsbase/.env, or put # in front of it, then:

cd ~/omicsbase && docker compose up -d

New notes run on your machine again. Files of notes that ran on the server stay there.