Show More
@@ -1,7269 +1,7268 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 |
|
59 | |||
60 | # :command.long_usage |
|
60 | # :command.long_usage | |
61 | if [[ -n $long_usage ]]; then |
|
61 | if [[ -n $long_usage ]]; then | |
62 | printf "%s\n" "Options:" |
|
62 | printf "%s\n" "Options:" | |
63 |
|
63 | |||
64 | # :command.usage_flags |
|
64 | # :command.usage_flags | |
65 | # :flag.usage |
|
65 | # :flag.usage | |
66 | printf " %s\n" "--debug" |
|
66 | printf " %s\n" "--debug" | |
67 | printf " Enable debug and detailed output. Add --debug right after ./rcstack command.\n E.g. ./rcstack --debug COMMAND\n" |
|
67 | printf " Enable debug and detailed output. Add --debug right after ./rcstack command.\n E.g. ./rcstack --debug COMMAND\n" | |
68 | echo |
|
68 | echo | |
69 |
|
69 | |||
70 | # :flag.usage |
|
70 | # :flag.usage | |
71 | printf " %s\n" "--no-init-check" |
|
71 | printf " %s\n" "--no-init-check" | |
72 | printf " Skip check for ./rcstack init call\n" |
|
72 | printf " Skip check for ./rcstack init call\n" | |
73 | echo |
|
73 | echo | |
74 |
|
74 | |||
75 | # :command.usage_fixed_flags |
|
75 | # :command.usage_fixed_flags | |
76 | printf " %s\n" "--help, -h" |
|
76 | printf " %s\n" "--help, -h" | |
77 | printf " Show this help\n" |
|
77 | printf " Show this help\n" | |
78 | echo |
|
78 | echo | |
79 | printf " %s\n" "--version, -v" |
|
79 | printf " %s\n" "--version, -v" | |
80 | printf " Show version number\n" |
|
80 | printf " Show version number\n" | |
81 | echo |
|
81 | echo | |
82 |
|
82 | |||
83 | # :command.usage_environment_variables |
|
83 | # :command.usage_environment_variables | |
84 | printf "%s\n" "Environment Variables:" |
|
84 | printf "%s\n" "Environment Variables:" | |
85 |
|
85 | |||
86 | # :environment_variable.usage |
|
86 | # :environment_variable.usage | |
87 | printf " %s\n" "RCC_CONFIG" |
|
87 | printf " %s\n" "RCC_CONFIG" | |
88 | printf " default config file for rcstack\n" |
|
88 | printf " default config file for rcstack\n" | |
89 | printf " Default: .rcstack.ini\n" |
|
89 | printf " Default: .rcstack.ini\n" | |
90 | echo |
|
90 | echo | |
91 |
|
91 | |||
92 | # :environment_variable.usage |
|
92 | # :environment_variable.usage | |
93 | printf " %s\n" "AUTH_TOKEN" |
|
93 | printf " %s\n" "AUTH_TOKEN" | |
94 | printf " Set your RhodeCode AUTH Token\n" |
|
94 | printf " Set your RhodeCode AUTH Token\n" | |
95 | echo |
|
95 | echo | |
96 |
|
96 | |||
97 | # :environment_variable.usage |
|
97 | # :environment_variable.usage | |
98 | printf " %s\n" "RC_STACK_ROUTER_EXT" |
|
98 | printf " %s\n" "RC_STACK_ROUTER_EXT" | |
99 | printf "\n" |
|
99 | printf "\n" | |
100 | printf " Default: .custom/docker-compose-router.override.yaml\n" |
|
100 | printf " Default: .custom/docker-compose-router.override.yaml\n" | |
101 | echo |
|
101 | echo | |
102 |
|
102 | |||
103 | # :environment_variable.usage |
|
103 | # :environment_variable.usage | |
104 | printf " %s\n" "RC_STACK_METRICS_EXT" |
|
104 | printf " %s\n" "RC_STACK_METRICS_EXT" | |
105 | printf "\n" |
|
105 | printf "\n" | |
106 | printf " Default: .custom/docker-compose-metrics.override.yaml\n" |
|
106 | printf " Default: .custom/docker-compose-metrics.override.yaml\n" | |
107 | echo |
|
107 | echo | |
108 |
|
108 | |||
109 | # :environment_variable.usage |
|
109 | # :environment_variable.usage | |
110 | printf " %s\n" "RC_STACK_SERVICES_EXT" |
|
110 | printf " %s\n" "RC_STACK_SERVICES_EXT" | |
111 | printf "\n" |
|
111 | printf "\n" | |
112 | printf " Default: .custom/docker-compose-services.override.yaml\n" |
|
112 | printf " Default: .custom/docker-compose-services.override.yaml\n" | |
113 | echo |
|
113 | echo | |
114 |
|
114 | |||
115 | # :environment_variable.usage |
|
115 | # :environment_variable.usage | |
116 | printf " %s\n" "RC_STACK_RHODECODE_EXT" |
|
116 | printf " %s\n" "RC_STACK_RHODECODE_EXT" | |
117 | printf "\n" |
|
117 | printf "\n" | |
118 | printf " Default: .custom/docker-compose-apps.override.yaml\n" |
|
118 | printf " Default: .custom/docker-compose-apps.override.yaml\n" | |
119 | echo |
|
119 | echo | |
120 |
|
120 | |||
121 | # :command.footer |
|
121 | # :command.footer | |
122 | printf "RhodeCode Inc 2023\n\n" |
|
122 | printf "RhodeCode Inc 2023\n\n" | |
123 | echo |
|
123 | echo | |
124 |
|
124 | |||
125 | fi |
|
125 | fi | |
126 | } |
|
126 | } | |
127 |
|
127 | |||
128 | # :command.usage |
|
128 | # :command.usage | |
129 | rcstack_get_started_usage() { |
|
129 | rcstack_get_started_usage() { | |
130 | if [[ -n $long_usage ]]; then |
|
130 | if [[ -n $long_usage ]]; then | |
131 | printf "rcstack get-started - Print instructions to get started with rhodecode docker stack\n" |
|
131 | printf "rcstack get-started - Print instructions to get started with rhodecode docker stack\n" | |
132 | echo |
|
132 | echo | |
133 |
|
133 | |||
134 | else |
|
134 | else | |
135 | printf "rcstack get-started - Print instructions to get started with rhodecode docker stack\n" |
|
135 | printf "rcstack get-started - Print instructions to get started with rhodecode docker stack\n" | |
136 | echo |
|
136 | echo | |
137 |
|
137 | |||
138 | fi |
|
138 | fi | |
139 |
|
139 | |||
140 | printf "%s\n" "Usage:" |
|
140 | printf "%s\n" "Usage:" | |
141 | printf " rcstack get-started\n" |
|
141 | printf " rcstack get-started\n" | |
142 | printf " rcstack get-started --help | -h\n" |
|
142 | printf " rcstack get-started --help | -h\n" | |
143 | echo |
|
143 | echo | |
144 |
|
144 | |||
145 | # :command.long_usage |
|
145 | # :command.long_usage | |
146 | if [[ -n $long_usage ]]; then |
|
146 | if [[ -n $long_usage ]]; then | |
147 | printf "%s\n" "Options:" |
|
147 | printf "%s\n" "Options:" | |
148 |
|
148 | |||
149 | # :command.usage_fixed_flags |
|
149 | # :command.usage_fixed_flags | |
150 | printf " %s\n" "--help, -h" |
|
150 | printf " %s\n" "--help, -h" | |
151 | printf " Show this help\n" |
|
151 | printf " Show this help\n" | |
152 | echo |
|
152 | echo | |
153 |
|
153 | |||
154 | fi |
|
154 | fi | |
155 | } |
|
155 | } | |
156 |
|
156 | |||
157 | # :command.usage |
|
157 | # :command.usage | |
158 | rcstack_init_usage() { |
|
158 | rcstack_init_usage() { | |
159 | if [[ -n $long_usage ]]; then |
|
159 | if [[ -n $long_usage ]]; then | |
160 | printf "rcstack init - Bootstrap this machine, check docker version and install rhodecode-network\n" |
|
160 | printf "rcstack init - Bootstrap this machine, check docker version and install rhodecode-network\n" | |
161 | echo |
|
161 | echo | |
162 |
|
162 | |||
163 | else |
|
163 | else | |
164 | printf "rcstack init - Bootstrap this machine, check docker version and install rhodecode-network\n" |
|
164 | printf "rcstack init - Bootstrap this machine, check docker version and install rhodecode-network\n" | |
165 | echo |
|
165 | echo | |
166 |
|
166 | |||
167 | fi |
|
167 | fi | |
168 |
|
168 | |||
169 | printf "%s\n" "Usage:" |
|
169 | printf "%s\n" "Usage:" | |
170 | printf " rcstack init [OPTIONS]\n" |
|
170 | printf " rcstack init [OPTIONS]\n" | |
171 | printf " rcstack init --help | -h\n" |
|
171 | printf " rcstack init --help | -h\n" | |
172 | echo |
|
172 | echo | |
173 |
|
173 | |||
174 | # :command.long_usage |
|
174 | # :command.long_usage | |
175 | if [[ -n $long_usage ]]; then |
|
175 | if [[ -n $long_usage ]]; then | |
176 | printf "%s\n" "Options:" |
|
176 | printf "%s\n" "Options:" | |
177 |
|
177 | |||
178 | # :command.usage_flags |
|
178 | # :command.usage_flags | |
179 | # :flag.usage |
|
179 | # :flag.usage | |
180 | printf " %s\n" "--arg-rc-edition ARG_RC_EDITION" |
|
180 | printf " %s\n" "--arg-rc-edition ARG_RC_EDITION" | |
181 | printf " specify rc_edition [ee|ce] for setup\n" |
|
181 | printf " specify rc_edition [ee|ce] for setup\n" | |
182 | echo |
|
182 | echo | |
183 |
|
183 | |||
184 | # :flag.usage |
|
184 | # :flag.usage | |
185 | printf " %s\n" "--arg-hostname ARG_HOSTNAME" |
|
185 | printf " %s\n" "--arg-hostname ARG_HOSTNAME" | |
186 | printf " specify hostname [hostname.example.com] for setup\n" |
|
186 | printf " specify hostname [hostname.example.com] for setup\n" | |
187 | echo |
|
187 | echo | |
188 |
|
188 | |||
189 | # :flag.usage |
|
189 | # :flag.usage | |
190 | printf " %s\n" "--arg-use-ssl ARG_USE_SSL" |
|
190 | printf " %s\n" "--arg-use-ssl ARG_USE_SSL" | |
191 | printf " specify use_ssl [y|n] for setup\n" |
|
191 | printf " specify use_ssl [y|n] for setup\n" | |
192 | echo |
|
192 | echo | |
193 |
|
193 | |||
194 | # :flag.usage |
|
194 | # :flag.usage | |
195 | printf " %s\n" "--arg-admin-email ARG_ADMIN_EMAIL" |
|
195 | printf " %s\n" "--arg-admin-email ARG_ADMIN_EMAIL" | |
196 | printf " specify admin_email [foo@example.com] for setup\n" |
|
196 | printf " specify admin_email [foo@example.com] for setup\n" | |
197 | echo |
|
197 | echo | |
198 |
|
198 | |||
199 | # :flag.usage |
|
199 | # :flag.usage | |
200 | printf " %s\n" "--arg-admin-user ARG_ADMIN_USER" |
|
200 | printf " %s\n" "--arg-admin-user ARG_ADMIN_USER" | |
201 | printf " specify admin_user [admin] for setup\n" |
|
201 | printf " specify admin_user [admin] for setup\n" | |
202 | echo |
|
202 | echo | |
203 |
|
203 | |||
204 | # :flag.usage |
|
204 | # :flag.usage | |
205 | printf " %s\n" "--arg-admin-pass ARG_ADMIN_PASS" |
|
205 | printf " %s\n" "--arg-admin-pass ARG_ADMIN_PASS" | |
206 | printf " specify admin_pass [secretpassword] for setup\n" |
|
206 | printf " specify admin_pass [secretpassword] for setup\n" | |
207 | echo |
|
207 | echo | |
208 |
|
208 | |||
209 | # :flag.usage |
|
209 | # :flag.usage | |
210 | printf " %s\n" "--arg-license-token ARG_ADMIN_TOKEN" |
|
210 | printf " %s\n" "--arg-license-token ARG_ADMIN_TOKEN" | |
211 | printf " specify license_token [abcd-abcd-abcd-abcd] for setup\n" |
|
211 | printf " specify license_token [abcd-abcd-abcd-abcd] for setup\n" | |
212 | echo |
|
212 | echo | |
213 |
|
213 | |||
214 | # :flag.usage |
|
214 | # :flag.usage | |
215 | printf " %s\n" "--no-prompt" |
|
215 | printf " %s\n" "--no-prompt" | |
216 | printf " Don't use interactive prompt to ask setup questions. Use defaults instead\n" |
|
216 | printf " Don't use interactive prompt to ask setup questions. Use defaults instead\n" | |
217 | echo |
|
217 | echo | |
218 |
|
218 | |||
219 | # :flag.usage |
|
219 | # :flag.usage | |
220 | printf " %s\n" "--force, -f" |
|
220 | printf " %s\n" "--force, -f" | |
221 | printf " Overwrite existing files\n" |
|
221 | printf " Overwrite existing files\n" | |
222 | echo |
|
222 | echo | |
223 |
|
223 | |||
224 | # :flag.usage |
|
224 | # :flag.usage | |
225 | printf " %s\n" "--stage STAGE (repeatable)" |
|
225 | printf " %s\n" "--stage STAGE (repeatable)" | |
226 | printf " specify one or more stages to run\n" |
|
226 | printf " specify one or more stages to run\n" | |
227 | echo |
|
227 | echo | |
228 |
|
228 | |||
229 | # :flag.usage |
|
229 | # :flag.usage | |
230 | printf " %s\n" "--docker-revision DOCKER_REVISION" |
|
230 | printf " %s\n" "--docker-revision DOCKER_REVISION" | |
231 | printf " revision to fetch new docker definitions.\n" |
|
231 | printf " revision to fetch new docker definitions.\n" | |
232 | printf " Default: stable\n" |
|
232 | printf " Default: stable\n" | |
233 | echo |
|
233 | echo | |
234 |
|
234 | |||
235 | # :flag.usage |
|
235 | # :flag.usage | |
236 | printf " %s\n" "--install-docker INSTALL_DOCKER" |
|
236 | printf " %s\n" "--install-docker INSTALL_DOCKER" | |
237 | printf " answer [y]es or [n]o to question to install docker\n" |
|
237 | printf " answer [y]es or [n]o to question to install docker\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 the rcstack archive should be\n downloaded from\n" |
|
242 | printf " Specify RhodeCode server location where the rcstack archive should be\n downloaded from\n" | |
243 | printf " Default: https://dls.rhodecode.com/get_archive\n" |
|
243 | printf " Default: https://dls.rhodecode.com/get_archive\n" | |
244 | echo |
|
244 | echo | |
245 |
|
245 | |||
246 | # :flag.usage |
|
246 | # :flag.usage | |
247 | printf " %s\n" "--auth-token AUTH_TOKEN" |
|
247 | printf " %s\n" "--auth-token AUTH_TOKEN" | |
248 | printf " Optionally specify AUTH TOKEN to obtain sources\n" |
|
248 | printf " Optionally specify AUTH TOKEN to obtain sources\n" | |
249 | echo |
|
249 | echo | |
250 |
|
250 | |||
251 | # :command.usage_fixed_flags |
|
251 | # :command.usage_fixed_flags | |
252 | printf " %s\n" "--help, -h" |
|
252 | printf " %s\n" "--help, -h" | |
253 | printf " Show this help\n" |
|
253 | printf " Show this help\n" | |
254 | echo |
|
254 | echo | |
255 |
|
255 | |||
256 | # :command.usage_examples |
|
256 | # :command.usage_examples | |
257 | printf "%s\n" "Examples:" |
|
257 | printf "%s\n" "Examples:" | |
258 | 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" |
|
258 | 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" | |
259 | echo |
|
259 | echo | |
260 |
|
260 | |||
261 | fi |
|
261 | fi | |
262 | } |
|
262 | } | |
263 |
|
263 | |||
264 | # :command.usage |
|
264 | # :command.usage | |
265 | rcstack_self_update_usage() { |
|
265 | rcstack_self_update_usage() { | |
266 | if [[ -n $long_usage ]]; then |
|
266 | if [[ -n $long_usage ]]; then | |
267 | printf "rcstack self-update - Update rcstack and it's docker definitions\n" |
|
267 | printf "rcstack self-update - Update rcstack and it's docker definitions\n" | |
268 | echo |
|
268 | echo | |
269 |
|
269 | |||
270 | else |
|
270 | else | |
271 | printf "rcstack self-update - Update rcstack and it's docker definitions\n" |
|
271 | printf "rcstack self-update - Update rcstack and it's docker definitions\n" | |
272 | echo |
|
272 | echo | |
273 |
|
273 | |||
274 | fi |
|
274 | fi | |
275 |
|
275 | |||
276 | printf "%s\n" "Usage:" |
|
276 | printf "%s\n" "Usage:" | |
277 | printf " rcstack self-update [OPTIONS]\n" |
|
277 | printf " rcstack self-update [OPTIONS]\n" | |
278 | printf " rcstack self-update --help | -h\n" |
|
278 | printf " rcstack self-update --help | -h\n" | |
279 | echo |
|
279 | echo | |
280 |
|
280 | |||
281 | # :command.long_usage |
|
281 | # :command.long_usage | |
282 | if [[ -n $long_usage ]]; then |
|
282 | if [[ -n $long_usage ]]; then | |
283 | printf "%s\n" "Options:" |
|
283 | printf "%s\n" "Options:" | |
284 |
|
284 | |||
285 | # :command.usage_flags |
|
285 | # :command.usage_flags | |
286 | # :flag.usage |
|
286 | # :flag.usage | |
287 | printf " %s\n" "--force" |
|
287 | printf " %s\n" "--force" | |
288 | printf " Ignore same-version skip check. Runs same logic as there would be new\n version available\n" |
|
288 | printf " Ignore same-version skip check. Runs same logic as there would be new\n version available\n" | |
289 | echo |
|
289 | echo | |
290 |
|
290 | |||
291 | # :flag.usage |
|
291 | # :flag.usage | |
292 | printf " %s\n" "--update-docker-image UPDATE_DOCKER_IMAGE" |
|
292 | printf " %s\n" "--update-docker-image UPDATE_DOCKER_IMAGE" | |
293 | printf " answer [y]es or [n]o to question to set docker image from installer stored\n version.\n" |
|
293 | printf " answer [y]es or [n]o to question to set docker image from installer stored\n version.\n" | |
294 | echo |
|
294 | echo | |
295 |
|
295 | |||
296 | # :flag.usage |
|
296 | # :flag.usage | |
297 | printf " %s\n" "--cli-revision CLI_REVISION" |
|
297 | printf " %s\n" "--cli-revision CLI_REVISION" | |
298 | printf " commit or branch to fetch new rcstack cli tool.\n" |
|
298 | printf " commit or branch to fetch new rcstack cli tool.\n" | |
299 | printf " Default: stable\n" |
|
299 | printf " Default: stable\n" | |
300 | echo |
|
300 | echo | |
301 |
|
301 | |||
302 | # :flag.usage |
|
302 | # :flag.usage | |
303 | printf " %s\n" "--docker-revision DOCKER_REVISION" |
|
303 | printf " %s\n" "--docker-revision DOCKER_REVISION" | |
304 | printf " commit or branch to fetch new docker definitions.\n" |
|
304 | printf " commit or branch to fetch new docker definitions.\n" | |
305 | printf " Default: stable\n" |
|
305 | printf " Default: stable\n" | |
306 | echo |
|
306 | echo | |
307 |
|
307 | |||
308 | # :flag.usage |
|
308 | # :flag.usage | |
309 | printf " %s\n" "--server-url SERVER_URL" |
|
309 | printf " %s\n" "--server-url SERVER_URL" | |
310 | printf " Specify RhodeCode server location where the rcstack archive should be\n downloaded from\n" |
|
310 | printf " Specify RhodeCode server location where the rcstack archive should be\n downloaded from\n" | |
311 | printf " Default: https://dls.rhodecode.com/get_archive\n" |
|
311 | printf " Default: https://dls.rhodecode.com/get_archive\n" | |
312 | echo |
|
312 | echo | |
313 |
|
313 | |||
314 | # :flag.usage |
|
314 | # :flag.usage | |
315 | printf " %s\n" "--auth-token AUTH_TOKEN" |
|
315 | printf " %s\n" "--auth-token AUTH_TOKEN" | |
316 | printf " Optionally specify AUTH TOKEN to obtain sources\n" |
|
316 | printf " Optionally specify AUTH TOKEN to obtain sources\n" | |
317 | echo |
|
317 | echo | |
318 |
|
318 | |||
319 | # :command.usage_fixed_flags |
|
319 | # :command.usage_fixed_flags | |
320 | printf " %s\n" "--help, -h" |
|
320 | printf " %s\n" "--help, -h" | |
321 | printf " Show this help\n" |
|
321 | printf " Show this help\n" | |
322 | echo |
|
322 | echo | |
323 |
|
323 | |||
324 | # :command.usage_examples |
|
324 | # :command.usage_examples | |
325 | printf "%s\n" "Examples:" |
|
325 | printf "%s\n" "Examples:" | |
326 | printf " # simply to update it to a new version\n - ./rccstack self-update \n \n # to fetch dev branch and install it\n - ./rccstack self-update --cli-revision=master --docker-revision=master\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/stable && chmod +x rcstack\n" |
|
326 | printf " # simply to update it to a new version\n - ./rccstack self-update \n \n # to fetch dev branch and install it\n - ./rccstack self-update --cli-revision=master --docker-revision=master\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/stable && chmod +x rcstack\n" | |
327 | echo |
|
327 | echo | |
328 |
|
328 | |||
329 | fi |
|
329 | fi | |
330 | } |
|
330 | } | |
331 |
|
331 | |||
332 | # :command.usage |
|
332 | # :command.usage | |
333 | rcstack_stack_usage() { |
|
333 | rcstack_stack_usage() { | |
334 | if [[ -n $long_usage ]]; then |
|
334 | if [[ -n $long_usage ]]; then | |
335 | printf "rcstack stack - Run one of available cluster stacks, run stack -h for more details\n" |
|
335 | printf "rcstack stack - Run one of available cluster stacks, run stack -h for more details\n" | |
336 | echo |
|
336 | echo | |
337 |
|
337 | |||
338 | else |
|
338 | else | |
339 | printf "rcstack stack - Run one of available cluster stacks, run stack -h for more details\n" |
|
339 | printf "rcstack stack - Run one of available cluster stacks, run stack -h for more details\n" | |
340 | echo |
|
340 | echo | |
341 |
|
341 | |||
342 | fi |
|
342 | fi | |
343 |
|
343 | |||
344 | printf "%s\n" "Usage:" |
|
344 | printf "%s\n" "Usage:" | |
345 | printf " rcstack stack [OPTIONS] COMMAND\n" |
|
345 | printf " rcstack stack [OPTIONS] COMMAND\n" | |
346 | printf " rcstack stack [COMMAND] --help | -h\n" |
|
346 | printf " rcstack stack [COMMAND] --help | -h\n" | |
347 | echo |
|
347 | echo | |
348 | # :command.usage_commands |
|
348 | # :command.usage_commands | |
349 | printf "%s\n" "Commands:" |
|
349 | printf "%s\n" "Commands:" | |
350 | printf " %s execute commands for the router stack\n" "router " |
|
350 | printf " %s execute commands for the router stack\n" "router " | |
351 | printf " %s execute commands for the router stack\n" "metrics " |
|
351 | printf " %s execute commands for the router stack\n" "metrics " | |
352 | printf " %s execute commands for the router stack\n" "services " |
|
352 | printf " %s execute commands for the router stack\n" "services " | |
353 | printf " %s execute commands for the router stack\n" "rhodecode" |
|
353 | printf " %s execute commands for the router stack\n" "rhodecode" | |
354 | printf " %s execute commands for all stacks in order\n" "all " |
|
354 | printf " %s execute commands for all stacks in order\n" "all " | |
355 | echo |
|
355 | echo | |
356 |
|
356 | |||
357 | # :command.long_usage |
|
357 | # :command.long_usage | |
358 | if [[ -n $long_usage ]]; then |
|
358 | if [[ -n $long_usage ]]; then | |
359 | printf "%s\n" "Options:" |
|
359 | printf "%s\n" "Options:" | |
360 |
|
360 | |||
361 | # :command.usage_flags |
|
361 | # :command.usage_flags | |
362 | # :flag.usage |
|
362 | # :flag.usage | |
363 | printf " %s\n" "--env-file-path ENV_FILE_PATH" |
|
363 | printf " %s\n" "--env-file-path ENV_FILE_PATH" | |
364 | printf " Set custom env file\n" |
|
364 | printf " Set custom env file\n" | |
365 | printf " Default: $PWD/.custom/.runtime.env\n" |
|
365 | printf " Default: $PWD/.custom/.runtime.env\n" | |
366 | echo |
|
366 | echo | |
367 |
|
367 | |||
368 | # :flag.usage |
|
368 | # :flag.usage | |
369 | printf " %s\n" "--stack-prefix STACK_PREFIX" |
|
369 | printf " %s\n" "--stack-prefix STACK_PREFIX" | |
370 | printf " Set custom stack prefix, e.g rc_cluster_apps_ci\n" |
|
370 | printf " Set custom stack prefix, e.g rc_cluster_apps_ci\n" | |
371 | echo |
|
371 | echo | |
372 |
|
372 | |||
373 | # :command.usage_fixed_flags |
|
373 | # :command.usage_fixed_flags | |
374 | printf " %s\n" "--help, -h" |
|
374 | printf " %s\n" "--help, -h" | |
375 | printf " Show this help\n" |
|
375 | printf " Show this help\n" | |
376 | echo |
|
376 | echo | |
377 |
|
377 | |||
378 | # :command.usage_examples |
|
378 | # :command.usage_examples | |
379 | printf "%s\n" "Examples:" |
|
379 | printf "%s\n" "Examples:" | |
380 | printf " # running stack (example for router 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 restart # restart the 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" |
|
380 | printf " # running stack (example for router 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 restart # restart the 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 | echo |
|
381 | echo | |
382 |
|
382 | |||
383 | fi |
|
383 | fi | |
384 | } |
|
384 | } | |
385 |
|
385 | |||
386 | # :command.usage |
|
386 | # :command.usage | |
387 | rcstack_stack_router_usage() { |
|
387 | rcstack_stack_router_usage() { | |
388 | if [[ -n $long_usage ]]; then |
|
388 | if [[ -n $long_usage ]]; then | |
389 | printf "rcstack stack router - execute commands for the router stack\n" |
|
389 | printf "rcstack stack router - execute commands for the router stack\n" | |
390 | echo |
|
390 | echo | |
391 |
|
391 | |||
392 | else |
|
392 | else | |
393 | printf "rcstack stack router - execute commands for the router stack\n" |
|
393 | printf "rcstack stack router - execute commands for the router stack\n" | |
394 | echo |
|
394 | echo | |
395 |
|
395 | |||
396 | fi |
|
396 | fi | |
397 |
|
397 | |||
398 | printf "%s\n" "Usage:" |
|
398 | printf "%s\n" "Usage:" | |
399 | printf " rcstack stack router [SERVICES PARAMS...]\n" |
|
399 | printf " rcstack stack router [SERVICES PARAMS...]\n" | |
400 | printf " rcstack stack router --help | -h\n" |
|
400 | printf " rcstack stack router --help | -h\n" | |
401 | echo |
|
401 | echo | |
402 |
|
402 | |||
403 | # :command.long_usage |
|
403 | # :command.long_usage | |
404 | if [[ -n $long_usage ]]; then |
|
404 | if [[ -n $long_usage ]]; then | |
405 | printf "%s\n" "Options:" |
|
405 | printf "%s\n" "Options:" | |
406 |
|
406 | |||
407 | # :command.usage_fixed_flags |
|
407 | # :command.usage_fixed_flags | |
408 | printf " %s\n" "--help, -h" |
|
408 | printf " %s\n" "--help, -h" | |
409 | printf " Show this help\n" |
|
409 | printf " Show this help\n" | |
410 | echo |
|
410 | echo | |
411 |
|
411 | |||
412 | # :command.usage_args |
|
412 | # :command.usage_args | |
413 | printf "%s\n" "Arguments:" |
|
413 | printf "%s\n" "Arguments:" | |
414 |
|
414 | |||
415 | echo " SERVICES PARAMS..." |
|
415 | echo " SERVICES PARAMS..." | |
416 | printf " Additional arguments or flags for services command\n" |
|
416 | printf " Additional arguments or flags for services command\n" | |
417 | echo |
|
417 | echo | |
418 |
|
418 | |||
419 | fi |
|
419 | fi | |
420 | } |
|
420 | } | |
421 |
|
421 | |||
422 | # :command.usage |
|
422 | # :command.usage | |
423 | rcstack_stack_metrics_usage() { |
|
423 | rcstack_stack_metrics_usage() { | |
424 | if [[ -n $long_usage ]]; then |
|
424 | if [[ -n $long_usage ]]; then | |
425 | printf "rcstack stack metrics - execute commands for the router stack\n" |
|
425 | printf "rcstack stack metrics - execute commands for the router stack\n" | |
426 | echo |
|
426 | echo | |
427 |
|
427 | |||
428 | else |
|
428 | else | |
429 | printf "rcstack stack metrics - execute commands for the router stack\n" |
|
429 | printf "rcstack stack metrics - execute commands for the router stack\n" | |
430 | echo |
|
430 | echo | |
431 |
|
431 | |||
432 | fi |
|
432 | fi | |
433 |
|
433 | |||
434 | printf "%s\n" "Usage:" |
|
434 | printf "%s\n" "Usage:" | |
435 | printf " rcstack stack metrics [SERVICES PARAMS...]\n" |
|
435 | printf " rcstack stack metrics [SERVICES PARAMS...]\n" | |
436 | printf " rcstack stack metrics --help | -h\n" |
|
436 | printf " rcstack stack metrics --help | -h\n" | |
437 | echo |
|
437 | echo | |
438 |
|
438 | |||
439 | # :command.long_usage |
|
439 | # :command.long_usage | |
440 | if [[ -n $long_usage ]]; then |
|
440 | if [[ -n $long_usage ]]; then | |
441 | printf "%s\n" "Options:" |
|
441 | printf "%s\n" "Options:" | |
442 |
|
442 | |||
443 | # :command.usage_fixed_flags |
|
443 | # :command.usage_fixed_flags | |
444 | printf " %s\n" "--help, -h" |
|
444 | printf " %s\n" "--help, -h" | |
445 | printf " Show this help\n" |
|
445 | printf " Show this help\n" | |
446 | echo |
|
446 | echo | |
447 |
|
447 | |||
448 | # :command.usage_args |
|
448 | # :command.usage_args | |
449 | printf "%s\n" "Arguments:" |
|
449 | printf "%s\n" "Arguments:" | |
450 |
|
450 | |||
451 | echo " SERVICES PARAMS..." |
|
451 | echo " SERVICES PARAMS..." | |
452 | printf " Additional arguments or flags for services command\n" |
|
452 | printf " Additional arguments or flags for services command\n" | |
453 | echo |
|
453 | echo | |
454 |
|
454 | |||
455 | fi |
|
455 | fi | |
456 | } |
|
456 | } | |
457 |
|
457 | |||
458 | # :command.usage |
|
458 | # :command.usage | |
459 | rcstack_stack_services_usage() { |
|
459 | rcstack_stack_services_usage() { | |
460 | if [[ -n $long_usage ]]; then |
|
460 | if [[ -n $long_usage ]]; then | |
461 | printf "rcstack stack services - execute commands for the router stack\n" |
|
461 | printf "rcstack stack services - execute commands for the router stack\n" | |
462 | echo |
|
462 | echo | |
463 |
|
463 | |||
464 | else |
|
464 | else | |
465 | printf "rcstack stack services - execute commands for the router stack\n" |
|
465 | printf "rcstack stack services - execute commands for the router stack\n" | |
466 | echo |
|
466 | echo | |
467 |
|
467 | |||
468 | fi |
|
468 | fi | |
469 |
|
469 | |||
470 | printf "%s\n" "Usage:" |
|
470 | printf "%s\n" "Usage:" | |
471 | printf " rcstack stack services [SERVICES PARAMS...]\n" |
|
471 | printf " rcstack stack services [SERVICES PARAMS...]\n" | |
472 | printf " rcstack stack services --help | -h\n" |
|
472 | printf " rcstack stack services --help | -h\n" | |
473 | echo |
|
473 | echo | |
474 |
|
474 | |||
475 | # :command.long_usage |
|
475 | # :command.long_usage | |
476 | if [[ -n $long_usage ]]; then |
|
476 | if [[ -n $long_usage ]]; then | |
477 | printf "%s\n" "Options:" |
|
477 | printf "%s\n" "Options:" | |
478 |
|
478 | |||
479 | # :command.usage_fixed_flags |
|
479 | # :command.usage_fixed_flags | |
480 | printf " %s\n" "--help, -h" |
|
480 | printf " %s\n" "--help, -h" | |
481 | printf " Show this help\n" |
|
481 | printf " Show this help\n" | |
482 | echo |
|
482 | echo | |
483 |
|
483 | |||
484 | # :command.usage_args |
|
484 | # :command.usage_args | |
485 | printf "%s\n" "Arguments:" |
|
485 | printf "%s\n" "Arguments:" | |
486 |
|
486 | |||
487 | echo " SERVICES PARAMS..." |
|
487 | echo " SERVICES PARAMS..." | |
488 | printf " Additional arguments or flags for services command\n" |
|
488 | printf " Additional arguments or flags for services command\n" | |
489 | echo |
|
489 | echo | |
490 |
|
490 | |||
491 | fi |
|
491 | fi | |
492 | } |
|
492 | } | |
493 |
|
493 | |||
494 | # :command.usage |
|
494 | # :command.usage | |
495 | rcstack_stack_rhodecode_usage() { |
|
495 | rcstack_stack_rhodecode_usage() { | |
496 | if [[ -n $long_usage ]]; then |
|
496 | if [[ -n $long_usage ]]; then | |
497 | printf "rcstack stack rhodecode - execute commands for the router stack\n" |
|
497 | printf "rcstack stack rhodecode - execute commands for the router stack\n" | |
498 | echo |
|
498 | echo | |
499 |
|
499 | |||
500 | else |
|
500 | else | |
501 | printf "rcstack stack rhodecode - execute commands for the router stack\n" |
|
501 | printf "rcstack stack rhodecode - execute commands for the router stack\n" | |
502 | echo |
|
502 | echo | |
503 |
|
503 | |||
504 | fi |
|
504 | fi | |
505 |
|
505 | |||
506 | printf "%s\n" "Usage:" |
|
506 | printf "%s\n" "Usage:" | |
507 | printf " rcstack stack rhodecode [SERVICES PARAMS...]\n" |
|
507 | printf " rcstack stack rhodecode [SERVICES PARAMS...]\n" | |
508 | printf " rcstack stack rhodecode --help | -h\n" |
|
508 | printf " rcstack stack rhodecode --help | -h\n" | |
509 | echo |
|
509 | echo | |
510 |
|
510 | |||
511 | # :command.long_usage |
|
511 | # :command.long_usage | |
512 | if [[ -n $long_usage ]]; then |
|
512 | if [[ -n $long_usage ]]; then | |
513 | printf "%s\n" "Options:" |
|
513 | printf "%s\n" "Options:" | |
514 |
|
514 | |||
515 | # :command.usage_fixed_flags |
|
515 | # :command.usage_fixed_flags | |
516 | printf " %s\n" "--help, -h" |
|
516 | printf " %s\n" "--help, -h" | |
517 | printf " Show this help\n" |
|
517 | printf " Show this help\n" | |
518 | echo |
|
518 | echo | |
519 |
|
519 | |||
520 | # :command.usage_args |
|
520 | # :command.usage_args | |
521 | printf "%s\n" "Arguments:" |
|
521 | printf "%s\n" "Arguments:" | |
522 |
|
522 | |||
523 | echo " SERVICES PARAMS..." |
|
523 | echo " SERVICES PARAMS..." | |
524 | printf " Additional arguments or flags for services command\n" |
|
524 | printf " Additional arguments or flags for services command\n" | |
525 | echo |
|
525 | echo | |
526 |
|
526 | |||
527 | fi |
|
527 | fi | |
528 | } |
|
528 | } | |
529 |
|
529 | |||
530 | # :command.usage |
|
530 | # :command.usage | |
531 | rcstack_stack_all_usage() { |
|
531 | rcstack_stack_all_usage() { | |
532 | if [[ -n $long_usage ]]; then |
|
532 | if [[ -n $long_usage ]]; then | |
533 | printf "rcstack stack all - execute commands for all stacks in order\n" |
|
533 | printf "rcstack stack all - execute commands for all stacks in order\n" | |
534 | echo |
|
534 | echo | |
535 |
|
535 | |||
536 | else |
|
536 | else | |
537 | printf "rcstack stack all - execute commands for all stacks in order\n" |
|
537 | printf "rcstack stack all - execute commands for all stacks in order\n" | |
538 | echo |
|
538 | echo | |
539 |
|
539 | |||
540 | fi |
|
540 | fi | |
541 |
|
541 | |||
542 | printf "%s\n" "Usage:" |
|
542 | printf "%s\n" "Usage:" | |
543 | printf " rcstack stack all [SERVICES PARAMS...]\n" |
|
543 | printf " rcstack stack all [SERVICES PARAMS...]\n" | |
544 | printf " rcstack stack all --help | -h\n" |
|
544 | printf " rcstack stack all --help | -h\n" | |
545 | echo |
|
545 | echo | |
546 |
|
546 | |||
547 | # :command.long_usage |
|
547 | # :command.long_usage | |
548 | if [[ -n $long_usage ]]; then |
|
548 | if [[ -n $long_usage ]]; then | |
549 | printf "%s\n" "Options:" |
|
549 | printf "%s\n" "Options:" | |
550 |
|
550 | |||
551 | # :command.usage_fixed_flags |
|
551 | # :command.usage_fixed_flags | |
552 | printf " %s\n" "--help, -h" |
|
552 | printf " %s\n" "--help, -h" | |
553 | printf " Show this help\n" |
|
553 | printf " Show this help\n" | |
554 | echo |
|
554 | echo | |
555 |
|
555 | |||
556 | # :command.usage_args |
|
556 | # :command.usage_args | |
557 | printf "%s\n" "Arguments:" |
|
557 | printf "%s\n" "Arguments:" | |
558 |
|
558 | |||
559 | echo " SERVICES PARAMS..." |
|
559 | echo " SERVICES PARAMS..." | |
560 | printf " Additional arguments or flags for services command\n" |
|
560 | printf " Additional arguments or flags for services command\n" | |
561 | echo |
|
561 | echo | |
562 |
|
562 | |||
563 | fi |
|
563 | fi | |
564 | } |
|
564 | } | |
565 |
|
565 | |||
566 | # :command.usage |
|
566 | # :command.usage | |
567 | rcstack_stack_status_usage() { |
|
567 | rcstack_stack_status_usage() { | |
568 | if [[ -n $long_usage ]]; then |
|
568 | if [[ -n $long_usage ]]; then | |
569 | printf "rcstack stack-status - Show stack status\n" |
|
569 | printf "rcstack stack-status - Show stack status\n" | |
570 | echo |
|
570 | echo | |
571 |
|
571 | |||
572 | else |
|
572 | else | |
573 | printf "rcstack stack-status - Show stack status\n" |
|
573 | printf "rcstack stack-status - Show stack status\n" | |
574 | echo |
|
574 | echo | |
575 |
|
575 | |||
576 | fi |
|
576 | fi | |
577 |
|
577 | |||
578 | printf "Alias: status\n" |
|
578 | printf "Alias: status\n" | |
579 | echo |
|
579 | echo | |
580 |
|
580 | |||
581 | printf "%s\n" "Usage:" |
|
581 | printf "%s\n" "Usage:" | |
582 | printf " rcstack stack-status [OPTIONS]\n" |
|
582 | printf " rcstack stack-status [OPTIONS]\n" | |
583 | printf " rcstack stack-status --help | -h\n" |
|
583 | printf " rcstack stack-status --help | -h\n" | |
584 | echo |
|
584 | echo | |
585 |
|
585 | |||
586 | # :command.long_usage |
|
586 | # :command.long_usage | |
587 | if [[ -n $long_usage ]]; then |
|
587 | if [[ -n $long_usage ]]; then | |
588 | printf "%s\n" "Options:" |
|
588 | printf "%s\n" "Options:" | |
589 |
|
589 | |||
590 | # :command.usage_flags |
|
590 | # :command.usage_flags | |
591 | # :flag.usage |
|
591 | # :flag.usage | |
592 | printf " %s\n" "--detailed" |
|
592 | printf " %s\n" "--detailed" | |
593 | printf " Display a detailed format\n" |
|
593 | printf " Display a detailed format\n" | |
594 | echo |
|
594 | echo | |
595 |
|
595 | |||
596 | # :flag.usage |
|
596 | # :flag.usage | |
597 | printf " %s\n" "--configs" |
|
597 | printf " %s\n" "--configs" | |
598 | printf " Display a detailed info about configuration files\n" |
|
598 | printf " Display a detailed info about configuration files\n" | |
599 | echo |
|
599 | echo | |
600 |
|
600 | |||
601 | # :flag.usage |
|
601 | # :flag.usage | |
602 | printf " %s\n" "-v" |
|
602 | printf " %s\n" "-v" | |
603 | printf " Verbose output for details on the stack\n" |
|
603 | printf " Verbose output for details on the stack\n" | |
604 | echo |
|
604 | echo | |
605 |
|
605 | |||
606 | # :command.usage_fixed_flags |
|
606 | # :command.usage_fixed_flags | |
607 | printf " %s\n" "--help, -h" |
|
607 | printf " %s\n" "--help, -h" | |
608 | printf " Show this help\n" |
|
608 | printf " Show this help\n" | |
609 | echo |
|
609 | echo | |
610 |
|
610 | |||
611 | fi |
|
611 | fi | |
612 | } |
|
612 | } | |
613 |
|
613 | |||
614 | # :command.usage |
|
614 | # :command.usage | |
615 | rcstack_stack_upgrade_usage() { |
|
615 | rcstack_stack_upgrade_usage() { | |
616 | if [[ -n $long_usage ]]; then |
|
616 | if [[ -n $long_usage ]]; then | |
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 | else |
|
620 | else | |
621 | printf "rcstack stack-upgrade - Upgrade a stack, run stack-upgrade -h for more details\n" |
|
621 | printf "rcstack stack-upgrade - Upgrade a stack, run stack-upgrade -h for more details\n" | |
622 | echo |
|
622 | echo | |
623 |
|
623 | |||
624 | fi |
|
624 | fi | |
625 |
|
625 | |||
626 | printf "%s\n" "Usage:" |
|
626 | printf "%s\n" "Usage:" | |
627 | printf " rcstack stack-upgrade [OPTIONS] COMMAND\n" |
|
627 | printf " rcstack stack-upgrade [OPTIONS] COMMAND\n" | |
628 | printf " rcstack stack-upgrade [COMMAND] --help | -h\n" |
|
628 | printf " rcstack stack-upgrade [COMMAND] --help | -h\n" | |
629 | echo |
|
629 | echo | |
630 | # :command.usage_commands |
|
630 | # :command.usage_commands | |
631 | printf "%s\n" "Commands:" |
|
631 | printf "%s\n" "Commands:" | |
632 | printf " %s upgrade the router stack\n" "router " |
|
632 | printf " %s upgrade the router stack\n" "router " | |
633 | printf " %s upgrade the services stack\n" "services " |
|
633 | printf " %s upgrade the services stack\n" "services " | |
634 | printf " %s upgrade the metrics stack\n" "metrics " |
|
634 | printf " %s upgrade the metrics stack\n" "metrics " | |
635 | printf " %s upgrade the rhodecode stack\n" "rhodecode" |
|
635 | printf " %s upgrade the rhodecode stack\n" "rhodecode" | |
636 | echo |
|
636 | echo | |
637 |
|
637 | |||
638 | # :command.long_usage |
|
638 | # :command.long_usage | |
639 | if [[ -n $long_usage ]]; then |
|
639 | if [[ -n $long_usage ]]; then | |
640 | printf "%s\n" "Options:" |
|
640 | printf "%s\n" "Options:" | |
641 |
|
641 | |||
642 | # :command.usage_flags |
|
642 | # :command.usage_flags | |
643 | # :flag.usage |
|
643 | # :flag.usage | |
644 | printf " %s\n" "--stack-prefix STACK_PREFIX" |
|
644 | printf " %s\n" "--stack-prefix STACK_PREFIX" | |
645 | printf " Set custom stack prefix, e.g rc_cluster_apps_ci\n" |
|
645 | printf " Set custom stack prefix, e.g rc_cluster_apps_ci\n" | |
646 | echo |
|
646 | echo | |
647 |
|
647 | |||
648 | # :command.usage_fixed_flags |
|
648 | # :command.usage_fixed_flags | |
649 | printf " %s\n" "--help, -h" |
|
649 | printf " %s\n" "--help, -h" | |
650 | printf " Show this help\n" |
|
650 | printf " Show this help\n" | |
651 | echo |
|
651 | echo | |
652 |
|
652 | |||
653 | # :command.usage_examples |
|
653 | # :command.usage_examples | |
654 | printf "%s\n" "Examples:" |
|
654 | printf "%s\n" "Examples:" | |
655 | 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 \n # RhodeCode stack upgrades with fast container restart recycle, might cause\n slight downtime\n - ./rcstack stack-upgrade rhodecode --stop-wait=10 --docker-stop-wait=5\n" |
|
655 | 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 \n # RhodeCode stack upgrades with fast container restart recycle, might cause\n slight downtime\n - ./rcstack stack-upgrade rhodecode --stop-wait=10 --docker-stop-wait=5\n" | |
656 | echo |
|
656 | echo | |
657 |
|
657 | |||
658 | fi |
|
658 | fi | |
659 | } |
|
659 | } | |
660 |
|
660 | |||
661 | # :command.usage |
|
661 | # :command.usage | |
662 | rcstack_stack_upgrade_router_usage() { |
|
662 | rcstack_stack_upgrade_router_usage() { | |
663 | if [[ -n $long_usage ]]; then |
|
663 | if [[ -n $long_usage ]]; then | |
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 | else |
|
667 | else | |
668 | printf "rcstack stack-upgrade router - upgrade the router stack\n" |
|
668 | printf "rcstack stack-upgrade router - upgrade the router stack\n" | |
669 | echo |
|
669 | echo | |
670 |
|
670 | |||
671 | fi |
|
671 | fi | |
672 |
|
672 | |||
673 | printf "%s\n" "Usage:" |
|
673 | printf "%s\n" "Usage:" | |
674 | printf " rcstack stack-upgrade router\n" |
|
674 | printf " rcstack stack-upgrade router\n" | |
675 | printf " rcstack stack-upgrade router --help | -h\n" |
|
675 | printf " rcstack stack-upgrade router --help | -h\n" | |
676 | echo |
|
676 | echo | |
677 |
|
677 | |||
678 | # :command.long_usage |
|
678 | # :command.long_usage | |
679 | if [[ -n $long_usage ]]; then |
|
679 | if [[ -n $long_usage ]]; then | |
680 | printf "%s\n" "Options:" |
|
680 | printf "%s\n" "Options:" | |
681 |
|
681 | |||
682 | # :command.usage_fixed_flags |
|
682 | # :command.usage_fixed_flags | |
683 | printf " %s\n" "--help, -h" |
|
683 | printf " %s\n" "--help, -h" | |
684 | printf " Show this help\n" |
|
684 | printf " Show this help\n" | |
685 | echo |
|
685 | echo | |
686 |
|
686 | |||
687 | fi |
|
687 | fi | |
688 | } |
|
688 | } | |
689 |
|
689 | |||
690 | # :command.usage |
|
690 | # :command.usage | |
691 | rcstack_stack_upgrade_services_usage() { |
|
691 | rcstack_stack_upgrade_services_usage() { | |
692 | if [[ -n $long_usage ]]; then |
|
692 | if [[ -n $long_usage ]]; then | |
693 | printf "rcstack stack-upgrade services - upgrade the services stack\n" |
|
693 | printf "rcstack stack-upgrade services - upgrade the services stack\n" | |
694 | echo |
|
694 | echo | |
695 |
|
695 | |||
696 | else |
|
696 | else | |
697 | printf "rcstack stack-upgrade services - upgrade the services stack\n" |
|
697 | printf "rcstack stack-upgrade services - upgrade the services stack\n" | |
698 | echo |
|
698 | echo | |
699 |
|
699 | |||
700 | fi |
|
700 | fi | |
701 |
|
701 | |||
702 | printf "%s\n" "Usage:" |
|
702 | printf "%s\n" "Usage:" | |
703 | printf " rcstack stack-upgrade services\n" |
|
703 | printf " rcstack stack-upgrade services\n" | |
704 | printf " rcstack stack-upgrade services --help | -h\n" |
|
704 | printf " rcstack stack-upgrade services --help | -h\n" | |
705 | echo |
|
705 | echo | |
706 |
|
706 | |||
707 | # :command.long_usage |
|
707 | # :command.long_usage | |
708 | if [[ -n $long_usage ]]; then |
|
708 | if [[ -n $long_usage ]]; then | |
709 | printf "%s\n" "Options:" |
|
709 | printf "%s\n" "Options:" | |
710 |
|
710 | |||
711 | # :command.usage_fixed_flags |
|
711 | # :command.usage_fixed_flags | |
712 | printf " %s\n" "--help, -h" |
|
712 | printf " %s\n" "--help, -h" | |
713 | printf " Show this help\n" |
|
713 | printf " Show this help\n" | |
714 | echo |
|
714 | echo | |
715 |
|
715 | |||
716 | fi |
|
716 | fi | |
717 | } |
|
717 | } | |
718 |
|
718 | |||
719 | # :command.usage |
|
719 | # :command.usage | |
720 | rcstack_stack_upgrade_metrics_usage() { |
|
720 | rcstack_stack_upgrade_metrics_usage() { | |
721 | if [[ -n $long_usage ]]; then |
|
721 | if [[ -n $long_usage ]]; then | |
722 | printf "rcstack stack-upgrade metrics - upgrade the metrics stack\n" |
|
722 | printf "rcstack stack-upgrade metrics - upgrade the metrics stack\n" | |
723 | echo |
|
723 | echo | |
724 |
|
724 | |||
725 | else |
|
725 | else | |
726 | printf "rcstack stack-upgrade metrics - upgrade the metrics stack\n" |
|
726 | printf "rcstack stack-upgrade metrics - upgrade the metrics stack\n" | |
727 | echo |
|
727 | echo | |
728 |
|
728 | |||
729 | fi |
|
729 | fi | |
730 |
|
730 | |||
731 | printf "%s\n" "Usage:" |
|
731 | printf "%s\n" "Usage:" | |
732 | printf " rcstack stack-upgrade metrics\n" |
|
732 | printf " rcstack stack-upgrade metrics\n" | |
733 | printf " rcstack stack-upgrade metrics --help | -h\n" |
|
733 | printf " rcstack stack-upgrade metrics --help | -h\n" | |
734 | echo |
|
734 | echo | |
735 |
|
735 | |||
736 | # :command.long_usage |
|
736 | # :command.long_usage | |
737 | if [[ -n $long_usage ]]; then |
|
737 | if [[ -n $long_usage ]]; then | |
738 | printf "%s\n" "Options:" |
|
738 | printf "%s\n" "Options:" | |
739 |
|
739 | |||
740 | # :command.usage_fixed_flags |
|
740 | # :command.usage_fixed_flags | |
741 | printf " %s\n" "--help, -h" |
|
741 | printf " %s\n" "--help, -h" | |
742 | printf " Show this help\n" |
|
742 | printf " Show this help\n" | |
743 | echo |
|
743 | echo | |
744 |
|
744 | |||
745 | fi |
|
745 | fi | |
746 | } |
|
746 | } | |
747 |
|
747 | |||
748 | # :command.usage |
|
748 | # :command.usage | |
749 | rcstack_stack_upgrade_rhodecode_usage() { |
|
749 | rcstack_stack_upgrade_rhodecode_usage() { | |
750 | if [[ -n $long_usage ]]; then |
|
750 | if [[ -n $long_usage ]]; then | |
751 | printf "rcstack stack-upgrade rhodecode - upgrade the rhodecode stack\n" |
|
751 | printf "rcstack stack-upgrade rhodecode - upgrade the rhodecode stack\n" | |
752 | echo |
|
752 | echo | |
753 |
|
753 | |||
754 | else |
|
754 | else | |
755 | printf "rcstack stack-upgrade rhodecode - upgrade the rhodecode stack\n" |
|
755 | printf "rcstack stack-upgrade rhodecode - upgrade the rhodecode stack\n" | |
756 | echo |
|
756 | echo | |
757 |
|
757 | |||
758 | fi |
|
758 | fi | |
759 |
|
759 | |||
760 | printf "%s\n" "Usage:" |
|
760 | printf "%s\n" "Usage:" | |
761 | printf " rcstack stack-upgrade rhodecode [OPTIONS]\n" |
|
761 | printf " rcstack stack-upgrade rhodecode [OPTIONS]\n" | |
762 | printf " rcstack stack-upgrade rhodecode --help | -h\n" |
|
762 | printf " rcstack stack-upgrade rhodecode --help | -h\n" | |
763 | echo |
|
763 | echo | |
764 |
|
764 | |||
765 | # :command.long_usage |
|
765 | # :command.long_usage | |
766 | if [[ -n $long_usage ]]; then |
|
766 | if [[ -n $long_usage ]]; then | |
767 | printf "%s\n" "Options:" |
|
767 | printf "%s\n" "Options:" | |
768 |
|
768 | |||
769 | # :command.usage_flags |
|
769 | # :command.usage_flags | |
770 | # :flag.usage |
|
770 | # :flag.usage | |
771 | printf " %s\n" "--stop-wait STOP_WAIT" |
|
771 | printf " %s\n" "--stop-wait STOP_WAIT" | |
772 | printf " Number of seconds to wait for stopping old containers, use low value to\n quickly restart and recycle containers\n" |
|
772 | printf " Number of seconds to wait for stopping old containers, use low value to\n quickly restart and recycle containers\n" | |
773 | printf " Default: 120\n" |
|
773 | printf " Default: 120\n" | |
774 | echo |
|
774 | echo | |
775 |
|
775 | |||
776 | # :flag.usage |
|
776 | # :flag.usage | |
777 | printf " %s\n" "--docker-stop-wait DOCKER_STOP_WAIT" |
|
777 | printf " %s\n" "--docker-stop-wait DOCKER_STOP_WAIT" | |
778 | printf " Number of seconds to pass to docker stop command that will wait for\n container to gracefully stop\n" |
|
778 | printf " Number of seconds to pass to docker stop command that will wait for\n container to gracefully stop\n" | |
779 | printf " Default: 3600\n" |
|
779 | printf " Default: 3600\n" | |
780 | echo |
|
780 | echo | |
781 |
|
781 | |||
782 | # :command.usage_fixed_flags |
|
782 | # :command.usage_fixed_flags | |
783 | printf " %s\n" "--help, -h" |
|
783 | printf " %s\n" "--help, -h" | |
784 | printf " Show this help\n" |
|
784 | printf " Show this help\n" | |
785 | echo |
|
785 | echo | |
786 |
|
786 | |||
787 | fi |
|
787 | fi | |
788 | } |
|
788 | } | |
789 |
|
789 | |||
790 | # :command.usage |
|
790 | # :command.usage | |
791 | rcstack_stack_monitor_usage() { |
|
791 | rcstack_stack_monitor_usage() { | |
792 | if [[ -n $long_usage ]]; then |
|
792 | if [[ -n $long_usage ]]; then | |
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 | else |
|
796 | else | |
797 | printf "rcstack stack-monitor - run monitoring on stack items\n" |
|
797 | printf "rcstack stack-monitor - run monitoring on stack items\n" | |
798 | echo |
|
798 | echo | |
799 |
|
799 | |||
800 | fi |
|
800 | fi | |
801 |
|
801 | |||
802 | printf "%s\n" "Usage:" |
|
802 | printf "%s\n" "Usage:" | |
803 | printf " rcstack stack-monitor COMMAND\n" |
|
803 | printf " rcstack stack-monitor COMMAND\n" | |
804 | printf " rcstack stack-monitor [COMMAND] --help | -h\n" |
|
804 | printf " rcstack stack-monitor [COMMAND] --help | -h\n" | |
805 | echo |
|
805 | echo | |
806 | # :command.usage_commands |
|
806 | # :command.usage_commands | |
807 | printf "%s\n" "Stack Commands:" |
|
807 | printf "%s\n" "Stack Commands:" | |
808 | printf " %s monitor stack containers that are unhealthy and restart them\n" "restart-unhealthy" |
|
808 | printf " %s monitor stack containers that are unhealthy and restart them\n" "restart-unhealthy" | |
809 | echo |
|
809 | echo | |
810 |
|
810 | |||
811 | # :command.long_usage |
|
811 | # :command.long_usage | |
812 | if [[ -n $long_usage ]]; then |
|
812 | if [[ -n $long_usage ]]; then | |
813 | printf "%s\n" "Options:" |
|
813 | printf "%s\n" "Options:" | |
814 |
|
814 | |||
815 | # :command.usage_fixed_flags |
|
815 | # :command.usage_fixed_flags | |
816 | printf " %s\n" "--help, -h" |
|
816 | printf " %s\n" "--help, -h" | |
817 | printf " Show this help\n" |
|
817 | printf " Show this help\n" | |
818 | echo |
|
818 | echo | |
819 |
|
819 | |||
820 | fi |
|
820 | fi | |
821 | } |
|
821 | } | |
822 |
|
822 | |||
823 | # :command.usage |
|
823 | # :command.usage | |
824 | rcstack_stack_monitor_restart_unhealthy_usage() { |
|
824 | rcstack_stack_monitor_restart_unhealthy_usage() { | |
825 | if [[ -n $long_usage ]]; then |
|
825 | if [[ -n $long_usage ]]; then | |
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 | else |
|
829 | else | |
830 | printf "rcstack stack-monitor restart-unhealthy - monitor stack containers that are unhealthy and restart them\n" |
|
830 | printf "rcstack stack-monitor restart-unhealthy - monitor stack containers that are unhealthy and restart them\n" | |
831 | echo |
|
831 | echo | |
832 |
|
832 | |||
833 | fi |
|
833 | fi | |
834 |
|
834 | |||
835 | printf "%s\n" "Usage:" |
|
835 | printf "%s\n" "Usage:" | |
836 | printf " rcstack stack-monitor restart-unhealthy [OPTIONS]\n" |
|
836 | printf " rcstack stack-monitor restart-unhealthy [OPTIONS]\n" | |
837 | printf " rcstack stack-monitor restart-unhealthy --help | -h\n" |
|
837 | printf " rcstack stack-monitor restart-unhealthy --help | -h\n" | |
838 | echo |
|
838 | echo | |
839 |
|
839 | |||
840 | # :command.long_usage |
|
840 | # :command.long_usage | |
841 | if [[ -n $long_usage ]]; then |
|
841 | if [[ -n $long_usage ]]; then | |
842 | printf "%s\n" "Options:" |
|
842 | printf "%s\n" "Options:" | |
843 |
|
843 | |||
844 | # :command.usage_flags |
|
844 | # :command.usage_flags | |
845 | # :flag.usage |
|
845 | # :flag.usage | |
846 | printf " %s\n" "--loop LOOP" |
|
846 | printf " %s\n" "--loop LOOP" | |
847 | printf " run in a loop to monitor continuously every N seconds\n" |
|
847 | printf " run in a loop to monitor continuously every N seconds\n" | |
848 | printf " Default: 0\n" |
|
848 | printf " Default: 0\n" | |
849 | echo |
|
849 | echo | |
850 |
|
850 | |||
851 | # :command.usage_fixed_flags |
|
851 | # :command.usage_fixed_flags | |
852 | printf " %s\n" "--help, -h" |
|
852 | printf " %s\n" "--help, -h" | |
853 | printf " Show this help\n" |
|
853 | printf " Show this help\n" | |
854 | echo |
|
854 | echo | |
855 |
|
855 | |||
856 | # :command.usage_examples |
|
856 | # :command.usage_examples | |
857 | printf "%s\n" "Examples:" |
|
857 | printf "%s\n" "Examples:" | |
858 | printf " # check and restart for unhealthy containers\n ./rcstack stack-monitor restart-unhealthy\n \n # check and restart for unhealthy containers, and continue in a loop every 5\n minutes (300s)\n ./rcstack stack-monitor restart-unhealthy --loop=300\n \n # run this script in background with logs\n nohup ./rcstack stack-monitor restart-unhealthy --loop=300 >\n unhealthy-checks.log &\n" |
|
858 | printf " # check and restart for unhealthy containers\n ./rcstack stack-monitor restart-unhealthy\n \n # check and restart for unhealthy containers, and continue in a loop every 5\n minutes (300s)\n ./rcstack stack-monitor restart-unhealthy --loop=300\n \n # run this script in background with logs\n nohup ./rcstack stack-monitor restart-unhealthy --loop=300 >\n unhealthy-checks.log &\n" | |
859 | echo |
|
859 | echo | |
860 |
|
860 | |||
861 | fi |
|
861 | fi | |
862 | } |
|
862 | } | |
863 |
|
863 | |||
864 | # :command.usage |
|
864 | # :command.usage | |
865 | rcstack_cli_usage() { |
|
865 | rcstack_cli_usage() { | |
866 | if [[ -n $long_usage ]]; then |
|
866 | if [[ -n $long_usage ]]; then | |
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 | else |
|
870 | else | |
871 | printf "rcstack cli - Various CLI tools, run cli -h for more details\n" |
|
871 | printf "rcstack cli - Various CLI tools, run cli -h for more details\n" | |
872 | echo |
|
872 | echo | |
873 |
|
873 | |||
874 | fi |
|
874 | fi | |
875 |
|
875 | |||
876 | printf "%s\n" "Usage:" |
|
876 | printf "%s\n" "Usage:" | |
877 | printf " rcstack cli COMMAND\n" |
|
877 | printf " rcstack cli COMMAND\n" | |
878 | printf " rcstack cli [COMMAND] --help | -h\n" |
|
878 | printf " rcstack cli [COMMAND] --help | -h\n" | |
879 | echo |
|
879 | echo | |
880 | # :command.usage_commands |
|
880 | # :command.usage_commands | |
881 | printf "%s\n" "Commands:" |
|
881 | printf "%s\n" "Commands:" | |
882 | printf " %s run a custom command on top of docker image from RhodeCode\n" "cmd " |
|
882 | printf " %s run a custom command on top of docker image from RhodeCode\n" "cmd " | |
883 | printf " %s ishell attached to running RhodeCode instance\n" "ishell " |
|
883 | printf " %s ishell attached to running RhodeCode instance\n" "ishell " | |
884 | printf " %s print out stored docker image version\n" "image-info " |
|
884 | printf " %s print out stored docker image version\n" "image-info " | |
885 | printf " %s set version to .runtime.env file\n" "set-runtime-image " |
|
885 | printf " %s set version to .runtime.env file\n" "set-runtime-image " | |
886 | printf " %s get current docker info\n" "docker-info " |
|
886 | printf " %s get current docker info\n" "docker-info " | |
887 | printf " %s force upgrade docker\n" "docker-upgrade " |
|
887 | printf " %s force upgrade docker\n" "docker-upgrade " | |
888 | printf " %s CLI for Redis\n" "redis " |
|
888 | printf " %s CLI for Redis\n" "redis " | |
889 | printf " %s CLI with Database connection\n" "db " |
|
889 | printf " %s CLI with Database connection\n" "db " | |
890 | printf " %s CLI to run db upgrade\n" "db-upgrade " |
|
890 | printf " %s CLI to run db upgrade\n" "db-upgrade " | |
891 | 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 " |
|
891 | 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 " | |
892 | printf " %s attach to running instance of RhodeCode, by default it attaches to rhodecode main web app\n" "attach " |
|
892 | printf " %s attach to running instance of RhodeCode, by default it attaches to rhodecode main web app\n" "attach " | |
893 | printf " %s set current setup to either CE (Community) or EE (Enterprise) type\n" "set-edition " |
|
893 | printf " %s set current setup to either CE (Community) or EE (Enterprise) type\n" "set-edition " | |
894 | printf " %s reconfigure the vcsserver.ini file\n" "configure-vcsserver" |
|
894 | printf " %s reconfigure the vcsserver.ini file\n" "configure-vcsserver" | |
895 | printf " %s reconfigure the rhodecode.ini file\n" "configure-rhodecode" |
|
895 | printf " %s reconfigure the rhodecode.ini file\n" "configure-rhodecode" | |
896 | echo |
|
896 | echo | |
897 |
|
897 | |||
898 | # :command.long_usage |
|
898 | # :command.long_usage | |
899 | if [[ -n $long_usage ]]; then |
|
899 | if [[ -n $long_usage ]]; then | |
900 | printf "%s\n" "Options:" |
|
900 | printf "%s\n" "Options:" | |
901 |
|
901 | |||
902 | # :command.usage_fixed_flags |
|
902 | # :command.usage_fixed_flags | |
903 | printf " %s\n" "--help, -h" |
|
903 | printf " %s\n" "--help, -h" | |
904 | printf " Show this help\n" |
|
904 | printf " Show this help\n" | |
905 | echo |
|
905 | echo | |
906 |
|
906 | |||
907 | fi |
|
907 | fi | |
908 | } |
|
908 | } | |
909 |
|
909 | |||
910 | # :command.usage |
|
910 | # :command.usage | |
911 | rcstack_cli_cmd_usage() { |
|
911 | rcstack_cli_cmd_usage() { | |
912 | if [[ -n $long_usage ]]; then |
|
912 | if [[ -n $long_usage ]]; then | |
913 | printf "rcstack cli cmd - run a custom command on top of docker image from RhodeCode\n" |
|
913 | printf "rcstack cli cmd - run a custom command on top of docker image from RhodeCode\n" | |
914 | echo |
|
914 | echo | |
915 |
|
915 | |||
916 | else |
|
916 | else | |
917 | printf "rcstack cli cmd - run a custom command on top of docker image from RhodeCode\n" |
|
917 | printf "rcstack cli cmd - run a custom command on top of docker image from RhodeCode\n" | |
918 | echo |
|
918 | echo | |
919 |
|
919 | |||
920 | fi |
|
920 | fi | |
921 |
|
921 | |||
922 | printf "%s\n" "Usage:" |
|
922 | printf "%s\n" "Usage:" | |
923 | printf " rcstack cli cmd [OPTIONS] [CALL ARGUMENTS...]\n" |
|
923 | printf " rcstack cli cmd [OPTIONS] [CALL ARGUMENTS...]\n" | |
924 | printf " rcstack cli cmd --help | -h\n" |
|
924 | printf " rcstack cli cmd --help | -h\n" | |
925 | echo |
|
925 | echo | |
926 |
|
926 | |||
927 | # :command.long_usage |
|
927 | # :command.long_usage | |
928 | if [[ -n $long_usage ]]; then |
|
928 | if [[ -n $long_usage ]]; then | |
929 | printf "%s\n" "Options:" |
|
929 | printf "%s\n" "Options:" | |
930 |
|
930 | |||
931 | # :command.usage_flags |
|
931 | # :command.usage_flags | |
932 | # :flag.usage |
|
932 | # :flag.usage | |
933 | printf " %s\n" "--no-tty" |
|
933 | printf " %s\n" "--no-tty" | |
934 | printf " when running docker command don't attach to TTY. Useful for running a script\n out of shell context, e.g crontab\n" |
|
934 | printf " when running docker command don't attach to TTY. Useful for running a script\n out of shell context, e.g crontab\n" | |
935 | echo |
|
935 | echo | |
936 |
|
936 | |||
937 | # :flag.usage |
|
937 | # :flag.usage | |
938 | printf " %s\n" "--user" |
|
938 | printf " %s\n" "--user" | |
939 | printf " User to run the command as, e.g root / rhodecode\n" |
|
939 | printf " User to run the command as, e.g root / rhodecode\n" | |
940 | echo |
|
940 | echo | |
941 |
|
941 | |||
942 | # :flag.usage |
|
942 | # :flag.usage | |
943 | printf " %s\n" "--env-file-path ENV_FILE_PATH" |
|
943 | printf " %s\n" "--env-file-path ENV_FILE_PATH" | |
944 | printf " Set custom env file\n" |
|
944 | printf " Set custom env file\n" | |
945 | printf " Default: $PWD/.custom/.runtime.env\n" |
|
945 | printf " Default: $PWD/.custom/.runtime.env\n" | |
946 | echo |
|
946 | echo | |
947 |
|
947 | |||
948 | # :command.usage_fixed_flags |
|
948 | # :command.usage_fixed_flags | |
949 | printf " %s\n" "--help, -h" |
|
949 | printf " %s\n" "--help, -h" | |
950 | printf " Show this help\n" |
|
950 | printf " Show this help\n" | |
951 | echo |
|
951 | echo | |
952 |
|
952 | |||
953 | # :command.usage_args |
|
953 | # :command.usage_args | |
954 | printf "%s\n" "Arguments:" |
|
954 | printf "%s\n" "Arguments:" | |
955 |
|
955 | |||
956 | echo " CALL ARGUMENTS..." |
|
956 | echo " CALL ARGUMENTS..." | |
957 | printf " call arguments\n" |
|
957 | printf " call arguments\n" | |
958 | echo |
|
958 | echo | |
959 |
|
959 | |||
960 | fi |
|
960 | fi | |
961 | } |
|
961 | } | |
962 |
|
962 | |||
963 | # :command.usage |
|
963 | # :command.usage | |
964 | rcstack_cli_ishell_usage() { |
|
964 | rcstack_cli_ishell_usage() { | |
965 | if [[ -n $long_usage ]]; then |
|
965 | if [[ -n $long_usage ]]; then | |
966 | printf "rcstack cli ishell - ishell attached to running RhodeCode instance\n" |
|
966 | printf "rcstack cli ishell - ishell attached to running RhodeCode instance\n" | |
967 | echo |
|
967 | echo | |
968 |
|
968 | |||
969 | else |
|
969 | else | |
970 | printf "rcstack cli ishell - ishell attached to running RhodeCode instance\n" |
|
970 | printf "rcstack cli ishell - ishell attached to running RhodeCode instance\n" | |
971 | echo |
|
971 | echo | |
972 |
|
972 | |||
973 | fi |
|
973 | fi | |
974 |
|
974 | |||
975 | printf "%s\n" "Usage:" |
|
975 | printf "%s\n" "Usage:" | |
976 | printf " rcstack cli ishell [OPTIONS]\n" |
|
976 | printf " rcstack cli ishell [OPTIONS]\n" | |
977 | printf " rcstack cli ishell --help | -h\n" |
|
977 | printf " rcstack cli ishell --help | -h\n" | |
978 | echo |
|
978 | echo | |
979 |
|
979 | |||
980 | # :command.long_usage |
|
980 | # :command.long_usage | |
981 | if [[ -n $long_usage ]]; then |
|
981 | if [[ -n $long_usage ]]; then | |
982 | printf "%s\n" "Options:" |
|
982 | printf "%s\n" "Options:" | |
983 |
|
983 | |||
984 | # :command.usage_flags |
|
984 | # :command.usage_flags | |
985 | # :flag.usage |
|
985 | # :flag.usage | |
986 | printf " %s\n" "--no-tty" |
|
986 | printf " %s\n" "--no-tty" | |
987 | printf " when running docker command don't attach to TTY. Useful for running a script\n out of shell context, e.g crontab\n" |
|
987 | printf " when running docker command don't attach to TTY. Useful for running a script\n out of shell context, e.g crontab\n" | |
988 | echo |
|
988 | echo | |
989 |
|
989 | |||
990 | # :flag.usage |
|
990 | # :flag.usage | |
991 | printf " %s\n" "--user" |
|
991 | printf " %s\n" "--user" | |
992 | printf " User to run the command as, e.g root / rhodecode\n" |
|
992 | printf " User to run the command as, e.g root / rhodecode\n" | |
993 | echo |
|
993 | echo | |
994 |
|
994 | |||
995 | # :flag.usage |
|
995 | # :flag.usage | |
996 | printf " %s\n" "--env-file-path ENV_FILE_PATH" |
|
996 | printf " %s\n" "--env-file-path ENV_FILE_PATH" | |
997 | printf " Set custom env file\n" |
|
997 | printf " Set custom env file\n" | |
998 | printf " Default: $PWD/.custom/.runtime.env\n" |
|
998 | printf " Default: $PWD/.custom/.runtime.env\n" | |
999 | echo |
|
999 | echo | |
1000 |
|
1000 | |||
1001 | # :command.usage_fixed_flags |
|
1001 | # :command.usage_fixed_flags | |
1002 | printf " %s\n" "--help, -h" |
|
1002 | printf " %s\n" "--help, -h" | |
1003 | printf " Show this help\n" |
|
1003 | printf " Show this help\n" | |
1004 | echo |
|
1004 | echo | |
1005 |
|
1005 | |||
1006 | fi |
|
1006 | fi | |
1007 | } |
|
1007 | } | |
1008 |
|
1008 | |||
1009 | # :command.usage |
|
1009 | # :command.usage | |
1010 | rcstack_cli_image_info_usage() { |
|
1010 | rcstack_cli_image_info_usage() { | |
1011 | if [[ -n $long_usage ]]; then |
|
1011 | if [[ -n $long_usage ]]; then | |
1012 | printf "rcstack cli image-info - print out stored docker image version\n" |
|
1012 | printf "rcstack cli image-info - print out stored docker image version\n" | |
1013 | echo |
|
1013 | echo | |
1014 |
|
1014 | |||
1015 | else |
|
1015 | else | |
1016 | printf "rcstack cli image-info - print out stored docker image version\n" |
|
1016 | printf "rcstack cli image-info - print out stored docker image version\n" | |
1017 | echo |
|
1017 | echo | |
1018 |
|
1018 | |||
1019 | fi |
|
1019 | fi | |
1020 |
|
1020 | |||
1021 | printf "%s\n" "Usage:" |
|
1021 | printf "%s\n" "Usage:" | |
1022 | printf " rcstack cli image-info [OPTIONS]\n" |
|
1022 | printf " rcstack cli image-info [OPTIONS]\n" | |
1023 | printf " rcstack cli image-info --help | -h\n" |
|
1023 | printf " rcstack cli image-info --help | -h\n" | |
1024 | echo |
|
1024 | echo | |
1025 |
|
1025 | |||
1026 | # :command.long_usage |
|
1026 | # :command.long_usage | |
1027 | if [[ -n $long_usage ]]; then |
|
1027 | if [[ -n $long_usage ]]; then | |
1028 | printf "%s\n" "Options:" |
|
1028 | printf "%s\n" "Options:" | |
1029 |
|
1029 | |||
1030 | # :command.usage_flags |
|
1030 | # :command.usage_flags | |
1031 | # :flag.usage |
|
1031 | # :flag.usage | |
1032 | printf " %s\n" "--verbose" |
|
1032 | printf " %s\n" "--verbose" | |
1033 | printf " rich output about image\n" |
|
1033 | printf " rich output about image\n" | |
1034 | echo |
|
1034 | echo | |
1035 |
|
1035 | |||
1036 | # :command.usage_fixed_flags |
|
1036 | # :command.usage_fixed_flags | |
1037 | printf " %s\n" "--help, -h" |
|
1037 | printf " %s\n" "--help, -h" | |
1038 | printf " Show this help\n" |
|
1038 | printf " Show this help\n" | |
1039 | echo |
|
1039 | echo | |
1040 |
|
1040 | |||
1041 | fi |
|
1041 | fi | |
1042 | } |
|
1042 | } | |
1043 |
|
1043 | |||
1044 | # :command.usage |
|
1044 | # :command.usage | |
1045 | rcstack_cli_set_runtime_image_usage() { |
|
1045 | rcstack_cli_set_runtime_image_usage() { | |
1046 | if [[ -n $long_usage ]]; then |
|
1046 | if [[ -n $long_usage ]]; then | |
1047 | printf "rcstack cli set-runtime-image - set version to .runtime.env file\n" |
|
1047 | printf "rcstack cli set-runtime-image - set version to .runtime.env file\n" | |
1048 | echo |
|
1048 | echo | |
1049 |
|
1049 | |||
1050 | else |
|
1050 | else | |
1051 | printf "rcstack cli set-runtime-image - set version to .runtime.env file\n" |
|
1051 | printf "rcstack cli set-runtime-image - set version to .runtime.env file\n" | |
1052 | echo |
|
1052 | echo | |
1053 |
|
1053 | |||
1054 | fi |
|
1054 | fi | |
1055 |
|
1055 | |||
1056 | printf "%s\n" "Usage:" |
|
1056 | printf "%s\n" "Usage:" | |
1057 | printf " rcstack cli set-runtime-image VERSION\n" |
|
1057 | printf " rcstack cli set-runtime-image VERSION\n" | |
1058 | printf " rcstack cli set-runtime-image --help | -h\n" |
|
1058 | printf " rcstack cli set-runtime-image --help | -h\n" | |
1059 | echo |
|
1059 | echo | |
1060 |
|
1060 | |||
1061 | # :command.long_usage |
|
1061 | # :command.long_usage | |
1062 | if [[ -n $long_usage ]]; then |
|
1062 | if [[ -n $long_usage ]]; then | |
1063 | printf "%s\n" "Options:" |
|
1063 | printf "%s\n" "Options:" | |
1064 |
|
1064 | |||
1065 | # :command.usage_fixed_flags |
|
1065 | # :command.usage_fixed_flags | |
1066 | printf " %s\n" "--help, -h" |
|
1066 | printf " %s\n" "--help, -h" | |
1067 | printf " Show this help\n" |
|
1067 | printf " Show this help\n" | |
1068 | echo |
|
1068 | echo | |
1069 |
|
1069 | |||
1070 | # :command.usage_args |
|
1070 | # :command.usage_args | |
1071 | printf "%s\n" "Arguments:" |
|
1071 | printf "%s\n" "Arguments:" | |
1072 |
|
1072 | |||
1073 | # :argument.usage |
|
1073 | # :argument.usage | |
1074 | printf " %s\n" "VERSION" |
|
1074 | printf " %s\n" "VERSION" | |
1075 | printf " Version of docker image to set e.g '5.0.0'\n" |
|
1075 | printf " Version of docker image to set e.g '5.0.0'\n" | |
1076 | echo |
|
1076 | echo | |
1077 |
|
1077 | |||
1078 | fi |
|
1078 | fi | |
1079 | } |
|
1079 | } | |
1080 |
|
1080 | |||
1081 | # :command.usage |
|
1081 | # :command.usage | |
1082 | rcstack_cli_docker_info_usage() { |
|
1082 | rcstack_cli_docker_info_usage() { | |
1083 | if [[ -n $long_usage ]]; then |
|
1083 | if [[ -n $long_usage ]]; then | |
1084 | printf "rcstack cli docker-info - get current docker info\n" |
|
1084 | printf "rcstack cli docker-info - get current docker info\n" | |
1085 | echo |
|
1085 | echo | |
1086 |
|
1086 | |||
1087 | else |
|
1087 | else | |
1088 | printf "rcstack cli docker-info - get current docker info\n" |
|
1088 | printf "rcstack cli docker-info - get current docker info\n" | |
1089 | echo |
|
1089 | echo | |
1090 |
|
1090 | |||
1091 | fi |
|
1091 | fi | |
1092 |
|
1092 | |||
1093 | printf "%s\n" "Usage:" |
|
1093 | printf "%s\n" "Usage:" | |
1094 | printf " rcstack cli docker-info [OPTIONS]\n" |
|
1094 | printf " rcstack cli docker-info [OPTIONS]\n" | |
1095 | printf " rcstack cli docker-info --help | -h\n" |
|
1095 | printf " rcstack cli docker-info --help | -h\n" | |
1096 | echo |
|
1096 | echo | |
1097 |
|
1097 | |||
1098 | # :command.long_usage |
|
1098 | # :command.long_usage | |
1099 | if [[ -n $long_usage ]]; then |
|
1099 | if [[ -n $long_usage ]]; then | |
1100 | printf "%s\n" "Options:" |
|
1100 | printf "%s\n" "Options:" | |
1101 |
|
1101 | |||
1102 | # :command.usage_flags |
|
1102 | # :command.usage_flags | |
1103 | # :flag.usage |
|
1103 | # :flag.usage | |
1104 | printf " %s\n" "--verbose" |
|
1104 | printf " %s\n" "--verbose" | |
1105 | printf " rich output about docker\n" |
|
1105 | printf " rich output about docker\n" | |
1106 | echo |
|
1106 | echo | |
1107 |
|
1107 | |||
1108 | # :command.usage_fixed_flags |
|
1108 | # :command.usage_fixed_flags | |
1109 | printf " %s\n" "--help, -h" |
|
1109 | printf " %s\n" "--help, -h" | |
1110 | printf " Show this help\n" |
|
1110 | printf " Show this help\n" | |
1111 | echo |
|
1111 | echo | |
1112 |
|
1112 | |||
1113 | fi |
|
1113 | fi | |
1114 | } |
|
1114 | } | |
1115 |
|
1115 | |||
1116 | # :command.usage |
|
1116 | # :command.usage | |
1117 | rcstack_cli_docker_upgrade_usage() { |
|
1117 | rcstack_cli_docker_upgrade_usage() { | |
1118 | if [[ -n $long_usage ]]; then |
|
1118 | if [[ -n $long_usage ]]; then | |
1119 | printf "rcstack cli docker-upgrade - force upgrade docker\n" |
|
1119 | printf "rcstack cli docker-upgrade - force upgrade docker\n" | |
1120 | echo |
|
1120 | echo | |
1121 |
|
1121 | |||
1122 | else |
|
1122 | else | |
1123 | printf "rcstack cli docker-upgrade - force upgrade docker\n" |
|
1123 | printf "rcstack cli docker-upgrade - force upgrade docker\n" | |
1124 | echo |
|
1124 | echo | |
1125 |
|
1125 | |||
1126 | fi |
|
1126 | fi | |
1127 |
|
1127 | |||
1128 | printf "%s\n" "Usage:" |
|
1128 | printf "%s\n" "Usage:" | |
1129 | printf " rcstack cli docker-upgrade [OPTIONS]\n" |
|
1129 | printf " rcstack cli docker-upgrade [OPTIONS]\n" | |
1130 | printf " rcstack cli docker-upgrade --help | -h\n" |
|
1130 | printf " rcstack cli docker-upgrade --help | -h\n" | |
1131 | echo |
|
1131 | echo | |
1132 |
|
1132 | |||
1133 | # :command.long_usage |
|
1133 | # :command.long_usage | |
1134 | if [[ -n $long_usage ]]; then |
|
1134 | if [[ -n $long_usage ]]; then | |
1135 | printf "%s\n" "Options:" |
|
1135 | printf "%s\n" "Options:" | |
1136 |
|
1136 | |||
1137 | # :command.usage_flags |
|
1137 | # :command.usage_flags | |
1138 | # :flag.usage |
|
1138 | # :flag.usage | |
1139 | printf " %s\n" "--compose" |
|
1139 | printf " %s\n" "--compose" | |
1140 | printf " run an upgrade of docker compose to latest version\n" |
|
1140 | printf " run an upgrade of docker compose to latest version\n" | |
1141 | echo |
|
1141 | echo | |
1142 |
|
1142 | |||
1143 | # :command.usage_fixed_flags |
|
1143 | # :command.usage_fixed_flags | |
1144 | printf " %s\n" "--help, -h" |
|
1144 | printf " %s\n" "--help, -h" | |
1145 | printf " Show this help\n" |
|
1145 | printf " Show this help\n" | |
1146 | echo |
|
1146 | echo | |
1147 |
|
1147 | |||
1148 | fi |
|
1148 | fi | |
1149 | } |
|
1149 | } | |
1150 |
|
1150 | |||
1151 | # :command.usage |
|
1151 | # :command.usage | |
1152 | rcstack_cli_redis_usage() { |
|
1152 | rcstack_cli_redis_usage() { | |
1153 | if [[ -n $long_usage ]]; then |
|
1153 | if [[ -n $long_usage ]]; then | |
1154 | printf "rcstack cli redis - CLI for Redis\n" |
|
1154 | printf "rcstack cli redis - CLI for Redis\n" | |
1155 | echo |
|
1155 | echo | |
1156 |
|
1156 | |||
1157 | else |
|
1157 | else | |
1158 | printf "rcstack cli redis - CLI for Redis\n" |
|
1158 | printf "rcstack cli redis - CLI for Redis\n" | |
1159 | echo |
|
1159 | echo | |
1160 |
|
1160 | |||
1161 | fi |
|
1161 | fi | |
1162 |
|
1162 | |||
1163 | printf "%s\n" "Usage:" |
|
1163 | printf "%s\n" "Usage:" | |
1164 | printf " rcstack cli redis [OPTIONS]\n" |
|
1164 | printf " rcstack cli redis [OPTIONS]\n" | |
1165 | printf " rcstack cli redis --help | -h\n" |
|
1165 | printf " rcstack cli redis --help | -h\n" | |
1166 | echo |
|
1166 | echo | |
1167 |
|
1167 | |||
1168 | # :command.long_usage |
|
1168 | # :command.long_usage | |
1169 | if [[ -n $long_usage ]]; then |
|
1169 | if [[ -n $long_usage ]]; then | |
1170 | printf "%s\n" "Options:" |
|
1170 | printf "%s\n" "Options:" | |
1171 |
|
1171 | |||
1172 | # :command.usage_flags |
|
1172 | # :command.usage_flags | |
1173 | # :flag.usage |
|
1173 | # :flag.usage | |
1174 | printf " %s\n" "--no-tty" |
|
1174 | printf " %s\n" "--no-tty" | |
1175 | printf " when running docker command don't attach to TTY. Useful for running a script\n out of shell context, e.g crontab\n" |
|
1175 | printf " when running docker command don't attach to TTY. Useful for running a script\n out of shell context, e.g crontab\n" | |
1176 | echo |
|
1176 | echo | |
1177 |
|
1177 | |||
1178 | # :flag.usage |
|
1178 | # :flag.usage | |
1179 | printf " %s\n" "--user" |
|
1179 | printf " %s\n" "--user" | |
1180 | printf " User to run the command as, e.g root / rhodecode\n" |
|
1180 | printf " User to run the command as, e.g root / rhodecode\n" | |
1181 | echo |
|
1181 | echo | |
1182 |
|
1182 | |||
1183 | # :flag.usage |
|
1183 | # :flag.usage | |
1184 | printf " %s\n" "--env-file-path ENV_FILE_PATH" |
|
1184 | printf " %s\n" "--env-file-path ENV_FILE_PATH" | |
1185 | printf " Set custom env file\n" |
|
1185 | printf " Set custom env file\n" | |
1186 | printf " Default: $PWD/.custom/.runtime.env\n" |
|
1186 | printf " Default: $PWD/.custom/.runtime.env\n" | |
1187 | echo |
|
1187 | echo | |
1188 |
|
1188 | |||
1189 | # :flag.usage |
|
1189 | # :flag.usage | |
1190 | printf " %s\n" "--db DB" |
|
1190 | printf " %s\n" "--db DB" | |
1191 | printf " select Redis db, defaults 0\n" |
|
1191 | printf " select Redis db, defaults 0\n" | |
1192 | printf " Default: 0\n" |
|
1192 | printf " Default: 0\n" | |
1193 | echo |
|
1193 | echo | |
1194 |
|
1194 | |||
1195 | # :command.usage_fixed_flags |
|
1195 | # :command.usage_fixed_flags | |
1196 | printf " %s\n" "--help, -h" |
|
1196 | printf " %s\n" "--help, -h" | |
1197 | printf " Show this help\n" |
|
1197 | printf " Show this help\n" | |
1198 | echo |
|
1198 | echo | |
1199 |
|
1199 | |||
1200 | # :command.usage_examples |
|
1200 | # :command.usage_examples | |
1201 | printf "%s\n" "Examples:" |
|
1201 | printf "%s\n" "Examples:" | |
1202 | printf " # run the redis CLI\n - ./rcstack cli redis\n # run a command without TTY\n - echo 'KEYS *' | ./rcstack cli redis --no-tty\n" |
|
1202 | printf " # run the redis CLI\n - ./rcstack cli redis\n # run a command without TTY\n - echo 'KEYS *' | ./rcstack cli redis --no-tty\n" | |
1203 | echo |
|
1203 | echo | |
1204 |
|
1204 | |||
1205 | fi |
|
1205 | fi | |
1206 | } |
|
1206 | } | |
1207 |
|
1207 | |||
1208 | # :command.usage |
|
1208 | # :command.usage | |
1209 | rcstack_cli_db_usage() { |
|
1209 | rcstack_cli_db_usage() { | |
1210 | if [[ -n $long_usage ]]; then |
|
1210 | if [[ -n $long_usage ]]; then | |
1211 | printf "rcstack cli db - CLI with Database connection\n" |
|
1211 | printf "rcstack cli db - CLI with Database connection\n" | |
1212 | echo |
|
1212 | echo | |
1213 |
|
1213 | |||
1214 | else |
|
1214 | else | |
1215 | printf "rcstack cli db - CLI with Database connection\n" |
|
1215 | printf "rcstack cli db - CLI with Database connection\n" | |
1216 | echo |
|
1216 | echo | |
1217 |
|
1217 | |||
1218 | fi |
|
1218 | fi | |
1219 |
|
1219 | |||
1220 | printf "%s\n" "Usage:" |
|
1220 | printf "%s\n" "Usage:" | |
1221 | printf " rcstack cli db [OPTIONS]\n" |
|
1221 | printf " rcstack cli db [OPTIONS]\n" | |
1222 | printf " rcstack cli db --help | -h\n" |
|
1222 | printf " rcstack cli db --help | -h\n" | |
1223 | echo |
|
1223 | echo | |
1224 |
|
1224 | |||
1225 | # :command.long_usage |
|
1225 | # :command.long_usage | |
1226 | if [[ -n $long_usage ]]; then |
|
1226 | if [[ -n $long_usage ]]; then | |
1227 | printf "%s\n" "Options:" |
|
1227 | printf "%s\n" "Options:" | |
1228 |
|
1228 | |||
1229 | # :command.usage_flags |
|
1229 | # :command.usage_flags | |
1230 | # :flag.usage |
|
1230 | # :flag.usage | |
1231 | printf " %s\n" "--no-tty" |
|
1231 | printf " %s\n" "--no-tty" | |
1232 | printf " when running docker command don't attach to TTY. Useful for running a script\n out of shell context, e.g crontab\n" |
|
1232 | printf " when running docker command don't attach to TTY. Useful for running a script\n out of shell context, e.g crontab\n" | |
1233 | echo |
|
1233 | echo | |
1234 |
|
1234 | |||
1235 | # :flag.usage |
|
1235 | # :flag.usage | |
1236 | printf " %s\n" "--user" |
|
1236 | printf " %s\n" "--user" | |
1237 | printf " User to run the command as, e.g root / rhodecode\n" |
|
1237 | printf " User to run the command as, e.g root / rhodecode\n" | |
1238 | echo |
|
1238 | echo | |
1239 |
|
1239 | |||
1240 | # :flag.usage |
|
1240 | # :flag.usage | |
1241 | printf " %s\n" "--env-file-path ENV_FILE_PATH" |
|
1241 | printf " %s\n" "--env-file-path ENV_FILE_PATH" | |
1242 | printf " Set custom env file\n" |
|
1242 | printf " Set custom env file\n" | |
1243 | printf " Default: $PWD/.custom/.runtime.env\n" |
|
1243 | printf " Default: $PWD/.custom/.runtime.env\n" | |
1244 | echo |
|
1244 | echo | |
1245 |
|
1245 | |||
1246 | # :command.usage_fixed_flags |
|
1246 | # :command.usage_fixed_flags | |
1247 | printf " %s\n" "--help, -h" |
|
1247 | printf " %s\n" "--help, -h" | |
1248 | printf " Show this help\n" |
|
1248 | printf " Show this help\n" | |
1249 | echo |
|
1249 | echo | |
1250 |
|
1250 | |||
1251 | # :command.usage_examples |
|
1251 | # :command.usage_examples | |
1252 | printf "%s\n" "Examples:" |
|
1252 | printf "%s\n" "Examples:" | |
1253 | printf " # restore backup\n - \i /var/rc-data-dump/your_dump.sql\n" |
|
1253 | printf " # restore backup\n - \i /var/rc-data-dump/your_dump.sql\n" | |
1254 | echo |
|
1254 | echo | |
1255 |
|
1255 | |||
1256 | fi |
|
1256 | fi | |
1257 | } |
|
1257 | } | |
1258 |
|
1258 | |||
1259 | # :command.usage |
|
1259 | # :command.usage | |
1260 | rcstack_cli_db_upgrade_usage() { |
|
1260 | rcstack_cli_db_upgrade_usage() { | |
1261 | if [[ -n $long_usage ]]; then |
|
1261 | if [[ -n $long_usage ]]; then | |
1262 | printf "rcstack cli db-upgrade - CLI to run db upgrade\n" |
|
1262 | printf "rcstack cli db-upgrade - CLI to run db upgrade\n" | |
1263 | echo |
|
1263 | echo | |
1264 |
|
1264 | |||
1265 | else |
|
1265 | else | |
1266 | printf "rcstack cli db-upgrade - CLI to run db upgrade\n" |
|
1266 | printf "rcstack cli db-upgrade - CLI to run db upgrade\n" | |
1267 | echo |
|
1267 | echo | |
1268 |
|
1268 | |||
1269 | fi |
|
1269 | fi | |
1270 |
|
1270 | |||
1271 | printf "%s\n" "Usage:" |
|
1271 | printf "%s\n" "Usage:" | |
1272 | printf " rcstack cli db-upgrade\n" |
|
1272 | printf " rcstack cli db-upgrade\n" | |
1273 | printf " rcstack cli db-upgrade --help | -h\n" |
|
1273 | printf " rcstack cli db-upgrade --help | -h\n" | |
1274 | echo |
|
1274 | echo | |
1275 |
|
1275 | |||
1276 | # :command.long_usage |
|
1276 | # :command.long_usage | |
1277 | if [[ -n $long_usage ]]; then |
|
1277 | if [[ -n $long_usage ]]; then | |
1278 | printf "%s\n" "Options:" |
|
1278 | printf "%s\n" "Options:" | |
1279 |
|
1279 | |||
1280 | # :command.usage_fixed_flags |
|
1280 | # :command.usage_fixed_flags | |
1281 | printf " %s\n" "--help, -h" |
|
1281 | printf " %s\n" "--help, -h" | |
1282 | printf " Show this help\n" |
|
1282 | printf " Show this help\n" | |
1283 | echo |
|
1283 | echo | |
1284 |
|
1284 | |||
1285 | fi |
|
1285 | fi | |
1286 | } |
|
1286 | } | |
1287 |
|
1287 | |||
1288 | # :command.usage |
|
1288 | # :command.usage | |
1289 | rcstack_cli_storage_usage() { |
|
1289 | rcstack_cli_storage_usage() { | |
1290 | if [[ -n $long_usage ]]; then |
|
1290 | if [[ -n $long_usage ]]; then | |
1291 | 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" |
|
1291 | 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" | |
1292 | echo |
|
1292 | echo | |
1293 |
|
1293 | |||
1294 | else |
|
1294 | else | |
1295 | 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" |
|
1295 | 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" | |
1296 | echo |
|
1296 | echo | |
1297 |
|
1297 | |||
1298 | fi |
|
1298 | fi | |
1299 |
|
1299 | |||
1300 | printf "%s\n" "Usage:" |
|
1300 | printf "%s\n" "Usage:" | |
1301 | printf " rcstack cli storage [OPTIONS]\n" |
|
1301 | printf " rcstack cli storage [OPTIONS]\n" | |
1302 | printf " rcstack cli storage --help | -h\n" |
|
1302 | printf " rcstack cli storage --help | -h\n" | |
1303 | echo |
|
1303 | echo | |
1304 |
|
1304 | |||
1305 | # :command.long_usage |
|
1305 | # :command.long_usage | |
1306 | if [[ -n $long_usage ]]; then |
|
1306 | if [[ -n $long_usage ]]; then | |
1307 | printf "%s\n" "Options:" |
|
1307 | printf "%s\n" "Options:" | |
1308 |
|
1308 | |||
1309 | # :command.usage_flags |
|
1309 | # :command.usage_flags | |
1310 | # :flag.usage |
|
1310 | # :flag.usage | |
1311 | printf " %s\n" "--no-tty" |
|
1311 | printf " %s\n" "--no-tty" | |
1312 | printf " when running docker command don't attach to TTY. Useful for running a script\n out of shell context, e.g crontab\n" |
|
1312 | printf " when running docker command don't attach to TTY. Useful for running a script\n out of shell context, e.g crontab\n" | |
1313 | echo |
|
1313 | echo | |
1314 |
|
1314 | |||
1315 | # :flag.usage |
|
1315 | # :flag.usage | |
1316 | printf " %s\n" "--attached ATTACHED" |
|
1316 | printf " %s\n" "--attached ATTACHED" | |
1317 | printf " attach to storage of already running vcsserver container instead\n" |
|
1317 | printf " attach to storage of already running vcsserver container instead\n" | |
1318 | echo |
|
1318 | echo | |
1319 |
|
1319 | |||
1320 | # :command.usage_fixed_flags |
|
1320 | # :command.usage_fixed_flags | |
1321 | printf " %s\n" "--help, -h" |
|
1321 | printf " %s\n" "--help, -h" | |
1322 | printf " Show this help\n" |
|
1322 | printf " Show this help\n" | |
1323 | echo |
|
1323 | echo | |
1324 |
|
1324 | |||
1325 | fi |
|
1325 | fi | |
1326 | } |
|
1326 | } | |
1327 |
|
1327 | |||
1328 | # :command.usage |
|
1328 | # :command.usage | |
1329 | rcstack_cli_attach_usage() { |
|
1329 | rcstack_cli_attach_usage() { | |
1330 | if [[ -n $long_usage ]]; then |
|
1330 | if [[ -n $long_usage ]]; then | |
1331 | printf "rcstack cli attach - attach to running instance of RhodeCode, by default it attaches to rhodecode main web app\n" |
|
1331 | printf "rcstack cli attach - attach to running instance of RhodeCode, by default it attaches to rhodecode main web app\n" | |
1332 | echo |
|
1332 | echo | |
1333 |
|
1333 | |||
1334 | else |
|
1334 | else | |
1335 | printf "rcstack cli attach - attach to running instance of RhodeCode, by default it attaches to rhodecode main web app\n" |
|
1335 | printf "rcstack cli attach - attach to running instance of RhodeCode, by default it attaches to rhodecode main web app\n" | |
1336 | echo |
|
1336 | echo | |
1337 |
|
1337 | |||
1338 | fi |
|
1338 | fi | |
1339 |
|
1339 | |||
1340 | printf "%s\n" "Usage:" |
|
1340 | printf "%s\n" "Usage:" | |
1341 | printf " rcstack cli attach [OPTIONS]\n" |
|
1341 | printf " rcstack cli attach [OPTIONS]\n" | |
1342 | printf " rcstack cli attach --help | -h\n" |
|
1342 | printf " rcstack cli attach --help | -h\n" | |
1343 | echo |
|
1343 | echo | |
1344 |
|
1344 | |||
1345 | # :command.long_usage |
|
1345 | # :command.long_usage | |
1346 | if [[ -n $long_usage ]]; then |
|
1346 | if [[ -n $long_usage ]]; then | |
1347 | printf "%s\n" "Options:" |
|
1347 | printf "%s\n" "Options:" | |
1348 |
|
1348 | |||
1349 | # :command.usage_flags |
|
1349 | # :command.usage_flags | |
1350 | # :flag.usage |
|
1350 | # :flag.usage | |
1351 | printf " %s\n" "--no-tty" |
|
1351 | printf " %s\n" "--no-tty" | |
1352 | printf " when running docker command don't attach to TTY. Useful for running a script\n out of shell context, e.g crontab\n" |
|
1352 | printf " when running docker command don't attach to TTY. Useful for running a script\n out of shell context, e.g crontab\n" | |
1353 | echo |
|
1353 | echo | |
1354 |
|
1354 | |||
1355 | # :flag.usage |
|
1355 | # :flag.usage | |
1356 | printf " %s\n" "--instance-type INSTANCE_TYPE" |
|
1356 | printf " %s\n" "--instance-type INSTANCE_TYPE" | |
1357 | printf " type of instance to attach to\n" |
|
1357 | printf " type of instance to attach to\n" | |
1358 | printf " Default: rhodecode\n" |
|
1358 | printf " Default: rhodecode\n" | |
1359 | echo |
|
1359 | echo | |
1360 |
|
1360 | |||
1361 | # :command.usage_fixed_flags |
|
1361 | # :command.usage_fixed_flags | |
1362 | printf " %s\n" "--help, -h" |
|
1362 | printf " %s\n" "--help, -h" | |
1363 | printf " Show this help\n" |
|
1363 | printf " Show this help\n" | |
1364 | echo |
|
1364 | echo | |
1365 |
|
1365 | |||
1366 | # :command.usage_examples |
|
1366 | # :command.usage_examples | |
1367 | printf "%s\n" "Examples:" |
|
1367 | printf "%s\n" "Examples:" | |
1368 | 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" |
|
1368 | 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" | |
1369 | echo |
|
1369 | echo | |
1370 |
|
1370 | |||
1371 | fi |
|
1371 | fi | |
1372 | } |
|
1372 | } | |
1373 |
|
1373 | |||
1374 | # :command.usage |
|
1374 | # :command.usage | |
1375 | rcstack_cli_set_edition_usage() { |
|
1375 | rcstack_cli_set_edition_usage() { | |
1376 | if [[ -n $long_usage ]]; then |
|
1376 | if [[ -n $long_usage ]]; then | |
1377 | printf "rcstack cli set-edition - set current setup to either CE (Community) or EE (Enterprise) type\n" |
|
1377 | printf "rcstack cli set-edition - set current setup to either CE (Community) or EE (Enterprise) type\n" | |
1378 | echo |
|
1378 | echo | |
1379 |
|
1379 | |||
1380 | else |
|
1380 | else | |
1381 | printf "rcstack cli set-edition - set current setup to either CE (Community) or EE (Enterprise) type\n" |
|
1381 | printf "rcstack cli set-edition - set current setup to either CE (Community) or EE (Enterprise) type\n" | |
1382 | echo |
|
1382 | echo | |
1383 |
|
1383 | |||
1384 | fi |
|
1384 | fi | |
1385 |
|
1385 | |||
1386 | printf "%s\n" "Usage:" |
|
1386 | printf "%s\n" "Usage:" | |
1387 | printf " rcstack cli set-edition EDITION_TYPE\n" |
|
1387 | printf " rcstack cli set-edition EDITION_TYPE\n" | |
1388 | printf " rcstack cli set-edition --help | -h\n" |
|
1388 | printf " rcstack cli set-edition --help | -h\n" | |
1389 | echo |
|
1389 | echo | |
1390 |
|
1390 | |||
1391 | # :command.long_usage |
|
1391 | # :command.long_usage | |
1392 | if [[ -n $long_usage ]]; then |
|
1392 | if [[ -n $long_usage ]]; then | |
1393 | printf "%s\n" "Options:" |
|
1393 | printf "%s\n" "Options:" | |
1394 |
|
1394 | |||
1395 | # :command.usage_fixed_flags |
|
1395 | # :command.usage_fixed_flags | |
1396 | printf " %s\n" "--help, -h" |
|
1396 | printf " %s\n" "--help, -h" | |
1397 | printf " Show this help\n" |
|
1397 | printf " Show this help\n" | |
1398 | echo |
|
1398 | echo | |
1399 |
|
1399 | |||
1400 | # :command.usage_args |
|
1400 | # :command.usage_args | |
1401 | printf "%s\n" "Arguments:" |
|
1401 | printf "%s\n" "Arguments:" | |
1402 |
|
1402 | |||
1403 | # :argument.usage |
|
1403 | # :argument.usage | |
1404 | printf " %s\n" "EDITION_TYPE" |
|
1404 | printf " %s\n" "EDITION_TYPE" | |
1405 | printf " pick type CE or EE\n" |
|
1405 | printf " pick type CE or EE\n" | |
1406 | printf " Allowed: ce, ee\n" |
|
1406 | printf " Allowed: ce, ee\n" | |
1407 | echo |
|
1407 | echo | |
1408 |
|
1408 | |||
1409 | # :command.usage_examples |
|
1409 | # :command.usage_examples | |
1410 | printf "%s\n" "Examples:" |
|
1410 | printf "%s\n" "Examples:" | |
1411 | printf " ./rcstack set-edition ce\n" |
|
1411 | printf " ./rcstack set-edition ce\n" | |
1412 | printf " ./rcstack set-edition ee\n" |
|
1412 | printf " ./rcstack set-edition ee\n" | |
1413 | echo |
|
1413 | echo | |
1414 |
|
1414 | |||
1415 | fi |
|
1415 | fi | |
1416 | } |
|
1416 | } | |
1417 |
|
1417 | |||
1418 | # :command.usage |
|
1418 | # :command.usage | |
1419 | rcstack_cli_configure_vcsserver_usage() { |
|
1419 | rcstack_cli_configure_vcsserver_usage() { | |
1420 | if [[ -n $long_usage ]]; then |
|
1420 | if [[ -n $long_usage ]]; then | |
1421 | printf "rcstack cli configure-vcsserver - reconfigure the vcsserver.ini file\n" |
|
1421 | printf "rcstack cli configure-vcsserver - reconfigure the vcsserver.ini file\n" | |
1422 | echo |
|
1422 | echo | |
1423 |
|
1423 | |||
1424 | else |
|
1424 | else | |
1425 | printf "rcstack cli configure-vcsserver - reconfigure the vcsserver.ini file\n" |
|
1425 | printf "rcstack cli configure-vcsserver - reconfigure the vcsserver.ini file\n" | |
1426 | echo |
|
1426 | echo | |
1427 |
|
1427 | |||
1428 | fi |
|
1428 | fi | |
1429 |
|
1429 | |||
1430 | printf "%s\n" "Usage:" |
|
1430 | printf "%s\n" "Usage:" | |
1431 | printf " rcstack cli configure-vcsserver INI_PATH\n" |
|
1431 | printf " rcstack cli configure-vcsserver INI_PATH\n" | |
1432 | printf " rcstack cli configure-vcsserver --help | -h\n" |
|
1432 | printf " rcstack cli configure-vcsserver --help | -h\n" | |
1433 | echo |
|
1433 | echo | |
1434 |
|
1434 | |||
1435 | # :command.long_usage |
|
1435 | # :command.long_usage | |
1436 | if [[ -n $long_usage ]]; then |
|
1436 | if [[ -n $long_usage ]]; then | |
1437 | printf "%s\n" "Options:" |
|
1437 | printf "%s\n" "Options:" | |
1438 |
|
1438 | |||
1439 | # :command.usage_fixed_flags |
|
1439 | # :command.usage_fixed_flags | |
1440 | printf " %s\n" "--help, -h" |
|
1440 | printf " %s\n" "--help, -h" | |
1441 | printf " Show this help\n" |
|
1441 | printf " Show this help\n" | |
1442 | echo |
|
1442 | echo | |
1443 |
|
1443 | |||
1444 | # :command.usage_args |
|
1444 | # :command.usage_args | |
1445 | printf "%s\n" "Arguments:" |
|
1445 | printf "%s\n" "Arguments:" | |
1446 |
|
1446 | |||
1447 | # :argument.usage |
|
1447 | # :argument.usage | |
1448 | printf " %s\n" "INI_PATH" |
|
1448 | printf " %s\n" "INI_PATH" | |
1449 | printf " Path to vcsserver.ini to reconfigure\n" |
|
1449 | printf " Path to vcsserver.ini to reconfigure\n" | |
1450 | echo |
|
1450 | echo | |
1451 |
|
1451 | |||
1452 | # :command.usage_examples |
|
1452 | # :command.usage_examples | |
1453 | printf "%s\n" "Examples:" |
|
1453 | printf "%s\n" "Examples:" | |
1454 | printf " ./rcstack cli configure-vcs config/_shared/vcsserver.ini\n" |
|
1454 | printf " ./rcstack cli configure-vcs config/_shared/vcsserver.ini\n" | |
1455 | echo |
|
1455 | echo | |
1456 |
|
1456 | |||
1457 | fi |
|
1457 | fi | |
1458 | } |
|
1458 | } | |
1459 |
|
1459 | |||
1460 | # :command.usage |
|
1460 | # :command.usage | |
1461 | rcstack_cli_configure_rhodecode_usage() { |
|
1461 | rcstack_cli_configure_rhodecode_usage() { | |
1462 | if [[ -n $long_usage ]]; then |
|
1462 | if [[ -n $long_usage ]]; then | |
1463 | printf "rcstack cli configure-rhodecode - reconfigure the rhodecode.ini file\n" |
|
1463 | printf "rcstack cli configure-rhodecode - reconfigure the rhodecode.ini file\n" | |
1464 | echo |
|
1464 | echo | |
1465 |
|
1465 | |||
1466 | else |
|
1466 | else | |
1467 | printf "rcstack cli configure-rhodecode - reconfigure the rhodecode.ini file\n" |
|
1467 | printf "rcstack cli configure-rhodecode - reconfigure the rhodecode.ini file\n" | |
1468 | echo |
|
1468 | echo | |
1469 |
|
1469 | |||
1470 | fi |
|
1470 | fi | |
1471 |
|
1471 | |||
1472 | printf "%s\n" "Usage:" |
|
1472 | printf "%s\n" "Usage:" | |
1473 | printf " rcstack cli configure-rhodecode INI_PATH\n" |
|
1473 | printf " rcstack cli configure-rhodecode INI_PATH\n" | |
1474 | printf " rcstack cli configure-rhodecode --help | -h\n" |
|
1474 | printf " rcstack cli configure-rhodecode --help | -h\n" | |
1475 | echo |
|
1475 | echo | |
1476 |
|
1476 | |||
1477 | # :command.long_usage |
|
1477 | # :command.long_usage | |
1478 | if [[ -n $long_usage ]]; then |
|
1478 | if [[ -n $long_usage ]]; then | |
1479 | printf "%s\n" "Options:" |
|
1479 | printf "%s\n" "Options:" | |
1480 |
|
1480 | |||
1481 | # :command.usage_fixed_flags |
|
1481 | # :command.usage_fixed_flags | |
1482 | printf " %s\n" "--help, -h" |
|
1482 | printf " %s\n" "--help, -h" | |
1483 | printf " Show this help\n" |
|
1483 | printf " Show this help\n" | |
1484 | echo |
|
1484 | echo | |
1485 |
|
1485 | |||
1486 | # :command.usage_args |
|
1486 | # :command.usage_args | |
1487 | printf "%s\n" "Arguments:" |
|
1487 | printf "%s\n" "Arguments:" | |
1488 |
|
1488 | |||
1489 | # :argument.usage |
|
1489 | # :argument.usage | |
1490 | printf " %s\n" "INI_PATH" |
|
1490 | printf " %s\n" "INI_PATH" | |
1491 | printf " Path to rhodecode.ini to reconfigure\n" |
|
1491 | printf " Path to rhodecode.ini to reconfigure\n" | |
1492 | echo |
|
1492 | echo | |
1493 |
|
1493 | |||
1494 | # :command.usage_examples |
|
1494 | # :command.usage_examples | |
1495 | printf "%s\n" "Examples:" |
|
1495 | printf "%s\n" "Examples:" | |
1496 | printf " ./rcstack cli configure-rhodecode config/_shared/rhodecode.ini\n" |
|
1496 | printf " ./rcstack cli configure-rhodecode config/_shared/rhodecode.ini\n" | |
1497 | echo |
|
1497 | echo | |
1498 |
|
1498 | |||
1499 | fi |
|
1499 | fi | |
1500 | } |
|
1500 | } | |
1501 |
|
1501 | |||
1502 | # :command.usage |
|
1502 | # :command.usage | |
1503 | rcstack_backup_db_usage() { |
|
1503 | rcstack_backup_db_usage() { | |
1504 | if [[ -n $long_usage ]]; then |
|
1504 | if [[ -n $long_usage ]]; then | |
1505 | printf "rcstack backup-db - Backup Database\n" |
|
1505 | printf "rcstack backup-db - Backup Database\n" | |
1506 | echo |
|
1506 | echo | |
1507 |
|
1507 | |||
1508 | else |
|
1508 | else | |
1509 | printf "rcstack backup-db - Backup Database\n" |
|
1509 | printf "rcstack backup-db - Backup Database\n" | |
1510 | echo |
|
1510 | echo | |
1511 |
|
1511 | |||
1512 | fi |
|
1512 | fi | |
1513 |
|
1513 | |||
1514 | printf "%s\n" "Usage:" |
|
1514 | printf "%s\n" "Usage:" | |
1515 | printf " rcstack backup-db DESTINATION\n" |
|
1515 | printf " rcstack backup-db DESTINATION\n" | |
1516 | printf " rcstack backup-db --help | -h\n" |
|
1516 | printf " rcstack backup-db --help | -h\n" | |
1517 | echo |
|
1517 | echo | |
1518 |
|
1518 | |||
1519 | # :command.long_usage |
|
1519 | # :command.long_usage | |
1520 | if [[ -n $long_usage ]]; then |
|
1520 | if [[ -n $long_usage ]]; then | |
1521 | printf "%s\n" "Options:" |
|
1521 | printf "%s\n" "Options:" | |
1522 |
|
1522 | |||
1523 | # :command.usage_fixed_flags |
|
1523 | # :command.usage_fixed_flags | |
1524 | printf " %s\n" "--help, -h" |
|
1524 | printf " %s\n" "--help, -h" | |
1525 | printf " Show this help\n" |
|
1525 | printf " Show this help\n" | |
1526 | echo |
|
1526 | echo | |
1527 |
|
1527 | |||
1528 | # :command.usage_args |
|
1528 | # :command.usage_args | |
1529 | printf "%s\n" "Arguments:" |
|
1529 | printf "%s\n" "Arguments:" | |
1530 |
|
1530 | |||
1531 | # :argument.usage |
|
1531 | # :argument.usage | |
1532 | printf " %s\n" "DESTINATION" |
|
1532 | printf " %s\n" "DESTINATION" | |
1533 | printf " Destination directory to store backup archive\n" |
|
1533 | printf " Destination directory to store backup archive\n" | |
1534 | echo |
|
1534 | echo | |
1535 |
|
1535 | |||
1536 | # :command.usage_examples |
|
1536 | # :command.usage_examples | |
1537 | printf "%s\n" "Examples:" |
|
1537 | printf "%s\n" "Examples:" | |
1538 | printf " # make backup gz compressed from container DB\n - ./rcstack backup-db /home/my-db-backup\n \n # restore backup\n - gunzip your_dump.sql.gz\n - ./rcstack cli db\n - \i /var/rc-data-dump/your_dump.sql\n" |
|
1538 | printf " # make backup gz compressed from container DB\n - ./rcstack backup-db /home/my-db-backup\n \n # restore backup\n - gunzip your_dump.sql.gz\n - ./rcstack cli db\n - \i /var/rc-data-dump/your_dump.sql\n" | |
1539 | echo |
|
1539 | echo | |
1540 |
|
1540 | |||
1541 | fi |
|
1541 | fi | |
1542 | } |
|
1542 | } | |
1543 |
|
1543 | |||
1544 | # :command.usage |
|
1544 | # :command.usage | |
1545 | rcstack_backup_data_usage() { |
|
1545 | rcstack_backup_data_usage() { | |
1546 | if [[ -n $long_usage ]]; then |
|
1546 | if [[ -n $long_usage ]]; then | |
1547 | printf "rcstack backup-data - Backup RhodeCode storage\n" |
|
1547 | printf "rcstack backup-data - Backup RhodeCode storage\n" | |
1548 | echo |
|
1548 | echo | |
1549 |
|
1549 | |||
1550 | else |
|
1550 | else | |
1551 | printf "rcstack backup-data - Backup RhodeCode storage\n" |
|
1551 | printf "rcstack backup-data - Backup RhodeCode storage\n" | |
1552 | echo |
|
1552 | echo | |
1553 |
|
1553 | |||
1554 | fi |
|
1554 | fi | |
1555 |
|
1555 | |||
1556 | printf "%s\n" "Usage:" |
|
1556 | printf "%s\n" "Usage:" | |
1557 | printf " rcstack backup-data DESTINATION\n" |
|
1557 | printf " rcstack backup-data DESTINATION\n" | |
1558 | printf " rcstack backup-data --help | -h\n" |
|
1558 | printf " rcstack backup-data --help | -h\n" | |
1559 | echo |
|
1559 | echo | |
1560 |
|
1560 | |||
1561 | # :command.long_usage |
|
1561 | # :command.long_usage | |
1562 | if [[ -n $long_usage ]]; then |
|
1562 | if [[ -n $long_usage ]]; then | |
1563 | printf "%s\n" "Options:" |
|
1563 | printf "%s\n" "Options:" | |
1564 |
|
1564 | |||
1565 | # :command.usage_fixed_flags |
|
1565 | # :command.usage_fixed_flags | |
1566 | printf " %s\n" "--help, -h" |
|
1566 | printf " %s\n" "--help, -h" | |
1567 | printf " Show this help\n" |
|
1567 | printf " Show this help\n" | |
1568 | echo |
|
1568 | echo | |
1569 |
|
1569 | |||
1570 | # :command.usage_args |
|
1570 | # :command.usage_args | |
1571 | printf "%s\n" "Arguments:" |
|
1571 | printf "%s\n" "Arguments:" | |
1572 |
|
1572 | |||
1573 | # :argument.usage |
|
1573 | # :argument.usage | |
1574 | printf " %s\n" "DESTINATION" |
|
1574 | printf " %s\n" "DESTINATION" | |
1575 | printf " Destination directory to store backup archive\n" |
|
1575 | printf " Destination directory to store backup archive\n" | |
1576 | echo |
|
1576 | echo | |
1577 |
|
1577 | |||
1578 | # :command.usage_examples |
|
1578 | # :command.usage_examples | |
1579 | printf "%s\n" "Examples:" |
|
1579 | printf "%s\n" "Examples:" | |
1580 | printf " # make backup gz compressed for rhodecode containers, and all volumes\n - ./rcstack backup-data /home/my-data-backup\n" |
|
1580 | printf " # make backup gz compressed for rhodecode containers, and all volumes\n - ./rcstack backup-data /home/my-data-backup\n" | |
1581 | echo |
|
1581 | echo | |
1582 |
|
1582 | |||
1583 | fi |
|
1583 | fi | |
1584 | } |
|
1584 | } | |
1585 |
|
1585 | |||
1586 | # :command.usage |
|
1586 | # :command.usage | |
1587 | rcstack__completions_usage() { |
|
1587 | rcstack__completions_usage() { | |
1588 | if [[ -n $long_usage ]]; then |
|
1588 | if [[ -n $long_usage ]]; then | |
1589 | printf "rcstack _completions - Generate completions\n" |
|
1589 | printf "rcstack _completions - Generate completions\n" | |
1590 | echo |
|
1590 | echo | |
1591 |
|
1591 | |||
1592 | else |
|
1592 | else | |
1593 | printf "rcstack _completions - Generate completions\n" |
|
1593 | printf "rcstack _completions - Generate completions\n" | |
1594 | echo |
|
1594 | echo | |
1595 |
|
1595 | |||
1596 | fi |
|
1596 | fi | |
1597 |
|
1597 | |||
1598 | printf "%s\n" "Usage:" |
|
1598 | printf "%s\n" "Usage:" | |
1599 | printf " rcstack _completions\n" |
|
1599 | printf " rcstack _completions\n" | |
1600 | printf " rcstack _completions --help | -h\n" |
|
1600 | printf " rcstack _completions --help | -h\n" | |
1601 | echo |
|
1601 | echo | |
1602 |
|
1602 | |||
1603 | # :command.long_usage |
|
1603 | # :command.long_usage | |
1604 | if [[ -n $long_usage ]]; then |
|
1604 | if [[ -n $long_usage ]]; then | |
1605 | printf "%s\n" "Options:" |
|
1605 | printf "%s\n" "Options:" | |
1606 |
|
1606 | |||
1607 | # :command.usage_fixed_flags |
|
1607 | # :command.usage_fixed_flags | |
1608 | printf " %s\n" "--help, -h" |
|
1608 | printf " %s\n" "--help, -h" | |
1609 | printf " Show this help\n" |
|
1609 | printf " Show this help\n" | |
1610 | echo |
|
1610 | echo | |
1611 |
|
1611 | |||
1612 | fi |
|
1612 | fi | |
1613 | } |
|
1613 | } | |
1614 |
|
1614 | |||
1615 | # :command.normalize_input |
|
1615 | # :command.normalize_input | |
1616 | normalize_input() { |
|
1616 | normalize_input() { | |
1617 | local arg flags |
|
1617 | local arg flags | |
1618 |
|
1618 | |||
1619 | while [[ $# -gt 0 ]]; do |
|
1619 | while [[ $# -gt 0 ]]; do | |
1620 | arg="$1" |
|
1620 | arg="$1" | |
1621 | if [[ $arg =~ ^(--[a-zA-Z0-9_\-]+)=(.+)$ ]]; then |
|
1621 | if [[ $arg =~ ^(--[a-zA-Z0-9_\-]+)=(.+)$ ]]; then | |
1622 | input+=("${BASH_REMATCH[1]}") |
|
1622 | input+=("${BASH_REMATCH[1]}") | |
1623 | input+=("${BASH_REMATCH[2]}") |
|
1623 | input+=("${BASH_REMATCH[2]}") | |
1624 | elif [[ $arg =~ ^(-[a-zA-Z0-9])=(.+)$ ]]; then |
|
1624 | elif [[ $arg =~ ^(-[a-zA-Z0-9])=(.+)$ ]]; then | |
1625 | input+=("${BASH_REMATCH[1]}") |
|
1625 | input+=("${BASH_REMATCH[1]}") | |
1626 | input+=("${BASH_REMATCH[2]}") |
|
1626 | input+=("${BASH_REMATCH[2]}") | |
1627 | elif [[ $arg =~ ^-([a-zA-Z0-9][a-zA-Z0-9]+)$ ]]; then |
|
1627 | elif [[ $arg =~ ^-([a-zA-Z0-9][a-zA-Z0-9]+)$ ]]; then | |
1628 | flags="${BASH_REMATCH[1]}" |
|
1628 | flags="${BASH_REMATCH[1]}" | |
1629 | for ((i = 0; i < ${#flags}; i++)); do |
|
1629 | for ((i = 0; i < ${#flags}; i++)); do | |
1630 | input+=("-${flags:i:1}") |
|
1630 | input+=("-${flags:i:1}") | |
1631 | done |
|
1631 | done | |
1632 | else |
|
1632 | else | |
1633 | input+=("$arg") |
|
1633 | input+=("$arg") | |
1634 | fi |
|
1634 | fi | |
1635 |
|
1635 | |||
1636 | shift |
|
1636 | shift | |
1637 | done |
|
1637 | done | |
1638 | } |
|
1638 | } | |
1639 | # :command.inspect_args |
|
1639 | # :command.inspect_args | |
1640 | inspect_args() { |
|
1640 | inspect_args() { | |
1641 | if ((${#args[@]})); then |
|
1641 | if ((${#args[@]})); then | |
1642 | readarray -t sorted_keys < <(printf '%s\n' "${!args[@]}" | sort) |
|
1642 | readarray -t sorted_keys < <(printf '%s\n' "${!args[@]}" | sort) | |
1643 | echo args: |
|
1643 | echo args: | |
1644 | for k in "${sorted_keys[@]}"; do echo "- \${args[$k]} = ${args[$k]}"; done |
|
1644 | for k in "${sorted_keys[@]}"; do echo "- \${args[$k]} = ${args[$k]}"; done | |
1645 | else |
|
1645 | else | |
1646 | echo args: none |
|
1646 | echo args: none | |
1647 | fi |
|
1647 | fi | |
1648 |
|
1648 | |||
1649 | if ((${#other_args[@]})); then |
|
1649 | if ((${#other_args[@]})); then | |
1650 | echo |
|
1650 | echo | |
1651 | echo other_args: |
|
1651 | echo other_args: | |
1652 | echo "- \${other_args[*]} = ${other_args[*]}" |
|
1652 | echo "- \${other_args[*]} = ${other_args[*]}" | |
1653 | for i in "${!other_args[@]}"; do |
|
1653 | for i in "${!other_args[@]}"; do | |
1654 | echo "- \${other_args[$i]} = ${other_args[$i]}" |
|
1654 | echo "- \${other_args[$i]} = ${other_args[$i]}" | |
1655 | done |
|
1655 | done | |
1656 | fi |
|
1656 | fi | |
1657 |
|
1657 | |||
1658 | if ((${#deps[@]})); then |
|
1658 | if ((${#deps[@]})); then | |
1659 | readarray -t sorted_keys < <(printf '%s\n' "${!deps[@]}" | sort) |
|
1659 | readarray -t sorted_keys < <(printf '%s\n' "${!deps[@]}" | sort) | |
1660 | echo |
|
1660 | echo | |
1661 | echo deps: |
|
1661 | echo deps: | |
1662 | for k in "${sorted_keys[@]}"; do echo "- \${deps[$k]} = ${deps[$k]}"; done |
|
1662 | for k in "${sorted_keys[@]}"; do echo "- \${deps[$k]} = ${deps[$k]}"; done | |
1663 | fi |
|
1663 | fi | |
1664 |
|
1664 | |||
1665 | } |
|
1665 | } | |
1666 |
|
1666 | |||
1667 | # :command.user_lib |
|
1667 | # :command.user_lib | |
1668 | # src/lib/check_bootstrap.sh |
|
1668 | # src/lib/check_bootstrap.sh | |
1669 |
|
1669 | |||
1670 | check_bootstrap() { |
|
1670 | check_bootstrap() { | |
1671 | # Avoid destroying bootstrapping by simple start/stop |
|
1671 | # Avoid destroying bootstrapping by simple start/stop | |
1672 | for stage_name in $BOOTSTRAP_STAGES; do |
|
1672 | for stage_name in $BOOTSTRAP_STAGES; do | |
1673 | if ! config_has_key $stage_name ; then |
|
1673 | if ! config_has_key $stage_name ; then | |
1674 | echo "$(yellow WARNING:) Bootstrap key $stage_name not found in config file $CONFIG_FILE!" |
|
1674 | echo "$(yellow WARNING:) Bootstrap key $stage_name not found in config file $CONFIG_FILE!" | |
1675 | echo "$(yellow NOTICE:) Run this first: ./$RC_SCRIPT_NAME init" |
|
1675 | echo "$(yellow NOTICE:) Run this first: ./$RC_SCRIPT_NAME init" | |
1676 | exit |
|
1676 | exit | |
1677 | fi |
|
1677 | fi | |
1678 | done |
|
1678 | done | |
1679 |
|
1679 | |||
1680 | } |
|
1680 | } | |
1681 |
|
1681 | |||
1682 | # src/lib/colors.sh |
|
1682 | # src/lib/colors.sh | |
1683 | print_in_color() { |
|
1683 | print_in_color() { | |
1684 | local color="$1" |
|
1684 | local color="$1" | |
1685 | shift |
|
1685 | shift | |
1686 | if [[ -z ${NO_COLOR+x} ]]; then |
|
1686 | if [[ -z ${NO_COLOR+x} ]]; then | |
1687 | printf "$color%b\e[0m\n" "$*" |
|
1687 | printf "$color%b\e[0m\n" "$*" | |
1688 | else |
|
1688 | else | |
1689 | printf "%b\n" "$*" |
|
1689 | printf "%b\n" "$*" | |
1690 | fi |
|
1690 | fi | |
1691 | } |
|
1691 | } | |
1692 |
|
1692 | |||
1693 | red() { print_in_color "\e[31m" "$*"; } |
|
1693 | red() { print_in_color "\e[31m" "$*"; } | |
1694 | green() { print_in_color "\e[32m" "$*"; } |
|
1694 | green() { print_in_color "\e[32m" "$*"; } | |
1695 | yellow() { print_in_color "\e[33m" "$*"; } |
|
1695 | yellow() { print_in_color "\e[33m" "$*"; } | |
1696 | blue() { print_in_color "\e[34m" "$*"; } |
|
1696 | blue() { print_in_color "\e[34m" "$*"; } | |
1697 | magenta() { print_in_color "\e[35m" "$*"; } |
|
1697 | magenta() { print_in_color "\e[35m" "$*"; } | |
1698 | cyan() { print_in_color "\e[36m" "$*"; } |
|
1698 | cyan() { print_in_color "\e[36m" "$*"; } | |
1699 | bold() { print_in_color "\e[1m" "$*"; } |
|
1699 | bold() { print_in_color "\e[1m" "$*"; } | |
1700 | underlined() { print_in_color "\e[4m" "$*"; } |
|
1700 | underlined() { print_in_color "\e[4m" "$*"; } | |
1701 | red_bold() { print_in_color "\e[1;31m" "$*"; } |
|
1701 | red_bold() { print_in_color "\e[1;31m" "$*"; } | |
1702 | green_bold() { print_in_color "\e[1;32m" "$*"; } |
|
1702 | green_bold() { print_in_color "\e[1;32m" "$*"; } | |
1703 | yellow_bold() { print_in_color "\e[1;33m" "$*"; } |
|
1703 | yellow_bold() { print_in_color "\e[1;33m" "$*"; } | |
1704 | blue_bold() { print_in_color "\e[1;34m" "$*"; } |
|
1704 | blue_bold() { print_in_color "\e[1;34m" "$*"; } | |
1705 | magenta_bold() { print_in_color "\e[1;35m" "$*"; } |
|
1705 | magenta_bold() { print_in_color "\e[1;35m" "$*"; } | |
1706 | cyan_bold() { print_in_color "\e[1;36m" "$*"; } |
|
1706 | cyan_bold() { print_in_color "\e[1;36m" "$*"; } | |
1707 | red_underlined() { print_in_color "\e[4;31m" "$*"; } |
|
1707 | red_underlined() { print_in_color "\e[4;31m" "$*"; } | |
1708 | green_underlined() { print_in_color "\e[4;32m" "$*"; } |
|
1708 | green_underlined() { print_in_color "\e[4;32m" "$*"; } | |
1709 | yellow_underlined() { print_in_color "\e[4;33m" "$*"; } |
|
1709 | yellow_underlined() { print_in_color "\e[4;33m" "$*"; } | |
1710 | blue_underlined() { print_in_color "\e[4;34m" "$*"; } |
|
1710 | blue_underlined() { print_in_color "\e[4;34m" "$*"; } | |
1711 | magenta_underlined() { print_in_color "\e[4;35m" "$*"; } |
|
1711 | magenta_underlined() { print_in_color "\e[4;35m" "$*"; } | |
1712 | cyan_underlined() { print_in_color "\e[4;36m" "$*"; } |
|
1712 | cyan_underlined() { print_in_color "\e[4;36m" "$*"; } | |
1713 |
|
1713 | |||
1714 | # src/lib/config.sh |
|
1714 | # src/lib/config.sh | |
1715 |
|
1715 | |||
1716 | config_show() { |
|
1716 | config_show() { | |
1717 | config_load |
|
1717 | config_load | |
1718 | ini_show |
|
1718 | ini_show | |
1719 | } |
|
1719 | } | |
1720 |
|
1720 | |||
1721 | config_get() { |
|
1721 | config_get() { | |
1722 | local key="$1" |
|
1722 | local key="$1" | |
1723 | local default_value="$2" |
|
1723 | local default_value="$2" | |
1724 |
|
1724 | |||
1725 | config_load |
|
1725 | config_load | |
1726 | echo "${ini["$key"]:-$default_value}" |
|
1726 | echo "${ini["$key"]:-$default_value}" | |
1727 | } |
|
1727 | } | |
1728 |
|
1728 | |||
1729 | config_set() { |
|
1729 | config_set() { | |
1730 | local key="$1" |
|
1730 | local key="$1" | |
1731 | shift |
|
1731 | shift | |
1732 | local value="$*" |
|
1732 | local value="$*" | |
1733 |
|
1733 | |||
1734 | config_load |
|
1734 | config_load | |
1735 | ini["$key"]="$value" |
|
1735 | ini["$key"]="$value" | |
1736 | config_save |
|
1736 | config_save | |
1737 | } |
|
1737 | } | |
1738 |
|
1738 | |||
1739 | config_del() { |
|
1739 | config_del() { | |
1740 | local key="$1" |
|
1740 | local key="$1" | |
1741 |
|
1741 | |||
1742 | config_load |
|
1742 | config_load | |
1743 | unset "ini[$key]" |
|
1743 | unset "ini[$key]" | |
1744 | config_save |
|
1744 | config_save | |
1745 | } |
|
1745 | } | |
1746 |
|
1746 | |||
1747 | config_keys() { |
|
1747 | config_keys() { | |
1748 | config_load |
|
1748 | config_load | |
1749 | ini_keys |
|
1749 | ini_keys | |
1750 | } |
|
1750 | } | |
1751 |
|
1751 | |||
1752 | config_has_key() { |
|
1752 | config_has_key() { | |
1753 | [[ $(config_get "$1") ]] |
|
1753 | [[ $(config_get "$1") ]] | |
1754 | } |
|
1754 | } | |
1755 |
|
1755 | |||
1756 | config_reload() { |
|
1756 | config_reload() { | |
1757 | declare -g config_loaded=false |
|
1757 | declare -g config_loaded=false | |
1758 | config_load |
|
1758 | config_load | |
1759 | } |
|
1759 | } | |
1760 |
|
1760 | |||
1761 | config_load() { |
|
1761 | config_load() { | |
1762 | [[ "$config_loaded" == "true" ]] && return |
|
1762 | [[ "$config_loaded" == "true" ]] && return | |
1763 |
|
1763 | |||
1764 | declare -g CONFIG_FILE=${CONFIG_FILE:=config.ini} |
|
1764 | declare -g CONFIG_FILE=${CONFIG_FILE:=config.ini} | |
1765 | declare -g config_loaded=true |
|
1765 | declare -g config_loaded=true | |
1766 | [[ -f "$CONFIG_FILE" ]] || touch "$CONFIG_FILE" |
|
1766 | [[ -f "$CONFIG_FILE" ]] || touch "$CONFIG_FILE" | |
1767 | ini_load "$CONFIG_FILE" |
|
1767 | ini_load "$CONFIG_FILE" | |
1768 | } |
|
1768 | } | |
1769 |
|
1769 | |||
1770 | config_save() { |
|
1770 | config_save() { | |
1771 | ini_save "$CONFIG_FILE" |
|
1771 | ini_save "$CONFIG_FILE" | |
1772 | } |
|
1772 | } | |
1773 |
|
1773 | |||
1774 | # src/lib/dotenv.sh |
|
1774 | # src/lib/dotenv.sh | |
1775 |
|
1775 | |||
1776 | __dotenv= |
|
1776 | __dotenv= | |
1777 | __dotenv_file= |
|
1777 | __dotenv_file= | |
1778 | __dotenv_cmd=.env |
|
1778 | __dotenv_cmd=.env | |
1779 |
|
1779 | |||
1780 | .env() { |
|
1780 | .env() { | |
1781 | REPLY=() |
|
1781 | REPLY=() | |
1782 | [[ $__dotenv_file || ${1-} == -* ]] || .env.--file .env || return |
|
1782 | [[ $__dotenv_file || ${1-} == -* ]] || .env.--file .env || return | |
1783 | if declare -F -- ".env.${1-}" >/dev/null; then .env."$@"; return ; fi |
|
1783 | if declare -F -- ".env.${1-}" >/dev/null; then .env."$@"; return ; fi | |
1784 | .env --help >&2; return 64 |
|
1784 | .env --help >&2; return 64 | |
1785 | } |
|
1785 | } | |
1786 |
|
1786 | |||
1787 | .env.-f() { .env.--file "$@"; } |
|
1787 | .env.-f() { .env.--file "$@"; } | |
1788 |
|
1788 | |||
1789 | .env.get() { |
|
1789 | .env.get() { | |
1790 | .env::arg "get requires a key" "$@" && |
|
1790 | .env::arg "get requires a key" "$@" && | |
1791 | [[ "$__dotenv" =~ ^(.*(^|$'\n'))([ ]*)"$1="(.*)$ ]] && |
|
1791 | [[ "$__dotenv" =~ ^(.*(^|$'\n'))([ ]*)"$1="(.*)$ ]] && | |
1792 | REPLY=${BASH_REMATCH[4]%%$'\n'*} && REPLY=${REPLY%"${REPLY##*[![:space:]]}"} |
|
1792 | REPLY=${BASH_REMATCH[4]%%$'\n'*} && REPLY=${REPLY%"${REPLY##*[![:space:]]}"} | |
1793 | } |
|
1793 | } | |
1794 |
|
1794 | |||
1795 | .env.get_or_error() { |
|
1795 | .env.get_or_error() { | |
1796 | .env.get "$@" || { echo "$(red ERROR required key $@ not set in $RUNTIME_ENV file)"; exit 1; } |
|
1796 | .env.get "$@" || { echo "$(red ERROR required key $@ not set in $RUNTIME_ENV file)"; exit 1; } | |
1797 | } |
|
1797 | } | |
1798 |
|
1798 | |||
1799 | .env.parse() { |
|
1799 | .env.parse() { | |
1800 | local line key |
|
1800 | local line key | |
1801 | while IFS= read -r line; do |
|
1801 | while IFS= read -r line; do | |
1802 | line=${line#"${line%%[![:space:]]*}"} # trim leading whitespace |
|
1802 | line=${line#"${line%%[![:space:]]*}"} # trim leading whitespace | |
1803 | line=${line%"${line##*[![:space:]]}"} # trim trailing whitespace |
|
1803 | line=${line%"${line##*[![:space:]]}"} # trim trailing whitespace | |
1804 | if [[ ! "$line" || "$line" == '#'* ]]; then continue ; fi |
|
1804 | if [[ ! "$line" || "$line" == '#'* ]]; then continue ; fi | |
1805 | if (($#)); then |
|
1805 | if (($#)); then | |
1806 | for key; do |
|
1806 | for key; do | |
1807 | if [[ $key == "${line%%=*}" ]]; then REPLY+=("$line"); break; |
|
1807 | if [[ $key == "${line%%=*}" ]]; then REPLY+=("$line"); break; | |
1808 | fi |
|
1808 | fi | |
1809 | done |
|
1809 | done | |
1810 | else |
|
1810 | else | |
1811 | REPLY+=("$line") |
|
1811 | REPLY+=("$line") | |
1812 | fi |
|
1812 | fi | |
1813 | done <<<"$__dotenv" |
|
1813 | done <<<"$__dotenv" | |
1814 | ((${#REPLY[@]})) |
|
1814 | ((${#REPLY[@]})) | |
1815 | } |
|
1815 | } | |
1816 |
|
1816 | |||
1817 | .env.export() { ! .env.parse "$@" || export "${REPLY[@]}"; } |
|
1817 | .env.export() { ! .env.parse "$@" || export "${REPLY[@]}"; } | |
1818 |
|
1818 | |||
1819 | .env.set() { |
|
1819 | .env.set() { | |
1820 | .env::file load || return ; local key saved=$__dotenv |
|
1820 | .env::file load || return ; local key saved=$__dotenv | |
1821 | while (($#)); do |
|
1821 | while (($#)); do | |
1822 | key=${1#+}; key=${key%%=*} |
|
1822 | key=${1#+}; key=${key%%=*} | |
1823 | if .env.get "$key"; then |
|
1823 | if .env.get "$key"; then | |
1824 | REPLY=() |
|
1824 | REPLY=() | |
1825 | if [[ $1 == +* ]]; then shift; continue # skip if already found |
|
1825 | if [[ $1 == +* ]]; then shift; continue # skip if already found | |
1826 | elif [[ $1 == *=* ]]; then |
|
1826 | elif [[ $1 == *=* ]]; then | |
1827 | __dotenv=${BASH_REMATCH[1]}${BASH_REMATCH[3]}$1$'\n'${BASH_REMATCH[4]#*$'\n'} |
|
1827 | __dotenv=${BASH_REMATCH[1]}${BASH_REMATCH[3]}$1$'\n'${BASH_REMATCH[4]#*$'\n'} | |
1828 | else |
|
1828 | else | |
1829 | __dotenv=${BASH_REMATCH[1]}${BASH_REMATCH[4]#*$'\n'} |
|
1829 | __dotenv=${BASH_REMATCH[1]}${BASH_REMATCH[4]#*$'\n'} | |
1830 | continue # delete all occurrences |
|
1830 | continue # delete all occurrences | |
1831 | fi |
|
1831 | fi | |
1832 | elif [[ $1 == *=* ]]; then |
|
1832 | elif [[ $1 == *=* ]]; then | |
1833 | __dotenv+="${1#+}"$'\n' |
|
1833 | __dotenv+="${1#+}"$'\n' | |
1834 | fi |
|
1834 | fi | |
1835 | shift |
|
1835 | shift | |
1836 | done |
|
1836 | done | |
1837 | [[ $__dotenv == "$saved" ]] || .env::file save |
|
1837 | [[ $__dotenv == "$saved" ]] || .env::file save | |
1838 | } |
|
1838 | } | |
1839 |
|
1839 | |||
1840 | .env.puts() { echo "${1-}">>"$__dotenv_file" && __dotenv+="$1"$'\n'; } |
|
1840 | .env.puts() { echo "${1-}">>"$__dotenv_file" && __dotenv+="$1"$'\n'; } | |
1841 |
|
1841 | |||
1842 | .env.generate() { |
|
1842 | .env.generate() { | |
1843 | .env::arg "key required for generate" "$@" || return |
|
1843 | .env::arg "key required for generate" "$@" || return | |
1844 | .env.get "$1" && return || REPLY=$("${@:2}") || return |
|
1844 | .env.get "$1" && return || REPLY=$("${@:2}") || return | |
1845 | .env::one "generate: ouptut of '${*:2}' has more than one line" "$REPLY" || return |
|
1845 | .env::one "generate: ouptut of '${*:2}' has more than one line" "$REPLY" || return | |
1846 | .env.puts "$1=$REPLY" |
|
1846 | .env.puts "$1=$REPLY" | |
1847 | } |
|
1847 | } | |
1848 |
|
1848 | |||
1849 | .env.--file() { |
|
1849 | .env.--file() { | |
1850 | .env::arg "filename required for --file" "$@" || return |
|
1850 | .env::arg "filename required for --file" "$@" || return | |
1851 | __dotenv_file=$1; .env::file load || return |
|
1851 | __dotenv_file=$1; .env::file load || return | |
1852 | (($#<2)) || .env "${@:2}" |
|
1852 | (($#<2)) || .env "${@:2}" | |
1853 | } |
|
1853 | } | |
1854 |
|
1854 | |||
1855 | .env::arg() { [[ "${2-}" ]] || { echo "$__dotenv_cmd: $1" >&2; return 64; }; } |
|
1855 | .env::arg() { [[ "${2-}" ]] || { echo "$__dotenv_cmd: $1" >&2; return 64; }; } | |
1856 |
|
1856 | |||
1857 | .env::one() { [[ "$2" != *$'\n'* ]] || .env::arg "$1"; } |
|
1857 | .env::one() { [[ "$2" != *$'\n'* ]] || .env::arg "$1"; } | |
1858 |
|
1858 | |||
1859 | .env::file() { |
|
1859 | .env::file() { | |
1860 | local REPLY=$__dotenv_file |
|
1860 | local REPLY=$__dotenv_file | |
1861 | case "$1" in |
|
1861 | case "$1" in | |
1862 | load) |
|
1862 | load) | |
1863 | __dotenv=; ! [[ -f "$REPLY" ]] || __dotenv="$(<"$REPLY")"$'\n' || return ;; |
|
1863 | __dotenv=; ! [[ -f "$REPLY" ]] || __dotenv="$(<"$REPLY")"$'\n' || return ;; | |
1864 | save) |
|
1864 | save) | |
1865 | if [[ -L "$REPLY" ]] && declare -F -- realpath.resolved >/dev/null; then |
|
1865 | if [[ -L "$REPLY" ]] && declare -F -- realpath.resolved >/dev/null; then | |
1866 | realpath.resolved "$REPLY" |
|
1866 | realpath.resolved "$REPLY" | |
1867 | fi |
|
1867 | fi | |
1868 | { [[ ! -f "$REPLY" ]] || cp -p "$REPLY" "$REPLY.bak"; } && |
|
1868 | { [[ ! -f "$REPLY" ]] || cp -p "$REPLY" "$REPLY.bak"; } && | |
1869 | printf %s "$__dotenv" >"$REPLY.bak" && mv "$REPLY.bak" "$REPLY" |
|
1869 | printf %s "$__dotenv" >"$REPLY.bak" && mv "$REPLY.bak" "$REPLY" | |
1870 | esac |
|
1870 | esac | |
1871 | } |
|
1871 | } | |
1872 |
|
1872 | |||
1873 | # |
|
1873 | # | |
1874 | #__dotenv() { |
|
1874 | #__dotenv() { | |
1875 | # set -eu |
|
1875 | # set -eu | |
1876 | # __dotenv_cmd=${0##*/} |
|
1876 | # __dotenv_cmd=${0##*/} | |
1877 | # .env.export() { .env.parse "$@" || return 0; printf 'export %q\n' "${REPLY[@]}"; REPLY=(); } |
|
1877 | # .env.export() { .env.parse "$@" || return 0; printf 'export %q\n' "${REPLY[@]}"; REPLY=(); } | |
1878 | # .env "$@" || return $? |
|
1878 | # .env "$@" || return $? | |
1879 | # ${REPLY[@]+printf '%s\n' "${REPLY[@]}"} |
|
1879 | # ${REPLY[@]+printf '%s\n' "${REPLY[@]}"} | |
1880 | #} |
|
1880 | #} | |
1881 | #if [[ $0 == "${BASH_SOURCE-}" ]]; then __dotenv "$@"; exit; fi |
|
1881 | #if [[ $0 == "${BASH_SOURCE-}" ]]; then __dotenv "$@"; exit; fi | |
1882 |
|
1882 | |||
1883 | # src/lib/get_docker_definitions.sh |
|
1883 | # src/lib/get_docker_definitions.sh | |
1884 |
|
1884 | |||
1885 | get_docker_definitions() { |
|
1885 | get_docker_definitions() { | |
1886 | SOURCE_DIR=$PWD |
|
1886 | SOURCE_DIR=$PWD | |
1887 | RHODECODE_DOCKER_HASH=$1 |
|
1887 | RHODECODE_DOCKER_HASH=$1 | |
1888 | FULL_MODE=$2 |
|
1888 | FULL_MODE=$2 | |
1889 | DEBUG=$3 |
|
1889 | DEBUG=$3 | |
1890 |
|
1890 | |||
1891 | final_archive_url="$SERVER_URL/$RHODECODE_DOCKER_HASH.tgz" |
|
1891 | final_archive_url="$SERVER_URL/$RHODECODE_DOCKER_HASH.tgz" | |
1892 | extracted_archive_dir="rhodecode-enterprise-docker-id-bacb-sub-0-archive-all" |
|
1892 | extracted_archive_dir="rhodecode-enterprise-docker-id-bacb-sub-0-archive-all" | |
1893 |
|
1893 | |||
1894 | # download sources |
|
1894 | # download sources | |
1895 | echo "bootstrap_definitions: download rhodecode docker definitions from: $final_archive_url" |
|
1895 | echo "bootstrap_definitions: download rhodecode docker definitions from: $final_archive_url" | |
1896 | echo "" |
|
1896 | echo "" | |
1897 |
|
1897 | |||
1898 | if [ $DEBUG ]; then |
|
1898 | if [ $DEBUG ]; then | |
1899 | echo "bootstrap_definitions: downloading: $SERVER_URL/$RHODECODE_DOCKER_HASH.tgz" |
|
1899 | echo "bootstrap_definitions: downloading: $SERVER_URL/$RHODECODE_DOCKER_HASH.tgz" | |
1900 | curl --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $final_archive_url | tar -xz -C $SOURCE_DIR |
|
1900 | curl --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $final_archive_url | tar -xz -C $SOURCE_DIR | |
1901 |
|
1901 | |||
1902 | echo "extracted archive to $SOURCE_DIR" |
|
1902 | echo "extracted archive to $SOURCE_DIR" | |
1903 | echo "bootstrap_definitions: running CP $SOURCE_DIR/$extracted_archive_dir/* $SOURCE_DIR" |
|
1903 | echo "bootstrap_definitions: running CP $SOURCE_DIR/$extracted_archive_dir/* $SOURCE_DIR" | |
1904 | cp_backup_verbose $SOURCE_DIR/$extracted_archive_dir/* $SOURCE_DIR |
|
1904 | cp_backup_verbose $SOURCE_DIR/$extracted_archive_dir/* $SOURCE_DIR | |
1905 |
|
1905 | |||
1906 | echo "bootstrap_definitions: removing $SOURCE_DIR/$extracted_archive_dir" |
|
1906 | echo "bootstrap_definitions: removing $SOURCE_DIR/$extracted_archive_dir" | |
1907 | rm -r $SOURCE_DIR/$extracted_archive_dir |
|
1907 | rm -r $SOURCE_DIR/$extracted_archive_dir | |
1908 | else |
|
1908 | else | |
1909 | curl -s --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $final_archive_url | tar -xz -C $SOURCE_DIR |
|
1909 | curl -s --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $final_archive_url | tar -xz -C $SOURCE_DIR | |
1910 |
|
1910 | |||
1911 | cp_backup $SOURCE_DIR/$extracted_archive_dir/* $SOURCE_DIR |
|
1911 | cp_backup $SOURCE_DIR/$extracted_archive_dir/* $SOURCE_DIR | |
1912 |
|
1912 | |||
1913 | rm -r $SOURCE_DIR/$extracted_archive_dir |
|
1913 | rm -r $SOURCE_DIR/$extracted_archive_dir | |
1914 | fi |
|
1914 | fi | |
1915 |
|
1915 | |||
1916 | echo "$(green bootstrap_definitions: docker definitions extracted to $SOURCE_DIR)" |
|
1916 | echo "$(green bootstrap_definitions: docker definitions extracted to $SOURCE_DIR)" | |
1917 |
|
1917 | |||
1918 | # cleanup of backup files, just good to have, ignore any warnings |
|
1918 | # cleanup of backup files, just good to have, ignore any warnings | |
1919 | # NOTE: Disabled for backward compat |
|
1919 | # NOTE: Disabled for backward compat | |
1920 | #find "$SOURCE_DIR" -nowarn -ignore_readdir_race -iname "*.~*~" -delete 2> /dev/null |
|
1920 | #find "$SOURCE_DIR" -nowarn -ignore_readdir_race -iname "*.~*~" -delete 2> /dev/null | |
1921 |
|
1921 | |||
1922 | # some cleanup of things we don't need in cli |
|
1922 | # some cleanup of things we don't need in cli | |
1923 | if [[ ! $FULL_MODE ]]; then |
|
1923 | if [[ ! $FULL_MODE ]]; then | |
1924 | rm dev-tools |
|
1924 | rm dev-tools | |
1925 | rm -r scripts/dev-tools |
|
1925 | rm -r scripts/dev-tools | |
1926 | rm -r entrypoints.d |
|
1926 | rm -r entrypoints.d | |
1927 | fi |
|
1927 | fi | |
1928 | } |
|
1928 | } | |
1929 |
|
1929 | |||
1930 | # src/lib/ini.sh |
|
1930 | # src/lib/ini.sh | |
1931 |
|
1931 | |||
1932 | ini_load() { |
|
1932 | ini_load() { | |
1933 | declare -gA ini |
|
1933 | declare -gA ini | |
1934 |
|
1934 | |||
1935 | local ini_file="$1" |
|
1935 | local ini_file="$1" | |
1936 |
|
1936 | |||
1937 | local section="" |
|
1937 | local section="" | |
1938 | local key="" |
|
1938 | local key="" | |
1939 | local value="" |
|
1939 | local value="" | |
1940 | local section_regex="^\[(.+)\]" |
|
1940 | local section_regex="^\[(.+)\]" | |
1941 | local key_regex="^([^ =]+) *= *(.*) *$" |
|
1941 | local key_regex="^([^ =]+) *= *(.*) *$" | |
1942 | local comment_regex="^;" |
|
1942 | local comment_regex="^;" | |
1943 |
|
1943 | |||
1944 | while IFS= read -r line; do |
|
1944 | while IFS= read -r line; do | |
1945 | if [[ $line =~ $comment_regex ]]; then |
|
1945 | if [[ $line =~ $comment_regex ]]; then | |
1946 | continue |
|
1946 | continue | |
1947 | elif [[ $line =~ $section_regex ]]; then |
|
1947 | elif [[ $line =~ $section_regex ]]; then | |
1948 | section="${BASH_REMATCH[1]}." |
|
1948 | section="${BASH_REMATCH[1]}." | |
1949 | elif [[ $line =~ $key_regex ]]; then |
|
1949 | elif [[ $line =~ $key_regex ]]; then | |
1950 | key="${BASH_REMATCH[1]}" |
|
1950 | key="${BASH_REMATCH[1]}" | |
1951 | value="${BASH_REMATCH[2]}" |
|
1951 | value="${BASH_REMATCH[2]}" | |
1952 | ini["${section}${key}"]="$value" |
|
1952 | ini["${section}${key}"]="$value" | |
1953 | fi |
|
1953 | fi | |
1954 | done <"$ini_file" |
|
1954 | done <"$ini_file" | |
1955 | } |
|
1955 | } | |
1956 |
|
1956 | |||
1957 | ini_save() { |
|
1957 | ini_save() { | |
1958 | declare -gA ini |
|
1958 | declare -gA ini | |
1959 |
|
1959 | |||
1960 | local ini_file="$1" |
|
1960 | local ini_file="$1" | |
1961 |
|
1961 | |||
1962 | local current_section="" |
|
1962 | local current_section="" | |
1963 | local has_free_keys=false |
|
1963 | local has_free_keys=false | |
1964 |
|
1964 | |||
1965 | rm -f "$ini_file" |
|
1965 | rm -f "$ini_file" | |
1966 |
|
1966 | |||
1967 | for key in $(ini_keys); do |
|
1967 | for key in $(ini_keys); do | |
1968 | [[ $key == *.* ]] && continue |
|
1968 | [[ $key == *.* ]] && continue | |
1969 | has_free_keys=true |
|
1969 | has_free_keys=true | |
1970 | value="${ini[$key]}" |
|
1970 | value="${ini[$key]}" | |
1971 | echo "$key = $value" >>"$ini_file" |
|
1971 | echo "$key = $value" >>"$ini_file" | |
1972 | done |
|
1972 | done | |
1973 |
|
1973 | |||
1974 | [[ "${has_free_keys}" == "true" ]] && echo >>"$ini_file" |
|
1974 | [[ "${has_free_keys}" == "true" ]] && echo >>"$ini_file" | |
1975 |
|
1975 | |||
1976 | for key in $(ini_keys); do |
|
1976 | for key in $(ini_keys); do | |
1977 | [[ $key == *.* ]] || continue |
|
1977 | [[ $key == *.* ]] || continue | |
1978 | value="${ini[$key]}" |
|
1978 | value="${ini[$key]}" | |
1979 | IFS="." read -r section_name key_name <<<"$key" |
|
1979 | IFS="." read -r section_name key_name <<<"$key" | |
1980 |
|
1980 | |||
1981 | if [[ "$current_section" != "$section_name" ]]; then |
|
1981 | if [[ "$current_section" != "$section_name" ]]; then | |
1982 | [[ $current_section ]] && echo >>"$ini_file" |
|
1982 | [[ $current_section ]] && echo >>"$ini_file" | |
1983 | echo "[$section_name]" >>"$ini_file" |
|
1983 | echo "[$section_name]" >>"$ini_file" | |
1984 | current_section="$section_name" |
|
1984 | current_section="$section_name" | |
1985 | fi |
|
1985 | fi | |
1986 |
|
1986 | |||
1987 | echo "$key_name = $value" >>"$ini_file" |
|
1987 | echo "$key_name = $value" >>"$ini_file" | |
1988 | done |
|
1988 | done | |
1989 | } |
|
1989 | } | |
1990 |
|
1990 | |||
1991 | ini_show() { |
|
1991 | ini_show() { | |
1992 | declare -gA ini |
|
1992 | declare -gA ini | |
1993 |
|
1993 | |||
1994 | for key in $(ini_keys); do |
|
1994 | for key in $(ini_keys); do | |
1995 | echo "$key = ${ini[$key]}" |
|
1995 | echo "$key = ${ini[$key]}" | |
1996 | done |
|
1996 | done | |
1997 | } |
|
1997 | } | |
1998 |
|
1998 | |||
1999 | ini_keys() { |
|
1999 | ini_keys() { | |
2000 | declare -gA ini |
|
2000 | declare -gA ini | |
2001 |
|
2001 | |||
2002 | local keys=("${!ini[@]}") |
|
2002 | local keys=("${!ini[@]}") | |
2003 | for a in "${keys[@]}"; do echo "$a"; done | sort |
|
2003 | for a in "${keys[@]}"; do echo "$a"; done | sort | |
2004 | } |
|
2004 | } | |
2005 |
|
2005 | |||
2006 | # src/lib/reconfigure_ini.sh |
|
2006 | # src/lib/reconfigure_ini.sh | |
2007 | sed_replace() { |
|
2007 | sed_replace() { | |
2008 | if [[ $ini_path == "" ]]; then |
|
2008 | if [[ $ini_path == "" ]]; then | |
2009 | echo "ERROR: missing 'ini_path' variable" |
|
2009 | echo "ERROR: missing 'ini_path' variable" | |
2010 | fi |
|
2010 | fi | |
2011 |
|
2011 | |||
2012 | sed_func "$1" "$2" "$ini_path" |
|
2012 | sed_func "$1" "$2" "$ini_path" | |
2013 | } |
|
2013 | } | |
2014 |
|
2014 | |||
2015 | sed_safe_path() { |
|
2015 | sed_safe_path() { | |
2016 | echo $((echo $1|sed -r 's/([\$\.\*\/\[\\^])/\\\1/g'|sed 's/[]]/\[]]/g')>&1) |
|
2016 | echo $((echo $1|sed -r 's/([\$\.\*\/\[\\^])/\\\1/g'|sed 's/[]]/\[]]/g')>&1) | |
2017 | } |
|
2017 | } | |
2018 |
|
2018 | |||
2019 | config_vcsserver_ini() { |
|
2019 | config_vcsserver_ini() { | |
2020 |
|
2020 | |||
2021 | #host/port |
|
2021 | #host/port | |
2022 | sed_replace '^#?host = .*' 'host = 0\.0\.0\.0' |
|
2022 | sed_replace '^#?host = .*' 'host = 0\.0\.0\.0' | |
2023 | sed_replace '^#?port = .*' 'port = 10010' |
|
2023 | sed_replace '^#?port = .*' 'port = 10010' | |
2024 |
|
2024 | |||
2025 | # workers adjustment |
|
2025 | # workers adjustment | |
2026 | sed_replace '^#?workers = .*' 'workers = 1' |
|
2026 | sed_replace '^#?workers = .*' 'workers = 1' | |
2027 | sed_replace '^#?memory_max_usage = .*' 'memory_max_usage = 2147483648' |
|
2027 | sed_replace '^#?memory_max_usage = .*' 'memory_max_usage = 2147483648' | |
2028 | sed_replace '^#?core\.binary_dir = .*' 'core.binary_dir = \/usr\/local\/bin\/rhodecode_bin\/vcs_bin' |
|
2028 | sed_replace '^#?core\.binary_dir = .*' 'core.binary_dir = \/usr\/local\/bin\/rhodecode_bin\/vcs_bin' | |
2029 |
|
2029 | |||
2030 | sed_replace '^#?rc_cache\.repo_object\.expiration_time = .*' '#rc_cache.repo_object.expiration_time = 2592000' |
|
2030 | sed_replace '^#?rc_cache\.repo_object\.expiration_time = .*' '#rc_cache.repo_object.expiration_time = 2592000' | |
2031 | sed_replace '^#?rc_cache\.repo_object\.backend = dogpile\.cache\.rc\.redis_msgpack' 'rc_cache.repo_object.backend = dogpile.cache.rc.redis_msgpack' |
|
2031 | sed_replace '^#?rc_cache\.repo_object\.backend = dogpile\.cache\.rc\.redis_msgpack' 'rc_cache.repo_object.backend = dogpile.cache.rc.redis_msgpack' | |
2032 |
|
2032 | |||
2033 | sed_replace '^#?rc_cache\.repo_object\.arguments\.socket_timeout = .*' 'rc_cache.repo_object.arguments.socket_timeout = 30' |
|
2033 | sed_replace '^#?rc_cache\.repo_object\.arguments\.socket_timeout = .*' 'rc_cache.repo_object.arguments.socket_timeout = 30' | |
2034 | sed_replace '^#?rc_cache\.repo_object\.arguments\.db = .*' 'rc_cache.repo_object.arguments.db = 5' |
|
2034 | sed_replace '^#?rc_cache\.repo_object\.arguments\.db = .*' 'rc_cache.repo_object.arguments.db = 5' | |
2035 | sed_replace '^#?rc_cache\.repo_object\.arguments\.port = .*' 'rc_cache.repo_object.arguments.port = 6379' |
|
2035 | sed_replace '^#?rc_cache\.repo_object\.arguments\.port = .*' 'rc_cache.repo_object.arguments.port = 6379' | |
2036 | sed_replace '^#?rc_cache\.repo_object\.arguments\.host = .*' 'rc_cache.repo_object.arguments.host = redis' |
|
2036 | sed_replace '^#?rc_cache\.repo_object\.arguments\.host = .*' 'rc_cache.repo_object.arguments.host = redis' | |
2037 | sed_replace '^#?rc_cache\.repo_object\.arguments\.redis_expiration_time = .*' 'rc_cache.repo_object.arguments.redis_expiration_time = 3592000' |
|
2037 | sed_replace '^#?rc_cache\.repo_object\.arguments\.redis_expiration_time = .*' 'rc_cache.repo_object.arguments.redis_expiration_time = 3592000' | |
2038 |
|
2038 | |||
2039 | sed_replace '^#?cache_dir = .*' 'cache_dir = \/var\/opt\/rhodecode_data' |
|
2039 | sed_replace '^#?cache_dir = .*' 'cache_dir = \/var\/opt\/rhodecode_data' | |
2040 | sed_replace '^#?formatter = .*' 'formatter = json' |
|
2040 | sed_replace '^#?formatter = .*' 'formatter = json' | |
2041 |
|
2041 | |||
2042 | #statsd enable |
|
2042 | #statsd enable | |
2043 | sed_replace '^#?statsd.enabled = .*' 'statsd.enabled = true' |
|
2043 | sed_replace '^#?statsd.enabled = .*' 'statsd.enabled = true' | |
2044 | sed_replace '^#?statsd.statsd_host = .*' 'statsd.statsd_host = statsd-exporter' |
|
2044 | sed_replace '^#?statsd.statsd_host = .*' 'statsd.statsd_host = statsd-exporter' | |
2045 | sed_replace '^#?statsd.statsd_port = .*' 'statsd.statsd_port = 9125' |
|
2045 | sed_replace '^#?statsd.statsd_port = .*' 'statsd.statsd_port = 9125' | |
2046 |
|
2046 | |||
2047 | } |
|
2047 | } | |
2048 |
|
2048 | |||
2049 | config_rhodecode_ini() { |
|
2049 | config_rhodecode_ini() { | |
2050 | #host/port |
|
2050 | #host/port | |
2051 | sed_replace '^#?host = .*' 'host = 0\.0\.0\.0' |
|
2051 | sed_replace '^#?host = .*' 'host = 0\.0\.0\.0' | |
2052 | sed_replace '^#?port = .*' 'port = 10020' |
|
2052 | sed_replace '^#?port = .*' 'port = 10020' | |
2053 |
|
2053 | |||
2054 | # workers adjustment |
|
2054 | # workers adjustment | |
2055 | sed_replace '^#?workers = .*' 'workers = 1' |
|
2055 | sed_replace '^#?workers = .*' 'workers = 1' | |
2056 | sed_replace '^#?memory_max_usage = .*' 'memory_max_usage = 2147483648' |
|
2056 | sed_replace '^#?memory_max_usage = .*' 'memory_max_usage = 2147483648' | |
2057 |
|
2057 | |||
2058 |
|
2058 | |||
2059 | sed_replace '^#?email_prefix = .*' 'email_prefix = [RhodeCode]' |
|
2059 | sed_replace '^#?email_prefix = .*' 'email_prefix = [RhodeCode]' | |
2060 | sed_replace '^#?app_email_from = .*' "app_email_from = rhodecode-noreply@$RC_HOSTNAME" |
|
2060 | sed_replace '^#?app_email_from = .*' "app_email_from = rhodecode-noreply@$RC_HOSTNAME" | |
2061 | sed_replace '^#?smtp_server = .*' 'smtp_server = localhost' |
|
2061 | sed_replace '^#?smtp_server = .*' 'smtp_server = localhost' | |
2062 |
|
2062 | |||
2063 | # app-instance-uuid |
|
2063 | # app-instance-uuid | |
2064 | sed_replace '^app_instance_uuid = .*' "app_instance_uuid = $RC_APP_INSTANCE_UUID" |
|
2064 | sed_replace '^app_instance_uuid = .*' "app_instance_uuid = $RC_APP_INSTANCE_UUID" | |
2065 |
|
2065 | |||
2066 | # app base |
|
2066 | # app base | |
2067 | sed_replace '^app\.base_url = .*' "app\.base_url = $RC_APP_BASE_URL" |
|
2067 | sed_replace '^app\.base_url = .*' "app\.base_url = $RC_APP_BASE_URL" | |
2068 |
|
2068 | |||
2069 | # set license_token |
|
2069 | # set license_token | |
2070 | sed_replace '^#?license_token =.*' "license_token = $RC_LICENSE_TOKEN" |
|
2070 | sed_replace '^#?license_token =.*' "license_token = $RC_LICENSE_TOKEN" | |
2071 | # set Edition |
|
2071 | # set Edition | |
2072 | sed_replace '^use = egg:rhodecode-enterprise.*' "use = egg:rhodecode-enterprise-$RC_EDITION" |
|
2072 | sed_replace '^use = egg:rhodecode-enterprise.*' "use = egg:rhodecode-enterprise-$RC_EDITION" | |
2073 |
|
2073 | |||
2074 | # enable celery |
|
2074 | # enable celery | |
2075 | sed_replace '^#?use_celery = .*' 'use_celery = true' |
|
2075 | sed_replace '^#?use_celery = .*' 'use_celery = true' | |
2076 |
|
2076 | |||
2077 | # DB |
|
2077 | # DB | |
2078 | sed_replace '^sqlalchemy\.db1\.url =.*' "sqlalchemy\.db1\.url = $RC_SQLALCHEMY_DB1_URL" |
|
2078 | sed_replace '^sqlalchemy\.db1\.url =.*' "sqlalchemy\.db1\.url = $RC_SQLALCHEMY_DB1_URL" | |
2079 |
|
2079 | |||
2080 | #CHANNELSTREAM WS_URL |
|
2080 | #CHANNELSTREAM WS_URL | |
2081 | sed_replace '^#?channelstream\.ws_url =.*' "channelstream\.ws_url = $RC_CHANNELSTREAM_WS_URL" |
|
2081 | sed_replace '^#?channelstream\.ws_url =.*' "channelstream\.ws_url = $RC_CHANNELSTREAM_WS_URL" | |
2082 |
|
2082 | |||
2083 | # set cache dir |
|
2083 | # set cache dir | |
2084 | sed_replace '^#?cache_dir = .*' 'cache_dir = \/var\/opt\/rhodecode_data' |
|
2084 | sed_replace '^#?cache_dir = .*' 'cache_dir = \/var\/opt\/rhodecode_data' | |
2085 |
|
2085 | |||
2086 | # set archive cache dir |
|
2086 | # set archive cache dir | |
2087 | sed_replace '^#?archive_cache_dir = .*' 'archive_cache_dir = \/var\/opt\/rhodecode_data\/tarballcache' |
|
2087 | sed_replace '^#?archive_cache_dir = .*' 'archive_cache_dir = \/var\/opt\/rhodecode_data\/tarballcache' | |
2088 |
|
2088 | |||
2089 | # set file_store path |
|
2089 | # set file_store path | |
2090 | sed_replace '^#?file_store\.storage_path = .*' 'file_store.storage_path = \/var\/opt\/rhodecode_data\/file_store' |
|
2090 | sed_replace '^#?file_store\.storage_path = .*' 'file_store.storage_path = \/var\/opt\/rhodecode_data\/file_store' | |
2091 |
|
2091 | |||
2092 | # cleanup rabbitmq example entry |
|
2092 | # cleanup rabbitmq example entry | |
2093 | sed_replace '^#celery\.broker_url = amqp.*' '' |
|
2093 | sed_replace '^#celery\.broker_url = amqp.*' '' | |
2094 | sed_replace '^#?celery\.broker_url = .*' 'celery\.broker_url = redis:\/\/redis:6379\/8' |
|
2094 | sed_replace '^#?celery\.broker_url = .*' 'celery\.broker_url = redis:\/\/redis:6379\/8' | |
2095 |
|
2095 | |||
2096 | # switch beaker sessions to Redis based |
|
2096 | # switch beaker sessions to Redis based | |
2097 | sed_replace '^#?beaker.session.type = file.*' '#beaker.session.type = file' |
|
2097 | sed_replace '^#?beaker.session.type = file.*' '#beaker.session.type = file' | |
2098 | sed_replace '^#?beaker.session.data_dir = .*' '#beaker.session.data_dir = \/tmp\/data\/sessions' |
|
2098 | sed_replace '^#?beaker.session.data_dir = .*' '#beaker.session.data_dir = \/tmp\/data\/sessions' | |
2099 |
|
2099 | |||
2100 | # enable redis db2 |
|
2100 | # enable redis db2 | |
2101 | sed_replace '^#?beaker\.session\.type = ext:redis' 'beaker.session.type = ext:redis' |
|
2101 | sed_replace '^#?beaker\.session\.type = ext:redis' 'beaker.session.type = ext:redis' | |
2102 | sed_replace '^#?beaker\.session\.url = redis:\/\/127.0.0.1:6379\/2' 'beaker.session.url = redis:\/\/redis:6379\/2' |
|
2102 | sed_replace '^#?beaker\.session\.url = redis:\/\/127.0.0.1:6379\/2' 'beaker.session.url = redis:\/\/redis:6379\/2' | |
2103 |
|
2103 | |||
2104 | # sed_replace '^#?beaker.session.type = ext:database.*' 'beaker.session.type = ext:database' |
|
2104 | # sed_replace '^#?beaker.session.type = ext:database.*' 'beaker.session.type = ext:database' | |
2105 | # sed_replace '^#?beaker.session.sa.url = postgresql.*' 'beaker.session.sa.url = postgresql://{{rhodecode_db_username}}:{{rhodecode_db_password}}@localhost/{{rhodecode_db_name}}' |
|
2105 | # sed_replace '^#?beaker.session.sa.url = postgresql.*' 'beaker.session.sa.url = postgresql://{{rhodecode_db_username}}:{{rhodecode_db_password}}@localhost/{{rhodecode_db_name}}' | |
2106 |
|
2106 | |||
2107 | # hooks reconfigure for auto-bind to host |
|
2107 | # hooks reconfigure for auto-bind to host | |
2108 | sed_replace '^#?vcs.hooks.host = .*' 'vcs.hooks.host = \*' |
|
2108 | sed_replace '^#?vcs.hooks.host = .*' 'vcs.hooks.host = \*' | |
2109 | sed_replace '^#?vcs.server = .*' 'vcs.server = vcsserver:10010' |
|
2109 | sed_replace '^#?vcs.server = .*' 'vcs.server = vcsserver:10010' | |
2110 |
|
2110 | |||
2111 | # enable SVN |
|
2111 | # enable SVN | |
2112 | sed_replace '^#?svn.proxy.generate_config = .*' 'svn.proxy.generate_config = true' |
|
2112 | sed_replace '^#?svn.proxy.generate_config = .*' 'svn.proxy.generate_config = true' | |
2113 |
|
2113 | |||
2114 | # enable SSH |
|
2114 | # enable SSH | |
2115 | sed_replace '^#?ssh.generate_authorized_keyfile = .*' 'ssh.generate_authorized_keyfile = true' |
|
2115 | sed_replace '^#?ssh.generate_authorized_keyfile = .*' 'ssh.generate_authorized_keyfile = true' | |
2116 |
|
2116 | |||
2117 | #statsd enable |
|
2117 | #statsd enable | |
2118 | sed_replace '^#?statsd.enabled = .*' 'statsd.enabled = true' |
|
2118 | sed_replace '^#?statsd.enabled = .*' 'statsd.enabled = true' | |
2119 | sed_replace '^#?statsd.statsd_host = .*' 'statsd.statsd_host = statsd-exporter' |
|
2119 | sed_replace '^#?statsd.statsd_host = .*' 'statsd.statsd_host = statsd-exporter' | |
2120 | sed_replace '^#?statsd.statsd_port = .*' 'statsd.statsd_port = 9125' |
|
2120 | sed_replace '^#?statsd.statsd_port = .*' 'statsd.statsd_port = 9125' | |
2121 |
|
2121 | |||
2122 | # the wrapper_cmd |
|
2122 | # the wrapper_cmd | |
2123 | sed_replace '^#?ssh.wrapper_cmd = .*' 'ssh.wrapper_cmd = \/usr\/local\/bin\/rhodecode_bin\/bin\/rc-ssh-wrapper' |
|
2123 | sed_replace '^#?ssh.wrapper_cmd = .*' 'ssh.wrapper_cmd = \/usr\/local\/bin\/rhodecode_bin\/bin\/rc-ssh-wrapper' | |
2124 |
|
2124 | |||
2125 | sed_replace '^#?api_access_controllers_whitelist = .*' 'api_access_controllers_whitelist = RepoFilesView:repo_archivefile, RepoFilesView:repo_file_raw' |
|
2125 | sed_replace '^#?api_access_controllers_whitelist = .*' 'api_access_controllers_whitelist = RepoFilesView:repo_archivefile, RepoFilesView:repo_file_raw' | |
2126 |
|
2126 | |||
2127 | # # set search to elasticsearch |
|
2127 | # # set search to elasticsearch | |
2128 | # # enabled modules for Whoosh we remove, we have duplicates there.. |
|
2128 | # # enabled modules for Whoosh we remove, we have duplicates there.. | |
2129 | # '^search.module = .*' '' |
|
2129 | # '^search.module = .*' '' | |
2130 | # '^search.location = .*' '' |
|
2130 | # '^search.location = .*' '' | |
2131 | # |
|
2131 | # | |
2132 | # '^#?search.module = .*' 'search.module = rc_elasticsearch' |
|
2132 | # '^#?search.module = .*' 'search.module = rc_elasticsearch' | |
2133 | # '^#?search.location = .*' 'search.location = http://localhost:9200' |
|
2133 | # '^#?search.location = .*' 'search.location = http://localhost:9200' | |
2134 | # '^#?search.es_version = .*' 'search.es_version = 6' |
|
2134 | # '^#?search.es_version = .*' 'search.es_version = 6' | |
2135 |
|
2135 | |||
2136 | # enable Chat |
|
2136 | # enable Chat | |
2137 | sed_replace '^#?chat.enabled = .*' 'chat.enabled = true' |
|
2137 | sed_replace '^#?chat.enabled = .*' 'chat.enabled = true' | |
2138 |
|
2138 | |||
2139 | # logging |
|
2139 | # logging | |
2140 | sed_replace '^#?formatter = .*' 'formatter = json' |
|
2140 | sed_replace '^#?formatter = .*' 'formatter = json' | |
2141 |
|
2141 | |||
2142 | } |
|
2142 | } | |
2143 |
|
2143 | |||
2144 | # src/lib/send_completions.sh |
|
2144 | # src/lib/send_completions.sh | |
2145 |
|
2145 | |||
2146 | # src/lib/utils.sh |
|
2146 | # src/lib/utils.sh | |
2147 |
|
2147 | |||
2148 | generate_md5() { |
|
2148 | generate_md5() { | |
2149 | local input_string="$1" |
|
2149 | local input_string="$1" | |
2150 |
|
2150 | |||
2151 | if command -v md5 &> /dev/null; then |
|
2151 | if command -v md5 &> /dev/null; then | |
2152 | echo -n "$input_string" | md5 |
|
2152 | echo -n "$input_string" | md5 | |
2153 | elif command -v md5sum &> /dev/null; then |
|
2153 | elif command -v md5sum &> /dev/null; then | |
2154 | echo -n "$input_string" | md5sum | awk '{print $1}' |
|
2154 | echo -n "$input_string" | md5sum | awk '{print $1}' | |
2155 | else |
|
2155 | else | |
2156 | echo "Error: Neither md5 nor md5sum command is available. Please make sure this is installed in your system" |
|
2156 | echo "Error: Neither md5 nor md5sum command is available. Please make sure this is installed in your system" | |
2157 | return 1 |
|
2157 | return 1 | |
2158 | fi |
|
2158 | fi | |
2159 | } |
|
2159 | } | |
2160 |
|
2160 | |||
2161 | random_str() { |
|
2161 | random_str() { | |
2162 | len=$1 |
|
2162 | len=$1 | |
2163 | random_generate=$(generate_md5 $RANDOM | head -c $len) |
|
2163 | random_generate=$(generate_md5 $RANDOM | head -c $len) | |
2164 | echo "$random_generate" |
|
2164 | echo "$random_generate" | |
2165 | } |
|
2165 | } | |
2166 |
|
2166 | |||
2167 | # function to copy files with --backup=numbered option |
|
2167 | # function to copy files with --backup=numbered option | |
2168 | detect_cp_backup () { |
|
2168 | detect_cp_backup () { | |
2169 | cp -r -f --update --backup=numbered "$@" 2>/dev/null |
|
2169 | cp -r -f --update --backup=numbered "$@" 2>/dev/null | |
2170 | if [ $? -eq 0 ]; then |
|
2170 | if [ $? -eq 0 ]; then | |
2171 | # if exit status is 0, --backup=numbered worked and return true |
|
2171 | # if exit status is 0, --backup=numbered worked and return true | |
2172 | return 0 |
|
2172 | return 0 | |
2173 | else |
|
2173 | else | |
2174 | # if exit status is not 0, --backup=numbered didn't work and return false |
|
2174 | # if exit status is not 0, --backup=numbered didn't work and return false | |
2175 | return 1 |
|
2175 | return 1 | |
2176 | fi |
|
2176 | fi | |
2177 | } |
|
2177 | } | |
2178 |
|
2178 | |||
2179 | # function that acts like cp |
|
2179 | # function that acts like cp | |
2180 | cp_backup () { |
|
2180 | cp_backup () { | |
2181 | cp -r -f "$@" |
|
2181 | cp -r -f "$@" | |
2182 | } |
|
2182 | } | |
2183 |
|
2183 | |||
2184 | cp_backup_verbose () { |
|
2184 | cp_backup_verbose () { | |
2185 | cp -r -f -v "$@" |
|
2185 | cp -r -f -v "$@" | |
2186 | } |
|
2186 | } | |
2187 |
|
2187 | |||
2188 | # version_gte checks if the version specified in $VERSION is at least the given |
|
2188 | # version_gte checks if the version specified in $VERSION is at least the given | |
2189 | # SemVer (Maj.Minor[.Patch]), or CalVer (YY.MM) version.It returns 0 (success) |
|
2189 | # SemVer (Maj.Minor[.Patch]), or CalVer (YY.MM) version.It returns 0 (success) | |
2190 | # if $VERSION is either unset (=latest) or newer or equal than the specified |
|
2190 | # if $VERSION is either unset (=latest) or newer or equal than the specified | |
2191 | # version, or returns 1 (fail) otherwise. |
|
2191 | # version, or returns 1 (fail) otherwise. | |
2192 | # |
|
2192 | # | |
2193 | # examples: |
|
2193 | # examples: | |
2194 | # |
|
2194 | # | |
2195 | # VERSION=23.0 |
|
2195 | # VERSION=23.0 | |
2196 | # version_gte 23.0 // 0 (success) |
|
2196 | # version_gte 23.0 // 0 (success) | |
2197 | # version_gte 20.10 // 0 (success) |
|
2197 | # version_gte 20.10 // 0 (success) | |
2198 | # version_gte 19.03 // 0 (success) |
|
2198 | # version_gte 19.03 // 0 (success) | |
2199 | # version_gte 21.10 // 1 (fail) |
|
2199 | # version_gte 21.10 // 1 (fail) | |
2200 | version_gte() { |
|
2200 | version_gte() { | |
2201 | if [ -z "$VERSION" ]; then |
|
2201 | if [ -z "$VERSION" ]; then | |
2202 | return 0 |
|
2202 | return 0 | |
2203 | fi |
|
2203 | fi | |
2204 | eval version_compare "$VERSION" "$1" |
|
2204 | eval version_compare "$VERSION" "$1" | |
2205 | } |
|
2205 | } | |
2206 |
|
2206 | |||
2207 | # version_compare compares two version strings (either SemVer (Major.Minor.Path), |
|
2207 | # version_compare compares two version strings (either SemVer (Major.Minor.Path), | |
2208 | # or CalVer (YY.MM) version strings. It returns 0 (success) if version A is newer |
|
2208 | # or CalVer (YY.MM) version strings. It returns 0 (success) if version A is newer | |
2209 | # or equal than version B, or 1 (fail) otherwise. Patch releases and pre-release |
|
2209 | # or equal than version B, or 1 (fail) otherwise. Patch releases and pre-release | |
2210 | # (-alpha/-beta) are not taken into account |
|
2210 | # (-alpha/-beta) are not taken into account | |
2211 | # |
|
2211 | # | |
2212 | # examples: |
|
2212 | # examples: | |
2213 | # |
|
2213 | # | |
2214 | # version_compare 23.0.0 20.10 // 0 (success) |
|
2214 | # version_compare 23.0.0 20.10 // 0 (success) | |
2215 | # version_compare 23.0 20.10 // 0 (success) |
|
2215 | # version_compare 23.0 20.10 // 0 (success) | |
2216 | # version_compare 20.10 19.03 // 0 (success) |
|
2216 | # version_compare 20.10 19.03 // 0 (success) | |
2217 | # version_compare 20.10 20.10 // 0 (success) |
|
2217 | # version_compare 20.10 20.10 // 0 (success) | |
2218 | # version_compare 19.03 20.10 // 1 (fail) |
|
2218 | # version_compare 19.03 20.10 // 1 (fail) | |
2219 | version_compare() ( |
|
2219 | version_compare() ( | |
2220 | set +x |
|
2220 | set +x | |
2221 |
|
2221 | |||
2222 | yy_a="$(echo "$1" | cut -d'.' -f1)" |
|
2222 | yy_a="$(echo "$1" | cut -d'.' -f1)" | |
2223 | yy_b="$(echo "$2" | cut -d'.' -f1)" |
|
2223 | yy_b="$(echo "$2" | cut -d'.' -f1)" | |
2224 | if [ "$yy_a" -lt "$yy_b" ]; then |
|
2224 | if [ "$yy_a" -lt "$yy_b" ]; then | |
2225 | return 1 |
|
2225 | return 1 | |
2226 | fi |
|
2226 | fi | |
2227 | if [ "$yy_a" -gt "$yy_b" ]; then |
|
2227 | if [ "$yy_a" -gt "$yy_b" ]; then | |
2228 | return 0 |
|
2228 | return 0 | |
2229 | fi |
|
2229 | fi | |
2230 | mm_a="$(echo "$1" | cut -d'.' -f2)" |
|
2230 | mm_a="$(echo "$1" | cut -d'.' -f2)" | |
2231 | mm_b="$(echo "$2" | cut -d'.' -f2)" |
|
2231 | mm_b="$(echo "$2" | cut -d'.' -f2)" | |
2232 |
|
2232 | |||
2233 | # trim leading zeros to accommodate CalVer |
|
2233 | # trim leading zeros to accommodate CalVer | |
2234 | mm_a="${mm_a#0}" |
|
2234 | mm_a="${mm_a#0}" | |
2235 | mm_b="${mm_b#0}" |
|
2235 | mm_b="${mm_b#0}" | |
2236 |
|
2236 | |||
2237 | if [ "${mm_a:-0}" -lt "${mm_b:-0}" ]; then |
|
2237 | if [ "${mm_a:-0}" -lt "${mm_b:-0}" ]; then | |
2238 | return 1 |
|
2238 | return 1 | |
2239 | fi |
|
2239 | fi | |
2240 |
|
2240 | |||
2241 | return 0 |
|
2241 | return 0 | |
2242 | ) |
|
2242 | ) | |
2243 |
|
2243 | |||
2244 | # consistent sed function |
|
2244 | # consistent sed function | |
2245 | # example sed_func x y file.txt |
|
2245 | # example sed_func x y file.txt | |
2246 | sed_func() { |
|
2246 | sed_func() { | |
2247 | if [[ $DEBUG ]]; then |
|
2247 | if [[ $DEBUG ]]; then | |
2248 | echo |
|
2248 | echo | |
2249 | echo "sed -i .replaced -E \"s/$1/$2/\" $in_file" |
|
2249 | echo "sed -i .replaced -E \"s/$1/$2/\" $in_file" | |
2250 | echo "pat1: $1" |
|
2250 | echo "pat1: $1" | |
2251 | echo "pat2: $2" |
|
2251 | echo "pat2: $2" | |
2252 | fi |
|
2252 | fi | |
2253 |
|
2253 | |||
2254 | in_file=$3 |
|
2254 | in_file=$3 | |
2255 | sed -i.replaced -E "s/$1/$2/" $in_file |
|
2255 | sed -i.replaced -E "s/$1/$2/" $in_file | |
2256 | } |
|
2256 | } | |
2257 |
|
2257 | |||
2258 | # create a slug from a name |
|
2258 | # create a slug from a name | |
2259 | slugify() { |
|
2259 | slugify() { | |
2260 | local input="$1" |
|
2260 | local input="$1" | |
2261 | local slug |
|
2261 | local slug | |
2262 |
|
2262 | |||
2263 | # Convert to lowercase |
|
2263 | # Convert to lowercase | |
2264 | slug="${input,,}" |
|
2264 | slug="${input,,}" | |
2265 |
|
2265 | |||
2266 | # Replace slashes with underscores |
|
2266 | # Replace slashes with underscores | |
2267 | slug="${slug//\//_}" |
|
2267 | slug="${slug//\//_}" | |
2268 |
|
2268 | |||
2269 | # Replace spaces with hyphens |
|
2269 | # Replace spaces with hyphens | |
2270 | slug="${slug// /_}" |
|
2270 | slug="${slug// /_}" | |
2271 |
|
2271 | |||
2272 | # Remove characters that are not letters, numbers, or hyphens, or underscores |
|
2272 | # Remove characters that are not letters, numbers, or hyphens, or underscores | |
2273 | slug="${slug//[^a-zA-Z0-9-_]/}" |
|
2273 | slug="${slug//[^a-zA-Z0-9-_]/}" | |
2274 |
|
2274 | |||
2275 | echo "$slug" |
|
2275 | echo "$slug" | |
2276 | } |
|
2276 | } | |
2277 |
|
2277 | |||
2278 | check_os() { |
|
2278 | check_os() { | |
2279 | echo `uname -s` |
|
2279 | echo `uname -s` | |
2280 | } |
|
2280 | } | |
2281 |
|
2281 | |||
2282 | check_macos_memory() { |
|
2282 | check_macos_memory() { | |
2283 | echo $(($(memory_pressure | head -n 1 | awk '{ print $4 }') / 1024 / 1024 / 1024)) |
|
2283 | echo $(($(memory_pressure | head -n 1 | awk '{ print $4 }') / 1024 / 1024 / 1024)) | |
2284 | } |
|
2284 | } | |
2285 |
|
2285 | |||
2286 | check_linux_memory() { |
|
2286 | check_linux_memory() { | |
2287 | mem=`free -m --si | awk ' /Mem:/ {print $2}'` |
|
2287 | mem=`free -m --si | awk ' /Mem:/ {print $2}'` | |
2288 | if [ "$mem" -ge 990 -a "$mem" -lt 1000 ]; then |
|
2288 | if [ "$mem" -ge 990 -a "$mem" -lt 1000 ]; then | |
2289 | echo 1 |
|
2289 | echo 1 | |
2290 | else |
|
2290 | else | |
2291 | echo `free -g --si | awk ' /Mem:/ {print $2} '` |
|
2291 | echo `free -g --si | awk ' /Mem:/ {print $2} '` | |
2292 | fi |
|
2292 | fi | |
2293 | } |
|
2293 | } | |
2294 |
|
2294 | |||
2295 | # src/lib/validate_stack_exists.sh |
|
2295 | # src/lib/validate_stack_exists.sh | |
2296 |
|
2296 | |||
2297 | validate_stack_exists() { |
|
2297 | validate_stack_exists() { | |
2298 | err="" |
|
2298 | err="" | |
2299 | invalid="1" |
|
2299 | invalid="1" | |
2300 |
|
2300 | |||
2301 | for item in $VALID_SERVICES |
|
2301 | for item in $VALID_SERVICES | |
2302 | do |
|
2302 | do | |
2303 | if [ "$1" == "$item" ]; then |
|
2303 | if [ "$1" == "$item" ]; then | |
2304 | invalid="" |
|
2304 | invalid="" | |
2305 | break |
|
2305 | break | |
2306 | fi |
|
2306 | fi | |
2307 | done |
|
2307 | done | |
2308 |
|
2308 | |||
2309 | if [[ -n $invalid ]]; then |
|
2309 | if [[ -n $invalid ]]; then | |
2310 | err="command '$1' not in list of $VALID_SERVICES" |
|
2310 | err="command '$1' not in list of $VALID_SERVICES" | |
2311 | fi |
|
2311 | fi | |
2312 |
|
2312 | |||
2313 | echo $err |
|
2313 | echo $err | |
2314 | } |
|
2314 | } | |
2315 |
|
2315 | |||
2316 | # src/lib/validations/validate_dir_exists.sh |
|
2316 | # src/lib/validations/validate_dir_exists.sh | |
2317 | validate_dir_exists() { |
|
2317 | validate_dir_exists() { | |
2318 | [[ -d "$1" ]] || echo "must be an existing directory" |
|
2318 | [[ -d "$1" ]] || echo "must be an existing directory" | |
2319 | } |
|
2319 | } | |
2320 |
|
2320 | |||
2321 | # src/lib/validations/validate_file_exists.sh |
|
2321 | # src/lib/validations/validate_file_exists.sh | |
2322 | validate_file_exists() { |
|
2322 | validate_file_exists() { | |
2323 | [[ -f "$1" ]] || echo "must be an existing file" |
|
2323 | [[ -f "$1" ]] || echo "must be an existing file" | |
2324 | } |
|
2324 | } | |
2325 |
|
2325 | |||
2326 | # src/lib/validations/validate_integer.sh |
|
2326 | # src/lib/validations/validate_integer.sh | |
2327 | validate_integer() { |
|
2327 | validate_integer() { | |
2328 | [[ "$1" =~ ^[0-9]+$ ]] || echo "must be an integer" |
|
2328 | [[ "$1" =~ ^[0-9]+$ ]] || echo "must be an integer" | |
2329 | } |
|
2329 | } | |
2330 |
|
2330 | |||
2331 | # src/lib/validations/validate_not_empty.sh |
|
2331 | # src/lib/validations/validate_not_empty.sh | |
2332 | validate_not_empty() { |
|
2332 | validate_not_empty() { | |
2333 | [[ -z "$1" ]] && echo "must not be empty" |
|
2333 | [[ -z "$1" ]] && echo "must not be empty" | |
2334 | } |
|
2334 | } | |
2335 |
|
2335 | |||
2336 | # :command.command_functions |
|
2336 | # :command.command_functions | |
2337 | # :command.function |
|
2337 | # :command.function | |
2338 | rcstack_get_started_command() { |
|
2338 | rcstack_get_started_command() { | |
2339 | # src/get_started_command.sh |
|
2339 | # src/get_started_command.sh | |
2340 | get_started_full |
|
2340 | get_started_full | |
2341 | } |
|
2341 | } | |
2342 |
|
2342 | |||
2343 | # :command.function |
|
2343 | # :command.function | |
2344 | rcstack_init_command() { |
|
2344 | rcstack_init_command() { | |
2345 | # src/init_command.sh |
|
2345 | # src/init_command.sh | |
2346 | DEBUG=${args[--debug]} |
|
2346 | DEBUG=${args[--debug]} | |
2347 | force=${args[--force]} |
|
2347 | force=${args[--force]} | |
2348 | docker_revision=${args[--docker-revision]} |
|
2348 | docker_revision=${args[--docker-revision]} | |
2349 | install_docker=${args[--install-docker]} |
|
2349 | install_docker=${args[--install-docker]} | |
2350 | no_prompt=${args[--no-prompt]} |
|
2350 | no_prompt=${args[--no-prompt]} | |
2351 |
|
2351 | |||
2352 | eval "stages_from_cli=(${args[--stage]})" |
|
2352 | eval "stages_from_cli=(${args[--stage]})" | |
2353 |
|
2353 | |||
2354 | # CLI passed args / defaults |
|
2354 | # CLI passed args / defaults | |
2355 |
|
2355 | |||
2356 | if [[ -z ${args['--arg-rc-edition']} ]]; then |
|
2356 | if [[ -z ${args['--arg-rc-edition']} ]]; then | |
2357 | # set default |
|
2357 | # set default | |
2358 | args['--arg-rc-edition']="ee" |
|
2358 | args['--arg-rc-edition']="ee" | |
2359 | else |
|
2359 | else | |
2360 | # mark we used flag and don't ask in prompts |
|
2360 | # mark we used flag and don't ask in prompts | |
2361 | args['__arg_rc_edition']=1 |
|
2361 | args['__arg_rc_edition']=1 | |
2362 | fi |
|
2362 | fi | |
2363 |
|
2363 | |||
2364 | if [[ -z ${args['--arg-accept-eula']} ]]; then |
|
2364 | if [[ -z ${args['--arg-accept-eula']} ]]; then | |
2365 | # set default |
|
2365 | # set default | |
2366 | args['--arg-accept-eula']="yes" |
|
2366 | args['--arg-accept-eula']="yes" | |
2367 | else |
|
2367 | else | |
2368 | # mark we used flag and don't ask in prompts |
|
2368 | # mark we used flag and don't ask in prompts | |
2369 | args['__arg_accept_eula']=1 |
|
2369 | args['__arg_accept_eula']=1 | |
2370 | fi |
|
2370 | fi | |
2371 |
|
2371 | |||
2372 | if [[ -z ${args['--arg-hostname']} ]]; then |
|
2372 | if [[ -z ${args['--arg-hostname']} ]]; then | |
2373 | # set default |
|
2373 | # set default | |
2374 | args['--arg-hostname']="rhodecode.local" |
|
2374 | args['--arg-hostname']="rhodecode.local" | |
2375 | else |
|
2375 | else | |
2376 | # mark we used flag and don't ask in prompts |
|
2376 | # mark we used flag and don't ask in prompts | |
2377 | args['__arg_hostname']=1 |
|
2377 | args['__arg_hostname']=1 | |
2378 | fi |
|
2378 | fi | |
2379 |
|
2379 | |||
2380 | if [[ -z ${args['--arg-use-ssl']} ]]; then |
|
2380 | if [[ -z ${args['--arg-use-ssl']} ]]; then | |
2381 | # set default |
|
2381 | # set default | |
2382 | args['--arg-use-ssl']="n" |
|
2382 | args['--arg-use-ssl']="n" | |
2383 | else |
|
2383 | else | |
2384 | # mark we used flag and don't ask in prompts |
|
2384 | # mark we used flag and don't ask in prompts | |
2385 | args['__arg_use_ssl']=1 |
|
2385 | args['__arg_use_ssl']=1 | |
2386 | fi |
|
2386 | fi | |
2387 |
|
2387 | |||
2388 | if [[ -z ${args['--arg-admin-email']} ]]; then |
|
2388 | if [[ -z ${args['--arg-admin-email']} ]]; then | |
2389 | # set default |
|
2389 | # set default | |
2390 | args['--arg-admin-email']="admin@${args['--arg-hostname']}" |
|
2390 | args['--arg-admin-email']="admin@${args['--arg-hostname']}" | |
2391 | else |
|
2391 | else | |
2392 | # mark we used flag and don't ask in prompts |
|
2392 | # mark we used flag and don't ask in prompts | |
2393 | args['__arg_admin_email']=1 |
|
2393 | args['__arg_admin_email']=1 | |
2394 | fi |
|
2394 | fi | |
2395 |
|
2395 | |||
2396 | if [[ -z ${args['--arg-admin-user']} ]]; then |
|
2396 | if [[ -z ${args['--arg-admin-user']} ]]; then | |
2397 | # set default |
|
2397 | # set default | |
2398 | args['--arg-admin-user']="admin" |
|
2398 | args['--arg-admin-user']="admin" | |
2399 | else |
|
2399 | else | |
2400 | # mark we used flag and don't ask in prompts |
|
2400 | # mark we used flag and don't ask in prompts | |
2401 | args['__arg_admin_user']=1 |
|
2401 | args['__arg_admin_user']=1 | |
2402 | fi |
|
2402 | fi | |
2403 |
|
2403 | |||
2404 | if [[ -z ${args['--arg-admin-pass']} ]]; then |
|
2404 | if [[ -z ${args['--arg-admin-pass']} ]]; then | |
2405 | # set default |
|
2405 | # set default | |
2406 | args['--arg-admin-pass']="secret4" |
|
2406 | args['--arg-admin-pass']="secret4" | |
2407 | else |
|
2407 | else | |
2408 | # mark we used flag and don't ask in prompts |
|
2408 | # mark we used flag and don't ask in prompts | |
2409 | args['__arg_admin_pass']=1 |
|
2409 | args['__arg_admin_pass']=1 | |
2410 | fi |
|
2410 | fi | |
2411 |
|
2411 | |||
2412 | if [[ -z ${args['--arg-license-token']} ]]; then |
|
2412 | if [[ -z ${args['--arg-license-token']} ]]; then | |
2413 | # set default |
|
2413 | # set default | |
2414 | args['--arg-license-token']="$(random_str 4)"-"$(random_str 4)"-"$(random_str 4)"-"$(random_str 4)" |
|
2414 | args['--arg-license-token']="$(random_str 4)"-"$(random_str 4)"-"$(random_str 4)"-"$(random_str 4)" | |
2415 | else |
|
2415 | else | |
2416 | # mark we used flag and don't ask in prompts |
|
2416 | # mark we used flag and don't ask in prompts | |
2417 | args['__arg_license_token']=1 |
|
2417 | args['__arg_license_token']=1 | |
2418 | fi |
|
2418 | fi | |
2419 |
|
2419 | |||
2420 | if [[ -z ${args['--arg-log-formatter']} ]]; then |
|
2420 | if [[ -z ${args['--arg-log-formatter']} ]]; then | |
2421 | # set default |
|
2421 | # set default | |
2422 | args['--arg-log-formatter']="json" |
|
2422 | args['--arg-log-formatter']="json" | |
2423 | else |
|
2423 | else | |
2424 | # mark we used flag and don't ask in prompts |
|
2424 | # mark we used flag and don't ask in prompts | |
2425 | args['__arg_log_formatter']=1 |
|
2425 | args['__arg_log_formatter']=1 | |
2426 | fi |
|
2426 | fi | |
2427 |
|
2427 | |||
2428 | arg_rc_edition=${args[--arg-rc-edition]} |
|
2428 | arg_rc_edition=${args[--arg-rc-edition]} | |
2429 | arg_accept_eula=${args[--arg-accept-eula]} |
|
2429 | arg_accept_eula=${args[--arg-accept-eula]} | |
2430 | arg_hostname=${args[--arg-hostname]} |
|
2430 | arg_hostname=${args[--arg-hostname]} | |
2431 | arg_use_ssl=${args[--arg-use-ssl]} |
|
2431 | arg_use_ssl=${args[--arg-use-ssl]} | |
2432 | arg_admin_email=${args[--arg-admin-email]} |
|
2432 | arg_admin_email=${args[--arg-admin-email]} | |
2433 | arg_admin_user=${args[--arg-admin-user]} |
|
2433 | arg_admin_user=${args[--arg-admin-user]} | |
2434 | arg_admin_pass=${args[--arg-admin-pass]} |
|
2434 | arg_admin_pass=${args[--arg-admin-pass]} | |
2435 | arg_license_token=${args[--arg-license-token]} |
|
2435 | arg_license_token=${args[--arg-license-token]} | |
2436 | arg_log_formatter=${args[--arg-log-formatter]} |
|
2436 | arg_log_formatter=${args[--arg-log-formatter]} | |
2437 |
|
2437 | |||
2438 | ask_user_for_config() { |
|
2438 | ask_user_for_config() { | |
2439 | local config_done="n" |
|
2439 | local config_done="n" | |
2440 |
|
2440 | |||
2441 | echo "Starting interactive setup..." |
|
2441 | echo "Starting interactive setup..." | |
2442 | echo "" |
|
2442 | echo "" | |
2443 |
|
2443 | |||
2444 | while [[ "$config_done" == "n" ]] |
|
2444 | while [[ "$config_done" == "n" ]] | |
2445 | # config loop start |
|
2445 | # config loop start | |
2446 | do |
|
2446 | do | |
2447 | # edition to install |
|
2447 | # edition to install | |
2448 | if [ ! -z "$arg_rc_edition" ] && [ -z ${args['__arg_rc_edition']} ] |
|
2448 | if [ ! -z "$arg_rc_edition" ] && [ -z ${args['__arg_rc_edition']} ] | |
2449 | then |
|
2449 | then | |
2450 | read -p "Select 'ee' to use Enterprise edition or type 'ce' to use Community free edition: rhodecode-[$arg_rc_edition]: " new_value |
|
2450 | read -p "Select 'ee' to use Enterprise edition or type 'ce' to use Community free edition: rhodecode-[$arg_rc_edition]: " new_value | |
2451 | if [ ! -z "$new_value" ] |
|
2451 | if [ ! -z "$new_value" ] | |
2452 | then |
|
2452 | then | |
2453 | arg_rc_edition="$new_value" |
|
2453 | arg_rc_edition="$new_value" | |
2454 | fi |
|
2454 | fi | |
2455 | fi |
|
2455 | fi | |
2456 |
|
2456 | |||
2457 | if [ ! -z "$arg_accept_eula" ] && [ -z ${args['__arg_accept_eula']} ] |
|
2457 | if [ ! -z "$arg_accept_eula" ] && [ -z ${args['__arg_accept_eula']} ] | |
2458 | then |
|
2458 | then | |
2459 | if [[ $arg_rc_edition == "ee" ]]; then |
|
2459 | if [[ $arg_rc_edition == "ee" ]]; then | |
2460 | #EE EULA |
|
2460 | #EE EULA | |
2461 | 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 |
|
2461 | 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 | |
2462 | else |
|
2462 | else | |
2463 | #CE EULA |
|
2463 | #CE EULA | |
2464 | 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 |
|
2464 | 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 | |
2465 | fi |
|
2465 | fi | |
2466 |
|
2466 | |||
2467 | if [ ! -z "$new_value" ] |
|
2467 | if [ ! -z "$new_value" ] | |
2468 | then |
|
2468 | then | |
2469 | arg_accept_eula="$new_value" |
|
2469 | arg_accept_eula="$new_value" | |
2470 | fi |
|
2470 | fi | |
2471 |
|
2471 | |||
2472 | if [[ $arg_accept_eula != "yes" ]]; then |
|
2472 | if [[ $arg_accept_eula != "yes" ]]; then | |
2473 | echo "$(red please accept EULA by typing yes, no installation is possible without accepted EULA)" |
|
2473 | echo "$(red please accept EULA by typing yes, no installation is possible without accepted EULA)" | |
2474 | exit |
|
2474 | exit | |
2475 | fi |
|
2475 | fi | |
2476 | fi |
|
2476 | fi | |
2477 |
|
2477 | |||
2478 | # ask for license-token IF edition is ee |
|
2478 | # ask for license-token IF edition is ee | |
2479 | if [[ $arg_rc_edition == "ee" ]]; then |
|
2479 | if [[ $arg_rc_edition == "ee" ]]; then | |
2480 | if [ ! -z "$arg_license_token" ] && [ -z ${args['__arg_license_token']} ] |
|
2480 | if [ ! -z "$arg_license_token" ] && [ -z ${args['__arg_license_token']} ] | |
2481 | then |
|
2481 | then | |
2482 | read -p "enter a valid license-token or use pre-generated one [$arg_license_token]: " new_value |
|
2482 | read -p "enter a valid license-token or use pre-generated one [$arg_license_token]: " new_value | |
2483 | if [ ! -z "$new_value" ] |
|
2483 | if [ ! -z "$new_value" ] | |
2484 | then |
|
2484 | then | |
2485 | arg_license_token="$new_value" |
|
2485 | arg_license_token="$new_value" | |
2486 | fi |
|
2486 | fi | |
2487 | fi |
|
2487 | fi | |
2488 | fi |
|
2488 | fi | |
2489 |
|
2489 | |||
2490 | # hostname |
|
2490 | # hostname | |
2491 | if [ ! -z "$arg_hostname" ] && [ -z ${args['__arg_hostname']} ] |
|
2491 | if [ ! -z "$arg_hostname" ] && [ -z ${args['__arg_hostname']} ] | |
2492 | then |
|
2492 | then | |
2493 | read -p "Enter a valid hostname for RhodeCode Stack? [$arg_hostname]: " new_value |
|
2493 | read -p "Enter a valid hostname for RhodeCode Stack? [$arg_hostname]: " new_value | |
2494 | if [ ! -z "$new_value" ] |
|
2494 | if [ ! -z "$new_value" ] | |
2495 | then |
|
2495 | then | |
2496 | arg_hostname="$new_value" |
|
2496 | arg_hostname="$new_value" | |
2497 | fi |
|
2497 | fi | |
2498 | if [[ $arg_hostname =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]] |
|
2498 | if [[ $arg_hostname =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]] | |
2499 | then |
|
2499 | then | |
2500 | echo |
|
2500 | echo | |
2501 | echo "$(red IP addresses are unsupported and will not work. Please provide a DNS hostname)" |
|
2501 | echo "$(red IP addresses are unsupported and will not work. Please provide a DNS hostname)" | |
2502 | echo |
|
2502 | echo | |
2503 | arg_hostname="rc-docker.local" |
|
2503 | arg_hostname="rc-docker.local" | |
2504 | fi |
|
2504 | fi | |
2505 | fi |
|
2505 | fi | |
2506 |
|
2506 | |||
2507 | # use SSL |
|
2507 | # use SSL | |
2508 | if [ ! -z "$arg_use_ssl" ] && [ -z ${args['__arg_use_ssl']} ] |
|
2508 | if [ ! -z "$arg_use_ssl" ] && [ -z ${args['__arg_use_ssl']} ] | |
2509 | then |
|
2509 | then | |
2510 | 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 |
|
2510 | 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 | |
2511 | if [ ! -z "$new_value" ] |
|
2511 | if [ ! -z "$new_value" ] | |
2512 | then |
|
2512 | then | |
2513 | arg_use_ssl="$new_value" |
|
2513 | arg_use_ssl="$new_value" | |
2514 | fi |
|
2514 | fi | |
2515 | fi |
|
2515 | fi | |
2516 |
|
2516 | |||
2517 | # admin email |
|
2517 | # admin email | |
2518 | if [ ! -z "$arg_admin_email" ] && [ -z ${args['__arg_admin_email']} ] |
|
2518 | if [ ! -z "$arg_admin_email" ] && [ -z ${args['__arg_admin_email']} ] | |
2519 | then |
|
2519 | then | |
2520 | read -p "Enter first super-admin email? [$arg_admin_email]: " new_value |
|
2520 | read -p "Enter first super-admin email? [$arg_admin_email]: " new_value | |
2521 | if [ ! -z "$new_value" ] |
|
2521 | if [ ! -z "$new_value" ] | |
2522 | then |
|
2522 | then | |
2523 | arg_admin_email="$new_value" |
|
2523 | arg_admin_email="$new_value" | |
2524 | fi |
|
2524 | fi | |
2525 | fi |
|
2525 | fi | |
2526 |
|
2526 | |||
2527 | # admin user |
|
2527 | # admin user | |
2528 | if [ ! -z "$arg_admin_user" ] && [ -z ${args['__arg_admin_user']} ] |
|
2528 | if [ ! -z "$arg_admin_user" ] && [ -z ${args['__arg_admin_user']} ] | |
2529 | then |
|
2529 | then | |
2530 | read -p "Enter first super-admin account name? [$arg_admin_user]: " new_value |
|
2530 | read -p "Enter first super-admin account name? [$arg_admin_user]: " new_value | |
2531 | if [ ! -z "$new_value" ] |
|
2531 | if [ ! -z "$new_value" ] | |
2532 | then |
|
2532 | then | |
2533 | arg_admin_user="$new_value" |
|
2533 | arg_admin_user="$new_value" | |
2534 | fi |
|
2534 | fi | |
2535 | fi |
|
2535 | fi | |
2536 |
|
2536 | |||
2537 | # admin password |
|
2537 | # admin password | |
2538 | if [ ! -z "$arg_admin_pass" ] && [ -z ${args['__arg_admin_pass']} ] |
|
2538 | if [ ! -z "$arg_admin_pass" ] && [ -z ${args['__arg_admin_pass']} ] | |
2539 | then |
|
2539 | then | |
2540 | read -p "Enter first super-admin account password? [$arg_admin_pass]: " new_value |
|
2540 | read -p "Enter first super-admin account password? [$arg_admin_pass]: " new_value | |
2541 | if [ ! -z "$new_value" ] |
|
2541 | if [ ! -z "$new_value" ] | |
2542 | then |
|
2542 | then | |
2543 | arg_admin_pass="$new_value" |
|
2543 | arg_admin_pass="$new_value" | |
2544 | fi |
|
2544 | fi | |
2545 | fi |
|
2545 | fi | |
2546 |
|
2546 | |||
2547 | echo -e "\nDoes this look right?\n" |
|
2547 | echo -e "\nDoes this look right?\n" | |
2548 | echo "RhodeCode Edition : rhodecode-$arg_rc_edition" |
|
2548 | echo "RhodeCode Edition : rhodecode-$arg_rc_edition" | |
2549 | echo "License Token : $arg_license_token" |
|
2549 | echo "License Token : $arg_license_token" | |
2550 | echo "Hostname : $arg_hostname" |
|
2550 | echo "Hostname : $arg_hostname" | |
2551 | echo "Use SSL : $arg_use_ssl" |
|
2551 | echo "Use SSL : $arg_use_ssl" | |
2552 | echo "Email : $arg_admin_email" |
|
2552 | echo "Email : $arg_admin_email" | |
2553 | echo "Admin user : $arg_admin_user" |
|
2553 | echo "Admin user : $arg_admin_user" | |
2554 | echo "Admin password : $arg_admin_pass" |
|
2554 | echo "Admin password : $arg_admin_pass" | |
2555 | echo "" |
|
2555 | echo "" | |
2556 | read -p "ENTER to continue, 'n' to try again, Ctrl+C to exit: " config_done |
|
2556 | read -p "ENTER to continue, 'n' to try again, Ctrl+C to exit: " config_done | |
2557 |
|
2557 | |||
2558 | # config loop end |
|
2558 | # config loop end | |
2559 | done |
|
2559 | done | |
2560 |
|
2560 | |||
2561 | } |
|
2561 | } | |
2562 |
|
2562 | |||
2563 | check_docker() { |
|
2563 | check_docker() { | |
2564 | (which docker || which docker.io) &>/dev/null |
|
2564 | (which docker || which docker.io) &>/dev/null | |
2565 | } |
|
2565 | } | |
2566 |
|
2566 | |||
2567 | bootstrap_docker_install() { |
|
2567 | bootstrap_docker_install() { | |
2568 | # systemctl enable docker on debian |
|
2568 | # systemctl enable docker on debian | |
2569 | echo "bootstrap_docker_install: trying to check and configure docker" |
|
2569 | echo "bootstrap_docker_install: trying to check and configure docker" | |
2570 | failMsg="Failed to find docker on your PATH" |
|
2570 | failMsg="Failed to find docker on your PATH" | |
2571 |
|
2571 | |||
2572 | if ! check_docker; then |
|
2572 | if ! check_docker; then | |
2573 |
|
2573 | |||
2574 | if [[ $install_docker == "n" ]]; then |
|
2574 | if [[ $install_docker == "n" ]]; then | |
2575 | echo "$(red $failMsg, exiting without docker install)" |
|
2575 | echo "$(red $failMsg, exiting without docker install)" | |
2576 | fi |
|
2576 | fi | |
2577 |
|
2577 | |||
2578 | echo "$(yellow $failMsg, trying docker install)" |
|
2578 | echo "$(yellow $failMsg, trying docker install)" | |
2579 |
|
2579 | |||
2580 | if [[ $install_docker == "y" ]]; then |
|
2580 | if [[ $install_docker == "y" ]]; then | |
2581 | echo "continuing with automated docker installation from https://get.docker.com/ " |
|
2581 | echo "continuing with automated docker installation from https://get.docker.com/ " | |
2582 | else |
|
2582 | else | |
2583 | read -p "Enter to install Docker directly from https://get.docker.com/ or Ctrl+C to exit and install it manually" |
|
2583 | read -p "Enter to install Docker directly from https://get.docker.com/ or Ctrl+C to exit and install it manually" | |
2584 | fi |
|
2584 | fi | |
2585 |
|
2585 | |||
2586 | curl -fsSL https://get.docker.com -o install-docker.sh |
|
2586 | curl -fsSL https://get.docker.com -o install-docker.sh | |
2587 | sh install-docker.sh |
|
2587 | sh install-docker.sh | |
2588 | rm install-docker.sh |
|
2588 | rm install-docker.sh | |
2589 |
|
2589 | |||
2590 | if ! check_docker; then |
|
2590 | if ! check_docker; then | |
2591 | echo "$failMsg" |
|
2591 | echo "$failMsg" | |
2592 | echo "Docker install failed. Quitting." |
|
2592 | echo "Docker install failed. Quitting." | |
2593 | exit 1 |
|
2593 | exit 1 | |
2594 | fi |
|
2594 | fi | |
2595 |
|
2595 | |||
2596 | docker --version |
|
2596 | docker --version | |
2597 |
|
2597 | |||
2598 | fi |
|
2598 | fi | |
2599 | } |
|
2599 | } | |
2600 |
|
2600 | |||
2601 | bootstrap_docker_commons() { |
|
2601 | bootstrap_docker_commons() { | |
2602 |
|
2602 | |||
2603 | echo 'bootstrap_docker_commons: running docker commands.' |
|
2603 | echo 'bootstrap_docker_commons: running docker commands.' | |
2604 |
|
2604 | |||
2605 | echo "bootstrap_docker_commons: creating volume 'rc_datavolume'" |
|
2605 | echo "bootstrap_docker_commons: creating volume 'rc_datavolume'" | |
2606 | docker volume create --label keep=1 --name=rc_datavolume |
|
2606 | docker volume create --label keep=1 --name=rc_datavolume | |
2607 | echo "bootstrap_docker_commons (rc_datavolume): done" |
|
2607 | echo "bootstrap_docker_commons (rc_datavolume): done" | |
2608 | echo "" |
|
2608 | echo "" | |
2609 |
|
2609 | |||
2610 | echo "bootstrap_docker_commons: creating volume 'rc_reposvolume'" |
|
2610 | echo "bootstrap_docker_commons: creating volume 'rc_reposvolume'" | |
2611 | docker volume create --label keep=1 --name=rc_reposvolume |
|
2611 | docker volume create --label keep=1 --name=rc_reposvolume | |
2612 | echo "bootstrap_docker_commons (rc_reposvolume): done" |
|
2612 | echo "bootstrap_docker_commons (rc_reposvolume): done" | |
2613 | echo "" |
|
2613 | echo "" | |
2614 |
|
2614 | |||
2615 | echo "bootstrap_docker_commons: creating network 'rhodecode_network'" |
|
2615 | echo "bootstrap_docker_commons: creating network 'rhodecode_network'" | |
2616 | docker network inspect rhodecode_network >/dev/null 2>&1 || docker network create rhodecode_network |
|
2616 | docker network inspect rhodecode_network >/dev/null 2>&1 || docker network create rhodecode_network | |
2617 | echo "bootstrap_docker_commons (rhodecode_network): done" |
|
2617 | echo "bootstrap_docker_commons (rhodecode_network): done" | |
2618 | echo "" |
|
2618 | echo "" | |
2619 |
|
2619 | |||
2620 | echo "bootstrap_docker_commons: creating loki logging" |
|
2620 | echo "bootstrap_docker_commons: creating loki logging" | |
2621 | loki_driver=$(docker plugin ls --format {{.Name}} --filter enabled=true | grep loki || echo "") |
|
2621 | loki_driver=$(docker plugin ls --format {{.Name}} --filter enabled=true | grep loki || echo "") | |
2622 | if [[ $loki_driver == "" ]]; then |
|
2622 | if [[ $loki_driver == "" ]]; then | |
2623 | docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions |
|
2623 | docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions | |
2624 | else |
|
2624 | else | |
2625 | echo "bootstrap_docker_commons: loki driver already exists" |
|
2625 | echo "bootstrap_docker_commons: loki driver already exists" | |
2626 | fi |
|
2626 | fi | |
2627 | } |
|
2627 | } | |
2628 |
|
2628 | |||
2629 | config_init() { |
|
2629 | config_init() { | |
2630 | loc_config_file=${CONFIG_FILE:=config.ini} |
|
2630 | loc_config_file=${CONFIG_FILE:=config.ini} | |
2631 | [[ -f "$loc_config_file" ]] || touch "$loc_config_file" |
|
2631 | [[ -f "$loc_config_file" ]] || touch "$loc_config_file" | |
2632 | } |
|
2632 | } | |
2633 |
|
2633 | |||
2634 | bootstrap_config() { |
|
2634 | bootstrap_config() { | |
2635 | shared_key=$(random_str 32) |
|
2635 | shared_key=$(random_str 32) | |
2636 | shared_key_md5=$(generate_md5 $shared_key | head -c 32) |
|
2636 | shared_key_md5=$(generate_md5 $shared_key | head -c 32) | |
2637 | db_key=$(random_str 32) |
|
2637 | db_key=$(random_str 32) | |
2638 |
|
2638 | |||
2639 | if [[ ! $no_prompt ]]; then |
|
2639 | if [[ ! $no_prompt ]]; then | |
2640 | ask_user_for_config |
|
2640 | ask_user_for_config | |
2641 | fi |
|
2641 | fi | |
2642 |
|
2642 | |||
2643 | # setup args |
|
2643 | # setup args | |
2644 | license_token=$arg_license_token |
|
2644 | license_token=$arg_license_token | |
2645 | log_formatter=$arg_log_formatter |
|
2645 | log_formatter=$arg_log_formatter | |
2646 | base_domain=$arg_hostname |
|
2646 | base_domain=$arg_hostname | |
2647 | rc_edition=$arg_rc_edition |
|
2647 | rc_edition=$arg_rc_edition | |
2648 |
|
2648 | |||
2649 | is_https=0 |
|
2649 | is_https=0 | |
2650 | if [[ $arg_use_ssl == "y" ]]; then is_https=1; fi |
|
2650 | if [[ $arg_use_ssl == "y" ]]; then is_https=1; fi | |
2651 |
|
2651 | |||
2652 | DB_USER='rhodecode' |
|
2652 | DB_USER='rhodecode' | |
2653 | DB_NAME='rhodecode' |
|
2653 | DB_NAME='rhodecode' | |
2654 |
|
2654 | |||
2655 | if [[ ! -f "$CONFIG_FILE" ]]; then |
|
2655 | if [[ ! -f "$CONFIG_FILE" ]]; then | |
2656 | echo "init new config at: $CONFIG_FILE" |
|
2656 | echo "init new config at: $CONFIG_FILE" | |
2657 | config_init |
|
2657 | config_init | |
2658 | else |
|
2658 | else | |
2659 | echo "re-using existing config at: $CONFIG_FILE" |
|
2659 | echo "re-using existing config at: $CONFIG_FILE" | |
2660 | fi |
|
2660 | fi | |
2661 |
|
2661 | |||
2662 | CUSTOM_DIR_PATH=$PWD/.custom |
|
2662 | CUSTOM_DIR_PATH=$PWD/.custom | |
2663 | mkdir -p "$CUSTOM_DIR_PATH" |
|
2663 | mkdir -p "$CUSTOM_DIR_PATH" | |
2664 | BOOTSTRAP_TMPL=$PWD/templates/runtime.env.tmpl |
|
2664 | BOOTSTRAP_TMPL=$PWD/templates/runtime.env.tmpl | |
2665 | BOOTSTRAP_RUNTIME_ENV=$PWD/.custom/.runtime.env |
|
2665 | BOOTSTRAP_RUNTIME_ENV=$PWD/.custom/.runtime.env | |
2666 |
|
2666 | |||
2667 | # TODO: Pick version |
|
2667 | # TODO: Pick version | |
2668 | ver=0_edge |
|
2668 | ver=0_edge | |
2669 | INI_TARGET=$PWD/config/_shared |
|
2669 | INI_TARGET=$PWD/config/_shared | |
2670 | RHODECODE_INI_TMPL=$PWD/templates/ini/$ver/rhodecode.ini |
|
2670 | RHODECODE_INI_TMPL=$PWD/templates/ini/$ver/rhodecode.ini | |
2671 | VCSSERVER_INI_TMPL=$PWD/templates/ini/$ver/vcsserver.ini |
|
2671 | VCSSERVER_INI_TMPL=$PWD/templates/ini/$ver/vcsserver.ini | |
2672 |
|
2672 | |||
2673 | # break if we didn't use force and definitions exist |
|
2673 | # break if we didn't use force and definitions exist | |
2674 | if [[ -f $BOOTSTRAP_RUNTIME_ENV && ! $force ]]; then |
|
2674 | if [[ -f $BOOTSTRAP_RUNTIME_ENV && ! $force ]]; then | |
2675 | echo "$(yellow bootstrap_config: $BOOTSTRAP_RUNTIME_ENV file exists, not adding any configuration. Use --force to create it anyway)" |
|
2675 | echo "$(yellow bootstrap_config: $BOOTSTRAP_RUNTIME_ENV file exists, not adding any configuration. Use --force to create it anyway)" | |
2676 | return |
|
2676 | return | |
2677 | fi |
|
2677 | fi | |
2678 |
|
2678 | |||
2679 | if [[ -f $BOOTSTRAP_RUNTIME_ENV ]]; then |
|
2679 | if [[ -f $BOOTSTRAP_RUNTIME_ENV ]]; then | |
2680 | echo "$(yellow $BOOTSTRAP_RUNTIME_ENV file exists, are you sure to force re-create it?)" |
|
2680 | echo "$(yellow $BOOTSTRAP_RUNTIME_ENV file exists, are you sure to force re-create it?)" | |
2681 | while true; do |
|
2681 | while true; do | |
2682 | read -p "Would you like to continue with overriding file? [yn] " yn |
|
2682 | read -p "Would you like to continue with overriding file? [yn] " yn | |
2683 | case $yn in |
|
2683 | case $yn in | |
2684 | [Yy]*) break ;; |
|
2684 | [Yy]*) break ;; | |
2685 | [Nn]*) exit ;; |
|
2685 | [Nn]*) exit ;; | |
2686 | *) echo "Please answer y or n." ;; |
|
2686 | *) echo "Please answer y or n." ;; | |
2687 | esac |
|
2687 | esac | |
2688 | done |
|
2688 | done | |
2689 | fi |
|
2689 | fi | |
2690 |
|
2690 | |||
2691 | echo "bootstrap_config: init runtime env config at: $BOOTSTRAP_RUNTIME_ENV" |
|
2691 | echo "bootstrap_config: init runtime env config at: $BOOTSTRAP_RUNTIME_ENV" | |
2692 |
|
2692 | |||
2693 | # Make runtime file |
|
2693 | # Make runtime file | |
2694 | echo "## BOOTSTRAP GENERATED $(date) ##" > $BOOTSTRAP_RUNTIME_ENV |
|
2694 | echo "## BOOTSTRAP GENERATED $(date) ##" > $BOOTSTRAP_RUNTIME_ENV | |
2695 | echo "" >> $BOOTSTRAP_RUNTIME_ENV |
|
2695 | echo "" >> $BOOTSTRAP_RUNTIME_ENV | |
2696 |
|
2696 | |||
2697 | cat $BOOTSTRAP_TMPL >> $BOOTSTRAP_RUNTIME_ENV |
|
2697 | cat $BOOTSTRAP_TMPL >> $BOOTSTRAP_RUNTIME_ENV | |
2698 |
|
2698 | |||
2699 | # Make .ini files |
|
2699 | # Make .ini files | |
2700 | cp -v $RHODECODE_INI_TMPL $INI_TARGET |
|
2700 | cp -v $RHODECODE_INI_TMPL $INI_TARGET | |
2701 | cp -v $VCSSERVER_INI_TMPL $INI_TARGET |
|
2701 | cp -v $VCSSERVER_INI_TMPL $INI_TARGET | |
2702 |
|
2702 | |||
2703 | # init env generator with env file |
|
2703 | # init env generator with env file | |
2704 | .env --file "$BOOTSTRAP_RUNTIME_ENV" |
|
2704 | .env --file "$BOOTSTRAP_RUNTIME_ENV" | |
2705 |
|
2705 | |||
2706 | .env set RC_EDITION=$rc_edition |
|
2706 | .env set RC_EDITION=$rc_edition | |
2707 | .env set DB_PASSWORD=$db_key |
|
2707 | .env set DB_PASSWORD=$db_key | |
2708 |
|
2708 | |||
2709 | .env set RHODECODE_USER_EMAIL=$arg_admin_email |
|
2709 | .env set RHODECODE_USER_EMAIL=$arg_admin_email | |
2710 | .env set RHODECODE_USER_NAME=$arg_admin_user |
|
2710 | .env set RHODECODE_USER_NAME=$arg_admin_user | |
2711 | .env set RHODECODE_USER_PASS=$arg_admin_pass |
|
2711 | .env set RHODECODE_USER_PASS=$arg_admin_pass | |
2712 |
|
2712 | |||
2713 | .env set RC_ENCRYPTED_SECRET=$shared_key |
|
2713 | .env set RC_ENCRYPTED_SECRET=$shared_key | |
2714 |
|
2714 | |||
2715 | rc_db1="postgresql://$DB_USER:$db_key@database/$DB_NAME" |
|
2715 | rc_db1="postgresql://$DB_USER:$db_key@database/$DB_NAME" | |
2716 | .env set RC_DB_URL="$rc_db1" |
|
2716 | .env set RC_DB_URL="$rc_db1" | |
2717 | .env set RC_SQLALCHEMY_DB1_URL="$rc_db1" |
|
2717 | .env set RC_SQLALCHEMY_DB1_URL="$rc_db1" | |
2718 |
|
2718 | |||
2719 | .env set RC_LICENSE_TOKEN=$license_token |
|
2719 | .env set RC_LICENSE_TOKEN=$license_token | |
2720 | .env set RC_HOSTNAME=$base_domain |
|
2720 | .env set RC_HOSTNAME=$base_domain | |
2721 |
|
2721 | |||
2722 | if [[ $is_https == 1 ]]; then |
|
2722 | if [[ $is_https == 1 ]]; then | |
2723 | app_base_url=https://$base_domain |
|
2723 | app_base_url=https://$base_domain | |
2724 | else |
|
2724 | else | |
2725 | app_base_url=http://$base_domain |
|
2725 | app_base_url=http://$base_domain | |
2726 | fi |
|
2726 | fi | |
2727 |
|
2727 | |||
2728 | .env set RC_APP_BASE_URL=$app_base_url |
|
2728 | .env set RC_APP_BASE_URL=$app_base_url | |
2729 |
|
2729 | |||
2730 | .env set RC_LOKI_AUTH=loki-auth:$shared_key@ |
|
2730 | .env set RC_LOKI_AUTH=loki-auth:$shared_key@ | |
2731 |
|
2731 | |||
2732 | .env puts '' |
|
2732 | .env puts '' | |
2733 | .env puts '# Log formatter option' |
|
2733 | .env puts '# Log formatter option' | |
2734 | .env set RC_LOGGING_FORMATTER=$log_formatter |
|
2734 | .env set RC_LOGGING_FORMATTER=$log_formatter | |
2735 | .env set RC_USE_CELERY=true |
|
2735 | .env set RC_USE_CELERY=true | |
2736 |
|
2736 | |||
2737 | .env puts '' |
|
2737 | .env puts '' | |
2738 | .env puts '# Channelstream config' |
|
2738 | .env puts '# Channelstream config' | |
2739 | .env set RC_CHANNELSTREAM_SERVER=channelstream:8000 |
|
2739 | .env set RC_CHANNELSTREAM_SERVER=channelstream:8000 | |
2740 |
|
2740 | |||
2741 | if [[ $is_https == 1 ]]; then |
|
2741 | if [[ $is_https == 1 ]]; then | |
2742 | rc_channelstream_url="wss://$base_domain/_channelstream" |
|
2742 | rc_channelstream_url="wss://$base_domain/_channelstream" | |
2743 | else |
|
2743 | else | |
2744 | rc_channelstream_url="ws://$base_domain/_channelstream" |
|
2744 | rc_channelstream_url="ws://$base_domain/_channelstream" | |
2745 | fi |
|
2745 | fi | |
2746 |
|
2746 | |||
2747 | .env set RC_CHANNELSTREAM_WS_URL=$rc_channelstream_url |
|
2747 | .env set RC_CHANNELSTREAM_WS_URL=$rc_channelstream_url | |
2748 |
|
2748 | |||
2749 | .env set CHANNELSTREAM_ALLOW_POSTING_FROM=0.0.0.0 |
|
2749 | .env set CHANNELSTREAM_ALLOW_POSTING_FROM=0.0.0.0 | |
2750 |
|
2750 | |||
2751 | .env puts '' |
|
2751 | .env puts '' | |
2752 | .env puts '# Channelstream secrets' |
|
2752 | .env puts '# Channelstream secrets' | |
2753 | .env set CHANNELSTREAM_SECRET=$shared_key |
|
2753 | .env set CHANNELSTREAM_SECRET=$shared_key | |
2754 | .env set RC_CHANNELSTREAM_SECRET=$shared_key |
|
2754 | .env set RC_CHANNELSTREAM_SECRET=$shared_key | |
2755 |
|
2755 | |||
2756 | .env puts '' |
|
2756 | .env puts '' | |
2757 | .env puts '# Channelstream admin' |
|
2757 | .env puts '# Channelstream admin' | |
2758 | .env set CHANNELSTREAM_ADMIN_SECRET=$shared_key |
|
2758 | .env set CHANNELSTREAM_ADMIN_SECRET=$shared_key | |
2759 | .env set RC_CHANNELSTREAM_ADMIN_SECRET=$shared_key |
|
2759 | .env set RC_CHANNELSTREAM_ADMIN_SECRET=$shared_key | |
2760 |
|
2760 | |||
2761 | .env puts '' |
|
2761 | .env puts '' | |
2762 | .env puts '# SSH PORT' |
|
2762 | .env puts '# SSH PORT' | |
2763 | .env set RC_SSH_PORT=9022 |
|
2763 | .env set RC_SSH_PORT=9022 | |
2764 |
|
2764 | |||
2765 | ini_path=$INI_TARGET/vcsserver.ini |
|
2765 | ini_path=$INI_TARGET/vcsserver.ini | |
2766 | config_vcsserver_ini |
|
2766 | config_vcsserver_ini | |
2767 |
|
2767 | |||
2768 | ini_path=$INI_TARGET/rhodecode.ini |
|
2768 | ini_path=$INI_TARGET/rhodecode.ini | |
2769 | RC_EDITION=$rc_edition |
|
2769 | RC_EDITION=$rc_edition | |
2770 | RC_LICENSE_TOKEN=$license_token |
|
2770 | RC_LICENSE_TOKEN=$license_token | |
2771 | RC_HOSTNAME=$(sed_safe_path $base_domain) |
|
2771 | RC_HOSTNAME=$(sed_safe_path $base_domain) | |
2772 | RC_APP_BASE_URL=$(sed_safe_path $app_base_url) |
|
2772 | RC_APP_BASE_URL=$(sed_safe_path $app_base_url) | |
2773 | RC_SQLALCHEMY_DB1_URL=$(sed_safe_path $rc_db1) |
|
2773 | RC_SQLALCHEMY_DB1_URL=$(sed_safe_path $rc_db1) | |
2774 | RC_CHANNELSTREAM_WS_URL=$(sed_safe_path $rc_channelstream_url) |
|
2774 | RC_CHANNELSTREAM_WS_URL=$(sed_safe_path $rc_channelstream_url) | |
2775 | config_rhodecode_ini |
|
2775 | config_rhodecode_ini | |
2776 |
|
2776 | |||
2777 | touch $BOOTSTRAP_RUNTIME_ENV |
|
2777 | touch $BOOTSTRAP_RUNTIME_ENV | |
2778 |
|
2778 | |||
2779 | } |
|
2779 | } | |
2780 |
|
2780 | |||
2781 | bootstrap_definitions() { |
|
2781 | bootstrap_definitions() { | |
2782 |
|
2782 | |||
2783 | # This is needed for bootstrap_definitions |
|
2783 | # This is needed for bootstrap_definitions | |
2784 | AUTH_TOKEN=${args[--auth-token]} |
|
2784 | AUTH_TOKEN=${args[--auth-token]} | |
2785 | SERVER_URL=${args[--server-url]} |
|
2785 | SERVER_URL=${args[--server-url]} | |
2786 |
|
2786 | |||
2787 | DEFINITIONS_EXIST="" |
|
2787 | DEFINITIONS_EXIST="" | |
2788 | CHECK_FILES="\ |
|
2788 | CHECK_FILES="\ | |
2789 | docker-compose-services.yaml \ |
|
2789 | docker-compose-services.yaml \ | |
2790 | docker-compose-apps.yaml \ |
|
2790 | docker-compose-apps.yaml \ | |
2791 | docker-compose-metrics.yaml \ |
|
2791 | docker-compose-metrics.yaml \ | |
2792 | docker-compose-router.yaml \ |
|
2792 | docker-compose-router.yaml \ | |
2793 | " |
|
2793 | " | |
2794 | for check_file in $CHECK_FILES; do |
|
2794 | for check_file in $CHECK_FILES; do | |
2795 | if [[ -f "$check_file" ]]; then |
|
2795 | if [[ -f "$check_file" ]]; then | |
2796 | DEFINITIONS_EXIST="1" |
|
2796 | DEFINITIONS_EXIST="1" | |
2797 | fi |
|
2797 | fi | |
2798 | done |
|
2798 | done | |
2799 |
|
2799 | |||
2800 | # break if we didn't use force and definitions exist |
|
2800 | # break if we didn't use force and definitions exist | |
2801 | if [[ -n $DEFINITIONS_EXIST && ! $force ]]; then |
|
2801 | if [[ -n $DEFINITIONS_EXIST && ! $force ]]; then | |
2802 | echo "$(yellow bootstrap_definitions: skipping docker defs creation, existing files found. Use --force to create them anyway)" |
|
2802 | echo "$(yellow bootstrap_definitions: skipping docker defs creation, existing files found. Use --force to create them anyway)" | |
2803 | return |
|
2803 | return | |
2804 | fi |
|
2804 | fi | |
2805 |
|
2805 | |||
2806 | if [[ -n $DEFINITIONS_EXIST ]]; then |
|
2806 | if [[ -n $DEFINITIONS_EXIST ]]; then | |
2807 | echo "$(yellow docker definitions exists, are you sure to force re-create them?)" |
|
2807 | echo "$(yellow docker definitions exists, are you sure to force re-create them?)" | |
2808 | while true; do |
|
2808 | while true; do | |
2809 | read -p "Would you like to continue with overriding files? [yn] " yn |
|
2809 | read -p "Would you like to continue with overriding files? [yn] " yn | |
2810 | case $yn in |
|
2810 | case $yn in | |
2811 | [Yy]*) break ;; |
|
2811 | [Yy]*) break ;; | |
2812 | [Nn]*) exit ;; |
|
2812 | [Nn]*) exit ;; | |
2813 | *) echo "Please answer y or n." ;; |
|
2813 | *) echo "Please answer y or n." ;; | |
2814 | esac |
|
2814 | esac | |
2815 | done |
|
2815 | done | |
2816 | fi |
|
2816 | fi | |
2817 |
|
2817 | |||
2818 | FULL_MODE=1 |
|
2818 | FULL_MODE=1 | |
2819 | # This expects the $AUTH_TOKEN and $SERVER_URL be present |
|
2819 | # This expects the $AUTH_TOKEN and $SERVER_URL be present | |
2820 | get_docker_definitions $docker_revision $FULL_MODE $DEBUG |
|
2820 | get_docker_definitions $docker_revision $FULL_MODE $DEBUG | |
2821 |
|
2821 | |||
2822 | } |
|
2822 | } | |
2823 |
|
2823 | |||
2824 | bootstrap_overrides() { |
|
2824 | bootstrap_overrides() { | |
2825 | templates=$YAML_TEMPLATES |
|
2825 | templates=$YAML_TEMPLATES | |
2826 |
|
2826 | |||
2827 | target_dir=$PWD/.custom |
|
2827 | target_dir=$PWD/.custom | |
2828 |
|
2828 | |||
2829 | for o_file in $templates; do |
|
2829 | for o_file in $templates; do | |
2830 | target_file=$target_dir/$o_file |
|
2830 | target_file=$target_dir/$o_file | |
2831 | if [[ ! -f "$target_file" ]]; then |
|
2831 | if [[ ! -f "$target_file" ]]; then | |
2832 | echo "copy override file $o_file" |
|
2832 | echo "copy override file $o_file" | |
2833 | cp -v $PWD/templates/$o_file $target_file |
|
2833 | cp -v $PWD/templates/$o_file $target_file | |
2834 | else |
|
2834 | else | |
2835 | echo "file $target_file existing, skipping..." |
|
2835 | echo "file $target_file existing, skipping..." | |
2836 | fi |
|
2836 | fi | |
2837 | done |
|
2837 | done | |
2838 | mkdir -p $target_dir/traefik_custom |
|
2838 | mkdir -p $target_dir/traefik_custom | |
2839 | cp -r $PWD/config/traefik/* $target_dir/traefik_custom/ |
|
2839 | cp -r $PWD/config/traefik/* $target_dir/traefik_custom/ | |
2840 |
|
2840 | |||
2841 | echo "$(green bootstrap_overrides: overrides extracted to $target_dir)" |
|
2841 | echo "$(green bootstrap_overrides: overrides extracted to $target_dir)" | |
2842 |
|
2842 | |||
2843 | # save our loki auth using md5 encryption so the auth works OOTB |
|
2843 | # save our loki auth using md5 encryption so the auth works OOTB | |
2844 | echo "loki-auth:$shared_key_md5" >> $target_dir/traefik_custom/dynamic/.htpasswd |
|
2844 | echo "loki-auth:$shared_key_md5" >> $target_dir/traefik_custom/dynamic/.htpasswd | |
2845 |
|
2845 | |||
2846 | # change our templates and adjust using enable SSH |
|
2846 | # change our templates and adjust using enable SSH | |
2847 | if [[ $arg_use_ssl == "y" ]]; then |
|
2847 | if [[ $arg_use_ssl == "y" ]]; then | |
2848 | echo "enabling SSL on .override.yaml templates" |
|
2848 | echo "enabling SSL on .override.yaml templates" | |
2849 |
|
2849 | |||
2850 | metrics_replace() { |
|
2850 | metrics_replace() { | |
2851 | metrics_tmpl=$target_dir/docker-compose-metrics.override.yaml |
|
2851 | metrics_tmpl=$target_dir/docker-compose-metrics.override.yaml | |
2852 | sed_func "$1" "$2" "$metrics_tmpl" |
|
2852 | sed_func "$1" "$2" "$metrics_tmpl" | |
2853 | } |
|
2853 | } | |
2854 |
|
2854 | |||
2855 | metrics_replace '# # Enable http\+https' ' # Enable http\+https' |
|
2855 | metrics_replace '# # Enable http\+https' ' # Enable http\+https' | |
2856 | metrics_replace '# - "traefik.http.routers.grafana.entrypoints=http,https"' ' - "traefik.http.routers.grafana.entrypoints=http,https"' |
|
2856 | metrics_replace '# - "traefik.http.routers.grafana.entrypoints=http,https"' ' - "traefik.http.routers.grafana.entrypoints=http,https"' | |
2857 |
|
2857 | |||
2858 | services_replace() { |
|
2858 | services_replace() { | |
2859 | services_tmpl=$target_dir/docker-compose-services.override.yaml |
|
2859 | services_tmpl=$target_dir/docker-compose-services.override.yaml | |
2860 | sed_func "$1" "$2" "$services_tmpl" |
|
2860 | sed_func "$1" "$2" "$services_tmpl" | |
2861 | } |
|
2861 | } | |
2862 |
|
2862 | |||
2863 | services_replace '# # Enable http\+https' ' # Enable http\+https' |
|
2863 | services_replace '# # Enable http\+https' ' # Enable http\+https' | |
2864 | services_replace '# - "traefik.http.routers.channelstream.entrypoints=http,https"' ' - "traefik.http.routers.channelstream.entrypoints=http,https"' |
|
2864 | services_replace '# - "traefik.http.routers.channelstream.entrypoints=http,https"' ' - "traefik.http.routers.channelstream.entrypoints=http,https"' | |
2865 | services_replace '# - "traefik.http.routers.nginx-statics.entrypoints=http,https"' ' - "traefik.http.routers.nginx-statics.entrypoints=http,https"' |
|
2865 | services_replace '# - "traefik.http.routers.nginx-statics.entrypoints=http,https"' ' - "traefik.http.routers.nginx-statics.entrypoints=http,https"' | |
2866 |
|
2866 | |||
2867 | apps_replace() { |
|
2867 | apps_replace() { | |
2868 | apps_tmpl=$target_dir/docker-compose-apps.override.yaml |
|
2868 | apps_tmpl=$target_dir/docker-compose-apps.override.yaml | |
2869 | sed_func "$1" "$2" "$apps_tmpl" |
|
2869 | sed_func "$1" "$2" "$apps_tmpl" | |
2870 | } |
|
2870 | } | |
2871 |
|
2871 | |||
2872 | apps_replace '# # Enable http\+https' ' # Enable http\+https' |
|
2872 | apps_replace '# # Enable http\+https' ' # Enable http\+https' | |
2873 | apps_replace '# - "traefik.http.routers.rhodecode.entrypoints=http,https"' ' - "traefik.http.routers.rhodecode.entrypoints=http,https"' |
|
2873 | apps_replace '# - "traefik.http.routers.rhodecode.entrypoints=http,https"' ' - "traefik.http.routers.rhodecode.entrypoints=http,https"' | |
2874 |
|
2874 | |||
2875 | fi |
|
2875 | fi | |
2876 | } |
|
2876 | } | |
2877 |
|
2877 | |||
2878 | cur_date=$(date '+%Y-%m-%d %H:%M:%S') |
|
2878 | cur_date=$(date '+%Y-%m-%d %H:%M:%S') | |
2879 |
|
2879 | |||
2880 | # Init the config ! |
|
2880 | # Init the config ! | |
2881 | if [[ ! -f "$CONFIG_FILE" ]]; then |
|
2881 | if [[ ! -f "$CONFIG_FILE" ]]; then | |
2882 | echo "config: init new config at: $CONFIG_FILE" |
|
2882 | echo "config: init new config at: $CONFIG_FILE" | |
2883 | config_init |
|
2883 | config_init | |
2884 | else |
|
2884 | else | |
2885 | echo "config: re-using present config at: $CONFIG_FILE" |
|
2885 | echo "config: re-using present config at: $CONFIG_FILE" | |
2886 | fi |
|
2886 | fi | |
2887 |
|
2887 | |||
2888 | run_stages=$BOOTSTRAP_STAGES |
|
2888 | run_stages=$BOOTSTRAP_STAGES | |
2889 |
|
2889 | |||
2890 | if [ ! ${#stages_from_cli[@]} -eq 0 ]; then |
|
2890 | if [ ! ${#stages_from_cli[@]} -eq 0 ]; then | |
2891 | echo "Using custom stages to run init command..." |
|
2891 | echo "Using custom stages to run init command..." | |
2892 | run_stages=${stages_from_cli[@]} |
|
2892 | run_stages=${stages_from_cli[@]} | |
2893 | fi |
|
2893 | fi | |
2894 |
|
2894 | |||
2895 | for stage_name in $run_stages; do |
|
2895 | for stage_name in $run_stages; do | |
2896 |
|
2896 | |||
2897 | stage_func=$(get_stage_function $stage_name) |
|
2897 | stage_func=$(get_stage_function $stage_name) | |
2898 |
|
2898 | |||
2899 | if ! config_has_key $stage_name ; then |
|
2899 | if ! config_has_key $stage_name ; then | |
2900 | echo "$(green \* bootstrap: \'$stage_name\' stage not found\; running now... )" |
|
2900 | echo "$(green \* bootstrap: \'$stage_name\' stage not found\; running now... )" | |
2901 | $stage_func |
|
2901 | $stage_func | |
2902 | config_set "$stage_name" $cur_date |
|
2902 | config_set "$stage_name" $cur_date | |
2903 | else |
|
2903 | else | |
2904 | if [ $force ]; then |
|
2904 | if [ $force ]; then | |
2905 | echo "$(green \* bootstrap: \'$stage_name\' is present!\; FORCE running now... )" |
|
2905 | echo "$(green \* bootstrap: \'$stage_name\' is present!\; FORCE running now... )" | |
2906 | $stage_func $force |
|
2906 | $stage_func $force | |
2907 | config_set "$stage_name" $cur_date |
|
2907 | config_set "$stage_name" $cur_date | |
2908 | else |
|
2908 | else | |
2909 | echo "$(yellow \* bootstrap: \'$stage_name\' stage already present, use --force to run it again)" |
|
2909 | echo "$(yellow \* bootstrap: \'$stage_name\' stage already present, use --force to run it again)" | |
2910 | fi |
|
2910 | fi | |
2911 | fi |
|
2911 | fi | |
2912 |
|
2912 | |||
2913 | done |
|
2913 | done | |
2914 |
|
2914 | |||
2915 | echo "" |
|
2915 | echo "" | |
2916 | echo "~~~~ $(green Bootstrap completed) ~~~~" |
|
2916 | echo "~~~~ $(green Bootstrap completed) ~~~~" | |
2917 |
|
2917 | |||
2918 | get_started |
|
2918 | get_started | |
2919 |
|
2919 | |||
2920 | } |
|
2920 | } | |
2921 |
|
2921 | |||
2922 | # :command.function |
|
2922 | # :command.function | |
2923 | rcstack_self_update_command() { |
|
2923 | rcstack_self_update_command() { | |
2924 | # src/self_update_command.sh |
|
2924 | # src/self_update_command.sh | |
2925 | check_bootstrap |
|
2925 | check_bootstrap | |
2926 |
|
2926 | |||
2927 | FORCE=${args[--force]} |
|
2927 | FORCE=${args[--force]} | |
2928 | DEBUG=${args[--debug]} |
|
2928 | DEBUG=${args[--debug]} | |
2929 |
|
2929 | |||
2930 | # This is needed for bootstrap_definitions |
|
2930 | # This is needed for bootstrap_definitions | |
2931 | AUTH_TOKEN=${args[--auth-token]} |
|
2931 | AUTH_TOKEN=${args[--auth-token]} | |
2932 | SERVER_URL=${args[--server-url]} |
|
2932 | SERVER_URL=${args[--server-url]} | |
2933 |
|
2933 | |||
2934 | update_docker_image=${args[--update-docker-image]} |
|
2934 | update_docker_image=${args[--update-docker-image]} | |
2935 |
|
2935 | |||
2936 | rcstack_channel=${args[--cli-revision]} |
|
2936 | rcstack_channel=${args[--cli-revision]} | |
2937 | docker_channel=${args[--docker-revision]} |
|
2937 | docker_channel=${args[--docker-revision]} | |
2938 |
|
2938 | |||
2939 | FETCH_FROM=https://dls.rhodecode.com/get/$rcstack_channel |
|
2939 | FETCH_FROM=https://dls.rhodecode.com/get/$rcstack_channel | |
2940 |
|
2940 | |||
2941 | FINAL_TARGET=$PWD/scripts/rcstack/rcstack |
|
2941 | FINAL_TARGET=$PWD/scripts/rcstack/rcstack | |
2942 |
|
2942 | |||
2943 | DL_TARGET=$PWD/scripts/rcstack/rcstack.tmp |
|
2943 | DL_TARGET=$PWD/scripts/rcstack/rcstack.tmp | |
2944 |
|
2944 | |||
2945 | #ensure we have this dir ! |
|
2945 | #ensure we have this dir ! | |
2946 | mkdir -p $PWD/scripts/rcstack |
|
2946 | mkdir -p $PWD/scripts/rcstack | |
2947 |
|
2947 | |||
2948 | .env --file $RUNTIME_ENV |
|
2948 | .env --file $RUNTIME_ENV | |
2949 | .env get_or_error RC_VERSION |
|
2949 | .env get_or_error RC_VERSION | |
2950 |
|
2950 | |||
2951 | ENV_VER=$REPLY |
|
2951 | ENV_VER=$REPLY | |
2952 |
|
2952 | |||
2953 | echo "self-update: downloading new $RC_SCRIPT_NAME script from $FETCH_FROM" |
|
2953 | echo "self-update: downloading new $RC_SCRIPT_NAME script from $FETCH_FROM" | |
2954 |
|
2954 | |||
2955 | if [[ $FORCE ]]; then |
|
2955 | if [[ $FORCE ]]; then | |
2956 | echo "$(yellow self-update: --force used, doing forced update)" |
|
2956 | echo "$(yellow self-update: --force used, doing forced update)" | |
2957 | fi |
|
2957 | fi | |
2958 |
|
2958 | |||
2959 | if [[ $DEBUG ]]; then |
|
2959 | if [[ $DEBUG ]]; then | |
2960 | echo "running: curl -L -ss --fail -o $DL_TARGET $FETCH_FROM" |
|
2960 | echo "running: curl -L -ss --fail -o $DL_TARGET $FETCH_FROM" | |
2961 | fi |
|
2961 | fi | |
2962 |
|
2962 | |||
2963 | curl -L -ss --fail -o $DL_TARGET $FETCH_FROM |
|
2963 | curl -L -ss --fail -o $DL_TARGET $FETCH_FROM | |
2964 |
|
2964 | |||
2965 | chmod +x $DL_TARGET |
|
2965 | chmod +x $DL_TARGET | |
2966 |
|
2966 | |||
2967 | version_old=0 |
|
2967 | version_old=0 | |
2968 | rc_version_old=0 |
|
2968 | rc_version_old=0 | |
2969 |
|
2969 | |||
2970 | # check if we have OLD file, in case we don't just set versions to 0 |
|
2970 | # check if we have OLD file, in case we don't just set versions to 0 | |
2971 | if [[ -f "$FINAL_TARGET" ]]; then |
|
2971 | if [[ -f "$FINAL_TARGET" ]]; then | |
2972 | version_old=$($FINAL_TARGET --version) |
|
2972 | version_old=$($FINAL_TARGET --version) | |
2973 | rc_version_old=$($FINAL_TARGET cli image-info) |
|
2973 | rc_version_old=$($FINAL_TARGET cli image-info) | |
2974 | fi |
|
2974 | fi | |
2975 |
|
2975 | |||
2976 | version_dl=$($DL_TARGET --version) |
|
2976 | version_dl=$($DL_TARGET --version) | |
2977 | rc_version_dl=$($DL_TARGET cli image-info) |
|
2977 | rc_version_dl=$($DL_TARGET cli image-info) | |
2978 |
|
2978 | |||
2979 | echo "self-update: $RC_SCRIPT_NAME version downloaded: $version_dl" |
|
2979 | echo "self-update: $RC_SCRIPT_NAME version downloaded: $version_dl" | |
2980 |
|
2980 | |||
2981 | if [[ $DEBUG ]]; then |
|
2981 | if [[ $DEBUG ]]; then | |
2982 | echo "DEBUG: old-script ver: $version_old" |
|
2982 | echo "DEBUG: old-script ver: $version_old" | |
2983 | echo "DEBUG: new-script ver: $version_dl" |
|
2983 | echo "DEBUG: new-script ver: $version_dl" | |
2984 | echo "DEBUG: " |
|
2984 | echo "DEBUG: " | |
2985 | echo "DEBUG: .runtime.env set version $ENV_VER" |
|
2985 | echo "DEBUG: .runtime.env set version $ENV_VER" | |
2986 | echo "DEBUG: " |
|
2986 | echo "DEBUG: " | |
2987 | echo "DEBUG: old-script: RC VERSION: $rc_version_old" |
|
2987 | echo "DEBUG: old-script: RC VERSION: $rc_version_old" | |
2988 | echo "DEBUG: new-script: RC VERSION: $rc_version_dl" |
|
2988 | echo "DEBUG: new-script: RC VERSION: $rc_version_dl" | |
2989 | fi |
|
2989 | fi | |
2990 |
|
2990 | |||
2991 | if [[ $version_old == "$version_dl" ]]; then |
|
2991 | if [[ $version_old == "$version_dl" ]]; then | |
2992 |
|
2992 | |||
2993 | if [[ $FORCE ]]; then |
|
2993 | if [[ $FORCE ]]; then | |
2994 | echo "$(yellow self-update: downloaded version is the same as current version $version_dl, continue with --force...)" |
|
2994 | echo "$(yellow self-update: downloaded version is the same as current version $version_dl, continue with --force...)" | |
2995 | else |
|
2995 | else | |
2996 | echo "self-update: downloaded version is the same as current version $version_dl, exiting..." |
|
2996 | echo "self-update: downloaded version is the same as current version $version_dl, exiting..." | |
2997 | exit |
|
2997 | exit | |
2998 | fi |
|
2998 | fi | |
2999 |
|
2999 | |||
3000 | fi |
|
3000 | fi | |
3001 |
|
3001 | |||
3002 | docker_image_update() { |
|
3002 | docker_image_update() { | |
3003 |
|
3003 | |||
3004 | echo "$(green self-update: saving new RC_VERSION=$rc_version_dl to runtime.env file)" |
|
3004 | echo "$(green self-update: saving new RC_VERSION=$rc_version_dl to runtime.env file)" | |
3005 | echo "currently .runtime.env file uses image: $ENV_VER" |
|
3005 | echo "currently .runtime.env file uses image: $ENV_VER" | |
3006 |
|
3006 | |||
3007 | if [[ $update_docker_image == "y" ]]; then |
|
3007 | if [[ $update_docker_image == "y" ]]; then | |
3008 | echo "continuing with automated forced installer version saved into .runtime.env" |
|
3008 | echo "continuing with automated forced installer version saved into .runtime.env" | |
3009 | .env set RC_VERSION=$rc_version_dl |
|
3009 | .env set RC_VERSION=$rc_version_dl | |
3010 | else |
|
3010 | else | |
3011 | while true; do |
|
3011 | while true; do | |
3012 | read -p "self-update: Would you like to continue with setting RC_VERSION=$rc_version_dl into .runtime.env file? [yn] " yn |
|
3012 | read -p "self-update: Would you like to continue with setting RC_VERSION=$rc_version_dl into .runtime.env file? [yn] " yn | |
3013 | case $yn in |
|
3013 | case $yn in | |
3014 | [Yy]*) |
|
3014 | [Yy]*) | |
3015 | .env set RC_VERSION=$rc_version_dl |
|
3015 | .env set RC_VERSION=$rc_version_dl | |
3016 | echo "self-update: new version set into config" |
|
3016 | echo "self-update: new version set into config" | |
3017 | break ;; |
|
3017 | break ;; | |
3018 | [Nn]*) |
|
3018 | [Nn]*) | |
3019 | break ;; |
|
3019 | break ;; | |
3020 | *) echo "Please answer y or n." ;; |
|
3020 | *) echo "Please answer y or n." ;; | |
3021 | esac |
|
3021 | esac | |
3022 | done |
|
3022 | done | |
3023 | fi |
|
3023 | fi | |
3024 | } |
|
3024 | } | |
3025 |
|
3025 | |||
3026 | if [[ $rc_version_old == "$rc_version_dl" ]]; then |
|
3026 | if [[ $rc_version_old == "$rc_version_dl" ]]; then | |
3027 | echo "self-update: docker image defined by RC_VERSION=$rc_version_dl seems to be up-to date" |
|
3027 | echo "self-update: docker image defined by RC_VERSION=$rc_version_dl seems to be up-to date" | |
3028 |
|
3028 | |||
3029 | if [[ $FORCE ]]; then |
|
3029 | if [[ $FORCE ]]; then | |
3030 | echo "$(yellow self-update: continue with --force...)" |
|
3030 | echo "$(yellow self-update: continue with --force...)" | |
3031 | docker_image_update |
|
3031 | docker_image_update | |
3032 | fi |
|
3032 | fi | |
3033 |
|
3033 | |||
3034 | else |
|
3034 | else | |
3035 | docker_image_update |
|
3035 | docker_image_update | |
3036 | fi |
|
3036 | fi | |
3037 |
|
3037 | |||
3038 | echo "self-update: updating cli $RC_SCRIPT_NAME script to new version: $version_dl" |
|
3038 | echo "self-update: updating cli $RC_SCRIPT_NAME script to new version: $version_dl" | |
3039 |
|
3039 | |||
3040 | if [[ -f "$FINAL_TARGET" ]]; then |
|
3040 | if [[ -f "$FINAL_TARGET" ]]; then | |
3041 | rm $FINAL_TARGET && mv -v $DL_TARGET $FINAL_TARGET |
|
3041 | rm $FINAL_TARGET && mv -v $DL_TARGET $FINAL_TARGET | |
3042 | else |
|
3042 | else | |
3043 | mv -v $DL_TARGET $FINAL_TARGET |
|
3043 | mv -v $DL_TARGET $FINAL_TARGET | |
3044 | fi |
|
3044 | fi | |
3045 |
|
3045 | |||
3046 | echo "$(green self-update: updating docker definitions to $docker_channel)" |
|
3046 | echo "$(green self-update: updating docker definitions to $docker_channel)" | |
3047 |
|
3047 | |||
3048 | FULL_MODE=1 |
|
3048 | FULL_MODE=1 | |
3049 | # This expects the $AUTH_TOKEN and $SERVER_URL be present |
|
3049 | # This expects the $AUTH_TOKEN and $SERVER_URL be present | |
3050 | get_docker_definitions $docker_channel $FULL_MODE $DEBUG |
|
3050 | get_docker_definitions $docker_channel $FULL_MODE $DEBUG | |
3051 |
|
3051 | |||
3052 | echo "$(green self-update: successfully update to $version_dl)" |
|
3052 | echo "$(green self-update: successfully update to $version_dl)" | |
3053 | exit |
|
3053 | exit | |
3054 | } |
|
3054 | } | |
3055 |
|
3055 | |||
3056 | # :command.function |
|
3056 | # :command.function | |
3057 | rcstack_stack_router_command() { |
|
3057 | rcstack_stack_router_command() { | |
3058 | # src/stack_router_command.sh |
|
3058 | # src/stack_router_command.sh | |
3059 | check_bootstrap |
|
3059 | check_bootstrap | |
3060 |
|
3060 | |||
3061 | DEBUG=${args[--debug]} |
|
3061 | DEBUG=${args[--debug]} | |
3062 | ENV_FILE=${args[--env-file-path]} |
|
3062 | ENV_FILE=${args[--env-file-path]} | |
3063 |
|
3063 | |||
3064 | if [[ ! -f $RC_STACK_ROUTER_EXT ]]; then |
|
3064 | if [[ ! -f $RC_STACK_ROUTER_EXT ]]; then | |
3065 | RC_STACK_ROUTER_EXT="" |
|
3065 | RC_STACK_ROUTER_EXT="" | |
3066 | else |
|
3066 | else | |
3067 | RC_STACK_ROUTER_EXT="-f $RC_STACK_ROUTER_EXT" |
|
3067 | RC_STACK_ROUTER_EXT="-f $RC_STACK_ROUTER_EXT" | |
3068 | fi |
|
3068 | fi | |
3069 |
|
3069 | |||
3070 | CMD_ROUTER="\ |
|
3070 | CMD_ROUTER="\ | |
3071 | RC_ENV_FILE=$ENV_FILE docker compose \ |
|
3071 | RC_ENV_FILE=$ENV_FILE docker compose \ | |
3072 | --env-file $ENV_FILE \ |
|
3072 | --env-file $ENV_FILE \ | |
3073 | $ENV_EXPAND \ |
|
3073 | $ENV_EXPAND \ | |
3074 | -p rc_cluster_router \ |
|
3074 | -p rc_cluster_router \ | |
3075 | -f docker-compose-base.yaml \ |
|
3075 | -f docker-compose-base.yaml \ | |
3076 | -f docker-compose-router.yaml $RC_STACK_ROUTER_EXT" |
|
3076 | -f docker-compose-router.yaml $RC_STACK_ROUTER_EXT" | |
3077 |
|
3077 | |||
3078 | if [[ $DEBUG ]]; then |
|
3078 | if [[ $DEBUG ]]; then | |
3079 | echo "---" |
|
3079 | echo "---" | |
3080 | echo "stacks docker: $RC_STACK_ROUTER_EXT_LCL" |
|
3080 | echo "stacks docker: $RC_STACK_ROUTER_EXT_LCL" | |
3081 | echo "running command: ${CMD_ROUTER}" |
|
3081 | echo "running command: ${CMD_ROUTER}" | |
3082 | echo "ARGS: ${other_args[*]}" |
|
3082 | echo "ARGS: ${other_args[*]}" | |
3083 | echo "---" |
|
3083 | echo "---" | |
3084 | fi |
|
3084 | fi | |
3085 | eval "${CMD_ROUTER} ${other_args[*]}" |
|
3085 | eval "${CMD_ROUTER} ${other_args[*]}" | |
3086 |
|
3086 | |||
3087 | } |
|
3087 | } | |
3088 |
|
3088 | |||
3089 | # :command.function |
|
3089 | # :command.function | |
3090 | rcstack_stack_metrics_command() { |
|
3090 | rcstack_stack_metrics_command() { | |
3091 | # src/stack_metrics_command.sh |
|
3091 | # src/stack_metrics_command.sh | |
3092 | check_bootstrap |
|
3092 | check_bootstrap | |
3093 |
|
3093 | |||
3094 | DEBUG=${args[--debug]} |
|
3094 | DEBUG=${args[--debug]} | |
3095 | ENV_FILE=${args[--env-file-path]} |
|
3095 | ENV_FILE=${args[--env-file-path]} | |
3096 |
|
3096 | |||
3097 | if [[ ! -f $RC_STACK_METRICS_EXT ]]; then |
|
3097 | if [[ ! -f $RC_STACK_METRICS_EXT ]]; then | |
3098 | RC_STACK_METRICS_EXT_LCL="" |
|
3098 | RC_STACK_METRICS_EXT_LCL="" | |
3099 | else |
|
3099 | else | |
3100 | RC_STACK_METRICS_EXT_LCL="-f $RC_STACK_METRICS_EXT" |
|
3100 | RC_STACK_METRICS_EXT_LCL="-f $RC_STACK_METRICS_EXT" | |
3101 | fi |
|
3101 | fi | |
3102 |
|
3102 | |||
3103 | CMD_METRICS="\ |
|
3103 | CMD_METRICS="\ | |
3104 | RC_ENV_FILE=$ENV_FILE docker compose \ |
|
3104 | RC_ENV_FILE=$ENV_FILE docker compose \ | |
3105 | --env-file $ENV_FILE \ |
|
3105 | --env-file $ENV_FILE \ | |
3106 | $ENV_EXPAND \ |
|
3106 | $ENV_EXPAND \ | |
3107 | -p rc_cluster_metrics \ |
|
3107 | -p rc_cluster_metrics \ | |
3108 | -f docker-compose-base.yaml \ |
|
3108 | -f docker-compose-base.yaml \ | |
3109 | -f docker-compose-metrics.yaml $RC_STACK_METRICS_EXT_LCL" |
|
3109 | -f docker-compose-metrics.yaml $RC_STACK_METRICS_EXT_LCL" | |
3110 |
|
3110 | |||
3111 | if [[ $DEBUG ]]; then |
|
3111 | if [[ $DEBUG ]]; then | |
3112 | echo "---" |
|
3112 | echo "---" | |
3113 | echo "stacks docker: $RC_STACK_METRICS_EXT_LCL" |
|
3113 | echo "stacks docker: $RC_STACK_METRICS_EXT_LCL" | |
3114 | echo "running command: ${CMD_METRICS}" |
|
3114 | echo "running command: ${CMD_METRICS}" | |
3115 | echo "ARGS: ${other_args[*]}" |
|
3115 | echo "ARGS: ${other_args[*]}" | |
3116 | echo "---" |
|
3116 | echo "---" | |
3117 | fi |
|
3117 | fi | |
3118 | eval "${CMD_METRICS} ${other_args[*]}" |
|
3118 | eval "${CMD_METRICS} ${other_args[*]}" | |
3119 | } |
|
3119 | } | |
3120 |
|
3120 | |||
3121 | # :command.function |
|
3121 | # :command.function | |
3122 | rcstack_stack_services_command() { |
|
3122 | rcstack_stack_services_command() { | |
3123 | # src/stack_services_command.sh |
|
3123 | # src/stack_services_command.sh | |
3124 | check_bootstrap |
|
3124 | check_bootstrap | |
3125 |
|
3125 | |||
3126 | DEBUG=${args[--debug]} |
|
3126 | DEBUG=${args[--debug]} | |
3127 | ENV_FILE=${args[--env-file-path]} |
|
3127 | ENV_FILE=${args[--env-file-path]} | |
3128 |
|
3128 | |||
3129 | if [[ ! -f $RC_STACK_SERVICES_EXT ]]; then |
|
3129 | if [[ ! -f $RC_STACK_SERVICES_EXT ]]; then | |
3130 | RC_STACK_SERVICES_EXT_LCL="" |
|
3130 | RC_STACK_SERVICES_EXT_LCL="" | |
3131 | else |
|
3131 | else | |
3132 | RC_STACK_SERVICES_EXT_LCL="-f $RC_STACK_SERVICES_EXT" |
|
3132 | RC_STACK_SERVICES_EXT_LCL="-f $RC_STACK_SERVICES_EXT" | |
3133 | fi |
|
3133 | fi | |
3134 |
|
3134 | |||
3135 | RC_STACK_PROFILES="--profile database --profile redis --profile elasticsearch --profile channelstream" |
|
3135 | RC_STACK_PROFILES="--profile database --profile redis --profile elasticsearch --profile channelstream" | |
3136 |
|
3136 | |||
3137 | CMD_SERVICES="\ |
|
3137 | CMD_SERVICES="\ | |
3138 | RC_ENV_FILE=$ENV_FILE docker compose \ |
|
3138 | RC_ENV_FILE=$ENV_FILE docker compose \ | |
3139 | --env-file $ENV_FILE \ |
|
3139 | --env-file $ENV_FILE \ | |
3140 | $ENV_EXPAND \ |
|
3140 | $ENV_EXPAND \ | |
3141 | $RC_STACK_PROFILES \ |
|
3141 | $RC_STACK_PROFILES \ | |
3142 | --project-name rc_cluster_services \ |
|
3142 | --project-name rc_cluster_services \ | |
3143 | -f docker-compose-base.yaml \ |
|
3143 | -f docker-compose-base.yaml \ | |
3144 | -f docker-compose-services.yaml $RC_STACK_SERVICES_EXT_LCL" |
|
3144 | -f docker-compose-services.yaml $RC_STACK_SERVICES_EXT_LCL" | |
3145 |
|
3145 | |||
3146 | if [[ $DEBUG ]]; then |
|
3146 | if [[ $DEBUG ]]; then | |
3147 | echo "---" |
|
3147 | echo "---" | |
3148 | echo "stacks docker: $RC_STACK_SERVICES_EXT_LCL" |
|
3148 | echo "stacks docker: $RC_STACK_SERVICES_EXT_LCL" | |
3149 | echo "running command: ${CMD_SERVICES}" |
|
3149 | echo "running command: ${CMD_SERVICES}" | |
3150 | echo "ARGS: ${other_args[*]}" |
|
3150 | echo "ARGS: ${other_args[*]}" | |
3151 | echo "---" |
|
3151 | echo "---" | |
3152 | fi |
|
3152 | fi | |
3153 |
|
3153 | |||
3154 | eval "${CMD_SERVICES} ${other_args[*]}" |
|
3154 | eval "${CMD_SERVICES} ${other_args[*]}" | |
3155 | } |
|
3155 | } | |
3156 |
|
3156 | |||
3157 | # :command.function |
|
3157 | # :command.function | |
3158 | rcstack_stack_rhodecode_command() { |
|
3158 | rcstack_stack_rhodecode_command() { | |
3159 | # src/stack_rhodecode_command.sh |
|
3159 | # src/stack_rhodecode_command.sh | |
3160 | check_bootstrap |
|
3160 | check_bootstrap | |
3161 |
|
3161 | |||
3162 | DEBUG=${args[--debug]} |
|
3162 | DEBUG=${args[--debug]} | |
3163 | ENV_FILE=${args[--env-file-path]} |
|
3163 | ENV_FILE=${args[--env-file-path]} | |
3164 |
|
3164 | |||
3165 | stack_prefix=${args[--stack-prefix]} |
|
3165 | stack_prefix=${args[--stack-prefix]} | |
3166 | if [[ $stack_prefix == "" ]]; then |
|
3166 | if [[ $stack_prefix == "" ]]; then | |
3167 | stack_prefix="rc_cluster_apps" |
|
3167 | stack_prefix="rc_cluster_apps" | |
3168 | fi |
|
3168 | fi | |
3169 |
|
3169 | |||
3170 | if [[ ! -f $RC_STACK_RHODECODE_EXT ]]; then |
|
3170 | if [[ ! -f $RC_STACK_RHODECODE_EXT ]]; then | |
3171 | RC_STACK_RHODECODE_EXT_LCL="" |
|
3171 | RC_STACK_RHODECODE_EXT_LCL="" | |
3172 | else |
|
3172 | else | |
3173 | RC_STACK_RHODECODE_EXT_LCL="-f $RC_STACK_RHODECODE_EXT" |
|
3173 | RC_STACK_RHODECODE_EXT_LCL="-f $RC_STACK_RHODECODE_EXT" | |
3174 | fi |
|
3174 | fi | |
3175 |
|
3175 | |||
3176 | CMD_RHODECODE="\ |
|
3176 | CMD_RHODECODE="\ | |
3177 | RC_ENV_FILE=$ENV_FILE docker compose \ |
|
3177 | RC_ENV_FILE=$ENV_FILE docker compose \ | |
3178 | --env-file $ENV_FILE \ |
|
3178 | --env-file $ENV_FILE \ | |
3179 | $ENV_EXPAND \ |
|
3179 | $ENV_EXPAND \ | |
3180 | -p $stack_prefix \ |
|
3180 | -p $stack_prefix \ | |
3181 | -f docker-compose-base.yaml \ |
|
3181 | -f docker-compose-base.yaml \ | |
3182 | -f docker-compose-apps.yaml $RC_STACK_RHODECODE_EXT_LCL" |
|
3182 | -f docker-compose-apps.yaml $RC_STACK_RHODECODE_EXT_LCL" | |
3183 |
|
3183 | |||
3184 | sub_cmd=${other_args[0]} |
|
3184 | sub_cmd=${other_args[0]} | |
3185 |
|
3185 | |||
3186 | if [[ $sub_cmd == "up" ]]; then |
|
3186 | if [[ $sub_cmd == "up" ]]; then | |
3187 | declare -a final_args=( "$sub_cmd" "--no-color" "--no-build" "${other_args[@]:1}" ) |
|
3187 | declare -a final_args=( "$sub_cmd" "--no-color" "--no-build" "${other_args[@]:1}" ) | |
3188 | else |
|
3188 | else | |
3189 | declare -a final_args=( "$sub_cmd" "${other_args[@]:1}" ) |
|
3189 | declare -a final_args=( "$sub_cmd" "${other_args[@]:1}" ) | |
3190 | fi |
|
3190 | fi | |
3191 |
|
3191 | |||
3192 | if [[ $DEBUG ]]; then |
|
3192 | if [[ $DEBUG ]]; then | |
3193 | echo "---" |
|
3193 | echo "---" | |
3194 | echo "stacks docker: $RC_STACK_RHODECODE_EXT_LCL" |
|
3194 | echo "stacks docker: $RC_STACK_RHODECODE_EXT_LCL" | |
3195 | echo "running command: ${CMD_RHODECODE}" |
|
3195 | echo "running command: ${CMD_RHODECODE}" | |
3196 | echo "ARGS: ${final_args[*]}" |
|
3196 | echo "ARGS: ${final_args[*]}" | |
3197 | echo "---" |
|
3197 | echo "---" | |
3198 | fi |
|
3198 | fi | |
3199 | eval "${CMD_RHODECODE} ${final_args[*]}" |
|
3199 | eval "${CMD_RHODECODE} ${final_args[*]}" | |
3200 |
|
3200 | |||
3201 | } |
|
3201 | } | |
3202 |
|
3202 | |||
3203 | # :command.function |
|
3203 | # :command.function | |
3204 | rcstack_stack_all_command() { |
|
3204 | rcstack_stack_all_command() { | |
3205 | # src/stack_all_command.sh |
|
3205 | # src/stack_all_command.sh | |
3206 | check_bootstrap |
|
3206 | check_bootstrap | |
3207 |
|
3207 | |||
3208 | DEBUG=${args[--debug]} |
|
3208 | DEBUG=${args[--debug]} | |
3209 |
|
3209 | |||
3210 | stack_lst=$VALID_SERVICES |
|
3210 | stack_lst=$VALID_SERVICES | |
3211 |
|
3211 | |||
3212 | for stack in $stack_lst; do |
|
3212 | for stack in $stack_lst; do | |
3213 | ./$RC_SCRIPT_NAME stack $stack ${other_args[*]} |
|
3213 | ./$RC_SCRIPT_NAME stack $stack ${other_args[*]} | |
3214 | done |
|
3214 | done | |
3215 |
|
3215 | |||
3216 | } |
|
3216 | } | |
3217 |
|
3217 | |||
3218 | # :command.function |
|
3218 | # :command.function | |
3219 | rcstack_stack_status_command() { |
|
3219 | rcstack_stack_status_command() { | |
3220 | # src/stack_status_command.sh |
|
3220 | # src/stack_status_command.sh | |
3221 | check_bootstrap |
|
3221 | check_bootstrap | |
3222 | DEBUG=${args[--debug]} |
|
3222 | DEBUG=${args[--debug]} | |
3223 | DETAILED=${args[--detailed]} |
|
3223 | DETAILED=${args[--detailed]} | |
3224 | CONFIGS=${args[--configs]} |
|
3224 | CONFIGS=${args[--configs]} | |
3225 | VERBOSE=${args[-v]} |
|
3225 | VERBOSE=${args[-v]} | |
3226 |
|
3226 | |||
3227 | .env --file $RUNTIME_ENV |
|
3227 | .env --file $RUNTIME_ENV | |
3228 | .env get_or_error RC_APP_BASE_URL |
|
3228 | .env get_or_error RC_APP_BASE_URL | |
3229 | RC_APP_BASE_URL=$REPLY |
|
3229 | RC_APP_BASE_URL=$REPLY | |
3230 |
|
3230 | |||
3231 | .env get_or_error RC_VERSION |
|
3231 | .env get_or_error RC_VERSION | |
3232 | RC_VERSION=$REPLY |
|
3232 | RC_VERSION=$REPLY | |
3233 |
|
3233 | |||
3234 | .env get_or_error RC_SSH_PORT |
|
3234 | .env get_or_error RC_SSH_PORT | |
3235 | RC_SSH_PORT=$REPLY |
|
3235 | RC_SSH_PORT=$REPLY | |
3236 |
|
3236 | |||
3237 | .env get_or_error RC_EDITION |
|
3237 | .env get_or_error RC_EDITION | |
3238 | RC_EDITION=$REPLY |
|
3238 | RC_EDITION=$REPLY | |
3239 |
|
3239 | |||
3240 | .env get_or_error RC_LICENSE_TOKEN |
|
3240 | .env get_or_error RC_LICENSE_TOKEN | |
3241 | RC_LICENSE_TOKEN=$REPLY |
|
3241 | RC_LICENSE_TOKEN=$REPLY | |
3242 |
|
3242 | |||
3243 | if [[ $DEBUG ]]; then |
|
3243 | if [[ $DEBUG ]]; then | |
3244 | echo "---" |
|
3244 | echo "---" | |
3245 | ps_cmd=$(docker ps --filter=name=rc_cluster --format="{{.ID}}") |
|
3245 | ps_cmd=$(docker ps --filter=name=rc_cluster --format="{{.ID}}") | |
3246 |
|
3246 | |||
3247 | for service in $ps_cmd; do |
|
3247 | for service in $ps_cmd; do | |
3248 |
|
3248 | |||
3249 | servicename=`docker inspect --format '{{ .Name }}' $service` |
|
3249 | servicename=`docker inspect --format '{{ .Name }}' $service` | |
3250 | servicename=${servicename:1} |
|
3250 | servicename=${servicename:1} | |
3251 | echo $servicename |
|
3251 | echo $servicename | |
3252 | docker inspect $service --format='{{.State.Status}}: {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' |
|
3252 | docker inspect $service --format='{{.State.Status}}: {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' | |
3253 | echo "" |
|
3253 | echo "" | |
3254 |
|
3254 | |||
3255 | done |
|
3255 | done | |
3256 | echo "---" |
|
3256 | echo "---" | |
3257 | fi |
|
3257 | fi | |
3258 |
|
3258 | |||
3259 | echo "Running hostname: $RC_APP_BASE_URL" |
|
3259 | echo "Running hostname: $RC_APP_BASE_URL" | |
3260 | if [[ $VERBOSE ]]; then |
|
3260 | if [[ $VERBOSE ]]; then | |
3261 | printf "SSH Port: $RC_SSH_PORT\n" |
|
3261 | printf "SSH Port: $RC_SSH_PORT\n" | |
3262 | printf "Edition: $RC_EDITION:$RC_VERSION\n" |
|
3262 | printf "Edition: $RC_EDITION:$RC_VERSION\n" | |
3263 | printf "License: $RC_LICENSE_TOKEN\n" |
|
3263 | printf "License: $RC_LICENSE_TOKEN\n" | |
3264 | printf "\n" |
|
3264 | printf "\n" | |
3265 | fi |
|
3265 | fi | |
3266 |
|
3266 | |||
3267 | if [[ $CONFIGS ]]; then |
|
3267 | if [[ $CONFIGS ]]; then | |
3268 | printf "rcstack:\n" |
|
3268 | printf "rcstack:\n" | |
3269 | printf " config (in-host): $RUNTIME_ENV\n" |
|
3269 | printf " config (in-host): $RUNTIME_ENV\n" | |
3270 |
|
3270 | |||
3271 | printf "RhodeCode:\n" |
|
3271 | printf "RhodeCode:\n" | |
3272 | printf " ini (in-host): $rhodecode_default_config_path\n" |
|
3272 | printf " ini (in-host): $rhodecode_default_config_path\n" | |
3273 | printf " volumes (in-container):\n" |
|
3273 | printf " volumes (in-container):\n" | |
3274 | printf " repo-store: /var/opt/rhodecode_repo_store\n" |
|
3274 | printf " repo-store: /var/opt/rhodecode_repo_store\n" | |
3275 | printf " data-store: /var/opt/rhodecode_data\n" |
|
3275 | printf " data-store: /var/opt/rhodecode_data\n" | |
3276 |
|
3276 | |||
3277 | printf "VCSServer:\n" |
|
3277 | printf "VCSServer:\n" | |
3278 | printf " ini (in-host): $vcsserver_default_config_path\n" |
|
3278 | printf " ini (in-host): $vcsserver_default_config_path\n" | |
3279 | printf " volumes (in-container):\n" |
|
3279 | printf " volumes (in-container):\n" | |
3280 | printf " repo-store: /var/opt/rhodecode_repo_store\n" |
|
3280 | printf " repo-store: /var/opt/rhodecode_repo_store\n" | |
3281 | printf " data-store: /var/opt/rhodecode_data\n" |
|
3281 | printf " data-store: /var/opt/rhodecode_data\n" | |
3282 |
|
3282 | |||
3283 | printf "Traefik (router):\n" |
|
3283 | printf "Traefik (router):\n" | |
3284 | printf " ssl-certs definitions: .custom/traefik_custom/dynamic/traefik_dynamic_custom.yaml\n" |
|
3284 | printf " ssl-certs definitions: .custom/traefik_custom/dynamic/traefik_dynamic_custom.yaml\n" | |
3285 | printf " ssl-certs dir: .custom/traefik_custom/dynamic/certs/\n" |
|
3285 | printf " ssl-certs dir: .custom/traefik_custom/dynamic/certs/\n" | |
3286 |
|
3286 | |||
3287 | fi |
|
3287 | fi | |
3288 |
|
3288 | |||
3289 | if [[ $DETAILED ]]; then |
|
3289 | if [[ $DETAILED ]]; then | |
3290 | ps_cmd=$(docker ps --filter=name=rc_cluster --format="{{.ID}}") |
|
3290 | ps_cmd=$(docker ps --filter=name=rc_cluster --format="{{.ID}}") | |
3291 |
|
3291 | |||
3292 | for service in $ps_cmd; do |
|
3292 | for service in $ps_cmd; do | |
3293 | servicename=`docker inspect --format '{{ .Name }}' $service` |
|
3293 | servicename=`docker inspect --format '{{ .Name }}' $service` | |
3294 | servicename=${servicename:1} |
|
3294 | servicename=${servicename:1} | |
3295 | printf "CONTAINER:\\t$servicename\n" |
|
3295 | printf "CONTAINER:\\t$servicename\n" | |
3296 | printf "LOGS:\\t\\tdocker logs --tail=100 $service\n" |
|
3296 | printf "LOGS:\\t\\tdocker logs --tail=100 $service\n" | |
3297 | docker ps --filter=name=$servicename --format="ID:\\t\\t{{.ID}}\nIMAGE:\\t\\t{{.Image}}\nSTATUS:\\t\\t{{.Status}}\nPORTS:\\t\\t{{.Ports}}\n" |
|
3297 | docker ps --filter=name=$servicename --format="ID:\\t\\t{{.ID}}\nIMAGE:\\t\\t{{.Image}}\nSTATUS:\\t\\t{{.Status}}\nPORTS:\\t\\t{{.Ports}}\n" | |
3298 | echo "" |
|
3298 | echo "" | |
3299 | done |
|
3299 | done | |
3300 | else |
|
3300 | else | |
3301 | 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 ) |
|
3301 | 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 ) | |
3302 | fi |
|
3302 | fi | |
3303 |
|
3303 | |||
3304 | } |
|
3304 | } | |
3305 |
|
3305 | |||
3306 | # :command.function |
|
3306 | # :command.function | |
3307 | rcstack_stack_upgrade_router_command() { |
|
3307 | rcstack_stack_upgrade_router_command() { | |
3308 | # src/stack_upgrade_router_command.sh |
|
3308 | # src/stack_upgrade_router_command.sh | |
3309 | echo "Upgrading this stack with:" |
|
3309 | echo "Upgrading this stack with:" | |
3310 | echo "./$RC_SCRIPT_NAME stack router up --force-recreate --detach" |
|
3310 | echo "./$RC_SCRIPT_NAME stack router up --force-recreate --detach" | |
3311 | echo "" |
|
3311 | echo "" | |
3312 | echo "NOTE: To reclaim space occupied by old images, run:" |
|
3312 | echo "NOTE: To reclaim space occupied by old images, run:" | |
3313 | echo "docker image prune -f" |
|
3313 | echo "docker image prune -f" | |
3314 |
|
3314 | |||
3315 | ./$RC_SCRIPT_NAME stack router up --force-recreate --detach |
|
3315 | ./$RC_SCRIPT_NAME stack router up --force-recreate --detach | |
3316 |
|
3316 | |||
3317 | } |
|
3317 | } | |
3318 |
|
3318 | |||
3319 | # :command.function |
|
3319 | # :command.function | |
3320 | rcstack_stack_upgrade_services_command() { |
|
3320 | rcstack_stack_upgrade_services_command() { | |
3321 | # src/stack_upgrade_services_command.sh |
|
3321 | # src/stack_upgrade_services_command.sh | |
3322 | echo "Upgrading this stack with:" |
|
3322 | echo "Upgrading this stack with:" | |
3323 | echo "./$RC_SCRIPT_NAME stack services up --force-recreate --detach" |
|
3323 | echo "./$RC_SCRIPT_NAME stack services up --force-recreate --detach" | |
3324 | echo "" |
|
3324 | echo "" | |
3325 | echo "NOTE: To reclaim space occupied by old images, run:" |
|
3325 | echo "NOTE: To reclaim space occupied by old images, run:" | |
3326 | echo "docker image prune -f" |
|
3326 | echo "docker image prune -f" | |
3327 |
|
3327 | |||
3328 | ./$RC_SCRIPT_NAME stack services up --force-recreate --detach |
|
3328 | ./$RC_SCRIPT_NAME stack services up --force-recreate --detach | |
3329 |
|
3329 | |||
3330 | } |
|
3330 | } | |
3331 |
|
3331 | |||
3332 | # :command.function |
|
3332 | # :command.function | |
3333 | rcstack_stack_upgrade_metrics_command() { |
|
3333 | rcstack_stack_upgrade_metrics_command() { | |
3334 | # src/stack_upgrade_metrics_command.sh |
|
3334 | # src/stack_upgrade_metrics_command.sh | |
3335 | echo "To upgrading this stack with:" |
|
3335 | echo "To upgrading this stack with:" | |
3336 | echo "./$RC_SCRIPT_NAME stack metrics up --force-recreate --detach" |
|
3336 | echo "./$RC_SCRIPT_NAME stack metrics up --force-recreate --detach" | |
3337 | echo "" |
|
3337 | echo "" | |
3338 | echo "NOTE: To reclaim space occupied by old images, run:" |
|
3338 | echo "NOTE: To reclaim space occupied by old images, run:" | |
3339 | echo "docker image prune -f" |
|
3339 | echo "docker image prune -f" | |
3340 |
|
3340 | |||
3341 | ./$RC_SCRIPT_NAME stack metrics up --force-recreate --detach |
|
3341 | ./$RC_SCRIPT_NAME stack metrics up --force-recreate --detach | |
3342 |
|
3342 | |||
3343 | } |
|
3343 | } | |
3344 |
|
3344 | |||
3345 | # :command.function |
|
3345 | # :command.function | |
3346 | rcstack_stack_upgrade_rhodecode_command() { |
|
3346 | rcstack_stack_upgrade_rhodecode_command() { | |
3347 | # src/stack_upgrade_rhodecode_command.sh |
|
3347 | # src/stack_upgrade_rhodecode_command.sh | |
3348 | check_bootstrap |
|
3348 | check_bootstrap | |
3349 |
|
3349 | |||
3350 | stop_wait=${args[--stop-wait]} |
|
3350 | stop_wait=${args[--stop-wait]} | |
3351 | docker_stop_wait=${args[--docker-stop-wait]} |
|
3351 | docker_stop_wait=${args[--docker-stop-wait]} | |
3352 |
|
3352 | |||
3353 | stack_prefix=${args[--stack-prefix]} |
|
3353 | stack_prefix=${args[--stack-prefix]} | |
3354 | if [[ $stack_prefix == "" ]]; then |
|
3354 | if [[ $stack_prefix == "" ]]; then | |
3355 | stack_prefix="rc_cluster_apps" |
|
3355 | stack_prefix="rc_cluster_apps" | |
3356 | fi |
|
3356 | fi | |
3357 |
|
3357 | |||
3358 | # search docker IDs for current service |
|
3358 | # search docker IDs for current service | |
3359 | .env --file $RUNTIME_ENV |
|
3359 | .env --file $RUNTIME_ENV | |
3360 |
|
3360 | |||
3361 | .env get_or_error RC_VERSION |
|
3361 | .env get_or_error RC_VERSION | |
3362 | RC_VERSION=$REPLY |
|
3362 | RC_VERSION=$REPLY | |
3363 |
|
3363 | |||
3364 | .env get_or_error RC_EDITION |
|
3364 | .env get_or_error RC_EDITION | |
3365 | RC_EDITION=$REPLY |
|
3365 | RC_EDITION=$REPLY | |
3366 |
|
3366 | |||
3367 | echo "Pulling new image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION}" |
|
3367 | echo "Pulling new image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION}" | |
3368 | echo "WARNING: about to start downloading the RhodeCode base image" |
|
3368 | echo "WARNING: about to start downloading the RhodeCode base image" | |
3369 | echo "This process may take anywhere between a few minutes to an hour, depending on your network speed" |
|
3369 | echo "This process may take anywhere between a few minutes to an hour, depending on your network speed" | |
3370 | echo "running: docker pull -q rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION}" |
|
3370 | echo "running: docker pull -q rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION}" | |
3371 |
|
3371 | |||
3372 | eval "docker pull -q rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION}" |
|
3372 | eval "docker pull -q rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION}" | |
3373 |
|
3373 | |||
3374 | have_tty=1 |
|
3374 | have_tty=1 | |
3375 | # Set a dummy terminal type if none set |
|
3375 | # Set a dummy terminal type if none set | |
3376 | [[ -z "$TERM" ]] && export have_tty=0 |
|
3376 | [[ -z "$TERM" ]] && export have_tty=0 | |
3377 | [[ ! -t 1 ]] && export have_tty=0 |
|
3377 | [[ ! -t 1 ]] && export have_tty=0 | |
3378 |
|
3378 | |||
3379 | set_cursor() { |
|
3379 | set_cursor() { | |
3380 | if [[ $have_tty == 1 ]]; then |
|
3380 | if [[ $have_tty == 1 ]]; then | |
3381 | tput $1 |
|
3381 | tput $1 | |
3382 | fi |
|
3382 | fi | |
3383 | } |
|
3383 | } | |
3384 |
|
3384 | |||
3385 | stop_containers() { |
|
3385 | stop_containers() { | |
3386 | target_container=$1 |
|
3386 | target_container=$1 | |
3387 | docker_stop_wait=$2 |
|
3387 | docker_stop_wait=$2 | |
3388 | stop_wait=$3 |
|
3388 | stop_wait=$3 | |
3389 | target_containers_pat="$stack_prefix-$target_container-*" |
|
3389 | target_containers_pat="$stack_prefix-$target_container-*" | |
3390 |
|
3390 | |||
3391 | # array with OLD containers |
|
3391 | # array with OLD containers | |
3392 | local -a old_docker_ids |
|
3392 | local -a old_docker_ids | |
3393 | readarray -t old_docker_ids < <(docker ps --filter name="$target_containers_pat" -q) |
|
3393 | readarray -t old_docker_ids < <(docker ps --filter name="$target_containers_pat" -q) | |
3394 |
|
3394 | |||
3395 | scale=${#old_docker_ids[@]} |
|
3395 | scale=${#old_docker_ids[@]} | |
3396 | scale_2=$(( scale * 2 )) |
|
3396 | scale_2=$(( scale * 2 )) | |
3397 |
|
3397 | |||
3398 | echo "" |
|
3398 | echo "" | |
3399 | echo "Found $scale old container[s] for $target_container" |
|
3399 | echo "Found $scale old container[s] for $target_container" | |
3400 | echo "Old container-ids:" "${old_docker_ids[@]}" |
|
3400 | echo "Old container-ids:" "${old_docker_ids[@]}" | |
3401 | echo "" |
|
3401 | echo "" | |
3402 |
|
3402 | |||
3403 | if [[ $scale == "0" ]]; then |
|
3403 | if [[ $scale == "0" ]]; then | |
3404 | echo "No previous services found, doing a regular start for $target_container" |
|
3404 | echo "No previous services found, doing a regular start for $target_container" | |
3405 | ./$RC_SCRIPT_NAME stack rhodecode up $target_container --detach |
|
3405 | ./$RC_SCRIPT_NAME stack rhodecode up $target_container --detach | |
3406 | return |
|
3406 | return | |
3407 | else |
|
3407 | else | |
3408 | echo "Scaling to 2x ($scale_2 total) containers for $target_container" |
|
3408 | echo "Scaling to 2x ($scale_2 total) containers for $target_container" | |
3409 | ./$RC_SCRIPT_NAME stack rhodecode up $target_container --no-recreate --detach --scale $target_container=$scale_2 |
|
3409 | ./$RC_SCRIPT_NAME stack rhodecode up $target_container --no-recreate --detach --scale $target_container=$scale_2 | |
3410 | fi |
|
3410 | fi | |
3411 |
|
3411 | |||
3412 | # array with ALL new containers |
|
3412 | # array with ALL new containers | |
3413 | local -a scaled_docker_ids |
|
3413 | local -a scaled_docker_ids | |
3414 | readarray -t scaled_docker_ids < <(docker ps --filter name="$target_containers_pat" -q) |
|
3414 | readarray -t scaled_docker_ids < <(docker ps --filter name="$target_containers_pat" -q) | |
3415 |
|
3415 | |||
3416 | echo "Scaling completed, running $scale_2 services for upgrade purpose..." |
|
3416 | echo "Scaling completed, running $scale_2 services for upgrade purpose..." | |
3417 | echo "new docker-ids:" "${scaled_docker_ids[@]}" |
|
3417 | echo "new docker-ids:" "${scaled_docker_ids[@]}" | |
3418 |
|
3418 | |||
3419 | # calculate just NEW containers |
|
3419 | # calculate just NEW containers | |
3420 | declare -A new_container_check |
|
3420 | declare -A new_container_check | |
3421 |
|
3421 | |||
3422 | # Mark elements of the first initial docker |
|
3422 | # Mark elements of the first initial docker | |
3423 | for docker_id in "${old_docker_ids[@]}"; do |
|
3423 | for docker_id in "${old_docker_ids[@]}"; do | |
3424 | new_container_check[$docker_id]=1 |
|
3424 | new_container_check[$docker_id]=1 | |
3425 | done |
|
3425 | done | |
3426 |
|
3426 | |||
3427 | local new_docker_ids_str |
|
3427 | local new_docker_ids_str | |
3428 | new_docker_ids_str="" |
|
3428 | new_docker_ids_str="" | |
3429 |
|
3429 | |||
3430 | # Check if elements of the second array are not in the first |
|
3430 | # Check if elements of the second array are not in the first | |
3431 | for n_docker_id in "${scaled_docker_ids[@]}"; do |
|
3431 | for n_docker_id in "${scaled_docker_ids[@]}"; do | |
3432 | # if $docker_id in new services is empty in the last array we ADD it :) |
|
3432 | # if $docker_id in new services is empty in the last array we ADD it :) | |
3433 | if [[ -z ${new_container_check[$n_docker_id]} ]]; then |
|
3433 | if [[ -z ${new_container_check[$n_docker_id]} ]]; then | |
3434 | new_docker_ids_str+=" $n_docker_id " |
|
3434 | new_docker_ids_str+=" $n_docker_id " | |
3435 | fi |
|
3435 | fi | |
3436 | done |
|
3436 | done | |
3437 |
|
3437 | |||
3438 | echo "Stopping $scale old $target_container containers " |
|
3438 | echo "Stopping $scale old $target_container containers " | |
3439 | echo "killing docker-ids:" "${old_docker_ids[@]}" |
|
3439 | echo "killing docker-ids:" "${old_docker_ids[@]}" | |
3440 |
|
3440 | |||
3441 | spin='β Ύβ ½β »β β ―β ·' |
|
3441 | spin='β Ύβ ½β »β β ―β ·' | |
3442 | charwidth=1 |
|
3442 | charwidth=1 | |
3443 |
|
3443 | |||
3444 | # wait the required stop-wait time |
|
3444 | # wait the required stop-wait time | |
3445 | #HC: docker inspect --format='{{.Name}}: {{json .ContainerId .State.Health.Status}}' <container-id> |
|
3445 | #HC: docker inspect --format='{{.Name}}: {{json .ContainerId .State.Health.Status}}' <container-id> | |
3446 | local i |
|
3446 | local i | |
3447 | i=$(($stop_wait * 10)) |
|
3447 | i=$(($stop_wait * 10)) | |
3448 |
|
3448 | |||
3449 | local status |
|
3449 | local status | |
3450 | status='' |
|
3450 | status='' | |
3451 |
|
3451 | |||
3452 | # cursor invisible |
|
3452 | # cursor invisible | |
3453 | set_cursor civis |
|
3453 | set_cursor civis | |
3454 | while true |
|
3454 | while true | |
3455 | s=$((i / 10)) |
|
3455 | s=$((i / 10)) | |
3456 | do |
|
3456 | do | |
3457 | i=$(($i-1)) |
|
3457 | i=$(($i-1)) | |
3458 | if [[ $i -lt 1 ]]; then |
|
3458 | if [[ $i -lt 1 ]]; then | |
3459 | break |
|
3459 | break | |
3460 | fi |
|
3460 | fi | |
3461 |
|
3461 | |||
3462 | if [[ "$(($i % 10))" == 0 ]]; |
|
3462 | if [[ "$(($i % 10))" == 0 ]]; | |
3463 | then |
|
3463 | then | |
3464 | is_at_sec=1 |
|
3464 | is_at_sec=1 | |
3465 | else |
|
3465 | else | |
3466 | is_at_sec=0 |
|
3466 | is_at_sec=0 | |
3467 | fi |
|
3467 | fi | |
3468 |
|
3468 | |||
3469 | local new_docker_ids_status_cnt |
|
3469 | local new_docker_ids_status_cnt | |
3470 |
|
3470 | |||
3471 | if [[ $is_at_sec == 1 ]]; then |
|
3471 | if [[ $is_at_sec == 1 ]]; then | |
3472 |
|
3472 | |||
3473 | new_docker_ids_status_cnt=$(docker inspect --format='{{.State.Health.Status}}' $new_docker_ids_str | grep -c "healthy" || echo "") |
|
3473 | new_docker_ids_status_cnt=$(docker inspect --format='{{.State.Health.Status}}' $new_docker_ids_str | grep -c "healthy" || echo "") | |
3474 |
|
3474 | |||
3475 | if [[ $new_docker_ids_status_cnt -eq $scale ]]; then |
|
3475 | if [[ $new_docker_ids_status_cnt -eq $scale ]]; then | |
3476 | echo "All $target_container are in HEALTHY state; stopping old ones now" |
|
3476 | echo "All $target_container are in HEALTHY state; stopping old ones now" | |
3477 | echo "" |
|
3477 | echo "" | |
3478 | break |
|
3478 | break | |
3479 | fi |
|
3479 | fi | |
3480 |
|
3480 | |||
3481 | fi |
|
3481 | fi | |
3482 |
|
3482 | |||
3483 | k=$(((k + $charwidth) % ${#spin})) |
|
3483 | k=$(((k + $charwidth) % ${#spin})) | |
3484 |
|
3484 | |||
3485 | if [[ $have_tty == 1 ]]; then |
|
3485 | if [[ $have_tty == 1 ]]; then | |
3486 | printf "%s stopping $scale old containers once they are in HEALTHY state, or in $s s..." "${spin:$k:$charwidth}" |
|
3486 | printf "%s stopping $scale old containers once they are in HEALTHY state, or in $s s..." "${spin:$k:$charwidth}" | |
3487 | printf "\r" |
|
3487 | printf "\r" | |
3488 | else |
|
3488 | else | |
3489 | if [[ $is_at_sec == 1 ]]; then |
|
3489 | if [[ $is_at_sec == 1 ]]; then | |
3490 | echo "stopping $scale old containers once they are in HEALTHY state, or in $s s..." |
|
3490 | echo "stopping $scale old containers once they are in HEALTHY state, or in $s s..." | |
3491 | fi |
|
3491 | fi | |
3492 | fi |
|
3492 | fi | |
3493 |
|
3493 | |||
3494 | sleep .1 |
|
3494 | sleep .1 | |
3495 | done |
|
3495 | done | |
3496 | set_cursor cnorm |
|
3496 | set_cursor cnorm | |
3497 |
|
3497 | |||
3498 | for container in "${old_docker_ids[@]}" |
|
3498 | for container in "${old_docker_ids[@]}" | |
3499 | do |
|
3499 | do | |
3500 | echo "now running container $container stop with --time $docker_stop_wait" |
|
3500 | echo "now running container $container stop with --time $docker_stop_wait" | |
3501 | docker stop --time "$docker_stop_wait" "$container" > /dev/null |
|
3501 | docker stop --time "$docker_stop_wait" "$container" > /dev/null | |
3502 | docker rm "$container" > /dev/null |
|
3502 | docker rm "$container" > /dev/null | |
3503 | echo "Stopped $container" |
|
3503 | echo "Stopped $container" | |
3504 | done |
|
3504 | done | |
3505 |
|
3505 | |||
3506 | } |
|
3506 | } | |
3507 |
|
3507 | |||
3508 | # VCSSERVER Containers |
|
3508 | # VCSSERVER Containers | |
3509 | stop_containers "vcsserver" $docker_stop_wait $stop_wait |
|
3509 | stop_containers "vcsserver" $docker_stop_wait $stop_wait | |
3510 |
|
3510 | |||
3511 | # RHODECODE Containers |
|
3511 | # RHODECODE Containers | |
3512 | stop_containers "rhodecode" $docker_stop_wait $stop_wait |
|
3512 | stop_containers "rhodecode" $docker_stop_wait $stop_wait | |
3513 |
|
3513 | |||
3514 | # SSHD Containers |
|
3514 | # SSHD Containers | |
3515 | stop_containers "sshd" $docker_stop_wait $stop_wait |
|
3515 | stop_containers "sshd" $docker_stop_wait $stop_wait | |
3516 |
|
3516 | |||
3517 | # SVN Containers |
|
3517 | # SVN Containers | |
3518 | stop_containers "svn" $docker_stop_wait $stop_wait |
|
3518 | stop_containers "svn" $docker_stop_wait $stop_wait | |
3519 |
|
3519 | |||
3520 | ./$RC_SCRIPT_NAME stack rhodecode up celery --force-recreate --detach |
|
3520 | ./$RC_SCRIPT_NAME stack rhodecode up celery --force-recreate --detach | |
3521 | ./$RC_SCRIPT_NAME stack rhodecode up celery-beat --force-recreate --detach |
|
3521 | ./$RC_SCRIPT_NAME stack rhodecode up celery-beat --force-recreate --detach | |
3522 |
|
3522 | |||
3523 | echo "Upgrade to rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION} completed" |
|
3523 | echo "Upgrade to rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION} completed" | |
3524 | exit |
|
3524 | exit | |
3525 |
|
3525 | |||
3526 | } |
|
3526 | } | |
3527 |
|
3527 | |||
3528 | # :command.function |
|
3528 | # :command.function | |
3529 | rcstack_stack_monitor_restart_unhealthy_command() { |
|
3529 | rcstack_stack_monitor_restart_unhealthy_command() { | |
3530 | # src/stack_monitor_restart_unhealthy_command.sh |
|
3530 | # src/stack_monitor_restart_unhealthy_command.sh | |
3531 | check_bootstrap |
|
3531 | check_bootstrap | |
3532 |
|
3532 | |||
3533 | DEBUG=${args[--debug]} |
|
3533 | DEBUG=${args[--debug]} | |
3534 | loop=${args[--loop]} |
|
3534 | loop=${args[--loop]} | |
3535 |
|
3535 | |||
3536 | get_unhealthy() { |
|
3536 | get_unhealthy() { | |
3537 | unhealthy=$(docker ps --filter health=unhealthy --filter label=autoheal=true --format "{{.ID}}") |
|
3537 | unhealthy=$(docker ps --filter health=unhealthy --filter label=autoheal=true --format "{{.ID}}") | |
3538 |
|
3538 | |||
3539 | if [[ $unhealthy == "" ]]; then |
|
3539 | if [[ $unhealthy == "" ]]; then | |
3540 | echo "$(green stack-monitor: no unhealthy containers found)" |
|
3540 | echo "$(green stack-monitor: no unhealthy containers found)" | |
3541 | else |
|
3541 | else | |
3542 | echo "$(yellow stack-monitor: found unhealthy containers $unhealthy)" |
|
3542 | echo "$(yellow stack-monitor: found unhealthy containers $unhealthy)" | |
3543 | fi |
|
3543 | fi | |
3544 |
|
3544 | |||
3545 | for container in $unhealthy |
|
3545 | for container in $unhealthy | |
3546 | do |
|
3546 | do | |
3547 | docker stats --no-stream --format '{{.ID}}\t{{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.NetIO}}\t{{.BlockIO}}' $container |
|
3547 | docker stats --no-stream --format '{{.ID}}\t{{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.NetIO}}\t{{.BlockIO}}' $container | |
3548 | echo "stack-monitor: restart $container" |
|
3548 | echo "stack-monitor: restart $container" | |
3549 | docker restart --time=10 $container |
|
3549 | docker restart --time=10 $container | |
3550 | done |
|
3550 | done | |
3551 |
|
3551 | |||
3552 | } |
|
3552 | } | |
3553 |
|
3553 | |||
3554 | if [[ ! $loop == "0" ]]; then |
|
3554 | if [[ ! $loop == "0" ]]; then | |
3555 |
|
3555 | |||
3556 | while true |
|
3556 | while true | |
3557 | do |
|
3557 | do | |
3558 | date_formatted=$(date) |
|
3558 | date_formatted=$(date) | |
3559 | echo "stack-monitor: loop-run every $loop seconds..., $date_formatted" |
|
3559 | echo "stack-monitor: loop-run every $loop seconds..., $date_formatted" | |
3560 | # loop run |
|
3560 | # loop run | |
3561 | NO_COLOR=1 get_unhealthy |
|
3561 | NO_COLOR=1 get_unhealthy | |
3562 | echo "Next execution in $loop s..." && \ |
|
3562 | echo "Next execution in $loop s..." && \ | |
3563 | sleep $loop |
|
3563 | sleep $loop | |
3564 | echo "" |
|
3564 | echo "" | |
3565 | done |
|
3565 | done | |
3566 |
|
3566 | |||
3567 | else |
|
3567 | else | |
3568 |
|
3568 | |||
3569 | # one time run |
|
3569 | # one time run | |
3570 | get_unhealthy |
|
3570 | get_unhealthy | |
3571 | fi |
|
3571 | fi | |
3572 |
|
3572 | |||
3573 | exit |
|
3573 | exit | |
3574 |
|
3574 | |||
3575 | } |
|
3575 | } | |
3576 |
|
3576 | |||
3577 | # :command.function |
|
3577 | # :command.function | |
3578 | rcstack_cli_cmd_command() { |
|
3578 | rcstack_cli_cmd_command() { | |
3579 | # src/cli_cmd_command.sh |
|
3579 | # src/cli_cmd_command.sh | |
3580 | check_bootstrap |
|
3580 | check_bootstrap | |
3581 |
|
3581 | |||
3582 | if [[ -z ${args['--user']} ]]; then |
|
3582 | if [[ -z ${args['--user']} ]]; then | |
3583 | # set default, user if the flag is not used |
|
3583 | # set default, user if the flag is not used | |
3584 | args['--user']='root' |
|
3584 | args['--user']='root' | |
3585 | fi |
|
3585 | fi | |
3586 |
|
3586 | |||
3587 | DEBUG=${args[--debug]} |
|
3587 | DEBUG=${args[--debug]} | |
3588 | RUN_WITHOUT_TTY=${args[--no-tty]} |
|
3588 | RUN_WITHOUT_TTY=${args[--no-tty]} | |
3589 | ENV_FILE=${args[--env-file-path]} |
|
3589 | ENV_FILE=${args[--env-file-path]} | |
3590 | EXEC_USER=${args[--user]} |
|
3590 | EXEC_USER=${args[--user]} | |
3591 |
|
3591 | |||
3592 | INTERACTIVE_FLAGS="--interactive --tty" |
|
3592 | INTERACTIVE_FLAGS="--interactive --tty" | |
3593 | if [[ $RUN_WITHOUT_TTY ]]; then |
|
3593 | if [[ $RUN_WITHOUT_TTY ]]; then | |
3594 | INTERACTIVE_FLAGS="--interactive" |
|
3594 | INTERACTIVE_FLAGS="--interactive" | |
3595 | fi |
|
3595 | fi | |
3596 |
|
3596 | |||
3597 | proj_name=rc_cluster_apps |
|
3597 | proj_name=rc_cluster_apps | |
3598 | # use vcsserver here because it won't do any extra logic like rhodecode image does |
|
3598 | # use vcsserver here because it won't do any extra logic like rhodecode image does | |
3599 | instance_type=vcsserver |
|
3599 | instance_type=vcsserver | |
3600 |
|
3600 | |||
3601 | if [ ${#other_args[@]} -eq 0 ]; then |
|
3601 | if [ ${#other_args[@]} -eq 0 ]; then | |
3602 | other_args[${#other_args[@]}]="echo 'please provide a valid cmd arg...'" |
|
3602 | other_args[${#other_args[@]}]="echo 'please provide a valid cmd arg...'" | |
3603 | fi |
|
3603 | fi | |
3604 |
|
3604 | |||
3605 | printf "*Volumes*:\n" |
|
3605 | printf "*Volumes*:\n" | |
3606 | printf " attaching $PWD/config/_shared \t\tunder: /vol/confvolume\n" |
|
3606 | printf " attaching $PWD/config/_shared \t\tunder: /vol/confvolume\n" | |
3607 | printf "\n" |
|
3607 | printf "\n" | |
3608 |
|
3608 | |||
3609 | #printf "attaching rc_reposvolume \t\tunder: /vol/repovolume\n" |
|
3609 | #printf "attaching rc_reposvolume \t\tunder: /vol/repovolume\n" | |
3610 | #printf "attaching \$PWD/.custom/storage \t\tunder: /vol/backupvolume\n" |
|
3610 | #printf "attaching \$PWD/.custom/storage \t\tunder: /vol/backupvolume\n" | |
3611 |
|
3611 | |||
3612 | CMD_EXEC="\ |
|
3612 | CMD_EXEC="\ | |
3613 | RC_ENV_FILE=$ENV_FILE docker compose \ |
|
3613 | RC_ENV_FILE=$ENV_FILE docker compose \ | |
3614 | --env-file $ENV_FILE \ |
|
3614 | --env-file $ENV_FILE \ | |
3615 | $ENV_EXPAND \ |
|
3615 | $ENV_EXPAND \ | |
3616 | --project-name $proj_name \ |
|
3616 | --project-name $proj_name \ | |
3617 | -f docker-compose-base.yaml \ |
|
3617 | -f docker-compose-base.yaml \ | |
3618 | -f docker-compose-apps.yaml \ |
|
3618 | -f docker-compose-apps.yaml \ | |
3619 | run \ |
|
3619 | run \ | |
3620 | --user $EXEC_USER \ |
|
3620 | --user $EXEC_USER \ | |
3621 | --rm \ |
|
3621 | --rm \ | |
3622 | $INTERACTIVE_FLAGS \ |
|
3622 | $INTERACTIVE_FLAGS \ | |
3623 | --volume=$PWD/config/_shared:/vol/confvolume \ |
|
3623 | --volume=$PWD/config/_shared:/vol/confvolume \ | |
3624 | --workdir=/vol/confvolume \ |
|
3624 | --workdir=/vol/confvolume \ | |
3625 | $instance_type" |
|
3625 | $instance_type" | |
3626 |
|
3626 | |||
3627 | if [[ $DEBUG ]]; then |
|
3627 | if [[ $DEBUG ]]; then | |
3628 | echo $CMD_EXEC |
|
3628 | echo $CMD_EXEC | |
3629 | echo ${other_args[*]} |
|
3629 | echo ${other_args[*]} | |
3630 | fi |
|
3630 | fi | |
3631 |
|
3631 | |||
3632 | eval "${CMD_EXEC} ${other_args[*]}" |
|
3632 | eval "${CMD_EXEC} ${other_args[*]}" | |
3633 |
|
3633 | |||
3634 | } |
|
3634 | } | |
3635 |
|
3635 | |||
3636 | # :command.function |
|
3636 | # :command.function | |
3637 | rcstack_cli_ishell_command() { |
|
3637 | rcstack_cli_ishell_command() { | |
3638 | # src/cli_ishell_command.sh |
|
3638 | # src/cli_ishell_command.sh | |
3639 | check_bootstrap |
|
3639 | check_bootstrap | |
3640 |
|
3640 | |||
3641 | if [[ -z ${args['--user']} ]]; then |
|
3641 | if [[ -z ${args['--user']} ]]; then | |
3642 | # set default, user if the flag is not used |
|
3642 | # set default, user if the flag is not used | |
3643 | args['--user']='rhodecode' |
|
3643 | args['--user']='rhodecode' | |
3644 | fi |
|
3644 | fi | |
3645 |
|
3645 | |||
3646 | DEBUG=${args[--debug]} |
|
3646 | DEBUG=${args[--debug]} | |
3647 | RUN_WITHOUT_TTY=${args[--no-tty]} |
|
3647 | RUN_WITHOUT_TTY=${args[--no-tty]} | |
3648 | ENV_FILE=${args[--env-file-path]} |
|
3648 | ENV_FILE=${args[--env-file-path]} | |
3649 | EXEC_USER=${args[--user]} |
|
3649 | EXEC_USER=${args[--user]} | |
3650 |
|
3650 | |||
3651 | INTERACTIVE_FLAGS="--interactive --tty" |
|
3651 | INTERACTIVE_FLAGS="--interactive --tty" | |
3652 | if [[ $RUN_WITHOUT_TTY ]]; then |
|
3652 | if [[ $RUN_WITHOUT_TTY ]]; then | |
3653 | INTERACTIVE_FLAGS="--interactive" |
|
3653 | INTERACTIVE_FLAGS="--interactive" | |
3654 | fi |
|
3654 | fi | |
3655 |
|
3655 | |||
3656 | proj_name=rc_cluster_apps |
|
3656 | proj_name=rc_cluster_apps | |
3657 | instance_type=rhodecode |
|
3657 | instance_type=rhodecode | |
3658 |
|
3658 | |||
3659 | docker_id=$(docker ps --filter name=$proj_name-$instance_type -q | head -n1) |
|
3659 | docker_id=$(docker ps --filter name=$proj_name-$instance_type -q | head -n1) | |
3660 | if [[ $docker_id == "" ]]; then |
|
3660 | if [[ $docker_id == "" ]]; then | |
3661 | echo "$(yellow cannot find docker instance \($proj_name-$instance_type\) for command execution. Please make sure it is running.)" |
|
3661 | echo "$(yellow cannot find docker instance \($proj_name-$instance_type\) for command execution. Please make sure it is running.)" | |
3662 | exit 1 |
|
3662 | exit 1 | |
3663 | fi |
|
3663 | fi | |
3664 |
|
3664 | |||
3665 | index_num=$(docker inspect "$docker_id" --format '{{ index .Config.Labels "com.docker.compose.container-number" }}') |
|
3665 | index_num=$(docker inspect "$docker_id" --format '{{ index .Config.Labels "com.docker.compose.container-number" }}') | |
3666 | if [[ -z "$index_num" ]] |
|
3666 | if [[ -z "$index_num" ]] | |
3667 | then |
|
3667 | then | |
3668 | index_num="0" |
|
3668 | index_num="0" | |
3669 | fi |
|
3669 | fi | |
3670 |
|
3670 | |||
3671 | RC_STACK_PROFILES="--profile database --profile redis --profile elasticsearch --profile channelstream" |
|
3671 | RC_STACK_PROFILES="--profile database --profile redis --profile elasticsearch --profile channelstream" | |
3672 |
|
3672 | |||
3673 | CMD_EXEC="\ |
|
3673 | CMD_EXEC="\ | |
3674 | RC_ENV_FILE=$ENV_FILE docker compose \ |
|
3674 | RC_ENV_FILE=$ENV_FILE docker compose \ | |
3675 | --env-file $ENV_FILE \ |
|
3675 | --env-file $ENV_FILE \ | |
3676 | $ENV_EXPAND \ |
|
3676 | $ENV_EXPAND \ | |
3677 | $RC_STACK_PROFILES \ |
|
3677 | $RC_STACK_PROFILES \ | |
3678 | --project-name $proj_name \ |
|
3678 | --project-name $proj_name \ | |
3679 | -f docker-compose-base.yaml \ |
|
3679 | -f docker-compose-base.yaml \ | |
3680 | -f docker-compose-apps.yaml \ |
|
3680 | -f docker-compose-apps.yaml \ | |
3681 | exec \ |
|
3681 | exec \ | |
3682 | --index $index_num \ |
|
3682 | --index $index_num \ | |
3683 | --user $EXEC_USER \ |
|
3683 | --user $EXEC_USER \ | |
3684 | $INTERACTIVE_FLAGS \ |
|
3684 | $INTERACTIVE_FLAGS \ | |
3685 | $instance_type \ |
|
3685 | $instance_type \ | |
3686 | /usr/local/bin/rhodecode_bin/bin/rc-ishell \ |
|
3686 | /usr/local/bin/rhodecode_bin/bin/rc-ishell \ | |
3687 | /etc/rhodecode/conf/rhodecode.ini" |
|
3687 | /etc/rhodecode/conf/rhodecode.ini" | |
3688 |
|
3688 | |||
3689 | if [[ $DEBUG ]]; then |
|
3689 | if [[ $DEBUG ]]; then | |
3690 | echo $CMD_EXEC |
|
3690 | echo $CMD_EXEC | |
3691 | echo ${other_args[*]} |
|
3691 | echo ${other_args[*]} | |
3692 | fi |
|
3692 | fi | |
3693 |
|
3693 | |||
3694 | eval "${CMD_EXEC}" |
|
3694 | eval "${CMD_EXEC}" | |
3695 |
|
3695 | |||
3696 | } |
|
3696 | } | |
3697 |
|
3697 | |||
3698 | # :command.function |
|
3698 | # :command.function | |
3699 | rcstack_cli_image_info_command() { |
|
3699 | rcstack_cli_image_info_command() { | |
3700 | # src/cli_image_info_command.sh |
|
3700 | # src/cli_image_info_command.sh | |
3701 |
|
3701 | |||
3702 | verbose=${args[--verbose]} |
|
3702 | verbose=${args[--verbose]} | |
3703 |
|
3703 | |||
3704 | if [[ $verbose ]]; then |
|
3704 | if [[ $verbose ]]; then | |
3705 |
|
3705 | |||
3706 | ver="unknown" |
|
3706 | ver="unknown" | |
3707 | if [[ -f $RUNTIME_ENV ]]; then |
|
3707 | if [[ -f $RUNTIME_ENV ]]; then | |
3708 | .env --file $RUNTIME_ENV |
|
3708 | .env --file $RUNTIME_ENV | |
3709 | .env get_or_error RC_VERSION |
|
3709 | .env get_or_error RC_VERSION | |
3710 | ver=$REPLY |
|
3710 | ver=$REPLY | |
3711 | fi |
|
3711 | fi | |
3712 |
|
3712 | |||
3713 | echo "Image stored version: $rc_image_ver" |
|
3713 | echo "Image stored version: $rc_image_ver" | |
3714 | echo "Image from runtime: $ver" |
|
3714 | echo "Image from runtime: $ver" | |
3715 | echo "runtime-file=$RUNTIME_ENV" |
|
3715 | echo "runtime-file=$RUNTIME_ENV" | |
3716 | echo "RC_VERSION=$ver" |
|
3716 | echo "RC_VERSION=$ver" | |
3717 | else |
|
3717 | else | |
3718 | echo $rc_image_ver |
|
3718 | echo $rc_image_ver | |
3719 | fi |
|
3719 | fi | |
3720 |
|
3720 | |||
3721 | } |
|
3721 | } | |
3722 |
|
3722 | |||
3723 | # :command.function |
|
3723 | # :command.function | |
3724 | rcstack_cli_set_runtime_image_command() { |
|
3724 | rcstack_cli_set_runtime_image_command() { | |
3725 | # src/cli_set_runtime_image_command.sh |
|
3725 | # src/cli_set_runtime_image_command.sh | |
3726 | set_ver=${args[version]} |
|
3726 | set_ver=${args[version]} | |
3727 |
|
3727 | |||
3728 | .env --file $RUNTIME_ENV |
|
3728 | .env --file $RUNTIME_ENV | |
3729 | echo "setting runtime version to $set_ver into $RUNTIME_ENV" |
|
3729 | echo "setting runtime version to $set_ver into $RUNTIME_ENV" | |
3730 |
|
3730 | |||
3731 | .env set RC_VERSION=$set_ver |
|
3731 | .env set RC_VERSION=$set_ver | |
3732 |
|
3732 | |||
3733 | echo "New version set to $set_ver" |
|
3733 | echo "New version set to $set_ver" | |
3734 |
|
3734 | |||
3735 | } |
|
3735 | } | |
3736 |
|
3736 | |||
3737 | # :command.function |
|
3737 | # :command.function | |
3738 | rcstack_cli_docker_info_command() { |
|
3738 | rcstack_cli_docker_info_command() { | |
3739 | # src/cli_docker_info_command.sh |
|
3739 | # src/cli_docker_info_command.sh | |
3740 | verbose=${args[--verbose]} |
|
3740 | verbose=${args[--verbose]} | |
3741 |
|
3741 | |||
3742 | docker --version |
|
3742 | docker --version | |
3743 | docker compose version |
|
3743 | docker compose version | |
3744 |
|
3744 | |||
3745 | if [[ $verbose ]]; then |
|
3745 | if [[ $verbose ]]; then | |
3746 | echo "-- DETAILED DOCKER INFO --" |
|
3746 | echo "-- DETAILED DOCKER INFO --" | |
3747 | docker version |
|
3747 | docker version | |
3748 | fi |
|
3748 | fi | |
3749 |
|
3749 | |||
3750 | } |
|
3750 | } | |
3751 |
|
3751 | |||
3752 | # :command.function |
|
3752 | # :command.function | |
3753 | rcstack_cli_docker_upgrade_command() { |
|
3753 | rcstack_cli_docker_upgrade_command() { | |
3754 | # src/cli_docker_upgrade_command.sh |
|
3754 | # src/cli_docker_upgrade_command.sh | |
3755 | DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker} |
|
3755 | DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker} | |
3756 | DOCKER_CLI_PLUGINS=$DOCKER_CONFIG/cli-plugins |
|
3756 | DOCKER_CLI_PLUGINS=$DOCKER_CONFIG/cli-plugins | |
3757 | upgrade_compose=${args[--compose]} |
|
3757 | upgrade_compose=${args[--compose]} | |
3758 |
|
3758 | |||
3759 | compose_script_name="install-docker.sh" |
|
3759 | compose_script_name="install-docker.sh" | |
3760 |
|
3760 | |||
3761 | curl -fsSL https://get.docker.com -o "$compose_script_name" |
|
3761 | curl -fsSL https://get.docker.com -o "$compose_script_name" | |
3762 | # sh install-docker.sh --version 23.0 |
|
3762 | # sh install-docker.sh --version 23.0 | |
3763 | sh "$compose_script_name" |
|
3763 | sh "$compose_script_name" | |
3764 | rm -rf "$compose_script_name" |
|
3764 | rm -rf "$compose_script_name" | |
3765 |
|
3765 | |||
3766 | if [[ $upgrade_compose ]]; then |
|
3766 | if [[ $upgrade_compose ]]; then | |
3767 |
|
3767 | |||
3768 | os_type=$(check_os) |
|
3768 | os_type=$(check_os) | |
3769 | if [ "$os_type" != "Linux" ]; then |
|
3769 | if [ "$os_type" != "Linux" ]; then | |
3770 | echo "$(red compose upgrade is only available for Linux architecture, got \'$os_type\' instead)" |
|
3770 | echo "$(red compose upgrade is only available for Linux architecture, got \'$os_type\' instead)" | |
3771 | exit |
|
3771 | exit | |
3772 | fi |
|
3772 | fi | |
3773 |
|
3773 | |||
3774 | # just ensure we have this dir |
|
3774 | # just ensure we have this dir | |
3775 | mkdir -p "$DOCKER_CLI_PLUGINS" |
|
3775 | mkdir -p "$DOCKER_CLI_PLUGINS" | |
3776 |
|
3776 | |||
3777 | if [[ -f "$DOCKER_CLI_PLUGINS/docker-compose" ]]; then |
|
3777 | if [[ -f "$DOCKER_CLI_PLUGINS/docker-compose" ]]; then | |
3778 | echo "found docker-compose at $DOCKER_CLI_PLUGINS, removing it now..." |
|
3778 | echo "found docker-compose at $DOCKER_CLI_PLUGINS, removing it now..." | |
3779 | rm -rf "$DOCKER_CLI_PLUGINS/docker-compose" |
|
3779 | rm -rf "$DOCKER_CLI_PLUGINS/docker-compose" | |
3780 | fi |
|
3780 | fi | |
3781 |
|
3781 | |||
3782 | NEW_COMPOSE_VERSION=$(curl --silent https://api.github.com/repos/docker/compose/releases/latest | grep -Po '"tag_name": "\K.*\d') |
|
3782 | NEW_COMPOSE_VERSION=$(curl --silent https://api.github.com/repos/docker/compose/releases/latest | grep -Po '"tag_name": "\K.*\d') | |
3783 | echo "new compose version $NEW_COMPOSE_VERSION to be installed in $DOCKER_CLI_PLUGINS" |
|
3783 | echo "new compose version $NEW_COMPOSE_VERSION to be installed in $DOCKER_CLI_PLUGINS" | |
3784 | curl -fsSL https://github.com/docker/compose/releases/download/$NEW_COMPOSE_VERSION/docker-compose-linux-x86_64 -o $DOCKER_CLI_PLUGINS/docker-compose |
|
3784 | curl -fsSL https://github.com/docker/compose/releases/download/$NEW_COMPOSE_VERSION/docker-compose-linux-x86_64 -o $DOCKER_CLI_PLUGINS/docker-compose | |
3785 | chmod +x $DOCKER_CLI_PLUGINS/docker-compose |
|
3785 | chmod +x $DOCKER_CLI_PLUGINS/docker-compose | |
3786 | echo "updated compose to $NEW_COMPOSE_VERSION" |
|
3786 | echo "updated compose to $NEW_COMPOSE_VERSION" | |
3787 | fi |
|
3787 | fi | |
3788 |
|
3788 | |||
3789 | } |
|
3789 | } | |
3790 |
|
3790 | |||
3791 | # :command.function |
|
3791 | # :command.function | |
3792 | rcstack_cli_redis_command() { |
|
3792 | rcstack_cli_redis_command() { | |
3793 | # src/cli_redis_command.sh |
|
3793 | # src/cli_redis_command.sh | |
3794 | check_bootstrap |
|
3794 | check_bootstrap | |
3795 |
|
3795 | |||
3796 | if [[ -z ${args['--user']} ]]; then |
|
3796 | if [[ -z ${args['--user']} ]]; then | |
3797 | # set default, user if the flag is not used |
|
3797 | # set default, user if the flag is not used | |
3798 | args['--user']='root' |
|
3798 | args['--user']='root' | |
3799 | fi |
|
3799 | fi | |
3800 |
|
3800 | |||
3801 | DEBUG=${args[--debug]} |
|
3801 | DEBUG=${args[--debug]} | |
3802 | RUN_WITHOUT_TTY=${args[--no-tty]} |
|
3802 | RUN_WITHOUT_TTY=${args[--no-tty]} | |
3803 | ENV_FILE=${args[--env-file-path]} |
|
3803 | ENV_FILE=${args[--env-file-path]} | |
3804 | EXEC_USER=${args[--user]} |
|
3804 | EXEC_USER=${args[--user]} | |
3805 | db_num=${args[--db]} |
|
3805 | db_num=${args[--db]} | |
3806 |
|
3806 | |||
3807 | INTERACTIVE_FLAGS="--interactive --tty" |
|
3807 | INTERACTIVE_FLAGS="--interactive --tty" | |
3808 | if [[ $RUN_WITHOUT_TTY ]]; then |
|
3808 | if [[ $RUN_WITHOUT_TTY ]]; then | |
3809 | INTERACTIVE_FLAGS="--interactive" |
|
3809 | INTERACTIVE_FLAGS="--interactive" | |
3810 | fi |
|
3810 | fi | |
3811 |
|
3811 | |||
3812 | proj_name=rc_cluster_services |
|
3812 | proj_name=rc_cluster_services | |
3813 | instance_type=redis |
|
3813 | instance_type=redis | |
3814 |
|
3814 | |||
3815 | docker_id=$(docker ps --filter name=$proj_name-$instance_type -q | head -n1) |
|
3815 | docker_id=$(docker ps --filter name=$proj_name-$instance_type -q | head -n1) | |
3816 | if [[ $docker_id == "" ]]; then |
|
3816 | if [[ $docker_id == "" ]]; then | |
3817 | echo "$(yellow cannot find docker instance \($proj_name-$instance_type\) for command execution. Please make sure it is running.)" |
|
3817 | echo "$(yellow cannot find docker instance \($proj_name-$instance_type\) for command execution. Please make sure it is running.)" | |
3818 | exit 1 |
|
3818 | exit 1 | |
3819 | fi |
|
3819 | fi | |
3820 |
|
3820 | |||
3821 | index_num=$(docker inspect "$docker_id" --format '{{ index .Config.Labels "com.docker.compose.container-number" }}') |
|
3821 | index_num=$(docker inspect "$docker_id" --format '{{ index .Config.Labels "com.docker.compose.container-number" }}') | |
3822 | if [[ -z "$index_num" ]] |
|
3822 | if [[ -z "$index_num" ]] | |
3823 | then |
|
3823 | then | |
3824 | index_num="0" |
|
3824 | index_num="0" | |
3825 | fi |
|
3825 | fi | |
3826 |
|
3826 | |||
3827 | RC_STACK_PROFILES="--profile database --profile redis --profile elasticsearch --profile channelstream" |
|
3827 | RC_STACK_PROFILES="--profile database --profile redis --profile elasticsearch --profile channelstream" | |
3828 |
|
3828 | |||
3829 | CMD_EXEC="\ |
|
3829 | CMD_EXEC="\ | |
3830 | RC_ENV_FILE=$ENV_FILE docker compose \ |
|
3830 | RC_ENV_FILE=$ENV_FILE docker compose \ | |
3831 | --env-file $ENV_FILE \ |
|
3831 | --env-file $ENV_FILE \ | |
3832 | $ENV_EXPAND \ |
|
3832 | $ENV_EXPAND \ | |
3833 | $RC_STACK_PROFILES \ |
|
3833 | $RC_STACK_PROFILES \ | |
3834 | --project-name $proj_name \ |
|
3834 | --project-name $proj_name \ | |
3835 | -f docker-compose-base.yaml \ |
|
3835 | -f docker-compose-base.yaml \ | |
3836 | -f docker-compose-services.yaml \ |
|
3836 | -f docker-compose-services.yaml \ | |
3837 | exec \ |
|
3837 | exec \ | |
3838 | --user $EXEC_USER \ |
|
3838 | --user $EXEC_USER \ | |
3839 | $INTERACTIVE_FLAGS \ |
|
3839 | $INTERACTIVE_FLAGS \ | |
3840 | $instance_type \ |
|
3840 | $instance_type \ | |
3841 | /bin/bash -c 'redis-cli -n $db_num'" |
|
3841 | /bin/bash -c 'redis-cli -n $db_num'" | |
3842 |
|
3842 | |||
3843 | if [[ $DEBUG ]]; then |
|
3843 | if [[ $DEBUG ]]; then | |
3844 | echo $CMD_EXEC |
|
3844 | echo $CMD_EXEC | |
3845 | echo ${other_args[*]} |
|
3845 | echo ${other_args[*]} | |
3846 | fi |
|
3846 | fi | |
3847 |
|
3847 | |||
3848 | eval "${CMD_EXEC}" |
|
3848 | eval "${CMD_EXEC}" | |
3849 |
|
3849 | |||
3850 | } |
|
3850 | } | |
3851 |
|
3851 | |||
3852 | # :command.function |
|
3852 | # :command.function | |
3853 | rcstack_cli_db_command() { |
|
3853 | rcstack_cli_db_command() { | |
3854 | # src/cli_db_command.sh |
|
3854 | # src/cli_db_command.sh | |
3855 | check_bootstrap |
|
3855 | check_bootstrap | |
3856 |
|
3856 | |||
3857 | if [[ -z ${args['--user']} ]]; then |
|
3857 | if [[ -z ${args['--user']} ]]; then | |
3858 | # set default, user if the flag is not used |
|
3858 | # set default, user if the flag is not used | |
3859 | args['--user']='root' |
|
3859 | args['--user']='root' | |
3860 | fi |
|
3860 | fi | |
3861 |
|
3861 | |||
3862 | DEBUG=${args[--debug]} |
|
3862 | DEBUG=${args[--debug]} | |
3863 | RUN_WITHOUT_TTY=${args[--no-tty]} |
|
3863 | RUN_WITHOUT_TTY=${args[--no-tty]} | |
3864 | ENV_FILE=${args[--env-file-path]} |
|
3864 | ENV_FILE=${args[--env-file-path]} | |
3865 | EXEC_USER=${args[--user]} |
|
3865 | EXEC_USER=${args[--user]} | |
3866 |
|
3866 | |||
3867 | INTERACTIVE_FLAGS="--interactive --tty" |
|
3867 | INTERACTIVE_FLAGS="--interactive --tty" | |
3868 | if [[ $RUN_WITHOUT_TTY ]]; then |
|
3868 | if [[ $RUN_WITHOUT_TTY ]]; then | |
3869 | INTERACTIVE_FLAGS="--interactive" |
|
3869 | INTERACTIVE_FLAGS="--interactive" | |
3870 | fi |
|
3870 | fi | |
3871 |
|
3871 | |||
3872 | .env --file $ENV_FILE |
|
3872 | .env --file $ENV_FILE | |
3873 |
|
3873 | |||
3874 | .env get_or_error DB_PASSWORD |
|
3874 | .env get_or_error DB_PASSWORD | |
3875 | DB_PASSWORD=$REPLY |
|
3875 | DB_PASSWORD=$REPLY | |
3876 |
|
3876 | |||
3877 | .env get_or_error DB_NAME |
|
3877 | .env get_or_error DB_NAME | |
3878 | DB_NAME=$REPLY |
|
3878 | DB_NAME=$REPLY | |
3879 |
|
3879 | |||
3880 | .env get_or_error DB_USER |
|
3880 | .env get_or_error DB_USER | |
3881 | DB_USER=$REPLY |
|
3881 | DB_USER=$REPLY | |
3882 |
|
3882 | |||
3883 | proj_name=rc_cluster_services |
|
3883 | proj_name=rc_cluster_services | |
3884 | instance_type=database |
|
3884 | instance_type=database | |
3885 |
|
3885 | |||
3886 | docker_id=$(docker ps --filter name=$proj_name-$instance_type -q | head -n1) |
|
3886 | docker_id=$(docker ps --filter name=$proj_name-$instance_type -q | head -n1) | |
3887 | if [[ $docker_id == "" ]]; then |
|
3887 | if [[ $docker_id == "" ]]; then | |
3888 | echo "$(yellow cannot find docker instance \($proj_name-$instance_type\) for command execution. Please make sure it is running.)" |
|
3888 | echo "$(yellow cannot find docker instance \($proj_name-$instance_type\) for command execution. Please make sure it is running.)" | |
3889 | exit 1 |
|
3889 | exit 1 | |
3890 | fi |
|
3890 | fi | |
3891 |
|
3891 | |||
3892 | index_num=$(docker inspect "$docker_id" --format '{{ index .Config.Labels "com.docker.compose.container-number" }}') |
|
3892 | index_num=$(docker inspect "$docker_id" --format '{{ index .Config.Labels "com.docker.compose.container-number" }}') | |
3893 | if [[ -z "$index_num" ]] |
|
3893 | if [[ -z "$index_num" ]] | |
3894 | then |
|
3894 | then | |
3895 | index_num="0" |
|
3895 | index_num="0" | |
3896 | fi |
|
3896 | fi | |
3897 |
|
3897 | |||
3898 | RC_STACK_PROFILES="--profile database --profile redis --profile elasticsearch --profile channelstream" |
|
3898 | RC_STACK_PROFILES="--profile database --profile redis --profile elasticsearch --profile channelstream" | |
3899 |
|
3899 | |||
3900 | CMD_EXEC="\ |
|
3900 | CMD_EXEC="\ | |
3901 | RC_ENV_FILE=$ENV_FILE docker compose \ |
|
3901 | RC_ENV_FILE=$ENV_FILE docker compose \ | |
3902 | --env-file $ENV_FILE \ |
|
3902 | --env-file $ENV_FILE \ | |
3903 | $ENV_EXPAND \ |
|
3903 | $ENV_EXPAND \ | |
3904 | $RC_STACK_PROFILES \ |
|
3904 | $RC_STACK_PROFILES \ | |
3905 | --project-name $proj_name \ |
|
3905 | --project-name $proj_name \ | |
3906 | -f docker-compose-base.yaml \ |
|
3906 | -f docker-compose-base.yaml \ | |
3907 | -f docker-compose-services.yaml \ |
|
3907 | -f docker-compose-services.yaml \ | |
3908 | exec \ |
|
3908 | exec \ | |
3909 | --user $EXEC_USER \ |
|
3909 | --user $EXEC_USER \ | |
3910 | $INTERACTIVE_FLAGS \ |
|
3910 | $INTERACTIVE_FLAGS \ | |
3911 | $instance_type \ |
|
3911 | $instance_type \ | |
3912 | /bin/bash -c 'PGPASSWORD=$DB_PASSWORD psql --username=$DB_USER --dbname=$DB_NAME'" |
|
3912 | /bin/bash -c 'PGPASSWORD=$DB_PASSWORD psql --username=$DB_USER --dbname=$DB_NAME'" | |
3913 |
|
3913 | |||
3914 | if [[ $DEBUG ]]; then |
|
3914 | if [[ $DEBUG ]]; then | |
3915 | echo $CMD_EXEC |
|
3915 | echo $CMD_EXEC | |
3916 | echo ${other_args[*]} |
|
3916 | echo ${other_args[*]} | |
3917 | fi |
|
3917 | fi | |
3918 |
|
3918 | |||
3919 | printf "*Volumes*:\n" |
|
3919 | printf "*Volumes*:\n" | |
3920 | printf " attaching pg_data under: /var/lib/postgresql/data\n" |
|
3920 | printf " attaching pg_data under: /var/lib/postgresql/data\n" | |
3921 | printf " attaching \$PWD/.custom/db_dump under: /var/rc-data-dump\n" |
|
3921 | printf " attaching \$PWD/.custom/db_dump under: /var/rc-data-dump\n" | |
3922 | printf "\n" |
|
3922 | printf "\n" | |
3923 | printf "*Restore dump*:\n" |
|
3923 | printf "*Restore dump*:\n" | |
3924 | printf " \i /var/rc-data-dump/your_dump.sql\n" |
|
3924 | printf " \i /var/rc-data-dump/your_dump.sql\n" | |
3925 | printf "\n" |
|
3925 | printf "\n" | |
3926 |
|
3926 | |||
3927 | eval "${CMD_EXEC}" |
|
3927 | eval "${CMD_EXEC}" | |
3928 |
|
3928 | |||
3929 | } |
|
3929 | } | |
3930 |
|
3930 | |||
3931 | # :command.function |
|
3931 | # :command.function | |
3932 | rcstack_cli_db_upgrade_command() { |
|
3932 | rcstack_cli_db_upgrade_command() { | |
3933 | # src/cli_db_upgrade_command.sh |
|
3933 | # src/cli_db_upgrade_command.sh | |
3934 | check_bootstrap |
|
3934 | check_bootstrap | |
3935 |
|
3935 | |||
3936 | DEBUG=${args[--debug]} |
|
3936 | DEBUG=${args[--debug]} | |
3937 |
|
3937 | |||
3938 | target_container=rc_cluster_services-database-* |
|
3938 | target_container=rc_cluster_services-database-* | |
3939 | docker_id=$(docker ps --filter name=$target_container -q | head -n1) |
|
3939 | docker_id=$(docker ps --filter name=$target_container -q | head -n1) | |
3940 |
|
3940 | |||
3941 | if [[ $DEBUG ]]; then |
|
3941 | if [[ $DEBUG ]]; then | |
3942 | echo "container id: $docker_id, based on $target_container filter" |
|
3942 | echo "container id: $docker_id, based on $target_container filter" | |
3943 | docker ps |
|
3943 | docker ps | |
3944 | fi |
|
3944 | fi | |
3945 |
|
3945 | |||
3946 | if [ "$docker_id" == "" ]; then |
|
3946 | if [ "$docker_id" == "" ]; then | |
3947 | MSG="Cannot find container ID with name $target_container" |
|
3947 | MSG="Cannot find container ID with name $target_container" | |
3948 | echo "$(red $MSG)" |
|
3948 | echo "$(red $MSG)" | |
3949 | exit 1 |
|
3949 | exit 1 | |
3950 | fi |
|
3950 | fi | |
3951 |
|
3951 | |||
3952 | if [[ $DEBUG ]]; then |
|
3952 | if [[ $DEBUG ]]; then | |
3953 | echo "./$RC_SCRIPT_NAME stack rhodecode exec rhodecode /usr/local/bin/rhodecode_bin/bin/rc-upgrade-db /etc/rhodecode/conf/rhodecode.ini --force-yes" |
|
3953 | echo "./$RC_SCRIPT_NAME stack rhodecode exec rhodecode /usr/local/bin/rhodecode_bin/bin/rc-upgrade-db /etc/rhodecode/conf/rhodecode.ini --force-yes" | |
3954 | fi |
|
3954 | fi | |
3955 |
|
3955 | |||
3956 | ./$RC_SCRIPT_NAME stack rhodecode exec rhodecode /usr/local/bin/rhodecode_bin/bin/rc-upgrade-db /etc/rhodecode/conf/rhodecode.ini --force-yes |
|
3956 | ./$RC_SCRIPT_NAME stack rhodecode exec rhodecode /usr/local/bin/rhodecode_bin/bin/rc-upgrade-db /etc/rhodecode/conf/rhodecode.ini --force-yes | |
3957 | } |
|
3957 | } | |
3958 |
|
3958 | |||
3959 | # :command.function |
|
3959 | # :command.function | |
3960 | rcstack_cli_storage_command() { |
|
3960 | rcstack_cli_storage_command() { | |
3961 | # src/cli_storage_command.sh |
|
3961 | # src/cli_storage_command.sh | |
3962 | check_bootstrap |
|
3962 | check_bootstrap | |
3963 |
|
3963 | |||
3964 | DEBUG=${args[--debug]} |
|
3964 | DEBUG=${args[--debug]} | |
3965 | RUN_WITHOUT_TTY=${args[--no-tty]} |
|
3965 | RUN_WITHOUT_TTY=${args[--no-tty]} | |
3966 | INTERACTIVE_FLAGS="--interactive --tty" |
|
3966 | INTERACTIVE_FLAGS="--interactive --tty" | |
3967 | if [[ $RUN_WITHOUT_TTY ]]; then |
|
3967 | if [[ $RUN_WITHOUT_TTY ]]; then | |
3968 | INTERACTIVE_FLAGS="--interactive" |
|
3968 | INTERACTIVE_FLAGS="--interactive" | |
3969 | fi |
|
3969 | fi | |
3970 |
|
3970 | |||
3971 | ENV_FILE=${args[--env-file-path]} |
|
3971 | ENV_FILE=${args[--env-file-path]} | |
3972 | ATTACHED=${args[--attached]} |
|
3972 | ATTACHED=${args[--attached]} | |
3973 |
|
3973 | |||
3974 | if [[ $DEBUG ]]; then |
|
3974 | if [[ $DEBUG ]]; then | |
3975 | echo "rc_datavolume inspection..." |
|
3975 | echo "rc_datavolume inspection..." | |
3976 | docker volume inspect rc_datavolume |
|
3976 | docker volume inspect rc_datavolume | |
3977 |
|
3977 | |||
3978 | echo "rc_reposvolume inspection..." |
|
3978 | echo "rc_reposvolume inspection..." | |
3979 | docker volume inspect rc_reposvolume |
|
3979 | docker volume inspect rc_reposvolume | |
3980 | fi |
|
3980 | fi | |
3981 |
|
3981 | |||
3982 | # |
|
3982 | # | |
3983 | #if [[ $DEBUG ]]; then |
|
3983 | #if [[ $DEBUG ]]; then | |
3984 | # echo "image id: $image_id, based on $target_container filter" |
|
3984 | # echo "image id: $image_id, based on $target_container filter" | |
3985 | # docker image ls |
|
3985 | # docker image ls | |
3986 | # echo "---" |
|
3986 | # echo "---" | |
3987 | #fi |
|
3987 | #fi | |
3988 | # rename a volume |
|
3988 | # rename a volume | |
3989 | #docker volume create --name <new_volume> |
|
3989 | #docker volume create --name <new_volume> | |
3990 | #docker run --rm -it -v <old_volume>:/from -v <new_volume>:/to alpine ash -c "cd /from ; cp -av . /to" |
|
3990 | #docker run --rm -it -v <old_volume>:/from -v <new_volume>:/to alpine ash -c "cd /from ; cp -av . /to" | |
3991 | #docker volume rm <old_volume> |
|
3991 | #docker volume rm <old_volume> | |
3992 |
|
3992 | |||
3993 | if [[ $ATTACHED ]]; then |
|
3993 | if [[ $ATTACHED ]]; then | |
3994 | printf "Starting with attached mode to vcsserver !" |
|
3994 | printf "Starting with attached mode to vcsserver !" | |
3995 | printf "present rc_datavolume \t\tunder: /var/opt/rhodecode_data\n" |
|
3995 | printf "present rc_datavolume \t\tunder: /var/opt/rhodecode_data\n" | |
3996 | printf "present rc_reposvolume \t\tunder: /var/opt/rhodecode_repo_store\n" |
|
3996 | printf "present rc_reposvolume \t\tunder: /var/opt/rhodecode_repo_store\n" | |
3997 | printf "present confvolume \t\tunder: /etc/rhodecode/conf\n" |
|
3997 | printf "present confvolume \t\tunder: /etc/rhodecode/conf\n" | |
3998 |
|
3998 | |||
3999 | match_name=rc_cluster_apps-vcsserver |
|
3999 | match_name=rc_cluster_apps-vcsserver | |
4000 |
|
4000 | |||
4001 | docker_id=$(docker ps --filter name=$match_name -q | head -n1) |
|
4001 | docker_id=$(docker ps --filter name=$match_name -q | head -n1) | |
4002 | if [[ $docker_id == "" ]]; then |
|
4002 | if [[ $docker_id == "" ]]; then | |
4003 | echo "$(yellow cannot find instance to attach by name *$match_name*)" |
|
4003 | echo "$(yellow cannot find instance to attach by name *$match_name*)" | |
4004 | exit 1 |
|
4004 | exit 1 | |
4005 | fi |
|
4005 | fi | |
4006 |
|
4006 | |||
4007 | docker exec \ |
|
4007 | docker exec \ | |
4008 | $INTERACTIVE_FLAGS \ |
|
4008 | $INTERACTIVE_FLAGS \ | |
4009 | --workdir /var/opt $docker_id bash |
|
4009 | --workdir /var/opt $docker_id bash | |
4010 |
|
4010 | |||
4011 | else |
|
4011 | else | |
4012 | printf "attaching rc_datavolume \t\tunder: /vol/datavolume\n" |
|
4012 | printf "attaching rc_datavolume \t\tunder: /vol/datavolume\n" | |
4013 | printf "attaching rc_reposvolume \t\tunder: /vol/repovolume\n" |
|
4013 | printf "attaching rc_reposvolume \t\tunder: /vol/repovolume\n" | |
4014 | printf "attaching \$PWD/.custom/storage \t\tunder: /vol/backupvolume\n" |
|
4014 | printf "attaching \$PWD/.custom/storage \t\tunder: /vol/backupvolume\n" | |
4015 |
|
4015 | |||
4016 | docker run --rm \ |
|
4016 | docker run --rm \ | |
4017 | $INTERACTIVE_FLAGS \ |
|
4017 | $INTERACTIVE_FLAGS \ | |
4018 | --volume $PWD/.custom/storage:/vol/backupvolume \ |
|
4018 | --volume $PWD/.custom/storage:/vol/backupvolume \ | |
4019 | --volume rc_datavolume:/vol/datavolume \ |
|
4019 | --volume rc_datavolume:/vol/datavolume \ | |
4020 | --volume rc_reposvolume:/vol/repovolume \ |
|
4020 | --volume rc_reposvolume:/vol/repovolume \ | |
4021 | --workdir="/vol" \ |
|
4021 | --workdir="/vol" \ | |
4022 | $BASE_OPS_IMAGE \ |
|
4022 | $BASE_OPS_IMAGE \ | |
4023 | /bin/bash |
|
4023 | /bin/bash | |
4024 | fi |
|
4024 | fi | |
4025 |
|
4025 | |||
4026 | } |
|
4026 | } | |
4027 |
|
4027 | |||
4028 | # :command.function |
|
4028 | # :command.function | |
4029 | rcstack_cli_attach_command() { |
|
4029 | rcstack_cli_attach_command() { | |
4030 | # src/cli_attach_command.sh |
|
4030 | # src/cli_attach_command.sh | |
4031 | check_bootstrap |
|
4031 | check_bootstrap | |
4032 | RUN_WITHOUT_TTY=${args[--no-tty]} |
|
4032 | RUN_WITHOUT_TTY=${args[--no-tty]} | |
4033 | INTERACTIVE_FLAGS="--interactive --tty" |
|
4033 | INTERACTIVE_FLAGS="--interactive --tty" | |
4034 | if [[ $RUN_WITHOUT_TTY ]]; then |
|
4034 | if [[ $RUN_WITHOUT_TTY ]]; then | |
4035 | INTERACTIVE_FLAGS="--interactive" |
|
4035 | INTERACTIVE_FLAGS="--interactive" | |
4036 | fi |
|
4036 | fi | |
4037 |
|
4037 | |||
4038 | instance_type=${args[--instance-type]} |
|
4038 | instance_type=${args[--instance-type]} | |
4039 |
|
4039 | |||
4040 | match_name=rc_cluster_apps-$instance_type |
|
4040 | match_name=rc_cluster_apps-$instance_type | |
4041 |
|
4041 | |||
4042 | docker_id=$(docker ps --filter name=$match_name -q | head -n1) |
|
4042 | docker_id=$(docker ps --filter name=$match_name -q | head -n1) | |
4043 | if [[ $docker_id == "" ]]; then |
|
4043 | if [[ $docker_id == "" ]]; then | |
4044 | echo "$(yellow cannot find instance to attach by name *$match_name*)" |
|
4044 | echo "$(yellow cannot find instance to attach by name *$match_name*)" | |
4045 | exit 1 |
|
4045 | exit 1 | |
4046 | fi |
|
4046 | fi | |
4047 |
|
4047 | |||
4048 | docker exec \ |
|
4048 | docker exec \ | |
4049 | $INTERACTIVE_FLAGS \ |
|
4049 | $INTERACTIVE_FLAGS \ | |
4050 | $docker_id bash |
|
4050 | $docker_id bash | |
4051 |
|
4051 | |||
4052 | } |
|
4052 | } | |
4053 |
|
4053 | |||
4054 | # :command.function |
|
4054 | # :command.function | |
4055 | rcstack_cli_set_edition_command() { |
|
4055 | rcstack_cli_set_edition_command() { | |
4056 | # src/cli_set_edition_command.sh |
|
4056 | # src/cli_set_edition_command.sh | |
4057 | INI_TARGET=$PWD/config/_shared |
|
4057 | INI_TARGET=$PWD/config/_shared | |
4058 | BOOTSTRAP_RUNTIME_ENV=$PWD/.custom/.runtime.env |
|
4058 | BOOTSTRAP_RUNTIME_ENV=$PWD/.custom/.runtime.env | |
4059 |
|
4059 | |||
4060 | RC_EDITION=${args[edition_type]} |
|
4060 | RC_EDITION=${args[edition_type]} | |
4061 | ini_path=$INI_TARGET/rhodecode.ini |
|
4061 | ini_path=$INI_TARGET/rhodecode.ini | |
4062 |
|
4062 | |||
4063 | echo "Setting current installation as rhodecode-$RC_EDITION type" |
|
4063 | echo "Setting current installation as rhodecode-$RC_EDITION type" | |
4064 |
|
4064 | |||
4065 | echo "configure $ini_path" |
|
4065 | echo "configure $ini_path" | |
4066 | sed_replace '^use = egg:rhodecode-enterprise.*' "use = egg:rhodecode-enterprise-$RC_EDITION" |
|
4066 | sed_replace '^use = egg:rhodecode-enterprise.*' "use = egg:rhodecode-enterprise-$RC_EDITION" | |
4067 |
|
4067 | |||
4068 | echo "" |
|
4068 | echo "" | |
4069 | echo "configure $BOOTSTRAP_RUNTIME_ENV" |
|
4069 | echo "configure $BOOTSTRAP_RUNTIME_ENV" | |
4070 | .env --file "$BOOTSTRAP_RUNTIME_ENV" |
|
4070 | .env --file "$BOOTSTRAP_RUNTIME_ENV" | |
4071 | .env set RC_EDITION=$RC_EDITION |
|
4071 | .env set RC_EDITION=$RC_EDITION | |
4072 |
|
4072 | |||
4073 | echo "Configuration done, run " |
|
4073 | echo "Configuration done, run " | |
4074 | echo "./$RC_SCRIPT_NAME stack-upgrade rhodecode" |
|
4074 | echo "./$RC_SCRIPT_NAME stack-upgrade rhodecode" | |
4075 |
|
4075 | |||
4076 | } |
|
4076 | } | |
4077 |
|
4077 | |||
4078 | # :command.function |
|
4078 | # :command.function | |
4079 | rcstack_cli_configure_vcsserver_command() { |
|
4079 | rcstack_cli_configure_vcsserver_command() { | |
4080 | # src/cli_configure_vcsserver_command.sh |
|
4080 | # src/cli_configure_vcsserver_command.sh | |
4081 | ini_path=${args[ini_path]} |
|
4081 | ini_path=${args[ini_path]} | |
4082 | DEBUG=${args[--debug]} |
|
4082 | DEBUG=${args[--debug]} | |
4083 |
|
4083 | |||
4084 | config_vcsserver_ini |
|
4084 | config_vcsserver_ini | |
4085 |
|
4085 | |||
4086 | echo |
|
4086 | echo | |
4087 | echo "reconfigure of $ini_path completed" |
|
4087 | echo "reconfigure of $ini_path completed" | |
4088 |
|
4088 | |||
4089 | } |
|
4089 | } | |
4090 |
|
4090 | |||
4091 | # :command.function |
|
4091 | # :command.function | |
4092 | rcstack_cli_configure_rhodecode_command() { |
|
4092 | rcstack_cli_configure_rhodecode_command() { | |
4093 | # src/cli_configure_rhodecode_command.sh |
|
4093 | # src/cli_configure_rhodecode_command.sh | |
4094 | ini_path=${args[ini_path]} |
|
4094 | ini_path=${args[ini_path]} | |
4095 | DEBUG=${args[--debug]} |
|
4095 | DEBUG=${args[--debug]} | |
4096 |
|
4096 | |||
4097 | # read generated secrets etc from our .env file |
|
4097 | # read generated secrets etc from our .env file | |
4098 | .env --file $RUNTIME_ENV |
|
4098 | .env --file $RUNTIME_ENV | |
4099 |
|
4099 | |||
4100 | .env get RC_LICENSE_TOKEN |
|
4100 | .env get RC_LICENSE_TOKEN | |
4101 | RC_LICENSE_TOKEN=$REPLY |
|
4101 | RC_LICENSE_TOKEN=$REPLY | |
4102 |
|
4102 | |||
4103 | .env get RC_EDITION |
|
4103 | .env get RC_EDITION | |
4104 | RC_EDITION=$REPLY |
|
4104 | RC_EDITION=$REPLY | |
4105 |
|
4105 | |||
4106 | .env get RC_HOSTNAME |
|
4106 | .env get RC_HOSTNAME | |
4107 | RC_HOSTNAME=$(sed_safe_path $REPLY) |
|
4107 | RC_HOSTNAME=$(sed_safe_path $REPLY) | |
4108 |
|
4108 | |||
4109 | .env get RC_APP_BASE_URL |
|
4109 | .env get RC_APP_BASE_URL | |
4110 | RC_APP_BASE_URL=$(sed_safe_path $REPLY) |
|
4110 | RC_APP_BASE_URL=$(sed_safe_path $REPLY) | |
4111 |
|
4111 | |||
4112 | .env get RC_SQLALCHEMY_DB1_URL |
|
4112 | .env get RC_SQLALCHEMY_DB1_URL | |
4113 | RC_SQLALCHEMY_DB1_URL=$(sed_safe_path $REPLY) |
|
4113 | RC_SQLALCHEMY_DB1_URL=$(sed_safe_path $REPLY) | |
4114 |
|
4114 | |||
4115 | .env get RC_CHANNELSTREAM_WS_URL |
|
4115 | .env get RC_CHANNELSTREAM_WS_URL | |
4116 | RC_CHANNELSTREAM_WS_URL=$(sed_safe_path $REPLY) |
|
4116 | RC_CHANNELSTREAM_WS_URL=$(sed_safe_path $REPLY) | |
4117 |
|
4117 | |||
4118 | # $ini_path needs to be defined! |
|
4118 | # $ini_path needs to be defined! | |
4119 | config_rhodecode_ini |
|
4119 | config_rhodecode_ini | |
4120 |
|
4120 | |||
4121 | echo |
|
4121 | echo | |
4122 | echo "reconfigure of $ini_path completed" |
|
4122 | echo "reconfigure of $ini_path completed" | |
4123 | } |
|
4123 | } | |
4124 |
|
4124 | |||
4125 | # :command.function |
|
4125 | # :command.function | |
4126 | rcstack_backup_db_command() { |
|
4126 | rcstack_backup_db_command() { | |
4127 | # src/backup_db_command.sh |
|
4127 | # src/backup_db_command.sh | |
4128 | check_bootstrap |
|
4128 | check_bootstrap | |
4129 |
|
4129 | |||
4130 | DEBUG=${args[--debug]} |
|
4130 | DEBUG=${args[--debug]} | |
4131 | DESTINATION=${args[destination]} |
|
4131 | DESTINATION=${args[destination]} | |
4132 |
|
4132 | |||
4133 | echo "$(green_bold Creating backup of rcstack database)" |
|
4133 | echo "$(green_bold Creating backup of rcstack database)" | |
4134 |
|
4134 | |||
4135 | backup_date=$(date +%Y-%m-%d) |
|
4135 | backup_date=$(date +%Y-%m-%d) | |
4136 | backup_name_prefix=rc_db_dump |
|
4136 | backup_name_prefix=rc_db_dump | |
4137 |
|
4137 | |||
4138 | target_container=rc_cluster_services-database-* |
|
4138 | target_container=rc_cluster_services-database-* | |
4139 |
|
4139 | |||
4140 | docker_id=$(docker ps --filter name=$target_container -q | head -n1) |
|
4140 | docker_id=$(docker ps --filter name=$target_container -q | head -n1) | |
4141 |
|
4141 | |||
4142 | if [[ $DEBUG ]]; then |
|
4142 | if [[ $DEBUG ]]; then | |
4143 | echo "container id: $docker_id, based on $target_container filter" |
|
4143 | echo "container id: $docker_id, based on $target_container filter" | |
4144 | docker ps |
|
4144 | docker ps | |
4145 | echo "---" |
|
4145 | echo "---" | |
4146 | fi |
|
4146 | fi | |
4147 |
|
4147 | |||
4148 | if [ "$docker_id" == "" ]; then |
|
4148 | if [ "$docker_id" == "" ]; then | |
4149 | MSG="Cannot find container ID with name $target_container" |
|
4149 | MSG="Cannot find container ID with name $target_container" | |
4150 | echo "$(red $MSG)" |
|
4150 | echo "$(red $MSG)" | |
4151 | exit 1 |
|
4151 | exit 1 | |
4152 | fi |
|
4152 | fi | |
4153 |
|
4153 | |||
4154 | .env --file $RUNTIME_ENV |
|
4154 | .env --file $RUNTIME_ENV | |
4155 |
|
4155 | |||
4156 | .env get_or_error DB_PASSWORD |
|
4156 | .env get_or_error DB_PASSWORD | |
4157 | DB_PASSWORD=$REPLY |
|
4157 | DB_PASSWORD=$REPLY | |
4158 |
|
4158 | |||
4159 | .env get_or_error DB_NAME |
|
4159 | .env get_or_error DB_NAME | |
4160 | DB_NAME=$REPLY |
|
4160 | DB_NAME=$REPLY | |
4161 |
|
4161 | |||
4162 | .env get_or_error DB_USER |
|
4162 | .env get_or_error DB_USER | |
4163 | DB_USER=$REPLY |
|
4163 | DB_USER=$REPLY | |
4164 |
|
4164 | |||
4165 | destination_dir=$DESTINATION |
|
4165 | destination_dir=$DESTINATION | |
4166 | spacer="_" |
|
4166 | spacer="_" | |
4167 | backup_name="$backup_name_prefix$spacer$backup_date.sql.gz" |
|
4167 | backup_name="$backup_name_prefix$spacer$backup_date.sql.gz" | |
4168 |
|
4168 | |||
4169 | if [[ $DEBUG ]]; then |
|
4169 | if [[ $DEBUG ]]; then | |
4170 | 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'" |
|
4170 | 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'" | |
4171 | echo "dump placed in /var/rc-data-dump/$backup_name" |
|
4171 | echo "dump placed in /var/rc-data-dump/$backup_name" | |
4172 | echo "run docker cp $docker_id:/var/rc-data-dump/$backup_name $PWD to copy the file into your host machine" |
|
4172 | echo "run docker cp $docker_id:/var/rc-data-dump/$backup_name $PWD to copy the file into your host machine" | |
4173 | fi |
|
4173 | fi | |
4174 |
|
4174 | |||
4175 | set -euo pipefail |
|
4175 | set -euo pipefail | |
4176 |
|
4176 | |||
4177 | 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" |
|
4177 | 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" | |
4178 | docker cp $docker_id:/var/rc-data-dump/$backup_name $destination_dir |
|
4178 | docker cp $docker_id:/var/rc-data-dump/$backup_name $destination_dir | |
4179 |
|
4179 | |||
4180 | echo "$(green Backup created in: \'$destination_dir\')" |
|
4180 | echo "$(green Backup created in: \'$destination_dir\')" | |
4181 | ls -la $destination_dir | grep $backup_name_prefix |
|
4181 | ls -la $destination_dir | grep $backup_name_prefix | |
4182 |
|
4182 | |||
4183 | } |
|
4183 | } | |
4184 |
|
4184 | |||
4185 | # :command.function |
|
4185 | # :command.function | |
4186 | rcstack_backup_data_command() { |
|
4186 | rcstack_backup_data_command() { | |
4187 | # src/backup_data_command.sh |
|
4187 | # src/backup_data_command.sh | |
4188 | check_bootstrap |
|
4188 | check_bootstrap | |
4189 |
|
4189 | |||
4190 | DEBUG=${args[--debug]} |
|
4190 | DEBUG=${args[--debug]} | |
4191 | DESTINATION=${args[destination]} |
|
4191 | DESTINATION=${args[destination]} | |
4192 |
|
4192 | |||
4193 | echo "$(green_bold Creating backup of rcstack volumes)" |
|
4193 | echo "$(green_bold Creating backup of rcstack volumes)" | |
4194 |
|
4194 | |||
4195 | backup_date=$(date +%Y-%m-%d) |
|
4195 | backup_date=$(date +%Y-%m-%d) | |
4196 | backup_name_prefix=rc_data_dump |
|
4196 | backup_name_prefix=rc_data_dump | |
4197 |
|
4197 | |||
4198 | target_container=rc_cluster_apps-rhodecode-* |
|
4198 | target_container=rc_cluster_apps-rhodecode-* | |
4199 |
|
4199 | |||
4200 | docker_id=$(docker ps --filter name=$target_container -q | head -n1) |
|
4200 | docker_id=$(docker ps --filter name=$target_container -q | head -n1) | |
4201 |
|
4201 | |||
4202 | if [[ $DEBUG ]]; then |
|
4202 | if [[ $DEBUG ]]; then | |
4203 | echo "container id: $docker_id, based on $target_container filter" |
|
4203 | echo "container id: $docker_id, based on $target_container filter" | |
4204 | docker ps |
|
4204 | docker ps | |
4205 | echo "---" |
|
4205 | echo "---" | |
4206 | fi |
|
4206 | fi | |
4207 |
|
4207 | |||
4208 | if [ "$docker_id" == "" ]; then |
|
4208 | if [ "$docker_id" == "" ]; then | |
4209 | MSG="Cannot find container ID with name $target_container" |
|
4209 | MSG="Cannot find container ID with name $target_container" | |
4210 | echo "$(red $MSG)" |
|
4210 | echo "$(red $MSG)" | |
4211 | exit 1 |
|
4211 | exit 1 | |
4212 | fi |
|
4212 | fi | |
4213 |
|
4213 | |||
4214 | set -euo pipefail |
|
4214 | set -euo pipefail | |
4215 |
|
4215 | |||
4216 | echo "$(green_bold Following volumes will be backed-up:)" |
|
4216 | echo "$(green_bold Following volumes will be backed-up:)" | |
4217 |
|
4217 | |||
4218 | volumes=$(docker inspect --format "{{ range .Mounts }}{{ println .Destination }}{{ end }}" $docker_id) |
|
4218 | volumes=$(docker inspect --format "{{ range .Mounts }}{{ println .Destination }}{{ end }}" $docker_id) | |
4219 | destination_dir=$DESTINATION |
|
4219 | destination_dir=$DESTINATION | |
4220 |
|
4220 | |||
4221 | spacer="_" |
|
4221 | spacer="_" | |
4222 | for vol in $volumes; do |
|
4222 | for vol in $volumes; do | |
4223 | echo "Volume: $vol" |
|
4223 | echo "Volume: $vol" | |
4224 | vol_name=$(slugify $vol) |
|
4224 | vol_name=$(slugify $vol) | |
4225 | backup_slug="$backup_name_prefix$spacer$vol_name$spacer$backup_date" |
|
4225 | backup_slug="$backup_name_prefix$spacer$vol_name$spacer$backup_date" | |
4226 |
|
4226 | |||
4227 | docker run --rm -v $destination_dir:/backup --volumes-from "$docker_id" $BASE_OPS_IMAGE tar -czvf /backup/$backup_slug.tar.gz "$vol" |
|
4227 | docker run --rm -v $destination_dir:/backup --volumes-from "$docker_id" $BASE_OPS_IMAGE tar -czvf /backup/$backup_slug.tar.gz "$vol" | |
4228 | done |
|
4228 | done | |
4229 |
|
4229 | |||
4230 | echo "$(green Backup created in: \'$destination_dir\')" |
|
4230 | echo "$(green Backup created in: \'$destination_dir\')" | |
4231 | ls -la $destination_dir | grep $backup_name_prefix |
|
4231 | ls -la $destination_dir | grep $backup_name_prefix | |
4232 |
|
4232 | |||
4233 | #docker-volume-restore-compressed() { |
|
4233 | #docker-volume-restore-compressed() { | |
4234 | # destination_dir=$1 |
|
4234 | # destination_dir=$1 | |
4235 | # container=$2 |
|
4235 | # container=$2 | |
4236 | # |
|
4236 | # | |
4237 | # docker run --rm -v $destination_dir:/backup --volumes-from "$container" debian:jessie tar -xzvf /backup/backup.tar.gz "${@:3}" |
|
4237 | # docker run --rm -v $destination_dir:/backup --volumes-from "$container" debian:jessie tar -xzvf /backup/backup.tar.gz "${@:3}" | |
4238 | # echo "Double checking files..." |
|
4238 | # echo "Double checking files..." | |
4239 | # docker run --rm -v $destination_dir:/backup --volumes-from "$container" debian:jessie ls -lh "${@:2}" |
|
4239 | # docker run --rm -v $destination_dir:/backup --volumes-from "$container" debian:jessie ls -lh "${@:2}" | |
4240 | #} |
|
4240 | #} | |
4241 | } |
|
4241 | } | |
4242 |
|
4242 | |||
4243 | # :command.function |
|
4243 | # :command.function | |
4244 | rcstack__completions_command() { |
|
4244 | rcstack__completions_command() { | |
4245 | # src/_completions_command.sh |
|
4245 | # src/_completions_command.sh | |
4246 | send_completions |
|
4246 | send_completions | |
4247 | } |
|
4247 | } | |
4248 |
|
4248 | |||
4249 | # :command.parse_requirements |
|
4249 | # :command.parse_requirements | |
4250 | parse_requirements() { |
|
4250 | parse_requirements() { | |
4251 | # :command.fixed_flags_filter |
|
4251 | # :command.fixed_flags_filter | |
4252 | while [[ $# -gt 0 ]]; do |
|
4252 | while [[ $# -gt 0 ]]; do | |
4253 | case "${1:-}" in |
|
4253 | case "${1:-}" in | |
4254 | --version | -v) |
|
4254 | --version | -v) | |
4255 | version_command |
|
4255 | version_command | |
4256 | exit |
|
4256 | exit | |
4257 | ;; |
|
4257 | ;; | |
4258 |
|
4258 | |||
4259 | --help | -h) |
|
4259 | --help | -h) | |
4260 | long_usage=yes |
|
4260 | long_usage=yes | |
4261 | rcstack_usage |
|
4261 | rcstack_usage | |
4262 | exit |
|
4262 | exit | |
4263 | ;; |
|
4263 | ;; | |
4264 |
|
4264 | |||
4265 | # :flag.case |
|
4265 | # :flag.case | |
4266 | --debug) |
|
4266 | --debug) | |
4267 |
|
4267 | |||
4268 | # :flag.case_no_arg |
|
4268 | # :flag.case_no_arg | |
4269 | args['--debug']=1 |
|
4269 | args['--debug']=1 | |
4270 | shift |
|
4270 | shift | |
4271 | ;; |
|
4271 | ;; | |
4272 |
|
4272 | |||
4273 | # :flag.case |
|
4273 | # :flag.case | |
4274 | --no-init-check) |
|
4274 | --no-init-check) | |
4275 |
|
4275 | |||
4276 | # :flag.case_no_arg |
|
4276 | # :flag.case_no_arg | |
4277 | args['--no-init-check']=1 |
|
4277 | args['--no-init-check']=1 | |
4278 | shift |
|
4278 | shift | |
4279 | ;; |
|
4279 | ;; | |
4280 |
|
4280 | |||
4281 | *) |
|
4281 | *) | |
4282 | break |
|
4282 | break | |
4283 | ;; |
|
4283 | ;; | |
4284 |
|
4284 | |||
4285 | esac |
|
4285 | esac | |
4286 | done |
|
4286 | done | |
4287 |
|
4287 | |||
4288 | # :command.environment_variables_filter |
|
4288 | # :command.environment_variables_filter | |
4289 | # :command.environment_variables_default |
|
4289 | # :command.environment_variables_default | |
4290 | export RCC_CONFIG="${RCC_CONFIG:-.rcstack.ini}" |
|
4290 | export RCC_CONFIG="${RCC_CONFIG:-.rcstack.ini}" | |
4291 | export RC_STACK_ROUTER_EXT="${RC_STACK_ROUTER_EXT:-.custom/docker-compose-router.override.yaml}" |
|
4291 | export RC_STACK_ROUTER_EXT="${RC_STACK_ROUTER_EXT:-.custom/docker-compose-router.override.yaml}" | |
4292 | export RC_STACK_METRICS_EXT="${RC_STACK_METRICS_EXT:-.custom/docker-compose-metrics.override.yaml}" |
|
4292 | export RC_STACK_METRICS_EXT="${RC_STACK_METRICS_EXT:-.custom/docker-compose-metrics.override.yaml}" | |
4293 | export RC_STACK_SERVICES_EXT="${RC_STACK_SERVICES_EXT:-.custom/docker-compose-services.override.yaml}" |
|
4293 | export RC_STACK_SERVICES_EXT="${RC_STACK_SERVICES_EXT:-.custom/docker-compose-services.override.yaml}" | |
4294 | export RC_STACK_RHODECODE_EXT="${RC_STACK_RHODECODE_EXT:-.custom/docker-compose-apps.override.yaml}" |
|
4294 | export RC_STACK_RHODECODE_EXT="${RC_STACK_RHODECODE_EXT:-.custom/docker-compose-apps.override.yaml}" | |
4295 |
|
4295 | |||
4296 | # :command.command_filter |
|
4296 | # :command.command_filter | |
4297 | action=${1:-} |
|
4297 | action=${1:-} | |
4298 |
|
4298 | |||
4299 | case $action in |
|
4299 | case $action in | |
4300 | -*) ;; |
|
4300 | -*) ;; | |
4301 |
|
4301 | |||
4302 | get-started) |
|
4302 | get-started) | |
4303 | action="get-started" |
|
4303 | action="get-started" | |
4304 | shift |
|
4304 | shift | |
4305 | rcstack_get_started_parse_requirements "$@" |
|
4305 | rcstack_get_started_parse_requirements "$@" | |
4306 | shift $# |
|
4306 | shift $# | |
4307 | ;; |
|
4307 | ;; | |
4308 |
|
4308 | |||
4309 | init) |
|
4309 | init) | |
4310 | action="init" |
|
4310 | action="init" | |
4311 | shift |
|
4311 | shift | |
4312 | rcstack_init_parse_requirements "$@" |
|
4312 | rcstack_init_parse_requirements "$@" | |
4313 | shift $# |
|
4313 | shift $# | |
4314 | ;; |
|
4314 | ;; | |
4315 |
|
4315 | |||
4316 | self-update) |
|
4316 | self-update) | |
4317 | action="self-update" |
|
4317 | action="self-update" | |
4318 | shift |
|
4318 | shift | |
4319 | rcstack_self_update_parse_requirements "$@" |
|
4319 | rcstack_self_update_parse_requirements "$@" | |
4320 | shift $# |
|
4320 | shift $# | |
4321 | ;; |
|
4321 | ;; | |
4322 |
|
4322 | |||
4323 | stack) |
|
4323 | stack) | |
4324 | action="stack" |
|
4324 | action="stack" | |
4325 | shift |
|
4325 | shift | |
4326 | rcstack_stack_parse_requirements "$@" |
|
4326 | rcstack_stack_parse_requirements "$@" | |
4327 | shift $# |
|
4327 | shift $# | |
4328 | ;; |
|
4328 | ;; | |
4329 |
|
4329 | |||
4330 | stack-status | status) |
|
4330 | stack-status | status) | |
4331 | action="stack-status" |
|
4331 | action="stack-status" | |
4332 | shift |
|
4332 | shift | |
4333 | rcstack_stack_status_parse_requirements "$@" |
|
4333 | rcstack_stack_status_parse_requirements "$@" | |
4334 | shift $# |
|
4334 | shift $# | |
4335 | ;; |
|
4335 | ;; | |
4336 |
|
4336 | |||
4337 | stack-upgrade) |
|
4337 | stack-upgrade) | |
4338 | action="stack-upgrade" |
|
4338 | action="stack-upgrade" | |
4339 | shift |
|
4339 | shift | |
4340 | rcstack_stack_upgrade_parse_requirements "$@" |
|
4340 | rcstack_stack_upgrade_parse_requirements "$@" | |
4341 | shift $# |
|
4341 | shift $# | |
4342 | ;; |
|
4342 | ;; | |
4343 |
|
4343 | |||
4344 | stack-monitor) |
|
4344 | stack-monitor) | |
4345 | action="stack-monitor" |
|
4345 | action="stack-monitor" | |
4346 | shift |
|
4346 | shift | |
4347 | rcstack_stack_monitor_parse_requirements "$@" |
|
4347 | rcstack_stack_monitor_parse_requirements "$@" | |
4348 | shift $# |
|
4348 | shift $# | |
4349 | ;; |
|
4349 | ;; | |
4350 |
|
4350 | |||
4351 | cli) |
|
4351 | cli) | |
4352 | action="cli" |
|
4352 | action="cli" | |
4353 | shift |
|
4353 | shift | |
4354 | rcstack_cli_parse_requirements "$@" |
|
4354 | rcstack_cli_parse_requirements "$@" | |
4355 | shift $# |
|
4355 | shift $# | |
4356 | ;; |
|
4356 | ;; | |
4357 |
|
4357 | |||
4358 | backup-db) |
|
4358 | backup-db) | |
4359 | action="backup-db" |
|
4359 | action="backup-db" | |
4360 | shift |
|
4360 | shift | |
4361 | rcstack_backup_db_parse_requirements "$@" |
|
4361 | rcstack_backup_db_parse_requirements "$@" | |
4362 | shift $# |
|
4362 | shift $# | |
4363 | ;; |
|
4363 | ;; | |
4364 |
|
4364 | |||
4365 | backup-data) |
|
4365 | backup-data) | |
4366 | action="backup-data" |
|
4366 | action="backup-data" | |
4367 | shift |
|
4367 | shift | |
4368 | rcstack_backup_data_parse_requirements "$@" |
|
4368 | rcstack_backup_data_parse_requirements "$@" | |
4369 | shift $# |
|
4369 | shift $# | |
4370 | ;; |
|
4370 | ;; | |
4371 |
|
4371 | |||
4372 | _completions) |
|
4372 | _completions) | |
4373 | action="_completions" |
|
4373 | action="_completions" | |
4374 | shift |
|
4374 | shift | |
4375 | rcstack__completions_parse_requirements "$@" |
|
4375 | rcstack__completions_parse_requirements "$@" | |
4376 | shift $# |
|
4376 | shift $# | |
4377 | ;; |
|
4377 | ;; | |
4378 |
|
4378 | |||
4379 | # :command.command_fallback |
|
4379 | # :command.command_fallback | |
4380 | "") |
|
4380 | "") | |
4381 | rcstack_usage >&2 |
|
4381 | rcstack_usage >&2 | |
4382 | exit 1 |
|
4382 | exit 1 | |
4383 | ;; |
|
4383 | ;; | |
4384 |
|
4384 | |||
4385 | *) |
|
4385 | *) | |
4386 | printf "invalid command: %s\n" "$action" >&2 |
|
4386 | printf "invalid command: %s\n" "$action" >&2 | |
4387 | exit 1 |
|
4387 | exit 1 | |
4388 | ;; |
|
4388 | ;; | |
4389 |
|
4389 | |||
4390 | esac |
|
4390 | esac | |
4391 |
|
4391 | |||
4392 | # :command.parse_requirements_while |
|
4392 | # :command.parse_requirements_while | |
4393 | while [[ $# -gt 0 ]]; do |
|
4393 | while [[ $# -gt 0 ]]; do | |
4394 | key="$1" |
|
4394 | key="$1" | |
4395 | case "$key" in |
|
4395 | case "$key" in | |
4396 |
|
4396 | |||
4397 | -?*) |
|
4397 | -?*) | |
4398 | printf "invalid option: %s\n" "$key" >&2 |
|
4398 | printf "invalid option: %s\n" "$key" >&2 | |
4399 | exit 1 |
|
4399 | exit 1 | |
4400 | ;; |
|
4400 | ;; | |
4401 |
|
4401 | |||
4402 | *) |
|
4402 | *) | |
4403 | # :command.parse_requirements_case |
|
4403 | # :command.parse_requirements_case | |
4404 | # :command.parse_requirements_case_simple |
|
4404 | # :command.parse_requirements_case_simple | |
4405 | printf "invalid argument: %s\n" "$key" >&2 |
|
4405 | printf "invalid argument: %s\n" "$key" >&2 | |
4406 | exit 1 |
|
4406 | exit 1 | |
4407 |
|
4407 | |||
4408 | ;; |
|
4408 | ;; | |
4409 |
|
4409 | |||
4410 | esac |
|
4410 | esac | |
4411 | done |
|
4411 | done | |
4412 |
|
4412 | |||
4413 | } |
|
4413 | } | |
4414 |
|
4414 | |||
4415 | # :command.parse_requirements |
|
4415 | # :command.parse_requirements | |
4416 | rcstack_get_started_parse_requirements() { |
|
4416 | rcstack_get_started_parse_requirements() { | |
4417 | # :command.fixed_flags_filter |
|
4417 | # :command.fixed_flags_filter | |
4418 | while [[ $# -gt 0 ]]; do |
|
4418 | while [[ $# -gt 0 ]]; do | |
4419 | case "${1:-}" in |
|
4419 | case "${1:-}" in | |
4420 | --help | -h) |
|
4420 | --help | -h) | |
4421 | long_usage=yes |
|
4421 | long_usage=yes | |
4422 | rcstack_get_started_usage |
|
4422 | rcstack_get_started_usage | |
4423 | exit |
|
4423 | exit | |
4424 | ;; |
|
4424 | ;; | |
4425 |
|
4425 | |||
4426 | *) |
|
4426 | *) | |
4427 | break |
|
4427 | break | |
4428 | ;; |
|
4428 | ;; | |
4429 |
|
4429 | |||
4430 | esac |
|
4430 | esac | |
4431 | done |
|
4431 | done | |
4432 |
|
4432 | |||
4433 | # :command.command_filter |
|
4433 | # :command.command_filter | |
4434 | action="get-started" |
|
4434 | action="get-started" | |
4435 |
|
4435 | |||
4436 | # :command.parse_requirements_while |
|
4436 | # :command.parse_requirements_while | |
4437 | while [[ $# -gt 0 ]]; do |
|
4437 | while [[ $# -gt 0 ]]; do | |
4438 | key="$1" |
|
4438 | key="$1" | |
4439 | case "$key" in |
|
4439 | case "$key" in | |
4440 |
|
4440 | |||
4441 | -?*) |
|
4441 | -?*) | |
4442 | printf "invalid option: %s\n" "$key" >&2 |
|
4442 | printf "invalid option: %s\n" "$key" >&2 | |
4443 | exit 1 |
|
4443 | exit 1 | |
4444 | ;; |
|
4444 | ;; | |
4445 |
|
4445 | |||
4446 | *) |
|
4446 | *) | |
4447 | # :command.parse_requirements_case |
|
4447 | # :command.parse_requirements_case | |
4448 | # :command.parse_requirements_case_simple |
|
4448 | # :command.parse_requirements_case_simple | |
4449 | printf "invalid argument: %s\n" "$key" >&2 |
|
4449 | printf "invalid argument: %s\n" "$key" >&2 | |
4450 | exit 1 |
|
4450 | exit 1 | |
4451 |
|
4451 | |||
4452 | ;; |
|
4452 | ;; | |
4453 |
|
4453 | |||
4454 | esac |
|
4454 | esac | |
4455 | done |
|
4455 | done | |
4456 |
|
4456 | |||
4457 | } |
|
4457 | } | |
4458 |
|
4458 | |||
4459 | # :command.parse_requirements |
|
4459 | # :command.parse_requirements | |
4460 | rcstack_init_parse_requirements() { |
|
4460 | rcstack_init_parse_requirements() { | |
4461 | # :command.fixed_flags_filter |
|
4461 | # :command.fixed_flags_filter | |
4462 | while [[ $# -gt 0 ]]; do |
|
4462 | while [[ $# -gt 0 ]]; do | |
4463 | case "${1:-}" in |
|
4463 | case "${1:-}" in | |
4464 | --help | -h) |
|
4464 | --help | -h) | |
4465 | long_usage=yes |
|
4465 | long_usage=yes | |
4466 | rcstack_init_usage |
|
4466 | rcstack_init_usage | |
4467 | exit |
|
4467 | exit | |
4468 | ;; |
|
4468 | ;; | |
4469 |
|
4469 | |||
4470 | *) |
|
4470 | *) | |
4471 | break |
|
4471 | break | |
4472 | ;; |
|
4472 | ;; | |
4473 |
|
4473 | |||
4474 | esac |
|
4474 | esac | |
4475 | done |
|
4475 | done | |
4476 |
|
4476 | |||
4477 | # :command.dependencies_filter |
|
4477 | # :command.dependencies_filter | |
4478 | if command -v curl >/dev/null 2>&1; then |
|
4478 | if command -v curl >/dev/null 2>&1; then | |
4479 | deps['curl']="$(command -v curl | head -n1)" |
|
4479 | deps['curl']="$(command -v curl | head -n1)" | |
4480 | else |
|
4480 | else | |
4481 | printf "missing dependency: curl\n" >&2 |
|
4481 | printf "missing dependency: curl\n" >&2 | |
4482 | exit 1 |
|
4482 | exit 1 | |
4483 | fi |
|
4483 | fi | |
4484 |
|
4484 | |||
4485 | if command -v tar >/dev/null 2>&1; then |
|
4485 | if command -v tar >/dev/null 2>&1; then | |
4486 | deps['tar']="$(command -v tar | head -n1)" |
|
4486 | deps['tar']="$(command -v tar | head -n1)" | |
4487 | else |
|
4487 | else | |
4488 | printf "missing dependency: tar\n" >&2 |
|
4488 | printf "missing dependency: tar\n" >&2 | |
4489 | exit 1 |
|
4489 | exit 1 | |
4490 | fi |
|
4490 | fi | |
4491 |
|
4491 | |||
4492 | if command -v find >/dev/null 2>&1; then |
|
4492 | if command -v find >/dev/null 2>&1; then | |
4493 | deps['find']="$(command -v find | head -n1)" |
|
4493 | deps['find']="$(command -v find | head -n1)" | |
4494 | else |
|
4494 | else | |
4495 | printf "missing dependency: find\n" >&2 |
|
4495 | printf "missing dependency: find\n" >&2 | |
4496 | exit 1 |
|
4496 | exit 1 | |
4497 | fi |
|
4497 | fi | |
4498 |
|
4498 | |||
4499 | # :command.command_filter |
|
4499 | # :command.command_filter | |
4500 | action="init" |
|
4500 | action="init" | |
4501 |
|
4501 | |||
4502 | # :command.parse_requirements_while |
|
4502 | # :command.parse_requirements_while | |
4503 | while [[ $# -gt 0 ]]; do |
|
4503 | while [[ $# -gt 0 ]]; do | |
4504 | key="$1" |
|
4504 | key="$1" | |
4505 | case "$key" in |
|
4505 | case "$key" in | |
4506 | # :flag.case |
|
4506 | # :flag.case | |
4507 | --arg-rc-edition) |
|
4507 | --arg-rc-edition) | |
4508 |
|
4508 | |||
4509 | # :flag.case_arg |
|
4509 | # :flag.case_arg | |
4510 | if [[ -n ${2+x} ]]; then |
|
4510 | if [[ -n ${2+x} ]]; then | |
4511 |
|
4511 | |||
4512 | args['--arg-rc-edition']="$2" |
|
4512 | args['--arg-rc-edition']="$2" | |
4513 | shift |
|
4513 | shift | |
4514 | shift |
|
4514 | shift | |
4515 | else |
|
4515 | else | |
4516 | printf "%s\n" "--arg-rc-edition requires an argument: --arg-rc-edition ARG_RC_EDITION" >&2 |
|
4516 | printf "%s\n" "--arg-rc-edition requires an argument: --arg-rc-edition ARG_RC_EDITION" >&2 | |
4517 | exit 1 |
|
4517 | exit 1 | |
4518 | fi |
|
4518 | fi | |
4519 | ;; |
|
4519 | ;; | |
4520 |
|
4520 | |||
4521 | # :flag.case |
|
4521 | # :flag.case | |
4522 | --arg-hostname) |
|
4522 | --arg-hostname) | |
4523 |
|
4523 | |||
4524 | # :flag.case_arg |
|
4524 | # :flag.case_arg | |
4525 | if [[ -n ${2+x} ]]; then |
|
4525 | if [[ -n ${2+x} ]]; then | |
4526 |
|
4526 | |||
4527 | args['--arg-hostname']="$2" |
|
4527 | args['--arg-hostname']="$2" | |
4528 | shift |
|
4528 | shift | |
4529 | shift |
|
4529 | shift | |
4530 | else |
|
4530 | else | |
4531 | printf "%s\n" "--arg-hostname requires an argument: --arg-hostname ARG_HOSTNAME" >&2 |
|
4531 | printf "%s\n" "--arg-hostname requires an argument: --arg-hostname ARG_HOSTNAME" >&2 | |
4532 | exit 1 |
|
4532 | exit 1 | |
4533 | fi |
|
4533 | fi | |
4534 | ;; |
|
4534 | ;; | |
4535 |
|
4535 | |||
4536 | # :flag.case |
|
4536 | # :flag.case | |
4537 | --arg-use-ssl) |
|
4537 | --arg-use-ssl) | |
4538 |
|
4538 | |||
4539 | # :flag.case_arg |
|
4539 | # :flag.case_arg | |
4540 | if [[ -n ${2+x} ]]; then |
|
4540 | if [[ -n ${2+x} ]]; then | |
4541 |
|
4541 | |||
4542 | args['--arg-use-ssl']="$2" |
|
4542 | args['--arg-use-ssl']="$2" | |
4543 | shift |
|
4543 | shift | |
4544 | shift |
|
4544 | shift | |
4545 | else |
|
4545 | else | |
4546 | printf "%s\n" "--arg-use-ssl requires an argument: --arg-use-ssl ARG_USE_SSL" >&2 |
|
4546 | printf "%s\n" "--arg-use-ssl requires an argument: --arg-use-ssl ARG_USE_SSL" >&2 | |
4547 | exit 1 |
|
4547 | exit 1 | |
4548 | fi |
|
4548 | fi | |
4549 | ;; |
|
4549 | ;; | |
4550 |
|
4550 | |||
4551 | # :flag.case |
|
4551 | # :flag.case | |
4552 | --arg-admin-email) |
|
4552 | --arg-admin-email) | |
4553 |
|
4553 | |||
4554 | # :flag.case_arg |
|
4554 | # :flag.case_arg | |
4555 | if [[ -n ${2+x} ]]; then |
|
4555 | if [[ -n ${2+x} ]]; then | |
4556 |
|
4556 | |||
4557 | args['--arg-admin-email']="$2" |
|
4557 | args['--arg-admin-email']="$2" | |
4558 | shift |
|
4558 | shift | |
4559 | shift |
|
4559 | shift | |
4560 | else |
|
4560 | else | |
4561 | printf "%s\n" "--arg-admin-email requires an argument: --arg-admin-email ARG_ADMIN_EMAIL" >&2 |
|
4561 | printf "%s\n" "--arg-admin-email requires an argument: --arg-admin-email ARG_ADMIN_EMAIL" >&2 | |
4562 | exit 1 |
|
4562 | exit 1 | |
4563 | fi |
|
4563 | fi | |
4564 | ;; |
|
4564 | ;; | |
4565 |
|
4565 | |||
4566 | # :flag.case |
|
4566 | # :flag.case | |
4567 | --arg-admin-user) |
|
4567 | --arg-admin-user) | |
4568 |
|
4568 | |||
4569 | # :flag.case_arg |
|
4569 | # :flag.case_arg | |
4570 | if [[ -n ${2+x} ]]; then |
|
4570 | if [[ -n ${2+x} ]]; then | |
4571 |
|
4571 | |||
4572 | args['--arg-admin-user']="$2" |
|
4572 | args['--arg-admin-user']="$2" | |
4573 | shift |
|
4573 | shift | |
4574 | shift |
|
4574 | shift | |
4575 | else |
|
4575 | else | |
4576 | printf "%s\n" "--arg-admin-user requires an argument: --arg-admin-user ARG_ADMIN_USER" >&2 |
|
4576 | printf "%s\n" "--arg-admin-user requires an argument: --arg-admin-user ARG_ADMIN_USER" >&2 | |
4577 | exit 1 |
|
4577 | exit 1 | |
4578 | fi |
|
4578 | fi | |
4579 | ;; |
|
4579 | ;; | |
4580 |
|
4580 | |||
4581 | # :flag.case |
|
4581 | # :flag.case | |
4582 | --arg-admin-pass) |
|
4582 | --arg-admin-pass) | |
4583 |
|
4583 | |||
4584 | # :flag.case_arg |
|
4584 | # :flag.case_arg | |
4585 | if [[ -n ${2+x} ]]; then |
|
4585 | if [[ -n ${2+x} ]]; then | |
4586 |
|
4586 | |||
4587 | args['--arg-admin-pass']="$2" |
|
4587 | args['--arg-admin-pass']="$2" | |
4588 | shift |
|
4588 | shift | |
4589 | shift |
|
4589 | shift | |
4590 | else |
|
4590 | else | |
4591 | printf "%s\n" "--arg-admin-pass requires an argument: --arg-admin-pass ARG_ADMIN_PASS" >&2 |
|
4591 | printf "%s\n" "--arg-admin-pass requires an argument: --arg-admin-pass ARG_ADMIN_PASS" >&2 | |
4592 | exit 1 |
|
4592 | exit 1 | |
4593 | fi |
|
4593 | fi | |
4594 | ;; |
|
4594 | ;; | |
4595 |
|
4595 | |||
4596 | # :flag.case |
|
4596 | # :flag.case | |
4597 | --arg-license-token) |
|
4597 | --arg-license-token) | |
4598 |
|
4598 | |||
4599 | # :flag.case_arg |
|
4599 | # :flag.case_arg | |
4600 | if [[ -n ${2+x} ]]; then |
|
4600 | if [[ -n ${2+x} ]]; then | |
4601 |
|
4601 | |||
4602 | args['--arg-license-token']="$2" |
|
4602 | args['--arg-license-token']="$2" | |
4603 | shift |
|
4603 | shift | |
4604 | shift |
|
4604 | shift | |
4605 | else |
|
4605 | else | |
4606 | printf "%s\n" "--arg-license-token requires an argument: --arg-license-token ARG_ADMIN_TOKEN" >&2 |
|
4606 | printf "%s\n" "--arg-license-token requires an argument: --arg-license-token ARG_ADMIN_TOKEN" >&2 | |
4607 | exit 1 |
|
4607 | exit 1 | |
4608 | fi |
|
4608 | fi | |
4609 | ;; |
|
4609 | ;; | |
4610 |
|
4610 | |||
4611 | # :flag.case |
|
4611 | # :flag.case | |
4612 | --no-prompt) |
|
4612 | --no-prompt) | |
4613 |
|
4613 | |||
4614 | # :flag.case_no_arg |
|
4614 | # :flag.case_no_arg | |
4615 | args['--no-prompt']=1 |
|
4615 | args['--no-prompt']=1 | |
4616 | shift |
|
4616 | shift | |
4617 | ;; |
|
4617 | ;; | |
4618 |
|
4618 | |||
4619 | # :flag.case |
|
4619 | # :flag.case | |
4620 | --force | -f) |
|
4620 | --force | -f) | |
4621 |
|
4621 | |||
4622 | # :flag.case_no_arg |
|
4622 | # :flag.case_no_arg | |
4623 | args['--force']=1 |
|
4623 | args['--force']=1 | |
4624 | shift |
|
4624 | shift | |
4625 | ;; |
|
4625 | ;; | |
4626 |
|
4626 | |||
4627 | # :flag.case |
|
4627 | # :flag.case | |
4628 | --stage) |
|
4628 | --stage) | |
4629 |
|
4629 | |||
4630 | # :flag.case_arg |
|
4630 | # :flag.case_arg | |
4631 | if [[ -n ${2+x} ]]; then |
|
4631 | if [[ -n ${2+x} ]]; then | |
4632 |
|
4632 | |||
4633 | if [[ -z ${args['--stage']+x} ]]; then |
|
4633 | if [[ -z ${args['--stage']+x} ]]; then | |
4634 | args['--stage']="\"$2\"" |
|
4634 | args['--stage']="\"$2\"" | |
4635 | else |
|
4635 | else | |
4636 | args['--stage']="${args[--stage]} \"$2\"" |
|
4636 | args['--stage']="${args[--stage]} \"$2\"" | |
4637 | fi |
|
4637 | fi | |
4638 | shift |
|
4638 | shift | |
4639 | shift |
|
4639 | shift | |
4640 | else |
|
4640 | else | |
4641 | printf "%s\n" "--stage requires an argument: --stage STAGE" >&2 |
|
4641 | printf "%s\n" "--stage requires an argument: --stage STAGE" >&2 | |
4642 | exit 1 |
|
4642 | exit 1 | |
4643 | fi |
|
4643 | fi | |
4644 | ;; |
|
4644 | ;; | |
4645 |
|
4645 | |||
4646 | # :flag.case |
|
4646 | # :flag.case | |
4647 | --docker-revision) |
|
4647 | --docker-revision) | |
4648 |
|
4648 | |||
4649 | # :flag.case_arg |
|
4649 | # :flag.case_arg | |
4650 | if [[ -n ${2+x} ]]; then |
|
4650 | if [[ -n ${2+x} ]]; then | |
4651 |
|
4651 | |||
4652 | args['--docker-revision']="$2" |
|
4652 | args['--docker-revision']="$2" | |
4653 | shift |
|
4653 | shift | |
4654 | shift |
|
4654 | shift | |
4655 | else |
|
4655 | else | |
4656 | printf "%s\n" "--docker-revision requires an argument: --docker-revision DOCKER_REVISION" >&2 |
|
4656 | printf "%s\n" "--docker-revision requires an argument: --docker-revision DOCKER_REVISION" >&2 | |
4657 | exit 1 |
|
4657 | exit 1 | |
4658 | fi |
|
4658 | fi | |
4659 | ;; |
|
4659 | ;; | |
4660 |
|
4660 | |||
4661 | # :flag.case |
|
4661 | # :flag.case | |
4662 | --install-docker) |
|
4662 | --install-docker) | |
4663 |
|
4663 | |||
4664 | # :flag.case_arg |
|
4664 | # :flag.case_arg | |
4665 | if [[ -n ${2+x} ]]; then |
|
4665 | if [[ -n ${2+x} ]]; then | |
4666 |
|
4666 | |||
4667 | args['--install-docker']="$2" |
|
4667 | args['--install-docker']="$2" | |
4668 | shift |
|
4668 | shift | |
4669 | shift |
|
4669 | shift | |
4670 | else |
|
4670 | else | |
4671 | printf "%s\n" "--install-docker requires an argument: --install-docker INSTALL_DOCKER" >&2 |
|
4671 | printf "%s\n" "--install-docker requires an argument: --install-docker INSTALL_DOCKER" >&2 | |
4672 | exit 1 |
|
4672 | exit 1 | |
4673 | fi |
|
4673 | fi | |
4674 | ;; |
|
4674 | ;; | |
4675 |
|
4675 | |||
4676 | # :flag.case |
|
4676 | # :flag.case | |
4677 | --server-url) |
|
4677 | --server-url) | |
4678 |
|
4678 | |||
4679 | # :flag.case_arg |
|
4679 | # :flag.case_arg | |
4680 | if [[ -n ${2+x} ]]; then |
|
4680 | if [[ -n ${2+x} ]]; then | |
4681 |
|
4681 | |||
4682 | args['--server-url']="$2" |
|
4682 | args['--server-url']="$2" | |
4683 | shift |
|
4683 | shift | |
4684 | shift |
|
4684 | shift | |
4685 | else |
|
4685 | else | |
4686 | printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2 |
|
4686 | printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2 | |
4687 | exit 1 |
|
4687 | exit 1 | |
4688 | fi |
|
4688 | fi | |
4689 | ;; |
|
4689 | ;; | |
4690 |
|
4690 | |||
4691 | # :flag.case |
|
4691 | # :flag.case | |
4692 | --auth-token) |
|
4692 | --auth-token) | |
4693 |
|
4693 | |||
4694 | # :flag.case_arg |
|
4694 | # :flag.case_arg | |
4695 | if [[ -n ${2+x} ]]; then |
|
4695 | if [[ -n ${2+x} ]]; then | |
4696 |
|
4696 | |||
4697 | args['--auth-token']="$2" |
|
4697 | args['--auth-token']="$2" | |
4698 | shift |
|
4698 | shift | |
4699 | shift |
|
4699 | shift | |
4700 | else |
|
4700 | else | |
4701 | printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2 |
|
4701 | printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2 | |
4702 | exit 1 |
|
4702 | exit 1 | |
4703 | fi |
|
4703 | fi | |
4704 | ;; |
|
4704 | ;; | |
4705 |
|
4705 | |||
4706 | -?*) |
|
4706 | -?*) | |
4707 | printf "invalid option: %s\n" "$key" >&2 |
|
4707 | printf "invalid option: %s\n" "$key" >&2 | |
4708 | exit 1 |
|
4708 | exit 1 | |
4709 | ;; |
|
4709 | ;; | |
4710 |
|
4710 | |||
4711 | *) |
|
4711 | *) | |
4712 | # :command.parse_requirements_case |
|
4712 | # :command.parse_requirements_case | |
4713 | # :command.parse_requirements_case_simple |
|
4713 | # :command.parse_requirements_case_simple | |
4714 | printf "invalid argument: %s\n" "$key" >&2 |
|
4714 | printf "invalid argument: %s\n" "$key" >&2 | |
4715 | exit 1 |
|
4715 | exit 1 | |
4716 |
|
4716 | |||
4717 | ;; |
|
4717 | ;; | |
4718 |
|
4718 | |||
4719 | esac |
|
4719 | esac | |
4720 | done |
|
4720 | done | |
4721 |
|
4721 | |||
4722 | # :command.default_assignments |
|
4722 | # :command.default_assignments | |
4723 | [[ -n ${args['--docker-revision']:-} ]] || args['--docker-revision']="stable" |
|
4723 | [[ -n ${args['--docker-revision']:-} ]] || args['--docker-revision']="stable" | |
4724 | [[ -n ${args['--server-url']:-} ]] || args['--server-url']="https://dls.rhodecode.com/get_archive" |
|
4724 | [[ -n ${args['--server-url']:-} ]] || args['--server-url']="https://dls.rhodecode.com/get_archive" | |
4725 |
|
4725 | |||
4726 | } |
|
4726 | } | |
4727 |
|
4727 | |||
4728 | # :command.parse_requirements |
|
4728 | # :command.parse_requirements | |
4729 | rcstack_self_update_parse_requirements() { |
|
4729 | rcstack_self_update_parse_requirements() { | |
4730 | # :command.fixed_flags_filter |
|
4730 | # :command.fixed_flags_filter | |
4731 | while [[ $# -gt 0 ]]; do |
|
4731 | while [[ $# -gt 0 ]]; do | |
4732 | case "${1:-}" in |
|
4732 | case "${1:-}" in | |
4733 | --help | -h) |
|
4733 | --help | -h) | |
4734 | long_usage=yes |
|
4734 | long_usage=yes | |
4735 | rcstack_self_update_usage |
|
4735 | rcstack_self_update_usage | |
4736 | exit |
|
4736 | exit | |
4737 | ;; |
|
4737 | ;; | |
4738 |
|
4738 | |||
4739 | *) |
|
4739 | *) | |
4740 | break |
|
4740 | break | |
4741 | ;; |
|
4741 | ;; | |
4742 |
|
4742 | |||
4743 | esac |
|
4743 | esac | |
4744 | done |
|
4744 | done | |
4745 |
|
4745 | |||
4746 | # :command.dependencies_filter |
|
4746 | # :command.dependencies_filter | |
4747 | if command -v curl >/dev/null 2>&1; then |
|
4747 | if command -v curl >/dev/null 2>&1; then | |
4748 | deps['curl']="$(command -v curl | head -n1)" |
|
4748 | deps['curl']="$(command -v curl | head -n1)" | |
4749 | else |
|
4749 | else | |
4750 | printf "missing dependency: curl\n" >&2 |
|
4750 | printf "missing dependency: curl\n" >&2 | |
4751 | exit 1 |
|
4751 | exit 1 | |
4752 | fi |
|
4752 | fi | |
4753 |
|
4753 | |||
4754 | if command -v tar >/dev/null 2>&1; then |
|
4754 | if command -v tar >/dev/null 2>&1; then | |
4755 | deps['tar']="$(command -v tar | head -n1)" |
|
4755 | deps['tar']="$(command -v tar | head -n1)" | |
4756 | else |
|
4756 | else | |
4757 | printf "missing dependency: tar\n" >&2 |
|
4757 | printf "missing dependency: tar\n" >&2 | |
4758 | exit 1 |
|
4758 | exit 1 | |
4759 | fi |
|
4759 | fi | |
4760 |
|
4760 | |||
4761 | # :command.command_filter |
|
4761 | # :command.command_filter | |
4762 | action="self-update" |
|
4762 | action="self-update" | |
4763 |
|
4763 | |||
4764 | # :command.parse_requirements_while |
|
4764 | # :command.parse_requirements_while | |
4765 | while [[ $# -gt 0 ]]; do |
|
4765 | while [[ $# -gt 0 ]]; do | |
4766 | key="$1" |
|
4766 | key="$1" | |
4767 | case "$key" in |
|
4767 | case "$key" in | |
4768 | # :flag.case |
|
4768 | # :flag.case | |
4769 | --force) |
|
4769 | --force) | |
4770 |
|
4770 | |||
4771 | # :flag.case_no_arg |
|
4771 | # :flag.case_no_arg | |
4772 | args['--force']=1 |
|
4772 | args['--force']=1 | |
4773 | shift |
|
4773 | shift | |
4774 | ;; |
|
4774 | ;; | |
4775 |
|
4775 | |||
4776 | # :flag.case |
|
4776 | # :flag.case | |
4777 | --update-docker-image) |
|
4777 | --update-docker-image) | |
4778 |
|
4778 | |||
4779 | # :flag.case_arg |
|
4779 | # :flag.case_arg | |
4780 | if [[ -n ${2+x} ]]; then |
|
4780 | if [[ -n ${2+x} ]]; then | |
4781 |
|
4781 | |||
4782 | args['--update-docker-image']="$2" |
|
4782 | args['--update-docker-image']="$2" | |
4783 | shift |
|
4783 | shift | |
4784 | shift |
|
4784 | shift | |
4785 | else |
|
4785 | else | |
4786 | printf "%s\n" "--update-docker-image requires an argument: --update-docker-image UPDATE_DOCKER_IMAGE" >&2 |
|
4786 | printf "%s\n" "--update-docker-image requires an argument: --update-docker-image UPDATE_DOCKER_IMAGE" >&2 | |
4787 | exit 1 |
|
4787 | exit 1 | |
4788 | fi |
|
4788 | fi | |
4789 | ;; |
|
4789 | ;; | |
4790 |
|
4790 | |||
4791 | # :flag.case |
|
4791 | # :flag.case | |
4792 | --cli-revision) |
|
4792 | --cli-revision) | |
4793 |
|
4793 | |||
4794 | # :flag.case_arg |
|
4794 | # :flag.case_arg | |
4795 | if [[ -n ${2+x} ]]; then |
|
4795 | if [[ -n ${2+x} ]]; then | |
4796 |
|
4796 | |||
4797 | args['--cli-revision']="$2" |
|
4797 | args['--cli-revision']="$2" | |
4798 | shift |
|
4798 | shift | |
4799 | shift |
|
4799 | shift | |
4800 | else |
|
4800 | else | |
4801 | printf "%s\n" "--cli-revision requires an argument: --cli-revision CLI_REVISION" >&2 |
|
4801 | printf "%s\n" "--cli-revision requires an argument: --cli-revision CLI_REVISION" >&2 | |
4802 | exit 1 |
|
4802 | exit 1 | |
4803 | fi |
|
4803 | fi | |
4804 | ;; |
|
4804 | ;; | |
4805 |
|
4805 | |||
4806 | # :flag.case |
|
4806 | # :flag.case | |
4807 | --docker-revision) |
|
4807 | --docker-revision) | |
4808 |
|
4808 | |||
4809 | # :flag.case_arg |
|
4809 | # :flag.case_arg | |
4810 | if [[ -n ${2+x} ]]; then |
|
4810 | if [[ -n ${2+x} ]]; then | |
4811 |
|
4811 | |||
4812 | args['--docker-revision']="$2" |
|
4812 | args['--docker-revision']="$2" | |
4813 | shift |
|
4813 | shift | |
4814 | shift |
|
4814 | shift | |
4815 | else |
|
4815 | else | |
4816 | printf "%s\n" "--docker-revision requires an argument: --docker-revision DOCKER_REVISION" >&2 |
|
4816 | printf "%s\n" "--docker-revision requires an argument: --docker-revision DOCKER_REVISION" >&2 | |
4817 | exit 1 |
|
4817 | exit 1 | |
4818 | fi |
|
4818 | fi | |
4819 | ;; |
|
4819 | ;; | |
4820 |
|
4820 | |||
4821 | # :flag.case |
|
4821 | # :flag.case | |
4822 | --server-url) |
|
4822 | --server-url) | |
4823 |
|
4823 | |||
4824 | # :flag.case_arg |
|
4824 | # :flag.case_arg | |
4825 | if [[ -n ${2+x} ]]; then |
|
4825 | if [[ -n ${2+x} ]]; then | |
4826 |
|
4826 | |||
4827 | args['--server-url']="$2" |
|
4827 | args['--server-url']="$2" | |
4828 | shift |
|
4828 | shift | |
4829 | shift |
|
4829 | shift | |
4830 | else |
|
4830 | else | |
4831 | printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2 |
|
4831 | printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2 | |
4832 | exit 1 |
|
4832 | exit 1 | |
4833 | fi |
|
4833 | fi | |
4834 | ;; |
|
4834 | ;; | |
4835 |
|
4835 | |||
4836 | # :flag.case |
|
4836 | # :flag.case | |
4837 | --auth-token) |
|
4837 | --auth-token) | |
4838 |
|
4838 | |||
4839 | # :flag.case_arg |
|
4839 | # :flag.case_arg | |
4840 | if [[ -n ${2+x} ]]; then |
|
4840 | if [[ -n ${2+x} ]]; then | |
4841 |
|
4841 | |||
4842 | args['--auth-token']="$2" |
|
4842 | args['--auth-token']="$2" | |
4843 | shift |
|
4843 | shift | |
4844 | shift |
|
4844 | shift | |
4845 | else |
|
4845 | else | |
4846 | printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2 |
|
4846 | printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2 | |
4847 | exit 1 |
|
4847 | exit 1 | |
4848 | fi |
|
4848 | fi | |
4849 | ;; |
|
4849 | ;; | |
4850 |
|
4850 | |||
4851 | -?*) |
|
4851 | -?*) | |
4852 | printf "invalid option: %s\n" "$key" >&2 |
|
4852 | printf "invalid option: %s\n" "$key" >&2 | |
4853 | exit 1 |
|
4853 | exit 1 | |
4854 | ;; |
|
4854 | ;; | |
4855 |
|
4855 | |||
4856 | *) |
|
4856 | *) | |
4857 | # :command.parse_requirements_case |
|
4857 | # :command.parse_requirements_case | |
4858 | # :command.parse_requirements_case_simple |
|
4858 | # :command.parse_requirements_case_simple | |
4859 | printf "invalid argument: %s\n" "$key" >&2 |
|
4859 | printf "invalid argument: %s\n" "$key" >&2 | |
4860 | exit 1 |
|
4860 | exit 1 | |
4861 |
|
4861 | |||
4862 | ;; |
|
4862 | ;; | |
4863 |
|
4863 | |||
4864 | esac |
|
4864 | esac | |
4865 | done |
|
4865 | done | |
4866 |
|
4866 | |||
4867 | # :command.default_assignments |
|
4867 | # :command.default_assignments | |
4868 | [[ -n ${args['--cli-revision']:-} ]] || args['--cli-revision']="stable" |
|
4868 | [[ -n ${args['--cli-revision']:-} ]] || args['--cli-revision']="stable" | |
4869 | [[ -n ${args['--docker-revision']:-} ]] || args['--docker-revision']="stable" |
|
4869 | [[ -n ${args['--docker-revision']:-} ]] || args['--docker-revision']="stable" | |
4870 | [[ -n ${args['--server-url']:-} ]] || args['--server-url']="https://dls.rhodecode.com/get_archive" |
|
4870 | [[ -n ${args['--server-url']:-} ]] || args['--server-url']="https://dls.rhodecode.com/get_archive" | |
4871 |
|
4871 | |||
4872 | } |
|
4872 | } | |
4873 |
|
4873 | |||
4874 | # :command.parse_requirements |
|
4874 | # :command.parse_requirements | |
4875 | rcstack_stack_parse_requirements() { |
|
4875 | rcstack_stack_parse_requirements() { | |
4876 | # :command.fixed_flags_filter |
|
4876 | # :command.fixed_flags_filter | |
4877 | while [[ $# -gt 0 ]]; do |
|
4877 | while [[ $# -gt 0 ]]; do | |
4878 | case "${1:-}" in |
|
4878 | case "${1:-}" in | |
4879 | --help | -h) |
|
4879 | --help | -h) | |
4880 | long_usage=yes |
|
4880 | long_usage=yes | |
4881 | rcstack_stack_usage |
|
4881 | rcstack_stack_usage | |
4882 | exit |
|
4882 | exit | |
4883 | ;; |
|
4883 | ;; | |
4884 |
|
4884 | |||
4885 | # :flag.case |
|
4885 | # :flag.case | |
4886 | --env-file-path) |
|
4886 | --env-file-path) | |
4887 |
|
4887 | |||
4888 | # :flag.case_arg |
|
4888 | # :flag.case_arg | |
4889 | if [[ -n ${2+x} ]]; then |
|
4889 | if [[ -n ${2+x} ]]; then | |
4890 | # :flag.validations |
|
4890 | # :flag.validations | |
4891 | if [[ -n $(validate_file_exists "$2") ]]; then |
|
4891 | if [[ -n $(validate_file_exists "$2") ]]; then | |
4892 | printf "validation error in %s:\n%s\n" "--env-file-path ENV_FILE_PATH" "$(validate_file_exists "$2")" >&2 |
|
4892 | printf "validation error in %s:\n%s\n" "--env-file-path ENV_FILE_PATH" "$(validate_file_exists "$2")" >&2 | |
4893 | exit 1 |
|
4893 | exit 1 | |
4894 | fi |
|
4894 | fi | |
4895 |
|
4895 | |||
4896 | args['--env-file-path']="$2" |
|
4896 | args['--env-file-path']="$2" | |
4897 | shift |
|
4897 | shift | |
4898 | shift |
|
4898 | shift | |
4899 | else |
|
4899 | else | |
4900 | printf "%s\n" "--env-file-path requires an argument: --env-file-path ENV_FILE_PATH" >&2 |
|
4900 | printf "%s\n" "--env-file-path requires an argument: --env-file-path ENV_FILE_PATH" >&2 | |
4901 | exit 1 |
|
4901 | exit 1 | |
4902 | fi |
|
4902 | fi | |
4903 | ;; |
|
4903 | ;; | |
4904 |
|
4904 | |||
4905 | # :flag.case |
|
4905 | # :flag.case | |
4906 | --stack-prefix) |
|
4906 | --stack-prefix) | |
4907 |
|
4907 | |||
4908 | # :flag.case_arg |
|
4908 | # :flag.case_arg | |
4909 | if [[ -n ${2+x} ]]; then |
|
4909 | if [[ -n ${2+x} ]]; then | |
4910 |
|
4910 | |||
4911 | args['--stack-prefix']="$2" |
|
4911 | args['--stack-prefix']="$2" | |
4912 | shift |
|
4912 | shift | |
4913 | shift |
|
4913 | shift | |
4914 | else |
|
4914 | else | |
4915 | printf "%s\n" "--stack-prefix requires an argument: --stack-prefix STACK_PREFIX" >&2 |
|
4915 | printf "%s\n" "--stack-prefix requires an argument: --stack-prefix STACK_PREFIX" >&2 | |
4916 | exit 1 |
|
4916 | exit 1 | |
4917 | fi |
|
4917 | fi | |
4918 | ;; |
|
4918 | ;; | |
4919 |
|
4919 | |||
4920 | *) |
|
4920 | *) | |
4921 | break |
|
4921 | break | |
4922 | ;; |
|
4922 | ;; | |
4923 |
|
4923 | |||
4924 | esac |
|
4924 | esac | |
4925 | done |
|
4925 | done | |
4926 |
|
4926 | |||
4927 | # :command.command_filter |
|
4927 | # :command.command_filter | |
4928 | action=${1:-} |
|
4928 | action=${1:-} | |
4929 |
|
4929 | |||
4930 | case $action in |
|
4930 | case $action in | |
4931 | -*) ;; |
|
4931 | -*) ;; | |
4932 |
|
4932 | |||
4933 | router) |
|
4933 | router) | |
4934 | action="router" |
|
4934 | action="router" | |
4935 | shift |
|
4935 | shift | |
4936 | rcstack_stack_router_parse_requirements "$@" |
|
4936 | rcstack_stack_router_parse_requirements "$@" | |
4937 | shift $# |
|
4937 | shift $# | |
4938 | ;; |
|
4938 | ;; | |
4939 |
|
4939 | |||
4940 | metrics) |
|
4940 | metrics) | |
4941 | action="metrics" |
|
4941 | action="metrics" | |
4942 | shift |
|
4942 | shift | |
4943 | rcstack_stack_metrics_parse_requirements "$@" |
|
4943 | rcstack_stack_metrics_parse_requirements "$@" | |
4944 | shift $# |
|
4944 | shift $# | |
4945 | ;; |
|
4945 | ;; | |
4946 |
|
4946 | |||
4947 | services) |
|
4947 | services) | |
4948 | action="services" |
|
4948 | action="services" | |
4949 | shift |
|
4949 | shift | |
4950 | rcstack_stack_services_parse_requirements "$@" |
|
4950 | rcstack_stack_services_parse_requirements "$@" | |
4951 | shift $# |
|
4951 | shift $# | |
4952 | ;; |
|
4952 | ;; | |
4953 |
|
4953 | |||
4954 | rhodecode) |
|
4954 | rhodecode) | |
4955 | action="rhodecode" |
|
4955 | action="rhodecode" | |
4956 | shift |
|
4956 | shift | |
4957 | rcstack_stack_rhodecode_parse_requirements "$@" |
|
4957 | rcstack_stack_rhodecode_parse_requirements "$@" | |
4958 | shift $# |
|
4958 | shift $# | |
4959 | ;; |
|
4959 | ;; | |
4960 |
|
4960 | |||
4961 | all) |
|
4961 | all) | |
4962 | action="all" |
|
4962 | action="all" | |
4963 | shift |
|
4963 | shift | |
4964 | rcstack_stack_all_parse_requirements "$@" |
|
4964 | rcstack_stack_all_parse_requirements "$@" | |
4965 | shift $# |
|
4965 | shift $# | |
4966 | ;; |
|
4966 | ;; | |
4967 |
|
4967 | |||
4968 | # :command.command_fallback |
|
4968 | # :command.command_fallback | |
4969 | "") |
|
4969 | "") | |
4970 | rcstack_stack_usage >&2 |
|
4970 | rcstack_stack_usage >&2 | |
4971 | exit 1 |
|
4971 | exit 1 | |
4972 | ;; |
|
4972 | ;; | |
4973 |
|
4973 | |||
4974 | *) |
|
4974 | *) | |
4975 | printf "invalid command: %s\n" "$action" >&2 |
|
4975 | printf "invalid command: %s\n" "$action" >&2 | |
4976 | exit 1 |
|
4976 | exit 1 | |
4977 | ;; |
|
4977 | ;; | |
4978 |
|
4978 | |||
4979 | esac |
|
4979 | esac | |
4980 |
|
4980 | |||
4981 | # :command.parse_requirements_while |
|
4981 | # :command.parse_requirements_while | |
4982 | while [[ $# -gt 0 ]]; do |
|
4982 | while [[ $# -gt 0 ]]; do | |
4983 | key="$1" |
|
4983 | key="$1" | |
4984 | case "$key" in |
|
4984 | case "$key" in | |
4985 |
|
4985 | |||
4986 | -?*) |
|
4986 | -?*) | |
4987 | printf "invalid option: %s\n" "$key" >&2 |
|
4987 | printf "invalid option: %s\n" "$key" >&2 | |
4988 | exit 1 |
|
4988 | exit 1 | |
4989 | ;; |
|
4989 | ;; | |
4990 |
|
4990 | |||
4991 | *) |
|
4991 | *) | |
4992 | # :command.parse_requirements_case |
|
4992 | # :command.parse_requirements_case | |
4993 | # :command.parse_requirements_case_simple |
|
4993 | # :command.parse_requirements_case_simple | |
4994 | printf "invalid argument: %s\n" "$key" >&2 |
|
4994 | printf "invalid argument: %s\n" "$key" >&2 | |
4995 | exit 1 |
|
4995 | exit 1 | |
4996 |
|
4996 | |||
4997 | ;; |
|
4997 | ;; | |
4998 |
|
4998 | |||
4999 | esac |
|
4999 | esac | |
5000 | done |
|
5000 | done | |
5001 |
|
5001 | |||
5002 | # :command.default_assignments |
|
5002 | # :command.default_assignments | |
5003 | [[ -n ${args['--env-file-path']:-} ]] || args['--env-file-path']="$PWD/.custom/.runtime.env" |
|
5003 | [[ -n ${args['--env-file-path']:-} ]] || args['--env-file-path']="$PWD/.custom/.runtime.env" | |
5004 |
|
5004 | |||
5005 | } |
|
5005 | } | |
5006 |
|
5006 | |||
5007 | # :command.parse_requirements |
|
5007 | # :command.parse_requirements | |
5008 | rcstack_stack_router_parse_requirements() { |
|
5008 | rcstack_stack_router_parse_requirements() { | |
5009 | # :command.fixed_flags_filter |
|
5009 | # :command.fixed_flags_filter | |
5010 | while [[ $# -gt 0 ]]; do |
|
5010 | while [[ $# -gt 0 ]]; do | |
5011 | case "${1:-}" in |
|
5011 | case "${1:-}" in | |
5012 | --help | -h) |
|
5012 | --help | -h) | |
5013 | long_usage=yes |
|
5013 | long_usage=yes | |
5014 | rcstack_stack_router_usage |
|
5014 | rcstack_stack_router_usage | |
5015 | exit |
|
5015 | exit | |
5016 | ;; |
|
5016 | ;; | |
5017 |
|
5017 | |||
5018 | *) |
|
5018 | *) | |
5019 | break |
|
5019 | break | |
5020 | ;; |
|
5020 | ;; | |
5021 |
|
5021 | |||
5022 | esac |
|
5022 | esac | |
5023 | done |
|
5023 | done | |
5024 |
|
5024 | |||
5025 | # :command.command_filter |
|
5025 | # :command.command_filter | |
5026 | action="stack router" |
|
5026 | action="stack router" | |
5027 |
|
5027 | |||
5028 | # :command.parse_requirements_while |
|
5028 | # :command.parse_requirements_while | |
5029 | while [[ $# -gt 0 ]]; do |
|
5029 | while [[ $# -gt 0 ]]; do | |
5030 | key="$1" |
|
5030 | key="$1" | |
5031 | case "$key" in |
|
5031 | case "$key" in | |
5032 |
|
5032 | |||
5033 | --) |
|
5033 | --) | |
5034 | shift |
|
5034 | shift | |
5035 | other_args+=("$@") |
|
5035 | other_args+=("$@") | |
5036 | break |
|
5036 | break | |
5037 | ;; |
|
5037 | ;; | |
5038 |
|
5038 | |||
5039 | -?*) |
|
5039 | -?*) | |
5040 | other_args+=("$1") |
|
5040 | other_args+=("$1") | |
5041 | shift |
|
5041 | shift | |
5042 | ;; |
|
5042 | ;; | |
5043 |
|
5043 | |||
5044 | *) |
|
5044 | *) | |
5045 | # :command.parse_requirements_case |
|
5045 | # :command.parse_requirements_case | |
5046 | # :command.parse_requirements_case_catch_all |
|
5046 | # :command.parse_requirements_case_catch_all | |
5047 | other_args+=("$1") |
|
5047 | other_args+=("$1") | |
5048 | shift |
|
5048 | shift | |
5049 |
|
5049 | |||
5050 | ;; |
|
5050 | ;; | |
5051 |
|
5051 | |||
5052 | esac |
|
5052 | esac | |
5053 | done |
|
5053 | done | |
5054 |
|
5054 | |||
5055 | } |
|
5055 | } | |
5056 |
|
5056 | |||
5057 | # :command.parse_requirements |
|
5057 | # :command.parse_requirements | |
5058 | rcstack_stack_metrics_parse_requirements() { |
|
5058 | rcstack_stack_metrics_parse_requirements() { | |
5059 | # :command.fixed_flags_filter |
|
5059 | # :command.fixed_flags_filter | |
5060 | while [[ $# -gt 0 ]]; do |
|
5060 | while [[ $# -gt 0 ]]; do | |
5061 | case "${1:-}" in |
|
5061 | case "${1:-}" in | |
5062 | --help | -h) |
|
5062 | --help | -h) | |
5063 | long_usage=yes |
|
5063 | long_usage=yes | |
5064 | rcstack_stack_metrics_usage |
|
5064 | rcstack_stack_metrics_usage | |
5065 | exit |
|
5065 | exit | |
5066 | ;; |
|
5066 | ;; | |
5067 |
|
5067 | |||
5068 | *) |
|
5068 | *) | |
5069 | break |
|
5069 | break | |
5070 | ;; |
|
5070 | ;; | |
5071 |
|
5071 | |||
5072 | esac |
|
5072 | esac | |
5073 | done |
|
5073 | done | |
5074 |
|
5074 | |||
5075 | # :command.command_filter |
|
5075 | # :command.command_filter | |
5076 | action="stack metrics" |
|
5076 | action="stack metrics" | |
5077 |
|
5077 | |||
5078 | # :command.parse_requirements_while |
|
5078 | # :command.parse_requirements_while | |
5079 | while [[ $# -gt 0 ]]; do |
|
5079 | while [[ $# -gt 0 ]]; do | |
5080 | key="$1" |
|
5080 | key="$1" | |
5081 | case "$key" in |
|
5081 | case "$key" in | |
5082 |
|
5082 | |||
5083 | --) |
|
5083 | --) | |
5084 | shift |
|
5084 | shift | |
5085 | other_args+=("$@") |
|
5085 | other_args+=("$@") | |
5086 | break |
|
5086 | break | |
5087 | ;; |
|
5087 | ;; | |
5088 |
|
5088 | |||
5089 | -?*) |
|
5089 | -?*) | |
5090 | other_args+=("$1") |
|
5090 | other_args+=("$1") | |
5091 | shift |
|
5091 | shift | |
5092 | ;; |
|
5092 | ;; | |
5093 |
|
5093 | |||
5094 | *) |
|
5094 | *) | |
5095 | # :command.parse_requirements_case |
|
5095 | # :command.parse_requirements_case | |
5096 | # :command.parse_requirements_case_catch_all |
|
5096 | # :command.parse_requirements_case_catch_all | |
5097 | other_args+=("$1") |
|
5097 | other_args+=("$1") | |
5098 | shift |
|
5098 | shift | |
5099 |
|
5099 | |||
5100 | ;; |
|
5100 | ;; | |
5101 |
|
5101 | |||
5102 | esac |
|
5102 | esac | |
5103 | done |
|
5103 | done | |
5104 |
|
5104 | |||
5105 | } |
|
5105 | } | |
5106 |
|
5106 | |||
5107 | # :command.parse_requirements |
|
5107 | # :command.parse_requirements | |
5108 | rcstack_stack_services_parse_requirements() { |
|
5108 | rcstack_stack_services_parse_requirements() { | |
5109 | # :command.fixed_flags_filter |
|
5109 | # :command.fixed_flags_filter | |
5110 | while [[ $# -gt 0 ]]; do |
|
5110 | while [[ $# -gt 0 ]]; do | |
5111 | case "${1:-}" in |
|
5111 | case "${1:-}" in | |
5112 | --help | -h) |
|
5112 | --help | -h) | |
5113 | long_usage=yes |
|
5113 | long_usage=yes | |
5114 | rcstack_stack_services_usage |
|
5114 | rcstack_stack_services_usage | |
5115 | exit |
|
5115 | exit | |
5116 | ;; |
|
5116 | ;; | |
5117 |
|
5117 | |||
5118 | *) |
|
5118 | *) | |
5119 | break |
|
5119 | break | |
5120 | ;; |
|
5120 | ;; | |
5121 |
|
5121 | |||
5122 | esac |
|
5122 | esac | |
5123 | done |
|
5123 | done | |
5124 |
|
5124 | |||
5125 | # :command.command_filter |
|
5125 | # :command.command_filter | |
5126 | action="stack services" |
|
5126 | action="stack services" | |
5127 |
|
5127 | |||
5128 | # :command.parse_requirements_while |
|
5128 | # :command.parse_requirements_while | |
5129 | while [[ $# -gt 0 ]]; do |
|
5129 | while [[ $# -gt 0 ]]; do | |
5130 | key="$1" |
|
5130 | key="$1" | |
5131 | case "$key" in |
|
5131 | case "$key" in | |
5132 |
|
5132 | |||
5133 | --) |
|
5133 | --) | |
5134 | shift |
|
5134 | shift | |
5135 | other_args+=("$@") |
|
5135 | other_args+=("$@") | |
5136 | break |
|
5136 | break | |
5137 | ;; |
|
5137 | ;; | |
5138 |
|
5138 | |||
5139 | -?*) |
|
5139 | -?*) | |
5140 | other_args+=("$1") |
|
5140 | other_args+=("$1") | |
5141 | shift |
|
5141 | shift | |
5142 | ;; |
|
5142 | ;; | |
5143 |
|
5143 | |||
5144 | *) |
|
5144 | *) | |
5145 | # :command.parse_requirements_case |
|
5145 | # :command.parse_requirements_case | |
5146 | # :command.parse_requirements_case_catch_all |
|
5146 | # :command.parse_requirements_case_catch_all | |
5147 | other_args+=("$1") |
|
5147 | other_args+=("$1") | |
5148 | shift |
|
5148 | shift | |
5149 |
|
5149 | |||
5150 | ;; |
|
5150 | ;; | |
5151 |
|
5151 | |||
5152 | esac |
|
5152 | esac | |
5153 | done |
|
5153 | done | |
5154 |
|
5154 | |||
5155 | } |
|
5155 | } | |
5156 |
|
5156 | |||
5157 | # :command.parse_requirements |
|
5157 | # :command.parse_requirements | |
5158 | rcstack_stack_rhodecode_parse_requirements() { |
|
5158 | rcstack_stack_rhodecode_parse_requirements() { | |
5159 | # :command.fixed_flags_filter |
|
5159 | # :command.fixed_flags_filter | |
5160 | while [[ $# -gt 0 ]]; do |
|
5160 | while [[ $# -gt 0 ]]; do | |
5161 | case "${1:-}" in |
|
5161 | case "${1:-}" in | |
5162 | --help | -h) |
|
5162 | --help | -h) | |
5163 | long_usage=yes |
|
5163 | long_usage=yes | |
5164 | rcstack_stack_rhodecode_usage |
|
5164 | rcstack_stack_rhodecode_usage | |
5165 | exit |
|
5165 | exit | |
5166 | ;; |
|
5166 | ;; | |
5167 |
|
5167 | |||
5168 | *) |
|
5168 | *) | |
5169 | break |
|
5169 | break | |
5170 | ;; |
|
5170 | ;; | |
5171 |
|
5171 | |||
5172 | esac |
|
5172 | esac | |
5173 | done |
|
5173 | done | |
5174 |
|
5174 | |||
5175 | # :command.command_filter |
|
5175 | # :command.command_filter | |
5176 | action="stack rhodecode" |
|
5176 | action="stack rhodecode" | |
5177 |
|
5177 | |||
5178 | # :command.parse_requirements_while |
|
5178 | # :command.parse_requirements_while | |
5179 | while [[ $# -gt 0 ]]; do |
|
5179 | while [[ $# -gt 0 ]]; do | |
5180 | key="$1" |
|
5180 | key="$1" | |
5181 | case "$key" in |
|
5181 | case "$key" in | |
5182 |
|
5182 | |||
5183 | --) |
|
5183 | --) | |
5184 | shift |
|
5184 | shift | |
5185 | other_args+=("$@") |
|
5185 | other_args+=("$@") | |
5186 | break |
|
5186 | break | |
5187 | ;; |
|
5187 | ;; | |
5188 |
|
5188 | |||
5189 | -?*) |
|
5189 | -?*) | |
5190 | other_args+=("$1") |
|
5190 | other_args+=("$1") | |
5191 | shift |
|
5191 | shift | |
5192 | ;; |
|
5192 | ;; | |
5193 |
|
5193 | |||
5194 | *) |
|
5194 | *) | |
5195 | # :command.parse_requirements_case |
|
5195 | # :command.parse_requirements_case | |
5196 | # :command.parse_requirements_case_catch_all |
|
5196 | # :command.parse_requirements_case_catch_all | |
5197 | other_args+=("$1") |
|
5197 | other_args+=("$1") | |
5198 | shift |
|
5198 | shift | |
5199 |
|
5199 | |||
5200 | ;; |
|
5200 | ;; | |
5201 |
|
5201 | |||
5202 | esac |
|
5202 | esac | |
5203 | done |
|
5203 | done | |
5204 |
|
5204 | |||
5205 | } |
|
5205 | } | |
5206 |
|
5206 | |||
5207 | # :command.parse_requirements |
|
5207 | # :command.parse_requirements | |
5208 | rcstack_stack_all_parse_requirements() { |
|
5208 | rcstack_stack_all_parse_requirements() { | |
5209 | # :command.fixed_flags_filter |
|
5209 | # :command.fixed_flags_filter | |
5210 | while [[ $# -gt 0 ]]; do |
|
5210 | while [[ $# -gt 0 ]]; do | |
5211 | case "${1:-}" in |
|
5211 | case "${1:-}" in | |
5212 | --help | -h) |
|
5212 | --help | -h) | |
5213 | long_usage=yes |
|
5213 | long_usage=yes | |
5214 | rcstack_stack_all_usage |
|
5214 | rcstack_stack_all_usage | |
5215 | exit |
|
5215 | exit | |
5216 | ;; |
|
5216 | ;; | |
5217 |
|
5217 | |||
5218 | *) |
|
5218 | *) | |
5219 | break |
|
5219 | break | |
5220 | ;; |
|
5220 | ;; | |
5221 |
|
5221 | |||
5222 | esac |
|
5222 | esac | |
5223 | done |
|
5223 | done | |
5224 |
|
5224 | |||
5225 | # :command.command_filter |
|
5225 | # :command.command_filter | |
5226 | action="stack all" |
|
5226 | action="stack all" | |
5227 |
|
5227 | |||
5228 | # :command.parse_requirements_while |
|
5228 | # :command.parse_requirements_while | |
5229 | while [[ $# -gt 0 ]]; do |
|
5229 | while [[ $# -gt 0 ]]; do | |
5230 | key="$1" |
|
5230 | key="$1" | |
5231 | case "$key" in |
|
5231 | case "$key" in | |
5232 |
|
5232 | |||
5233 | --) |
|
5233 | --) | |
5234 | shift |
|
5234 | shift | |
5235 | other_args+=("$@") |
|
5235 | other_args+=("$@") | |
5236 | break |
|
5236 | break | |
5237 | ;; |
|
5237 | ;; | |
5238 |
|
5238 | |||
5239 | -?*) |
|
5239 | -?*) | |
5240 | other_args+=("$1") |
|
5240 | other_args+=("$1") | |
5241 | shift |
|
5241 | shift | |
5242 | ;; |
|
5242 | ;; | |
5243 |
|
5243 | |||
5244 | *) |
|
5244 | *) | |
5245 | # :command.parse_requirements_case |
|
5245 | # :command.parse_requirements_case | |
5246 | # :command.parse_requirements_case_catch_all |
|
5246 | # :command.parse_requirements_case_catch_all | |
5247 | other_args+=("$1") |
|
5247 | other_args+=("$1") | |
5248 | shift |
|
5248 | shift | |
5249 |
|
5249 | |||
5250 | ;; |
|
5250 | ;; | |
5251 |
|
5251 | |||
5252 | esac |
|
5252 | esac | |
5253 | done |
|
5253 | done | |
5254 |
|
5254 | |||
5255 | } |
|
5255 | } | |
5256 |
|
5256 | |||
5257 | # :command.parse_requirements |
|
5257 | # :command.parse_requirements | |
5258 | rcstack_stack_status_parse_requirements() { |
|
5258 | rcstack_stack_status_parse_requirements() { | |
5259 | # :command.fixed_flags_filter |
|
5259 | # :command.fixed_flags_filter | |
5260 | while [[ $# -gt 0 ]]; do |
|
5260 | while [[ $# -gt 0 ]]; do | |
5261 | case "${1:-}" in |
|
5261 | case "${1:-}" in | |
5262 | --help | -h) |
|
5262 | --help | -h) | |
5263 | long_usage=yes |
|
5263 | long_usage=yes | |
5264 | rcstack_stack_status_usage |
|
5264 | rcstack_stack_status_usage | |
5265 | exit |
|
5265 | exit | |
5266 | ;; |
|
5266 | ;; | |
5267 |
|
5267 | |||
5268 | *) |
|
5268 | *) | |
5269 | break |
|
5269 | break | |
5270 | ;; |
|
5270 | ;; | |
5271 |
|
5271 | |||
5272 | esac |
|
5272 | esac | |
5273 | done |
|
5273 | done | |
5274 |
|
5274 | |||
5275 | # :command.command_filter |
|
5275 | # :command.command_filter | |
5276 | action="stack-status" |
|
5276 | action="stack-status" | |
5277 |
|
5277 | |||
5278 | # :command.parse_requirements_while |
|
5278 | # :command.parse_requirements_while | |
5279 | while [[ $# -gt 0 ]]; do |
|
5279 | while [[ $# -gt 0 ]]; do | |
5280 | key="$1" |
|
5280 | key="$1" | |
5281 | case "$key" in |
|
5281 | case "$key" in | |
5282 | # :flag.case |
|
5282 | # :flag.case | |
5283 | --detailed) |
|
5283 | --detailed) | |
5284 |
|
5284 | |||
5285 | # :flag.case_no_arg |
|
5285 | # :flag.case_no_arg | |
5286 | args['--detailed']=1 |
|
5286 | args['--detailed']=1 | |
5287 | shift |
|
5287 | shift | |
5288 | ;; |
|
5288 | ;; | |
5289 |
|
5289 | |||
5290 | # :flag.case |
|
5290 | # :flag.case | |
5291 | --configs) |
|
5291 | --configs) | |
5292 |
|
5292 | |||
5293 | # :flag.case_no_arg |
|
5293 | # :flag.case_no_arg | |
5294 | args['--configs']=1 |
|
5294 | args['--configs']=1 | |
5295 | shift |
|
5295 | shift | |
5296 | ;; |
|
5296 | ;; | |
5297 |
|
5297 | |||
5298 | # :flag.case |
|
5298 | # :flag.case | |
5299 | -v) |
|
5299 | -v) | |
5300 |
|
5300 | |||
5301 | # :flag.case_no_arg |
|
5301 | # :flag.case_no_arg | |
5302 | args['-v']=1 |
|
5302 | args['-v']=1 | |
5303 | shift |
|
5303 | shift | |
5304 | ;; |
|
5304 | ;; | |
5305 |
|
5305 | |||
5306 | -?*) |
|
5306 | -?*) | |
5307 | printf "invalid option: %s\n" "$key" >&2 |
|
5307 | printf "invalid option: %s\n" "$key" >&2 | |
5308 | exit 1 |
|
5308 | exit 1 | |
5309 | ;; |
|
5309 | ;; | |
5310 |
|
5310 | |||
5311 | *) |
|
5311 | *) | |
5312 | # :command.parse_requirements_case |
|
5312 | # :command.parse_requirements_case | |
5313 | # :command.parse_requirements_case_simple |
|
5313 | # :command.parse_requirements_case_simple | |
5314 | printf "invalid argument: %s\n" "$key" >&2 |
|
5314 | printf "invalid argument: %s\n" "$key" >&2 | |
5315 | exit 1 |
|
5315 | exit 1 | |
5316 |
|
5316 | |||
5317 | ;; |
|
5317 | ;; | |
5318 |
|
5318 | |||
5319 | esac |
|
5319 | esac | |
5320 | done |
|
5320 | done | |
5321 |
|
5321 | |||
5322 | } |
|
5322 | } | |
5323 |
|
5323 | |||
5324 | # :command.parse_requirements |
|
5324 | # :command.parse_requirements | |
5325 | rcstack_stack_upgrade_parse_requirements() { |
|
5325 | rcstack_stack_upgrade_parse_requirements() { | |
5326 | # :command.fixed_flags_filter |
|
5326 | # :command.fixed_flags_filter | |
5327 | while [[ $# -gt 0 ]]; do |
|
5327 | while [[ $# -gt 0 ]]; do | |
5328 | case "${1:-}" in |
|
5328 | case "${1:-}" in | |
5329 | --help | -h) |
|
5329 | --help | -h) | |
5330 | long_usage=yes |
|
5330 | long_usage=yes | |
5331 | rcstack_stack_upgrade_usage |
|
5331 | rcstack_stack_upgrade_usage | |
5332 | exit |
|
5332 | exit | |
5333 | ;; |
|
5333 | ;; | |
5334 |
|
5334 | |||
5335 | # :flag.case |
|
5335 | # :flag.case | |
5336 | --stack-prefix) |
|
5336 | --stack-prefix) | |
5337 |
|
5337 | |||
5338 | # :flag.case_arg |
|
5338 | # :flag.case_arg | |
5339 | if [[ -n ${2+x} ]]; then |
|
5339 | if [[ -n ${2+x} ]]; then | |
5340 |
|
5340 | |||
5341 | args['--stack-prefix']="$2" |
|
5341 | args['--stack-prefix']="$2" | |
5342 | shift |
|
5342 | shift | |
5343 | shift |
|
5343 | shift | |
5344 | else |
|
5344 | else | |
5345 | printf "%s\n" "--stack-prefix requires an argument: --stack-prefix STACK_PREFIX" >&2 |
|
5345 | printf "%s\n" "--stack-prefix requires an argument: --stack-prefix STACK_PREFIX" >&2 | |
5346 | exit 1 |
|
5346 | exit 1 | |
5347 | fi |
|
5347 | fi | |
5348 | ;; |
|
5348 | ;; | |
5349 |
|
5349 | |||
5350 | *) |
|
5350 | *) | |
5351 | break |
|
5351 | break | |
5352 | ;; |
|
5352 | ;; | |
5353 |
|
5353 | |||
5354 | esac |
|
5354 | esac | |
5355 | done |
|
5355 | done | |
5356 |
|
5356 | |||
5357 | # :command.command_filter |
|
5357 | # :command.command_filter | |
5358 | action=${1:-} |
|
5358 | action=${1:-} | |
5359 |
|
5359 | |||
5360 | case $action in |
|
5360 | case $action in | |
5361 | -*) ;; |
|
5361 | -*) ;; | |
5362 |
|
5362 | |||
5363 | router) |
|
5363 | router) | |
5364 | action="router" |
|
5364 | action="router" | |
5365 | shift |
|
5365 | shift | |
5366 | rcstack_stack_upgrade_router_parse_requirements "$@" |
|
5366 | rcstack_stack_upgrade_router_parse_requirements "$@" | |
5367 | shift $# |
|
5367 | shift $# | |
5368 | ;; |
|
5368 | ;; | |
5369 |
|
5369 | |||
5370 | services) |
|
5370 | services) | |
5371 | action="services" |
|
5371 | action="services" | |
5372 | shift |
|
5372 | shift | |
5373 | rcstack_stack_upgrade_services_parse_requirements "$@" |
|
5373 | rcstack_stack_upgrade_services_parse_requirements "$@" | |
5374 | shift $# |
|
5374 | shift $# | |
5375 | ;; |
|
5375 | ;; | |
5376 |
|
5376 | |||
5377 | metrics) |
|
5377 | metrics) | |
5378 | action="metrics" |
|
5378 | action="metrics" | |
5379 | shift |
|
5379 | shift | |
5380 | rcstack_stack_upgrade_metrics_parse_requirements "$@" |
|
5380 | rcstack_stack_upgrade_metrics_parse_requirements "$@" | |
5381 | shift $# |
|
5381 | shift $# | |
5382 | ;; |
|
5382 | ;; | |
5383 |
|
5383 | |||
5384 | rhodecode) |
|
5384 | rhodecode) | |
5385 | action="rhodecode" |
|
5385 | action="rhodecode" | |
5386 | shift |
|
5386 | shift | |
5387 | rcstack_stack_upgrade_rhodecode_parse_requirements "$@" |
|
5387 | rcstack_stack_upgrade_rhodecode_parse_requirements "$@" | |
5388 | shift $# |
|
5388 | shift $# | |
5389 | ;; |
|
5389 | ;; | |
5390 |
|
5390 | |||
5391 | # :command.command_fallback |
|
5391 | # :command.command_fallback | |
5392 | "") |
|
5392 | "") | |
5393 | rcstack_stack_upgrade_usage >&2 |
|
5393 | rcstack_stack_upgrade_usage >&2 | |
5394 | exit 1 |
|
5394 | exit 1 | |
5395 | ;; |
|
5395 | ;; | |
5396 |
|
5396 | |||
5397 | *) |
|
5397 | *) | |
5398 | printf "invalid command: %s\n" "$action" >&2 |
|
5398 | printf "invalid command: %s\n" "$action" >&2 | |
5399 | exit 1 |
|
5399 | exit 1 | |
5400 | ;; |
|
5400 | ;; | |
5401 |
|
5401 | |||
5402 | esac |
|
5402 | esac | |
5403 |
|
5403 | |||
5404 | # :command.parse_requirements_while |
|
5404 | # :command.parse_requirements_while | |
5405 | while [[ $# -gt 0 ]]; do |
|
5405 | while [[ $# -gt 0 ]]; do | |
5406 | key="$1" |
|
5406 | key="$1" | |
5407 | case "$key" in |
|
5407 | case "$key" in | |
5408 |
|
5408 | |||
5409 | -?*) |
|
5409 | -?*) | |
5410 | printf "invalid option: %s\n" "$key" >&2 |
|
5410 | printf "invalid option: %s\n" "$key" >&2 | |
5411 | exit 1 |
|
5411 | exit 1 | |
5412 | ;; |
|
5412 | ;; | |
5413 |
|
5413 | |||
5414 | *) |
|
5414 | *) | |
5415 | # :command.parse_requirements_case |
|
5415 | # :command.parse_requirements_case | |
5416 | # :command.parse_requirements_case_simple |
|
5416 | # :command.parse_requirements_case_simple | |
5417 | printf "invalid argument: %s\n" "$key" >&2 |
|
5417 | printf "invalid argument: %s\n" "$key" >&2 | |
5418 | exit 1 |
|
5418 | exit 1 | |
5419 |
|
5419 | |||
5420 | ;; |
|
5420 | ;; | |
5421 |
|
5421 | |||
5422 | esac |
|
5422 | esac | |
5423 | done |
|
5423 | done | |
5424 |
|
5424 | |||
5425 | } |
|
5425 | } | |
5426 |
|
5426 | |||
5427 | # :command.parse_requirements |
|
5427 | # :command.parse_requirements | |
5428 | rcstack_stack_upgrade_router_parse_requirements() { |
|
5428 | rcstack_stack_upgrade_router_parse_requirements() { | |
5429 | # :command.fixed_flags_filter |
|
5429 | # :command.fixed_flags_filter | |
5430 | while [[ $# -gt 0 ]]; do |
|
5430 | while [[ $# -gt 0 ]]; do | |
5431 | case "${1:-}" in |
|
5431 | case "${1:-}" in | |
5432 | --help | -h) |
|
5432 | --help | -h) | |
5433 | long_usage=yes |
|
5433 | long_usage=yes | |
5434 | rcstack_stack_upgrade_router_usage |
|
5434 | rcstack_stack_upgrade_router_usage | |
5435 | exit |
|
5435 | exit | |
5436 | ;; |
|
5436 | ;; | |
5437 |
|
5437 | |||
5438 | *) |
|
5438 | *) | |
5439 | break |
|
5439 | break | |
5440 | ;; |
|
5440 | ;; | |
5441 |
|
5441 | |||
5442 | esac |
|
5442 | esac | |
5443 | done |
|
5443 | done | |
5444 |
|
5444 | |||
5445 | # :command.command_filter |
|
5445 | # :command.command_filter | |
5446 | action="stack-upgrade router" |
|
5446 | action="stack-upgrade router" | |
5447 |
|
5447 | |||
5448 | # :command.parse_requirements_while |
|
5448 | # :command.parse_requirements_while | |
5449 | while [[ $# -gt 0 ]]; do |
|
5449 | while [[ $# -gt 0 ]]; do | |
5450 | key="$1" |
|
5450 | key="$1" | |
5451 | case "$key" in |
|
5451 | case "$key" in | |
5452 |
|
5452 | |||
5453 | -?*) |
|
5453 | -?*) | |
5454 | printf "invalid option: %s\n" "$key" >&2 |
|
5454 | printf "invalid option: %s\n" "$key" >&2 | |
5455 | exit 1 |
|
5455 | exit 1 | |
5456 | ;; |
|
5456 | ;; | |
5457 |
|
5457 | |||
5458 | *) |
|
5458 | *) | |
5459 | # :command.parse_requirements_case |
|
5459 | # :command.parse_requirements_case | |
5460 | # :command.parse_requirements_case_simple |
|
5460 | # :command.parse_requirements_case_simple | |
5461 | printf "invalid argument: %s\n" "$key" >&2 |
|
5461 | printf "invalid argument: %s\n" "$key" >&2 | |
5462 | exit 1 |
|
5462 | exit 1 | |
5463 |
|
5463 | |||
5464 | ;; |
|
5464 | ;; | |
5465 |
|
5465 | |||
5466 | esac |
|
5466 | esac | |
5467 | done |
|
5467 | done | |
5468 |
|
5468 | |||
5469 | } |
|
5469 | } | |
5470 |
|
5470 | |||
5471 | # :command.parse_requirements |
|
5471 | # :command.parse_requirements | |
5472 | rcstack_stack_upgrade_services_parse_requirements() { |
|
5472 | rcstack_stack_upgrade_services_parse_requirements() { | |
5473 | # :command.fixed_flags_filter |
|
5473 | # :command.fixed_flags_filter | |
5474 | while [[ $# -gt 0 ]]; do |
|
5474 | while [[ $# -gt 0 ]]; do | |
5475 | case "${1:-}" in |
|
5475 | case "${1:-}" in | |
5476 | --help | -h) |
|
5476 | --help | -h) | |
5477 | long_usage=yes |
|
5477 | long_usage=yes | |
5478 | rcstack_stack_upgrade_services_usage |
|
5478 | rcstack_stack_upgrade_services_usage | |
5479 | exit |
|
5479 | exit | |
5480 | ;; |
|
5480 | ;; | |
5481 |
|
5481 | |||
5482 | *) |
|
5482 | *) | |
5483 | break |
|
5483 | break | |
5484 | ;; |
|
5484 | ;; | |
5485 |
|
5485 | |||
5486 | esac |
|
5486 | esac | |
5487 | done |
|
5487 | done | |
5488 |
|
5488 | |||
5489 | # :command.command_filter |
|
5489 | # :command.command_filter | |
5490 | action="stack-upgrade services" |
|
5490 | action="stack-upgrade services" | |
5491 |
|
5491 | |||
5492 | # :command.parse_requirements_while |
|
5492 | # :command.parse_requirements_while | |
5493 | while [[ $# -gt 0 ]]; do |
|
5493 | while [[ $# -gt 0 ]]; do | |
5494 | key="$1" |
|
5494 | key="$1" | |
5495 | case "$key" in |
|
5495 | case "$key" in | |
5496 |
|
5496 | |||
5497 | -?*) |
|
5497 | -?*) | |
5498 | printf "invalid option: %s\n" "$key" >&2 |
|
5498 | printf "invalid option: %s\n" "$key" >&2 | |
5499 | exit 1 |
|
5499 | exit 1 | |
5500 | ;; |
|
5500 | ;; | |
5501 |
|
5501 | |||
5502 | *) |
|
5502 | *) | |
5503 | # :command.parse_requirements_case |
|
5503 | # :command.parse_requirements_case | |
5504 | # :command.parse_requirements_case_simple |
|
5504 | # :command.parse_requirements_case_simple | |
5505 | printf "invalid argument: %s\n" "$key" >&2 |
|
5505 | printf "invalid argument: %s\n" "$key" >&2 | |
5506 | exit 1 |
|
5506 | exit 1 | |
5507 |
|
5507 | |||
5508 | ;; |
|
5508 | ;; | |
5509 |
|
5509 | |||
5510 | esac |
|
5510 | esac | |
5511 | done |
|
5511 | done | |
5512 |
|
5512 | |||
5513 | } |
|
5513 | } | |
5514 |
|
5514 | |||
5515 | # :command.parse_requirements |
|
5515 | # :command.parse_requirements | |
5516 | rcstack_stack_upgrade_metrics_parse_requirements() { |
|
5516 | rcstack_stack_upgrade_metrics_parse_requirements() { | |
5517 | # :command.fixed_flags_filter |
|
5517 | # :command.fixed_flags_filter | |
5518 | while [[ $# -gt 0 ]]; do |
|
5518 | while [[ $# -gt 0 ]]; do | |
5519 | case "${1:-}" in |
|
5519 | case "${1:-}" in | |
5520 | --help | -h) |
|
5520 | --help | -h) | |
5521 | long_usage=yes |
|
5521 | long_usage=yes | |
5522 | rcstack_stack_upgrade_metrics_usage |
|
5522 | rcstack_stack_upgrade_metrics_usage | |
5523 | exit |
|
5523 | exit | |
5524 | ;; |
|
5524 | ;; | |
5525 |
|
5525 | |||
5526 | *) |
|
5526 | *) | |
5527 | break |
|
5527 | break | |
5528 | ;; |
|
5528 | ;; | |
5529 |
|
5529 | |||
5530 | esac |
|
5530 | esac | |
5531 | done |
|
5531 | done | |
5532 |
|
5532 | |||
5533 | # :command.command_filter |
|
5533 | # :command.command_filter | |
5534 | action="stack-upgrade metrics" |
|
5534 | action="stack-upgrade metrics" | |
5535 |
|
5535 | |||
5536 | # :command.parse_requirements_while |
|
5536 | # :command.parse_requirements_while | |
5537 | while [[ $# -gt 0 ]]; do |
|
5537 | while [[ $# -gt 0 ]]; do | |
5538 | key="$1" |
|
5538 | key="$1" | |
5539 | case "$key" in |
|
5539 | case "$key" in | |
5540 |
|
5540 | |||
5541 | -?*) |
|
5541 | -?*) | |
5542 | printf "invalid option: %s\n" "$key" >&2 |
|
5542 | printf "invalid option: %s\n" "$key" >&2 | |
5543 | exit 1 |
|
5543 | exit 1 | |
5544 | ;; |
|
5544 | ;; | |
5545 |
|
5545 | |||
5546 | *) |
|
5546 | *) | |
5547 | # :command.parse_requirements_case |
|
5547 | # :command.parse_requirements_case | |
5548 | # :command.parse_requirements_case_simple |
|
5548 | # :command.parse_requirements_case_simple | |
5549 | printf "invalid argument: %s\n" "$key" >&2 |
|
5549 | printf "invalid argument: %s\n" "$key" >&2 | |
5550 | exit 1 |
|
5550 | exit 1 | |
5551 |
|
5551 | |||
5552 | ;; |
|
5552 | ;; | |
5553 |
|
5553 | |||
5554 | esac |
|
5554 | esac | |
5555 | done |
|
5555 | done | |
5556 |
|
5556 | |||
5557 | } |
|
5557 | } | |
5558 |
|
5558 | |||
5559 | # :command.parse_requirements |
|
5559 | # :command.parse_requirements | |
5560 | rcstack_stack_upgrade_rhodecode_parse_requirements() { |
|
5560 | rcstack_stack_upgrade_rhodecode_parse_requirements() { | |
5561 | # :command.fixed_flags_filter |
|
5561 | # :command.fixed_flags_filter | |
5562 | while [[ $# -gt 0 ]]; do |
|
5562 | while [[ $# -gt 0 ]]; do | |
5563 | case "${1:-}" in |
|
5563 | case "${1:-}" in | |
5564 | --help | -h) |
|
5564 | --help | -h) | |
5565 | long_usage=yes |
|
5565 | long_usage=yes | |
5566 | rcstack_stack_upgrade_rhodecode_usage |
|
5566 | rcstack_stack_upgrade_rhodecode_usage | |
5567 | exit |
|
5567 | exit | |
5568 | ;; |
|
5568 | ;; | |
5569 |
|
5569 | |||
5570 | *) |
|
5570 | *) | |
5571 | break |
|
5571 | break | |
5572 | ;; |
|
5572 | ;; | |
5573 |
|
5573 | |||
5574 | esac |
|
5574 | esac | |
5575 | done |
|
5575 | done | |
5576 |
|
5576 | |||
5577 | # :command.command_filter |
|
5577 | # :command.command_filter | |
5578 | action="stack-upgrade rhodecode" |
|
5578 | action="stack-upgrade rhodecode" | |
5579 |
|
5579 | |||
5580 | # :command.parse_requirements_while |
|
5580 | # :command.parse_requirements_while | |
5581 | while [[ $# -gt 0 ]]; do |
|
5581 | while [[ $# -gt 0 ]]; do | |
5582 | key="$1" |
|
5582 | key="$1" | |
5583 | case "$key" in |
|
5583 | case "$key" in | |
5584 | # :flag.case |
|
5584 | # :flag.case | |
5585 | --stop-wait) |
|
5585 | --stop-wait) | |
5586 |
|
5586 | |||
5587 | # :flag.case_arg |
|
5587 | # :flag.case_arg | |
5588 | if [[ -n ${2+x} ]]; then |
|
5588 | if [[ -n ${2+x} ]]; then | |
5589 |
|
5589 | |||
5590 | args['--stop-wait']="$2" |
|
5590 | args['--stop-wait']="$2" | |
5591 | shift |
|
5591 | shift | |
5592 | shift |
|
5592 | shift | |
5593 | else |
|
5593 | else | |
5594 | printf "%s\n" "--stop-wait requires an argument: --stop-wait STOP_WAIT" >&2 |
|
5594 | printf "%s\n" "--stop-wait requires an argument: --stop-wait STOP_WAIT" >&2 | |
5595 | exit 1 |
|
5595 | exit 1 | |
5596 | fi |
|
5596 | fi | |
5597 | ;; |
|
5597 | ;; | |
5598 |
|
5598 | |||
5599 | # :flag.case |
|
5599 | # :flag.case | |
5600 | --docker-stop-wait) |
|
5600 | --docker-stop-wait) | |
5601 |
|
5601 | |||
5602 | # :flag.case_arg |
|
5602 | # :flag.case_arg | |
5603 | if [[ -n ${2+x} ]]; then |
|
5603 | if [[ -n ${2+x} ]]; then | |
5604 |
|
5604 | |||
5605 | args['--docker-stop-wait']="$2" |
|
5605 | args['--docker-stop-wait']="$2" | |
5606 | shift |
|
5606 | shift | |
5607 | shift |
|
5607 | shift | |
5608 | else |
|
5608 | else | |
5609 | printf "%s\n" "--docker-stop-wait requires an argument: --docker-stop-wait DOCKER_STOP_WAIT" >&2 |
|
5609 | printf "%s\n" "--docker-stop-wait requires an argument: --docker-stop-wait DOCKER_STOP_WAIT" >&2 | |
5610 | exit 1 |
|
5610 | exit 1 | |
5611 | fi |
|
5611 | fi | |
5612 | ;; |
|
5612 | ;; | |
5613 |
|
5613 | |||
5614 | -?*) |
|
5614 | -?*) | |
5615 | printf "invalid option: %s\n" "$key" >&2 |
|
5615 | printf "invalid option: %s\n" "$key" >&2 | |
5616 | exit 1 |
|
5616 | exit 1 | |
5617 | ;; |
|
5617 | ;; | |
5618 |
|
5618 | |||
5619 | *) |
|
5619 | *) | |
5620 | # :command.parse_requirements_case |
|
5620 | # :command.parse_requirements_case | |
5621 | # :command.parse_requirements_case_simple |
|
5621 | # :command.parse_requirements_case_simple | |
5622 | printf "invalid argument: %s\n" "$key" >&2 |
|
5622 | printf "invalid argument: %s\n" "$key" >&2 | |
5623 | exit 1 |
|
5623 | exit 1 | |
5624 |
|
5624 | |||
5625 | ;; |
|
5625 | ;; | |
5626 |
|
5626 | |||
5627 | esac |
|
5627 | esac | |
5628 | done |
|
5628 | done | |
5629 |
|
5629 | |||
5630 | # :command.default_assignments |
|
5630 | # :command.default_assignments | |
5631 | [[ -n ${args['--stop-wait']:-} ]] || args['--stop-wait']="120" |
|
5631 | [[ -n ${args['--stop-wait']:-} ]] || args['--stop-wait']="120" | |
5632 | [[ -n ${args['--docker-stop-wait']:-} ]] || args['--docker-stop-wait']="3600" |
|
5632 | [[ -n ${args['--docker-stop-wait']:-} ]] || args['--docker-stop-wait']="3600" | |
5633 |
|
5633 | |||
5634 | } |
|
5634 | } | |
5635 |
|
5635 | |||
5636 | # :command.parse_requirements |
|
5636 | # :command.parse_requirements | |
5637 | rcstack_stack_monitor_parse_requirements() { |
|
5637 | rcstack_stack_monitor_parse_requirements() { | |
5638 | # :command.fixed_flags_filter |
|
5638 | # :command.fixed_flags_filter | |
5639 | while [[ $# -gt 0 ]]; do |
|
5639 | while [[ $# -gt 0 ]]; do | |
5640 | case "${1:-}" in |
|
5640 | case "${1:-}" in | |
5641 | --help | -h) |
|
5641 | --help | -h) | |
5642 | long_usage=yes |
|
5642 | long_usage=yes | |
5643 | rcstack_stack_monitor_usage |
|
5643 | rcstack_stack_monitor_usage | |
5644 | exit |
|
5644 | exit | |
5645 | ;; |
|
5645 | ;; | |
5646 |
|
5646 | |||
5647 | *) |
|
5647 | *) | |
5648 | break |
|
5648 | break | |
5649 | ;; |
|
5649 | ;; | |
5650 |
|
5650 | |||
5651 | esac |
|
5651 | esac | |
5652 | done |
|
5652 | done | |
5653 |
|
5653 | |||
5654 | # :command.command_filter |
|
5654 | # :command.command_filter | |
5655 | action=${1:-} |
|
5655 | action=${1:-} | |
5656 |
|
5656 | |||
5657 | case $action in |
|
5657 | case $action in | |
5658 | -*) ;; |
|
5658 | -*) ;; | |
5659 |
|
5659 | |||
5660 | restart-unhealthy) |
|
5660 | restart-unhealthy) | |
5661 | action="restart-unhealthy" |
|
5661 | action="restart-unhealthy" | |
5662 | shift |
|
5662 | shift | |
5663 | rcstack_stack_monitor_restart_unhealthy_parse_requirements "$@" |
|
5663 | rcstack_stack_monitor_restart_unhealthy_parse_requirements "$@" | |
5664 | shift $# |
|
5664 | shift $# | |
5665 | ;; |
|
5665 | ;; | |
5666 |
|
5666 | |||
5667 | # :command.command_fallback |
|
5667 | # :command.command_fallback | |
5668 | "") |
|
5668 | "") | |
5669 | rcstack_stack_monitor_usage >&2 |
|
5669 | rcstack_stack_monitor_usage >&2 | |
5670 | exit 1 |
|
5670 | exit 1 | |
5671 | ;; |
|
5671 | ;; | |
5672 |
|
5672 | |||
5673 | *) |
|
5673 | *) | |
5674 | printf "invalid command: %s\n" "$action" >&2 |
|
5674 | printf "invalid command: %s\n" "$action" >&2 | |
5675 | exit 1 |
|
5675 | exit 1 | |
5676 | ;; |
|
5676 | ;; | |
5677 |
|
5677 | |||
5678 | esac |
|
5678 | esac | |
5679 |
|
5679 | |||
5680 | # :command.parse_requirements_while |
|
5680 | # :command.parse_requirements_while | |
5681 | while [[ $# -gt 0 ]]; do |
|
5681 | while [[ $# -gt 0 ]]; do | |
5682 | key="$1" |
|
5682 | key="$1" | |
5683 | case "$key" in |
|
5683 | case "$key" in | |
5684 |
|
5684 | |||
5685 | -?*) |
|
5685 | -?*) | |
5686 | printf "invalid option: %s\n" "$key" >&2 |
|
5686 | printf "invalid option: %s\n" "$key" >&2 | |
5687 | exit 1 |
|
5687 | exit 1 | |
5688 | ;; |
|
5688 | ;; | |
5689 |
|
5689 | |||
5690 | *) |
|
5690 | *) | |
5691 | # :command.parse_requirements_case |
|
5691 | # :command.parse_requirements_case | |
5692 | # :command.parse_requirements_case_simple |
|
5692 | # :command.parse_requirements_case_simple | |
5693 | printf "invalid argument: %s\n" "$key" >&2 |
|
5693 | printf "invalid argument: %s\n" "$key" >&2 | |
5694 | exit 1 |
|
5694 | exit 1 | |
5695 |
|
5695 | |||
5696 | ;; |
|
5696 | ;; | |
5697 |
|
5697 | |||
5698 | esac |
|
5698 | esac | |
5699 | done |
|
5699 | done | |
5700 |
|
5700 | |||
5701 | } |
|
5701 | } | |
5702 |
|
5702 | |||
5703 | # :command.parse_requirements |
|
5703 | # :command.parse_requirements | |
5704 | rcstack_stack_monitor_restart_unhealthy_parse_requirements() { |
|
5704 | rcstack_stack_monitor_restart_unhealthy_parse_requirements() { | |
5705 | # :command.fixed_flags_filter |
|
5705 | # :command.fixed_flags_filter | |
5706 | while [[ $# -gt 0 ]]; do |
|
5706 | while [[ $# -gt 0 ]]; do | |
5707 | case "${1:-}" in |
|
5707 | case "${1:-}" in | |
5708 | --help | -h) |
|
5708 | --help | -h) | |
5709 | long_usage=yes |
|
5709 | long_usage=yes | |
5710 | rcstack_stack_monitor_restart_unhealthy_usage |
|
5710 | rcstack_stack_monitor_restart_unhealthy_usage | |
5711 | exit |
|
5711 | exit | |
5712 | ;; |
|
5712 | ;; | |
5713 |
|
5713 | |||
5714 | *) |
|
5714 | *) | |
5715 | break |
|
5715 | break | |
5716 | ;; |
|
5716 | ;; | |
5717 |
|
5717 | |||
5718 | esac |
|
5718 | esac | |
5719 | done |
|
5719 | done | |
5720 |
|
5720 | |||
5721 | # :command.command_filter |
|
5721 | # :command.command_filter | |
5722 | action="stack-monitor restart-unhealthy" |
|
5722 | action="stack-monitor restart-unhealthy" | |
5723 |
|
5723 | |||
5724 | # :command.parse_requirements_while |
|
5724 | # :command.parse_requirements_while | |
5725 | while [[ $# -gt 0 ]]; do |
|
5725 | while [[ $# -gt 0 ]]; do | |
5726 | key="$1" |
|
5726 | key="$1" | |
5727 | case "$key" in |
|
5727 | case "$key" in | |
5728 | # :flag.case |
|
5728 | # :flag.case | |
5729 | --loop) |
|
5729 | --loop) | |
5730 |
|
5730 | |||
5731 | # :flag.case_arg |
|
5731 | # :flag.case_arg | |
5732 | if [[ -n ${2+x} ]]; then |
|
5732 | if [[ -n ${2+x} ]]; then | |
5733 | # :flag.validations |
|
5733 | # :flag.validations | |
5734 | if [[ -n $(validate_integer "$2") ]]; then |
|
5734 | if [[ -n $(validate_integer "$2") ]]; then | |
5735 | printf "validation error in %s:\n%s\n" "--loop LOOP" "$(validate_integer "$2")" >&2 |
|
5735 | printf "validation error in %s:\n%s\n" "--loop LOOP" "$(validate_integer "$2")" >&2 | |
5736 | exit 1 |
|
5736 | exit 1 | |
5737 | fi |
|
5737 | fi | |
5738 |
|
5738 | |||
5739 | args['--loop']="$2" |
|
5739 | args['--loop']="$2" | |
5740 | shift |
|
5740 | shift | |
5741 | shift |
|
5741 | shift | |
5742 | else |
|
5742 | else | |
5743 | printf "%s\n" "--loop requires an argument: --loop LOOP" >&2 |
|
5743 | printf "%s\n" "--loop requires an argument: --loop LOOP" >&2 | |
5744 | exit 1 |
|
5744 | exit 1 | |
5745 | fi |
|
5745 | fi | |
5746 | ;; |
|
5746 | ;; | |
5747 |
|
5747 | |||
5748 | -?*) |
|
5748 | -?*) | |
5749 | printf "invalid option: %s\n" "$key" >&2 |
|
5749 | printf "invalid option: %s\n" "$key" >&2 | |
5750 | exit 1 |
|
5750 | exit 1 | |
5751 | ;; |
|
5751 | ;; | |
5752 |
|
5752 | |||
5753 | *) |
|
5753 | *) | |
5754 | # :command.parse_requirements_case |
|
5754 | # :command.parse_requirements_case | |
5755 | # :command.parse_requirements_case_simple |
|
5755 | # :command.parse_requirements_case_simple | |
5756 | printf "invalid argument: %s\n" "$key" >&2 |
|
5756 | printf "invalid argument: %s\n" "$key" >&2 | |
5757 | exit 1 |
|
5757 | exit 1 | |
5758 |
|
5758 | |||
5759 | ;; |
|
5759 | ;; | |
5760 |
|
5760 | |||
5761 | esac |
|
5761 | esac | |
5762 | done |
|
5762 | done | |
5763 |
|
5763 | |||
5764 | # :command.default_assignments |
|
5764 | # :command.default_assignments | |
5765 | [[ -n ${args['--loop']:-} ]] || args['--loop']="0" |
|
5765 | [[ -n ${args['--loop']:-} ]] || args['--loop']="0" | |
5766 |
|
5766 | |||
5767 | } |
|
5767 | } | |
5768 |
|
5768 | |||
5769 | # :command.parse_requirements |
|
5769 | # :command.parse_requirements | |
5770 | rcstack_cli_parse_requirements() { |
|
5770 | rcstack_cli_parse_requirements() { | |
5771 | # :command.fixed_flags_filter |
|
5771 | # :command.fixed_flags_filter | |
5772 | while [[ $# -gt 0 ]]; do |
|
5772 | while [[ $# -gt 0 ]]; do | |
5773 | case "${1:-}" in |
|
5773 | case "${1:-}" in | |
5774 | --help | -h) |
|
5774 | --help | -h) | |
5775 | long_usage=yes |
|
5775 | long_usage=yes | |
5776 | rcstack_cli_usage |
|
5776 | rcstack_cli_usage | |
5777 | exit |
|
5777 | exit | |
5778 | ;; |
|
5778 | ;; | |
5779 |
|
5779 | |||
5780 | *) |
|
5780 | *) | |
5781 | break |
|
5781 | break | |
5782 | ;; |
|
5782 | ;; | |
5783 |
|
5783 | |||
5784 | esac |
|
5784 | esac | |
5785 | done |
|
5785 | done | |
5786 |
|
5786 | |||
5787 | # :command.command_filter |
|
5787 | # :command.command_filter | |
5788 | action=${1:-} |
|
5788 | action=${1:-} | |
5789 |
|
5789 | |||
5790 | case $action in |
|
5790 | case $action in | |
5791 | -*) ;; |
|
5791 | -*) ;; | |
5792 |
|
5792 | |||
5793 | cmd) |
|
5793 | cmd) | |
5794 | action="cmd" |
|
5794 | action="cmd" | |
5795 | shift |
|
5795 | shift | |
5796 | rcstack_cli_cmd_parse_requirements "$@" |
|
5796 | rcstack_cli_cmd_parse_requirements "$@" | |
5797 | shift $# |
|
5797 | shift $# | |
5798 | ;; |
|
5798 | ;; | |
5799 |
|
5799 | |||
5800 | ishell) |
|
5800 | ishell) | |
5801 | action="ishell" |
|
5801 | action="ishell" | |
5802 | shift |
|
5802 | shift | |
5803 | rcstack_cli_ishell_parse_requirements "$@" |
|
5803 | rcstack_cli_ishell_parse_requirements "$@" | |
5804 | shift $# |
|
5804 | shift $# | |
5805 | ;; |
|
5805 | ;; | |
5806 |
|
5806 | |||
5807 | image-info) |
|
5807 | image-info) | |
5808 | action="image-info" |
|
5808 | action="image-info" | |
5809 | shift |
|
5809 | shift | |
5810 | rcstack_cli_image_info_parse_requirements "$@" |
|
5810 | rcstack_cli_image_info_parse_requirements "$@" | |
5811 | shift $# |
|
5811 | shift $# | |
5812 | ;; |
|
5812 | ;; | |
5813 |
|
5813 | |||
5814 | set-runtime-image) |
|
5814 | set-runtime-image) | |
5815 | action="set-runtime-image" |
|
5815 | action="set-runtime-image" | |
5816 | shift |
|
5816 | shift | |
5817 | rcstack_cli_set_runtime_image_parse_requirements "$@" |
|
5817 | rcstack_cli_set_runtime_image_parse_requirements "$@" | |
5818 | shift $# |
|
5818 | shift $# | |
5819 | ;; |
|
5819 | ;; | |
5820 |
|
5820 | |||
5821 | docker-info) |
|
5821 | docker-info) | |
5822 | action="docker-info" |
|
5822 | action="docker-info" | |
5823 | shift |
|
5823 | shift | |
5824 | rcstack_cli_docker_info_parse_requirements "$@" |
|
5824 | rcstack_cli_docker_info_parse_requirements "$@" | |
5825 | shift $# |
|
5825 | shift $# | |
5826 | ;; |
|
5826 | ;; | |
5827 |
|
5827 | |||
5828 | docker-upgrade) |
|
5828 | docker-upgrade) | |
5829 | action="docker-upgrade" |
|
5829 | action="docker-upgrade" | |
5830 | shift |
|
5830 | shift | |
5831 | rcstack_cli_docker_upgrade_parse_requirements "$@" |
|
5831 | rcstack_cli_docker_upgrade_parse_requirements "$@" | |
5832 | shift $# |
|
5832 | shift $# | |
5833 | ;; |
|
5833 | ;; | |
5834 |
|
5834 | |||
5835 | redis) |
|
5835 | redis) | |
5836 | action="redis" |
|
5836 | action="redis" | |
5837 | shift |
|
5837 | shift | |
5838 | rcstack_cli_redis_parse_requirements "$@" |
|
5838 | rcstack_cli_redis_parse_requirements "$@" | |
5839 | shift $# |
|
5839 | shift $# | |
5840 | ;; |
|
5840 | ;; | |
5841 |
|
5841 | |||
5842 | db) |
|
5842 | db) | |
5843 | action="db" |
|
5843 | action="db" | |
5844 | shift |
|
5844 | shift | |
5845 | rcstack_cli_db_parse_requirements "$@" |
|
5845 | rcstack_cli_db_parse_requirements "$@" | |
5846 | shift $# |
|
5846 | shift $# | |
5847 | ;; |
|
5847 | ;; | |
5848 |
|
5848 | |||
5849 | db-upgrade) |
|
5849 | db-upgrade) | |
5850 | action="db-upgrade" |
|
5850 | action="db-upgrade" | |
5851 | shift |
|
5851 | shift | |
5852 | rcstack_cli_db_upgrade_parse_requirements "$@" |
|
5852 | rcstack_cli_db_upgrade_parse_requirements "$@" | |
5853 | shift $# |
|
5853 | shift $# | |
5854 | ;; |
|
5854 | ;; | |
5855 |
|
5855 | |||
5856 | storage) |
|
5856 | storage) | |
5857 | action="storage" |
|
5857 | action="storage" | |
5858 | shift |
|
5858 | shift | |
5859 | rcstack_cli_storage_parse_requirements "$@" |
|
5859 | rcstack_cli_storage_parse_requirements "$@" | |
5860 | shift $# |
|
5860 | shift $# | |
5861 | ;; |
|
5861 | ;; | |
5862 |
|
5862 | |||
5863 | attach) |
|
5863 | attach) | |
5864 | action="attach" |
|
5864 | action="attach" | |
5865 | shift |
|
5865 | shift | |
5866 | rcstack_cli_attach_parse_requirements "$@" |
|
5866 | rcstack_cli_attach_parse_requirements "$@" | |
5867 | shift $# |
|
5867 | shift $# | |
5868 | ;; |
|
5868 | ;; | |
5869 |
|
5869 | |||
5870 | set-edition) |
|
5870 | set-edition) | |
5871 | action="set-edition" |
|
5871 | action="set-edition" | |
5872 | shift |
|
5872 | shift | |
5873 | rcstack_cli_set_edition_parse_requirements "$@" |
|
5873 | rcstack_cli_set_edition_parse_requirements "$@" | |
5874 | shift $# |
|
5874 | shift $# | |
5875 | ;; |
|
5875 | ;; | |
5876 |
|
5876 | |||
5877 | configure-vcsserver) |
|
5877 | configure-vcsserver) | |
5878 | action="configure-vcsserver" |
|
5878 | action="configure-vcsserver" | |
5879 | shift |
|
5879 | shift | |
5880 | rcstack_cli_configure_vcsserver_parse_requirements "$@" |
|
5880 | rcstack_cli_configure_vcsserver_parse_requirements "$@" | |
5881 | shift $# |
|
5881 | shift $# | |
5882 | ;; |
|
5882 | ;; | |
5883 |
|
5883 | |||
5884 | configure-rhodecode) |
|
5884 | configure-rhodecode) | |
5885 | action="configure-rhodecode" |
|
5885 | action="configure-rhodecode" | |
5886 | shift |
|
5886 | shift | |
5887 | rcstack_cli_configure_rhodecode_parse_requirements "$@" |
|
5887 | rcstack_cli_configure_rhodecode_parse_requirements "$@" | |
5888 | shift $# |
|
5888 | shift $# | |
5889 | ;; |
|
5889 | ;; | |
5890 |
|
5890 | |||
5891 | # :command.command_fallback |
|
5891 | # :command.command_fallback | |
5892 | "") |
|
5892 | "") | |
5893 | rcstack_cli_usage >&2 |
|
5893 | rcstack_cli_usage >&2 | |
5894 | exit 1 |
|
5894 | exit 1 | |
5895 | ;; |
|
5895 | ;; | |
5896 |
|
5896 | |||
5897 | *) |
|
5897 | *) | |
5898 | printf "invalid command: %s\n" "$action" >&2 |
|
5898 | printf "invalid command: %s\n" "$action" >&2 | |
5899 | exit 1 |
|
5899 | exit 1 | |
5900 | ;; |
|
5900 | ;; | |
5901 |
|
5901 | |||
5902 | esac |
|
5902 | esac | |
5903 |
|
5903 | |||
5904 | # :command.parse_requirements_while |
|
5904 | # :command.parse_requirements_while | |
5905 | while [[ $# -gt 0 ]]; do |
|
5905 | while [[ $# -gt 0 ]]; do | |
5906 | key="$1" |
|
5906 | key="$1" | |
5907 | case "$key" in |
|
5907 | case "$key" in | |
5908 |
|
5908 | |||
5909 | -?*) |
|
5909 | -?*) | |
5910 | printf "invalid option: %s\n" "$key" >&2 |
|
5910 | printf "invalid option: %s\n" "$key" >&2 | |
5911 | exit 1 |
|
5911 | exit 1 | |
5912 | ;; |
|
5912 | ;; | |
5913 |
|
5913 | |||
5914 | *) |
|
5914 | *) | |
5915 | # :command.parse_requirements_case |
|
5915 | # :command.parse_requirements_case | |
5916 | # :command.parse_requirements_case_simple |
|
5916 | # :command.parse_requirements_case_simple | |
5917 | printf "invalid argument: %s\n" "$key" >&2 |
|
5917 | printf "invalid argument: %s\n" "$key" >&2 | |
5918 | exit 1 |
|
5918 | exit 1 | |
5919 |
|
5919 | |||
5920 | ;; |
|
5920 | ;; | |
5921 |
|
5921 | |||
5922 | esac |
|
5922 | esac | |
5923 | done |
|
5923 | done | |
5924 |
|
5924 | |||
5925 | } |
|
5925 | } | |
5926 |
|
5926 | |||
5927 | # :command.parse_requirements |
|
5927 | # :command.parse_requirements | |
5928 | rcstack_cli_cmd_parse_requirements() { |
|
5928 | rcstack_cli_cmd_parse_requirements() { | |
5929 | # :command.fixed_flags_filter |
|
5929 | # :command.fixed_flags_filter | |
5930 | while [[ $# -gt 0 ]]; do |
|
5930 | while [[ $# -gt 0 ]]; do | |
5931 | case "${1:-}" in |
|
5931 | case "${1:-}" in | |
5932 | --help | -h) |
|
5932 | --help | -h) | |
5933 | long_usage=yes |
|
5933 | long_usage=yes | |
5934 | rcstack_cli_cmd_usage |
|
5934 | rcstack_cli_cmd_usage | |
5935 | exit |
|
5935 | exit | |
5936 | ;; |
|
5936 | ;; | |
5937 |
|
5937 | |||
5938 | *) |
|
5938 | *) | |
5939 | break |
|
5939 | break | |
5940 | ;; |
|
5940 | ;; | |
5941 |
|
5941 | |||
5942 | esac |
|
5942 | esac | |
5943 | done |
|
5943 | done | |
5944 |
|
5944 | |||
5945 | # :command.command_filter |
|
5945 | # :command.command_filter | |
5946 | action="cli cmd" |
|
5946 | action="cli cmd" | |
5947 |
|
5947 | |||
5948 | # :command.parse_requirements_while |
|
5948 | # :command.parse_requirements_while | |
5949 | while [[ $# -gt 0 ]]; do |
|
5949 | while [[ $# -gt 0 ]]; do | |
5950 | key="$1" |
|
5950 | key="$1" | |
5951 | case "$key" in |
|
5951 | case "$key" in | |
5952 | # :flag.case |
|
5952 | # :flag.case | |
5953 | --no-tty) |
|
5953 | --no-tty) | |
5954 |
|
5954 | |||
5955 | # :flag.case_no_arg |
|
5955 | # :flag.case_no_arg | |
5956 | args['--no-tty']=1 |
|
5956 | args['--no-tty']=1 | |
5957 | shift |
|
5957 | shift | |
5958 | ;; |
|
5958 | ;; | |
5959 |
|
5959 | |||
5960 | # :flag.case |
|
5960 | # :flag.case | |
5961 | --user) |
|
5961 | --user) | |
5962 |
|
5962 | |||
5963 | # :flag.case_no_arg |
|
5963 | # :flag.case_no_arg | |
5964 | args['--user']=1 |
|
5964 | args['--user']=1 | |
5965 | shift |
|
5965 | shift | |
5966 | ;; |
|
5966 | ;; | |
5967 |
|
5967 | |||
5968 | # :flag.case |
|
5968 | # :flag.case | |
5969 | --env-file-path) |
|
5969 | --env-file-path) | |
5970 |
|
5970 | |||
5971 | # :flag.case_arg |
|
5971 | # :flag.case_arg | |
5972 | if [[ -n ${2+x} ]]; then |
|
5972 | if [[ -n ${2+x} ]]; then | |
5973 | # :flag.validations |
|
5973 | # :flag.validations | |
5974 | if [[ -n $(validate_file_exists "$2") ]]; then |
|
5974 | if [[ -n $(validate_file_exists "$2") ]]; then | |
5975 | printf "validation error in %s:\n%s\n" "--env-file-path ENV_FILE_PATH" "$(validate_file_exists "$2")" >&2 |
|
5975 | printf "validation error in %s:\n%s\n" "--env-file-path ENV_FILE_PATH" "$(validate_file_exists "$2")" >&2 | |
5976 | exit 1 |
|
5976 | exit 1 | |
5977 | fi |
|
5977 | fi | |
5978 |
|
5978 | |||
5979 | args['--env-file-path']="$2" |
|
5979 | args['--env-file-path']="$2" | |
5980 | shift |
|
5980 | shift | |
5981 | shift |
|
5981 | shift | |
5982 | else |
|
5982 | else | |
5983 | printf "%s\n" "--env-file-path requires an argument: --env-file-path ENV_FILE_PATH" >&2 |
|
5983 | printf "%s\n" "--env-file-path requires an argument: --env-file-path ENV_FILE_PATH" >&2 | |
5984 | exit 1 |
|
5984 | exit 1 | |
5985 | fi |
|
5985 | fi | |
5986 | ;; |
|
5986 | ;; | |
5987 |
|
5987 | |||
5988 | --) |
|
5988 | --) | |
5989 | shift |
|
5989 | shift | |
5990 | other_args+=("$@") |
|
5990 | other_args+=("$@") | |
5991 | break |
|
5991 | break | |
5992 | ;; |
|
5992 | ;; | |
5993 |
|
5993 | |||
5994 | -?*) |
|
5994 | -?*) | |
5995 | other_args+=("$1") |
|
5995 | other_args+=("$1") | |
5996 | shift |
|
5996 | shift | |
5997 | ;; |
|
5997 | ;; | |
5998 |
|
5998 | |||
5999 | *) |
|
5999 | *) | |
6000 | # :command.parse_requirements_case |
|
6000 | # :command.parse_requirements_case | |
6001 | # :command.parse_requirements_case_catch_all |
|
6001 | # :command.parse_requirements_case_catch_all | |
6002 | other_args+=("$1") |
|
6002 | other_args+=("$1") | |
6003 | shift |
|
6003 | shift | |
6004 |
|
6004 | |||
6005 | ;; |
|
6005 | ;; | |
6006 |
|
6006 | |||
6007 | esac |
|
6007 | esac | |
6008 | done |
|
6008 | done | |
6009 |
|
6009 | |||
6010 | # :command.default_assignments |
|
6010 | # :command.default_assignments | |
6011 | [[ -n ${args['--env-file-path']:-} ]] || args['--env-file-path']="$PWD/.custom/.runtime.env" |
|
6011 | [[ -n ${args['--env-file-path']:-} ]] || args['--env-file-path']="$PWD/.custom/.runtime.env" | |
6012 |
|
6012 | |||
6013 | } |
|
6013 | } | |
6014 |
|
6014 | |||
6015 | # :command.parse_requirements |
|
6015 | # :command.parse_requirements | |
6016 | rcstack_cli_ishell_parse_requirements() { |
|
6016 | rcstack_cli_ishell_parse_requirements() { | |
6017 | # :command.fixed_flags_filter |
|
6017 | # :command.fixed_flags_filter | |
6018 | while [[ $# -gt 0 ]]; do |
|
6018 | while [[ $# -gt 0 ]]; do | |
6019 | case "${1:-}" in |
|
6019 | case "${1:-}" in | |
6020 | --help | -h) |
|
6020 | --help | -h) | |
6021 | long_usage=yes |
|
6021 | long_usage=yes | |
6022 | rcstack_cli_ishell_usage |
|
6022 | rcstack_cli_ishell_usage | |
6023 | exit |
|
6023 | exit | |
6024 | ;; |
|
6024 | ;; | |
6025 |
|
6025 | |||
6026 | *) |
|
6026 | *) | |
6027 | break |
|
6027 | break | |
6028 | ;; |
|
6028 | ;; | |
6029 |
|
6029 | |||
6030 | esac |
|
6030 | esac | |
6031 | done |
|
6031 | done | |
6032 |
|
6032 | |||
6033 | # :command.command_filter |
|
6033 | # :command.command_filter | |
6034 | action="cli ishell" |
|
6034 | action="cli ishell" | |
6035 |
|
6035 | |||
6036 | # :command.parse_requirements_while |
|
6036 | # :command.parse_requirements_while | |
6037 | while [[ $# -gt 0 ]]; do |
|
6037 | while [[ $# -gt 0 ]]; do | |
6038 | key="$1" |
|
6038 | key="$1" | |
6039 | case "$key" in |
|
6039 | case "$key" in | |
6040 | # :flag.case |
|
6040 | # :flag.case | |
6041 | --no-tty) |
|
6041 | --no-tty) | |
6042 |
|
6042 | |||
6043 | # :flag.case_no_arg |
|
6043 | # :flag.case_no_arg | |
6044 | args['--no-tty']=1 |
|
6044 | args['--no-tty']=1 | |
6045 | shift |
|
6045 | shift | |
6046 | ;; |
|
6046 | ;; | |
6047 |
|
6047 | |||
6048 | # :flag.case |
|
6048 | # :flag.case | |
6049 | --user) |
|
6049 | --user) | |
6050 |
|
6050 | |||
6051 | # :flag.case_no_arg |
|
6051 | # :flag.case_no_arg | |
6052 | args['--user']=1 |
|
6052 | args['--user']=1 | |
6053 | shift |
|
6053 | shift | |
6054 | ;; |
|
6054 | ;; | |
6055 |
|
6055 | |||
6056 | # :flag.case |
|
6056 | # :flag.case | |
6057 | --env-file-path) |
|
6057 | --env-file-path) | |
6058 |
|
6058 | |||
6059 | # :flag.case_arg |
|
6059 | # :flag.case_arg | |
6060 | if [[ -n ${2+x} ]]; then |
|
6060 | if [[ -n ${2+x} ]]; then | |
6061 | # :flag.validations |
|
6061 | # :flag.validations | |
6062 | if [[ -n $(validate_file_exists "$2") ]]; then |
|
6062 | if [[ -n $(validate_file_exists "$2") ]]; then | |
6063 | printf "validation error in %s:\n%s\n" "--env-file-path ENV_FILE_PATH" "$(validate_file_exists "$2")" >&2 |
|
6063 | printf "validation error in %s:\n%s\n" "--env-file-path ENV_FILE_PATH" "$(validate_file_exists "$2")" >&2 | |
6064 | exit 1 |
|
6064 | exit 1 | |
6065 | fi |
|
6065 | fi | |
6066 |
|
6066 | |||
6067 | args['--env-file-path']="$2" |
|
6067 | args['--env-file-path']="$2" | |
6068 | shift |
|
6068 | shift | |
6069 | shift |
|
6069 | shift | |
6070 | else |
|
6070 | else | |
6071 | printf "%s\n" "--env-file-path requires an argument: --env-file-path ENV_FILE_PATH" >&2 |
|
6071 | printf "%s\n" "--env-file-path requires an argument: --env-file-path ENV_FILE_PATH" >&2 | |
6072 | exit 1 |
|
6072 | exit 1 | |
6073 | fi |
|
6073 | fi | |
6074 | ;; |
|
6074 | ;; | |
6075 |
|
6075 | |||
6076 | -?*) |
|
6076 | -?*) | |
6077 | printf "invalid option: %s\n" "$key" >&2 |
|
6077 | printf "invalid option: %s\n" "$key" >&2 | |
6078 | exit 1 |
|
6078 | exit 1 | |
6079 | ;; |
|
6079 | ;; | |
6080 |
|
6080 | |||
6081 | *) |
|
6081 | *) | |
6082 | # :command.parse_requirements_case |
|
6082 | # :command.parse_requirements_case | |
6083 | # :command.parse_requirements_case_simple |
|
6083 | # :command.parse_requirements_case_simple | |
6084 | printf "invalid argument: %s\n" "$key" >&2 |
|
6084 | printf "invalid argument: %s\n" "$key" >&2 | |
6085 | exit 1 |
|
6085 | exit 1 | |
6086 |
|
6086 | |||
6087 | ;; |
|
6087 | ;; | |
6088 |
|
6088 | |||
6089 | esac |
|
6089 | esac | |
6090 | done |
|
6090 | done | |
6091 |
|
6091 | |||
6092 | # :command.default_assignments |
|
6092 | # :command.default_assignments | |
6093 | [[ -n ${args['--env-file-path']:-} ]] || args['--env-file-path']="$PWD/.custom/.runtime.env" |
|
6093 | [[ -n ${args['--env-file-path']:-} ]] || args['--env-file-path']="$PWD/.custom/.runtime.env" | |
6094 |
|
6094 | |||
6095 | } |
|
6095 | } | |
6096 |
|
6096 | |||
6097 | # :command.parse_requirements |
|
6097 | # :command.parse_requirements | |
6098 | rcstack_cli_image_info_parse_requirements() { |
|
6098 | rcstack_cli_image_info_parse_requirements() { | |
6099 | # :command.fixed_flags_filter |
|
6099 | # :command.fixed_flags_filter | |
6100 | while [[ $# -gt 0 ]]; do |
|
6100 | while [[ $# -gt 0 ]]; do | |
6101 | case "${1:-}" in |
|
6101 | case "${1:-}" in | |
6102 | --help | -h) |
|
6102 | --help | -h) | |
6103 | long_usage=yes |
|
6103 | long_usage=yes | |
6104 | rcstack_cli_image_info_usage |
|
6104 | rcstack_cli_image_info_usage | |
6105 | exit |
|
6105 | exit | |
6106 | ;; |
|
6106 | ;; | |
6107 |
|
6107 | |||
6108 | *) |
|
6108 | *) | |
6109 | break |
|
6109 | break | |
6110 | ;; |
|
6110 | ;; | |
6111 |
|
6111 | |||
6112 | esac |
|
6112 | esac | |
6113 | done |
|
6113 | done | |
6114 |
|
6114 | |||
6115 | # :command.command_filter |
|
6115 | # :command.command_filter | |
6116 | action="cli image-info" |
|
6116 | action="cli image-info" | |
6117 |
|
6117 | |||
6118 | # :command.parse_requirements_while |
|
6118 | # :command.parse_requirements_while | |
6119 | while [[ $# -gt 0 ]]; do |
|
6119 | while [[ $# -gt 0 ]]; do | |
6120 | key="$1" |
|
6120 | key="$1" | |
6121 | case "$key" in |
|
6121 | case "$key" in | |
6122 | # :flag.case |
|
6122 | # :flag.case | |
6123 | --verbose) |
|
6123 | --verbose) | |
6124 |
|
6124 | |||
6125 | # :flag.case_no_arg |
|
6125 | # :flag.case_no_arg | |
6126 | args['--verbose']=1 |
|
6126 | args['--verbose']=1 | |
6127 | shift |
|
6127 | shift | |
6128 | ;; |
|
6128 | ;; | |
6129 |
|
6129 | |||
6130 | -?*) |
|
6130 | -?*) | |
6131 | printf "invalid option: %s\n" "$key" >&2 |
|
6131 | printf "invalid option: %s\n" "$key" >&2 | |
6132 | exit 1 |
|
6132 | exit 1 | |
6133 | ;; |
|
6133 | ;; | |
6134 |
|
6134 | |||
6135 | *) |
|
6135 | *) | |
6136 | # :command.parse_requirements_case |
|
6136 | # :command.parse_requirements_case | |
6137 | # :command.parse_requirements_case_simple |
|
6137 | # :command.parse_requirements_case_simple | |
6138 | printf "invalid argument: %s\n" "$key" >&2 |
|
6138 | printf "invalid argument: %s\n" "$key" >&2 | |
6139 | exit 1 |
|
6139 | exit 1 | |
6140 |
|
6140 | |||
6141 | ;; |
|
6141 | ;; | |
6142 |
|
6142 | |||
6143 | esac |
|
6143 | esac | |
6144 | done |
|
6144 | done | |
6145 |
|
6145 | |||
6146 | } |
|
6146 | } | |
6147 |
|
6147 | |||
6148 | # :command.parse_requirements |
|
6148 | # :command.parse_requirements | |
6149 | rcstack_cli_set_runtime_image_parse_requirements() { |
|
6149 | rcstack_cli_set_runtime_image_parse_requirements() { | |
6150 | # :command.fixed_flags_filter |
|
6150 | # :command.fixed_flags_filter | |
6151 | while [[ $# -gt 0 ]]; do |
|
6151 | while [[ $# -gt 0 ]]; do | |
6152 | case "${1:-}" in |
|
6152 | case "${1:-}" in | |
6153 | --help | -h) |
|
6153 | --help | -h) | |
6154 | long_usage=yes |
|
6154 | long_usage=yes | |
6155 | rcstack_cli_set_runtime_image_usage |
|
6155 | rcstack_cli_set_runtime_image_usage | |
6156 | exit |
|
6156 | exit | |
6157 | ;; |
|
6157 | ;; | |
6158 |
|
6158 | |||
6159 | *) |
|
6159 | *) | |
6160 | break |
|
6160 | break | |
6161 | ;; |
|
6161 | ;; | |
6162 |
|
6162 | |||
6163 | esac |
|
6163 | esac | |
6164 | done |
|
6164 | done | |
6165 |
|
6165 | |||
6166 | # :command.command_filter |
|
6166 | # :command.command_filter | |
6167 | action="cli set-runtime-image" |
|
6167 | action="cli set-runtime-image" | |
6168 |
|
6168 | |||
6169 | # :command.parse_requirements_while |
|
6169 | # :command.parse_requirements_while | |
6170 | while [[ $# -gt 0 ]]; do |
|
6170 | while [[ $# -gt 0 ]]; do | |
6171 | key="$1" |
|
6171 | key="$1" | |
6172 | case "$key" in |
|
6172 | case "$key" in | |
6173 |
|
6173 | |||
6174 | -?*) |
|
6174 | -?*) | |
6175 | printf "invalid option: %s\n" "$key" >&2 |
|
6175 | printf "invalid option: %s\n" "$key" >&2 | |
6176 | exit 1 |
|
6176 | exit 1 | |
6177 | ;; |
|
6177 | ;; | |
6178 |
|
6178 | |||
6179 | *) |
|
6179 | *) | |
6180 | # :command.parse_requirements_case |
|
6180 | # :command.parse_requirements_case | |
6181 | # :command.parse_requirements_case_simple |
|
6181 | # :command.parse_requirements_case_simple | |
6182 | if [[ -z ${args['version']+x} ]]; then |
|
6182 | if [[ -z ${args['version']+x} ]]; then | |
6183 |
|
6183 | |||
6184 | args['version']=$1 |
|
6184 | args['version']=$1 | |
6185 | shift |
|
6185 | shift | |
6186 | else |
|
6186 | else | |
6187 | printf "invalid argument: %s\n" "$key" >&2 |
|
6187 | printf "invalid argument: %s\n" "$key" >&2 | |
6188 | exit 1 |
|
6188 | exit 1 | |
6189 | fi |
|
6189 | fi | |
6190 |
|
6190 | |||
6191 | ;; |
|
6191 | ;; | |
6192 |
|
6192 | |||
6193 | esac |
|
6193 | esac | |
6194 | done |
|
6194 | done | |
6195 |
|
6195 | |||
6196 | # :command.required_args_filter |
|
6196 | # :command.required_args_filter | |
6197 | if [[ -z ${args['version']+x} ]]; then |
|
6197 | if [[ -z ${args['version']+x} ]]; then | |
6198 | printf "missing required argument: VERSION\nusage: rcstack cli set-runtime-image VERSION\n" >&2 |
|
6198 | printf "missing required argument: VERSION\nusage: rcstack cli set-runtime-image VERSION\n" >&2 | |
6199 | exit 1 |
|
6199 | exit 1 | |
6200 | fi |
|
6200 | fi | |
6201 |
|
6201 | |||
6202 | } |
|
6202 | } | |
6203 |
|
6203 | |||
6204 | # :command.parse_requirements |
|
6204 | # :command.parse_requirements | |
6205 | rcstack_cli_docker_info_parse_requirements() { |
|
6205 | rcstack_cli_docker_info_parse_requirements() { | |
6206 | # :command.fixed_flags_filter |
|
6206 | # :command.fixed_flags_filter | |
6207 | while [[ $# -gt 0 ]]; do |
|
6207 | while [[ $# -gt 0 ]]; do | |
6208 | case "${1:-}" in |
|
6208 | case "${1:-}" in | |
6209 | --help | -h) |
|
6209 | --help | -h) | |
6210 | long_usage=yes |
|
6210 | long_usage=yes | |
6211 | rcstack_cli_docker_info_usage |
|
6211 | rcstack_cli_docker_info_usage | |
6212 | exit |
|
6212 | exit | |
6213 | ;; |
|
6213 | ;; | |
6214 |
|
6214 | |||
6215 | *) |
|
6215 | *) | |
6216 | break |
|
6216 | break | |
6217 | ;; |
|
6217 | ;; | |
6218 |
|
6218 | |||
6219 | esac |
|
6219 | esac | |
6220 | done |
|
6220 | done | |
6221 |
|
6221 | |||
6222 | # :command.command_filter |
|
6222 | # :command.command_filter | |
6223 | action="cli docker-info" |
|
6223 | action="cli docker-info" | |
6224 |
|
6224 | |||
6225 | # :command.parse_requirements_while |
|
6225 | # :command.parse_requirements_while | |
6226 | while [[ $# -gt 0 ]]; do |
|
6226 | while [[ $# -gt 0 ]]; do | |
6227 | key="$1" |
|
6227 | key="$1" | |
6228 | case "$key" in |
|
6228 | case "$key" in | |
6229 | # :flag.case |
|
6229 | # :flag.case | |
6230 | --verbose) |
|
6230 | --verbose) | |
6231 |
|
6231 | |||
6232 | # :flag.case_no_arg |
|
6232 | # :flag.case_no_arg | |
6233 | args['--verbose']=1 |
|
6233 | args['--verbose']=1 | |
6234 | shift |
|
6234 | shift | |
6235 | ;; |
|
6235 | ;; | |
6236 |
|
6236 | |||
6237 | -?*) |
|
6237 | -?*) | |
6238 | printf "invalid option: %s\n" "$key" >&2 |
|
6238 | printf "invalid option: %s\n" "$key" >&2 | |
6239 | exit 1 |
|
6239 | exit 1 | |
6240 | ;; |
|
6240 | ;; | |
6241 |
|
6241 | |||
6242 | *) |
|
6242 | *) | |
6243 | # :command.parse_requirements_case |
|
6243 | # :command.parse_requirements_case | |
6244 | # :command.parse_requirements_case_simple |
|
6244 | # :command.parse_requirements_case_simple | |
6245 | printf "invalid argument: %s\n" "$key" >&2 |
|
6245 | printf "invalid argument: %s\n" "$key" >&2 | |
6246 | exit 1 |
|
6246 | exit 1 | |
6247 |
|
6247 | |||
6248 | ;; |
|
6248 | ;; | |
6249 |
|
6249 | |||
6250 | esac |
|
6250 | esac | |
6251 | done |
|
6251 | done | |
6252 |
|
6252 | |||
6253 | } |
|
6253 | } | |
6254 |
|
6254 | |||
6255 | # :command.parse_requirements |
|
6255 | # :command.parse_requirements | |
6256 | rcstack_cli_docker_upgrade_parse_requirements() { |
|
6256 | rcstack_cli_docker_upgrade_parse_requirements() { | |
6257 | # :command.fixed_flags_filter |
|
6257 | # :command.fixed_flags_filter | |
6258 | while [[ $# -gt 0 ]]; do |
|
6258 | while [[ $# -gt 0 ]]; do | |
6259 | case "${1:-}" in |
|
6259 | case "${1:-}" in | |
6260 | --help | -h) |
|
6260 | --help | -h) | |
6261 | long_usage=yes |
|
6261 | long_usage=yes | |
6262 | rcstack_cli_docker_upgrade_usage |
|
6262 | rcstack_cli_docker_upgrade_usage | |
6263 | exit |
|
6263 | exit | |
6264 | ;; |
|
6264 | ;; | |
6265 |
|
6265 | |||
6266 | *) |
|
6266 | *) | |
6267 | break |
|
6267 | break | |
6268 | ;; |
|
6268 | ;; | |
6269 |
|
6269 | |||
6270 | esac |
|
6270 | esac | |
6271 | done |
|
6271 | done | |
6272 |
|
6272 | |||
6273 | # :command.command_filter |
|
6273 | # :command.command_filter | |
6274 | action="cli docker-upgrade" |
|
6274 | action="cli docker-upgrade" | |
6275 |
|
6275 | |||
6276 | # :command.parse_requirements_while |
|
6276 | # :command.parse_requirements_while | |
6277 | while [[ $# -gt 0 ]]; do |
|
6277 | while [[ $# -gt 0 ]]; do | |
6278 | key="$1" |
|
6278 | key="$1" | |
6279 | case "$key" in |
|
6279 | case "$key" in | |
6280 | # :flag.case |
|
6280 | # :flag.case | |
6281 | --compose) |
|
6281 | --compose) | |
6282 |
|
6282 | |||
6283 | # :flag.case_no_arg |
|
6283 | # :flag.case_no_arg | |
6284 | args['--compose']=1 |
|
6284 | args['--compose']=1 | |
6285 | shift |
|
6285 | shift | |
6286 | ;; |
|
6286 | ;; | |
6287 |
|
6287 | |||
6288 | -?*) |
|
6288 | -?*) | |
6289 | printf "invalid option: %s\n" "$key" >&2 |
|
6289 | printf "invalid option: %s\n" "$key" >&2 | |
6290 | exit 1 |
|
6290 | exit 1 | |
6291 | ;; |
|
6291 | ;; | |
6292 |
|
6292 | |||
6293 | *) |
|
6293 | *) | |
6294 | # :command.parse_requirements_case |
|
6294 | # :command.parse_requirements_case | |
6295 | # :command.parse_requirements_case_simple |
|
6295 | # :command.parse_requirements_case_simple | |
6296 | printf "invalid argument: %s\n" "$key" >&2 |
|
6296 | printf "invalid argument: %s\n" "$key" >&2 | |
6297 | exit 1 |
|
6297 | exit 1 | |
6298 |
|
6298 | |||
6299 | ;; |
|
6299 | ;; | |
6300 |
|
6300 | |||
6301 | esac |
|
6301 | esac | |
6302 | done |
|
6302 | done | |
6303 |
|
6303 | |||
6304 | } |
|
6304 | } | |
6305 |
|
6305 | |||
6306 | # :command.parse_requirements |
|
6306 | # :command.parse_requirements | |
6307 | rcstack_cli_redis_parse_requirements() { |
|
6307 | rcstack_cli_redis_parse_requirements() { | |
6308 | # :command.fixed_flags_filter |
|
6308 | # :command.fixed_flags_filter | |
6309 | while [[ $# -gt 0 ]]; do |
|
6309 | while [[ $# -gt 0 ]]; do | |
6310 | case "${1:-}" in |
|
6310 | case "${1:-}" in | |
6311 | --help | -h) |
|
6311 | --help | -h) | |
6312 | long_usage=yes |
|
6312 | long_usage=yes | |
6313 | rcstack_cli_redis_usage |
|
6313 | rcstack_cli_redis_usage | |
6314 | exit |
|
6314 | exit | |
6315 | ;; |
|
6315 | ;; | |
6316 |
|
6316 | |||
6317 | *) |
|
6317 | *) | |
6318 | break |
|
6318 | break | |
6319 | ;; |
|
6319 | ;; | |
6320 |
|
6320 | |||
6321 | esac |
|
6321 | esac | |
6322 | done |
|
6322 | done | |
6323 |
|
6323 | |||
6324 | # :command.command_filter |
|
6324 | # :command.command_filter | |
6325 | action="cli redis" |
|
6325 | action="cli redis" | |
6326 |
|
6326 | |||
6327 | # :command.parse_requirements_while |
|
6327 | # :command.parse_requirements_while | |
6328 | while [[ $# -gt 0 ]]; do |
|
6328 | while [[ $# -gt 0 ]]; do | |
6329 | key="$1" |
|
6329 | key="$1" | |
6330 | case "$key" in |
|
6330 | case "$key" in | |
6331 | # :flag.case |
|
6331 | # :flag.case | |
6332 | --no-tty) |
|
6332 | --no-tty) | |
6333 |
|
6333 | |||
6334 | # :flag.case_no_arg |
|
6334 | # :flag.case_no_arg | |
6335 | args['--no-tty']=1 |
|
6335 | args['--no-tty']=1 | |
6336 | shift |
|
6336 | shift | |
6337 | ;; |
|
6337 | ;; | |
6338 |
|
6338 | |||
6339 | # :flag.case |
|
6339 | # :flag.case | |
6340 | --user) |
|
6340 | --user) | |
6341 |
|
6341 | |||
6342 | # :flag.case_no_arg |
|
6342 | # :flag.case_no_arg | |
6343 | args['--user']=1 |
|
6343 | args['--user']=1 | |
6344 | shift |
|
6344 | shift | |
6345 | ;; |
|
6345 | ;; | |
6346 |
|
6346 | |||
6347 | # :flag.case |
|
6347 | # :flag.case | |
6348 | --env-file-path) |
|
6348 | --env-file-path) | |
6349 |
|
6349 | |||
6350 | # :flag.case_arg |
|
6350 | # :flag.case_arg | |
6351 | if [[ -n ${2+x} ]]; then |
|
6351 | if [[ -n ${2+x} ]]; then | |
6352 | # :flag.validations |
|
6352 | # :flag.validations | |
6353 | if [[ -n $(validate_file_exists "$2") ]]; then |
|
6353 | if [[ -n $(validate_file_exists "$2") ]]; then | |
6354 | printf "validation error in %s:\n%s\n" "--env-file-path ENV_FILE_PATH" "$(validate_file_exists "$2")" >&2 |
|
6354 | printf "validation error in %s:\n%s\n" "--env-file-path ENV_FILE_PATH" "$(validate_file_exists "$2")" >&2 | |
6355 | exit 1 |
|
6355 | exit 1 | |
6356 | fi |
|
6356 | fi | |
6357 |
|
6357 | |||
6358 | args['--env-file-path']="$2" |
|
6358 | args['--env-file-path']="$2" | |
6359 | shift |
|
6359 | shift | |
6360 | shift |
|
6360 | shift | |
6361 | else |
|
6361 | else | |
6362 | printf "%s\n" "--env-file-path requires an argument: --env-file-path ENV_FILE_PATH" >&2 |
|
6362 | printf "%s\n" "--env-file-path requires an argument: --env-file-path ENV_FILE_PATH" >&2 | |
6363 | exit 1 |
|
6363 | exit 1 | |
6364 | fi |
|
6364 | fi | |
6365 | ;; |
|
6365 | ;; | |
6366 |
|
6366 | |||
6367 | # :flag.case |
|
6367 | # :flag.case | |
6368 | --db) |
|
6368 | --db) | |
6369 |
|
6369 | |||
6370 | # :flag.case_arg |
|
6370 | # :flag.case_arg | |
6371 | if [[ -n ${2+x} ]]; then |
|
6371 | if [[ -n ${2+x} ]]; then | |
6372 |
|
6372 | |||
6373 | args['--db']="$2" |
|
6373 | args['--db']="$2" | |
6374 | shift |
|
6374 | shift | |
6375 | shift |
|
6375 | shift | |
6376 | else |
|
6376 | else | |
6377 | printf "%s\n" "--db requires an argument: --db DB" >&2 |
|
6377 | printf "%s\n" "--db requires an argument: --db DB" >&2 | |
6378 | exit 1 |
|
6378 | exit 1 | |
6379 | fi |
|
6379 | fi | |
6380 | ;; |
|
6380 | ;; | |
6381 |
|
6381 | |||
6382 | -?*) |
|
6382 | -?*) | |
6383 | printf "invalid option: %s\n" "$key" >&2 |
|
6383 | printf "invalid option: %s\n" "$key" >&2 | |
6384 | exit 1 |
|
6384 | exit 1 | |
6385 | ;; |
|
6385 | ;; | |
6386 |
|
6386 | |||
6387 | *) |
|
6387 | *) | |
6388 | # :command.parse_requirements_case |
|
6388 | # :command.parse_requirements_case | |
6389 | # :command.parse_requirements_case_simple |
|
6389 | # :command.parse_requirements_case_simple | |
6390 | printf "invalid argument: %s\n" "$key" >&2 |
|
6390 | printf "invalid argument: %s\n" "$key" >&2 | |
6391 | exit 1 |
|
6391 | exit 1 | |
6392 |
|
6392 | |||
6393 | ;; |
|
6393 | ;; | |
6394 |
|
6394 | |||
6395 | esac |
|
6395 | esac | |
6396 | done |
|
6396 | done | |
6397 |
|
6397 | |||
6398 | # :command.default_assignments |
|
6398 | # :command.default_assignments | |
6399 | [[ -n ${args['--env-file-path']:-} ]] || args['--env-file-path']="$PWD/.custom/.runtime.env" |
|
6399 | [[ -n ${args['--env-file-path']:-} ]] || args['--env-file-path']="$PWD/.custom/.runtime.env" | |
6400 | [[ -n ${args['--db']:-} ]] || args['--db']="0" |
|
6400 | [[ -n ${args['--db']:-} ]] || args['--db']="0" | |
6401 |
|
6401 | |||
6402 | } |
|
6402 | } | |
6403 |
|
6403 | |||
6404 | # :command.parse_requirements |
|
6404 | # :command.parse_requirements | |
6405 | rcstack_cli_db_parse_requirements() { |
|
6405 | rcstack_cli_db_parse_requirements() { | |
6406 | # :command.fixed_flags_filter |
|
6406 | # :command.fixed_flags_filter | |
6407 | while [[ $# -gt 0 ]]; do |
|
6407 | while [[ $# -gt 0 ]]; do | |
6408 | case "${1:-}" in |
|
6408 | case "${1:-}" in | |
6409 | --help | -h) |
|
6409 | --help | -h) | |
6410 | long_usage=yes |
|
6410 | long_usage=yes | |
6411 | rcstack_cli_db_usage |
|
6411 | rcstack_cli_db_usage | |
6412 | exit |
|
6412 | exit | |
6413 | ;; |
|
6413 | ;; | |
6414 |
|
6414 | |||
6415 | *) |
|
6415 | *) | |
6416 | break |
|
6416 | break | |
6417 | ;; |
|
6417 | ;; | |
6418 |
|
6418 | |||
6419 | esac |
|
6419 | esac | |
6420 | done |
|
6420 | done | |
6421 |
|
6421 | |||
6422 | # :command.command_filter |
|
6422 | # :command.command_filter | |
6423 | action="cli db" |
|
6423 | action="cli db" | |
6424 |
|
6424 | |||
6425 | # :command.parse_requirements_while |
|
6425 | # :command.parse_requirements_while | |
6426 | while [[ $# -gt 0 ]]; do |
|
6426 | while [[ $# -gt 0 ]]; do | |
6427 | key="$1" |
|
6427 | key="$1" | |
6428 | case "$key" in |
|
6428 | case "$key" in | |
6429 | # :flag.case |
|
6429 | # :flag.case | |
6430 | --no-tty) |
|
6430 | --no-tty) | |
6431 |
|
6431 | |||
6432 | # :flag.case_no_arg |
|
6432 | # :flag.case_no_arg | |
6433 | args['--no-tty']=1 |
|
6433 | args['--no-tty']=1 | |
6434 | shift |
|
6434 | shift | |
6435 | ;; |
|
6435 | ;; | |
6436 |
|
6436 | |||
6437 | # :flag.case |
|
6437 | # :flag.case | |
6438 | --user) |
|
6438 | --user) | |
6439 |
|
6439 | |||
6440 | # :flag.case_no_arg |
|
6440 | # :flag.case_no_arg | |
6441 | args['--user']=1 |
|
6441 | args['--user']=1 | |
6442 | shift |
|
6442 | shift | |
6443 | ;; |
|
6443 | ;; | |
6444 |
|
6444 | |||
6445 | # :flag.case |
|
6445 | # :flag.case | |
6446 | --env-file-path) |
|
6446 | --env-file-path) | |
6447 |
|
6447 | |||
6448 | # :flag.case_arg |
|
6448 | # :flag.case_arg | |
6449 | if [[ -n ${2+x} ]]; then |
|
6449 | if [[ -n ${2+x} ]]; then | |
6450 | # :flag.validations |
|
6450 | # :flag.validations | |
6451 | if [[ -n $(validate_file_exists "$2") ]]; then |
|
6451 | if [[ -n $(validate_file_exists "$2") ]]; then | |
6452 | printf "validation error in %s:\n%s\n" "--env-file-path ENV_FILE_PATH" "$(validate_file_exists "$2")" >&2 |
|
6452 | printf "validation error in %s:\n%s\n" "--env-file-path ENV_FILE_PATH" "$(validate_file_exists "$2")" >&2 | |
6453 | exit 1 |
|
6453 | exit 1 | |
6454 | fi |
|
6454 | fi | |
6455 |
|
6455 | |||
6456 | args['--env-file-path']="$2" |
|
6456 | args['--env-file-path']="$2" | |
6457 | shift |
|
6457 | shift | |
6458 | shift |
|
6458 | shift | |
6459 | else |
|
6459 | else | |
6460 | printf "%s\n" "--env-file-path requires an argument: --env-file-path ENV_FILE_PATH" >&2 |
|
6460 | printf "%s\n" "--env-file-path requires an argument: --env-file-path ENV_FILE_PATH" >&2 | |
6461 | exit 1 |
|
6461 | exit 1 | |
6462 | fi |
|
6462 | fi | |
6463 | ;; |
|
6463 | ;; | |
6464 |
|
6464 | |||
6465 | -?*) |
|
6465 | -?*) | |
6466 | printf "invalid option: %s\n" "$key" >&2 |
|
6466 | printf "invalid option: %s\n" "$key" >&2 | |
6467 | exit 1 |
|
6467 | exit 1 | |
6468 | ;; |
|
6468 | ;; | |
6469 |
|
6469 | |||
6470 | *) |
|
6470 | *) | |
6471 | # :command.parse_requirements_case |
|
6471 | # :command.parse_requirements_case | |
6472 | # :command.parse_requirements_case_simple |
|
6472 | # :command.parse_requirements_case_simple | |
6473 | printf "invalid argument: %s\n" "$key" >&2 |
|
6473 | printf "invalid argument: %s\n" "$key" >&2 | |
6474 | exit 1 |
|
6474 | exit 1 | |
6475 |
|
6475 | |||
6476 | ;; |
|
6476 | ;; | |
6477 |
|
6477 | |||
6478 | esac |
|
6478 | esac | |
6479 | done |
|
6479 | done | |
6480 |
|
6480 | |||
6481 | # :command.default_assignments |
|
6481 | # :command.default_assignments | |
6482 | [[ -n ${args['--env-file-path']:-} ]] || args['--env-file-path']="$PWD/.custom/.runtime.env" |
|
6482 | [[ -n ${args['--env-file-path']:-} ]] || args['--env-file-path']="$PWD/.custom/.runtime.env" | |
6483 |
|
6483 | |||
6484 | } |
|
6484 | } | |
6485 |
|
6485 | |||
6486 | # :command.parse_requirements |
|
6486 | # :command.parse_requirements | |
6487 | rcstack_cli_db_upgrade_parse_requirements() { |
|
6487 | rcstack_cli_db_upgrade_parse_requirements() { | |
6488 | # :command.fixed_flags_filter |
|
6488 | # :command.fixed_flags_filter | |
6489 | while [[ $# -gt 0 ]]; do |
|
6489 | while [[ $# -gt 0 ]]; do | |
6490 | case "${1:-}" in |
|
6490 | case "${1:-}" in | |
6491 | --help | -h) |
|
6491 | --help | -h) | |
6492 | long_usage=yes |
|
6492 | long_usage=yes | |
6493 | rcstack_cli_db_upgrade_usage |
|
6493 | rcstack_cli_db_upgrade_usage | |
6494 | exit |
|
6494 | exit | |
6495 | ;; |
|
6495 | ;; | |
6496 |
|
6496 | |||
6497 | *) |
|
6497 | *) | |
6498 | break |
|
6498 | break | |
6499 | ;; |
|
6499 | ;; | |
6500 |
|
6500 | |||
6501 | esac |
|
6501 | esac | |
6502 | done |
|
6502 | done | |
6503 |
|
6503 | |||
6504 | # :command.command_filter |
|
6504 | # :command.command_filter | |
6505 | action="cli db-upgrade" |
|
6505 | action="cli db-upgrade" | |
6506 |
|
6506 | |||
6507 | # :command.parse_requirements_while |
|
6507 | # :command.parse_requirements_while | |
6508 | while [[ $# -gt 0 ]]; do |
|
6508 | while [[ $# -gt 0 ]]; do | |
6509 | key="$1" |
|
6509 | key="$1" | |
6510 | case "$key" in |
|
6510 | case "$key" in | |
6511 |
|
6511 | |||
6512 | -?*) |
|
6512 | -?*) | |
6513 | printf "invalid option: %s\n" "$key" >&2 |
|
6513 | printf "invalid option: %s\n" "$key" >&2 | |
6514 | exit 1 |
|
6514 | exit 1 | |
6515 | ;; |
|
6515 | ;; | |
6516 |
|
6516 | |||
6517 | *) |
|
6517 | *) | |
6518 | # :command.parse_requirements_case |
|
6518 | # :command.parse_requirements_case | |
6519 | # :command.parse_requirements_case_simple |
|
6519 | # :command.parse_requirements_case_simple | |
6520 | printf "invalid argument: %s\n" "$key" >&2 |
|
6520 | printf "invalid argument: %s\n" "$key" >&2 | |
6521 | exit 1 |
|
6521 | exit 1 | |
6522 |
|
6522 | |||
6523 | ;; |
|
6523 | ;; | |
6524 |
|
6524 | |||
6525 | esac |
|
6525 | esac | |
6526 | done |
|
6526 | done | |
6527 |
|
6527 | |||
6528 | } |
|
6528 | } | |
6529 |
|
6529 | |||
6530 | # :command.parse_requirements |
|
6530 | # :command.parse_requirements | |
6531 | rcstack_cli_storage_parse_requirements() { |
|
6531 | rcstack_cli_storage_parse_requirements() { | |
6532 | # :command.fixed_flags_filter |
|
6532 | # :command.fixed_flags_filter | |
6533 | while [[ $# -gt 0 ]]; do |
|
6533 | while [[ $# -gt 0 ]]; do | |
6534 | case "${1:-}" in |
|
6534 | case "${1:-}" in | |
6535 | --help | -h) |
|
6535 | --help | -h) | |
6536 | long_usage=yes |
|
6536 | long_usage=yes | |
6537 | rcstack_cli_storage_usage |
|
6537 | rcstack_cli_storage_usage | |
6538 | exit |
|
6538 | exit | |
6539 | ;; |
|
6539 | ;; | |
6540 |
|
6540 | |||
6541 | *) |
|
6541 | *) | |
6542 | break |
|
6542 | break | |
6543 | ;; |
|
6543 | ;; | |
6544 |
|
6544 | |||
6545 | esac |
|
6545 | esac | |
6546 | done |
|
6546 | done | |
6547 |
|
6547 | |||
6548 | # :command.command_filter |
|
6548 | # :command.command_filter | |
6549 | action="cli storage" |
|
6549 | action="cli storage" | |
6550 |
|
6550 | |||
6551 | # :command.parse_requirements_while |
|
6551 | # :command.parse_requirements_while | |
6552 | while [[ $# -gt 0 ]]; do |
|
6552 | while [[ $# -gt 0 ]]; do | |
6553 | key="$1" |
|
6553 | key="$1" | |
6554 | case "$key" in |
|
6554 | case "$key" in | |
6555 | # :flag.case |
|
6555 | # :flag.case | |
6556 | --no-tty) |
|
6556 | --no-tty) | |
6557 |
|
6557 | |||
6558 | # :flag.case_no_arg |
|
6558 | # :flag.case_no_arg | |
6559 | args['--no-tty']=1 |
|
6559 | args['--no-tty']=1 | |
6560 | shift |
|
6560 | shift | |
6561 | ;; |
|
6561 | ;; | |
6562 |
|
6562 | |||
6563 | # :flag.case |
|
6563 | # :flag.case | |
6564 | --attached) |
|
6564 | --attached) | |
6565 |
|
6565 | |||
6566 | # :flag.case_arg |
|
6566 | # :flag.case_arg | |
6567 | if [[ -n ${2+x} ]]; then |
|
6567 | if [[ -n ${2+x} ]]; then | |
6568 |
|
6568 | |||
6569 | args['--attached']="$2" |
|
6569 | args['--attached']="$2" | |
6570 | shift |
|
6570 | shift | |
6571 | shift |
|
6571 | shift | |
6572 | else |
|
6572 | else | |
6573 | printf "%s\n" "--attached requires an argument: --attached ATTACHED" >&2 |
|
6573 | printf "%s\n" "--attached requires an argument: --attached ATTACHED" >&2 | |
6574 | exit 1 |
|
6574 | exit 1 | |
6575 | fi |
|
6575 | fi | |
6576 | ;; |
|
6576 | ;; | |
6577 |
|
6577 | |||
6578 | -?*) |
|
6578 | -?*) | |
6579 | printf "invalid option: %s\n" "$key" >&2 |
|
6579 | printf "invalid option: %s\n" "$key" >&2 | |
6580 | exit 1 |
|
6580 | exit 1 | |
6581 | ;; |
|
6581 | ;; | |
6582 |
|
6582 | |||
6583 | *) |
|
6583 | *) | |
6584 | # :command.parse_requirements_case |
|
6584 | # :command.parse_requirements_case | |
6585 | # :command.parse_requirements_case_simple |
|
6585 | # :command.parse_requirements_case_simple | |
6586 | printf "invalid argument: %s\n" "$key" >&2 |
|
6586 | printf "invalid argument: %s\n" "$key" >&2 | |
6587 | exit 1 |
|
6587 | exit 1 | |
6588 |
|
6588 | |||
6589 | ;; |
|
6589 | ;; | |
6590 |
|
6590 | |||
6591 | esac |
|
6591 | esac | |
6592 | done |
|
6592 | done | |
6593 |
|
6593 | |||
6594 | } |
|
6594 | } | |
6595 |
|
6595 | |||
6596 | # :command.parse_requirements |
|
6596 | # :command.parse_requirements | |
6597 | rcstack_cli_attach_parse_requirements() { |
|
6597 | rcstack_cli_attach_parse_requirements() { | |
6598 | # :command.fixed_flags_filter |
|
6598 | # :command.fixed_flags_filter | |
6599 | while [[ $# -gt 0 ]]; do |
|
6599 | while [[ $# -gt 0 ]]; do | |
6600 | case "${1:-}" in |
|
6600 | case "${1:-}" in | |
6601 | --help | -h) |
|
6601 | --help | -h) | |
6602 | long_usage=yes |
|
6602 | long_usage=yes | |
6603 | rcstack_cli_attach_usage |
|
6603 | rcstack_cli_attach_usage | |
6604 | exit |
|
6604 | exit | |
6605 | ;; |
|
6605 | ;; | |
6606 |
|
6606 | |||
6607 | *) |
|
6607 | *) | |
6608 | break |
|
6608 | break | |
6609 | ;; |
|
6609 | ;; | |
6610 |
|
6610 | |||
6611 | esac |
|
6611 | esac | |
6612 | done |
|
6612 | done | |
6613 |
|
6613 | |||
6614 | # :command.command_filter |
|
6614 | # :command.command_filter | |
6615 | action="cli attach" |
|
6615 | action="cli attach" | |
6616 |
|
6616 | |||
6617 | # :command.parse_requirements_while |
|
6617 | # :command.parse_requirements_while | |
6618 | while [[ $# -gt 0 ]]; do |
|
6618 | while [[ $# -gt 0 ]]; do | |
6619 | key="$1" |
|
6619 | key="$1" | |
6620 | case "$key" in |
|
6620 | case "$key" in | |
6621 | # :flag.case |
|
6621 | # :flag.case | |
6622 | --no-tty) |
|
6622 | --no-tty) | |
6623 |
|
6623 | |||
6624 | # :flag.case_no_arg |
|
6624 | # :flag.case_no_arg | |
6625 | args['--no-tty']=1 |
|
6625 | args['--no-tty']=1 | |
6626 | shift |
|
6626 | shift | |
6627 | ;; |
|
6627 | ;; | |
6628 |
|
6628 | |||
6629 | # :flag.case |
|
6629 | # :flag.case | |
6630 | --instance-type) |
|
6630 | --instance-type) | |
6631 |
|
6631 | |||
6632 | # :flag.case_arg |
|
6632 | # :flag.case_arg | |
6633 | if [[ -n ${2+x} ]]; then |
|
6633 | if [[ -n ${2+x} ]]; then | |
6634 |
|
6634 | |||
6635 | args['--instance-type']="$2" |
|
6635 | args['--instance-type']="$2" | |
6636 | shift |
|
6636 | shift | |
6637 | shift |
|
6637 | shift | |
6638 | else |
|
6638 | else | |
6639 | printf "%s\n" "--instance-type requires an argument: --instance-type INSTANCE_TYPE" >&2 |
|
6639 | printf "%s\n" "--instance-type requires an argument: --instance-type INSTANCE_TYPE" >&2 | |
6640 | exit 1 |
|
6640 | exit 1 | |
6641 | fi |
|
6641 | fi | |
6642 | ;; |
|
6642 | ;; | |
6643 |
|
6643 | |||
6644 | -?*) |
|
6644 | -?*) | |
6645 | printf "invalid option: %s\n" "$key" >&2 |
|
6645 | printf "invalid option: %s\n" "$key" >&2 | |
6646 | exit 1 |
|
6646 | exit 1 | |
6647 | ;; |
|
6647 | ;; | |
6648 |
|
6648 | |||
6649 | *) |
|
6649 | *) | |
6650 | # :command.parse_requirements_case |
|
6650 | # :command.parse_requirements_case | |
6651 | # :command.parse_requirements_case_simple |
|
6651 | # :command.parse_requirements_case_simple | |
6652 | printf "invalid argument: %s\n" "$key" >&2 |
|
6652 | printf "invalid argument: %s\n" "$key" >&2 | |
6653 | exit 1 |
|
6653 | exit 1 | |
6654 |
|
6654 | |||
6655 | ;; |
|
6655 | ;; | |
6656 |
|
6656 | |||
6657 | esac |
|
6657 | esac | |
6658 | done |
|
6658 | done | |
6659 |
|
6659 | |||
6660 | # :command.default_assignments |
|
6660 | # :command.default_assignments | |
6661 | [[ -n ${args['--instance-type']:-} ]] || args['--instance-type']="rhodecode" |
|
6661 | [[ -n ${args['--instance-type']:-} ]] || args['--instance-type']="rhodecode" | |
6662 |
|
6662 | |||
6663 | } |
|
6663 | } | |
6664 |
|
6664 | |||
6665 | # :command.parse_requirements |
|
6665 | # :command.parse_requirements | |
6666 | rcstack_cli_set_edition_parse_requirements() { |
|
6666 | rcstack_cli_set_edition_parse_requirements() { | |
6667 | # :command.fixed_flags_filter |
|
6667 | # :command.fixed_flags_filter | |
6668 | while [[ $# -gt 0 ]]; do |
|
6668 | while [[ $# -gt 0 ]]; do | |
6669 | case "${1:-}" in |
|
6669 | case "${1:-}" in | |
6670 | --help | -h) |
|
6670 | --help | -h) | |
6671 | long_usage=yes |
|
6671 | long_usage=yes | |
6672 | rcstack_cli_set_edition_usage |
|
6672 | rcstack_cli_set_edition_usage | |
6673 | exit |
|
6673 | exit | |
6674 | ;; |
|
6674 | ;; | |
6675 |
|
6675 | |||
6676 | *) |
|
6676 | *) | |
6677 | break |
|
6677 | break | |
6678 | ;; |
|
6678 | ;; | |
6679 |
|
6679 | |||
6680 | esac |
|
6680 | esac | |
6681 | done |
|
6681 | done | |
6682 |
|
6682 | |||
6683 | # :command.command_filter |
|
6683 | # :command.command_filter | |
6684 | action="cli set-edition" |
|
6684 | action="cli set-edition" | |
6685 |
|
6685 | |||
6686 | # :command.parse_requirements_while |
|
6686 | # :command.parse_requirements_while | |
6687 | while [[ $# -gt 0 ]]; do |
|
6687 | while [[ $# -gt 0 ]]; do | |
6688 | key="$1" |
|
6688 | key="$1" | |
6689 | case "$key" in |
|
6689 | case "$key" in | |
6690 |
|
6690 | |||
6691 | -?*) |
|
6691 | -?*) | |
6692 | printf "invalid option: %s\n" "$key" >&2 |
|
6692 | printf "invalid option: %s\n" "$key" >&2 | |
6693 | exit 1 |
|
6693 | exit 1 | |
6694 | ;; |
|
6694 | ;; | |
6695 |
|
6695 | |||
6696 | *) |
|
6696 | *) | |
6697 | # :command.parse_requirements_case |
|
6697 | # :command.parse_requirements_case | |
6698 | # :command.parse_requirements_case_simple |
|
6698 | # :command.parse_requirements_case_simple | |
6699 | if [[ -z ${args['edition_type']+x} ]]; then |
|
6699 | if [[ -z ${args['edition_type']+x} ]]; then | |
6700 |
|
6700 | |||
6701 | args['edition_type']=$1 |
|
6701 | args['edition_type']=$1 | |
6702 | shift |
|
6702 | shift | |
6703 | else |
|
6703 | else | |
6704 | printf "invalid argument: %s\n" "$key" >&2 |
|
6704 | printf "invalid argument: %s\n" "$key" >&2 | |
6705 | exit 1 |
|
6705 | exit 1 | |
6706 | fi |
|
6706 | fi | |
6707 |
|
6707 | |||
6708 | ;; |
|
6708 | ;; | |
6709 |
|
6709 | |||
6710 | esac |
|
6710 | esac | |
6711 | done |
|
6711 | done | |
6712 |
|
6712 | |||
6713 | # :command.required_args_filter |
|
6713 | # :command.required_args_filter | |
6714 | if [[ -z ${args['edition_type']+x} ]]; then |
|
6714 | if [[ -z ${args['edition_type']+x} ]]; then | |
6715 | printf "missing required argument: EDITION_TYPE\nusage: rcstack cli set-edition EDITION_TYPE\n" >&2 |
|
6715 | printf "missing required argument: EDITION_TYPE\nusage: rcstack cli set-edition EDITION_TYPE\n" >&2 | |
6716 | exit 1 |
|
6716 | exit 1 | |
6717 | fi |
|
6717 | fi | |
6718 |
|
6718 | |||
6719 | # :command.whitelist_filter |
|
6719 | # :command.whitelist_filter | |
6720 | if [[ -n ${args['edition_type']} ]] && [[ ! ${args['edition_type']} =~ ^(ce|ee)$ ]]; then |
|
6720 | if [[ -n ${args['edition_type']} ]] && [[ ! ${args['edition_type']} =~ ^(ce|ee)$ ]]; then | |
6721 | printf "%s\n" "edition_type must be one of: ce, ee" >&2 |
|
6721 | printf "%s\n" "edition_type must be one of: ce, ee" >&2 | |
6722 | exit 1 |
|
6722 | exit 1 | |
6723 | fi |
|
6723 | fi | |
6724 |
|
6724 | |||
6725 | } |
|
6725 | } | |
6726 |
|
6726 | |||
6727 | # :command.parse_requirements |
|
6727 | # :command.parse_requirements | |
6728 | rcstack_cli_configure_vcsserver_parse_requirements() { |
|
6728 | rcstack_cli_configure_vcsserver_parse_requirements() { | |
6729 | # :command.fixed_flags_filter |
|
6729 | # :command.fixed_flags_filter | |
6730 | while [[ $# -gt 0 ]]; do |
|
6730 | while [[ $# -gt 0 ]]; do | |
6731 | case "${1:-}" in |
|
6731 | case "${1:-}" in | |
6732 | --help | -h) |
|
6732 | --help | -h) | |
6733 | long_usage=yes |
|
6733 | long_usage=yes | |
6734 | rcstack_cli_configure_vcsserver_usage |
|
6734 | rcstack_cli_configure_vcsserver_usage | |
6735 | exit |
|
6735 | exit | |
6736 | ;; |
|
6736 | ;; | |
6737 |
|
6737 | |||
6738 | *) |
|
6738 | *) | |
6739 | break |
|
6739 | break | |
6740 | ;; |
|
6740 | ;; | |
6741 |
|
6741 | |||
6742 | esac |
|
6742 | esac | |
6743 | done |
|
6743 | done | |
6744 |
|
6744 | |||
6745 | # :command.command_filter |
|
6745 | # :command.command_filter | |
6746 | action="cli configure-vcsserver" |
|
6746 | action="cli configure-vcsserver" | |
6747 |
|
6747 | |||
6748 | # :command.parse_requirements_while |
|
6748 | # :command.parse_requirements_while | |
6749 | while [[ $# -gt 0 ]]; do |
|
6749 | while [[ $# -gt 0 ]]; do | |
6750 | key="$1" |
|
6750 | key="$1" | |
6751 | case "$key" in |
|
6751 | case "$key" in | |
6752 |
|
6752 | |||
6753 | -?*) |
|
6753 | -?*) | |
6754 | printf "invalid option: %s\n" "$key" >&2 |
|
6754 | printf "invalid option: %s\n" "$key" >&2 | |
6755 | exit 1 |
|
6755 | exit 1 | |
6756 | ;; |
|
6756 | ;; | |
6757 |
|
6757 | |||
6758 | *) |
|
6758 | *) | |
6759 | # :command.parse_requirements_case |
|
6759 | # :command.parse_requirements_case | |
6760 | # :command.parse_requirements_case_simple |
|
6760 | # :command.parse_requirements_case_simple | |
6761 | if [[ -z ${args['ini_path']+x} ]]; then |
|
6761 | if [[ -z ${args['ini_path']+x} ]]; then | |
6762 | # :argument.validations |
|
6762 | # :argument.validations | |
6763 | if [[ -n $(validate_file_exists "$1") ]]; then |
|
6763 | if [[ -n $(validate_file_exists "$1") ]]; then | |
6764 | printf "validation error in %s:\n%s\n" "INI_PATH" "$(validate_file_exists "$1")" >&2 |
|
6764 | printf "validation error in %s:\n%s\n" "INI_PATH" "$(validate_file_exists "$1")" >&2 | |
6765 | exit 1 |
|
6765 | exit 1 | |
6766 | fi |
|
6766 | fi | |
6767 |
|
6767 | |||
6768 | args['ini_path']=$1 |
|
6768 | args['ini_path']=$1 | |
6769 | shift |
|
6769 | shift | |
6770 | else |
|
6770 | else | |
6771 | printf "invalid argument: %s\n" "$key" >&2 |
|
6771 | printf "invalid argument: %s\n" "$key" >&2 | |
6772 | exit 1 |
|
6772 | exit 1 | |
6773 | fi |
|
6773 | fi | |
6774 |
|
6774 | |||
6775 | ;; |
|
6775 | ;; | |
6776 |
|
6776 | |||
6777 | esac |
|
6777 | esac | |
6778 | done |
|
6778 | done | |
6779 |
|
6779 | |||
6780 | # :command.required_args_filter |
|
6780 | # :command.required_args_filter | |
6781 | if [[ -z ${args['ini_path']+x} ]]; then |
|
6781 | if [[ -z ${args['ini_path']+x} ]]; then | |
6782 | printf "missing required argument: INI_PATH\nusage: rcstack cli configure-vcsserver INI_PATH\n" >&2 |
|
6782 | printf "missing required argument: INI_PATH\nusage: rcstack cli configure-vcsserver INI_PATH\n" >&2 | |
6783 | exit 1 |
|
6783 | exit 1 | |
6784 | fi |
|
6784 | fi | |
6785 |
|
6785 | |||
6786 | } |
|
6786 | } | |
6787 |
|
6787 | |||
6788 | # :command.parse_requirements |
|
6788 | # :command.parse_requirements | |
6789 | rcstack_cli_configure_rhodecode_parse_requirements() { |
|
6789 | rcstack_cli_configure_rhodecode_parse_requirements() { | |
6790 | # :command.fixed_flags_filter |
|
6790 | # :command.fixed_flags_filter | |
6791 | while [[ $# -gt 0 ]]; do |
|
6791 | while [[ $# -gt 0 ]]; do | |
6792 | case "${1:-}" in |
|
6792 | case "${1:-}" in | |
6793 | --help | -h) |
|
6793 | --help | -h) | |
6794 | long_usage=yes |
|
6794 | long_usage=yes | |
6795 | rcstack_cli_configure_rhodecode_usage |
|
6795 | rcstack_cli_configure_rhodecode_usage | |
6796 | exit |
|
6796 | exit | |
6797 | ;; |
|
6797 | ;; | |
6798 |
|
6798 | |||
6799 | *) |
|
6799 | *) | |
6800 | break |
|
6800 | break | |
6801 | ;; |
|
6801 | ;; | |
6802 |
|
6802 | |||
6803 | esac |
|
6803 | esac | |
6804 | done |
|
6804 | done | |
6805 |
|
6805 | |||
6806 | # :command.command_filter |
|
6806 | # :command.command_filter | |
6807 | action="cli configure-rhodecode" |
|
6807 | action="cli configure-rhodecode" | |
6808 |
|
6808 | |||
6809 | # :command.parse_requirements_while |
|
6809 | # :command.parse_requirements_while | |
6810 | while [[ $# -gt 0 ]]; do |
|
6810 | while [[ $# -gt 0 ]]; do | |
6811 | key="$1" |
|
6811 | key="$1" | |
6812 | case "$key" in |
|
6812 | case "$key" in | |
6813 |
|
6813 | |||
6814 | -?*) |
|
6814 | -?*) | |
6815 | printf "invalid option: %s\n" "$key" >&2 |
|
6815 | printf "invalid option: %s\n" "$key" >&2 | |
6816 | exit 1 |
|
6816 | exit 1 | |
6817 | ;; |
|
6817 | ;; | |
6818 |
|
6818 | |||
6819 | *) |
|
6819 | *) | |
6820 | # :command.parse_requirements_case |
|
6820 | # :command.parse_requirements_case | |
6821 | # :command.parse_requirements_case_simple |
|
6821 | # :command.parse_requirements_case_simple | |
6822 | if [[ -z ${args['ini_path']+x} ]]; then |
|
6822 | if [[ -z ${args['ini_path']+x} ]]; then | |
6823 | # :argument.validations |
|
6823 | # :argument.validations | |
6824 | if [[ -n $(validate_file_exists "$1") ]]; then |
|
6824 | if [[ -n $(validate_file_exists "$1") ]]; then | |
6825 | printf "validation error in %s:\n%s\n" "INI_PATH" "$(validate_file_exists "$1")" >&2 |
|
6825 | printf "validation error in %s:\n%s\n" "INI_PATH" "$(validate_file_exists "$1")" >&2 | |
6826 | exit 1 |
|
6826 | exit 1 | |
6827 | fi |
|
6827 | fi | |
6828 |
|
6828 | |||
6829 | args['ini_path']=$1 |
|
6829 | args['ini_path']=$1 | |
6830 | shift |
|
6830 | shift | |
6831 | else |
|
6831 | else | |
6832 | printf "invalid argument: %s\n" "$key" >&2 |
|
6832 | printf "invalid argument: %s\n" "$key" >&2 | |
6833 | exit 1 |
|
6833 | exit 1 | |
6834 | fi |
|
6834 | fi | |
6835 |
|
6835 | |||
6836 | ;; |
|
6836 | ;; | |
6837 |
|
6837 | |||
6838 | esac |
|
6838 | esac | |
6839 | done |
|
6839 | done | |
6840 |
|
6840 | |||
6841 | # :command.required_args_filter |
|
6841 | # :command.required_args_filter | |
6842 | if [[ -z ${args['ini_path']+x} ]]; then |
|
6842 | if [[ -z ${args['ini_path']+x} ]]; then | |
6843 | printf "missing required argument: INI_PATH\nusage: rcstack cli configure-rhodecode INI_PATH\n" >&2 |
|
6843 | printf "missing required argument: INI_PATH\nusage: rcstack cli configure-rhodecode INI_PATH\n" >&2 | |
6844 | exit 1 |
|
6844 | exit 1 | |
6845 | fi |
|
6845 | fi | |
6846 |
|
6846 | |||
6847 | } |
|
6847 | } | |
6848 |
|
6848 | |||
6849 | # :command.parse_requirements |
|
6849 | # :command.parse_requirements | |
6850 | rcstack_backup_db_parse_requirements() { |
|
6850 | rcstack_backup_db_parse_requirements() { | |
6851 | # :command.fixed_flags_filter |
|
6851 | # :command.fixed_flags_filter | |
6852 | while [[ $# -gt 0 ]]; do |
|
6852 | while [[ $# -gt 0 ]]; do | |
6853 | case "${1:-}" in |
|
6853 | case "${1:-}" in | |
6854 | --help | -h) |
|
6854 | --help | -h) | |
6855 | long_usage=yes |
|
6855 | long_usage=yes | |
6856 | rcstack_backup_db_usage |
|
6856 | rcstack_backup_db_usage | |
6857 | exit |
|
6857 | exit | |
6858 | ;; |
|
6858 | ;; | |
6859 |
|
6859 | |||
6860 | *) |
|
6860 | *) | |
6861 | break |
|
6861 | break | |
6862 | ;; |
|
6862 | ;; | |
6863 |
|
6863 | |||
6864 | esac |
|
6864 | esac | |
6865 | done |
|
6865 | done | |
6866 |
|
6866 | |||
6867 | # :command.dependencies_filter |
|
6867 | # :command.dependencies_filter | |
6868 | if command -v tar >/dev/null 2>&1; then |
|
6868 | if command -v tar >/dev/null 2>&1; then | |
6869 | deps['tar']="$(command -v tar | head -n1)" |
|
6869 | deps['tar']="$(command -v tar | head -n1)" | |
6870 | else |
|
6870 | else | |
6871 | printf "missing dependency: tar\n" >&2 |
|
6871 | printf "missing dependency: tar\n" >&2 | |
6872 | exit 1 |
|
6872 | exit 1 | |
6873 | fi |
|
6873 | fi | |
6874 |
|
6874 | |||
6875 | if command -v gzip >/dev/null 2>&1; then |
|
6875 | if command -v gzip >/dev/null 2>&1; then | |
6876 | deps['gzip']="$(command -v gzip | head -n1)" |
|
6876 | deps['gzip']="$(command -v gzip | head -n1)" | |
6877 | else |
|
6877 | else | |
6878 | printf "missing dependency: gzip\n" >&2 |
|
6878 | printf "missing dependency: gzip\n" >&2 | |
6879 | exit 1 |
|
6879 | exit 1 | |
6880 | fi |
|
6880 | fi | |
6881 |
|
6881 | |||
6882 | # :command.command_filter |
|
6882 | # :command.command_filter | |
6883 | action="backup-db" |
|
6883 | action="backup-db" | |
6884 |
|
6884 | |||
6885 | # :command.parse_requirements_while |
|
6885 | # :command.parse_requirements_while | |
6886 | while [[ $# -gt 0 ]]; do |
|
6886 | while [[ $# -gt 0 ]]; do | |
6887 | key="$1" |
|
6887 | key="$1" | |
6888 | case "$key" in |
|
6888 | case "$key" in | |
6889 |
|
6889 | |||
6890 | -?*) |
|
6890 | -?*) | |
6891 | printf "invalid option: %s\n" "$key" >&2 |
|
6891 | printf "invalid option: %s\n" "$key" >&2 | |
6892 | exit 1 |
|
6892 | exit 1 | |
6893 | ;; |
|
6893 | ;; | |
6894 |
|
6894 | |||
6895 | *) |
|
6895 | *) | |
6896 | # :command.parse_requirements_case |
|
6896 | # :command.parse_requirements_case | |
6897 | # :command.parse_requirements_case_simple |
|
6897 | # :command.parse_requirements_case_simple | |
6898 | if [[ -z ${args['destination']+x} ]]; then |
|
6898 | if [[ -z ${args['destination']+x} ]]; then | |
6899 | # :argument.validations |
|
6899 | # :argument.validations | |
6900 | if [[ -n $(validate_dir_exists "$1") ]]; then |
|
6900 | if [[ -n $(validate_dir_exists "$1") ]]; then | |
6901 | printf "validation error in %s:\n%s\n" "DESTINATION" "$(validate_dir_exists "$1")" >&2 |
|
6901 | printf "validation error in %s:\n%s\n" "DESTINATION" "$(validate_dir_exists "$1")" >&2 | |
6902 | exit 1 |
|
6902 | exit 1 | |
6903 | fi |
|
6903 | fi | |
6904 |
|
6904 | |||
6905 | args['destination']=$1 |
|
6905 | args['destination']=$1 | |
6906 | shift |
|
6906 | shift | |
6907 | else |
|
6907 | else | |
6908 | printf "invalid argument: %s\n" "$key" >&2 |
|
6908 | printf "invalid argument: %s\n" "$key" >&2 | |
6909 | exit 1 |
|
6909 | exit 1 | |
6910 | fi |
|
6910 | fi | |
6911 |
|
6911 | |||
6912 | ;; |
|
6912 | ;; | |
6913 |
|
6913 | |||
6914 | esac |
|
6914 | esac | |
6915 | done |
|
6915 | done | |
6916 |
|
6916 | |||
6917 | # :command.required_args_filter |
|
6917 | # :command.required_args_filter | |
6918 | if [[ -z ${args['destination']+x} ]]; then |
|
6918 | if [[ -z ${args['destination']+x} ]]; then | |
6919 | printf "missing required argument: DESTINATION\nusage: rcstack backup-db DESTINATION\n" >&2 |
|
6919 | printf "missing required argument: DESTINATION\nusage: rcstack backup-db DESTINATION\n" >&2 | |
6920 | exit 1 |
|
6920 | exit 1 | |
6921 | fi |
|
6921 | fi | |
6922 |
|
6922 | |||
6923 | } |
|
6923 | } | |
6924 |
|
6924 | |||
6925 | # :command.parse_requirements |
|
6925 | # :command.parse_requirements | |
6926 | rcstack_backup_data_parse_requirements() { |
|
6926 | rcstack_backup_data_parse_requirements() { | |
6927 | # :command.fixed_flags_filter |
|
6927 | # :command.fixed_flags_filter | |
6928 | while [[ $# -gt 0 ]]; do |
|
6928 | while [[ $# -gt 0 ]]; do | |
6929 | case "${1:-}" in |
|
6929 | case "${1:-}" in | |
6930 | --help | -h) |
|
6930 | --help | -h) | |
6931 | long_usage=yes |
|
6931 | long_usage=yes | |
6932 | rcstack_backup_data_usage |
|
6932 | rcstack_backup_data_usage | |
6933 | exit |
|
6933 | exit | |
6934 | ;; |
|
6934 | ;; | |
6935 |
|
6935 | |||
6936 | *) |
|
6936 | *) | |
6937 | break |
|
6937 | break | |
6938 | ;; |
|
6938 | ;; | |
6939 |
|
6939 | |||
6940 | esac |
|
6940 | esac | |
6941 | done |
|
6941 | done | |
6942 |
|
6942 | |||
6943 | # :command.dependencies_filter |
|
6943 | # :command.dependencies_filter | |
6944 | if command -v tar >/dev/null 2>&1; then |
|
6944 | if command -v tar >/dev/null 2>&1; then | |
6945 | deps['tar']="$(command -v tar | head -n1)" |
|
6945 | deps['tar']="$(command -v tar | head -n1)" | |
6946 | else |
|
6946 | else | |
6947 | printf "missing dependency: tar\n" >&2 |
|
6947 | printf "missing dependency: tar\n" >&2 | |
6948 | exit 1 |
|
6948 | exit 1 | |
6949 | fi |
|
6949 | fi | |
6950 |
|
6950 | |||
6951 | if command -v gzip >/dev/null 2>&1; then |
|
6951 | if command -v gzip >/dev/null 2>&1; then | |
6952 | deps['gzip']="$(command -v gzip | head -n1)" |
|
6952 | deps['gzip']="$(command -v gzip | head -n1)" | |
6953 | else |
|
6953 | else | |
6954 | printf "missing dependency: gzip\n" >&2 |
|
6954 | printf "missing dependency: gzip\n" >&2 | |
6955 | exit 1 |
|
6955 | exit 1 | |
6956 | fi |
|
6956 | fi | |
6957 |
|
6957 | |||
6958 | # :command.command_filter |
|
6958 | # :command.command_filter | |
6959 | action="backup-data" |
|
6959 | action="backup-data" | |
6960 |
|
6960 | |||
6961 | # :command.parse_requirements_while |
|
6961 | # :command.parse_requirements_while | |
6962 | while [[ $# -gt 0 ]]; do |
|
6962 | while [[ $# -gt 0 ]]; do | |
6963 | key="$1" |
|
6963 | key="$1" | |
6964 | case "$key" in |
|
6964 | case "$key" in | |
6965 |
|
6965 | |||
6966 | -?*) |
|
6966 | -?*) | |
6967 | printf "invalid option: %s\n" "$key" >&2 |
|
6967 | printf "invalid option: %s\n" "$key" >&2 | |
6968 | exit 1 |
|
6968 | exit 1 | |
6969 | ;; |
|
6969 | ;; | |
6970 |
|
6970 | |||
6971 | *) |
|
6971 | *) | |
6972 | # :command.parse_requirements_case |
|
6972 | # :command.parse_requirements_case | |
6973 | # :command.parse_requirements_case_simple |
|
6973 | # :command.parse_requirements_case_simple | |
6974 | if [[ -z ${args['destination']+x} ]]; then |
|
6974 | if [[ -z ${args['destination']+x} ]]; then | |
6975 | # :argument.validations |
|
6975 | # :argument.validations | |
6976 | if [[ -n $(validate_dir_exists "$1") ]]; then |
|
6976 | if [[ -n $(validate_dir_exists "$1") ]]; then | |
6977 | printf "validation error in %s:\n%s\n" "DESTINATION" "$(validate_dir_exists "$1")" >&2 |
|
6977 | printf "validation error in %s:\n%s\n" "DESTINATION" "$(validate_dir_exists "$1")" >&2 | |
6978 | exit 1 |
|
6978 | exit 1 | |
6979 | fi |
|
6979 | fi | |
6980 |
|
6980 | |||
6981 | args['destination']=$1 |
|
6981 | args['destination']=$1 | |
6982 | shift |
|
6982 | shift | |
6983 | else |
|
6983 | else | |
6984 | printf "invalid argument: %s\n" "$key" >&2 |
|
6984 | printf "invalid argument: %s\n" "$key" >&2 | |
6985 | exit 1 |
|
6985 | exit 1 | |
6986 | fi |
|
6986 | fi | |
6987 |
|
6987 | |||
6988 | ;; |
|
6988 | ;; | |
6989 |
|
6989 | |||
6990 | esac |
|
6990 | esac | |
6991 | done |
|
6991 | done | |
6992 |
|
6992 | |||
6993 | # :command.required_args_filter |
|
6993 | # :command.required_args_filter | |
6994 | if [[ -z ${args['destination']+x} ]]; then |
|
6994 | if [[ -z ${args['destination']+x} ]]; then | |
6995 | printf "missing required argument: DESTINATION\nusage: rcstack backup-data DESTINATION\n" >&2 |
|
6995 | printf "missing required argument: DESTINATION\nusage: rcstack backup-data DESTINATION\n" >&2 | |
6996 | exit 1 |
|
6996 | exit 1 | |
6997 | fi |
|
6997 | fi | |
6998 |
|
6998 | |||
6999 | } |
|
6999 | } | |
7000 |
|
7000 | |||
7001 | # :command.parse_requirements |
|
7001 | # :command.parse_requirements | |
7002 | rcstack__completions_parse_requirements() { |
|
7002 | rcstack__completions_parse_requirements() { | |
7003 | # :command.fixed_flags_filter |
|
7003 | # :command.fixed_flags_filter | |
7004 | while [[ $# -gt 0 ]]; do |
|
7004 | while [[ $# -gt 0 ]]; do | |
7005 | case "${1:-}" in |
|
7005 | case "${1:-}" in | |
7006 | --help | -h) |
|
7006 | --help | -h) | |
7007 | long_usage=yes |
|
7007 | long_usage=yes | |
7008 | rcstack__completions_usage |
|
7008 | rcstack__completions_usage | |
7009 | exit |
|
7009 | exit | |
7010 | ;; |
|
7010 | ;; | |
7011 |
|
7011 | |||
7012 | *) |
|
7012 | *) | |
7013 | break |
|
7013 | break | |
7014 | ;; |
|
7014 | ;; | |
7015 |
|
7015 | |||
7016 | esac |
|
7016 | esac | |
7017 | done |
|
7017 | done | |
7018 |
|
7018 | |||
7019 | # :command.command_filter |
|
7019 | # :command.command_filter | |
7020 | action="_completions" |
|
7020 | action="_completions" | |
7021 |
|
7021 | |||
7022 | # :command.parse_requirements_while |
|
7022 | # :command.parse_requirements_while | |
7023 | while [[ $# -gt 0 ]]; do |
|
7023 | while [[ $# -gt 0 ]]; do | |
7024 | key="$1" |
|
7024 | key="$1" | |
7025 | case "$key" in |
|
7025 | case "$key" in | |
7026 |
|
7026 | |||
7027 | -?*) |
|
7027 | -?*) | |
7028 | printf "invalid option: %s\n" "$key" >&2 |
|
7028 | printf "invalid option: %s\n" "$key" >&2 | |
7029 | exit 1 |
|
7029 | exit 1 | |
7030 | ;; |
|
7030 | ;; | |
7031 |
|
7031 | |||
7032 | *) |
|
7032 | *) | |
7033 | # :command.parse_requirements_case |
|
7033 | # :command.parse_requirements_case | |
7034 | # :command.parse_requirements_case_simple |
|
7034 | # :command.parse_requirements_case_simple | |
7035 | printf "invalid argument: %s\n" "$key" >&2 |
|
7035 | printf "invalid argument: %s\n" "$key" >&2 | |
7036 | exit 1 |
|
7036 | exit 1 | |
7037 |
|
7037 | |||
7038 | ;; |
|
7038 | ;; | |
7039 |
|
7039 | |||
7040 | esac |
|
7040 | esac | |
7041 | done |
|
7041 | done | |
7042 |
|
7042 | |||
7043 | } |
|
7043 | } | |
7044 |
|
7044 | |||
7045 | # :command.initialize |
|
7045 | # :command.initialize | |
7046 | initialize() { |
|
7046 | initialize() { | |
7047 | version="5.8.0" |
|
7047 | version="5.8.0" | |
7048 | long_usage='' |
|
7048 | long_usage='' | |
7049 | set -e |
|
7049 | set -e | |
7050 |
|
7050 | |||
7051 | # :command.environment_variables_default |
|
7051 | # :command.environment_variables_default | |
7052 | export RCC_CONFIG="${RCC_CONFIG:-.rcstack.ini}" |
|
7052 | export RCC_CONFIG="${RCC_CONFIG:-.rcstack.ini}" | |
7053 | export RC_STACK_ROUTER_EXT="${RC_STACK_ROUTER_EXT:-.custom/docker-compose-router.override.yaml}" |
|
7053 | export RC_STACK_ROUTER_EXT="${RC_STACK_ROUTER_EXT:-.custom/docker-compose-router.override.yaml}" | |
7054 | export RC_STACK_METRICS_EXT="${RC_STACK_METRICS_EXT:-.custom/docker-compose-metrics.override.yaml}" |
|
7054 | export RC_STACK_METRICS_EXT="${RC_STACK_METRICS_EXT:-.custom/docker-compose-metrics.override.yaml}" | |
7055 | export RC_STACK_SERVICES_EXT="${RC_STACK_SERVICES_EXT:-.custom/docker-compose-services.override.yaml}" |
|
7055 | export RC_STACK_SERVICES_EXT="${RC_STACK_SERVICES_EXT:-.custom/docker-compose-services.override.yaml}" | |
7056 | export RC_STACK_RHODECODE_EXT="${RC_STACK_RHODECODE_EXT:-.custom/docker-compose-apps.override.yaml}" |
|
7056 | export RC_STACK_RHODECODE_EXT="${RC_STACK_RHODECODE_EXT:-.custom/docker-compose-apps.override.yaml}" | |
7057 |
|
7057 | |||
7058 | # src/initialize.sh |
|
7058 | # src/initialize.sh | |
7059 |
|
7059 | |||
7060 | rc_image_ver=4.28.0 |
|
7060 | rc_image_ver=4.28.0 | |
7061 |
|
7061 | |||
7062 | rhodecode_default_config_path=config/_shared/rhodecode.ini |
|
7062 | rhodecode_default_config_path=config/_shared/rhodecode.ini | |
7063 | vcsserver_default_config_path=config/_shared/vcsserver.ini |
|
7063 | vcsserver_default_config_path=config/_shared/vcsserver.ini | |
7064 |
|
7064 | |||
7065 | RC_STACK_ROUTER_VER=1.0.0 |
|
7065 | RC_STACK_ROUTER_VER=1.0.0 | |
7066 | RC_STACK_SERVICES_VER=1.0.0 |
|
7066 | RC_STACK_SERVICES_VER=1.0.0 | |
7067 | RC_STACK_RHODECODE_VER=1.0.0 |
|
7067 | RC_STACK_RHODECODE_VER=1.0.0 | |
7068 | RC_STACK_METRICS_VER=1.0.0 |
|
7068 | RC_STACK_METRICS_VER=1.0.0 | |
7069 |
|
7069 | |||
7070 | RC_SCRIPT_NAME=rcstack |
|
7070 | RC_SCRIPT_NAME=rcstack | |
7071 | # bootstrap file is a config file at the same time |
|
7071 | # bootstrap file is a config file at the same time | |
7072 | CONFIG_FILE=${RCC_CONFIG:=.rcstack.ini} |
|
7072 | CONFIG_FILE=${RCC_CONFIG:=.rcstack.ini} | |
7073 |
|
7073 | |||
7074 | # runtime env file |
|
7074 | # runtime env file | |
7075 | RUNTIME_ENV=$PWD/.custom/.runtime.env |
|
7075 | RUNTIME_ENV=$PWD/.custom/.runtime.env | |
7076 |
|
7076 | |||
7077 | # STACK_LIST |
|
7077 | # STACK_LIST | |
7078 | VALID_SERVICES="router metrics services rhodecode" |
|
7078 | VALID_SERVICES="router metrics services rhodecode" | |
7079 | DOCKER_DEFS_WORK_DIR="docker_defs" |
|
7079 | DOCKER_DEFS_WORK_DIR="docker_defs" | |
7080 |
|
7080 | |||
7081 | # stage key, saved in .rcstack.ini : stage func to execute |
|
7081 | # stage key, saved in .rcstack.ini : stage func to execute | |
7082 | BOOTSTRAP_STAGES="\ |
|
7082 | BOOTSTRAP_STAGES="\ | |
7083 | bootstrap_v1_docker_install \ |
|
7083 | bootstrap_v1_docker_install \ | |
7084 | bootstrap_v1_docker_commons \ |
|
7084 | bootstrap_v1_docker_commons \ | |
7085 | bootstrap_v1_definitions \ |
|
7085 | bootstrap_v1_definitions \ | |
7086 | bootstrap_v1_config \ |
|
7086 | bootstrap_v1_config \ | |
7087 | bootstrap_v1_overrides \ |
|
7087 | bootstrap_v1_overrides \ | |
7088 | " |
|
7088 | " | |
7089 |
|
7089 | |||
7090 | YAML_TEMPLATES="\ |
|
7090 | YAML_TEMPLATES="\ | |
7091 | docker-compose-apps.override.yaml |
|
7091 | docker-compose-apps.override.yaml | |
7092 | docker-compose-metrics.override.yaml |
|
7092 | docker-compose-metrics.override.yaml | |
7093 | docker-compose-router.override.yaml |
|
7093 | docker-compose-router.override.yaml | |
7094 | docker-compose-services.override.yaml |
|
7094 | docker-compose-services.override.yaml | |
7095 | runtime.env.tmpl |
|
7095 | runtime.env.tmpl | |
7096 | " |
|
7096 | " | |
7097 |
|
7097 | |||
7098 | BASE_OPS_IMAGE="ubuntu:22.04" |
|
7098 | BASE_OPS_IMAGE="ubuntu:22.04" | |
7099 |
|
7099 | |||
7100 | get_stage_function() { |
|
7100 | get_stage_function() { | |
7101 | stage_name=$1 |
|
7101 | stage_name=$1 | |
7102 |
|
7102 | |||
7103 | case $stage_name in |
|
7103 | case $stage_name in | |
7104 | bootstrap_v1_docker_install) |
|
7104 | bootstrap_v1_docker_install) | |
7105 | stage_func=bootstrap_docker_install |
|
7105 | stage_func=bootstrap_docker_install | |
7106 | ;; |
|
7106 | ;; | |
7107 | bootstrap_v1_docker_commons) |
|
7107 | bootstrap_v1_docker_commons) | |
7108 | stage_func=bootstrap_docker_commons |
|
7108 | stage_func=bootstrap_docker_commons | |
7109 | ;; |
|
7109 | ;; | |
7110 | bootstrap_v1_definitions) |
|
7110 | bootstrap_v1_definitions) | |
7111 | stage_func=bootstrap_definitions |
|
7111 | stage_func=bootstrap_definitions | |
7112 | ;; |
|
7112 | ;; | |
7113 | bootstrap_v1_config) |
|
7113 | bootstrap_v1_config) | |
7114 | stage_func=bootstrap_config |
|
7114 | stage_func=bootstrap_config | |
7115 | ;; |
|
7115 | ;; | |
7116 | bootstrap_v1_overrides) |
|
7116 | bootstrap_v1_overrides) | |
7117 | stage_func=bootstrap_overrides |
|
7117 | stage_func=bootstrap_overrides | |
7118 | ;; |
|
7118 | ;; | |
7119 | *) |
|
7119 | *) | |
7120 | echo "can't find function for stage $stage_name" |
|
7120 | echo "can't find function for stage $stage_name" | |
7121 | exit 1 |
|
7121 | exit 1 | |
7122 | esac |
|
7122 | esac | |
7123 |
|
7123 | |||
7124 | echo $stage_func |
|
7124 | echo $stage_func | |
7125 | } |
|
7125 | } | |
7126 |
|
7126 | |||
7127 | #echo "1 ----" |
|
7127 | #echo "1 ----" | |
7128 | #echo $RC_STACK_SERVICES_EXT |
|
7128 | #echo $RC_STACK_SERVICES_EXT | |
7129 | #echo $RC_STACK_METRICS_EXT |
|
7129 | #echo $RC_STACK_METRICS_EXT | |
7130 | #echo "1 -----" |
|
7130 | #echo "1 -----" | |
7131 |
|
7131 | |||
7132 | #echo '2 ----' |
|
7132 | #echo '2 ----' | |
7133 | #grep -v -e '^#' "$ENV_FILE" | xargs -I {} echo \'{}\' |
|
7133 | #grep -v -e '^#' "$ENV_FILE" | xargs -I {} echo \'{}\' | |
7134 | #echo '2 ----' |
|
7134 | #echo '2 ----' | |
7135 |
|
7135 | |||
7136 | #expose env vars from ./rcstack config |
|
7136 | #expose env vars from ./rcstack config | |
7137 | #if [[ -f $ENV_FILE ]]; then |
|
7137 | #if [[ -f $ENV_FILE ]]; then | |
7138 | # eval $(grep -v -e '^#' "$ENV_FILE" | xargs -I {} echo export \'{}\') |
|
7138 | # eval $(grep -v -e '^#' "$ENV_FILE" | xargs -I {} echo export \'{}\') | |
7139 | #fi |
|
7139 | #fi | |
7140 |
|
7140 | |||
7141 | #ENV_EXPAND="" |
|
7141 | #ENV_EXPAND="" | |
7142 | #for k in $(config_keys); do |
|
7142 | #for k in $(config_keys); do | |
7143 | # k_upper=${k^^} |
|
7143 | # k_upper=${k^^} | |
7144 | # env_entry="-e $k_upper='$(config_get "$k")' " |
|
7144 | # env_entry="-e $k_upper='$(config_get "$k")' " | |
7145 | # ENV_EXPAND+=$env_entry; |
|
7145 | # ENV_EXPAND+=$env_entry; | |
7146 | # #echo $env_expand |
|
7146 | # #echo $env_expand | |
7147 | #done |
|
7147 | #done | |
7148 |
|
7148 | |||
7149 | # |
|
7149 | # | |
7150 | #echo "3 ----" |
|
7150 | #echo "3 ----" | |
7151 | #echo $RC_STACK_SERVICES_EXT |
|
7151 | #echo $RC_STACK_SERVICES_EXT | |
7152 | #echo $RC_STACK_METRICS_EXT |
|
7152 | #echo $RC_STACK_METRICS_EXT | |
7153 | #echo $RC_STACK_RHODECODE_EXT |
|
7153 | #echo $RC_STACK_RHODECODE_EXT | |
7154 | #echo "3 -----" |
|
7154 | #echo "3 -----" | |
7155 |
|
7155 | |||
7156 | #env | grep RC_ |
|
7156 | #env | grep RC_ | |
7157 |
|
7157 | |||
7158 | docker_ping_host() { |
|
7158 | docker_ping_host() { | |
7159 | PING_HOST="$1" |
|
7159 | PING_HOST="$1" | |
7160 | docker run --network rhodecode_network --rm alpine ping "$PING_HOST" |
|
7160 | docker run --network rhodecode_network --rm alpine ping "$PING_HOST" | |
7161 | } |
|
7161 | } | |
7162 |
|
7162 | |||
7163 | get_started() { |
|
7163 | get_started() { | |
7164 | echo "" |
|
7164 | echo "" | |
7165 | echo "To start using RhodeCode run the following stacks using './$RC_SCRIPT_NAME stack [STACK_NAME]'" |
|
7165 | echo "To start using RhodeCode run the following stacks using './$RC_SCRIPT_NAME stack [STACK_NAME]'" | |
7166 | echo "Check './$RC_SCRIPT_NAME stack --help' for more examples and options" |
|
7166 | echo "Check './$RC_SCRIPT_NAME stack --help' for more examples and options" | |
7167 | echo "$(green_bold IMPORTANT): init command generates some secrets/config inside $RUNTIME_ENV file." |
|
7167 | echo "$(green_bold IMPORTANT): init command generates some secrets/config inside $RUNTIME_ENV file." | |
7168 | echo "Check and adjust those settings if needed." |
|
7168 | echo "Check and adjust those settings if needed." | |
7169 | echo "" |
|
7169 | echo "" | |
7170 | echo "$(bold Run the stacks in following order):" |
|
7170 | echo "$(bold Run the stacks in following order):" | |
|
7171 | echo "$(bold [NOTE]): Instead of running stacks independent, one can use shorthand to run all stacks in order (detached with -d)" | |||
|
7172 | echo "./$RC_SCRIPT_NAME stack all up -d" | |||
7171 | echo "" |
|
7173 | echo "" | |
7172 | echo "$(green_bold 1\) router [Mandatory]): run the edge router to control stack traffic / domain access and optionally SSL termination" |
|
7174 | echo "$(green_bold 1\) router [Mandatory]): run the edge router to control stack traffic / domain access and optionally SSL termination" | |
7173 | echo "IMPORTANT: router binds to some common ports 80, 443, SSH (9022), Loki (3100) if those are not available, please adjust them" |
|
7175 | echo "IMPORTANT: router binds to some common ports 80, 443, SSH (9022), Loki (3100) if those are not available, please adjust them" | |
7174 | echo "To configure this stack before running check: $RC_STACK_ROUTER_EXT" |
|
7176 | echo "To configure this stack before running check: $RC_STACK_ROUTER_EXT" | |
7175 | echo "" |
|
7177 | echo "" | |
7176 | echo "./$RC_SCRIPT_NAME stack router up --detach" |
|
7178 | echo "./$RC_SCRIPT_NAME stack router up --detach" | |
7177 | echo "" |
|
7179 | echo "" | |
7178 | echo "$(green_bold 2\) services [Mandatory]): run the services, like database, redis, channelstream etc..." |
|
7180 | echo "$(green_bold 2\) services [Mandatory]): run the services, like database, redis, channelstream etc..." | |
7179 | echo "IMPORTANT: if you like to run your own database, or redis please adjust before running" |
|
7181 | echo "IMPORTANT: if you like to run your own database, or redis please adjust before running" | |
7180 | echo "To configure this stack before running check: $RC_STACK_SERVICES_EXT" |
|
7182 | echo "To configure this stack before running check: $RC_STACK_SERVICES_EXT" | |
7181 | echo "" |
|
7183 | echo "" | |
7182 | echo "./$RC_SCRIPT_NAME stack services up --detach" |
|
7184 | echo "./$RC_SCRIPT_NAME stack services up --detach" | |
7183 | echo "" |
|
7185 | echo "" | |
7184 | echo "$(green_bold 3\) rhodecode [Mandatory]): run the rhodecode app stack" |
|
7186 | echo "$(green_bold 3\) rhodecode [Mandatory]): run the rhodecode app stack" | |
7185 | echo "To configure this stack before running check: $RC_STACK_RHODECODE_EXT" |
|
7187 | echo "To configure this stack before running check: $RC_STACK_RHODECODE_EXT" | |
7186 | echo "" |
|
7188 | echo "" | |
7187 | echo "./$RC_SCRIPT_NAME stack rhodecode up --detach" |
|
7189 | echo "./$RC_SCRIPT_NAME stack rhodecode up --detach" | |
7188 | echo "" |
|
7190 | echo "" | |
7189 | echo "$(yellow_bold 4\) metrics [Optional]): run the monitoring stack, this includes grafana/prometheus logging/metrics system" |
|
7191 | echo "$(yellow_bold 4\) metrics [Optional]): run the monitoring stack, this includes grafana/prometheus logging/metrics system" | |
7190 | echo "To configure this stack before running check: $RC_STACK_METRICS_EXT" |
|
7192 | echo "To configure this stack before running check: $RC_STACK_METRICS_EXT" | |
7191 | echo "" |
|
7193 | echo "" | |
7192 | echo "./$RC_SCRIPT_NAME stack metrics up --detach" |
|
7194 | echo "./$RC_SCRIPT_NAME stack metrics up --detach" | |
7193 | echo "" |
|
7195 | echo "" | |
7194 | echo "$(bold [Status]): check services run status, ports etc.." |
|
7196 | echo "$(bold [Status]): check services run status, ports etc.." | |
7195 | echo "./$RC_SCRIPT_NAME status -v --configs" |
|
7197 | echo "./$RC_SCRIPT_NAME status -v --configs" | |
7196 | echo "" |
|
7198 | echo "" | |
7197 | echo "$(bold [All]): shorthand to run all stacks (detached with -d)" |
|
|||
7198 | echo "./$RC_SCRIPT_NAME stack all up -d" |
|
|||
7199 | echo "" |
|
|||
7200 | echo "$(bold [Logs]): check service logs" |
|
7199 | echo "$(bold [Logs]): check service logs" | |
7201 | echo "./$RC_SCRIPT_NAME stack [STACK_NAME] logs" |
|
7200 | echo "./$RC_SCRIPT_NAME stack [STACK_NAME] logs" | |
7202 | } |
|
7201 | } | |
7203 |
|
7202 | |||
7204 | get_started_full() { |
|
7203 | get_started_full() { | |
7205 | echo "$(blue_bold [~~~~ GET STARTED ~~~~~])" |
|
7204 | echo "$(blue_bold [~~~~ GET STARTED ~~~~~])" | |
7206 | echo "$(green_bold Having problems / need help? Reach out to us here:) https://community.rhodecode.com" |
|
7205 | echo "$(green_bold Having problems / need help? Reach out to us here:) https://community.rhodecode.com" | |
7207 | echo "" |
|
7206 | echo "" | |
7208 | echo "./$RC_SCRIPT_NAME is a CLI based installer/manager for RhodeCode Cluster Stack" |
|
7207 | echo "./$RC_SCRIPT_NAME is a CLI based installer/manager for RhodeCode Cluster Stack" | |
7209 | echo "./$RC_SCRIPT_NAME -h is your friend, in case of doubt, check examples and usage options with -h / --help flag" |
|
7208 | echo "./$RC_SCRIPT_NAME -h is your friend, in case of doubt, check examples and usage options with -h / --help flag" | |
7210 | echo "" |
|
7209 | echo "" | |
7211 | echo "$(yellow_bold [First time run])" |
|
7210 | echo "$(yellow_bold [First time run])" | |
7212 | echo "run './$RC_SCRIPT_NAME init' to setup docker and download required installer files." |
|
7211 | echo "run './$RC_SCRIPT_NAME init' to setup docker and download required installer files." | |
7213 | echo "./$RC_SCRIPT_NAME can install Docker for you, or install it manually before running init command" |
|
7212 | echo "./$RC_SCRIPT_NAME can install Docker for you, or install it manually before running init command" | |
7214 |
|
7213 | |||
7215 | get_started |
|
7214 | get_started | |
7216 | } |
|
7215 | } | |
7217 |
|
7216 | |||
7218 | } |
|
7217 | } | |
7219 |
|
7218 | |||
7220 | # :command.run |
|
7219 | # :command.run | |
7221 | run() { |
|
7220 | run() { | |
7222 | declare -A args=() |
|
7221 | declare -A args=() | |
7223 | declare -A deps=() |
|
7222 | declare -A deps=() | |
7224 | declare -a other_args=() |
|
7223 | declare -a other_args=() | |
7225 | declare -a input=() |
|
7224 | declare -a input=() | |
7226 | normalize_input "$@" |
|
7225 | normalize_input "$@" | |
7227 | parse_requirements "${input[@]}" |
|
7226 | parse_requirements "${input[@]}" | |
7228 |
|
7227 | |||
7229 | case "$action" in |
|
7228 | case "$action" in | |
7230 | "get-started") rcstack_get_started_command ;; |
|
7229 | "get-started") rcstack_get_started_command ;; | |
7231 | "init") rcstack_init_command ;; |
|
7230 | "init") rcstack_init_command ;; | |
7232 | "self-update") rcstack_self_update_command ;; |
|
7231 | "self-update") rcstack_self_update_command ;; | |
7233 | "stack") rcstack_stack_command ;; |
|
7232 | "stack") rcstack_stack_command ;; | |
7234 | "stack router") rcstack_stack_router_command ;; |
|
7233 | "stack router") rcstack_stack_router_command ;; | |
7235 | "stack metrics") rcstack_stack_metrics_command ;; |
|
7234 | "stack metrics") rcstack_stack_metrics_command ;; | |
7236 | "stack services") rcstack_stack_services_command ;; |
|
7235 | "stack services") rcstack_stack_services_command ;; | |
7237 | "stack rhodecode") rcstack_stack_rhodecode_command ;; |
|
7236 | "stack rhodecode") rcstack_stack_rhodecode_command ;; | |
7238 | "stack all") rcstack_stack_all_command ;; |
|
7237 | "stack all") rcstack_stack_all_command ;; | |
7239 | "stack-status") rcstack_stack_status_command ;; |
|
7238 | "stack-status") rcstack_stack_status_command ;; | |
7240 | "stack-upgrade") rcstack_stack_upgrade_command ;; |
|
7239 | "stack-upgrade") rcstack_stack_upgrade_command ;; | |
7241 | "stack-upgrade router") rcstack_stack_upgrade_router_command ;; |
|
7240 | "stack-upgrade router") rcstack_stack_upgrade_router_command ;; | |
7242 | "stack-upgrade services") rcstack_stack_upgrade_services_command ;; |
|
7241 | "stack-upgrade services") rcstack_stack_upgrade_services_command ;; | |
7243 | "stack-upgrade metrics") rcstack_stack_upgrade_metrics_command ;; |
|
7242 | "stack-upgrade metrics") rcstack_stack_upgrade_metrics_command ;; | |
7244 | "stack-upgrade rhodecode") rcstack_stack_upgrade_rhodecode_command ;; |
|
7243 | "stack-upgrade rhodecode") rcstack_stack_upgrade_rhodecode_command ;; | |
7245 | "stack-monitor") rcstack_stack_monitor_command ;; |
|
7244 | "stack-monitor") rcstack_stack_monitor_command ;; | |
7246 | "stack-monitor restart-unhealthy") rcstack_stack_monitor_restart_unhealthy_command ;; |
|
7245 | "stack-monitor restart-unhealthy") rcstack_stack_monitor_restart_unhealthy_command ;; | |
7247 | "cli") rcstack_cli_command ;; |
|
7246 | "cli") rcstack_cli_command ;; | |
7248 | "cli cmd") rcstack_cli_cmd_command ;; |
|
7247 | "cli cmd") rcstack_cli_cmd_command ;; | |
7249 | "cli ishell") rcstack_cli_ishell_command ;; |
|
7248 | "cli ishell") rcstack_cli_ishell_command ;; | |
7250 | "cli image-info") rcstack_cli_image_info_command ;; |
|
7249 | "cli image-info") rcstack_cli_image_info_command ;; | |
7251 | "cli set-runtime-image") rcstack_cli_set_runtime_image_command ;; |
|
7250 | "cli set-runtime-image") rcstack_cli_set_runtime_image_command ;; | |
7252 | "cli docker-info") rcstack_cli_docker_info_command ;; |
|
7251 | "cli docker-info") rcstack_cli_docker_info_command ;; | |
7253 | "cli docker-upgrade") rcstack_cli_docker_upgrade_command ;; |
|
7252 | "cli docker-upgrade") rcstack_cli_docker_upgrade_command ;; | |
7254 | "cli redis") rcstack_cli_redis_command ;; |
|
7253 | "cli redis") rcstack_cli_redis_command ;; | |
7255 | "cli db") rcstack_cli_db_command ;; |
|
7254 | "cli db") rcstack_cli_db_command ;; | |
7256 | "cli db-upgrade") rcstack_cli_db_upgrade_command ;; |
|
7255 | "cli db-upgrade") rcstack_cli_db_upgrade_command ;; | |
7257 | "cli storage") rcstack_cli_storage_command ;; |
|
7256 | "cli storage") rcstack_cli_storage_command ;; | |
7258 | "cli attach") rcstack_cli_attach_command ;; |
|
7257 | "cli attach") rcstack_cli_attach_command ;; | |
7259 | "cli set-edition") rcstack_cli_set_edition_command ;; |
|
7258 | "cli set-edition") rcstack_cli_set_edition_command ;; | |
7260 | "cli configure-vcsserver") rcstack_cli_configure_vcsserver_command ;; |
|
7259 | "cli configure-vcsserver") rcstack_cli_configure_vcsserver_command ;; | |
7261 | "cli configure-rhodecode") rcstack_cli_configure_rhodecode_command ;; |
|
7260 | "cli configure-rhodecode") rcstack_cli_configure_rhodecode_command ;; | |
7262 | "backup-db") rcstack_backup_db_command ;; |
|
7261 | "backup-db") rcstack_backup_db_command ;; | |
7263 | "backup-data") rcstack_backup_data_command ;; |
|
7262 | "backup-data") rcstack_backup_data_command ;; | |
7264 | "_completions") rcstack__completions_command ;; |
|
7263 | "_completions") rcstack__completions_command ;; | |
7265 | esac |
|
7264 | esac | |
7266 | } |
|
7265 | } | |
7267 |
|
7266 | |||
7268 | initialize |
|
7267 | initialize | |
7269 | run "$@" |
|
7268 | run "$@" |
General Comments 0
You need to be logged in to leave comments.
Login now