Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to swarm mode #44

Merged
merged 9 commits into from
May 19, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix app datasources
  • Loading branch information
Toshbrown committed May 19, 2017
commit de01e659494d2ea3041bb738d1408fdfdaa40e6f
27 changes: 17 additions & 10 deletions src/container-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,26 @@ const appConfig = function (config,sla) {
secrets: [ ]
};

if ('packages' in sla) {
//packages are being removed.
/*if ('packages' in sla) {
console.log(sla.packages)
for (let manifestPackage of sla.packages) {
let packageEnabled = 'enabled' in manifestPackage ? manifestPackage.enabled : false;
config.Env.push("PACKAGE_" + manifestPackage.id + "=" + packageEnabled);
app.Env.push("PACKAGE_" + manifestPackage.id + "=" + packageEnabled);
}
}*/

if ('datasources' in sla) {
for (let datasource of sla.datasources) {
app.Env.push("DATASOURCE_" + datasource.clientid + "=" + JSON.stringify(datasource.hypercat));
}
}

if(sla['resource-requirements'] && sla['resource-requirements']['store']) {
let storeName = sla.name + "-" + sla['resource-requirements']['store'] + ARCH;
app.Env.push("DATABOX_STORE_ENDPOINT=https://" + storeName + ":8080");
}

config.Networks.push({Target:'databox_databox-app-net'});
config.Name = localContainerName
config.TaskTemplate.ContainerSpec = app
Expand Down Expand Up @@ -268,12 +281,6 @@ const storeConfig = function (config,sla) {
}
}

if ('datasources' in sla) {
for (let datasource of sla.datasources) {
config.Env.push("DATASOURCE_" + datasource.clientid + "=" + JSON.stringify(datasource.hypercat));
}
}

config.Name = requiredName
config.TaskTemplate.ContainerSpec = store
config.TaskTemplate.Placement.constraints = ["node.role == manager"]
Expand All @@ -298,12 +305,12 @@ async function addPermissionsFromSla (sla) {
console.log("[Adding Export permissions for " + localContainerName + "] on " + urlsString);
proms.push(updateContainerPermissions({
name: localContainerName,
route: {target:DATABOX_EXPORT_SERVICE_HOSTNAME, path: '/export/', method:'POST'},
route: {target:DATABOX_EXPORT_SERVICE_ENDPOINT, path: '/export/', method:'POST'},
caveats: [ "destination = [" + urlsString + "]" ]
}));
proms.push(updateContainerPermissions({
name: localContainerName,
route: {target:DATABOX_EXPORT_SERVICE_HOSTNAME, path: '/lp/export/', method:'POST'},
route: {target:DATABOX_EXPORT_SERVICE_ENDPOINT, path: '/lp/export/', method:'POST'},
caveats: [ "destination = [" + urlsString + "]" ]
}));
}
Expand Down