Skip to main content

Notes engine on a server

Run the R of your notes on a bigger server while OmicsBase stays on your own machine.

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

The install connects to the server; nothing on the server needs to reach the install. Your install can therefore 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 install. 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 the install.

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 your install’s ~/omicsbase/.env
OMICSBASE_VERSION The image version, latest by default. If you pinned a version on the install, use the same one.

Copy the secret from your install’s .env; do not generate a new one. 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 your install at the server

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

ENGINE_URL=https://engine.example.org

Then restart the install:

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.

The install also asks the engine once each time it starts. See the answer on the machine with your install:

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 install: it must be the same address, starting with https://. After a change, restart the install:

    cd ~/omicsbase && docker compose up -d

Then run the cell again.

Where your data lives

With ENGINE_URL set, the R of your notes, their files and their 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 the install’s data/ on your own 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’s notes connection only accepts requests that carry the secret.
  • One install per secret. Give the server the secret of the install that uses it. If you think the secret has leaked, set a new value in the install’s .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 the install, 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.