skip to content

Installation and configuration

The installation example of the repository ambrogio-app, in its folder docker/self-hosted, installs Ambrogio on one host with Docker Compose: PostgreSQL, the server of Ambrogio, and Caddy as the HTTPS entry.

  • A host that runs containers, with Docker and Docker Compose. The image of Ambrogio is published for linux/amd64 and linux/arm64: an x86-64 machine such as a mini-PC or a NAS, or an ARM computer, both work.
  • A domain name for the installation, for which Caddy obtains the HTTPS certificate.
  • A key of the supplier of the language models that the agent files name (Mistral in the example).
File What it is
compose.yaml The services: postgres, migrate (applies the migrations, then ends), server and caddy.
.env.example Every value of the installation, with its description; copied to .env.
Caddyfile Caddy obtains the HTTPS certificate of the domain and passes every request to the server.
postgres-init.sh Creates the two database users of Ambrogio on the first start of an empty database.
agents/ The agent files: orchestrator.json and one file for each specialized agent, such as generic.json.
speech/ The folder of the speech models, empty until you download them (see Voice).
  1. Copy the folder docker/self-hosted to the host.

  2. Copy .env.example to .env and set its values (see the worked example).

  3. Start the installation:

    Terminal window
    docker compose up -d

migrate applies the migrations and ends, then the server starts, then Caddy. Other commands of the command-line interface run the same way:

Terminal window
docker compose run --rm server cli <command>

Every value is in .env. The passwords are written into connection URLs: use letters and digits only.

Value What it sets
AMBROGIO_DOMAIN Domain name of the installation; Caddy obtains its HTTPS certificate.
AMBROGIO_HTTP_PORT, AMBROGIO_HTTPS_PORT Ports of the host on which Caddy answers, 80 and 443 by default.
AMBROGIO_SUBNET Subnet of the internal network of Compose; change it only if it overlaps a network of the host. The server trusts the X-Forwarded-For header of the requests that come from it, through Caddy.
POSTGRES_PASSWORD Password of the PostgreSQL superuser.
AMBROGIO_MIGRATION_PASSWORD Password of the migration database user, owner of the database, used only by cli migrate.
AMBROGIO_BACKEND_PASSWORD Password of the backend database user, used by the server.
AMBROGIO_LOG_LEVEL Lowest level of the log lines: fatal, error, warn, info, debug, trace or silent.
AMBROGIO_CONVERSATION_LANGUAGE Language of the household: it, en, fr, es or de, en by default.
AMBROGIO_TIME_ZONE Time zone of the household, of the IANA database, such as Europe/Rome. Required, with no default: the server does not start without it.
MISTRAL_API_KEY Key of the supplier of the language models that the agent files of ./agents name.
AMBROGIO_SPEECH_DIR Optional: the folder of the speech models, /etc/ambrogio/speech. Left unset, the installation has no voice.

The three passwords are given to the database users on the first start only. To change one later:

  1. Set it in the database, as the PostgreSQL superuser, naming its user (postgres, ambrogio_migration or ambrogio_backend); psql asks for the new password, so that it stays out of the shell history:

    Terminal window
    docker compose exec postgres psql --username=postgres --command='\password ambrogio_backend'
  2. Write the new password in .env, in place of the old one.

  3. Restart, so that the services read it: docker compose up -d.

.env.example lists, in its comments, every other value that the server and the command-line interface read, with its description and its default. To replace the default of one of them, set it in .env and in the environment of the server service of compose.yaml, then restart.

The server reads its agents from the JSON files of ./agents, mounted read-only at /etc/ambrogio/agents, once at start: orchestrator.json, which chooses the specialized agent that answers each message, and one file for each specialized agent, named after it in lowercase letters, digits and hyphens. Each file names the environment variable that holds the key of its supplier of language models, never the key itself; the server refuses to start with a message that names each file and what is wrong. The suppliers an agent file can name are mistral, openai, anthropic, google and openai-compatible (which also takes baseURL, the address of its API).

A specialized agent can also reach an MCP server: see Agents.

A household that speaks English, in the time zone Europe/London, with the installation at the placeholder domain ambrogio.example.com. .env:

AMBROGIO_DOMAIN=ambrogio.example.com
AMBROGIO_HTTP_PORT=80
AMBROGIO_HTTPS_PORT=443
AMBROGIO_SUBNET=172.30.0.0/24
POSTGRES_PASSWORD=examplePostgresPassword1
AMBROGIO_MIGRATION_PASSWORD=exampleMigrationPassword2
AMBROGIO_BACKEND_PASSWORD=exampleBackendPassword3
AMBROGIO_LOG_LEVEL=info
AMBROGIO_CONVERSATION_LANGUAGE=en
AMBROGIO_TIME_ZONE=Europe/London
MISTRAL_API_KEY=<your Mistral key>
AMBROGIO_SPEECH_DIR=/etc/ambrogio/speech

Replace the three example passwords with your own, of letters and digits only, and keep .env out of any repository.

The agents, as the example ships them. agents/orchestrator.json:

{
"instructions": "Choose the agent that should answer the latest message of the household. Route general questions, conversation and unclear requests to generic. If the message answers a question of an agent, choose the same agent.",
"llm": {
"provider": "mistral",
"model": "mistral-medium-latest",
"apiKeyEnv": "MISTRAL_API_KEY"
}
}

agents/generic.json:

{
"description": "Answers general questions and makes conversation.",
"instructions": "You are Ambrogio, the assistant of the household. Answer briefly and plainly. Requests may come from speech recognition and contain misheard words; interpret them in context. If you cannot understand a request, ask the household to repeat it.",
"llm": {
"provider": "mistral",
"model": "mistral-medium-latest",
"apiKeyEnv": "MISTRAL_API_KEY"
}
}

The English recognition model and the voice Kristin go into speech/en/recognition and speech/en/voice, as Voice shows. Then start the installation and wait until the server is healthy:

Terminal window
docker compose up -d --wait

Ambrogio answers at https://ambrogio.example.com, and its health at https://ambrogio.example.com/health.

Ambrogio recognizes and speaks the conversation language of the installation with speech models that run on the host: a recognition model and a voice. They are not in the image: download them into the speech folder, which compose.yaml mounts read-only into the server at /etc/ambrogio/speech, and set AMBROGIO_SPEECH_DIR=/etc/ambrogio/speech in .env. Without them the installation has no voice, and conversations go on by text.

The speech folder holds one folder for each language, named by its code, with the recognition model in recognition and the voice in voice. The server loads only the models of the conversation language, and does not start when one of them is missing.

The models come from the releases of sherpa-onnx. The recognition model, Nemotron 3.5 ASR streaming 0.6B of NVIDIA, recognizes all five languages and is under the OpenMDW License 1.1. The voices are Piper (VITS) voices, from rhasspy/piper-voices, each under the license of the dataset it was trained on. The README of the installation example lists, for each of the five languages, the address and the SHA-256 digest of the recognition model and of a female and a male voice, with their licenses and the attributions they require.

For each archive, download it, check its SHA-256 digest, and extract it into its folder; for the voice Kristin of English, from the speech folder:

Terminal window
mkdir -p en/voice && cd en
curl --fail --location --remote-name <address>
echo "<digest> <archive>" | sha256sum --check --strict
tar -xjf <archive> -C voice --strip-components=1 && rm <archive>

Each archive holds one folder, named after it without .tar.bz2: --strip-components=1 extracts its files directly into recognition or voice. The Spanish voice Sharvard holds two speakers: for the female one, set AMBROGIO_SPEECH_SPEAKER=1 in .env.

After installing the models, restart and wait until the server is healthy:

Terminal window
docker compose up -d --wait

The server loads the models when it starts and does not start when a model cannot be loaded, so a healthy server has loaded them. If it does not become healthy, docker compose logs server names the folder and the reason.

Caddy is the only service reachable from outside the host: it answers plain HTTP only with a redirect to HTTPS and serves Ambrogio over HTTPS, with the certificate it obtains for AMBROGIO_DOMAIN. The server and PostgreSQL talk over the internal network of Compose, which never leaves the host and publishes no port.

If you split the parts of the installation across hosts, for example PostgreSQL on another machine, the connections between them leave the host and the example no longer protects them: encrypting them, for example with TLS for PostgreSQL or a VPN between the hosts, is the responsibility of whoever runs the installation.

Ambrogio does not encrypt what it stores: the operator chooses how the database and its backups are encrypted where they are stored, for example with an encrypted disk on the host that keeps the volume of PostgreSQL and with encrypted backups.

A voice satellite verifies the certificate of Ambrogio when the address it is set with is https. An operator whose satellite cannot verify that certificate, or who otherwise prefers it, may set the satellite with an http address instead; then the conversation and the voice travel unencrypted between the satellite and Ambrogio, and any device of the home network can read and change them, and pose as Ambrogio. That choice, and its risk, are the operator’s.

To make it work, add the route of the conversation channel, in plain HTTP, on the home network only, as a further site of the Caddyfile, listening on the published HTTP port:

# A separate site, reachable only on the home network: do not expose this to the internet.
http://satellite.home.arpa {
reverse_proxy /api/v1/conversation-channel server:3000
}

The address of the satellite is then that site’s address, for example http://satellite.home.arpa. It must answer directly, never with a redirect: an http address that redirects to https makes the satellite retry without pause.

Back up the database by hand with pg_dump, run inside the postgres service, in its custom format:

Terminal window
docker compose exec postgres pg_dump --format=custom --username=postgres ambrogio > ambrogio.dump

To restore it, stop server and migrate first, so nothing writes to the database during the restore, then run pg_restore the same way and start the installation again:

Terminal window
docker compose stop server migrate
docker compose exec --no-tty postgres pg_restore --clean --if-exists --username=postgres --dbname=ambrogio \
< ambrogio.dump
docker compose up -d

A backup holds every stored conversation in clear, as the database itself does: protect it the same way. Ambrogio makes no automated or scheduled backup; run these commands by hand, at the interval you choose.

The server answers GET /health on port 3000 of the internal network, which compose.yaml uses to mark the service healthy; through Caddy it is also https://<AMBROGIO_DOMAIN>/health. Its answers:

  • 200 with {"status":"ok"}: the server runs and its database answers.
  • 503 with {"status":"unavailable"}: the server runs but its database does not answer; the server logs the reason.
  • no answer: the server is not running or cannot be reached.

Each database user has only the rights it needs; keep it so if you create the users yourself, for example on a PostgreSQL that you run already:

  • ambrogio_migration owns the database and changes its structure; only cli migrate uses it, from the migrate service.
  • ambrogio_backend, used by the server, only connects: cli migrate grants it reading and writing the data of the tables. Give it no right to create, change or drop tables or schemas, and do not make it the owner of the database or a superuser.
  • postgres, the superuser, is used only to create the two users on the first start (postgres-init.sh) and to change their passwords; the services of Ambrogio never connect with it.