/
messages.go
367 lines (309 loc) · 12.3 KB
/
messages.go
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
package display
import (
"fmt"
"os"
"strings"
)
func MOTD() {
os.Stderr.WriteString(fmt.Sprintf(`
**
********
***************
*********************
*****************
:: ********* ::
:: *** ::
++ ::: ::: ++
++ ::: ++
++ ++
+
_ _ ____ _ _ ____ ___ ____ _ _
|\ | |__| |\ | | | |__) | | \/
| \| | | | \| |__| |__) |__| _/\_
`))
}
func InfoProductionHost() {
os.Stderr.WriteString(fmt.Sprintf(`
--------------------------------------------------------------------------------
+ WARNING:
+ You are on a live, production Linux server.
+ This host is primarily responsible for running docker containers.
+ Changes made to this machine have real consequences.
+ Proceed at your own risk.
--------------------------------------------------------------------------------
`))
}
func InfoProductionContainer() {
os.Stderr.WriteString(fmt.Sprintf(`
--------------------------------------------------------------------------------
+ WARNING:
+ You are in a live, production Linux container.
+ Changes made to this machine have real consequences.
+ Proceed at your own risk.
--------------------------------------------------------------------------------
`))
}
func InfoLocalContainer() {
os.Stderr.WriteString(fmt.Sprintf(`
--------------------------------------------------------------------------------
+ You are inside a Linux container on your local machine.
+ Anything here can be undone, so have fun and explore!
--------------------------------------------------------------------------------
`))
}
func TunnelEstablished(component, port string) {
os.Stderr.WriteString(fmt.Sprintf(`
--------------------------------------------------------------------------------
+ Secure tunnel established to %s
+ Use the following credentials to connect
--------------------------------------------------------------------------------
Host: 127.0.0.1
Port: %s
User: available in your dashboard (if applicable)
Pass: available in your dashboard (if applicable)
`, component, port))
}
func InfoDevContainer(ip string) {
os.Stderr.WriteString(fmt.Sprintf(`
--------------------------------------------------------------------------------
+ You are in a Linux container
+ Your local source code has been mounted into the container
+ Changes to your code in either the container or desktop will be mirrored
+ If you run a server, access it at >> %s
--------------------------------------------------------------------------------
`, ip))
}
func InfoDevRunContainer(cmd, ip string) {
os.Stderr.WriteString(fmt.Sprintf(`
**
*********
*************** Your command will run in an isolated Linux container
:: ********* :: Code changes in either the container or desktop are mirrored
" ::: *** ::: " ------------------------------------------------------------
"" ::: "" If you run a server, access it at >> %s
"" " ""
"
RUNNING > %s
`, ip, cmd))
os.Stderr.WriteString(fmt.Sprintf("%s\n", strings.Repeat("-", len(cmd)+10)))
}
func InfoSimDeploy(ip string) {
os.Stderr.WriteString(fmt.Sprintf(`
--------------------------------------------------------------------------------
+ Your app is running in simulated production environment
+ Access your app at >> %s
--------------------------------------------------------------------------------
`, ip))
}
func DevRunEmpty() {
os.Stderr.WriteString(fmt.Sprintf(`
! You don't have any web or worker start commands specified in your
boxfile.yml. More information about start commands is available here:
https://docs.nanobox.io/boxfile/web/#start-command
`))
}
func FirstDeploy() {
os.Stderr.WriteString(fmt.Sprintf(`
--------------------------------------------------------------------------------
+ HEADS UP:
+ This is the first deploy to this app and the upload takes longer than usual.
+ Future deploys only sync the differences and will be much faster.
--------------------------------------------------------------------------------
`))
}
func FirstBuild() {
os.Stderr.WriteString(fmt.Sprintf(`
--------------------------------------------------------------------------------
+ HEADS UP:
+ This is the first build for this project and will take longer than usual.
+ Future builds will pull from the cache and will be much faster.
--------------------------------------------------------------------------------
`))
}
func ProviderSetup() {
os.Stderr.WriteString(fmt.Sprintf(`
--------------------------------------------------------------------------------
+ HEADS UP:
+ Nanobox will run a single VM transparently within VirtualBox.
+ All apps and containers will be launched within the same VM.
--------------------------------------------------------------------------------
`))
}
func MigrateOldRequired() {
os.Stderr.WriteString(fmt.Sprintf(`
--------------------------------------------------------------------------------
+ WARNING:
+ Nanobox has been successfully upgraded! This change constitutes a major
+ architectural refactor as well as data re-structure. To use this version we
+ need to purge your current apps. No worries, nanobox will re-build them for
+ you the next time you use "nanobox run".
--------------------------------------------------------------------------------
`))
}
func MigrateProviderRequired() {
os.Stderr.WriteString(fmt.Sprintf(`
--------------------------------------------------------------------------------
+ WARNING:
+ It looks like you want to use a different provider, cool! Just FYI, we have
+ to bring down your existing apps as providers are not compatible. No worries,
+ nanobox will re-build them for you the next time you use "nanobox run".
--------------------------------------------------------------------------------
`))
}
func BadTerminal() {
os.Stderr.WriteString(fmt.Sprintf(`
--------------------------------------------------------------------------------
This console is currently not supported by nanobox
Please refer to the docs for more information
--------------------------------------------------------------------------------
`))
}
func MissingDependencies(provider string, missingParts []string) {
fmt.Printf("Using nanobox with %s requires tools that appear to not be available on your system.\n", provider)
fmt.Println(strings.Join(missingParts, "\n"))
fmt.Println("View these requirements at docs.nanobox.io/install")
}
func DeployComplete() {
os.Stderr.WriteString(fmt.Sprintf(`
%s Success, this deploy is on the way!
Check your dashboard for progress.
`, TaskComplete))
}
func LoginComplete() {
os.Stderr.WriteString(fmt.Sprintf(`
%s You've successfully logged in
`, TaskComplete))
}
func NetworkCreateError(name, network string) {
os.Stderr.WriteString(fmt.Sprintf(`
Nanobox is trying to create a native docker network, and it
looks like we have a conflict. An existing docker network is
already using the %s address space.
You will need to either remove the conflicting network, or set
an alternative address space with the following:
nanobox config set %s <unused ip/cidr>
`, network, name))
}
func VMCommunicationError() {
os.Stderr.WriteString(fmt.Sprintf(`
--------------------------------------------------------------------------------
Nanobox has started a VM that needs access to your machine for mounting.
This VM is unable to communicate with the host machine currently. Please
verify that you don't have a firewall blocking this connection, and try again!
--------------------------------------------------------------------------------
`))
}
func NoGonanaUser() {
os.Stderr.WriteString(fmt.Sprintf(`
We could not connect as the gonano user but we were able to
fall back to the default user
`, TaskComplete))
}
func MissingBoxfile() {
os.Stderr.WriteString(fmt.Sprintf(`
--------------------------------------------------------------------------------
MISSING BOXFILE.YML
Nanobox is looking for a boxfile.yml config file. You might want to
check out our getting-started guide on configuring your app:
https://guides.nanobox.io/
--------------------------------------------------------------------------------
`))
}
func InvalidBoxfile() {
os.Stderr.WriteString(fmt.Sprintf(`
--------------------------------------------------------------------------------
INVALID BOXFILE.YML
Nanobox requires valid yaml in your boxfile.yml config file. Please paste the
contents of your boxfile into www.yamllint.com to validate.
--------------------------------------------------------------------------------
`))
}
func TooManyKeys() {
os.Stderr.WriteString(fmt.Sprintf(`
--------------------------------------------------------------------------------
POSSIBLY TOO MANY KEYS
Nanobox imports your ssh key directory for fetching dependencies but it appears
you may have more than we can handle. You might want to check out our docs on
specifying a key to use:
https://docs.nanobox.io/local-config/configure-nanobox/
--------------------------------------------------------------------------------
`))
}
func WorldWritable() {
os.Stderr.WriteString(fmt.Sprintf(`
--------------------------------------------------------------------------------
Virtualbox was unable to create the virtual machine because a folder in the path
is globaly accessable and it should be private.
--------------------------------------------------------------------------------
`))
}
func LoginRequired() {
os.Stderr.WriteString(fmt.Sprintf(`
It appears you are running Nanobox for the first time.
Login to your Nanobox account:
`))
}
func UnexpectedPrivilage() {
os.Stderr.WriteString(fmt.Sprintf(`
--------------------------------------------------------------------------------
+ ERROR:
+ Nanobox is designed to run as a standard user (non root)
+ Please run all nanobox commands as a non privileged user
--------------------------------------------------------------------------------
`))
}
func BadPortType(protocol string) {
os.Stderr.WriteString(fmt.Sprintf(`
--------------------------------------------------------------------------------
+ WARNING:
+ The boxfile.yml does not support port protocol '%s'. Using 'tcp' as default.
--------------------------------------------------------------------------------
`, protocol))
}
func PortInUse(port string) {
os.Stderr.WriteString(fmt.Sprintf(`
--------------------------------------------------------------------------------
ADDRESS IN USE
It appears your local port (%s) is in use. Please specify a different port with
the '-p' flag. (eg. 'nanobox tunnel data.db -p 5444')
--------------------------------------------------------------------------------
`, port))
}
func PortPrivileged(port string) {
os.Stderr.WriteString(fmt.Sprintf(`
--------------------------------------------------------------------------------
PRIVILEGED PORT
Port '%s' is a privileged port. Please specify a port greater than 1023 with
the '-p' flag. (eg. 'nanobox tunnel data.db -p 5444')
--------------------------------------------------------------------------------
`, port))
}
func ConsoleNodeNotFound() {
os.Stderr.WriteString(fmt.Sprintf(`
--------------------------------------------------------------------------------
NODE NOT FOUND
It appears the node you are trying to console to does not exist. Please double
check your boxfile.yml. If your boxfile.yml does contain a node by the name you
specified, please contact support.
--------------------------------------------------------------------------------
`))
}
func ConsoleLocalCode() {
os.Stderr.WriteString(fmt.Sprintf(`
--------------------------------------------------------------------------------
CANNOT CONSOLE TO LOCAL CODE NODE
It appears you are trying to console to a local code node. When consoling to a
local web/worker, please use 'nanobox run'.
--------------------------------------------------------------------------------
`))
}
func LocalEngineNotFound() {
os.Stderr.WriteString(fmt.Sprintf(`
--------------------------------------------------------------------------------
LOCAL ENGINE NOT FOUND
It appears the local engine sepcified does not exist at the location defined.
Please double check your boxfile.yml and the path to the engine. If the path
you specified exists, please contact support.
--------------------------------------------------------------------------------
`))
}