Skip to content

Install with Docker Compose#

The reference installation of Empowerment Center 8: a server with Docker running the own database, the backend and the frontend, all described in deploy/compose.yaml. It is the same installation each version is tested with.

Before you start#

  • Docker 24 or later with Docker Compose v2 (docker compose version).
  • The deploy/ folder of the ECenter distribution, with compose.yaml, ecenter.env.example and db-init/.
  • The images ecenter/backend:8.0.0 and ecenter/frontend:8.0.0, or the sources to build them.
  • openssl to generate the secrets key.

The commands on this page are typed from the folder that contains deploy/. If you work inside deploy/, remove -f deploy/compose.yaml from each one.

What starts#

Service Image What it does Default memory
db postgis/postgis:18-3.6-alpine The own database. Its data goes in the db-data volume. It is not published. 1 GB
backend ecenter/backend:8.0.0 The ECenter server. It starts when the database responds. It is not published. 4 GB
frontend ecenter/frontend:8.0.0 The web application and the proxy to the backend. It is the only thing published, on port ECENTER_HTTP_PORT (8080). 256 MB
chromium chromedp/headless-shell The headless browser. Only with the render profile. 2 GB
valhalla ghcr.io/valhalla/valhalla-scripted:3.9.0 The routing engine. Only with the routing profile. Its graph goes in the routing-data volume. 6 GB

All of them restart automatically if they go down (restart: unless-stopped) and their logs rotate (see Logs and cleanup).

Note

This installation has the own database in PostgreSQL, in the db service. If you want it in your organization's Oracle, the db service is not needed and the backend receives the details of that Oracle: see The own database in Oracle, which also explains how to try it with deploy/compose.oracle.yaml.

1. Prepare the images#

If the images come from a registry, say so in the configuration file of step 2:

ECENTER_BACKEND_IMAGE=registro.example.org/ecenter/backend:8.0.0
ECENTER_FRONTEND_IMAGE=registro.example.org/ecenter/frontend:8.0.0

If you build them from the sources, do it after step 2 (Compose needs the .env file to read compose.yaml):

docker compose -f deploy/compose.yaml build

They can also be built one by one, from the root of the repository:

docker build -t ecenter/backend:8.0.0 backend
docker build --build-context manuales=manuales -t ecenter/frontend:8.0.0 frontend

The frontend image carries the manuals at /ayuda/ and builds them with it: the manuales/ directory is a second build context, manuales, which deploy/compose.yaml gives with additional_contexts and docker build with --build-context. See The manuals at /ayuda/.

2. Prepare the configuration#

  1. Copy the example and protect it:

    cp deploy/ecenter.env.example deploy/.env
    chmod 600 deploy/.env
    
  2. Generate the secrets key:

    openssl rand -base64 32
    
  3. Open deploy/.env and fill in at least these variables:

    Variable What to put
    ECENTER_DB_PASSWORD A long password for the own database. Both the database container and the backend use it.
    ECENTER_SECRETS_KEY The key you have just generated.
    ECENTER_PUBLIC_URL The address users will sign in with, without a trailing slash: https://ecenter.example.org.
    ECENTER_ADMIN_LOGIN The login of the first administrator.
    ECENTER_ADMIN_PASSWORD Their password: at least 10 characters.
    TZ The time zone of the installation: Europe/Madrid.
  4. If you already have the email details, uncomment and fill in the SPRING_MAIL_* variables (see Mail and notifications). If not, leave them commented out: an empty variable counts as defined, and SPRING_MAIL_HOST= with no value is not the same as not setting it.

  5. If there is going to be another proxy in front of the frontend that terminates TLS, set ECENTER_BEHIND_PROXY=on (see The reverse proxy and TLS).

Warning

Keep ECENTER_SECRETS_KEY off the server, with the same protection as the database backups. It encrypts the passwords of the connections to the client databases, the credentials of the remote file export destinations and the key with which ECenter signs its own tokens. If it is lost, the password of each connection and the credential of each remote destination have to be typed again. Never upload deploy/.env to a repository.

What does not fit in a variable (identity providers, the base map, the links on the sign-in screen) goes in your own application.yml file. See Configuration.

3. Start#

docker compose -f deploy/compose.yaml up -d

The first time:

  1. The db container creates the ecenter database, the ecenter user as its owner (without being a superuser and with the password from ECENTER_DB_PASSWORD) and the postgis and pg_trgm extensions. The image's superuser (postgres) is left without a password: it can only sign in from inside the container.
  2. When the database responds, the backend starts, creates the ECenter schema (one or two minutes) and, as the database has no users, the first administrator.
  3. The frontend starts.

Follow the startup with:

docker compose -f deploy/compose.yaml ps
docker compose -f deploy/compose.yaml logs -f backend

The services are ready when ps shows them as healthy. In the backend log you will see, among others, these lines (the log is in Spanish):

  • Creado el administrador inicial '…' (the first administrator has been created).
  • Instalación <identifier>: No hay ninguna licencia instalada… (no license is installed). That identifier is the one Action Ware will ask for to issue the license.

Note

The db-init/ script only runs with the db-data volume empty. If you change ECENTER_DB_PASSWORD after the first start, the database keeps the previous password and the backend will not be able to sign in. To change it, do it in the database as well: docker compose -f deploy/compose.yaml exec db psql -U postgres -c "ALTER ROLE ecenter PASSWORD 'new-key'".

4. Check health#

Service How Compose checks it
db pg_isready every 5 s.
backend GET /api/about every 10 s, which is public and needs neither a session nor a license. It gives it 60 s of margin at startup.
frontend It reads its index.html every 10 s.

From the outside, a request to the public address checks the whole path (frontend and backend):

curl -s https://ecenter.example.org/api/about

The response carries the product and the version (8.0.0).

For an orchestrator there are also the backend probes /actuator/health/liveness and /actuator/health/readiness. They do not go through the frontend: they are requested directly from the backend or, if you turn on the management port, from that port. A client database that does not respond does not take the backend out of the load balancer: it is a console alert, not a health failure.

5. Sign in#

  1. Open ECENTER_PUBLIC_URL in the browser.
  2. Sign in with the login and password of the first administrator.
  3. As there is no license, the application takes you to Administration › License, with the installation identifier. Follow The license.
  4. With the license installed, continue with First start and go-live.

Variables set by compose.yaml#

deploy/compose.yaml gives the backend and the frontend what connects them to each other. You do not need to touch them while you use that installation:

Variable Value What for
ECENTER_DB_URL, ECENTER_DB_USER jdbc:postgresql://db:5432/ecenter, ecenter The backend reaches the own database. Its engine comes from the URL: PostgreSQL or Oracle.
ECENTER_INSTANCE_NAME ecenter-1 The name of the instance in alerts and runs. It is fixed because the container name changes each time it is recreated.
SERVER_FORWARD_HEADERS_STRATEGY framework The backend reads the original scheme, name and address from the frontend's X-Forwarded-* headers.
ECENTER_EMBEDDING_INDEX_LOCATION http://frontend:8080/index.html The page the backend serves to embedding.
ECENTER_RENDER_BROWSER_URL, ECENTER_RENDER_FRONTEND_URL http://chromium:9222, http://frontend:8080 Where the headless browser and the frontend are on the internal network.
ECENTER_MAPS_ROUTING_URL http://valhalla:8002 Where the routing engine is.
ECENTER_BACKEND_URL (frontend) http://backend:8080 Where the backend is.

The backend also receives all the variables you define in deploy/.env. When it is stopped, Compose gives it 45 s to finish the requests and jobs in progress in an orderly way.

Another orchestrator#

With Kubernetes or another orchestrator the same images are used. Carry over from deploy/compose.yaml:

  • the variables of the previous table, with the names of its services;
  • a memory limit for each container: the backend JVM takes 75 % of its own, and without a limit it would take 75 % of the node;
  • the frontend's DNS resolver (ECENTER_RESOLVER, which by default is Docker's, 127.0.0.11): the cluster's;
  • for the headless browser, an in-memory volume mounted at /dev/shm (an emptyDir with medium: Memory);
  • and the probes: the backend's liveness and readiness, on its port or on the management port.

Common problems#

Symptom Cause What to do
Falta ECENTER_DB_PASSWORD en .env (ECENTER_DB_PASSWORD missing in .env) at startup. The .env file is not next to compose.yaml or does not define the variable. Create deploy/.env (step 2).
The backend restarts and its log says the secrets encryption key is missing. ECENTER_SECRETS_KEY empty or not 32 bytes in Base64. Generate it with openssl rand -base64 32.
The backend says ECENTER_DB_URL, ECENTER_DB_USER or ECENTER_DB_PASSWORD are missing. It starts outside compose.yaml without them. Define them (see Environment variables).
No hay usuarios y no se ha configurado ecenter.security.bootstrap-admin: nadie podrá iniciar sesión… (there are no users and no bootstrap administrator: nobody will be able to sign in) ECENTER_ADMIN_LOGIN or ECENTER_ADMIN_PASSWORD are missing on the first start. Add them and recreate the backend: docker compose -f deploy/compose.yaml up -d backend.
The backend does not finish starting and its log says «La contraseña debe tener al menos 10 caracteres» (the password must have at least 10 characters). The one in ECENTER_ADMIN_PASSWORD is shorter (or exceeds 72 bytes). Correct it and recreate the backend.
The migration stops with a message about pg_trgm or GRANT CREATE ON DATABASE. An own database prepared by hand without the extension or the privilege. Create the extension as a superuser or grant the privilege (see Requirements).
With the own database in Oracle, the backend does not start and its log talks about the version or the character set. The database is older than 19c or is not in AL32UTF8. See Startup, license and access.

See also#