Merge branch 'release/1.16.1'

pull/1602/head 1.16.1
Anthony Lapenna 2018-01-23 16:52:59 +01:00
commit 54750f002a
19 changed files with 61 additions and 66 deletions

View File

@ -33,7 +33,6 @@ func (*Service) ParseFlags(version string) (*portainer.CLIFlags, error) {
flags := &portainer.CLIFlags{
Addr: kingpin.Flag("bind", "Address and port to serve Portainer").Default(defaultBindAddress).Short('p').String(),
Assets: kingpin.Flag("assets", "Path to the assets").Default(defaultAssetsDirectory).Short('a').String(),
CheckHealth: kingpin.Flag("check-health", "GET http://localhost:<port>/api/health endpoint").Default(defaultCheckHealth).Short('c').Bool(),
Data: kingpin.Flag("data", "Path to the folder where the data is stored").Default(defaultDataDirectory).Short('d').String(),
Endpoint: kingpin.Flag("host", "Dockerd endpoint").Short('H').String(),
ExternalEndpoints: kingpin.Flag("external-endpoints", "Path to a file defining available endpoints").String(),

View File

@ -6,7 +6,6 @@ const (
defaultBindAddress = ":9000"
defaultDataDirectory = "/data"
defaultAssetsDirectory = "./"
defaultCheckHealth = "false"
defaultNoAuth = "false"
defaultNoAnalytics = "false"
defaultTLSVerify = "false"

View File

@ -4,7 +4,6 @@ const (
defaultBindAddress = ":9000"
defaultDataDirectory = "C:\\data"
defaultAssetsDirectory = "./"
defaultCheckHealth = "false"
defaultNoAuth = "false"
defaultNoAnalytics = "false"
defaultTLSVerify = "false"

View File

@ -14,7 +14,6 @@ import (
"github.com/portainer/portainer/ldap"
"log"
"os"
)
func initCLI() *portainer.CLIFlags {
@ -172,19 +171,6 @@ func retrieveFirstEndpointFromDatabase(endpointService portainer.EndpointService
func main() {
flags := initCLI()
if *flags.CheckHealth {
statuscode, err := http.HealthCheck(*flags.Addr)
if err == nil {
if statuscode == 200 {
log.Println(*flags.Addr, ": Online - response:", statuscode)
os.Exit(0)
} else {
log.Fatal(*flags.Addr, ": Error - response:", statuscode)
}
}
log.Fatal("Connection error:", err.Error())
}
fileService := initFileService(*flags.Data)
store := initStore(*flags.Data)

View File

@ -1,11 +0,0 @@
package http
import (
"net/http"
)
// HealthCheck GETs /api/status
func HealthCheck(addr string) (int, error) {
resp, err := http.Get("http://" + addr + "/api/status")
return resp.StatusCode, err
}

View File

@ -13,7 +13,6 @@ type (
CLIFlags struct {
Addr *string
Assets *string
CheckHealth *bool
Data *string
Endpoint *string
ExternalEndpoints *string
@ -391,7 +390,7 @@ type (
const (
// APIVersion is the version number of the Portainer API.
APIVersion = "1.16.0"
APIVersion = "1.16.1"
// DBVersion is the version number of the Portainer database.
DBVersion = 7
// DefaultTemplatesURL represents the default URL for the templates definitions.

View File

@ -56,7 +56,7 @@ info:
**NOTE**: You can find more information on how to query the Docker API in the [Docker official documentation](https://docs.docker.com/engine/api/v1.30/) as well as in [this Portainer example](https://gist.github.com/deviantony/77026d402366b4b43fa5918d41bc42f8).
version: "1.16.0"
version: "1.16.1"
title: "Portainer API"
contact:
email: "info@portainer.io"
@ -2143,7 +2143,7 @@ definitions:
description: "Is analytics enabled"
Version:
type: "string"
example: "1.16.0"
example: "1.16.1"
description: "Portainer API version"
PublicSettingsInspectResponse:
type: "object"

View File

@ -277,12 +277,14 @@ function ($q, $scope, $transition$, $state, $location, $timeout, $anchorScroll,
Order: service.UpdateOrder
};
config.TaskTemplate.RestartPolicy = {
Condition: service.RestartCondition,
Delay: ServiceHelper.translateHumanDurationToNanos(service.RestartDelay) || 5000000000,
MaxAttempts: service.RestartMaxAttempts,
Window: ServiceHelper.translateHumanDurationToNanos(service.RestartWindow) || 0
};
if ($scope.hasChanges(service, ['RestartCondition', 'RestartDelay', 'RestartMaxAttempts', 'RestartWindow'])){
config.TaskTemplate.RestartPolicy = {
Condition: service.RestartCondition,
Delay: ServiceHelper.translateHumanDurationToNanos(service.RestartDelay) || 5000000000,
MaxAttempts: service.RestartMaxAttempts,
Window: ServiceHelper.translateHumanDurationToNanos(service.RestartWindow) || 0
};
}
config.TaskTemplate.LogDriver = null;
if (service.LogDriverName) {

View File

@ -40,5 +40,13 @@ angular.module('extension.storidge')
});
};
service.shutdown = function() {
return $http({
method: 'POST',
url: StoridgeManager.StoridgeAPIURL() + '/cluster/shutdown',
skipAuthorization: true
});
};
return service;
}]);

View File

@ -7,6 +7,10 @@ angular.module('extension.storidge')
return StoridgeCluster.reboot();
};
service.shutdown = function() {
return StoridgeCluster.shutdown();
};
service.info = function() {
var deferred = $q.defer();

View File

@ -37,12 +37,12 @@
<div class="form-group">
<div class="col-sm-12">
<button type="button" class="btn btn-danger btn-sm" ng-click="shutdownCluster()" ng-disabled="state.shutdownInProgress" button-spinner="state.shutdownInProgress">
<span ng-hide="state.updateInProgress"><i class="fa fa-power-off space-right" aria-hidden="true"></i> Shutdown the cluster</span>
<span ng-show="state.updateInProgress">Shutting down cluster...</span>
<span ng-hide="state.shutdownInProgress"><i class="fa fa-power-off space-right" aria-hidden="true"></i> Shutdown the cluster</span>
<span ng-show="state.shutdownInProgress">Shutting down cluster...</span>
</button>
<button type="button" class="btn btn-danger btn-sm" ng-click="rebootCluster()" ng-disabled="state.rebootInProgress" button-spinner="state.shutdownInProgress">
<span ng-hide="state.deleteInProgress"><i class="fa fa-refresh space-right" aria-hidden="true"></i> Reboot the cluster</span>
<span ng-show="state.deleteInProgress">Rebooting cluster...</span>
<span ng-hide="state.rebootInProgress"><i class="fa fa-refresh space-right" aria-hidden="true"></i> Reboot the cluster</span>
<span ng-show="state.rebootInProgress">Rebooting cluster...</span>
</button>
</div>
</div>

View File

@ -42,8 +42,18 @@ function ($q, $scope, $state, Notifications, StoridgeClusterService, StoridgeNod
};
function shutdownCluster() {
Notifications.error('Not implemented', {}, 'Not implemented yet');
$state.reload();
$scope.state.shutdownInProgress = true;
StoridgeClusterService.shutdown()
.then(function success(data) {
Notifications.success('Cluster successfully shutdown');
$state.go('dashboard');
})
.catch(function error(err) {
Notifications.error('Failure', err, 'Unable to shutdown cluster');
})
.finally(function final() {
$scope.state.shutdownInProgress = false;
});
}
function rebootCluster() {

View File

@ -5,16 +5,17 @@ angular.module('portainer.services')
service.plugins = function() {
var deferred = $q.defer();
var plugins = [];
Plugin.query({}).$promise
.then(function success(data) {
var plugins = data.map(function (item) {
return new PluginViewModel(item);
});
deferred.resolve(plugins);
for (var i = 0; i < data.length; i++) {
var plugin = new PluginViewModel(data[i]);
plugins.push(plugin);
}
})
.catch(function error(err) {
deferred.reject({ msg: 'Unable to retrieve plugins', err: err });
.finally(function final() {
deferred.resolve(plugins);
});
return deferred.promise;
@ -61,7 +62,7 @@ angular.module('portainer.services')
};
service.loggingPlugins = function(systemOnly) {
return servicePlugins(systemOnly, 'Log', 'docker.logdriver/1.0');
return servicePlugins(systemOnly, 'Log', 'docker.logdriver/1.0');
};
return service;

View File

@ -23,10 +23,9 @@ angular.module('portainer.services')
if (_.includes(volumePlugins, 'cio:latest')) {
extensions.push('storidge');
}
deferred.resolve(extensions);
})
.catch(function error(err) {
deferred.reject({ msg: 'Unable to retrieve extensions', err: err });
.finally(function final() {
deferred.resolve(extensions);
});
return deferred.promise;

View File

@ -114,15 +114,17 @@ angular.module('portainer.services')
}
$q.all({
info: SystemService.info(),
version: SystemService.version(),
extensions: ExtensionManager.extensions()
version: SystemService.version()
})
.then(function success(data) {
var endpointMode = InfoHelper.determineEndpointMode(data.info);
var endpointAPIVersion = parseFloat(data.version.ApiVersion);
state.endpoint.mode = endpointMode;
state.endpoint.apiVersion = endpointAPIVersion;
state.endpoint.extensions = data.extensions;
return $q.when(endpointAPIVersion < 1.25 || ExtensionManager.extensions());
})
.then(function success(data) {
state.endpoint.extensions = data instanceof Array ? data : [];
LocalStorage.storeEndpointState(state.endpoint);
deferred.resolve();
})

View File

@ -9,5 +9,3 @@ WORKDIR /
EXPOSE 9000
ENTRYPOINT ["/portainer"]
HEALTHCHECK --start-period=10ms --interval=30s --timeout=5s --retries=3 CMD ["/portainer", "-c"]

View File

@ -1,5 +1,5 @@
Name: portainer
Version: 1.16.0
Version: 1.16.1
Release: 0
License: Zlib
Summary: A lightweight docker management UI

View File

@ -2,7 +2,7 @@
"author": "Portainer.io",
"name": "portainer",
"homepage": "http://portainer.io",
"version": "1.16.0",
"version": "1.16.1",
"repository": {
"type": "git",
"url": "git@github.com:portainer/portainer.git"
@ -45,7 +45,7 @@
"filesize": "~3.3.0",
"font-awesome": "~4.7.0",
"isteven-angular-multiselect": "~4.0.0",
"jquery": "1.11.1",
"jquery": "^3.3.1",
"js-yaml": "~3.10.0",
"lodash": "4.12.0",
"moment": "~2.14.1",

View File

@ -2370,14 +2370,14 @@ isteven-angular-multiselect@~4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/isteven-angular-multiselect/-/isteven-angular-multiselect-4.0.0.tgz#70276da5ff3bc4d9a0887dc585ee26a1a26a8ed6"
jquery@1.11.1:
version "1.11.1"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-1.11.1.tgz#b6ec928590112ebed69e1e49cbfd0025ccd60ddb"
jquery@>=1.12.0:
version "3.2.1"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.2.1.tgz#5c4d9de652af6cd0a770154a631bba12b015c787"
jquery@^3.3.1:
version "3.3.1"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.3.1.tgz#958ce29e81c9790f31be7792df5d4d95fc57fbca"
js-base64@^2.1.9:
version "2.4.0"
resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.4.0.tgz#9e566fee624751a1d720c966cd6226d29d4025aa"