From ed80c00df72382d6be732eb8f14fbf7950adce9b Mon Sep 17 00:00:00 2001 From: Sean Li Date: Thu, 28 Aug 2014 19:27:56 -0700 Subject: [PATCH] Displays host url and ports properly in app settings. --- .../dashboard/apps/dashboard-apps-settings.html | 12 +++++++++++- meteor/collections/apps.js | 15 +++++++++++++++ meteor/server/docker.js | 4 ++-- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/meteor/client/views/dashboard/apps/dashboard-apps-settings.html b/meteor/client/views/dashboard/apps/dashboard-apps-settings.html index fff224a04e..35acdf1dcb 100755 --- a/meteor/client/views/dashboard/apps/dashboard-apps-settings.html +++ b/meteor/client/views/dashboard/apps/dashboard-apps-settings.html @@ -10,9 +10,19 @@
- {{url}} + {{hostUrl}}
+ {{#if ports}} +
+
+ +
+
+ {{ports}} +
+
+ {{/if}}
diff --git a/meteor/collections/apps.js b/meteor/collections/apps.js index 7c4373aba0..3b0ff8b147 100755 --- a/meteor/collections/apps.js +++ b/meteor/collections/apps.js @@ -59,6 +59,21 @@ Apps.helpers({ image: function () { return Images.findOne(this.imageId); }, + hostUrl: function () { + return this.name + '.dev'; + }, + ports: function () { + var app = this; + if (app.docker && app.docker.NetworkSettings.Ports) { + var ports = _.map(_.keys(app.docker.NetworkSettings.Ports), function (portObj) { + var port = parseInt(portObj.split('/')[0], 10); + return port; + }); + return ports.join(', '); + } else { + return null; + } + }, url: function () { var app = this; var image = Images.findOne(app.imageId); diff --git a/meteor/server/docker.js b/meteor/server/docker.js index 3e5228dead..06d52b63c2 100755 --- a/meteor/server/docker.js +++ b/meteor/server/docker.js @@ -94,7 +94,7 @@ runContainer = function (app, image, callback) { if (err) { callback(err, null); return; } console.log('Started container: ' + container.id); // Use dig to refresh the DNS - exec('/usr/bin/dig dig ' + app.name + '.dev @172.17.42.1 ', function(err, out, code) { + exec('/usr/bin/dig dig ' + app.name + '.dev @172.17.42.1 ', function(err, out) { console.log(out); }); callback(null, container); @@ -147,7 +147,7 @@ restartApp = function (app, callback) { callback(null); // Use dig to refresh the DNS - exec('/usr/bin/dig dig ' + app.name + '.dev @172.17.42.1 ', function(err, out, code) { + exec('/usr/bin/dig dig ' + app.name + '.dev @172.17.42.1 ', function(err, out) { console.log(out); }); } else {