The agdb_server can be run in Docker using official Docker image. Optionally you can build the image yourself.
The image is based on Alpine Linux using musl libc. The image is made available on Docker Hub or GitHub packages:
| Vendor | Tag | Command | Description |
|---|---|---|---|
| Docker Hub | latest | docker pull agnesoft/agdb:latest | Equals latest released version |
| Docker Hub | 0.x.x | docker pull agnesoft/agdb:0.x.x | Released version, e.g. 0.10.0 |
| Docker Hub | dev | docker pull agnesoft/agdb:dev | Equals latest development version on the main branch, refreshed with every commit to main |
| GitHub | latest | docker pull ghcr.io/agnesoft/agdb:latest | Equals latest released version |
| GitHub | 0.x.x | docker pull ghcr.io/agnesoft/agdb:0.x.x | Released version, e.g. 0.10.0 |
| GitHub | dev | docker pull ghcr.io/agnesoft/agdb:dev | Equals latest development version on the main branch, refreshed with every commit to main |
If you want to build the image yourself run the following in the root of the checked out agdb repository:
docker build --pull -t agnesoft/agdb:dev -f agdb_server/containerfile .
docker run -v agdb_data:/agdb/agdb_data --name agdb -p 3000:3000 agnesoft/agdb:dev
This command runs the server using the default configuration (without TLS). It assigns a volume to the data directory for data persistence, gives the container a name (agdb) and publishes the container's exposed port (3000) to the host. You can publish to a different local port (e.g. 5000:3000 (host:container)) where the container's port 3000 will be locally accessible on the port 5000.
curlcurl -v localhost:3000/api/v1/status # should return 200 OK
The server can be shutdown either by stopping the container or programmatically posting to the shutdown endpoint as logged in server admin:
# this will produce an admin API token, e.g. "bb2fc207-90d1-45dd-8110-3247c4753cd5"
token=$(curl -X POST -H 'Content-Type: application/json' localhost:3000/api/v1/user/login -d '{"username":"admin","password":"admin"}')
curl -X POST -H "Authorization: Bearer ${token}" localhost:3000/api/v1/admin/shutdown
In order to enable TLS support you need to provide following config values as per the server documentation:
tls_certificate: /agdb/cert.pem
tls_key: /agdb/cert.key
If you are using self-signed certificate you should provide also the root CA via:
tls_root: /agdb/root_ca.pem
You can then mount the custom config and the certificates into the container as volume(s). Assuming the agdb_server.yaml and the certificates are in /local/path on your host machine:
docker run -v agdb_data:/agdb/agdb_data -v /local/path:/agdb --name agdb -p 3000:3000 agnesoft/agdb:dev
When you run the container this way it will load the configuration from /agdb/agdb_server.yaml and if it specifies the paths to the files they would be loaded as well.