This directory contains files for Digital.ai Deploy central configuration.

To refresh configuration values without restarting server, invoke the refresh Spring Boot Actuator endpoint manually
in order to force the client to refresh and draw in the new value.

$ curl -u admin:<password> localhost:4516/actuator/refresh -d {} -H "Content-Type: application/json"


Using the embedded H2 database with workers
-------------------------------------------

H2 is intended for development and evaluation only; use PostgreSQL, MySQL, Oracle or MS SQL Server
for production.

The Deploy server and every worker run in their own JVM and each of them opens the repository
database. An H2 database opened in memory (jdbc:h2:mem:...) or directly as a file
(jdbc:h2:file:...) can only be used by a single JVM: a worker would either get its own empty
database or fail with "Database may be already in use". To run one or more workers on H2, the
database must be served over TCP so that all JVMs share it.

1. Configure deploy-repository.yaml with a TCP URL:

     xl:
       repository:
         database:
           db-driver-classname: "org.h2.Driver"
           db-url: "jdbc:h2:tcp://localhost:9092/xl-deploy"
           db-username: "sa"
           db-password: "sa"
           max-pool-size: 10

2. Start the database first, and leave it running:

     bin/startDatabase.sh      (bin\startDatabase.cmd on Windows)

   The database files are created under <server home>/repository. The port is taken from the
   jdbc:h2:tcp:// URL above and defaults to 9092.

3. Start the Deploy server, then the workers, for example:

     bin/startLocalWorker.sh 1 -api http://localhost:4516 -master localhost:8180

4. On shutdown, stop the workers and the server first, then the database:

     bin/stopDatabase.sh       (bin\stopDatabase.cmd on Windows)

Notes:

- The H2 network server is a separate process and is not managed by the service wrapper, so
  install-service.sh / install-service.cmd do not start or stop it.
- The database accepts connections from other machines by default, so a worker does not have to
  run on the same host as the server. For that to work, db-url must name the host running the
  database instead of localhost (every JVM reads the same URL, and 'localhost' would point each
  worker at itself), and the port must be open on that host's firewall. Set H2_TCP_LOCAL_ONLY
  before running startDatabase to restrict the listener to the local machine.
- The database port has no network-level protection: there is no TLS, and any client that can
  reach it may create databases and define Java functions. Keep it on a trusted network, and use
  PostgreSQL, MySQL, Oracle or MS SQL Server for anything beyond development and evaluation.

- If the server fails to start with "Wrong user name or password", an older repository/<name>.mv.db
  file created with different credentials is probably still present. Either use the credentials it
  was created with, or delete the files under repository/ to start from an empty database.
- startDatabase always sets an H2 management password, because H2 generates a random one when none
  is given and the server then cannot be shut down. It defaults to 'xldeploy'; to change it, set
  H2_TCP_PASSWORD to the same value for both startDatabase and stopDatabase.
