Merge pull request #1 from githubsaturn/master

update local
This commit is contained in:
Nitin Goyal
2017-12-19 15:19:49 +05:30
committed by GitHub
25 changed files with 178 additions and 105 deletions
+46
View File
@@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at captainduckduck.github atJiiiMaaaiL. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
+3 -2
View File
@@ -25,10 +25,11 @@ or your local machine itself. Needless to say, Docker is required (same minimum
> Docker for Mac users: You need to add `/captain` to shared paths.
> To do so, click on the Docker icon -> Setting -> File Sharing and add `/captain`
Log in to your machine, clone the git repo, go to `app-backend` directory and run the following line:
Log in to your machine, clone the git repo, go to `app-backend` directory and run the following lines:
```bash
./dev-clean-run-as-dev.sh
$ npm install
$ ./dev-clean-run-as-dev.sh
```
You are good to go! You can run the following line to see the logs for the back-end service.
+1
View File
@@ -19,6 +19,7 @@ Captain is a modern automated app deployment & web server manager. It's blazingl
- Deploy apps in your own space (Node js, PHP, Python, literally any language!)
- Deploying built-in apps is a matter of seconds! MongoDB, Parse, MySQL, WordPress, Postgres and many more.
- Secure your services over HTTPS for FREE
- Automatic deploy from Github, Bitbucket and etc by using webhooks!
- Attach more nodes and create a cluster in seconds! Captain automatically configures nginx to load balance.
- Focus on your apps! Not the bells and whistles just to run your apps!
+4
View File
@@ -1524,6 +1524,10 @@ function SettingsCtrl($scope, $cookieStore, $rootScope, pageDefinitions,
captainToast.showToastSuccess('Update process has successfully started...');
setTimeout(function () {
window.location.reload(true);
}, 6000);
$scope.loadingState.enabled = false;
});
+8 -11
View File
@@ -3,8 +3,7 @@
<div ng-show="!loadingState.enabled">
<div class="row" ng-show="!editContent.appsToEdit.length">
<div class="col-md-4"></div>
<div class="col-md-4">
<div class="col-md-4 col-md-offset-4">
<rd-widget>
<rd-widget-header icon="fa-plus" title="Create A New App">
@@ -48,8 +47,7 @@
</div>
<div class="row" ng-show="!editContent.appsToEdit.length && allApps && !!allApps.length">
<div class="col-md-2"></div>
<div class="col-md-8">
<div class="col-md-8 col-md-offset-2">
<br>
<br>
@@ -106,8 +104,7 @@
<div class="row" ng-repeat="app in editContent.appsToEdit" ng-show="editContent.appsToEdit.length">
<div class="col-md-3"></div>
<div class="col-md-6">
<div class="col-md-6 col-md-offset-3">
<br>
<br>
@@ -268,11 +265,11 @@
<div class="form-group col-sm-6">
<div class="input-group">
<span class="input-group-addon">Username:</span>
<input type="text" class="form-control" ng-model="app.appPushWebhook.repoInfo.user" placeholder="githubusername">
<input type="text" class="form-control" ng-model="app.appPushWebhook.repoInfo.user" placeholder="myemail@gmail.com">
</div>
</div>
<div class="col-sm-6 form-group">
<div class="input-group">
<div class="input-group" uib-tooltip="Enter 123123 (or anything else!) for public repos">
<span class="input-group-addon">Password:</span>
<input type="text" class="form-control" ng-model="app.appPushWebhook.repoInfo.password" placeholder="githubpassword">
</div>
@@ -282,7 +279,7 @@
<div class="form-group col-sm-6">
<div class="input-group">
<span class="input-group-addon">Repository:</span>
<input type="text" class="form-control" ng-model="app.appPushWebhook.repoInfo.repo" placeholder="githubusername">
<input type="text" class="form-control" ng-model="app.appPushWebhook.repoInfo.repo" placeholder="github.com/someone/something">
</div>
</div>
<div class="col-sm-6 form-group">
@@ -434,7 +431,7 @@
<div class="form-group col-xs-6">
<div class="input-group" uib-tooltip="{{app.hasPersistentData?'Cannot change instances of an app with persistent data':'Number of running instances of this app'}}">
<span class="input-group-addon">Instance Count:</span>
<input type="text" class="form-control" ng-disabled="app.hasPersistentData" ng-model="app.instanceCount">
<input type="number" class="form-control" ng-disabled="app.hasPersistentData" ng-model="app.instanceCount">
</div>
</div>
@@ -450,4 +447,4 @@
</rd-widget>
</div>
</div>
</div>
</div>
+4 -7
View File
@@ -1,6 +1,5 @@
<div class="row">
<div class="col-lg-2"></div>
<div class="col-lg-8">
<div class="col-lg-8 col-lg-offset-2">
<rd-widget>
<rd-widget-header icon="fa-tasks" title="Captain Root Domain Configurations">
</rd-widget-header>
@@ -19,8 +18,7 @@
<hr>
<div class="row">
<div class="col-lg-1"></div>
<div class="col-lg-10">
<div class="col-lg-10 col-lg-offset-1">
<form class="row">
<div class="form-group col-md-12">
<label for="rootDomainId">Captain Root Domain</label>
@@ -54,8 +52,7 @@
<hr>
<div class="row">
<div class="col-lg-2"></div>
<div class="col-lg-8">
<div class="col-lg-8 col-lg-offset-2">
<rd-widget>
<rd-widget-header icon="fa-tasks" title="Docker Registry Configuration">
</rd-widget-header>
@@ -116,4 +113,4 @@
</rd-widget-body>
</rd-widget>
</div>
</div>
</div>
+2 -3
View File
@@ -1,7 +1,6 @@
<div class="full-page-content">
<div class="row">
<div class="col-lg-4"></div>
<div class="col-lg-4">
<div class="col-lg-4 col-lg-offset-4">
<rd-widget>
<rd-widget-header icon="fa-key" title="Login">
@@ -29,4 +28,4 @@
</div>
</div>
</div>
</div>
+2 -3
View File
@@ -66,8 +66,7 @@
<hr>
<div class="row">
<div class="col-lg-2"></div>
<div class="col-lg-8">
<div class="col-lg-8 col-lg-offset-2">
<rd-widget>
<rd-widget-header icon="fa-tasks" title="NetData Monitoring Tool">
</rd-widget-header>
@@ -294,4 +293,4 @@
</rd-widget-body>
</rd-widget>
</div>
</div>
</div>
+8 -15
View File
@@ -3,8 +3,7 @@
<div ng-show="!loadingState.enabled">
<div class="row">
<div class="col-md-2"></div>
<div class="col-md-8">
<div class="col-md-8 col-md-offset-2">
<rd-widget>
<rd-widget-header icon="fa-link" title="Attach a New Node">
@@ -12,15 +11,13 @@
<rd-widget-body>
<div class="row">
<div class="col-sm-1"></div>
<div class="col-sm-4">
<div class="col-sm-4 col-sm-offset-1">
<div class="form-group">
<label for="inputFirstName">Remote IP Address (as seen by Captain)</label>
<input type="text" class="form-control" id="inputFirstName" placeholder="Remote IP Address" ng-model="nodeToAdd.remoteNodeIpAddress">
</div>
</div>
<div class="col-sm-2"></div>
<div class="col-sm-4">
<div class="col-sm-4 col-sm-offset-2">
<div class="form-group">
<label for="inputLastName">Remote Username</label>
<input type="text" class="form-control" id="inputLastName" ng-model="nodeToAdd.remoteUserName">
@@ -28,15 +25,13 @@
</div>
</div>
<div class="row">
<div class="col-sm-1"></div>
<div class="col-sm-4">
<div class="col-sm-4 col-sm-offset-1">
<div class="form-group">
<label for="inputFirstName">Captain IP Address (as seen by remote)</label>
<input type="text" class="form-control" ng-model="nodeToAdd.captainIpAddress" id="captainIpAddress" placeholder="Captain IP Address">
</div>
</div>
<div class="col-sm-2"></div>
<div class="col-sm-4">
<div class="col-sm-4 col-sm-offset-2">
<div class="form-group">
<label for="inputWebsite">Node Type</label>
<input type="text" class="form-control" ng-model="nodeToAdd.nodeType" id="inputWebsite" placeholder="worker/manager">
@@ -44,8 +39,7 @@
</div>
</div>
<div class="row">
<div class="col-sm-1"></div>
<div class="col-sm-10">
<div class="col-sm-10 col-sm-offset-1">
<div class="form-group">
<label for="textarea01">SSH Private Key</label>
<textarea style="font-family: monospace" ng-model="nodeToAdd.privateKey" placeholder="-----BEGIN RSA PRIVATE KEY-----&#10;MIICWwIBAAKBgQDArfs81aizq8ckg16e+ewFgJg7J..." class="form-control" id="textarea01"></textarea>
@@ -72,8 +66,7 @@
<div ng-repeat="node in allNodes">
<div class="row">
<div class="col-md-3"></div>
<div class="col-md-6">
<div class="col-md-6 col-md-offset-3">
<rd-widget>
<rd-widget-header icon="fa-server" title="{{node.ip}} {{node.state=='down'?'** DOWN **':''}}">
@@ -104,4 +97,4 @@
</div>
<br>
<br>
</div>
</div>
+3 -5
View File
@@ -1,6 +1,5 @@
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4">
<div class="col-md-4 col-md-offset-4">
<rd-widget>
<rd-widget-header icon="fa-key" title="Change Password">
@@ -44,8 +43,7 @@
<hr>
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4">
<div class="col-md-4 col-md-offset-4">
<rd-widget>
@@ -85,4 +83,4 @@
</rd-widget-body>
</rd-widget>
</div>
</div>
</div>
+6 -2
View File
@@ -428,8 +428,12 @@ class DataStore {
.then(function (appPushWebhookRepoInfo) {
instanceCount = Number(instanceCount);
if (instanceCount >= 0) {
app.instanceCount = instanceCount;
}
app.instanceCount = instanceCount;
app.notExposeAsWebApp = !!notExposeAsWebApp;
app.nodeId = nodeId;
@@ -812,4 +816,4 @@ class DataStore {
}
module.exports = DataStore;
module.exports = DataStore;
+1 -1
View File
@@ -106,7 +106,7 @@ module.exports.injectUserForWebhook = function () {
app = appFound;
if (app.appPushWebhook.tokenVersion !== decodedInfo.tokenVersion) {
Logger.e('Token Info do not match')
throw new Error('Token Info do not match');
}
let user = {
+52 -7
View File
@@ -7,6 +7,31 @@ const ApiStatusCodes = require('../api/ApiStatusCodes');
const Logger = require('../utils/Logger');
const CaptainConstants = require('../utils/CaptainConstants');
router.post('/triggerbuild', function (req, res, next) {
// find which branch is pushed
// inject it in locals.pushedBranches
let isGithub = req.header('X-GitHub-Event') === 'push';
let isBitbucket = (req.header('X-Event-Key') === 'repo:push') && req.header('X-Request-UUID') && req.header('X-Hook-UUID');
res.locals.pushedBranches = [];
if (isGithub) {
let ref = req.body.ref; // "ref/heads/somebranch"
res.locals.pushedBranches.push(ref.substring(11, ref.length));
}
else if (isBitbucket) {
for (let i = 0; i < req.body.push.changes.length; i++) {
res.locals.pushedBranches.push(req.body.push.changes[i].new.name);
}
}
next();
});
router.post('/triggerbuild', function (req, res, next) {
res.sendStatus(200);
@@ -15,7 +40,7 @@ router.post('/triggerbuild', function (req, res, next) {
let app = res.locals.app;
let namespace = res.locals.user.namespace;
if (!app || !serviceManager || !namespace|| !appName) {
if (!app || !serviceManager || !namespace || !appName) {
Logger.e('Something went wrong during trigger build. Cannot extract app information from the payload.');
return;
}
@@ -28,14 +53,34 @@ router.post('/triggerbuild', function (req, res, next) {
})
.then(function (repoInfo) {
return serviceManager.createImage(appName, {
repoInfo: repoInfo
});
// if we didn't detect any branches, the POST might have come from another source that we don't
// explicitly support. Therefore, we just let it go through and triggers a build anyways
if (res.locals.pushedBranches.length > 0) {
let branchIsTracked = false;
})
.then(function (version) {
for (let i = 0; i < res.locals.pushedBranches.length; i++) {
if (res.locals.pushedBranches[i] === repoInfo.branch) {
branchIsTracked = true;
break;
}
}
return serviceManager.ensureServiceInitedAndUpdated(appName, version);
// POST call was triggered due to another branch being pushed. We don't need to trigger the build.
if (!branchIsTracked) {
return;
}
}
return serviceManager
.createImage(appName, {
repoInfo: repoInfo
})
.then(function (version) {
return serviceManager.ensureServiceInitedAndUpdated(appName, version);
});
})
.catch(function (error) {
+2 -2
View File
@@ -24,7 +24,7 @@
server {
listen 80;
client_max_body_size 200m;
client_max_body_size 300m;
<%
if (captain.hasRootSsl) {
@@ -71,7 +71,7 @@
server {
listen 80;
client_max_body_size 200m;
client_max_body_size 300m;
<%
if (registry.hasRootSsl) {
%>
@@ -6,7 +6,6 @@
server {
listen 80;
<%
if (s.hasSsl) {
%>
@@ -17,6 +16,7 @@
}
%>
client_max_body_size 500m;
server_name <%-s.publicDomain%>;
+2
View File
@@ -16,6 +16,7 @@ function getTagsForImage(imageBaseName, url, allTags) {
function (error, response, body) {
if (error || !body) {
Logger.e(error);
reject(error);
return;
}
@@ -29,6 +30,7 @@ function getTagsForImage(imageBaseName, url, allTags) {
}
if (!results) {
Logger.e('NO RESULT');
reject(new Error('NO RESULT'));
return;
}
+1 -1
View File
@@ -24,7 +24,7 @@ let data = {
isDebug: EnvVars.CAPTAIN_IS_DEBUG,
version: '0.2.2',
version: '0.3.0',
captainSaltSecretKey: 'captain-salt',
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "captainduckduck",
"version": "1.0.6",
"version": "1.0.7",
"description": "CLI tool for CaptainDuckDuck. See CaptainDuckDuck.com for more details.",
"main": "captainduckduck.js",
"scripts": {
@@ -60,6 +60,10 @@ function SettingsCtrl($scope, $cookieStore, $rootScope, pageDefinitions,
captainToast.showToastSuccess('Update process has successfully started...');
setTimeout(function () {
window.location.reload(true);
}, 6000);
$scope.loadingState.enabled = false;
});
+8 -11
View File
@@ -3,8 +3,7 @@
<div ng-show="!loadingState.enabled">
<div class="row" ng-show="!editContent.appsToEdit.length">
<div class="col-md-4"></div>
<div class="col-md-4">
<div class="col-md-4 col-md-offset-4">
<rd-widget>
<rd-widget-header icon="fa-plus" title="Create A New App">
@@ -48,8 +47,7 @@
</div>
<div class="row" ng-show="!editContent.appsToEdit.length && allApps && !!allApps.length">
<div class="col-md-2"></div>
<div class="col-md-8">
<div class="col-md-8 col-md-offset-2">
<br/>
<br/>
@@ -106,8 +104,7 @@
<div class="row" ng-repeat="app in editContent.appsToEdit" ng-show="editContent.appsToEdit.length">
<div class="col-md-3"></div>
<div class="col-md-6">
<div class="col-md-6 col-md-offset-3">
<br/>
<br/>
@@ -269,11 +266,11 @@
<div class="form-group col-sm-6">
<div class="input-group">
<span class="input-group-addon">Username:</span>
<input type="text" class="form-control" ng-model="app.appPushWebhook.repoInfo.user" placeholder="githubusername">
<input type="text" class="form-control" ng-model="app.appPushWebhook.repoInfo.user" placeholder="myemail@gmail.com">
</div>
</div>
<div class="col-sm-6 form-group">
<div class="input-group">
<div class="input-group" uib-tooltip="Enter 123123 (or anything else!) for public repos">
<span class="input-group-addon">Password:</span>
<input type="text" class="form-control" ng-model="app.appPushWebhook.repoInfo.password" placeholder="githubpassword">
</div>
@@ -283,7 +280,7 @@
<div class="form-group col-sm-6">
<div class="input-group">
<span class="input-group-addon">Repository:</span>
<input type="text" class="form-control" ng-model="app.appPushWebhook.repoInfo.repo" placeholder="githubusername">
<input type="text" class="form-control" ng-model="app.appPushWebhook.repoInfo.repo" placeholder="github.com/someone/something">
</div>
</div>
<div class="col-sm-6 form-group">
@@ -436,7 +433,7 @@
<div class="form-group col-xs-6">
<div class="input-group" uib-tooltip="{{app.hasPersistentData?'Cannot change instances of an app with persistent data':'Number of running instances of this app'}}">
<span class="input-group-addon">Instance Count:</span>
<input type="text" class="form-control" ng-disabled="app.hasPersistentData" ng-model="app.instanceCount">
<input type="number" class="form-control" ng-disabled="app.hasPersistentData" ng-model="app.instanceCount">
</div>
</div>
@@ -452,4 +449,4 @@
</rd-widget>
</div>
</div>
</div>
</div>
+4 -7
View File
@@ -1,6 +1,5 @@
<div class="row">
<div class="col-lg-2"></div>
<div class="col-lg-8">
<div class="col-lg-8 col-lg-offset-2">
<rd-widget>
<rd-widget-header icon="fa-tasks" title="Captain Root Domain Configurations">
</rd-widget-header>
@@ -19,8 +18,7 @@
<hr />
<div class="row">
<div class="col-lg-1"></div>
<div class="col-lg-10">
<div class="col-lg-10 col-lg-offset-1">
<form class="row">
<div class="form-group col-md-12">
<label for="rootDomainId">Captain Root Domain</label>
@@ -59,8 +57,7 @@
<hr/>
<div class="row">
<div class="col-lg-2"></div>
<div class="col-lg-8">
<div class="col-lg-8 col-lg-offset-2">
<rd-widget>
<rd-widget-header icon="fa-tasks" title="Docker Registry Configuration">
</rd-widget-header>
@@ -121,4 +118,4 @@
</rd-widget-body>
</rd-widget>
</div>
</div>
</div>
+2 -3
View File
@@ -1,7 +1,6 @@
<div class="full-page-content">
<div class="row">
<div class="col-lg-4"></div>
<div class="col-lg-4">
<div class="col-lg-4 col-lg-offset-4">
<rd-widget>
<rd-widget-header icon="fa-key" title="Login">
@@ -29,4 +28,4 @@
</div>
</div>
</div>
</div>
+2 -3
View File
@@ -66,8 +66,7 @@
<hr />
<div class="row">
<div class="col-lg-2"></div>
<div class="col-lg-8">
<div class="col-lg-8 col-lg-offset-2">
<rd-widget>
<rd-widget-header icon="fa-tasks" title="NetData Monitoring Tool">
</rd-widget-header>
@@ -304,4 +303,4 @@
</rd-widget-body>
</rd-widget>
</div>
</div>
</div>
+8 -15
View File
@@ -3,8 +3,7 @@
<div ng-show="!loadingState.enabled">
<div class="row">
<div class="col-md-2"></div>
<div class="col-md-8">
<div class="col-md-8 col-md-offset-2">
<rd-widget>
<rd-widget-header icon="fa-link" title="Attach a New Node">
@@ -12,15 +11,13 @@
<rd-widget-body>
<div class="row">
<div class="col-sm-1"></div>
<div class="col-sm-4">
<div class="col-sm-4 col-sm-offset-1">
<div class="form-group">
<label for="inputFirstName">Remote IP Address (as seen by Captain)</label>
<input type="text" class="form-control" id="inputFirstName" placeholder="Remote IP Address" ng-model="nodeToAdd.remoteNodeIpAddress">
</div>
</div>
<div class="col-sm-2"></div>
<div class="col-sm-4">
<div class="col-sm-4 col-sm-offset-2">
<div class="form-group">
<label for="inputLastName">Remote Username</label>
<input type="text" class="form-control" id="inputLastName" ng-model="nodeToAdd.remoteUserName">
@@ -28,15 +25,13 @@
</div>
</div>
<div class="row">
<div class="col-sm-1"></div>
<div class="col-sm-4">
<div class="col-sm-4 col-sm-offset-1">
<div class="form-group">
<label for="inputFirstName">Captain IP Address (as seen by remote)</label>
<input type="text" class="form-control" ng-model="nodeToAdd.captainIpAddress" id="captainIpAddress" placeholder="Captain IP Address">
</div>
</div>
<div class="col-sm-2"></div>
<div class="col-sm-4">
<div class="col-sm-4 col-sm-offset-2">
<div class="form-group">
<label for="inputWebsite">Node Type</label>
<input type="text" class="form-control" ng-model="nodeToAdd.nodeType" id="inputWebsite" placeholder="worker/manager">
@@ -44,8 +39,7 @@
</div>
</div>
<div class="row">
<div class="col-sm-1"></div>
<div class="col-sm-10">
<div class="col-sm-10 col-sm-offset-1">
<div class="form-group">
<label for="textarea01">SSH Private Key</label>
<textarea style="font-family: monospace;" ng-model="nodeToAdd.privateKey" placeholder="-----BEGIN RSA PRIVATE KEY-----&#10;MIICWwIBAAKBgQDArfs81aizq8ckg16e+ewFgJg7J..."
@@ -73,8 +67,7 @@
<div ng-repeat="node in allNodes">
<div class="row">
<div class="col-md-3"></div>
<div class="col-md-6">
<div class="col-md-6 col-md-offset-3">
<rd-widget>
<rd-widget-header icon="fa-server" title="{{node.ip}} {{node.state=='down'?'** DOWN **':''}}">
@@ -105,4 +98,4 @@
</div>
<br/>
<br/>
</div>
</div>
+3 -5
View File
@@ -1,6 +1,5 @@
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4">
<div class="col-md-4 col-md-offset-4">
<rd-widget>
<rd-widget-header icon="fa-key" title="Change Password">
@@ -45,8 +44,7 @@
<hr/>
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4">
<div class="col-md-4 col-md-offset-4">
<rd-widget>
@@ -86,4 +84,4 @@
</rd-widget-body>
</rd-widget>
</div>
</div>
</div>