deploy.sh 0.2.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +1 -0
- package/.eslintrc +7 -9
- package/.github/workflows/ci.yml +48 -0
- package/.husky/pre-commit +5 -0
- package/{test/fixtures/unknown/.gitkeep → .prettierrc} +0 -0
- package/.release-it.json +5 -0
- package/CHANGELOG.md +26 -0
- package/README.md +5 -6
- package/__tests__/fixtures/unknown/.gitkeep +0 -0
- package/__tests__/lib/classifier.test.js +49 -0
- package/__tests__/lib/helpers/util.test.js +57 -0
- package/bin/deploy-delete.js +14 -0
- package/bin/deploy-deploy.js +34 -59
- package/bin/deploy-list.js +25 -52
- package/bin/deploy-login.js +36 -52
- package/bin/deploy-logout.js +9 -40
- package/bin/deploy-logs.js +22 -48
- package/bin/deploy-open.js +14 -37
- package/bin/deploy-register.js +37 -50
- package/bin/deploy-server.js +8 -5
- package/bin/deploy-whoami.js +8 -37
- package/bin/deploy.js +145 -19
- package/{test/fixtures → examples}/docker/Dockerfile +0 -0
- package/examples/docker/index.js +12 -0
- package/examples/node/index.js +8 -0
- package/{test/fixtures → examples}/node/package.json +0 -0
- package/examples/static/index.html +22 -0
- package/{test/fixtures → examples}/static/main.css +4 -2
- package/examples/static/out.gifcd +0 -0
- package/generate-docs.js +55 -0
- package/index.js +54 -55
- package/jsdoc.json +6 -3
- package/lib/classifier.js +24 -17
- package/lib/deploy.js +56 -64
- package/lib/helpers/cli.js +178 -207
- package/lib/helpers/util.js +94 -21
- package/lib/models/deployment.js +415 -474
- package/lib/models/request.js +77 -66
- package/lib/models/user.js +119 -144
- package/lib/server.js +187 -97
- package/lib/static/not-found.html +30 -0
- package/lib/static/page-could-not-load.html +30 -0
- package/lib/static/static-server.js +70 -0
- package/package.json +47 -34
- package/website/README.md +41 -0
- package/website/babel.config.js +3 -0
- package/website/docs/api/_category_.yml +1 -0
- package/website/docs/api/lib/classifier.js.md +11 -0
- package/website/docs/api/lib/deploy.js.md +13 -0
- package/website/docs/api/lib/helpers/cli.js.md +193 -0
- package/website/docs/api/lib/helpers/util.js.md +65 -0
- package/website/docs/api/lib/models/deployment.js.md +171 -0
- package/website/docs/api/lib/models/request.js.md +67 -0
- package/website/docs/api/lib/models/user.js.md +92 -0
- package/website/docs/api/lib/server.js.md +0 -0
- package/website/docs/api/lib/static/static-server.js.md +0 -0
- package/website/docs/intro.md +57 -0
- package/website/docusaurus.config.js +82 -0
- package/website/package-lock.json +25218 -0
- package/website/package.json +39 -0
- package/website/sidebars.js +31 -0
- package/website/src/components/HomepageFeatures/index.js +79 -0
- package/website/src/components/HomepageFeatures/styles.module.css +11 -0
- package/website/src/css/custom.css +39 -0
- package/website/src/pages/index.js +57 -0
- package/website/src/pages/index.module.css +23 -0
- package/website/static/.nojekyll +0 -0
- package/website/static/example.gif +0 -0
- package/website/static/example.mov +0 -0
- package/website/static/img/favicon.ico +0 -0
- package/website/static/img/intro/deploy.png +0 -0
- package/website/static/img/intro/logs.png +0 -0
- package/{docs → website/static/img}/logo.png +0 -0
- package/{docs → website/static/img}/logo.pxm +0 -0
- package/{docs → website/static/img}/logo@2x.png +0 -0
- package/.npmignore +0 -9
- package/.travis.yml +0 -9
- package/TODO.md +0 -12
- package/docs/code/classifier.js.html +0 -116
- package/docs/code/deploy.js.html +0 -138
- package/docs/code/fonts/OpenSans-Bold-webfont.eot +0 -0
- package/docs/code/fonts/OpenSans-Bold-webfont.svg +0 -1830
- package/docs/code/fonts/OpenSans-Bold-webfont.woff +0 -0
- package/docs/code/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
- package/docs/code/fonts/OpenSans-BoldItalic-webfont.svg +0 -1830
- package/docs/code/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
- package/docs/code/fonts/OpenSans-Italic-webfont.eot +0 -0
- package/docs/code/fonts/OpenSans-Italic-webfont.svg +0 -1830
- package/docs/code/fonts/OpenSans-Italic-webfont.woff +0 -0
- package/docs/code/fonts/OpenSans-Light-webfont.eot +0 -0
- package/docs/code/fonts/OpenSans-Light-webfont.svg +0 -1831
- package/docs/code/fonts/OpenSans-Light-webfont.woff +0 -0
- package/docs/code/fonts/OpenSans-LightItalic-webfont.eot +0 -0
- package/docs/code/fonts/OpenSans-LightItalic-webfont.svg +0 -1835
- package/docs/code/fonts/OpenSans-LightItalic-webfont.woff +0 -0
- package/docs/code/fonts/OpenSans-Regular-webfont.eot +0 -0
- package/docs/code/fonts/OpenSans-Regular-webfont.svg +0 -1831
- package/docs/code/fonts/OpenSans-Regular-webfont.woff +0 -0
- package/docs/code/fonts/OpenSans-Semibold-webfont.eot +0 -0
- package/docs/code/fonts/OpenSans-Semibold-webfont.svg +0 -1830
- package/docs/code/fonts/OpenSans-Semibold-webfont.ttf +0 -0
- package/docs/code/fonts/OpenSans-Semibold-webfont.woff +0 -0
- package/docs/code/fonts/OpenSans-SemiboldItalic-webfont.eot +0 -0
- package/docs/code/fonts/OpenSans-SemiboldItalic-webfont.svg +0 -1830
- package/docs/code/fonts/OpenSans-SemiboldItalic-webfont.ttf +0 -0
- package/docs/code/fonts/OpenSans-SemiboldItalic-webfont.woff +0 -0
- package/docs/code/global.html +0 -325
- package/docs/code/helpers_cli.js.html +0 -351
- package/docs/code/helpers_util.js.html +0 -127
- package/docs/code/index.html +0 -81
- package/docs/code/models_deployment.js.html +0 -593
- package/docs/code/models_request.js.html +0 -150
- package/docs/code/models_user.js.html +0 -232
- package/docs/code/module-lib_classifier.html +0 -246
- package/docs/code/module-lib_deploy.html +0 -350
- package/docs/code/module-lib_helpers_cli.html +0 -2067
- package/docs/code/module-lib_helpers_util.html +0 -608
- package/docs/code/module-models_deployment-Deployment.html +0 -359
- package/docs/code/module-models_deployment-DeploymentSchema.html +0 -359
- package/docs/code/module-models_deployment.Deployment.html +0 -359
- package/docs/code/module-models_deployment.html +0 -1851
- package/docs/code/module-models_request-Request.html +0 -409
- package/docs/code/module-models_request-RequestSchema.html +0 -359
- package/docs/code/module-models_request.html +0 -446
- package/docs/code/module-models_user-User.html +0 -306
- package/docs/code/module-models_user-UserSchema.html +0 -306
- package/docs/code/module-models_user.User.html +0 -306
- package/docs/code/module-models_user.html +0 -1200
- package/docs/code/scripts/linenumber.js +0 -25
- package/docs/code/scripts/prettify/Apache-License-2.0.txt +0 -202
- package/docs/code/scripts/prettify/lang-css.js +0 -2
- package/docs/code/scripts/prettify/prettify.js +0 -28
- package/docs/code/styles/jsdoc-default.css +0 -692
- package/docs/code/styles/prettify-jsdoc.css +0 -111
- package/docs/code/styles/prettify-tomorrow.css +0 -132
- package/docs/example-docker.gif +0 -0
- package/docs/example-node.gif +0 -0
- package/docs/example-static.gif +0 -0
- package/docs/index.html +0 -50
- package/docs/main.css +0 -12
- package/docs/psychic-min.css +0 -1
- package/lib/helpers/static-server.js +0 -69
- package/test/fixtures/docker/index.js +0 -12
- package/test/fixtures/node/index.js +0 -8
- package/test/fixtures/static/index.html +0 -14
- package/test/lib/classifier.js +0 -51
- package/test/lib/helpers/util.js +0 -30
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "website",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"docusaurus": "docusaurus",
|
|
7
|
+
"start": "docusaurus start",
|
|
8
|
+
"build": "docusaurus build",
|
|
9
|
+
"swizzle": "docusaurus swizzle",
|
|
10
|
+
"deploy": "docusaurus deploy",
|
|
11
|
+
"clear": "docusaurus clear",
|
|
12
|
+
"serve": "docusaurus serve",
|
|
13
|
+
"write-translations": "docusaurus write-translations",
|
|
14
|
+
"write-heading-ids": "docusaurus write-heading-ids"
|
|
15
|
+
},
|
|
16
|
+
"browserslist": {
|
|
17
|
+
"production": [
|
|
18
|
+
">0.5%",
|
|
19
|
+
"not dead",
|
|
20
|
+
"not op_mini all"
|
|
21
|
+
],
|
|
22
|
+
"development": [
|
|
23
|
+
"last 1 chrome version",
|
|
24
|
+
"last 1 firefox version",
|
|
25
|
+
"last 1 safari version"
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@docusaurus/core": "2.0.0-beta.17",
|
|
30
|
+
"@docusaurus/preset-classic": "2.0.0-beta.17",
|
|
31
|
+
"@mdx-js/react": "^1.6.22",
|
|
32
|
+
"clsx": "^1.1.1",
|
|
33
|
+
"docusaurus-plugin-image-zoom": "^0.0.2",
|
|
34
|
+
"docusaurus-plugin-search-local": "^0.4.0",
|
|
35
|
+
"prism-react-renderer": "^1.2.1",
|
|
36
|
+
"react": "^17.0.1",
|
|
37
|
+
"react-dom": "^17.0.1"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creating a sidebar enables you to:
|
|
3
|
+
- create an ordered group of docs
|
|
4
|
+
- render a sidebar for each doc of that group
|
|
5
|
+
- provide next/previous navigation
|
|
6
|
+
|
|
7
|
+
The sidebars can be generated from the filesystem, or explicitly defined here.
|
|
8
|
+
|
|
9
|
+
Create as many sidebars as you want.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
// @ts-check
|
|
13
|
+
|
|
14
|
+
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
|
|
15
|
+
const sidebars = {
|
|
16
|
+
// By default, Docusaurus generates a sidebar from the docs folder structure
|
|
17
|
+
tutorialSidebar: [{ type: "autogenerated", dirName: "." }],
|
|
18
|
+
|
|
19
|
+
// But you can create a sidebar manually
|
|
20
|
+
/*
|
|
21
|
+
tutorialSidebar: [
|
|
22
|
+
{
|
|
23
|
+
type: 'category',
|
|
24
|
+
label: 'Tutorial',
|
|
25
|
+
items: ['hello'],
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
*/
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
module.exports = sidebars;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import styles from "./styles.module.css";
|
|
4
|
+
|
|
5
|
+
const FeatureList = [
|
|
6
|
+
{
|
|
7
|
+
title: "Docker",
|
|
8
|
+
description: (
|
|
9
|
+
<>
|
|
10
|
+
<pre>
|
|
11
|
+
<span>$ my-app/</span>
|
|
12
|
+
ls/
|
|
13
|
+
<br />
|
|
14
|
+
<b>Dockerfile server.go</b>
|
|
15
|
+
<br />
|
|
16
|
+
<span>$ my-app/</span>
|
|
17
|
+
deploy
|
|
18
|
+
</pre>
|
|
19
|
+
</>
|
|
20
|
+
),
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
title: "Node.js",
|
|
24
|
+
description: (
|
|
25
|
+
<>
|
|
26
|
+
<pre>
|
|
27
|
+
<span>$ my-api/</span>
|
|
28
|
+
ls
|
|
29
|
+
<br />
|
|
30
|
+
<b>package.json index.js</b>
|
|
31
|
+
<br />
|
|
32
|
+
<span>$ my-api/</span>
|
|
33
|
+
deploy
|
|
34
|
+
</pre>
|
|
35
|
+
</>
|
|
36
|
+
),
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
title: "Static Websites",
|
|
40
|
+
description: (
|
|
41
|
+
<>
|
|
42
|
+
<pre>
|
|
43
|
+
<span>$ my-site/</span>
|
|
44
|
+
ls
|
|
45
|
+
<br />
|
|
46
|
+
<b>index.html logo.png</b>
|
|
47
|
+
<br />
|
|
48
|
+
<span>$ my-site/</span>
|
|
49
|
+
deploy
|
|
50
|
+
</pre>
|
|
51
|
+
</>
|
|
52
|
+
),
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
function Feature({ title, description }) {
|
|
57
|
+
return (
|
|
58
|
+
<div className={clsx("col col--4 text--left")}>
|
|
59
|
+
<div className="padding-horiz--md">
|
|
60
|
+
<h3>{title}</h3>
|
|
61
|
+
<p>{description}</p>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export default function HomepageFeatures() {
|
|
68
|
+
return (
|
|
69
|
+
<section className={styles.features}>
|
|
70
|
+
<div className="container">
|
|
71
|
+
<div className="row">
|
|
72
|
+
{FeatureList.map((props, idx) => (
|
|
73
|
+
<Feature key={idx} {...props} />
|
|
74
|
+
))}
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
</section>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Any CSS included here will be global. The classic template
|
|
3
|
+
* bundles Infima by default. Infima is a CSS framework designed to
|
|
4
|
+
* work well for content-centric websites.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/* You can override the default Infima variables here. */
|
|
8
|
+
:root {
|
|
9
|
+
--ifm-color-primary: #2e8555;
|
|
10
|
+
--ifm-color-primary-dark: #29784c;
|
|
11
|
+
--ifm-color-primary-darker: #277148;
|
|
12
|
+
--ifm-color-primary-darkest: #205d3b;
|
|
13
|
+
--ifm-color-primary-light: #33925d;
|
|
14
|
+
--ifm-color-primary-lighter: #359962;
|
|
15
|
+
--ifm-color-primary-lightest: #3cad6e;
|
|
16
|
+
--ifm-code-font-size: 95%;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/* For readability concerns, you should choose a lighter palette in dark mode. */
|
|
20
|
+
[data-theme="dark"] {
|
|
21
|
+
--ifm-color-primary: #25c2a0;
|
|
22
|
+
--ifm-color-primary-dark: #21af90;
|
|
23
|
+
--ifm-color-primary-darker: #1fa588;
|
|
24
|
+
--ifm-color-primary-darkest: #1a8870;
|
|
25
|
+
--ifm-color-primary-light: #29d5b0;
|
|
26
|
+
--ifm-color-primary-lighter: #32d8b4;
|
|
27
|
+
--ifm-color-primary-lightest: #4fddbf;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.docusaurus-highlight-code-line {
|
|
31
|
+
background-color: rgba(0, 0, 0, 0.1);
|
|
32
|
+
display: block;
|
|
33
|
+
margin: 0 calc(-1 * var(--ifm-pre-padding));
|
|
34
|
+
padding: 0 var(--ifm-pre-padding);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
[data-theme="dark"] .docusaurus-highlight-code-line {
|
|
38
|
+
background-color: rgba(0, 0, 0, 0.3);
|
|
39
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import Layout from "@theme/Layout";
|
|
4
|
+
import Link from "@docusaurus/Link";
|
|
5
|
+
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
|
|
6
|
+
import styles from "./index.module.css";
|
|
7
|
+
import HomepageFeatures from "@site/src/components/HomepageFeatures";
|
|
8
|
+
|
|
9
|
+
function HomepageHeader() {
|
|
10
|
+
const { siteConfig } = useDocusaurusContext();
|
|
11
|
+
return (
|
|
12
|
+
<header className={clsx("hero", styles.heroBanner)}>
|
|
13
|
+
<div className="container">
|
|
14
|
+
<h1 className="hero__title">{siteConfig.title}</h1>
|
|
15
|
+
<p className="hero__subtitle">{siteConfig.tagline}</p>
|
|
16
|
+
<pre
|
|
17
|
+
className="text--left"
|
|
18
|
+
style={{ width: "300px", margin: "0 auto" }}
|
|
19
|
+
>
|
|
20
|
+
$ npm install deploy.sh -g
|
|
21
|
+
<br />
|
|
22
|
+
$ ls
|
|
23
|
+
<br />
|
|
24
|
+
<b> index.html logo.png </b>
|
|
25
|
+
<br />
|
|
26
|
+
$ deploy
|
|
27
|
+
<br />
|
|
28
|
+
<b> 🚀☁️ </b>
|
|
29
|
+
</pre>
|
|
30
|
+
<br />
|
|
31
|
+
<div className={styles.buttons}>
|
|
32
|
+
<Link
|
|
33
|
+
className="button button--secondary button--lg"
|
|
34
|
+
to="/docs/intro"
|
|
35
|
+
>
|
|
36
|
+
Getting Started
|
|
37
|
+
</Link>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
</header>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export default function Home() {
|
|
45
|
+
const { siteConfig } = useDocusaurusContext();
|
|
46
|
+
return (
|
|
47
|
+
<Layout
|
|
48
|
+
title={`Hello from ${siteConfig.title}`}
|
|
49
|
+
description="Description will go into a meta tag in <head />"
|
|
50
|
+
>
|
|
51
|
+
<HomepageHeader />
|
|
52
|
+
<main>
|
|
53
|
+
<HomepageFeatures />
|
|
54
|
+
</main>
|
|
55
|
+
</Layout>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS files with the .module.css suffix will be treated as CSS modules
|
|
3
|
+
* and scoped locally.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
.heroBanner {
|
|
7
|
+
padding: 4rem 0;
|
|
8
|
+
text-align: center;
|
|
9
|
+
position: relative;
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@media screen and (max-width: 996px) {
|
|
14
|
+
.heroBanner {
|
|
15
|
+
padding: 2rem;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.buttons {
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
}
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/.npmignore
DELETED
package/.travis.yml
DELETED
package/TODO.md
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
- [x] be able to persist data
|
|
2
|
-
- [x] Once there is a way to store metadata, have an in memory store of a proxy routing to deal with subrouting application.
|
|
3
|
-
- [x] be able retrieve logs
|
|
4
|
-
- [x] deal with shutting down
|
|
5
|
-
- [x] deal with cleaning up old images
|
|
6
|
-
- [x] store most recent tars and metadata somewhere to make sure when the service starts back up it will start those sub services also
|
|
7
|
-
- [ ] have a pull command that retrieves the contents of a deployed instance
|
|
8
|
-
- [ ] be able to get container status by querying the container on the get call (add to decorator function)
|
|
9
|
-
- [ ] add timing metrics to cli calls (maybe add just overall function call tracing)
|
|
10
|
-
- [ ] add lamba functionality
|
|
11
|
-
- [ ] add web gui
|
|
12
|
-
- [ ] be able to remove an instance and its data (purge)
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
-
<title>classifier.js - Documentation</title>
|
|
7
|
-
|
|
8
|
-
<script src="scripts/prettify/prettify.js"></script>
|
|
9
|
-
<script src="scripts/prettify/lang-css.js"></script>
|
|
10
|
-
<!--[if lt IE 9]>
|
|
11
|
-
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
12
|
-
<![endif]-->
|
|
13
|
-
<link type="text/css" rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
|
|
14
|
-
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
|
15
|
-
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
|
16
|
-
</head>
|
|
17
|
-
<body>
|
|
18
|
-
|
|
19
|
-
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
|
|
20
|
-
<label for="nav-trigger" class="navicon-button x">
|
|
21
|
-
<div class="navicon"></div>
|
|
22
|
-
</label>
|
|
23
|
-
|
|
24
|
-
<label for="nav-trigger" class="overlay"></label>
|
|
25
|
-
|
|
26
|
-
<nav>
|
|
27
|
-
<li class="nav-link nav-home-link"><a href="index.html">Home</a></li><li class="nav-heading">Classes</li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="module-models_deployment.Deployment.html">Deployment</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="module-models_request-Request.html">Request</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="module-models_user.User.html">User</a></span></li><li class="nav-heading">Modules</li><li class="nav-heading"><span class="nav-item-type type-module">M</span><span class="nav-item-name"><a href="module-lib_classifier.html">lib/classifier</a></span></li><li class="nav-heading"><span class="nav-item-type type-module">M</span><span class="nav-item-name"><a href="module-lib_deploy.html">lib/deploy</a></span></li><li class="nav-heading"><span class="nav-item-type type-module">M</span><span class="nav-item-name"><a href="module-lib_helpers_cli.html">lib/helpers/cli</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-lib_helpers_cli.html#~cacheCredentials">cacheCredentials</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-lib_helpers_cli.html#~createBundle">createBundle</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-lib_helpers_cli.html#~getCredentials">getCredentials</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-lib_helpers_cli.html#~getDeployments">getDeployments</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-lib_helpers_cli.html#~getLogs">getLogs</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-lib_helpers_cli.html#~login">login</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-lib_helpers_cli.html#~logout">logout</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-lib_helpers_cli.html#~register">register</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-lib_helpers_cli.html#~uploadBundle">uploadBundle</a></span></li><li class="nav-heading"><span class="nav-item-type type-module">M</span><span class="nav-item-name"><a href="module-lib_helpers_util.html">lib/helpers/util</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-lib_helpers_util.html#~contains">contains</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-lib_helpers_util.html#~getPort">getPort</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-lib_helpers_util.html#~hash">hash</a></span></li><li class="nav-heading"><span class="nav-item-type type-module">M</span><span class="nav-item-name"><a href="module-models_deployment.html">models/deployment</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-models_deployment.html#~decorate">decorate</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-models_deployment.html#~get">get</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-models_deployment.html#~getAll">getAll</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-models_deployment.html#~proxy">proxy</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-models_deployment.html#~remove">remove</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-models_deployment.html#~start">start</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-models_deployment.html#~stop">stop</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-models_deployment.html#~update">update</a></span></li><li class="nav-heading"><span class="nav-item-type type-module">M</span><span class="nav-item-name"><a href="module-models_request.html">models/request</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-models_request.html#~count">count</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-models_request.html#~log">log</a></span></li><li class="nav-heading"><span class="nav-item-type type-module">M</span><span class="nav-item-name"><a href="module-models_user.html">models/user</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-models_user.html#~authenticate">authenticate</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-models_user.html#~authenticateMiddleware">authenticateMiddleware</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-models_user.html#~get">get</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-models_user.html#~login">login</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-models_user.html#~logout">logout</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-models_user.html#~register">register</a></span></li>
|
|
28
|
-
</nav>
|
|
29
|
-
|
|
30
|
-
<div id="main">
|
|
31
|
-
|
|
32
|
-
<h1 class="page-title">classifier.js</h1>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
<section>
|
|
41
|
-
<article>
|
|
42
|
-
<pre class="prettyprint source linenums"><code>const fs = require('fs');
|
|
43
|
-
const path = require('path');
|
|
44
|
-
|
|
45
|
-
const { contains } = require('./helpers/util');
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* classifies what type of deployment is needed for a certain directory
|
|
49
|
-
* @module lib/classifier
|
|
50
|
-
* @param {String} directory - the directory of which to classify
|
|
51
|
-
* @return {Object} the configuration needed to deploy
|
|
52
|
-
*/
|
|
53
|
-
module.exports = function classifier(directory) {
|
|
54
|
-
const files = fs.readdirSync(directory);
|
|
55
|
-
|
|
56
|
-
if(contains(files, ['Dockerfile'])) {
|
|
57
|
-
let build = fs.readFileSync(path.resolve(directory, 'Dockerfile')).toString('utf8');
|
|
58
|
-
build = build.replace(/\$\{directory\}/, directory);
|
|
59
|
-
|
|
60
|
-
return {
|
|
61
|
-
type: 'docker',
|
|
62
|
-
build
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if(contains(files, ['package.json'])) {
|
|
67
|
-
return {
|
|
68
|
-
type: 'node',
|
|
69
|
-
build: `
|
|
70
|
-
FROM mhart/alpine-node:8
|
|
71
|
-
WORKDIR ${directory}
|
|
72
|
-
ADD . .
|
|
73
|
-
|
|
74
|
-
RUN npm install
|
|
75
|
-
|
|
76
|
-
CMD ["npm", "start"]
|
|
77
|
-
`
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if(contains(files, ['index.html', '!Dockerfile', '!package.json'])) {
|
|
82
|
-
return {
|
|
83
|
-
type: 'static',
|
|
84
|
-
build: `
|
|
85
|
-
FROM mhart/alpine-node:base-8
|
|
86
|
-
WORKDIR ${directory}
|
|
87
|
-
ADD . .
|
|
88
|
-
|
|
89
|
-
CMD ["node", "index.js"]
|
|
90
|
-
`
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
return {
|
|
95
|
-
type: 'unknown'
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
|
-
</code></pre>
|
|
99
|
-
</article>
|
|
100
|
-
</section>
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
</div>
|
|
106
|
-
|
|
107
|
-
<br class="clear">
|
|
108
|
-
|
|
109
|
-
<footer>
|
|
110
|
-
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.4</a> on Mon Aug 14 2017 00:16:03 GMT-0700 (PDT) using the Minami theme.
|
|
111
|
-
</footer>
|
|
112
|
-
|
|
113
|
-
<script>prettyPrint();</script>
|
|
114
|
-
<script src="scripts/linenumber.js"></script>
|
|
115
|
-
</body>
|
|
116
|
-
</html>
|
package/docs/code/deploy.js.html
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
-
<title>deploy.js - Documentation</title>
|
|
7
|
-
|
|
8
|
-
<script src="scripts/prettify/prettify.js"></script>
|
|
9
|
-
<script src="scripts/prettify/lang-css.js"></script>
|
|
10
|
-
<!--[if lt IE 9]>
|
|
11
|
-
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
12
|
-
<![endif]-->
|
|
13
|
-
<link type="text/css" rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
|
|
14
|
-
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
|
15
|
-
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
|
16
|
-
</head>
|
|
17
|
-
<body>
|
|
18
|
-
|
|
19
|
-
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
|
|
20
|
-
<label for="nav-trigger" class="navicon-button x">
|
|
21
|
-
<div class="navicon"></div>
|
|
22
|
-
</label>
|
|
23
|
-
|
|
24
|
-
<label for="nav-trigger" class="overlay"></label>
|
|
25
|
-
|
|
26
|
-
<nav>
|
|
27
|
-
<li class="nav-link nav-home-link"><a href="index.html">Home</a></li><li class="nav-heading">Classes</li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="module-models_deployment.Deployment.html">Deployment</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="module-models_request-Request.html">Request</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="module-models_user.User.html">User</a></span></li><li class="nav-heading">Modules</li><li class="nav-heading"><span class="nav-item-type type-module">M</span><span class="nav-item-name"><a href="module-lib_classifier.html">lib/classifier</a></span></li><li class="nav-heading"><span class="nav-item-type type-module">M</span><span class="nav-item-name"><a href="module-lib_deploy.html">lib/deploy</a></span></li><li class="nav-heading"><span class="nav-item-type type-module">M</span><span class="nav-item-name"><a href="module-lib_helpers_cli.html">lib/helpers/cli</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-lib_helpers_cli.html#~cacheCredentials">cacheCredentials</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-lib_helpers_cli.html#~createBundle">createBundle</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-lib_helpers_cli.html#~getCredentials">getCredentials</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-lib_helpers_cli.html#~getDeployments">getDeployments</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-lib_helpers_cli.html#~getLogs">getLogs</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-lib_helpers_cli.html#~login">login</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-lib_helpers_cli.html#~logout">logout</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-lib_helpers_cli.html#~register">register</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-lib_helpers_cli.html#~uploadBundle">uploadBundle</a></span></li><li class="nav-heading"><span class="nav-item-type type-module">M</span><span class="nav-item-name"><a href="module-lib_helpers_util.html">lib/helpers/util</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-lib_helpers_util.html#~contains">contains</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-lib_helpers_util.html#~getPort">getPort</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-lib_helpers_util.html#~hash">hash</a></span></li><li class="nav-heading"><span class="nav-item-type type-module">M</span><span class="nav-item-name"><a href="module-models_deployment.html">models/deployment</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-models_deployment.html#~decorate">decorate</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-models_deployment.html#~get">get</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-models_deployment.html#~getAll">getAll</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-models_deployment.html#~proxy">proxy</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-models_deployment.html#~remove">remove</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-models_deployment.html#~start">start</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-models_deployment.html#~stop">stop</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-models_deployment.html#~update">update</a></span></li><li class="nav-heading"><span class="nav-item-type type-module">M</span><span class="nav-item-name"><a href="module-models_request.html">models/request</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-models_request.html#~count">count</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-models_request.html#~log">log</a></span></li><li class="nav-heading"><span class="nav-item-type type-module">M</span><span class="nav-item-name"><a href="module-models_user.html">models/user</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-models_user.html#~authenticate">authenticate</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-models_user.html#~authenticateMiddleware">authenticateMiddleware</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-models_user.html#~get">get</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-models_user.html#~login">login</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-models_user.html#~logout">logout</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-models_user.html#~register">register</a></span></li>
|
|
28
|
-
</nav>
|
|
29
|
-
|
|
30
|
-
<div id="main">
|
|
31
|
-
|
|
32
|
-
<h1 class="page-title">deploy.js</h1>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
<section>
|
|
41
|
-
<article>
|
|
42
|
-
<pre class="prettyprint source linenums"><code>const Async = require('async');
|
|
43
|
-
const tar = require('tar');
|
|
44
|
-
const path = require('path');
|
|
45
|
-
const fs = require('fs');
|
|
46
|
-
const mkdirp = require('mkdirp');
|
|
47
|
-
|
|
48
|
-
const classifer = require('./classifier');
|
|
49
|
-
|
|
50
|
-
const { getPort } = require('./helpers/util');
|
|
51
|
-
const { get, build, remove } = require('./models/deployment');
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* handles the deployment of an application tar
|
|
55
|
-
* @module lib/deploy
|
|
56
|
-
* @param {Object} option
|
|
57
|
-
* @param {String} option.name - the name of the the deployment
|
|
58
|
-
* @param {String} option.bundlePath - the directory of which the tar of the application is located
|
|
59
|
-
* @param {String} option.token - token associated with the user that want to deploy the application
|
|
60
|
-
* @param {String} option.username - username of the user the token is associated too
|
|
61
|
-
*/
|
|
62
|
-
module.exports = function deploy({ name, bundlePath, token, username }) {
|
|
63
|
-
return new Promise(function(resolve, reject) {
|
|
64
|
-
get({ username, token, name, create: true })
|
|
65
|
-
.then((deployment) => {
|
|
66
|
-
const outputDir = path.resolve(__dirname, '..', 'tmp', deployment.subdomain);
|
|
67
|
-
mkdirp.sync(outputDir);
|
|
68
|
-
|
|
69
|
-
tar.x({
|
|
70
|
-
file: bundlePath,
|
|
71
|
-
cwd: outputDir
|
|
72
|
-
}).then(() => {
|
|
73
|
-
Async.waterfall([
|
|
74
|
-
(callback) => {
|
|
75
|
-
remove({
|
|
76
|
-
token,
|
|
77
|
-
username,
|
|
78
|
-
name: deployment.subdomain
|
|
79
|
-
})
|
|
80
|
-
.then(() => callback())
|
|
81
|
-
.catch((ex) => callback(ex));
|
|
82
|
-
},
|
|
83
|
-
(callback) => {
|
|
84
|
-
const config = classifer(outputDir);
|
|
85
|
-
if (config.type === 'unknown') {
|
|
86
|
-
callback('deployment not supported', null);
|
|
87
|
-
}
|
|
88
|
-
if (config.type === 'static') {
|
|
89
|
-
fs.writeFileSync(path.resolve(outputDir, 'index.js'), fs.readFileSync(path.resolve(__dirname, 'helpers', 'static-server.js')));
|
|
90
|
-
}
|
|
91
|
-
callback(null, config.build);
|
|
92
|
-
},
|
|
93
|
-
(config, callback) => {
|
|
94
|
-
fs.writeFile(path.resolve(outputDir, 'Dockerfile'), config, callback);
|
|
95
|
-
},
|
|
96
|
-
(callback) => {
|
|
97
|
-
getPort(callback);
|
|
98
|
-
},
|
|
99
|
-
(port, callback) => {
|
|
100
|
-
build({
|
|
101
|
-
name,
|
|
102
|
-
token,
|
|
103
|
-
username,
|
|
104
|
-
subdomain: deployment.subdomain,
|
|
105
|
-
port,
|
|
106
|
-
directory: outputDir
|
|
107
|
-
})
|
|
108
|
-
.then((deployment) => callback(null, deployment))
|
|
109
|
-
.catch((ex) => callback(ex));
|
|
110
|
-
}
|
|
111
|
-
], (err, result) => {
|
|
112
|
-
if (err) return reject(err);
|
|
113
|
-
resolve(result);
|
|
114
|
-
});
|
|
115
|
-
})
|
|
116
|
-
.catch((ex) => reject(ex));
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
};
|
|
120
|
-
</code></pre>
|
|
121
|
-
</article>
|
|
122
|
-
</section>
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
</div>
|
|
128
|
-
|
|
129
|
-
<br class="clear">
|
|
130
|
-
|
|
131
|
-
<footer>
|
|
132
|
-
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.4</a> on Mon Aug 14 2017 00:16:03 GMT-0700 (PDT) using the Minami theme.
|
|
133
|
-
</footer>
|
|
134
|
-
|
|
135
|
-
<script>prettyPrint();</script>
|
|
136
|
-
<script src="scripts/linenumber.js"></script>
|
|
137
|
-
</body>
|
|
138
|
-
</html>
|
|
Binary file
|