Set more environment variables in defineCluster
Set ONM_IP, ONM_URL, BROKER_ADDRESS, BROKER_PORT, ACTIVEMQ_HOST, ACTIVEMQ_PORT, based on the values of APP_ACTIVEMQ_HOST (or --app-activemq-host parameter), AP_ACTIVEMQ_PORT (or --app-activemq-port parameter), ONM_IP (or --onm-ip parameter), ONM_URL (or --onm-url parameter). See https://bugs.launchpad.net/nebulous/+bug/2062521 Change-Id: Iad3614ba0aeeeab48f809e4f7b185474039905f3
This commit is contained in:
parent
4557a44823
commit
2cefd9b8a0
@ -51,6 +51,14 @@ spec:
|
|||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: {{ include "nebulous-optimiser-controller.fullname" . }}-secrets
|
name: {{ include "nebulous-optimiser-controller.fullname" . }}-secrets
|
||||||
key: ACTIVEMQ_PASSWORD
|
key: ACTIVEMQ_PASSWORD
|
||||||
|
- name: APP_ACTIVEMQ_HOST
|
||||||
|
value: "{{ .Values.app.ACTIVEMQ_HOST }}"
|
||||||
|
- name: APP_ACTIVEMQ_PORT
|
||||||
|
value: "{{ .Values.app.ACTIVEMQ_PORT }}"
|
||||||
|
- name: ONM_IP
|
||||||
|
value: "{{ .Values.app.ONM_IP }}"
|
||||||
|
- name: ONM_URL
|
||||||
|
value: "{{ .Values.app.ONM_URL }}"
|
||||||
# livenessProbe:
|
# livenessProbe:
|
||||||
# httpGet:
|
# httpGet:
|
||||||
# path: /
|
# path: /
|
||||||
|
@ -89,5 +89,11 @@ activemq:
|
|||||||
ACTIVEMQ_PORT: 5672
|
ACTIVEMQ_PORT: 5672
|
||||||
ACTIVEMQ_USER: admin
|
ACTIVEMQ_USER: admin
|
||||||
|
|
||||||
|
app:
|
||||||
|
ONM_IP: '123'
|
||||||
|
ONM_URL: onm-url''
|
||||||
|
ACTIVEMQ_HOST: 'nebulous-activemq'
|
||||||
|
ACTIVEMQ_PORT: '131'
|
||||||
|
|
||||||
secrets:
|
secrets:
|
||||||
ACTIVEMQ_PASSWORD: nebulous
|
ACTIVEMQ_PASSWORD: nebulous
|
||||||
|
@ -69,6 +69,34 @@ public class Main implements Callable<Integer> {
|
|||||||
@Getter
|
@Getter
|
||||||
private static Path logDirectory;
|
private static Path logDirectory;
|
||||||
|
|
||||||
|
@Option(names = {"--app-activemq-host"},
|
||||||
|
description = "The hostname of the ActiveMQ server in a deployed app. Can also be set via the @|bold APP_ACTIVEMQ_HOST|@ environment variable.",
|
||||||
|
paramLabel = "APP_ACTIVEMQ_HOST",
|
||||||
|
defaultValue = "${APP_ACTIVEMQ_HOST}")
|
||||||
|
@Getter
|
||||||
|
private static String appBrokerAddress;
|
||||||
|
|
||||||
|
@Option(names = {"--app-activemq-port"},
|
||||||
|
description = "The port of the ActiveMQ server in a deployed app. Can also be set via the @|bold APP_ACTIVEMQ_PORT|@ environment variable.",
|
||||||
|
paramLabel = "APP_ACTIVEMQ_PORT",
|
||||||
|
defaultValue = "${APP_ACTIVEMQ_PORT:-5672}")
|
||||||
|
@Getter
|
||||||
|
private static int appBrokerPort;
|
||||||
|
|
||||||
|
@Option(names = {"--onm-ip"},
|
||||||
|
description = "The IP address of the ONM server in a deployed app. Can also be set via the @|bold ONM_IP|@ environment variable. NOTE: will be deprecated soon.",
|
||||||
|
paramLabel = "ONM_IP",
|
||||||
|
defaultValue = "${ONM_IP}")
|
||||||
|
@Getter
|
||||||
|
private static String onmIp;
|
||||||
|
|
||||||
|
@Option(names = {"--onm-url"},
|
||||||
|
description = "The URL of the ONM server in a deployed app. Can also be set via the @|bold ONM_URL|@ environment variable.",
|
||||||
|
paramLabel = "ONM_URL",
|
||||||
|
defaultValue = "${ONM_URL}")
|
||||||
|
@Getter
|
||||||
|
private static String onmUrl;
|
||||||
|
|
||||||
@Option(names = {"--verbose", "-v"},
|
@Option(names = {"--verbose", "-v"},
|
||||||
description = "Turn on more verbose logging output. Can be given multiple times. When not given, print only warnings and error messages. With @|underline -v|@, print status messages. With @|underline -vvv|@, print everything.",
|
description = "Turn on more verbose logging output. Can be given multiple times. When not given, print only warnings and error messages. With @|underline -v|@, print status messages. With @|underline -vvv|@, print everything.",
|
||||||
scope = ScopeType.INHERIT)
|
scope = ScopeType.INHERIT)
|
||||||
|
@ -405,10 +405,32 @@ public class NebulousAppDeployer {
|
|||||||
.put("cloudId", candidate.getCloud().getId());
|
.put("cloudId", candidate.getCloud().getId());
|
||||||
});
|
});
|
||||||
ObjectNode environment = cluster.withObject("/env-var");
|
ObjectNode environment = cluster.withObject("/env-var");
|
||||||
|
// See https://openproject.nebulouscloud.eu/projects/nebulous-collaboration-hub/wiki/env-variables-necessary-for-nebulous-application-deployment-scripts
|
||||||
environment.put("APPLICATION_ID", appUUID);
|
environment.put("APPLICATION_ID", appUUID);
|
||||||
// TODO: consider pre-parsing environment variables and storing them
|
if (Main.getAppBrokerAddress() == null || Main.getAppBrokerAddress().equals("")) {
|
||||||
// in the app object instead of reading them from the raw dsl message
|
log.warn("ActiveMQ broker address for app (APP_ACTIVEMQ_HOST) is not set, optimistically continuing with 'localhost'");
|
||||||
// here
|
environment.put("BROKER_ADDRESS", "localhost");
|
||||||
|
environment.put("ACTIVEMQ_HOST", "localhost");
|
||||||
|
} else {
|
||||||
|
environment.put("BROKER_ADDRESS", Main.getAppBrokerAddress());
|
||||||
|
environment.put("ACTIVEMQ_HOST", Main.getAppBrokerAddress());
|
||||||
|
}
|
||||||
|
// Don't warn when those are unset, 5672 is usually the right call
|
||||||
|
environment.put("BROKER_PORT", Main.getAppBrokerPort());
|
||||||
|
environment.put("ACTIVEMQ_PORT", Main.getAppBrokerPort());
|
||||||
|
if (Main.getOnmIp() == null || Main.getOnmIp().equals("")) {
|
||||||
|
log.warn("Overlay Network Manager address (ONM_IP) is not set, continuing without setting ONM_IP for the app");
|
||||||
|
} else {
|
||||||
|
environment.put("ONM_IP", Main.getOnmIp());
|
||||||
|
}
|
||||||
|
if (Main.getOnmUrl() == null || Main.getOnmUrl().equals("")) {
|
||||||
|
log.warn("Overlay Network Manager address (ONM_URL) is not set, continuing without setting ONM_URL for the app");
|
||||||
|
} else {
|
||||||
|
environment.put("ONM_URL", Main.getOnmUrl());
|
||||||
|
}
|
||||||
|
// TODO: consider pre-parsing environment variables from the app
|
||||||
|
// message and storing them in the app object instead of reading them
|
||||||
|
// from the raw JSON here -- but it's not that important
|
||||||
for (final JsonNode v : app.getOriginalAppMessage().withArray("/environmentVariables")) {
|
for (final JsonNode v : app.getOriginalAppMessage().withArray("/environmentVariables")) {
|
||||||
if (v.has("name") && v.has("value") && v.get("name").isTextual()) {
|
if (v.has("name") && v.has("value") && v.get("name").isTextual()) {
|
||||||
// TODO: figure out what to do with the `"secret":true` field
|
// TODO: figure out what to do with the `"secret":true` field
|
||||||
|
Loading…
x
Reference in New Issue
Block a user