Skip to content

biblio backend.nomad

Matthias Vandermaesen edited this page Jul 15, 2022 · 1 revision

Copy this to a biblio-backend.nomad file on your local machine:

job "biblio-backend" {
	meta {
		run_uuid = "${uuidv4()}" # force creating a new job
	}

	datacenters = ["dc1"]

	type = "service"

	group "biblio-backend" {
		count = 1

		network {
			port "biblio-backend" {
				to = "3000"
				static = "3000"
			}

			port "citeproc" {
				to = "8085"
				static = "8085"
			}

			port "imagor" {
				to = "8086"
				static = "8086"
			}
		}

		service {
			name = "biblio-backend"
			port = "biblio-backend"
		}

		task "imagor" {
			driver = "docker"

			config {
				image = "shumc/imagor"
				ports = ["imagor"]
			}

			env {
					PORT = "${NOMAD_PORT_imagor}"
					IMAGOR_SECRET = "mysecretseed"
					FILE_LOADER_BASE_DIR = "/vol/files"
					FILE_STORAGE_BASE_DIR = "/vol/files"
					FILE_RESULT_STORAGE_BASE_DIR = "/vol/files/img"
			}
		}

		task "citeproc" {
			driver = "docker"

			config {
				image = "ugentlib/citeproc-server"
				ports = ["citeproc"]

				auth {
					username = "<dockerhub-username>"
					password = "<dockerhub-password>"
				}
			}
		}

		task "biblio-backend" {
			driver = "docker"

			config {
				image = "ugentlib/biblio-backend:dev"
				force_pull = true
				ports = ["biblio-backend"]

				auth {
					username = "<dockerhub-username>"
					password = "<dockerhub-password>"
				}

				extra_hosts = ["host.docker.internal:host-gateway"]
			}

			env {
				BIBLIO_BACKEND_FILE_DIR = "<path-to-file-dir>
				BIBLIO_BACKEND_SESSION_SECRET = "<secret>"
				BIBLIO_BACKEND_CSRF_SECRET = "<secret>"
				BIBLIO_BACKEND_FRONTEND_URL = "https://bibliotest.ugent.be"
				BIBLIO_BACKEND_FRONTEND_USERNAME = "<frontend-username>"
				BIBLIO_BACKEND_FRONTEND_PASSWORD = "<frontend-password>"
				BIBLIO_BACKEND_ORCID_CLIENT_ID ="<orcid-client-id>"
				BIBLIO_BACKEND_ORCID_CLIENT_SECRET ="<orcid-client-secret>"
				BIBLIO_BACKEND_ORCID_SANDBOX ="true"
				BIBLIO_BACKEND_OIDC_URL = "<oidc-url>"
				BIBLIO_BACKEND_OIDC_CLIENT_ID = "<oidc-client-id>"
				BIBLIO_BACKEND_OIDC_CLIENT_SECRET = "<oidc-client-secret"
				BIBLIO_BACKEND_PG_CONN = "postgres://biblio:[email protected]:5432/biblio"
				BIBLIO_BACKEND_ES6_URL = "http://host.docker.internal:9200"
				BIBLIO_BACKEND_DATASET_INDEX = "biblio_datasets"
				BIBLIO_BACKEND_PUBLICATION_INDEX = "biblio_publications"
				BIBLIO_BACKEND_IMAGOR_URL = "http://host.docker.internal:8086"
				BIBLIO_BACKEND_IMAGOR_SECRET = "mysecretseeds"
			}
		}
	}
}
Clone this wiki locally