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.
Files changed (147) hide show
  1. package/.eslintignore +1 -0
  2. package/.eslintrc +7 -9
  3. package/.github/workflows/ci.yml +48 -0
  4. package/.husky/pre-commit +5 -0
  5. package/{test/fixtures/unknown/.gitkeep → .prettierrc} +0 -0
  6. package/.release-it.json +5 -0
  7. package/CHANGELOG.md +26 -0
  8. package/README.md +5 -6
  9. package/__tests__/fixtures/unknown/.gitkeep +0 -0
  10. package/__tests__/lib/classifier.test.js +49 -0
  11. package/__tests__/lib/helpers/util.test.js +57 -0
  12. package/bin/deploy-delete.js +14 -0
  13. package/bin/deploy-deploy.js +34 -59
  14. package/bin/deploy-list.js +25 -52
  15. package/bin/deploy-login.js +36 -52
  16. package/bin/deploy-logout.js +9 -40
  17. package/bin/deploy-logs.js +22 -48
  18. package/bin/deploy-open.js +14 -37
  19. package/bin/deploy-register.js +37 -50
  20. package/bin/deploy-server.js +8 -5
  21. package/bin/deploy-whoami.js +8 -37
  22. package/bin/deploy.js +145 -19
  23. package/{test/fixtures → examples}/docker/Dockerfile +0 -0
  24. package/examples/docker/index.js +12 -0
  25. package/examples/node/index.js +8 -0
  26. package/{test/fixtures → examples}/node/package.json +0 -0
  27. package/examples/static/index.html +22 -0
  28. package/{test/fixtures → examples}/static/main.css +4 -2
  29. package/examples/static/out.gifcd +0 -0
  30. package/generate-docs.js +55 -0
  31. package/index.js +54 -55
  32. package/jsdoc.json +6 -3
  33. package/lib/classifier.js +24 -17
  34. package/lib/deploy.js +56 -64
  35. package/lib/helpers/cli.js +178 -207
  36. package/lib/helpers/util.js +94 -21
  37. package/lib/models/deployment.js +415 -474
  38. package/lib/models/request.js +77 -66
  39. package/lib/models/user.js +119 -144
  40. package/lib/server.js +187 -97
  41. package/lib/static/not-found.html +30 -0
  42. package/lib/static/page-could-not-load.html +30 -0
  43. package/lib/static/static-server.js +70 -0
  44. package/package.json +47 -34
  45. package/website/README.md +41 -0
  46. package/website/babel.config.js +3 -0
  47. package/website/docs/api/_category_.yml +1 -0
  48. package/website/docs/api/lib/classifier.js.md +11 -0
  49. package/website/docs/api/lib/deploy.js.md +13 -0
  50. package/website/docs/api/lib/helpers/cli.js.md +193 -0
  51. package/website/docs/api/lib/helpers/util.js.md +65 -0
  52. package/website/docs/api/lib/models/deployment.js.md +171 -0
  53. package/website/docs/api/lib/models/request.js.md +67 -0
  54. package/website/docs/api/lib/models/user.js.md +92 -0
  55. package/website/docs/api/lib/server.js.md +0 -0
  56. package/website/docs/api/lib/static/static-server.js.md +0 -0
  57. package/website/docs/intro.md +57 -0
  58. package/website/docusaurus.config.js +82 -0
  59. package/website/package-lock.json +25218 -0
  60. package/website/package.json +39 -0
  61. package/website/sidebars.js +31 -0
  62. package/website/src/components/HomepageFeatures/index.js +79 -0
  63. package/website/src/components/HomepageFeatures/styles.module.css +11 -0
  64. package/website/src/css/custom.css +39 -0
  65. package/website/src/pages/index.js +57 -0
  66. package/website/src/pages/index.module.css +23 -0
  67. package/website/static/.nojekyll +0 -0
  68. package/website/static/example.gif +0 -0
  69. package/website/static/example.mov +0 -0
  70. package/website/static/img/favicon.ico +0 -0
  71. package/website/static/img/intro/deploy.png +0 -0
  72. package/website/static/img/intro/logs.png +0 -0
  73. package/{docs → website/static/img}/logo.png +0 -0
  74. package/{docs → website/static/img}/logo.pxm +0 -0
  75. package/{docs → website/static/img}/logo@2x.png +0 -0
  76. package/.npmignore +0 -9
  77. package/.travis.yml +0 -9
  78. package/TODO.md +0 -12
  79. package/docs/code/classifier.js.html +0 -116
  80. package/docs/code/deploy.js.html +0 -138
  81. package/docs/code/fonts/OpenSans-Bold-webfont.eot +0 -0
  82. package/docs/code/fonts/OpenSans-Bold-webfont.svg +0 -1830
  83. package/docs/code/fonts/OpenSans-Bold-webfont.woff +0 -0
  84. package/docs/code/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
  85. package/docs/code/fonts/OpenSans-BoldItalic-webfont.svg +0 -1830
  86. package/docs/code/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
  87. package/docs/code/fonts/OpenSans-Italic-webfont.eot +0 -0
  88. package/docs/code/fonts/OpenSans-Italic-webfont.svg +0 -1830
  89. package/docs/code/fonts/OpenSans-Italic-webfont.woff +0 -0
  90. package/docs/code/fonts/OpenSans-Light-webfont.eot +0 -0
  91. package/docs/code/fonts/OpenSans-Light-webfont.svg +0 -1831
  92. package/docs/code/fonts/OpenSans-Light-webfont.woff +0 -0
  93. package/docs/code/fonts/OpenSans-LightItalic-webfont.eot +0 -0
  94. package/docs/code/fonts/OpenSans-LightItalic-webfont.svg +0 -1835
  95. package/docs/code/fonts/OpenSans-LightItalic-webfont.woff +0 -0
  96. package/docs/code/fonts/OpenSans-Regular-webfont.eot +0 -0
  97. package/docs/code/fonts/OpenSans-Regular-webfont.svg +0 -1831
  98. package/docs/code/fonts/OpenSans-Regular-webfont.woff +0 -0
  99. package/docs/code/fonts/OpenSans-Semibold-webfont.eot +0 -0
  100. package/docs/code/fonts/OpenSans-Semibold-webfont.svg +0 -1830
  101. package/docs/code/fonts/OpenSans-Semibold-webfont.ttf +0 -0
  102. package/docs/code/fonts/OpenSans-Semibold-webfont.woff +0 -0
  103. package/docs/code/fonts/OpenSans-SemiboldItalic-webfont.eot +0 -0
  104. package/docs/code/fonts/OpenSans-SemiboldItalic-webfont.svg +0 -1830
  105. package/docs/code/fonts/OpenSans-SemiboldItalic-webfont.ttf +0 -0
  106. package/docs/code/fonts/OpenSans-SemiboldItalic-webfont.woff +0 -0
  107. package/docs/code/global.html +0 -325
  108. package/docs/code/helpers_cli.js.html +0 -351
  109. package/docs/code/helpers_util.js.html +0 -127
  110. package/docs/code/index.html +0 -81
  111. package/docs/code/models_deployment.js.html +0 -593
  112. package/docs/code/models_request.js.html +0 -150
  113. package/docs/code/models_user.js.html +0 -232
  114. package/docs/code/module-lib_classifier.html +0 -246
  115. package/docs/code/module-lib_deploy.html +0 -350
  116. package/docs/code/module-lib_helpers_cli.html +0 -2067
  117. package/docs/code/module-lib_helpers_util.html +0 -608
  118. package/docs/code/module-models_deployment-Deployment.html +0 -359
  119. package/docs/code/module-models_deployment-DeploymentSchema.html +0 -359
  120. package/docs/code/module-models_deployment.Deployment.html +0 -359
  121. package/docs/code/module-models_deployment.html +0 -1851
  122. package/docs/code/module-models_request-Request.html +0 -409
  123. package/docs/code/module-models_request-RequestSchema.html +0 -359
  124. package/docs/code/module-models_request.html +0 -446
  125. package/docs/code/module-models_user-User.html +0 -306
  126. package/docs/code/module-models_user-UserSchema.html +0 -306
  127. package/docs/code/module-models_user.User.html +0 -306
  128. package/docs/code/module-models_user.html +0 -1200
  129. package/docs/code/scripts/linenumber.js +0 -25
  130. package/docs/code/scripts/prettify/Apache-License-2.0.txt +0 -202
  131. package/docs/code/scripts/prettify/lang-css.js +0 -2
  132. package/docs/code/scripts/prettify/prettify.js +0 -28
  133. package/docs/code/styles/jsdoc-default.css +0 -692
  134. package/docs/code/styles/prettify-jsdoc.css +0 -111
  135. package/docs/code/styles/prettify-tomorrow.css +0 -132
  136. package/docs/example-docker.gif +0 -0
  137. package/docs/example-node.gif +0 -0
  138. package/docs/example-static.gif +0 -0
  139. package/docs/index.html +0 -50
  140. package/docs/main.css +0 -12
  141. package/docs/psychic-min.css +0 -1
  142. package/lib/helpers/static-server.js +0 -69
  143. package/test/fixtures/docker/index.js +0 -12
  144. package/test/fixtures/node/index.js +0 -8
  145. package/test/fixtures/static/index.html +0 -14
  146. package/test/lib/classifier.js +0 -51
  147. package/test/lib/helpers/util.js +0 -30
@@ -0,0 +1,193 @@
1
+ <a name="CLI"></a>
2
+
3
+ ## CLI
4
+
5
+ **Kind**: global class
6
+
7
+ - [CLI](#CLI)
8
+ - [new CLI(options)](#new_CLI_new)
9
+ - [.createBundle(directory)](#CLI.createBundle) ⇒ <code>Promise</code>
10
+ - [.removeBundle(directory)](#CLI.removeBundle) ⇒ <code>Promise</code>
11
+ - [.uploadBundle(options)](#CLI.uploadBundle) ⇒ <code>Promise</code>
12
+ - [.login(options)](#CLI.login) ⇒ <code>Promise</code>
13
+ - [.register(options)](#CLI.register) ⇒ <code>Promise</code>
14
+ - [.logout(options)](#CLI.logout) ⇒ <code>Promise</code>
15
+ - [.getLogs(options)](#CLI.getLogs) ⇒ <code>Promise</code>
16
+ - [.getDeployments(options)](#CLI.getDeployments) ⇒ <code>Promise</code>
17
+ - [.deleteDeployment(options)](#CLI.deleteDeployment) ⇒ <code>Promise</code>
18
+ - [.getUserDetails()](#CLI.getUserDetails) ⇒ <code>Promise</code>
19
+ - [.cacheCredentials(options)](#CLI.cacheCredentials) ⇒ <code>Promise</code>
20
+ - [.getCredentials()](#CLI.getCredentials) ⇒ <code>Promise</code>
21
+
22
+ <a name="new_CLI_new"></a>
23
+
24
+ ### new CLI(options)
25
+
26
+ the cli instance that holds all options and methods to talk to the deploy.sh service
27
+
28
+ | Param | Type | Description |
29
+ | ------------------- | ------------------- | -------------------------------------------------------------------------------------------- |
30
+ | options | <code>Object</code> | contains defaults and overrides |
31
+ | options.url | <code>String</code> | the url of the remote deploy.sh service |
32
+ | options.application | <code>String</code> | the deployed application name to alter |
33
+ | options.mongo | <code>String</code> | the mongo connection string used by deploy.sh service when running `deploy serve --mongo ''` |
34
+
35
+ <a name="CLI.createBundle"></a>
36
+
37
+ ### CLI.createBundle(directory) ⇒ <code>Promise</code>
38
+
39
+ creates a bundle to send to the server for deployment
40
+
41
+ **Kind**: static method of [<code>CLI</code>](#CLI)
42
+
43
+ | Param | Type | Description |
44
+ | --------- | ------------------- | --------------------------------------------- |
45
+ | directory | <code>String</code> | the directory that is to be turned into a tar |
46
+
47
+ <a name="CLI.removeBundle"></a>
48
+
49
+ ### CLI.removeBundle(directory) ⇒ <code>Promise</code>
50
+
51
+ removes the bundle from the given directory
52
+
53
+ **Kind**: static method of [<code>CLI</code>](#CLI)
54
+
55
+ | Param | Type | Description |
56
+ | --------- | ------------------- | ----------------- |
57
+ | directory | <code>String</code> | path to directory |
58
+
59
+ <a name="CLI.uploadBundle"></a>
60
+
61
+ ### CLI.uploadBundle(options) ⇒ <code>Promise</code>
62
+
63
+ Deals with uploading a specified bundle
64
+
65
+ **Kind**: static method of [<code>CLI</code>](#CLI)
66
+
67
+ | Param | Type | Description |
68
+ | -------------- | ------------------- | ------------------------------------- |
69
+ | options | <code>Object</code> | |
70
+ | options.name | <code>String</code> | the name of the specified application |
71
+ | options.bundle | <code>Stream</code> | a file stream of the tar |
72
+
73
+ <a name="CLI.login"></a>
74
+
75
+ ### CLI.login(options) ⇒ <code>Promise</code>
76
+
77
+ calls the login api to get a token to persist for future requests
78
+
79
+ **Kind**: static method of [<code>CLI</code>](#CLI)
80
+
81
+ | Param | Type | Description |
82
+ | ---------------- | ------------------- | ------------------------------------ |
83
+ | options | <code>Object</code> | |
84
+ | options.username | <code>String</code> | username of the account |
85
+ | options.password | <code>String</code> | password associated with the account |
86
+
87
+ <a name="CLI.register"></a>
88
+
89
+ ### CLI.register(options) ⇒ <code>Promise</code>
90
+
91
+ prompts the user to register account
92
+
93
+ **Kind**: static method of [<code>CLI</code>](#CLI)
94
+
95
+ | Param | Type | Description |
96
+ | ---------------- | ------------------- | ------------------------------------ |
97
+ | options | <code>Object</code> | |
98
+ | options.username | <code>String</code> | username of the account |
99
+ | options.password | <code>String</code> | password associated with the account |
100
+
101
+ <a name="CLI.logout"></a>
102
+
103
+ ### CLI.logout(options) ⇒ <code>Promise</code>
104
+
105
+ calls the logout api to invalidate token
106
+
107
+ **Kind**: static method of [<code>CLI</code>](#CLI)
108
+
109
+ | Param | Type | Description |
110
+ | ---------------- | ------------------- | --------------------------------- |
111
+ | options | <code>Object</code> | |
112
+ | options.token | <code>String</code> | token to make authenticated calls |
113
+ | options.username | <code>String</code> | username linked to the token |
114
+
115
+ <a name="CLI.getLogs"></a>
116
+
117
+ ### CLI.getLogs(options) ⇒ <code>Promise</code>
118
+
119
+ gets the application logs
120
+
121
+ **Kind**: static method of [<code>CLI</code>](#CLI)
122
+
123
+ | Param | Type | Description |
124
+ | ---------------- | ------------------- | --------------------------------- |
125
+ | options | <code>Object</code> | |
126
+ | options.token | <code>String</code> | token to make authenticated calls |
127
+ | options.username | <code>String</code> | username linked to the token |
128
+ | options.name | <code>String</code> | name of the deployment |
129
+
130
+ <a name="CLI.getDeployments"></a>
131
+
132
+ ### CLI.getDeployments(options) ⇒ <code>Promise</code>
133
+
134
+ gets the user's deployed applications
135
+
136
+ **Kind**: static method of [<code>CLI</code>](#CLI)
137
+
138
+ | Param | Type | Description |
139
+ | ---------------- | ------------------- | --------------------------------- |
140
+ | options | <code>Object</code> | |
141
+ | options.token | <code>String</code> | token to make authenticated calls |
142
+ | options.username | <code>String</code> | username linked to the token |
143
+ | [options.name] | <code>String</code> | name of the deployment |
144
+
145
+ <a name="CLI.deleteDeployment"></a>
146
+
147
+ ### CLI.deleteDeployment(options) ⇒ <code>Promise</code>
148
+
149
+ deletes the specified deployment
150
+
151
+ **Kind**: static method of [<code>CLI</code>](#CLI)
152
+
153
+ | Param | Type | Description |
154
+ | ---------------- | ------------------- | --------------------------------- |
155
+ | options | <code>Object</code> | |
156
+ | options.token | <code>String</code> | token to make authenticated calls |
157
+ | options.username | <code>String</code> | username linked to the token |
158
+ | options.name | <code>String</code> | name of the deployment |
159
+
160
+ <a name="CLI.getUserDetails"></a>
161
+
162
+ ### CLI.getUserDetails() ⇒ <code>Promise</code>
163
+
164
+ gets the user details
165
+
166
+ **Kind**: static method of [<code>CLI</code>](#CLI)
167
+
168
+ | Param | Type | Description |
169
+ | ---------------- | ------------------- | --------------------------------- |
170
+ | options.token | <code>String</code> | token to make authenticated calls |
171
+ | options.username | <code>String</code> | username linked to the token |
172
+
173
+ <a name="CLI.cacheCredentials"></a>
174
+
175
+ ### CLI.cacheCredentials(options) ⇒ <code>Promise</code>
176
+
177
+ persists the token and username locally
178
+
179
+ **Kind**: static method of [<code>CLI</code>](#CLI)
180
+
181
+ | Param | Type | Description |
182
+ | ---------------- | ------------------- | --------------------------------- |
183
+ | options | <code>Object</code> | |
184
+ | options.token | <code>String</code> | token to make authenticated calls |
185
+ | options.username | <code>String</code> | username linked to the token |
186
+
187
+ <a name="CLI.getCredentials"></a>
188
+
189
+ ### CLI.getCredentials() ⇒ <code>Promise</code>
190
+
191
+ gets the token and username that were persisted locally
192
+
193
+ **Kind**: static method of [<code>CLI</code>](#CLI)
@@ -0,0 +1,65 @@
1
+ <a name="module_lib/helpers/util"></a>
2
+
3
+ ## lib/helpers/util
4
+
5
+ - [lib/helpers/util](#module_lib/helpers/util)
6
+ - _static_
7
+ - [.mk](#module_lib/helpers/util.mk) ⇒ <code>Promise</code>
8
+ - _inner_
9
+ - [~getPort()](#module_lib/helpers/util..getPort) ⇒ <code>Promise</code>
10
+ - [~hash(length)](#module_lib/helpers/util..hash) ⇒ <code>String</code>
11
+ - [~contains(arr, contains)](#module_lib/helpers/util..contains) ⇒ <code>Boolean</code>
12
+
13
+ <a name="module_lib/helpers/util.mk"></a>
14
+
15
+ ### lib/helpers/util.mk ⇒ <code>Promise</code>
16
+
17
+ makes a directory recursively
18
+
19
+ **Kind**: static constant of [<code>lib/helpers/util</code>](#module_lib/helpers/util)
20
+
21
+ | Param | Type | Description |
22
+ | --------- | ------------------- | ------------------------ |
23
+ | directory | <code>String</code> | path to future directory |
24
+
25
+ <a name="module_lib/helpers/util..getPort"></a>
26
+
27
+ ### lib/helpers/util~getPort() ⇒ <code>Promise</code>
28
+
29
+ gets an open port
30
+
31
+ **Kind**: inner method of [<code>lib/helpers/util</code>](#module_lib/helpers/util)
32
+ <a name="module_lib/helpers/util..hash"></a>
33
+
34
+ ### lib/helpers/util~hash(length) ⇒ <code>String</code>
35
+
36
+ gets a lowercase random string with specified length
37
+
38
+ **Kind**: inner method of [<code>lib/helpers/util</code>](#module_lib/helpers/util)
39
+
40
+ | Param | Type | Description |
41
+ | ------ | ------------------- | ----------------------------------------- |
42
+ | length | <code>Number</code> | the specified length of the random string |
43
+
44
+ <a name="module_lib/helpers/util..contains"></a>
45
+
46
+ ### lib/helpers/util~contains(arr, contains) ⇒ <code>Boolean</code>
47
+
48
+ contains is a function that takes an array and see if the condition matches
49
+
50
+ **Kind**: inner method of [<code>lib/helpers/util</code>](#module_lib/helpers/util)
51
+ **Returns**: <code>Boolean</code> - - responds back with a boolean value
52
+
53
+ | Param | Type | Description |
54
+ | -------- | ------------------ | ------------------------------------------------- |
55
+ | arr | <code>Array</code> | array to check with rules |
56
+ | contains | <code>Array</code> | rules to make sure the arr contains the following |
57
+
58
+ **Example**
59
+
60
+ ```js
61
+ contains(
62
+ ["index.html", "main.css"],
63
+ ["index.html", "!Dockerfile", "!package.json"]
64
+ );
65
+ ```
@@ -0,0 +1,171 @@
1
+ <a name="Deployment"></a>
2
+
3
+ ## Deployment
4
+
5
+ **Kind**: global class
6
+ **Properties**
7
+
8
+ | Name | Type | Description |
9
+ | --------- | ------------------- | --------------------------------------- |
10
+ | id | <code>String</code> | the container id |
11
+ | name | <code>String</code> | the name of the deployment |
12
+ | port | <code>Number</code> | the port that the container has exposed |
13
+ | subdomain | <code>String</code> | the subdomain of the application |
14
+ | directory | <code>String</code> | the directory of tared application |
15
+ | username | <code>String</code> | the username who owns the deployment |
16
+
17
+ - [Deployment](#Deployment)
18
+ - [new Deployment()](#new_Deployment_new)
19
+ - [.update(options)](#Deployment.update) ⇒ <code>Promise</code>
20
+ - [.del(name)](#Deployment.del) ⇒ <code>Promise</code>
21
+ - [.proxy(subdomain)](#Deployment.proxy) ⇒ <code>Promise</code>
22
+ - [.decorate(deployment)](#Deployment.decorate) ⇒ <code>Promise</code>
23
+ - [.get(options)](#Deployment.get) ⇒ <code>Promise</code>
24
+ - [.getAll()](#Deployment.getAll) ⇒ <code>Promise</code>
25
+ - [.start([name])](#Deployment.start) ⇒ <code>Promise</code>
26
+ - [.stop([name])](#Deployment.stop) ⇒ <code>Promise</code>
27
+ - [.logs(name, token, username)](#Deployment.logs) ⇒ <code>Promise</code>
28
+ - [.remove(name)](#Deployment.remove) ⇒ <code>Promise</code>
29
+
30
+ <a name="new_Deployment_new"></a>
31
+
32
+ ### new Deployment()
33
+
34
+ Deployment definition
35
+
36
+ <a name="Deployment.update"></a>
37
+
38
+ ### Deployment.update(options) ⇒ <code>Promise</code>
39
+
40
+ updates a deployment
41
+
42
+ **Kind**: static method of [<code>Deployment</code>](#Deployment)
43
+
44
+ | Param | Type | Description |
45
+ | ---------------- | ------------------- | -------------------------------------------- |
46
+ | options | <code>Object</code> | |
47
+ | options.name | <code>String</code> | the name of the deployment |
48
+ | options.username | <code>String</code> | the username associated with this deployment |
49
+
50
+ <a name="Deployment.del"></a>
51
+
52
+ ### Deployment.del(name) ⇒ <code>Promise</code>
53
+
54
+ deletes the specified deployment from the user
55
+
56
+ **Kind**: static method of [<code>Deployment</code>](#Deployment)
57
+
58
+ | Param | Type | Description |
59
+ | ---------------- | ------------------- | ---------------------------------------------- |
60
+ | name | <code>String</code> | the name of the deployment |
61
+ | options.token | <code>String</code> | the token for the user who owns the deployment |
62
+ | options.username | <code>String</code> | the username associated with this deployment |
63
+
64
+ <a name="Deployment.proxy"></a>
65
+
66
+ ### Deployment.proxy(subdomain) ⇒ <code>Promise</code>
67
+
68
+ express middleware to proxy to correct container
69
+
70
+ **Kind**: static method of [<code>Deployment</code>](#Deployment)
71
+
72
+ | Param | Type | Description |
73
+ | --------- | ------------------- | ------------------------------------------------- |
74
+ | subdomain | <code>String</code> | the subdomain for the application being requested |
75
+
76
+ <a name="Deployment.decorate"></a>
77
+
78
+ ### Deployment.decorate(deployment) ⇒ <code>Promise</code>
79
+
80
+ decorates a deployment with the correct data on get
81
+
82
+ **Kind**: static method of [<code>Deployment</code>](#Deployment)
83
+
84
+ | Param | Type | Description |
85
+ | ---------- | -------------------------------------- | --------------------- |
86
+ | deployment | [<code>Deployment</code>](#Deployment) | a deployment instance |
87
+
88
+ <a name="Deployment.get"></a>
89
+
90
+ ### Deployment.get(options) ⇒ <code>Promise</code>
91
+
92
+ gets a specific deployment for the specified user
93
+
94
+ **Kind**: static method of [<code>Deployment</code>](#Deployment)
95
+
96
+ | Param | Type | Description |
97
+ | ---------------- | -------------------- | ---------------------------------------------- |
98
+ | options | <code>Object</code> | |
99
+ | options.name | <code>String</code> | the name of the deployment |
100
+ | options.token | <code>String</code> | the token for the user who owns the deployment |
101
+ | options.username | <code>String</code> | the username associated with this deployment |
102
+ | option.create | <code>Boolean</code> | create a deployment if not found |
103
+
104
+ <a name="Deployment.getAll"></a>
105
+
106
+ ### Deployment.getAll() ⇒ <code>Promise</code>
107
+
108
+ gets all deployments for the specified user
109
+
110
+ **Kind**: static method of [<code>Deployment</code>](#Deployment)
111
+
112
+ | Param | Type | Description |
113
+ | ---------------- | ------------------- | ---------------------------------------------- |
114
+ | options.token | <code>String</code> | the token for the user who owns the deployment |
115
+ | options.username | <code>String</code> | the username associated with this deployment |
116
+
117
+ <a name="Deployment.start"></a>
118
+
119
+ ### Deployment.start([name]) ⇒ <code>Promise</code>
120
+
121
+ starts a container or all containers
122
+
123
+ **Kind**: static method of [<code>Deployment</code>](#Deployment)
124
+
125
+ | Param | Type | Description |
126
+ | ---------------- | ------------------- | ------------------------------------------------------- |
127
+ | [name] | <code>String</code> | to start a specific container a name property is needed |
128
+ | options.token | <code>String</code> | the token for the user who owns the deployment |
129
+ | options.username | <code>String</code> | the username associated with this deployment |
130
+
131
+ <a name="Deployment.stop"></a>
132
+
133
+ ### Deployment.stop([name]) ⇒ <code>Promise</code>
134
+
135
+ stops a container or all containers
136
+
137
+ **Kind**: static method of [<code>Deployment</code>](#Deployment)
138
+
139
+ | Param | Type | Description |
140
+ | ------------------ | ------------------- | ------------------------------------------------------ |
141
+ | [name] | <code>String</code> | to stop a specific container a name property is needed |
142
+ | [options.token] | <code>String</code> | the token for the user who owns the deployment |
143
+ | [options.username] | <code>String</code> | the username associated with this deployment |
144
+
145
+ <a name="Deployment.logs"></a>
146
+
147
+ ### Deployment.logs(name, token, username) ⇒ <code>Promise</code>
148
+
149
+ retrieves from a given instance
150
+
151
+ **Kind**: static method of [<code>Deployment</code>](#Deployment)
152
+
153
+ | Param | Type | Description |
154
+ | -------- | ------------------- | ---------------------------------------------- |
155
+ | name | <code>String</code> | instance name |
156
+ | token | <code>String</code> | the token for the user who owns the deployment |
157
+ | username | <code>String</code> | the username associated with this deployment |
158
+
159
+ <a name="Deployment.remove"></a>
160
+
161
+ ### Deployment.remove(name) ⇒ <code>Promise</code>
162
+
163
+ removes a specific container, will stop and cleanup all necessary files
164
+
165
+ **Kind**: static method of [<code>Deployment</code>](#Deployment)
166
+
167
+ | Param | Type | Description |
168
+ | ---------------- | ------------------- | ---------------------------------------------- |
169
+ | name | <code>String</code> | the name of the container |
170
+ | options.token | <code>String</code> | the token for the user who owns the deployment |
171
+ | options.username | <code>String</code> | the username associated with this deployment |
@@ -0,0 +1,67 @@
1
+ <a name="Request"></a>
2
+
3
+ ## Request
4
+
5
+ **Kind**: global class
6
+ **Properties**
7
+
8
+ | Name | Type | Description |
9
+ | -------------- | ------------------- | ------------------------------------------------------------- |
10
+ | subdomain | <code>String</code> | the subdomain of the request |
11
+ | url | <code>String</code> | the url that was being accessed |
12
+ | time | <code>Number</code> | the time it took to access the resource |
13
+ | method | <code>String</code> | the http verb that describes the request |
14
+ | statusCode | <code>String</code> | the statusCode associated with the request |
15
+ | userAgent | <code>String</code> | the userAgent that access the resource |
16
+ | referer | <code>String</code> | the referer that the user was at before accessing the address |
17
+ | acceptLanguage | <code>String</code> | browser based language preferences |
18
+
19
+ - [Request](#Request)
20
+ - [new Request()](#new_Request_new)
21
+ - [.log(req, res, next)](#Request.log)
22
+ - [.count(subdomain)](#Request.count) ⇒ <code>Promise</code>
23
+ - [.del(subdomain)](#Request.del) ⇒ <code>Promise</code>
24
+
25
+ <a name="new_Request_new"></a>
26
+
27
+ ### new Request()
28
+
29
+ Request definition
30
+
31
+ <a name="Request.log"></a>
32
+
33
+ ### Request.log(req, res, next)
34
+
35
+ express middleware that logs requests
36
+
37
+ **Kind**: static method of [<code>Request</code>](#Request)
38
+
39
+ | Param | Type | Description |
40
+ | ----- | --------------------- | ----------------------- |
41
+ | req | <code>Object</code> | express request object |
42
+ | res | <code>Object</code> | express response object |
43
+ | next | <code>function</code> | callback function |
44
+
45
+ <a name="Request.count"></a>
46
+
47
+ ### Request.count(subdomain) ⇒ <code>Promise</code>
48
+
49
+ returns the amount of requests for the specified subdomain
50
+
51
+ **Kind**: static method of [<code>Request</code>](#Request)
52
+
53
+ | Param | Type | Description |
54
+ | --------- | ------------------- | ------------------------------------------------------- |
55
+ | subdomain | <code>string</code> | the subdomain of which to get the count of requests for |
56
+
57
+ <a name="Request.del"></a>
58
+
59
+ ### Request.del(subdomain) ⇒ <code>Promise</code>
60
+
61
+ removes all entries associated with a particular subdomain
62
+
63
+ **Kind**: static method of [<code>Request</code>](#Request)
64
+
65
+ | Param | Type | Description |
66
+ | --------- | ------------------- | --------------------------------------------- |
67
+ | subdomain | <code>String</code> | the subdomain that the entries are related to |
@@ -0,0 +1,92 @@
1
+ <a name="User"></a>
2
+
3
+ ## User
4
+
5
+ **Kind**: global class
6
+ **Properties**
7
+
8
+ | Name | Type | Description |
9
+ | -------- | ------------------- | ----------------------------------------- |
10
+ | username | <code>String</code> | a string that defines the user's accounts |
11
+ | password | <code>String</code> | a password for the user |
12
+ | [token] | <code>String</code> | an access token |
13
+
14
+ - [User](#User)
15
+ - [new User()](#new_User_new)
16
+ - [.authenticateMiddleware(req, res, next)](#User.authenticateMiddleware)
17
+ - [.authenticate(token, username)](#User.authenticate) ⇒ <code>Promise</code>
18
+ - [.logout(token, username)](#User.logout) ⇒ <code>Promise</code>
19
+ - [.login(username, password)](#User.login) ⇒ <code>Promise</code>
20
+ - [.register(username, password)](#User.register) ⇒ <code>Promise</code>
21
+
22
+ <a name="new_User_new"></a>
23
+
24
+ ### new User()
25
+
26
+ User definition
27
+
28
+ <a name="User.authenticateMiddleware"></a>
29
+
30
+ ### User.authenticateMiddleware(req, res, next)
31
+
32
+ middleware to verify the username and token are valid, will then set the user to req.user
33
+
34
+ **Kind**: static method of [<code>User</code>](#User)
35
+
36
+ | Param | Type | Description |
37
+ | ----- | --------------------- | --------------------------------- |
38
+ | req | <code>Object</code> | express request |
39
+ | res | <code>Object</code> | express response |
40
+ | next | <code>function</code> | callback to go to next middleware |
41
+
42
+ <a name="User.authenticate"></a>
43
+
44
+ ### User.authenticate(token, username) ⇒ <code>Promise</code>
45
+
46
+ verify the username and token are valid
47
+
48
+ **Kind**: static method of [<code>User</code>](#User)
49
+
50
+ | Param | Type | Description |
51
+ | -------- | ------------------- | -------------------------------------- |
52
+ | token | <code>String</code> | the token associated with the username |
53
+ | username | <code>String</code> | the username of the user |
54
+
55
+ <a name="User.logout"></a>
56
+
57
+ ### User.logout(token, username) ⇒ <code>Promise</code>
58
+
59
+ logs out a user by deleting their token
60
+
61
+ **Kind**: static method of [<code>User</code>](#User)
62
+
63
+ | Param | Type | Description |
64
+ | -------- | ------------------- | -------------------------------------- |
65
+ | token | <code>String</code> | the token associated with the username |
66
+ | username | <code>String</code> | the username of the user |
67
+
68
+ <a name="User.login"></a>
69
+
70
+ ### User.login(username, password) ⇒ <code>Promise</code>
71
+
72
+ logs in a user and returns
73
+
74
+ **Kind**: static method of [<code>User</code>](#User)
75
+
76
+ | Param | Type | Description |
77
+ | -------- | ------------------- | ------------------------------------------ |
78
+ | username | <code>String</code> | the username of the user who is logging in |
79
+ | password | <code>String</code> | the password associated with the user |
80
+
81
+ <a name="User.register"></a>
82
+
83
+ ### User.register(username, password) ⇒ <code>Promise</code>
84
+
85
+ registers a user
86
+
87
+ **Kind**: static method of [<code>User</code>](#User)
88
+
89
+ | Param | Type | Description |
90
+ | -------- | ------------------- | ------------------------------------------ |
91
+ | username | <code>String</code> | the username of the user who is logging in |
92
+ | password | <code>String</code> | the password associated with the user |
File without changes
@@ -0,0 +1,57 @@
1
+ ---
2
+ sidebar_position: 1
3
+ title: "Intro"
4
+ ---
5
+
6
+ ## Getting Started
7
+
8
+ Firstly we must install `deploy.sh`.
9
+
10
+ ```bash
11
+ npm install deploy.sh -g
12
+ ```
13
+
14
+ ### What you'll need
15
+
16
+ - [Node.js](https://nodejs.org/en/download/) version 14 or above:
17
+ - When installing Node.js, you are recommended to check all checkboxes related to dependencies.
18
+ - [Docker](https://docs.docker.com/get-docker/) is how deploy.sh runs and is required to start new applications
19
+ - [Mongo](https://docs.mongodb.com/manual/administration/install-community/) is required to store application state and logs
20
+
21
+ ## Starting deploy.sh server
22
+
23
+ In order to deploy your applications you will need to spin up a deploy.sh server
24
+
25
+ ```bash
26
+ deploy server
27
+ ```
28
+
29
+ ```bash
30
+ % deploy serve
31
+ ✔ Started 0 deployment(s) successfully
32
+ ⛅️ deploy.sh is running on port 5000
33
+ ```
34
+
35
+ ## Start your site
36
+
37
+ In order to do anything you must first go through the registration process by running:
38
+
39
+ ```
40
+ deploy register
41
+ ```
42
+
43
+ For this example I am going to use the folder in `examples/docker` in <https://github.com/gabrielcsapo/deploy.sh>.
44
+
45
+ ```bash
46
+ deploy
47
+ ```
48
+
49
+ ![../static/img/intro/deploy.png](../static/img/intro/deploy.png)
50
+
51
+ To look at the logs from the docker container itself, simply run `deploy logs`
52
+
53
+ ```bash
54
+ deploy logs
55
+ ```
56
+
57
+ ![../static/img/intro/logs.png](../static/img/intro/logs.png)