upped the version

This commit is contained in:
Kasra Bigdeli
2018-11-27 20:29:54 -08:00
13 changed files with 344 additions and 154 deletions
File diff suppressed because one or more lines are too long
+6 -17
View File
@@ -100,6 +100,8 @@ class ServiceManager {
* pathToSrcTarballFile
* OR
* repoInfo : {repo, user, password, branch}
* OR
* undefined
* @param gitHash
* @returns {Promise<void>}
*/
@@ -143,7 +145,8 @@ class ServiceManager {
.pathToSrcTarballFile) {
promiseToFetchDirectory = tar
.x({
file: source.pathToSrcTarballFile,
file: source
.pathToSrcTarballFile,
cwd: rawImageSourceFolder,
})
.then(function () {
@@ -152,7 +155,8 @@ class ServiceManager {
}
else if (source &&
source.repoInfo) {
const repoInfo = source.repoInfo;
const repoInfo = source
.repoInfo;
promiseToFetchDirectory = GitHelper.clone(repoInfo.user, repoInfo.password, repoInfo.repo, repoInfo.branch, rawImageSourceFolder).then(function () {
return GitHelper.getLastHash(rawImageSourceFolder);
});
@@ -303,9 +307,6 @@ class ServiceManager {
return CaptainManager.get().verifyCaptainOwnsDomainOrThrow(customDomain, undefined);
})
.then(function () {
if (!appName) {
throw new Error('No App Name! Cannot verify domain');
}
Logger.d('Enabling SSL for: ' + appName + ' on ' + customDomain);
return self.dataStore
.getAppsDataStore()
@@ -349,9 +350,6 @@ class ServiceManager {
return CaptainManager.get().verifyDomainResolvesToDefaultServerOnHost(customDomain);
})
.then(function () {
if (!appName) {
throw new Error('No App Name! Cannot verify domain');
}
Logger.d('Enabling custom domain for: ' + appName);
return self.dataStore
.getAppsDataStore()
@@ -365,9 +363,6 @@ class ServiceManager {
const self = this;
return Promise.resolve()
.then(function () {
if (!appName) {
throw new Error('No App Name! Cannot verify domain');
}
Logger.d('Removing custom domain for: ' + appName);
return self.dataStore
.getAppsDataStore()
@@ -386,9 +381,6 @@ class ServiceManager {
})
.then(function () {
Logger.d('Enabling SSL for: ' + appName);
if (!appName) {
throw new Error('No App Name! Cannot verify domain');
}
return self.dataStore.getRootDomain();
})
.then(function (val) {
@@ -423,9 +415,6 @@ class ServiceManager {
let rootDomain;
return Promise.resolve()
.then(function () {
if (!appName) {
throw new Error('No App Name! Cannot verify domain');
}
return self.dataStore.getRootDomain();
})
.then(function (val) {
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -16,7 +16,7 @@ let data = {
defaultEmail: 'runner@captainduckduck.com',
defaultMaxLogSize: '512m',
isDebug: EnvVars.CAPTAIN_IS_DEBUG,
version: '0.7.2',
version: '0.7.3',
captainSaltSecretKey: 'captain-salt',
nginxServiceName: 'captain-nginx',
nginxPortNumber: 80,
+119 -119
View File
@@ -725,6 +725,124 @@ angular.module('RDash')
}
});
/**
* File Upload Read Directive
*/
angular
.module('RDash')
.directive("fileread", [function () {
return {
scope: {
fileread: "="
},
link: function (scope, element, attributes) {
element.bind("change", function (changeEvent) {
scope.$apply(function () {
scope.fileread = changeEvent.target.files[0];
// or all selected files:
// scope.fileread = changeEvent.target.files;
});
});
}
}
}]);
/**
* Loading Directive
* @see http://tobiasahlin.com/spinkit/
*/
angular
.module('RDash')
.directive('rdLoading', rdLoading);
function rdLoading() {
var directive = {
restrict: 'AE',
template: '<div class="loading"><div class="double-bounce1"></div><div class="double-bounce2"></div></div>'
};
return directive;
};
/**
* Widget Body Directive
*/
angular
.module('RDash')
.directive('rdWidgetBody', rdWidgetBody);
function rdWidgetBody() {
var directive = {
requires: '^rdWidget',
scope: {
loading: '=?',
classes: '@?'
},
transclude: true,
template: '<div class="widget-body" ng-class="classes"><rd-loading ng-show="loading"></rd-loading><div ng-hide="loading" class="widget-content" ng-transclude></div></div>',
restrict: 'E'
};
return directive;
};
/**
* Widget Footer Directive
*/
angular
.module('RDash')
.directive('rdWidgetFooter', rdWidgetFooter);
function rdWidgetFooter() {
var directive = {
requires: '^rdWidget',
transclude: true,
template: '<div class="widget-footer" ng-transclude></div>',
restrict: 'E'
};
return directive;
};
/**
* Widget Header Directive
*/
angular
.module('RDash')
.directive('rdWidgetHeader', rdWidgetTitle);
function rdWidgetTitle() {
var directive = {
requires: '^rdWidget',
scope: {
title: '@',
icon: '@'
},
transclude: true,
template: '<div class="widget-header"><div class="row"><div class="pull-left"><i class="fa" ng-class="icon"></i> {{title}} </div><div class="pull-right col-xs-6 col-sm-4" ng-transclude></div></div></div>',
restrict: 'E'
};
return directive;
};
/**
* Widget Directive
*/
angular
.module('RDash')
.directive('rdWidget', rdWidget);
function rdWidget() {
var directive = {
transclude: true,
template: '<div class="widget" ng-transclude></div>',
restrict: 'EA'
};
return directive;
function link(scope, element, attrs) {
/* */
}
};
/**
* Alerts Controller
*/
@@ -1886,122 +2004,4 @@ function SettingsCtrl($scope, $cookieStore, $rootScope, pageDefinitions,
}());
}
/**
* File Upload Read Directive
*/
angular
.module('RDash')
.directive("fileread", [function () {
return {
scope: {
fileread: "="
},
link: function (scope, element, attributes) {
element.bind("change", function (changeEvent) {
scope.$apply(function () {
scope.fileread = changeEvent.target.files[0];
// or all selected files:
// scope.fileread = changeEvent.target.files;
});
});
}
}
}]);
/**
* Loading Directive
* @see http://tobiasahlin.com/spinkit/
*/
angular
.module('RDash')
.directive('rdLoading', rdLoading);
function rdLoading() {
var directive = {
restrict: 'AE',
template: '<div class="loading"><div class="double-bounce1"></div><div class="double-bounce2"></div></div>'
};
return directive;
};
/**
* Widget Body Directive
*/
angular
.module('RDash')
.directive('rdWidgetBody', rdWidgetBody);
function rdWidgetBody() {
var directive = {
requires: '^rdWidget',
scope: {
loading: '=?',
classes: '@?'
},
transclude: true,
template: '<div class="widget-body" ng-class="classes"><rd-loading ng-show="loading"></rd-loading><div ng-hide="loading" class="widget-content" ng-transclude></div></div>',
restrict: 'E'
};
return directive;
};
/**
* Widget Footer Directive
*/
angular
.module('RDash')
.directive('rdWidgetFooter', rdWidgetFooter);
function rdWidgetFooter() {
var directive = {
requires: '^rdWidget',
transclude: true,
template: '<div class="widget-footer" ng-transclude></div>',
restrict: 'E'
};
return directive;
};
/**
* Widget Header Directive
*/
angular
.module('RDash')
.directive('rdWidgetHeader', rdWidgetTitle);
function rdWidgetTitle() {
var directive = {
requires: '^rdWidget',
scope: {
title: '@',
icon: '@'
},
transclude: true,
template: '<div class="widget-header"><div class="row"><div class="pull-left"><i class="fa" ng-class="icon"></i> {{title}} </div><div class="pull-right col-xs-6 col-sm-4" ng-transclude></div></div></div>',
restrict: 'E'
};
return directive;
};
/**
* Widget Directive
*/
angular
.module('RDash')
.directive('rdWidget', rdWidget);
function rdWidget() {
var directive = {
transclude: true,
template: '<div class="widget" ng-transclude></div>',
restrict: 'EA'
};
return directive;
function link(scope, element, attrs) {
/* */
}
};
}
@@ -0,0 +1,201 @@
(function () {
var SUCCESS = 'success';
var ERROR = 'danger';
var INFO = 'info';
oneClickAppsRepository["vsts-agent"] = function (apiManager) {
var getErrorMessageIfExists = apiManager.getErrorMessageIfExists;
var VSTS_ACCOUNT = 'VSTS_ACCOUNT';
var VSTS_TOKEN = 'VSTS_TOKEN';
var VSTS_AGENT = 'VSTS_AGENT';
var VSTS_POOL = 'VSTS_POOL';
var DOCKER_TAG = 'DOCKER_TAG';
var VSTS_AGENT_CONTAINER_NAME = 'VSTS_AGENT_CONTAINER_NAME';
var step1next = {};
step1next.data = [];
step1next.data.push({
label: 'VSTS Agent Container Name',
id: VSTS_AGENT_CONTAINER_NAME,
type: 'text'
});
step1next.data.push({
label: 'OPTIONAL: Docker Tag (default "latest")',
labelDesc: 'https://hub.docker.com/r/microsoft/vsts-agent/tags/',
id: DOCKER_TAG,
type: 'text'
});
step1next.data.push({
label: 'VSTS Account',
labelDesc: 'The name of the Visual Studio account. Take only the account part from your address, e.g. http://{account}.visualstudio.com',
id: VSTS_ACCOUNT,
type: 'text'
});
step1next.data.push({
label: 'VSTS Token',
labelDesc: 'A personal access token (PAT) for the Visual Studio account that has been given at least the Agent Pools (read, manage) scope.',
id: VSTS_TOKEN,
type: 'text'
});
step1next.data.push({
label: 'VSTS Agent',
labelDesc: 'The name of the agent.',
id: VSTS_AGENT,
type: 'text'
});
step1next.data.push({
label: 'VSTS Pool',
labelDesc: 'The name of the agent pool.',
id: VSTS_POOL,
type: 'text'
});
step1next.process = function (data, step1Callback) {
// create container and set persistent
// set env vars and volumes
// deploy image via dockerfile
function endWithSuccess() {
step1Callback({
message: {
text: 'VSTS Agent is deployed and published as ' + data[VSTS_AGENT] +'.',
type: SUCCESS
},
next: null // this can be similar to step1next, in that case the flow continues...
});
}
function endWithError(errorMessage) {
step1Callback({
message: {
text: errorMessage,
type: ERROR
},
next: step1next
});
}
// process the inputs:
var errorMessage = null;
if (!data[VSTS_AGENT_CONTAINER_NAME]) {
errorMessage = 'Container name is required!';
} else if (!data[VSTS_ACCOUNT]) {
errorMessage = 'Account is required!';
} else if (!data[VSTS_TOKEN]) {
errorMessage = 'Acess token is required!';
} else if (!data[VSTS_AGENT]) {
errorMessage = 'Agent name is required!';
} else if (!data[VSTS_POOL]) {
errorMessage = 'Pool name is required!';
}
if (errorMessage) {
endWithError(errorMessage);
return;
}
var appName = data[VSTS_AGENT_CONTAINER_NAME];
var dockerTag = data[DOCKER_TAG] || 'latest';
var envVars = [{
key: VSTS_ACCOUNT,
value: data[VSTS_ACCOUNT]
}, {
key: VSTS_TOKEN,
value: data[VSTS_TOKEN]
},
{
key: VSTS_AGENT,
value: data[VSTS_AGENT]
},
{
key: VSTS_POOL,
value: data[VSTS_POOL]
}];
var volumes = [{
volumeName: appName + '-vsts-agent-vol',
containerPath: '/data/db'
}, {
volumeName: appName + '-vsts-agent-vol',
containerPath: '/data/configdb'
}];
function createContainer() {
var hasPersistentData = true;
apiManager.registerNewApp(appName, hasPersistentData, function (data) {
if (getErrorMessageIfExists(data)) {
endWithError(getErrorMessageIfExists(data));
return;
}
setupAppDefinition();
});
}
function setupAppDefinition() {
var appDefinition = {
instanceCount: 1,
envVars: envVars,
notExposeAsWebApp: true,
volumes: volumes
};
apiManager.updateConfigAndSave(appName, appDefinition, function (data) {
if (getErrorMessageIfExists(data)) {
endWithError(getErrorMessageIfExists(data));
return;
}
deployDockerfile();
});
}
function deployDockerfile() {
var captainDefinitionContent = {
schemaVersion: 1,
dockerfileLines: [
"FROM microsoft/vsts-agent:" + dockerTag
]
}
apiManager.uploadCaptainDefinitionContent(appName,
JSON.stringify(captainDefinitionContent), function (data) {
if (getErrorMessageIfExists(data)) {
endWithError(getErrorMessageIfExists(data));
return;
}
endWithSuccess();
});
}
createContainer();
}
var step1 = {};
step1.message = {
type: INFO,
text: 'Official image for the Visual Studio Team Services (VSTS) agent.'
}
step1.next = step1next;
return step1;
}
})();
@@ -34,7 +34,7 @@
type: 'text'
});
step1next.data.push({
label: 'OPTIONAL: Docker Tag for MySQL (default "5.5")',
label: 'OPTIONAL: Docker Tag for MySQL (default "5.7")',
labelDesc: 'https://hub.docker.com/r/library/mysql/tags/',
id: DOCKER_TAG_MYSQL,
type: 'text'
@@ -83,7 +83,7 @@
}
var dockerTagWordPress = data[DOCKER_TAG_WORDPRESS] || '4.9';
var dockerTagMySql = data[DOCKER_TAG_MYSQL] || '5.5';
var dockerTagMySql = data[DOCKER_TAG_MYSQL] || '5.7';
var mySqlAppName = data[WORDPRESS_NAME] + '-mysql';
var envVarsMySql = [{
key: MYSQL_ROOT_PASSWORD,
@@ -231,4 +231,4 @@
}
})();
})();
@@ -182,13 +182,13 @@
</div>
<p>Make sure that you have a 'captain-definition' file in your project. See
<a href="https://github.com/githubsaturn/captainduckduck/wiki/Captain-Definition-File" target="_blank">docs</a> for more details.</p>
<a href="https://captainduckduck.com/docs/captain-definition-file.html" target="_blank">docs</a> for more details.</p>
<h5>
<b> Method 1 (RECOMMENDED)</b>
</h5>
<p>Use CLI deploy command. This is the best method as it's the only method that reports potential build
failures to you.
<a href="https://github.com/githubsaturn/captainduckduck/wiki/Getting-Started#step-4-deploy-the-test-app" target="_blank">Read here</a>
<a href="https://captainduckduck.com/docs/get-started.html#step-4-deploy-the-test-app" target="_blank">Read here</a>
</p>
<h5>
<b> Method 2: Tarball</b>
@@ -303,7 +303,7 @@
<div>
<h4>Port Mapping &nbsp;
<a href="https://github.com/githubsaturn/captainduckduck/wiki/App-Configuration#port-mapping" target="_blank" rel="noopener noreferrer">
<a href="https://captainduckduck.com/docs/app-configuration.html#port-mapping" target="_blank" rel="noopener noreferrer">
<i class="fa fa-info-circle" aria-hidden="true"></i>
</a>
</h4>
@@ -337,7 +337,7 @@
<div ng-show="app.hasPersistentData">
<h4>Persistent Directories &nbsp;
<a href="https://github.com/githubsaturn/captainduckduck/wiki/App-Configuration#persistent-data" target="_blank" rel="noopener noreferrer">
<a href="https://captainduckduck.com/docs/app-configuration.html#persistent-or-not" target="_blank" rel="noopener noreferrer">
<i class="fa fa-info-circle" aria-hidden="true"></i>
</a>
@@ -426,7 +426,7 @@
<a href="" ng-click="onPreDeployFunctionToggled()">
<h5>{{!!app.hasPreDeployFunction? 'Remove':'Add'}} Pre-Deploy Script
&nbsp;
<a href="https://github.com/githubsaturn/captainduckduck/wiki/Deployment-Methods#post-deploy-script" target="_blank" rel="noopener noreferrer">
<a href="https://captainduckduck.com/docs/pre-deploy-script.html" target="_blank" rel="noopener noreferrer">
&nbsp; <i class="fa fa-info-circle" aria-hidden="true"></i>
</a>
@@ -25,7 +25,7 @@
<div class="checkbox" uib-tooltip="Mostly used for databases, see docs for details.">
<label>
<input type="checkbox" ng-model="newAppData.newAppHasPersistentData"> Has Persistent Data &nbsp;
<a href="https://github.com/githubsaturn/captainduckduck/wiki/App-Configuration#persistent-data" target="_blank" rel="noopener noreferrer">
<a href="https://captainduckduck.com/docs/app-configuration.html#persistent-or-not" target="_blank" rel="noopener noreferrer">
<i class="fa fa-info-circle" aria-hidden="true"></i>
</a>
</label>
@@ -11,7 +11,7 @@
<div class="row">
<div>
<label for="inputFirstName">Password (default: captain42 )</label>
<label for="inputFirstName">Password (default: captain42)</label>
<input type="password" class="form-control" id="inputFirstName" ng-model="data.captainPassword">
</div>
@@ -14,7 +14,7 @@
<b>IMPORTANT:</b>
<i> {{modalAppDelete.appName}}</i> is an app with persistent data. After deleting the app from CaptainDuckDuck, you
will have to manually SSH to your server, and delete Persistent Directories on your server. Refer to the
<a href="https://github.com/githubsaturn/captainduckduck/wiki/App-Configuration#removing-persistent-apps" target="_blank" rel="noopener noreferrer">
<a href="https://captainduckduck.com/docs/app-configuration.html#removing-persistent-apps" target="_blank" rel="noopener noreferrer">
documentations</a>
for more details.
</p>
+1 -1
View File
@@ -27,7 +27,7 @@ let data = {
isDebug: EnvVars.CAPTAIN_IS_DEBUG,
version: '0.7.2',
version: '0.7.3',
captainSaltSecretKey: 'captain-salt',
+3 -3
View File
@@ -1241,7 +1241,7 @@
},
"duplexer": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz",
"resolved": "http://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz",
"integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=",
"dev": true
},
@@ -4571,7 +4571,7 @@
},
"pause-stream": {
"version": "0.0.11",
"resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz",
"resolved": "http://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz",
"integrity": "sha1-/lo0sMvOErWqaitAPuLnO2AvFEU=",
"dev": true,
"requires": {
@@ -5853,7 +5853,7 @@
},
"through": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
"resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz",
"integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=",
"dev": true
},