|
@@
-1,7017
+1,7047
b''
|
|
1
|
#!/usr/bin/env bash
|
|
1
|
#!/usr/bin/env bash
|
|
2
|
# This script was generated
|
|
2
|
# This script was generated
|
|
3
|
# Modifying it manually is not recommended
|
|
3
|
# Modifying it manually is not recommended
|
|
4
|
|
|
4
|
|
|
5
|
check_bash_version() {
|
|
5
|
check_bash_version() {
|
|
6
|
if [ ! "${BASH_VERSINFO:-0}" -ge 4 ]; then
|
|
6
|
if [ ! "${BASH_VERSINFO:-0}" -ge 4 ]; then
|
|
7
|
echo "Bash version 4 or greater is required (got ${BASH_VERSINFO}), please update your bash version!"
|
|
7
|
echo "Bash version 4 or greater is required (got ${BASH_VERSINFO}), please update your bash version!"
|
|
8
|
exit 1
|
|
8
|
exit 1
|
|
9
|
fi
|
|
9
|
fi
|
|
10
|
}
|
|
10
|
}
|
|
11
|
check_bash_version
|
|
11
|
check_bash_version
|
|
12
|
|
|
12
|
|
|
13
|
# :command.master_script
|
|
13
|
# :command.master_script
|
|
14
|
|
|
14
|
|
|
15
|
# :command.version_command
|
|
15
|
# :command.version_command
|
|
16
|
version_command() {
|
|
16
|
version_command() {
|
|
17
|
echo "$version"
|
|
17
|
echo "$version"
|
|
18
|
}
|
|
18
|
}
|
|
19
|
|
|
19
|
|
|
20
|
# :command.usage
|
|
20
|
# :command.usage
|
|
21
|
rcstack_usage() {
|
|
21
|
rcstack_usage() {
|
|
22
|
if [[ -n $long_usage ]]; then
|
|
22
|
if [[ -n $long_usage ]]; then
|
|
23
|
printf "rcstack\n"
|
|
23
|
printf "rcstack\n"
|
|
24
|
echo
|
|
24
|
echo
|
|
25
|
|
|
25
|
|
|
26
|
printf " CLI for installing and managing RhodeCode Cluster Stack \nSupport:\n https://community.rhodecode.com\nDocs: https://docs.rhodecode.com/rcstack\n"
|
|
26
|
printf " CLI for installing and managing RhodeCode Cluster Stack \nSupport:\n https://community.rhodecode.com\nDocs: https://docs.rhodecode.com/rcstack\n"
|
|
27
|
echo
|
|
27
|
echo
|
|
28
|
|
|
28
|
|
|
29
|
else
|
|
29
|
else
|
|
30
|
printf "rcstack - CLI for installing and managing RhodeCode Cluster Stack \nSupport: https://community.rhodecode.com\nDocs: https://docs.rhodecode.com/rcstack\n"
|
|
30
|
printf "rcstack - CLI for installing and managing RhodeCode Cluster Stack \nSupport: https://community.rhodecode.com\nDocs: https://docs.rhodecode.com/rcstack\n"
|
|
31
|
echo
|
|
31
|
echo
|
|
32
|
|
|
32
|
|
|
33
|
fi
|
|
33
|
fi
|
|
34
|
|
|
34
|
|
|
35
|
printf "%s\n" "Usage:"
|
|
35
|
printf "%s\n" "Usage:"
|
|
36
|
printf " rcstack [OPTIONS] COMMAND\n"
|
|
36
|
printf " rcstack [OPTIONS] COMMAND\n"
|
|
37
|
printf " rcstack [COMMAND] --help | -h\n"
|
|
37
|
printf " rcstack [COMMAND] --help | -h\n"
|
|
38
|
printf " rcstack --version | -v\n"
|
|
38
|
printf " rcstack --version | -v\n"
|
|
39
|
echo
|
|
39
|
echo
|
|
40
|
# :command.usage_commands
|
|
40
|
# :command.usage_commands
|
|
41
|
printf "%s\n" "Commands:"
|
|
41
|
printf "%s\n" "Commands:"
|
|
42
|
printf " %s Print instructions to get started with rhodecode docker stack\n" "get-started "
|
|
42
|
printf " %s Print instructions to get started with rhodecode docker stack\n" "get-started "
|
|
43
|
printf " %s Bootstrap this machine, check docker version and install rhodecode-network\n" "init "
|
|
43
|
printf " %s Bootstrap this machine, check docker version and install rhodecode-network\n" "init "
|
|
44
|
printf " %s Update rcstack and it's docker definitions\n" "self-update "
|
|
44
|
printf " %s Update rcstack and it's docker definitions\n" "self-update "
|
|
45
|
echo
|
|
45
|
echo
|
|
46
|
printf "%s\n" "Stack Commands:"
|
|
46
|
printf "%s\n" "Stack Commands:"
|
|
47
|
printf " %s Run one of available cluster stacks, run stack -h for more details\n" "stack "
|
|
47
|
printf " %s Run one of available cluster stacks, run stack -h for more details\n" "stack "
|
|
48
|
printf " %s Show stack status\n" "stack-status "
|
|
48
|
printf " %s Show stack status\n" "stack-status "
|
|
49
|
printf " %s Upgrade a stack, run stack-upgrade -h for more details\n" "stack-upgrade "
|
|
49
|
printf " %s Upgrade a stack, run stack-upgrade -h for more details\n" "stack-upgrade "
|
|
50
|
printf " %s run monitoring on stack items\n" "stack-monitor "
|
|
50
|
printf " %s run monitoring on stack items\n" "stack-monitor "
|
|
51
|
echo
|
|
51
|
echo
|
|
52
|
printf "%s\n" "CLI Commands:"
|
|
52
|
printf "%s\n" "CLI Commands:"
|
|
53
|
printf " %s Various CLI tools, run cli -h for more details\n" "cli "
|
|
53
|
printf " %s Various CLI tools, run cli -h for more details\n" "cli "
|
|
54
|
echo
|
|
54
|
echo
|
|
55
|
printf "%s\n" "Backup Commands:"
|
|
55
|
printf "%s\n" "Backup Commands:"
|
|
56
|
printf " %s Backup Database\n" "backup-db "
|
|
56
|
printf " %s Backup Database\n" "backup-db "
|
|
57
|
printf " %s Backup RhodeCode storage\n" "backup-data "
|
|
57
|
printf " %s Backup RhodeCode storage\n" "backup-data "
|
|
58
|
echo
|
|
58
|
echo
|
|
59
|
printf "%s\n" "Build Commands:"
|
|
59
|
printf "%s\n" "Build Commands:"
|
|
60
|
printf " %s Fetch Artifacts to run installer based build\n" "get-build-artifacts"
|
|
60
|
printf " %s Fetch Artifacts to run installer based build\n" "get-build-artifacts"
|
|
61
|
printf " %s Build RhodeCode image from installer, ./rcstack get-build-artifacts initially\n" "build-installer "
|
|
61
|
printf " %s Build RhodeCode image from installer, ./rcstack get-build-artifacts initially\n" "build-installer "
|
|
62
|
printf " %s Fetch RhodeCode sources, store in .source dir to run a source-based builds\n" "get-build-source "
|
|
62
|
printf " %s Fetch RhodeCode sources, store in .source dir to run a source-based builds\n" "get-build-source "
|
|
63
|
printf " %s Build RhodeCode image from source, requires ./rcstack get-build-source initially\n" "build-source "
|
|
63
|
printf " %s Build RhodeCode image from source, requires ./rcstack get-build-source initially\n" "build-source "
|
|
64
|
echo
|
|
64
|
echo
|
|
65
|
|
|
65
|
|
|
66
|
# :command.long_usage
|
|
66
|
# :command.long_usage
|
|
67
|
if [[ -n $long_usage ]]; then
|
|
67
|
if [[ -n $long_usage ]]; then
|
|
68
|
printf "%s\n" "Options:"
|
|
68
|
printf "%s\n" "Options:"
|
|
69
|
|
|
69
|
|
|
70
|
# :command.usage_flags
|
|
70
|
# :command.usage_flags
|
|
71
|
# :flag.usage
|
|
71
|
# :flag.usage
|
|
72
|
printf " %s\n" "--debug"
|
|
72
|
printf " %s\n" "--debug"
|
|
73
|
printf " Enable debug and detailed output,\n"
|
|
73
|
printf " Enable debug and detailed output,\n"
|
|
74
|
echo
|
|
74
|
echo
|
|
75
|
|
|
75
|
|
|
76
|
# :flag.usage
|
|
76
|
# :flag.usage
|
|
77
|
printf " %s\n" "--no-init-check"
|
|
77
|
printf " %s\n" "--no-init-check"
|
|
78
|
printf " Skip check for ./rcstack init call\n"
|
|
78
|
printf " Skip check for ./rcstack init call\n"
|
|
79
|
echo
|
|
79
|
echo
|
|
80
|
|
|
80
|
|
|
81
|
# :command.usage_fixed_flags
|
|
81
|
# :command.usage_fixed_flags
|
|
82
|
printf " %s\n" "--help, -h"
|
|
82
|
printf " %s\n" "--help, -h"
|
|
83
|
printf " Show this help\n"
|
|
83
|
printf " Show this help\n"
|
|
84
|
echo
|
|
84
|
echo
|
|
85
|
printf " %s\n" "--version, -v"
|
|
85
|
printf " %s\n" "--version, -v"
|
|
86
|
printf " Show version number\n"
|
|
86
|
printf " Show version number\n"
|
|
87
|
echo
|
|
87
|
echo
|
|
88
|
|
|
88
|
|
|
89
|
# :command.usage_environment_variables
|
|
89
|
# :command.usage_environment_variables
|
|
90
|
printf "%s\n" "Environment Variables:"
|
|
90
|
printf "%s\n" "Environment Variables:"
|
|
91
|
|
|
91
|
|
|
92
|
# :environment_variable.usage
|
|
92
|
# :environment_variable.usage
|
|
93
|
printf " %s\n" "RCC_CONFIG"
|
|
93
|
printf " %s\n" "RCC_CONFIG"
|
|
94
|
printf " default config file for rcstack\n"
|
|
94
|
printf " default config file for rcstack\n"
|
|
95
|
printf " Default: .rcstack.ini\n"
|
|
95
|
printf " Default: .rcstack.ini\n"
|
|
96
|
echo
|
|
96
|
echo
|
|
97
|
|
|
97
|
|
|
98
|
# :environment_variable.usage
|
|
98
|
# :environment_variable.usage
|
|
99
|
printf " %s\n" "AUTH_TOKEN"
|
|
99
|
printf " %s\n" "AUTH_TOKEN"
|
|
100
|
printf " Set your RhodeCode AUTH Token\n"
|
|
100
|
printf " Set your RhodeCode AUTH Token\n"
|
|
101
|
echo
|
|
101
|
echo
|
|
102
|
|
|
102
|
|
|
103
|
# :environment_variable.usage
|
|
103
|
# :environment_variable.usage
|
|
104
|
printf " %s\n" "RC_STACK_ROUTER_EXT"
|
|
104
|
printf " %s\n" "RC_STACK_ROUTER_EXT"
|
|
105
|
printf "\n"
|
|
105
|
printf "\n"
|
|
106
|
printf " Default: .custom/docker-compose-router.override.yaml\n"
|
|
106
|
printf " Default: .custom/docker-compose-router.override.yaml\n"
|
|
107
|
echo
|
|
107
|
echo
|
|
108
|
|
|
108
|
|
|
109
|
# :environment_variable.usage
|
|
109
|
# :environment_variable.usage
|
|
110
|
printf " %s\n" "RC_STACK_METRICS_EXT"
|
|
110
|
printf " %s\n" "RC_STACK_METRICS_EXT"
|
|
111
|
printf "\n"
|
|
111
|
printf "\n"
|
|
112
|
printf " Default: .custom/docker-compose-metrics.override.yaml\n"
|
|
112
|
printf " Default: .custom/docker-compose-metrics.override.yaml\n"
|
|
113
|
echo
|
|
113
|
echo
|
|
114
|
|
|
114
|
|
|
115
|
# :environment_variable.usage
|
|
115
|
# :environment_variable.usage
|
|
116
|
printf " %s\n" "RC_STACK_SERVICES_EXT"
|
|
116
|
printf " %s\n" "RC_STACK_SERVICES_EXT"
|
|
117
|
printf "\n"
|
|
117
|
printf "\n"
|
|
118
|
printf " Default: .custom/docker-compose-services.override.yaml\n"
|
|
118
|
printf " Default: .custom/docker-compose-services.override.yaml\n"
|
|
119
|
echo
|
|
119
|
echo
|
|
120
|
|
|
120
|
|
|
121
|
# :environment_variable.usage
|
|
121
|
# :environment_variable.usage
|
|
122
|
printf " %s\n" "RC_STACK_RHODECODE_EXT"
|
|
122
|
printf " %s\n" "RC_STACK_RHODECODE_EXT"
|
|
123
|
printf "\n"
|
|
123
|
printf "\n"
|
|
124
|
printf " Default: .custom/docker-compose-apps.override.yaml\n"
|
|
124
|
printf " Default: .custom/docker-compose-apps.override.yaml\n"
|
|
125
|
echo
|
|
125
|
echo
|
|
126
|
|
|
126
|
|
|
127
|
# :command.footer
|
|
127
|
# :command.footer
|
|
128
|
printf "RhodeCode Inc 2023\n\n"
|
|
128
|
printf "RhodeCode Inc 2023\n\n"
|
|
129
|
echo
|
|
129
|
echo
|
|
130
|
|
|
130
|
|
|
131
|
fi
|
|
131
|
fi
|
|
132
|
}
|
|
132
|
}
|
|
133
|
|
|
133
|
|
|
134
|
# :command.usage
|
|
134
|
# :command.usage
|
|
135
|
rcstack_get_started_usage() {
|
|
135
|
rcstack_get_started_usage() {
|
|
136
|
if [[ -n $long_usage ]]; then
|
|
136
|
if [[ -n $long_usage ]]; then
|
|
137
|
printf "rcstack get-started - Print instructions to get started with rhodecode docker stack\n"
|
|
137
|
printf "rcstack get-started - Print instructions to get started with rhodecode docker stack\n"
|
|
138
|
echo
|
|
138
|
echo
|
|
139
|
|
|
139
|
|
|
140
|
else
|
|
140
|
else
|
|
141
|
printf "rcstack get-started - Print instructions to get started with rhodecode docker stack\n"
|
|
141
|
printf "rcstack get-started - Print instructions to get started with rhodecode docker stack\n"
|
|
142
|
echo
|
|
142
|
echo
|
|
143
|
|
|
143
|
|
|
144
|
fi
|
|
144
|
fi
|
|
145
|
|
|
145
|
|
|
146
|
printf "%s\n" "Usage:"
|
|
146
|
printf "%s\n" "Usage:"
|
|
147
|
printf " rcstack get-started\n"
|
|
147
|
printf " rcstack get-started\n"
|
|
148
|
printf " rcstack get-started --help | -h\n"
|
|
148
|
printf " rcstack get-started --help | -h\n"
|
|
149
|
echo
|
|
149
|
echo
|
|
150
|
|
|
150
|
|
|
151
|
# :command.long_usage
|
|
151
|
# :command.long_usage
|
|
152
|
if [[ -n $long_usage ]]; then
|
|
152
|
if [[ -n $long_usage ]]; then
|
|
153
|
printf "%s\n" "Options:"
|
|
153
|
printf "%s\n" "Options:"
|
|
154
|
|
|
154
|
|
|
155
|
# :command.usage_fixed_flags
|
|
155
|
# :command.usage_fixed_flags
|
|
156
|
printf " %s\n" "--help, -h"
|
|
156
|
printf " %s\n" "--help, -h"
|
|
157
|
printf " Show this help\n"
|
|
157
|
printf " Show this help\n"
|
|
158
|
echo
|
|
158
|
echo
|
|
159
|
|
|
159
|
|
|
160
|
fi
|
|
160
|
fi
|
|
161
|
}
|
|
161
|
}
|
|
162
|
|
|
162
|
|
|
163
|
# :command.usage
|
|
163
|
# :command.usage
|
|
164
|
rcstack_init_usage() {
|
|
164
|
rcstack_init_usage() {
|
|
165
|
if [[ -n $long_usage ]]; then
|
|
165
|
if [[ -n $long_usage ]]; then
|
|
166
|
printf "rcstack init - Bootstrap this machine, check docker version and install rhodecode-network\n"
|
|
166
|
printf "rcstack init - Bootstrap this machine, check docker version and install rhodecode-network\n"
|
|
167
|
echo
|
|
167
|
echo
|
|
168
|
|
|
168
|
|
|
169
|
else
|
|
169
|
else
|
|
170
|
printf "rcstack init - Bootstrap this machine, check docker version and install rhodecode-network\n"
|
|
170
|
printf "rcstack init - Bootstrap this machine, check docker version and install rhodecode-network\n"
|
|
171
|
echo
|
|
171
|
echo
|
|
172
|
|
|
172
|
|
|
173
|
fi
|
|
173
|
fi
|
|
174
|
|
|
174
|
|
|
175
|
printf "%s\n" "Usage:"
|
|
175
|
printf "%s\n" "Usage:"
|
|
176
|
printf " rcstack init [OPTIONS]\n"
|
|
176
|
printf " rcstack init [OPTIONS]\n"
|
|
177
|
printf " rcstack init --help | -h\n"
|
|
177
|
printf " rcstack init --help | -h\n"
|
|
178
|
echo
|
|
178
|
echo
|
|
179
|
|
|
179
|
|
|
180
|
# :command.long_usage
|
|
180
|
# :command.long_usage
|
|
181
|
if [[ -n $long_usage ]]; then
|
|
181
|
if [[ -n $long_usage ]]; then
|
|
182
|
printf "%s\n" "Options:"
|
|
182
|
printf "%s\n" "Options:"
|
|
183
|
|
|
183
|
|
|
184
|
# :command.usage_flags
|
|
184
|
# :command.usage_flags
|
|
185
|
# :flag.usage
|
|
185
|
# :flag.usage
|
|
186
|
printf " %s\n" "--arg-rc-edition ARG_RC_EDITION"
|
|
186
|
printf " %s\n" "--arg-rc-edition ARG_RC_EDITION"
|
|
187
|
printf " specify rc_edition [ee|ce] for setup\n"
|
|
187
|
printf " specify rc_edition [ee|ce] for setup\n"
|
|
188
|
echo
|
|
188
|
echo
|
|
189
|
|
|
189
|
|
|
190
|
# :flag.usage
|
|
190
|
# :flag.usage
|
|
191
|
printf " %s\n" "--arg-hostname ARG_HOSTNAME"
|
|
191
|
printf " %s\n" "--arg-hostname ARG_HOSTNAME"
|
|
192
|
printf " specify hostname [hostname.example.com] for setup\n"
|
|
192
|
printf " specify hostname [hostname.example.com] for setup\n"
|
|
193
|
echo
|
|
193
|
echo
|
|
194
|
|
|
194
|
|
|
195
|
# :flag.usage
|
|
195
|
# :flag.usage
|
|
196
|
printf " %s\n" "--arg-use-ssl ARG_USE_SSL"
|
|
196
|
printf " %s\n" "--arg-use-ssl ARG_USE_SSL"
|
|
197
|
printf " specify use_ssl [y|n] for setup\n"
|
|
197
|
printf " specify use_ssl [y|n] for setup\n"
|
|
198
|
echo
|
|
198
|
echo
|
|
199
|
|
|
199
|
|
|
200
|
# :flag.usage
|
|
200
|
# :flag.usage
|
|
201
|
printf " %s\n" "--arg-admin-email ARG_ADMIN_EMAIL"
|
|
201
|
printf " %s\n" "--arg-admin-email ARG_ADMIN_EMAIL"
|
|
202
|
printf " specify admin_email [foo@example.com] for setup\n"
|
|
202
|
printf " specify admin_email [foo@example.com] for setup\n"
|
|
203
|
echo
|
|
203
|
echo
|
|
204
|
|
|
204
|
|
|
205
|
# :flag.usage
|
|
205
|
# :flag.usage
|
|
206
|
printf " %s\n" "--arg-admin-user ARG_ADMIN_USER"
|
|
206
|
printf " %s\n" "--arg-admin-user ARG_ADMIN_USER"
|
|
207
|
printf " specify admin_user [admin] for setup\n"
|
|
207
|
printf " specify admin_user [admin] for setup\n"
|
|
208
|
echo
|
|
208
|
echo
|
|
209
|
|
|
209
|
|
|
210
|
# :flag.usage
|
|
210
|
# :flag.usage
|
|
211
|
printf " %s\n" "--arg-admin-pass ARG_ADMIN_PASS"
|
|
211
|
printf " %s\n" "--arg-admin-pass ARG_ADMIN_PASS"
|
|
212
|
printf " specify admin_pass [secretpassword] for setup\n"
|
|
212
|
printf " specify admin_pass [secretpassword] for setup\n"
|
|
213
|
echo
|
|
213
|
echo
|
|
214
|
|
|
214
|
|
|
215
|
# :flag.usage
|
|
215
|
# :flag.usage
|
|
216
|
printf " %s\n" "--arg-license-token ARG_ADMIN_TOKEN"
|
|
216
|
printf " %s\n" "--arg-license-token ARG_ADMIN_TOKEN"
|
|
217
|
printf " specify license_token [abcd-abcd-abcd-abcd] for setup\n"
|
|
217
|
printf " specify license_token [abcd-abcd-abcd-abcd] for setup\n"
|
|
218
|
echo
|
|
218
|
echo
|
|
219
|
|
|
219
|
|
|
220
|
# :flag.usage
|
|
220
|
# :flag.usage
|
|
221
|
printf " %s\n" "--no-prompt"
|
|
221
|
printf " %s\n" "--no-prompt"
|
|
222
|
printf " Don't use interactive prompt to ask setup questions. Use defaults instead\n"
|
|
222
|
printf " Don't use interactive prompt to ask setup questions. Use defaults instead\n"
|
|
223
|
echo
|
|
223
|
echo
|
|
224
|
|
|
224
|
|
|
225
|
# :flag.usage
|
|
225
|
# :flag.usage
|
|
226
|
printf " %s\n" "--force, -f"
|
|
226
|
printf " %s\n" "--force, -f"
|
|
227
|
printf " Overwrite existing files\n"
|
|
227
|
printf " Overwrite existing files\n"
|
|
228
|
echo
|
|
228
|
echo
|
|
229
|
|
|
229
|
|
|
230
|
# :flag.usage
|
|
230
|
# :flag.usage
|
|
231
|
printf " %s\n" "--stage STAGE (repeatable)"
|
|
231
|
printf " %s\n" "--stage STAGE (repeatable)"
|
|
232
|
printf " specify one or more stages to run\n"
|
|
232
|
printf " specify one or more stages to run\n"
|
|
233
|
echo
|
|
233
|
echo
|
|
234
|
|
|
234
|
|
|
235
|
# :flag.usage
|
|
235
|
# :flag.usage
|
|
236
|
printf " %s\n" "--auth-token AUTH_TOKEN"
|
|
236
|
printf " %s\n" "--auth-token AUTH_TOKEN"
|
|
237
|
printf " Optionally specify AUTH TOKEN to obtain sources\n"
|
|
237
|
printf " Optionally specify AUTH TOKEN to obtain sources\n"
|
|
238
|
echo
|
|
238
|
echo
|
|
239
|
|
|
239
|
|
|
240
|
# :flag.usage
|
|
240
|
# :flag.usage
|
|
241
|
printf " %s\n" "--server-url SERVER_URL"
|
|
241
|
printf " %s\n" "--server-url SERVER_URL"
|
|
242
|
printf " Specify RhodeCode server location where projects should be downloaded\n"
|
|
242
|
printf " Specify RhodeCode server location where projects should be downloaded\n"
|
|
243
|
printf " Default: https://code.rhodecode.com\n"
|
|
243
|
printf " Default: https://code.rhodecode.com\n"
|
|
244
|
echo
|
|
244
|
echo
|
|
245
|
|
|
245
|
|
|
246
|
# :flag.usage
|
|
246
|
# :flag.usage
|
|
247
|
printf " %s\n" "--docker-revision DOCKER_REVISION"
|
|
247
|
printf " %s\n" "--docker-revision DOCKER_REVISION"
|
|
248
|
printf " revision to fetch new docker definitions.\n"
|
|
248
|
printf " revision to fetch new docker definitions.\n"
|
|
249
|
printf " Default: master\n"
|
|
249
|
printf " Default: master\n"
|
|
250
|
echo
|
|
250
|
echo
|
|
251
|
|
|
251
|
|
|
252
|
# :flag.usage
|
|
252
|
# :flag.usage
|
|
253
|
printf " %s\n" "--install-docker INSTALL_DOCKER"
|
|
253
|
printf " %s\n" "--install-docker INSTALL_DOCKER"
|
|
254
|
printf " answer [y]es or [n]o to question to install docker\n"
|
|
254
|
printf " answer [y]es or [n]o to question to install docker\n"
|
|
255
|
echo
|
|
255
|
echo
|
|
256
|
|
|
256
|
|
|
257
|
# :command.usage_fixed_flags
|
|
257
|
# :command.usage_fixed_flags
|
|
258
|
printf " %s\n" "--help, -h"
|
|
258
|
printf " %s\n" "--help, -h"
|
|
259
|
printf " Show this help\n"
|
|
259
|
printf " Show this help\n"
|
|
260
|
echo
|
|
260
|
echo
|
|
261
|
|
|
261
|
|
|
262
|
# :command.usage_examples
|
|
262
|
# :command.usage_examples
|
|
263
|
printf "%s\n" "Examples:"
|
|
263
|
printf "%s\n" "Examples:"
|
|
264
|
printf " - ./rcstack init\n - ./rcstack init --force\n # non-interactive mode to say yes to install docker question [n] always does\n not install docker\n - ./rcstack init --install-docker=y\n # non-interactive mode to answer setup questions use --help to check all\n --arg-NAME options\n - ./rcstack init --install-docker=y --arg-hostname=docker-dev --arg-use-ssl=n\n --arg-rc-edition=ee\n"
|
|
264
|
printf " - ./rcstack init\n - ./rcstack init --force\n # non-interactive mode to say yes to install docker question [n] always does\n not install docker\n - ./rcstack init --install-docker=y\n # non-interactive mode to answer setup questions use --help to check all\n --arg-NAME options\n - ./rcstack init --install-docker=y --arg-hostname=docker-dev --arg-use-ssl=n\n --arg-rc-edition=ee\n"
|
|
265
|
echo
|
|
265
|
echo
|
|
266
|
|
|
266
|
|
|
267
|
fi
|
|
267
|
fi
|
|
268
|
}
|
|
268
|
}
|
|
269
|
|
|
269
|
|
|
270
|
# :command.usage
|
|
270
|
# :command.usage
|
|
271
|
rcstack_self_update_usage() {
|
|
271
|
rcstack_self_update_usage() {
|
|
272
|
if [[ -n $long_usage ]]; then
|
|
272
|
if [[ -n $long_usage ]]; then
|
|
273
|
printf "rcstack self-update - Update rcstack and it's docker definitions\n"
|
|
273
|
printf "rcstack self-update - Update rcstack and it's docker definitions\n"
|
|
274
|
echo
|
|
274
|
echo
|
|
275
|
|
|
275
|
|
|
276
|
else
|
|
276
|
else
|
|
277
|
printf "rcstack self-update - Update rcstack and it's docker definitions\n"
|
|
277
|
printf "rcstack self-update - Update rcstack and it's docker definitions\n"
|
|
278
|
echo
|
|
278
|
echo
|
|
279
|
|
|
279
|
|
|
280
|
fi
|
|
280
|
fi
|
|
281
|
|
|
281
|
|
|
282
|
printf "%s\n" "Usage:"
|
|
282
|
printf "%s\n" "Usage:"
|
|
283
|
printf " rcstack self-update [OPTIONS]\n"
|
|
283
|
printf " rcstack self-update [OPTIONS]\n"
|
|
284
|
printf " rcstack self-update --help | -h\n"
|
|
284
|
printf " rcstack self-update --help | -h\n"
|
|
285
|
echo
|
|
285
|
echo
|
|
286
|
|
|
286
|
|
|
287
|
# :command.long_usage
|
|
287
|
# :command.long_usage
|
|
288
|
if [[ -n $long_usage ]]; then
|
|
288
|
if [[ -n $long_usage ]]; then
|
|
289
|
printf "%s\n" "Options:"
|
|
289
|
printf "%s\n" "Options:"
|
|
290
|
|
|
290
|
|
|
291
|
# :command.usage_flags
|
|
291
|
# :command.usage_flags
|
|
292
|
# :flag.usage
|
|
292
|
# :flag.usage
|
|
293
|
printf " %s\n" "--force"
|
|
293
|
printf " %s\n" "--force"
|
|
294
|
printf " Ignore same-version skip check. Runs same logic as there would be new\n version available\n"
|
|
294
|
printf " Ignore same-version skip check. Runs same logic as there would be new\n version available\n"
|
|
295
|
echo
|
|
295
|
echo
|
|
296
|
|
|
296
|
|
|
297
|
# :flag.usage
|
|
297
|
# :flag.usage
|
|
298
|
printf " %s\n" "--cli-revision CLI_REVISION"
|
|
298
|
printf " %s\n" "--cli-revision CLI_REVISION"
|
|
299
|
printf " revision to fetch new rcstack cli tool.\n"
|
|
299
|
printf " revision to fetch new rcstack cli tool.\n"
|
|
300
|
printf " Default: master\n"
|
|
300
|
printf " Default: master\n"
|
|
301
|
echo
|
|
301
|
echo
|
|
302
|
|
|
302
|
|
|
303
|
# :flag.usage
|
|
303
|
# :flag.usage
|
|
304
|
printf " %s\n" "--docker-revision DOCKER_REVISION"
|
|
304
|
printf " %s\n" "--docker-revision DOCKER_REVISION"
|
|
305
|
printf " revision to fetch new docker definitions.\n"
|
|
305
|
printf " revision to fetch new docker definitions.\n"
|
|
306
|
printf " Default: master\n"
|
|
306
|
printf " Default: master\n"
|
|
307
|
echo
|
|
307
|
echo
|
|
308
|
|
|
308
|
|
|
309
|
# :flag.usage
|
|
309
|
# :flag.usage
|
|
310
|
printf " %s\n" "--auth-token AUTH_TOKEN"
|
|
310
|
printf " %s\n" "--auth-token AUTH_TOKEN"
|
|
311
|
printf " Optionally specify AUTH TOKEN to obtain sources\n"
|
|
311
|
printf " Optionally specify AUTH TOKEN to obtain sources\n"
|
|
312
|
echo
|
|
312
|
echo
|
|
313
|
|
|
313
|
|
|
314
|
# :flag.usage
|
|
314
|
# :flag.usage
|
|
315
|
printf " %s\n" "--server-url SERVER_URL"
|
|
315
|
printf " %s\n" "--server-url SERVER_URL"
|
|
316
|
printf " Specify RhodeCode server location where projects should be downloaded\n"
|
|
316
|
printf " Specify RhodeCode server location where projects should be downloaded\n"
|
|
317
|
printf " Default: https://code.rhodecode.com\n"
|
|
317
|
printf " Default: https://code.rhodecode.com\n"
|
|
318
|
echo
|
|
318
|
echo
|
|
319
|
|
|
319
|
|
|
320
|
# :command.usage_fixed_flags
|
|
320
|
# :command.usage_fixed_flags
|
|
321
|
printf " %s\n" "--help, -h"
|
|
321
|
printf " %s\n" "--help, -h"
|
|
322
|
printf " Show this help\n"
|
|
322
|
printf " Show this help\n"
|
|
323
|
echo
|
|
323
|
echo
|
|
324
|
|
|
324
|
|
|
325
|
# :command.usage_examples
|
|
325
|
# :command.usage_examples
|
|
326
|
printf "%s\n" "Examples:"
|
|
326
|
printf "%s\n" "Examples:"
|
|
327
|
printf " - ./rccstack self-update simply to update it to a new version\n \n # to fetch dev branch and install it\n - ./rccstack self-update --cli-revision=dev --docker-revision=dev\n \n # In case rcstack breaks, you can re-download the stack script using curl\n curl -L -s -o rcstack https://dls.rhodecode.com/get/master && chmod +x rcstack\n"
|
|
327
|
printf " - ./rccstack self-update simply to update it to a new version\n \n # to fetch dev branch and install it\n - ./rccstack self-update --cli-revision=dev --docker-revision=dev\n \n # In case rcstack breaks, you can re-download the stack script using curl\n curl -L -s -o rcstack https://dls.rhodecode.com/get/master && chmod +x rcstack\n"
|
|
328
|
echo
|
|
328
|
echo
|
|
329
|
|
|
329
|
|
|
330
|
fi
|
|
330
|
fi
|
|
331
|
}
|
|
331
|
}
|
|
332
|
|
|
332
|
|
|
333
|
# :command.usage
|
|
333
|
# :command.usage
|
|
334
|
rcstack_stack_usage() {
|
|
334
|
rcstack_stack_usage() {
|
|
335
|
if [[ -n $long_usage ]]; then
|
|
335
|
if [[ -n $long_usage ]]; then
|
|
336
|
printf "rcstack stack - Run one of available cluster stacks, run stack -h for more details\n"
|
|
336
|
printf "rcstack stack - Run one of available cluster stacks, run stack -h for more details\n"
|
|
337
|
echo
|
|
337
|
echo
|
|
338
|
|
|
338
|
|
|
339
|
else
|
|
339
|
else
|
|
340
|
printf "rcstack stack - Run one of available cluster stacks, run stack -h for more details\n"
|
|
340
|
printf "rcstack stack - Run one of available cluster stacks, run stack -h for more details\n"
|
|
341
|
echo
|
|
341
|
echo
|
|
342
|
|
|
342
|
|
|
343
|
fi
|
|
343
|
fi
|
|
344
|
|
|
344
|
|
|
345
|
printf "%s\n" "Usage:"
|
|
345
|
printf "%s\n" "Usage:"
|
|
346
|
printf " rcstack stack [OPTIONS] COMMAND\n"
|
|
346
|
printf " rcstack stack [OPTIONS] COMMAND\n"
|
|
347
|
printf " rcstack stack [COMMAND] --help | -h\n"
|
|
347
|
printf " rcstack stack [COMMAND] --help | -h\n"
|
|
348
|
echo
|
|
348
|
echo
|
|
349
|
# :command.usage_commands
|
|
349
|
# :command.usage_commands
|
|
350
|
printf "%s\n" "Commands:"
|
|
350
|
printf "%s\n" "Commands:"
|
|
351
|
printf " %s execute commands for the router stack\n" "router "
|
|
351
|
printf " %s execute commands for the router stack\n" "router "
|
|
352
|
printf " %s execute commands for the router stack\n" "metrics "
|
|
352
|
printf " %s execute commands for the router stack\n" "metrics "
|
|
353
|
printf " %s execute commands for the router stack\n" "services "
|
|
353
|
printf " %s execute commands for the router stack\n" "services "
|
|
354
|
printf " %s execute commands for the router stack\n" "rhodecode"
|
|
354
|
printf " %s execute commands for the router stack\n" "rhodecode"
|
|
355
|
printf " %s execute commands for all stacks in order\n" "all "
|
|
355
|
printf " %s execute commands for all stacks in order\n" "all "
|
|
356
|
echo
|
|
356
|
echo
|
|
357
|
|
|
357
|
|
|
358
|
# :command.long_usage
|
|
358
|
# :command.long_usage
|
|
359
|
if [[ -n $long_usage ]]; then
|
|
359
|
if [[ -n $long_usage ]]; then
|
|
360
|
printf "%s\n" "Options:"
|
|
360
|
printf "%s\n" "Options:"
|
|
361
|
|
|
361
|
|
|
362
|
# :command.usage_flags
|
|
362
|
# :command.usage_flags
|
|
363
|
# :flag.usage
|
|
363
|
# :flag.usage
|
|
364
|
printf " %s\n" "--env-file-path ENV_FILE_PATH"
|
|
364
|
printf " %s\n" "--env-file-path ENV_FILE_PATH"
|
|
365
|
printf " Set custom env file\n"
|
|
365
|
printf " Set custom env file\n"
|
|
366
|
printf " Default: $PWD/.custom/.runtime.env\n"
|
|
366
|
printf " Default: $PWD/.custom/.runtime.env\n"
|
|
367
|
echo
|
|
367
|
echo
|
|
368
|
|
|
368
|
|
|
369
|
# :flag.usage
|
|
369
|
# :flag.usage
|
|
370
|
printf " %s\n" "--stack-prefix STACK_PREFIX"
|
|
370
|
printf " %s\n" "--stack-prefix STACK_PREFIX"
|
|
371
|
printf " Set custom stack prefix, e.g rc_cluster_apps_ci\n"
|
|
371
|
printf " Set custom stack prefix, e.g rc_cluster_apps_ci\n"
|
|
372
|
echo
|
|
372
|
echo
|
|
373
|
|
|
373
|
|
|
374
|
# :command.usage_fixed_flags
|
|
374
|
# :command.usage_fixed_flags
|
|
375
|
printf " %s\n" "--help, -h"
|
|
375
|
printf " %s\n" "--help, -h"
|
|
376
|
printf " Show this help\n"
|
|
376
|
printf " Show this help\n"
|
|
377
|
echo
|
|
377
|
echo
|
|
378
|
|
|
378
|
|
|
379
|
# :command.usage_examples
|
|
379
|
# :command.usage_examples
|
|
380
|
printf "%s\n" "Examples:"
|
|
380
|
printf "%s\n" "Examples:"
|
|
381
|
printf " # running stack\n - ./rcstack stack router up # run router stack with output to stdout\n - ./rcstack stack router up --detach # run router stack detached\n - ./rcstack stack router down # stop whole router stack\n - ./rcstack stack router ps # check status of router stack\n \n # logs, use logs -f to follow/tail --until 1h to limit for last time\n - ./rcstack stack services logs -f database\n \n # scale a single stack service[s] to more replicas (horizontally), use\n overrides files to permanently set scale\n - ./rcstack stack rhodecode up --detach --no-recreate --scale rhodecode=2\n --scale vcsserver=2\n \n # run router stack with your overrides compose file\n - ./rcstack stack router -f docker-overrides.yaml up -d\n \n # run command in the stack image\n - ./rcstack stack rhodecode run rhodecode bash\n"
|
|
381
|
printf " # running stack\n - ./rcstack stack router up # run router stack with output to stdout\n - ./rcstack stack router up --detach # run router stack detached\n - ./rcstack stack router down # stop whole router stack\n - ./rcstack stack router ps # check status of router stack\n \n # logs, use logs -f to follow/tail --until 1h to limit for last time\n - ./rcstack stack services logs -f database\n \n # scale a single stack service[s] to more replicas (horizontally), use\n overrides files to permanently set scale\n - ./rcstack stack rhodecode up --detach --no-recreate --scale rhodecode=2\n --scale vcsserver=2\n \n # run router stack with your overrides compose file\n - ./rcstack stack router -f docker-overrides.yaml up -d\n \n # run command in the stack image\n - ./rcstack stack rhodecode run rhodecode bash\n"
|
|
382
|
echo
|
|
382
|
echo
|
|
383
|
|
|
383
|
|
|
384
|
fi
|
|
384
|
fi
|
|
385
|
}
|
|
385
|
}
|
|
386
|
|
|
386
|
|
|
387
|
# :command.usage
|
|
387
|
# :command.usage
|
|
388
|
rcstack_stack_router_usage() {
|
|
388
|
rcstack_stack_router_usage() {
|
|
389
|
if [[ -n $long_usage ]]; then
|
|
389
|
if [[ -n $long_usage ]]; then
|
|
390
|
printf "rcstack stack router - execute commands for the router stack\n"
|
|
390
|
printf "rcstack stack router - execute commands for the router stack\n"
|
|
391
|
echo
|
|
391
|
echo
|
|
392
|
|
|
392
|
|
|
393
|
else
|
|
393
|
else
|
|
394
|
printf "rcstack stack router - execute commands for the router stack\n"
|
|
394
|
printf "rcstack stack router - execute commands for the router stack\n"
|
|
395
|
echo
|
|
395
|
echo
|
|
396
|
|
|
396
|
|
|
397
|
fi
|
|
397
|
fi
|
|
398
|
|
|
398
|
|
|
399
|
printf "%s\n" "Usage:"
|
|
399
|
printf "%s\n" "Usage:"
|
|
400
|
printf " rcstack stack router [SERVICES PARAMS...]\n"
|
|
400
|
printf " rcstack stack router [SERVICES PARAMS...]\n"
|
|
401
|
printf " rcstack stack router --help | -h\n"
|
|
401
|
printf " rcstack stack router --help | -h\n"
|
|
402
|
echo
|
|
402
|
echo
|
|
403
|
|
|
403
|
|
|
404
|
# :command.long_usage
|
|
404
|
# :command.long_usage
|
|
405
|
if [[ -n $long_usage ]]; then
|
|
405
|
if [[ -n $long_usage ]]; then
|
|
406
|
printf "%s\n" "Options:"
|
|
406
|
printf "%s\n" "Options:"
|
|
407
|
|
|
407
|
|
|
408
|
# :command.usage_fixed_flags
|
|
408
|
# :command.usage_fixed_flags
|
|
409
|
printf " %s\n" "--help, -h"
|
|
409
|
printf " %s\n" "--help, -h"
|
|
410
|
printf " Show this help\n"
|
|
410
|
printf " Show this help\n"
|
|
411
|
echo
|
|
411
|
echo
|
|
412
|
|
|
412
|
|
|
413
|
# :command.usage_args
|
|
413
|
# :command.usage_args
|
|
414
|
printf "%s\n" "Arguments:"
|
|
414
|
printf "%s\n" "Arguments:"
|
|
415
|
|
|
415
|
|
|
416
|
echo " SERVICES PARAMS..."
|
|
416
|
echo " SERVICES PARAMS..."
|
|
417
|
printf " Additional arguments or flags for services command\n"
|
|
417
|
printf " Additional arguments or flags for services command\n"
|
|
418
|
echo
|
|
418
|
echo
|
|
419
|
|
|
419
|
|
|
420
|
fi
|
|
420
|
fi
|
|
421
|
}
|
|
421
|
}
|
|
422
|
|
|
422
|
|
|
423
|
# :command.usage
|
|
423
|
# :command.usage
|
|
424
|
rcstack_stack_metrics_usage() {
|
|
424
|
rcstack_stack_metrics_usage() {
|
|
425
|
if [[ -n $long_usage ]]; then
|
|
425
|
if [[ -n $long_usage ]]; then
|
|
426
|
printf "rcstack stack metrics - execute commands for the router stack\n"
|
|
426
|
printf "rcstack stack metrics - execute commands for the router stack\n"
|
|
427
|
echo
|
|
427
|
echo
|
|
428
|
|
|
428
|
|
|
429
|
else
|
|
429
|
else
|
|
430
|
printf "rcstack stack metrics - execute commands for the router stack\n"
|
|
430
|
printf "rcstack stack metrics - execute commands for the router stack\n"
|
|
431
|
echo
|
|
431
|
echo
|
|
432
|
|
|
432
|
|
|
433
|
fi
|
|
433
|
fi
|
|
434
|
|
|
434
|
|
|
435
|
printf "%s\n" "Usage:"
|
|
435
|
printf "%s\n" "Usage:"
|
|
436
|
printf " rcstack stack metrics [SERVICES PARAMS...]\n"
|
|
436
|
printf " rcstack stack metrics [SERVICES PARAMS...]\n"
|
|
437
|
printf " rcstack stack metrics --help | -h\n"
|
|
437
|
printf " rcstack stack metrics --help | -h\n"
|
|
438
|
echo
|
|
438
|
echo
|
|
439
|
|
|
439
|
|
|
440
|
# :command.long_usage
|
|
440
|
# :command.long_usage
|
|
441
|
if [[ -n $long_usage ]]; then
|
|
441
|
if [[ -n $long_usage ]]; then
|
|
442
|
printf "%s\n" "Options:"
|
|
442
|
printf "%s\n" "Options:"
|
|
443
|
|
|
443
|
|
|
444
|
# :command.usage_fixed_flags
|
|
444
|
# :command.usage_fixed_flags
|
|
445
|
printf " %s\n" "--help, -h"
|
|
445
|
printf " %s\n" "--help, -h"
|
|
446
|
printf " Show this help\n"
|
|
446
|
printf " Show this help\n"
|
|
447
|
echo
|
|
447
|
echo
|
|
448
|
|
|
448
|
|
|
449
|
# :command.usage_args
|
|
449
|
# :command.usage_args
|
|
450
|
printf "%s\n" "Arguments:"
|
|
450
|
printf "%s\n" "Arguments:"
|
|
451
|
|
|
451
|
|
|
452
|
echo " SERVICES PARAMS..."
|
|
452
|
echo " SERVICES PARAMS..."
|
|
453
|
printf " Additional arguments or flags for services command\n"
|
|
453
|
printf " Additional arguments or flags for services command\n"
|
|
454
|
echo
|
|
454
|
echo
|
|
455
|
|
|
455
|
|
|
456
|
fi
|
|
456
|
fi
|
|
457
|
}
|
|
457
|
}
|
|
458
|
|
|
458
|
|
|
459
|
# :command.usage
|
|
459
|
# :command.usage
|
|
460
|
rcstack_stack_services_usage() {
|
|
460
|
rcstack_stack_services_usage() {
|
|
461
|
if [[ -n $long_usage ]]; then
|
|
461
|
if [[ -n $long_usage ]]; then
|
|
462
|
printf "rcstack stack services - execute commands for the router stack\n"
|
|
462
|
printf "rcstack stack services - execute commands for the router stack\n"
|
|
463
|
echo
|
|
463
|
echo
|
|
464
|
|
|
464
|
|
|
465
|
else
|
|
465
|
else
|
|
466
|
printf "rcstack stack services - execute commands for the router stack\n"
|
|
466
|
printf "rcstack stack services - execute commands for the router stack\n"
|
|
467
|
echo
|
|
467
|
echo
|
|
468
|
|
|
468
|
|
|
469
|
fi
|
|
469
|
fi
|
|
470
|
|
|
470
|
|
|
471
|
printf "%s\n" "Usage:"
|
|
471
|
printf "%s\n" "Usage:"
|
|
472
|
printf " rcstack stack services [SERVICES PARAMS...]\n"
|
|
472
|
printf " rcstack stack services [SERVICES PARAMS...]\n"
|
|
473
|
printf " rcstack stack services --help | -h\n"
|
|
473
|
printf " rcstack stack services --help | -h\n"
|
|
474
|
echo
|
|
474
|
echo
|
|
475
|
|
|
475
|
|
|
476
|
# :command.long_usage
|
|
476
|
# :command.long_usage
|
|
477
|
if [[ -n $long_usage ]]; then
|
|
477
|
if [[ -n $long_usage ]]; then
|
|
478
|
printf "%s\n" "Options:"
|
|
478
|
printf "%s\n" "Options:"
|
|
479
|
|
|
479
|
|
|
480
|
# :command.usage_fixed_flags
|
|
480
|
# :command.usage_fixed_flags
|
|
481
|
printf " %s\n" "--help, -h"
|
|
481
|
printf " %s\n" "--help, -h"
|
|
482
|
printf " Show this help\n"
|
|
482
|
printf " Show this help\n"
|
|
483
|
echo
|
|
483
|
echo
|
|
484
|
|
|
484
|
|
|
485
|
# :command.usage_args
|
|
485
|
# :command.usage_args
|
|
486
|
printf "%s\n" "Arguments:"
|
|
486
|
printf "%s\n" "Arguments:"
|
|
487
|
|
|
487
|
|
|
488
|
echo " SERVICES PARAMS..."
|
|
488
|
echo " SERVICES PARAMS..."
|
|
489
|
printf " Additional arguments or flags for services command\n"
|
|
489
|
printf " Additional arguments or flags for services command\n"
|
|
490
|
echo
|
|
490
|
echo
|
|
491
|
|
|
491
|
|
|
492
|
fi
|
|
492
|
fi
|
|
493
|
}
|
|
493
|
}
|
|
494
|
|
|
494
|
|
|
495
|
# :command.usage
|
|
495
|
# :command.usage
|
|
496
|
rcstack_stack_rhodecode_usage() {
|
|
496
|
rcstack_stack_rhodecode_usage() {
|
|
497
|
if [[ -n $long_usage ]]; then
|
|
497
|
if [[ -n $long_usage ]]; then
|
|
498
|
printf "rcstack stack rhodecode - execute commands for the router stack\n"
|
|
498
|
printf "rcstack stack rhodecode - execute commands for the router stack\n"
|
|
499
|
echo
|
|
499
|
echo
|
|
500
|
|
|
500
|
|
|
501
|
else
|
|
501
|
else
|
|
502
|
printf "rcstack stack rhodecode - execute commands for the router stack\n"
|
|
502
|
printf "rcstack stack rhodecode - execute commands for the router stack\n"
|
|
503
|
echo
|
|
503
|
echo
|
|
504
|
|
|
504
|
|
|
505
|
fi
|
|
505
|
fi
|
|
506
|
|
|
506
|
|
|
507
|
printf "%s\n" "Usage:"
|
|
507
|
printf "%s\n" "Usage:"
|
|
508
|
printf " rcstack stack rhodecode [SERVICES PARAMS...]\n"
|
|
508
|
printf " rcstack stack rhodecode [SERVICES PARAMS...]\n"
|
|
509
|
printf " rcstack stack rhodecode --help | -h\n"
|
|
509
|
printf " rcstack stack rhodecode --help | -h\n"
|
|
510
|
echo
|
|
510
|
echo
|
|
511
|
|
|
511
|
|
|
512
|
# :command.long_usage
|
|
512
|
# :command.long_usage
|
|
513
|
if [[ -n $long_usage ]]; then
|
|
513
|
if [[ -n $long_usage ]]; then
|
|
514
|
printf "%s\n" "Options:"
|
|
514
|
printf "%s\n" "Options:"
|
|
515
|
|
|
515
|
|
|
516
|
# :command.usage_fixed_flags
|
|
516
|
# :command.usage_fixed_flags
|
|
517
|
printf " %s\n" "--help, -h"
|
|
517
|
printf " %s\n" "--help, -h"
|
|
518
|
printf " Show this help\n"
|
|
518
|
printf " Show this help\n"
|
|
519
|
echo
|
|
519
|
echo
|
|
520
|
|
|
520
|
|
|
521
|
# :command.usage_args
|
|
521
|
# :command.usage_args
|
|
522
|
printf "%s\n" "Arguments:"
|
|
522
|
printf "%s\n" "Arguments:"
|
|
523
|
|
|
523
|
|
|
524
|
echo " SERVICES PARAMS..."
|
|
524
|
echo " SERVICES PARAMS..."
|
|
525
|
printf " Additional arguments or flags for services command\n"
|
|
525
|
printf " Additional arguments or flags for services command\n"
|
|
526
|
echo
|
|
526
|
echo
|
|
527
|
|
|
527
|
|
|
528
|
fi
|
|
528
|
fi
|
|
529
|
}
|
|
529
|
}
|
|
530
|
|
|
530
|
|
|
531
|
# :command.usage
|
|
531
|
# :command.usage
|
|
532
|
rcstack_stack_all_usage() {
|
|
532
|
rcstack_stack_all_usage() {
|
|
533
|
if [[ -n $long_usage ]]; then
|
|
533
|
if [[ -n $long_usage ]]; then
|
|
534
|
printf "rcstack stack all - execute commands for all stacks in order\n"
|
|
534
|
printf "rcstack stack all - execute commands for all stacks in order\n"
|
|
535
|
echo
|
|
535
|
echo
|
|
536
|
|
|
536
|
|
|
537
|
else
|
|
537
|
else
|
|
538
|
printf "rcstack stack all - execute commands for all stacks in order\n"
|
|
538
|
printf "rcstack stack all - execute commands for all stacks in order\n"
|
|
539
|
echo
|
|
539
|
echo
|
|
540
|
|
|
540
|
|
|
541
|
fi
|
|
541
|
fi
|
|
542
|
|
|
542
|
|
|
543
|
printf "%s\n" "Usage:"
|
|
543
|
printf "%s\n" "Usage:"
|
|
544
|
printf " rcstack stack all [SERVICES PARAMS...]\n"
|
|
544
|
printf " rcstack stack all [SERVICES PARAMS...]\n"
|
|
545
|
printf " rcstack stack all --help | -h\n"
|
|
545
|
printf " rcstack stack all --help | -h\n"
|
|
546
|
echo
|
|
546
|
echo
|
|
547
|
|
|
547
|
|
|
548
|
# :command.long_usage
|
|
548
|
# :command.long_usage
|
|
549
|
if [[ -n $long_usage ]]; then
|
|
549
|
if [[ -n $long_usage ]]; then
|
|
550
|
printf "%s\n" "Options:"
|
|
550
|
printf "%s\n" "Options:"
|
|
551
|
|
|
551
|
|
|
552
|
# :command.usage_fixed_flags
|
|
552
|
# :command.usage_fixed_flags
|
|
553
|
printf " %s\n" "--help, -h"
|
|
553
|
printf " %s\n" "--help, -h"
|
|
554
|
printf " Show this help\n"
|
|
554
|
printf " Show this help\n"
|
|
555
|
echo
|
|
555
|
echo
|
|
556
|
|
|
556
|
|
|
557
|
# :command.usage_args
|
|
557
|
# :command.usage_args
|
|
558
|
printf "%s\n" "Arguments:"
|
|
558
|
printf "%s\n" "Arguments:"
|
|
559
|
|
|
559
|
|
|
560
|
echo " SERVICES PARAMS..."
|
|
560
|
echo " SERVICES PARAMS..."
|
|
561
|
printf " Additional arguments or flags for services command\n"
|
|
561
|
printf " Additional arguments or flags for services command\n"
|
|
562
|
echo
|
|
562
|
echo
|
|
563
|
|
|
563
|
|
|
564
|
fi
|
|
564
|
fi
|
|
565
|
}
|
|
565
|
}
|
|
566
|
|
|
566
|
|
|
567
|
# :command.usage
|
|
567
|
# :command.usage
|
|
568
|
rcstack_stack_status_usage() {
|
|
568
|
rcstack_stack_status_usage() {
|
|
569
|
if [[ -n $long_usage ]]; then
|
|
569
|
if [[ -n $long_usage ]]; then
|
|
570
|
printf "rcstack stack-status - Show stack status\n"
|
|
570
|
printf "rcstack stack-status - Show stack status\n"
|
|
571
|
echo
|
|
571
|
echo
|
|
572
|
|
|
572
|
|
|
573
|
else
|
|
573
|
else
|
|
574
|
printf "rcstack stack-status - Show stack status\n"
|
|
574
|
printf "rcstack stack-status - Show stack status\n"
|
|
575
|
echo
|
|
575
|
echo
|
|
576
|
|
|
576
|
|
|
577
|
fi
|
|
577
|
fi
|
|
578
|
|
|
578
|
|
|
579
|
printf "Alias: status\n"
|
|
579
|
printf "Alias: status\n"
|
|
580
|
echo
|
|
580
|
echo
|
|
581
|
|
|
581
|
|
|
582
|
printf "%s\n" "Usage:"
|
|
582
|
printf "%s\n" "Usage:"
|
|
583
|
printf " rcstack stack-status [OPTIONS]\n"
|
|
583
|
printf " rcstack stack-status [OPTIONS]\n"
|
|
584
|
printf " rcstack stack-status --help | -h\n"
|
|
584
|
printf " rcstack stack-status --help | -h\n"
|
|
585
|
echo
|
|
585
|
echo
|
|
586
|
|
|
586
|
|
|
587
|
# :command.long_usage
|
|
587
|
# :command.long_usage
|
|
588
|
if [[ -n $long_usage ]]; then
|
|
588
|
if [[ -n $long_usage ]]; then
|
|
589
|
printf "%s\n" "Options:"
|
|
589
|
printf "%s\n" "Options:"
|
|
590
|
|
|
590
|
|
|
591
|
# :command.usage_flags
|
|
591
|
# :command.usage_flags
|
|
592
|
# :flag.usage
|
|
592
|
# :flag.usage
|
|
593
|
printf " %s\n" "--detailed"
|
|
593
|
printf " %s\n" "--detailed"
|
|
594
|
printf " Display a detailed format\n"
|
|
594
|
printf " Display a detailed format\n"
|
|
595
|
echo
|
|
595
|
echo
|
|
596
|
|
|
596
|
|
|
597
|
# :flag.usage
|
|
597
|
# :flag.usage
|
|
598
|
printf " %s\n" "--configs"
|
|
598
|
printf " %s\n" "--configs"
|
|
599
|
printf " Display a detailed info about configuration files\n"
|
|
599
|
printf " Display a detailed info about configuration files\n"
|
|
600
|
echo
|
|
600
|
echo
|
|
601
|
|
|
601
|
|
|
602
|
# :command.usage_fixed_flags
|
|
602
|
# :command.usage_fixed_flags
|
|
603
|
printf " %s\n" "--help, -h"
|
|
603
|
printf " %s\n" "--help, -h"
|
|
604
|
printf " Show this help\n"
|
|
604
|
printf " Show this help\n"
|
|
605
|
echo
|
|
605
|
echo
|
|
606
|
|
|
606
|
|
|
607
|
fi
|
|
607
|
fi
|
|
608
|
}
|
|
608
|
}
|
|
609
|
|
|
609
|
|
|
610
|
# :command.usage
|
|
610
|
# :command.usage
|
|
611
|
rcstack_stack_upgrade_usage() {
|
|
611
|
rcstack_stack_upgrade_usage() {
|
|
612
|
if [[ -n $long_usage ]]; then
|
|
612
|
if [[ -n $long_usage ]]; then
|
|
613
|
printf "rcstack stack-upgrade - Upgrade a stack, run stack-upgrade -h for more details\n"
|
|
613
|
printf "rcstack stack-upgrade - Upgrade a stack, run stack-upgrade -h for more details\n"
|
|
614
|
echo
|
|
614
|
echo
|
|
615
|
|
|
615
|
|
|
616
|
else
|
|
616
|
else
|
|
617
|
printf "rcstack stack-upgrade - Upgrade a stack, run stack-upgrade -h for more details\n"
|
|
617
|
printf "rcstack stack-upgrade - Upgrade a stack, run stack-upgrade -h for more details\n"
|
|
618
|
echo
|
|
618
|
echo
|
|
619
|
|
|
619
|
|
|
620
|
fi
|
|
620
|
fi
|
|
621
|
|
|
621
|
|
|
622
|
printf "%s\n" "Usage:"
|
|
622
|
printf "%s\n" "Usage:"
|
|
623
|
printf " rcstack stack-upgrade [OPTIONS] COMMAND\n"
|
|
623
|
printf " rcstack stack-upgrade [OPTIONS] COMMAND\n"
|
|
624
|
printf " rcstack stack-upgrade [COMMAND] --help | -h\n"
|
|
624
|
printf " rcstack stack-upgrade [COMMAND] --help | -h\n"
|
|
625
|
echo
|
|
625
|
echo
|
|
626
|
# :command.usage_commands
|
|
626
|
# :command.usage_commands
|
|
627
|
printf "%s\n" "Commands:"
|
|
627
|
printf "%s\n" "Commands:"
|
|
628
|
printf " %s upgrade the router stack\n" "router "
|
|
628
|
printf " %s upgrade the router stack\n" "router "
|
|
629
|
printf " %s run the router stack\n" "metrics "
|
|
629
|
printf " %s run the router stack\n" "metrics "
|
|
630
|
printf " %s run the router stack\n" "services "
|
|
630
|
printf " %s run the router stack\n" "services "
|
|
631
|
printf " %s run the router stack\n" "rhodecode"
|
|
631
|
printf " %s run the router stack\n" "rhodecode"
|
|
632
|
echo
|
|
632
|
echo
|
|
633
|
|
|
633
|
|
|
634
|
# :command.long_usage
|
|
634
|
# :command.long_usage
|
|
635
|
if [[ -n $long_usage ]]; then
|
|
635
|
if [[ -n $long_usage ]]; then
|
|
636
|
printf "%s\n" "Options:"
|
|
636
|
printf "%s\n" "Options:"
|
|
637
|
|
|
637
|
|
|
638
|
# :command.usage_flags
|
|
638
|
# :command.usage_flags
|
|
639
|
# :flag.usage
|
|
639
|
# :flag.usage
|
|
640
|
printf " %s\n" "--stack-prefix STACK_PREFIX"
|
|
640
|
printf " %s\n" "--stack-prefix STACK_PREFIX"
|
|
641
|
printf " Set custom stack prefix, e.g rc_cluster_apps_ci\n"
|
|
641
|
printf " Set custom stack prefix, e.g rc_cluster_apps_ci\n"
|
|
642
|
echo
|
|
642
|
echo
|
|
643
|
|
|
643
|
|
|
644
|
# :command.usage_fixed_flags
|
|
644
|
# :command.usage_fixed_flags
|
|
645
|
printf " %s\n" "--help, -h"
|
|
645
|
printf " %s\n" "--help, -h"
|
|
646
|
printf " Show this help\n"
|
|
646
|
printf " Show this help\n"
|
|
647
|
echo
|
|
647
|
echo
|
|
648
|
|
|
648
|
|
|
649
|
# :command.usage_examples
|
|
649
|
# :command.usage_examples
|
|
650
|
printf "%s\n" "Examples:"
|
|
650
|
printf "%s\n" "Examples:"
|
|
651
|
printf " # Upgrading stack\n - ./rcstack stack-upgrade router\n \n # RhodeCode stack upgrades with 0 downtime using container rotation\n - ./rcstack stack-upgrade rhodecode\n"
|
|
651
|
printf " # Upgrading stack\n - ./rcstack stack-upgrade router\n \n # RhodeCode stack upgrades with 0 downtime using container rotation\n - ./rcstack stack-upgrade rhodecode\n"
|
|
652
|
echo
|
|
652
|
echo
|
|
653
|
|
|
653
|
|
|
654
|
fi
|
|
654
|
fi
|
|
655
|
}
|
|
655
|
}
|
|
656
|
|
|
656
|
|
|
657
|
# :command.usage
|
|
657
|
# :command.usage
|
|
658
|
rcstack_stack_upgrade_router_usage() {
|
|
658
|
rcstack_stack_upgrade_router_usage() {
|
|
659
|
if [[ -n $long_usage ]]; then
|
|
659
|
if [[ -n $long_usage ]]; then
|
|
660
|
printf "rcstack stack-upgrade router - upgrade the router stack\n"
|
|
660
|
printf "rcstack stack-upgrade router - upgrade the router stack\n"
|
|
661
|
echo
|
|
661
|
echo
|
|
662
|
|
|
662
|
|
|
663
|
else
|
|
663
|
else
|
|
664
|
printf "rcstack stack-upgrade router - upgrade the router stack\n"
|
|
664
|
printf "rcstack stack-upgrade router - upgrade the router stack\n"
|
|
665
|
echo
|
|
665
|
echo
|
|
666
|
|
|
666
|
|
|
667
|
fi
|
|
667
|
fi
|
|
668
|
|
|
668
|
|
|
669
|
printf "%s\n" "Usage:"
|
|
669
|
printf "%s\n" "Usage:"
|
|
670
|
printf " rcstack stack-upgrade router\n"
|
|
670
|
printf " rcstack stack-upgrade router\n"
|
|
671
|
printf " rcstack stack-upgrade router --help | -h\n"
|
|
671
|
printf " rcstack stack-upgrade router --help | -h\n"
|
|
672
|
echo
|
|
672
|
echo
|
|
673
|
|
|
673
|
|
|
674
|
# :command.long_usage
|
|
674
|
# :command.long_usage
|
|
675
|
if [[ -n $long_usage ]]; then
|
|
675
|
if [[ -n $long_usage ]]; then
|
|
676
|
printf "%s\n" "Options:"
|
|
676
|
printf "%s\n" "Options:"
|
|
677
|
|
|
677
|
|
|
678
|
# :command.usage_fixed_flags
|
|
678
|
# :command.usage_fixed_flags
|
|
679
|
printf " %s\n" "--help, -h"
|
|
679
|
printf " %s\n" "--help, -h"
|
|
680
|
printf " Show this help\n"
|
|
680
|
printf " Show this help\n"
|
|
681
|
echo
|
|
681
|
echo
|
|
682
|
|
|
682
|
|
|
683
|
fi
|
|
683
|
fi
|
|
684
|
}
|
|
684
|
}
|
|
685
|
|
|
685
|
|
|
686
|
# :command.usage
|
|
686
|
# :command.usage
|
|
687
|
rcstack_stack_upgrade_metrics_usage() {
|
|
687
|
rcstack_stack_upgrade_metrics_usage() {
|
|
688
|
if [[ -n $long_usage ]]; then
|
|
688
|
if [[ -n $long_usage ]]; then
|
|
689
|
printf "rcstack stack-upgrade metrics - run the router stack\n"
|
|
689
|
printf "rcstack stack-upgrade metrics - run the router stack\n"
|
|
690
|
echo
|
|
690
|
echo
|
|
691
|
|
|
691
|
|
|
692
|
else
|
|
692
|
else
|
|
693
|
printf "rcstack stack-upgrade metrics - run the router stack\n"
|
|
693
|
printf "rcstack stack-upgrade metrics - run the router stack\n"
|
|
694
|
echo
|
|
694
|
echo
|
|
695
|
|
|
695
|
|
|
696
|
fi
|
|
696
|
fi
|
|
697
|
|
|
697
|
|
|
698
|
printf "%s\n" "Usage:"
|
|
698
|
printf "%s\n" "Usage:"
|
|
699
|
printf " rcstack stack-upgrade metrics\n"
|
|
699
|
printf " rcstack stack-upgrade metrics\n"
|
|
700
|
printf " rcstack stack-upgrade metrics --help | -h\n"
|
|
700
|
printf " rcstack stack-upgrade metrics --help | -h\n"
|
|
701
|
echo
|
|
701
|
echo
|
|
702
|
|
|
702
|
|
|
703
|
# :command.long_usage
|
|
703
|
# :command.long_usage
|
|
704
|
if [[ -n $long_usage ]]; then
|
|
704
|
if [[ -n $long_usage ]]; then
|
|
705
|
printf "%s\n" "Options:"
|
|
705
|
printf "%s\n" "Options:"
|
|
706
|
|
|
706
|
|
|
707
|
# :command.usage_fixed_flags
|
|
707
|
# :command.usage_fixed_flags
|
|
708
|
printf " %s\n" "--help, -h"
|
|
708
|
printf " %s\n" "--help, -h"
|
|
709
|
printf " Show this help\n"
|
|
709
|
printf " Show this help\n"
|
|
710
|
echo
|
|
710
|
echo
|
|
711
|
|
|
711
|
|
|
712
|
fi
|
|
712
|
fi
|
|
713
|
}
|
|
713
|
}
|
|
714
|
|
|
714
|
|
|
715
|
# :command.usage
|
|
715
|
# :command.usage
|
|
716
|
rcstack_stack_upgrade_services_usage() {
|
|
716
|
rcstack_stack_upgrade_services_usage() {
|
|
717
|
if [[ -n $long_usage ]]; then
|
|
717
|
if [[ -n $long_usage ]]; then
|
|
718
|
printf "rcstack stack-upgrade services - run the router stack\n"
|
|
718
|
printf "rcstack stack-upgrade services - run the router stack\n"
|
|
719
|
echo
|
|
719
|
echo
|
|
720
|
|
|
720
|
|
|
721
|
else
|
|
721
|
else
|
|
722
|
printf "rcstack stack-upgrade services - run the router stack\n"
|
|
722
|
printf "rcstack stack-upgrade services - run the router stack\n"
|
|
723
|
echo
|
|
723
|
echo
|
|
724
|
|
|
724
|
|
|
725
|
fi
|
|
725
|
fi
|
|
726
|
|
|
726
|
|
|
727
|
printf "%s\n" "Usage:"
|
|
727
|
printf "%s\n" "Usage:"
|
|
728
|
printf " rcstack stack-upgrade services\n"
|
|
728
|
printf " rcstack stack-upgrade services\n"
|
|
729
|
printf " rcstack stack-upgrade services --help | -h\n"
|
|
729
|
printf " rcstack stack-upgrade services --help | -h\n"
|
|
730
|
echo
|
|
730
|
echo
|
|
731
|
|
|
731
|
|
|
732
|
# :command.long_usage
|
|
732
|
# :command.long_usage
|
|
733
|
if [[ -n $long_usage ]]; then
|
|
733
|
if [[ -n $long_usage ]]; then
|
|
734
|
printf "%s\n" "Options:"
|
|
734
|
printf "%s\n" "Options:"
|
|
735
|
|
|
735
|
|
|
736
|
# :command.usage_fixed_flags
|
|
736
|
# :command.usage_fixed_flags
|
|
737
|
printf " %s\n" "--help, -h"
|
|
737
|
printf " %s\n" "--help, -h"
|
|
738
|
printf " Show this help\n"
|
|
738
|
printf " Show this help\n"
|
|
739
|
echo
|
|
739
|
echo
|
|
740
|
|
|
740
|
|
|
741
|
fi
|
|
741
|
fi
|
|
742
|
}
|
|
742
|
}
|
|
743
|
|
|
743
|
|
|
744
|
# :command.usage
|
|
744
|
# :command.usage
|
|
745
|
rcstack_stack_upgrade_rhodecode_usage() {
|
|
745
|
rcstack_stack_upgrade_rhodecode_usage() {
|
|
746
|
if [[ -n $long_usage ]]; then
|
|
746
|
if [[ -n $long_usage ]]; then
|
|
747
|
printf "rcstack stack-upgrade rhodecode - run the router stack\n"
|
|
747
|
printf "rcstack stack-upgrade rhodecode - run the router stack\n"
|
|
748
|
echo
|
|
748
|
echo
|
|
749
|
|
|
749
|
|
|
750
|
else
|
|
750
|
else
|
|
751
|
printf "rcstack stack-upgrade rhodecode - run the router stack\n"
|
|
751
|
printf "rcstack stack-upgrade rhodecode - run the router stack\n"
|
|
752
|
echo
|
|
752
|
echo
|
|
753
|
|
|
753
|
|
|
754
|
fi
|
|
754
|
fi
|
|
755
|
|
|
755
|
|
|
756
|
printf "%s\n" "Usage:"
|
|
756
|
printf "%s\n" "Usage:"
|
|
757
|
printf " rcstack stack-upgrade rhodecode [OPTIONS]\n"
|
|
757
|
printf " rcstack stack-upgrade rhodecode [OPTIONS]\n"
|
|
758
|
printf " rcstack stack-upgrade rhodecode --help | -h\n"
|
|
758
|
printf " rcstack stack-upgrade rhodecode --help | -h\n"
|
|
759
|
echo
|
|
759
|
echo
|
|
760
|
|
|
760
|
|
|
761
|
# :command.long_usage
|
|
761
|
# :command.long_usage
|
|
762
|
if [[ -n $long_usage ]]; then
|
|
762
|
if [[ -n $long_usage ]]; then
|
|
763
|
printf "%s\n" "Options:"
|
|
763
|
printf "%s\n" "Options:"
|
|
764
|
|
|
764
|
|
|
765
|
# :command.usage_flags
|
|
765
|
# :command.usage_flags
|
|
766
|
# :flag.usage
|
|
766
|
# :flag.usage
|
|
767
|
printf " %s\n" "--stop-wait STOP_WAIT"
|
|
767
|
printf " %s\n" "--stop-wait STOP_WAIT"
|
|
768
|
printf " Number of seconds to wait for stopping old containers, use low value to\n quickly restart and recycle containers\n"
|
|
768
|
printf " Number of seconds to wait for stopping old containers, use low value to\n quickly restart and recycle containers\n"
|
|
769
|
printf " Default: 120\n"
|
|
769
|
printf " Default: 120\n"
|
|
770
|
echo
|
|
770
|
echo
|
|
771
|
|
|
771
|
|
|
772
|
# :flag.usage
|
|
772
|
# :flag.usage
|
|
773
|
printf " %s\n" "--docker-stop-wait DOCKER_STOP_WAIT"
|
|
773
|
printf " %s\n" "--docker-stop-wait DOCKER_STOP_WAIT"
|
|
774
|
printf " Number of seconds to pass to docker stop command that will wait for\n container to gracefull stop\n"
|
|
774
|
printf " Number of seconds to pass to docker stop command that will wait for\n container to gracefull stop\n"
|
|
775
|
printf " Default: 3600\n"
|
|
775
|
printf " Default: 3600\n"
|
|
776
|
echo
|
|
776
|
echo
|
|
777
|
|
|
777
|
|
|
778
|
# :command.usage_fixed_flags
|
|
778
|
# :command.usage_fixed_flags
|
|
779
|
printf " %s\n" "--help, -h"
|
|
779
|
printf " %s\n" "--help, -h"
|
|
780
|
printf " Show this help\n"
|
|
780
|
printf " Show this help\n"
|
|
781
|
echo
|
|
781
|
echo
|
|
782
|
|
|
782
|
|
|
783
|
fi
|
|
783
|
fi
|
|
784
|
}
|
|
784
|
}
|
|
785
|
|
|
785
|
|
|
786
|
# :command.usage
|
|
786
|
# :command.usage
|
|
787
|
rcstack_stack_monitor_usage() {
|
|
787
|
rcstack_stack_monitor_usage() {
|
|
788
|
if [[ -n $long_usage ]]; then
|
|
788
|
if [[ -n $long_usage ]]; then
|
|
789
|
printf "rcstack stack-monitor - run monitoring on stack items\n"
|
|
789
|
printf "rcstack stack-monitor - run monitoring on stack items\n"
|
|
790
|
echo
|
|
790
|
echo
|
|
791
|
|
|
791
|
|
|
792
|
else
|
|
792
|
else
|
|
793
|
printf "rcstack stack-monitor - run monitoring on stack items\n"
|
|
793
|
printf "rcstack stack-monitor - run monitoring on stack items\n"
|
|
794
|
echo
|
|
794
|
echo
|
|
795
|
|
|
795
|
|
|
796
|
fi
|
|
796
|
fi
|
|
797
|
|
|
797
|
|
|
798
|
printf "%s\n" "Usage:"
|
|
798
|
printf "%s\n" "Usage:"
|
|
799
|
printf " rcstack stack-monitor COMMAND\n"
|
|
799
|
printf " rcstack stack-monitor COMMAND\n"
|
|
800
|
printf " rcstack stack-monitor [COMMAND] --help | -h\n"
|
|
800
|
printf " rcstack stack-monitor [COMMAND] --help | -h\n"
|
|
801
|
echo
|
|
801
|
echo
|
|
802
|
# :command.usage_commands
|
|
802
|
# :command.usage_commands
|
|
803
|
printf "%s\n" "Stack Commands:"
|
|
803
|
printf "%s\n" "Stack Commands:"
|
|
804
|
printf " %s monitor stack containers that are unhealthy and restart them\n" "restart-unhealthy"
|
|
804
|
printf " %s monitor stack containers that are unhealthy and restart them\n" "restart-unhealthy"
|
|
805
|
echo
|
|
805
|
echo
|
|
806
|
|
|
806
|
|
|
807
|
# :command.long_usage
|
|
807
|
# :command.long_usage
|
|
808
|
if [[ -n $long_usage ]]; then
|
|
808
|
if [[ -n $long_usage ]]; then
|
|
809
|
printf "%s\n" "Options:"
|
|
809
|
printf "%s\n" "Options:"
|
|
810
|
|
|
810
|
|
|
811
|
# :command.usage_fixed_flags
|
|
811
|
# :command.usage_fixed_flags
|
|
812
|
printf " %s\n" "--help, -h"
|
|
812
|
printf " %s\n" "--help, -h"
|
|
813
|
printf " Show this help\n"
|
|
813
|
printf " Show this help\n"
|
|
814
|
echo
|
|
814
|
echo
|
|
815
|
|
|
815
|
|
|
816
|
fi
|
|
816
|
fi
|
|
817
|
}
|
|
817
|
}
|
|
818
|
|
|
818
|
|
|
819
|
# :command.usage
|
|
819
|
# :command.usage
|
|
820
|
rcstack_stack_monitor_restart_unhealthy_usage() {
|
|
820
|
rcstack_stack_monitor_restart_unhealthy_usage() {
|
|
821
|
if [[ -n $long_usage ]]; then
|
|
821
|
if [[ -n $long_usage ]]; then
|
|
822
|
printf "rcstack stack-monitor restart-unhealthy - monitor stack containers that are unhealthy and restart them\n"
|
|
822
|
printf "rcstack stack-monitor restart-unhealthy - monitor stack containers that are unhealthy and restart them\n"
|
|
823
|
echo
|
|
823
|
echo
|
|
824
|
|
|
824
|
|
|
825
|
else
|
|
825
|
else
|
|
826
|
printf "rcstack stack-monitor restart-unhealthy - monitor stack containers that are unhealthy and restart them\n"
|
|
826
|
printf "rcstack stack-monitor restart-unhealthy - monitor stack containers that are unhealthy and restart them\n"
|
|
827
|
echo
|
|
827
|
echo
|
|
828
|
|
|
828
|
|
|
829
|
fi
|
|
829
|
fi
|
|
830
|
|
|
830
|
|
|
831
|
printf "%s\n" "Usage:"
|
|
831
|
printf "%s\n" "Usage:"
|
|
832
|
printf " rcstack stack-monitor restart-unhealthy [OPTIONS]\n"
|
|
832
|
printf " rcstack stack-monitor restart-unhealthy [OPTIONS]\n"
|
|
833
|
printf " rcstack stack-monitor restart-unhealthy --help | -h\n"
|
|
833
|
printf " rcstack stack-monitor restart-unhealthy --help | -h\n"
|
|
834
|
echo
|
|
834
|
echo
|
|
835
|
|
|
835
|
|
|
836
|
# :command.long_usage
|
|
836
|
# :command.long_usage
|
|
837
|
if [[ -n $long_usage ]]; then
|
|
837
|
if [[ -n $long_usage ]]; then
|
|
838
|
printf "%s\n" "Options:"
|
|
838
|
printf "%s\n" "Options:"
|
|
839
|
|
|
839
|
|
|
840
|
# :command.usage_flags
|
|
840
|
# :command.usage_flags
|
|
841
|
# :flag.usage
|
|
841
|
# :flag.usage
|
|
842
|
printf " %s\n" "--loop LOOP"
|
|
842
|
printf " %s\n" "--loop LOOP"
|
|
843
|
printf " run in a loop to monitor continously every N seconds\n"
|
|
843
|
printf " run in a loop to monitor continously every N seconds\n"
|
|
844
|
printf " Default: 0\n"
|
|
844
|
printf " Default: 0\n"
|
|
845
|
echo
|
|
845
|
echo
|
|
846
|
|
|
846
|
|
|
847
|
# :command.usage_fixed_flags
|
|
847
|
# :command.usage_fixed_flags
|
|
848
|
printf " %s\n" "--help, -h"
|
|
848
|
printf " %s\n" "--help, -h"
|
|
849
|
printf " Show this help\n"
|
|
849
|
printf " Show this help\n"
|
|
850
|
echo
|
|
850
|
echo
|
|
851
|
|
|
851
|
|
|
852
|
# :command.usage_examples
|
|
852
|
# :command.usage_examples
|
|
853
|
printf "%s\n" "Examples:"
|
|
853
|
printf "%s\n" "Examples:"
|
|
854
|
printf " # check and restart for unhealthy containers\n ./rcstack restart-unhealthy\n \n # check and restart for unhealthy containers, and continue in a loop every 5\n minutes (300s)\n ./rcstack restart-unhealthy --loop=300\n \n # run this script in background with logs\n nohup ./rcstack restart-unhealthy --loop=300 > unhealthy-checks.log &\n"
|
|
854
|
printf " # check and restart for unhealthy containers\n ./rcstack restart-unhealthy\n \n # check and restart for unhealthy containers, and continue in a loop every 5\n minutes (300s)\n ./rcstack restart-unhealthy --loop=300\n \n # run this script in background with logs\n nohup ./rcstack restart-unhealthy --loop=300 > unhealthy-checks.log &\n"
|
|
855
|
echo
|
|
855
|
echo
|
|
856
|
|
|
856
|
|
|
857
|
fi
|
|
857
|
fi
|
|
858
|
}
|
|
858
|
}
|
|
859
|
|
|
859
|
|
|
860
|
# :command.usage
|
|
860
|
# :command.usage
|
|
861
|
rcstack_cli_usage() {
|
|
861
|
rcstack_cli_usage() {
|
|
862
|
if [[ -n $long_usage ]]; then
|
|
862
|
if [[ -n $long_usage ]]; then
|
|
863
|
printf "rcstack cli - Various CLI tools, run cli -h for more details\n"
|
|
863
|
printf "rcstack cli - Various CLI tools, run cli -h for more details\n"
|
|
864
|
echo
|
|
864
|
echo
|
|
865
|
|
|
865
|
|
|
866
|
else
|
|
866
|
else
|
|
867
|
printf "rcstack cli - Various CLI tools, run cli -h for more details\n"
|
|
867
|
printf "rcstack cli - Various CLI tools, run cli -h for more details\n"
|
|
868
|
echo
|
|
868
|
echo
|
|
869
|
|
|
869
|
|
|
870
|
fi
|
|
870
|
fi
|
|
871
|
|
|
871
|
|
|
872
|
printf "%s\n" "Usage:"
|
|
872
|
printf "%s\n" "Usage:"
|
|
873
|
printf " rcstack cli COMMAND\n"
|
|
873
|
printf " rcstack cli COMMAND\n"
|
|
874
|
printf " rcstack cli [COMMAND] --help | -h\n"
|
|
874
|
printf " rcstack cli [COMMAND] --help | -h\n"
|
|
875
|
echo
|
|
875
|
echo
|
|
876
|
# :command.usage_commands
|
|
876
|
# :command.usage_commands
|
|
877
|
printf "%s\n" "Commands:"
|
|
877
|
printf "%s\n" "Commands:"
|
|
878
|
printf " %s print out stored docker image version\n" "image-info "
|
|
878
|
printf " %s print out stored docker image version\n" "image-info "
|
|
879
|
printf " %s set version to .runtime.env file\n" "set-runtime-image "
|
|
879
|
printf " %s set version to .runtime.env file\n" "set-runtime-image "
|
|
880
|
printf " %s Ishell attached to running RhodeCode instance\n" "ishell "
|
|
880
|
printf " %s Ishell attached to running RhodeCode instance\n" "ishell "
|
|
881
|
printf " %s CLI for Redis\n" "redis "
|
|
881
|
printf " %s CLI for Redis\n" "redis "
|
|
882
|
printf " %s CLI with Database connection\n" "db "
|
|
882
|
printf " %s CLI with Database connection\n" "db "
|
|
883
|
printf " %s CLI to run db upgrade\n" "db-upgrade "
|
|
883
|
printf " %s CLI to run db upgrade\n" "db-upgrade "
|
|
884
|
printf " %s CLI for repository storage. Exposes a basic image with mounted data and repositories volumes or attach to currently running containers storage\n" "storage "
|
|
884
|
printf " %s CLI for repository storage. Exposes a basic image with mounted data and repositories volumes or attach to currently running containers storage\n" "storage "
|
|
885
|
printf " %s attach to running instance of RhodeCode, by default it attaches to rhodecode main web app\n" "attach "
|
|
885
|
printf " %s attach to running instance of RhodeCode, by default it attaches to rhodecode main web app\n" "attach "
|
|
886
|
printf " %s set current setup to either CE (Community) or EE (Enterprise) type\n" "set-edition "
|
|
886
|
printf " %s set current setup to either CE (Community) or EE (Enterprise) type\n" "set-edition "
|
|
887
|
printf " %s reconfigure the vcsserver.ini file\n" "configure-vcsserver"
|
|
887
|
printf " %s reconfigure the vcsserver.ini file\n" "configure-vcsserver"
|
|
888
|
printf " %s reconfigure the rhodecode.ini file\n" "configure-rhodecode"
|
|
888
|
printf " %s reconfigure the rhodecode.ini file\n" "configure-rhodecode"
|
|
889
|
echo
|
|
889
|
echo
|
|
890
|
|
|
890
|
|
|
891
|
# :command.long_usage
|
|
891
|
# :command.long_usage
|
|
892
|
if [[ -n $long_usage ]]; then
|
|
892
|
if [[ -n $long_usage ]]; then
|
|
893
|
printf "%s\n" "Options:"
|
|
893
|
printf "%s\n" "Options:"
|
|
894
|
|
|
894
|
|
|
895
|
# :command.usage_fixed_flags
|
|
895
|
# :command.usage_fixed_flags
|
|
896
|
printf " %s\n" "--help, -h"
|
|
896
|
printf " %s\n" "--help, -h"
|
|
897
|
printf " Show this help\n"
|
|
897
|
printf " Show this help\n"
|
|
898
|
echo
|
|
898
|
echo
|
|
899
|
|
|
899
|
|
|
900
|
fi
|
|
900
|
fi
|
|
901
|
}
|
|
901
|
}
|
|
902
|
|
|
902
|
|
|
903
|
# :command.usage
|
|
903
|
# :command.usage
|
|
904
|
rcstack_cli_image_info_usage() {
|
|
904
|
rcstack_cli_image_info_usage() {
|
|
905
|
if [[ -n $long_usage ]]; then
|
|
905
|
if [[ -n $long_usage ]]; then
|
|
906
|
printf "rcstack cli image-info - print out stored docker image version\n"
|
|
906
|
printf "rcstack cli image-info - print out stored docker image version\n"
|
|
907
|
echo
|
|
907
|
echo
|
|
908
|
|
|
908
|
|
|
909
|
else
|
|
909
|
else
|
|
910
|
printf "rcstack cli image-info - print out stored docker image version\n"
|
|
910
|
printf "rcstack cli image-info - print out stored docker image version\n"
|
|
911
|
echo
|
|
911
|
echo
|
|
912
|
|
|
912
|
|
|
913
|
fi
|
|
913
|
fi
|
|
914
|
|
|
914
|
|
|
915
|
printf "%s\n" "Usage:"
|
|
915
|
printf "%s\n" "Usage:"
|
|
916
|
printf " rcstack cli image-info [OPTIONS]\n"
|
|
916
|
printf " rcstack cli image-info [OPTIONS]\n"
|
|
917
|
printf " rcstack cli image-info --help | -h\n"
|
|
917
|
printf " rcstack cli image-info --help | -h\n"
|
|
918
|
echo
|
|
918
|
echo
|
|
919
|
|
|
919
|
|
|
920
|
# :command.long_usage
|
|
920
|
# :command.long_usage
|
|
921
|
if [[ -n $long_usage ]]; then
|
|
921
|
if [[ -n $long_usage ]]; then
|
|
922
|
printf "%s\n" "Options:"
|
|
922
|
printf "%s\n" "Options:"
|
|
923
|
|
|
923
|
|
|
924
|
# :command.usage_flags
|
|
924
|
# :command.usage_flags
|
|
925
|
# :flag.usage
|
|
925
|
# :flag.usage
|
|
926
|
printf " %s\n" "--verbose"
|
|
926
|
printf " %s\n" "--verbose"
|
|
927
|
printf " rich output about image\n"
|
|
927
|
printf " rich output about image\n"
|
|
928
|
echo
|
|
928
|
echo
|
|
929
|
|
|
929
|
|
|
930
|
# :command.usage_fixed_flags
|
|
930
|
# :command.usage_fixed_flags
|
|
931
|
printf " %s\n" "--help, -h"
|
|
931
|
printf " %s\n" "--help, -h"
|
|
932
|
printf " Show this help\n"
|
|
932
|
printf " Show this help\n"
|
|
933
|
echo
|
|
933
|
echo
|
|
934
|
|
|
934
|
|
|
935
|
fi
|
|
935
|
fi
|
|
936
|
}
|
|
936
|
}
|
|
937
|
|
|
937
|
|
|
938
|
# :command.usage
|
|
938
|
# :command.usage
|
|
939
|
rcstack_cli_set_runtime_image_usage() {
|
|
939
|
rcstack_cli_set_runtime_image_usage() {
|
|
940
|
if [[ -n $long_usage ]]; then
|
|
940
|
if [[ -n $long_usage ]]; then
|
|
941
|
printf "rcstack cli set-runtime-image - set version to .runtime.env file\n"
|
|
941
|
printf "rcstack cli set-runtime-image - set version to .runtime.env file\n"
|
|
942
|
echo
|
|
942
|
echo
|
|
943
|
|
|
943
|
|
|
944
|
else
|
|
944
|
else
|
|
945
|
printf "rcstack cli set-runtime-image - set version to .runtime.env file\n"
|
|
945
|
printf "rcstack cli set-runtime-image - set version to .runtime.env file\n"
|
|
946
|
echo
|
|
946
|
echo
|
|
947
|
|
|
947
|
|
|
948
|
fi
|
|
948
|
fi
|
|
949
|
|
|
949
|
|
|
950
|
printf "%s\n" "Usage:"
|
|
950
|
printf "%s\n" "Usage:"
|
|
951
|
printf " rcstack cli set-runtime-image VERSION\n"
|
|
951
|
printf " rcstack cli set-runtime-image VERSION\n"
|
|
952
|
printf " rcstack cli set-runtime-image --help | -h\n"
|
|
952
|
printf " rcstack cli set-runtime-image --help | -h\n"
|
|
953
|
echo
|
|
953
|
echo
|
|
954
|
|
|
954
|
|
|
955
|
# :command.long_usage
|
|
955
|
# :command.long_usage
|
|
956
|
if [[ -n $long_usage ]]; then
|
|
956
|
if [[ -n $long_usage ]]; then
|
|
957
|
printf "%s\n" "Options:"
|
|
957
|
printf "%s\n" "Options:"
|
|
958
|
|
|
958
|
|
|
959
|
# :command.usage_fixed_flags
|
|
959
|
# :command.usage_fixed_flags
|
|
960
|
printf " %s\n" "--help, -h"
|
|
960
|
printf " %s\n" "--help, -h"
|
|
961
|
printf " Show this help\n"
|
|
961
|
printf " Show this help\n"
|
|
962
|
echo
|
|
962
|
echo
|
|
963
|
|
|
963
|
|
|
964
|
# :command.usage_args
|
|
964
|
# :command.usage_args
|
|
965
|
printf "%s\n" "Arguments:"
|
|
965
|
printf "%s\n" "Arguments:"
|
|
966
|
|
|
966
|
|
|
967
|
# :argument.usage
|
|
967
|
# :argument.usage
|
|
968
|
printf " %s\n" "VERSION"
|
|
968
|
printf " %s\n" "VERSION"
|
|
969
|
printf " Version of docker image to set e.g '5.0.0'\n"
|
|
969
|
printf " Version of docker image to set e.g '5.0.0'\n"
|
|
970
|
echo
|
|
970
|
echo
|
|
971
|
|
|
971
|
|
|
972
|
fi
|
|
972
|
fi
|
|
973
|
}
|
|
973
|
}
|
|
974
|
|
|
974
|
|
|
975
|
# :command.usage
|
|
975
|
# :command.usage
|
|
976
|
rcstack_cli_ishell_usage() {
|
|
976
|
rcstack_cli_ishell_usage() {
|
|
977
|
if [[ -n $long_usage ]]; then
|
|
977
|
if [[ -n $long_usage ]]; then
|
|
978
|
printf "rcstack cli ishell - Ishell attached to running RhodeCode instance\n"
|
|
978
|
printf "rcstack cli ishell - Ishell attached to running RhodeCode instance\n"
|
|
979
|
echo
|
|
979
|
echo
|
|
980
|
|
|
980
|
|
|
981
|
else
|
|
981
|
else
|
|
982
|
printf "rcstack cli ishell - Ishell attached to running RhodeCode instance\n"
|
|
982
|
printf "rcstack cli ishell - Ishell attached to running RhodeCode instance\n"
|
|
983
|
echo
|
|
983
|
echo
|
|
984
|
|
|
984
|
|
|
985
|
fi
|
|
985
|
fi
|
|
986
|
|
|
986
|
|
|
987
|
printf "%s\n" "Usage:"
|
|
987
|
printf "%s\n" "Usage:"
|
|
988
|
printf " rcstack cli ishell\n"
|
|
988
|
printf " rcstack cli ishell\n"
|
|
989
|
printf " rcstack cli ishell --help | -h\n"
|
|
989
|
printf " rcstack cli ishell --help | -h\n"
|
|
990
|
echo
|
|
990
|
echo
|
|
991
|
|
|
991
|
|
|
992
|
# :command.long_usage
|
|
992
|
# :command.long_usage
|
|
993
|
if [[ -n $long_usage ]]; then
|
|
993
|
if [[ -n $long_usage ]]; then
|
|
994
|
printf "%s\n" "Options:"
|
|
994
|
printf "%s\n" "Options:"
|
|
995
|
|
|
995
|
|
|
996
|
# :command.usage_fixed_flags
|
|
996
|
# :command.usage_fixed_flags
|
|
997
|
printf " %s\n" "--help, -h"
|
|
997
|
printf " %s\n" "--help, -h"
|
|
998
|
printf " Show this help\n"
|
|
998
|
printf " Show this help\n"
|
|
999
|
echo
|
|
999
|
echo
|
|
1000
|
|
|
1000
|
|
|
1001
|
fi
|
|
1001
|
fi
|
|
1002
|
}
|
|
1002
|
}
|
|
1003
|
|
|
1003
|
|
|
1004
|
# :command.usage
|
|
1004
|
# :command.usage
|
|
1005
|
rcstack_cli_redis_usage() {
|
|
1005
|
rcstack_cli_redis_usage() {
|
|
1006
|
if [[ -n $long_usage ]]; then
|
|
1006
|
if [[ -n $long_usage ]]; then
|
|
1007
|
printf "rcstack cli redis - CLI for Redis\n"
|
|
1007
|
printf "rcstack cli redis - CLI for Redis\n"
|
|
1008
|
echo
|
|
1008
|
echo
|
|
1009
|
|
|
1009
|
|
|
1010
|
else
|
|
1010
|
else
|
|
1011
|
printf "rcstack cli redis - CLI for Redis\n"
|
|
1011
|
printf "rcstack cli redis - CLI for Redis\n"
|
|
1012
|
echo
|
|
1012
|
echo
|
|
1013
|
|
|
1013
|
|
|
1014
|
fi
|
|
1014
|
fi
|
|
1015
|
|
|
1015
|
|
|
1016
|
printf "%s\n" "Usage:"
|
|
1016
|
printf "%s\n" "Usage:"
|
|
1017
|
printf " rcstack cli redis\n"
|
|
1017
|
printf " rcstack cli redis\n"
|
|
1018
|
printf " rcstack cli redis --help | -h\n"
|
|
1018
|
printf " rcstack cli redis --help | -h\n"
|
|
1019
|
echo
|
|
1019
|
echo
|
|
1020
|
|
|
1020
|
|
|
1021
|
# :command.long_usage
|
|
1021
|
# :command.long_usage
|
|
1022
|
if [[ -n $long_usage ]]; then
|
|
1022
|
if [[ -n $long_usage ]]; then
|
|
1023
|
printf "%s\n" "Options:"
|
|
1023
|
printf "%s\n" "Options:"
|
|
1024
|
|
|
1024
|
|
|
1025
|
# :command.usage_fixed_flags
|
|
1025
|
# :command.usage_fixed_flags
|
|
1026
|
printf " %s\n" "--help, -h"
|
|
1026
|
printf " %s\n" "--help, -h"
|
|
1027
|
printf " Show this help\n"
|
|
1027
|
printf " Show this help\n"
|
|
1028
|
echo
|
|
1028
|
echo
|
|
1029
|
|
|
1029
|
|
|
1030
|
fi
|
|
1030
|
fi
|
|
1031
|
}
|
|
1031
|
}
|
|
1032
|
|
|
1032
|
|
|
1033
|
# :command.usage
|
|
1033
|
# :command.usage
|
|
1034
|
rcstack_cli_db_usage() {
|
|
1034
|
rcstack_cli_db_usage() {
|
|
1035
|
if [[ -n $long_usage ]]; then
|
|
1035
|
if [[ -n $long_usage ]]; then
|
|
1036
|
printf "rcstack cli db - CLI with Database connection\n"
|
|
1036
|
printf "rcstack cli db - CLI with Database connection\n"
|
|
1037
|
echo
|
|
1037
|
echo
|
|
1038
|
|
|
1038
|
|
|
1039
|
else
|
|
1039
|
else
|
|
1040
|
printf "rcstack cli db - CLI with Database connection\n"
|
|
1040
|
printf "rcstack cli db - CLI with Database connection\n"
|
|
1041
|
echo
|
|
1041
|
echo
|
|
1042
|
|
|
1042
|
|
|
1043
|
fi
|
|
1043
|
fi
|
|
1044
|
|
|
1044
|
|
|
1045
|
printf "%s\n" "Usage:"
|
|
1045
|
printf "%s\n" "Usage:"
|
|
1046
|
printf " rcstack cli db\n"
|
|
1046
|
printf " rcstack cli db\n"
|
|
1047
|
printf " rcstack cli db --help | -h\n"
|
|
1047
|
printf " rcstack cli db --help | -h\n"
|
|
1048
|
echo
|
|
1048
|
echo
|
|
1049
|
|
|
1049
|
|
|
1050
|
# :command.long_usage
|
|
1050
|
# :command.long_usage
|
|
1051
|
if [[ -n $long_usage ]]; then
|
|
1051
|
if [[ -n $long_usage ]]; then
|
|
1052
|
printf "%s\n" "Options:"
|
|
1052
|
printf "%s\n" "Options:"
|
|
1053
|
|
|
1053
|
|
|
1054
|
# :command.usage_fixed_flags
|
|
1054
|
# :command.usage_fixed_flags
|
|
1055
|
printf " %s\n" "--help, -h"
|
|
1055
|
printf " %s\n" "--help, -h"
|
|
1056
|
printf " Show this help\n"
|
|
1056
|
printf " Show this help\n"
|
|
1057
|
echo
|
|
1057
|
echo
|
|
1058
|
|
|
1058
|
|
|
1059
|
# :command.usage_examples
|
|
1059
|
# :command.usage_examples
|
|
1060
|
printf "%s\n" "Examples:"
|
|
1060
|
printf "%s\n" "Examples:"
|
|
1061
|
printf " # restore backup\n - \i /var/rc-data-dump/your_dump.sql\n"
|
|
1061
|
printf " # restore backup\n - \i /var/rc-data-dump/your_dump.sql\n"
|
|
1062
|
echo
|
|
1062
|
echo
|
|
1063
|
|
|
1063
|
|
|
1064
|
fi
|
|
1064
|
fi
|
|
1065
|
}
|
|
1065
|
}
|
|
1066
|
|
|
1066
|
|
|
1067
|
# :command.usage
|
|
1067
|
# :command.usage
|
|
1068
|
rcstack_cli_db_upgrade_usage() {
|
|
1068
|
rcstack_cli_db_upgrade_usage() {
|
|
1069
|
if [[ -n $long_usage ]]; then
|
|
1069
|
if [[ -n $long_usage ]]; then
|
|
1070
|
printf "rcstack cli db-upgrade - CLI to run db upgrade\n"
|
|
1070
|
printf "rcstack cli db-upgrade - CLI to run db upgrade\n"
|
|
1071
|
echo
|
|
1071
|
echo
|
|
1072
|
|
|
1072
|
|
|
1073
|
else
|
|
1073
|
else
|
|
1074
|
printf "rcstack cli db-upgrade - CLI to run db upgrade\n"
|
|
1074
|
printf "rcstack cli db-upgrade - CLI to run db upgrade\n"
|
|
1075
|
echo
|
|
1075
|
echo
|
|
1076
|
|
|
1076
|
|
|
1077
|
fi
|
|
1077
|
fi
|
|
1078
|
|
|
1078
|
|
|
1079
|
printf "%s\n" "Usage:"
|
|
1079
|
printf "%s\n" "Usage:"
|
|
1080
|
printf " rcstack cli db-upgrade\n"
|
|
1080
|
printf " rcstack cli db-upgrade\n"
|
|
1081
|
printf " rcstack cli db-upgrade --help | -h\n"
|
|
1081
|
printf " rcstack cli db-upgrade --help | -h\n"
|
|
1082
|
echo
|
|
1082
|
echo
|
|
1083
|
|
|
1083
|
|
|
1084
|
# :command.long_usage
|
|
1084
|
# :command.long_usage
|
|
1085
|
if [[ -n $long_usage ]]; then
|
|
1085
|
if [[ -n $long_usage ]]; then
|
|
1086
|
printf "%s\n" "Options:"
|
|
1086
|
printf "%s\n" "Options:"
|
|
1087
|
|
|
1087
|
|
|
1088
|
# :command.usage_fixed_flags
|
|
1088
|
# :command.usage_fixed_flags
|
|
1089
|
printf " %s\n" "--help, -h"
|
|
1089
|
printf " %s\n" "--help, -h"
|
|
1090
|
printf " Show this help\n"
|
|
1090
|
printf " Show this help\n"
|
|
1091
|
echo
|
|
1091
|
echo
|
|
1092
|
|
|
1092
|
|
|
1093
|
fi
|
|
1093
|
fi
|
|
1094
|
}
|
|
1094
|
}
|
|
1095
|
|
|
1095
|
|
|
1096
|
# :command.usage
|
|
1096
|
# :command.usage
|
|
1097
|
rcstack_cli_storage_usage() {
|
|
1097
|
rcstack_cli_storage_usage() {
|
|
1098
|
if [[ -n $long_usage ]]; then
|
|
1098
|
if [[ -n $long_usage ]]; then
|
|
1099
|
printf "rcstack cli storage - CLI for repository storage. Exposes a basic image with mounted data and repositories volumes or attach to currently running containers storage\n"
|
|
1099
|
printf "rcstack cli storage - CLI for repository storage. Exposes a basic image with mounted data and repositories volumes or attach to currently running containers storage\n"
|
|
1100
|
echo
|
|
1100
|
echo
|
|
1101
|
|
|
1101
|
|
|
1102
|
else
|
|
1102
|
else
|
|
1103
|
printf "rcstack cli storage - CLI for repository storage. Exposes a basic image with mounted data and repositories volumes or attach to currently running containers storage\n"
|
|
1103
|
printf "rcstack cli storage - CLI for repository storage. Exposes a basic image with mounted data and repositories volumes or attach to currently running containers storage\n"
|
|
1104
|
echo
|
|
1104
|
echo
|
|
1105
|
|
|
1105
|
|
|
1106
|
fi
|
|
1106
|
fi
|
|
1107
|
|
|
1107
|
|
|
1108
|
printf "%s\n" "Usage:"
|
|
1108
|
printf "%s\n" "Usage:"
|
|
1109
|
printf " rcstack cli storage [OPTIONS]\n"
|
|
1109
|
printf " rcstack cli storage [OPTIONS]\n"
|
|
1110
|
printf " rcstack cli storage --help | -h\n"
|
|
1110
|
printf " rcstack cli storage --help | -h\n"
|
|
1111
|
echo
|
|
1111
|
echo
|
|
1112
|
|
|
1112
|
|
|
1113
|
# :command.long_usage
|
|
1113
|
# :command.long_usage
|
|
1114
|
if [[ -n $long_usage ]]; then
|
|
1114
|
if [[ -n $long_usage ]]; then
|
|
1115
|
printf "%s\n" "Options:"
|
|
1115
|
printf "%s\n" "Options:"
|
|
1116
|
|
|
1116
|
|
|
1117
|
# :command.usage_flags
|
|
1117
|
# :command.usage_flags
|
|
1118
|
# :flag.usage
|
|
1118
|
# :flag.usage
|
|
1119
|
printf " %s\n" "--attached ATTACHED"
|
|
1119
|
printf " %s\n" "--attached ATTACHED"
|
|
1120
|
printf " attach to storage of already running vcsserver container instead\n"
|
|
1120
|
printf " attach to storage of already running vcsserver container instead\n"
|
|
1121
|
echo
|
|
1121
|
echo
|
|
1122
|
|
|
1122
|
|
|
1123
|
# :command.usage_fixed_flags
|
|
1123
|
# :command.usage_fixed_flags
|
|
1124
|
printf " %s\n" "--help, -h"
|
|
1124
|
printf " %s\n" "--help, -h"
|
|
1125
|
printf " Show this help\n"
|
|
1125
|
printf " Show this help\n"
|
|
1126
|
echo
|
|
1126
|
echo
|
|
1127
|
|
|
1127
|
|
|
1128
|
fi
|
|
1128
|
fi
|
|
1129
|
}
|
|
1129
|
}
|
|
1130
|
|
|
1130
|
|
|
1131
|
# :command.usage
|
|
1131
|
# :command.usage
|
|
1132
|
rcstack_cli_attach_usage() {
|
|
1132
|
rcstack_cli_attach_usage() {
|
|
1133
|
if [[ -n $long_usage ]]; then
|
|
1133
|
if [[ -n $long_usage ]]; then
|
|
1134
|
printf "rcstack cli attach - attach to running instance of RhodeCode, by default it attaches to rhodecode main web app\n"
|
|
1134
|
printf "rcstack cli attach - attach to running instance of RhodeCode, by default it attaches to rhodecode main web app\n"
|
|
1135
|
echo
|
|
1135
|
echo
|
|
1136
|
|
|
1136
|
|
|
1137
|
else
|
|
1137
|
else
|
|
1138
|
printf "rcstack cli attach - attach to running instance of RhodeCode, by default it attaches to rhodecode main web app\n"
|
|
1138
|
printf "rcstack cli attach - attach to running instance of RhodeCode, by default it attaches to rhodecode main web app\n"
|
|
1139
|
echo
|
|
1139
|
echo
|
|
1140
|
|
|
1140
|
|
|
1141
|
fi
|
|
1141
|
fi
|
|
1142
|
|
|
1142
|
|
|
1143
|
printf "%s\n" "Usage:"
|
|
1143
|
printf "%s\n" "Usage:"
|
|
1144
|
printf " rcstack cli attach [OPTIONS]\n"
|
|
1144
|
printf " rcstack cli attach [OPTIONS]\n"
|
|
1145
|
printf " rcstack cli attach --help | -h\n"
|
|
1145
|
printf " rcstack cli attach --help | -h\n"
|
|
1146
|
echo
|
|
1146
|
echo
|
|
1147
|
|
|
1147
|
|
|
1148
|
# :command.long_usage
|
|
1148
|
# :command.long_usage
|
|
1149
|
if [[ -n $long_usage ]]; then
|
|
1149
|
if [[ -n $long_usage ]]; then
|
|
1150
|
printf "%s\n" "Options:"
|
|
1150
|
printf "%s\n" "Options:"
|
|
1151
|
|
|
1151
|
|
|
1152
|
# :command.usage_flags
|
|
1152
|
# :command.usage_flags
|
|
1153
|
# :flag.usage
|
|
1153
|
# :flag.usage
|
|
1154
|
printf " %s\n" "--instance-type INSTANCE_TYPE"
|
|
1154
|
printf " %s\n" "--instance-type INSTANCE_TYPE"
|
|
1155
|
printf " type of instance to attach to\n"
|
|
1155
|
printf " type of instance to attach to\n"
|
|
1156
|
printf " Default: rhodecode\n"
|
|
1156
|
printf " Default: rhodecode\n"
|
|
1157
|
echo
|
|
1157
|
echo
|
|
1158
|
|
|
1158
|
|
|
1159
|
# :command.usage_fixed_flags
|
|
1159
|
# :command.usage_fixed_flags
|
|
1160
|
printf " %s\n" "--help, -h"
|
|
1160
|
printf " %s\n" "--help, -h"
|
|
1161
|
printf " Show this help\n"
|
|
1161
|
printf " Show this help\n"
|
|
1162
|
echo
|
|
1162
|
echo
|
|
1163
|
|
|
1163
|
|
|
1164
|
# :command.usage_examples
|
|
1164
|
# :command.usage_examples
|
|
1165
|
printf "%s\n" "Examples:"
|
|
1165
|
printf "%s\n" "Examples:"
|
|
1166
|
printf " ./rcstack cli attach --instance-type sshd\n ./rcstack cli attach --instance-type vcsserver\n ./rcstack cli attach --instance-type celery\n ./rcstack cli attach --instance-type celery-beat\n"
|
|
1166
|
printf " ./rcstack cli attach --instance-type sshd\n ./rcstack cli attach --instance-type vcsserver\n ./rcstack cli attach --instance-type celery\n ./rcstack cli attach --instance-type celery-beat\n"
|
|
1167
|
echo
|
|
1167
|
echo
|
|
1168
|
|
|
1168
|
|
|
1169
|
fi
|
|
1169
|
fi
|
|
1170
|
}
|
|
1170
|
}
|
|
1171
|
|
|
1171
|
|
|
1172
|
# :command.usage
|
|
1172
|
# :command.usage
|
|
1173
|
rcstack_cli_set_edition_usage() {
|
|
1173
|
rcstack_cli_set_edition_usage() {
|
|
1174
|
if [[ -n $long_usage ]]; then
|
|
1174
|
if [[ -n $long_usage ]]; then
|
|
1175
|
printf "rcstack cli set-edition - set current setup to either CE (Community) or EE (Enterprise) type\n"
|
|
1175
|
printf "rcstack cli set-edition - set current setup to either CE (Community) or EE (Enterprise) type\n"
|
|
1176
|
echo
|
|
1176
|
echo
|
|
1177
|
|
|
1177
|
|
|
1178
|
else
|
|
1178
|
else
|
|
1179
|
printf "rcstack cli set-edition - set current setup to either CE (Community) or EE (Enterprise) type\n"
|
|
1179
|
printf "rcstack cli set-edition - set current setup to either CE (Community) or EE (Enterprise) type\n"
|
|
1180
|
echo
|
|
1180
|
echo
|
|
1181
|
|
|
1181
|
|
|
1182
|
fi
|
|
1182
|
fi
|
|
1183
|
|
|
1183
|
|
|
1184
|
printf "%s\n" "Usage:"
|
|
1184
|
printf "%s\n" "Usage:"
|
|
1185
|
printf " rcstack cli set-edition EDITION_TYPE\n"
|
|
1185
|
printf " rcstack cli set-edition EDITION_TYPE\n"
|
|
1186
|
printf " rcstack cli set-edition --help | -h\n"
|
|
1186
|
printf " rcstack cli set-edition --help | -h\n"
|
|
1187
|
echo
|
|
1187
|
echo
|
|
1188
|
|
|
1188
|
|
|
1189
|
# :command.long_usage
|
|
1189
|
# :command.long_usage
|
|
1190
|
if [[ -n $long_usage ]]; then
|
|
1190
|
if [[ -n $long_usage ]]; then
|
|
1191
|
printf "%s\n" "Options:"
|
|
1191
|
printf "%s\n" "Options:"
|
|
1192
|
|
|
1192
|
|
|
1193
|
# :command.usage_fixed_flags
|
|
1193
|
# :command.usage_fixed_flags
|
|
1194
|
printf " %s\n" "--help, -h"
|
|
1194
|
printf " %s\n" "--help, -h"
|
|
1195
|
printf " Show this help\n"
|
|
1195
|
printf " Show this help\n"
|
|
1196
|
echo
|
|
1196
|
echo
|
|
1197
|
|
|
1197
|
|
|
1198
|
# :command.usage_args
|
|
1198
|
# :command.usage_args
|
|
1199
|
printf "%s\n" "Arguments:"
|
|
1199
|
printf "%s\n" "Arguments:"
|
|
1200
|
|
|
1200
|
|
|
1201
|
# :argument.usage
|
|
1201
|
# :argument.usage
|
|
1202
|
printf " %s\n" "EDITION_TYPE"
|
|
1202
|
printf " %s\n" "EDITION_TYPE"
|
|
1203
|
printf " pick type CE or EE\n"
|
|
1203
|
printf " pick type CE or EE\n"
|
|
1204
|
printf " Allowed: ce, ee\n"
|
|
1204
|
printf " Allowed: ce, ee\n"
|
|
1205
|
echo
|
|
1205
|
echo
|
|
1206
|
|
|
1206
|
|
|
1207
|
# :command.usage_examples
|
|
1207
|
# :command.usage_examples
|
|
1208
|
printf "%s\n" "Examples:"
|
|
1208
|
printf "%s\n" "Examples:"
|
|
1209
|
printf " ./rcstack set-edition ce\n"
|
|
1209
|
printf " ./rcstack set-edition ce\n"
|
|
1210
|
printf " ./rcstack set-edition ee\n"
|
|
1210
|
printf " ./rcstack set-edition ee\n"
|
|
1211
|
echo
|
|
1211
|
echo
|
|
1212
|
|
|
1212
|
|
|
1213
|
fi
|
|
1213
|
fi
|
|
1214
|
}
|
|
1214
|
}
|
|
1215
|
|
|
1215
|
|
|
1216
|
# :command.usage
|
|
1216
|
# :command.usage
|
|
1217
|
rcstack_cli_configure_vcsserver_usage() {
|
|
1217
|
rcstack_cli_configure_vcsserver_usage() {
|
|
1218
|
if [[ -n $long_usage ]]; then
|
|
1218
|
if [[ -n $long_usage ]]; then
|
|
1219
|
printf "rcstack cli configure-vcsserver - reconfigure the vcsserver.ini file\n"
|
|
1219
|
printf "rcstack cli configure-vcsserver - reconfigure the vcsserver.ini file\n"
|
|
1220
|
echo
|
|
1220
|
echo
|
|
1221
|
|
|
1221
|
|
|
1222
|
else
|
|
1222
|
else
|
|
1223
|
printf "rcstack cli configure-vcsserver - reconfigure the vcsserver.ini file\n"
|
|
1223
|
printf "rcstack cli configure-vcsserver - reconfigure the vcsserver.ini file\n"
|
|
1224
|
echo
|
|
1224
|
echo
|
|
1225
|
|
|
1225
|
|
|
1226
|
fi
|
|
1226
|
fi
|
|
1227
|
|
|
1227
|
|
|
1228
|
printf "%s\n" "Usage:"
|
|
1228
|
printf "%s\n" "Usage:"
|
|
1229
|
printf " rcstack cli configure-vcsserver INI_PATH\n"
|
|
1229
|
printf " rcstack cli configure-vcsserver INI_PATH\n"
|
|
1230
|
printf " rcstack cli configure-vcsserver --help | -h\n"
|
|
1230
|
printf " rcstack cli configure-vcsserver --help | -h\n"
|
|
1231
|
echo
|
|
1231
|
echo
|
|
1232
|
|
|
1232
|
|
|
1233
|
# :command.long_usage
|
|
1233
|
# :command.long_usage
|
|
1234
|
if [[ -n $long_usage ]]; then
|
|
1234
|
if [[ -n $long_usage ]]; then
|
|
1235
|
printf "%s\n" "Options:"
|
|
1235
|
printf "%s\n" "Options:"
|
|
1236
|
|
|
1236
|
|
|
1237
|
# :command.usage_fixed_flags
|
|
1237
|
# :command.usage_fixed_flags
|
|
1238
|
printf " %s\n" "--help, -h"
|
|
1238
|
printf " %s\n" "--help, -h"
|
|
1239
|
printf " Show this help\n"
|
|
1239
|
printf " Show this help\n"
|
|
1240
|
echo
|
|
1240
|
echo
|
|
1241
|
|
|
1241
|
|
|
1242
|
# :command.usage_args
|
|
1242
|
# :command.usage_args
|
|
1243
|
printf "%s\n" "Arguments:"
|
|
1243
|
printf "%s\n" "Arguments:"
|
|
1244
|
|
|
1244
|
|
|
1245
|
# :argument.usage
|
|
1245
|
# :argument.usage
|
|
1246
|
printf " %s\n" "INI_PATH"
|
|
1246
|
printf " %s\n" "INI_PATH"
|
|
1247
|
printf " Path to vcsserver.ini to reconfigure\n"
|
|
1247
|
printf " Path to vcsserver.ini to reconfigure\n"
|
|
1248
|
echo
|
|
1248
|
echo
|
|
1249
|
|
|
1249
|
|
|
1250
|
# :command.usage_examples
|
|
1250
|
# :command.usage_examples
|
|
1251
|
printf "%s\n" "Examples:"
|
|
1251
|
printf "%s\n" "Examples:"
|
|
1252
|
printf " ./rcstack cli configure-vcs config/_shared/vcsserver.ini\n"
|
|
1252
|
printf " ./rcstack cli configure-vcs config/_shared/vcsserver.ini\n"
|
|
1253
|
echo
|
|
1253
|
echo
|
|
1254
|
|
|
1254
|
|
|
1255
|
fi
|
|
1255
|
fi
|
|
1256
|
}
|
|
1256
|
}
|
|
1257
|
|
|
1257
|
|
|
1258
|
# :command.usage
|
|
1258
|
# :command.usage
|
|
1259
|
rcstack_cli_configure_rhodecode_usage() {
|
|
1259
|
rcstack_cli_configure_rhodecode_usage() {
|
|
1260
|
if [[ -n $long_usage ]]; then
|
|
1260
|
if [[ -n $long_usage ]]; then
|
|
1261
|
printf "rcstack cli configure-rhodecode - reconfigure the rhodecode.ini file\n"
|
|
1261
|
printf "rcstack cli configure-rhodecode - reconfigure the rhodecode.ini file\n"
|
|
1262
|
echo
|
|
1262
|
echo
|
|
1263
|
|
|
1263
|
|
|
1264
|
else
|
|
1264
|
else
|
|
1265
|
printf "rcstack cli configure-rhodecode - reconfigure the rhodecode.ini file\n"
|
|
1265
|
printf "rcstack cli configure-rhodecode - reconfigure the rhodecode.ini file\n"
|
|
1266
|
echo
|
|
1266
|
echo
|
|
1267
|
|
|
1267
|
|
|
1268
|
fi
|
|
1268
|
fi
|
|
1269
|
|
|
1269
|
|
|
1270
|
printf "%s\n" "Usage:"
|
|
1270
|
printf "%s\n" "Usage:"
|
|
1271
|
printf " rcstack cli configure-rhodecode INI_PATH\n"
|
|
1271
|
printf " rcstack cli configure-rhodecode INI_PATH\n"
|
|
1272
|
printf " rcstack cli configure-rhodecode --help | -h\n"
|
|
1272
|
printf " rcstack cli configure-rhodecode --help | -h\n"
|
|
1273
|
echo
|
|
1273
|
echo
|
|
1274
|
|
|
1274
|
|
|
1275
|
# :command.long_usage
|
|
1275
|
# :command.long_usage
|
|
1276
|
if [[ -n $long_usage ]]; then
|
|
1276
|
if [[ -n $long_usage ]]; then
|
|
1277
|
printf "%s\n" "Options:"
|
|
1277
|
printf "%s\n" "Options:"
|
|
1278
|
|
|
1278
|
|
|
1279
|
# :command.usage_fixed_flags
|
|
1279
|
# :command.usage_fixed_flags
|
|
1280
|
printf " %s\n" "--help, -h"
|
|
1280
|
printf " %s\n" "--help, -h"
|
|
1281
|
printf " Show this help\n"
|
|
1281
|
printf " Show this help\n"
|
|
1282
|
echo
|
|
1282
|
echo
|
|
1283
|
|
|
1283
|
|
|
1284
|
# :command.usage_args
|
|
1284
|
# :command.usage_args
|
|
1285
|
printf "%s\n" "Arguments:"
|
|
1285
|
printf "%s\n" "Arguments:"
|
|
1286
|
|
|
1286
|
|
|
1287
|
# :argument.usage
|
|
1287
|
# :argument.usage
|
|
1288
|
printf " %s\n" "INI_PATH"
|
|
1288
|
printf " %s\n" "INI_PATH"
|
|
1289
|
printf " Path to rhodecode.ini to reconfigure\n"
|
|
1289
|
printf " Path to rhodecode.ini to reconfigure\n"
|
|
1290
|
echo
|
|
1290
|
echo
|
|
1291
|
|
|
1291
|
|
|
1292
|
# :command.usage_examples
|
|
1292
|
# :command.usage_examples
|
|
1293
|
printf "%s\n" "Examples:"
|
|
1293
|
printf "%s\n" "Examples:"
|
|
1294
|
printf " ./rcstack cli configure-rhodecode config/_shared/rhodecode.ini\n"
|
|
1294
|
printf " ./rcstack cli configure-rhodecode config/_shared/rhodecode.ini\n"
|
|
1295
|
echo
|
|
1295
|
echo
|
|
1296
|
|
|
1296
|
|
|
1297
|
fi
|
|
1297
|
fi
|
|
1298
|
}
|
|
1298
|
}
|
|
1299
|
|
|
1299
|
|
|
1300
|
# :command.usage
|
|
1300
|
# :command.usage
|
|
1301
|
rcstack_backup_db_usage() {
|
|
1301
|
rcstack_backup_db_usage() {
|
|
1302
|
if [[ -n $long_usage ]]; then
|
|
1302
|
if [[ -n $long_usage ]]; then
|
|
1303
|
printf "rcstack backup-db - Backup Database\n"
|
|
1303
|
printf "rcstack backup-db - Backup Database\n"
|
|
1304
|
echo
|
|
1304
|
echo
|
|
1305
|
|
|
1305
|
|
|
1306
|
else
|
|
1306
|
else
|
|
1307
|
printf "rcstack backup-db - Backup Database\n"
|
|
1307
|
printf "rcstack backup-db - Backup Database\n"
|
|
1308
|
echo
|
|
1308
|
echo
|
|
1309
|
|
|
1309
|
|
|
1310
|
fi
|
|
1310
|
fi
|
|
1311
|
|
|
1311
|
|
|
1312
|
printf "%s\n" "Usage:"
|
|
1312
|
printf "%s\n" "Usage:"
|
|
1313
|
printf " rcstack backup-db\n"
|
|
1313
|
printf " rcstack backup-db\n"
|
|
1314
|
printf " rcstack backup-db --help | -h\n"
|
|
1314
|
printf " rcstack backup-db --help | -h\n"
|
|
1315
|
echo
|
|
1315
|
echo
|
|
1316
|
|
|
1316
|
|
|
1317
|
# :command.long_usage
|
|
1317
|
# :command.long_usage
|
|
1318
|
if [[ -n $long_usage ]]; then
|
|
1318
|
if [[ -n $long_usage ]]; then
|
|
1319
|
printf "%s\n" "Options:"
|
|
1319
|
printf "%s\n" "Options:"
|
|
1320
|
|
|
1320
|
|
|
1321
|
# :command.usage_fixed_flags
|
|
1321
|
# :command.usage_fixed_flags
|
|
1322
|
printf " %s\n" "--help, -h"
|
|
1322
|
printf " %s\n" "--help, -h"
|
|
1323
|
printf " Show this help\n"
|
|
1323
|
printf " Show this help\n"
|
|
1324
|
echo
|
|
1324
|
echo
|
|
1325
|
|
|
1325
|
|
|
1326
|
# :command.usage_examples
|
|
1326
|
# :command.usage_examples
|
|
1327
|
printf "%s\n" "Examples:"
|
|
1327
|
printf "%s\n" "Examples:"
|
|
1328
|
printf " # make backup gz compressed from container DB\n - ./rcstack backup-db\n \n # restore backup\n - gunzip your_dump.sql.gz\n - ./rcstack cli db\n - \i /var/rc-data-dump/your_dump.sql\n"
|
|
1328
|
printf " # make backup gz compressed from container DB\n - ./rcstack backup-db\n \n # restore backup\n - gunzip your_dump.sql.gz\n - ./rcstack cli db\n - \i /var/rc-data-dump/your_dump.sql\n"
|
|
1329
|
echo
|
|
1329
|
echo
|
|
1330
|
|
|
1330
|
|
|
1331
|
fi
|
|
1331
|
fi
|
|
1332
|
}
|
|
1332
|
}
|
|
1333
|
|
|
1333
|
|
|
1334
|
# :command.usage
|
|
1334
|
# :command.usage
|
|
1335
|
rcstack_backup_data_usage() {
|
|
1335
|
rcstack_backup_data_usage() {
|
|
1336
|
if [[ -n $long_usage ]]; then
|
|
1336
|
if [[ -n $long_usage ]]; then
|
|
1337
|
printf "rcstack backup-data - Backup RhodeCode storage\n"
|
|
1337
|
printf "rcstack backup-data - Backup RhodeCode storage\n"
|
|
1338
|
echo
|
|
1338
|
echo
|
|
1339
|
|
|
1339
|
|
|
1340
|
else
|
|
1340
|
else
|
|
1341
|
printf "rcstack backup-data - Backup RhodeCode storage\n"
|
|
1341
|
printf "rcstack backup-data - Backup RhodeCode storage\n"
|
|
1342
|
echo
|
|
1342
|
echo
|
|
1343
|
|
|
1343
|
|
|
1344
|
fi
|
|
1344
|
fi
|
|
1345
|
|
|
1345
|
|
|
1346
|
printf "%s\n" "Usage:"
|
|
1346
|
printf "%s\n" "Usage:"
|
|
1347
|
printf " rcstack backup-data\n"
|
|
1347
|
printf " rcstack backup-data\n"
|
|
1348
|
printf " rcstack backup-data --help | -h\n"
|
|
1348
|
printf " rcstack backup-data --help | -h\n"
|
|
1349
|
echo
|
|
1349
|
echo
|
|
1350
|
|
|
1350
|
|
|
1351
|
# :command.long_usage
|
|
1351
|
# :command.long_usage
|
|
1352
|
if [[ -n $long_usage ]]; then
|
|
1352
|
if [[ -n $long_usage ]]; then
|
|
1353
|
printf "%s\n" "Options:"
|
|
1353
|
printf "%s\n" "Options:"
|
|
1354
|
|
|
1354
|
|
|
1355
|
# :command.usage_fixed_flags
|
|
1355
|
# :command.usage_fixed_flags
|
|
1356
|
printf " %s\n" "--help, -h"
|
|
1356
|
printf " %s\n" "--help, -h"
|
|
1357
|
printf " Show this help\n"
|
|
1357
|
printf " Show this help\n"
|
|
1358
|
echo
|
|
1358
|
echo
|
|
1359
|
|
|
1359
|
|
|
1360
|
# :command.usage_examples
|
|
1360
|
# :command.usage_examples
|
|
1361
|
printf "%s\n" "Examples:"
|
|
1361
|
printf "%s\n" "Examples:"
|
|
1362
|
printf " # make backup gz compressed for rhodecode containers, and all volumes\n - ./rcstack backup-data\n"
|
|
1362
|
printf " # make backup gz compressed for rhodecode containers, and all volumes\n - ./rcstack backup-data\n"
|
|
1363
|
echo
|
|
1363
|
echo
|
|
1364
|
|
|
1364
|
|
|
1365
|
fi
|
|
1365
|
fi
|
|
1366
|
}
|
|
1366
|
}
|
|
1367
|
|
|
1367
|
|
|
1368
|
# :command.usage
|
|
1368
|
# :command.usage
|
|
1369
|
rcstack_get_build_artifacts_usage() {
|
|
1369
|
rcstack_get_build_artifacts_usage() {
|
|
1370
|
if [[ -n $long_usage ]]; then
|
|
1370
|
if [[ -n $long_usage ]]; then
|
|
1371
|
printf "rcstack get-build-artifacts - Fetch Artifacts to run installer based build\n"
|
|
1371
|
printf "rcstack get-build-artifacts - Fetch Artifacts to run installer based build\n"
|
|
1372
|
echo
|
|
1372
|
echo
|
|
1373
|
|
|
1373
|
|
|
1374
|
else
|
|
1374
|
else
|
|
1375
|
printf "rcstack get-build-artifacts - Fetch Artifacts to run installer based build\n"
|
|
1375
|
printf "rcstack get-build-artifacts - Fetch Artifacts to run installer based build\n"
|
|
1376
|
echo
|
|
1376
|
echo
|
|
1377
|
|
|
1377
|
|
|
1378
|
fi
|
|
1378
|
fi
|
|
1379
|
|
|
1379
|
|
|
1380
|
printf "%s\n" "Usage:"
|
|
1380
|
printf "%s\n" "Usage:"
|
|
1381
|
printf " rcstack get-build-artifacts [OPTIONS]\n"
|
|
1381
|
printf " rcstack get-build-artifacts [OPTIONS]\n"
|
|
1382
|
printf " rcstack get-build-artifacts --help | -h\n"
|
|
1382
|
printf " rcstack get-build-artifacts --help | -h\n"
|
|
1383
|
echo
|
|
1383
|
echo
|
|
1384
|
|
|
1384
|
|
|
1385
|
# :command.long_usage
|
|
1385
|
# :command.long_usage
|
|
1386
|
if [[ -n $long_usage ]]; then
|
|
1386
|
if [[ -n $long_usage ]]; then
|
|
1387
|
printf "%s\n" "Options:"
|
|
1387
|
printf "%s\n" "Options:"
|
|
1388
|
|
|
1388
|
|
|
1389
|
# :command.usage_flags
|
|
1389
|
# :command.usage_flags
|
|
1390
|
# :flag.usage
|
|
1390
|
# :flag.usage
|
|
1391
|
printf " %s\n" "--auth AUTH"
|
|
1391
|
printf " %s\n" "--auth AUTH"
|
|
1392
|
printf " Specify custom auth for curl e.g -u admin:secret\n"
|
|
1392
|
printf " Specify custom auth for curl e.g -u admin:secret\n"
|
|
1393
|
printf " Default: \n"
|
|
1393
|
printf " Default: \n"
|
|
1394
|
echo
|
|
1394
|
echo
|
|
1395
|
|
|
1395
|
|
|
1396
|
# :flag.usage
|
|
1396
|
# :flag.usage
|
|
1397
|
printf " %s\n" "--installer-url INSTALLER_URL"
|
|
1397
|
printf " %s\n" "--installer-url INSTALLER_URL"
|
|
1398
|
printf " Installer Download URL\n"
|
|
1398
|
printf " Installer Download URL\n"
|
|
1399
|
printf " Default: https://dls.rhodecode.com/dls/N2E2ZTY1NzA3NjYxNDA2NTc1NjI3MTcyNzA2MjcxNzIyZTcwNjI3YQ==/rhodecode-control/latest-linux-ee\n"
|
|
1399
|
printf " Default: https://dls.rhodecode.com/dls/N2E2ZTY1NzA3NjYxNDA2NTc1NjI3MTcyNzA2MjcxNzIyZTcwNjI3YQ==/rhodecode-control/latest-linux-ee\n"
|
|
1400
|
echo
|
|
1400
|
echo
|
|
1401
|
|
|
1401
|
|
|
1402
|
# :flag.usage
|
|
1402
|
# :flag.usage
|
|
1403
|
printf " %s\n" "--manifest-url MANIFEST_URL"
|
|
1403
|
printf " %s\n" "--manifest-url MANIFEST_URL"
|
|
1404
|
printf " Manifest file url\n"
|
|
1404
|
printf " Manifest file url\n"
|
|
1405
|
printf " Default: https://dls.rhodecode.com/linux/MANIFEST\n"
|
|
1405
|
printf " Default: https://dls.rhodecode.com/linux/MANIFEST\n"
|
|
1406
|
echo
|
|
1406
|
echo
|
|
1407
|
|
|
1407
|
|
|
1408
|
# :flag.usage
|
|
1408
|
# :flag.usage
|
|
1409
|
printf " %s\n" "--version-name VERSION_NAME"
|
|
1409
|
printf " %s\n" "--version-name VERSION_NAME"
|
|
1410
|
printf " Specify custom build ver e.g 4.27.0\n"
|
|
1410
|
printf " Specify custom build ver e.g 4.27.0\n"
|
|
1411
|
printf " Default: $RC_CLI_VERSION_NAME\n"
|
|
1411
|
printf " Default: $RC_CLI_VERSION_NAME\n"
|
|
1412
|
echo
|
|
1412
|
echo
|
|
1413
|
|
|
1413
|
|
|
1414
|
# :command.usage_fixed_flags
|
|
1414
|
# :command.usage_fixed_flags
|
|
1415
|
printf " %s\n" "--help, -h"
|
|
1415
|
printf " %s\n" "--help, -h"
|
|
1416
|
printf " Show this help\n"
|
|
1416
|
printf " Show this help\n"
|
|
1417
|
echo
|
|
1417
|
echo
|
|
1418
|
|
|
1418
|
|
|
1419
|
fi
|
|
1419
|
fi
|
|
1420
|
}
|
|
1420
|
}
|
|
1421
|
|
|
1421
|
|
|
1422
|
# :command.usage
|
|
1422
|
# :command.usage
|
|
1423
|
rcstack_build_installer_usage() {
|
|
1423
|
rcstack_build_installer_usage() {
|
|
1424
|
if [[ -n $long_usage ]]; then
|
|
1424
|
if [[ -n $long_usage ]]; then
|
|
1425
|
printf "rcstack build-installer - Build RhodeCode image from installer, ./rcstack get-build-artifacts initially\n"
|
|
1425
|
printf "rcstack build-installer - Build RhodeCode image from installer, ./rcstack get-build-artifacts initially\n"
|
|
1426
|
echo
|
|
1426
|
echo
|
|
1427
|
|
|
1427
|
|
|
1428
|
else
|
|
1428
|
else
|
|
1429
|
printf "rcstack build-installer - Build RhodeCode image from installer, ./rcstack get-build-artifacts initially\n"
|
|
1429
|
printf "rcstack build-installer - Build RhodeCode image from installer, ./rcstack get-build-artifacts initially\n"
|
|
1430
|
echo
|
|
1430
|
echo
|
|
1431
|
|
|
1431
|
|
|
1432
|
fi
|
|
1432
|
fi
|
|
1433
|
|
|
1433
|
|
|
1434
|
printf "%s\n" "Usage:"
|
|
1434
|
printf "%s\n" "Usage:"
|
|
1435
|
printf " rcstack build-installer [OPTIONS]\n"
|
|
1435
|
printf " rcstack build-installer [OPTIONS]\n"
|
|
1436
|
printf " rcstack build-installer --help | -h\n"
|
|
1436
|
printf " rcstack build-installer --help | -h\n"
|
|
1437
|
echo
|
|
1437
|
echo
|
|
1438
|
|
|
1438
|
|
|
1439
|
# :command.long_usage
|
|
1439
|
# :command.long_usage
|
|
1440
|
if [[ -n $long_usage ]]; then
|
|
1440
|
if [[ -n $long_usage ]]; then
|
|
1441
|
printf "%s\n" "Options:"
|
|
1441
|
printf "%s\n" "Options:"
|
|
1442
|
|
|
1442
|
|
|
1443
|
# :command.usage_flags
|
|
1443
|
# :command.usage_flags
|
|
1444
|
# :flag.usage
|
|
1444
|
# :flag.usage
|
|
1445
|
printf " %s\n" "--version-name VERSION_NAME"
|
|
1445
|
printf " %s\n" "--version-name VERSION_NAME"
|
|
1446
|
printf " Specify custom build ver e.g 4.27.0\n"
|
|
1446
|
printf " Specify custom build ver e.g 4.27.0\n"
|
|
1447
|
printf " Default: $RC_CLI_VERSION_NAME\n"
|
|
1447
|
printf " Default: $RC_CLI_VERSION_NAME\n"
|
|
1448
|
echo
|
|
1448
|
echo
|
|
1449
|
|
|
1449
|
|
|
1450
|
# :command.usage_fixed_flags
|
|
1450
|
# :command.usage_fixed_flags
|
|
1451
|
printf " %s\n" "--help, -h"
|
|
1451
|
printf " %s\n" "--help, -h"
|
|
1452
|
printf " Show this help\n"
|
|
1452
|
printf " Show this help\n"
|
|
1453
|
echo
|
|
1453
|
echo
|
|
1454
|
|
|
1454
|
|
|
1455
|
fi
|
|
1455
|
fi
|
|
1456
|
}
|
|
1456
|
}
|
|
1457
|
|
|
1457
|
|
|
1458
|
# :command.usage
|
|
1458
|
# :command.usage
|
|
1459
|
rcstack_get_build_source_usage() {
|
|
1459
|
rcstack_get_build_source_usage() {
|
|
1460
|
if [[ -n $long_usage ]]; then
|
|
1460
|
if [[ -n $long_usage ]]; then
|
|
1461
|
printf "rcstack get-build-source - Fetch RhodeCode sources, store in .source dir to run a source-based builds\n"
|
|
1461
|
printf "rcstack get-build-source - Fetch RhodeCode sources, store in .source dir to run a source-based builds\n"
|
|
1462
|
echo
|
|
1462
|
echo
|
|
1463
|
|
|
1463
|
|
|
1464
|
else
|
|
1464
|
else
|
|
1465
|
printf "rcstack get-build-source - Fetch RhodeCode sources, store in .source dir to run a source-based builds\n"
|
|
1465
|
printf "rcstack get-build-source - Fetch RhodeCode sources, store in .source dir to run a source-based builds\n"
|
|
1466
|
echo
|
|
1466
|
echo
|
|
1467
|
|
|
1467
|
|
|
1468
|
fi
|
|
1468
|
fi
|
|
1469
|
|
|
1469
|
|
|
1470
|
printf "%s\n" "Usage:"
|
|
1470
|
printf "%s\n" "Usage:"
|
|
1471
|
printf " rcstack get-build-source [OPTIONS]\n"
|
|
1471
|
printf " rcstack get-build-source [OPTIONS]\n"
|
|
1472
|
printf " rcstack get-build-source --help | -h\n"
|
|
1472
|
printf " rcstack get-build-source --help | -h\n"
|
|
1473
|
echo
|
|
1473
|
echo
|
|
1474
|
|
|
1474
|
|
|
1475
|
# :command.long_usage
|
|
1475
|
# :command.long_usage
|
|
1476
|
if [[ -n $long_usage ]]; then
|
|
1476
|
if [[ -n $long_usage ]]; then
|
|
1477
|
printf "%s\n" "Options:"
|
|
1477
|
printf "%s\n" "Options:"
|
|
1478
|
|
|
1478
|
|
|
1479
|
# :command.usage_flags
|
|
1479
|
# :command.usage_flags
|
|
1480
|
# :flag.usage
|
|
1480
|
# :flag.usage
|
|
1481
|
printf " %s\n" "--revision REVISION"
|
|
1481
|
printf " %s\n" "--revision REVISION"
|
|
1482
|
printf " revision to download\n"
|
|
1482
|
printf " revision to download\n"
|
|
1483
|
printf " Default: default\n"
|
|
1483
|
printf " Default: default\n"
|
|
1484
|
echo
|
|
1484
|
echo
|
|
1485
|
|
|
1485
|
|
|
1486
|
# :flag.usage
|
|
1486
|
# :flag.usage
|
|
1487
|
printf " %s\n" "--auth-token AUTH_TOKEN"
|
|
1487
|
printf " %s\n" "--auth-token AUTH_TOKEN"
|
|
1488
|
printf " Specify AUTH TOKEN to obtain sources\n"
|
|
1488
|
printf " Specify AUTH TOKEN to obtain sources\n"
|
|
1489
|
echo
|
|
1489
|
echo
|
|
1490
|
|
|
1490
|
|
|
1491
|
# :flag.usage
|
|
1491
|
# :flag.usage
|
|
1492
|
printf " %s\n" "--server-url SERVER_URL"
|
|
1492
|
printf " %s\n" "--server-url SERVER_URL"
|
|
1493
|
printf " Specify RhodeCode server location where projects should be downloaded\n"
|
|
1493
|
printf " Specify RhodeCode server location where projects should be downloaded\n"
|
|
1494
|
printf " Default: https://code.rhodecode.com\n"
|
|
1494
|
printf " Default: https://code.rhodecode.com\n"
|
|
1495
|
echo
|
|
1495
|
echo
|
|
1496
|
|
|
1496
|
|
|
1497
|
# :command.usage_fixed_flags
|
|
1497
|
# :command.usage_fixed_flags
|
|
1498
|
printf " %s\n" "--help, -h"
|
|
1498
|
printf " %s\n" "--help, -h"
|
|
1499
|
printf " Show this help\n"
|
|
1499
|
printf " Show this help\n"
|
|
1500
|
echo
|
|
1500
|
echo
|
|
1501
|
|
|
1501
|
|
|
1502
|
# :command.usage_examples
|
|
1502
|
# :command.usage_examples
|
|
1503
|
printf "%s\n" "Examples:"
|
|
1503
|
printf "%s\n" "Examples:"
|
|
1504
|
printf " ./rcstack get-sources $RC_CLI_VERSION_NAME\n"
|
|
1504
|
printf " ./rcstack get-sources $RC_CLI_VERSION_NAME\n"
|
|
1505
|
printf " ./rcstack get-sources default --auth-token xyxyxyx --server-url\n https://secret.repo/\n"
|
|
1505
|
printf " ./rcstack get-sources default --auth-token xyxyxyx --server-url\n https://secret.repo/\n"
|
|
1506
|
echo
|
|
1506
|
echo
|
|
1507
|
|
|
1507
|
|
|
1508
|
fi
|
|
1508
|
fi
|
|
1509
|
}
|
|
1509
|
}
|
|
1510
|
|
|
1510
|
|
|
1511
|
# :command.usage
|
|
1511
|
# :command.usage
|
|
1512
|
rcstack_build_source_usage() {
|
|
1512
|
rcstack_build_source_usage() {
|
|
1513
|
if [[ -n $long_usage ]]; then
|
|
1513
|
if [[ -n $long_usage ]]; then
|
|
1514
|
printf "rcstack build-source - Build RhodeCode image from source, requires ./rcstack get-build-source initially\n"
|
|
1514
|
printf "rcstack build-source - Build RhodeCode image from source, requires ./rcstack get-build-source initially\n"
|
|
1515
|
echo
|
|
1515
|
echo
|
|
1516
|
|
|
1516
|
|
|
1517
|
else
|
|
1517
|
else
|
|
1518
|
printf "rcstack build-source - Build RhodeCode image from source, requires ./rcstack get-build-source initially\n"
|
|
1518
|
printf "rcstack build-source - Build RhodeCode image from source, requires ./rcstack get-build-source initially\n"
|
|
1519
|
echo
|
|
1519
|
echo
|
|
1520
|
|
|
1520
|
|
|
1521
|
fi
|
|
1521
|
fi
|
|
1522
|
|
|
1522
|
|
|
1523
|
printf "%s\n" "Usage:"
|
|
1523
|
printf "%s\n" "Usage:"
|
|
1524
|
printf " rcstack build-source [OPTIONS]\n"
|
|
1524
|
printf " rcstack build-source [OPTIONS]\n"
|
|
1525
|
printf " rcstack build-source --help | -h\n"
|
|
1525
|
printf " rcstack build-source --help | -h\n"
|
|
1526
|
echo
|
|
1526
|
echo
|
|
1527
|
|
|
1527
|
|
|
1528
|
# :command.long_usage
|
|
1528
|
# :command.long_usage
|
|
1529
|
if [[ -n $long_usage ]]; then
|
|
1529
|
if [[ -n $long_usage ]]; then
|
|
1530
|
printf "%s\n" "Options:"
|
|
1530
|
printf "%s\n" "Options:"
|
|
1531
|
|
|
1531
|
|
|
1532
|
# :command.usage_flags
|
|
1532
|
# :command.usage_flags
|
|
1533
|
# :flag.usage
|
|
1533
|
# :flag.usage
|
|
1534
|
printf " %s\n" "--version-name VERSION_NAME"
|
|
1534
|
printf " %s\n" "--version-name VERSION_NAME"
|
|
1535
|
printf " Specify custom build ver e.g 4.27.0\n"
|
|
1535
|
printf " Specify custom build ver e.g 4.27.0\n"
|
|
1536
|
printf " Default: $RC_CLI_VERSION_NAME\n"
|
|
1536
|
printf " Default: $RC_CLI_VERSION_NAME\n"
|
|
1537
|
echo
|
|
1537
|
echo
|
|
1538
|
|
|
1538
|
|
|
1539
|
# :flag.usage
|
|
1539
|
# :flag.usage
|
|
1540
|
printf " %s\n" "--source-build-yaml BUILD_SOURCE_YAML"
|
|
1540
|
printf " %s\n" "--source-build-yaml BUILD_SOURCE_YAML"
|
|
1541
|
printf " yaml file to build source against\n"
|
|
1541
|
printf " yaml file to build source against\n"
|
|
1542
|
printf " Default: docker-compose-apps.source.yaml\n"
|
|
1542
|
printf " Default: docker-compose-apps.source.yaml\n"
|
|
1543
|
echo
|
|
1543
|
echo
|
|
1544
|
|
|
1544
|
|
|
1545
|
# :flag.usage
|
|
1545
|
# :flag.usage
|
|
1546
|
printf " %s\n" "--tag TAG (repeatable)"
|
|
1546
|
printf " %s\n" "--tag TAG (repeatable)"
|
|
1547
|
printf " tag build image\n"
|
|
1547
|
printf " tag build image\n"
|
|
1548
|
echo
|
|
1548
|
echo
|
|
1549
|
|
|
1549
|
|
|
1550
|
# :command.usage_fixed_flags
|
|
1550
|
# :command.usage_fixed_flags
|
|
1551
|
printf " %s\n" "--help, -h"
|
|
1551
|
printf " %s\n" "--help, -h"
|
|
1552
|
printf " Show this help\n"
|
|
1552
|
printf " Show this help\n"
|
|
1553
|
echo
|
|
1553
|
echo
|
|
1554
|
|
|
1554
|
|
|
1555
|
# :command.usage_examples
|
|
1555
|
# :command.usage_examples
|
|
1556
|
printf "%s\n" "Examples:"
|
|
1556
|
printf "%s\n" "Examples:"
|
|
1557
|
printf " ./rcstack build-source --version-name 4.28.0.REL.2023.02.02.1\n"
|
|
1557
|
printf " ./rcstack build-source --version-name 4.28.0.REL.2023.02.02.1\n"
|
|
1558
|
printf " ./rcstack build-source --source-build-yaml docker-compose-apps.venv.yaml\n --version-name 4.28.0.REL.2023.02.02.1\n"
|
|
1558
|
printf " ./rcstack build-source --source-build-yaml docker-compose-apps.venv.yaml\n --version-name 4.28.0.REL.2023.02.02.1\n"
|
|
1559
|
echo
|
|
1559
|
echo
|
|
1560
|
|
|
1560
|
|
|
1561
|
fi
|
|
1561
|
fi
|
|
1562
|
}
|
|
1562
|
}
|
|
1563
|
|
|
1563
|
|
|
1564
|
# :command.usage
|
|
1564
|
# :command.usage
|
|
1565
|
rcstack__completions_usage() {
|
|
1565
|
rcstack__completions_usage() {
|
|
1566
|
if [[ -n $long_usage ]]; then
|
|
1566
|
if [[ -n $long_usage ]]; then
|
|
1567
|
printf "rcstack _completions - Generate completions\n"
|
|
1567
|
printf "rcstack _completions - Generate completions\n"
|
|
1568
|
echo
|
|
1568
|
echo
|
|
1569
|
|
|
1569
|
|
|
1570
|
else
|
|
1570
|
else
|
|
1571
|
printf "rcstack _completions - Generate completions\n"
|
|
1571
|
printf "rcstack _completions - Generate completions\n"
|
|
1572
|
echo
|
|
1572
|
echo
|
|
1573
|
|
|
1573
|
|
|
1574
|
fi
|
|
1574
|
fi
|
|
1575
|
|
|
1575
|
|
|
1576
|
printf "%s\n" "Usage:"
|
|
1576
|
printf "%s\n" "Usage:"
|
|
1577
|
printf " rcstack _completions\n"
|
|
1577
|
printf " rcstack _completions\n"
|
|
1578
|
printf " rcstack _completions --help | -h\n"
|
|
1578
|
printf " rcstack _completions --help | -h\n"
|
|
1579
|
echo
|
|
1579
|
echo
|
|
1580
|
|
|
1580
|
|
|
1581
|
# :command.long_usage
|
|
1581
|
# :command.long_usage
|
|
1582
|
if [[ -n $long_usage ]]; then
|
|
1582
|
if [[ -n $long_usage ]]; then
|
|
1583
|
printf "%s\n" "Options:"
|
|
1583
|
printf "%s\n" "Options:"
|
|
1584
|
|
|
1584
|
|
|
1585
|
# :command.usage_fixed_flags
|
|
1585
|
# :command.usage_fixed_flags
|
|
1586
|
printf " %s\n" "--help, -h"
|
|
1586
|
printf " %s\n" "--help, -h"
|
|
1587
|
printf " Show this help\n"
|
|
1587
|
printf " Show this help\n"
|
|
1588
|
echo
|
|
1588
|
echo
|
|
1589
|
|
|
1589
|
|
|
1590
|
fi
|
|
1590
|
fi
|
|
1591
|
}
|
|
1591
|
}
|
|
1592
|
|
|
1592
|
|
|
1593
|
# :command.normalize_input
|
|
1593
|
# :command.normalize_input
|
|
1594
|
normalize_input() {
|
|
1594
|
normalize_input() {
|
|
1595
|
local arg flags
|
|
1595
|
local arg flags
|
|
1596
|
|
|
1596
|
|
|
1597
|
while [[ $# -gt 0 ]]; do
|
|
1597
|
while [[ $# -gt 0 ]]; do
|
|
1598
|
arg="$1"
|
|
1598
|
arg="$1"
|
|
1599
|
if [[ $arg =~ ^(--[a-zA-Z0-9_\-]+)=(.+)$ ]]; then
|
|
1599
|
if [[ $arg =~ ^(--[a-zA-Z0-9_\-]+)=(.+)$ ]]; then
|
|
1600
|
input+=("${BASH_REMATCH[1]}")
|
|
1600
|
input+=("${BASH_REMATCH[1]}")
|
|
1601
|
input+=("${BASH_REMATCH[2]}")
|
|
1601
|
input+=("${BASH_REMATCH[2]}")
|
|
1602
|
elif [[ $arg =~ ^(-[a-zA-Z0-9])=(.+)$ ]]; then
|
|
1602
|
elif [[ $arg =~ ^(-[a-zA-Z0-9])=(.+)$ ]]; then
|
|
1603
|
input+=("${BASH_REMATCH[1]}")
|
|
1603
|
input+=("${BASH_REMATCH[1]}")
|
|
1604
|
input+=("${BASH_REMATCH[2]}")
|
|
1604
|
input+=("${BASH_REMATCH[2]}")
|
|
1605
|
elif [[ $arg =~ ^-([a-zA-Z0-9][a-zA-Z0-9]+)$ ]]; then
|
|
1605
|
elif [[ $arg =~ ^-([a-zA-Z0-9][a-zA-Z0-9]+)$ ]]; then
|
|
1606
|
flags="${BASH_REMATCH[1]}"
|
|
1606
|
flags="${BASH_REMATCH[1]}"
|
|
1607
|
for ((i = 0; i < ${#flags}; i++)); do
|
|
1607
|
for ((i = 0; i < ${#flags}; i++)); do
|
|
1608
|
input+=("-${flags:i:1}")
|
|
1608
|
input+=("-${flags:i:1}")
|
|
1609
|
done
|
|
1609
|
done
|
|
1610
|
else
|
|
1610
|
else
|
|
1611
|
input+=("$arg")
|
|
1611
|
input+=("$arg")
|
|
1612
|
fi
|
|
1612
|
fi
|
|
1613
|
|
|
1613
|
|
|
1614
|
shift
|
|
1614
|
shift
|
|
1615
|
done
|
|
1615
|
done
|
|
1616
|
}
|
|
1616
|
}
|
|
1617
|
# :command.inspect_args
|
|
1617
|
# :command.inspect_args
|
|
1618
|
inspect_args() {
|
|
1618
|
inspect_args() {
|
|
1619
|
if ((${#args[@]})); then
|
|
1619
|
if ((${#args[@]})); then
|
|
1620
|
readarray -t sorted_keys < <(printf '%s\n' "${!args[@]}" | sort)
|
|
1620
|
readarray -t sorted_keys < <(printf '%s\n' "${!args[@]}" | sort)
|
|
1621
|
echo args:
|
|
1621
|
echo args:
|
|
1622
|
for k in "${sorted_keys[@]}"; do echo "- \${args[$k]} = ${args[$k]}"; done
|
|
1622
|
for k in "${sorted_keys[@]}"; do echo "- \${args[$k]} = ${args[$k]}"; done
|
|
1623
|
else
|
|
1623
|
else
|
|
1624
|
echo args: none
|
|
1624
|
echo args: none
|
|
1625
|
fi
|
|
1625
|
fi
|
|
1626
|
|
|
1626
|
|
|
1627
|
if ((${#other_args[@]})); then
|
|
1627
|
if ((${#other_args[@]})); then
|
|
1628
|
echo
|
|
1628
|
echo
|
|
1629
|
echo other_args:
|
|
1629
|
echo other_args:
|
|
1630
|
echo "- \${other_args[*]} = ${other_args[*]}"
|
|
1630
|
echo "- \${other_args[*]} = ${other_args[*]}"
|
|
1631
|
for i in "${!other_args[@]}"; do
|
|
1631
|
for i in "${!other_args[@]}"; do
|
|
1632
|
echo "- \${other_args[$i]} = ${other_args[$i]}"
|
|
1632
|
echo "- \${other_args[$i]} = ${other_args[$i]}"
|
|
1633
|
done
|
|
1633
|
done
|
|
1634
|
fi
|
|
1634
|
fi
|
|
1635
|
|
|
1635
|
|
|
1636
|
if ((${#deps[@]})); then
|
|
1636
|
if ((${#deps[@]})); then
|
|
1637
|
readarray -t sorted_keys < <(printf '%s\n' "${!deps[@]}" | sort)
|
|
1637
|
readarray -t sorted_keys < <(printf '%s\n' "${!deps[@]}" | sort)
|
|
1638
|
echo
|
|
1638
|
echo
|
|
1639
|
echo deps:
|
|
1639
|
echo deps:
|
|
1640
|
for k in "${sorted_keys[@]}"; do echo "- \${deps[$k]} = ${deps[$k]}"; done
|
|
1640
|
for k in "${sorted_keys[@]}"; do echo "- \${deps[$k]} = ${deps[$k]}"; done
|
|
1641
|
fi
|
|
1641
|
fi
|
|
1642
|
|
|
1642
|
|
|
1643
|
}
|
|
1643
|
}
|
|
1644
|
|
|
1644
|
|
|
1645
|
# :command.user_lib
|
|
1645
|
# :command.user_lib
|
|
1646
|
# src/lib/check_bootstrap.sh
|
|
1646
|
# src/lib/check_bootstrap.sh
|
|
1647
|
|
|
1647
|
|
|
1648
|
check_bootstrap() {
|
|
1648
|
check_bootstrap() {
|
|
1649
|
# Avoid destroying bootstrapping by simple start/stop
|
|
1649
|
# Avoid destroying bootstrapping by simple start/stop
|
|
1650
|
for stage_name in $BOOTSTRAP_STAGES; do
|
|
1650
|
for stage_name in $BOOTSTRAP_STAGES; do
|
|
1651
|
if ! config_has_key $stage_name ; then
|
|
1651
|
if ! config_has_key $stage_name ; then
|
|
1652
|
echo "$(yellow WARNING:) Bootstrap key $stage_name not found in config file $CONFIG_FILE!"
|
|
1652
|
echo "$(yellow WARNING:) Bootstrap key $stage_name not found in config file $CONFIG_FILE!"
|
|
1653
|
echo "$(yellow NOTICE:) Run this first: ./$RC_SCRIPT_NAME init"
|
|
1653
|
echo "$(yellow NOTICE:) Run this first: ./$RC_SCRIPT_NAME init"
|
|
1654
|
exit
|
|
1654
|
exit
|
|
1655
|
fi
|
|
1655
|
fi
|
|
1656
|
done
|
|
1656
|
done
|
|
1657
|
|
|
1657
|
|
|
1658
|
}
|
|
1658
|
}
|
|
1659
|
|
|
1659
|
|
|
1660
|
# src/lib/colors.sh
|
|
1660
|
# src/lib/colors.sh
|
|
1661
|
print_in_color() {
|
|
1661
|
print_in_color() {
|
|
1662
|
local color="$1"
|
|
1662
|
local color="$1"
|
|
1663
|
shift
|
|
1663
|
shift
|
|
1664
|
if [[ -z ${NO_COLOR+x} ]]; then
|
|
1664
|
if [[ -z ${NO_COLOR+x} ]]; then
|
|
1665
|
printf "$color%b\e[0m\n" "$*"
|
|
1665
|
printf "$color%b\e[0m\n" "$*"
|
|
1666
|
else
|
|
1666
|
else
|
|
1667
|
printf "%b\n" "$*"
|
|
1667
|
printf "%b\n" "$*"
|
|
1668
|
fi
|
|
1668
|
fi
|
|
1669
|
}
|
|
1669
|
}
|
|
1670
|
|
|
1670
|
|
|
1671
|
red() { print_in_color "\e[31m" "$*"; }
|
|
1671
|
red() { print_in_color "\e[31m" "$*"; }
|
|
1672
|
green() { print_in_color "\e[32m" "$*"; }
|
|
1672
|
green() { print_in_color "\e[32m" "$*"; }
|
|
1673
|
yellow() { print_in_color "\e[33m" "$*"; }
|
|
1673
|
yellow() { print_in_color "\e[33m" "$*"; }
|
|
1674
|
blue() { print_in_color "\e[34m" "$*"; }
|
|
1674
|
blue() { print_in_color "\e[34m" "$*"; }
|
|
1675
|
magenta() { print_in_color "\e[35m" "$*"; }
|
|
1675
|
magenta() { print_in_color "\e[35m" "$*"; }
|
|
1676
|
cyan() { print_in_color "\e[36m" "$*"; }
|
|
1676
|
cyan() { print_in_color "\e[36m" "$*"; }
|
|
1677
|
bold() { print_in_color "\e[1m" "$*"; }
|
|
1677
|
bold() { print_in_color "\e[1m" "$*"; }
|
|
1678
|
underlined() { print_in_color "\e[4m" "$*"; }
|
|
1678
|
underlined() { print_in_color "\e[4m" "$*"; }
|
|
1679
|
red_bold() { print_in_color "\e[1;31m" "$*"; }
|
|
1679
|
red_bold() { print_in_color "\e[1;31m" "$*"; }
|
|
1680
|
green_bold() { print_in_color "\e[1;32m" "$*"; }
|
|
1680
|
green_bold() { print_in_color "\e[1;32m" "$*"; }
|
|
1681
|
yellow_bold() { print_in_color "\e[1;33m" "$*"; }
|
|
1681
|
yellow_bold() { print_in_color "\e[1;33m" "$*"; }
|
|
1682
|
blue_bold() { print_in_color "\e[1;34m" "$*"; }
|
|
1682
|
blue_bold() { print_in_color "\e[1;34m" "$*"; }
|
|
1683
|
magenta_bold() { print_in_color "\e[1;35m" "$*"; }
|
|
1683
|
magenta_bold() { print_in_color "\e[1;35m" "$*"; }
|
|
1684
|
cyan_bold() { print_in_color "\e[1;36m" "$*"; }
|
|
1684
|
cyan_bold() { print_in_color "\e[1;36m" "$*"; }
|
|
1685
|
red_underlined() { print_in_color "\e[4;31m" "$*"; }
|
|
1685
|
red_underlined() { print_in_color "\e[4;31m" "$*"; }
|
|
1686
|
green_underlined() { print_in_color "\e[4;32m" "$*"; }
|
|
1686
|
green_underlined() { print_in_color "\e[4;32m" "$*"; }
|
|
1687
|
yellow_underlined() { print_in_color "\e[4;33m" "$*"; }
|
|
1687
|
yellow_underlined() { print_in_color "\e[4;33m" "$*"; }
|
|
1688
|
blue_underlined() { print_in_color "\e[4;34m" "$*"; }
|
|
1688
|
blue_underlined() { print_in_color "\e[4;34m" "$*"; }
|
|
1689
|
magenta_underlined() { print_in_color "\e[4;35m" "$*"; }
|
|
1689
|
magenta_underlined() { print_in_color "\e[4;35m" "$*"; }
|
|
1690
|
cyan_underlined() { print_in_color "\e[4;36m" "$*"; }
|
|
1690
|
cyan_underlined() { print_in_color "\e[4;36m" "$*"; }
|
|
1691
|
|
|
1691
|
|
|
1692
|
# src/lib/config.sh
|
|
1692
|
# src/lib/config.sh
|
|
1693
|
|
|
1693
|
|
|
1694
|
config_show() {
|
|
1694
|
config_show() {
|
|
1695
|
config_load
|
|
1695
|
config_load
|
|
1696
|
ini_show
|
|
1696
|
ini_show
|
|
1697
|
}
|
|
1697
|
}
|
|
1698
|
|
|
1698
|
|
|
1699
|
config_get() {
|
|
1699
|
config_get() {
|
|
1700
|
local key="$1"
|
|
1700
|
local key="$1"
|
|
1701
|
local default_value="$2"
|
|
1701
|
local default_value="$2"
|
|
1702
|
|
|
1702
|
|
|
1703
|
config_load
|
|
1703
|
config_load
|
|
1704
|
echo "${ini["$key"]:-$default_value}"
|
|
1704
|
echo "${ini["$key"]:-$default_value}"
|
|
1705
|
}
|
|
1705
|
}
|
|
1706
|
|
|
1706
|
|
|
1707
|
config_set() {
|
|
1707
|
config_set() {
|
|
1708
|
local key="$1"
|
|
1708
|
local key="$1"
|
|
1709
|
shift
|
|
1709
|
shift
|
|
1710
|
local value="$*"
|
|
1710
|
local value="$*"
|
|
1711
|
|
|
1711
|
|
|
1712
|
config_load
|
|
1712
|
config_load
|
|
1713
|
ini["$key"]="$value"
|
|
1713
|
ini["$key"]="$value"
|
|
1714
|
config_save
|
|
1714
|
config_save
|
|
1715
|
}
|
|
1715
|
}
|
|
1716
|
|
|
1716
|
|
|
1717
|
config_del() {
|
|
1717
|
config_del() {
|
|
1718
|
local key="$1"
|
|
1718
|
local key="$1"
|
|
1719
|
|
|
1719
|
|
|
1720
|
config_load
|
|
1720
|
config_load
|
|
1721
|
unset "ini[$key]"
|
|
1721
|
unset "ini[$key]"
|
|
1722
|
config_save
|
|
1722
|
config_save
|
|
1723
|
}
|
|
1723
|
}
|
|
1724
|
|
|
1724
|
|
|
1725
|
config_keys() {
|
|
1725
|
config_keys() {
|
|
1726
|
config_load
|
|
1726
|
config_load
|
|
1727
|
ini_keys
|
|
1727
|
ini_keys
|
|
1728
|
}
|
|
1728
|
}
|
|
1729
|
|
|
1729
|
|
|
1730
|
config_has_key() {
|
|
1730
|
config_has_key() {
|
|
1731
|
[[ $(config_get "$1") ]]
|
|
1731
|
[[ $(config_get "$1") ]]
|
|
1732
|
}
|
|
1732
|
}
|
|
1733
|
|
|
1733
|
|
|
1734
|
config_reload() {
|
|
1734
|
config_reload() {
|
|
1735
|
declare -g config_loaded=false
|
|
1735
|
declare -g config_loaded=false
|
|
1736
|
config_load
|
|
1736
|
config_load
|
|
1737
|
}
|
|
1737
|
}
|
|
1738
|
|
|
1738
|
|
|
1739
|
config_load() {
|
|
1739
|
config_load() {
|
|
1740
|
[[ "$config_loaded" == "true" ]] && return
|
|
1740
|
[[ "$config_loaded" == "true" ]] && return
|
|
1741
|
|
|
1741
|
|
|
1742
|
declare -g CONFIG_FILE=${CONFIG_FILE:=config.ini}
|
|
1742
|
declare -g CONFIG_FILE=${CONFIG_FILE:=config.ini}
|
|
1743
|
declare -g config_loaded=true
|
|
1743
|
declare -g config_loaded=true
|
|
1744
|
[[ -f "$CONFIG_FILE" ]] || touch "$CONFIG_FILE"
|
|
1744
|
[[ -f "$CONFIG_FILE" ]] || touch "$CONFIG_FILE"
|
|
1745
|
ini_load "$CONFIG_FILE"
|
|
1745
|
ini_load "$CONFIG_FILE"
|
|
1746
|
}
|
|
1746
|
}
|
|
1747
|
|
|
1747
|
|
|
1748
|
config_save() {
|
|
1748
|
config_save() {
|
|
1749
|
ini_save "$CONFIG_FILE"
|
|
1749
|
ini_save "$CONFIG_FILE"
|
|
1750
|
}
|
|
1750
|
}
|
|
1751
|
|
|
1751
|
|
|
1752
|
# src/lib/dotenv.sh
|
|
1752
|
# src/lib/dotenv.sh
|
|
1753
|
|
|
1753
|
|
|
1754
|
__dotenv=
|
|
1754
|
__dotenv=
|
|
1755
|
__dotenv_file=
|
|
1755
|
__dotenv_file=
|
|
1756
|
__dotenv_cmd=.env
|
|
1756
|
__dotenv_cmd=.env
|
|
1757
|
|
|
1757
|
|
|
1758
|
.env() {
|
|
1758
|
.env() {
|
|
1759
|
REPLY=()
|
|
1759
|
REPLY=()
|
|
1760
|
[[ $__dotenv_file || ${1-} == -* ]] || .env.--file .env || return
|
|
1760
|
[[ $__dotenv_file || ${1-} == -* ]] || .env.--file .env || return
|
|
1761
|
if declare -F -- ".env.${1-}" >/dev/null; then .env."$@"; return ; fi
|
|
1761
|
if declare -F -- ".env.${1-}" >/dev/null; then .env."$@"; return ; fi
|
|
1762
|
.env --help >&2; return 64
|
|
1762
|
.env --help >&2; return 64
|
|
1763
|
}
|
|
1763
|
}
|
|
1764
|
|
|
1764
|
|
|
1765
|
.env.-f() { .env.--file "$@"; }
|
|
1765
|
.env.-f() { .env.--file "$@"; }
|
|
1766
|
|
|
1766
|
|
|
1767
|
.env.get() {
|
|
1767
|
.env.get() {
|
|
1768
|
.env::arg "get requires a key" "$@" &&
|
|
1768
|
.env::arg "get requires a key" "$@" &&
|
|
1769
|
[[ "$__dotenv" =~ ^(.*(^|$'\n'))([ ]*)"$1="(.*)$ ]] &&
|
|
1769
|
[[ "$__dotenv" =~ ^(.*(^|$'\n'))([ ]*)"$1="(.*)$ ]] &&
|
|
1770
|
REPLY=${BASH_REMATCH[4]%%$'\n'*} && REPLY=${REPLY%"${REPLY##*[![:space:]]}"}
|
|
1770
|
REPLY=${BASH_REMATCH[4]%%$'\n'*} && REPLY=${REPLY%"${REPLY##*[![:space:]]}"}
|
|
1771
|
}
|
|
1771
|
}
|
|
1772
|
|
|
1772
|
|
|
1773
|
.env.parse() {
|
|
1773
|
.env.parse() {
|
|
1774
|
local line key
|
|
1774
|
local line key
|
|
1775
|
while IFS= read -r line; do
|
|
1775
|
while IFS= read -r line; do
|
|
1776
|
line=${line#"${line%%[![:space:]]*}"} # trim leading whitespace
|
|
1776
|
line=${line#"${line%%[![:space:]]*}"} # trim leading whitespace
|
|
1777
|
line=${line%"${line##*[![:space:]]}"} # trim trailing whitespace
|
|
1777
|
line=${line%"${line##*[![:space:]]}"} # trim trailing whitespace
|
|
1778
|
if [[ ! "$line" || "$line" == '#'* ]]; then continue ; fi
|
|
1778
|
if [[ ! "$line" || "$line" == '#'* ]]; then continue ; fi
|
|
1779
|
if (($#)); then
|
|
1779
|
if (($#)); then
|
|
1780
|
for key; do
|
|
1780
|
for key; do
|
|
1781
|
if [[ $key == "${line%%=*}" ]]; then REPLY+=("$line"); break;
|
|
1781
|
if [[ $key == "${line%%=*}" ]]; then REPLY+=("$line"); break;
|
|
1782
|
fi
|
|
1782
|
fi
|
|
1783
|
done
|
|
1783
|
done
|
|
1784
|
else
|
|
1784
|
else
|
|
1785
|
REPLY+=("$line")
|
|
1785
|
REPLY+=("$line")
|
|
1786
|
fi
|
|
1786
|
fi
|
|
1787
|
done <<<"$__dotenv"
|
|
1787
|
done <<<"$__dotenv"
|
|
1788
|
((${#REPLY[@]}))
|
|
1788
|
((${#REPLY[@]}))
|
|
1789
|
}
|
|
1789
|
}
|
|
1790
|
|
|
1790
|
|
|
1791
|
.env.export() { ! .env.parse "$@" || export "${REPLY[@]}"; }
|
|
1791
|
.env.export() { ! .env.parse "$@" || export "${REPLY[@]}"; }
|
|
1792
|
|
|
1792
|
|
|
1793
|
.env.set() {
|
|
1793
|
.env.set() {
|
|
1794
|
.env::file load || return ; local key saved=$__dotenv
|
|
1794
|
.env::file load || return ; local key saved=$__dotenv
|
|
1795
|
while (($#)); do
|
|
1795
|
while (($#)); do
|
|
1796
|
key=${1#+}; key=${key%%=*}
|
|
1796
|
key=${1#+}; key=${key%%=*}
|
|
1797
|
if .env.get "$key"; then
|
|
1797
|
if .env.get "$key"; then
|
|
1798
|
REPLY=()
|
|
1798
|
REPLY=()
|
|
1799
|
if [[ $1 == +* ]]; then shift; continue # skip if already found
|
|
1799
|
if [[ $1 == +* ]]; then shift; continue # skip if already found
|
|
1800
|
elif [[ $1 == *=* ]]; then
|
|
1800
|
elif [[ $1 == *=* ]]; then
|
|
1801
|
__dotenv=${BASH_REMATCH[1]}${BASH_REMATCH[3]}$1$'\n'${BASH_REMATCH[4]#*$'\n'}
|
|
1801
|
__dotenv=${BASH_REMATCH[1]}${BASH_REMATCH[3]}$1$'\n'${BASH_REMATCH[4]#*$'\n'}
|
|
1802
|
else
|
|
1802
|
else
|
|
1803
|
__dotenv=${BASH_REMATCH[1]}${BASH_REMATCH[4]#*$'\n'}
|
|
1803
|
__dotenv=${BASH_REMATCH[1]}${BASH_REMATCH[4]#*$'\n'}
|
|
1804
|
continue # delete all occurrences
|
|
1804
|
continue # delete all occurrences
|
|
1805
|
fi
|
|
1805
|
fi
|
|
1806
|
elif [[ $1 == *=* ]]; then
|
|
1806
|
elif [[ $1 == *=* ]]; then
|
|
1807
|
__dotenv+="${1#+}"$'\n'
|
|
1807
|
__dotenv+="${1#+}"$'\n'
|
|
1808
|
fi
|
|
1808
|
fi
|
|
1809
|
shift
|
|
1809
|
shift
|
|
1810
|
done
|
|
1810
|
done
|
|
1811
|
[[ $__dotenv == "$saved" ]] || .env::file save
|
|
1811
|
[[ $__dotenv == "$saved" ]] || .env::file save
|
|
1812
|
}
|
|
1812
|
}
|
|
1813
|
|
|
1813
|
|
|
1814
|
.env.puts() { echo "${1-}">>"$__dotenv_file" && __dotenv+="$1"$'\n'; }
|
|
1814
|
.env.puts() { echo "${1-}">>"$__dotenv_file" && __dotenv+="$1"$'\n'; }
|
|
1815
|
|
|
1815
|
|
|
1816
|
.env.generate() {
|
|
1816
|
.env.generate() {
|
|
1817
|
.env::arg "key required for generate" "$@" || return
|
|
1817
|
.env::arg "key required for generate" "$@" || return
|
|
1818
|
.env.get "$1" && return || REPLY=$("${@:2}") || return
|
|
1818
|
.env.get "$1" && return || REPLY=$("${@:2}") || return
|
|
1819
|
.env::one "generate: ouptut of '${*:2}' has more than one line" "$REPLY" || return
|
|
1819
|
.env::one "generate: ouptut of '${*:2}' has more than one line" "$REPLY" || return
|
|
1820
|
.env.puts "$1=$REPLY"
|
|
1820
|
.env.puts "$1=$REPLY"
|
|
1821
|
}
|
|
1821
|
}
|
|
1822
|
|
|
1822
|
|
|
1823
|
.env.--file() {
|
|
1823
|
.env.--file() {
|
|
1824
|
.env::arg "filename required for --file" "$@" || return
|
|
1824
|
.env::arg "filename required for --file" "$@" || return
|
|
1825
|
__dotenv_file=$1; .env::file load || return
|
|
1825
|
__dotenv_file=$1; .env::file load || return
|
|
1826
|
(($#<2)) || .env "${@:2}"
|
|
1826
|
(($#<2)) || .env "${@:2}"
|
|
1827
|
}
|
|
1827
|
}
|
|
1828
|
|
|
1828
|
|
|
1829
|
.env::arg() { [[ "${2-}" ]] || { echo "$__dotenv_cmd: $1" >&2; return 64; }; }
|
|
1829
|
.env::arg() { [[ "${2-}" ]] || { echo "$__dotenv_cmd: $1" >&2; return 64; }; }
|
|
1830
|
|
|
1830
|
|
|
1831
|
.env::one() { [[ "$2" != *$'\n'* ]] || .env::arg "$1"; }
|
|
1831
|
.env::one() { [[ "$2" != *$'\n'* ]] || .env::arg "$1"; }
|
|
1832
|
|
|
1832
|
|
|
1833
|
.env::file() {
|
|
1833
|
.env::file() {
|
|
1834
|
local REPLY=$__dotenv_file
|
|
1834
|
local REPLY=$__dotenv_file
|
|
1835
|
case "$1" in
|
|
1835
|
case "$1" in
|
|
1836
|
load)
|
|
1836
|
load)
|
|
1837
|
__dotenv=; ! [[ -f "$REPLY" ]] || __dotenv="$(<"$REPLY")"$'\n' || return ;;
|
|
1837
|
__dotenv=; ! [[ -f "$REPLY" ]] || __dotenv="$(<"$REPLY")"$'\n' || return ;;
|
|
1838
|
save)
|
|
1838
|
save)
|
|
1839
|
if [[ -L "$REPLY" ]] && declare -F -- realpath.resolved >/dev/null; then
|
|
1839
|
if [[ -L "$REPLY" ]] && declare -F -- realpath.resolved >/dev/null; then
|
|
1840
|
realpath.resolved "$REPLY"
|
|
1840
|
realpath.resolved "$REPLY"
|
|
1841
|
fi
|
|
1841
|
fi
|
|
1842
|
{ [[ ! -f "$REPLY" ]] || cp -p "$REPLY" "$REPLY.bak"; } &&
|
|
1842
|
{ [[ ! -f "$REPLY" ]] || cp -p "$REPLY" "$REPLY.bak"; } &&
|
|
1843
|
printf %s "$__dotenv" >"$REPLY.bak" && mv "$REPLY.bak" "$REPLY"
|
|
1843
|
printf %s "$__dotenv" >"$REPLY.bak" && mv "$REPLY.bak" "$REPLY"
|
|
1844
|
esac
|
|
1844
|
esac
|
|
1845
|
}
|
|
1845
|
}
|
|
1846
|
#
|
|
1846
|
#
|
|
1847
|
#__dotenv() {
|
|
1847
|
#__dotenv() {
|
|
1848
|
# set -eu
|
|
1848
|
# set -eu
|
|
1849
|
# __dotenv_cmd=${0##*/}
|
|
1849
|
# __dotenv_cmd=${0##*/}
|
|
1850
|
# .env.export() { .env.parse "$@" || return 0; printf 'export %q\n' "${REPLY[@]}"; REPLY=(); }
|
|
1850
|
# .env.export() { .env.parse "$@" || return 0; printf 'export %q\n' "${REPLY[@]}"; REPLY=(); }
|
|
1851
|
# .env "$@" || return $?
|
|
1851
|
# .env "$@" || return $?
|
|
1852
|
# ${REPLY[@]+printf '%s\n' "${REPLY[@]}"}
|
|
1852
|
# ${REPLY[@]+printf '%s\n' "${REPLY[@]}"}
|
|
1853
|
#}
|
|
1853
|
#}
|
|
1854
|
#if [[ $0 == "${BASH_SOURCE-}" ]]; then __dotenv "$@"; exit; fi
|
|
1854
|
#if [[ $0 == "${BASH_SOURCE-}" ]]; then __dotenv "$@"; exit; fi
|
|
1855
|
|
|
1855
|
|
|
1856
|
# src/lib/get_docker_definitions.sh
|
|
1856
|
# src/lib/get_docker_definitions.sh
|
|
1857
|
|
|
1857
|
|
|
1858
|
get_docker_definitions() {
|
|
1858
|
get_docker_definitions() {
|
|
1859
|
SOURCE_DIR=$PWD
|
|
1859
|
SOURCE_DIR=$PWD
|
|
1860
|
RHODECODE_DOCKER_HASH=$1
|
|
1860
|
RHODECODE_DOCKER_HASH=$1
|
|
1861
|
FULL_MODE=$2
|
|
1861
|
FULL_MODE=$2
|
|
1862
|
DEBUG=$3
|
|
1862
|
DEBUG=$3
|
|
1863
|
|
|
1863
|
|
|
1864
|
# download sources
|
|
1864
|
# download sources
|
|
1865
|
echo "bootstrap_definitions: download rhodecode docker definitions from $SERVER_URL"
|
|
1865
|
echo "bootstrap_definitions: download rhodecode docker definitions from $SERVER_URL"
|
|
1866
|
echo ""
|
|
1866
|
echo ""
|
|
1867
|
extracted_arcive_dir="rhodecode-enterprise-docker-id-bacb-sub-0-archive-all"
|
|
1867
|
extracted_arcive_dir="rhodecode-enterprise-docker-id-bacb-sub-0-archive-all"
|
|
1868
|
|
|
1868
|
|
|
1869
|
if [ $DEBUG ]; then
|
|
1869
|
if [ $DEBUG ]; then
|
|
1870
|
echo "bootstrap_definitions: downloading: $SERVER_URL/rhodecode-enterprise-docker/archive/$RHODECODE_DOCKER_HASH.tgz?with_hash=0"
|
|
1870
|
echo "bootstrap_definitions: downloading: $SERVER_URL/rhodecode-enterprise-docker/archive/$RHODECODE_DOCKER_HASH.tgz?with_hash=0"
|
|
1871
|
curl --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-enterprise-docker/archive/$RHODECODE_DOCKER_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR
|
|
1871
|
curl --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-enterprise-docker/archive/$RHODECODE_DOCKER_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR
|
|
1872
|
|
|
1872
|
|
|
1873
|
echo "extracted archive to $SOURCE_DIR"
|
|
1873
|
echo "extracted archive to $SOURCE_DIR"
|
|
1874
|
echo "bootstrap_definitions: running CP $SOURCE_DIR/$extracted_arcive_dir/* $SOURCE_DIR"
|
|
1874
|
echo "bootstrap_definitions: running CP $SOURCE_DIR/$extracted_arcive_dir/* $SOURCE_DIR"
|
|
1875
|
cp_backup_verbose $SOURCE_DIR/*rhodecode-enterprise-docker-plain/* $SOURCE_DIR
|
|
1875
|
cp_backup_verbose $SOURCE_DIR/*rhodecode-enterprise-docker-plain/* $SOURCE_DIR
|
|
1876
|
|
|
1876
|
|
|
1877
|
echo "bootstrap_definitions: removing $SOURCE_DIR/$extracted_arcive_dir"
|
|
1877
|
echo "bootstrap_definitions: removing $SOURCE_DIR/$extracted_arcive_dir"
|
|
1878
|
rm -r $SOURCE_DIR/$extracted_arcive_dir
|
|
1878
|
rm -r $SOURCE_DIR/$extracted_arcive_dir
|
|
1879
|
else
|
|
1879
|
else
|
|
1880
|
curl -s --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-enterprise-docker/archive/$RHODECODE_DOCKER_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR
|
|
1880
|
curl -s --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-enterprise-docker/archive/$RHODECODE_DOCKER_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR
|
|
1881
|
|
|
1881
|
|
|
1882
|
cp_backup $SOURCE_DIR/$extracted_arcive_dir/* $SOURCE_DIR
|
|
1882
|
cp_backup $SOURCE_DIR/$extracted_arcive_dir/* $SOURCE_DIR
|
|
1883
|
|
|
1883
|
|
|
1884
|
rm -r $SOURCE_DIR/$extracted_arcive_dir
|
|
1884
|
rm -r $SOURCE_DIR/$extracted_arcive_dir
|
|
1885
|
fi
|
|
1885
|
fi
|
|
1886
|
|
|
1886
|
|
|
1887
|
echo "$(green bootstrap_definitions: docker definitions extracted to $SOURCE_DIR)"
|
|
1887
|
echo "$(green bootstrap_definitions: docker definitions extracted to $SOURCE_DIR)"
|
|
1888
|
|
|
1888
|
|
|
1889
|
# cleanup of backup files, just good to have, ignore any warnings
|
|
1889
|
# cleanup of backup files, just good to have, ignore any warnings
|
|
1890
|
# NOTE: Disabled for backward compat
|
|
1890
|
# NOTE: Disabled for backward compat
|
|
1891
|
#find "$SOURCE_DIR" -nowarn -ignore_readdir_race -iname "*.~*~" -delete 2> /dev/null
|
|
1891
|
#find "$SOURCE_DIR" -nowarn -ignore_readdir_race -iname "*.~*~" -delete 2> /dev/null
|
|
1892
|
|
|
1892
|
|
|
1893
|
# some cleanup of things we don't need in cli
|
|
1893
|
# some cleanup of things we don't need in cli
|
|
1894
|
if [[ ! $FULL_MODE ]]; then
|
|
1894
|
if [[ ! $FULL_MODE ]]; then
|
|
1895
|
rm dev-tools
|
|
1895
|
rm dev-tools
|
|
1896
|
rm -r scripts/dev-tools
|
|
1896
|
rm -r scripts/dev-tools
|
|
1897
|
rm -r entrypoints.d
|
|
1897
|
rm -r entrypoints.d
|
|
1898
|
fi
|
|
1898
|
fi
|
|
1899
|
}
|
|
1899
|
}
|
|
1900
|
|
|
1900
|
|
|
1901
|
# src/lib/ini.sh
|
|
1901
|
# src/lib/ini.sh
|
|
1902
|
|
|
1902
|
|
|
1903
|
ini_load() {
|
|
1903
|
ini_load() {
|
|
1904
|
declare -gA ini
|
|
1904
|
declare -gA ini
|
|
1905
|
|
|
1905
|
|
|
1906
|
local ini_file="$1"
|
|
1906
|
local ini_file="$1"
|
|
1907
|
|
|
1907
|
|
|
1908
|
local section=""
|
|
1908
|
local section=""
|
|
1909
|
local key=""
|
|
1909
|
local key=""
|
|
1910
|
local value=""
|
|
1910
|
local value=""
|
|
1911
|
local section_regex="^\[(.+)\]"
|
|
1911
|
local section_regex="^\[(.+)\]"
|
|
1912
|
local key_regex="^([^ =]+) *= *(.*) *$"
|
|
1912
|
local key_regex="^([^ =]+) *= *(.*) *$"
|
|
1913
|
local comment_regex="^;"
|
|
1913
|
local comment_regex="^;"
|
|
1914
|
|
|
1914
|
|
|
1915
|
while IFS= read -r line; do
|
|
1915
|
while IFS= read -r line; do
|
|
1916
|
if [[ $line =~ $comment_regex ]]; then
|
|
1916
|
if [[ $line =~ $comment_regex ]]; then
|
|
1917
|
continue
|
|
1917
|
continue
|
|
1918
|
elif [[ $line =~ $section_regex ]]; then
|
|
1918
|
elif [[ $line =~ $section_regex ]]; then
|
|
1919
|
section="${BASH_REMATCH[1]}."
|
|
1919
|
section="${BASH_REMATCH[1]}."
|
|
1920
|
elif [[ $line =~ $key_regex ]]; then
|
|
1920
|
elif [[ $line =~ $key_regex ]]; then
|
|
1921
|
key="${BASH_REMATCH[1]}"
|
|
1921
|
key="${BASH_REMATCH[1]}"
|
|
1922
|
value="${BASH_REMATCH[2]}"
|
|
1922
|
value="${BASH_REMATCH[2]}"
|
|
1923
|
ini["${section}${key}"]="$value"
|
|
1923
|
ini["${section}${key}"]="$value"
|
|
1924
|
fi
|
|
1924
|
fi
|
|
1925
|
done <"$ini_file"
|
|
1925
|
done <"$ini_file"
|
|
1926
|
}
|
|
1926
|
}
|
|
1927
|
|
|
1927
|
|
|
1928
|
ini_save() {
|
|
1928
|
ini_save() {
|
|
1929
|
declare -gA ini
|
|
1929
|
declare -gA ini
|
|
1930
|
|
|
1930
|
|
|
1931
|
local ini_file="$1"
|
|
1931
|
local ini_file="$1"
|
|
1932
|
|
|
1932
|
|
|
1933
|
local current_section=""
|
|
1933
|
local current_section=""
|
|
1934
|
local has_free_keys=false
|
|
1934
|
local has_free_keys=false
|
|
1935
|
|
|
1935
|
|
|
1936
|
rm -f "$ini_file"
|
|
1936
|
rm -f "$ini_file"
|
|
1937
|
|
|
1937
|
|
|
1938
|
for key in $(ini_keys); do
|
|
1938
|
for key in $(ini_keys); do
|
|
1939
|
[[ $key == *.* ]] && continue
|
|
1939
|
[[ $key == *.* ]] && continue
|
|
1940
|
has_free_keys=true
|
|
1940
|
has_free_keys=true
|
|
1941
|
value="${ini[$key]}"
|
|
1941
|
value="${ini[$key]}"
|
|
1942
|
echo "$key = $value" >>"$ini_file"
|
|
1942
|
echo "$key = $value" >>"$ini_file"
|
|
1943
|
done
|
|
1943
|
done
|
|
1944
|
|
|
1944
|
|
|
1945
|
[[ "${has_free_keys}" == "true" ]] && echo >>"$ini_file"
|
|
1945
|
[[ "${has_free_keys}" == "true" ]] && echo >>"$ini_file"
|
|
1946
|
|
|
1946
|
|
|
1947
|
for key in $(ini_keys); do
|
|
1947
|
for key in $(ini_keys); do
|
|
1948
|
[[ $key == *.* ]] || continue
|
|
1948
|
[[ $key == *.* ]] || continue
|
|
1949
|
value="${ini[$key]}"
|
|
1949
|
value="${ini[$key]}"
|
|
1950
|
IFS="." read -r section_name key_name <<<"$key"
|
|
1950
|
IFS="." read -r section_name key_name <<<"$key"
|
|
1951
|
|
|
1951
|
|
|
1952
|
if [[ "$current_section" != "$section_name" ]]; then
|
|
1952
|
if [[ "$current_section" != "$section_name" ]]; then
|
|
1953
|
[[ $current_section ]] && echo >>"$ini_file"
|
|
1953
|
[[ $current_section ]] && echo >>"$ini_file"
|
|
1954
|
echo "[$section_name]" >>"$ini_file"
|
|
1954
|
echo "[$section_name]" >>"$ini_file"
|
|
1955
|
current_section="$section_name"
|
|
1955
|
current_section="$section_name"
|
|
1956
|
fi
|
|
1956
|
fi
|
|
1957
|
|
|
1957
|
|
|
1958
|
echo "$key_name = $value" >>"$ini_file"
|
|
1958
|
echo "$key_name = $value" >>"$ini_file"
|
|
1959
|
done
|
|
1959
|
done
|
|
1960
|
}
|
|
1960
|
}
|
|
1961
|
|
|
1961
|
|
|
1962
|
ini_show() {
|
|
1962
|
ini_show() {
|
|
1963
|
declare -gA ini
|
|
1963
|
declare -gA ini
|
|
1964
|
|
|
1964
|
|
|
1965
|
for key in $(ini_keys); do
|
|
1965
|
for key in $(ini_keys); do
|
|
1966
|
echo "$key = ${ini[$key]}"
|
|
1966
|
echo "$key = ${ini[$key]}"
|
|
1967
|
done
|
|
1967
|
done
|
|
1968
|
}
|
|
1968
|
}
|
|
1969
|
|
|
1969
|
|
|
1970
|
ini_keys() {
|
|
1970
|
ini_keys() {
|
|
1971
|
declare -gA ini
|
|
1971
|
declare -gA ini
|
|
1972
|
|
|
1972
|
|
|
1973
|
local keys=("${!ini[@]}")
|
|
1973
|
local keys=("${!ini[@]}")
|
|
1974
|
for a in "${keys[@]}"; do echo "$a"; done | sort
|
|
1974
|
for a in "${keys[@]}"; do echo "$a"; done | sort
|
|
1975
|
}
|
|
1975
|
}
|
|
1976
|
|
|
1976
|
|
|
1977
|
# src/lib/reconfigure_ini.sh
|
|
1977
|
# src/lib/reconfigure_ini.sh
|
|
1978
|
sed_replace() {
|
|
1978
|
sed_replace() {
|
|
1979
|
if [[ $ini_path == "" ]]; then
|
|
1979
|
if [[ $ini_path == "" ]]; then
|
|
1980
|
echo "ERROR: missing 'ini_path' variable"
|
|
1980
|
echo "ERROR: missing 'ini_path' variable"
|
|
1981
|
fi
|
|
1981
|
fi
|
|
1982
|
|
|
1982
|
|
|
1983
|
if [[ $DEBUG ]]; then
|
|
1983
|
if [[ $DEBUG ]]; then
|
|
1984
|
echo
|
|
1984
|
echo
|
|
1985
|
echo "sed --in-place=.replaced -E \"s/$1/$2/\" $ini_path"
|
|
1985
|
echo "sed --in-place=.replaced -E \"s/$1/$2/\" $ini_path"
|
|
1986
|
echo "pat1: $1"
|
|
1986
|
echo "pat1: $1"
|
|
1987
|
echo "pat2: $2"
|
|
1987
|
echo "pat2: $2"
|
|
1988
|
fi
|
|
1988
|
fi
|
|
1989
|
|
|
1989
|
|
|
1990
|
sed --in-place=.replaced -E "s/$1/$2/" $ini_path
|
|
1990
|
sed --in-place=.replaced -E "s/$1/$2/" $ini_path
|
|
1991
|
|
|
1991
|
|
|
1992
|
}
|
|
1992
|
}
|
|
1993
|
|
|
1993
|
|
|
1994
|
sed_safe_path() {
|
|
1994
|
sed_safe_path() {
|
|
1995
|
echo $((echo $1|sed -r 's/([\$\.\*\/\[\\^])/\\\1/g'|sed 's/[]]/\[]]/g')>&1)
|
|
1995
|
echo $((echo $1|sed -r 's/([\$\.\*\/\[\\^])/\\\1/g'|sed 's/[]]/\[]]/g')>&1)
|
|
1996
|
}
|
|
1996
|
}
|
|
1997
|
|
|
1997
|
|
|
1998
|
config_vcsserver_ini() {
|
|
1998
|
config_vcsserver_ini() {
|
|
1999
|
|
|
1999
|
|
|
2000
|
#host/port
|
|
2000
|
#host/port
|
|
2001
|
sed_replace '^#?host = .*' 'host = 0\.0\.0\.0'
|
|
2001
|
sed_replace '^#?host = .*' 'host = 0\.0\.0\.0'
|
|
2002
|
sed_replace '^#?port = .*' 'port = 10010'
|
|
2002
|
sed_replace '^#?port = .*' 'port = 10010'
|
|
2003
|
|
|
2003
|
|
|
2004
|
# workers adjustment
|
|
2004
|
# workers adjustment
|
|
2005
|
sed_replace '^#?workers = .*' 'workers = 1'
|
|
2005
|
sed_replace '^#?workers = .*' 'workers = 1'
|
|
2006
|
sed_replace '^#?memory_max_usage = .*' 'memory_max_usage = 2147483648'
|
|
2006
|
sed_replace '^#?memory_max_usage = .*' 'memory_max_usage = 2147483648'
|
|
2007
|
sed_replace '^#?core\.binary_dir = .*' 'core.binary_dir = \/usr\/local\/bin\/rhodecode_bin\/vcs_bin'
|
|
2007
|
sed_replace '^#?core\.binary_dir = .*' 'core.binary_dir = \/usr\/local\/bin\/rhodecode_bin\/vcs_bin'
|
|
2008
|
|
|
2008
|
|
|
2009
|
sed_replace '^#?rc_cache\.repo_object\.expiration_time = .*' '#rc_cache.repo_object.expiration_time = 2592000'
|
|
2009
|
sed_replace '^#?rc_cache\.repo_object\.expiration_time = .*' '#rc_cache.repo_object.expiration_time = 2592000'
|
|
2010
|
sed_replace '^#?rc_cache\.repo_object\.backend = dogpile\.cache\.rc\.redis_msgpack' 'rc_cache.repo_object.backend = dogpile.cache.rc.redis_msgpack'
|
|
2010
|
sed_replace '^#?rc_cache\.repo_object\.backend = dogpile\.cache\.rc\.redis_msgpack' 'rc_cache.repo_object.backend = dogpile.cache.rc.redis_msgpack'
|
|
2011
|
|
|
2011
|
|
|
2012
|
sed_replace '^#?rc_cache\.repo_object\.arguments\.socket_timeout = .*' 'rc_cache.repo_object.arguments.socket_timeout = 30'
|
|
2012
|
sed_replace '^#?rc_cache\.repo_object\.arguments\.socket_timeout = .*' 'rc_cache.repo_object.arguments.socket_timeout = 30'
|
|
2013
|
sed_replace '^#?rc_cache\.repo_object\.arguments\.db = .*' 'rc_cache.repo_object.arguments.db = 5'
|
|
2013
|
sed_replace '^#?rc_cache\.repo_object\.arguments\.db = .*' 'rc_cache.repo_object.arguments.db = 5'
|
|
2014
|
sed_replace '^#?rc_cache\.repo_object\.arguments\.port = .*' 'rc_cache.repo_object.arguments.port = 6379'
|
|
2014
|
sed_replace '^#?rc_cache\.repo_object\.arguments\.port = .*' 'rc_cache.repo_object.arguments.port = 6379'
|
|
2015
|
sed_replace '^#?rc_cache\.repo_object\.arguments\.host = .*' 'rc_cache.repo_object.arguments.host = redis'
|
|
2015
|
sed_replace '^#?rc_cache\.repo_object\.arguments\.host = .*' 'rc_cache.repo_object.arguments.host = redis'
|
|
2016
|
sed_replace '^#?rc_cache\.repo_object\.arguments\.redis_expiration_time = .*' 'rc_cache.repo_object.arguments.redis_expiration_time = 3592000'
|
|
2016
|
sed_replace '^#?rc_cache\.repo_object\.arguments\.redis_expiration_time = .*' 'rc_cache.repo_object.arguments.redis_expiration_time = 3592000'
|
|
2017
|
|
|
2017
|
|
|
2018
|
sed_replace '^#?cache_dir = .*' 'cache_dir = \/var\/opt\/rhodecode_data'
|
|
2018
|
sed_replace '^#?cache_dir = .*' 'cache_dir = \/var\/opt\/rhodecode_data'
|
|
2019
|
sed_replace '^#?formatter = .*' 'formatter = json'
|
|
2019
|
sed_replace '^#?formatter = .*' 'formatter = json'
|
|
2020
|
|
|
2020
|
|
|
2021
|
#statsd enable
|
|
2021
|
#statsd enable
|
|
2022
|
sed_replace '^#?statsd.enabled = .*' 'statsd.enabled = true'
|
|
2022
|
sed_replace '^#?statsd.enabled = .*' 'statsd.enabled = true'
|
|
2023
|
sed_replace '^#?statsd.statsd_host = .*' 'statsd.statsd_host = statsd-exporter'
|
|
2023
|
sed_replace '^#?statsd.statsd_host = .*' 'statsd.statsd_host = statsd-exporter'
|
|
2024
|
sed_replace '^#?statsd.statsd_port = .*' 'statsd.statsd_port = 9125'
|
|
2024
|
sed_replace '^#?statsd.statsd_port = .*' 'statsd.statsd_port = 9125'
|
|
2025
|
|
|
2025
|
|
|
2026
|
}
|
|
2026
|
}
|
|
2027
|
|
|
2027
|
|
|
2028
|
config_rhodecode_ini() {
|
|
2028
|
config_rhodecode_ini() {
|
|
2029
|
#host/port
|
|
2029
|
#host/port
|
|
2030
|
sed_replace '^#?host = .*' 'host = 0\.0\.0\.0'
|
|
2030
|
sed_replace '^#?host = .*' 'host = 0\.0\.0\.0'
|
|
2031
|
sed_replace '^#?port = .*' 'port = 10020'
|
|
2031
|
sed_replace '^#?port = .*' 'port = 10020'
|
|
2032
|
|
|
2032
|
|
|
2033
|
# workers adjustment
|
|
2033
|
# workers adjustment
|
|
2034
|
sed_replace '^#?workers = .*' 'workers = 1'
|
|
2034
|
sed_replace '^#?workers = .*' 'workers = 1'
|
|
2035
|
sed_replace '^#?memory_max_usage = .*' 'memory_max_usage = 2147483648'
|
|
2035
|
sed_replace '^#?memory_max_usage = .*' 'memory_max_usage = 2147483648'
|
|
2036
|
|
|
2036
|
|
|
2037
|
# email
|
|
2037
|
# email
|
|
2038
|
sed_replace '^#?email_prefix = .*' 'email_prefix = [RhodeCode]'
|
|
2038
|
sed_replace '^#?email_prefix = .*' 'email_prefix = [RhodeCode]'
|
|
2039
|
sed_replace '^#?app_email_from = .*' "app_email_from = rhodecode-noreply@$RC_HOSTNAME"
|
|
2039
|
sed_replace '^#?app_email_from = .*' "app_email_from = rhodecode-noreply@$RC_HOSTNAME"
|
|
2040
|
sed_replace '^#?smtp_server = .*' 'smtp_server = localhost'
|
|
2040
|
sed_replace '^#?smtp_server = .*' 'smtp_server = localhost'
|
|
2041
|
|
|
2041
|
|
|
2042
|
# app-instance-uuid
|
|
2042
|
# app-instance-uuid
|
|
2043
|
sed_replace '^app_instance_uuid = .*' "app_instance_uuid = $RC_APP_INSTANCE_UUID"
|
|
2043
|
sed_replace '^app_instance_uuid = .*' "app_instance_uuid = $RC_APP_INSTANCE_UUID"
|
|
2044
|
|
|
2044
|
|
|
2045
|
# app base
|
|
2045
|
# app base
|
|
2046
|
sed_replace '^app\.base_url = .*' "app\.base_url = $RC_APP_BASE_URL"
|
|
2046
|
sed_replace '^app\.base_url = .*' "app\.base_url = $RC_APP_BASE_URL"
|
|
2047
|
|
|
2047
|
|
|
2048
|
# set license_token
|
|
2048
|
# set license_token
|
|
2049
|
sed_replace '^#?license_token =.*' "license_token = $RC_LICENSE_TOKEN"
|
|
2049
|
sed_replace '^#?license_token =.*' "license_token = $RC_LICENSE_TOKEN"
|
|
2050
|
# set Edition
|
|
2050
|
# set Edition
|
|
2051
|
sed_replace '^use = egg:rhodecode-enterprise.*' "use = egg:rhodecode-enterprise-$RC_EDITION"
|
|
2051
|
sed_replace '^use = egg:rhodecode-enterprise.*' "use = egg:rhodecode-enterprise-$RC_EDITION"
|
|
2052
|
|
|
2052
|
|
|
2053
|
# enable celery
|
|
2053
|
# enable celery
|
|
2054
|
sed_replace '^#?use_celery = .*' 'use_celery = true'
|
|
2054
|
sed_replace '^#?use_celery = .*' 'use_celery = true'
|
|
2055
|
|
|
2055
|
|
|
2056
|
# DB
|
|
2056
|
# DB
|
|
2057
|
sed_replace '^sqlalchemy\.db1\.url =.*' "sqlalchemy\.db1\.url = $RC_SQLALCHEMY_DB1_URL"
|
|
2057
|
sed_replace '^sqlalchemy\.db1\.url =.*' "sqlalchemy\.db1\.url = $RC_SQLALCHEMY_DB1_URL"
|
|
2058
|
|
|
2058
|
|
|
2059
|
#CHANNELSTREAM WS_URL
|
|
2059
|
#CHANNELSTREAM WS_URL
|
|
2060
|
sed_replace '^#?channelstream\.ws_url =.*' "channelstream\.ws_url = $RC_CHANNELSTREAM_WS_URL"
|
|
2060
|
sed_replace '^#?channelstream\.ws_url =.*' "channelstream\.ws_url = $RC_CHANNELSTREAM_WS_URL"
|
|
2061
|
|
|
2061
|
|
|
2062
|
# set cache dir
|
|
2062
|
# set cache dir
|
|
2063
|
sed_replace '^#?cache_dir = .*' 'cache_dir = \/var\/opt\/rhodecode_data'
|
|
2063
|
sed_replace '^#?cache_dir = .*' 'cache_dir = \/var\/opt\/rhodecode_data'
|
|
2064
|
|
|
2064
|
|
|
2065
|
# set archive cache dir
|
|
2065
|
# set archive cache dir
|
|
2066
|
sed_replace '^#?archive_cache_dir = .*' 'archive_cache_dir = \/var\/opt\/rhodecode_data\/tarballcache'
|
|
2066
|
sed_replace '^#?archive_cache_dir = .*' 'archive_cache_dir = \/var\/opt\/rhodecode_data\/tarballcache'
|
|
2067
|
|
|
2067
|
|
|
2068
|
# set file_store path
|
|
2068
|
# set file_store path
|
|
2069
|
sed_replace '^#?file_store\.storage_path = .*' 'file_store.storage_path = \/var\/opt\/rhodecode_data\/file_store'
|
|
2069
|
sed_replace '^#?file_store\.storage_path = .*' 'file_store.storage_path = \/var\/opt\/rhodecode_data\/file_store'
|
|
2070
|
|
|
2070
|
|
|
2071
|
# cleanup rabbitmq example entry
|
|
2071
|
# cleanup rabbitmq example entry
|
|
2072
|
sed_replace '^#celery\.broker_url = amqp.*' ''
|
|
2072
|
sed_replace '^#celery\.broker_url = amqp.*' ''
|
|
2073
|
sed_replace '^#?celery\.broker_url = .*' 'celery\.broker_url = redis:\/\/redis:6379\/8'
|
|
2073
|
sed_replace '^#?celery\.broker_url = .*' 'celery\.broker_url = redis:\/\/redis:6379\/8'
|
|
2074
|
|
|
2074
|
|
|
2075
|
# switch beaker sessions to Redis based
|
|
2075
|
# switch beaker sessions to Redis based
|
|
2076
|
sed_replace '^#?beaker.session.type = file.*' '#beaker.session.type = file'
|
|
2076
|
sed_replace '^#?beaker.session.type = file.*' '#beaker.session.type = file'
|
|
2077
|
sed_replace '^#?beaker.session.data_dir = .*' '#beaker.session.data_dir = \/tmp\/data\/sessions'
|
|
2077
|
sed_replace '^#?beaker.session.data_dir = .*' '#beaker.session.data_dir = \/tmp\/data\/sessions'
|
|
2078
|
|
|
2078
|
|
|
2079
|
# enable redis db2
|
|
2079
|
# enable redis db2
|
|
2080
|
sed_replace '^#?beaker\.session\.type = ext:redis' 'beaker.session.type = ext:redis'
|
|
2080
|
sed_replace '^#?beaker\.session\.type = ext:redis' 'beaker.session.type = ext:redis'
|
|
2081
|
sed_replace '^#?beaker\.session\.url = redis:\/\/127.0.0.1:6379\/2' 'beaker.session.url = redis:\/\/redis:6379\/2'
|
|
2081
|
sed_replace '^#?beaker\.session\.url = redis:\/\/127.0.0.1:6379\/2' 'beaker.session.url = redis:\/\/redis:6379\/2'
|
|
2082
|
|
|
2082
|
|
|
2083
|
# sed_replace '^#?beaker.session.type = ext:database.*' 'beaker.session.type = ext:database'
|
|
2083
|
# sed_replace '^#?beaker.session.type = ext:database.*' 'beaker.session.type = ext:database'
|
|
2084
|
# sed_replace '^#?beaker.session.sa.url = postgresql.*' 'beaker.session.sa.url = postgresql://{{rhodecode_db_username}}:{{rhodecode_db_password}}@localhost/{{rhodecode_db_name}}'
|
|
2084
|
# sed_replace '^#?beaker.session.sa.url = postgresql.*' 'beaker.session.sa.url = postgresql://{{rhodecode_db_username}}:{{rhodecode_db_password}}@localhost/{{rhodecode_db_name}}'
|
|
2085
|
|
|
2085
|
|
|
2086
|
# hooks reconfigure for auto-bind to host
|
|
2086
|
# hooks reconfigure for auto-bind to host
|
|
2087
|
sed_replace '^#?vcs.hooks.host = .*' 'vcs.hooks.host = \*'
|
|
2087
|
sed_replace '^#?vcs.hooks.host = .*' 'vcs.hooks.host = \*'
|
|
2088
|
sed_replace '^#?vcs.server = .*' 'vcs.server = vcsserver:10010'
|
|
2088
|
sed_replace '^#?vcs.server = .*' 'vcs.server = vcsserver:10010'
|
|
2089
|
|
|
2089
|
|
|
2090
|
# enable SVN
|
|
2090
|
# enable SVN
|
|
2091
|
sed_replace '^#?svn.proxy.generate_config = .*' 'svn.proxy.generate_config = true'
|
|
2091
|
sed_replace '^#?svn.proxy.generate_config = .*' 'svn.proxy.generate_config = true'
|
|
2092
|
|
|
2092
|
|
|
2093
|
# enable SSH
|
|
2093
|
# enable SSH
|
|
2094
|
sed_replace '^#?ssh.generate_authorized_keyfile = .*' 'ssh.generate_authorized_keyfile = true'
|
|
2094
|
sed_replace '^#?ssh.generate_authorized_keyfile = .*' 'ssh.generate_authorized_keyfile = true'
|
|
2095
|
|
|
2095
|
|
|
2096
|
#statsd enable
|
|
2096
|
#statsd enable
|
|
2097
|
sed_replace '^#?statsd.enabled = .*' 'statsd.enabled = true'
|
|
2097
|
sed_replace '^#?statsd.enabled = .*' 'statsd.enabled = true'
|
|
2098
|
sed_replace '^#?statsd.statsd_host = .*' 'statsd.statsd_host = statsd-exporter'
|
|
2098
|
sed_replace '^#?statsd.statsd_host = .*' 'statsd.statsd_host = statsd-exporter'
|
|
2099
|
sed_replace '^#?statsd.statsd_port = .*' 'statsd.statsd_port = 9125'
|
|
2099
|
sed_replace '^#?statsd.statsd_port = .*' 'statsd.statsd_port = 9125'
|
|
2100
|
|
|
2100
|
|
|
2101
|
# the wrapper_cmd
|
|
2101
|
# the wrapper_cmd
|
|
2102
|
sed_replace '^#?ssh.wrapper_cmd = .*' 'ssh.wrapper_cmd = \/usr\/local\/bin\/rhodecode_bin\/bin\/rc-ssh-wrapper'
|
|
2102
|
sed_replace '^#?ssh.wrapper_cmd = .*' 'ssh.wrapper_cmd = \/usr\/local\/bin\/rhodecode_bin\/bin\/rc-ssh-wrapper'
|
|
2103
|
|
|
2103
|
|
|
2104
|
sed_replace '^#?api_access_controllers_whitelist = .*' 'api_access_controllers_whitelist = RepoFilesView:repo_archivefile, RepoFilesView:repo_file_raw'
|
|
2104
|
sed_replace '^#?api_access_controllers_whitelist = .*' 'api_access_controllers_whitelist = RepoFilesView:repo_archivefile, RepoFilesView:repo_file_raw'
|
|
2105
|
|
|
2105
|
|
|
2106
|
# # set search to elasticsearch
|
|
2106
|
# # set search to elasticsearch
|
|
2107
|
# # enabled modules for Whoosh we remove, we have duplicates there..
|
|
2107
|
# # enabled modules for Whoosh we remove, we have duplicates there..
|
|
2108
|
# '^search.module = .*' ''
|
|
2108
|
# '^search.module = .*' ''
|
|
2109
|
# '^search.location = .*' ''
|
|
2109
|
# '^search.location = .*' ''
|
|
2110
|
#
|
|
2110
|
#
|
|
2111
|
# '^#?search.module = .*' 'search.module = rc_elasticsearch'
|
|
2111
|
# '^#?search.module = .*' 'search.module = rc_elasticsearch'
|
|
2112
|
# '^#?search.location = .*' 'search.location = http://localhost:9200'
|
|
2112
|
# '^#?search.location = .*' 'search.location = http://localhost:9200'
|
|
2113
|
# '^#?search.es_version = .*' 'search.es_version = 6'
|
|
2113
|
# '^#?search.es_version = .*' 'search.es_version = 6'
|
|
2114
|
|
|
2114
|
|
|
2115
|
# enable Chat
|
|
2115
|
# enable Chat
|
|
2116
|
sed_replace '^#?chat.enabled = .*' 'chat.enabled = true'
|
|
2116
|
sed_replace '^#?chat.enabled = .*' 'chat.enabled = true'
|
|
2117
|
|
|
2117
|
|
|
2118
|
# logging
|
|
2118
|
# logging
|
|
2119
|
sed_replace '^#?formatter = .*' 'formatter = json'
|
|
2119
|
sed_replace '^#?formatter = .*' 'formatter = json'
|
|
2120
|
|
|
2120
|
|
|
2121
|
}
|
|
2121
|
}
|
|
2122
|
|
|
2122
|
|
|
2123
|
# src/lib/send_completions.sh
|
|
2123
|
# src/lib/send_completions.sh
|
|
2124
|
|
|
2124
|
|
|
2125
|
# src/lib/utils.sh
|
|
2125
|
# src/lib/utils.sh
|
|
2126
|
|
|
2126
|
|
|
2127
|
generate_md5() {
|
|
2127
|
generate_md5() {
|
|
2128
|
local input_string="$1"
|
|
2128
|
local input_string="$1"
|
|
2129
|
|
|
2129
|
|
|
2130
|
if command -v md5 &> /dev/null; then
|
|
2130
|
if command -v md5 &> /dev/null; then
|
|
2131
|
echo -n "$input_string" | md5
|
|
2131
|
echo -n "$input_string" | md5
|
|
2132
|
elif command -v md5sum &> /dev/null; then
|
|
2132
|
elif command -v md5sum &> /dev/null; then
|
|
2133
|
echo -n "$input_string" | md5sum | awk '{print $1}'
|
|
2133
|
echo -n "$input_string" | md5sum | awk '{print $1}'
|
|
2134
|
else
|
|
2134
|
else
|
|
2135
|
echo "Error: Neither md5 nor md5sum command is available. Please make sure this is installed in your system"
|
|
2135
|
echo "Error: Neither md5 nor md5sum command is available. Please make sure this is installed in your system"
|
|
2136
|
return 1
|
|
2136
|
return 1
|
|
2137
|
fi
|
|
2137
|
fi
|
|
2138
|
}
|
|
2138
|
}
|
|
2139
|
|
|
2139
|
|
|
2140
|
random_str() {
|
|
2140
|
random_str() {
|
|
2141
|
len=$1
|
|
2141
|
len=$1
|
|
2142
|
random_generate=$(generate_md5 $RANDOM | head -c $len)
|
|
2142
|
random_generate=$(generate_md5 $RANDOM | head -c $len)
|
|
2143
|
echo "$random_generate"
|
|
2143
|
echo "$random_generate"
|
|
2144
|
}
|
|
2144
|
}
|
|
2145
|
|
|
2145
|
|
|
2146
|
# function to copy files with --backup=numbered option
|
|
2146
|
# function to copy files with --backup=numbered option
|
|
2147
|
detect_cp_backup () {
|
|
2147
|
detect_cp_backup () {
|
|
2148
|
cp -r -f --update --backup=numbered "$@" 2>/dev/null
|
|
2148
|
cp -r -f --update --backup=numbered "$@" 2>/dev/null
|
|
2149
|
if [ $? -eq 0 ]; then
|
|
2149
|
if [ $? -eq 0 ]; then
|
|
2150
|
# if exit status is 0, --backup=numbered worked and return true
|
|
2150
|
# if exit status is 0, --backup=numbered worked and return true
|
|
2151
|
return 0
|
|
2151
|
return 0
|
|
2152
|
else
|
|
2152
|
else
|
|
2153
|
# if exit status is not 0, --backup=numbered didn't work and return false
|
|
2153
|
# if exit status is not 0, --backup=numbered didn't work and return false
|
|
2154
|
return 1
|
|
2154
|
return 1
|
|
2155
|
fi
|
|
2155
|
fi
|
|
2156
|
}
|
|
2156
|
}
|
|
2157
|
|
|
2157
|
|
|
2158
|
# function that acts like cp
|
|
2158
|
# function that acts like cp
|
|
2159
|
cp_backup () {
|
|
2159
|
cp_backup () {
|
|
2160
|
cp -r -f "$@"
|
|
2160
|
cp -r -f "$@"
|
|
2161
|
}
|
|
2161
|
}
|
|
2162
|
|
|
2162
|
|
|
2163
|
cp_backup_verbose () {
|
|
2163
|
cp_backup_verbose () {
|
|
2164
|
cp -r -f -v "$@"
|
|
2164
|
cp -r -f -v "$@"
|
|
2165
|
}
|
|
2165
|
}
|
|
2166
|
|
|
2166
|
|
|
2167
|
# version_gte checks if the version specified in $VERSION is at least the given
|
|
2167
|
# version_gte checks if the version specified in $VERSION is at least the given
|
|
2168
|
# SemVer (Maj.Minor[.Patch]), or CalVer (YY.MM) version.It returns 0 (success)
|
|
2168
|
# SemVer (Maj.Minor[.Patch]), or CalVer (YY.MM) version.It returns 0 (success)
|
|
2169
|
# if $VERSION is either unset (=latest) or newer or equal than the specified
|
|
2169
|
# if $VERSION is either unset (=latest) or newer or equal than the specified
|
|
2170
|
# version, or returns 1 (fail) otherwise.
|
|
2170
|
# version, or returns 1 (fail) otherwise.
|
|
2171
|
#
|
|
2171
|
#
|
|
2172
|
# examples:
|
|
2172
|
# examples:
|
|
2173
|
#
|
|
2173
|
#
|
|
2174
|
# VERSION=23.0
|
|
2174
|
# VERSION=23.0
|
|
2175
|
# version_gte 23.0 // 0 (success)
|
|
2175
|
# version_gte 23.0 // 0 (success)
|
|
2176
|
# version_gte 20.10 // 0 (success)
|
|
2176
|
# version_gte 20.10 // 0 (success)
|
|
2177
|
# version_gte 19.03 // 0 (success)
|
|
2177
|
# version_gte 19.03 // 0 (success)
|
|
2178
|
# version_gte 21.10 // 1 (fail)
|
|
2178
|
# version_gte 21.10 // 1 (fail)
|
|
2179
|
version_gte() {
|
|
2179
|
version_gte() {
|
|
2180
|
if [ -z "$VERSION" ]; then
|
|
2180
|
if [ -z "$VERSION" ]; then
|
|
2181
|
return 0
|
|
2181
|
return 0
|
|
2182
|
fi
|
|
2182
|
fi
|
|
2183
|
eval version_compare "$VERSION" "$1"
|
|
2183
|
eval version_compare "$VERSION" "$1"
|
|
2184
|
}
|
|
2184
|
}
|
|
2185
|
|
|
2185
|
|
|
2186
|
# version_compare compares two version strings (either SemVer (Major.Minor.Path),
|
|
2186
|
# version_compare compares two version strings (either SemVer (Major.Minor.Path),
|
|
2187
|
# or CalVer (YY.MM) version strings. It returns 0 (success) if version A is newer
|
|
2187
|
# or CalVer (YY.MM) version strings. It returns 0 (success) if version A is newer
|
|
2188
|
# or equal than version B, or 1 (fail) otherwise. Patch releases and pre-release
|
|
2188
|
# or equal than version B, or 1 (fail) otherwise. Patch releases and pre-release
|
|
2189
|
# (-alpha/-beta) are not taken into account
|
|
2189
|
# (-alpha/-beta) are not taken into account
|
|
2190
|
#
|
|
2190
|
#
|
|
2191
|
# examples:
|
|
2191
|
# examples:
|
|
2192
|
#
|
|
2192
|
#
|
|
2193
|
# version_compare 23.0.0 20.10 // 0 (success)
|
|
2193
|
# version_compare 23.0.0 20.10 // 0 (success)
|
|
2194
|
# version_compare 23.0 20.10 // 0 (success)
|
|
2194
|
# version_compare 23.0 20.10 // 0 (success)
|
|
2195
|
# version_compare 20.10 19.03 // 0 (success)
|
|
2195
|
# version_compare 20.10 19.03 // 0 (success)
|
|
2196
|
# version_compare 20.10 20.10 // 0 (success)
|
|
2196
|
# version_compare 20.10 20.10 // 0 (success)
|
|
2197
|
# version_compare 19.03 20.10 // 1 (fail)
|
|
2197
|
# version_compare 19.03 20.10 // 1 (fail)
|
|
2198
|
version_compare() (
|
|
2198
|
version_compare() (
|
|
2199
|
set +x
|
|
2199
|
set +x
|
|
2200
|
|
|
2200
|
|
|
2201
|
yy_a="$(echo "$1" | cut -d'.' -f1)"
|
|
2201
|
yy_a="$(echo "$1" | cut -d'.' -f1)"
|
|
2202
|
yy_b="$(echo "$2" | cut -d'.' -f1)"
|
|
2202
|
yy_b="$(echo "$2" | cut -d'.' -f1)"
|
|
2203
|
if [ "$yy_a" -lt "$yy_b" ]; then
|
|
2203
|
if [ "$yy_a" -lt "$yy_b" ]; then
|
|
2204
|
return 1
|
|
2204
|
return 1
|
|
2205
|
fi
|
|
2205
|
fi
|
|
2206
|
if [ "$yy_a" -gt "$yy_b" ]; then
|
|
2206
|
if [ "$yy_a" -gt "$yy_b" ]; then
|
|
2207
|
return 0
|
|
2207
|
return 0
|
|
2208
|
fi
|
|
2208
|
fi
|
|
2209
|
mm_a="$(echo "$1" | cut -d'.' -f2)"
|
|
2209
|
mm_a="$(echo "$1" | cut -d'.' -f2)"
|
|
2210
|
mm_b="$(echo "$2" | cut -d'.' -f2)"
|
|
2210
|
mm_b="$(echo "$2" | cut -d'.' -f2)"
|
|
2211
|
|
|
2211
|
|
|
2212
|
# trim leading zeros to accommodate CalVer
|
|
2212
|
# trim leading zeros to accommodate CalVer
|
|
2213
|
mm_a="${mm_a#0}"
|
|
2213
|
mm_a="${mm_a#0}"
|
|
2214
|
mm_b="${mm_b#0}"
|
|
2214
|
mm_b="${mm_b#0}"
|
|
2215
|
|
|
2215
|
|
|
2216
|
if [ "${mm_a:-0}" -lt "${mm_b:-0}" ]; then
|
|
2216
|
if [ "${mm_a:-0}" -lt "${mm_b:-0}" ]; then
|
|
2217
|
return 1
|
|
2217
|
return 1
|
|
2218
|
fi
|
|
2218
|
fi
|
|
2219
|
|
|
2219
|
|
|
2220
|
return 0
|
|
2220
|
return 0
|
|
2221
|
)
|
|
2221
|
)
|
|
2222
|
|
|
2222
|
|
|
2223
|
# src/lib/validate_stack_exists.sh
|
|
2223
|
# src/lib/validate_stack_exists.sh
|
|
2224
|
|
|
2224
|
|
|
2225
|
validate_stack_exists() {
|
|
2225
|
validate_stack_exists() {
|
|
2226
|
err=""
|
|
2226
|
err=""
|
|
2227
|
invalid="1"
|
|
2227
|
invalid="1"
|
|
2228
|
|
|
2228
|
|
|
2229
|
for item in $VALID_SERVICES
|
|
2229
|
for item in $VALID_SERVICES
|
|
2230
|
do
|
|
2230
|
do
|
|
2231
|
if [ "$1" == "$item" ]; then
|
|
2231
|
if [ "$1" == "$item" ]; then
|
|
2232
|
invalid=""
|
|
2232
|
invalid=""
|
|
2233
|
break
|
|
2233
|
break
|
|
2234
|
fi
|
|
2234
|
fi
|
|
2235
|
done
|
|
2235
|
done
|
|
2236
|
|
|
2236
|
|
|
2237
|
if [[ -n $invalid ]]; then
|
|
2237
|
if [[ -n $invalid ]]; then
|
|
2238
|
err="command '$1' not in list of $VALID_SERVICES"
|
|
2238
|
err="command '$1' not in list of $VALID_SERVICES"
|
|
2239
|
fi
|
|
2239
|
fi
|
|
2240
|
|
|
2240
|
|
|
2241
|
echo $err
|
|
2241
|
echo $err
|
|
2242
|
}
|
|
2242
|
}
|
|
2243
|
|
|
2243
|
|
|
2244
|
# src/lib/validations/validate_dir_exists.sh
|
|
2244
|
# src/lib/validations/validate_dir_exists.sh
|
|
2245
|
validate_dir_exists() {
|
|
2245
|
validate_dir_exists() {
|
|
2246
|
[[ -d "$1" ]] || echo "must be an existing directory"
|
|
2246
|
[[ -d "$1" ]] || echo "must be an existing directory"
|
|
2247
|
}
|
|
2247
|
}
|
|
2248
|
|
|
2248
|
|
|
2249
|
# src/lib/validations/validate_file_exists.sh
|
|
2249
|
# src/lib/validations/validate_file_exists.sh
|
|
2250
|
validate_file_exists() {
|
|
2250
|
validate_file_exists() {
|
|
2251
|
[[ -f "$1" ]] || echo "must be an existing file"
|
|
2251
|
[[ -f "$1" ]] || echo "must be an existing file"
|
|
2252
|
}
|
|
2252
|
}
|
|
2253
|
|
|
2253
|
|
|
2254
|
# src/lib/validations/validate_integer.sh
|
|
2254
|
# src/lib/validations/validate_integer.sh
|
|
2255
|
validate_integer() {
|
|
2255
|
validate_integer() {
|
|
2256
|
[[ "$1" =~ ^[0-9]+$ ]] || echo "must be an integer"
|
|
2256
|
[[ "$1" =~ ^[0-9]+$ ]] || echo "must be an integer"
|
|
2257
|
}
|
|
2257
|
}
|
|
2258
|
|
|
2258
|
|
|
2259
|
# src/lib/validations/validate_not_empty.sh
|
|
2259
|
# src/lib/validations/validate_not_empty.sh
|
|
2260
|
validate_not_empty() {
|
|
2260
|
validate_not_empty() {
|
|
2261
|
[[ -z "$1" ]] && echo "must not be empty"
|
|
2261
|
[[ -z "$1" ]] && echo "must not be empty"
|
|
2262
|
}
|
|
2262
|
}
|
|
2263
|
|
|
2263
|
|
|
2264
|
# :command.command_functions
|
|
2264
|
# :command.command_functions
|
|
2265
|
# :command.function
|
|
2265
|
# :command.function
|
|
2266
|
rcstack_get_started_command() {
|
|
2266
|
rcstack_get_started_command() {
|
|
2267
|
# src/get_started_command.sh
|
|
2267
|
# src/get_started_command.sh
|
|
2268
|
get_started_full
|
|
2268
|
get_started_full
|
|
2269
|
}
|
|
2269
|
}
|
|
2270
|
|
|
2270
|
|
|
2271
|
# :command.function
|
|
2271
|
# :command.function
|
|
2272
|
rcstack_init_command() {
|
|
2272
|
rcstack_init_command() {
|
|
2273
|
# src/init_command.sh
|
|
2273
|
# src/init_command.sh
|
|
2274
|
DEBUG=${args[--debug]}
|
|
2274
|
DEBUG=${args[--debug]}
|
|
2275
|
force=${args[--force]}
|
|
2275
|
force=${args[--force]}
|
|
2276
|
docker_revision=${args[--docker-revision]}
|
|
2276
|
docker_revision=${args[--docker-revision]}
|
|
2277
|
install_docker=${args[--install-docker]}
|
|
2277
|
install_docker=${args[--install-docker]}
|
|
2278
|
no_prompt=${args[--no-prompt]}
|
|
2278
|
no_prompt=${args[--no-prompt]}
|
|
2279
|
|
|
2279
|
|
|
2280
|
eval "stages_from_cli=(${args[--stage]})"
|
|
2280
|
eval "stages_from_cli=(${args[--stage]})"
|
|
2281
|
|
|
2281
|
|
|
2282
|
# CLI passed args / defaults
|
|
2282
|
# CLI passed args / defaults
|
|
2283
|
|
|
2283
|
|
|
2284
|
if [[ -z ${args['--arg-rc-edition']} ]]; then
|
|
2284
|
if [[ -z ${args['--arg-rc-edition']} ]]; then
|
|
2285
|
# set default
|
|
2285
|
# set default
|
|
2286
|
args['--arg-rc-edition']="ee"
|
|
2286
|
args['--arg-rc-edition']="ee"
|
|
2287
|
else
|
|
2287
|
else
|
|
2288
|
# mark we used flag and don't ask in prompts
|
|
2288
|
# mark we used flag and don't ask in prompts
|
|
2289
|
args['__arg_rc_edition']=1
|
|
2289
|
args['__arg_rc_edition']=1
|
|
2290
|
fi
|
|
2290
|
fi
|
|
2291
|
|
|
2291
|
|
|
|
|
|
2292
|
if [[ -z ${args['--arg-accept-eula']} ]]; then
|
|
|
|
|
2293
|
# set default
|
|
|
|
|
2294
|
args['--arg-accept-eula']="yes"
|
|
|
|
|
2295
|
else
|
|
|
|
|
2296
|
# mark we used flag and don't ask in prompts
|
|
|
|
|
2297
|
args['__arg_accept_eula']=1
|
|
|
|
|
2298
|
fi
|
|
|
|
|
2299
|
|
|
2292
|
if [[ -z ${args['--arg-hostname']} ]]; then
|
|
2300
|
if [[ -z ${args['--arg-hostname']} ]]; then
|
|
2293
|
# set default
|
|
2301
|
# set default
|
|
2294
|
args['--arg-hostname']="rhodecode.local"
|
|
2302
|
args['--arg-hostname']="rhodecode.local"
|
|
2295
|
else
|
|
2303
|
else
|
|
2296
|
# mark we used flag and don't ask in prompts
|
|
2304
|
# mark we used flag and don't ask in prompts
|
|
2297
|
args['__arg_hostname']=1
|
|
2305
|
args['__arg_hostname']=1
|
|
2298
|
fi
|
|
2306
|
fi
|
|
2299
|
|
|
2307
|
|
|
2300
|
if [[ -z ${args['--arg-use-ssl']} ]]; then
|
|
2308
|
if [[ -z ${args['--arg-use-ssl']} ]]; then
|
|
2301
|
# set default
|
|
2309
|
# set default
|
|
2302
|
args['--arg-use-ssl']="n"
|
|
2310
|
args['--arg-use-ssl']="n"
|
|
2303
|
else
|
|
2311
|
else
|
|
2304
|
# mark we used flag and don't ask in prompts
|
|
2312
|
# mark we used flag and don't ask in prompts
|
|
2305
|
args['__arg_use_ssl']=1
|
|
2313
|
args['__arg_use_ssl']=1
|
|
2306
|
fi
|
|
2314
|
fi
|
|
2307
|
|
|
2315
|
|
|
2308
|
if [[ -z ${args['--arg-admin-email']} ]]; then
|
|
2316
|
if [[ -z ${args['--arg-admin-email']} ]]; then
|
|
2309
|
# set default
|
|
2317
|
# set default
|
|
2310
|
args['--arg-admin-email']="admin@${args['--arg-hostname']}"
|
|
2318
|
args['--arg-admin-email']="admin@${args['--arg-hostname']}"
|
|
2311
|
else
|
|
2319
|
else
|
|
2312
|
# mark we used flag and don't ask in prompts
|
|
2320
|
# mark we used flag and don't ask in prompts
|
|
2313
|
args['__arg_admin_email']=1
|
|
2321
|
args['__arg_admin_email']=1
|
|
2314
|
fi
|
|
2322
|
fi
|
|
2315
|
|
|
2323
|
|
|
2316
|
if [[ -z ${args['--arg-admin-user']} ]]; then
|
|
2324
|
if [[ -z ${args['--arg-admin-user']} ]]; then
|
|
2317
|
# set default
|
|
2325
|
# set default
|
|
2318
|
args['--arg-admin-user']="admin"
|
|
2326
|
args['--arg-admin-user']="admin"
|
|
2319
|
else
|
|
2327
|
else
|
|
2320
|
# mark we used flag and don't ask in prompts
|
|
2328
|
# mark we used flag and don't ask in prompts
|
|
2321
|
args['__arg_admin_user']=1
|
|
2329
|
args['__arg_admin_user']=1
|
|
2322
|
fi
|
|
2330
|
fi
|
|
2323
|
|
|
2331
|
|
|
2324
|
if [[ -z ${args['--arg-admin-pass']} ]]; then
|
|
2332
|
if [[ -z ${args['--arg-admin-pass']} ]]; then
|
|
2325
|
# set default
|
|
2333
|
# set default
|
|
2326
|
args['--arg-admin-pass']="secret4"
|
|
2334
|
args['--arg-admin-pass']="secret4"
|
|
2327
|
else
|
|
2335
|
else
|
|
2328
|
# mark we used flag and don't ask in prompts
|
|
2336
|
# mark we used flag and don't ask in prompts
|
|
2329
|
args['__arg_admin_pass']=1
|
|
2337
|
args['__arg_admin_pass']=1
|
|
2330
|
fi
|
|
2338
|
fi
|
|
2331
|
|
|
2339
|
|
|
2332
|
if [[ -z ${args['--arg-license-token']} ]]; then
|
|
2340
|
if [[ -z ${args['--arg-license-token']} ]]; then
|
|
2333
|
# set default
|
|
2341
|
# set default
|
|
2334
|
args['--arg-license-token']="$(random_str 4)"-"$(random_str 4)"-"$(random_str 4)"-"$(random_str 4)"
|
|
2342
|
args['--arg-license-token']="$(random_str 4)"-"$(random_str 4)"-"$(random_str 4)"-"$(random_str 4)"
|
|
2335
|
else
|
|
2343
|
else
|
|
2336
|
# mark we used flag and don't ask in prompts
|
|
2344
|
# mark we used flag and don't ask in prompts
|
|
2337
|
args['__arg_license_token']=1
|
|
2345
|
args['__arg_license_token']=1
|
|
2338
|
fi
|
|
2346
|
fi
|
|
2339
|
|
|
2347
|
|
|
2340
|
if [[ -z ${args['--arg-log-formatter']} ]]; then
|
|
2348
|
if [[ -z ${args['--arg-log-formatter']} ]]; then
|
|
2341
|
# set default
|
|
2349
|
# set default
|
|
2342
|
args['--arg-log-formatter']="json"
|
|
2350
|
args['--arg-log-formatter']="json"
|
|
2343
|
else
|
|
2351
|
else
|
|
2344
|
# mark we used flag and don't ask in prompts
|
|
2352
|
# mark we used flag and don't ask in prompts
|
|
2345
|
args['__arg_log_formatter']=1
|
|
2353
|
args['__arg_log_formatter']=1
|
|
2346
|
fi
|
|
2354
|
fi
|
|
2347
|
|
|
2355
|
|
|
2348
|
arg_rc_edition=${args[--arg-rc-edition]}
|
|
2356
|
arg_rc_edition=${args[--arg-rc-edition]}
|
|
|
|
|
2357
|
arg_accept_eula=${args[--arg-accept-eula]}
|
|
2349
|
arg_hostname=${args[--arg-hostname]}
|
|
2358
|
arg_hostname=${args[--arg-hostname]}
|
|
2350
|
arg_use_ssl=${args[--arg-use-ssl]}
|
|
2359
|
arg_use_ssl=${args[--arg-use-ssl]}
|
|
2351
|
arg_admin_email=${args[--arg-admin-email]}
|
|
2360
|
arg_admin_email=${args[--arg-admin-email]}
|
|
2352
|
arg_admin_user=${args[--arg-admin-user]}
|
|
2361
|
arg_admin_user=${args[--arg-admin-user]}
|
|
2353
|
arg_admin_pass=${args[--arg-admin-pass]}
|
|
2362
|
arg_admin_pass=${args[--arg-admin-pass]}
|
|
2354
|
arg_license_token=${args[--arg-license-token]}
|
|
2363
|
arg_license_token=${args[--arg-license-token]}
|
|
2355
|
arg_log_formatter=${args[--arg-log-formatter]}
|
|
2364
|
arg_log_formatter=${args[--arg-log-formatter]}
|
|
2356
|
|
|
2365
|
|
|
2357
|
ask_user_for_config() {
|
|
2366
|
ask_user_for_config() {
|
|
2358
|
local config_done="n"
|
|
2367
|
local config_done="n"
|
|
2359
|
|
|
2368
|
|
|
2360
|
echo "Starting interactive setup..."
|
|
2369
|
echo "Starting interactive setup..."
|
|
2361
|
echo ""
|
|
2370
|
echo ""
|
|
2362
|
|
|
2371
|
|
|
2363
|
while [[ "$config_done" == "n" ]]
|
|
2372
|
while [[ "$config_done" == "n" ]]
|
|
2364
|
# config loop start
|
|
2373
|
# config loop start
|
|
2365
|
do
|
|
2374
|
do
|
|
2366
|
# edition to install
|
|
2375
|
# edition to install
|
|
2367
|
if [ ! -z "$arg_rc_edition" ] && [ -z ${args['__arg_rc_edition']} ]
|
|
2376
|
if [ ! -z "$arg_rc_edition" ] && [ -z ${args['__arg_rc_edition']} ]
|
|
2368
|
then
|
|
2377
|
then
|
|
2369
|
read -p "Select 'ee' to use Enterprise edition or type 'ce' to use Community free edition: rhodecode-[$arg_rc_edition]: " new_value
|
|
2378
|
read -p "Select 'ee' to use Enterprise edition or type 'ce' to use Community free edition: rhodecode-[$arg_rc_edition]: " new_value
|
|
2370
|
if [ ! -z "$new_value" ]
|
|
2379
|
if [ ! -z "$new_value" ]
|
|
2371
|
then
|
|
2380
|
then
|
|
2372
|
arg_rc_edition="$new_value"
|
|
2381
|
arg_rc_edition="$new_value"
|
|
2373
|
fi
|
|
2382
|
fi
|
|
2374
|
fi
|
|
2383
|
fi
|
|
2375
|
|
|
2384
|
|
|
|
|
|
2385
|
if [ ! -z "$arg_accept_eula" ] && [ -z ${args['__arg_accept_eula']} ]
|
|
|
|
|
2386
|
then
|
|
|
|
|
2387
|
if [[ $arg_rc_edition == "ee" ]]; then
|
|
|
|
|
2388
|
#EE EULA
|
|
|
|
|
2389
|
read -p "Do you accept RhodeCode EULA (see: https://docs.rhodecode.com/rcstack/eula/ee.txt) accept: 'yes' deny: 'no' ? [$arg_accept_eula]: " new_value
|
|
|
|
|
2390
|
else
|
|
|
|
|
2391
|
#CE EULA
|
|
|
|
|
2392
|
read -p "Do you accept RhodeCode EULA (see: https://docs.rhodecode.com/rcstack/eula/ce.txt) accept: 'yes' deny: 'no' ? [$arg_accept_eula]: " new_value
|
|
|
|
|
2393
|
fi
|
|
|
|
|
2394
|
|
|
|
|
|
2395
|
if [ ! -z "$new_value" ]
|
|
|
|
|
2396
|
then
|
|
|
|
|
2397
|
arg_accept_eula="$new_value"
|
|
|
|
|
2398
|
fi
|
|
|
|
|
2399
|
|
|
|
|
|
2400
|
if [[ $arg_accept_eula != "yes" ]]; then
|
|
|
|
|
2401
|
echo "$(red please accept EULA by typing yes, no installation is possible without accepted EULA)"
|
|
|
|
|
2402
|
exit
|
|
|
|
|
2403
|
fi
|
|
|
|
|
2404
|
fi
|
|
|
|
|
2405
|
|
|
2376
|
# ask for license-token IF edition is ee
|
|
2406
|
# ask for license-token IF edition is ee
|
|
2377
|
if [[ $arg_rc_edition == "ee" ]]; then
|
|
2407
|
if [[ $arg_rc_edition == "ee" ]]; then
|
|
2378
|
if [ ! -z "$arg_license_token" ] && [ -z ${args['__arg_license_token']} ]
|
|
2408
|
if [ ! -z "$arg_license_token" ] && [ -z ${args['__arg_license_token']} ]
|
|
2379
|
then
|
|
2409
|
then
|
|
2380
|
read -p "enter a valid license-token or use pre-generated one [$arg_license_token]: " new_value
|
|
2410
|
read -p "enter a valid license-token or use pre-generated one [$arg_license_token]: " new_value
|
|
2381
|
if [ ! -z "$new_value" ]
|
|
2411
|
if [ ! -z "$new_value" ]
|
|
2382
|
then
|
|
2412
|
then
|
|
2383
|
arg_license_token="$new_value"
|
|
2413
|
arg_license_token="$new_value"
|
|
2384
|
fi
|
|
2414
|
fi
|
|
2385
|
fi
|
|
2415
|
fi
|
|
2386
|
fi
|
|
2416
|
fi
|
|
2387
|
|
|
2417
|
|
|
2388
|
# hostname
|
|
2418
|
# hostname
|
|
2389
|
if [ ! -z "$arg_hostname" ] && [ -z ${args['__arg_hostname']} ]
|
|
2419
|
if [ ! -z "$arg_hostname" ] && [ -z ${args['__arg_hostname']} ]
|
|
2390
|
then
|
|
2420
|
then
|
|
2391
|
read -p "Enter a valid hostname for RhodeCode Stack? [$arg_hostname]: " new_value
|
|
2421
|
read -p "Enter a valid hostname for RhodeCode Stack? [$arg_hostname]: " new_value
|
|
2392
|
if [ ! -z "$new_value" ]
|
|
2422
|
if [ ! -z "$new_value" ]
|
|
2393
|
then
|
|
2423
|
then
|
|
2394
|
arg_hostname="$new_value"
|
|
2424
|
arg_hostname="$new_value"
|
|
2395
|
fi
|
|
2425
|
fi
|
|
2396
|
if [[ $arg_hostname =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]
|
|
2426
|
if [[ $arg_hostname =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]
|
|
2397
|
then
|
|
2427
|
then
|
|
2398
|
echo
|
|
2428
|
echo
|
|
2399
|
echo "$(red IP addresses are unsupported and will not work. Please provide a DNS hostname)"
|
|
2429
|
echo "$(red IP addresses are unsupported and will not work. Please provide a DNS hostname)"
|
|
2400
|
echo
|
|
2430
|
echo
|
|
2401
|
arg_hostname="rc-docker.local"
|
|
2431
|
arg_hostname="rc-docker.local"
|
|
2402
|
fi
|
|
2432
|
fi
|
|
2403
|
fi
|
|
2433
|
fi
|
|
2404
|
|
|
2434
|
|
|
2405
|
# use SSL
|
|
2435
|
# use SSL
|
|
2406
|
if [ ! -z "$arg_use_ssl" ] && [ -z ${args['__arg_use_ssl']} ]
|
|
2436
|
if [ ! -z "$arg_use_ssl" ] && [ -z ${args['__arg_use_ssl']} ]
|
|
2407
|
then
|
|
2437
|
then
|
|
2408
|
read -p "Do you want to enable SSL/HTTPS now (can be changed later) 'y' for yes 'n' for no? [$arg_use_ssl]: " new_value
|
|
2438
|
read -p "Do you want to enable SSL/HTTPS now (can be changed later) 'y' for yes 'n' for no? [$arg_use_ssl]: " new_value
|
|
2409
|
if [ ! -z "$new_value" ]
|
|
2439
|
if [ ! -z "$new_value" ]
|
|
2410
|
then
|
|
2440
|
then
|
|
2411
|
arg_use_ssl="$new_value"
|
|
2441
|
arg_use_ssl="$new_value"
|
|
2412
|
fi
|
|
2442
|
fi
|
|
2413
|
fi
|
|
2443
|
fi
|
|
2414
|
|
|
2444
|
|
|
2415
|
# admin email
|
|
2445
|
# admin email
|
|
2416
|
if [ ! -z "$arg_admin_email" ] && [ -z ${args['__arg_admin_email']} ]
|
|
2446
|
if [ ! -z "$arg_admin_email" ] && [ -z ${args['__arg_admin_email']} ]
|
|
2417
|
then
|
|
2447
|
then
|
|
2418
|
read -p "Enter first super-admin email? [$arg_admin_email]: " new_value
|
|
2448
|
read -p "Enter first super-admin email? [$arg_admin_email]: " new_value
|
|
2419
|
if [ ! -z "$new_value" ]
|
|
2449
|
if [ ! -z "$new_value" ]
|
|
2420
|
then
|
|
2450
|
then
|
|
2421
|
arg_admin_email="$new_value"
|
|
2451
|
arg_admin_email="$new_value"
|
|
2422
|
fi
|
|
2452
|
fi
|
|
2423
|
fi
|
|
2453
|
fi
|
|
2424
|
|
|
2454
|
|
|
2425
|
# admin user
|
|
2455
|
# admin user
|
|
2426
|
if [ ! -z "$arg_admin_user" ] && [ -z ${args['__arg_admin_user']} ]
|
|
2456
|
if [ ! -z "$arg_admin_user" ] && [ -z ${args['__arg_admin_user']} ]
|
|
2427
|
then
|
|
2457
|
then
|
|
2428
|
read -p "Enter first super-admin account name? [$arg_admin_user]: " new_value
|
|
2458
|
read -p "Enter first super-admin account name? [$arg_admin_user]: " new_value
|
|
2429
|
if [ ! -z "$new_value" ]
|
|
2459
|
if [ ! -z "$new_value" ]
|
|
2430
|
then
|
|
2460
|
then
|
|
2431
|
arg_admin_user="$new_value"
|
|
2461
|
arg_admin_user="$new_value"
|
|
2432
|
fi
|
|
2462
|
fi
|
|
2433
|
fi
|
|
2463
|
fi
|
|
2434
|
|
|
2464
|
|
|
2435
|
# admin password
|
|
2465
|
# admin password
|
|
2436
|
if [ ! -z "$arg_admin_pass" ] && [ -z ${args['__arg_admin_pass']} ]
|
|
2466
|
if [ ! -z "$arg_admin_pass" ] && [ -z ${args['__arg_admin_pass']} ]
|
|
2437
|
then
|
|
2467
|
then
|
|
2438
|
read -p "Enter first super-admin account password? [$arg_admin_pass]: " new_value
|
|
2468
|
read -p "Enter first super-admin account password? [$arg_admin_pass]: " new_value
|
|
2439
|
if [ ! -z "$new_value" ]
|
|
2469
|
if [ ! -z "$new_value" ]
|
|
2440
|
then
|
|
2470
|
then
|
|
2441
|
arg_admin_pass="$new_value"
|
|
2471
|
arg_admin_pass="$new_value"
|
|
2442
|
fi
|
|
2472
|
fi
|
|
2443
|
fi
|
|
2473
|
fi
|
|
2444
|
|
|
2474
|
|
|
2445
|
echo -e "\nDoes this look right?\n"
|
|
2475
|
echo -e "\nDoes this look right?\n"
|
|
2446
|
echo "RhodeCode Edition : rhodecode-$arg_rc_edition"
|
|
2476
|
echo "RhodeCode Edition : rhodecode-$arg_rc_edition"
|
|
2447
|
echo "License Token : $arg_license_token"
|
|
2477
|
echo "License Token : $arg_license_token"
|
|
2448
|
echo "Hostname : $arg_hostname"
|
|
2478
|
echo "Hostname : $arg_hostname"
|
|
2449
|
echo "Use SSL : $arg_use_ssl"
|
|
2479
|
echo "Use SSL : $arg_use_ssl"
|
|
2450
|
echo "Email : $arg_admin_email"
|
|
2480
|
echo "Email : $arg_admin_email"
|
|
2451
|
echo "Admin user : $arg_admin_user"
|
|
2481
|
echo "Admin user : $arg_admin_user"
|
|
2452
|
echo "Admin password : $arg_admin_pass"
|
|
2482
|
echo "Admin password : $arg_admin_pass"
|
|
2453
|
echo ""
|
|
2483
|
echo ""
|
|
2454
|
read -p "ENTER to continue, 'n' to try again, Ctrl+C to exit: " config_done
|
|
2484
|
read -p "ENTER to continue, 'n' to try again, Ctrl+C to exit: " config_done
|
|
2455
|
|
|
2485
|
|
|
2456
|
# config loop end
|
|
2486
|
# config loop end
|
|
2457
|
done
|
|
2487
|
done
|
|
2458
|
|
|
2488
|
|
|
2459
|
}
|
|
2489
|
}
|
|
2460
|
|
|
2490
|
|
|
2461
|
check_docker() {
|
|
2491
|
check_docker() {
|
|
2462
|
(which docker || which docker.io) &>/dev/null
|
|
2492
|
(which docker || which docker.io) &>/dev/null
|
|
2463
|
}
|
|
2493
|
}
|
|
2464
|
|
|
2494
|
|
|
2465
|
bootstrap_docker_install() {
|
|
2495
|
bootstrap_docker_install() {
|
|
2466
|
# systemctl enable docker on debian
|
|
2496
|
# systemctl enable docker on debian
|
|
2467
|
echo "bootstrap_docker_install: trying to check and configure docker"
|
|
2497
|
echo "bootstrap_docker_install: trying to check and configure docker"
|
|
2468
|
failMsg="Failed to find docker on your PATH"
|
|
2498
|
failMsg="Failed to find docker on your PATH"
|
|
2469
|
|
|
2499
|
|
|
2470
|
if ! check_docker; then
|
|
2500
|
if ! check_docker; then
|
|
2471
|
|
|
2501
|
|
|
2472
|
if [[ $install_docker == "n" ]]; then
|
|
2502
|
if [[ $install_docker == "n" ]]; then
|
|
2473
|
echo "$(red $failMsg, exiting without docker install)"
|
|
2503
|
echo "$(red $failMsg, exiting without docker install)"
|
|
2474
|
fi
|
|
2504
|
fi
|
|
2475
|
|
|
2505
|
|
|
2476
|
echo "$(yellow $failMsg, trying docker install)"
|
|
2506
|
echo "$(yellow $failMsg, trying docker install)"
|
|
2477
|
|
|
2507
|
|
|
2478
|
if [[ $install_docker == "y" ]]; then
|
|
2508
|
if [[ $install_docker == "y" ]]; then
|
|
2479
|
echo "continuing with automated docker installation from https://get.docker.com/ "
|
|
2509
|
echo "continuing with automated docker installation from https://get.docker.com/ "
|
|
2480
|
else
|
|
2510
|
else
|
|
2481
|
read -p "Enter to install Docker directly from https://get.docker.com/ or Ctrl+C to exit and install it manually"
|
|
2511
|
read -p "Enter to install Docker directly from https://get.docker.com/ or Ctrl+C to exit and install it manually"
|
|
2482
|
fi
|
|
2512
|
fi
|
|
2483
|
|
|
2513
|
|
|
2484
|
curl -fsSL https://get.docker.com -o install-docker.sh
|
|
2514
|
curl -fsSL https://get.docker.com -o install-docker.sh
|
|
2485
|
sh install-docker.sh
|
|
2515
|
sh install-docker.sh
|
|
2486
|
rm install-docker.sh
|
|
2516
|
rm install-docker.sh
|
|
2487
|
|
|
2517
|
|
|
2488
|
if ! check_docker; then
|
|
2518
|
if ! check_docker; then
|
|
2489
|
echo "$failMsg"
|
|
2519
|
echo "$failMsg"
|
|
2490
|
echo "Docker install failed. Quitting."
|
|
2520
|
echo "Docker install failed. Quitting."
|
|
2491
|
exit 1
|
|
2521
|
exit 1
|
|
2492
|
fi
|
|
2522
|
fi
|
|
2493
|
|
|
2523
|
|
|
2494
|
docker --version
|
|
2524
|
docker --version
|
|
2495
|
|
|
2525
|
|
|
2496
|
fi
|
|
2526
|
fi
|
|
2497
|
}
|
|
2527
|
}
|
|
2498
|
|
|
2528
|
|
|
2499
|
bootstrap_docker_commons() {
|
|
2529
|
bootstrap_docker_commons() {
|
|
2500
|
|
|
2530
|
|
|
2501
|
echo 'bootstrap_docker_commons: running docker commands.'
|
|
2531
|
echo 'bootstrap_docker_commons: running docker commands.'
|
|
2502
|
|
|
2532
|
|
|
2503
|
echo "bootstrap_docker_commons: creating volume 'rc_datavolume'"
|
|
2533
|
echo "bootstrap_docker_commons: creating volume 'rc_datavolume'"
|
|
2504
|
docker volume create --label keep=1 --name=rc_datavolume
|
|
2534
|
docker volume create --label keep=1 --name=rc_datavolume
|
|
2505
|
echo "bootstrap_docker_commons (rc_datavolume): done"
|
|
2535
|
echo "bootstrap_docker_commons (rc_datavolume): done"
|
|
2506
|
echo ""
|
|
2536
|
echo ""
|
|
2507
|
|
|
2537
|
|
|
2508
|
echo "bootstrap_docker_commons: creating volume 'rc_reposvolume'"
|
|
2538
|
echo "bootstrap_docker_commons: creating volume 'rc_reposvolume'"
|
|
2509
|
docker volume create --label keep=1 --name=rc_reposvolume
|
|
2539
|
docker volume create --label keep=1 --name=rc_reposvolume
|
|
2510
|
echo "bootstrap_docker_commons (rc_reposvolume): done"
|
|
2540
|
echo "bootstrap_docker_commons (rc_reposvolume): done"
|
|
2511
|
echo ""
|
|
2541
|
echo ""
|
|
2512
|
|
|
2542
|
|
|
2513
|
echo "bootstrap_docker_commons: creating network 'rhodecode_network'"
|
|
2543
|
echo "bootstrap_docker_commons: creating network 'rhodecode_network'"
|
|
2514
|
docker network inspect rhodecode_network >/dev/null 2>&1 || docker network create rhodecode_network
|
|
2544
|
docker network inspect rhodecode_network >/dev/null 2>&1 || docker network create rhodecode_network
|
|
2515
|
echo "bootstrap_docker_commons (rhodecode_network): done"
|
|
2545
|
echo "bootstrap_docker_commons (rhodecode_network): done"
|
|
2516
|
echo ""
|
|
2546
|
echo ""
|
|
2517
|
|
|
2547
|
|
|
2518
|
echo "bootstrap_docker_commons: creating loki logging"
|
|
2548
|
echo "bootstrap_docker_commons: creating loki logging"
|
|
2519
|
loki_driver=$(docker plugin ls --format {{.Name}} --filter enabled=true | grep loki || echo "")
|
|
2549
|
loki_driver=$(docker plugin ls --format {{.Name}} --filter enabled=true | grep loki || echo "")
|
|
2520
|
if [[ $loki_driver == "" ]]; then
|
|
2550
|
if [[ $loki_driver == "" ]]; then
|
|
2521
|
docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions
|
|
2551
|
docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions
|
|
2522
|
else
|
|
2552
|
else
|
|
2523
|
echo "bootstrap_docker_commons: loki driver already exists"
|
|
2553
|
echo "bootstrap_docker_commons: loki driver already exists"
|
|
2524
|
fi
|
|
2554
|
fi
|
|
2525
|
}
|
|
2555
|
}
|
|
2526
|
|
|
2556
|
|
|
2527
|
config_init() {
|
|
2557
|
config_init() {
|
|
2528
|
loc_config_file=${CONFIG_FILE:=config.ini}
|
|
2558
|
loc_config_file=${CONFIG_FILE:=config.ini}
|
|
2529
|
[[ -f "$loc_config_file" ]] || touch "$loc_config_file"
|
|
2559
|
[[ -f "$loc_config_file" ]] || touch "$loc_config_file"
|
|
2530
|
}
|
|
2560
|
}
|
|
2531
|
|
|
2561
|
|
|
2532
|
bootstrap_config() {
|
|
2562
|
bootstrap_config() {
|
|
2533
|
shared_key=$(random_str 32)
|
|
2563
|
shared_key=$(random_str 32)
|
|
2534
|
shared_key_md5=$(generate_md5 $shared_key | head -c 32)
|
|
2564
|
shared_key_md5=$(generate_md5 $shared_key | head -c 32)
|
|
2535
|
db_key=$(random_str 32)
|
|
2565
|
db_key=$(random_str 32)
|
|
2536
|
|
|
2566
|
|
|
2537
|
if [[ ! $no_prompt ]]; then
|
|
2567
|
if [[ ! $no_prompt ]]; then
|
|
2538
|
ask_user_for_config
|
|
2568
|
ask_user_for_config
|
|
2539
|
fi
|
|
2569
|
fi
|
|
2540
|
|
|
2570
|
|
|
2541
|
# setup args
|
|
2571
|
# setup args
|
|
2542
|
license_token=$arg_license_token
|
|
2572
|
license_token=$arg_license_token
|
|
2543
|
log_formatter=$arg_log_formatter
|
|
2573
|
log_formatter=$arg_log_formatter
|
|
2544
|
base_domain=$arg_hostname
|
|
2574
|
base_domain=$arg_hostname
|
|
2545
|
rc_edition=$arg_rc_edition
|
|
2575
|
rc_edition=$arg_rc_edition
|
|
2546
|
|
|
2576
|
|
|
2547
|
is_https=0
|
|
2577
|
is_https=0
|
|
2548
|
if [[ $arg_use_ssl == "y" ]]; then is_https=1; fi
|
|
2578
|
if [[ $arg_use_ssl == "y" ]]; then is_https=1; fi
|
|
2549
|
|
|
2579
|
|
|
2550
|
DB_USER='rhodecode'
|
|
2580
|
DB_USER='rhodecode'
|
|
2551
|
DB_NAME='rhodecode'
|
|
2581
|
DB_NAME='rhodecode'
|
|
2552
|
|
|
2582
|
|
|
2553
|
if [[ ! -f "$CONFIG_FILE" ]]; then
|
|
2583
|
if [[ ! -f "$CONFIG_FILE" ]]; then
|
|
2554
|
echo "init new config at: $CONFIG_FILE"
|
|
2584
|
echo "init new config at: $CONFIG_FILE"
|
|
2555
|
config_init
|
|
2585
|
config_init
|
|
2556
|
else
|
|
2586
|
else
|
|
2557
|
echo "re-using existing config at: $CONFIG_FILE"
|
|
2587
|
echo "re-using existing config at: $CONFIG_FILE"
|
|
2558
|
fi
|
|
2588
|
fi
|
|
2559
|
|
|
2589
|
|
|
2560
|
CUSTOM_DIR_PATH=$PWD/.custom
|
|
2590
|
CUSTOM_DIR_PATH=$PWD/.custom
|
|
2561
|
mkdir -p "$CUSTOM_DIR_PATH"
|
|
2591
|
mkdir -p "$CUSTOM_DIR_PATH"
|
|
2562
|
BOOTSTRAP_TMPL=$PWD/templates/runtime.env.tmpl
|
|
2592
|
BOOTSTRAP_TMPL=$PWD/templates/runtime.env.tmpl
|
|
2563
|
BOOTSTRAP_RUNTIME_ENV=$PWD/.custom/.runtime.env
|
|
2593
|
BOOTSTRAP_RUNTIME_ENV=$PWD/.custom/.runtime.env
|
|
2564
|
|
|
2594
|
|
|
2565
|
# TODO: Pick version
|
|
2595
|
# TODO: Pick version
|
|
2566
|
ver=0_edge
|
|
2596
|
ver=0_edge
|
|
2567
|
INI_TARGET=$PWD/config/_shared
|
|
2597
|
INI_TARGET=$PWD/config/_shared
|
|
2568
|
RHODECODE_INI_TMPL=$PWD/templates/ini/$ver/rhodecode.ini
|
|
2598
|
RHODECODE_INI_TMPL=$PWD/templates/ini/$ver/rhodecode.ini
|
|
2569
|
VCSSERVER_INI_TMPL=$PWD/templates/ini/$ver/vcsserver.ini
|
|
2599
|
VCSSERVER_INI_TMPL=$PWD/templates/ini/$ver/vcsserver.ini
|
|
2570
|
|
|
2600
|
|
|
2571
|
if [[ ! -f "$BOOTSTRAP_RUNTIME_ENV" ]]; then
|
|
2601
|
if [[ ! -f "$BOOTSTRAP_RUNTIME_ENV" ]]; then
|
|
2572
|
echo "bootstrap_config: init runtime env config at: $BOOTSTRAP_RUNTIME_ENV"
|
|
2602
|
echo "bootstrap_config: init runtime env config at: $BOOTSTRAP_RUNTIME_ENV"
|
|
2573
|
|
|
2603
|
|
|
2574
|
# Make runtime file
|
|
2604
|
# Make runtime file
|
|
2575
|
echo "## BOOTSTRAP GENERATED $(date) ##" >> $BOOTSTRAP_RUNTIME_ENV
|
|
2605
|
echo "## BOOTSTRAP GENERATED $(date) ##" >> $BOOTSTRAP_RUNTIME_ENV
|
|
2576
|
echo "" >> $BOOTSTRAP_RUNTIME_ENV
|
|
2606
|
echo "" >> $BOOTSTRAP_RUNTIME_ENV
|
|
2577
|
|
|
2607
|
|
|
2578
|
cat $BOOTSTRAP_TMPL >> $BOOTSTRAP_RUNTIME_ENV
|
|
2608
|
cat $BOOTSTRAP_TMPL >> $BOOTSTRAP_RUNTIME_ENV
|
|
2579
|
|
|
2609
|
|
|
2580
|
# Make .ini files
|
|
2610
|
# Make .ini files
|
|
2581
|
cp -v $RHODECODE_INI_TMPL $INI_TARGET
|
|
2611
|
cp -v $RHODECODE_INI_TMPL $INI_TARGET
|
|
2582
|
cp -v $VCSSERVER_INI_TMPL $INI_TARGET
|
|
2612
|
cp -v $VCSSERVER_INI_TMPL $INI_TARGET
|
|
2583
|
|
|
2613
|
|
|
2584
|
# init env generator with env file
|
|
2614
|
# init env generator with env file
|
|
2585
|
.env --file "$BOOTSTRAP_RUNTIME_ENV"
|
|
2615
|
.env --file "$BOOTSTRAP_RUNTIME_ENV"
|
|
2586
|
|
|
2616
|
|
|
2587
|
.env set RC_EDITION=$rc_edition
|
|
2617
|
.env set RC_EDITION=$rc_edition
|
|
2588
|
.env set DB_PASSWORD=$db_key
|
|
2618
|
.env set DB_PASSWORD=$db_key
|
|
2589
|
|
|
2619
|
|
|
2590
|
.env set RHODECODE_USER_EMAIL=$arg_admin_email
|
|
2620
|
.env set RHODECODE_USER_EMAIL=$arg_admin_email
|
|
2591
|
.env set RHODECODE_USER_NAME=$arg_admin_user
|
|
2621
|
.env set RHODECODE_USER_NAME=$arg_admin_user
|
|
2592
|
.env set RHODECODE_USER_PASS=$arg_admin_pass
|
|
2622
|
.env set RHODECODE_USER_PASS=$arg_admin_pass
|
|
2593
|
|
|
2623
|
|
|
2594
|
.env set RC_ENCRYPTED_SECRET=$shared_key
|
|
2624
|
.env set RC_ENCRYPTED_SECRET=$shared_key
|
|
2595
|
|
|
2625
|
|
|
2596
|
rc_db1="postgresql://$DB_USER:$db_key@database/$DB_NAME"
|
|
2626
|
rc_db1="postgresql://$DB_USER:$db_key@database/$DB_NAME"
|
|
2597
|
.env set RC_DB_URL="$rc_db1"
|
|
2627
|
.env set RC_DB_URL="$rc_db1"
|
|
2598
|
.env set RC_SQLALCHEMY_DB1_URL="$rc_db1"
|
|
2628
|
.env set RC_SQLALCHEMY_DB1_URL="$rc_db1"
|
|
2599
|
|
|
2629
|
|
|
2600
|
.env set RC_LICENSE_TOKEN=$license_token
|
|
2630
|
.env set RC_LICENSE_TOKEN=$license_token
|
|
2601
|
.env set RC_HOSTNAME=$base_domain
|
|
2631
|
.env set RC_HOSTNAME=$base_domain
|
|
2602
|
|
|
2632
|
|
|
2603
|
if [[ $is_https == 1 ]]; then
|
|
2633
|
if [[ $is_https == 1 ]]; then
|
|
2604
|
app_base_url=https://$base_domain
|
|
2634
|
app_base_url=https://$base_domain
|
|
2605
|
else
|
|
2635
|
else
|
|
2606
|
app_base_url=http://$base_domain
|
|
2636
|
app_base_url=http://$base_domain
|
|
2607
|
fi
|
|
2637
|
fi
|
|
2608
|
|
|
2638
|
|
|
2609
|
.env set RC_APP_BASE_URL=$app_base_url
|
|
2639
|
.env set RC_APP_BASE_URL=$app_base_url
|
|
2610
|
|
|
2640
|
|
|
2611
|
.env set RC_LOKI_AUTH=loki-auth:$shared_key@
|
|
2641
|
.env set RC_LOKI_AUTH=loki-auth:$shared_key@
|
|
2612
|
|
|
2642
|
|
|
2613
|
.env puts '# Log formatter option'
|
|
2643
|
.env puts '# Log formatter option'
|
|
2614
|
.env set RC_LOGGING_FORMATTER=$log_formatter
|
|
2644
|
.env set RC_LOGGING_FORMATTER=$log_formatter
|
|
2615
|
.env set RC_USE_CELERY=true
|
|
2645
|
.env set RC_USE_CELERY=true
|
|
2616
|
|
|
2646
|
|
|
2617
|
.env puts '# Channelstream config'
|
|
2647
|
.env puts '# Channelstream config'
|
|
2618
|
.env set RC_CHANNELSTREAM_SERVER=channelstream:8000
|
|
2648
|
.env set RC_CHANNELSTREAM_SERVER=channelstream:8000
|
|
2619
|
|
|
2649
|
|
|
2620
|
if [[ $is_https == 1 ]]; then
|
|
2650
|
if [[ $is_https == 1 ]]; then
|
|
2621
|
rc_channelstream_url="wss://$base_domain/_channelstream"
|
|
2651
|
rc_channelstream_url="wss://$base_domain/_channelstream"
|
|
2622
|
else
|
|
2652
|
else
|
|
2623
|
rc_channelstream_url="ws://$base_domain/_channelstream"
|
|
2653
|
rc_channelstream_url="ws://$base_domain/_channelstream"
|
|
2624
|
fi
|
|
2654
|
fi
|
|
2625
|
|
|
2655
|
|
|
2626
|
.env set RC_CHANNELSTREAM_WS_URL=$rc_channelstream_url
|
|
2656
|
.env set RC_CHANNELSTREAM_WS_URL=$rc_channelstream_url
|
|
2627
|
|
|
2657
|
|
|
2628
|
.env set CHANNELSTREAM_ALLOW_POSTING_FROM=0.0.0.0
|
|
2658
|
.env set CHANNELSTREAM_ALLOW_POSTING_FROM=0.0.0.0
|
|
2629
|
|
|
2659
|
|
|
2630
|
.env puts '# Channelstream secrets'
|
|
2660
|
.env puts '# Channelstream secrets'
|
|
2631
|
.env set CHANNELSTREAM_SECRET=$shared_key
|
|
2661
|
.env set CHANNELSTREAM_SECRET=$shared_key
|
|
2632
|
.env set RC_CHANNELSTREAM_SECRET=$shared_key
|
|
2662
|
.env set RC_CHANNELSTREAM_SECRET=$shared_key
|
|
2633
|
|
|
2663
|
|
|
2634
|
.env puts '# Channelstream admin'
|
|
2664
|
.env puts '# Channelstream admin'
|
|
2635
|
.env set CHANNELSTREAM_ADMIN_SECRET=$shared_key
|
|
2665
|
.env set CHANNELSTREAM_ADMIN_SECRET=$shared_key
|
|
2636
|
.env set RC_CHANNELSTREAM_ADMIN_SECRET=$shared_key
|
|
2666
|
.env set RC_CHANNELSTREAM_ADMIN_SECRET=$shared_key
|
|
2637
|
|
|
2667
|
|
|
2638
|
ini_path=$INI_TARGET/vcsserver.ini
|
|
2668
|
ini_path=$INI_TARGET/vcsserver.ini
|
|
2639
|
config_vcsserver_ini
|
|
2669
|
config_vcsserver_ini
|
|
2640
|
|
|
2670
|
|
|
2641
|
ini_path=$INI_TARGET/rhodecode.ini
|
|
2671
|
ini_path=$INI_TARGET/rhodecode.ini
|
|
2642
|
RC_EDITION=$rc_edition
|
|
2672
|
RC_EDITION=$rc_edition
|
|
2643
|
RC_LICENSE_TOKEN=$license_token
|
|
2673
|
RC_LICENSE_TOKEN=$license_token
|
|
2644
|
RC_HOSTNAME=$(sed_safe_path $base_domain)
|
|
2674
|
RC_HOSTNAME=$(sed_safe_path $base_domain)
|
|
2645
|
RC_APP_BASE_URL=$(sed_safe_path $app_base_url)
|
|
2675
|
RC_APP_BASE_URL=$(sed_safe_path $app_base_url)
|
|
2646
|
RC_SQLALCHEMY_DB1_URL=$(sed_safe_path $rc_db1)
|
|
2676
|
RC_SQLALCHEMY_DB1_URL=$(sed_safe_path $rc_db1)
|
|
2647
|
RC_CHANNELSTREAM_WS_URL=$(sed_safe_path $rc_channelstream_url)
|
|
2677
|
RC_CHANNELSTREAM_WS_URL=$(sed_safe_path $rc_channelstream_url)
|
|
2648
|
|
|
2678
|
|
|
2649
|
config_rhodecode_ini
|
|
2679
|
config_rhodecode_ini
|
|
2650
|
|
|
2680
|
|
|
2651
|
touch $BOOTSTRAP_RUNTIME_ENV
|
|
2681
|
touch $BOOTSTRAP_RUNTIME_ENV
|
|
2652
|
else
|
|
2682
|
else
|
|
2653
|
echo "bootstrap_config: $BOOTSTRAP_RUNTIME_ENV file exists, not adding any configuration..."
|
|
2683
|
echo "bootstrap_config: $BOOTSTRAP_RUNTIME_ENV file exists, not adding any configuration..."
|
|
2654
|
fi
|
|
2684
|
fi
|
|
2655
|
}
|
|
2685
|
}
|
|
2656
|
|
|
2686
|
|
|
2657
|
bootstrap_definitions() {
|
|
2687
|
bootstrap_definitions() {
|
|
2658
|
|
|
2688
|
|
|
2659
|
AUTH_TOKEN=${args[--auth-token]}
|
|
2689
|
AUTH_TOKEN=${args[--auth-token]}
|
|
2660
|
SERVER_URL=${args[--server-url]}
|
|
2690
|
SERVER_URL=${args[--server-url]}
|
|
2661
|
|
|
2691
|
|
|
2662
|
DEFINITIONS_EXIST=""
|
|
2692
|
DEFINITIONS_EXIST=""
|
|
2663
|
CHECK_FILES="\
|
|
2693
|
CHECK_FILES="\
|
|
2664
|
docker-compose-services.yaml \
|
|
2694
|
docker-compose-services.yaml \
|
|
2665
|
docker-compose-apps.yaml \
|
|
2695
|
docker-compose-apps.yaml \
|
|
2666
|
docker-compose-metrics.yaml \
|
|
2696
|
docker-compose-metrics.yaml \
|
|
2667
|
docker-compose-router.yaml \
|
|
2697
|
docker-compose-router.yaml \
|
|
2668
|
"
|
|
2698
|
"
|
|
2669
|
for check_file in $CHECK_FILES; do
|
|
2699
|
for check_file in $CHECK_FILES; do
|
|
2670
|
if [[ -f "$check_file" ]]; then
|
|
2700
|
if [[ -f "$check_file" ]]; then
|
|
2671
|
DEFINITIONS_EXIST="1"
|
|
2701
|
DEFINITIONS_EXIST="1"
|
|
2672
|
fi
|
|
2702
|
fi
|
|
2673
|
done
|
|
2703
|
done
|
|
2674
|
|
|
2704
|
|
|
2675
|
if [[ -n $DEFINITIONS_EXIST && ! $force ]]; then
|
|
2705
|
if [[ -n $DEFINITIONS_EXIST && ! $force ]]; then
|
|
2676
|
echo "$(yellow bootstrap_definitions: skipping docker defs creation, existing files found. Use --force to create them anyway)"
|
|
2706
|
echo "$(yellow bootstrap_definitions: skipping docker defs creation, existing files found. Use --force to create them anyway)"
|
|
2677
|
return
|
|
2707
|
return
|
|
2678
|
fi
|
|
2708
|
fi
|
|
2679
|
|
|
2709
|
|
|
2680
|
if [[ -n $DEFINITIONS_EXIST ]]; then
|
|
2710
|
if [[ -n $DEFINITIONS_EXIST ]]; then
|
|
2681
|
echo "$(yellow docker definitions exists, are you sure to force re-create them?)"
|
|
2711
|
echo "$(yellow docker definitions exists, are you sure to force re-create them?)"
|
|
2682
|
while true; do
|
|
2712
|
while true; do
|
|
2683
|
read -p "Would you like to continue with overriding file? [yn] " yn
|
|
2713
|
read -p "Would you like to continue with overriding file? [yn] " yn
|
|
2684
|
case $yn in
|
|
2714
|
case $yn in
|
|
2685
|
[Yy]*) break ;;
|
|
2715
|
[Yy]*) break ;;
|
|
2686
|
[Nn]*) exit ;;
|
|
2716
|
[Nn]*) exit ;;
|
|
2687
|
*) echo "Please answer y or n." ;;
|
|
2717
|
*) echo "Please answer y or n." ;;
|
|
2688
|
esac
|
|
2718
|
esac
|
|
2689
|
done
|
|
2719
|
done
|
|
2690
|
fi
|
|
2720
|
fi
|
|
2691
|
FULL_MODE=1
|
|
2721
|
FULL_MODE=1
|
|
2692
|
get_docker_definitions $docker_revision $FULL_MODE $DEBUG
|
|
2722
|
get_docker_definitions $docker_revision $FULL_MODE $DEBUG
|
|
2693
|
|
|
2723
|
|
|
2694
|
}
|
|
2724
|
}
|
|
2695
|
|
|
2725
|
|
|
2696
|
bootstrap_overrides() {
|
|
2726
|
bootstrap_overrides() {
|
|
2697
|
templates=$YAML_TEMPLATES
|
|
2727
|
templates=$YAML_TEMPLATES
|
|
2698
|
|
|
2728
|
|
|
2699
|
target_dir=$PWD/.custom
|
|
2729
|
target_dir=$PWD/.custom
|
|
2700
|
|
|
2730
|
|
|
2701
|
for o_file in $templates; do
|
|
2731
|
for o_file in $templates; do
|
|
2702
|
target_file=$target_dir/$o_file
|
|
2732
|
target_file=$target_dir/$o_file
|
|
2703
|
if [[ ! -f "$target_file" ]]; then
|
|
2733
|
if [[ ! -f "$target_file" ]]; then
|
|
2704
|
echo "copy override file $o_file"
|
|
2734
|
echo "copy override file $o_file"
|
|
2705
|
cp -v $PWD/templates/$o_file $target_file
|
|
2735
|
cp -v $PWD/templates/$o_file $target_file
|
|
2706
|
else
|
|
2736
|
else
|
|
2707
|
echo "file $target_file existing, skipping..."
|
|
2737
|
echo "file $target_file existing, skipping..."
|
|
2708
|
fi
|
|
2738
|
fi
|
|
2709
|
done
|
|
2739
|
done
|
|
2710
|
mkdir -p $target_dir/traefik_custom
|
|
2740
|
mkdir -p $target_dir/traefik_custom
|
|
2711
|
cp -r $PWD/config/traefik/* $target_dir/traefik_custom/
|
|
2741
|
cp -r $PWD/config/traefik/* $target_dir/traefik_custom/
|
|
2712
|
|
|
2742
|
|
|
2713
|
echo "$(green bootstrap_overrides: overrides extracted to $target_dir)"
|
|
2743
|
echo "$(green bootstrap_overrides: overrides extracted to $target_dir)"
|
|
2714
|
|
|
2744
|
|
|
2715
|
# save our loki auth using md5 encryption so the auth works OOTB
|
|
2745
|
# save our loki auth using md5 encryption so the auth works OOTB
|
|
2716
|
echo "loki-auth:$shared_key_md5" >> $target_dir/traefik_custom/dynamic/.htpasswd
|
|
2746
|
echo "loki-auth:$shared_key_md5" >> $target_dir/traefik_custom/dynamic/.htpasswd
|
|
2717
|
|
|
2747
|
|
|
2718
|
# change our templates and adjust using enable SSH
|
|
2748
|
# change our templates and adjust using enable SSH
|
|
2719
|
if [[ $arg_use_ssl == "y" ]]; then
|
|
2749
|
if [[ $arg_use_ssl == "y" ]]; then
|
|
2720
|
echo "enabling SSL on .override.yaml templates"
|
|
2750
|
echo "enabling SSL on .override.yaml templates"
|
|
2721
|
|
|
2751
|
|
|
2722
|
metrics_replace() {
|
|
2752
|
metrics_replace() {
|
|
2723
|
metrics_tmpl=$target_dir/docker-compose-metrics.override.yaml
|
|
2753
|
metrics_tmpl=$target_dir/docker-compose-metrics.override.yaml
|
|
2724
|
sed --in-place=.replaced -E "s/$1/$2/" $metrics_tmpl
|
|
2754
|
sed --in-place=.replaced -E "s/$1/$2/" $metrics_tmpl
|
|
2725
|
}
|
|
2755
|
}
|
|
2726
|
|
|
2756
|
|
|
2727
|
metrics_replace '# # Enable http\+https' ' # Enable http\+https'
|
|
2757
|
metrics_replace '# # Enable http\+https' ' # Enable http\+https'
|
|
2728
|
metrics_replace '# - "traefik.http.routers.grafana.entrypoints=http,https"' ' - "traefik.http.routers.grafana.entrypoints=http,https"'
|
|
2758
|
metrics_replace '# - "traefik.http.routers.grafana.entrypoints=http,https"' ' - "traefik.http.routers.grafana.entrypoints=http,https"'
|
|
2729
|
|
|
2759
|
|
|
2730
|
apps_replace() {
|
|
2760
|
apps_replace() {
|
|
2731
|
apps_tmpl=$target_dir/docker-compose-apps.override.yaml
|
|
2761
|
apps_tmpl=$target_dir/docker-compose-apps.override.yaml
|
|
2732
|
sed --in-place=.replaced -E "s/$1/$2/" $apps_tmpl
|
|
2762
|
sed --in-place=.replaced -E "s/$1/$2/" $apps_tmpl
|
|
2733
|
}
|
|
2763
|
}
|
|
2734
|
|
|
2764
|
|
|
2735
|
apps_replace '# # Enable http\+https' ' # Enable http\+https'
|
|
2765
|
apps_replace '# # Enable http\+https' ' # Enable http\+https'
|
|
2736
|
apps_replace '# - "traefik.http.routers.rhodecode.entrypoints=http,https"' ' - "traefik.http.routers.rhodecode.entrypoints=http,https"'
|
|
2766
|
apps_replace '# - "traefik.http.routers.rhodecode.entrypoints=http,https"' ' - "traefik.http.routers.rhodecode.entrypoints=http,https"'
|
|
2737
|
|
|
2767
|
|
|
2738
|
fi
|
|
2768
|
fi
|
|
2739
|
}
|
|
2769
|
}
|
|
2740
|
|
|
2770
|
|
|
2741
|
cur_date=$(date '+%Y-%m-%d %H:%M:%S')
|
|
2771
|
cur_date=$(date '+%Y-%m-%d %H:%M:%S')
|
|
2742
|
|
|
2772
|
|
|
2743
|
# Init the config !
|
|
2773
|
# Init the config !
|
|
2744
|
if [[ ! -f "$CONFIG_FILE" ]]; then
|
|
2774
|
if [[ ! -f "$CONFIG_FILE" ]]; then
|
|
2745
|
echo "config: init new config at: $CONFIG_FILE"
|
|
2775
|
echo "config: init new config at: $CONFIG_FILE"
|
|
2746
|
config_init
|
|
2776
|
config_init
|
|
2747
|
else
|
|
2777
|
else
|
|
2748
|
echo "config: re-using present config at: $CONFIG_FILE"
|
|
2778
|
echo "config: re-using present config at: $CONFIG_FILE"
|
|
2749
|
fi
|
|
2779
|
fi
|
|
2750
|
|
|
2780
|
|
|
2751
|
run_stages=$BOOTSTRAP_STAGES
|
|
2781
|
run_stages=$BOOTSTRAP_STAGES
|
|
2752
|
|
|
2782
|
|
|
2753
|
if [ ! ${#stages_from_cli[@]} -eq 0 ]; then
|
|
2783
|
if [ ! ${#stages_from_cli[@]} -eq 0 ]; then
|
|
2754
|
echo "Using custom stages to run init command..."
|
|
2784
|
echo "Using custom stages to run init command..."
|
|
2755
|
run_stages=${stages_from_cli[@]}
|
|
2785
|
run_stages=${stages_from_cli[@]}
|
|
2756
|
fi
|
|
2786
|
fi
|
|
2757
|
|
|
2787
|
|
|
2758
|
for stage_name in $run_stages; do
|
|
2788
|
for stage_name in $run_stages; do
|
|
2759
|
|
|
2789
|
|
|
2760
|
stage_func=$(get_stage_function $stage_name)
|
|
2790
|
stage_func=$(get_stage_function $stage_name)
|
|
2761
|
|
|
2791
|
|
|
2762
|
if ! config_has_key $stage_name ; then
|
|
2792
|
if ! config_has_key $stage_name ; then
|
|
2763
|
echo "$(green \* bootstrap: \'$stage_name\' stage not found\; running now... )"
|
|
2793
|
echo "$(green \* bootstrap: \'$stage_name\' stage not found\; running now... )"
|
|
2764
|
$stage_func
|
|
2794
|
$stage_func
|
|
2765
|
config_set "$stage_name" $cur_date
|
|
2795
|
config_set "$stage_name" $cur_date
|
|
2766
|
else
|
|
2796
|
else
|
|
2767
|
if [ $force ]; then
|
|
2797
|
if [ $force ]; then
|
|
2768
|
echo "$(green \* bootstrap: \'$stage_name\' is present!\; FORCE running now... )"
|
|
2798
|
echo "$(green \* bootstrap: \'$stage_name\' is present!\; FORCE running now... )"
|
|
2769
|
$stage_func $force
|
|
2799
|
$stage_func $force
|
|
2770
|
config_set "$stage_name" $cur_date
|
|
2800
|
config_set "$stage_name" $cur_date
|
|
2771
|
else
|
|
2801
|
else
|
|
2772
|
echo "$(yellow \* bootstrap: \'$stage_name\' stage already present, use --force to run it again)"
|
|
2802
|
echo "$(yellow \* bootstrap: \'$stage_name\' stage already present, use --force to run it again)"
|
|
2773
|
fi
|
|
2803
|
fi
|
|
2774
|
fi
|
|
2804
|
fi
|
|
2775
|
|
|
2805
|
|
|
2776
|
done
|
|
2806
|
done
|
|
2777
|
|
|
2807
|
|
|
2778
|
echo ""
|
|
2808
|
echo ""
|
|
2779
|
echo "~~~~ $(green Bootstrap completed) ~~~~"
|
|
2809
|
echo "~~~~ $(green Bootstrap completed) ~~~~"
|
|
2780
|
|
|
2810
|
|
|
2781
|
get_started
|
|
2811
|
get_started
|
|
2782
|
|
|
2812
|
|
|
2783
|
}
|
|
2813
|
}
|
|
2784
|
|
|
2814
|
|
|
2785
|
# :command.function
|
|
2815
|
# :command.function
|
|
2786
|
rcstack_self_update_command() {
|
|
2816
|
rcstack_self_update_command() {
|
|
2787
|
# src/self_update_command.sh
|
|
2817
|
# src/self_update_command.sh
|
|
2788
|
check_bootstrap
|
|
2818
|
check_bootstrap
|
|
2789
|
|
|
2819
|
|
|
2790
|
DEBUG=${args[--debug]}
|
|
2820
|
DEBUG=${args[--debug]}
|
|
2791
|
AUTH_TOKEN=${args[--auth-token]}
|
|
2821
|
AUTH_TOKEN=${args[--auth-token]}
|
|
2792
|
SERVER_URL=${args[--server-url]}
|
|
2822
|
SERVER_URL=${args[--server-url]}
|
|
2793
|
FORCE=${args[--force]}
|
|
2823
|
FORCE=${args[--force]}
|
|
2794
|
|
|
2824
|
|
|
2795
|
cli_revision=${args[--cli-revision]}
|
|
2825
|
cli_revision=${args[--cli-revision]}
|
|
2796
|
docker_revision=${args[--docker-revision]}
|
|
2826
|
docker_revision=${args[--docker-revision]}
|
|
2797
|
|
|
2827
|
|
|
2798
|
FETCH_FROM=$SERVER_URL/rhodecode-enterprise-docker/raw/$cli_revision/scripts/rcstack/rcstack
|
|
2828
|
FETCH_FROM=$SERVER_URL/rhodecode-enterprise-docker/raw/$cli_revision/scripts/rcstack/rcstack
|
|
2799
|
|
|
2829
|
|
|
2800
|
FINAL_TARGET=$PWD/scripts/rcstack/rcstack
|
|
2830
|
FINAL_TARGET=$PWD/scripts/rcstack/rcstack
|
|
2801
|
|
|
2831
|
|
|
2802
|
DL_TARGET=$PWD/scripts/rcstack/rcstack.tmp
|
|
2832
|
DL_TARGET=$PWD/scripts/rcstack/rcstack.tmp
|
|
2803
|
|
|
2833
|
|
|
2804
|
#ensure we have this dir !
|
|
2834
|
#ensure we have this dir !
|
|
2805
|
mkdir -p $PWD/scripts/rcstack
|
|
2835
|
mkdir -p $PWD/scripts/rcstack
|
|
2806
|
|
|
2836
|
|
|
2807
|
.env --file $RUNTIME_ENV
|
|
2837
|
.env --file $RUNTIME_ENV
|
|
2808
|
.env get RC_VERSION
|
|
2838
|
.env get RC_VERSION
|
|
2809
|
|
|
2839
|
|
|
2810
|
ENV_VER=$REPLY
|
|
2840
|
ENV_VER=$REPLY
|
|
2811
|
|
|
2841
|
|
|
2812
|
echo "self-update: downloading new $RC_SCRIPT_NAME script from $FETCH_FROM"
|
|
2842
|
echo "self-update: downloading new $RC_SCRIPT_NAME script from $FETCH_FROM"
|
|
2813
|
|
|
2843
|
|
|
2814
|
if [[ $FORCE ]]; then
|
|
2844
|
if [[ $FORCE ]]; then
|
|
2815
|
echo "$(yellow self-update: --force used, doing forced update)"
|
|
2845
|
echo "$(yellow self-update: --force used, doing forced update)"
|
|
2816
|
fi
|
|
2846
|
fi
|
|
2817
|
|
|
2847
|
|
|
2818
|
if [[ $DEBUG ]]; then
|
|
2848
|
if [[ $DEBUG ]]; then
|
|
2819
|
echo "running: curl -ss --fail --header \"X-Rc-Auth-Token: $AUTH_TOKEN\" -o $DL_TARGET -L $FETCH_FROM"
|
|
2849
|
echo "running: curl -ss --fail --header \"X-Rc-Auth-Token: $AUTH_TOKEN\" -o $DL_TARGET -L $FETCH_FROM"
|
|
2820
|
fi
|
|
2850
|
fi
|
|
2821
|
|
|
2851
|
|
|
2822
|
curl -L -ss --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -o $DL_TARGET $FETCH_FROM
|
|
2852
|
curl -L -ss --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -o $DL_TARGET $FETCH_FROM
|
|
2823
|
|
|
2853
|
|
|
2824
|
chmod +x $DL_TARGET
|
|
2854
|
chmod +x $DL_TARGET
|
|
2825
|
|
|
2855
|
|
|
2826
|
version_old=0
|
|
2856
|
version_old=0
|
|
2827
|
rc_version_old=0
|
|
2857
|
rc_version_old=0
|
|
2828
|
|
|
2858
|
|
|
2829
|
# check if we have OLD file, in case we don't just set versions to 0
|
|
2859
|
# check if we have OLD file, in case we don't just set versions to 0
|
|
2830
|
if [[ -f "$FINAL_TARGET" ]]; then
|
|
2860
|
if [[ -f "$FINAL_TARGET" ]]; then
|
|
2831
|
version_old=$($FINAL_TARGET --version)
|
|
2861
|
version_old=$($FINAL_TARGET --version)
|
|
2832
|
rc_version_old=$($FINAL_TARGET cli image-info)
|
|
2862
|
rc_version_old=$($FINAL_TARGET cli image-info)
|
|
2833
|
fi
|
|
2863
|
fi
|
|
2834
|
|
|
2864
|
|
|
2835
|
version_dl=$($DL_TARGET --version)
|
|
2865
|
version_dl=$($DL_TARGET --version)
|
|
2836
|
rc_version_dl=$($DL_TARGET cli image-info)
|
|
2866
|
rc_version_dl=$($DL_TARGET cli image-info)
|
|
2837
|
|
|
2867
|
|
|
2838
|
echo "self-update: $RC_SCRIPT_NAME version downloaded: $version_dl"
|
|
2868
|
echo "self-update: $RC_SCRIPT_NAME version downloaded: $version_dl"
|
|
2839
|
|
|
2869
|
|
|
2840
|
if [[ $DEBUG ]]; then
|
|
2870
|
if [[ $DEBUG ]]; then
|
|
2841
|
echo "DEBUG: old-script ver: $version_old"
|
|
2871
|
echo "DEBUG: old-script ver: $version_old"
|
|
2842
|
echo "DEBUG: new-script ver: $version_dl"
|
|
2872
|
echo "DEBUG: new-script ver: $version_dl"
|
|
2843
|
echo "DEBUG: "
|
|
2873
|
echo "DEBUG: "
|
|
2844
|
echo "DEBUG: .runtime.env set version $ENV_VER"
|
|
2874
|
echo "DEBUG: .runtime.env set version $ENV_VER"
|
|
2845
|
echo "DEBUG: "
|
|
2875
|
echo "DEBUG: "
|
|
2846
|
echo "DEBUG: old-script: RC VERSION: $rc_version_old"
|
|
2876
|
echo "DEBUG: old-script: RC VERSION: $rc_version_old"
|
|
2847
|
echo "DEBUG: new-script: RC VERSION: $rc_version_dl"
|
|
2877
|
echo "DEBUG: new-script: RC VERSION: $rc_version_dl"
|
|
2848
|
fi
|
|
2878
|
fi
|
|
2849
|
|
|
2879
|
|
|
2850
|
if [[ $version_old == "$version_dl" ]]; then
|
|
2880
|
if [[ $version_old == "$version_dl" ]]; then
|
|
2851
|
|
|
2881
|
|
|
2852
|
if [[ $FORCE ]]; then
|
|
2882
|
if [[ $FORCE ]]; then
|
|
2853
|
echo "$(yellow self-update: downloaded version is the same as current version $version_dl, continue with --force...)"
|
|
2883
|
echo "$(yellow self-update: downloaded version is the same as current version $version_dl, continue with --force...)"
|
|
2854
|
else
|
|
2884
|
else
|
|
2855
|
echo "self-update: downloaded version is the same as current version $version_dl, exiting..."
|
|
2885
|
echo "self-update: downloaded version is the same as current version $version_dl, exiting..."
|
|
2856
|
exit
|
|
2886
|
exit
|
|
2857
|
fi
|
|
2887
|
fi
|
|
2858
|
|
|
2888
|
|
|
2859
|
fi
|
|
2889
|
fi
|
|
2860
|
|
|
2890
|
|
|
2861
|
docker_image_update() {
|
|
2891
|
docker_image_update() {
|
|
2862
|
|
|
2892
|
|
|
2863
|
echo "$(green self-update: saving new RC_VERSION=$rc_version_dl to runtime.env file)"
|
|
2893
|
echo "$(green self-update: saving new RC_VERSION=$rc_version_dl to runtime.env file)"
|
|
2864
|
|
|
2894
|
|
|
2865
|
echo "currently .runtime.env file uses image: $ENV_VER"
|
|
2895
|
echo "currently .runtime.env file uses image: $ENV_VER"
|
|
2866
|
while true; do
|
|
2896
|
while true; do
|
|
2867
|
read -p "self-update: Would you like to continue with setting RC_VERSION=$rc_version_dl into .runtime.env file? [yn] " yn
|
|
2897
|
read -p "self-update: Would you like to continue with setting RC_VERSION=$rc_version_dl into .runtime.env file? [yn] " yn
|
|
2868
|
case $yn in
|
|
2898
|
case $yn in
|
|
2869
|
[Yy]*)
|
|
2899
|
[Yy]*)
|
|
2870
|
.env set RC_VERSION=$rc_version_dl
|
|
2900
|
.env set RC_VERSION=$rc_version_dl
|
|
2871
|
echo "self-update: new version set into config"
|
|
2901
|
echo "self-update: new version set into config"
|
|
2872
|
break ;;
|
|
2902
|
break ;;
|
|
2873
|
[Nn]*)
|
|
2903
|
[Nn]*)
|
|
2874
|
break ;;
|
|
2904
|
break ;;
|
|
2875
|
*) echo "Please answer y or n." ;;
|
|
2905
|
*) echo "Please answer y or n." ;;
|
|
2876
|
esac
|
|
2906
|
esac
|
|
2877
|
done
|
|
2907
|
done
|
|
2878
|
}
|
|
2908
|
}
|
|
2879
|
|
|
2909
|
|
|
2880
|
if [[ $rc_version_old == "$rc_version_dl" ]]; then
|
|
2910
|
if [[ $rc_version_old == "$rc_version_dl" ]]; then
|
|
2881
|
echo "self-update: docker image defined by RC_VERSION=$rc_version_dl seems to be up-to date"
|
|
2911
|
echo "self-update: docker image defined by RC_VERSION=$rc_version_dl seems to be up-to date"
|
|
2882
|
|
|
2912
|
|
|
2883
|
if [[ $FORCE ]]; then
|
|
2913
|
if [[ $FORCE ]]; then
|
|
2884
|
echo "$(yellow self-update: continue with --force...)"
|
|
2914
|
echo "$(yellow self-update: continue with --force...)"
|
|
2885
|
docker_image_update
|
|
2915
|
docker_image_update
|
|
2886
|
fi
|
|
2916
|
fi
|
|
2887
|
|
|
2917
|
|
|
2888
|
else
|
|
2918
|
else
|
|
2889
|
docker_image_update
|
|
2919
|
docker_image_update
|
|
2890
|
fi
|
|
2920
|
fi
|
|
2891
|
|
|
2921
|
|
|
2892
|
echo "self-update: updating cli $RC_SCRIPT_NAME script to new version: $version_dl"
|
|
2922
|
echo "self-update: updating cli $RC_SCRIPT_NAME script to new version: $version_dl"
|
|
2893
|
|
|
2923
|
|
|
2894
|
if [[ -f "$FINAL_TARGET" ]]; then
|
|
2924
|
if [[ -f "$FINAL_TARGET" ]]; then
|
|
2895
|
rm $FINAL_TARGET && mv -v $DL_TARGET $FINAL_TARGET
|
|
2925
|
rm $FINAL_TARGET && mv -v $DL_TARGET $FINAL_TARGET
|
|
2896
|
else
|
|
2926
|
else
|
|
2897
|
mv -v $DL_TARGET $FINAL_TARGET
|
|
2927
|
mv -v $DL_TARGET $FINAL_TARGET
|
|
2898
|
fi
|
|
2928
|
fi
|
|
2899
|
|
|
2929
|
|
|
2900
|
echo "$(green self-update: updating docker definitions to $docker_revision)"
|
|
2930
|
echo "$(green self-update: updating docker definitions to $docker_revision)"
|
|
2901
|
|
|
2931
|
|
|
2902
|
FULL_MODE=1
|
|
2932
|
FULL_MODE=1
|
|
2903
|
get_docker_definitions $docker_revision $FULL_MODE $DEBUG
|
|
2933
|
get_docker_definitions $docker_revision $FULL_MODE $DEBUG
|
|
2904
|
|
|
2934
|
|
|
2905
|
echo "$(green self-update: successfully update to $version_dl)"
|
|
2935
|
echo "$(green self-update: successfully update to $version_dl)"
|
|
2906
|
exit
|
|
2936
|
exit
|
|
2907
|
}
|
|
2937
|
}
|
|
2908
|
|
|
2938
|
|
|
2909
|
# :command.function
|
|
2939
|
# :command.function
|
|
2910
|
rcstack_stack_router_command() {
|
|
2940
|
rcstack_stack_router_command() {
|
|
2911
|
# src/stack_router_command.sh
|
|
2941
|
# src/stack_router_command.sh
|
|
2912
|
check_bootstrap
|
|
2942
|
check_bootstrap
|
|
2913
|
|
|
2943
|
|
|
2914
|
DEBUG=${args[--debug]}
|
|
2944
|
DEBUG=${args[--debug]}
|
|
2915
|
ENV_FILE=${args[--env-file-path]}
|
|
2945
|
ENV_FILE=${args[--env-file-path]}
|
|
2916
|
|
|
2946
|
|
|
2917
|
if [[ ! -f $RC_STACK_ROUTER_EXT ]]; then
|
|
2947
|
if [[ ! -f $RC_STACK_ROUTER_EXT ]]; then
|
|
2918
|
RC_STACK_ROUTER_EXT=""
|
|
2948
|
RC_STACK_ROUTER_EXT=""
|
|
2919
|
else
|
|
2949
|
else
|
|
2920
|
RC_STACK_ROUTER_EXT="-f $RC_STACK_ROUTER_EXT"
|
|
2950
|
RC_STACK_ROUTER_EXT="-f $RC_STACK_ROUTER_EXT"
|
|
2921
|
fi
|
|
2951
|
fi
|
|
2922
|
|
|
2952
|
|
|
2923
|
CMD_ROUTER="\
|
|
2953
|
CMD_ROUTER="\
|
|
2924
|
RC_ENV_FILE=$ENV_FILE docker compose \
|
|
2954
|
RC_ENV_FILE=$ENV_FILE docker compose \
|
|
2925
|
--env-file $ENV_FILE \
|
|
2955
|
--env-file $ENV_FILE \
|
|
2926
|
$ENV_EXPAND \
|
|
2956
|
$ENV_EXPAND \
|
|
2927
|
-p rc_cluster_router \
|
|
2957
|
-p rc_cluster_router \
|
|
2928
|
-f docker-compose-base.yaml \
|
|
2958
|
-f docker-compose-base.yaml \
|
|
2929
|
-f docker-compose-router.yaml $RC_STACK_ROUTER_EXT"
|
|
2959
|
-f docker-compose-router.yaml $RC_STACK_ROUTER_EXT"
|
|
2930
|
|
|
2960
|
|
|
2931
|
if [[ $DEBUG ]]; then
|
|
2961
|
if [[ $DEBUG ]]; then
|
|
2932
|
echo "---"
|
|
2962
|
echo "---"
|
|
2933
|
echo "stacks docker: $RC_STACK_ROUTER_EXT_LCL"
|
|
2963
|
echo "stacks docker: $RC_STACK_ROUTER_EXT_LCL"
|
|
2934
|
echo "running command: ${CMD_ROUTER}"
|
|
2964
|
echo "running command: ${CMD_ROUTER}"
|
|
2935
|
echo "ARGS: ${other_args[*]}"
|
|
2965
|
echo "ARGS: ${other_args[*]}"
|
|
2936
|
echo "---"
|
|
2966
|
echo "---"
|
|
2937
|
fi
|
|
2967
|
fi
|
|
2938
|
eval "${CMD_ROUTER} ${other_args[*]}"
|
|
2968
|
eval "${CMD_ROUTER} ${other_args[*]}"
|
|
2939
|
|
|
2969
|
|
|
2940
|
}
|
|
2970
|
}
|
|
2941
|
|
|
2971
|
|
|
2942
|
# :command.function
|
|
2972
|
# :command.function
|
|
2943
|
rcstack_stack_metrics_command() {
|
|
2973
|
rcstack_stack_metrics_command() {
|
|
2944
|
# src/stack_metrics_command.sh
|
|
2974
|
# src/stack_metrics_command.sh
|
|
2945
|
check_bootstrap
|
|
2975
|
check_bootstrap
|
|
2946
|
|
|
2976
|
|
|
2947
|
DEBUG=${args[--debug]}
|
|
2977
|
DEBUG=${args[--debug]}
|
|
2948
|
ENV_FILE=${args[--env-file-path]}
|
|
2978
|
ENV_FILE=${args[--env-file-path]}
|
|
2949
|
|
|
2979
|
|
|
2950
|
if [[ ! -f $RC_STACK_METRICS_EXT ]]; then
|
|
2980
|
if [[ ! -f $RC_STACK_METRICS_EXT ]]; then
|
|
2951
|
RC_STACK_METRICS_EXT_LCL=""
|
|
2981
|
RC_STACK_METRICS_EXT_LCL=""
|
|
2952
|
else
|
|
2982
|
else
|
|
2953
|
RC_STACK_METRICS_EXT_LCL="-f $RC_STACK_METRICS_EXT"
|
|
2983
|
RC_STACK_METRICS_EXT_LCL="-f $RC_STACK_METRICS_EXT"
|
|
2954
|
fi
|
|
2984
|
fi
|
|
2955
|
|
|
2985
|
|
|
2956
|
CMD_METRICS="\
|
|
2986
|
CMD_METRICS="\
|
|
2957
|
RC_ENV_FILE=$ENV_FILE docker compose \
|
|
2987
|
RC_ENV_FILE=$ENV_FILE docker compose \
|
|
2958
|
--env-file $ENV_FILE \
|
|
2988
|
--env-file $ENV_FILE \
|
|
2959
|
$ENV_EXPAND \
|
|
2989
|
$ENV_EXPAND \
|
|
2960
|
-p rc_cluster_metrics \
|
|
2990
|
-p rc_cluster_metrics \
|
|
2961
|
-f docker-compose-base.yaml \
|
|
2991
|
-f docker-compose-base.yaml \
|
|
2962
|
-f docker-compose-metrics.yaml $RC_STACK_METRICS_EXT_LCL"
|
|
2992
|
-f docker-compose-metrics.yaml $RC_STACK_METRICS_EXT_LCL"
|
|
2963
|
|
|
2993
|
|
|
2964
|
if [[ $DEBUG ]]; then
|
|
2994
|
if [[ $DEBUG ]]; then
|
|
2965
|
echo "---"
|
|
2995
|
echo "---"
|
|
2966
|
echo "stacks docker: $RC_STACK_METRICS_EXT_LCL"
|
|
2996
|
echo "stacks docker: $RC_STACK_METRICS_EXT_LCL"
|
|
2967
|
echo "running command: ${CMD_METRICS}"
|
|
2997
|
echo "running command: ${CMD_METRICS}"
|
|
2968
|
echo "ARGS: ${other_args[*]}"
|
|
2998
|
echo "ARGS: ${other_args[*]}"
|
|
2969
|
echo "---"
|
|
2999
|
echo "---"
|
|
2970
|
fi
|
|
3000
|
fi
|
|
2971
|
eval "${CMD_METRICS} ${other_args[*]}"
|
|
3001
|
eval "${CMD_METRICS} ${other_args[*]}"
|
|
2972
|
}
|
|
3002
|
}
|
|
2973
|
|
|
3003
|
|
|
2974
|
# :command.function
|
|
3004
|
# :command.function
|
|
2975
|
rcstack_stack_services_command() {
|
|
3005
|
rcstack_stack_services_command() {
|
|
2976
|
# src/stack_services_command.sh
|
|
3006
|
# src/stack_services_command.sh
|
|
2977
|
check_bootstrap
|
|
3007
|
check_bootstrap
|
|
2978
|
|
|
3008
|
|
|
2979
|
DEBUG=${args[--debug]}
|
|
3009
|
DEBUG=${args[--debug]}
|
|
2980
|
ENV_FILE=${args[--env-file-path]}
|
|
3010
|
ENV_FILE=${args[--env-file-path]}
|
|
2981
|
|
|
3011
|
|
|
2982
|
if [[ ! -f $RC_STACK_SERVICES_EXT ]]; then
|
|
3012
|
if [[ ! -f $RC_STACK_SERVICES_EXT ]]; then
|
|
2983
|
RC_STACK_SERVICES_EXT_LCL=""
|
|
3013
|
RC_STACK_SERVICES_EXT_LCL=""
|
|
2984
|
else
|
|
3014
|
else
|
|
2985
|
RC_STACK_SERVICES_EXT_LCL="-f $RC_STACK_SERVICES_EXT"
|
|
3015
|
RC_STACK_SERVICES_EXT_LCL="-f $RC_STACK_SERVICES_EXT"
|
|
2986
|
fi
|
|
3016
|
fi
|
|
2987
|
|
|
3017
|
|
|
2988
|
RC_STACK_PROFILES="--profile database --profile redis --profile elasticsearch --profile channelstream"
|
|
3018
|
RC_STACK_PROFILES="--profile database --profile redis --profile elasticsearch --profile channelstream"
|
|
2989
|
|
|
3019
|
|
|
2990
|
CMD_SERVICES="\
|
|
3020
|
CMD_SERVICES="\
|
|
2991
|
RC_ENV_FILE=$ENV_FILE docker compose \
|
|
3021
|
RC_ENV_FILE=$ENV_FILE docker compose \
|
|
2992
|
--env-file $ENV_FILE \
|
|
3022
|
--env-file $ENV_FILE \
|
|
2993
|
$ENV_EXPAND \
|
|
3023
|
$ENV_EXPAND \
|
|
2994
|
$RC_STACK_PROFILES \
|
|
3024
|
$RC_STACK_PROFILES \
|
|
2995
|
-p rc_cluster_services \
|
|
3025
|
-p rc_cluster_services \
|
|
2996
|
-f docker-compose-base.yaml \
|
|
3026
|
-f docker-compose-base.yaml \
|
|
2997
|
-f docker-compose-services.yaml $RC_STACK_SERVICES_EXT_LCL"
|
|
3027
|
-f docker-compose-services.yaml $RC_STACK_SERVICES_EXT_LCL"
|
|
2998
|
|
|
3028
|
|
|
2999
|
if [[ $DEBUG ]]; then
|
|
3029
|
if [[ $DEBUG ]]; then
|
|
3000
|
echo "---"
|
|
3030
|
echo "---"
|
|
3001
|
echo "stacks docker: $RC_STACK_SERVICES_EXT_LCL"
|
|
3031
|
echo "stacks docker: $RC_STACK_SERVICES_EXT_LCL"
|
|
3002
|
echo "running command: ${CMD_SERVICES}"
|
|
3032
|
echo "running command: ${CMD_SERVICES}"
|
|
3003
|
echo "ARGS: ${other_args[*]}"
|
|
3033
|
echo "ARGS: ${other_args[*]}"
|
|
3004
|
echo "---"
|
|
3034
|
echo "---"
|
|
3005
|
fi
|
|
3035
|
fi
|
|
3006
|
|
|
3036
|
|
|
3007
|
eval "${CMD_SERVICES} ${other_args[*]}"
|
|
3037
|
eval "${CMD_SERVICES} ${other_args[*]}"
|
|
3008
|
}
|
|
3038
|
}
|
|
3009
|
|
|
3039
|
|
|
3010
|
# :command.function
|
|
3040
|
# :command.function
|
|
3011
|
rcstack_stack_rhodecode_command() {
|
|
3041
|
rcstack_stack_rhodecode_command() {
|
|
3012
|
# src/stack_rhodecode_command.sh
|
|
3042
|
# src/stack_rhodecode_command.sh
|
|
3013
|
check_bootstrap
|
|
3043
|
check_bootstrap
|
|
3014
|
|
|
3044
|
|
|
3015
|
DEBUG=${args[--debug]}
|
|
3045
|
DEBUG=${args[--debug]}
|
|
3016
|
ENV_FILE=${args[--env-file-path]}
|
|
3046
|
ENV_FILE=${args[--env-file-path]}
|
|
3017
|
|
|
3047
|
|
|
3018
|
stack_prefix=${args[--stack-prefix]}
|
|
3048
|
stack_prefix=${args[--stack-prefix]}
|
|
3019
|
if [[ $stack_prefix == "" ]]; then
|
|
3049
|
if [[ $stack_prefix == "" ]]; then
|
|
3020
|
stack_prefix="rc_cluster_apps"
|
|
3050
|
stack_prefix="rc_cluster_apps"
|
|
3021
|
fi
|
|
3051
|
fi
|
|
3022
|
|
|
3052
|
|
|
3023
|
if [[ ! -f $RC_STACK_RHODECODE_EXT ]]; then
|
|
3053
|
if [[ ! -f $RC_STACK_RHODECODE_EXT ]]; then
|
|
3024
|
RC_STACK_RHODECODE_EXT_LCL=""
|
|
3054
|
RC_STACK_RHODECODE_EXT_LCL=""
|
|
3025
|
else
|
|
3055
|
else
|
|
3026
|
RC_STACK_RHODECODE_EXT_LCL="-f $RC_STACK_RHODECODE_EXT"
|
|
3056
|
RC_STACK_RHODECODE_EXT_LCL="-f $RC_STACK_RHODECODE_EXT"
|
|
3027
|
fi
|
|
3057
|
fi
|
|
3028
|
|
|
3058
|
|
|
3029
|
CMD_RHODECODE="\
|
|
3059
|
CMD_RHODECODE="\
|
|
3030
|
RC_ENV_FILE=$ENV_FILE docker compose \
|
|
3060
|
RC_ENV_FILE=$ENV_FILE docker compose \
|
|
3031
|
--env-file $ENV_FILE \
|
|
3061
|
--env-file $ENV_FILE \
|
|
3032
|
$ENV_EXPAND \
|
|
3062
|
$ENV_EXPAND \
|
|
3033
|
-p $stack_prefix \
|
|
3063
|
-p $stack_prefix \
|
|
3034
|
-f docker-compose-base.yaml \
|
|
3064
|
-f docker-compose-base.yaml \
|
|
3035
|
-f docker-compose-apps.yaml $RC_STACK_RHODECODE_EXT_LCL"
|
|
3065
|
-f docker-compose-apps.yaml $RC_STACK_RHODECODE_EXT_LCL"
|
|
3036
|
|
|
3066
|
|
|
3037
|
CMD_RHODECODE_SOURCE="\
|
|
3067
|
CMD_RHODECODE_SOURCE="\
|
|
3038
|
RC_ENV_FILE=$ENV_FILE docker compose \
|
|
3068
|
RC_ENV_FILE=$ENV_FILE docker compose \
|
|
3039
|
--env-file $ENV_FILE \
|
|
3069
|
--env-file $ENV_FILE \
|
|
3040
|
$ENV_EXPAND \
|
|
3070
|
$ENV_EXPAND \
|
|
3041
|
-p $stack_prefix \
|
|
3071
|
-p $stack_prefix \
|
|
3042
|
-f docker-compose-base.yaml \
|
|
3072
|
-f docker-compose-base.yaml \
|
|
3043
|
-f docker-compose-apps.yaml \
|
|
3073
|
-f docker-compose-apps.yaml \
|
|
3044
|
-f docker-compose-apps.source.yaml $RC_STACK_RHODECODE_EXT_LCL"
|
|
3074
|
-f docker-compose-apps.source.yaml $RC_STACK_RHODECODE_EXT_LCL"
|
|
3045
|
|
|
3075
|
|
|
3046
|
sub_cmd=${other_args[0]}
|
|
3076
|
sub_cmd=${other_args[0]}
|
|
3047
|
|
|
3077
|
|
|
3048
|
if [[ $sub_cmd == "up" ]]; then
|
|
3078
|
if [[ $sub_cmd == "up" ]]; then
|
|
3049
|
declare -a final_args=( "$sub_cmd" "--no-color" "--no-build" "${other_args[@]:1}" )
|
|
3079
|
declare -a final_args=( "$sub_cmd" "--no-color" "--no-build" "${other_args[@]:1}" )
|
|
3050
|
else
|
|
3080
|
else
|
|
3051
|
declare -a final_args=( "$sub_cmd" "${other_args[@]:1}" )
|
|
3081
|
declare -a final_args=( "$sub_cmd" "${other_args[@]:1}" )
|
|
3052
|
fi
|
|
3082
|
fi
|
|
3053
|
|
|
3083
|
|
|
3054
|
if [[ $DEBUG ]]; then
|
|
3084
|
if [[ $DEBUG ]]; then
|
|
3055
|
echo "---"
|
|
3085
|
echo "---"
|
|
3056
|
echo "stacks docker: $RC_STACK_RHODECODE_EXT_LCL"
|
|
3086
|
echo "stacks docker: $RC_STACK_RHODECODE_EXT_LCL"
|
|
3057
|
echo "running command: ${CMD_RHODECODE}"
|
|
3087
|
echo "running command: ${CMD_RHODECODE}"
|
|
3058
|
echo "ARGS: ${final_args[*]}"
|
|
3088
|
echo "ARGS: ${final_args[*]}"
|
|
3059
|
echo "---"
|
|
3089
|
echo "---"
|
|
3060
|
fi
|
|
3090
|
fi
|
|
3061
|
eval "${CMD_RHODECODE} ${final_args[*]}"
|
|
3091
|
eval "${CMD_RHODECODE} ${final_args[*]}"
|
|
3062
|
|
|
3092
|
|
|
3063
|
}
|
|
3093
|
}
|
|
3064
|
|
|
3094
|
|
|
3065
|
# :command.function
|
|
3095
|
# :command.function
|
|
3066
|
rcstack_stack_all_command() {
|
|
3096
|
rcstack_stack_all_command() {
|
|
3067
|
# src/stack_all_command.sh
|
|
3097
|
# src/stack_all_command.sh
|
|
3068
|
check_bootstrap
|
|
3098
|
check_bootstrap
|
|
3069
|
|
|
3099
|
|
|
3070
|
DEBUG=${args[--debug]}
|
|
3100
|
DEBUG=${args[--debug]}
|
|
3071
|
|
|
3101
|
|
|
3072
|
stack_lst=$VALID_SERVICES
|
|
3102
|
stack_lst=$VALID_SERVICES
|
|
3073
|
|
|
3103
|
|
|
3074
|
for stack in $stack_lst; do
|
|
3104
|
for stack in $stack_lst; do
|
|
3075
|
./$RC_SCRIPT_NAME stack $stack ${other_args[*]}
|
|
3105
|
./$RC_SCRIPT_NAME stack $stack ${other_args[*]}
|
|
3076
|
done
|
|
3106
|
done
|
|
3077
|
|
|
3107
|
|
|
3078
|
}
|
|
3108
|
}
|
|
3079
|
|
|
3109
|
|
|
3080
|
# :command.function
|
|
3110
|
# :command.function
|
|
3081
|
rcstack_stack_status_command() {
|
|
3111
|
rcstack_stack_status_command() {
|
|
3082
|
# src/stack_status_command.sh
|
|
3112
|
# src/stack_status_command.sh
|
|
3083
|
check_bootstrap
|
|
3113
|
check_bootstrap
|
|
3084
|
DEBUG=${args[--debug]}
|
|
3114
|
DEBUG=${args[--debug]}
|
|
3085
|
DETAILED=${args[--detailed]}
|
|
3115
|
DETAILED=${args[--detailed]}
|
|
3086
|
CONFIGS=${args[--configs]}
|
|
3116
|
CONFIGS=${args[--configs]}
|
|
3087
|
|
|
3117
|
|
|
3088
|
.env --file $RUNTIME_ENV
|
|
3118
|
.env --file $RUNTIME_ENV
|
|
3089
|
.env get RC_APP_BASE_URL
|
|
3119
|
.env get RC_APP_BASE_URL
|
|
3090
|
RC_APP_BASE_URL=$REPLY
|
|
3120
|
RC_APP_BASE_URL=$REPLY
|
|
3091
|
|
|
3121
|
|
|
3092
|
if [[ $DEBUG ]]; then
|
|
3122
|
if [[ $DEBUG ]]; then
|
|
3093
|
echo "---"
|
|
3123
|
echo "---"
|
|
3094
|
ps_cmd=$(docker ps --filter=name=rc_cluster --format="{{.ID}}")
|
|
3124
|
ps_cmd=$(docker ps --filter=name=rc_cluster --format="{{.ID}}")
|
|
3095
|
|
|
3125
|
|
|
3096
|
for service in $ps_cmd; do
|
|
3126
|
for service in $ps_cmd; do
|
|
3097
|
|
|
3127
|
|
|
3098
|
servicename=`docker inspect --format '{{ .Name }}' $service`
|
|
3128
|
servicename=`docker inspect --format '{{ .Name }}' $service`
|
|
3099
|
servicename=${servicename:1}
|
|
3129
|
servicename=${servicename:1}
|
|
3100
|
echo $servicename
|
|
3130
|
echo $servicename
|
|
3101
|
docker inspect $service --format='{{.State.Status}}: {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'
|
|
3131
|
docker inspect $service --format='{{.State.Status}}: {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'
|
|
3102
|
echo ""
|
|
3132
|
echo ""
|
|
3103
|
|
|
3133
|
|
|
3104
|
done
|
|
3134
|
done
|
|
3105
|
echo "---"
|
|
3135
|
echo "---"
|
|
3106
|
fi
|
|
3136
|
fi
|
|
3107
|
|
|
3137
|
|
|
3108
|
echo "Running hostname: $RC_APP_BASE_URL"
|
|
3138
|
echo "Running hostname: $RC_APP_BASE_URL"
|
|
3109
|
|
|
3139
|
|
|
3110
|
if [[ $CONFIGS ]]; then
|
|
3140
|
if [[ $CONFIGS ]]; then
|
|
3111
|
printf "RhodeCode:\n"
|
|
3141
|
printf "RhodeCode:\n"
|
|
3112
|
printf " ini (in-host): $rhodecode_default_config_path\n"
|
|
3142
|
printf " ini (in-host): $rhodecode_default_config_path\n"
|
|
3113
|
printf " volumes (in-container):\n"
|
|
3143
|
printf " volumes (in-container):\n"
|
|
3114
|
printf " repo-store: /var/opt/rhodecode_repo_store\n"
|
|
3144
|
printf " repo-store: /var/opt/rhodecode_repo_store\n"
|
|
3115
|
printf " data-store: /var/opt/rhodecode_data\n"
|
|
3145
|
printf " data-store: /var/opt/rhodecode_data\n"
|
|
3116
|
|
|
3146
|
|
|
3117
|
printf "VCSServer:\n"
|
|
3147
|
printf "VCSServer:\n"
|
|
3118
|
printf " ini (in-host): $vcsserver_default_config_path\n"
|
|
3148
|
printf " ini (in-host): $vcsserver_default_config_path\n"
|
|
3119
|
printf " volumes (in-container):\n"
|
|
3149
|
printf " volumes (in-container):\n"
|
|
3120
|
printf " repo-store: /var/opt/rhodecode_repo_store\n"
|
|
3150
|
printf " repo-store: /var/opt/rhodecode_repo_store\n"
|
|
3121
|
printf " data-store: /var/opt/rhodecode_data\n"
|
|
3151
|
printf " data-store: /var/opt/rhodecode_data\n"
|
|
3122
|
|
|
3152
|
|
|
3123
|
printf "Traefik (router):\n"
|
|
3153
|
printf "Traefik (router):\n"
|
|
3124
|
printf " ssl-certs definitions: .custom/traefik_custom/dynamic/traefik_dynamic_custom.yaml\n"
|
|
3154
|
printf " ssl-certs definitions: .custom/traefik_custom/dynamic/traefik_dynamic_custom.yaml\n"
|
|
3125
|
printf " ssl-certs dir: .custom/traefik_custom/dynamic/certs/\n"
|
|
3155
|
printf " ssl-certs dir: .custom/traefik_custom/dynamic/certs/\n"
|
|
3126
|
|
|
3156
|
|
|
3127
|
fi
|
|
3157
|
fi
|
|
3128
|
|
|
3158
|
|
|
3129
|
if [[ $DETAILED ]]; then
|
|
3159
|
if [[ $DETAILED ]]; then
|
|
3130
|
ps_cmd=$(docker ps --filter=name=rc_cluster --format="{{.ID}}")
|
|
3160
|
ps_cmd=$(docker ps --filter=name=rc_cluster --format="{{.ID}}")
|
|
3131
|
|
|
3161
|
|
|
3132
|
for service in $ps_cmd; do
|
|
3162
|
for service in $ps_cmd; do
|
|
3133
|
servicename=`docker inspect --format '{{ .Name }}' $service`
|
|
3163
|
servicename=`docker inspect --format '{{ .Name }}' $service`
|
|
3134
|
servicename=${servicename:1}
|
|
3164
|
servicename=${servicename:1}
|
|
3135
|
printf "CONTAINER:\\t$servicename\n"
|
|
3165
|
printf "CONTAINER:\\t$servicename\n"
|
|
3136
|
printf "LOGS:\\t\\tdocker logs --tail=100 $service\n"
|
|
3166
|
printf "LOGS:\\t\\tdocker logs --tail=100 $service\n"
|
|
3137
|
docker ps --filter=name=$servicename --format="ID:\\t\\t{{.ID}}\nIMAGE:\\t\\t{{.Image}}\nSTATUS:\\t\\t{{.Status}}\nPORTS:\\t\\t{{.Ports}}\n"
|
|
3167
|
docker ps --filter=name=$servicename --format="ID:\\t\\t{{.ID}}\nIMAGE:\\t\\t{{.Image}}\nSTATUS:\\t\\t{{.Status}}\nPORTS:\\t\\t{{.Ports}}\n"
|
|
3138
|
echo ""
|
|
3168
|
echo ""
|
|
3139
|
done
|
|
3169
|
done
|
|
3140
|
else
|
|
3170
|
else
|
|
3141
|
docker ps --filter=name=rc_cluster --format "table {{.ID}}\t{{.Names}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}" | (read -r; printf "%s\n" "$REPLY"; sort -k 2 )
|
|
3171
|
docker ps --filter=name=rc_cluster --format "table {{.ID}}\t{{.Names}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}" | (read -r; printf "%s\n" "$REPLY"; sort -k 2 )
|
|
3142
|
fi
|
|
3172
|
fi
|
|
3143
|
|
|
3173
|
|
|
3144
|
}
|
|
3174
|
}
|
|
3145
|
|
|
3175
|
|
|
3146
|
# :command.function
|
|
3176
|
# :command.function
|
|
3147
|
rcstack_stack_upgrade_router_command() {
|
|
3177
|
rcstack_stack_upgrade_router_command() {
|
|
3148
|
# src/stack_upgrade_router_command.sh
|
|
3178
|
# src/stack_upgrade_router_command.sh
|
|
3149
|
echo "Upgrading this stack with:"
|
|
3179
|
echo "Upgrading this stack with:"
|
|
3150
|
echo "./$RC_SCRIPT_NAME stack router up --force-recreate --detach"
|
|
3180
|
echo "./$RC_SCRIPT_NAME stack router up --force-recreate --detach"
|
|
3151
|
echo ""
|
|
3181
|
echo ""
|
|
3152
|
echo "NOTE: To reclaim space occupied by old images, run:"
|
|
3182
|
echo "NOTE: To reclaim space occupied by old images, run:"
|
|
3153
|
echo "docker image prune -f"
|
|
3183
|
echo "docker image prune -f"
|
|
3154
|
|
|
3184
|
|
|
3155
|
./$RC_SCRIPT_NAME stack router up --force-recreate --detach
|
|
3185
|
./$RC_SCRIPT_NAME stack router up --force-recreate --detach
|
|
3156
|
|
|
3186
|
|
|
3157
|
}
|
|
3187
|
}
|
|
3158
|
|
|
3188
|
|
|
3159
|
# :command.function
|
|
3189
|
# :command.function
|
|
3160
|
rcstack_stack_upgrade_metrics_command() {
|
|
3190
|
rcstack_stack_upgrade_metrics_command() {
|
|
3161
|
# src/stack_upgrade_metrics_command.sh
|
|
3191
|
# src/stack_upgrade_metrics_command.sh
|
|
3162
|
echo "To upgrading this stack with:"
|
|
3192
|
echo "To upgrading this stack with:"
|
|
3163
|
echo "./$RC_SCRIPT_NAME stack metrics up --force-recreate --detach"
|
|
3193
|
echo "./$RC_SCRIPT_NAME stack metrics up --force-recreate --detach"
|
|
3164
|
echo ""
|
|
3194
|
echo ""
|
|
3165
|
echo "NOTE: To reclaim space occupied by old images, run:"
|
|
3195
|
echo "NOTE: To reclaim space occupied by old images, run:"
|
|
3166
|
echo "docker image prune -f"
|
|
3196
|
echo "docker image prune -f"
|
|
3167
|
|
|
3197
|
|
|
3168
|
./$RC_SCRIPT_NAME stack metrics up --force-recreate --detach
|
|
3198
|
./$RC_SCRIPT_NAME stack metrics up --force-recreate --detach
|
|
3169
|
|
|
3199
|
|
|
3170
|
}
|
|
3200
|
}
|
|
3171
|
|
|
3201
|
|
|
3172
|
# :command.function
|
|
3202
|
# :command.function
|
|
3173
|
rcstack_stack_upgrade_services_command() {
|
|
3203
|
rcstack_stack_upgrade_services_command() {
|
|
3174
|
# src/stack_upgrade_services_command.sh
|
|
3204
|
# src/stack_upgrade_services_command.sh
|
|
3175
|
echo "Upgrading this stack with:"
|
|
3205
|
echo "Upgrading this stack with:"
|
|
3176
|
echo "./$RC_SCRIPT_NAME stack services up --force-recreate --detach"
|
|
3206
|
echo "./$RC_SCRIPT_NAME stack services up --force-recreate --detach"
|
|
3177
|
echo ""
|
|
3207
|
echo ""
|
|
3178
|
echo "NOTE: To reclaim space occupied by old images, run:"
|
|
3208
|
echo "NOTE: To reclaim space occupied by old images, run:"
|
|
3179
|
echo "docker image prune -f"
|
|
3209
|
echo "docker image prune -f"
|
|
3180
|
|
|
3210
|
|
|
3181
|
./$RC_SCRIPT_NAME stack services up --force-recreate --detach
|
|
3211
|
./$RC_SCRIPT_NAME stack services up --force-recreate --detach
|
|
3182
|
|
|
3212
|
|
|
3183
|
}
|
|
3213
|
}
|
|
3184
|
|
|
3214
|
|
|
3185
|
# :command.function
|
|
3215
|
# :command.function
|
|
3186
|
rcstack_stack_upgrade_rhodecode_command() {
|
|
3216
|
rcstack_stack_upgrade_rhodecode_command() {
|
|
3187
|
# src/stack_upgrade_rhodecode_command.sh
|
|
3217
|
# src/stack_upgrade_rhodecode_command.sh
|
|
3188
|
check_bootstrap
|
|
3218
|
check_bootstrap
|
|
3189
|
|
|
3219
|
|
|
3190
|
stop_wait=${args[--stop-wait]}
|
|
3220
|
stop_wait=${args[--stop-wait]}
|
|
3191
|
docker_stop_wait=${args[--docker-stop-wait]}
|
|
3221
|
docker_stop_wait=${args[--docker-stop-wait]}
|
|
3192
|
|
|
3222
|
|
|
3193
|
stack_prefix=${args[--stack-prefix]}
|
|
3223
|
stack_prefix=${args[--stack-prefix]}
|
|
3194
|
if [[ $stack_prefix == "" ]]; then
|
|
3224
|
if [[ $stack_prefix == "" ]]; then
|
|
3195
|
stack_prefix="rc_cluster_apps"
|
|
3225
|
stack_prefix="rc_cluster_apps"
|
|
3196
|
fi
|
|
3226
|
fi
|
|
3197
|
|
|
3227
|
|
|
3198
|
# search docker IDs for current service
|
|
3228
|
# search docker IDs for current service
|
|
3199
|
.env --file $RUNTIME_ENV
|
|
3229
|
.env --file $RUNTIME_ENV
|
|
3200
|
|
|
3230
|
|
|
3201
|
.env get RC_VERSION
|
|
3231
|
.env get RC_VERSION
|
|
3202
|
RC_VERSION=$REPLY
|
|
3232
|
RC_VERSION=$REPLY
|
|
3203
|
|
|
3233
|
|
|
3204
|
.env get RC_EDITION
|
|
3234
|
.env get RC_EDITION
|
|
3205
|
RC_EDITION=$REPLY
|
|
3235
|
RC_EDITION=$REPLY
|
|
3206
|
|
|
3236
|
|
|
3207
|
echo "Pulling new image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION}"
|
|
3237
|
echo "Pulling new image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION}"
|
|
3208
|
echo "WARNING: about to start downloading the RhodeCode base image"
|
|
3238
|
echo "WARNING: about to start downloading the RhodeCode base image"
|
|
3209
|
echo "This process may take anywhere between a few minutes to an hour, depending on your network speed"
|
|
3239
|
echo "This process may take anywhere between a few minutes to an hour, depending on your network speed"
|
|
3210
|
echo "running: docker pull -q rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION}"
|
|
3240
|
echo "running: docker pull -q rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION}"
|
|
3211
|
|
|
3241
|
|
|
3212
|
eval "docker pull -q rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION}"
|
|
3242
|
eval "docker pull -q rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION}"
|
|
3213
|
|
|
3243
|
|
|
3214
|
have_tty=1
|
|
3244
|
have_tty=1
|
|
3215
|
# Set a dummy terminal type if none set
|
|
3245
|
# Set a dummy terminal type if none set
|
|
3216
|
[[ -z "$TERM" ]] && export have_tty=0
|
|
3246
|
[[ -z "$TERM" ]] && export have_tty=0
|
|
3217
|
[[ ! -t 1 ]] && export have_tty=0
|
|
3247
|
[[ ! -t 1 ]] && export have_tty=0
|
|
3218
|
|
|
3248
|
|
|
3219
|
set_cursor() {
|
|
3249
|
set_cursor() {
|
|
3220
|
if [[ $have_tty == 1 ]]; then
|
|
3250
|
if [[ $have_tty == 1 ]]; then
|
|
3221
|
tput $1
|
|
3251
|
tput $1
|
|
3222
|
fi
|
|
3252
|
fi
|
|
3223
|
}
|
|
3253
|
}
|
|
3224
|
|
|
3254
|
|
|
3225
|
stop_containers() {
|
|
3255
|
stop_containers() {
|
|
3226
|
target_container=$1
|
|
3256
|
target_container=$1
|
|
3227
|
docker_stop_wait=$2
|
|
3257
|
docker_stop_wait=$2
|
|
3228
|
stop_wait=$3
|
|
3258
|
stop_wait=$3
|
|
3229
|
target_containers_pat="$stack_prefix-$target_container-*"
|
|
3259
|
target_containers_pat="$stack_prefix-$target_container-*"
|
|
3230
|
|
|
3260
|
|
|
3231
|
# array with OLD containers
|
|
3261
|
# array with OLD containers
|
|
3232
|
local -a old_docker_ids
|
|
3262
|
local -a old_docker_ids
|
|
3233
|
readarray -t old_docker_ids < <(docker ps --filter name="$target_containers_pat" -q)
|
|
3263
|
readarray -t old_docker_ids < <(docker ps --filter name="$target_containers_pat" -q)
|
|
3234
|
|
|
3264
|
|
|
3235
|
scale=${#old_docker_ids[@]}
|
|
3265
|
scale=${#old_docker_ids[@]}
|
|
3236
|
scale_2=$(( scale * 2 ))
|
|
3266
|
scale_2=$(( scale * 2 ))
|
|
3237
|
|
|
3267
|
|
|
3238
|
echo ""
|
|
3268
|
echo ""
|
|
3239
|
echo "Found $scale services for $target_container"
|
|
3269
|
echo "Found $scale services for $target_container"
|
|
3240
|
echo "existing docker-ids:" "${old_docker_ids[@]}"
|
|
3270
|
echo "existing docker-ids:" "${old_docker_ids[@]}"
|
|
3241
|
echo ""
|
|
3271
|
echo ""
|
|
3242
|
|
|
3272
|
|
|
3243
|
echo "Scaling to 2x ($scale_2 total) containers for $target_container"
|
|
3273
|
echo "Scaling to 2x ($scale_2 total) containers for $target_container"
|
|
3244
|
./$RC_SCRIPT_NAME stack rhodecode up $target_container --no-recreate --detach --scale $target_container=$scale_2
|
|
3274
|
./$RC_SCRIPT_NAME stack rhodecode up $target_container --no-recreate --detach --scale $target_container=$scale_2
|
|
3245
|
|
|
3275
|
|
|
3246
|
# array with ALL new containers
|
|
3276
|
# array with ALL new containers
|
|
3247
|
local -a scaled_docker_ids
|
|
3277
|
local -a scaled_docker_ids
|
|
3248
|
readarray -t scaled_docker_ids < <(docker ps --filter name="$target_containers_pat" -q)
|
|
3278
|
readarray -t scaled_docker_ids < <(docker ps --filter name="$target_containers_pat" -q)
|
|
3249
|
|
|
3279
|
|
|
3250
|
echo "Scaling completed, running $scale_2 services for upgrade purpose..."
|
|
3280
|
echo "Scaling completed, running $scale_2 services for upgrade purpose..."
|
|
3251
|
echo "new docker-ids:" "${scaled_docker_ids[@]}"
|
|
3281
|
echo "new docker-ids:" "${scaled_docker_ids[@]}"
|
|
3252
|
|
|
3282
|
|
|
3253
|
# calculate just NEW containers
|
|
3283
|
# calculate just NEW containers
|
|
3254
|
declare -A new_container_check
|
|
3284
|
declare -A new_container_check
|
|
3255
|
|
|
3285
|
|
|
3256
|
# Mark elements of the first initial docker
|
|
3286
|
# Mark elements of the first initial docker
|
|
3257
|
for docker_id in "${old_docker_ids[@]}"; do
|
|
3287
|
for docker_id in "${old_docker_ids[@]}"; do
|
|
3258
|
new_container_check[$docker_id]=1
|
|
3288
|
new_container_check[$docker_id]=1
|
|
3259
|
done
|
|
3289
|
done
|
|
3260
|
|
|
3290
|
|
|
3261
|
local new_docker_ids_str
|
|
3291
|
local new_docker_ids_str
|
|
3262
|
new_docker_ids_str=""
|
|
3292
|
new_docker_ids_str=""
|
|
3263
|
|
|
3293
|
|
|
3264
|
# Check if elements of the second array are not in the first
|
|
3294
|
# Check if elements of the second array are not in the first
|
|
3265
|
for n_docker_id in "${scaled_docker_ids[@]}"; do
|
|
3295
|
for n_docker_id in "${scaled_docker_ids[@]}"; do
|
|
3266
|
# if $docker_id in new services is empty in the last array we ADD it :)
|
|
3296
|
# if $docker_id in new services is empty in the last array we ADD it :)
|
|
3267
|
if [[ -z ${new_container_check[$n_docker_id]} ]]; then
|
|
3297
|
if [[ -z ${new_container_check[$n_docker_id]} ]]; then
|
|
3268
|
new_docker_ids_str+=" $n_docker_id "
|
|
3298
|
new_docker_ids_str+=" $n_docker_id "
|
|
3269
|
fi
|
|
3299
|
fi
|
|
3270
|
done
|
|
3300
|
done
|
|
3271
|
|
|
3301
|
|
|
3272
|
echo "Stopping $scale old $target_container containers "
|
|
3302
|
echo "Stopping $scale old $target_container containers "
|
|
3273
|
echo "killing docker-ids:" "${old_docker_ids[@]}"
|
|
3303
|
echo "killing docker-ids:" "${old_docker_ids[@]}"
|
|
3274
|
|
|
3304
|
|
|
3275
|
spin='β Ύβ ½β »β β ―β ·'
|
|
3305
|
spin='β Ύβ ½β »β β ―β ·'
|
|
3276
|
charwidth=1
|
|
3306
|
charwidth=1
|
|
3277
|
|
|
3307
|
|
|
3278
|
# wait the required stop-wait time
|
|
3308
|
# wait the required stop-wait time
|
|
3279
|
#HC: docker inspect --format='{{.Name}}: {{json .ContainerId .State.Health.Status}}' <container-id>
|
|
3309
|
#HC: docker inspect --format='{{.Name}}: {{json .ContainerId .State.Health.Status}}' <container-id>
|
|
3280
|
local i
|
|
3310
|
local i
|
|
3281
|
i=$(($stop_wait * 10))
|
|
3311
|
i=$(($stop_wait * 10))
|
|
3282
|
|
|
3312
|
|
|
3283
|
local status
|
|
3313
|
local status
|
|
3284
|
status=''
|
|
3314
|
status=''
|
|
3285
|
|
|
3315
|
|
|
3286
|
# cursor invisible
|
|
3316
|
# cursor invisible
|
|
3287
|
set_cursor civis
|
|
3317
|
set_cursor civis
|
|
3288
|
while true
|
|
3318
|
while true
|
|
3289
|
s=$((i / 10))
|
|
3319
|
s=$((i / 10))
|
|
3290
|
do
|
|
3320
|
do
|
|
3291
|
i=$(($i-1))
|
|
3321
|
i=$(($i-1))
|
|
3292
|
if [[ $i -lt 1 ]]; then
|
|
3322
|
if [[ $i -lt 1 ]]; then
|
|
3293
|
break
|
|
3323
|
break
|
|
3294
|
fi
|
|
3324
|
fi
|
|
3295
|
|
|
3325
|
|
|
3296
|
if [[ "$(($i % 10))" == 0 ]];
|
|
3326
|
if [[ "$(($i % 10))" == 0 ]];
|
|
3297
|
then
|
|
3327
|
then
|
|
3298
|
is_at_sec=1
|
|
3328
|
is_at_sec=1
|
|
3299
|
else
|
|
3329
|
else
|
|
3300
|
is_at_sec=0
|
|
3330
|
is_at_sec=0
|
|
3301
|
fi
|
|
3331
|
fi
|
|
3302
|
|
|
3332
|
|
|
3303
|
local new_docker_ids_status_cnt
|
|
3333
|
local new_docker_ids_status_cnt
|
|
3304
|
|
|
3334
|
|
|
3305
|
if [[ $is_at_sec == 1 ]]; then
|
|
3335
|
if [[ $is_at_sec == 1 ]]; then
|
|
3306
|
|
|
3336
|
|
|
3307
|
new_docker_ids_status_cnt=$(docker inspect --format='{{.State.Health.Status}}' $new_docker_ids_str | grep -c "healthy" || echo "")
|
|
3337
|
new_docker_ids_status_cnt=$(docker inspect --format='{{.State.Health.Status}}' $new_docker_ids_str | grep -c "healthy" || echo "")
|
|
3308
|
|
|
3338
|
|
|
3309
|
if [[ $new_docker_ids_status_cnt -eq $scale ]]; then
|
|
3339
|
if [[ $new_docker_ids_status_cnt -eq $scale ]]; then
|
|
3310
|
echo "All $target_container are in HEALTHY state; stopping old ones now"
|
|
3340
|
echo "All $target_container are in HEALTHY state; stopping old ones now"
|
|
3311
|
echo ""
|
|
3341
|
echo ""
|
|
3312
|
break
|
|
3342
|
break
|
|
3313
|
fi
|
|
3343
|
fi
|
|
3314
|
|
|
3344
|
|
|
3315
|
fi
|
|
3345
|
fi
|
|
3316
|
|
|
3346
|
|
|
3317
|
k=$(((k + $charwidth) % ${#spin}))
|
|
3347
|
k=$(((k + $charwidth) % ${#spin}))
|
|
3318
|
|
|
3348
|
|
|
3319
|
if [[ $have_tty == 1 ]]; then
|
|
3349
|
if [[ $have_tty == 1 ]]; then
|
|
3320
|
printf "%s stopping $scale old containers once they are in HEALTHY state, or in $s s..." "${spin:$k:$charwidth}"
|
|
3350
|
printf "%s stopping $scale old containers once they are in HEALTHY state, or in $s s..." "${spin:$k:$charwidth}"
|
|
3321
|
printf "\r"
|
|
3351
|
printf "\r"
|
|
3322
|
else
|
|
3352
|
else
|
|
3323
|
if [[ $is_at_sec == 1 ]]; then
|
|
3353
|
if [[ $is_at_sec == 1 ]]; then
|
|
3324
|
echo "stopping $scale old containers once they are in HEALTHY state, or in $s s..."
|
|
3354
|
echo "stopping $scale old containers once they are in HEALTHY state, or in $s s..."
|
|
3325
|
fi
|
|
3355
|
fi
|
|
3326
|
fi
|
|
3356
|
fi
|
|
3327
|
|
|
3357
|
|
|
3328
|
sleep .1
|
|
3358
|
sleep .1
|
|
3329
|
done
|
|
3359
|
done
|
|
3330
|
set_cursor cnorm
|
|
3360
|
set_cursor cnorm
|
|
3331
|
|
|
3361
|
|
|
3332
|
for container in "${old_docker_ids[@]}"
|
|
3362
|
for container in "${old_docker_ids[@]}"
|
|
3333
|
do
|
|
3363
|
do
|
|
3334
|
echo "now running container $container stop with --time $docker_stop_wait"
|
|
3364
|
echo "now running container $container stop with --time $docker_stop_wait"
|
|
3335
|
docker stop --time "$docker_stop_wait" "$container" > /dev/null
|
|
3365
|
docker stop --time "$docker_stop_wait" "$container" > /dev/null
|
|
3336
|
docker rm "$container" > /dev/null
|
|
3366
|
docker rm "$container" > /dev/null
|
|
3337
|
echo "Stopped $container"
|
|
3367
|
echo "Stopped $container"
|
|
3338
|
done
|
|
3368
|
done
|
|
3339
|
|
|
3369
|
|
|
3340
|
}
|
|
3370
|
}
|
|
3341
|
|
|
3371
|
|
|
3342
|
# VCSSERVER Containers
|
|
3372
|
# VCSSERVER Containers
|
|
3343
|
stop_containers "vcsserver" $docker_stop_wait $stop_wait
|
|
3373
|
stop_containers "vcsserver" $docker_stop_wait $stop_wait
|
|
3344
|
|
|
3374
|
|
|
3345
|
# RHODECODE Containers
|
|
3375
|
# RHODECODE Containers
|
|
3346
|
stop_containers "rhodecode" $docker_stop_wait $stop_wait
|
|
3376
|
stop_containers "rhodecode" $docker_stop_wait $stop_wait
|
|
3347
|
|
|
3377
|
|
|
3348
|
# SVN Containers
|
|
3378
|
# SVN Containers
|
|
3349
|
stop_containers "svn" $docker_stop_wait $stop_wait
|
|
3379
|
stop_containers "svn" $docker_stop_wait $stop_wait
|
|
3350
|
|
|
3380
|
|
|
3351
|
# SSHD Containers
|
|
3381
|
# SSHD Containers
|
|
3352
|
stop_containers "sshd" $docker_stop_wait $stop_wait
|
|
3382
|
stop_containers "sshd" $docker_stop_wait $stop_wait
|
|
3353
|
|
|
3383
|
|
|
3354
|
./$RC_SCRIPT_NAME stack rhodecode up celery --force-recreate --detach
|
|
3384
|
./$RC_SCRIPT_NAME stack rhodecode up celery --force-recreate --detach
|
|
3355
|
./$RC_SCRIPT_NAME stack rhodecode up celery-beat --force-recreate --detach
|
|
3385
|
./$RC_SCRIPT_NAME stack rhodecode up celery-beat --force-recreate --detach
|
|
3356
|
|
|
3386
|
|
|
3357
|
echo "Upgrade to rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION} completed"
|
|
3387
|
echo "Upgrade to rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION} completed"
|
|
3358
|
exit
|
|
3388
|
exit
|
|
3359
|
|
|
3389
|
|
|
3360
|
}
|
|
3390
|
}
|
|
3361
|
|
|
3391
|
|
|
3362
|
# :command.function
|
|
3392
|
# :command.function
|
|
3363
|
rcstack_stack_monitor_restart_unhealthy_command() {
|
|
3393
|
rcstack_stack_monitor_restart_unhealthy_command() {
|
|
3364
|
# src/stack_monitor_restart_unhealthy_command.sh
|
|
3394
|
# src/stack_monitor_restart_unhealthy_command.sh
|
|
3365
|
check_bootstrap
|
|
3395
|
check_bootstrap
|
|
3366
|
|
|
3396
|
|
|
3367
|
DEBUG=${args[--debug]}
|
|
3397
|
DEBUG=${args[--debug]}
|
|
3368
|
loop=${args[--loop]}
|
|
3398
|
loop=${args[--loop]}
|
|
3369
|
|
|
3399
|
|
|
3370
|
get_unhealthy() {
|
|
3400
|
get_unhealthy() {
|
|
3371
|
unhealthy=$(docker ps --filter health=unhealthy --filter label=autoheal=true --format "{{.ID}}")
|
|
3401
|
unhealthy=$(docker ps --filter health=unhealthy --filter label=autoheal=true --format "{{.ID}}")
|
|
3372
|
|
|
3402
|
|
|
3373
|
if [[ $unhealthy == "" ]]; then
|
|
3403
|
if [[ $unhealthy == "" ]]; then
|
|
3374
|
echo "$(green stack-monitor: no unhealthy containers found)"
|
|
3404
|
echo "$(green stack-monitor: no unhealthy containers found)"
|
|
3375
|
else
|
|
3405
|
else
|
|
3376
|
echo "$(yellow stack-monitor: found unhealthy containers $unhealthy)"
|
|
3406
|
echo "$(yellow stack-monitor: found unhealthy containers $unhealthy)"
|
|
3377
|
fi
|
|
3407
|
fi
|
|
3378
|
|
|
3408
|
|
|
3379
|
for container in $unhealthy
|
|
3409
|
for container in $unhealthy
|
|
3380
|
do
|
|
3410
|
do
|
|
3381
|
docker stats --no-stream --format '{{.ID}}\t{{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.NetIO}}\t{{.BlockIO}}' $container
|
|
3411
|
docker stats --no-stream --format '{{.ID}}\t{{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.NetIO}}\t{{.BlockIO}}' $container
|
|
3382
|
echo "stack-monitor: restart $container"
|
|
3412
|
echo "stack-monitor: restart $container"
|
|
3383
|
docker restart --time=10 $container
|
|
3413
|
docker restart --time=10 $container
|
|
3384
|
done
|
|
3414
|
done
|
|
3385
|
|
|
3415
|
|
|
3386
|
}
|
|
3416
|
}
|
|
3387
|
|
|
3417
|
|
|
3388
|
if [[ ! $loop == "0" ]]; then
|
|
3418
|
if [[ ! $loop == "0" ]]; then
|
|
3389
|
|
|
3419
|
|
|
3390
|
while true
|
|
3420
|
while true
|
|
3391
|
do
|
|
3421
|
do
|
|
3392
|
date_formatted=$(date)
|
|
3422
|
date_formatted=$(date)
|
|
3393
|
echo "stack-monitor: loop-run every $loop seconds..., $date_formatted"
|
|
3423
|
echo "stack-monitor: loop-run every $loop seconds..., $date_formatted"
|
|
3394
|
# loop run
|
|
3424
|
# loop run
|
|
3395
|
NO_COLOR=1 get_unhealthy
|
|
3425
|
NO_COLOR=1 get_unhealthy
|
|
3396
|
echo "Next execution in $loop s..." && \
|
|
3426
|
echo "Next execution in $loop s..." && \
|
|
3397
|
sleep $loop
|
|
3427
|
sleep $loop
|
|
3398
|
echo ""
|
|
3428
|
echo ""
|
|
3399
|
done
|
|
3429
|
done
|
|
3400
|
|
|
3430
|
|
|
3401
|
else
|
|
3431
|
else
|
|
3402
|
|
|
3432
|
|
|
3403
|
# one time run
|
|
3433
|
# one time run
|
|
3404
|
get_unhealthy
|
|
3434
|
get_unhealthy
|
|
3405
|
fi
|
|
3435
|
fi
|
|
3406
|
|
|
3436
|
|
|
3407
|
exit
|
|
3437
|
exit
|
|
3408
|
|
|
3438
|
|
|
3409
|
}
|
|
3439
|
}
|
|
3410
|
|
|
3440
|
|
|
3411
|
# :command.function
|
|
3441
|
# :command.function
|
|
3412
|
rcstack_cli_image_info_command() {
|
|
3442
|
rcstack_cli_image_info_command() {
|
|
3413
|
# src/cli_image_info_command.sh
|
|
3443
|
# src/cli_image_info_command.sh
|
|
3414
|
|
|
3444
|
|
|
3415
|
verbose=${args[--verbose]}
|
|
3445
|
verbose=${args[--verbose]}
|
|
3416
|
|
|
3446
|
|
|
3417
|
if [[ $verbose ]]; then
|
|
3447
|
if [[ $verbose ]]; then
|
|
3418
|
|
|
3448
|
|
|
3419
|
ver="unknown"
|
|
3449
|
ver="unknown"
|
|
3420
|
if [[ -f $ENV_FILE ]]; then
|
|
3450
|
if [[ -f $ENV_FILE ]]; then
|
|
3421
|
.env --file $RUNTIME_ENV
|
|
3451
|
.env --file $RUNTIME_ENV
|
|
3422
|
.env get RC_VERSION
|
|
3452
|
.env get RC_VERSION
|
|
3423
|
ver=$REPLY
|
|
3453
|
ver=$REPLY
|
|
3424
|
fi
|
|
3454
|
fi
|
|
3425
|
|
|
3455
|
|
|
3426
|
echo "Image stored version: $rc_image_ver"
|
|
3456
|
echo "Image stored version: $rc_image_ver"
|
|
3427
|
echo "Image from runtime: $ver"
|
|
3457
|
echo "Image from runtime: $ver"
|
|
3428
|
echo "runtime-file=$RUNTIME_ENV"
|
|
3458
|
echo "runtime-file=$RUNTIME_ENV"
|
|
3429
|
echo "RC_VERSION=$ver"
|
|
3459
|
echo "RC_VERSION=$ver"
|
|
3430
|
else
|
|
3460
|
else
|
|
3431
|
echo $rc_image_ver
|
|
3461
|
echo $rc_image_ver
|
|
3432
|
fi
|
|
3462
|
fi
|
|
3433
|
|
|
3463
|
|
|
3434
|
}
|
|
3464
|
}
|
|
3435
|
|
|
3465
|
|
|
3436
|
# :command.function
|
|
3466
|
# :command.function
|
|
3437
|
rcstack_cli_set_runtime_image_command() {
|
|
3467
|
rcstack_cli_set_runtime_image_command() {
|
|
3438
|
# src/cli_set_runtime_image_command.sh
|
|
3468
|
# src/cli_set_runtime_image_command.sh
|
|
3439
|
set_ver=${args[version]}
|
|
3469
|
set_ver=${args[version]}
|
|
3440
|
|
|
3470
|
|
|
3441
|
.env --file $RUNTIME_ENV
|
|
3471
|
.env --file $RUNTIME_ENV
|
|
3442
|
echo "setting runtime version to $set_ver into $RUNTIME_ENV"
|
|
3472
|
echo "setting runtime version to $set_ver into $RUNTIME_ENV"
|
|
3443
|
|
|
3473
|
|
|
3444
|
.env set RC_VERSION=$set_ver
|
|
3474
|
.env set RC_VERSION=$set_ver
|
|
3445
|
|
|
3475
|
|
|
3446
|
echo "New version set to $set_ver"
|
|
3476
|
echo "New version set to $set_ver"
|
|
3447
|
|
|
3477
|
|
|
3448
|
}
|
|
3478
|
}
|
|
3449
|
|
|
3479
|
|
|
3450
|
# :command.function
|
|
3480
|
# :command.function
|
|
3451
|
rcstack_cli_ishell_command() {
|
|
3481
|
rcstack_cli_ishell_command() {
|
|
3452
|
# src/cli_ishell_command.sh
|
|
3482
|
# src/cli_ishell_command.sh
|
|
3453
|
instance_type=rhodecode
|
|
3483
|
instance_type=rhodecode
|
|
3454
|
|
|
3484
|
|
|
3455
|
match_name=rc_cluster_apps-
|
|
3485
|
match_name=rc_cluster_apps-
|
|
3456
|
docker_id=$(docker ps --filter name=$match_name -q | head -n1)
|
|
3486
|
docker_id=$(docker ps --filter name=$match_name -q | head -n1)
|
|
3457
|
|
|
3487
|
|
|
3458
|
if [[ $docker_id == "" ]]; then
|
|
3488
|
if [[ $docker_id == "" ]]; then
|
|
3459
|
echo "$(yellow cannot find instance to attach by name *$match_name*)"
|
|
3489
|
echo "$(yellow cannot find instance to attach by name *$match_name*)"
|
|
3460
|
exit 1
|
|
3490
|
exit 1
|
|
3461
|
fi
|
|
3491
|
fi
|
|
3462
|
|
|
3492
|
|
|
3463
|
docker exec -it --tty $docker_id /usr/local/bin/rhodecode_bin/bin/rc-ishell /etc/rhodecode/conf/rhodecode.ini
|
|
3493
|
docker exec -it --tty $docker_id /usr/local/bin/rhodecode_bin/bin/rc-ishell /etc/rhodecode/conf/rhodecode.ini
|
|
3464
|
|
|
3494
|
|
|
3465
|
}
|
|
3495
|
}
|
|
3466
|
|
|
3496
|
|
|
3467
|
# :command.function
|
|
3497
|
# :command.function
|
|
3468
|
rcstack_cli_redis_command() {
|
|
3498
|
rcstack_cli_redis_command() {
|
|
3469
|
# src/cli_redis_command.sh
|
|
3499
|
# src/cli_redis_command.sh
|
|
3470
|
check_bootstrap
|
|
3500
|
check_bootstrap
|
|
3471
|
|
|
3501
|
|
|
3472
|
DEBUG=${args[--debug]}
|
|
3502
|
DEBUG=${args[--debug]}
|
|
3473
|
|
|
3503
|
|
|
3474
|
target_container=rc_cluster_services-redis-1
|
|
3504
|
target_container=rc_cluster_services-redis-1
|
|
3475
|
docker_id=$(docker ps --filter name=$target_container -q)
|
|
3505
|
docker_id=$(docker ps --filter name=$target_container -q)
|
|
3476
|
|
|
3506
|
|
|
3477
|
if [[ $DEBUG ]]; then
|
|
3507
|
if [[ $DEBUG ]]; then
|
|
3478
|
echo "container id: $docker_id, based on $target_container filter"
|
|
3508
|
echo "container id: $docker_id, based on $target_container filter"
|
|
3479
|
docker ps
|
|
3509
|
docker ps
|
|
3480
|
fi
|
|
3510
|
fi
|
|
3481
|
|
|
3511
|
|
|
3482
|
if [ "$docker_id" == "" ]; then
|
|
3512
|
if [ "$docker_id" == "" ]; then
|
|
3483
|
MSG="Cannot find container ID with name $target_container"
|
|
3513
|
MSG="Cannot find container ID with name $target_container"
|
|
3484
|
echo "$(red $MSG)"
|
|
3514
|
echo "$(red $MSG)"
|
|
3485
|
exit 1
|
|
3515
|
exit 1
|
|
3486
|
fi
|
|
3516
|
fi
|
|
3487
|
|
|
3517
|
|
|
3488
|
if [[ $DEBUG ]]; then
|
|
3518
|
if [[ $DEBUG ]]; then
|
|
3489
|
echo "Running |docker exec --interactive --tty $docker_id $CMD|"
|
|
3519
|
echo "Running |docker exec --interactive --tty $docker_id $CMD|"
|
|
3490
|
echo "docker exec --interactive --tty $docker_id /bin/bash -c 'redis-cli'"
|
|
3520
|
echo "docker exec --interactive --tty $docker_id /bin/bash -c 'redis-cli'"
|
|
3491
|
fi
|
|
3521
|
fi
|
|
3492
|
|
|
3522
|
|
|
3493
|
eval "docker exec --interactive --tty $docker_id /bin/bash -c 'redis-cli'"
|
|
3523
|
eval "docker exec --interactive --tty $docker_id /bin/bash -c 'redis-cli'"
|
|
3494
|
|
|
3524
|
|
|
3495
|
}
|
|
3525
|
}
|
|
3496
|
|
|
3526
|
|
|
3497
|
# :command.function
|
|
3527
|
# :command.function
|
|
3498
|
rcstack_cli_db_command() {
|
|
3528
|
rcstack_cli_db_command() {
|
|
3499
|
# src/cli_db_command.sh
|
|
3529
|
# src/cli_db_command.sh
|
|
3500
|
check_bootstrap
|
|
3530
|
check_bootstrap
|
|
3501
|
|
|
3531
|
|
|
3502
|
DEBUG=${args[--debug]}
|
|
3532
|
DEBUG=${args[--debug]}
|
|
3503
|
|
|
3533
|
|
|
3504
|
target_container=rc_cluster_services-database-*
|
|
3534
|
target_container=rc_cluster_services-database-*
|
|
3505
|
docker_id=$(docker ps --filter name=$target_container -q | head -n1)
|
|
3535
|
docker_id=$(docker ps --filter name=$target_container -q | head -n1)
|
|
3506
|
|
|
3536
|
|
|
3507
|
if [[ $DEBUG ]]; then
|
|
3537
|
if [[ $DEBUG ]]; then
|
|
3508
|
echo "container id: $docker_id, based on $target_container filter"
|
|
3538
|
echo "container id: $docker_id, based on $target_container filter"
|
|
3509
|
docker ps
|
|
3539
|
docker ps
|
|
3510
|
fi
|
|
3540
|
fi
|
|
3511
|
|
|
3541
|
|
|
3512
|
if [ "$docker_id" == "" ]; then
|
|
3542
|
if [ "$docker_id" == "" ]; then
|
|
3513
|
MSG="Cannot find container ID with name $target_container"
|
|
3543
|
MSG="Cannot find container ID with name $target_container"
|
|
3514
|
echo "$(red $MSG)"
|
|
3544
|
echo "$(red $MSG)"
|
|
3515
|
exit 1
|
|
3545
|
exit 1
|
|
3516
|
fi
|
|
3546
|
fi
|
|
3517
|
|
|
3547
|
|
|
3518
|
.env --file $RUNTIME_ENV
|
|
3548
|
.env --file $RUNTIME_ENV
|
|
3519
|
|
|
3549
|
|
|
3520
|
.env get DB_PASSWORD
|
|
3550
|
.env get DB_PASSWORD
|
|
3521
|
DB_PASSWORD=$REPLY
|
|
3551
|
DB_PASSWORD=$REPLY
|
|
3522
|
|
|
3552
|
|
|
3523
|
.env get DB_NAME
|
|
3553
|
.env get DB_NAME
|
|
3524
|
DB_NAME=$REPLY
|
|
3554
|
DB_NAME=$REPLY
|
|
3525
|
|
|
3555
|
|
|
3526
|
.env get DB_USER
|
|
3556
|
.env get DB_USER
|
|
3527
|
DB_USER=$REPLY
|
|
3557
|
DB_USER=$REPLY
|
|
3528
|
|
|
3558
|
|
|
3529
|
if [[ $DEBUG ]]; then
|
|
3559
|
if [[ $DEBUG ]]; then
|
|
3530
|
echo "Running |docker exec --env-file $RUNTIME_ENV --interactive --tty $docker_id $CMD|"
|
|
3560
|
echo "Running |docker exec --env-file $RUNTIME_ENV --interactive --tty $docker_id $CMD|"
|
|
3531
|
echo "docker exec --interactive --tty $docker_id /bin/bash -c 'PGPASSWORD=$DB_PASSWORD psql --username=$DB_USER --dbname=$DB_NAME'"
|
|
3561
|
echo "docker exec --interactive --tty $docker_id /bin/bash -c 'PGPASSWORD=$DB_PASSWORD psql --username=$DB_USER --dbname=$DB_NAME'"
|
|
3532
|
fi
|
|
3562
|
fi
|
|
3533
|
|
|
3563
|
|
|
3534
|
printf "attaching pg_data \t\t\tunder: /var/lib/postgresql/data\n"
|
|
3564
|
printf "attaching pg_data \t\t\tunder: /var/lib/postgresql/data\n"
|
|
3535
|
printf "attaching \$PWD/.custom/db_dump \t\tunder: /var/rc-data-dump\n"
|
|
3565
|
printf "attaching \$PWD/.custom/db_dump \t\tunder: /var/rc-data-dump\n"
|
|
3536
|
printf "restore dump:\n\i /var/rc-data-dump/your_dump.sql\n\n"
|
|
3566
|
printf "restore dump:\n\i /var/rc-data-dump/your_dump.sql\n\n"
|
|
3537
|
|
|
3567
|
|
|
3538
|
eval "docker exec --env-file $RUNTIME_ENV --interactive --tty $docker_id /bin/bash -c 'PGPASSWORD=$DB_PASSWORD psql --username=$DB_USER --dbname=$DB_NAME'"
|
|
3568
|
eval "docker exec --env-file $RUNTIME_ENV --interactive --tty $docker_id /bin/bash -c 'PGPASSWORD=$DB_PASSWORD psql --username=$DB_USER --dbname=$DB_NAME'"
|
|
3539
|
|
|
3569
|
|
|
3540
|
}
|
|
3570
|
}
|
|
3541
|
|
|
3571
|
|
|
3542
|
# :command.function
|
|
3572
|
# :command.function
|
|
3543
|
rcstack_cli_db_upgrade_command() {
|
|
3573
|
rcstack_cli_db_upgrade_command() {
|
|
3544
|
# src/cli_db_upgrade_command.sh
|
|
3574
|
# src/cli_db_upgrade_command.sh
|
|
3545
|
check_bootstrap
|
|
3575
|
check_bootstrap
|
|
3546
|
|
|
3576
|
|
|
3547
|
DEBUG=${args[--debug]}
|
|
3577
|
DEBUG=${args[--debug]}
|
|
3548
|
|
|
3578
|
|
|
3549
|
target_container=rc_cluster_services-database-*
|
|
3579
|
target_container=rc_cluster_services-database-*
|
|
3550
|
docker_id=$(docker ps --filter name=$target_container -q | head -n1)
|
|
3580
|
docker_id=$(docker ps --filter name=$target_container -q | head -n1)
|
|
3551
|
|
|
3581
|
|
|
3552
|
if [[ $DEBUG ]]; then
|
|
3582
|
if [[ $DEBUG ]]; then
|
|
3553
|
echo "container id: $docker_id, based on $target_container filter"
|
|
3583
|
echo "container id: $docker_id, based on $target_container filter"
|
|
3554
|
docker ps
|
|
3584
|
docker ps
|
|
3555
|
fi
|
|
3585
|
fi
|
|
3556
|
|
|
3586
|
|
|
3557
|
if [ "$docker_id" == "" ]; then
|
|
3587
|
if [ "$docker_id" == "" ]; then
|
|
3558
|
MSG="Cannot find container ID with name $target_container"
|
|
3588
|
MSG="Cannot find container ID with name $target_container"
|
|
3559
|
echo "$(red $MSG)"
|
|
3589
|
echo "$(red $MSG)"
|
|
3560
|
exit 1
|
|
3590
|
exit 1
|
|
3561
|
fi
|
|
3591
|
fi
|
|
3562
|
|
|
3592
|
|
|
3563
|
if [[ $DEBUG ]]; then
|
|
3593
|
if [[ $DEBUG ]]; then
|
|
3564
|
echo "./$RC_SCRIPT_NAME stack rhodecode exec rhodecode /usr/local/bin/rhodecode_bin/bin/rc-upgrade-db /etc/rhodecode/conf/rhodecode.ini --force-yes"
|
|
3594
|
echo "./$RC_SCRIPT_NAME stack rhodecode exec rhodecode /usr/local/bin/rhodecode_bin/bin/rc-upgrade-db /etc/rhodecode/conf/rhodecode.ini --force-yes"
|
|
3565
|
fi
|
|
3595
|
fi
|
|
3566
|
|
|
3596
|
|
|
3567
|
./$RC_SCRIPT_NAME stack rhodecode exec rhodecode /usr/local/bin/rhodecode_bin/bin/rc-upgrade-db /etc/rhodecode/conf/rhodecode.ini --force-yes
|
|
3597
|
./$RC_SCRIPT_NAME stack rhodecode exec rhodecode /usr/local/bin/rhodecode_bin/bin/rc-upgrade-db /etc/rhodecode/conf/rhodecode.ini --force-yes
|
|
3568
|
}
|
|
3598
|
}
|
|
3569
|
|
|
3599
|
|
|
3570
|
# :command.function
|
|
3600
|
# :command.function
|
|
3571
|
rcstack_cli_storage_command() {
|
|
3601
|
rcstack_cli_storage_command() {
|
|
3572
|
# src/cli_storage_command.sh
|
|
3602
|
# src/cli_storage_command.sh
|
|
3573
|
check_bootstrap
|
|
3603
|
check_bootstrap
|
|
3574
|
|
|
3604
|
|
|
3575
|
DEBUG=${args[--debug]}
|
|
3605
|
DEBUG=${args[--debug]}
|
|
3576
|
ENV_FILE=${args[--env-file-path]}
|
|
3606
|
ENV_FILE=${args[--env-file-path]}
|
|
3577
|
ATTACHED=${args[--attached]}
|
|
3607
|
ATTACHED=${args[--attached]}
|
|
3578
|
|
|
3608
|
|
|
3579
|
if [[ $DEBUG ]]; then
|
|
3609
|
if [[ $DEBUG ]]; then
|
|
3580
|
echo "rc_datavolume inspection..."
|
|
3610
|
echo "rc_datavolume inspection..."
|
|
3581
|
docker volume inspect rc_datavolume
|
|
3611
|
docker volume inspect rc_datavolume
|
|
3582
|
|
|
3612
|
|
|
3583
|
echo "rc_reposvolume inspection..."
|
|
3613
|
echo "rc_reposvolume inspection..."
|
|
3584
|
docker volume inspect rc_reposvolume
|
|
3614
|
docker volume inspect rc_reposvolume
|
|
3585
|
fi
|
|
3615
|
fi
|
|
3586
|
|
|
3616
|
|
|
3587
|
#
|
|
3617
|
#
|
|
3588
|
#if [[ $DEBUG ]]; then
|
|
3618
|
#if [[ $DEBUG ]]; then
|
|
3589
|
# echo "image id: $image_id, based on $target_container filter"
|
|
3619
|
# echo "image id: $image_id, based on $target_container filter"
|
|
3590
|
# docker image ls
|
|
3620
|
# docker image ls
|
|
3591
|
# echo "---"
|
|
3621
|
# echo "---"
|
|
3592
|
#fi
|
|
3622
|
#fi
|
|
3593
|
# rename a volume
|
|
3623
|
# rename a volume
|
|
3594
|
#docker volume create --name <new_volume>
|
|
3624
|
#docker volume create --name <new_volume>
|
|
3595
|
#docker run --rm -it -v <old_volume>:/from -v <new_volume>:/to alpine ash -c "cd /from ; cp -av . /to"
|
|
3625
|
#docker run --rm -it -v <old_volume>:/from -v <new_volume>:/to alpine ash -c "cd /from ; cp -av . /to"
|
|
3596
|
#docker volume rm <old_volume>
|
|
3626
|
#docker volume rm <old_volume>
|
|
3597
|
if [[ $ATTACHED ]]; then
|
|
3627
|
if [[ $ATTACHED ]]; then
|
|
3598
|
printf "Starting with attached mode to vcsserver !"
|
|
3628
|
printf "Starting with attached mode to vcsserver !"
|
|
3599
|
printf "present rc_datavolume \t\tunder: /var/opt/rhodecode_data\n"
|
|
3629
|
printf "present rc_datavolume \t\tunder: /var/opt/rhodecode_data\n"
|
|
3600
|
printf "present rc_reposvolume \t\tunder: /var/opt/rhodecode_repo_store\n"
|
|
3630
|
printf "present rc_reposvolume \t\tunder: /var/opt/rhodecode_repo_store\n"
|
|
3601
|
printf "present confvolume \t\tunder: /etc/rhodecode/conf\n"
|
|
3631
|
printf "present confvolume \t\tunder: /etc/rhodecode/conf\n"
|
|
3602
|
|
|
3632
|
|
|
3603
|
match_name=rc_cluster_apps-vcsserver
|
|
3633
|
match_name=rc_cluster_apps-vcsserver
|
|
3604
|
docker_id=$(docker ps --filter name=$match_name -q | head -n1)
|
|
3634
|
docker_id=$(docker ps --filter name=$match_name -q | head -n1)
|
|
3605
|
|
|
3635
|
|
|
3606
|
if [[ $docker_id == "" ]]; then
|
|
3636
|
if [[ $docker_id == "" ]]; then
|
|
3607
|
echo "$(yellow cannot find instance to attach by name *$match_name*)"
|
|
3637
|
echo "$(yellow cannot find instance to attach by name *$match_name*)"
|
|
3608
|
exit 1
|
|
3638
|
exit 1
|
|
3609
|
fi
|
|
3639
|
fi
|
|
3610
|
|
|
3640
|
|
|
3611
|
docker exec -it --tty --workdir /var/opt $docker_id bash
|
|
3641
|
docker exec -it --tty --workdir /var/opt $docker_id bash
|
|
3612
|
|
|
3642
|
|
|
3613
|
else
|
|
3643
|
else
|
|
3614
|
printf "attaching rc_datavolume \t\tunder: /vol/datavolume\n"
|
|
3644
|
printf "attaching rc_datavolume \t\tunder: /vol/datavolume\n"
|
|
3615
|
printf "attaching rc_reposvolume \t\tunder: /vol/repovolume\n"
|
|
3645
|
printf "attaching rc_reposvolume \t\tunder: /vol/repovolume\n"
|
|
3616
|
printf "attaching \$PWD/.custom/storage \t\tunder: /vol/backupvolume\n"
|
|
3646
|
printf "attaching \$PWD/.custom/storage \t\tunder: /vol/backupvolume\n"
|
|
3617
|
|
|
3647
|
|
|
3618
|
docker run --rm \
|
|
3648
|
docker run --rm \
|
|
3619
|
-it \
|
|
3649
|
-it \
|
|
3620
|
--volume $PWD/.custom/storage:/vol/backupvolume \
|
|
3650
|
--volume $PWD/.custom/storage:/vol/backupvolume \
|
|
3621
|
--volume rc_datavolume:/vol/datavolume \
|
|
3651
|
--volume rc_datavolume:/vol/datavolume \
|
|
3622
|
--volume rc_reposvolume:/vol/repovolume \
|
|
3652
|
--volume rc_reposvolume:/vol/repovolume \
|
|
3623
|
--workdir="/vol" \
|
|
3653
|
--workdir="/vol" \
|
|
3624
|
ubuntu:22.04 \
|
|
3654
|
ubuntu:22.04 \
|
|
3625
|
/bin/bash
|
|
3655
|
/bin/bash
|
|
3626
|
fi
|
|
3656
|
fi
|
|
3627
|
|
|
3657
|
|
|
3628
|
}
|
|
3658
|
}
|
|
3629
|
|
|
3659
|
|
|
3630
|
# :command.function
|
|
3660
|
# :command.function
|
|
3631
|
rcstack_cli_attach_command() {
|
|
3661
|
rcstack_cli_attach_command() {
|
|
3632
|
# src/cli_attach_command.sh
|
|
3662
|
# src/cli_attach_command.sh
|
|
3633
|
instance_type=${args[--instance-type]}
|
|
3663
|
instance_type=${args[--instance-type]}
|
|
3634
|
|
|
3664
|
|
|
3635
|
match_name=rc_cluster_apps-$instance_type
|
|
3665
|
match_name=rc_cluster_apps-$instance_type
|
|
3636
|
docker_id=$(docker ps --filter name=$match_name -q | head -n1)
|
|
3666
|
docker_id=$(docker ps --filter name=$match_name -q | head -n1)
|
|
3637
|
|
|
3667
|
|
|
3638
|
if [[ $docker_id == "" ]]; then
|
|
3668
|
if [[ $docker_id == "" ]]; then
|
|
3639
|
echo "$(yellow cannot find instance to attach by name *$match_name*)"
|
|
3669
|
echo "$(yellow cannot find instance to attach by name *$match_name*)"
|
|
3640
|
exit 1
|
|
3670
|
exit 1
|
|
3641
|
fi
|
|
3671
|
fi
|
|
3642
|
|
|
3672
|
|
|
3643
|
docker exec -it --tty $docker_id bash
|
|
3673
|
docker exec -it --tty $docker_id bash
|
|
3644
|
|
|
3674
|
|
|
3645
|
}
|
|
3675
|
}
|
|
3646
|
|
|
3676
|
|
|
3647
|
# :command.function
|
|
3677
|
# :command.function
|
|
3648
|
rcstack_cli_set_edition_command() {
|
|
3678
|
rcstack_cli_set_edition_command() {
|
|
3649
|
# src/cli_set_edition_command.sh
|
|
3679
|
# src/cli_set_edition_command.sh
|
|
3650
|
INI_TARGET=$PWD/config/_shared
|
|
3680
|
INI_TARGET=$PWD/config/_shared
|
|
3651
|
BOOTSTRAP_RUNTIME_ENV=$PWD/.custom/.runtime.env
|
|
3681
|
BOOTSTRAP_RUNTIME_ENV=$PWD/.custom/.runtime.env
|
|
3652
|
|
|
3682
|
|
|
3653
|
RC_EDITION=${args[edition_type]}
|
|
3683
|
RC_EDITION=${args[edition_type]}
|
|
3654
|
ini_path=$INI_TARGET/rhodecode.ini
|
|
3684
|
ini_path=$INI_TARGET/rhodecode.ini
|
|
3655
|
|
|
3685
|
|
|
3656
|
echo "Setting current installation as rhodecode-$RC_EDITION type"
|
|
3686
|
echo "Setting current installation as rhodecode-$RC_EDITION type"
|
|
3657
|
|
|
3687
|
|
|
3658
|
echo "configure $ini_path"
|
|
3688
|
echo "configure $ini_path"
|
|
3659
|
sed_replace '^use = egg:rhodecode-enterprise.*' "use = egg:rhodecode-enterprise-$RC_EDITION"
|
|
3689
|
sed_replace '^use = egg:rhodecode-enterprise.*' "use = egg:rhodecode-enterprise-$RC_EDITION"
|
|
3660
|
|
|
3690
|
|
|
3661
|
echo ""
|
|
3691
|
echo ""
|
|
3662
|
echo "configure $BOOTSTRAP_RUNTIME_ENV"
|
|
3692
|
echo "configure $BOOTSTRAP_RUNTIME_ENV"
|
|
3663
|
.env --file "$BOOTSTRAP_RUNTIME_ENV"
|
|
3693
|
.env --file "$BOOTSTRAP_RUNTIME_ENV"
|
|
3664
|
.env set RC_EDITION=$RC_EDITION
|
|
3694
|
.env set RC_EDITION=$RC_EDITION
|
|
3665
|
|
|
3695
|
|
|
3666
|
echo "Configuration done, run "
|
|
3696
|
echo "Configuration done, run "
|
|
3667
|
echo "./$RC_SCRIPT_NAME stack-upgrade rhodecode"
|
|
3697
|
echo "./$RC_SCRIPT_NAME stack-upgrade rhodecode"
|
|
3668
|
|
|
3698
|
|
|
3669
|
}
|
|
3699
|
}
|
|
3670
|
|
|
3700
|
|
|
3671
|
# :command.function
|
|
3701
|
# :command.function
|
|
3672
|
rcstack_cli_configure_vcsserver_command() {
|
|
3702
|
rcstack_cli_configure_vcsserver_command() {
|
|
3673
|
# src/cli_configure_vcsserver_command.sh
|
|
3703
|
# src/cli_configure_vcsserver_command.sh
|
|
3674
|
ini_path=${args[ini_path]}
|
|
3704
|
ini_path=${args[ini_path]}
|
|
3675
|
DEBUG=${args[--debug]}
|
|
3705
|
DEBUG=${args[--debug]}
|
|
3676
|
|
|
3706
|
|
|
3677
|
config_vcsserver_ini
|
|
3707
|
config_vcsserver_ini
|
|
3678
|
|
|
3708
|
|
|
3679
|
echo
|
|
3709
|
echo
|
|
3680
|
echo "reconfigure of $ini_path completed"
|
|
3710
|
echo "reconfigure of $ini_path completed"
|
|
3681
|
|
|
3711
|
|
|
3682
|
}
|
|
3712
|
}
|
|
3683
|
|
|
3713
|
|
|
3684
|
# :command.function
|
|
3714
|
# :command.function
|
|
3685
|
rcstack_cli_configure_rhodecode_command() {
|
|
3715
|
rcstack_cli_configure_rhodecode_command() {
|
|
3686
|
# src/cli_configure_rhodecode_command.sh
|
|
3716
|
# src/cli_configure_rhodecode_command.sh
|
|
3687
|
ini_path=${args[ini_path]}
|
|
3717
|
ini_path=${args[ini_path]}
|
|
3688
|
DEBUG=${args[--debug]}
|
|
3718
|
DEBUG=${args[--debug]}
|
|
3689
|
|
|
3719
|
|
|
3690
|
# read generated secrets etc from our .env file
|
|
3720
|
# read generated secrets etc from our .env file
|
|
3691
|
.env --file $RUNTIME_ENV
|
|
3721
|
.env --file $RUNTIME_ENV
|
|
3692
|
|
|
3722
|
|
|
3693
|
.env get RC_LICENSE_TOKEN
|
|
3723
|
.env get RC_LICENSE_TOKEN
|
|
3694
|
RC_LICENSE_TOKEN=$REPLY
|
|
3724
|
RC_LICENSE_TOKEN=$REPLY
|
|
3695
|
|
|
3725
|
|
|
3696
|
.env get RC_EDITION
|
|
3726
|
.env get RC_EDITION
|
|
3697
|
RC_EDITION=$REPLY
|
|
3727
|
RC_EDITION=$REPLY
|
|
3698
|
|
|
3728
|
|
|
3699
|
.env get RC_HOSTNAME
|
|
3729
|
.env get RC_HOSTNAME
|
|
3700
|
RC_HOSTNAME=$(sed_safe_path $REPLY)
|
|
3730
|
RC_HOSTNAME=$(sed_safe_path $REPLY)
|
|
3701
|
|
|
3731
|
|
|
3702
|
.env get RC_APP_BASE_URL
|
|
3732
|
.env get RC_APP_BASE_URL
|
|
3703
|
RC_APP_BASE_URL=$(sed_safe_path $REPLY)
|
|
3733
|
RC_APP_BASE_URL=$(sed_safe_path $REPLY)
|
|
3704
|
|
|
3734
|
|
|
3705
|
.env get RC_SQLALCHEMY_DB1_URL
|
|
3735
|
.env get RC_SQLALCHEMY_DB1_URL
|
|
3706
|
RC_SQLALCHEMY_DB1_URL=$(sed_safe_path $REPLY)
|
|
3736
|
RC_SQLALCHEMY_DB1_URL=$(sed_safe_path $REPLY)
|
|
3707
|
|
|
3737
|
|
|
3708
|
.env get RC_CHANNELSTREAM_WS_URL
|
|
3738
|
.env get RC_CHANNELSTREAM_WS_URL
|
|
3709
|
RC_CHANNELSTREAM_WS_URL=$(sed_safe_path $REPLY)
|
|
3739
|
RC_CHANNELSTREAM_WS_URL=$(sed_safe_path $REPLY)
|
|
3710
|
|
|
3740
|
|
|
3711
|
# $ini_path needs to be defined!
|
|
3741
|
# $ini_path needs to be defined!
|
|
3712
|
config_rhodecode_ini
|
|
3742
|
config_rhodecode_ini
|
|
3713
|
|
|
3743
|
|
|
3714
|
echo
|
|
3744
|
echo
|
|
3715
|
echo "reconfigure of $ini_path completed"
|
|
3745
|
echo "reconfigure of $ini_path completed"
|
|
3716
|
}
|
|
3746
|
}
|
|
3717
|
|
|
3747
|
|
|
3718
|
# :command.function
|
|
3748
|
# :command.function
|
|
3719
|
rcstack_backup_db_command() {
|
|
3749
|
rcstack_backup_db_command() {
|
|
3720
|
# src/backup_db_command.sh
|
|
3750
|
# src/backup_db_command.sh
|
|
3721
|
check_bootstrap
|
|
3751
|
check_bootstrap
|
|
3722
|
|
|
3752
|
|
|
3723
|
DEBUG=${args[--debug]}
|
|
3753
|
DEBUG=${args[--debug]}
|
|
3724
|
DESTINATION=${args[destination]}
|
|
3754
|
DESTINATION=${args[destination]}
|
|
3725
|
|
|
3755
|
|
|
3726
|
backup_name=rc_db_dump-$(date +%Y-%m-%d).sql.gz
|
|
3756
|
backup_name=rc_db_dump-$(date +%Y-%m-%d).sql.gz
|
|
3727
|
echo "creating backup: $backup_name"
|
|
3757
|
echo "creating backup: $backup_name"
|
|
3728
|
|
|
3758
|
|
|
3729
|
target_container=rc_cluster_services-database-*
|
|
3759
|
target_container=rc_cluster_services-database-*
|
|
3730
|
docker_id=$(docker ps --filter name=$target_container -q | head -n1)
|
|
3760
|
docker_id=$(docker ps --filter name=$target_container -q | head -n1)
|
|
3731
|
|
|
3761
|
|
|
3732
|
if [[ $DEBUG ]]; then
|
|
3762
|
if [[ $DEBUG ]]; then
|
|
3733
|
echo "container id: $docker_id, based on $target_container filter"
|
|
3763
|
echo "container id: $docker_id, based on $target_container filter"
|
|
3734
|
docker ps
|
|
3764
|
docker ps
|
|
3735
|
echo "---"
|
|
3765
|
echo "---"
|
|
3736
|
fi
|
|
3766
|
fi
|
|
3737
|
|
|
3767
|
|
|
3738
|
if [ "$docker_id" == "" ]; then
|
|
3768
|
if [ "$docker_id" == "" ]; then
|
|
3739
|
MSG="Cannot find container ID with name $target_container"
|
|
3769
|
MSG="Cannot find container ID with name $target_container"
|
|
3740
|
echo "$(red $MSG)"
|
|
3770
|
echo "$(red $MSG)"
|
|
3741
|
exit 1
|
|
3771
|
exit 1
|
|
3742
|
fi
|
|
3772
|
fi
|
|
3743
|
|
|
3773
|
|
|
3744
|
.env --file $RUNTIME_ENV
|
|
3774
|
.env --file $RUNTIME_ENV
|
|
3745
|
|
|
3775
|
|
|
3746
|
.env get DB_PASSWORD
|
|
3776
|
.env get DB_PASSWORD
|
|
3747
|
DB_PASSWORD=$REPLY
|
|
3777
|
DB_PASSWORD=$REPLY
|
|
3748
|
|
|
3778
|
|
|
3749
|
.env get DB_NAME
|
|
3779
|
.env get DB_NAME
|
|
3750
|
DB_NAME=$REPLY
|
|
3780
|
DB_NAME=$REPLY
|
|
3751
|
|
|
3781
|
|
|
3752
|
.env get DB_USER
|
|
3782
|
.env get DB_USER
|
|
3753
|
DB_USER=$REPLY
|
|
3783
|
DB_USER=$REPLY
|
|
3754
|
|
|
3784
|
|
|
3755
|
if [[ $DEBUG ]]; then
|
|
3785
|
if [[ $DEBUG ]]; then
|
|
3756
|
echo "docker exec -e PGPASSWORD=$DB_PASSWORD $docker_id /bin/bash -c 'mkdir -p /var/rc-data-dump && pg_dump --inserts -U $DB_USER -h 127.0.0.1 --dbname=$DB_NAME | gzip > /var/rc-data-dump/$backup_name'"
|
|
3786
|
echo "docker exec -e PGPASSWORD=$DB_PASSWORD $docker_id /bin/bash -c 'mkdir -p /var/rc-data-dump && pg_dump --inserts -U $DB_USER -h 127.0.0.1 --dbname=$DB_NAME | gzip > /var/rc-data-dump/$backup_name'"
|
|
3757
|
echo "dump placed in /var/rc-data-dump/$backup_name"
|
|
3787
|
echo "dump placed in /var/rc-data-dump/$backup_name"
|
|
3758
|
echo "run docker cp $docker_id:/var/rc-data-dump/$backup_name $PWD to copy the file into your host machine"
|
|
3788
|
echo "run docker cp $docker_id:/var/rc-data-dump/$backup_name $PWD to copy the file into your host machine"
|
|
3759
|
fi
|
|
3789
|
fi
|
|
3760
|
|
|
3790
|
|
|
3761
|
set -euo pipefail
|
|
3791
|
set -euo pipefail
|
|
3762
|
|
|
3792
|
|
|
3763
|
docker exec -e PGPASSWORD=$DB_PASSWORD $docker_id /bin/bash -c "pg_dump --inserts -U $DB_USER -h 127.0.0.1 --dbname=$DB_NAME | gzip > /var/rc-data-dump/$backup_name"
|
|
3793
|
docker exec -e PGPASSWORD=$DB_PASSWORD $docker_id /bin/bash -c "pg_dump --inserts -U $DB_USER -h 127.0.0.1 --dbname=$DB_NAME | gzip > /var/rc-data-dump/$backup_name"
|
|
3764
|
|
|
3794
|
|
|
3765
|
echo "$(green Backup created in container volume under: /var/rc-data-dump/$backup_name !)"
|
|
3795
|
echo "$(green Backup created in container volume under: /var/rc-data-dump/$backup_name !)"
|
|
3766
|
echo "to copy this file into your host machine run:"
|
|
3796
|
echo "to copy this file into your host machine run:"
|
|
3767
|
echo "docker cp $docker_id:/var/rc-data-dump/$backup_name $PWD"
|
|
3797
|
echo "docker cp $docker_id:/var/rc-data-dump/$backup_name $PWD"
|
|
3768
|
|
|
3798
|
|
|
3769
|
}
|
|
3799
|
}
|
|
3770
|
|
|
3800
|
|
|
3771
|
# :command.function
|
|
3801
|
# :command.function
|
|
3772
|
rcstack_backup_data_command() {
|
|
3802
|
rcstack_backup_data_command() {
|
|
3773
|
# src/backup_data_command.sh
|
|
3803
|
# src/backup_data_command.sh
|
|
3774
|
check_bootstrap
|
|
3804
|
check_bootstrap
|
|
3775
|
|
|
3805
|
|
|
3776
|
DEBUG=${args[--debug]}
|
|
3806
|
DEBUG=${args[--debug]}
|
|
3777
|
DESTINATION=${args[destination]}
|
|
3807
|
DESTINATION=${args[destination]}
|
|
3778
|
|
|
3808
|
|
|
3779
|
backup_name=rc_data_dump-$(date +%Y-%m-%d).tar.gz
|
|
3809
|
backup_name=rc_data_dump-$(date +%Y-%m-%d).tar.gz
|
|
3780
|
echo "creating backup: $backup_name"
|
|
3810
|
echo "creating backup: $backup_name"
|
|
3781
|
|
|
3811
|
|
|
3782
|
target_container=rc_cluster_apps-rhodecode-*
|
|
3812
|
target_container=rc_cluster_apps-rhodecode-*
|
|
3783
|
target_container=rc_cluster_apps-celery-*
|
|
3813
|
target_container=rc_cluster_apps-celery-*
|
|
3784
|
docker_id=$(docker ps --filter name=$target_container -q | head -n1)
|
|
3814
|
docker_id=$(docker ps --filter name=$target_container -q | head -n1)
|
|
3785
|
|
|
3815
|
|
|
3786
|
if [[ $DEBUG ]]; then
|
|
3816
|
if [[ $DEBUG ]]; then
|
|
3787
|
echo "container id: $docker_id, based on $target_container filter"
|
|
3817
|
echo "container id: $docker_id, based on $target_container filter"
|
|
3788
|
docker ps
|
|
3818
|
docker ps
|
|
3789
|
echo "---"
|
|
3819
|
echo "---"
|
|
3790
|
fi
|
|
3820
|
fi
|
|
3791
|
|
|
3821
|
|
|
3792
|
if [ "$docker_id" == "" ]; then
|
|
3822
|
if [ "$docker_id" == "" ]; then
|
|
3793
|
MSG="Cannot find container ID with name $target_container"
|
|
3823
|
MSG="Cannot find container ID with name $target_container"
|
|
3794
|
echo "$(red $MSG)"
|
|
3824
|
echo "$(red $MSG)"
|
|
3795
|
exit 1
|
|
3825
|
exit 1
|
|
3796
|
fi
|
|
3826
|
fi
|
|
3797
|
|
|
3827
|
|
|
3798
|
set -euo pipefail
|
|
3828
|
set -euo pipefail
|
|
3799
|
|
|
3829
|
|
|
3800
|
echo "Following volumes will be backed-up:"
|
|
3830
|
echo "Following volumes will be backed-up:"
|
|
3801
|
|
|
3831
|
|
|
3802
|
volumes=$(docker inspect --format "{{ range .Mounts }}{{ println .Destination }}{{ end }}" $docker_id)
|
|
3832
|
volumes=$(docker inspect --format "{{ range .Mounts }}{{ println .Destination }}{{ end }}" $docker_id)
|
|
3803
|
destination_dir=/tmp
|
|
3833
|
destination_dir=/tmp
|
|
3804
|
for vol in $volumes; do
|
|
3834
|
for vol in $volumes; do
|
|
3805
|
echo "backup: $vol"
|
|
3835
|
echo "backup: $vol"
|
|
3806
|
docker run --rm -v $destination_dir:/backup --volumes-from "$docker_id" debian:jessie tar -czvf /backup/$backup_name.tar.gz "$vol"
|
|
3836
|
docker run --rm -v $destination_dir:/backup --volumes-from "$docker_id" debian:jessie tar -czvf /backup/$backup_name.tar.gz "$vol"
|
|
3807
|
done
|
|
3837
|
done
|
|
3808
|
|
|
3838
|
|
|
3809
|
echo "$(green Backup created in $destination_dir: $backup_name !)"
|
|
3839
|
echo "$(green Backup created in $destination_dir: $backup_name !)"
|
|
3810
|
|
|
3840
|
|
|
3811
|
#docker-volume-restore-compressed() {
|
|
3841
|
#docker-volume-restore-compressed() {
|
|
3812
|
# destination_dir=$1
|
|
3842
|
# destination_dir=$1
|
|
3813
|
# container=$2
|
|
3843
|
# container=$2
|
|
3814
|
#
|
|
3844
|
#
|
|
3815
|
# docker run --rm -v $destination_dir:/backup --volumes-from "$container" debian:jessie tar -xzvf /backup/backup.tar.gz "${@:3}"
|
|
3845
|
# docker run --rm -v $destination_dir:/backup --volumes-from "$container" debian:jessie tar -xzvf /backup/backup.tar.gz "${@:3}"
|
|
3816
|
# echo "Double checking files..."
|
|
3846
|
# echo "Double checking files..."
|
|
3817
|
# docker run --rm -v $destination_dir:/backup --volumes-from "$container" debian:jessie ls -lh "${@:2}"
|
|
3847
|
# docker run --rm -v $destination_dir:/backup --volumes-from "$container" debian:jessie ls -lh "${@:2}"
|
|
3818
|
#}
|
|
3848
|
#}
|
|
3819
|
}
|
|
3849
|
}
|
|
3820
|
|
|
3850
|
|
|
3821
|
# :command.function
|
|
3851
|
# :command.function
|
|
3822
|
rcstack_get_build_artifacts_command() {
|
|
3852
|
rcstack_get_build_artifacts_command() {
|
|
3823
|
# src/get_build_artifacts_command.sh
|
|
3853
|
# src/get_build_artifacts_command.sh
|
|
3824
|
check_bootstrap
|
|
3854
|
check_bootstrap
|
|
3825
|
|
|
3855
|
|
|
3826
|
DEBUG=${args[--debug]}
|
|
3856
|
DEBUG=${args[--debug]}
|
|
3827
|
AUTH=${args[--auth]}
|
|
3857
|
AUTH=${args[--auth]}
|
|
3828
|
INSTALLER_URL=${args[--installer-url]}
|
|
3858
|
INSTALLER_URL=${args[--installer-url]}
|
|
3829
|
MANIFEST_URL=${args[--manifest-url]}
|
|
3859
|
MANIFEST_URL=${args[--manifest-url]}
|
|
3830
|
RC_VERSION=${args[--version-name]}
|
|
3860
|
RC_VERSION=${args[--version-name]}
|
|
3831
|
VER=$RC_VERSION
|
|
3861
|
VER=$RC_VERSION
|
|
3832
|
|
|
3862
|
|
|
3833
|
CACHE_DIR=$PWD/.cache
|
|
3863
|
CACHE_DIR=$PWD/.cache
|
|
3834
|
VER_REGEX="$VER+x86_64"
|
|
3864
|
VER_REGEX="$VER+x86_64"
|
|
3835
|
|
|
3865
|
|
|
3836
|
if [[ $VER == "" ]]; then
|
|
3866
|
if [[ $VER == "" ]]; then
|
|
3837
|
msg="Version is empty, please set --version-name correctly"
|
|
3867
|
msg="Version is empty, please set --version-name correctly"
|
|
3838
|
echo "$(red $msg)"
|
|
3868
|
echo "$(red $msg)"
|
|
3839
|
exit 1
|
|
3869
|
exit 1
|
|
3840
|
fi
|
|
3870
|
fi
|
|
3841
|
|
|
3871
|
|
|
3842
|
echo "Downloading Artifacts for version: $VER"
|
|
3872
|
echo "Downloading Artifacts for version: $VER"
|
|
3843
|
mkdir -p $CACHE_DIR
|
|
3873
|
mkdir -p $CACHE_DIR
|
|
3844
|
|
|
3874
|
|
|
3845
|
echo "1/4 Checking available downloads from MANIFEST file"
|
|
3875
|
echo "1/4 Checking available downloads from MANIFEST file"
|
|
3846
|
|
|
3876
|
|
|
3847
|
ARTS=$(curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" | cut -d ' ' -f 2)
|
|
3877
|
ARTS=$(curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" | cut -d ' ' -f 2)
|
|
3848
|
|
|
3878
|
|
|
3849
|
if [[ $DEBUG ]]; then
|
|
3879
|
if [[ $DEBUG ]]; then
|
|
3850
|
echo "DEBUG START"
|
|
3880
|
echo "DEBUG START"
|
|
3851
|
curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" || echo "no regex match"
|
|
3881
|
curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" || echo "no regex match"
|
|
3852
|
curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" | cut -d ' ' -f 2
|
|
3882
|
curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" | cut -d ' ' -f 2
|
|
3853
|
echo "Found following artifacts:"
|
|
3883
|
echo "Found following artifacts:"
|
|
3854
|
echo $ARTS
|
|
3884
|
echo $ARTS
|
|
3855
|
echo "DEBUG END"
|
|
3885
|
echo "DEBUG END"
|
|
3856
|
fi
|
|
3886
|
fi
|
|
3857
|
|
|
3887
|
|
|
3858
|
if [[ $ARTS == "" ]]; then
|
|
3888
|
if [[ $ARTS == "" ]]; then
|
|
3859
|
MSG="Failed to found any MANIFEST entries for version $VER make sure there exists release with that version or use --version to specify different version"
|
|
3889
|
MSG="Failed to found any MANIFEST entries for version $VER make sure there exists release with that version or use --version to specify different version"
|
|
3860
|
echo "$(red $MSG)"
|
|
3890
|
echo "$(red $MSG)"
|
|
3861
|
exit 1
|
|
3891
|
exit 1
|
|
3862
|
fi
|
|
3892
|
fi
|
|
3863
|
|
|
3893
|
|
|
3864
|
echo "2/4 Downloading locale-archive"
|
|
3894
|
echo "2/4 Downloading locale-archive"
|
|
3865
|
curl -L https://dls.rhodecode.com/assets/locale-archive -J -O
|
|
3895
|
curl -L https://dls.rhodecode.com/assets/locale-archive -J -O
|
|
3866
|
mv -v locale-archive "$CACHE_DIR"
|
|
3896
|
mv -v locale-archive "$CACHE_DIR"
|
|
3867
|
|
|
3897
|
|
|
3868
|
# vcsserver/ce/ee
|
|
3898
|
# vcsserver/ce/ee
|
|
3869
|
echo "3/4 Downloading installer artifacts"
|
|
3899
|
echo "3/4 Downloading installer artifacts"
|
|
3870
|
for url in $ARTS; do
|
|
3900
|
for url in $ARTS; do
|
|
3871
|
echo "Downloading $url with $AUTH"
|
|
3901
|
echo "Downloading $url with $AUTH"
|
|
3872
|
curl $AUTH --fail-early -L ${url} -J -O
|
|
3902
|
curl $AUTH --fail-early -L ${url} -J -O
|
|
3873
|
done
|
|
3903
|
done
|
|
3874
|
|
|
3904
|
|
|
3875
|
#for url in $(curl -s $MANIFEST_URL | grep --ignore-case -E 'control.+\+x86_64' | cut -d ' ' -f 2); do
|
|
3905
|
#for url in $(curl -s $MANIFEST_URL | grep --ignore-case -E 'control.+\+x86_64' | cut -d ' ' -f 2); do
|
|
3876
|
# echo "Downloading $url"
|
|
3906
|
# echo "Downloading $url"
|
|
3877
|
# curl -L ${url} -J -O
|
|
3907
|
# curl -L ${url} -J -O
|
|
3878
|
#done
|
|
3908
|
#done
|
|
3879
|
|
|
3909
|
|
|
3880
|
echo "4/4 Downloading installer from $INSTALLER_URL"
|
|
3910
|
echo "4/4 Downloading installer from $INSTALLER_URL"
|
|
3881
|
curl $AUTH -L $INSTALLER_URL -J -O
|
|
3911
|
curl $AUTH -L $INSTALLER_URL -J -O
|
|
3882
|
|
|
3912
|
|
|
3883
|
INSTALLER=$(ls -Art RhodeCode-installer-* | tail -n 1)
|
|
3913
|
INSTALLER=$(ls -Art RhodeCode-installer-* | tail -n 1)
|
|
3884
|
if [[ -n $INSTALLER ]]; then
|
|
3914
|
if [[ -n $INSTALLER ]]; then
|
|
3885
|
chmod +x "${INSTALLER}"
|
|
3915
|
chmod +x "${INSTALLER}"
|
|
3886
|
fi
|
|
3916
|
fi
|
|
3887
|
|
|
3917
|
|
|
3888
|
echo "Copying artifacts into $CACHE_DIR"
|
|
3918
|
echo "Copying artifacts into $CACHE_DIR"
|
|
3889
|
|
|
3919
|
|
|
3890
|
mv -v "${INSTALLER}" $CACHE_DIR
|
|
3920
|
mv -v "${INSTALLER}" $CACHE_DIR
|
|
3891
|
mv -v *.bz2 $CACHE_DIR
|
|
3921
|
mv -v *.bz2 $CACHE_DIR
|
|
3892
|
ls -lh $CACHE_DIR
|
|
3922
|
ls -lh $CACHE_DIR
|
|
3893
|
|
|
3923
|
|
|
3894
|
}
|
|
3924
|
}
|
|
3895
|
|
|
3925
|
|
|
3896
|
# :command.function
|
|
3926
|
# :command.function
|
|
3897
|
rcstack_build_installer_command() {
|
|
3927
|
rcstack_build_installer_command() {
|
|
3898
|
# src/build_installer_command.sh
|
|
3928
|
# src/build_installer_command.sh
|
|
3899
|
check_bootstrap
|
|
3929
|
check_bootstrap
|
|
3900
|
|
|
3930
|
|
|
3901
|
rc_version=${args[--version-name]}
|
|
3931
|
rc_version=${args[--version-name]}
|
|
3902
|
export RC_VERSION=$rc_version
|
|
3932
|
export RC_VERSION=$rc_version
|
|
3903
|
eval "echo INSTALLER BASED BUILDING${RC_VERSION}"
|
|
3933
|
eval "echo INSTALLER BASED BUILDING${RC_VERSION}"
|
|
3904
|
|
|
3934
|
|
|
3905
|
RC_VERSION=$rc_version ./$RC_SCRIPT_NAME stack rhodecode build --progress plain rhodecode
|
|
3935
|
RC_VERSION=$rc_version ./$RC_SCRIPT_NAME stack rhodecode build --progress plain rhodecode
|
|
3906
|
|
|
3936
|
|
|
3907
|
}
|
|
3937
|
}
|
|
3908
|
|
|
3938
|
|
|
3909
|
# :command.function
|
|
3939
|
# :command.function
|
|
3910
|
rcstack_get_build_source_command() {
|
|
3940
|
rcstack_get_build_source_command() {
|
|
3911
|
# src/get_build_source_command.sh
|
|
3941
|
# src/get_build_source_command.sh
|
|
3912
|
|
|
3942
|
|
|
3913
|
NO_INIT=${args[--no-init-check]}
|
|
3943
|
NO_INIT=${args[--no-init-check]}
|
|
3914
|
|
|
3944
|
|
|
3915
|
if [[ ! $NO_INIT ]]; then
|
|
3945
|
if [[ ! $NO_INIT ]]; then
|
|
3916
|
check_bootstrap
|
|
3946
|
check_bootstrap
|
|
3917
|
fi
|
|
3947
|
fi
|
|
3918
|
|
|
3948
|
|
|
3919
|
DEBUG=${args[--debug]}
|
|
3949
|
DEBUG=${args[--debug]}
|
|
3920
|
AUTH_TOKEN=${args[--auth-token]}
|
|
3950
|
AUTH_TOKEN=${args[--auth-token]}
|
|
3921
|
SERVER_URL=${args[--server-url]}
|
|
3951
|
SERVER_URL=${args[--server-url]}
|
|
3922
|
revision=${args[--revision]}
|
|
3952
|
revision=${args[--revision]}
|
|
3923
|
|
|
3953
|
|
|
3924
|
SOURCE_DIR=$PWD/.source
|
|
3954
|
SOURCE_DIR=$PWD/.source
|
|
3925
|
|
|
3955
|
|
|
3926
|
RHODECODE_VCS_HASH=$revision
|
|
3956
|
RHODECODE_VCS_HASH=$revision
|
|
3927
|
RHODECODE_CE_HASH=$revision
|
|
3957
|
RHODECODE_CE_HASH=$revision
|
|
3928
|
RHODECODE_EE_HASH=$revision
|
|
3958
|
RHODECODE_EE_HASH=$revision
|
|
3929
|
|
|
3959
|
|
|
3930
|
# download sources
|
|
3960
|
# download sources
|
|
3931
|
echo "** download rhodecode source for build from $SERVER_URL using '$revision' hash **"
|
|
3961
|
echo "** download rhodecode source for build from $SERVER_URL using '$revision' hash **"
|
|
3932
|
mkdir -p $SOURCE_DIR
|
|
3962
|
mkdir -p $SOURCE_DIR
|
|
3933
|
|
|
3963
|
|
|
3934
|
echo "getting $SERVER_URL/rhodecode-vcsserver/archive/$RHODECODE_VCS_HASH.tgz"
|
|
3964
|
echo "getting $SERVER_URL/rhodecode-vcsserver/archive/$RHODECODE_VCS_HASH.tgz"
|
|
3935
|
curl --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-vcsserver/archive/$RHODECODE_VCS_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR
|
|
3965
|
curl --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-vcsserver/archive/$RHODECODE_VCS_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR
|
|
3936
|
|
|
3966
|
|
|
3937
|
echo "getting $SERVER_URL/rhodecode-enterprise-ce/archive/$RHODECODE_CE_HASH.tgz"
|
|
3967
|
echo "getting $SERVER_URL/rhodecode-enterprise-ce/archive/$RHODECODE_CE_HASH.tgz"
|
|
3938
|
curl --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-enterprise-ce/archive/$RHODECODE_CE_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR
|
|
3968
|
curl --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-enterprise-ce/archive/$RHODECODE_CE_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR
|
|
3939
|
|
|
3969
|
|
|
3940
|
echo "getting $SERVER_URL/rhodecode-enterprise-ee/archive/$RHODECODE_EE_HASH.tgz"
|
|
3970
|
echo "getting $SERVER_URL/rhodecode-enterprise-ee/archive/$RHODECODE_EE_HASH.tgz"
|
|
3941
|
curl --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-enterprise-ee/archive/$RHODECODE_EE_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR
|
|
3971
|
curl --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-enterprise-ee/archive/$RHODECODE_EE_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR
|
|
3942
|
|
|
3972
|
|
|
3943
|
rm -rf $SOURCE_DIR/rhodecode-vcsserver && \
|
|
3973
|
rm -rf $SOURCE_DIR/rhodecode-vcsserver && \
|
|
3944
|
mv $SOURCE_DIR/*rhodecode-vcsserver-plain $SOURCE_DIR/rhodecode-vcsserver
|
|
3974
|
mv $SOURCE_DIR/*rhodecode-vcsserver-plain $SOURCE_DIR/rhodecode-vcsserver
|
|
3945
|
rm -rf $SOURCE_DIR/rhodecode-vcsserver/.hg
|
|
3975
|
rm -rf $SOURCE_DIR/rhodecode-vcsserver/.hg
|
|
3946
|
|
|
3976
|
|
|
3947
|
rm -rf $SOURCE_DIR/rhodecode-enterprise-ce && \
|
|
3977
|
rm -rf $SOURCE_DIR/rhodecode-enterprise-ce && \
|
|
3948
|
mv $SOURCE_DIR/*rhodecode-enterprise-ce-plain $SOURCE_DIR/rhodecode-enterprise-ce
|
|
3978
|
mv $SOURCE_DIR/*rhodecode-enterprise-ce-plain $SOURCE_DIR/rhodecode-enterprise-ce
|
|
3949
|
rm -rf $SOURCE_DIR/rhodecode-enterprise-ce/.hg
|
|
3979
|
rm -rf $SOURCE_DIR/rhodecode-enterprise-ce/.hg
|
|
3950
|
|
|
3980
|
|
|
3951
|
rm -rf $SOURCE_DIR/rhodecode-enterprise-ee && \
|
|
3981
|
rm -rf $SOURCE_DIR/rhodecode-enterprise-ee && \
|
|
3952
|
mv $SOURCE_DIR/*rhodecode-enterprise-ee-plain $SOURCE_DIR/rhodecode-enterprise-ee
|
|
3982
|
mv $SOURCE_DIR/*rhodecode-enterprise-ee-plain $SOURCE_DIR/rhodecode-enterprise-ee
|
|
3953
|
rm -rf $SOURCE_DIR/rhodecode-enterprise-ee/.hg
|
|
3983
|
rm -rf $SOURCE_DIR/rhodecode-enterprise-ee/.hg
|
|
3954
|
|
|
3984
|
|
|
3955
|
echo "downloading sources done to $SOURCE_DIR, directory now consists:"
|
|
3985
|
echo "downloading sources done to $SOURCE_DIR, directory now consists:"
|
|
3956
|
ls -l $SOURCE_DIR
|
|
3986
|
ls -l $SOURCE_DIR
|
|
3957
|
|
|
3987
|
|
|
3958
|
echo ""
|
|
3988
|
echo ""
|
|
3959
|
date_formatted=$(date +%Y.%m.%d.1)
|
|
3989
|
date_formatted=$(date +%Y.%m.%d.1)
|
|
3960
|
echo "to create source based build run:"
|
|
3990
|
echo "to create source based build run:"
|
|
3961
|
echo " ./$RC_SCRIPT_NAME build-source --version-name 4.28.0.REL.$date_formatted --tag edge"
|
|
3991
|
echo " ./$RC_SCRIPT_NAME build-source --version-name 4.28.0.REL.$date_formatted --tag edge"
|
|
3962
|
|
|
3992
|
|
|
3963
|
}
|
|
3993
|
}
|
|
3964
|
|
|
3994
|
|
|
3965
|
# :command.function
|
|
3995
|
# :command.function
|
|
3966
|
rcstack_build_source_command() {
|
|
3996
|
rcstack_build_source_command() {
|
|
3967
|
# src/build_source_command.sh
|
|
3997
|
# src/build_source_command.sh
|
|
3968
|
check_bootstrap
|
|
3998
|
check_bootstrap
|
|
3969
|
|
|
3999
|
|
|
3970
|
rc_version=${args[--version-name]}
|
|
4000
|
rc_version=${args[--version-name]}
|
|
3971
|
source_build_yaml=${args[--source-build-yaml]}
|
|
4001
|
source_build_yaml=${args[--source-build-yaml]}
|
|
3972
|
|
|
4002
|
|
|
3973
|
eval "tags_data=(${args[--tag]})"
|
|
4003
|
eval "tags_data=(${args[--tag]})"
|
|
3974
|
|
|
4004
|
|
|
3975
|
export RC_VERSION=$rc_version
|
|
4005
|
export RC_VERSION=$rc_version
|
|
3976
|
export RC_EDITION=ee
|
|
4006
|
export RC_EDITION=ee
|
|
3977
|
echo "build_source: SOURCE BASED BUILDING: $rc_version"
|
|
4007
|
echo "build_source: SOURCE BASED BUILDING: $rc_version"
|
|
3978
|
echo ""
|
|
4008
|
echo ""
|
|
3979
|
|
|
4009
|
|
|
3980
|
DOCKER_SCAN_SUGGEST=false RC_VERSION=$rc_version ./$RC_SCRIPT_NAME stack rhodecode -f $source_build_yaml build --progress plain rhodecode
|
|
4010
|
DOCKER_SCAN_SUGGEST=false RC_VERSION=$rc_version ./$RC_SCRIPT_NAME stack rhodecode -f $source_build_yaml build --progress plain rhodecode
|
|
3981
|
|
|
4011
|
|
|
3982
|
# now tag the ee to ce
|
|
4012
|
# now tag the ee to ce
|
|
3983
|
docker tag rhodecode/rhodecode-ee:$rc_version rhodecode/rhodecode-ce:$rc_version
|
|
4013
|
docker tag rhodecode/rhodecode-ee:$rc_version rhodecode/rhodecode-ce:$rc_version
|
|
3984
|
|
|
4014
|
|
|
3985
|
# apply the tags
|
|
4015
|
# apply the tags
|
|
3986
|
for tag in "${tags_data[@]}"; do
|
|
4016
|
for tag in "${tags_data[@]}"; do
|
|
3987
|
echo "build_source: creating tag:$tag"
|
|
4017
|
echo "build_source: creating tag:$tag"
|
|
3988
|
docker tag rhodecode/rhodecode-ee:$rc_version rhodecode/rhodecode-ee:$tag
|
|
4018
|
docker tag rhodecode/rhodecode-ee:$rc_version rhodecode/rhodecode-ee:$tag
|
|
3989
|
docker tag rhodecode/rhodecode-ee:$rc_version rhodecode/rhodecode-ce:$tag
|
|
4019
|
docker tag rhodecode/rhodecode-ee:$rc_version rhodecode/rhodecode-ce:$tag
|
|
3990
|
done
|
|
4020
|
done
|
|
3991
|
|
|
4021
|
|
|
3992
|
echo "build_source: consider setting release version using"
|
|
4022
|
echo "build_source: consider setting release version using"
|
|
3993
|
echo " ./$RC_SCRIPT_NAME cli set-runtime-image $rc_version"
|
|
4023
|
echo " ./$RC_SCRIPT_NAME cli set-runtime-image $rc_version"
|
|
3994
|
|
|
4024
|
|
|
3995
|
echo "build_source: push this image using"
|
|
4025
|
echo "build_source: push this image using"
|
|
3996
|
echo " docker push rhodecode/rhodecode-ee:$rc_version"
|
|
4026
|
echo " docker push rhodecode/rhodecode-ee:$rc_version"
|
|
3997
|
echo " docker push rhodecode/rhodecode-ce:$rc_version"
|
|
4027
|
echo " docker push rhodecode/rhodecode-ce:$rc_version"
|
|
3998
|
|
|
4028
|
|
|
3999
|
for tag in "${tags_data[@]}"; do
|
|
4029
|
for tag in "${tags_data[@]}"; do
|
|
4000
|
echo " docker push rhodecode/rhodecode-ee:$tag"
|
|
4030
|
echo " docker push rhodecode/rhodecode-ee:$tag"
|
|
4001
|
echo " docker push rhodecode/rhodecode-ce:$tag"
|
|
4031
|
echo " docker push rhodecode/rhodecode-ce:$tag"
|
|
4002
|
done
|
|
4032
|
done
|
|
4003
|
}
|
|
4033
|
}
|
|
4004
|
|
|
4034
|
|
|
4005
|
# :command.function
|
|
4035
|
# :command.function
|
|
4006
|
rcstack__completions_command() {
|
|
4036
|
rcstack__completions_command() {
|
|
4007
|
# src/_completions_command.sh
|
|
4037
|
# src/_completions_command.sh
|
|
4008
|
send_completions
|
|
4038
|
send_completions
|
|
4009
|
}
|
|
4039
|
}
|
|
4010
|
|
|
4040
|
|
|
4011
|
# :command.parse_requirements
|
|
4041
|
# :command.parse_requirements
|
|
4012
|
parse_requirements() {
|
|
4042
|
parse_requirements() {
|
|
4013
|
# :command.fixed_flags_filter
|
|
4043
|
# :command.fixed_flags_filter
|
|
4014
|
while [[ $# -gt 0 ]]; do
|
|
4044
|
while [[ $# -gt 0 ]]; do
|
|
4015
|
case "${1:-}" in
|
|
4045
|
case "${1:-}" in
|
|
4016
|
--version | -v)
|
|
4046
|
--version | -v)
|
|
4017
|
version_command
|
|
4047
|
version_command
|
|
4018
|
exit
|
|
4048
|
exit
|
|
4019
|
;;
|
|
4049
|
;;
|
|
4020
|
|
|
4050
|
|
|
4021
|
--help | -h)
|
|
4051
|
--help | -h)
|
|
4022
|
long_usage=yes
|
|
4052
|
long_usage=yes
|
|
4023
|
rcstack_usage
|
|
4053
|
rcstack_usage
|
|
4024
|
exit
|
|
4054
|
exit
|
|
4025
|
;;
|
|
4055
|
;;
|
|
4026
|
|
|
4056
|
|
|
4027
|
# :flag.case
|
|
4057
|
# :flag.case
|
|
4028
|
--debug)
|
|
4058
|
--debug)
|
|
4029
|
|
|
4059
|
|
|
4030
|
# :flag.case_no_arg
|
|
4060
|
# :flag.case_no_arg
|
|
4031
|
args['--debug']=1
|
|
4061
|
args['--debug']=1
|
|
4032
|
shift
|
|
4062
|
shift
|
|
4033
|
;;
|
|
4063
|
;;
|
|
4034
|
|
|
4064
|
|
|
4035
|
# :flag.case
|
|
4065
|
# :flag.case
|
|
4036
|
--no-init-check)
|
|
4066
|
--no-init-check)
|
|
4037
|
|
|
4067
|
|
|
4038
|
# :flag.case_no_arg
|
|
4068
|
# :flag.case_no_arg
|
|
4039
|
args['--no-init-check']=1
|
|
4069
|
args['--no-init-check']=1
|
|
4040
|
shift
|
|
4070
|
shift
|
|
4041
|
;;
|
|
4071
|
;;
|
|
4042
|
|
|
4072
|
|
|
4043
|
*)
|
|
4073
|
*)
|
|
4044
|
break
|
|
4074
|
break
|
|
4045
|
;;
|
|
4075
|
;;
|
|
4046
|
|
|
4076
|
|
|
4047
|
esac
|
|
4077
|
esac
|
|
4048
|
done
|
|
4078
|
done
|
|
4049
|
|
|
4079
|
|
|
4050
|
# :command.environment_variables_filter
|
|
4080
|
# :command.environment_variables_filter
|
|
4051
|
# :command.environment_variables_default
|
|
4081
|
# :command.environment_variables_default
|
|
4052
|
export RCC_CONFIG="${RCC_CONFIG:-.rcstack.ini}"
|
|
4082
|
export RCC_CONFIG="${RCC_CONFIG:-.rcstack.ini}"
|
|
4053
|
export RC_STACK_ROUTER_EXT="${RC_STACK_ROUTER_EXT:-.custom/docker-compose-router.override.yaml}"
|
|
4083
|
export RC_STACK_ROUTER_EXT="${RC_STACK_ROUTER_EXT:-.custom/docker-compose-router.override.yaml}"
|
|
4054
|
export RC_STACK_METRICS_EXT="${RC_STACK_METRICS_EXT:-.custom/docker-compose-metrics.override.yaml}"
|
|
4084
|
export RC_STACK_METRICS_EXT="${RC_STACK_METRICS_EXT:-.custom/docker-compose-metrics.override.yaml}"
|
|
4055
|
export RC_STACK_SERVICES_EXT="${RC_STACK_SERVICES_EXT:-.custom/docker-compose-services.override.yaml}"
|
|
4085
|
export RC_STACK_SERVICES_EXT="${RC_STACK_SERVICES_EXT:-.custom/docker-compose-services.override.yaml}"
|
|
4056
|
export RC_STACK_RHODECODE_EXT="${RC_STACK_RHODECODE_EXT:-.custom/docker-compose-apps.override.yaml}"
|
|
4086
|
export RC_STACK_RHODECODE_EXT="${RC_STACK_RHODECODE_EXT:-.custom/docker-compose-apps.override.yaml}"
|
|
4057
|
|
|
4087
|
|
|
4058
|
# :command.command_filter
|
|
4088
|
# :command.command_filter
|
|
4059
|
action=${1:-}
|
|
4089
|
action=${1:-}
|
|
4060
|
|
|
4090
|
|
|
4061
|
case $action in
|
|
4091
|
case $action in
|
|
4062
|
-*) ;;
|
|
4092
|
-*) ;;
|
|
4063
|
|
|
4093
|
|
|
4064
|
get-started)
|
|
4094
|
get-started)
|
|
4065
|
action="get-started"
|
|
4095
|
action="get-started"
|
|
4066
|
shift
|
|
4096
|
shift
|
|
4067
|
rcstack_get_started_parse_requirements "$@"
|
|
4097
|
rcstack_get_started_parse_requirements "$@"
|
|
4068
|
shift $#
|
|
4098
|
shift $#
|
|
4069
|
;;
|
|
4099
|
;;
|
|
4070
|
|
|
4100
|
|
|
4071
|
init)
|
|
4101
|
init)
|
|
4072
|
action="init"
|
|
4102
|
action="init"
|
|
4073
|
shift
|
|
4103
|
shift
|
|
4074
|
rcstack_init_parse_requirements "$@"
|
|
4104
|
rcstack_init_parse_requirements "$@"
|
|
4075
|
shift $#
|
|
4105
|
shift $#
|
|
4076
|
;;
|
|
4106
|
;;
|
|
4077
|
|
|
4107
|
|
|
4078
|
self-update)
|
|
4108
|
self-update)
|
|
4079
|
action="self-update"
|
|
4109
|
action="self-update"
|
|
4080
|
shift
|
|
4110
|
shift
|
|
4081
|
rcstack_self_update_parse_requirements "$@"
|
|
4111
|
rcstack_self_update_parse_requirements "$@"
|
|
4082
|
shift $#
|
|
4112
|
shift $#
|
|
4083
|
;;
|
|
4113
|
;;
|
|
4084
|
|
|
4114
|
|
|
4085
|
stack)
|
|
4115
|
stack)
|
|
4086
|
action="stack"
|
|
4116
|
action="stack"
|
|
4087
|
shift
|
|
4117
|
shift
|
|
4088
|
rcstack_stack_parse_requirements "$@"
|
|
4118
|
rcstack_stack_parse_requirements "$@"
|
|
4089
|
shift $#
|
|
4119
|
shift $#
|
|
4090
|
;;
|
|
4120
|
;;
|
|
4091
|
|
|
4121
|
|
|
4092
|
stack-status | status)
|
|
4122
|
stack-status | status)
|
|
4093
|
action="stack-status"
|
|
4123
|
action="stack-status"
|
|
4094
|
shift
|
|
4124
|
shift
|
|
4095
|
rcstack_stack_status_parse_requirements "$@"
|
|
4125
|
rcstack_stack_status_parse_requirements "$@"
|
|
4096
|
shift $#
|
|
4126
|
shift $#
|
|
4097
|
;;
|
|
4127
|
;;
|
|
4098
|
|
|
4128
|
|
|
4099
|
stack-upgrade)
|
|
4129
|
stack-upgrade)
|
|
4100
|
action="stack-upgrade"
|
|
4130
|
action="stack-upgrade"
|
|
4101
|
shift
|
|
4131
|
shift
|
|
4102
|
rcstack_stack_upgrade_parse_requirements "$@"
|
|
4132
|
rcstack_stack_upgrade_parse_requirements "$@"
|
|
4103
|
shift $#
|
|
4133
|
shift $#
|
|
4104
|
;;
|
|
4134
|
;;
|
|
4105
|
|
|
4135
|
|
|
4106
|
stack-monitor)
|
|
4136
|
stack-monitor)
|
|
4107
|
action="stack-monitor"
|
|
4137
|
action="stack-monitor"
|
|
4108
|
shift
|
|
4138
|
shift
|
|
4109
|
rcstack_stack_monitor_parse_requirements "$@"
|
|
4139
|
rcstack_stack_monitor_parse_requirements "$@"
|
|
4110
|
shift $#
|
|
4140
|
shift $#
|
|
4111
|
;;
|
|
4141
|
;;
|
|
4112
|
|
|
4142
|
|
|
4113
|
cli)
|
|
4143
|
cli)
|
|
4114
|
action="cli"
|
|
4144
|
action="cli"
|
|
4115
|
shift
|
|
4145
|
shift
|
|
4116
|
rcstack_cli_parse_requirements "$@"
|
|
4146
|
rcstack_cli_parse_requirements "$@"
|
|
4117
|
shift $#
|
|
4147
|
shift $#
|
|
4118
|
;;
|
|
4148
|
;;
|
|
4119
|
|
|
4149
|
|
|
4120
|
backup-db)
|
|
4150
|
backup-db)
|
|
4121
|
action="backup-db"
|
|
4151
|
action="backup-db"
|
|
4122
|
shift
|
|
4152
|
shift
|
|
4123
|
rcstack_backup_db_parse_requirements "$@"
|
|
4153
|
rcstack_backup_db_parse_requirements "$@"
|
|
4124
|
shift $#
|
|
4154
|
shift $#
|
|
4125
|
;;
|
|
4155
|
;;
|
|
4126
|
|
|
4156
|
|
|
4127
|
backup-data)
|
|
4157
|
backup-data)
|
|
4128
|
action="backup-data"
|
|
4158
|
action="backup-data"
|
|
4129
|
shift
|
|
4159
|
shift
|
|
4130
|
rcstack_backup_data_parse_requirements "$@"
|
|
4160
|
rcstack_backup_data_parse_requirements "$@"
|
|
4131
|
shift $#
|
|
4161
|
shift $#
|
|
4132
|
;;
|
|
4162
|
;;
|
|
4133
|
|
|
4163
|
|
|
4134
|
get-build-artifacts)
|
|
4164
|
get-build-artifacts)
|
|
4135
|
action="get-build-artifacts"
|
|
4165
|
action="get-build-artifacts"
|
|
4136
|
shift
|
|
4166
|
shift
|
|
4137
|
rcstack_get_build_artifacts_parse_requirements "$@"
|
|
4167
|
rcstack_get_build_artifacts_parse_requirements "$@"
|
|
4138
|
shift $#
|
|
4168
|
shift $#
|
|
4139
|
;;
|
|
4169
|
;;
|
|
4140
|
|
|
4170
|
|
|
4141
|
build-installer)
|
|
4171
|
build-installer)
|
|
4142
|
action="build-installer"
|
|
4172
|
action="build-installer"
|
|
4143
|
shift
|
|
4173
|
shift
|
|
4144
|
rcstack_build_installer_parse_requirements "$@"
|
|
4174
|
rcstack_build_installer_parse_requirements "$@"
|
|
4145
|
shift $#
|
|
4175
|
shift $#
|
|
4146
|
;;
|
|
4176
|
;;
|
|
4147
|
|
|
4177
|
|
|
4148
|
get-build-source)
|
|
4178
|
get-build-source)
|
|
4149
|
action="get-build-source"
|
|
4179
|
action="get-build-source"
|
|
4150
|
shift
|
|
4180
|
shift
|
|
4151
|
rcstack_get_build_source_parse_requirements "$@"
|
|
4181
|
rcstack_get_build_source_parse_requirements "$@"
|
|
4152
|
shift $#
|
|
4182
|
shift $#
|
|
4153
|
;;
|
|
4183
|
;;
|
|
4154
|
|
|
4184
|
|
|
4155
|
build-source)
|
|
4185
|
build-source)
|
|
4156
|
action="build-source"
|
|
4186
|
action="build-source"
|
|
4157
|
shift
|
|
4187
|
shift
|
|
4158
|
rcstack_build_source_parse_requirements "$@"
|
|
4188
|
rcstack_build_source_parse_requirements "$@"
|
|
4159
|
shift $#
|
|
4189
|
shift $#
|
|
4160
|
;;
|
|
4190
|
;;
|
|
4161
|
|
|
4191
|
|
|
4162
|
_completions)
|
|
4192
|
_completions)
|
|
4163
|
action="_completions"
|
|
4193
|
action="_completions"
|
|
4164
|
shift
|
|
4194
|
shift
|
|
4165
|
rcstack__completions_parse_requirements "$@"
|
|
4195
|
rcstack__completions_parse_requirements "$@"
|
|
4166
|
shift $#
|
|
4196
|
shift $#
|
|
4167
|
;;
|
|
4197
|
;;
|
|
4168
|
|
|
4198
|
|
|
4169
|
# :command.command_fallback
|
|
4199
|
# :command.command_fallback
|
|
4170
|
"")
|
|
4200
|
"")
|
|
4171
|
rcstack_usage >&2
|
|
4201
|
rcstack_usage >&2
|
|
4172
|
exit 1
|
|
4202
|
exit 1
|
|
4173
|
;;
|
|
4203
|
;;
|
|
4174
|
|
|
4204
|
|
|
4175
|
*)
|
|
4205
|
*)
|
|
4176
|
printf "invalid command: %s\n" "$action" >&2
|
|
4206
|
printf "invalid command: %s\n" "$action" >&2
|
|
4177
|
exit 1
|
|
4207
|
exit 1
|
|
4178
|
;;
|
|
4208
|
;;
|
|
4179
|
|
|
4209
|
|
|
4180
|
esac
|
|
4210
|
esac
|
|
4181
|
|
|
4211
|
|
|
4182
|
# :command.parse_requirements_while
|
|
4212
|
# :command.parse_requirements_while
|
|
4183
|
while [[ $# -gt 0 ]]; do
|
|
4213
|
while [[ $# -gt 0 ]]; do
|
|
4184
|
key="$1"
|
|
4214
|
key="$1"
|
|
4185
|
case "$key" in
|
|
4215
|
case "$key" in
|
|
4186
|
|
|
4216
|
|
|
4187
|
-?*)
|
|
4217
|
-?*)
|
|
4188
|
printf "invalid option: %s\n" "$key" >&2
|
|
4218
|
printf "invalid option: %s\n" "$key" >&2
|
|
4189
|
exit 1
|
|
4219
|
exit 1
|
|
4190
|
;;
|
|
4220
|
;;
|
|
4191
|
|
|
4221
|
|
|
4192
|
*)
|
|
4222
|
*)
|
|
4193
|
# :command.parse_requirements_case
|
|
4223
|
# :command.parse_requirements_case
|
|
4194
|
# :command.parse_requirements_case_simple
|
|
4224
|
# :command.parse_requirements_case_simple
|
|
4195
|
printf "invalid argument: %s\n" "$key" >&2
|
|
4225
|
printf "invalid argument: %s\n" "$key" >&2
|
|
4196
|
exit 1
|
|
4226
|
exit 1
|
|
4197
|
|
|
4227
|
|
|
4198
|
;;
|
|
4228
|
;;
|
|
4199
|
|
|
4229
|
|
|
4200
|
esac
|
|
4230
|
esac
|
|
4201
|
done
|
|
4231
|
done
|
|
4202
|
|
|
4232
|
|
|
4203
|
}
|
|
4233
|
}
|
|
4204
|
|
|
4234
|
|
|
4205
|
# :command.parse_requirements
|
|
4235
|
# :command.parse_requirements
|
|
4206
|
rcstack_get_started_parse_requirements() {
|
|
4236
|
rcstack_get_started_parse_requirements() {
|
|
4207
|
# :command.fixed_flags_filter
|
|
4237
|
# :command.fixed_flags_filter
|
|
4208
|
while [[ $# -gt 0 ]]; do
|
|
4238
|
while [[ $# -gt 0 ]]; do
|
|
4209
|
case "${1:-}" in
|
|
4239
|
case "${1:-}" in
|
|
4210
|
--help | -h)
|
|
4240
|
--help | -h)
|
|
4211
|
long_usage=yes
|
|
4241
|
long_usage=yes
|
|
4212
|
rcstack_get_started_usage
|
|
4242
|
rcstack_get_started_usage
|
|
4213
|
exit
|
|
4243
|
exit
|
|
4214
|
;;
|
|
4244
|
;;
|
|
4215
|
|
|
4245
|
|
|
4216
|
*)
|
|
4246
|
*)
|
|
4217
|
break
|
|
4247
|
break
|
|
4218
|
;;
|
|
4248
|
;;
|
|
4219
|
|
|
4249
|
|
|
4220
|
esac
|
|
4250
|
esac
|
|
4221
|
done
|
|
4251
|
done
|
|
4222
|
|
|
4252
|
|
|
4223
|
# :command.command_filter
|
|
4253
|
# :command.command_filter
|
|
4224
|
action="get-started"
|
|
4254
|
action="get-started"
|
|
4225
|
|
|
4255
|
|
|
4226
|
# :command.parse_requirements_while
|
|
4256
|
# :command.parse_requirements_while
|
|
4227
|
while [[ $# -gt 0 ]]; do
|
|
4257
|
while [[ $# -gt 0 ]]; do
|
|
4228
|
key="$1"
|
|
4258
|
key="$1"
|
|
4229
|
case "$key" in
|
|
4259
|
case "$key" in
|
|
4230
|
|
|
4260
|
|
|
4231
|
-?*)
|
|
4261
|
-?*)
|
|
4232
|
printf "invalid option: %s\n" "$key" >&2
|
|
4262
|
printf "invalid option: %s\n" "$key" >&2
|
|
4233
|
exit 1
|
|
4263
|
exit 1
|
|
4234
|
;;
|
|
4264
|
;;
|
|
4235
|
|
|
4265
|
|
|
4236
|
*)
|
|
4266
|
*)
|
|
4237
|
# :command.parse_requirements_case
|
|
4267
|
# :command.parse_requirements_case
|
|
4238
|
# :command.parse_requirements_case_simple
|
|
4268
|
# :command.parse_requirements_case_simple
|
|
4239
|
printf "invalid argument: %s\n" "$key" >&2
|
|
4269
|
printf "invalid argument: %s\n" "$key" >&2
|
|
4240
|
exit 1
|
|
4270
|
exit 1
|
|
4241
|
|
|
4271
|
|
|
4242
|
;;
|
|
4272
|
;;
|
|
4243
|
|
|
4273
|
|
|
4244
|
esac
|
|
4274
|
esac
|
|
4245
|
done
|
|
4275
|
done
|
|
4246
|
|
|
4276
|
|
|
4247
|
}
|
|
4277
|
}
|
|
4248
|
|
|
4278
|
|
|
4249
|
# :command.parse_requirements
|
|
4279
|
# :command.parse_requirements
|
|
4250
|
rcstack_init_parse_requirements() {
|
|
4280
|
rcstack_init_parse_requirements() {
|
|
4251
|
# :command.fixed_flags_filter
|
|
4281
|
# :command.fixed_flags_filter
|
|
4252
|
while [[ $# -gt 0 ]]; do
|
|
4282
|
while [[ $# -gt 0 ]]; do
|
|
4253
|
case "${1:-}" in
|
|
4283
|
case "${1:-}" in
|
|
4254
|
--help | -h)
|
|
4284
|
--help | -h)
|
|
4255
|
long_usage=yes
|
|
4285
|
long_usage=yes
|
|
4256
|
rcstack_init_usage
|
|
4286
|
rcstack_init_usage
|
|
4257
|
exit
|
|
4287
|
exit
|
|
4258
|
;;
|
|
4288
|
;;
|
|
4259
|
|
|
4289
|
|
|
4260
|
*)
|
|
4290
|
*)
|
|
4261
|
break
|
|
4291
|
break
|
|
4262
|
;;
|
|
4292
|
;;
|
|
4263
|
|
|
4293
|
|
|
4264
|
esac
|
|
4294
|
esac
|
|
4265
|
done
|
|
4295
|
done
|
|
4266
|
|
|
4296
|
|
|
4267
|
# :command.dependencies_filter
|
|
4297
|
# :command.dependencies_filter
|
|
4268
|
if command -v curl >/dev/null 2>&1; then
|
|
4298
|
if command -v curl >/dev/null 2>&1; then
|
|
4269
|
deps['curl']="$(command -v curl | head -n1)"
|
|
4299
|
deps['curl']="$(command -v curl | head -n1)"
|
|
4270
|
else
|
|
4300
|
else
|
|
4271
|
printf "missing dependency: curl\n" >&2
|
|
4301
|
printf "missing dependency: curl\n" >&2
|
|
4272
|
exit 1
|
|
4302
|
exit 1
|
|
4273
|
fi
|
|
4303
|
fi
|
|
4274
|
|
|
4304
|
|
|
4275
|
if command -v tar >/dev/null 2>&1; then
|
|
4305
|
if command -v tar >/dev/null 2>&1; then
|
|
4276
|
deps['tar']="$(command -v tar | head -n1)"
|
|
4306
|
deps['tar']="$(command -v tar | head -n1)"
|
|
4277
|
else
|
|
4307
|
else
|
|
4278
|
printf "missing dependency: tar\n" >&2
|
|
4308
|
printf "missing dependency: tar\n" >&2
|
|
4279
|
exit 1
|
|
4309
|
exit 1
|
|
4280
|
fi
|
|
4310
|
fi
|
|
4281
|
|
|
4311
|
|
|
4282
|
if command -v find >/dev/null 2>&1; then
|
|
4312
|
if command -v find >/dev/null 2>&1; then
|
|
4283
|
deps['find']="$(command -v find | head -n1)"
|
|
4313
|
deps['find']="$(command -v find | head -n1)"
|
|
4284
|
else
|
|
4314
|
else
|
|
4285
|
printf "missing dependency: find\n" >&2
|
|
4315
|
printf "missing dependency: find\n" >&2
|
|
4286
|
exit 1
|
|
4316
|
exit 1
|
|
4287
|
fi
|
|
4317
|
fi
|
|
4288
|
|
|
4318
|
|
|
4289
|
# :command.command_filter
|
|
4319
|
# :command.command_filter
|
|
4290
|
action="init"
|
|
4320
|
action="init"
|
|
4291
|
|
|
4321
|
|
|
4292
|
# :command.parse_requirements_while
|
|
4322
|
# :command.parse_requirements_while
|
|
4293
|
while [[ $# -gt 0 ]]; do
|
|
4323
|
while [[ $# -gt 0 ]]; do
|
|
4294
|
key="$1"
|
|
4324
|
key="$1"
|
|
4295
|
case "$key" in
|
|
4325
|
case "$key" in
|
|
4296
|
# :flag.case
|
|
4326
|
# :flag.case
|
|
4297
|
--arg-rc-edition)
|
|
4327
|
--arg-rc-edition)
|
|
4298
|
|
|
4328
|
|
|
4299
|
# :flag.case_arg
|
|
4329
|
# :flag.case_arg
|
|
4300
|
if [[ -n ${2+x} ]]; then
|
|
4330
|
if [[ -n ${2+x} ]]; then
|
|
4301
|
|
|
4331
|
|
|
4302
|
args['--arg-rc-edition']="$2"
|
|
4332
|
args['--arg-rc-edition']="$2"
|
|
4303
|
shift
|
|
4333
|
shift
|
|
4304
|
shift
|
|
4334
|
shift
|
|
4305
|
else
|
|
4335
|
else
|
|
4306
|
printf "%s\n" "--arg-rc-edition requires an argument: --arg-rc-edition ARG_RC_EDITION" >&2
|
|
4336
|
printf "%s\n" "--arg-rc-edition requires an argument: --arg-rc-edition ARG_RC_EDITION" >&2
|
|
4307
|
exit 1
|
|
4337
|
exit 1
|
|
4308
|
fi
|
|
4338
|
fi
|
|
4309
|
;;
|
|
4339
|
;;
|
|
4310
|
|
|
4340
|
|
|
4311
|
# :flag.case
|
|
4341
|
# :flag.case
|
|
4312
|
--arg-hostname)
|
|
4342
|
--arg-hostname)
|
|
4313
|
|
|
4343
|
|
|
4314
|
# :flag.case_arg
|
|
4344
|
# :flag.case_arg
|
|
4315
|
if [[ -n ${2+x} ]]; then
|
|
4345
|
if [[ -n ${2+x} ]]; then
|
|
4316
|
|
|
4346
|
|
|
4317
|
args['--arg-hostname']="$2"
|
|
4347
|
args['--arg-hostname']="$2"
|
|
4318
|
shift
|
|
4348
|
shift
|
|
4319
|
shift
|
|
4349
|
shift
|
|
4320
|
else
|
|
4350
|
else
|
|
4321
|
printf "%s\n" "--arg-hostname requires an argument: --arg-hostname ARG_HOSTNAME" >&2
|
|
4351
|
printf "%s\n" "--arg-hostname requires an argument: --arg-hostname ARG_HOSTNAME" >&2
|
|
4322
|
exit 1
|
|
4352
|
exit 1
|
|
4323
|
fi
|
|
4353
|
fi
|
|
4324
|
;;
|
|
4354
|
;;
|
|
4325
|
|
|
4355
|
|
|
4326
|
# :flag.case
|
|
4356
|
# :flag.case
|
|
4327
|
--arg-use-ssl)
|
|
4357
|
--arg-use-ssl)
|
|
4328
|
|
|
4358
|
|
|
4329
|
# :flag.case_arg
|
|
4359
|
# :flag.case_arg
|
|
4330
|
if [[ -n ${2+x} ]]; then
|
|
4360
|
if [[ -n ${2+x} ]]; then
|
|
4331
|
|
|
4361
|
|
|
4332
|
args['--arg-use-ssl']="$2"
|
|
4362
|
args['--arg-use-ssl']="$2"
|
|
4333
|
shift
|
|
4363
|
shift
|
|
4334
|
shift
|
|
4364
|
shift
|
|
4335
|
else
|
|
4365
|
else
|
|
4336
|
printf "%s\n" "--arg-use-ssl requires an argument: --arg-use-ssl ARG_USE_SSL" >&2
|
|
4366
|
printf "%s\n" "--arg-use-ssl requires an argument: --arg-use-ssl ARG_USE_SSL" >&2
|
|
4337
|
exit 1
|
|
4367
|
exit 1
|
|
4338
|
fi
|
|
4368
|
fi
|
|
4339
|
;;
|
|
4369
|
;;
|
|
4340
|
|
|
4370
|
|
|
4341
|
# :flag.case
|
|
4371
|
# :flag.case
|
|
4342
|
--arg-admin-email)
|
|
4372
|
--arg-admin-email)
|
|
4343
|
|
|
4373
|
|
|
4344
|
# :flag.case_arg
|
|
4374
|
# :flag.case_arg
|
|
4345
|
if [[ -n ${2+x} ]]; then
|
|
4375
|
if [[ -n ${2+x} ]]; then
|
|
4346
|
|
|
4376
|
|
|
4347
|
args['--arg-admin-email']="$2"
|
|
4377
|
args['--arg-admin-email']="$2"
|
|
4348
|
shift
|
|
4378
|
shift
|
|
4349
|
shift
|
|
4379
|
shift
|
|
4350
|
else
|
|
4380
|
else
|
|
4351
|
printf "%s\n" "--arg-admin-email requires an argument: --arg-admin-email ARG_ADMIN_EMAIL" >&2
|
|
4381
|
printf "%s\n" "--arg-admin-email requires an argument: --arg-admin-email ARG_ADMIN_EMAIL" >&2
|
|
4352
|
exit 1
|
|
4382
|
exit 1
|
|
4353
|
fi
|
|
4383
|
fi
|
|
4354
|
;;
|
|
4384
|
;;
|
|
4355
|
|
|
4385
|
|
|
4356
|
# :flag.case
|
|
4386
|
# :flag.case
|
|
4357
|
--arg-admin-user)
|
|
4387
|
--arg-admin-user)
|
|
4358
|
|
|
4388
|
|
|
4359
|
# :flag.case_arg
|
|
4389
|
# :flag.case_arg
|
|
4360
|
if [[ -n ${2+x} ]]; then
|
|
4390
|
if [[ -n ${2+x} ]]; then
|
|
4361
|
|
|
4391
|
|
|
4362
|
args['--arg-admin-user']="$2"
|
|
4392
|
args['--arg-admin-user']="$2"
|
|
4363
|
shift
|
|
4393
|
shift
|
|
4364
|
shift
|
|
4394
|
shift
|
|
4365
|
else
|
|
4395
|
else
|
|
4366
|
printf "%s\n" "--arg-admin-user requires an argument: --arg-admin-user ARG_ADMIN_USER" >&2
|
|
4396
|
printf "%s\n" "--arg-admin-user requires an argument: --arg-admin-user ARG_ADMIN_USER" >&2
|
|
4367
|
exit 1
|
|
4397
|
exit 1
|
|
4368
|
fi
|
|
4398
|
fi
|
|
4369
|
;;
|
|
4399
|
;;
|
|
4370
|
|
|
4400
|
|
|
4371
|
# :flag.case
|
|
4401
|
# :flag.case
|
|
4372
|
--arg-admin-pass)
|
|
4402
|
--arg-admin-pass)
|
|
4373
|
|
|
4403
|
|
|
4374
|
# :flag.case_arg
|
|
4404
|
# :flag.case_arg
|
|
4375
|
if [[ -n ${2+x} ]]; then
|
|
4405
|
if [[ -n ${2+x} ]]; then
|
|
4376
|
|
|
4406
|
|
|
4377
|
args['--arg-admin-pass']="$2"
|
|
4407
|
args['--arg-admin-pass']="$2"
|
|
4378
|
shift
|
|
4408
|
shift
|
|
4379
|
shift
|
|
4409
|
shift
|
|
4380
|
else
|
|
4410
|
else
|
|
4381
|
printf "%s\n" "--arg-admin-pass requires an argument: --arg-admin-pass ARG_ADMIN_PASS" >&2
|
|
4411
|
printf "%s\n" "--arg-admin-pass requires an argument: --arg-admin-pass ARG_ADMIN_PASS" >&2
|
|
4382
|
exit 1
|
|
4412
|
exit 1
|
|
4383
|
fi
|
|
4413
|
fi
|
|
4384
|
;;
|
|
4414
|
;;
|
|
4385
|
|
|
4415
|
|
|
4386
|
# :flag.case
|
|
4416
|
# :flag.case
|
|
4387
|
--arg-license-token)
|
|
4417
|
--arg-license-token)
|
|
4388
|
|
|
4418
|
|
|
4389
|
# :flag.case_arg
|
|
4419
|
# :flag.case_arg
|
|
4390
|
if [[ -n ${2+x} ]]; then
|
|
4420
|
if [[ -n ${2+x} ]]; then
|
|
4391
|
|
|
4421
|
|
|
4392
|
args['--arg-license-token']="$2"
|
|
4422
|
args['--arg-license-token']="$2"
|
|
4393
|
shift
|
|
4423
|
shift
|
|
4394
|
shift
|
|
4424
|
shift
|
|
4395
|
else
|
|
4425
|
else
|
|
4396
|
printf "%s\n" "--arg-license-token requires an argument: --arg-license-token ARG_ADMIN_TOKEN" >&2
|
|
4426
|
printf "%s\n" "--arg-license-token requires an argument: --arg-license-token ARG_ADMIN_TOKEN" >&2
|
|
4397
|
exit 1
|
|
4427
|
exit 1
|
|
4398
|
fi
|
|
4428
|
fi
|
|
4399
|
;;
|
|
4429
|
;;
|
|
4400
|
|
|
4430
|
|
|
4401
|
# :flag.case
|
|
4431
|
# :flag.case
|
|
4402
|
--no-prompt)
|
|
4432
|
--no-prompt)
|
|
4403
|
|
|
4433
|
|
|
4404
|
# :flag.case_no_arg
|
|
4434
|
# :flag.case_no_arg
|
|
4405
|
args['--no-prompt']=1
|
|
4435
|
args['--no-prompt']=1
|
|
4406
|
shift
|
|
4436
|
shift
|
|
4407
|
;;
|
|
4437
|
;;
|
|
4408
|
|
|
4438
|
|
|
4409
|
# :flag.case
|
|
4439
|
# :flag.case
|
|
4410
|
--force | -f)
|
|
4440
|
--force | -f)
|
|
4411
|
|
|
4441
|
|
|
4412
|
# :flag.case_no_arg
|
|
4442
|
# :flag.case_no_arg
|
|
4413
|
args['--force']=1
|
|
4443
|
args['--force']=1
|
|
4414
|
shift
|
|
4444
|
shift
|
|
4415
|
;;
|
|
4445
|
;;
|
|
4416
|
|
|
4446
|
|
|
4417
|
# :flag.case
|
|
4447
|
# :flag.case
|
|
4418
|
--stage)
|
|
4448
|
--stage)
|
|
4419
|
|
|
4449
|
|
|
4420
|
# :flag.case_arg
|
|
4450
|
# :flag.case_arg
|
|
4421
|
if [[ -n ${2+x} ]]; then
|
|
4451
|
if [[ -n ${2+x} ]]; then
|
|
4422
|
|
|
4452
|
|
|
4423
|
if [[ -z ${args['--stage']+x} ]]; then
|
|
4453
|
if [[ -z ${args['--stage']+x} ]]; then
|
|
4424
|
args['--stage']="\"$2\""
|
|
4454
|
args['--stage']="\"$2\""
|
|
4425
|
else
|
|
4455
|
else
|
|
4426
|
args['--stage']="${args[--stage]} \"$2\""
|
|
4456
|
args['--stage']="${args[--stage]} \"$2\""
|
|
4427
|
fi
|
|
4457
|
fi
|
|
4428
|
shift
|
|
4458
|
shift
|
|
4429
|
shift
|
|
4459
|
shift
|
|
4430
|
else
|
|
4460
|
else
|
|
4431
|
printf "%s\n" "--stage requires an argument: --stage STAGE" >&2
|
|
4461
|
printf "%s\n" "--stage requires an argument: --stage STAGE" >&2
|
|
4432
|
exit 1
|
|
4462
|
exit 1
|
|
4433
|
fi
|
|
4463
|
fi
|
|
4434
|
;;
|
|
4464
|
;;
|
|
4435
|
|
|
4465
|
|
|
4436
|
# :flag.case
|
|
4466
|
# :flag.case
|
|
4437
|
--auth-token)
|
|
4467
|
--auth-token)
|
|
4438
|
|
|
4468
|
|
|
4439
|
# :flag.case_arg
|
|
4469
|
# :flag.case_arg
|
|
4440
|
if [[ -n ${2+x} ]]; then
|
|
4470
|
if [[ -n ${2+x} ]]; then
|
|
4441
|
|
|
4471
|
|
|
4442
|
args['--auth-token']="$2"
|
|
4472
|
args['--auth-token']="$2"
|
|
4443
|
shift
|
|
4473
|
shift
|
|
4444
|
shift
|
|
4474
|
shift
|
|
4445
|
else
|
|
4475
|
else
|
|
4446
|
printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2
|
|
4476
|
printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2
|
|
4447
|
exit 1
|
|
4477
|
exit 1
|
|
4448
|
fi
|
|
4478
|
fi
|
|
4449
|
;;
|
|
4479
|
;;
|
|
4450
|
|
|
4480
|
|
|
4451
|
# :flag.case
|
|
4481
|
# :flag.case
|
|
4452
|
--server-url)
|
|
4482
|
--server-url)
|
|
4453
|
|
|
4483
|
|
|
4454
|
# :flag.case_arg
|
|
4484
|
# :flag.case_arg
|
|
4455
|
if [[ -n ${2+x} ]]; then
|
|
4485
|
if [[ -n ${2+x} ]]; then
|
|
4456
|
|
|
4486
|
|
|
4457
|
args['--server-url']="$2"
|
|
4487
|
args['--server-url']="$2"
|
|
4458
|
shift
|
|
4488
|
shift
|
|
4459
|
shift
|
|
4489
|
shift
|
|
4460
|
else
|
|
4490
|
else
|
|
4461
|
printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2
|
|
4491
|
printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2
|
|
4462
|
exit 1
|
|
4492
|
exit 1
|
|
4463
|
fi
|
|
4493
|
fi
|
|
4464
|
;;
|
|
4494
|
;;
|
|
4465
|
|
|
4495
|
|
|
4466
|
# :flag.case
|
|
4496
|
# :flag.case
|
|
4467
|
--docker-revision)
|
|
4497
|
--docker-revision)
|
|
4468
|
|
|
4498
|
|
|
4469
|
# :flag.case_arg
|
|
4499
|
# :flag.case_arg
|
|
4470
|
if [[ -n ${2+x} ]]; then
|
|
4500
|
if [[ -n ${2+x} ]]; then
|
|
4471
|
|
|
4501
|
|
|
4472
|
args['--docker-revision']="$2"
|
|
4502
|
args['--docker-revision']="$2"
|
|
4473
|
shift
|
|
4503
|
shift
|
|
4474
|
shift
|
|
4504
|
shift
|
|
4475
|
else
|
|
4505
|
else
|
|
4476
|
printf "%s\n" "--docker-revision requires an argument: --docker-revision DOCKER_REVISION" >&2
|
|
4506
|
printf "%s\n" "--docker-revision requires an argument: --docker-revision DOCKER_REVISION" >&2
|
|
4477
|
exit 1
|
|
4507
|
exit 1
|
|
4478
|
fi
|
|
4508
|
fi
|
|
4479
|
;;
|
|
4509
|
;;
|
|
4480
|
|
|
4510
|
|
|
4481
|
# :flag.case
|
|
4511
|
# :flag.case
|
|
4482
|
--install-docker)
|
|
4512
|
--install-docker)
|
|
4483
|
|
|
4513
|
|
|
4484
|
# :flag.case_arg
|
|
4514
|
# :flag.case_arg
|
|
4485
|
if [[ -n ${2+x} ]]; then
|
|
4515
|
if [[ -n ${2+x} ]]; then
|
|
4486
|
|
|
4516
|
|
|
4487
|
args['--install-docker']="$2"
|
|
4517
|
args['--install-docker']="$2"
|
|
4488
|
shift
|
|
4518
|
shift
|
|
4489
|
shift
|
|
4519
|
shift
|
|
4490
|
else
|
|
4520
|
else
|
|
4491
|
printf "%s\n" "--install-docker requires an argument: --install-docker INSTALL_DOCKER" >&2
|
|
4521
|
printf "%s\n" "--install-docker requires an argument: --install-docker INSTALL_DOCKER" >&2
|
|
4492
|
exit 1
|
|
4522
|
exit 1
|
|
4493
|
fi
|
|
4523
|
fi
|
|
4494
|
;;
|
|
4524
|
;;
|
|
4495
|
|
|
4525
|
|
|
4496
|
-?*)
|
|
4526
|
-?*)
|
|
4497
|
printf "invalid option: %s\n" "$key" >&2
|
|
4527
|
printf "invalid option: %s\n" "$key" >&2
|
|
4498
|
exit 1
|
|
4528
|
exit 1
|
|
4499
|
;;
|
|
4529
|
;;
|
|
4500
|
|
|
4530
|
|
|
4501
|
*)
|
|
4531
|
*)
|
|
4502
|
# :command.parse_requirements_case
|
|
4532
|
# :command.parse_requirements_case
|
|
4503
|
# :command.parse_requirements_case_simple
|
|
4533
|
# :command.parse_requirements_case_simple
|
|
4504
|
printf "invalid argument: %s\n" "$key" >&2
|
|
4534
|
printf "invalid argument: %s\n" "$key" >&2
|
|
4505
|
exit 1
|
|
4535
|
exit 1
|
|
4506
|
|
|
4536
|
|
|
4507
|
;;
|
|
4537
|
;;
|
|
4508
|
|
|
4538
|
|
|
4509
|
esac
|
|
4539
|
esac
|
|
4510
|
done
|
|
4540
|
done
|
|
4511
|
|
|
4541
|
|
|
4512
|
# :command.default_assignments
|
|
4542
|
# :command.default_assignments
|
|
4513
|
[[ -n ${args['--server-url']:-} ]] || args['--server-url']="https://code.rhodecode.com"
|
|
4543
|
[[ -n ${args['--server-url']:-} ]] || args['--server-url']="https://code.rhodecode.com"
|
|
4514
|
[[ -n ${args['--docker-revision']:-} ]] || args['--docker-revision']="master"
|
|
4544
|
[[ -n ${args['--docker-revision']:-} ]] || args['--docker-revision']="master"
|
|
4515
|
|
|
4545
|
|
|
4516
|
}
|
|
4546
|
}
|
|
4517
|
|
|
4547
|
|
|
4518
|
# :command.parse_requirements
|
|
4548
|
# :command.parse_requirements
|
|
4519
|
rcstack_self_update_parse_requirements() {
|
|
4549
|
rcstack_self_update_parse_requirements() {
|
|
4520
|
# :command.fixed_flags_filter
|
|
4550
|
# :command.fixed_flags_filter
|
|
4521
|
while [[ $# -gt 0 ]]; do
|
|
4551
|
while [[ $# -gt 0 ]]; do
|
|
4522
|
case "${1:-}" in
|
|
4552
|
case "${1:-}" in
|
|
4523
|
--help | -h)
|
|
4553
|
--help | -h)
|
|
4524
|
long_usage=yes
|
|
4554
|
long_usage=yes
|
|
4525
|
rcstack_self_update_usage
|
|
4555
|
rcstack_self_update_usage
|
|
4526
|
exit
|
|
4556
|
exit
|
|
4527
|
;;
|
|
4557
|
;;
|
|
4528
|
|
|
4558
|
|
|
4529
|
*)
|
|
4559
|
*)
|
|
4530
|
break
|
|
4560
|
break
|
|
4531
|
;;
|
|
4561
|
;;
|
|
4532
|
|
|
4562
|
|
|
4533
|
esac
|
|
4563
|
esac
|
|
4534
|
done
|
|
4564
|
done
|
|
4535
|
|
|
4565
|
|
|
4536
|
# :command.dependencies_filter
|
|
4566
|
# :command.dependencies_filter
|
|
4537
|
if command -v curl >/dev/null 2>&1; then
|
|
4567
|
if command -v curl >/dev/null 2>&1; then
|
|
4538
|
deps['curl']="$(command -v curl | head -n1)"
|
|
4568
|
deps['curl']="$(command -v curl | head -n1)"
|
|
4539
|
else
|
|
4569
|
else
|
|
4540
|
printf "missing dependency: curl\n" >&2
|
|
4570
|
printf "missing dependency: curl\n" >&2
|
|
4541
|
exit 1
|
|
4571
|
exit 1
|
|
4542
|
fi
|
|
4572
|
fi
|
|
4543
|
|
|
4573
|
|
|
4544
|
if command -v tar >/dev/null 2>&1; then
|
|
4574
|
if command -v tar >/dev/null 2>&1; then
|
|
4545
|
deps['tar']="$(command -v tar | head -n1)"
|
|
4575
|
deps['tar']="$(command -v tar | head -n1)"
|
|
4546
|
else
|
|
4576
|
else
|
|
4547
|
printf "missing dependency: tar\n" >&2
|
|
4577
|
printf "missing dependency: tar\n" >&2
|
|
4548
|
exit 1
|
|
4578
|
exit 1
|
|
4549
|
fi
|
|
4579
|
fi
|
|
4550
|
|
|
4580
|
|
|
4551
|
# :command.command_filter
|
|
4581
|
# :command.command_filter
|
|
4552
|
action="self-update"
|
|
4582
|
action="self-update"
|
|
4553
|
|
|
4583
|
|
|
4554
|
# :command.parse_requirements_while
|
|
4584
|
# :command.parse_requirements_while
|
|
4555
|
while [[ $# -gt 0 ]]; do
|
|
4585
|
while [[ $# -gt 0 ]]; do
|
|
4556
|
key="$1"
|
|
4586
|
key="$1"
|
|
4557
|
case "$key" in
|
|
4587
|
case "$key" in
|
|
4558
|
# :flag.case
|
|
4588
|
# :flag.case
|
|
4559
|
--force)
|
|
4589
|
--force)
|
|
4560
|
|
|
4590
|
|
|
4561
|
# :flag.case_no_arg
|
|
4591
|
# :flag.case_no_arg
|
|
4562
|
args['--force']=1
|
|
4592
|
args['--force']=1
|
|
4563
|
shift
|
|
4593
|
shift
|
|
4564
|
;;
|
|
4594
|
;;
|
|
4565
|
|
|
4595
|
|
|
4566
|
# :flag.case
|
|
4596
|
# :flag.case
|
|
4567
|
--cli-revision)
|
|
4597
|
--cli-revision)
|
|
4568
|
|
|
4598
|
|
|
4569
|
# :flag.case_arg
|
|
4599
|
# :flag.case_arg
|
|
4570
|
if [[ -n ${2+x} ]]; then
|
|
4600
|
if [[ -n ${2+x} ]]; then
|
|
4571
|
|
|
4601
|
|
|
4572
|
args['--cli-revision']="$2"
|
|
4602
|
args['--cli-revision']="$2"
|
|
4573
|
shift
|
|
4603
|
shift
|
|
4574
|
shift
|
|
4604
|
shift
|
|
4575
|
else
|
|
4605
|
else
|
|
4576
|
printf "%s\n" "--cli-revision requires an argument: --cli-revision CLI_REVISION" >&2
|
|
4606
|
printf "%s\n" "--cli-revision requires an argument: --cli-revision CLI_REVISION" >&2
|
|
4577
|
exit 1
|
|
4607
|
exit 1
|
|
4578
|
fi
|
|
4608
|
fi
|
|
4579
|
;;
|
|
4609
|
;;
|
|
4580
|
|
|
4610
|
|
|
4581
|
# :flag.case
|
|
4611
|
# :flag.case
|
|
4582
|
--docker-revision)
|
|
4612
|
--docker-revision)
|
|
4583
|
|
|
4613
|
|
|
4584
|
# :flag.case_arg
|
|
4614
|
# :flag.case_arg
|
|
4585
|
if [[ -n ${2+x} ]]; then
|
|
4615
|
if [[ -n ${2+x} ]]; then
|
|
4586
|
|
|
4616
|
|
|
4587
|
args['--docker-revision']="$2"
|
|
4617
|
args['--docker-revision']="$2"
|
|
4588
|
shift
|
|
4618
|
shift
|
|
4589
|
shift
|
|
4619
|
shift
|
|
4590
|
else
|
|
4620
|
else
|
|
4591
|
printf "%s\n" "--docker-revision requires an argument: --docker-revision DOCKER_REVISION" >&2
|
|
4621
|
printf "%s\n" "--docker-revision requires an argument: --docker-revision DOCKER_REVISION" >&2
|
|
4592
|
exit 1
|
|
4622
|
exit 1
|
|
4593
|
fi
|
|
4623
|
fi
|
|
4594
|
;;
|
|
4624
|
;;
|
|
4595
|
|
|
4625
|
|
|
4596
|
# :flag.case
|
|
4626
|
# :flag.case
|
|
4597
|
--auth-token)
|
|
4627
|
--auth-token)
|
|
4598
|
|
|
4628
|
|
|
4599
|
# :flag.case_arg
|
|
4629
|
# :flag.case_arg
|
|
4600
|
if [[ -n ${2+x} ]]; then
|
|
4630
|
if [[ -n ${2+x} ]]; then
|
|
4601
|
|
|
4631
|
|
|
4602
|
args['--auth-token']="$2"
|
|
4632
|
args['--auth-token']="$2"
|
|
4603
|
shift
|
|
4633
|
shift
|
|
4604
|
shift
|
|
4634
|
shift
|
|
4605
|
else
|
|
4635
|
else
|
|
4606
|
printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2
|
|
4636
|
printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2
|
|
4607
|
exit 1
|
|
4637
|
exit 1
|
|
4608
|
fi
|
|
4638
|
fi
|
|
4609
|
;;
|
|
4639
|
;;
|
|
4610
|
|
|
4640
|
|
|
4611
|
# :flag.case
|
|
4641
|
# :flag.case
|
|
4612
|
--server-url)
|
|
4642
|
--server-url)
|
|
4613
|
|
|
4643
|
|
|
4614
|
# :flag.case_arg
|
|
4644
|
# :flag.case_arg
|
|
4615
|
if [[ -n ${2+x} ]]; then
|
|
4645
|
if [[ -n ${2+x} ]]; then
|
|
4616
|
|
|
4646
|
|
|
4617
|
args['--server-url']="$2"
|
|
4647
|
args['--server-url']="$2"
|
|
4618
|
shift
|
|
4648
|
shift
|
|
4619
|
shift
|
|
4649
|
shift
|
|
4620
|
else
|
|
4650
|
else
|
|
4621
|
printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2
|
|
4651
|
printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2
|
|
4622
|
exit 1
|
|
4652
|
exit 1
|
|
4623
|
fi
|
|
4653
|
fi
|
|
4624
|
;;
|
|
4654
|
;;
|
|
4625
|
|
|
4655
|
|
|
4626
|
-?*)
|
|
4656
|
-?*)
|
|
4627
|
printf "invalid option: %s\n" "$key" >&2
|
|
4657
|
printf "invalid option: %s\n" "$key" >&2
|
|
4628
|
exit 1
|
|
4658
|
exit 1
|
|
4629
|
;;
|
|
4659
|
;;
|
|
4630
|
|
|
4660
|
|
|
4631
|
*)
|
|
4661
|
*)
|
|
4632
|
# :command.parse_requirements_case
|
|
4662
|
# :command.parse_requirements_case
|
|
4633
|
# :command.parse_requirements_case_simple
|
|
4663
|
# :command.parse_requirements_case_simple
|
|
4634
|
printf "invalid argument: %s\n" "$key" >&2
|
|
4664
|
printf "invalid argument: %s\n" "$key" >&2
|
|
4635
|
exit 1
|
|
4665
|
exit 1
|
|
4636
|
|
|
4666
|
|
|
4637
|
;;
|
|
4667
|
;;
|
|
4638
|
|
|
4668
|
|
|
4639
|
esac
|
|
4669
|
esac
|
|
4640
|
done
|
|
4670
|
done
|
|
4641
|
|
|
4671
|
|
|
4642
|
# :command.default_assignments
|
|
4672
|
# :command.default_assignments
|
|
4643
|
[[ -n ${args['--cli-revision']:-} ]] || args['--cli-revision']="master"
|
|
4673
|
[[ -n ${args['--cli-revision']:-} ]] || args['--cli-revision']="master"
|
|
4644
|
[[ -n ${args['--docker-revision']:-} ]] || args['--docker-revision']="master"
|
|
4674
|
[[ -n ${args['--docker-revision']:-} ]] || args['--docker-revision']="master"
|
|
4645
|
[[ -n ${args['--server-url']:-} ]] || args['--server-url']="https://code.rhodecode.com"
|
|
4675
|
[[ -n ${args['--server-url']:-} ]] || args['--server-url']="https://code.rhodecode.com"
|
|
4646
|
|
|
4676
|
|
|
4647
|
}
|
|
4677
|
}
|
|
4648
|
|
|
4678
|
|
|
4649
|
# :command.parse_requirements
|
|
4679
|
# :command.parse_requirements
|
|
4650
|
rcstack_stack_parse_requirements() {
|
|
4680
|
rcstack_stack_parse_requirements() {
|
|
4651
|
# :command.fixed_flags_filter
|
|
4681
|
# :command.fixed_flags_filter
|
|
4652
|
while [[ $# -gt 0 ]]; do
|
|
4682
|
while [[ $# -gt 0 ]]; do
|
|
4653
|
case "${1:-}" in
|
|
4683
|
case "${1:-}" in
|
|
4654
|
--help | -h)
|
|
4684
|
--help | -h)
|
|
4655
|
long_usage=yes
|
|
4685
|
long_usage=yes
|
|
4656
|
rcstack_stack_usage
|
|
4686
|
rcstack_stack_usage
|
|
4657
|
exit
|
|
4687
|
exit
|
|
4658
|
;;
|
|
4688
|
;;
|
|
4659
|
|
|
4689
|
|
|
4660
|
# :flag.case
|
|
4690
|
# :flag.case
|
|
4661
|
--env-file-path)
|
|
4691
|
--env-file-path)
|
|
4662
|
|
|
4692
|
|
|
4663
|
# :flag.case_arg
|
|
4693
|
# :flag.case_arg
|
|
4664
|
if [[ -n ${2+x} ]]; then
|
|
4694
|
if [[ -n ${2+x} ]]; then
|
|
4665
|
# :flag.validations
|
|
4695
|
# :flag.validations
|
|
4666
|
if [[ -n $(validate_file_exists "$2") ]]; then
|
|
4696
|
if [[ -n $(validate_file_exists "$2") ]]; then
|
|
4667
|
printf "validation error in %s:\n%s\n" "--env-file-path ENV_FILE_PATH" "$(validate_file_exists "$2")" >&2
|
|
4697
|
printf "validation error in %s:\n%s\n" "--env-file-path ENV_FILE_PATH" "$(validate_file_exists "$2")" >&2
|
|
4668
|
exit 1
|
|
4698
|
exit 1
|
|
4669
|
fi
|
|
4699
|
fi
|
|
4670
|
|
|
4700
|
|
|
4671
|
args['--env-file-path']="$2"
|
|
4701
|
args['--env-file-path']="$2"
|
|
4672
|
shift
|
|
4702
|
shift
|
|
4673
|
shift
|
|
4703
|
shift
|
|
4674
|
else
|
|
4704
|
else
|
|
4675
|
printf "%s\n" "--env-file-path requires an argument: --env-file-path ENV_FILE_PATH" >&2
|
|
4705
|
printf "%s\n" "--env-file-path requires an argument: --env-file-path ENV_FILE_PATH" >&2
|
|
4676
|
exit 1
|
|
4706
|
exit 1
|
|
4677
|
fi
|
|
4707
|
fi
|
|
4678
|
;;
|
|
4708
|
;;
|
|
4679
|
|
|
4709
|
|
|
4680
|
# :flag.case
|
|
4710
|
# :flag.case
|
|
4681
|
--stack-prefix)
|
|
4711
|
--stack-prefix)
|
|
4682
|
|
|
4712
|
|
|
4683
|
# :flag.case_arg
|
|
4713
|
# :flag.case_arg
|
|
4684
|
if [[ -n ${2+x} ]]; then
|
|
4714
|
if [[ -n ${2+x} ]]; then
|
|
4685
|
|
|
4715
|
|
|
4686
|
args['--stack-prefix']="$2"
|
|
4716
|
args['--stack-prefix']="$2"
|
|
4687
|
shift
|
|
4717
|
shift
|
|
4688
|
shift
|
|
4718
|
shift
|
|
4689
|
else
|
|
4719
|
else
|
|
4690
|
printf "%s\n" "--stack-prefix requires an argument: --stack-prefix STACK_PREFIX" >&2
|
|
4720
|
printf "%s\n" "--stack-prefix requires an argument: --stack-prefix STACK_PREFIX" >&2
|
|
4691
|
exit 1
|
|
4721
|
exit 1
|
|
4692
|
fi
|
|
4722
|
fi
|
|
4693
|
;;
|
|
4723
|
;;
|
|
4694
|
|
|
4724
|
|
|
4695
|
*)
|
|
4725
|
*)
|
|
4696
|
break
|
|
4726
|
break
|
|
4697
|
;;
|
|
4727
|
;;
|
|
4698
|
|
|
4728
|
|
|
4699
|
esac
|
|
4729
|
esac
|
|
4700
|
done
|
|
4730
|
done
|
|
4701
|
|
|
4731
|
|
|
4702
|
# :command.command_filter
|
|
4732
|
# :command.command_filter
|
|
4703
|
action=${1:-}
|
|
4733
|
action=${1:-}
|
|
4704
|
|
|
4734
|
|
|
4705
|
case $action in
|
|
4735
|
case $action in
|
|
4706
|
-*) ;;
|
|
4736
|
-*) ;;
|
|
4707
|
|
|
4737
|
|
|
4708
|
router)
|
|
4738
|
router)
|
|
4709
|
action="router"
|
|
4739
|
action="router"
|
|
4710
|
shift
|
|
4740
|
shift
|
|
4711
|
rcstack_stack_router_parse_requirements "$@"
|
|
4741
|
rcstack_stack_router_parse_requirements "$@"
|
|
4712
|
shift $#
|
|
4742
|
shift $#
|
|
4713
|
;;
|
|
4743
|
;;
|
|
4714
|
|
|
4744
|
|
|
4715
|
metrics)
|
|
4745
|
metrics)
|
|
4716
|
action="metrics"
|
|
4746
|
action="metrics"
|
|
4717
|
shift
|
|
4747
|
shift
|
|
4718
|
rcstack_stack_metrics_parse_requirements "$@"
|
|
4748
|
rcstack_stack_metrics_parse_requirements "$@"
|
|
4719
|
shift $#
|
|
4749
|
shift $#
|
|
4720
|
;;
|
|
4750
|
;;
|
|
4721
|
|
|
4751
|
|
|
4722
|
services)
|
|
4752
|
services)
|
|
4723
|
action="services"
|
|
4753
|
action="services"
|
|
4724
|
shift
|
|
4754
|
shift
|
|
4725
|
rcstack_stack_services_parse_requirements "$@"
|
|
4755
|
rcstack_stack_services_parse_requirements "$@"
|
|
4726
|
shift $#
|
|
4756
|
shift $#
|
|
4727
|
;;
|
|
4757
|
;;
|
|
4728
|
|
|
4758
|
|
|
4729
|
rhodecode)
|
|
4759
|
rhodecode)
|
|
4730
|
action="rhodecode"
|
|
4760
|
action="rhodecode"
|
|
4731
|
shift
|
|
4761
|
shift
|
|
4732
|
rcstack_stack_rhodecode_parse_requirements "$@"
|
|
4762
|
rcstack_stack_rhodecode_parse_requirements "$@"
|
|
4733
|
shift $#
|
|
4763
|
shift $#
|
|
4734
|
;;
|
|
4764
|
;;
|
|
4735
|
|
|
4765
|
|
|
4736
|
all)
|
|
4766
|
all)
|
|
4737
|
action="all"
|
|
4767
|
action="all"
|
|
4738
|
shift
|
|
4768
|
shift
|
|
4739
|
rcstack_stack_all_parse_requirements "$@"
|
|
4769
|
rcstack_stack_all_parse_requirements "$@"
|
|
4740
|
shift $#
|
|
4770
|
shift $#
|
|
4741
|
;;
|
|
4771
|
;;
|
|
4742
|
|
|
4772
|
|
|
4743
|
# :command.command_fallback
|
|
4773
|
# :command.command_fallback
|
|
4744
|
"")
|
|
4774
|
"")
|
|
4745
|
rcstack_stack_usage >&2
|
|
4775
|
rcstack_stack_usage >&2
|
|
4746
|
exit 1
|
|
4776
|
exit 1
|
|
4747
|
;;
|
|
4777
|
;;
|
|
4748
|
|
|
4778
|
|
|
4749
|
*)
|
|
4779
|
*)
|
|
4750
|
printf "invalid command: %s\n" "$action" >&2
|
|
4780
|
printf "invalid command: %s\n" "$action" >&2
|
|
4751
|
exit 1
|
|
4781
|
exit 1
|
|
4752
|
;;
|
|
4782
|
;;
|
|
4753
|
|
|
4783
|
|
|
4754
|
esac
|
|
4784
|
esac
|
|
4755
|
|
|
4785
|
|
|
4756
|
# :command.parse_requirements_while
|
|
4786
|
# :command.parse_requirements_while
|
|
4757
|
while [[ $# -gt 0 ]]; do
|
|
4787
|
while [[ $# -gt 0 ]]; do
|
|
4758
|
key="$1"
|
|
4788
|
key="$1"
|
|
4759
|
case "$key" in
|
|
4789
|
case "$key" in
|
|
4760
|
|
|
4790
|
|
|
4761
|
-?*)
|
|
4791
|
-?*)
|
|
4762
|
printf "invalid option: %s\n" "$key" >&2
|
|
4792
|
printf "invalid option: %s\n" "$key" >&2
|
|
4763
|
exit 1
|
|
4793
|
exit 1
|
|
4764
|
;;
|
|
4794
|
;;
|
|
4765
|
|
|
4795
|
|
|
4766
|
*)
|
|
4796
|
*)
|
|
4767
|
# :command.parse_requirements_case
|
|
4797
|
# :command.parse_requirements_case
|
|
4768
|
# :command.parse_requirements_case_simple
|
|
4798
|
# :command.parse_requirements_case_simple
|
|
4769
|
printf "invalid argument: %s\n" "$key" >&2
|
|
4799
|
printf "invalid argument: %s\n" "$key" >&2
|
|
4770
|
exit 1
|
|
4800
|
exit 1
|
|
4771
|
|
|
4801
|
|
|
4772
|
;;
|
|
4802
|
;;
|
|
4773
|
|
|
4803
|
|
|
4774
|
esac
|
|
4804
|
esac
|
|
4775
|
done
|
|
4805
|
done
|
|
4776
|
|
|
4806
|
|
|
4777
|
# :command.default_assignments
|
|
4807
|
# :command.default_assignments
|
|
4778
|
[[ -n ${args['--env-file-path']:-} ]] || args['--env-file-path']="$PWD/.custom/.runtime.env"
|
|
4808
|
[[ -n ${args['--env-file-path']:-} ]] || args['--env-file-path']="$PWD/.custom/.runtime.env"
|
|
4779
|
|
|
4809
|
|
|
4780
|
}
|
|
4810
|
}
|
|
4781
|
|
|
4811
|
|
|
4782
|
# :command.parse_requirements
|
|
4812
|
# :command.parse_requirements
|
|
4783
|
rcstack_stack_router_parse_requirements() {
|
|
4813
|
rcstack_stack_router_parse_requirements() {
|
|
4784
|
# :command.fixed_flags_filter
|
|
4814
|
# :command.fixed_flags_filter
|
|
4785
|
while [[ $# -gt 0 ]]; do
|
|
4815
|
while [[ $# -gt 0 ]]; do
|
|
4786
|
case "${1:-}" in
|
|
4816
|
case "${1:-}" in
|
|
4787
|
--help | -h)
|
|
4817
|
--help | -h)
|
|
4788
|
long_usage=yes
|
|
4818
|
long_usage=yes
|
|
4789
|
rcstack_stack_router_usage
|
|
4819
|
rcstack_stack_router_usage
|
|
4790
|
exit
|
|
4820
|
exit
|
|
4791
|
;;
|
|
4821
|
;;
|
|
4792
|
|
|
4822
|
|
|
4793
|
*)
|
|
4823
|
*)
|
|
4794
|
break
|
|
4824
|
break
|
|
4795
|
;;
|
|
4825
|
;;
|
|
4796
|
|
|
4826
|
|
|
4797
|
esac
|
|
4827
|
esac
|
|
4798
|
done
|
|
4828
|
done
|
|
4799
|
|
|
4829
|
|
|
4800
|
# :command.command_filter
|
|
4830
|
# :command.command_filter
|
|
4801
|
action="stack router"
|
|
4831
|
action="stack router"
|
|
4802
|
|
|
4832
|
|
|
4803
|
# :command.parse_requirements_while
|
|
4833
|
# :command.parse_requirements_while
|
|
4804
|
while [[ $# -gt 0 ]]; do
|
|
4834
|
while [[ $# -gt 0 ]]; do
|
|
4805
|
key="$1"
|
|
4835
|
key="$1"
|
|
4806
|
case "$key" in
|
|
4836
|
case "$key" in
|
|
4807
|
|
|
4837
|
|
|
4808
|
--)
|
|
4838
|
--)
|
|
4809
|
shift
|
|
4839
|
shift
|
|
4810
|
other_args+=("$@")
|
|
4840
|
other_args+=("$@")
|
|
4811
|
break
|
|
4841
|
break
|
|
4812
|
;;
|
|
4842
|
;;
|
|
4813
|
|
|
4843
|
|
|
4814
|
-?*)
|
|
4844
|
-?*)
|
|
4815
|
other_args+=("$1")
|
|
4845
|
other_args+=("$1")
|
|
4816
|
shift
|
|
4846
|
shift
|
|
4817
|
;;
|
|
4847
|
;;
|
|
4818
|
|
|
4848
|
|
|
4819
|
*)
|
|
4849
|
*)
|
|
4820
|
# :command.parse_requirements_case
|
|
4850
|
# :command.parse_requirements_case
|
|
4821
|
# :command.parse_requirements_case_catch_all
|
|
4851
|
# :command.parse_requirements_case_catch_all
|
|
4822
|
other_args+=("$1")
|
|
4852
|
other_args+=("$1")
|
|
4823
|
shift
|
|
4853
|
shift
|
|
4824
|
|
|
4854
|
|
|
4825
|
;;
|
|
4855
|
;;
|
|
4826
|
|
|
4856
|
|
|
4827
|
esac
|
|
4857
|
esac
|
|
4828
|
done
|
|
4858
|
done
|
|
4829
|
|
|
4859
|
|
|
4830
|
}
|
|
4860
|
}
|
|
4831
|
|
|
4861
|
|
|
4832
|
# :command.parse_requirements
|
|
4862
|
# :command.parse_requirements
|
|
4833
|
rcstack_stack_metrics_parse_requirements() {
|
|
4863
|
rcstack_stack_metrics_parse_requirements() {
|
|
4834
|
# :command.fixed_flags_filter
|
|
4864
|
# :command.fixed_flags_filter
|
|
4835
|
while [[ $# -gt 0 ]]; do
|
|
4865
|
while [[ $# -gt 0 ]]; do
|
|
4836
|
case "${1:-}" in
|
|
4866
|
case "${1:-}" in
|
|
4837
|
--help | -h)
|
|
4867
|
--help | -h)
|
|
4838
|
long_usage=yes
|
|
4868
|
long_usage=yes
|
|
4839
|
rcstack_stack_metrics_usage
|
|
4869
|
rcstack_stack_metrics_usage
|
|
4840
|
exit
|
|
4870
|
exit
|
|
4841
|
;;
|
|
4871
|
;;
|
|
4842
|
|
|
4872
|
|
|
4843
|
*)
|
|
4873
|
*)
|
|
4844
|
break
|
|
4874
|
break
|
|
4845
|
;;
|
|
4875
|
;;
|
|
4846
|
|
|
4876
|
|
|
4847
|
esac
|
|
4877
|
esac
|
|
4848
|
done
|
|
4878
|
done
|
|
4849
|
|
|
4879
|
|
|
4850
|
# :command.command_filter
|
|
4880
|
# :command.command_filter
|
|
4851
|
action="stack metrics"
|
|
4881
|
action="stack metrics"
|
|
4852
|
|
|
4882
|
|
|
4853
|
# :command.parse_requirements_while
|
|
4883
|
# :command.parse_requirements_while
|
|
4854
|
while [[ $# -gt 0 ]]; do
|
|
4884
|
while [[ $# -gt 0 ]]; do
|
|
4855
|
key="$1"
|
|
4885
|
key="$1"
|
|
4856
|
case "$key" in
|
|
4886
|
case "$key" in
|
|
4857
|
|
|
4887
|
|
|
4858
|
--)
|
|
4888
|
--)
|
|
4859
|
shift
|
|
4889
|
shift
|
|
4860
|
other_args+=("$@")
|
|
4890
|
other_args+=("$@")
|
|
4861
|
break
|
|
4891
|
break
|
|
4862
|
;;
|
|
4892
|
;;
|
|
4863
|
|
|
4893
|
|
|
4864
|
-?*)
|
|
4894
|
-?*)
|
|
4865
|
other_args+=("$1")
|
|
4895
|
other_args+=("$1")
|
|
4866
|
shift
|
|
4896
|
shift
|
|
4867
|
;;
|
|
4897
|
;;
|
|
4868
|
|
|
4898
|
|
|
4869
|
*)
|
|
4899
|
*)
|
|
4870
|
# :command.parse_requirements_case
|
|
4900
|
# :command.parse_requirements_case
|
|
4871
|
# :command.parse_requirements_case_catch_all
|
|
4901
|
# :command.parse_requirements_case_catch_all
|
|
4872
|
other_args+=("$1")
|
|
4902
|
other_args+=("$1")
|
|
4873
|
shift
|
|
4903
|
shift
|
|
4874
|
|
|
4904
|
|
|
4875
|
;;
|
|
4905
|
;;
|
|
4876
|
|
|
4906
|
|
|
4877
|
esac
|
|
4907
|
esac
|
|
4878
|
done
|
|
4908
|
done
|
|
4879
|
|
|
4909
|
|
|
4880
|
}
|
|
4910
|
}
|
|
4881
|
|
|
4911
|
|
|
4882
|
# :command.parse_requirements
|
|
4912
|
# :command.parse_requirements
|
|
4883
|
rcstack_stack_services_parse_requirements() {
|
|
4913
|
rcstack_stack_services_parse_requirements() {
|
|
4884
|
# :command.fixed_flags_filter
|
|
4914
|
# :command.fixed_flags_filter
|
|
4885
|
while [[ $# -gt 0 ]]; do
|
|
4915
|
while [[ $# -gt 0 ]]; do
|
|
4886
|
case "${1:-}" in
|
|
4916
|
case "${1:-}" in
|
|
4887
|
--help | -h)
|
|
4917
|
--help | -h)
|
|
4888
|
long_usage=yes
|
|
4918
|
long_usage=yes
|
|
4889
|
rcstack_stack_services_usage
|
|
4919
|
rcstack_stack_services_usage
|
|
4890
|
exit
|
|
4920
|
exit
|
|
4891
|
;;
|
|
4921
|
;;
|
|
4892
|
|
|
4922
|
|
|
4893
|
*)
|
|
4923
|
*)
|
|
4894
|
break
|
|
4924
|
break
|
|
4895
|
;;
|
|
4925
|
;;
|
|
4896
|
|
|
4926
|
|
|
4897
|
esac
|
|
4927
|
esac
|
|
4898
|
done
|
|
4928
|
done
|
|
4899
|
|
|
4929
|
|
|
4900
|
# :command.command_filter
|
|
4930
|
# :command.command_filter
|
|
4901
|
action="stack services"
|
|
4931
|
action="stack services"
|
|
4902
|
|
|
4932
|
|
|
4903
|
# :command.parse_requirements_while
|
|
4933
|
# :command.parse_requirements_while
|
|
4904
|
while [[ $# -gt 0 ]]; do
|
|
4934
|
while [[ $# -gt 0 ]]; do
|
|
4905
|
key="$1"
|
|
4935
|
key="$1"
|
|
4906
|
case "$key" in
|
|
4936
|
case "$key" in
|
|
4907
|
|
|
4937
|
|
|
4908
|
--)
|
|
4938
|
--)
|
|
4909
|
shift
|
|
4939
|
shift
|
|
4910
|
other_args+=("$@")
|
|
4940
|
other_args+=("$@")
|
|
4911
|
break
|
|
4941
|
break
|
|
4912
|
;;
|
|
4942
|
;;
|
|
4913
|
|
|
4943
|
|
|
4914
|
-?*)
|
|
4944
|
-?*)
|
|
4915
|
other_args+=("$1")
|
|
4945
|
other_args+=("$1")
|
|
4916
|
shift
|
|
4946
|
shift
|
|
4917
|
;;
|
|
4947
|
;;
|
|
4918
|
|
|
4948
|
|
|
4919
|
*)
|
|
4949
|
*)
|
|
4920
|
# :command.parse_requirements_case
|
|
4950
|
# :command.parse_requirements_case
|
|
4921
|
# :command.parse_requirements_case_catch_all
|
|
4951
|
# :command.parse_requirements_case_catch_all
|
|
4922
|
other_args+=("$1")
|
|
4952
|
other_args+=("$1")
|
|
4923
|
shift
|
|
4953
|
shift
|
|
4924
|
|
|
4954
|
|
|
4925
|
;;
|
|
4955
|
;;
|
|
4926
|
|
|
4956
|
|
|
4927
|
esac
|
|
4957
|
esac
|
|
4928
|
done
|
|
4958
|
done
|
|
4929
|
|
|
4959
|
|
|
4930
|
}
|
|
4960
|
}
|
|
4931
|
|
|
4961
|
|
|
4932
|
# :command.parse_requirements
|
|
4962
|
# :command.parse_requirements
|
|
4933
|
rcstack_stack_rhodecode_parse_requirements() {
|
|
4963
|
rcstack_stack_rhodecode_parse_requirements() {
|
|
4934
|
# :command.fixed_flags_filter
|
|
4964
|
# :command.fixed_flags_filter
|
|
4935
|
while [[ $# -gt 0 ]]; do
|
|
4965
|
while [[ $# -gt 0 ]]; do
|
|
4936
|
case "${1:-}" in
|
|
4966
|
case "${1:-}" in
|
|
4937
|
--help | -h)
|
|
4967
|
--help | -h)
|
|
4938
|
long_usage=yes
|
|
4968
|
long_usage=yes
|
|
4939
|
rcstack_stack_rhodecode_usage
|
|
4969
|
rcstack_stack_rhodecode_usage
|
|
4940
|
exit
|
|
4970
|
exit
|
|
4941
|
;;
|
|
4971
|
;;
|
|
4942
|
|
|
4972
|
|
|
4943
|
*)
|
|
4973
|
*)
|
|
4944
|
break
|
|
4974
|
break
|
|
4945
|
;;
|
|
4975
|
;;
|
|
4946
|
|
|
4976
|
|
|
4947
|
esac
|
|
4977
|
esac
|
|
4948
|
done
|
|
4978
|
done
|
|
4949
|
|
|
4979
|
|
|
4950
|
# :command.command_filter
|
|
4980
|
# :command.command_filter
|
|
4951
|
action="stack rhodecode"
|
|
4981
|
action="stack rhodecode"
|
|
4952
|
|
|
4982
|
|
|
4953
|
# :command.parse_requirements_while
|
|
4983
|
# :command.parse_requirements_while
|
|
4954
|
while [[ $# -gt 0 ]]; do
|
|
4984
|
while [[ $# -gt 0 ]]; do
|
|
4955
|
key="$1"
|
|
4985
|
key="$1"
|
|
4956
|
case "$key" in
|
|
4986
|
case "$key" in
|
|
4957
|
|
|
4987
|
|
|
4958
|
--)
|
|
4988
|
--)
|
|
4959
|
shift
|
|
4989
|
shift
|
|
4960
|
other_args+=("$@")
|
|
4990
|
other_args+=("$@")
|
|
4961
|
break
|
|
4991
|
break
|
|
4962
|
;;
|
|
4992
|
;;
|
|
4963
|
|
|
4993
|
|
|
4964
|
-?*)
|
|
4994
|
-?*)
|
|
4965
|
other_args+=("$1")
|
|
4995
|
other_args+=("$1")
|
|
4966
|
shift
|
|
4996
|
shift
|
|
4967
|
;;
|
|
4997
|
;;
|
|
4968
|
|
|
4998
|
|
|
4969
|
*)
|
|
4999
|
*)
|
|
4970
|
# :command.parse_requirements_case
|
|
5000
|
# :command.parse_requirements_case
|
|
4971
|
# :command.parse_requirements_case_catch_all
|
|
5001
|
# :command.parse_requirements_case_catch_all
|
|
4972
|
other_args+=("$1")
|
|
5002
|
other_args+=("$1")
|
|
4973
|
shift
|
|
5003
|
shift
|
|
4974
|
|
|
5004
|
|
|
4975
|
;;
|
|
5005
|
;;
|
|
4976
|
|
|
5006
|
|
|
4977
|
esac
|
|
5007
|
esac
|
|
4978
|
done
|
|
5008
|
done
|
|
4979
|
|
|
5009
|
|
|
4980
|
}
|
|
5010
|
}
|
|
4981
|
|
|
5011
|
|
|
4982
|
# :command.parse_requirements
|
|
5012
|
# :command.parse_requirements
|
|
4983
|
rcstack_stack_all_parse_requirements() {
|
|
5013
|
rcstack_stack_all_parse_requirements() {
|
|
4984
|
# :command.fixed_flags_filter
|
|
5014
|
# :command.fixed_flags_filter
|
|
4985
|
while [[ $# -gt 0 ]]; do
|
|
5015
|
while [[ $# -gt 0 ]]; do
|
|
4986
|
case "${1:-}" in
|
|
5016
|
case "${1:-}" in
|
|
4987
|
--help | -h)
|
|
5017
|
--help | -h)
|
|
4988
|
long_usage=yes
|
|
5018
|
long_usage=yes
|
|
4989
|
rcstack_stack_all_usage
|
|
5019
|
rcstack_stack_all_usage
|
|
4990
|
exit
|
|
5020
|
exit
|
|
4991
|
;;
|
|
5021
|
;;
|
|
4992
|
|
|
5022
|
|
|
4993
|
*)
|
|
5023
|
*)
|
|
4994
|
break
|
|
5024
|
break
|
|
4995
|
;;
|
|
5025
|
;;
|
|
4996
|
|
|
5026
|
|
|
4997
|
esac
|
|
5027
|
esac
|
|
4998
|
done
|
|
5028
|
done
|
|
4999
|
|
|
5029
|
|
|
5000
|
# :command.command_filter
|
|
5030
|
# :command.command_filter
|
|
5001
|
action="stack all"
|
|
5031
|
action="stack all"
|
|
5002
|
|
|
5032
|
|
|
5003
|
# :command.parse_requirements_while
|
|
5033
|
# :command.parse_requirements_while
|
|
5004
|
while [[ $# -gt 0 ]]; do
|
|
5034
|
while [[ $# -gt 0 ]]; do
|
|
5005
|
key="$1"
|
|
5035
|
key="$1"
|
|
5006
|
case "$key" in
|
|
5036
|
case "$key" in
|
|
5007
|
|
|
5037
|
|
|
5008
|
--)
|
|
5038
|
--)
|
|
5009
|
shift
|
|
5039
|
shift
|
|
5010
|
other_args+=("$@")
|
|
5040
|
other_args+=("$@")
|
|
5011
|
break
|
|
5041
|
break
|
|
5012
|
;;
|
|
5042
|
;;
|
|
5013
|
|
|
5043
|
|
|
5014
|
-?*)
|
|
5044
|
-?*)
|
|
5015
|
other_args+=("$1")
|
|
5045
|
other_args+=("$1")
|
|
5016
|
shift
|
|
5046
|
shift
|
|
5017
|
;;
|
|
5047
|
;;
|
|
5018
|
|
|
5048
|
|
|
5019
|
*)
|
|
5049
|
*)
|
|
5020
|
# :command.parse_requirements_case
|
|
5050
|
# :command.parse_requirements_case
|
|
5021
|
# :command.parse_requirements_case_catch_all
|
|
5051
|
# :command.parse_requirements_case_catch_all
|
|
5022
|
other_args+=("$1")
|
|
5052
|
other_args+=("$1")
|
|
5023
|
shift
|
|
5053
|
shift
|
|
5024
|
|
|
5054
|
|
|
5025
|
;;
|
|
5055
|
;;
|
|
5026
|
|
|
5056
|
|
|
5027
|
esac
|
|
5057
|
esac
|
|
5028
|
done
|
|
5058
|
done
|
|
5029
|
|
|
5059
|
|
|
5030
|
}
|
|
5060
|
}
|
|
5031
|
|
|
5061
|
|
|
5032
|
# :command.parse_requirements
|
|
5062
|
# :command.parse_requirements
|
|
5033
|
rcstack_stack_status_parse_requirements() {
|
|
5063
|
rcstack_stack_status_parse_requirements() {
|
|
5034
|
# :command.fixed_flags_filter
|
|
5064
|
# :command.fixed_flags_filter
|
|
5035
|
while [[ $# -gt 0 ]]; do
|
|
5065
|
while [[ $# -gt 0 ]]; do
|
|
5036
|
case "${1:-}" in
|
|
5066
|
case "${1:-}" in
|
|
5037
|
--help | -h)
|
|
5067
|
--help | -h)
|
|
5038
|
long_usage=yes
|
|
5068
|
long_usage=yes
|
|
5039
|
rcstack_stack_status_usage
|
|
5069
|
rcstack_stack_status_usage
|
|
5040
|
exit
|
|
5070
|
exit
|
|
5041
|
;;
|
|
5071
|
;;
|
|
5042
|
|
|
5072
|
|
|
5043
|
*)
|
|
5073
|
*)
|
|
5044
|
break
|
|
5074
|
break
|
|
5045
|
;;
|
|
5075
|
;;
|
|
5046
|
|
|
5076
|
|
|
5047
|
esac
|
|
5077
|
esac
|
|
5048
|
done
|
|
5078
|
done
|
|
5049
|
|
|
5079
|
|
|
5050
|
# :command.command_filter
|
|
5080
|
# :command.command_filter
|
|
5051
|
action="stack-status"
|
|
5081
|
action="stack-status"
|
|
5052
|
|
|
5082
|
|
|
5053
|
# :command.parse_requirements_while
|
|
5083
|
# :command.parse_requirements_while
|
|
5054
|
while [[ $# -gt 0 ]]; do
|
|
5084
|
while [[ $# -gt 0 ]]; do
|
|
5055
|
key="$1"
|
|
5085
|
key="$1"
|
|
5056
|
case "$key" in
|
|
5086
|
case "$key" in
|
|
5057
|
# :flag.case
|
|
5087
|
# :flag.case
|
|
5058
|
--detailed)
|
|
5088
|
--detailed)
|
|
5059
|
|
|
5089
|
|
|
5060
|
# :flag.case_no_arg
|
|
5090
|
# :flag.case_no_arg
|
|
5061
|
args['--detailed']=1
|
|
5091
|
args['--detailed']=1
|
|
5062
|
shift
|
|
5092
|
shift
|
|
5063
|
;;
|
|
5093
|
;;
|
|
5064
|
|
|
5094
|
|
|
5065
|
# :flag.case
|
|
5095
|
# :flag.case
|
|
5066
|
--configs)
|
|
5096
|
--configs)
|
|
5067
|
|
|
5097
|
|
|
5068
|
# :flag.case_no_arg
|
|
5098
|
# :flag.case_no_arg
|
|
5069
|
args['--configs']=1
|
|
5099
|
args['--configs']=1
|
|
5070
|
shift
|
|
5100
|
shift
|
|
5071
|
;;
|
|
5101
|
;;
|
|
5072
|
|
|
5102
|
|
|
5073
|
-?*)
|
|
5103
|
-?*)
|
|
5074
|
printf "invalid option: %s\n" "$key" >&2
|
|
5104
|
printf "invalid option: %s\n" "$key" >&2
|
|
5075
|
exit 1
|
|
5105
|
exit 1
|
|
5076
|
;;
|
|
5106
|
;;
|
|
5077
|
|
|
5107
|
|
|
5078
|
*)
|
|
5108
|
*)
|
|
5079
|
# :command.parse_requirements_case
|
|
5109
|
# :command.parse_requirements_case
|
|
5080
|
# :command.parse_requirements_case_simple
|
|
5110
|
# :command.parse_requirements_case_simple
|
|
5081
|
printf "invalid argument: %s\n" "$key" >&2
|
|
5111
|
printf "invalid argument: %s\n" "$key" >&2
|
|
5082
|
exit 1
|
|
5112
|
exit 1
|
|
5083
|
|
|
5113
|
|
|
5084
|
;;
|
|
5114
|
;;
|
|
5085
|
|
|
5115
|
|
|
5086
|
esac
|
|
5116
|
esac
|
|
5087
|
done
|
|
5117
|
done
|
|
5088
|
|
|
5118
|
|
|
5089
|
}
|
|
5119
|
}
|
|
5090
|
|
|
5120
|
|
|
5091
|
# :command.parse_requirements
|
|
5121
|
# :command.parse_requirements
|
|
5092
|
rcstack_stack_upgrade_parse_requirements() {
|
|
5122
|
rcstack_stack_upgrade_parse_requirements() {
|
|
5093
|
# :command.fixed_flags_filter
|
|
5123
|
# :command.fixed_flags_filter
|
|
5094
|
while [[ $# -gt 0 ]]; do
|
|
5124
|
while [[ $# -gt 0 ]]; do
|
|
5095
|
case "${1:-}" in
|
|
5125
|
case "${1:-}" in
|
|
5096
|
--help | -h)
|
|
5126
|
--help | -h)
|
|
5097
|
long_usage=yes
|
|
5127
|
long_usage=yes
|
|
5098
|
rcstack_stack_upgrade_usage
|
|
5128
|
rcstack_stack_upgrade_usage
|
|
5099
|
exit
|
|
5129
|
exit
|
|
5100
|
;;
|
|
5130
|
;;
|
|
5101
|
|
|
5131
|
|
|
5102
|
# :flag.case
|
|
5132
|
# :flag.case
|
|
5103
|
--stack-prefix)
|
|
5133
|
--stack-prefix)
|
|
5104
|
|
|
5134
|
|
|
5105
|
# :flag.case_arg
|
|
5135
|
# :flag.case_arg
|
|
5106
|
if [[ -n ${2+x} ]]; then
|
|
5136
|
if [[ -n ${2+x} ]]; then
|
|
5107
|
|
|
5137
|
|
|
5108
|
args['--stack-prefix']="$2"
|
|
5138
|
args['--stack-prefix']="$2"
|
|
5109
|
shift
|
|
5139
|
shift
|
|
5110
|
shift
|
|
5140
|
shift
|
|
5111
|
else
|
|
5141
|
else
|
|
5112
|
printf "%s\n" "--stack-prefix requires an argument: --stack-prefix STACK_PREFIX" >&2
|
|
5142
|
printf "%s\n" "--stack-prefix requires an argument: --stack-prefix STACK_PREFIX" >&2
|
|
5113
|
exit 1
|
|
5143
|
exit 1
|
|
5114
|
fi
|
|
5144
|
fi
|
|
5115
|
;;
|
|
5145
|
;;
|
|
5116
|
|
|
5146
|
|
|
5117
|
*)
|
|
5147
|
*)
|
|
5118
|
break
|
|
5148
|
break
|
|
5119
|
;;
|
|
5149
|
;;
|
|
5120
|
|
|
5150
|
|
|
5121
|
esac
|
|
5151
|
esac
|
|
5122
|
done
|
|
5152
|
done
|
|
5123
|
|
|
5153
|
|
|
5124
|
# :command.command_filter
|
|
5154
|
# :command.command_filter
|
|
5125
|
action=${1:-}
|
|
5155
|
action=${1:-}
|
|
5126
|
|
|
5156
|
|
|
5127
|
case $action in
|
|
5157
|
case $action in
|
|
5128
|
-*) ;;
|
|
5158
|
-*) ;;
|
|
5129
|
|
|
5159
|
|
|
5130
|
router)
|
|
5160
|
router)
|
|
5131
|
action="router"
|
|
5161
|
action="router"
|
|
5132
|
shift
|
|
5162
|
shift
|
|
5133
|
rcstack_stack_upgrade_router_parse_requirements "$@"
|
|
5163
|
rcstack_stack_upgrade_router_parse_requirements "$@"
|
|
5134
|
shift $#
|
|
5164
|
shift $#
|
|
5135
|
;;
|
|
5165
|
;;
|
|
5136
|
|
|
5166
|
|
|
5137
|
metrics)
|
|
5167
|
metrics)
|
|
5138
|
action="metrics"
|
|
5168
|
action="metrics"
|
|
5139
|
shift
|
|
5169
|
shift
|
|
5140
|
rcstack_stack_upgrade_metrics_parse_requirements "$@"
|
|
5170
|
rcstack_stack_upgrade_metrics_parse_requirements "$@"
|
|
5141
|
shift $#
|
|
5171
|
shift $#
|
|
5142
|
;;
|
|
5172
|
;;
|
|
5143
|
|
|
5173
|
|
|
5144
|
services)
|
|
5174
|
services)
|
|
5145
|
action="services"
|
|
5175
|
action="services"
|
|
5146
|
shift
|
|
5176
|
shift
|
|
5147
|
rcstack_stack_upgrade_services_parse_requirements "$@"
|
|
5177
|
rcstack_stack_upgrade_services_parse_requirements "$@"
|
|
5148
|
shift $#
|
|
5178
|
shift $#
|
|
5149
|
;;
|
|
5179
|
;;
|
|
5150
|
|
|
5180
|
|
|
5151
|
rhodecode)
|
|
5181
|
rhodecode)
|
|
5152
|
action="rhodecode"
|
|
5182
|
action="rhodecode"
|
|
5153
|
shift
|
|
5183
|
shift
|
|
5154
|
rcstack_stack_upgrade_rhodecode_parse_requirements "$@"
|
|
5184
|
rcstack_stack_upgrade_rhodecode_parse_requirements "$@"
|
|
5155
|
shift $#
|
|
5185
|
shift $#
|
|
5156
|
;;
|
|
5186
|
;;
|
|
5157
|
|
|
5187
|
|
|
5158
|
# :command.command_fallback
|
|
5188
|
# :command.command_fallback
|
|
5159
|
"")
|
|
5189
|
"")
|
|
5160
|
rcstack_stack_upgrade_usage >&2
|
|
5190
|
rcstack_stack_upgrade_usage >&2
|
|
5161
|
exit 1
|
|
5191
|
exit 1
|
|
5162
|
;;
|
|
5192
|
;;
|
|
5163
|
|
|
5193
|
|
|
5164
|
*)
|
|
5194
|
*)
|
|
5165
|
printf "invalid command: %s\n" "$action" >&2
|
|
5195
|
printf "invalid command: %s\n" "$action" >&2
|
|
5166
|
exit 1
|
|
5196
|
exit 1
|
|
5167
|
;;
|
|
5197
|
;;
|
|
5168
|
|
|
5198
|
|
|
5169
|
esac
|
|
5199
|
esac
|
|
5170
|
|
|
5200
|
|
|
5171
|
# :command.parse_requirements_while
|
|
5201
|
# :command.parse_requirements_while
|
|
5172
|
while [[ $# -gt 0 ]]; do
|
|
5202
|
while [[ $# -gt 0 ]]; do
|
|
5173
|
key="$1"
|
|
5203
|
key="$1"
|
|
5174
|
case "$key" in
|
|
5204
|
case "$key" in
|
|
5175
|
|
|
5205
|
|
|
5176
|
-?*)
|
|
5206
|
-?*)
|
|
5177
|
printf "invalid option: %s\n" "$key" >&2
|
|
5207
|
printf "invalid option: %s\n" "$key" >&2
|
|
5178
|
exit 1
|
|
5208
|
exit 1
|
|
5179
|
;;
|
|
5209
|
;;
|
|
5180
|
|
|
5210
|
|
|
5181
|
*)
|
|
5211
|
*)
|
|
5182
|
# :command.parse_requirements_case
|
|
5212
|
# :command.parse_requirements_case
|
|
5183
|
# :command.parse_requirements_case_simple
|
|
5213
|
# :command.parse_requirements_case_simple
|
|
5184
|
printf "invalid argument: %s\n" "$key" >&2
|
|
5214
|
printf "invalid argument: %s\n" "$key" >&2
|
|
5185
|
exit 1
|
|
5215
|
exit 1
|
|
5186
|
|
|
5216
|
|
|
5187
|
;;
|
|
5217
|
;;
|
|
5188
|
|
|
5218
|
|
|
5189
|
esac
|
|
5219
|
esac
|
|
5190
|
done
|
|
5220
|
done
|
|
5191
|
|
|
5221
|
|
|
5192
|
}
|
|
5222
|
}
|
|
5193
|
|
|
5223
|
|
|
5194
|
# :command.parse_requirements
|
|
5224
|
# :command.parse_requirements
|
|
5195
|
rcstack_stack_upgrade_router_parse_requirements() {
|
|
5225
|
rcstack_stack_upgrade_router_parse_requirements() {
|
|
5196
|
# :command.fixed_flags_filter
|
|
5226
|
# :command.fixed_flags_filter
|
|
5197
|
while [[ $# -gt 0 ]]; do
|
|
5227
|
while [[ $# -gt 0 ]]; do
|
|
5198
|
case "${1:-}" in
|
|
5228
|
case "${1:-}" in
|
|
5199
|
--help | -h)
|
|
5229
|
--help | -h)
|
|
5200
|
long_usage=yes
|
|
5230
|
long_usage=yes
|
|
5201
|
rcstack_stack_upgrade_router_usage
|
|
5231
|
rcstack_stack_upgrade_router_usage
|
|
5202
|
exit
|
|
5232
|
exit
|
|
5203
|
;;
|
|
5233
|
;;
|
|
5204
|
|
|
5234
|
|
|
5205
|
*)
|
|
5235
|
*)
|
|
5206
|
break
|
|
5236
|
break
|
|
5207
|
;;
|
|
5237
|
;;
|
|
5208
|
|
|
5238
|
|
|
5209
|
esac
|
|
5239
|
esac
|
|
5210
|
done
|
|
5240
|
done
|
|
5211
|
|
|
5241
|
|
|
5212
|
# :command.command_filter
|
|
5242
|
# :command.command_filter
|
|
5213
|
action="stack-upgrade router"
|
|
5243
|
action="stack-upgrade router"
|
|
5214
|
|
|
5244
|
|
|
5215
|
# :command.parse_requirements_while
|
|
5245
|
# :command.parse_requirements_while
|
|
5216
|
while [[ $# -gt 0 ]]; do
|
|
5246
|
while [[ $# -gt 0 ]]; do
|
|
5217
|
key="$1"
|
|
5247
|
key="$1"
|
|
5218
|
case "$key" in
|
|
5248
|
case "$key" in
|
|
5219
|
|
|
5249
|
|
|
5220
|
-?*)
|
|
5250
|
-?*)
|
|
5221
|
printf "invalid option: %s\n" "$key" >&2
|
|
5251
|
printf "invalid option: %s\n" "$key" >&2
|
|
5222
|
exit 1
|
|
5252
|
exit 1
|
|
5223
|
;;
|
|
5253
|
;;
|
|
5224
|
|
|
5254
|
|
|
5225
|
*)
|
|
5255
|
*)
|
|
5226
|
# :command.parse_requirements_case
|
|
5256
|
# :command.parse_requirements_case
|
|
5227
|
# :command.parse_requirements_case_simple
|
|
5257
|
# :command.parse_requirements_case_simple
|
|
5228
|
printf "invalid argument: %s\n" "$key" >&2
|
|
5258
|
printf "invalid argument: %s\n" "$key" >&2
|
|
5229
|
exit 1
|
|
5259
|
exit 1
|
|
5230
|
|
|
5260
|
|
|
5231
|
;;
|
|
5261
|
;;
|
|
5232
|
|
|
5262
|
|
|
5233
|
esac
|
|
5263
|
esac
|
|
5234
|
done
|
|
5264
|
done
|
|
5235
|
|
|
5265
|
|
|
5236
|
}
|
|
5266
|
}
|
|
5237
|
|
|
5267
|
|
|
5238
|
# :command.parse_requirements
|
|
5268
|
# :command.parse_requirements
|
|
5239
|
rcstack_stack_upgrade_metrics_parse_requirements() {
|
|
5269
|
rcstack_stack_upgrade_metrics_parse_requirements() {
|
|
5240
|
# :command.fixed_flags_filter
|
|
5270
|
# :command.fixed_flags_filter
|
|
5241
|
while [[ $# -gt 0 ]]; do
|
|
5271
|
while [[ $# -gt 0 ]]; do
|
|
5242
|
case "${1:-}" in
|
|
5272
|
case "${1:-}" in
|
|
5243
|
--help | -h)
|
|
5273
|
--help | -h)
|
|
5244
|
long_usage=yes
|
|
5274
|
long_usage=yes
|
|
5245
|
rcstack_stack_upgrade_metrics_usage
|
|
5275
|
rcstack_stack_upgrade_metrics_usage
|
|
5246
|
exit
|
|
5276
|
exit
|
|
5247
|
;;
|
|
5277
|
;;
|
|
5248
|
|
|
5278
|
|
|
5249
|
*)
|
|
5279
|
*)
|
|
5250
|
break
|
|
5280
|
break
|
|
5251
|
;;
|
|
5281
|
;;
|
|
5252
|
|
|
5282
|
|
|
5253
|
esac
|
|
5283
|
esac
|
|
5254
|
done
|
|
5284
|
done
|
|
5255
|
|
|
5285
|
|
|
5256
|
# :command.command_filter
|
|
5286
|
# :command.command_filter
|
|
5257
|
action="stack-upgrade metrics"
|
|
5287
|
action="stack-upgrade metrics"
|
|
5258
|
|
|
5288
|
|
|
5259
|
# :command.parse_requirements_while
|
|
5289
|
# :command.parse_requirements_while
|
|
5260
|
while [[ $# -gt 0 ]]; do
|
|
5290
|
while [[ $# -gt 0 ]]; do
|
|
5261
|
key="$1"
|
|
5291
|
key="$1"
|
|
5262
|
case "$key" in
|
|
5292
|
case "$key" in
|
|
5263
|
|
|
5293
|
|
|
5264
|
-?*)
|
|
5294
|
-?*)
|
|
5265
|
printf "invalid option: %s\n" "$key" >&2
|
|
5295
|
printf "invalid option: %s\n" "$key" >&2
|
|
5266
|
exit 1
|
|
5296
|
exit 1
|
|
5267
|
;;
|
|
5297
|
;;
|
|
5268
|
|
|
5298
|
|
|
5269
|
*)
|
|
5299
|
*)
|
|
5270
|
# :command.parse_requirements_case
|
|
5300
|
# :command.parse_requirements_case
|
|
5271
|
# :command.parse_requirements_case_simple
|
|
5301
|
# :command.parse_requirements_case_simple
|
|
5272
|
printf "invalid argument: %s\n" "$key" >&2
|
|
5302
|
printf "invalid argument: %s\n" "$key" >&2
|
|
5273
|
exit 1
|
|
5303
|
exit 1
|
|
5274
|
|
|
5304
|
|
|
5275
|
;;
|
|
5305
|
;;
|
|
5276
|
|
|
5306
|
|
|
5277
|
esac
|
|
5307
|
esac
|
|
5278
|
done
|
|
5308
|
done
|
|
5279
|
|
|
5309
|
|
|
5280
|
}
|
|
5310
|
}
|
|
5281
|
|
|
5311
|
|
|
5282
|
# :command.parse_requirements
|
|
5312
|
# :command.parse_requirements
|
|
5283
|
rcstack_stack_upgrade_services_parse_requirements() {
|
|
5313
|
rcstack_stack_upgrade_services_parse_requirements() {
|
|
5284
|
# :command.fixed_flags_filter
|
|
5314
|
# :command.fixed_flags_filter
|
|
5285
|
while [[ $# -gt 0 ]]; do
|
|
5315
|
while [[ $# -gt 0 ]]; do
|
|
5286
|
case "${1:-}" in
|
|
5316
|
case "${1:-}" in
|
|
5287
|
--help | -h)
|
|
5317
|
--help | -h)
|
|
5288
|
long_usage=yes
|
|
5318
|
long_usage=yes
|
|
5289
|
rcstack_stack_upgrade_services_usage
|
|
5319
|
rcstack_stack_upgrade_services_usage
|
|
5290
|
exit
|
|
5320
|
exit
|
|
5291
|
;;
|
|
5321
|
;;
|
|
5292
|
|
|
5322
|
|
|
5293
|
*)
|
|
5323
|
*)
|
|
5294
|
break
|
|
5324
|
break
|
|
5295
|
;;
|
|
5325
|
;;
|
|
5296
|
|
|
5326
|
|
|
5297
|
esac
|
|
5327
|
esac
|
|
5298
|
done
|
|
5328
|
done
|
|
5299
|
|
|
5329
|
|
|
5300
|
# :command.command_filter
|
|
5330
|
# :command.command_filter
|
|
5301
|
action="stack-upgrade services"
|
|
5331
|
action="stack-upgrade services"
|
|
5302
|
|
|
5332
|
|
|
5303
|
# :command.parse_requirements_while
|
|
5333
|
# :command.parse_requirements_while
|
|
5304
|
while [[ $# -gt 0 ]]; do
|
|
5334
|
while [[ $# -gt 0 ]]; do
|
|
5305
|
key="$1"
|
|
5335
|
key="$1"
|
|
5306
|
case "$key" in
|
|
5336
|
case "$key" in
|
|
5307
|
|
|
5337
|
|
|
5308
|
-?*)
|
|
5338
|
-?*)
|
|
5309
|
printf "invalid option: %s\n" "$key" >&2
|
|
5339
|
printf "invalid option: %s\n" "$key" >&2
|
|
5310
|
exit 1
|
|
5340
|
exit 1
|
|
5311
|
;;
|
|
5341
|
;;
|
|
5312
|
|
|
5342
|
|
|
5313
|
*)
|
|
5343
|
*)
|
|
5314
|
# :command.parse_requirements_case
|
|
5344
|
# :command.parse_requirements_case
|
|
5315
|
# :command.parse_requirements_case_simple
|
|
5345
|
# :command.parse_requirements_case_simple
|
|
5316
|
printf "invalid argument: %s\n" "$key" >&2
|
|
5346
|
printf "invalid argument: %s\n" "$key" >&2
|
|
5317
|
exit 1
|
|
5347
|
exit 1
|
|
5318
|
|
|
5348
|
|
|
5319
|
;;
|
|
5349
|
;;
|
|
5320
|
|
|
5350
|
|
|
5321
|
esac
|
|
5351
|
esac
|
|
5322
|
done
|
|
5352
|
done
|
|
5323
|
|
|
5353
|
|
|
5324
|
}
|
|
5354
|
}
|
|
5325
|
|
|
5355
|
|
|
5326
|
# :command.parse_requirements
|
|
5356
|
# :command.parse_requirements
|
|
5327
|
rcstack_stack_upgrade_rhodecode_parse_requirements() {
|
|
5357
|
rcstack_stack_upgrade_rhodecode_parse_requirements() {
|
|
5328
|
# :command.fixed_flags_filter
|
|
5358
|
# :command.fixed_flags_filter
|
|
5329
|
while [[ $# -gt 0 ]]; do
|
|
5359
|
while [[ $# -gt 0 ]]; do
|
|
5330
|
case "${1:-}" in
|
|
5360
|
case "${1:-}" in
|
|
5331
|
--help | -h)
|
|
5361
|
--help | -h)
|
|
5332
|
long_usage=yes
|
|
5362
|
long_usage=yes
|
|
5333
|
rcstack_stack_upgrade_rhodecode_usage
|
|
5363
|
rcstack_stack_upgrade_rhodecode_usage
|
|
5334
|
exit
|
|
5364
|
exit
|
|
5335
|
;;
|
|
5365
|
;;
|
|
5336
|
|
|
5366
|
|
|
5337
|
*)
|
|
5367
|
*)
|
|
5338
|
break
|
|
5368
|
break
|
|
5339
|
;;
|
|
5369
|
;;
|
|
5340
|
|
|
5370
|
|
|
5341
|
esac
|
|
5371
|
esac
|
|
5342
|
done
|
|
5372
|
done
|
|
5343
|
|
|
5373
|
|
|
5344
|
# :command.command_filter
|
|
5374
|
# :command.command_filter
|
|
5345
|
action="stack-upgrade rhodecode"
|
|
5375
|
action="stack-upgrade rhodecode"
|
|
5346
|
|
|
5376
|
|
|
5347
|
# :command.parse_requirements_while
|
|
5377
|
# :command.parse_requirements_while
|
|
5348
|
while [[ $# -gt 0 ]]; do
|
|
5378
|
while [[ $# -gt 0 ]]; do
|
|
5349
|
key="$1"
|
|
5379
|
key="$1"
|
|
5350
|
case "$key" in
|
|
5380
|
case "$key" in
|
|
5351
|
# :flag.case
|
|
5381
|
# :flag.case
|
|
5352
|
--stop-wait)
|
|
5382
|
--stop-wait)
|
|
5353
|
|
|
5383
|
|
|
5354
|
# :flag.case_arg
|
|
5384
|
# :flag.case_arg
|
|
5355
|
if [[ -n ${2+x} ]]; then
|
|
5385
|
if [[ -n ${2+x} ]]; then
|
|
5356
|
|
|
5386
|
|
|
5357
|
args['--stop-wait']="$2"
|
|
5387
|
args['--stop-wait']="$2"
|
|
5358
|
shift
|
|
5388
|
shift
|
|
5359
|
shift
|
|
5389
|
shift
|
|
5360
|
else
|
|
5390
|
else
|
|
5361
|
printf "%s\n" "--stop-wait requires an argument: --stop-wait STOP_WAIT" >&2
|
|
5391
|
printf "%s\n" "--stop-wait requires an argument: --stop-wait STOP_WAIT" >&2
|
|
5362
|
exit 1
|
|
5392
|
exit 1
|
|
5363
|
fi
|
|
5393
|
fi
|
|
5364
|
;;
|
|
5394
|
;;
|
|
5365
|
|
|
5395
|
|
|
5366
|
# :flag.case
|
|
5396
|
# :flag.case
|
|
5367
|
--docker-stop-wait)
|
|
5397
|
--docker-stop-wait)
|
|
5368
|
|
|
5398
|
|
|
5369
|
# :flag.case_arg
|
|
5399
|
# :flag.case_arg
|
|
5370
|
if [[ -n ${2+x} ]]; then
|
|
5400
|
if [[ -n ${2+x} ]]; then
|
|
5371
|
|
|
5401
|
|
|
5372
|
args['--docker-stop-wait']="$2"
|
|
5402
|
args['--docker-stop-wait']="$2"
|
|
5373
|
shift
|
|
5403
|
shift
|
|
5374
|
shift
|
|
5404
|
shift
|
|
5375
|
else
|
|
5405
|
else
|
|
5376
|
printf "%s\n" "--docker-stop-wait requires an argument: --docker-stop-wait DOCKER_STOP_WAIT" >&2
|
|
5406
|
printf "%s\n" "--docker-stop-wait requires an argument: --docker-stop-wait DOCKER_STOP_WAIT" >&2
|
|
5377
|
exit 1
|
|
5407
|
exit 1
|
|
5378
|
fi
|
|
5408
|
fi
|
|
5379
|
;;
|
|
5409
|
;;
|
|
5380
|
|
|
5410
|
|
|
5381
|
-?*)
|
|
5411
|
-?*)
|
|
5382
|
printf "invalid option: %s\n" "$key" >&2
|
|
5412
|
printf "invalid option: %s\n" "$key" >&2
|
|
5383
|
exit 1
|
|
5413
|
exit 1
|
|
5384
|
;;
|
|
5414
|
;;
|
|
5385
|
|
|
5415
|
|
|
5386
|
*)
|
|
5416
|
*)
|
|
5387
|
# :command.parse_requirements_case
|
|
5417
|
# :command.parse_requirements_case
|
|
5388
|
# :command.parse_requirements_case_simple
|
|
5418
|
# :command.parse_requirements_case_simple
|
|
5389
|
printf "invalid argument: %s\n" "$key" >&2
|
|
5419
|
printf "invalid argument: %s\n" "$key" >&2
|
|
5390
|
exit 1
|
|
5420
|
exit 1
|
|
5391
|
|
|
5421
|
|
|
5392
|
;;
|
|
5422
|
;;
|
|
5393
|
|
|
5423
|
|
|
5394
|
esac
|
|
5424
|
esac
|
|
5395
|
done
|
|
5425
|
done
|
|
5396
|
|
|
5426
|
|
|
5397
|
# :command.default_assignments
|
|
5427
|
# :command.default_assignments
|
|
5398
|
[[ -n ${args['--stop-wait']:-} ]] || args['--stop-wait']="120"
|
|
5428
|
[[ -n ${args['--stop-wait']:-} ]] || args['--stop-wait']="120"
|
|
5399
|
[[ -n ${args['--docker-stop-wait']:-} ]] || args['--docker-stop-wait']="3600"
|
|
5429
|
[[ -n ${args['--docker-stop-wait']:-} ]] || args['--docker-stop-wait']="3600"
|
|
5400
|
|
|
5430
|
|
|
5401
|
}
|
|
5431
|
}
|
|
5402
|
|
|
5432
|
|
|
5403
|
# :command.parse_requirements
|
|
5433
|
# :command.parse_requirements
|
|
5404
|
rcstack_stack_monitor_parse_requirements() {
|
|
5434
|
rcstack_stack_monitor_parse_requirements() {
|
|
5405
|
# :command.fixed_flags_filter
|
|
5435
|
# :command.fixed_flags_filter
|
|
5406
|
while [[ $# -gt 0 ]]; do
|
|
5436
|
while [[ $# -gt 0 ]]; do
|
|
5407
|
case "${1:-}" in
|
|
5437
|
case "${1:-}" in
|
|
5408
|
--help | -h)
|
|
5438
|
--help | -h)
|
|
5409
|
long_usage=yes
|
|
5439
|
long_usage=yes
|
|
5410
|
rcstack_stack_monitor_usage
|
|
5440
|
rcstack_stack_monitor_usage
|
|
5411
|
exit
|
|
5441
|
exit
|
|
5412
|
;;
|
|
5442
|
;;
|
|
5413
|
|
|
5443
|
|
|
5414
|
*)
|
|
5444
|
*)
|
|
5415
|
break
|
|
5445
|
break
|
|
5416
|
;;
|
|
5446
|
;;
|
|
5417
|
|
|
5447
|
|
|
5418
|
esac
|
|
5448
|
esac
|
|
5419
|
done
|
|
5449
|
done
|
|
5420
|
|
|
5450
|
|
|
5421
|
# :command.command_filter
|
|
5451
|
# :command.command_filter
|
|
5422
|
action=${1:-}
|
|
5452
|
action=${1:-}
|
|
5423
|
|
|
5453
|
|
|
5424
|
case $action in
|
|
5454
|
case $action in
|
|
5425
|
-*) ;;
|
|
5455
|
-*) ;;
|
|
5426
|
|
|
5456
|
|
|
5427
|
restart-unhealthy)
|
|
5457
|
restart-unhealthy)
|
|
5428
|
action="restart-unhealthy"
|
|
5458
|
action="restart-unhealthy"
|
|
5429
|
shift
|
|
5459
|
shift
|
|
5430
|
rcstack_stack_monitor_restart_unhealthy_parse_requirements "$@"
|
|
5460
|
rcstack_stack_monitor_restart_unhealthy_parse_requirements "$@"
|
|
5431
|
shift $#
|
|
5461
|
shift $#
|
|
5432
|
;;
|
|
5462
|
;;
|
|
5433
|
|
|
5463
|
|
|
5434
|
# :command.command_fallback
|
|
5464
|
# :command.command_fallback
|
|
5435
|
"")
|
|
5465
|
"")
|
|
5436
|
rcstack_stack_monitor_usage >&2
|
|
5466
|
rcstack_stack_monitor_usage >&2
|
|
5437
|
exit 1
|
|
5467
|
exit 1
|
|
5438
|
;;
|
|
5468
|
;;
|
|
5439
|
|
|
5469
|
|
|
5440
|
*)
|
|
5470
|
*)
|
|
5441
|
printf "invalid command: %s\n" "$action" >&2
|
|
5471
|
printf "invalid command: %s\n" "$action" >&2
|
|
5442
|
exit 1
|
|
5472
|
exit 1
|
|
5443
|
;;
|
|
5473
|
;;
|
|
5444
|
|
|
5474
|
|
|
5445
|
esac
|
|
5475
|
esac
|
|
5446
|
|
|
5476
|
|
|
5447
|
# :command.parse_requirements_while
|
|
5477
|
# :command.parse_requirements_while
|
|
5448
|
while [[ $# -gt 0 ]]; do
|
|
5478
|
while [[ $# -gt 0 ]]; do
|
|
5449
|
key="$1"
|
|
5479
|
key="$1"
|
|
5450
|
case "$key" in
|
|
5480
|
case "$key" in
|
|
5451
|
|
|
5481
|
|
|
5452
|
-?*)
|
|
5482
|
-?*)
|
|
5453
|
printf "invalid option: %s\n" "$key" >&2
|
|
5483
|
printf "invalid option: %s\n" "$key" >&2
|
|
5454
|
exit 1
|
|
5484
|
exit 1
|
|
5455
|
;;
|
|
5485
|
;;
|
|
5456
|
|
|
5486
|
|
|
5457
|
*)
|
|
5487
|
*)
|
|
5458
|
# :command.parse_requirements_case
|
|
5488
|
# :command.parse_requirements_case
|
|
5459
|
# :command.parse_requirements_case_simple
|
|
5489
|
# :command.parse_requirements_case_simple
|
|
5460
|
printf "invalid argument: %s\n" "$key" >&2
|
|
5490
|
printf "invalid argument: %s\n" "$key" >&2
|
|
5461
|
exit 1
|
|
5491
|
exit 1
|
|
5462
|
|
|
5492
|
|
|
5463
|
;;
|
|
5493
|
;;
|
|
5464
|
|
|
5494
|
|
|
5465
|
esac
|
|
5495
|
esac
|
|
5466
|
done
|
|
5496
|
done
|
|
5467
|
|
|
5497
|
|
|
5468
|
}
|
|
5498
|
}
|
|
5469
|
|
|
5499
|
|
|
5470
|
# :command.parse_requirements
|
|
5500
|
# :command.parse_requirements
|
|
5471
|
rcstack_stack_monitor_restart_unhealthy_parse_requirements() {
|
|
5501
|
rcstack_stack_monitor_restart_unhealthy_parse_requirements() {
|
|
5472
|
# :command.fixed_flags_filter
|
|
5502
|
# :command.fixed_flags_filter
|
|
5473
|
while [[ $# -gt 0 ]]; do
|
|
5503
|
while [[ $# -gt 0 ]]; do
|
|
5474
|
case "${1:-}" in
|
|
5504
|
case "${1:-}" in
|
|
5475
|
--help | -h)
|
|
5505
|
--help | -h)
|
|
5476
|
long_usage=yes
|
|
5506
|
long_usage=yes
|
|
5477
|
rcstack_stack_monitor_restart_unhealthy_usage
|
|
5507
|
rcstack_stack_monitor_restart_unhealthy_usage
|
|
5478
|
exit
|
|
5508
|
exit
|
|
5479
|
;;
|
|
5509
|
;;
|
|
5480
|
|
|
5510
|
|
|
5481
|
*)
|
|
5511
|
*)
|
|
5482
|
break
|
|
5512
|
break
|
|
5483
|
;;
|
|
5513
|
;;
|
|
5484
|
|
|
5514
|
|
|
5485
|
esac
|
|
5515
|
esac
|
|
5486
|
done
|
|
5516
|
done
|
|
5487
|
|
|
5517
|
|
|
5488
|
# :command.command_filter
|
|
5518
|
# :command.command_filter
|
|
5489
|
action="stack-monitor restart-unhealthy"
|
|
5519
|
action="stack-monitor restart-unhealthy"
|
|
5490
|
|
|
5520
|
|
|
5491
|
# :command.parse_requirements_while
|
|
5521
|
# :command.parse_requirements_while
|
|
5492
|
while [[ $# -gt 0 ]]; do
|
|
5522
|
while [[ $# -gt 0 ]]; do
|
|
5493
|
key="$1"
|
|
5523
|
key="$1"
|
|
5494
|
case "$key" in
|
|
5524
|
case "$key" in
|
|
5495
|
# :flag.case
|
|
5525
|
# :flag.case
|
|
5496
|
--loop)
|
|
5526
|
--loop)
|
|
5497
|
|
|
5527
|
|
|
5498
|
# :flag.case_arg
|
|
5528
|
# :flag.case_arg
|
|
5499
|
if [[ -n ${2+x} ]]; then
|
|
5529
|
if [[ -n ${2+x} ]]; then
|
|
5500
|
# :flag.validations
|
|
5530
|
# :flag.validations
|
|
5501
|
if [[ -n $(validate_integer "$2") ]]; then
|
|
5531
|
if [[ -n $(validate_integer "$2") ]]; then
|
|
5502
|
printf "validation error in %s:\n%s\n" "--loop LOOP" "$(validate_integer "$2")" >&2
|
|
5532
|
printf "validation error in %s:\n%s\n" "--loop LOOP" "$(validate_integer "$2")" >&2
|
|
5503
|
exit 1
|
|
5533
|
exit 1
|
|
5504
|
fi
|
|
5534
|
fi
|
|
5505
|
|
|
5535
|
|
|
5506
|
args['--loop']="$2"
|
|
5536
|
args['--loop']="$2"
|
|
5507
|
shift
|
|
5537
|
shift
|
|
5508
|
shift
|
|
5538
|
shift
|
|
5509
|
else
|
|
5539
|
else
|
|
5510
|
printf "%s\n" "--loop requires an argument: --loop LOOP" >&2
|
|
5540
|
printf "%s\n" "--loop requires an argument: --loop LOOP" >&2
|
|
5511
|
exit 1
|
|
5541
|
exit 1
|
|
5512
|
fi
|
|
5542
|
fi
|
|
5513
|
;;
|
|
5543
|
;;
|
|
5514
|
|
|
5544
|
|
|
5515
|
-?*)
|
|
5545
|
-?*)
|
|
5516
|
printf "invalid option: %s\n" "$key" >&2
|
|
5546
|
printf "invalid option: %s\n" "$key" >&2
|
|
5517
|
exit 1
|
|
5547
|
exit 1
|
|
5518
|
;;
|
|
5548
|
;;
|
|
5519
|
|
|
5549
|
|
|
5520
|
*)
|
|
5550
|
*)
|
|
5521
|
# :command.parse_requirements_case
|
|
5551
|
# :command.parse_requirements_case
|
|
5522
|
# :command.parse_requirements_case_simple
|
|
5552
|
# :command.parse_requirements_case_simple
|
|
5523
|
printf "invalid argument: %s\n" "$key" >&2
|
|
5553
|
printf "invalid argument: %s\n" "$key" >&2
|
|
5524
|
exit 1
|
|
5554
|
exit 1
|
|
5525
|
|
|
5555
|
|
|
5526
|
;;
|
|
5556
|
;;
|
|
5527
|
|
|
5557
|
|
|
5528
|
esac
|
|
5558
|
esac
|
|
5529
|
done
|
|
5559
|
done
|
|
5530
|
|
|
5560
|
|
|
5531
|
# :command.default_assignments
|
|
5561
|
# :command.default_assignments
|
|
5532
|
[[ -n ${args['--loop']:-} ]] || args['--loop']="0"
|
|
5562
|
[[ -n ${args['--loop']:-} ]] || args['--loop']="0"
|
|
5533
|
|
|
5563
|
|
|
5534
|
}
|
|
5564
|
}
|
|
5535
|
|
|
5565
|
|
|
5536
|
# :command.parse_requirements
|
|
5566
|
# :command.parse_requirements
|
|
5537
|
rcstack_cli_parse_requirements() {
|
|
5567
|
rcstack_cli_parse_requirements() {
|
|
5538
|
# :command.fixed_flags_filter
|
|
5568
|
# :command.fixed_flags_filter
|
|
5539
|
while [[ $# -gt 0 ]]; do
|
|
5569
|
while [[ $# -gt 0 ]]; do
|
|
5540
|
case "${1:-}" in
|
|
5570
|
case "${1:-}" in
|
|
5541
|
--help | -h)
|
|
5571
|
--help | -h)
|
|
5542
|
long_usage=yes
|
|
5572
|
long_usage=yes
|
|
5543
|
rcstack_cli_usage
|
|
5573
|
rcstack_cli_usage
|
|
5544
|
exit
|
|
5574
|
exit
|
|
5545
|
;;
|
|
5575
|
;;
|
|
5546
|
|
|
5576
|
|
|
5547
|
*)
|
|
5577
|
*)
|
|
5548
|
break
|
|
5578
|
break
|
|
5549
|
;;
|
|
5579
|
;;
|
|
5550
|
|
|
5580
|
|
|
5551
|
esac
|
|
5581
|
esac
|
|
5552
|
done
|
|
5582
|
done
|
|
5553
|
|
|
5583
|
|
|
5554
|
# :command.command_filter
|
|
5584
|
# :command.command_filter
|
|
5555
|
action=${1:-}
|
|
5585
|
action=${1:-}
|
|
5556
|
|
|
5586
|
|
|
5557
|
case $action in
|
|
5587
|
case $action in
|
|
5558
|
-*) ;;
|
|
5588
|
-*) ;;
|
|
5559
|
|
|
5589
|
|
|
5560
|
image-info)
|
|
5590
|
image-info)
|
|
5561
|
action="image-info"
|
|
5591
|
action="image-info"
|
|
5562
|
shift
|
|
5592
|
shift
|
|
5563
|
rcstack_cli_image_info_parse_requirements "$@"
|
|
5593
|
rcstack_cli_image_info_parse_requirements "$@"
|
|
5564
|
shift $#
|
|
5594
|
shift $#
|
|
5565
|
;;
|
|
5595
|
;;
|
|
5566
|
|
|
5596
|
|
|
5567
|
set-runtime-image)
|
|
5597
|
set-runtime-image)
|
|
5568
|
action="set-runtime-image"
|
|
5598
|
action="set-runtime-image"
|
|
5569
|
shift
|
|
5599
|
shift
|
|
5570
|
rcstack_cli_set_runtime_image_parse_requirements "$@"
|
|
5600
|
rcstack_cli_set_runtime_image_parse_requirements "$@"
|
|
5571
|
shift $#
|
|
5601
|
shift $#
|
|
5572
|
;;
|
|
5602
|
;;
|
|
5573
|
|
|
5603
|
|
|
5574
|
ishell)
|
|
5604
|
ishell)
|
|
5575
|
action="ishell"
|
|
5605
|
action="ishell"
|
|
5576
|
shift
|
|
5606
|
shift
|
|
5577
|
rcstack_cli_ishell_parse_requirements "$@"
|
|
5607
|
rcstack_cli_ishell_parse_requirements "$@"
|
|
5578
|
shift $#
|
|
5608
|
shift $#
|
|
5579
|
;;
|
|
5609
|
;;
|
|
5580
|
|
|
5610
|
|
|
5581
|
redis)
|
|
5611
|
redis)
|
|
5582
|
action="redis"
|
|
5612
|
action="redis"
|
|
5583
|
shift
|
|
5613
|
shift
|
|
5584
|
rcstack_cli_redis_parse_requirements "$@"
|
|
5614
|
rcstack_cli_redis_parse_requirements "$@"
|
|
5585
|
shift $#
|
|
5615
|
shift $#
|
|
5586
|
;;
|
|
5616
|
;;
|
|
5587
|
|
|
5617
|
|
|
5588
|
db)
|
|
5618
|
db)
|
|
5589
|
action="db"
|
|
5619
|
action="db"
|
|
5590
|
shift
|
|
5620
|
shift
|
|
5591
|
rcstack_cli_db_parse_requirements "$@"
|
|
5621
|
rcstack_cli_db_parse_requirements "$@"
|
|
5592
|
shift $#
|
|
5622
|
shift $#
|
|
5593
|
;;
|
|
5623
|
;;
|
|
5594
|
|
|
5624
|
|
|
5595
|
db-upgrade)
|
|
5625
|
db-upgrade)
|
|
5596
|
action="db-upgrade"
|
|
5626
|
action="db-upgrade"
|
|
5597
|
shift
|
|
5627
|
shift
|
|
5598
|
rcstack_cli_db_upgrade_parse_requirements "$@"
|
|
5628
|
rcstack_cli_db_upgrade_parse_requirements "$@"
|
|
5599
|
shift $#
|
|
5629
|
shift $#
|
|
5600
|
;;
|
|
5630
|
;;
|
|
5601
|
|
|
5631
|
|
|
5602
|
storage)
|
|
5632
|
storage)
|
|
5603
|
action="storage"
|
|
5633
|
action="storage"
|
|
5604
|
shift
|
|
5634
|
shift
|
|
5605
|
rcstack_cli_storage_parse_requirements "$@"
|
|
5635
|
rcstack_cli_storage_parse_requirements "$@"
|
|
5606
|
shift $#
|
|
5636
|
shift $#
|
|
5607
|
;;
|
|
5637
|
;;
|
|
5608
|
|
|
5638
|
|
|
5609
|
attach)
|
|
5639
|
attach)
|
|
5610
|
action="attach"
|
|
5640
|
action="attach"
|
|
5611
|
shift
|
|
5641
|
shift
|
|
5612
|
rcstack_cli_attach_parse_requirements "$@"
|
|
5642
|
rcstack_cli_attach_parse_requirements "$@"
|
|
5613
|
shift $#
|
|
5643
|
shift $#
|
|
5614
|
;;
|
|
5644
|
;;
|
|
5615
|
|
|
5645
|
|
|
5616
|
set-edition)
|
|
5646
|
set-edition)
|
|
5617
|
action="set-edition"
|
|
5647
|
action="set-edition"
|
|
5618
|
shift
|
|
5648
|
shift
|
|
5619
|
rcstack_cli_set_edition_parse_requirements "$@"
|
|
5649
|
rcstack_cli_set_edition_parse_requirements "$@"
|
|
5620
|
shift $#
|
|
5650
|
shift $#
|
|
5621
|
;;
|
|
5651
|
;;
|
|
5622
|
|
|
5652
|
|
|
5623
|
configure-vcsserver)
|
|
5653
|
configure-vcsserver)
|
|
5624
|
action="configure-vcsserver"
|
|
5654
|
action="configure-vcsserver"
|
|
5625
|
shift
|
|
5655
|
shift
|
|
5626
|
rcstack_cli_configure_vcsserver_parse_requirements "$@"
|
|
5656
|
rcstack_cli_configure_vcsserver_parse_requirements "$@"
|
|
5627
|
shift $#
|
|
5657
|
shift $#
|
|
5628
|
;;
|
|
5658
|
;;
|
|
5629
|
|
|
5659
|
|
|
5630
|
configure-rhodecode)
|
|
5660
|
configure-rhodecode)
|
|
5631
|
action="configure-rhodecode"
|
|
5661
|
action="configure-rhodecode"
|
|
5632
|
shift
|
|
5662
|
shift
|
|
5633
|
rcstack_cli_configure_rhodecode_parse_requirements "$@"
|
|
5663
|
rcstack_cli_configure_rhodecode_parse_requirements "$@"
|
|
5634
|
shift $#
|
|
5664
|
shift $#
|
|
5635
|
;;
|
|
5665
|
;;
|
|
5636
|
|
|
5666
|
|
|
5637
|
# :command.command_fallback
|
|
5667
|
# :command.command_fallback
|
|
5638
|
"")
|
|
5668
|
"")
|
|
5639
|
rcstack_cli_usage >&2
|
|
5669
|
rcstack_cli_usage >&2
|
|
5640
|
exit 1
|
|
5670
|
exit 1
|
|
5641
|
;;
|
|
5671
|
;;
|
|
5642
|
|
|
5672
|
|
|
5643
|
*)
|
|
5673
|
*)
|
|
5644
|
printf "invalid command: %s\n" "$action" >&2
|
|
5674
|
printf "invalid command: %s\n" "$action" >&2
|
|
5645
|
exit 1
|
|
5675
|
exit 1
|
|
5646
|
;;
|
|
5676
|
;;
|
|
5647
|
|
|
5677
|
|
|
5648
|
esac
|
|
5678
|
esac
|
|
5649
|
|
|
5679
|
|
|
5650
|
# :command.parse_requirements_while
|
|
5680
|
# :command.parse_requirements_while
|
|
5651
|
while [[ $# -gt 0 ]]; do
|
|
5681
|
while [[ $# -gt 0 ]]; do
|
|
5652
|
key="$1"
|
|
5682
|
key="$1"
|
|
5653
|
case "$key" in
|
|
5683
|
case "$key" in
|
|
5654
|
|
|
5684
|
|
|
5655
|
-?*)
|
|
5685
|
-?*)
|
|
5656
|
printf "invalid option: %s\n" "$key" >&2
|
|
5686
|
printf "invalid option: %s\n" "$key" >&2
|
|
5657
|
exit 1
|
|
5687
|
exit 1
|
|
5658
|
;;
|
|
5688
|
;;
|
|
5659
|
|
|
5689
|
|
|
5660
|
*)
|
|
5690
|
*)
|
|
5661
|
# :command.parse_requirements_case
|
|
5691
|
# :command.parse_requirements_case
|
|
5662
|
# :command.parse_requirements_case_simple
|
|
5692
|
# :command.parse_requirements_case_simple
|
|
5663
|
printf "invalid argument: %s\n" "$key" >&2
|
|
5693
|
printf "invalid argument: %s\n" "$key" >&2
|
|
5664
|
exit 1
|
|
5694
|
exit 1
|
|
5665
|
|
|
5695
|
|
|
5666
|
;;
|
|
5696
|
;;
|
|
5667
|
|
|
5697
|
|
|
5668
|
esac
|
|
5698
|
esac
|
|
5669
|
done
|
|
5699
|
done
|
|
5670
|
|
|
5700
|
|
|
5671
|
}
|
|
5701
|
}
|
|
5672
|
|
|
5702
|
|
|
5673
|
# :command.parse_requirements
|
|
5703
|
# :command.parse_requirements
|
|
5674
|
rcstack_cli_image_info_parse_requirements() {
|
|
5704
|
rcstack_cli_image_info_parse_requirements() {
|
|
5675
|
# :command.fixed_flags_filter
|
|
5705
|
# :command.fixed_flags_filter
|
|
5676
|
while [[ $# -gt 0 ]]; do
|
|
5706
|
while [[ $# -gt 0 ]]; do
|
|
5677
|
case "${1:-}" in
|
|
5707
|
case "${1:-}" in
|
|
5678
|
--help | -h)
|
|
5708
|
--help | -h)
|
|
5679
|
long_usage=yes
|
|
5709
|
long_usage=yes
|
|
5680
|
rcstack_cli_image_info_usage
|
|
5710
|
rcstack_cli_image_info_usage
|
|
5681
|
exit
|
|
5711
|
exit
|
|
5682
|
;;
|
|
5712
|
;;
|
|
5683
|
|
|
5713
|
|
|
5684
|
*)
|
|
5714
|
*)
|
|
5685
|
break
|
|
5715
|
break
|
|
5686
|
;;
|
|
5716
|
;;
|
|
5687
|
|
|
5717
|
|
|
5688
|
esac
|
|
5718
|
esac
|
|
5689
|
done
|
|
5719
|
done
|
|
5690
|
|
|
5720
|
|
|
5691
|
# :command.command_filter
|
|
5721
|
# :command.command_filter
|
|
5692
|
action="cli image-info"
|
|
5722
|
action="cli image-info"
|
|
5693
|
|
|
5723
|
|
|
5694
|
# :command.parse_requirements_while
|
|
5724
|
# :command.parse_requirements_while
|
|
5695
|
while [[ $# -gt 0 ]]; do
|
|
5725
|
while [[ $# -gt 0 ]]; do
|
|
5696
|
key="$1"
|
|
5726
|
key="$1"
|
|
5697
|
case "$key" in
|
|
5727
|
case "$key" in
|
|
5698
|
# :flag.case
|
|
5728
|
# :flag.case
|
|
5699
|
--verbose)
|
|
5729
|
--verbose)
|
|
5700
|
|
|
5730
|
|
|
5701
|
# :flag.case_no_arg
|
|
5731
|
# :flag.case_no_arg
|
|
5702
|
args['--verbose']=1
|
|
5732
|
args['--verbose']=1
|
|
5703
|
shift
|
|
5733
|
shift
|
|
5704
|
;;
|
|
5734
|
;;
|
|
5705
|
|
|
5735
|
|
|
5706
|
-?*)
|
|
5736
|
-?*)
|
|
5707
|
printf "invalid option: %s\n" "$key" >&2
|
|
5737
|
printf "invalid option: %s\n" "$key" >&2
|
|
5708
|
exit 1
|
|
5738
|
exit 1
|
|
5709
|
;;
|
|
5739
|
;;
|
|
5710
|
|
|
5740
|
|
|
5711
|
*)
|
|
5741
|
*)
|
|
5712
|
# :command.parse_requirements_case
|
|
5742
|
# :command.parse_requirements_case
|
|
5713
|
# :command.parse_requirements_case_simple
|
|
5743
|
# :command.parse_requirements_case_simple
|
|
5714
|
printf "invalid argument: %s\n" "$key" >&2
|
|
5744
|
printf "invalid argument: %s\n" "$key" >&2
|
|
5715
|
exit 1
|
|
5745
|
exit 1
|
|
5716
|
|
|
5746
|
|
|
5717
|
;;
|
|
5747
|
;;
|
|
5718
|
|
|
5748
|
|
|
5719
|
esac
|
|
5749
|
esac
|
|
5720
|
done
|
|
5750
|
done
|
|
5721
|
|
|
5751
|
|
|
5722
|
}
|
|
5752
|
}
|
|
5723
|
|
|
5753
|
|
|
5724
|
# :command.parse_requirements
|
|
5754
|
# :command.parse_requirements
|
|
5725
|
rcstack_cli_set_runtime_image_parse_requirements() {
|
|
5755
|
rcstack_cli_set_runtime_image_parse_requirements() {
|
|
5726
|
# :command.fixed_flags_filter
|
|
5756
|
# :command.fixed_flags_filter
|
|
5727
|
while [[ $# -gt 0 ]]; do
|
|
5757
|
while [[ $# -gt 0 ]]; do
|
|
5728
|
case "${1:-}" in
|
|
5758
|
case "${1:-}" in
|
|
5729
|
--help | -h)
|
|
5759
|
--help | -h)
|
|
5730
|
long_usage=yes
|
|
5760
|
long_usage=yes
|
|
5731
|
rcstack_cli_set_runtime_image_usage
|
|
5761
|
rcstack_cli_set_runtime_image_usage
|
|
5732
|
exit
|
|
5762
|
exit
|
|
5733
|
;;
|
|
5763
|
;;
|
|
5734
|
|
|
5764
|
|
|
5735
|
*)
|
|
5765
|
*)
|
|
5736
|
break
|
|
5766
|
break
|
|
5737
|
;;
|
|
5767
|
;;
|
|
5738
|
|
|
5768
|
|
|
5739
|
esac
|
|
5769
|
esac
|
|
5740
|
done
|
|
5770
|
done
|
|
5741
|
|
|
5771
|
|
|
5742
|
# :command.command_filter
|
|
5772
|
# :command.command_filter
|
|
5743
|
action="cli set-runtime-image"
|
|
5773
|
action="cli set-runtime-image"
|
|
5744
|
|
|
5774
|
|
|
5745
|
# :command.parse_requirements_while
|
|
5775
|
# :command.parse_requirements_while
|
|
5746
|
while [[ $# -gt 0 ]]; do
|
|
5776
|
while [[ $# -gt 0 ]]; do
|
|
5747
|
key="$1"
|
|
5777
|
key="$1"
|
|
5748
|
case "$key" in
|
|
5778
|
case "$key" in
|
|
5749
|
|
|
5779
|
|
|
5750
|
-?*)
|
|
5780
|
-?*)
|
|
5751
|
printf "invalid option: %s\n" "$key" >&2
|
|
5781
|
printf "invalid option: %s\n" "$key" >&2
|
|
5752
|
exit 1
|
|
5782
|
exit 1
|
|
5753
|
;;
|
|
5783
|
;;
|
|
5754
|
|
|
5784
|
|
|
5755
|
*)
|
|
5785
|
*)
|
|
5756
|
# :command.parse_requirements_case
|
|
5786
|
# :command.parse_requirements_case
|
|
5757
|
# :command.parse_requirements_case_simple
|
|
5787
|
# :command.parse_requirements_case_simple
|
|
5758
|
if [[ -z ${args['version']+x} ]]; then
|
|
5788
|
if [[ -z ${args['version']+x} ]]; then
|
|
5759
|
|
|
5789
|
|
|
5760
|
args['version']=$1
|
|
5790
|
args['version']=$1
|
|
5761
|
shift
|
|
5791
|
shift
|
|
5762
|
else
|
|
5792
|
else
|
|
5763
|
printf "invalid argument: %s\n" "$key" >&2
|
|
5793
|
printf "invalid argument: %s\n" "$key" >&2
|
|
5764
|
exit 1
|
|
5794
|
exit 1
|
|
5765
|
fi
|
|
5795
|
fi
|
|
5766
|
|
|
5796
|
|
|
5767
|
;;
|
|
5797
|
;;
|
|
5768
|
|
|
5798
|
|
|
5769
|
esac
|
|
5799
|
esac
|
|
5770
|
done
|
|
5800
|
done
|
|
5771
|
|
|
5801
|
|
|
5772
|
# :command.required_args_filter
|
|
5802
|
# :command.required_args_filter
|
|
5773
|
if [[ -z ${args['version']+x} ]]; then
|
|
5803
|
if [[ -z ${args['version']+x} ]]; then
|
|
5774
|
printf "missing required argument: VERSION\nusage: rcstack cli set-runtime-image VERSION\n" >&2
|
|
5804
|
printf "missing required argument: VERSION\nusage: rcstack cli set-runtime-image VERSION\n" >&2
|
|
5775
|
exit 1
|
|
5805
|
exit 1
|
|
5776
|
fi
|
|
5806
|
fi
|
|
5777
|
|
|
5807
|
|
|
5778
|
}
|
|
5808
|
}
|
|
5779
|
|
|
5809
|
|
|
5780
|
# :command.parse_requirements
|
|
5810
|
# :command.parse_requirements
|
|
5781
|
rcstack_cli_ishell_parse_requirements() {
|
|
5811
|
rcstack_cli_ishell_parse_requirements() {
|
|
5782
|
# :command.fixed_flags_filter
|
|
5812
|
# :command.fixed_flags_filter
|
|
5783
|
while [[ $# -gt 0 ]]; do
|
|
5813
|
while [[ $# -gt 0 ]]; do
|
|
5784
|
case "${1:-}" in
|
|
5814
|
case "${1:-}" in
|
|
5785
|
--help | -h)
|
|
5815
|
--help | -h)
|
|
5786
|
long_usage=yes
|
|
5816
|
long_usage=yes
|
|
5787
|
rcstack_cli_ishell_usage
|
|
5817
|
rcstack_cli_ishell_usage
|
|
5788
|
exit
|
|
5818
|
exit
|
|
5789
|
;;
|
|
5819
|
;;
|
|
5790
|
|
|
5820
|
|
|
5791
|
*)
|
|
5821
|
*)
|
|
5792
|
break
|
|
5822
|
break
|
|
5793
|
;;
|
|
5823
|
;;
|
|
5794
|
|
|
5824
|
|
|
5795
|
esac
|
|
5825
|
esac
|
|
5796
|
done
|
|
5826
|
done
|
|
5797
|
|
|
5827
|
|
|
5798
|
# :command.command_filter
|
|
5828
|
# :command.command_filter
|
|
5799
|
action="cli ishell"
|
|
5829
|
action="cli ishell"
|
|
5800
|
|
|
5830
|
|
|
5801
|
# :command.parse_requirements_while
|
|
5831
|
# :command.parse_requirements_while
|
|
5802
|
while [[ $# -gt 0 ]]; do
|
|
5832
|
while [[ $# -gt 0 ]]; do
|
|
5803
|
key="$1"
|
|
5833
|
key="$1"
|
|
5804
|
case "$key" in
|
|
5834
|
case "$key" in
|
|
5805
|
|
|
5835
|
|
|
5806
|
-?*)
|
|
5836
|
-?*)
|
|
5807
|
printf "invalid option: %s\n" "$key" >&2
|
|
5837
|
printf "invalid option: %s\n" "$key" >&2
|
|
5808
|
exit 1
|
|
5838
|
exit 1
|
|
5809
|
;;
|
|
5839
|
;;
|
|
5810
|
|
|
5840
|
|
|
5811
|
*)
|
|
5841
|
*)
|
|
5812
|
# :command.parse_requirements_case
|
|
5842
|
# :command.parse_requirements_case
|
|
5813
|
# :command.parse_requirements_case_simple
|
|
5843
|
# :command.parse_requirements_case_simple
|
|
5814
|
printf "invalid argument: %s\n" "$key" >&2
|
|
5844
|
printf "invalid argument: %s\n" "$key" >&2
|
|
5815
|
exit 1
|
|
5845
|
exit 1
|
|
5816
|
|
|
5846
|
|
|
5817
|
;;
|
|
5847
|
;;
|
|
5818
|
|
|
5848
|
|
|
5819
|
esac
|
|
5849
|
esac
|
|
5820
|
done
|
|
5850
|
done
|
|
5821
|
|
|
5851
|
|
|
5822
|
}
|
|
5852
|
}
|
|
5823
|
|
|
5853
|
|
|
5824
|
# :command.parse_requirements
|
|
5854
|
# :command.parse_requirements
|
|
5825
|
rcstack_cli_redis_parse_requirements() {
|
|
5855
|
rcstack_cli_redis_parse_requirements() {
|
|
5826
|
# :command.fixed_flags_filter
|
|
5856
|
# :command.fixed_flags_filter
|
|
5827
|
while [[ $# -gt 0 ]]; do
|
|
5857
|
while [[ $# -gt 0 ]]; do
|
|
5828
|
case "${1:-}" in
|
|
5858
|
case "${1:-}" in
|
|
5829
|
--help | -h)
|
|
5859
|
--help | -h)
|
|
5830
|
long_usage=yes
|
|
5860
|
long_usage=yes
|
|
5831
|
rcstack_cli_redis_usage
|
|
5861
|
rcstack_cli_redis_usage
|
|
5832
|
exit
|
|
5862
|
exit
|
|
5833
|
;;
|
|
5863
|
;;
|
|
5834
|
|
|
5864
|
|
|
5835
|
*)
|
|
5865
|
*)
|
|
5836
|
break
|
|
5866
|
break
|
|
5837
|
;;
|
|
5867
|
;;
|
|
5838
|
|
|
5868
|
|
|
5839
|
esac
|
|
5869
|
esac
|
|
5840
|
done
|
|
5870
|
done
|
|
5841
|
|
|
5871
|
|
|
5842
|
# :command.command_filter
|
|
5872
|
# :command.command_filter
|
|
5843
|
action="cli redis"
|
|
5873
|
action="cli redis"
|
|
5844
|
|
|
5874
|
|
|
5845
|
# :command.parse_requirements_while
|
|
5875
|
# :command.parse_requirements_while
|
|
5846
|
while [[ $# -gt 0 ]]; do
|
|
5876
|
while [[ $# -gt 0 ]]; do
|
|
5847
|
key="$1"
|
|
5877
|
key="$1"
|
|
5848
|
case "$key" in
|
|
5878
|
case "$key" in
|
|
5849
|
|
|
5879
|
|
|
5850
|
-?*)
|
|
5880
|
-?*)
|
|
5851
|
printf "invalid option: %s\n" "$key" >&2
|
|
5881
|
printf "invalid option: %s\n" "$key" >&2
|
|
5852
|
exit 1
|
|
5882
|
exit 1
|
|
5853
|
;;
|
|
5883
|
;;
|
|
5854
|
|
|
5884
|
|
|
5855
|
*)
|
|
5885
|
*)
|
|
5856
|
# :command.parse_requirements_case
|
|
5886
|
# :command.parse_requirements_case
|
|
5857
|
# :command.parse_requirements_case_simple
|
|
5887
|
# :command.parse_requirements_case_simple
|
|
5858
|
printf "invalid argument: %s\n" "$key" >&2
|
|
5888
|
printf "invalid argument: %s\n" "$key" >&2
|
|
5859
|
exit 1
|
|
5889
|
exit 1
|
|
5860
|
|
|
5890
|
|
|
5861
|
;;
|
|
5891
|
;;
|
|
5862
|
|
|
5892
|
|
|
5863
|
esac
|
|
5893
|
esac
|
|
5864
|
done
|
|
5894
|
done
|
|
5865
|
|
|
5895
|
|
|
5866
|
}
|
|
5896
|
}
|
|
5867
|
|
|
5897
|
|
|
5868
|
# :command.parse_requirements
|
|
5898
|
# :command.parse_requirements
|
|
5869
|
rcstack_cli_db_parse_requirements() {
|
|
5899
|
rcstack_cli_db_parse_requirements() {
|
|
5870
|
# :command.fixed_flags_filter
|
|
5900
|
# :command.fixed_flags_filter
|
|
5871
|
while [[ $# -gt 0 ]]; do
|
|
5901
|
while [[ $# -gt 0 ]]; do
|
|
5872
|
case "${1:-}" in
|
|
5902
|
case "${1:-}" in
|
|
5873
|
--help | -h)
|
|
5903
|
--help | -h)
|
|
5874
|
long_usage=yes
|
|
5904
|
long_usage=yes
|
|
5875
|
rcstack_cli_db_usage
|
|
5905
|
rcstack_cli_db_usage
|
|
5876
|
exit
|
|
5906
|
exit
|
|
5877
|
;;
|
|
5907
|
;;
|
|
5878
|
|
|
5908
|
|
|
5879
|
*)
|
|
5909
|
*)
|
|
5880
|
break
|
|
5910
|
break
|
|
5881
|
;;
|
|
5911
|
;;
|
|
5882
|
|
|
5912
|
|
|
5883
|
esac
|
|
5913
|
esac
|
|
5884
|
done
|
|
5914
|
done
|
|
5885
|
|
|
5915
|
|
|
5886
|
# :command.command_filter
|
|
5916
|
# :command.command_filter
|
|
5887
|
action="cli db"
|
|
5917
|
action="cli db"
|
|
5888
|
|
|
5918
|
|
|
5889
|
# :command.parse_requirements_while
|
|
5919
|
# :command.parse_requirements_while
|
|
5890
|
while [[ $# -gt 0 ]]; do
|
|
5920
|
while [[ $# -gt 0 ]]; do
|
|
5891
|
key="$1"
|
|
5921
|
key="$1"
|
|
5892
|
case "$key" in
|
|
5922
|
case "$key" in
|
|
5893
|
|
|
5923
|
|
|
5894
|
-?*)
|
|
5924
|
-?*)
|
|
5895
|
printf "invalid option: %s\n" "$key" >&2
|
|
5925
|
printf "invalid option: %s\n" "$key" >&2
|
|
5896
|
exit 1
|
|
5926
|
exit 1
|
|
5897
|
;;
|
|
5927
|
;;
|
|
5898
|
|
|
5928
|
|
|
5899
|
*)
|
|
5929
|
*)
|
|
5900
|
# :command.parse_requirements_case
|
|
5930
|
# :command.parse_requirements_case
|
|
5901
|
# :command.parse_requirements_case_simple
|
|
5931
|
# :command.parse_requirements_case_simple
|
|
5902
|
printf "invalid argument: %s\n" "$key" >&2
|
|
5932
|
printf "invalid argument: %s\n" "$key" >&2
|
|
5903
|
exit 1
|
|
5933
|
exit 1
|
|
5904
|
|
|
5934
|
|
|
5905
|
;;
|
|
5935
|
;;
|
|
5906
|
|
|
5936
|
|
|
5907
|
esac
|
|
5937
|
esac
|
|
5908
|
done
|
|
5938
|
done
|
|
5909
|
|
|
5939
|
|
|
5910
|
}
|
|
5940
|
}
|
|
5911
|
|
|
5941
|
|
|
5912
|
# :command.parse_requirements
|
|
5942
|
# :command.parse_requirements
|
|
5913
|
rcstack_cli_db_upgrade_parse_requirements() {
|
|
5943
|
rcstack_cli_db_upgrade_parse_requirements() {
|
|
5914
|
# :command.fixed_flags_filter
|
|
5944
|
# :command.fixed_flags_filter
|
|
5915
|
while [[ $# -gt 0 ]]; do
|
|
5945
|
while [[ $# -gt 0 ]]; do
|
|
5916
|
case "${1:-}" in
|
|
5946
|
case "${1:-}" in
|
|
5917
|
--help | -h)
|
|
5947
|
--help | -h)
|
|
5918
|
long_usage=yes
|
|
5948
|
long_usage=yes
|
|
5919
|
rcstack_cli_db_upgrade_usage
|
|
5949
|
rcstack_cli_db_upgrade_usage
|
|
5920
|
exit
|
|
5950
|
exit
|
|
5921
|
;;
|
|
5951
|
;;
|
|
5922
|
|
|
5952
|
|
|
5923
|
*)
|
|
5953
|
*)
|
|
5924
|
break
|
|
5954
|
break
|
|
5925
|
;;
|
|
5955
|
;;
|
|
5926
|
|
|
5956
|
|
|
5927
|
esac
|
|
5957
|
esac
|
|
5928
|
done
|
|
5958
|
done
|
|
5929
|
|
|
5959
|
|
|
5930
|
# :command.command_filter
|
|
5960
|
# :command.command_filter
|
|
5931
|
action="cli db-upgrade"
|
|
5961
|
action="cli db-upgrade"
|
|
5932
|
|
|
5962
|
|
|
5933
|
# :command.parse_requirements_while
|
|
5963
|
# :command.parse_requirements_while
|
|
5934
|
while [[ $# -gt 0 ]]; do
|
|
5964
|
while [[ $# -gt 0 ]]; do
|
|
5935
|
key="$1"
|
|
5965
|
key="$1"
|
|
5936
|
case "$key" in
|
|
5966
|
case "$key" in
|
|
5937
|
|
|
5967
|
|
|
5938
|
-?*)
|
|
5968
|
-?*)
|
|
5939
|
printf "invalid option: %s\n" "$key" >&2
|
|
5969
|
printf "invalid option: %s\n" "$key" >&2
|
|
5940
|
exit 1
|
|
5970
|
exit 1
|
|
5941
|
;;
|
|
5971
|
;;
|
|
5942
|
|
|
5972
|
|
|
5943
|
*)
|
|
5973
|
*)
|
|
5944
|
# :command.parse_requirements_case
|
|
5974
|
# :command.parse_requirements_case
|
|
5945
|
# :command.parse_requirements_case_simple
|
|
5975
|
# :command.parse_requirements_case_simple
|
|
5946
|
printf "invalid argument: %s\n" "$key" >&2
|
|
5976
|
printf "invalid argument: %s\n" "$key" >&2
|
|
5947
|
exit 1
|
|
5977
|
exit 1
|
|
5948
|
|
|
5978
|
|
|
5949
|
;;
|
|
5979
|
;;
|
|
5950
|
|
|
5980
|
|
|
5951
|
esac
|
|
5981
|
esac
|
|
5952
|
done
|
|
5982
|
done
|
|
5953
|
|
|
5983
|
|
|
5954
|
}
|
|
5984
|
}
|
|
5955
|
|
|
5985
|
|
|
5956
|
# :command.parse_requirements
|
|
5986
|
# :command.parse_requirements
|
|
5957
|
rcstack_cli_storage_parse_requirements() {
|
|
5987
|
rcstack_cli_storage_parse_requirements() {
|
|
5958
|
# :command.fixed_flags_filter
|
|
5988
|
# :command.fixed_flags_filter
|
|
5959
|
while [[ $# -gt 0 ]]; do
|
|
5989
|
while [[ $# -gt 0 ]]; do
|
|
5960
|
case "${1:-}" in
|
|
5990
|
case "${1:-}" in
|
|
5961
|
--help | -h)
|
|
5991
|
--help | -h)
|
|
5962
|
long_usage=yes
|
|
5992
|
long_usage=yes
|
|
5963
|
rcstack_cli_storage_usage
|
|
5993
|
rcstack_cli_storage_usage
|
|
5964
|
exit
|
|
5994
|
exit
|
|
5965
|
;;
|
|
5995
|
;;
|
|
5966
|
|
|
5996
|
|
|
5967
|
*)
|
|
5997
|
*)
|
|
5968
|
break
|
|
5998
|
break
|
|
5969
|
;;
|
|
5999
|
;;
|
|
5970
|
|
|
6000
|
|
|
5971
|
esac
|
|
6001
|
esac
|
|
5972
|
done
|
|
6002
|
done
|
|
5973
|
|
|
6003
|
|
|
5974
|
# :command.command_filter
|
|
6004
|
# :command.command_filter
|
|
5975
|
action="cli storage"
|
|
6005
|
action="cli storage"
|
|
5976
|
|
|
6006
|
|
|
5977
|
# :command.parse_requirements_while
|
|
6007
|
# :command.parse_requirements_while
|
|
5978
|
while [[ $# -gt 0 ]]; do
|
|
6008
|
while [[ $# -gt 0 ]]; do
|
|
5979
|
key="$1"
|
|
6009
|
key="$1"
|
|
5980
|
case "$key" in
|
|
6010
|
case "$key" in
|
|
5981
|
# :flag.case
|
|
6011
|
# :flag.case
|
|
5982
|
--attached)
|
|
6012
|
--attached)
|
|
5983
|
|
|
6013
|
|
|
5984
|
# :flag.case_arg
|
|
6014
|
# :flag.case_arg
|
|
5985
|
if [[ -n ${2+x} ]]; then
|
|
6015
|
if [[ -n ${2+x} ]]; then
|
|
5986
|
|
|
6016
|
|
|
5987
|
args['--attached']="$2"
|
|
6017
|
args['--attached']="$2"
|
|
5988
|
shift
|
|
6018
|
shift
|
|
5989
|
shift
|
|
6019
|
shift
|
|
5990
|
else
|
|
6020
|
else
|
|
5991
|
printf "%s\n" "--attached requires an argument: --attached ATTACHED" >&2
|
|
6021
|
printf "%s\n" "--attached requires an argument: --attached ATTACHED" >&2
|
|
5992
|
exit 1
|
|
6022
|
exit 1
|
|
5993
|
fi
|
|
6023
|
fi
|
|
5994
|
;;
|
|
6024
|
;;
|
|
5995
|
|
|
6025
|
|
|
5996
|
-?*)
|
|
6026
|
-?*)
|
|
5997
|
printf "invalid option: %s\n" "$key" >&2
|
|
6027
|
printf "invalid option: %s\n" "$key" >&2
|
|
5998
|
exit 1
|
|
6028
|
exit 1
|
|
5999
|
;;
|
|
6029
|
;;
|
|
6000
|
|
|
6030
|
|
|
6001
|
*)
|
|
6031
|
*)
|
|
6002
|
# :command.parse_requirements_case
|
|
6032
|
# :command.parse_requirements_case
|
|
6003
|
# :command.parse_requirements_case_simple
|
|
6033
|
# :command.parse_requirements_case_simple
|
|
6004
|
printf "invalid argument: %s\n" "$key" >&2
|
|
6034
|
printf "invalid argument: %s\n" "$key" >&2
|
|
6005
|
exit 1
|
|
6035
|
exit 1
|
|
6006
|
|
|
6036
|
|
|
6007
|
;;
|
|
6037
|
;;
|
|
6008
|
|
|
6038
|
|
|
6009
|
esac
|
|
6039
|
esac
|
|
6010
|
done
|
|
6040
|
done
|
|
6011
|
|
|
6041
|
|
|
6012
|
}
|
|
6042
|
}
|
|
6013
|
|
|
6043
|
|
|
6014
|
# :command.parse_requirements
|
|
6044
|
# :command.parse_requirements
|
|
6015
|
rcstack_cli_attach_parse_requirements() {
|
|
6045
|
rcstack_cli_attach_parse_requirements() {
|
|
6016
|
# :command.fixed_flags_filter
|
|
6046
|
# :command.fixed_flags_filter
|
|
6017
|
while [[ $# -gt 0 ]]; do
|
|
6047
|
while [[ $# -gt 0 ]]; do
|
|
6018
|
case "${1:-}" in
|
|
6048
|
case "${1:-}" in
|
|
6019
|
--help | -h)
|
|
6049
|
--help | -h)
|
|
6020
|
long_usage=yes
|
|
6050
|
long_usage=yes
|
|
6021
|
rcstack_cli_attach_usage
|
|
6051
|
rcstack_cli_attach_usage
|
|
6022
|
exit
|
|
6052
|
exit
|
|
6023
|
;;
|
|
6053
|
;;
|
|
6024
|
|
|
6054
|
|
|
6025
|
*)
|
|
6055
|
*)
|
|
6026
|
break
|
|
6056
|
break
|
|
6027
|
;;
|
|
6057
|
;;
|
|
6028
|
|
|
6058
|
|
|
6029
|
esac
|
|
6059
|
esac
|
|
6030
|
done
|
|
6060
|
done
|
|
6031
|
|
|
6061
|
|
|
6032
|
# :command.command_filter
|
|
6062
|
# :command.command_filter
|
|
6033
|
action="cli attach"
|
|
6063
|
action="cli attach"
|
|
6034
|
|
|
6064
|
|
|
6035
|
# :command.parse_requirements_while
|
|
6065
|
# :command.parse_requirements_while
|
|
6036
|
while [[ $# -gt 0 ]]; do
|
|
6066
|
while [[ $# -gt 0 ]]; do
|
|
6037
|
key="$1"
|
|
6067
|
key="$1"
|
|
6038
|
case "$key" in
|
|
6068
|
case "$key" in
|
|
6039
|
# :flag.case
|
|
6069
|
# :flag.case
|
|
6040
|
--instance-type)
|
|
6070
|
--instance-type)
|
|
6041
|
|
|
6071
|
|
|
6042
|
# :flag.case_arg
|
|
6072
|
# :flag.case_arg
|
|
6043
|
if [[ -n ${2+x} ]]; then
|
|
6073
|
if [[ -n ${2+x} ]]; then
|
|
6044
|
|
|
6074
|
|
|
6045
|
args['--instance-type']="$2"
|
|
6075
|
args['--instance-type']="$2"
|
|
6046
|
shift
|
|
6076
|
shift
|
|
6047
|
shift
|
|
6077
|
shift
|
|
6048
|
else
|
|
6078
|
else
|
|
6049
|
printf "%s\n" "--instance-type requires an argument: --instance-type INSTANCE_TYPE" >&2
|
|
6079
|
printf "%s\n" "--instance-type requires an argument: --instance-type INSTANCE_TYPE" >&2
|
|
6050
|
exit 1
|
|
6080
|
exit 1
|
|
6051
|
fi
|
|
6081
|
fi
|
|
6052
|
;;
|
|
6082
|
;;
|
|
6053
|
|
|
6083
|
|
|
6054
|
-?*)
|
|
6084
|
-?*)
|
|
6055
|
printf "invalid option: %s\n" "$key" >&2
|
|
6085
|
printf "invalid option: %s\n" "$key" >&2
|
|
6056
|
exit 1
|
|
6086
|
exit 1
|
|
6057
|
;;
|
|
6087
|
;;
|
|
6058
|
|
|
6088
|
|
|
6059
|
*)
|
|
6089
|
*)
|
|
6060
|
# :command.parse_requirements_case
|
|
6090
|
# :command.parse_requirements_case
|
|
6061
|
# :command.parse_requirements_case_simple
|
|
6091
|
# :command.parse_requirements_case_simple
|
|
6062
|
printf "invalid argument: %s\n" "$key" >&2
|
|
6092
|
printf "invalid argument: %s\n" "$key" >&2
|
|
6063
|
exit 1
|
|
6093
|
exit 1
|
|
6064
|
|
|
6094
|
|
|
6065
|
;;
|
|
6095
|
;;
|
|
6066
|
|
|
6096
|
|
|
6067
|
esac
|
|
6097
|
esac
|
|
6068
|
done
|
|
6098
|
done
|
|
6069
|
|
|
6099
|
|
|
6070
|
# :command.default_assignments
|
|
6100
|
# :command.default_assignments
|
|
6071
|
[[ -n ${args['--instance-type']:-} ]] || args['--instance-type']="rhodecode"
|
|
6101
|
[[ -n ${args['--instance-type']:-} ]] || args['--instance-type']="rhodecode"
|
|
6072
|
|
|
6102
|
|
|
6073
|
}
|
|
6103
|
}
|
|
6074
|
|
|
6104
|
|
|
6075
|
# :command.parse_requirements
|
|
6105
|
# :command.parse_requirements
|
|
6076
|
rcstack_cli_set_edition_parse_requirements() {
|
|
6106
|
rcstack_cli_set_edition_parse_requirements() {
|
|
6077
|
# :command.fixed_flags_filter
|
|
6107
|
# :command.fixed_flags_filter
|
|
6078
|
while [[ $# -gt 0 ]]; do
|
|
6108
|
while [[ $# -gt 0 ]]; do
|
|
6079
|
case "${1:-}" in
|
|
6109
|
case "${1:-}" in
|
|
6080
|
--help | -h)
|
|
6110
|
--help | -h)
|
|
6081
|
long_usage=yes
|
|
6111
|
long_usage=yes
|
|
6082
|
rcstack_cli_set_edition_usage
|
|
6112
|
rcstack_cli_set_edition_usage
|
|
6083
|
exit
|
|
6113
|
exit
|
|
6084
|
;;
|
|
6114
|
;;
|
|
6085
|
|
|
6115
|
|
|
6086
|
*)
|
|
6116
|
*)
|
|
6087
|
break
|
|
6117
|
break
|
|
6088
|
;;
|
|
6118
|
;;
|
|
6089
|
|
|
6119
|
|
|
6090
|
esac
|
|
6120
|
esac
|
|
6091
|
done
|
|
6121
|
done
|
|
6092
|
|
|
6122
|
|
|
6093
|
# :command.command_filter
|
|
6123
|
# :command.command_filter
|
|
6094
|
action="cli set-edition"
|
|
6124
|
action="cli set-edition"
|
|
6095
|
|
|
6125
|
|
|
6096
|
# :command.parse_requirements_while
|
|
6126
|
# :command.parse_requirements_while
|
|
6097
|
while [[ $# -gt 0 ]]; do
|
|
6127
|
while [[ $# -gt 0 ]]; do
|
|
6098
|
key="$1"
|
|
6128
|
key="$1"
|
|
6099
|
case "$key" in
|
|
6129
|
case "$key" in
|
|
6100
|
|
|
6130
|
|
|
6101
|
-?*)
|
|
6131
|
-?*)
|
|
6102
|
printf "invalid option: %s\n" "$key" >&2
|
|
6132
|
printf "invalid option: %s\n" "$key" >&2
|
|
6103
|
exit 1
|
|
6133
|
exit 1
|
|
6104
|
;;
|
|
6134
|
;;
|
|
6105
|
|
|
6135
|
|
|
6106
|
*)
|
|
6136
|
*)
|
|
6107
|
# :command.parse_requirements_case
|
|
6137
|
# :command.parse_requirements_case
|
|
6108
|
# :command.parse_requirements_case_simple
|
|
6138
|
# :command.parse_requirements_case_simple
|
|
6109
|
if [[ -z ${args['edition_type']+x} ]]; then
|
|
6139
|
if [[ -z ${args['edition_type']+x} ]]; then
|
|
6110
|
|
|
6140
|
|
|
6111
|
args['edition_type']=$1
|
|
6141
|
args['edition_type']=$1
|
|
6112
|
shift
|
|
6142
|
shift
|
|
6113
|
else
|
|
6143
|
else
|
|
6114
|
printf "invalid argument: %s\n" "$key" >&2
|
|
6144
|
printf "invalid argument: %s\n" "$key" >&2
|
|
6115
|
exit 1
|
|
6145
|
exit 1
|
|
6116
|
fi
|
|
6146
|
fi
|
|
6117
|
|
|
6147
|
|
|
6118
|
;;
|
|
6148
|
;;
|
|
6119
|
|
|
6149
|
|
|
6120
|
esac
|
|
6150
|
esac
|
|
6121
|
done
|
|
6151
|
done
|
|
6122
|
|
|
6152
|
|
|
6123
|
# :command.required_args_filter
|
|
6153
|
# :command.required_args_filter
|
|
6124
|
if [[ -z ${args['edition_type']+x} ]]; then
|
|
6154
|
if [[ -z ${args['edition_type']+x} ]]; then
|
|
6125
|
printf "missing required argument: EDITION_TYPE\nusage: rcstack cli set-edition EDITION_TYPE\n" >&2
|
|
6155
|
printf "missing required argument: EDITION_TYPE\nusage: rcstack cli set-edition EDITION_TYPE\n" >&2
|
|
6126
|
exit 1
|
|
6156
|
exit 1
|
|
6127
|
fi
|
|
6157
|
fi
|
|
6128
|
|
|
6158
|
|
|
6129
|
# :command.whitelist_filter
|
|
6159
|
# :command.whitelist_filter
|
|
6130
|
if [[ -n ${args['edition_type']} ]] && [[ ! ${args['edition_type']} =~ ^(ce|ee)$ ]]; then
|
|
6160
|
if [[ -n ${args['edition_type']} ]] && [[ ! ${args['edition_type']} =~ ^(ce|ee)$ ]]; then
|
|
6131
|
printf "%s\n" "edition_type must be one of: ce, ee" >&2
|
|
6161
|
printf "%s\n" "edition_type must be one of: ce, ee" >&2
|
|
6132
|
exit 1
|
|
6162
|
exit 1
|
|
6133
|
fi
|
|
6163
|
fi
|
|
6134
|
|
|
6164
|
|
|
6135
|
}
|
|
6165
|
}
|
|
6136
|
|
|
6166
|
|
|
6137
|
# :command.parse_requirements
|
|
6167
|
# :command.parse_requirements
|
|
6138
|
rcstack_cli_configure_vcsserver_parse_requirements() {
|
|
6168
|
rcstack_cli_configure_vcsserver_parse_requirements() {
|
|
6139
|
# :command.fixed_flags_filter
|
|
6169
|
# :command.fixed_flags_filter
|
|
6140
|
while [[ $# -gt 0 ]]; do
|
|
6170
|
while [[ $# -gt 0 ]]; do
|
|
6141
|
case "${1:-}" in
|
|
6171
|
case "${1:-}" in
|
|
6142
|
--help | -h)
|
|
6172
|
--help | -h)
|
|
6143
|
long_usage=yes
|
|
6173
|
long_usage=yes
|
|
6144
|
rcstack_cli_configure_vcsserver_usage
|
|
6174
|
rcstack_cli_configure_vcsserver_usage
|
|
6145
|
exit
|
|
6175
|
exit
|
|
6146
|
;;
|
|
6176
|
;;
|
|
6147
|
|
|
6177
|
|
|
6148
|
*)
|
|
6178
|
*)
|
|
6149
|
break
|
|
6179
|
break
|
|
6150
|
;;
|
|
6180
|
;;
|
|
6151
|
|
|
6181
|
|
|
6152
|
esac
|
|
6182
|
esac
|
|
6153
|
done
|
|
6183
|
done
|
|
6154
|
|
|
6184
|
|
|
6155
|
# :command.command_filter
|
|
6185
|
# :command.command_filter
|
|
6156
|
action="cli configure-vcsserver"
|
|
6186
|
action="cli configure-vcsserver"
|
|
6157
|
|
|
6187
|
|
|
6158
|
# :command.parse_requirements_while
|
|
6188
|
# :command.parse_requirements_while
|
|
6159
|
while [[ $# -gt 0 ]]; do
|
|
6189
|
while [[ $# -gt 0 ]]; do
|
|
6160
|
key="$1"
|
|
6190
|
key="$1"
|
|
6161
|
case "$key" in
|
|
6191
|
case "$key" in
|
|
6162
|
|
|
6192
|
|
|
6163
|
-?*)
|
|
6193
|
-?*)
|
|
6164
|
printf "invalid option: %s\n" "$key" >&2
|
|
6194
|
printf "invalid option: %s\n" "$key" >&2
|
|
6165
|
exit 1
|
|
6195
|
exit 1
|
|
6166
|
;;
|
|
6196
|
;;
|
|
6167
|
|
|
6197
|
|
|
6168
|
*)
|
|
6198
|
*)
|
|
6169
|
# :command.parse_requirements_case
|
|
6199
|
# :command.parse_requirements_case
|
|
6170
|
# :command.parse_requirements_case_simple
|
|
6200
|
# :command.parse_requirements_case_simple
|
|
6171
|
if [[ -z ${args['ini_path']+x} ]]; then
|
|
6201
|
if [[ -z ${args['ini_path']+x} ]]; then
|
|
6172
|
# :argument.validations
|
|
6202
|
# :argument.validations
|
|
6173
|
if [[ -n $(validate_file_exists "$1") ]]; then
|
|
6203
|
if [[ -n $(validate_file_exists "$1") ]]; then
|
|
6174
|
printf "validation error in %s:\n%s\n" "INI_PATH" "$(validate_file_exists "$1")" >&2
|
|
6204
|
printf "validation error in %s:\n%s\n" "INI_PATH" "$(validate_file_exists "$1")" >&2
|
|
6175
|
exit 1
|
|
6205
|
exit 1
|
|
6176
|
fi
|
|
6206
|
fi
|
|
6177
|
|
|
6207
|
|
|
6178
|
args['ini_path']=$1
|
|
6208
|
args['ini_path']=$1
|
|
6179
|
shift
|
|
6209
|
shift
|
|
6180
|
else
|
|
6210
|
else
|
|
6181
|
printf "invalid argument: %s\n" "$key" >&2
|
|
6211
|
printf "invalid argument: %s\n" "$key" >&2
|
|
6182
|
exit 1
|
|
6212
|
exit 1
|
|
6183
|
fi
|
|
6213
|
fi
|
|
6184
|
|
|
6214
|
|
|
6185
|
;;
|
|
6215
|
;;
|
|
6186
|
|
|
6216
|
|
|
6187
|
esac
|
|
6217
|
esac
|
|
6188
|
done
|
|
6218
|
done
|
|
6189
|
|
|
6219
|
|
|
6190
|
# :command.required_args_filter
|
|
6220
|
# :command.required_args_filter
|
|
6191
|
if [[ -z ${args['ini_path']+x} ]]; then
|
|
6221
|
if [[ -z ${args['ini_path']+x} ]]; then
|
|
6192
|
printf "missing required argument: INI_PATH\nusage: rcstack cli configure-vcsserver INI_PATH\n" >&2
|
|
6222
|
printf "missing required argument: INI_PATH\nusage: rcstack cli configure-vcsserver INI_PATH\n" >&2
|
|
6193
|
exit 1
|
|
6223
|
exit 1
|
|
6194
|
fi
|
|
6224
|
fi
|
|
6195
|
|
|
6225
|
|
|
6196
|
}
|
|
6226
|
}
|
|
6197
|
|
|
6227
|
|
|
6198
|
# :command.parse_requirements
|
|
6228
|
# :command.parse_requirements
|
|
6199
|
rcstack_cli_configure_rhodecode_parse_requirements() {
|
|
6229
|
rcstack_cli_configure_rhodecode_parse_requirements() {
|
|
6200
|
# :command.fixed_flags_filter
|
|
6230
|
# :command.fixed_flags_filter
|
|
6201
|
while [[ $# -gt 0 ]]; do
|
|
6231
|
while [[ $# -gt 0 ]]; do
|
|
6202
|
case "${1:-}" in
|
|
6232
|
case "${1:-}" in
|
|
6203
|
--help | -h)
|
|
6233
|
--help | -h)
|
|
6204
|
long_usage=yes
|
|
6234
|
long_usage=yes
|
|
6205
|
rcstack_cli_configure_rhodecode_usage
|
|
6235
|
rcstack_cli_configure_rhodecode_usage
|
|
6206
|
exit
|
|
6236
|
exit
|
|
6207
|
;;
|
|
6237
|
;;
|
|
6208
|
|
|
6238
|
|
|
6209
|
*)
|
|
6239
|
*)
|
|
6210
|
break
|
|
6240
|
break
|
|
6211
|
;;
|
|
6241
|
;;
|
|
6212
|
|
|
6242
|
|
|
6213
|
esac
|
|
6243
|
esac
|
|
6214
|
done
|
|
6244
|
done
|
|
6215
|
|
|
6245
|
|
|
6216
|
# :command.command_filter
|
|
6246
|
# :command.command_filter
|
|
6217
|
action="cli configure-rhodecode"
|
|
6247
|
action="cli configure-rhodecode"
|
|
6218
|
|
|
6248
|
|
|
6219
|
# :command.parse_requirements_while
|
|
6249
|
# :command.parse_requirements_while
|
|
6220
|
while [[ $# -gt 0 ]]; do
|
|
6250
|
while [[ $# -gt 0 ]]; do
|
|
6221
|
key="$1"
|
|
6251
|
key="$1"
|
|
6222
|
case "$key" in
|
|
6252
|
case "$key" in
|
|
6223
|
|
|
6253
|
|
|
6224
|
-?*)
|
|
6254
|
-?*)
|
|
6225
|
printf "invalid option: %s\n" "$key" >&2
|
|
6255
|
printf "invalid option: %s\n" "$key" >&2
|
|
6226
|
exit 1
|
|
6256
|
exit 1
|
|
6227
|
;;
|
|
6257
|
;;
|
|
6228
|
|
|
6258
|
|
|
6229
|
*)
|
|
6259
|
*)
|
|
6230
|
# :command.parse_requirements_case
|
|
6260
|
# :command.parse_requirements_case
|
|
6231
|
# :command.parse_requirements_case_simple
|
|
6261
|
# :command.parse_requirements_case_simple
|
|
6232
|
if [[ -z ${args['ini_path']+x} ]]; then
|
|
6262
|
if [[ -z ${args['ini_path']+x} ]]; then
|
|
6233
|
# :argument.validations
|
|
6263
|
# :argument.validations
|
|
6234
|
if [[ -n $(validate_file_exists "$1") ]]; then
|
|
6264
|
if [[ -n $(validate_file_exists "$1") ]]; then
|
|
6235
|
printf "validation error in %s:\n%s\n" "INI_PATH" "$(validate_file_exists "$1")" >&2
|
|
6265
|
printf "validation error in %s:\n%s\n" "INI_PATH" "$(validate_file_exists "$1")" >&2
|
|
6236
|
exit 1
|
|
6266
|
exit 1
|
|
6237
|
fi
|
|
6267
|
fi
|
|
6238
|
|
|
6268
|
|
|
6239
|
args['ini_path']=$1
|
|
6269
|
args['ini_path']=$1
|
|
6240
|
shift
|
|
6270
|
shift
|
|
6241
|
else
|
|
6271
|
else
|
|
6242
|
printf "invalid argument: %s\n" "$key" >&2
|
|
6272
|
printf "invalid argument: %s\n" "$key" >&2
|
|
6243
|
exit 1
|
|
6273
|
exit 1
|
|
6244
|
fi
|
|
6274
|
fi
|
|
6245
|
|
|
6275
|
|
|
6246
|
;;
|
|
6276
|
;;
|
|
6247
|
|
|
6277
|
|
|
6248
|
esac
|
|
6278
|
esac
|
|
6249
|
done
|
|
6279
|
done
|
|
6250
|
|
|
6280
|
|
|
6251
|
# :command.required_args_filter
|
|
6281
|
# :command.required_args_filter
|
|
6252
|
if [[ -z ${args['ini_path']+x} ]]; then
|
|
6282
|
if [[ -z ${args['ini_path']+x} ]]; then
|
|
6253
|
printf "missing required argument: INI_PATH\nusage: rcstack cli configure-rhodecode INI_PATH\n" >&2
|
|
6283
|
printf "missing required argument: INI_PATH\nusage: rcstack cli configure-rhodecode INI_PATH\n" >&2
|
|
6254
|
exit 1
|
|
6284
|
exit 1
|
|
6255
|
fi
|
|
6285
|
fi
|
|
6256
|
|
|
6286
|
|
|
6257
|
}
|
|
6287
|
}
|
|
6258
|
|
|
6288
|
|
|
6259
|
# :command.parse_requirements
|
|
6289
|
# :command.parse_requirements
|
|
6260
|
rcstack_backup_db_parse_requirements() {
|
|
6290
|
rcstack_backup_db_parse_requirements() {
|
|
6261
|
# :command.fixed_flags_filter
|
|
6291
|
# :command.fixed_flags_filter
|
|
6262
|
while [[ $# -gt 0 ]]; do
|
|
6292
|
while [[ $# -gt 0 ]]; do
|
|
6263
|
case "${1:-}" in
|
|
6293
|
case "${1:-}" in
|
|
6264
|
--help | -h)
|
|
6294
|
--help | -h)
|
|
6265
|
long_usage=yes
|
|
6295
|
long_usage=yes
|
|
6266
|
rcstack_backup_db_usage
|
|
6296
|
rcstack_backup_db_usage
|
|
6267
|
exit
|
|
6297
|
exit
|
|
6268
|
;;
|
|
6298
|
;;
|
|
6269
|
|
|
6299
|
|
|
6270
|
*)
|
|
6300
|
*)
|
|
6271
|
break
|
|
6301
|
break
|
|
6272
|
;;
|
|
6302
|
;;
|
|
6273
|
|
|
6303
|
|
|
6274
|
esac
|
|
6304
|
esac
|
|
6275
|
done
|
|
6305
|
done
|
|
6276
|
|
|
6306
|
|
|
6277
|
# :command.dependencies_filter
|
|
6307
|
# :command.dependencies_filter
|
|
6278
|
if command -v tar >/dev/null 2>&1; then
|
|
6308
|
if command -v tar >/dev/null 2>&1; then
|
|
6279
|
deps['tar']="$(command -v tar | head -n1)"
|
|
6309
|
deps['tar']="$(command -v tar | head -n1)"
|
|
6280
|
else
|
|
6310
|
else
|
|
6281
|
printf "missing dependency: tar\n" >&2
|
|
6311
|
printf "missing dependency: tar\n" >&2
|
|
6282
|
exit 1
|
|
6312
|
exit 1
|
|
6283
|
fi
|
|
6313
|
fi
|
|
6284
|
|
|
6314
|
|
|
6285
|
if command -v gzip >/dev/null 2>&1; then
|
|
6315
|
if command -v gzip >/dev/null 2>&1; then
|
|
6286
|
deps['gzip']="$(command -v gzip | head -n1)"
|
|
6316
|
deps['gzip']="$(command -v gzip | head -n1)"
|
|
6287
|
else
|
|
6317
|
else
|
|
6288
|
printf "missing dependency: gzip\n" >&2
|
|
6318
|
printf "missing dependency: gzip\n" >&2
|
|
6289
|
exit 1
|
|
6319
|
exit 1
|
|
6290
|
fi
|
|
6320
|
fi
|
|
6291
|
|
|
6321
|
|
|
6292
|
# :command.command_filter
|
|
6322
|
# :command.command_filter
|
|
6293
|
action="backup-db"
|
|
6323
|
action="backup-db"
|
|
6294
|
|
|
6324
|
|
|
6295
|
# :command.parse_requirements_while
|
|
6325
|
# :command.parse_requirements_while
|
|
6296
|
while [[ $# -gt 0 ]]; do
|
|
6326
|
while [[ $# -gt 0 ]]; do
|
|
6297
|
key="$1"
|
|
6327
|
key="$1"
|
|
6298
|
case "$key" in
|
|
6328
|
case "$key" in
|
|
6299
|
|
|
6329
|
|
|
6300
|
-?*)
|
|
6330
|
-?*)
|
|
6301
|
printf "invalid option: %s\n" "$key" >&2
|
|
6331
|
printf "invalid option: %s\n" "$key" >&2
|
|
6302
|
exit 1
|
|
6332
|
exit 1
|
|
6303
|
;;
|
|
6333
|
;;
|
|
6304
|
|
|
6334
|
|
|
6305
|
*)
|
|
6335
|
*)
|
|
6306
|
# :command.parse_requirements_case
|
|
6336
|
# :command.parse_requirements_case
|
|
6307
|
# :command.parse_requirements_case_simple
|
|
6337
|
# :command.parse_requirements_case_simple
|
|
6308
|
printf "invalid argument: %s\n" "$key" >&2
|
|
6338
|
printf "invalid argument: %s\n" "$key" >&2
|
|
6309
|
exit 1
|
|
6339
|
exit 1
|
|
6310
|
|
|
6340
|
|
|
6311
|
;;
|
|
6341
|
;;
|
|
6312
|
|
|
6342
|
|
|
6313
|
esac
|
|
6343
|
esac
|
|
6314
|
done
|
|
6344
|
done
|
|
6315
|
|
|
6345
|
|
|
6316
|
}
|
|
6346
|
}
|
|
6317
|
|
|
6347
|
|
|
6318
|
# :command.parse_requirements
|
|
6348
|
# :command.parse_requirements
|
|
6319
|
rcstack_backup_data_parse_requirements() {
|
|
6349
|
rcstack_backup_data_parse_requirements() {
|
|
6320
|
# :command.fixed_flags_filter
|
|
6350
|
# :command.fixed_flags_filter
|
|
6321
|
while [[ $# -gt 0 ]]; do
|
|
6351
|
while [[ $# -gt 0 ]]; do
|
|
6322
|
case "${1:-}" in
|
|
6352
|
case "${1:-}" in
|
|
6323
|
--help | -h)
|
|
6353
|
--help | -h)
|
|
6324
|
long_usage=yes
|
|
6354
|
long_usage=yes
|
|
6325
|
rcstack_backup_data_usage
|
|
6355
|
rcstack_backup_data_usage
|
|
6326
|
exit
|
|
6356
|
exit
|
|
6327
|
;;
|
|
6357
|
;;
|
|
6328
|
|
|
6358
|
|
|
6329
|
*)
|
|
6359
|
*)
|
|
6330
|
break
|
|
6360
|
break
|
|
6331
|
;;
|
|
6361
|
;;
|
|
6332
|
|
|
6362
|
|
|
6333
|
esac
|
|
6363
|
esac
|
|
6334
|
done
|
|
6364
|
done
|
|
6335
|
|
|
6365
|
|
|
6336
|
# :command.dependencies_filter
|
|
6366
|
# :command.dependencies_filter
|
|
6337
|
if command -v tar >/dev/null 2>&1; then
|
|
6367
|
if command -v tar >/dev/null 2>&1; then
|
|
6338
|
deps['tar']="$(command -v tar | head -n1)"
|
|
6368
|
deps['tar']="$(command -v tar | head -n1)"
|
|
6339
|
else
|
|
6369
|
else
|
|
6340
|
printf "missing dependency: tar\n" >&2
|
|
6370
|
printf "missing dependency: tar\n" >&2
|
|
6341
|
exit 1
|
|
6371
|
exit 1
|
|
6342
|
fi
|
|
6372
|
fi
|
|
6343
|
|
|
6373
|
|
|
6344
|
if command -v gzip >/dev/null 2>&1; then
|
|
6374
|
if command -v gzip >/dev/null 2>&1; then
|
|
6345
|
deps['gzip']="$(command -v gzip | head -n1)"
|
|
6375
|
deps['gzip']="$(command -v gzip | head -n1)"
|
|
6346
|
else
|
|
6376
|
else
|
|
6347
|
printf "missing dependency: gzip\n" >&2
|
|
6377
|
printf "missing dependency: gzip\n" >&2
|
|
6348
|
exit 1
|
|
6378
|
exit 1
|
|
6349
|
fi
|
|
6379
|
fi
|
|
6350
|
|
|
6380
|
|
|
6351
|
# :command.command_filter
|
|
6381
|
# :command.command_filter
|
|
6352
|
action="backup-data"
|
|
6382
|
action="backup-data"
|
|
6353
|
|
|
6383
|
|
|
6354
|
# :command.parse_requirements_while
|
|
6384
|
# :command.parse_requirements_while
|
|
6355
|
while [[ $# -gt 0 ]]; do
|
|
6385
|
while [[ $# -gt 0 ]]; do
|
|
6356
|
key="$1"
|
|
6386
|
key="$1"
|
|
6357
|
case "$key" in
|
|
6387
|
case "$key" in
|
|
6358
|
|
|
6388
|
|
|
6359
|
-?*)
|
|
6389
|
-?*)
|
|
6360
|
printf "invalid option: %s\n" "$key" >&2
|
|
6390
|
printf "invalid option: %s\n" "$key" >&2
|
|
6361
|
exit 1
|
|
6391
|
exit 1
|
|
6362
|
;;
|
|
6392
|
;;
|
|
6363
|
|
|
6393
|
|
|
6364
|
*)
|
|
6394
|
*)
|
|
6365
|
# :command.parse_requirements_case
|
|
6395
|
# :command.parse_requirements_case
|
|
6366
|
# :command.parse_requirements_case_simple
|
|
6396
|
# :command.parse_requirements_case_simple
|
|
6367
|
printf "invalid argument: %s\n" "$key" >&2
|
|
6397
|
printf "invalid argument: %s\n" "$key" >&2
|
|
6368
|
exit 1
|
|
6398
|
exit 1
|
|
6369
|
|
|
6399
|
|
|
6370
|
;;
|
|
6400
|
;;
|
|
6371
|
|
|
6401
|
|
|
6372
|
esac
|
|
6402
|
esac
|
|
6373
|
done
|
|
6403
|
done
|
|
6374
|
|
|
6404
|
|
|
6375
|
}
|
|
6405
|
}
|
|
6376
|
|
|
6406
|
|
|
6377
|
# :command.parse_requirements
|
|
6407
|
# :command.parse_requirements
|
|
6378
|
rcstack_get_build_artifacts_parse_requirements() {
|
|
6408
|
rcstack_get_build_artifacts_parse_requirements() {
|
|
6379
|
# :command.fixed_flags_filter
|
|
6409
|
# :command.fixed_flags_filter
|
|
6380
|
while [[ $# -gt 0 ]]; do
|
|
6410
|
while [[ $# -gt 0 ]]; do
|
|
6381
|
case "${1:-}" in
|
|
6411
|
case "${1:-}" in
|
|
6382
|
--help | -h)
|
|
6412
|
--help | -h)
|
|
6383
|
long_usage=yes
|
|
6413
|
long_usage=yes
|
|
6384
|
rcstack_get_build_artifacts_usage
|
|
6414
|
rcstack_get_build_artifacts_usage
|
|
6385
|
exit
|
|
6415
|
exit
|
|
6386
|
;;
|
|
6416
|
;;
|
|
6387
|
|
|
6417
|
|
|
6388
|
*)
|
|
6418
|
*)
|
|
6389
|
break
|
|
6419
|
break
|
|
6390
|
;;
|
|
6420
|
;;
|
|
6391
|
|
|
6421
|
|
|
6392
|
esac
|
|
6422
|
esac
|
|
6393
|
done
|
|
6423
|
done
|
|
6394
|
|
|
6424
|
|
|
6395
|
# :command.command_filter
|
|
6425
|
# :command.command_filter
|
|
6396
|
action="get-build-artifacts"
|
|
6426
|
action="get-build-artifacts"
|
|
6397
|
|
|
6427
|
|
|
6398
|
# :command.parse_requirements_while
|
|
6428
|
# :command.parse_requirements_while
|
|
6399
|
while [[ $# -gt 0 ]]; do
|
|
6429
|
while [[ $# -gt 0 ]]; do
|
|
6400
|
key="$1"
|
|
6430
|
key="$1"
|
|
6401
|
case "$key" in
|
|
6431
|
case "$key" in
|
|
6402
|
# :flag.case
|
|
6432
|
# :flag.case
|
|
6403
|
--auth)
|
|
6433
|
--auth)
|
|
6404
|
|
|
6434
|
|
|
6405
|
# :flag.case_arg
|
|
6435
|
# :flag.case_arg
|
|
6406
|
if [[ -n ${2+x} ]]; then
|
|
6436
|
if [[ -n ${2+x} ]]; then
|
|
6407
|
|
|
6437
|
|
|
6408
|
args['--auth']="$2"
|
|
6438
|
args['--auth']="$2"
|
|
6409
|
shift
|
|
6439
|
shift
|
|
6410
|
shift
|
|
6440
|
shift
|
|
6411
|
else
|
|
6441
|
else
|
|
6412
|
printf "%s\n" "--auth requires an argument: --auth AUTH" >&2
|
|
6442
|
printf "%s\n" "--auth requires an argument: --auth AUTH" >&2
|
|
6413
|
exit 1
|
|
6443
|
exit 1
|
|
6414
|
fi
|
|
6444
|
fi
|
|
6415
|
;;
|
|
6445
|
;;
|
|
6416
|
|
|
6446
|
|
|
6417
|
# :flag.case
|
|
6447
|
# :flag.case
|
|
6418
|
--installer-url)
|
|
6448
|
--installer-url)
|
|
6419
|
|
|
6449
|
|
|
6420
|
# :flag.case_arg
|
|
6450
|
# :flag.case_arg
|
|
6421
|
if [[ -n ${2+x} ]]; then
|
|
6451
|
if [[ -n ${2+x} ]]; then
|
|
6422
|
|
|
6452
|
|
|
6423
|
args['--installer-url']="$2"
|
|
6453
|
args['--installer-url']="$2"
|
|
6424
|
shift
|
|
6454
|
shift
|
|
6425
|
shift
|
|
6455
|
shift
|
|
6426
|
else
|
|
6456
|
else
|
|
6427
|
printf "%s\n" "--installer-url requires an argument: --installer-url INSTALLER_URL" >&2
|
|
6457
|
printf "%s\n" "--installer-url requires an argument: --installer-url INSTALLER_URL" >&2
|
|
6428
|
exit 1
|
|
6458
|
exit 1
|
|
6429
|
fi
|
|
6459
|
fi
|
|
6430
|
;;
|
|
6460
|
;;
|
|
6431
|
|
|
6461
|
|
|
6432
|
# :flag.case
|
|
6462
|
# :flag.case
|
|
6433
|
--manifest-url)
|
|
6463
|
--manifest-url)
|
|
6434
|
|
|
6464
|
|
|
6435
|
# :flag.case_arg
|
|
6465
|
# :flag.case_arg
|
|
6436
|
if [[ -n ${2+x} ]]; then
|
|
6466
|
if [[ -n ${2+x} ]]; then
|
|
6437
|
|
|
6467
|
|
|
6438
|
args['--manifest-url']="$2"
|
|
6468
|
args['--manifest-url']="$2"
|
|
6439
|
shift
|
|
6469
|
shift
|
|
6440
|
shift
|
|
6470
|
shift
|
|
6441
|
else
|
|
6471
|
else
|
|
6442
|
printf "%s\n" "--manifest-url requires an argument: --manifest-url MANIFEST_URL" >&2
|
|
6472
|
printf "%s\n" "--manifest-url requires an argument: --manifest-url MANIFEST_URL" >&2
|
|
6443
|
exit 1
|
|
6473
|
exit 1
|
|
6444
|
fi
|
|
6474
|
fi
|
|
6445
|
;;
|
|
6475
|
;;
|
|
6446
|
|
|
6476
|
|
|
6447
|
# :flag.case
|
|
6477
|
# :flag.case
|
|
6448
|
--version-name)
|
|
6478
|
--version-name)
|
|
6449
|
|
|
6479
|
|
|
6450
|
# :flag.case_arg
|
|
6480
|
# :flag.case_arg
|
|
6451
|
if [[ -n ${2+x} ]]; then
|
|
6481
|
if [[ -n ${2+x} ]]; then
|
|
6452
|
|
|
6482
|
|
|
6453
|
args['--version-name']="$2"
|
|
6483
|
args['--version-name']="$2"
|
|
6454
|
shift
|
|
6484
|
shift
|
|
6455
|
shift
|
|
6485
|
shift
|
|
6456
|
else
|
|
6486
|
else
|
|
6457
|
printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2
|
|
6487
|
printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2
|
|
6458
|
exit 1
|
|
6488
|
exit 1
|
|
6459
|
fi
|
|
6489
|
fi
|
|
6460
|
;;
|
|
6490
|
;;
|
|
6461
|
|
|
6491
|
|
|
6462
|
-?*)
|
|
6492
|
-?*)
|
|
6463
|
printf "invalid option: %s\n" "$key" >&2
|
|
6493
|
printf "invalid option: %s\n" "$key" >&2
|
|
6464
|
exit 1
|
|
6494
|
exit 1
|
|
6465
|
;;
|
|
6495
|
;;
|
|
6466
|
|
|
6496
|
|
|
6467
|
*)
|
|
6497
|
*)
|
|
6468
|
# :command.parse_requirements_case
|
|
6498
|
# :command.parse_requirements_case
|
|
6469
|
# :command.parse_requirements_case_simple
|
|
6499
|
# :command.parse_requirements_case_simple
|
|
6470
|
printf "invalid argument: %s\n" "$key" >&2
|
|
6500
|
printf "invalid argument: %s\n" "$key" >&2
|
|
6471
|
exit 1
|
|
6501
|
exit 1
|
|
6472
|
|
|
6502
|
|
|
6473
|
;;
|
|
6503
|
;;
|
|
6474
|
|
|
6504
|
|
|
6475
|
esac
|
|
6505
|
esac
|
|
6476
|
done
|
|
6506
|
done
|
|
6477
|
|
|
6507
|
|
|
6478
|
# :command.default_assignments
|
|
6508
|
# :command.default_assignments
|
|
6479
|
[[ -n ${args['--auth']:-} ]] || args['--auth']=""
|
|
6509
|
[[ -n ${args['--auth']:-} ]] || args['--auth']=""
|
|
6480
|
[[ -n ${args['--installer-url']:-} ]] || args['--installer-url']="https://dls.rhodecode.com/dls/N2E2ZTY1NzA3NjYxNDA2NTc1NjI3MTcyNzA2MjcxNzIyZTcwNjI3YQ==/rhodecode-control/latest-linux-ee"
|
|
6510
|
[[ -n ${args['--installer-url']:-} ]] || args['--installer-url']="https://dls.rhodecode.com/dls/N2E2ZTY1NzA3NjYxNDA2NTc1NjI3MTcyNzA2MjcxNzIyZTcwNjI3YQ==/rhodecode-control/latest-linux-ee"
|
|
6481
|
[[ -n ${args['--manifest-url']:-} ]] || args['--manifest-url']="https://dls.rhodecode.com/linux/MANIFEST"
|
|
6511
|
[[ -n ${args['--manifest-url']:-} ]] || args['--manifest-url']="https://dls.rhodecode.com/linux/MANIFEST"
|
|
6482
|
[[ -n ${args['--version-name']:-} ]] || args['--version-name']="$RC_CLI_VERSION_NAME"
|
|
6512
|
[[ -n ${args['--version-name']:-} ]] || args['--version-name']="$RC_CLI_VERSION_NAME"
|
|
6483
|
|
|
6513
|
|
|
6484
|
}
|
|
6514
|
}
|
|
6485
|
|
|
6515
|
|
|
6486
|
# :command.parse_requirements
|
|
6516
|
# :command.parse_requirements
|
|
6487
|
rcstack_build_installer_parse_requirements() {
|
|
6517
|
rcstack_build_installer_parse_requirements() {
|
|
6488
|
# :command.fixed_flags_filter
|
|
6518
|
# :command.fixed_flags_filter
|
|
6489
|
while [[ $# -gt 0 ]]; do
|
|
6519
|
while [[ $# -gt 0 ]]; do
|
|
6490
|
case "${1:-}" in
|
|
6520
|
case "${1:-}" in
|
|
6491
|
--help | -h)
|
|
6521
|
--help | -h)
|
|
6492
|
long_usage=yes
|
|
6522
|
long_usage=yes
|
|
6493
|
rcstack_build_installer_usage
|
|
6523
|
rcstack_build_installer_usage
|
|
6494
|
exit
|
|
6524
|
exit
|
|
6495
|
;;
|
|
6525
|
;;
|
|
6496
|
|
|
6526
|
|
|
6497
|
*)
|
|
6527
|
*)
|
|
6498
|
break
|
|
6528
|
break
|
|
6499
|
;;
|
|
6529
|
;;
|
|
6500
|
|
|
6530
|
|
|
6501
|
esac
|
|
6531
|
esac
|
|
6502
|
done
|
|
6532
|
done
|
|
6503
|
|
|
6533
|
|
|
6504
|
# :command.command_filter
|
|
6534
|
# :command.command_filter
|
|
6505
|
action="build-installer"
|
|
6535
|
action="build-installer"
|
|
6506
|
|
|
6536
|
|
|
6507
|
# :command.parse_requirements_while
|
|
6537
|
# :command.parse_requirements_while
|
|
6508
|
while [[ $# -gt 0 ]]; do
|
|
6538
|
while [[ $# -gt 0 ]]; do
|
|
6509
|
key="$1"
|
|
6539
|
key="$1"
|
|
6510
|
case "$key" in
|
|
6540
|
case "$key" in
|
|
6511
|
# :flag.case
|
|
6541
|
# :flag.case
|
|
6512
|
--version-name)
|
|
6542
|
--version-name)
|
|
6513
|
|
|
6543
|
|
|
6514
|
# :flag.case_arg
|
|
6544
|
# :flag.case_arg
|
|
6515
|
if [[ -n ${2+x} ]]; then
|
|
6545
|
if [[ -n ${2+x} ]]; then
|
|
6516
|
|
|
6546
|
|
|
6517
|
args['--version-name']="$2"
|
|
6547
|
args['--version-name']="$2"
|
|
6518
|
shift
|
|
6548
|
shift
|
|
6519
|
shift
|
|
6549
|
shift
|
|
6520
|
else
|
|
6550
|
else
|
|
6521
|
printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2
|
|
6551
|
printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2
|
|
6522
|
exit 1
|
|
6552
|
exit 1
|
|
6523
|
fi
|
|
6553
|
fi
|
|
6524
|
;;
|
|
6554
|
;;
|
|
6525
|
|
|
6555
|
|
|
6526
|
-?*)
|
|
6556
|
-?*)
|
|
6527
|
printf "invalid option: %s\n" "$key" >&2
|
|
6557
|
printf "invalid option: %s\n" "$key" >&2
|
|
6528
|
exit 1
|
|
6558
|
exit 1
|
|
6529
|
;;
|
|
6559
|
;;
|
|
6530
|
|
|
6560
|
|
|
6531
|
*)
|
|
6561
|
*)
|
|
6532
|
# :command.parse_requirements_case
|
|
6562
|
# :command.parse_requirements_case
|
|
6533
|
# :command.parse_requirements_case_simple
|
|
6563
|
# :command.parse_requirements_case_simple
|
|
6534
|
printf "invalid argument: %s\n" "$key" >&2
|
|
6564
|
printf "invalid argument: %s\n" "$key" >&2
|
|
6535
|
exit 1
|
|
6565
|
exit 1
|
|
6536
|
|
|
6566
|
|
|
6537
|
;;
|
|
6567
|
;;
|
|
6538
|
|
|
6568
|
|
|
6539
|
esac
|
|
6569
|
esac
|
|
6540
|
done
|
|
6570
|
done
|
|
6541
|
|
|
6571
|
|
|
6542
|
# :command.default_assignments
|
|
6572
|
# :command.default_assignments
|
|
6543
|
[[ -n ${args['--version-name']:-} ]] || args['--version-name']="$RC_CLI_VERSION_NAME"
|
|
6573
|
[[ -n ${args['--version-name']:-} ]] || args['--version-name']="$RC_CLI_VERSION_NAME"
|
|
6544
|
|
|
6574
|
|
|
6545
|
}
|
|
6575
|
}
|
|
6546
|
|
|
6576
|
|
|
6547
|
# :command.parse_requirements
|
|
6577
|
# :command.parse_requirements
|
|
6548
|
rcstack_get_build_source_parse_requirements() {
|
|
6578
|
rcstack_get_build_source_parse_requirements() {
|
|
6549
|
# :command.fixed_flags_filter
|
|
6579
|
# :command.fixed_flags_filter
|
|
6550
|
while [[ $# -gt 0 ]]; do
|
|
6580
|
while [[ $# -gt 0 ]]; do
|
|
6551
|
case "${1:-}" in
|
|
6581
|
case "${1:-}" in
|
|
6552
|
--help | -h)
|
|
6582
|
--help | -h)
|
|
6553
|
long_usage=yes
|
|
6583
|
long_usage=yes
|
|
6554
|
rcstack_get_build_source_usage
|
|
6584
|
rcstack_get_build_source_usage
|
|
6555
|
exit
|
|
6585
|
exit
|
|
6556
|
;;
|
|
6586
|
;;
|
|
6557
|
|
|
6587
|
|
|
6558
|
*)
|
|
6588
|
*)
|
|
6559
|
break
|
|
6589
|
break
|
|
6560
|
;;
|
|
6590
|
;;
|
|
6561
|
|
|
6591
|
|
|
6562
|
esac
|
|
6592
|
esac
|
|
6563
|
done
|
|
6593
|
done
|
|
6564
|
|
|
6594
|
|
|
6565
|
# :command.dependencies_filter
|
|
6595
|
# :command.dependencies_filter
|
|
6566
|
if command -v curl >/dev/null 2>&1; then
|
|
6596
|
if command -v curl >/dev/null 2>&1; then
|
|
6567
|
deps['curl']="$(command -v curl | head -n1)"
|
|
6597
|
deps['curl']="$(command -v curl | head -n1)"
|
|
6568
|
else
|
|
6598
|
else
|
|
6569
|
printf "missing dependency: curl\n" >&2
|
|
6599
|
printf "missing dependency: curl\n" >&2
|
|
6570
|
exit 1
|
|
6600
|
exit 1
|
|
6571
|
fi
|
|
6601
|
fi
|
|
6572
|
|
|
6602
|
|
|
6573
|
if command -v tar >/dev/null 2>&1; then
|
|
6603
|
if command -v tar >/dev/null 2>&1; then
|
|
6574
|
deps['tar']="$(command -v tar | head -n1)"
|
|
6604
|
deps['tar']="$(command -v tar | head -n1)"
|
|
6575
|
else
|
|
6605
|
else
|
|
6576
|
printf "missing dependency: tar\n" >&2
|
|
6606
|
printf "missing dependency: tar\n" >&2
|
|
6577
|
exit 1
|
|
6607
|
exit 1
|
|
6578
|
fi
|
|
6608
|
fi
|
|
6579
|
|
|
6609
|
|
|
6580
|
# :command.command_filter
|
|
6610
|
# :command.command_filter
|
|
6581
|
action="get-build-source"
|
|
6611
|
action="get-build-source"
|
|
6582
|
|
|
6612
|
|
|
6583
|
# :command.parse_requirements_while
|
|
6613
|
# :command.parse_requirements_while
|
|
6584
|
while [[ $# -gt 0 ]]; do
|
|
6614
|
while [[ $# -gt 0 ]]; do
|
|
6585
|
key="$1"
|
|
6615
|
key="$1"
|
|
6586
|
case "$key" in
|
|
6616
|
case "$key" in
|
|
6587
|
# :flag.case
|
|
6617
|
# :flag.case
|
|
6588
|
--revision)
|
|
6618
|
--revision)
|
|
6589
|
|
|
6619
|
|
|
6590
|
# :flag.case_arg
|
|
6620
|
# :flag.case_arg
|
|
6591
|
if [[ -n ${2+x} ]]; then
|
|
6621
|
if [[ -n ${2+x} ]]; then
|
|
6592
|
|
|
6622
|
|
|
6593
|
args['--revision']="$2"
|
|
6623
|
args['--revision']="$2"
|
|
6594
|
shift
|
|
6624
|
shift
|
|
6595
|
shift
|
|
6625
|
shift
|
|
6596
|
else
|
|
6626
|
else
|
|
6597
|
printf "%s\n" "--revision requires an argument: --revision REVISION" >&2
|
|
6627
|
printf "%s\n" "--revision requires an argument: --revision REVISION" >&2
|
|
6598
|
exit 1
|
|
6628
|
exit 1
|
|
6599
|
fi
|
|
6629
|
fi
|
|
6600
|
;;
|
|
6630
|
;;
|
|
6601
|
|
|
6631
|
|
|
6602
|
# :flag.case
|
|
6632
|
# :flag.case
|
|
6603
|
--auth-token)
|
|
6633
|
--auth-token)
|
|
6604
|
|
|
6634
|
|
|
6605
|
# :flag.case_arg
|
|
6635
|
# :flag.case_arg
|
|
6606
|
if [[ -n ${2+x} ]]; then
|
|
6636
|
if [[ -n ${2+x} ]]; then
|
|
6607
|
|
|
6637
|
|
|
6608
|
args['--auth-token']="$2"
|
|
6638
|
args['--auth-token']="$2"
|
|
6609
|
shift
|
|
6639
|
shift
|
|
6610
|
shift
|
|
6640
|
shift
|
|
6611
|
else
|
|
6641
|
else
|
|
6612
|
printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2
|
|
6642
|
printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2
|
|
6613
|
exit 1
|
|
6643
|
exit 1
|
|
6614
|
fi
|
|
6644
|
fi
|
|
6615
|
;;
|
|
6645
|
;;
|
|
6616
|
|
|
6646
|
|
|
6617
|
# :flag.case
|
|
6647
|
# :flag.case
|
|
6618
|
--server-url)
|
|
6648
|
--server-url)
|
|
6619
|
|
|
6649
|
|
|
6620
|
# :flag.case_arg
|
|
6650
|
# :flag.case_arg
|
|
6621
|
if [[ -n ${2+x} ]]; then
|
|
6651
|
if [[ -n ${2+x} ]]; then
|
|
6622
|
|
|
6652
|
|
|
6623
|
args['--server-url']="$2"
|
|
6653
|
args['--server-url']="$2"
|
|
6624
|
shift
|
|
6654
|
shift
|
|
6625
|
shift
|
|
6655
|
shift
|
|
6626
|
else
|
|
6656
|
else
|
|
6627
|
printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2
|
|
6657
|
printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2
|
|
6628
|
exit 1
|
|
6658
|
exit 1
|
|
6629
|
fi
|
|
6659
|
fi
|
|
6630
|
;;
|
|
6660
|
;;
|
|
6631
|
|
|
6661
|
|
|
6632
|
-?*)
|
|
6662
|
-?*)
|
|
6633
|
printf "invalid option: %s\n" "$key" >&2
|
|
6663
|
printf "invalid option: %s\n" "$key" >&2
|
|
6634
|
exit 1
|
|
6664
|
exit 1
|
|
6635
|
;;
|
|
6665
|
;;
|
|
6636
|
|
|
6666
|
|
|
6637
|
*)
|
|
6667
|
*)
|
|
6638
|
# :command.parse_requirements_case
|
|
6668
|
# :command.parse_requirements_case
|
|
6639
|
# :command.parse_requirements_case_simple
|
|
6669
|
# :command.parse_requirements_case_simple
|
|
6640
|
printf "invalid argument: %s\n" "$key" >&2
|
|
6670
|
printf "invalid argument: %s\n" "$key" >&2
|
|
6641
|
exit 1
|
|
6671
|
exit 1
|
|
6642
|
|
|
6672
|
|
|
6643
|
;;
|
|
6673
|
;;
|
|
6644
|
|
|
6674
|
|
|
6645
|
esac
|
|
6675
|
esac
|
|
6646
|
done
|
|
6676
|
done
|
|
6647
|
|
|
6677
|
|
|
6648
|
# :command.default_assignments
|
|
6678
|
# :command.default_assignments
|
|
6649
|
[[ -n ${args['--revision']:-} ]] || args['--revision']="default"
|
|
6679
|
[[ -n ${args['--revision']:-} ]] || args['--revision']="default"
|
|
6650
|
[[ -n ${args['--server-url']:-} ]] || args['--server-url']="https://code.rhodecode.com"
|
|
6680
|
[[ -n ${args['--server-url']:-} ]] || args['--server-url']="https://code.rhodecode.com"
|
|
6651
|
|
|
6681
|
|
|
6652
|
}
|
|
6682
|
}
|
|
6653
|
|
|
6683
|
|
|
6654
|
# :command.parse_requirements
|
|
6684
|
# :command.parse_requirements
|
|
6655
|
rcstack_build_source_parse_requirements() {
|
|
6685
|
rcstack_build_source_parse_requirements() {
|
|
6656
|
# :command.fixed_flags_filter
|
|
6686
|
# :command.fixed_flags_filter
|
|
6657
|
while [[ $# -gt 0 ]]; do
|
|
6687
|
while [[ $# -gt 0 ]]; do
|
|
6658
|
case "${1:-}" in
|
|
6688
|
case "${1:-}" in
|
|
6659
|
--help | -h)
|
|
6689
|
--help | -h)
|
|
6660
|
long_usage=yes
|
|
6690
|
long_usage=yes
|
|
6661
|
rcstack_build_source_usage
|
|
6691
|
rcstack_build_source_usage
|
|
6662
|
exit
|
|
6692
|
exit
|
|
6663
|
;;
|
|
6693
|
;;
|
|
6664
|
|
|
6694
|
|
|
6665
|
*)
|
|
6695
|
*)
|
|
6666
|
break
|
|
6696
|
break
|
|
6667
|
;;
|
|
6697
|
;;
|
|
6668
|
|
|
6698
|
|
|
6669
|
esac
|
|
6699
|
esac
|
|
6670
|
done
|
|
6700
|
done
|
|
6671
|
|
|
6701
|
|
|
6672
|
# :command.command_filter
|
|
6702
|
# :command.command_filter
|
|
6673
|
action="build-source"
|
|
6703
|
action="build-source"
|
|
6674
|
|
|
6704
|
|
|
6675
|
# :command.parse_requirements_while
|
|
6705
|
# :command.parse_requirements_while
|
|
6676
|
while [[ $# -gt 0 ]]; do
|
|
6706
|
while [[ $# -gt 0 ]]; do
|
|
6677
|
key="$1"
|
|
6707
|
key="$1"
|
|
6678
|
case "$key" in
|
|
6708
|
case "$key" in
|
|
6679
|
# :flag.case
|
|
6709
|
# :flag.case
|
|
6680
|
--version-name)
|
|
6710
|
--version-name)
|
|
6681
|
|
|
6711
|
|
|
6682
|
# :flag.case_arg
|
|
6712
|
# :flag.case_arg
|
|
6683
|
if [[ -n ${2+x} ]]; then
|
|
6713
|
if [[ -n ${2+x} ]]; then
|
|
6684
|
|
|
6714
|
|
|
6685
|
args['--version-name']="$2"
|
|
6715
|
args['--version-name']="$2"
|
|
6686
|
shift
|
|
6716
|
shift
|
|
6687
|
shift
|
|
6717
|
shift
|
|
6688
|
else
|
|
6718
|
else
|
|
6689
|
printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2
|
|
6719
|
printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2
|
|
6690
|
exit 1
|
|
6720
|
exit 1
|
|
6691
|
fi
|
|
6721
|
fi
|
|
6692
|
;;
|
|
6722
|
;;
|
|
6693
|
|
|
6723
|
|
|
6694
|
# :flag.case
|
|
6724
|
# :flag.case
|
|
6695
|
--source-build-yaml)
|
|
6725
|
--source-build-yaml)
|
|
6696
|
|
|
6726
|
|
|
6697
|
# :flag.case_arg
|
|
6727
|
# :flag.case_arg
|
|
6698
|
if [[ -n ${2+x} ]]; then
|
|
6728
|
if [[ -n ${2+x} ]]; then
|
|
6699
|
|
|
6729
|
|
|
6700
|
args['--source-build-yaml']="$2"
|
|
6730
|
args['--source-build-yaml']="$2"
|
|
6701
|
shift
|
|
6731
|
shift
|
|
6702
|
shift
|
|
6732
|
shift
|
|
6703
|
else
|
|
6733
|
else
|
|
6704
|
printf "%s\n" "--source-build-yaml requires an argument: --source-build-yaml BUILD_SOURCE_YAML" >&2
|
|
6734
|
printf "%s\n" "--source-build-yaml requires an argument: --source-build-yaml BUILD_SOURCE_YAML" >&2
|
|
6705
|
exit 1
|
|
6735
|
exit 1
|
|
6706
|
fi
|
|
6736
|
fi
|
|
6707
|
;;
|
|
6737
|
;;
|
|
6708
|
|
|
6738
|
|
|
6709
|
# :flag.case
|
|
6739
|
# :flag.case
|
|
6710
|
--tag)
|
|
6740
|
--tag)
|
|
6711
|
|
|
6741
|
|
|
6712
|
# :flag.case_arg
|
|
6742
|
# :flag.case_arg
|
|
6713
|
if [[ -n ${2+x} ]]; then
|
|
6743
|
if [[ -n ${2+x} ]]; then
|
|
6714
|
|
|
6744
|
|
|
6715
|
if [[ -z ${args['--tag']+x} ]]; then
|
|
6745
|
if [[ -z ${args['--tag']+x} ]]; then
|
|
6716
|
args['--tag']="\"$2\""
|
|
6746
|
args['--tag']="\"$2\""
|
|
6717
|
else
|
|
6747
|
else
|
|
6718
|
args['--tag']="${args[--tag]} \"$2\""
|
|
6748
|
args['--tag']="${args[--tag]} \"$2\""
|
|
6719
|
fi
|
|
6749
|
fi
|
|
6720
|
shift
|
|
6750
|
shift
|
|
6721
|
shift
|
|
6751
|
shift
|
|
6722
|
else
|
|
6752
|
else
|
|
6723
|
printf "%s\n" "--tag requires an argument: --tag TAG" >&2
|
|
6753
|
printf "%s\n" "--tag requires an argument: --tag TAG" >&2
|
|
6724
|
exit 1
|
|
6754
|
exit 1
|
|
6725
|
fi
|
|
6755
|
fi
|
|
6726
|
;;
|
|
6756
|
;;
|
|
6727
|
|
|
6757
|
|
|
6728
|
-?*)
|
|
6758
|
-?*)
|
|
6729
|
printf "invalid option: %s\n" "$key" >&2
|
|
6759
|
printf "invalid option: %s\n" "$key" >&2
|
|
6730
|
exit 1
|
|
6760
|
exit 1
|
|
6731
|
;;
|
|
6761
|
;;
|
|
6732
|
|
|
6762
|
|
|
6733
|
*)
|
|
6763
|
*)
|
|
6734
|
# :command.parse_requirements_case
|
|
6764
|
# :command.parse_requirements_case
|
|
6735
|
# :command.parse_requirements_case_simple
|
|
6765
|
# :command.parse_requirements_case_simple
|
|
6736
|
printf "invalid argument: %s\n" "$key" >&2
|
|
6766
|
printf "invalid argument: %s\n" "$key" >&2
|
|
6737
|
exit 1
|
|
6767
|
exit 1
|
|
6738
|
|
|
6768
|
|
|
6739
|
;;
|
|
6769
|
;;
|
|
6740
|
|
|
6770
|
|
|
6741
|
esac
|
|
6771
|
esac
|
|
6742
|
done
|
|
6772
|
done
|
|
6743
|
|
|
6773
|
|
|
6744
|
# :command.default_assignments
|
|
6774
|
# :command.default_assignments
|
|
6745
|
[[ -n ${args['--version-name']:-} ]] || args['--version-name']="$RC_CLI_VERSION_NAME"
|
|
6775
|
[[ -n ${args['--version-name']:-} ]] || args['--version-name']="$RC_CLI_VERSION_NAME"
|
|
6746
|
[[ -n ${args['--source-build-yaml']:-} ]] || args['--source-build-yaml']="docker-compose-apps.source.yaml"
|
|
6776
|
[[ -n ${args['--source-build-yaml']:-} ]] || args['--source-build-yaml']="docker-compose-apps.source.yaml"
|
|
6747
|
|
|
6777
|
|
|
6748
|
}
|
|
6778
|
}
|
|
6749
|
|
|
6779
|
|
|
6750
|
# :command.parse_requirements
|
|
6780
|
# :command.parse_requirements
|
|
6751
|
rcstack__completions_parse_requirements() {
|
|
6781
|
rcstack__completions_parse_requirements() {
|
|
6752
|
# :command.fixed_flags_filter
|
|
6782
|
# :command.fixed_flags_filter
|
|
6753
|
while [[ $# -gt 0 ]]; do
|
|
6783
|
while [[ $# -gt 0 ]]; do
|
|
6754
|
case "${1:-}" in
|
|
6784
|
case "${1:-}" in
|
|
6755
|
--help | -h)
|
|
6785
|
--help | -h)
|
|
6756
|
long_usage=yes
|
|
6786
|
long_usage=yes
|
|
6757
|
rcstack__completions_usage
|
|
6787
|
rcstack__completions_usage
|
|
6758
|
exit
|
|
6788
|
exit
|
|
6759
|
;;
|
|
6789
|
;;
|
|
6760
|
|
|
6790
|
|
|
6761
|
*)
|
|
6791
|
*)
|
|
6762
|
break
|
|
6792
|
break
|
|
6763
|
;;
|
|
6793
|
;;
|
|
6764
|
|
|
6794
|
|
|
6765
|
esac
|
|
6795
|
esac
|
|
6766
|
done
|
|
6796
|
done
|
|
6767
|
|
|
6797
|
|
|
6768
|
# :command.command_filter
|
|
6798
|
# :command.command_filter
|
|
6769
|
action="_completions"
|
|
6799
|
action="_completions"
|
|
6770
|
|
|
6800
|
|
|
6771
|
# :command.parse_requirements_while
|
|
6801
|
# :command.parse_requirements_while
|
|
6772
|
while [[ $# -gt 0 ]]; do
|
|
6802
|
while [[ $# -gt 0 ]]; do
|
|
6773
|
key="$1"
|
|
6803
|
key="$1"
|
|
6774
|
case "$key" in
|
|
6804
|
case "$key" in
|
|
6775
|
|
|
6805
|
|
|
6776
|
-?*)
|
|
6806
|
-?*)
|
|
6777
|
printf "invalid option: %s\n" "$key" >&2
|
|
6807
|
printf "invalid option: %s\n" "$key" >&2
|
|
6778
|
exit 1
|
|
6808
|
exit 1
|
|
6779
|
;;
|
|
6809
|
;;
|
|
6780
|
|
|
6810
|
|
|
6781
|
*)
|
|
6811
|
*)
|
|
6782
|
# :command.parse_requirements_case
|
|
6812
|
# :command.parse_requirements_case
|
|
6783
|
# :command.parse_requirements_case_simple
|
|
6813
|
# :command.parse_requirements_case_simple
|
|
6784
|
printf "invalid argument: %s\n" "$key" >&2
|
|
6814
|
printf "invalid argument: %s\n" "$key" >&2
|
|
6785
|
exit 1
|
|
6815
|
exit 1
|
|
6786
|
|
|
6816
|
|
|
6787
|
;;
|
|
6817
|
;;
|
|
6788
|
|
|
6818
|
|
|
6789
|
esac
|
|
6819
|
esac
|
|
6790
|
done
|
|
6820
|
done
|
|
6791
|
|
|
6821
|
|
|
6792
|
}
|
|
6822
|
}
|
|
6793
|
|
|
6823
|
|
|
6794
|
# :command.initialize
|
|
6824
|
# :command.initialize
|
|
6795
|
initialize() {
|
|
6825
|
initialize() {
|
|
6796
|
version="5.0.4"
|
|
6826
|
version="5.0.6"
|
|
6797
|
long_usage=''
|
|
6827
|
long_usage=''
|
|
6798
|
set -e
|
|
6828
|
set -e
|
|
6799
|
|
|
6829
|
|
|
6800
|
# :command.environment_variables_default
|
|
6830
|
# :command.environment_variables_default
|
|
6801
|
export RCC_CONFIG="${RCC_CONFIG:-.rcstack.ini}"
|
|
6831
|
export RCC_CONFIG="${RCC_CONFIG:-.rcstack.ini}"
|
|
6802
|
export RC_STACK_ROUTER_EXT="${RC_STACK_ROUTER_EXT:-.custom/docker-compose-router.override.yaml}"
|
|
6832
|
export RC_STACK_ROUTER_EXT="${RC_STACK_ROUTER_EXT:-.custom/docker-compose-router.override.yaml}"
|
|
6803
|
export RC_STACK_METRICS_EXT="${RC_STACK_METRICS_EXT:-.custom/docker-compose-metrics.override.yaml}"
|
|
6833
|
export RC_STACK_METRICS_EXT="${RC_STACK_METRICS_EXT:-.custom/docker-compose-metrics.override.yaml}"
|
|
6804
|
export RC_STACK_SERVICES_EXT="${RC_STACK_SERVICES_EXT:-.custom/docker-compose-services.override.yaml}"
|
|
6834
|
export RC_STACK_SERVICES_EXT="${RC_STACK_SERVICES_EXT:-.custom/docker-compose-services.override.yaml}"
|
|
6805
|
export RC_STACK_RHODECODE_EXT="${RC_STACK_RHODECODE_EXT:-.custom/docker-compose-apps.override.yaml}"
|
|
6835
|
export RC_STACK_RHODECODE_EXT="${RC_STACK_RHODECODE_EXT:-.custom/docker-compose-apps.override.yaml}"
|
|
6806
|
|
|
6836
|
|
|
6807
|
# src/initialize.sh
|
|
6837
|
# src/initialize.sh
|
|
6808
|
|
|
6838
|
|
|
6809
|
rc_image_ver=4.28.0
|
|
6839
|
rc_image_ver=4.28.0
|
|
6810
|
|
|
6840
|
|
|
6811
|
rhodecode_default_config_path=config/_shared/rhodecode.ini
|
|
6841
|
rhodecode_default_config_path=config/_shared/rhodecode.ini
|
|
6812
|
vcsserver_default_config_path=config/_shared/vcsserver.ini
|
|
6842
|
vcsserver_default_config_path=config/_shared/vcsserver.ini
|
|
6813
|
|
|
6843
|
|
|
6814
|
RC_STACK_ROUTER_VER=v1.0.0
|
|
6844
|
RC_STACK_ROUTER_VER=v1.0.0
|
|
6815
|
RC_STACK_SERVICES_VER=v1.0.0
|
|
6845
|
RC_STACK_SERVICES_VER=v1.0.0
|
|
6816
|
RC_STACK_RHODECODE_VER=v1.0.0
|
|
6846
|
RC_STACK_RHODECODE_VER=v1.0.0
|
|
6817
|
RC_STACK_METRICS_VER=v1.0.0
|
|
6847
|
RC_STACK_METRICS_VER=v1.0.0
|
|
6818
|
|
|
6848
|
|
|
6819
|
RC_SCRIPT_NAME=rcstack
|
|
6849
|
RC_SCRIPT_NAME=rcstack
|
|
6820
|
# bootstrap file is a config file at the same time
|
|
6850
|
# bootstrap file is a config file at the same time
|
|
6821
|
CONFIG_FILE=${RCC_CONFIG:=.rcstack.ini}
|
|
6851
|
CONFIG_FILE=${RCC_CONFIG:=.rcstack.ini}
|
|
6822
|
|
|
6852
|
|
|
6823
|
# runtime env file
|
|
6853
|
# runtime env file
|
|
6824
|
RUNTIME_ENV=$PWD/.custom/.runtime.env
|
|
6854
|
RUNTIME_ENV=$PWD/.custom/.runtime.env
|
|
6825
|
|
|
6855
|
|
|
6826
|
# STACK_LIST
|
|
6856
|
# STACK_LIST
|
|
6827
|
VALID_SERVICES="router metrics services rhodecode"
|
|
6857
|
VALID_SERVICES="router metrics services rhodecode"
|
|
6828
|
DOCKER_DEFS_WORK_DIR="docker_defs"
|
|
6858
|
DOCKER_DEFS_WORK_DIR="docker_defs"
|
|
6829
|
|
|
6859
|
|
|
6830
|
# stage key, saved in .rcstack.ini : stage func to execute
|
|
6860
|
# stage key, saved in .rcstack.ini : stage func to execute
|
|
6831
|
BOOTSTRAP_STAGES="\
|
|
6861
|
BOOTSTRAP_STAGES="\
|
|
6832
|
bootstrap_v1_docker_install \
|
|
6862
|
bootstrap_v1_docker_install \
|
|
6833
|
bootstrap_v1_docker_commons \
|
|
6863
|
bootstrap_v1_docker_commons \
|
|
6834
|
bootstrap_v1_definitions \
|
|
6864
|
bootstrap_v1_definitions \
|
|
6835
|
bootstrap_v1_config \
|
|
6865
|
bootstrap_v1_config \
|
|
6836
|
bootstrap_v1_overrides \
|
|
6866
|
bootstrap_v1_overrides \
|
|
6837
|
"
|
|
6867
|
"
|
|
6838
|
|
|
6868
|
|
|
6839
|
YAML_TEMPLATES="\
|
|
6869
|
YAML_TEMPLATES="\
|
|
6840
|
docker-compose-apps.override.yaml
|
|
6870
|
docker-compose-apps.override.yaml
|
|
6841
|
docker-compose-metrics.override.yaml
|
|
6871
|
docker-compose-metrics.override.yaml
|
|
6842
|
docker-compose-router.override.yaml
|
|
6872
|
docker-compose-router.override.yaml
|
|
6843
|
docker-compose-services.override.yaml
|
|
6873
|
docker-compose-services.override.yaml
|
|
6844
|
runtime.env.tmpl
|
|
6874
|
runtime.env.tmpl
|
|
6845
|
"
|
|
6875
|
"
|
|
6846
|
|
|
6876
|
|
|
6847
|
get_stage_function() {
|
|
6877
|
get_stage_function() {
|
|
6848
|
stage_name=$1
|
|
6878
|
stage_name=$1
|
|
6849
|
|
|
6879
|
|
|
6850
|
case $stage_name in
|
|
6880
|
case $stage_name in
|
|
6851
|
bootstrap_v1_docker_install)
|
|
6881
|
bootstrap_v1_docker_install)
|
|
6852
|
stage_func=bootstrap_docker_install
|
|
6882
|
stage_func=bootstrap_docker_install
|
|
6853
|
;;
|
|
6883
|
;;
|
|
6854
|
bootstrap_v1_docker_commons)
|
|
6884
|
bootstrap_v1_docker_commons)
|
|
6855
|
stage_func=bootstrap_docker_commons
|
|
6885
|
stage_func=bootstrap_docker_commons
|
|
6856
|
;;
|
|
6886
|
;;
|
|
6857
|
bootstrap_v1_definitions)
|
|
6887
|
bootstrap_v1_definitions)
|
|
6858
|
stage_func=bootstrap_definitions
|
|
6888
|
stage_func=bootstrap_definitions
|
|
6859
|
;;
|
|
6889
|
;;
|
|
6860
|
bootstrap_v1_config)
|
|
6890
|
bootstrap_v1_config)
|
|
6861
|
stage_func=bootstrap_config
|
|
6891
|
stage_func=bootstrap_config
|
|
6862
|
;;
|
|
6892
|
;;
|
|
6863
|
bootstrap_v1_overrides)
|
|
6893
|
bootstrap_v1_overrides)
|
|
6864
|
stage_func=bootstrap_overrides
|
|
6894
|
stage_func=bootstrap_overrides
|
|
6865
|
;;
|
|
6895
|
;;
|
|
6866
|
*)
|
|
6896
|
*)
|
|
6867
|
echo "can't find function for stage $stage_name"
|
|
6897
|
echo "can't find function for stage $stage_name"
|
|
6868
|
exit 1
|
|
6898
|
exit 1
|
|
6869
|
esac
|
|
6899
|
esac
|
|
6870
|
|
|
6900
|
|
|
6871
|
echo $stage_func
|
|
6901
|
echo $stage_func
|
|
6872
|
}
|
|
6902
|
}
|
|
6873
|
|
|
6903
|
|
|
6874
|
#echo "1 ----"
|
|
6904
|
#echo "1 ----"
|
|
6875
|
#echo $RC_STACK_SERVICES_EXT
|
|
6905
|
#echo $RC_STACK_SERVICES_EXT
|
|
6876
|
#echo $RC_STACK_METRICS_EXT
|
|
6906
|
#echo $RC_STACK_METRICS_EXT
|
|
6877
|
#echo "1 -----"
|
|
6907
|
#echo "1 -----"
|
|
6878
|
|
|
6908
|
|
|
6879
|
#echo '2 ----'
|
|
6909
|
#echo '2 ----'
|
|
6880
|
#grep -v -e '^#' "$ENV_FILE" | xargs -I {} echo \'{}\'
|
|
6910
|
#grep -v -e '^#' "$ENV_FILE" | xargs -I {} echo \'{}\'
|
|
6881
|
#echo '2 ----'
|
|
6911
|
#echo '2 ----'
|
|
6882
|
|
|
6912
|
|
|
6883
|
#expose env vars from ./rcstack config
|
|
6913
|
#expose env vars from ./rcstack config
|
|
6884
|
#if [[ -f $ENV_FILE ]]; then
|
|
6914
|
#if [[ -f $ENV_FILE ]]; then
|
|
6885
|
# eval $(grep -v -e '^#' "$ENV_FILE" | xargs -I {} echo export \'{}\')
|
|
6915
|
# eval $(grep -v -e '^#' "$ENV_FILE" | xargs -I {} echo export \'{}\')
|
|
6886
|
#fi
|
|
6916
|
#fi
|
|
6887
|
|
|
6917
|
|
|
6888
|
#ENV_EXPAND=""
|
|
6918
|
#ENV_EXPAND=""
|
|
6889
|
#for k in $(config_keys); do
|
|
6919
|
#for k in $(config_keys); do
|
|
6890
|
# k_upper=${k^^}
|
|
6920
|
# k_upper=${k^^}
|
|
6891
|
# env_entry="-e $k_upper='$(config_get "$k")' "
|
|
6921
|
# env_entry="-e $k_upper='$(config_get "$k")' "
|
|
6892
|
# ENV_EXPAND+=$env_entry;
|
|
6922
|
# ENV_EXPAND+=$env_entry;
|
|
6893
|
# #echo $env_expand
|
|
6923
|
# #echo $env_expand
|
|
6894
|
#done
|
|
6924
|
#done
|
|
6895
|
|
|
6925
|
|
|
6896
|
#
|
|
6926
|
#
|
|
6897
|
#echo "3 ----"
|
|
6927
|
#echo "3 ----"
|
|
6898
|
#echo $RC_STACK_SERVICES_EXT
|
|
6928
|
#echo $RC_STACK_SERVICES_EXT
|
|
6899
|
#echo $RC_STACK_METRICS_EXT
|
|
6929
|
#echo $RC_STACK_METRICS_EXT
|
|
6900
|
#echo $RC_STACK_RHODECODE_EXT
|
|
6930
|
#echo $RC_STACK_RHODECODE_EXT
|
|
6901
|
#echo "3 -----"
|
|
6931
|
#echo "3 -----"
|
|
6902
|
|
|
6932
|
|
|
6903
|
#env | grep RC_
|
|
6933
|
#env | grep RC_
|
|
6904
|
|
|
6934
|
|
|
6905
|
docker_ping_host() {
|
|
6935
|
docker_ping_host() {
|
|
6906
|
PING_HOST="$1"
|
|
6936
|
PING_HOST="$1"
|
|
6907
|
docker run --network rhodecode_network --rm alpine ping "$PING_HOST"
|
|
6937
|
docker run --network rhodecode_network --rm alpine ping "$PING_HOST"
|
|
6908
|
}
|
|
6938
|
}
|
|
6909
|
|
|
6939
|
|
|
6910
|
get_started() {
|
|
6940
|
get_started() {
|
|
6911
|
echo ""
|
|
6941
|
echo ""
|
|
6912
|
echo "To start using RhodeCode run the following stacks using './$RC_SCRIPT_NAME stack [STACK_NAME]'"
|
|
6942
|
echo "To start using RhodeCode run the following stacks using './$RC_SCRIPT_NAME stack [STACK_NAME]'"
|
|
6913
|
echo "Check './$RC_SCRIPT_NAME stack --help' for more examples and options"
|
|
6943
|
echo "Check './$RC_SCRIPT_NAME stack --help' for more examples and options"
|
|
6914
|
echo "$(green_bold IMPORTANT): init command generates some secrets/config inside $RUNTIME_ENV file."
|
|
6944
|
echo "$(green_bold IMPORTANT): init command generates some secrets/config inside $RUNTIME_ENV file."
|
|
6915
|
echo "Check and adjust those settings if needed."
|
|
6945
|
echo "Check and adjust those settings if needed."
|
|
6916
|
echo ""
|
|
6946
|
echo ""
|
|
6917
|
echo "$(bold Run the stacks in following order):"
|
|
6947
|
echo "$(bold Run the stacks in following order):"
|
|
6918
|
echo ""
|
|
6948
|
echo ""
|
|
6919
|
echo "$(green_bold 1\) router [Mandatory]): run the edge router to control stack traffic / domain access and optionally SSL termination"
|
|
6949
|
echo "$(green_bold 1\) router [Mandatory]): run the edge router to control stack traffic / domain access and optionally SSL termination"
|
|
6920
|
echo "IMPORTANT: router binds to some common ports 80, 443, SSH (9022), Loki (3100) if those are not available, please adjust them"
|
|
6950
|
echo "IMPORTANT: router binds to some common ports 80, 443, SSH (9022), Loki (3100) if those are not available, please adjust them"
|
|
6921
|
echo "To configure this stack before running check: $RC_STACK_ROUTER_EXT"
|
|
6951
|
echo "To configure this stack before running check: $RC_STACK_ROUTER_EXT"
|
|
6922
|
echo ""
|
|
6952
|
echo ""
|
|
6923
|
echo "./$RC_SCRIPT_NAME stack router up --detach"
|
|
6953
|
echo "./$RC_SCRIPT_NAME stack router up --detach"
|
|
6924
|
echo ""
|
|
6954
|
echo ""
|
|
6925
|
echo "$(green_bold 2\) services [Mandatory]): run the services, like database, redis, channelstream etc..."
|
|
6955
|
echo "$(green_bold 2\) services [Mandatory]): run the services, like database, redis, channelstream etc..."
|
|
6926
|
echo "IMPORTANT: if you like to run your own database, or redis please adjust before running"
|
|
6956
|
echo "IMPORTANT: if you like to run your own database, or redis please adjust before running"
|
|
6927
|
echo "To configure this stack before running check: $RC_STACK_SERVICES_EXT"
|
|
6957
|
echo "To configure this stack before running check: $RC_STACK_SERVICES_EXT"
|
|
6928
|
echo ""
|
|
6958
|
echo ""
|
|
6929
|
echo "./$RC_SCRIPT_NAME stack services up --detach"
|
|
6959
|
echo "./$RC_SCRIPT_NAME stack services up --detach"
|
|
6930
|
echo ""
|
|
6960
|
echo ""
|
|
6931
|
echo "$(green_bold 3\) rhodecode [Mandatory]): run the rhodecode app stack"
|
|
6961
|
echo "$(green_bold 3\) rhodecode [Mandatory]): run the rhodecode app stack"
|
|
6932
|
echo "To configure this stack before running check: $RC_STACK_RHODECODE_EXT"
|
|
6962
|
echo "To configure this stack before running check: $RC_STACK_RHODECODE_EXT"
|
|
6933
|
echo ""
|
|
6963
|
echo ""
|
|
6934
|
echo "./$RC_SCRIPT_NAME stack rhodecode up --detach"
|
|
6964
|
echo "./$RC_SCRIPT_NAME stack rhodecode up --detach"
|
|
6935
|
echo ""
|
|
6965
|
echo ""
|
|
6936
|
echo "$(yellow_bold 4\) metrics [Optional]): run the monitoring stack, this includes grafana/prometheus logging/metrics system"
|
|
6966
|
echo "$(yellow_bold 4\) metrics [Optional]): run the monitoring stack, this includes grafana/prometheus logging/metrics system"
|
|
6937
|
echo "To configure this stack before running check: $RC_STACK_METRICS_EXT"
|
|
6967
|
echo "To configure this stack before running check: $RC_STACK_METRICS_EXT"
|
|
6938
|
echo ""
|
|
6968
|
echo ""
|
|
6939
|
echo "./$RC_SCRIPT_NAME stack metrics up --detach"
|
|
6969
|
echo "./$RC_SCRIPT_NAME stack metrics up --detach"
|
|
6940
|
echo ""
|
|
6970
|
echo ""
|
|
6941
|
echo "$(bold [Status]): check services run status, ports etc.."
|
|
6971
|
echo "$(bold [Status]): check services run status, ports etc.."
|
|
6942
|
echo "./$RC_SCRIPT_NAME status"
|
|
6972
|
echo "./$RC_SCRIPT_NAME status"
|
|
6943
|
echo ""
|
|
6973
|
echo ""
|
|
6944
|
echo "$(bold [All]): shorthand to run all stacks (detached with -d)"
|
|
6974
|
echo "$(bold [All]): shorthand to run all stacks (detached with -d)"
|
|
6945
|
echo "./$RC_SCRIPT_NAME stack all up -d"
|
|
6975
|
echo "./$RC_SCRIPT_NAME stack all up -d"
|
|
6946
|
echo ""
|
|
6976
|
echo ""
|
|
6947
|
echo "$(bold [Logs]): check service logs"
|
|
6977
|
echo "$(bold [Logs]): check service logs"
|
|
6948
|
echo "./$RC_SCRIPT_NAME stack [STACK_NAME] logs"
|
|
6978
|
echo "./$RC_SCRIPT_NAME stack [STACK_NAME] logs"
|
|
6949
|
}
|
|
6979
|
}
|
|
6950
|
|
|
6980
|
|
|
6951
|
get_started_full() {
|
|
6981
|
get_started_full() {
|
|
6952
|
echo "$(blue_bold [~~~~ GET STARTED ~~~~~])"
|
|
6982
|
echo "$(blue_bold [~~~~ GET STARTED ~~~~~])"
|
|
6953
|
echo "$(green_bold Having problems / need help? Reach out to us here:) https://community.rhodecode.com"
|
|
6983
|
echo "$(green_bold Having problems / need help? Reach out to us here:) https://community.rhodecode.com"
|
|
6954
|
echo ""
|
|
6984
|
echo ""
|
|
6955
|
echo "./$RC_SCRIPT_NAME is a CLI based installer/manager for RhodeCode Cluster Stack"
|
|
6985
|
echo "./$RC_SCRIPT_NAME is a CLI based installer/manager for RhodeCode Cluster Stack"
|
|
6956
|
echo "./$RC_SCRIPT_NAME -h is your friend, in case of doubt, check examples and usage options with -h / --help flag"
|
|
6986
|
echo "./$RC_SCRIPT_NAME -h is your friend, in case of doubt, check examples and usage options with -h / --help flag"
|
|
6957
|
echo ""
|
|
6987
|
echo ""
|
|
6958
|
echo "$(yellow_bold [First time run])"
|
|
6988
|
echo "$(yellow_bold [First time run])"
|
|
6959
|
echo "run './$RC_SCRIPT_NAME init' to setup docker and download required installer files."
|
|
6989
|
echo "run './$RC_SCRIPT_NAME init' to setup docker and download required installer files."
|
|
6960
|
echo "./$RC_SCRIPT_NAME can install Docker for you, or install it manually before running init command"
|
|
6990
|
echo "./$RC_SCRIPT_NAME can install Docker for you, or install it manually before running init command"
|
|
6961
|
|
|
6991
|
|
|
6962
|
get_started
|
|
6992
|
get_started
|
|
6963
|
}
|
|
6993
|
}
|
|
6964
|
|
|
6994
|
|
|
6965
|
}
|
|
6995
|
}
|
|
6966
|
|
|
6996
|
|
|
6967
|
# :command.run
|
|
6997
|
# :command.run
|
|
6968
|
run() {
|
|
6998
|
run() {
|
|
6969
|
declare -A args=()
|
|
6999
|
declare -A args=()
|
|
6970
|
declare -A deps=()
|
|
7000
|
declare -A deps=()
|
|
6971
|
declare -a other_args=()
|
|
7001
|
declare -a other_args=()
|
|
6972
|
declare -a input=()
|
|
7002
|
declare -a input=()
|
|
6973
|
normalize_input "$@"
|
|
7003
|
normalize_input "$@"
|
|
6974
|
parse_requirements "${input[@]}"
|
|
7004
|
parse_requirements "${input[@]}"
|
|
6975
|
|
|
7005
|
|
|
6976
|
case "$action" in
|
|
7006
|
case "$action" in
|
|
6977
|
"get-started") rcstack_get_started_command ;;
|
|
7007
|
"get-started") rcstack_get_started_command ;;
|
|
6978
|
"init") rcstack_init_command ;;
|
|
7008
|
"init") rcstack_init_command ;;
|
|
6979
|
"self-update") rcstack_self_update_command ;;
|
|
7009
|
"self-update") rcstack_self_update_command ;;
|
|
6980
|
"stack") rcstack_stack_command ;;
|
|
7010
|
"stack") rcstack_stack_command ;;
|
|
6981
|
"stack router") rcstack_stack_router_command ;;
|
|
7011
|
"stack router") rcstack_stack_router_command ;;
|
|
6982
|
"stack metrics") rcstack_stack_metrics_command ;;
|
|
7012
|
"stack metrics") rcstack_stack_metrics_command ;;
|
|
6983
|
"stack services") rcstack_stack_services_command ;;
|
|
7013
|
"stack services") rcstack_stack_services_command ;;
|
|
6984
|
"stack rhodecode") rcstack_stack_rhodecode_command ;;
|
|
7014
|
"stack rhodecode") rcstack_stack_rhodecode_command ;;
|
|
6985
|
"stack all") rcstack_stack_all_command ;;
|
|
7015
|
"stack all") rcstack_stack_all_command ;;
|
|
6986
|
"stack-status") rcstack_stack_status_command ;;
|
|
7016
|
"stack-status") rcstack_stack_status_command ;;
|
|
6987
|
"stack-upgrade") rcstack_stack_upgrade_command ;;
|
|
7017
|
"stack-upgrade") rcstack_stack_upgrade_command ;;
|
|
6988
|
"stack-upgrade router") rcstack_stack_upgrade_router_command ;;
|
|
7018
|
"stack-upgrade router") rcstack_stack_upgrade_router_command ;;
|
|
6989
|
"stack-upgrade metrics") rcstack_stack_upgrade_metrics_command ;;
|
|
7019
|
"stack-upgrade metrics") rcstack_stack_upgrade_metrics_command ;;
|
|
6990
|
"stack-upgrade services") rcstack_stack_upgrade_services_command ;;
|
|
7020
|
"stack-upgrade services") rcstack_stack_upgrade_services_command ;;
|
|
6991
|
"stack-upgrade rhodecode") rcstack_stack_upgrade_rhodecode_command ;;
|
|
7021
|
"stack-upgrade rhodecode") rcstack_stack_upgrade_rhodecode_command ;;
|
|
6992
|
"stack-monitor") rcstack_stack_monitor_command ;;
|
|
7022
|
"stack-monitor") rcstack_stack_monitor_command ;;
|
|
6993
|
"stack-monitor restart-unhealthy") rcstack_stack_monitor_restart_unhealthy_command ;;
|
|
7023
|
"stack-monitor restart-unhealthy") rcstack_stack_monitor_restart_unhealthy_command ;;
|
|
6994
|
"cli") rcstack_cli_command ;;
|
|
7024
|
"cli") rcstack_cli_command ;;
|
|
6995
|
"cli image-info") rcstack_cli_image_info_command ;;
|
|
7025
|
"cli image-info") rcstack_cli_image_info_command ;;
|
|
6996
|
"cli set-runtime-image") rcstack_cli_set_runtime_image_command ;;
|
|
7026
|
"cli set-runtime-image") rcstack_cli_set_runtime_image_command ;;
|
|
6997
|
"cli ishell") rcstack_cli_ishell_command ;;
|
|
7027
|
"cli ishell") rcstack_cli_ishell_command ;;
|
|
6998
|
"cli redis") rcstack_cli_redis_command ;;
|
|
7028
|
"cli redis") rcstack_cli_redis_command ;;
|
|
6999
|
"cli db") rcstack_cli_db_command ;;
|
|
7029
|
"cli db") rcstack_cli_db_command ;;
|
|
7000
|
"cli db-upgrade") rcstack_cli_db_upgrade_command ;;
|
|
7030
|
"cli db-upgrade") rcstack_cli_db_upgrade_command ;;
|
|
7001
|
"cli storage") rcstack_cli_storage_command ;;
|
|
7031
|
"cli storage") rcstack_cli_storage_command ;;
|
|
7002
|
"cli attach") rcstack_cli_attach_command ;;
|
|
7032
|
"cli attach") rcstack_cli_attach_command ;;
|
|
7003
|
"cli set-edition") rcstack_cli_set_edition_command ;;
|
|
7033
|
"cli set-edition") rcstack_cli_set_edition_command ;;
|
|
7004
|
"cli configure-vcsserver") rcstack_cli_configure_vcsserver_command ;;
|
|
7034
|
"cli configure-vcsserver") rcstack_cli_configure_vcsserver_command ;;
|
|
7005
|
"cli configure-rhodecode") rcstack_cli_configure_rhodecode_command ;;
|
|
7035
|
"cli configure-rhodecode") rcstack_cli_configure_rhodecode_command ;;
|
|
7006
|
"backup-db") rcstack_backup_db_command ;;
|
|
7036
|
"backup-db") rcstack_backup_db_command ;;
|
|
7007
|
"backup-data") rcstack_backup_data_command ;;
|
|
7037
|
"backup-data") rcstack_backup_data_command ;;
|
|
7008
|
"get-build-artifacts") rcstack_get_build_artifacts_command ;;
|
|
7038
|
"get-build-artifacts") rcstack_get_build_artifacts_command ;;
|
|
7009
|
"build-installer") rcstack_build_installer_command ;;
|
|
7039
|
"build-installer") rcstack_build_installer_command ;;
|
|
7010
|
"get-build-source") rcstack_get_build_source_command ;;
|
|
7040
|
"get-build-source") rcstack_get_build_source_command ;;
|
|
7011
|
"build-source") rcstack_build_source_command ;;
|
|
7041
|
"build-source") rcstack_build_source_command ;;
|
|
7012
|
"_completions") rcstack__completions_command ;;
|
|
7042
|
"_completions") rcstack__completions_command ;;
|
|
7013
|
esac
|
|
7043
|
esac
|
|
7014
|
}
|
|
7044
|
}
|
|
7015
|
|
|
7045
|
|
|
7016
|
initialize
|
|
7046
|
initialize
|
|
7017
|
run "$@"
|
|
7047
|
run "$@"
|