@toa.io/operations 0.20.0-dev.3 → 0.20.0-dev.30
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/package.json +6 -5
- package/readme.md +14 -2
- package/src/deployment/.deployment/describe.js +2 -0
- package/src/deployment/chart/templates/compositions.yaml +4 -0
- package/src/deployment/chart/values.yaml +1 -0
- package/src/deployment/images/composition.Dockerfile +8 -7
- package/src/deployment/images/service.Dockerfile +7 -5
- package/types/_deployment/dependency.d.ts +72 -0
- package/types/deployment/dependency.d.ts +30 -66
- package/types/deployment/index.d.ts +1 -0
- package/types/index.d.ts +1 -0
- /package/types/{deployment → _deployment}/composition.d.ts +0 -0
- /package/types/{deployment → _deployment}/deployment.d.ts +0 -0
- /package/types/{deployment → _deployment}/factory.d.ts +0 -0
- /package/types/{deployment → _deployment}/images/factory.d.ts +0 -0
- /package/types/{deployment → _deployment}/images/image.d.ts +0 -0
- /package/types/{deployment → _deployment}/images/registry.d.ts +0 -0
- /package/types/{deployment → _deployment}/operator.d.ts +0 -0
- /package/types/{deployment → _deployment}/registry.d.ts +0 -0
- /package/types/{deployment → _deployment}/service.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/operations",
|
|
3
|
-
"version": "0.20.0-dev.
|
|
3
|
+
"version": "0.20.0-dev.30",
|
|
4
4
|
"description": "Toa Deployment",
|
|
5
5
|
"homepage": "https://toa.io",
|
|
6
6
|
"author": {
|
|
@@ -22,14 +22,15 @@
|
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"main": "src/index.js",
|
|
25
|
+
"types": "types/index.d.ts",
|
|
25
26
|
"scripts": {
|
|
26
27
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
27
28
|
},
|
|
28
29
|
"dependencies": {
|
|
29
|
-
"@toa.io/filesystem": "0.20.0-dev.
|
|
30
|
-
"@toa.io/generic": "0.20.0-dev.
|
|
31
|
-
"@toa.io/yaml": "0.20.0-dev.
|
|
30
|
+
"@toa.io/filesystem": "0.20.0-dev.30",
|
|
31
|
+
"@toa.io/generic": "0.20.0-dev.30",
|
|
32
|
+
"@toa.io/yaml": "0.20.0-dev.30",
|
|
32
33
|
"execa": "5.1.1"
|
|
33
34
|
},
|
|
34
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "61c8e74a336385265767e9fd37d49128cb51b17f"
|
|
35
36
|
}
|
package/readme.md
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
registry:
|
|
13
13
|
build:
|
|
14
|
-
arguments: [
|
|
15
|
-
run:
|
|
14
|
+
arguments: [GITHUB_TOKEN]
|
|
15
|
+
run: npm config set //npm.pkg.github.com/:_authToken ${GITHUB_TOKEN}
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
`arguments` is a list of environemt varialbes to be passed to `docker build`.
|
|
@@ -28,3 +28,15 @@ registry:
|
|
|
28
28
|
echo test > .test
|
|
29
29
|
rm .test
|
|
30
30
|
```
|
|
31
|
+
|
|
32
|
+
#### Registry Credentials
|
|
33
|
+
|
|
34
|
+
When using private container registry,
|
|
35
|
+
a secret containing required credentials can be specified using `registry.credentials` option.
|
|
36
|
+
|
|
37
|
+
```yaml
|
|
38
|
+
# context.toa.yaml
|
|
39
|
+
|
|
40
|
+
registry:
|
|
41
|
+
credentials: docker-credentials-secret-name
|
|
42
|
+
```
|
|
@@ -14,6 +14,7 @@ const describe = (context, compositions, dependency) => {
|
|
|
14
14
|
const components = get.components(compositions)
|
|
15
15
|
const dependencies = get.dependencies(references)
|
|
16
16
|
const variables = get.variables(context, dependency.variables)
|
|
17
|
+
const credentials = context.registry?.credentials
|
|
17
18
|
|
|
18
19
|
return {
|
|
19
20
|
compositions,
|
|
@@ -21,6 +22,7 @@ const describe = (context, compositions, dependency) => {
|
|
|
21
22
|
services,
|
|
22
23
|
proxies,
|
|
23
24
|
variables,
|
|
25
|
+
credentials,
|
|
24
26
|
...dependencies
|
|
25
27
|
}
|
|
26
28
|
}
|
|
@@ -3,16 +3,17 @@ FROM node:18.16.0-alpine3.17
|
|
|
3
3
|
{{build.arguments}}
|
|
4
4
|
|
|
5
5
|
ENV NODE_ENV=production
|
|
6
|
-
RUN if [ {{runtime.registry}} !=
|
|
7
|
-
RUN if [ {{runtime.proxy}} !=
|
|
8
|
-
RUN npm i -g @toa.io/runtime@{{runtime.version}}
|
|
6
|
+
RUN if [ "{{runtime.registry}}" != "" ]; then npm set registry {{runtime.registry}}; fi
|
|
7
|
+
RUN if [ "{{runtime.proxy}}" != "" ]; then npm set proxy {{runtime.proxy}}; fi
|
|
8
|
+
RUN npm i -g @toa.io/runtime@{{runtime.version}} --omit=dev
|
|
9
9
|
|
|
10
10
|
WORKDIR /composition
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
# run 'npm i' in each component
|
|
14
|
-
RUN find . -maxdepth 1 -type d \( ! -name . \) -exec /bin/sh -c "cd '{}' && if [ -f package.json ]; then npm i; fi" \;
|
|
11
|
+
COPY --chown=node:node . /composition
|
|
15
12
|
|
|
16
13
|
{{build.run}}
|
|
17
14
|
|
|
15
|
+
# run 'npm i' in each component
|
|
16
|
+
RUN for entry in *; do if [ -f "$entry/package.json" ]; then (cd $entry && npm i --omit=dev); fi; done
|
|
17
|
+
|
|
18
|
+
USER node
|
|
18
19
|
CMD toa compose *
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
FROM node:18.16.0-alpine3.17
|
|
2
2
|
|
|
3
3
|
ENV NODE_ENV=production
|
|
4
|
-
RUN if [ {{runtime.registry}} !=
|
|
5
|
-
RUN if [ {{runtime.proxy}} !=
|
|
6
|
-
RUN npm i -g @toa.io/runtime@{{runtime.version}}
|
|
4
|
+
RUN if [ "{{runtime.registry}}" != "" ]; then npm set registry {{runtime.registry}}; fi
|
|
5
|
+
RUN if [ "{{runtime.proxy}}" != "" ]; then npm set proxy {{runtime.proxy}}; fi
|
|
6
|
+
RUN npm i -g @toa.io/runtime@{{runtime.version}} --omit=dev
|
|
7
7
|
|
|
8
8
|
WORKDIR /service
|
|
9
|
-
|
|
10
|
-
RUN npm i
|
|
9
|
+
COPY --chown=node:node . /service
|
|
11
10
|
|
|
11
|
+
RUN npm i --omit=dev
|
|
12
|
+
|
|
13
|
+
USER node
|
|
12
14
|
CMD toa serve .
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as _service from './service'
|
|
2
|
+
import { dependencies } from '@toa.io/norm/types/context'
|
|
3
|
+
|
|
4
|
+
declare namespace toa.deployment {
|
|
5
|
+
|
|
6
|
+
namespace dependency {
|
|
7
|
+
|
|
8
|
+
type Constructor = (instances: dependencies.Instance[], annotation: any) => Declaration
|
|
9
|
+
|
|
10
|
+
type Reference = {
|
|
11
|
+
name: string
|
|
12
|
+
version: string
|
|
13
|
+
repository?: string
|
|
14
|
+
alias?: string
|
|
15
|
+
values?: Object
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
type Service = {
|
|
19
|
+
group: string
|
|
20
|
+
name: string
|
|
21
|
+
version: string
|
|
22
|
+
port: number
|
|
23
|
+
ingress?: {
|
|
24
|
+
host: string
|
|
25
|
+
class: string
|
|
26
|
+
annotations?: object
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
type Proxy = {
|
|
31
|
+
name: string
|
|
32
|
+
target: string
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
type Variable = {
|
|
36
|
+
name: string
|
|
37
|
+
value?: string | number
|
|
38
|
+
secret?: {
|
|
39
|
+
name: string,
|
|
40
|
+
key: string
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
type Variables = {
|
|
45
|
+
[key: string]: Variable[]
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
type Declaration = {
|
|
49
|
+
references?: Reference[]
|
|
50
|
+
services?: Service[] // dependency.Service
|
|
51
|
+
proxies?: Proxy[]
|
|
52
|
+
variables?: Variables
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
type Dependency = {
|
|
58
|
+
references?: dependency.Reference[]
|
|
59
|
+
services?: _service.Service[] // deployment.Service
|
|
60
|
+
proxies?: dependency.Proxy[]
|
|
61
|
+
variables?: dependency.Variables
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export type Declaration = toa.deployment.dependency.Declaration
|
|
67
|
+
export type Reference = toa.deployment.dependency.Reference
|
|
68
|
+
export type Service = toa.deployment.dependency.Service
|
|
69
|
+
export type Proxy = toa.deployment.dependency.Proxy
|
|
70
|
+
export type Variables = toa.deployment.dependency.Variables
|
|
71
|
+
export type Variable = toa.deployment.dependency.Variable
|
|
72
|
+
export type Dependency = toa.deployment.Dependency
|
|
@@ -1,72 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
type Constructor = (instances: dependencies.Instance[], annotation: any) => Declaration
|
|
9
|
-
|
|
10
|
-
type Reference = {
|
|
11
|
-
name: string
|
|
12
|
-
version: string
|
|
13
|
-
repository?: string
|
|
14
|
-
alias?: string
|
|
15
|
-
values?: Object
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
type Service = {
|
|
19
|
-
group: string
|
|
20
|
-
name: string
|
|
21
|
-
version: string
|
|
22
|
-
port: number
|
|
23
|
-
ingress?: {
|
|
24
|
-
host: string
|
|
25
|
-
class: string
|
|
26
|
-
annotations?: object
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
type Proxy = {
|
|
31
|
-
name: string
|
|
32
|
-
target: string
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
type Variable = {
|
|
36
|
-
name: string
|
|
37
|
-
value?: string | number
|
|
38
|
-
secret?: {
|
|
39
|
-
name: string,
|
|
40
|
-
key: string
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
type Variables = {
|
|
45
|
-
[key: string]: Variable[]
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
type Declaration = {
|
|
49
|
-
references?: Reference[]
|
|
50
|
-
services?: Service[] // dependency.Service
|
|
51
|
-
proxies?: Proxy[]
|
|
52
|
-
variables?: Variables
|
|
53
|
-
}
|
|
1
|
+
type Reference = {
|
|
2
|
+
name: string
|
|
3
|
+
version: string
|
|
4
|
+
repository?: string
|
|
5
|
+
alias?: string
|
|
6
|
+
values?: Object
|
|
7
|
+
}
|
|
54
8
|
|
|
9
|
+
type Service = {
|
|
10
|
+
group: string
|
|
11
|
+
name: string
|
|
12
|
+
version: string
|
|
13
|
+
port: number
|
|
14
|
+
ingress?: {
|
|
15
|
+
host: string
|
|
16
|
+
class: string
|
|
17
|
+
annotations?: object
|
|
55
18
|
}
|
|
19
|
+
}
|
|
56
20
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
21
|
+
type Variable = {
|
|
22
|
+
name: string
|
|
23
|
+
value?: string
|
|
24
|
+
secret?: {
|
|
25
|
+
name: string,
|
|
26
|
+
key: string
|
|
62
27
|
}
|
|
63
|
-
|
|
64
28
|
}
|
|
65
29
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
export type
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
30
|
+
type Variables = Record<string, Variable[]>
|
|
31
|
+
|
|
32
|
+
export type Dependency = {
|
|
33
|
+
references?: Reference[]
|
|
34
|
+
services?: Service[]
|
|
35
|
+
variables?: Variables
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dependency'
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as deployment from './deployment'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|