/
hyscale-commands-reference.md
220 lines (142 loc) · 10.6 KB
/
hyscale-commands-reference.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# HyScale Tool Command Reference
---
## deploy
```markdown
Usage: hyscale deploy service [OPTIONS]
Deploy an application service
Options:
-f, --file string Service spec file `<serviceName>.hspec`. Can be repeated for multiple service deployment.
-p, --profile string `Optional` service profile file `<profileName>-<serviceName>.hprof`. Can be repeated for different services.
-n, --namespace string name of namespace `<namespace>`
-a, --application string name of application `<applicationName>`
-v --verbose `Optional` verbose mode
-P string `Optional` profile name
-o, --output json `Optional` Show deployment status in the required format. Allowed values are json/JSON.
```
#### Description
To deploy an application service which is defined in the hspec file, use the "deploy" command. The command requires hspec file, Kubernetes namespace and application name as inputs, additionally profile can also be provided for a service. Multiple hspec files (-f `<serviceName1>`.hspec -f `<serviceName2>`.hspec -f `<serviceNameN>`.hspec or comma separated -f `<serviceName1>`.hspec,`<serviceName2>`.hspec) can be provided to deploy multiple services. Similarly profiles files (-p `<profileName1>-<serviceName1>`.hprof -p `<profileName2>-<serviceName2>`.hprof -p `<profileNameN>-<serviceNameN>`.hprof or comma separated -p `<profileName1>-<serviceName1>`.hprof,`<profileName2>-<serviceName2>`.hprof) can also be provided for services. At max one profile is allowed per service.
-P profilename option lookups for the profile files in the format `<profilename>-<servicename>`.hprof in the directory of hspec ,say dir(hspec) or in the dir(hspec)/profiles. In this case profile is compulsory for all the service spec(s) provided.
Images that are built part of hyscale deploy are handled based on the HYS_IMAGE_CLEANUP_POLICY environment variable. Possible values of the policy are
* PRESERVE_N_RECENTLY_USED (default) , preserves the last 3 recently used images
* DELETE_AFTER_BUILD, deletes the image immediately after the build.
* PRESERVE_ALL, preserves the images
## service status
```markdown
Usage: hyscale get service status [OPTIONS]
Status of an Application Service.
Options:
-s --service string name of service `<serviceName>`. Can be repeated for multiple services.
-n --namespace string name of namespace `<namespace>`
-a --application string name of application `<applicationName>`
```
#### Description
To get the status of a particular deployed service, use "get service status" command. The command requires service name, Kubernetes namespace and application name as inputs. Multiple service names (-s `<serviceName1>` -s `<serviceName2>` -s `<serviceNameN>` or comma separated like -s `<serviceName1>`,`<serviceName2>`) can be provided to get status of multiple services of an application.
## app status
```markdown
Usage: hyscale get app status [OPTIONS]
Status of Deployed Application.
Options:
-n --namespace string name of namespace `<namespace>`
-a --application string name of application `<applicationName>`
```
#### Description
To get the status of all the deployed services in an application, use "get app status" command. The command requires the Kubernetes namespace and application name as inputs.
## logs
```markdown
Usage: hyscale get service logs [OPTIONS]
Logs of an application Service
Options:
-s --service string name of service `<serviceName>`
-n --namespace string name of namespace `<namespace>`
-a --application string name of application `<applicationName>`
-l --lines int `Optional` output the last given lines
-t --tail `Optional` follow the logs
```
#### Description
To get the stdout logs of the deployed service, use "get service logs" command. The command requires service name, Kubernetes namespace and application name as inputs. The command can tail the logs with the specified number of lines using -t and -l options to the command. In case of more than 1 replicas, user will be asked to select the replica for which he wants to see the logs.
## undeploy service
```markdown
Usage: hyscale undeploy service [OPTIONS]
Undeploy an existing deployed application service.
Options:
-s --service string name of service `<serviceName>`. Can be repeated for multiple services.
-n --namespace string name of namespace `<namespace>`
-a --application string name of application `<applicationName>`
```
#### Description
To undeploy a particular application service which was deployed by HyScale, use "undeploy service" command. The undeploy command requires the service name, Kubernetes namespace and the application name as inputs. Multiple service names (-s `<serviceName1>` -s `<serviceName2>` -s `<serviceNameN>` or comma separated -s `<serviceName1>`,`<serviceName2>`) can be provided to undeploy multiple services.
## undeploy app
```markdown
Usage: hyscale undeploy app [OPTIONS]
Undeploy an existing deployed application.
Options:
-n --namespace string name of namespace `<namespace>`
-a --application string name of application `<applicationName>`
```
#### Description
To undeploy all services for an application which was deployed by HyScale, use "undeploy app" command. The command requires the Kubernetes namespace and the application name as inputs.
## generate manifests
```markdown
Usage: hyscale generate service manifests [OPTIONS]
Generate kubernetes manifests for the specified services.
Options:
-f, --file string service spec file `<serviceName>.hspec`. Can be repeated for multiple service specifications.
-p, --profile string `Optional` service profile file `<profileName>-<serviceName>.hprof`. Can be repeated for different services.
-a --application string name of application `<applicationName>`
-P string `Optional` profile name
```
#### Description
HyScale abstracts the generation of Kubernetes manifests for deployments, however a user can generate the Kubernetes manifests without deployment using the "generate service manifests" command. The command requires service name, the application name as inputs, additionally profile can also be provided for a service. Multiple service names (-f `<serviceName1>`.hspec -f `<serviceName2>`.hspec `<serviceNameN>`.hspec or comma separated -f `<serviceName1>`.hspec,`<serviceName2>`.hspec) can be provided to generate Kubernetes manifests for multiple services. Additionally profiles files (-p `<profileName1>-<serviceName1>`.hprof -p `<profileName2>-<serviceName2>`.hprof -p `<profileNameN>-<serviceNameN>`.hprof or comma separated -p `<profileName1>-<serviceName1>`.hprof,`<profileName2>-<serviceName2>`.hprof) can also be provided for services. At max one profile is allowed per service.
-P profilename option lookups for the profile files in the format `<profilename>-<servicename>`.hprof in the directory of hspec, say dir(hspec) or in the dir(hspec)/profiles. In this case profile is compulsory for all the service spec(s) provided.
## get apps
```markdown
Usage: hyscale get apps
Display application along with the namespace they are deployed in.
```
#### Description
To get all the deployed applications, use "get apps" command. The command will display all the applications along with namespace deployed through hyscale.
## get replica status
```markdown
Usage: hyscale get replica status [OPTIONS]
Replica Status of an Application Service.
Options:
-s --service string name of service `<serviceName>`.
-n --namespace string name of namespace `<namespace>`
-a --application string name of application `<applicationName>`
```
#### Description:
To get the replica status of a particular deployed service, use "get replica status" command. The command requires service name, Kubernetes namespace and application name as inputs.
## scale service
```markdown
Usage: hyscale scale service [OPTIONS]
Scale a service of an application imperatively.
Options:
-s --service string name of service `<serviceName>`
-n --namespace string name of namespace `<namespace>`
-a --application string name of application `<applicationName>`
--up integer scales service up by specified value
--down integer scales service down by specified value
--to integer scales service to a specified value
```
#### Description:
To scale a service of an application
## Tool Options Description:
**_-f `<serviceName>`.hspec_**
HyScale Service Spec file where file name should be same as service name mentioned inside spec. This is the name with which service by default gets deployed. To know how to write service spec click [here](https://github.com/hyscale/hspec/blob/master/docs/hyscale-spec-reference.md).
**_-p `<profileName>-<serviceName>`.hprof_**
HyScale Service Profile file where file name should follow the pattern `<profileName>-<serviceName>`.hprof. Profile provides flexibility to declare environment specific values for certain parameters. To know what all is supported in profile click [here](https://github.com/hyscale/hspec/blob/master/docs/hyscale-spec-reference.md#Profile-Files).
Profile name must consist of alphanumeric characters or '-', with length in the range of 2-30. Regex used for profile name validation is *`([-a-zA-Z0-9]){2,30}`*
**_-n `<namespace>`_**
Kubernetes namespace where service is deployed. `namespace` acts like an isolation for your application services. Generally namespace is used for describing application environments (like QA, STAGE, UAT etc..). If namespace is not present, hyscale will create one with the given name provided kubeconfig permissions.
Namespace must consist of lower case alphanumeric characters or '-', with length in the range of 2-30. Regex used for validation is *`([a-z0-9-]){2,30}`*
**_-a `<applicationName>`_**
Logical grouping of services together with a given application name.
Application name must consist of lower case alphanumeric characters or '-' with length in the range of 2-30. Regex used for validation is
*`([a-z0-9-]){2,30}`*
**_-s `<serviceName>`_**
Basic unit of your application deployment.
A service name must consist of lower case alphanumeric characters or '-', it should start with an alphabetic character, and can end with an alphanumeric character. Regex used for validation is
*`[a-z]([-a-z0-9]*[a-z0-9])?`*
## Environment Variables
`HYS_LOG_LEVEL` - Log level for hyscale tool logs. Default is set to `info`. To change log level to `debug` execute `export HYS_LOG_LEVEL=debug`.
`HYS_LOG_SIZE` - Folder size cap for hyscale tool logs. Default is set to `100MB`. To change total size cap execute `export HYS_LOG_SIZE=<size>` (minimum size cap is 10MB).