Show More
@@ -1,7596 +1,7604 b'' | |||||
1 | #!/usr/bin/env bash |
|
1 | #!/usr/bin/env bash | |
2 | # This script was generated |
|
2 | # This script was generated | |
3 | # Modifying it manually is not recommended |
|
3 | # Modifying it manually is not recommended | |
4 |
|
4 | |||
5 | check_bash_version() { |
|
5 | check_bash_version() { | |
6 | if [ ! "${BASH_VERSINFO:-0}" -ge 4 ]; then |
|
6 | if [ ! "${BASH_VERSINFO:-0}" -ge 4 ]; then | |
7 | echo "Bash version 4 or greater is required (got ${BASH_VERSINFO}), please update your bash version!" |
|
7 | echo "Bash version 4 or greater is required (got ${BASH_VERSINFO}), please update your bash version!" | |
8 | exit 1 |
|
8 | exit 1 | |
9 | fi |
|
9 | fi | |
10 | } |
|
10 | } | |
11 | check_bash_version |
|
11 | check_bash_version | |
12 |
|
12 | |||
13 | # :command.master_script |
|
13 | # :command.master_script | |
14 |
|
14 | |||
15 | # :command.version_command |
|
15 | # :command.version_command | |
16 | version_command() { |
|
16 | version_command() { | |
17 | echo "$version" |
|
17 | echo "$version" | |
18 | } |
|
18 | } | |
19 |
|
19 | |||
20 | # :command.usage |
|
20 | # :command.usage | |
21 | rcstack_usage() { |
|
21 | rcstack_usage() { | |
22 | if [[ -n $long_usage ]]; then |
|
22 | if [[ -n $long_usage ]]; then | |
23 | printf "rcstack\n" |
|
23 | printf "rcstack\n" | |
24 | echo |
|
24 | echo | |
25 |
|
25 | |||
26 | printf " CLI for installing and managing RhodeCode Cluster Stack \nSupport:\n https://community.rhodecode.com\nDocs: https://docs.rhodecode.com/rcstack\n" |
|
26 | printf " CLI for installing and managing RhodeCode Cluster Stack \nSupport:\n https://community.rhodecode.com\nDocs: https://docs.rhodecode.com/rcstack\n" | |
27 | echo |
|
27 | echo | |
28 |
|
28 | |||
29 | else |
|
29 | else | |
30 | printf "rcstack - CLI for installing and managing RhodeCode Cluster Stack \nSupport: https://community.rhodecode.com\nDocs: https://docs.rhodecode.com/rcstack\n" |
|
30 | printf "rcstack - CLI for installing and managing RhodeCode Cluster Stack \nSupport: https://community.rhodecode.com\nDocs: https://docs.rhodecode.com/rcstack\n" | |
31 | echo |
|
31 | echo | |
32 |
|
32 | |||
33 | fi |
|
33 | fi | |
34 |
|
34 | |||
35 | printf "%s\n" "Usage:" |
|
35 | printf "%s\n" "Usage:" | |
36 | printf " rcstack [OPTIONS] COMMAND\n" |
|
36 | printf " rcstack [OPTIONS] COMMAND\n" | |
37 | printf " rcstack [COMMAND] --help | -h\n" |
|
37 | printf " rcstack [COMMAND] --help | -h\n" | |
38 | printf " rcstack --version | -v\n" |
|
38 | printf " rcstack --version | -v\n" | |
39 | echo |
|
39 | echo | |
40 | # :command.usage_commands |
|
40 | # :command.usage_commands | |
41 | printf "%s\n" "Commands:" |
|
41 | printf "%s\n" "Commands:" | |
42 | printf " %s Print instructions to get started with rhodecode docker stack\n" "get-started " |
|
42 | printf " %s Print instructions to get started with rhodecode docker stack\n" "get-started " | |
43 | printf " %s Bootstrap this machine, check docker version and install rhodecode-network\n" "init " |
|
43 | printf " %s Bootstrap this machine, check docker version and install rhodecode-network\n" "init " | |
44 | printf " %s Update rcstack and it's docker definitions\n" "self-update " |
|
44 | printf " %s Update rcstack and it's docker definitions\n" "self-update " | |
45 | echo |
|
45 | echo | |
46 | printf "%s\n" "Stack Commands:" |
|
46 | printf "%s\n" "Stack Commands:" | |
47 | printf " %s Run one of available cluster stacks, run stack -h for more details\n" "stack " |
|
47 | printf " %s Run one of available cluster stacks, run stack -h for more details\n" "stack " | |
48 | printf " %s Show stack status\n" "stack-status " |
|
48 | printf " %s Show stack status\n" "stack-status " | |
49 | printf " %s Upgrade a stack, run stack-upgrade -h for more details\n" "stack-upgrade " |
|
49 | printf " %s Upgrade a stack, run stack-upgrade -h for more details\n" "stack-upgrade " | |
50 | printf " %s run monitoring on stack items\n" "stack-monitor " |
|
50 | printf " %s run monitoring on stack items\n" "stack-monitor " | |
51 | echo |
|
51 | echo | |
52 | printf "%s\n" "CLI Commands:" |
|
52 | printf "%s\n" "CLI Commands:" | |
53 | printf " %s Various CLI tools, run cli -h for more details\n" "cli " |
|
53 | printf " %s Various CLI tools, run cli -h for more details\n" "cli " | |
54 | echo |
|
54 | echo | |
55 | printf "%s\n" "Backup Commands:" |
|
55 | printf "%s\n" "Backup Commands:" | |
56 | printf " %s Backup Database\n" "backup-db " |
|
56 | printf " %s Backup Database\n" "backup-db " | |
57 | printf " %s Backup RhodeCode storage\n" "backup-data " |
|
57 | printf " %s Backup RhodeCode storage\n" "backup-data " | |
58 | echo |
|
58 | echo | |
59 | printf "%s\n" "Build Commands:" |
|
59 | printf "%s\n" "Build Commands:" | |
60 | printf " %s Fetch Artifacts to run installer based build\n" "get-build-artifacts" |
|
60 | printf " %s Fetch Artifacts to run installer based build\n" "get-build-artifacts" | |
61 | printf " %s Build RhodeCode image from installer, ./rcstack get-build-artifacts initially\n" "build-installer " |
|
61 | printf " %s Build RhodeCode image from installer, ./rcstack get-build-artifacts initially\n" "build-installer " | |
62 | printf " %s Fetch RhodeCode sources, store in .source dir to run a source-based builds\n" "get-build-source " |
|
62 | printf " %s Fetch RhodeCode sources, store in .source dir to run a source-based builds\n" "get-build-source " | |
63 | printf " %s Build RhodeCode image from source, requires ./rcstack get-build-source initially\n" "build-source " |
|
63 | printf " %s Build RhodeCode image from source, requires ./rcstack get-build-source initially\n" "build-source " | |
64 | echo |
|
64 | echo | |
65 |
|
65 | |||
66 | # :command.long_usage |
|
66 | # :command.long_usage | |
67 | if [[ -n $long_usage ]]; then |
|
67 | if [[ -n $long_usage ]]; then | |
68 | printf "%s\n" "Options:" |
|
68 | printf "%s\n" "Options:" | |
69 |
|
69 | |||
70 | # :command.usage_flags |
|
70 | # :command.usage_flags | |
71 | # :flag.usage |
|
71 | # :flag.usage | |
72 | printf " %s\n" "--debug" |
|
72 | printf " %s\n" "--debug" | |
73 | printf " Enable debug and detailed output,\n" |
|
73 | printf " Enable debug and detailed output,\n" | |
74 | echo |
|
74 | echo | |
75 |
|
75 | |||
76 | # :flag.usage |
|
76 | # :flag.usage | |
77 | printf " %s\n" "--no-init-check" |
|
77 | printf " %s\n" "--no-init-check" | |
78 | printf " Skip check for ./rcstack init call\n" |
|
78 | printf " Skip check for ./rcstack init call\n" | |
79 | echo |
|
79 | echo | |
80 |
|
80 | |||
81 | # :command.usage_fixed_flags |
|
81 | # :command.usage_fixed_flags | |
82 | printf " %s\n" "--help, -h" |
|
82 | printf " %s\n" "--help, -h" | |
83 | printf " Show this help\n" |
|
83 | printf " Show this help\n" | |
84 | echo |
|
84 | echo | |
85 | printf " %s\n" "--version, -v" |
|
85 | printf " %s\n" "--version, -v" | |
86 | printf " Show version number\n" |
|
86 | printf " Show version number\n" | |
87 | echo |
|
87 | echo | |
88 |
|
88 | |||
89 | # :command.usage_environment_variables |
|
89 | # :command.usage_environment_variables | |
90 | printf "%s\n" "Environment Variables:" |
|
90 | printf "%s\n" "Environment Variables:" | |
91 |
|
91 | |||
92 | # :environment_variable.usage |
|
92 | # :environment_variable.usage | |
93 | printf " %s\n" "RCC_CONFIG" |
|
93 | printf " %s\n" "RCC_CONFIG" | |
94 | printf " default config file for rcstack\n" |
|
94 | printf " default config file for rcstack\n" | |
95 | printf " Default: .rcstack.ini\n" |
|
95 | printf " Default: .rcstack.ini\n" | |
96 | echo |
|
96 | echo | |
97 |
|
97 | |||
98 | # :environment_variable.usage |
|
98 | # :environment_variable.usage | |
99 | printf " %s\n" "AUTH_TOKEN" |
|
99 | printf " %s\n" "AUTH_TOKEN" | |
100 | printf " Set your RhodeCode AUTH Token\n" |
|
100 | printf " Set your RhodeCode AUTH Token\n" | |
101 | echo |
|
101 | echo | |
102 |
|
102 | |||
103 | # :environment_variable.usage |
|
103 | # :environment_variable.usage | |
104 | printf " %s\n" "RC_STACK_ROUTER_EXT" |
|
104 | printf " %s\n" "RC_STACK_ROUTER_EXT" | |
105 | printf "\n" |
|
105 | printf "\n" | |
106 | printf " Default: .custom/docker-compose-router.override.yaml\n" |
|
106 | printf " Default: .custom/docker-compose-router.override.yaml\n" | |
107 | echo |
|
107 | echo | |
108 |
|
108 | |||
109 | # :environment_variable.usage |
|
109 | # :environment_variable.usage | |
110 | printf " %s\n" "RC_STACK_METRICS_EXT" |
|
110 | printf " %s\n" "RC_STACK_METRICS_EXT" | |
111 | printf "\n" |
|
111 | printf "\n" | |
112 | printf " Default: .custom/docker-compose-metrics.override.yaml\n" |
|
112 | printf " Default: .custom/docker-compose-metrics.override.yaml\n" | |
113 | echo |
|
113 | echo | |
114 |
|
114 | |||
115 | # :environment_variable.usage |
|
115 | # :environment_variable.usage | |
116 | printf " %s\n" "RC_STACK_SERVICES_EXT" |
|
116 | printf " %s\n" "RC_STACK_SERVICES_EXT" | |
117 | printf "\n" |
|
117 | printf "\n" | |
118 | printf " Default: .custom/docker-compose-services.override.yaml\n" |
|
118 | printf " Default: .custom/docker-compose-services.override.yaml\n" | |
119 | echo |
|
119 | echo | |
120 |
|
120 | |||
121 | # :environment_variable.usage |
|
121 | # :environment_variable.usage | |
122 | printf " %s\n" "RC_STACK_RHODECODE_EXT" |
|
122 | printf " %s\n" "RC_STACK_RHODECODE_EXT" | |
123 | printf "\n" |
|
123 | printf "\n" | |
124 | printf " Default: .custom/docker-compose-apps.override.yaml\n" |
|
124 | printf " Default: .custom/docker-compose-apps.override.yaml\n" | |
125 | echo |
|
125 | echo | |
126 |
|
126 | |||
127 | # :command.footer |
|
127 | # :command.footer | |
128 | printf "RhodeCode Inc 2023\n\n" |
|
128 | printf "RhodeCode Inc 2023\n\n" | |
129 | echo |
|
129 | echo | |
130 |
|
130 | |||
131 | fi |
|
131 | fi | |
132 | } |
|
132 | } | |
133 |
|
133 | |||
134 | # :command.usage |
|
134 | # :command.usage | |
135 | rcstack_get_started_usage() { |
|
135 | rcstack_get_started_usage() { | |
136 | if [[ -n $long_usage ]]; then |
|
136 | if [[ -n $long_usage ]]; then | |
137 | printf "rcstack get-started - Print instructions to get started with rhodecode docker stack\n" |
|
137 | printf "rcstack get-started - Print instructions to get started with rhodecode docker stack\n" | |
138 | echo |
|
138 | echo | |
139 |
|
139 | |||
140 | else |
|
140 | else | |
141 | printf "rcstack get-started - Print instructions to get started with rhodecode docker stack\n" |
|
141 | printf "rcstack get-started - Print instructions to get started with rhodecode docker stack\n" | |
142 | echo |
|
142 | echo | |
143 |
|
143 | |||
144 | fi |
|
144 | fi | |
145 |
|
145 | |||
146 | printf "%s\n" "Usage:" |
|
146 | printf "%s\n" "Usage:" | |
147 | printf " rcstack get-started\n" |
|
147 | printf " rcstack get-started\n" | |
148 | printf " rcstack get-started --help | -h\n" |
|
148 | printf " rcstack get-started --help | -h\n" | |
149 | echo |
|
149 | echo | |
150 |
|
150 | |||
151 | # :command.long_usage |
|
151 | # :command.long_usage | |
152 | if [[ -n $long_usage ]]; then |
|
152 | if [[ -n $long_usage ]]; then | |
153 | printf "%s\n" "Options:" |
|
153 | printf "%s\n" "Options:" | |
154 |
|
154 | |||
155 | # :command.usage_fixed_flags |
|
155 | # :command.usage_fixed_flags | |
156 | printf " %s\n" "--help, -h" |
|
156 | printf " %s\n" "--help, -h" | |
157 | printf " Show this help\n" |
|
157 | printf " Show this help\n" | |
158 | echo |
|
158 | echo | |
159 |
|
159 | |||
160 | fi |
|
160 | fi | |
161 | } |
|
161 | } | |
162 |
|
162 | |||
163 | # :command.usage |
|
163 | # :command.usage | |
164 | rcstack_init_usage() { |
|
164 | rcstack_init_usage() { | |
165 | if [[ -n $long_usage ]]; then |
|
165 | if [[ -n $long_usage ]]; then | |
166 | printf "rcstack init - Bootstrap this machine, check docker version and install rhodecode-network\n" |
|
166 | printf "rcstack init - Bootstrap this machine, check docker version and install rhodecode-network\n" | |
167 | echo |
|
167 | echo | |
168 |
|
168 | |||
169 | else |
|
169 | else | |
170 | printf "rcstack init - Bootstrap this machine, check docker version and install rhodecode-network\n" |
|
170 | printf "rcstack init - Bootstrap this machine, check docker version and install rhodecode-network\n" | |
171 | echo |
|
171 | echo | |
172 |
|
172 | |||
173 | fi |
|
173 | fi | |
174 |
|
174 | |||
175 | printf "%s\n" "Usage:" |
|
175 | printf "%s\n" "Usage:" | |
176 | printf " rcstack init [OPTIONS]\n" |
|
176 | printf " rcstack init [OPTIONS]\n" | |
177 | printf " rcstack init --help | -h\n" |
|
177 | printf " rcstack init --help | -h\n" | |
178 | echo |
|
178 | echo | |
179 |
|
179 | |||
180 | # :command.long_usage |
|
180 | # :command.long_usage | |
181 | if [[ -n $long_usage ]]; then |
|
181 | if [[ -n $long_usage ]]; then | |
182 | printf "%s\n" "Options:" |
|
182 | printf "%s\n" "Options:" | |
183 |
|
183 | |||
184 | # :command.usage_flags |
|
184 | # :command.usage_flags | |
185 | # :flag.usage |
|
185 | # :flag.usage | |
186 | printf " %s\n" "--arg-rc-edition ARG_RC_EDITION" |
|
186 | printf " %s\n" "--arg-rc-edition ARG_RC_EDITION" | |
187 | printf " specify rc_edition [ee|ce] for setup\n" |
|
187 | printf " specify rc_edition [ee|ce] for setup\n" | |
188 | echo |
|
188 | echo | |
189 |
|
189 | |||
190 | # :flag.usage |
|
190 | # :flag.usage | |
191 | printf " %s\n" "--arg-hostname ARG_HOSTNAME" |
|
191 | printf " %s\n" "--arg-hostname ARG_HOSTNAME" | |
192 | printf " specify hostname [hostname.example.com] for setup\n" |
|
192 | printf " specify hostname [hostname.example.com] for setup\n" | |
193 | echo |
|
193 | echo | |
194 |
|
194 | |||
195 | # :flag.usage |
|
195 | # :flag.usage | |
196 | printf " %s\n" "--arg-use-ssl ARG_USE_SSL" |
|
196 | printf " %s\n" "--arg-use-ssl ARG_USE_SSL" | |
197 | printf " specify use_ssl [y|n] for setup\n" |
|
197 | printf " specify use_ssl [y|n] for setup\n" | |
198 | echo |
|
198 | echo | |
199 |
|
199 | |||
200 | # :flag.usage |
|
200 | # :flag.usage | |
201 | printf " %s\n" "--arg-admin-email ARG_ADMIN_EMAIL" |
|
201 | printf " %s\n" "--arg-admin-email ARG_ADMIN_EMAIL" | |
202 | printf " specify admin_email [foo@example.com] for setup\n" |
|
202 | printf " specify admin_email [foo@example.com] for setup\n" | |
203 | echo |
|
203 | echo | |
204 |
|
204 | |||
205 | # :flag.usage |
|
205 | # :flag.usage | |
206 | printf " %s\n" "--arg-admin-user ARG_ADMIN_USER" |
|
206 | printf " %s\n" "--arg-admin-user ARG_ADMIN_USER" | |
207 | printf " specify admin_user [admin] for setup\n" |
|
207 | printf " specify admin_user [admin] for setup\n" | |
208 | echo |
|
208 | echo | |
209 |
|
209 | |||
210 | # :flag.usage |
|
210 | # :flag.usage | |
211 | printf " %s\n" "--arg-admin-pass ARG_ADMIN_PASS" |
|
211 | printf " %s\n" "--arg-admin-pass ARG_ADMIN_PASS" | |
212 | printf " specify admin_pass [secretpassword] for setup\n" |
|
212 | printf " specify admin_pass [secretpassword] for setup\n" | |
213 | echo |
|
213 | echo | |
214 |
|
214 | |||
215 | # :flag.usage |
|
215 | # :flag.usage | |
216 | printf " %s\n" "--arg-license-token ARG_ADMIN_TOKEN" |
|
216 | printf " %s\n" "--arg-license-token ARG_ADMIN_TOKEN" | |
217 | printf " specify license_token [abcd-abcd-abcd-abcd] for setup\n" |
|
217 | printf " specify license_token [abcd-abcd-abcd-abcd] for setup\n" | |
218 | echo |
|
218 | echo | |
219 |
|
219 | |||
220 | # :flag.usage |
|
220 | # :flag.usage | |
221 | printf " %s\n" "--no-prompt" |
|
221 | printf " %s\n" "--no-prompt" | |
222 | printf " Don't use interactive prompt to ask setup questions. Use defaults instead\n" |
|
222 | printf " Don't use interactive prompt to ask setup questions. Use defaults instead\n" | |
223 | echo |
|
223 | echo | |
224 |
|
224 | |||
225 | # :flag.usage |
|
225 | # :flag.usage | |
226 | printf " %s\n" "--force, -f" |
|
226 | printf " %s\n" "--force, -f" | |
227 | printf " Overwrite existing files\n" |
|
227 | printf " Overwrite existing files\n" | |
228 | echo |
|
228 | echo | |
229 |
|
229 | |||
230 | # :flag.usage |
|
230 | # :flag.usage | |
231 | printf " %s\n" "--stage STAGE (repeatable)" |
|
231 | printf " %s\n" "--stage STAGE (repeatable)" | |
232 | printf " specify one or more stages to run\n" |
|
232 | printf " specify one or more stages to run\n" | |
233 | echo |
|
233 | echo | |
234 |
|
234 | |||
235 | # :flag.usage |
|
235 | # :flag.usage | |
236 | printf " %s\n" "--docker-revision DOCKER_REVISION" |
|
236 | printf " %s\n" "--docker-revision DOCKER_REVISION" | |
237 | printf " revision to fetch new docker definitions.\n" |
|
237 | printf " revision to fetch new docker definitions.\n" | |
238 | printf " Default: stable\n" |
|
238 | printf " Default: stable\n" | |
239 | echo |
|
239 | echo | |
240 |
|
240 | |||
241 | # :flag.usage |
|
241 | # :flag.usage | |
242 | printf " %s\n" "--install-docker INSTALL_DOCKER" |
|
242 | printf " %s\n" "--install-docker INSTALL_DOCKER" | |
243 | printf " answer [y]es or [n]o to question to install docker\n" |
|
243 | printf " answer [y]es or [n]o to question to install docker\n" | |
244 | echo |
|
244 | echo | |
245 |
|
245 | |||
246 | # :flag.usage |
|
246 | # :flag.usage | |
247 | printf " %s\n" "--server-url SERVER_URL" |
|
247 | printf " %s\n" "--server-url SERVER_URL" | |
248 | printf " Specify RhodeCode server location where the rcstack archive should be\n downloaded from\n" |
|
248 | printf " Specify RhodeCode server location where the rcstack archive should be\n downloaded from\n" | |
249 | printf " Default: https://dls.rhodecode.com/get_archive\n" |
|
249 | printf " Default: https://dls.rhodecode.com/get_archive\n" | |
250 | echo |
|
250 | echo | |
251 |
|
251 | |||
252 | # :flag.usage |
|
252 | # :flag.usage | |
253 | printf " %s\n" "--auth-token AUTH_TOKEN" |
|
253 | printf " %s\n" "--auth-token AUTH_TOKEN" | |
254 | printf " Optionally specify AUTH TOKEN to obtain sources\n" |
|
254 | printf " Optionally specify AUTH TOKEN to obtain sources\n" | |
255 | echo |
|
255 | echo | |
256 |
|
256 | |||
257 | # :command.usage_fixed_flags |
|
257 | # :command.usage_fixed_flags | |
258 | printf " %s\n" "--help, -h" |
|
258 | printf " %s\n" "--help, -h" | |
259 | printf " Show this help\n" |
|
259 | printf " Show this help\n" | |
260 | echo |
|
260 | echo | |
261 |
|
261 | |||
262 | # :command.usage_examples |
|
262 | # :command.usage_examples | |
263 | printf "%s\n" "Examples:" |
|
263 | printf "%s\n" "Examples:" | |
264 | printf " - ./rcstack init\n - ./rcstack init --force\n # non-interactive mode to say yes to install docker question [n] always does\n not install docker\n - ./rcstack init --install-docker=y\n # non-interactive mode to answer setup questions use --help to check all\n --arg-NAME options\n - ./rcstack init --install-docker=y --arg-hostname=docker-dev --arg-use-ssl=n\n --arg-rc-edition=ee\n" |
|
264 | printf " - ./rcstack init\n - ./rcstack init --force\n # non-interactive mode to say yes to install docker question [n] always does\n not install docker\n - ./rcstack init --install-docker=y\n # non-interactive mode to answer setup questions use --help to check all\n --arg-NAME options\n - ./rcstack init --install-docker=y --arg-hostname=docker-dev --arg-use-ssl=n\n --arg-rc-edition=ee\n" | |
265 | echo |
|
265 | echo | |
266 |
|
266 | |||
267 | fi |
|
267 | fi | |
268 | } |
|
268 | } | |
269 |
|
269 | |||
270 | # :command.usage |
|
270 | # :command.usage | |
271 | rcstack_self_update_usage() { |
|
271 | rcstack_self_update_usage() { | |
272 | if [[ -n $long_usage ]]; then |
|
272 | if [[ -n $long_usage ]]; then | |
273 | printf "rcstack self-update - Update rcstack and it's docker definitions\n" |
|
273 | printf "rcstack self-update - Update rcstack and it's docker definitions\n" | |
274 | echo |
|
274 | echo | |
275 |
|
275 | |||
276 | else |
|
276 | else | |
277 | printf "rcstack self-update - Update rcstack and it's docker definitions\n" |
|
277 | printf "rcstack self-update - Update rcstack and it's docker definitions\n" | |
278 | echo |
|
278 | echo | |
279 |
|
279 | |||
280 | fi |
|
280 | fi | |
281 |
|
281 | |||
282 | printf "%s\n" "Usage:" |
|
282 | printf "%s\n" "Usage:" | |
283 | printf " rcstack self-update [OPTIONS]\n" |
|
283 | printf " rcstack self-update [OPTIONS]\n" | |
284 | printf " rcstack self-update --help | -h\n" |
|
284 | printf " rcstack self-update --help | -h\n" | |
285 | echo |
|
285 | echo | |
286 |
|
286 | |||
287 | # :command.long_usage |
|
287 | # :command.long_usage | |
288 | if [[ -n $long_usage ]]; then |
|
288 | if [[ -n $long_usage ]]; then | |
289 | printf "%s\n" "Options:" |
|
289 | printf "%s\n" "Options:" | |
290 |
|
290 | |||
291 | # :command.usage_flags |
|
291 | # :command.usage_flags | |
292 | # :flag.usage |
|
292 | # :flag.usage | |
293 | printf " %s\n" "--force" |
|
293 | printf " %s\n" "--force" | |
294 | printf " Ignore same-version skip check. Runs same logic as there would be new\n version available\n" |
|
294 | printf " Ignore same-version skip check. Runs same logic as there would be new\n version available\n" | |
295 | echo |
|
295 | echo | |
296 |
|
296 | |||
297 | # :flag.usage |
|
297 | # :flag.usage | |
298 | printf " %s\n" "--update-docker-image UPDATE_DOCKER_IMAGE" |
|
298 | printf " %s\n" "--update-docker-image UPDATE_DOCKER_IMAGE" | |
299 | printf " answer [y]es or [n]o to question to set docker image from installer stored\n version.\n" |
|
299 | printf " answer [y]es or [n]o to question to set docker image from installer stored\n version.\n" | |
300 | echo |
|
300 | echo | |
301 |
|
301 | |||
302 | # :flag.usage |
|
302 | # :flag.usage | |
303 | printf " %s\n" "--cli-revision CLI_REVISION" |
|
303 | printf " %s\n" "--cli-revision CLI_REVISION" | |
304 | printf " commit or branch to fetch new rcstack cli tool.\n" |
|
304 | printf " commit or branch to fetch new rcstack cli tool.\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" "--docker-revision DOCKER_REVISION" |
|
309 | printf " %s\n" "--docker-revision DOCKER_REVISION" | |
310 | printf " commit or branch to fetch new docker definitions.\n" |
|
310 | printf " commit or branch to fetch new docker definitions.\n" | |
311 | printf " Default: stable\n" |
|
311 | printf " Default: stable\n" | |
312 | echo |
|
312 | echo | |
313 |
|
313 | |||
314 | # :flag.usage |
|
314 | # :flag.usage | |
315 | printf " %s\n" "--server-url SERVER_URL" |
|
315 | printf " %s\n" "--server-url SERVER_URL" | |
316 | printf " Specify RhodeCode server location where the rcstack archive should be\n downloaded from\n" |
|
316 | printf " Specify RhodeCode server location where the rcstack archive should be\n downloaded from\n" | |
317 | printf " Default: https://dls.rhodecode.com/get_archive\n" |
|
317 | printf " Default: https://dls.rhodecode.com/get_archive\n" | |
318 | echo |
|
318 | echo | |
319 |
|
319 | |||
320 | # :flag.usage |
|
320 | # :flag.usage | |
321 | printf " %s\n" "--auth-token AUTH_TOKEN" |
|
321 | printf " %s\n" "--auth-token AUTH_TOKEN" | |
322 | printf " Optionally specify AUTH TOKEN to obtain sources\n" |
|
322 | printf " Optionally specify AUTH TOKEN to obtain sources\n" | |
323 | echo |
|
323 | echo | |
324 |
|
324 | |||
325 | # :command.usage_fixed_flags |
|
325 | # :command.usage_fixed_flags | |
326 | printf " %s\n" "--help, -h" |
|
326 | printf " %s\n" "--help, -h" | |
327 | printf " Show this help\n" |
|
327 | printf " Show this help\n" | |
328 | echo |
|
328 | echo | |
329 |
|
329 | |||
330 | # :command.usage_examples |
|
330 | # :command.usage_examples | |
331 | printf "%s\n" "Examples:" |
|
331 | printf "%s\n" "Examples:" | |
332 | 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" |
|
332 | 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" | |
333 | echo |
|
333 | echo | |
334 |
|
334 | |||
335 | fi |
|
335 | fi | |
336 | } |
|
336 | } | |
337 |
|
337 | |||
338 | # :command.usage |
|
338 | # :command.usage | |
339 | rcstack_stack_usage() { |
|
339 | rcstack_stack_usage() { | |
340 | if [[ -n $long_usage ]]; then |
|
340 | if [[ -n $long_usage ]]; then | |
341 | printf "rcstack stack - Run one of available cluster stacks, run stack -h for more details\n" |
|
341 | printf "rcstack stack - Run one of available cluster stacks, run stack -h for more details\n" | |
342 | echo |
|
342 | echo | |
343 |
|
343 | |||
344 | else |
|
344 | else | |
345 | printf "rcstack stack - Run one of available cluster stacks, run stack -h for more details\n" |
|
345 | printf "rcstack stack - Run one of available cluster stacks, run stack -h for more details\n" | |
346 | echo |
|
346 | echo | |
347 |
|
347 | |||
348 | fi |
|
348 | fi | |
349 |
|
349 | |||
350 | printf "%s\n" "Usage:" |
|
350 | printf "%s\n" "Usage:" | |
351 | printf " rcstack stack [OPTIONS] COMMAND\n" |
|
351 | printf " rcstack stack [OPTIONS] COMMAND\n" | |
352 | printf " rcstack stack [COMMAND] --help | -h\n" |
|
352 | printf " rcstack stack [COMMAND] --help | -h\n" | |
353 | echo |
|
353 | echo | |
354 | # :command.usage_commands |
|
354 | # :command.usage_commands | |
355 | printf "%s\n" "Commands:" |
|
355 | printf "%s\n" "Commands:" | |
356 | printf " %s execute commands for the router stack\n" "router " |
|
356 | printf " %s execute commands for the router stack\n" "router " | |
357 | printf " %s execute commands for the router stack\n" "metrics " |
|
357 | printf " %s execute commands for the router stack\n" "metrics " | |
358 | printf " %s execute commands for the router stack\n" "services " |
|
358 | printf " %s execute commands for the router stack\n" "services " | |
359 | printf " %s execute commands for the router stack\n" "rhodecode" |
|
359 | printf " %s execute commands for the router stack\n" "rhodecode" | |
360 | printf " %s execute commands for all stacks in order\n" "all " |
|
360 | printf " %s execute commands for all stacks in order\n" "all " | |
361 | echo |
|
361 | echo | |
362 |
|
362 | |||
363 | # :command.long_usage |
|
363 | # :command.long_usage | |
364 | if [[ -n $long_usage ]]; then |
|
364 | if [[ -n $long_usage ]]; then | |
365 | printf "%s\n" "Options:" |
|
365 | printf "%s\n" "Options:" | |
366 |
|
366 | |||
367 | # :command.usage_flags |
|
367 | # :command.usage_flags | |
368 | # :flag.usage |
|
368 | # :flag.usage | |
369 | printf " %s\n" "--env-file-path ENV_FILE_PATH" |
|
369 | printf " %s\n" "--env-file-path ENV_FILE_PATH" | |
370 | printf " Set custom env file\n" |
|
370 | printf " Set custom env file\n" | |
371 | printf " Default: $PWD/.custom/.runtime.env\n" |
|
371 | printf " Default: $PWD/.custom/.runtime.env\n" | |
372 | echo |
|
372 | echo | |
373 |
|
373 | |||
374 | # :flag.usage |
|
374 | # :flag.usage | |
375 | printf " %s\n" "--stack-prefix STACK_PREFIX" |
|
375 | printf " %s\n" "--stack-prefix STACK_PREFIX" | |
376 | printf " Set custom stack prefix, e.g rc_cluster_apps_ci\n" |
|
376 | printf " Set custom stack prefix, e.g rc_cluster_apps_ci\n" | |
377 | echo |
|
377 | echo | |
378 |
|
378 | |||
379 | # :command.usage_fixed_flags |
|
379 | # :command.usage_fixed_flags | |
380 | printf " %s\n" "--help, -h" |
|
380 | printf " %s\n" "--help, -h" | |
381 | printf " Show this help\n" |
|
381 | printf " Show this help\n" | |
382 | echo |
|
382 | echo | |
383 |
|
383 | |||
384 | # :command.usage_examples |
|
384 | # :command.usage_examples | |
385 | printf "%s\n" "Examples:" |
|
385 | printf "%s\n" "Examples:" | |
386 | 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" |
|
386 | 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" | |
387 | echo |
|
387 | echo | |
388 |
|
388 | |||
389 | fi |
|
389 | fi | |
390 | } |
|
390 | } | |
391 |
|
391 | |||
392 | # :command.usage |
|
392 | # :command.usage | |
393 | rcstack_stack_router_usage() { |
|
393 | rcstack_stack_router_usage() { | |
394 | if [[ -n $long_usage ]]; then |
|
394 | if [[ -n $long_usage ]]; then | |
395 | printf "rcstack stack router - execute commands for the router stack\n" |
|
395 | printf "rcstack stack router - execute commands for the router stack\n" | |
396 | echo |
|
396 | echo | |
397 |
|
397 | |||
398 | else |
|
398 | else | |
399 | printf "rcstack stack router - execute commands for the router stack\n" |
|
399 | printf "rcstack stack router - execute commands for the router stack\n" | |
400 | echo |
|
400 | echo | |
401 |
|
401 | |||
402 | fi |
|
402 | fi | |
403 |
|
403 | |||
404 | printf "%s\n" "Usage:" |
|
404 | printf "%s\n" "Usage:" | |
405 | printf " rcstack stack router [SERVICES PARAMS...]\n" |
|
405 | printf " rcstack stack router [SERVICES PARAMS...]\n" | |
406 | printf " rcstack stack router --help | -h\n" |
|
406 | printf " rcstack stack router --help | -h\n" | |
407 | echo |
|
407 | echo | |
408 |
|
408 | |||
409 | # :command.long_usage |
|
409 | # :command.long_usage | |
410 | if [[ -n $long_usage ]]; then |
|
410 | if [[ -n $long_usage ]]; then | |
411 | printf "%s\n" "Options:" |
|
411 | printf "%s\n" "Options:" | |
412 |
|
412 | |||
413 | # :command.usage_fixed_flags |
|
413 | # :command.usage_fixed_flags | |
414 | printf " %s\n" "--help, -h" |
|
414 | printf " %s\n" "--help, -h" | |
415 | printf " Show this help\n" |
|
415 | printf " Show this help\n" | |
416 | echo |
|
416 | echo | |
417 |
|
417 | |||
418 | # :command.usage_args |
|
418 | # :command.usage_args | |
419 | printf "%s\n" "Arguments:" |
|
419 | printf "%s\n" "Arguments:" | |
420 |
|
420 | |||
421 | echo " SERVICES PARAMS..." |
|
421 | echo " SERVICES PARAMS..." | |
422 | printf " Additional arguments or flags for services command\n" |
|
422 | printf " Additional arguments or flags for services command\n" | |
423 | echo |
|
423 | echo | |
424 |
|
424 | |||
425 | fi |
|
425 | fi | |
426 | } |
|
426 | } | |
427 |
|
427 | |||
428 | # :command.usage |
|
428 | # :command.usage | |
429 | rcstack_stack_metrics_usage() { |
|
429 | rcstack_stack_metrics_usage() { | |
430 | if [[ -n $long_usage ]]; then |
|
430 | if [[ -n $long_usage ]]; then | |
431 | printf "rcstack stack metrics - execute commands for the router stack\n" |
|
431 | printf "rcstack stack metrics - execute commands for the router stack\n" | |
432 | echo |
|
432 | echo | |
433 |
|
433 | |||
434 | else |
|
434 | else | |
435 | printf "rcstack stack metrics - execute commands for the router stack\n" |
|
435 | printf "rcstack stack metrics - execute commands for the router stack\n" | |
436 | echo |
|
436 | echo | |
437 |
|
437 | |||
438 | fi |
|
438 | fi | |
439 |
|
439 | |||
440 | printf "%s\n" "Usage:" |
|
440 | printf "%s\n" "Usage:" | |
441 | printf " rcstack stack metrics [SERVICES PARAMS...]\n" |
|
441 | printf " rcstack stack metrics [SERVICES PARAMS...]\n" | |
442 | printf " rcstack stack metrics --help | -h\n" |
|
442 | printf " rcstack stack metrics --help | -h\n" | |
443 | echo |
|
443 | echo | |
444 |
|
444 | |||
445 | # :command.long_usage |
|
445 | # :command.long_usage | |
446 | if [[ -n $long_usage ]]; then |
|
446 | if [[ -n $long_usage ]]; then | |
447 | printf "%s\n" "Options:" |
|
447 | printf "%s\n" "Options:" | |
448 |
|
448 | |||
449 | # :command.usage_fixed_flags |
|
449 | # :command.usage_fixed_flags | |
450 | printf " %s\n" "--help, -h" |
|
450 | printf " %s\n" "--help, -h" | |
451 | printf " Show this help\n" |
|
451 | printf " Show this help\n" | |
452 | echo |
|
452 | echo | |
453 |
|
453 | |||
454 | # :command.usage_args |
|
454 | # :command.usage_args | |
455 | printf "%s\n" "Arguments:" |
|
455 | printf "%s\n" "Arguments:" | |
456 |
|
456 | |||
457 | echo " SERVICES PARAMS..." |
|
457 | echo " SERVICES PARAMS..." | |
458 | printf " Additional arguments or flags for services command\n" |
|
458 | printf " Additional arguments or flags for services command\n" | |
459 | echo |
|
459 | echo | |
460 |
|
460 | |||
461 | fi |
|
461 | fi | |
462 | } |
|
462 | } | |
463 |
|
463 | |||
464 | # :command.usage |
|
464 | # :command.usage | |
465 | rcstack_stack_services_usage() { |
|
465 | rcstack_stack_services_usage() { | |
466 | if [[ -n $long_usage ]]; then |
|
466 | if [[ -n $long_usage ]]; then | |
467 | printf "rcstack stack services - execute commands for the router stack\n" |
|
467 | printf "rcstack stack services - execute commands for the router stack\n" | |
468 | echo |
|
468 | echo | |
469 |
|
469 | |||
470 | else |
|
470 | else | |
471 | printf "rcstack stack services - execute commands for the router stack\n" |
|
471 | printf "rcstack stack services - execute commands for the router stack\n" | |
472 | echo |
|
472 | echo | |
473 |
|
473 | |||
474 | fi |
|
474 | fi | |
475 |
|
475 | |||
476 | printf "%s\n" "Usage:" |
|
476 | printf "%s\n" "Usage:" | |
477 | printf " rcstack stack services [SERVICES PARAMS...]\n" |
|
477 | printf " rcstack stack services [SERVICES PARAMS...]\n" | |
478 | printf " rcstack stack services --help | -h\n" |
|
478 | printf " rcstack stack services --help | -h\n" | |
479 | echo |
|
479 | echo | |
480 |
|
480 | |||
481 | # :command.long_usage |
|
481 | # :command.long_usage | |
482 | if [[ -n $long_usage ]]; then |
|
482 | if [[ -n $long_usage ]]; then | |
483 | printf "%s\n" "Options:" |
|
483 | printf "%s\n" "Options:" | |
484 |
|
484 | |||
485 | # :command.usage_fixed_flags |
|
485 | # :command.usage_fixed_flags | |
486 | printf " %s\n" "--help, -h" |
|
486 | printf " %s\n" "--help, -h" | |
487 | printf " Show this help\n" |
|
487 | printf " Show this help\n" | |
488 | echo |
|
488 | echo | |
489 |
|
489 | |||
490 | # :command.usage_args |
|
490 | # :command.usage_args | |
491 | printf "%s\n" "Arguments:" |
|
491 | printf "%s\n" "Arguments:" | |
492 |
|
492 | |||
493 | echo " SERVICES PARAMS..." |
|
493 | echo " SERVICES PARAMS..." | |
494 | printf " Additional arguments or flags for services command\n" |
|
494 | printf " Additional arguments or flags for services command\n" | |
495 | echo |
|
495 | echo | |
496 |
|
496 | |||
497 | fi |
|
497 | fi | |
498 | } |
|
498 | } | |
499 |
|
499 | |||
500 | # :command.usage |
|
500 | # :command.usage | |
501 | rcstack_stack_rhodecode_usage() { |
|
501 | rcstack_stack_rhodecode_usage() { | |
502 | if [[ -n $long_usage ]]; then |
|
502 | if [[ -n $long_usage ]]; then | |
503 | printf "rcstack stack rhodecode - execute commands for the router stack\n" |
|
503 | printf "rcstack stack rhodecode - execute commands for the router stack\n" | |
504 | echo |
|
504 | echo | |
505 |
|
505 | |||
506 | else |
|
506 | else | |
507 | printf "rcstack stack rhodecode - execute commands for the router stack\n" |
|
507 | printf "rcstack stack rhodecode - execute commands for the router stack\n" | |
508 | echo |
|
508 | echo | |
509 |
|
509 | |||
510 | fi |
|
510 | fi | |
511 |
|
511 | |||
512 | printf "%s\n" "Usage:" |
|
512 | printf "%s\n" "Usage:" | |
513 | printf " rcstack stack rhodecode [SERVICES PARAMS...]\n" |
|
513 | printf " rcstack stack rhodecode [SERVICES PARAMS...]\n" | |
514 | printf " rcstack stack rhodecode --help | -h\n" |
|
514 | printf " rcstack stack rhodecode --help | -h\n" | |
515 | echo |
|
515 | echo | |
516 |
|
516 | |||
517 | # :command.long_usage |
|
517 | # :command.long_usage | |
518 | if [[ -n $long_usage ]]; then |
|
518 | if [[ -n $long_usage ]]; then | |
519 | printf "%s\n" "Options:" |
|
519 | printf "%s\n" "Options:" | |
520 |
|
520 | |||
521 | # :command.usage_fixed_flags |
|
521 | # :command.usage_fixed_flags | |
522 | printf " %s\n" "--help, -h" |
|
522 | printf " %s\n" "--help, -h" | |
523 | printf " Show this help\n" |
|
523 | printf " Show this help\n" | |
524 | echo |
|
524 | echo | |
525 |
|
525 | |||
526 | # :command.usage_args |
|
526 | # :command.usage_args | |
527 | printf "%s\n" "Arguments:" |
|
527 | printf "%s\n" "Arguments:" | |
528 |
|
528 | |||
529 | echo " SERVICES PARAMS..." |
|
529 | echo " SERVICES PARAMS..." | |
530 | printf " Additional arguments or flags for services command\n" |
|
530 | printf " Additional arguments or flags for services command\n" | |
531 | echo |
|
531 | echo | |
532 |
|
532 | |||
533 | fi |
|
533 | fi | |
534 | } |
|
534 | } | |
535 |
|
535 | |||
536 | # :command.usage |
|
536 | # :command.usage | |
537 | rcstack_stack_all_usage() { |
|
537 | rcstack_stack_all_usage() { | |
538 | if [[ -n $long_usage ]]; then |
|
538 | if [[ -n $long_usage ]]; then | |
539 | printf "rcstack stack all - execute commands for all stacks in order\n" |
|
539 | printf "rcstack stack all - execute commands for all stacks in order\n" | |
540 | echo |
|
540 | echo | |
541 |
|
541 | |||
542 | else |
|
542 | else | |
543 | printf "rcstack stack all - execute commands for all stacks in order\n" |
|
543 | printf "rcstack stack all - execute commands for all stacks in order\n" | |
544 | echo |
|
544 | echo | |
545 |
|
545 | |||
546 | fi |
|
546 | fi | |
547 |
|
547 | |||
548 | printf "%s\n" "Usage:" |
|
548 | printf "%s\n" "Usage:" | |
549 | printf " rcstack stack all [SERVICES PARAMS...]\n" |
|
549 | printf " rcstack stack all [SERVICES PARAMS...]\n" | |
550 | printf " rcstack stack all --help | -h\n" |
|
550 | printf " rcstack stack all --help | -h\n" | |
551 | echo |
|
551 | echo | |
552 |
|
552 | |||
553 | # :command.long_usage |
|
553 | # :command.long_usage | |
554 | if [[ -n $long_usage ]]; then |
|
554 | if [[ -n $long_usage ]]; then | |
555 | printf "%s\n" "Options:" |
|
555 | printf "%s\n" "Options:" | |
556 |
|
556 | |||
557 | # :command.usage_fixed_flags |
|
557 | # :command.usage_fixed_flags | |
558 | printf " %s\n" "--help, -h" |
|
558 | printf " %s\n" "--help, -h" | |
559 | printf " Show this help\n" |
|
559 | printf " Show this help\n" | |
560 | echo |
|
560 | echo | |
561 |
|
561 | |||
562 | # :command.usage_args |
|
562 | # :command.usage_args | |
563 | printf "%s\n" "Arguments:" |
|
563 | printf "%s\n" "Arguments:" | |
564 |
|
564 | |||
565 | echo " SERVICES PARAMS..." |
|
565 | echo " SERVICES PARAMS..." | |
566 | printf " Additional arguments or flags for services command\n" |
|
566 | printf " Additional arguments or flags for services command\n" | |
567 | echo |
|
567 | echo | |
568 |
|
568 | |||
569 | fi |
|
569 | fi | |
570 | } |
|
570 | } | |
571 |
|
571 | |||
572 | # :command.usage |
|
572 | # :command.usage | |
573 | rcstack_stack_status_usage() { |
|
573 | rcstack_stack_status_usage() { | |
574 | if [[ -n $long_usage ]]; then |
|
574 | if [[ -n $long_usage ]]; then | |
575 | printf "rcstack stack-status - Show stack status\n" |
|
575 | printf "rcstack stack-status - Show stack status\n" | |
576 | echo |
|
576 | echo | |
577 |
|
577 | |||
578 | else |
|
578 | else | |
579 | printf "rcstack stack-status - Show stack status\n" |
|
579 | printf "rcstack stack-status - Show stack status\n" | |
580 | echo |
|
580 | echo | |
581 |
|
581 | |||
582 | fi |
|
582 | fi | |
583 |
|
583 | |||
584 | printf "Alias: status\n" |
|
584 | printf "Alias: status\n" | |
585 | echo |
|
585 | echo | |
586 |
|
586 | |||
587 | printf "%s\n" "Usage:" |
|
587 | printf "%s\n" "Usage:" | |
588 | printf " rcstack stack-status [OPTIONS]\n" |
|
588 | printf " rcstack stack-status [OPTIONS]\n" | |
589 | printf " rcstack stack-status --help | -h\n" |
|
589 | printf " rcstack stack-status --help | -h\n" | |
590 | echo |
|
590 | echo | |
591 |
|
591 | |||
592 | # :command.long_usage |
|
592 | # :command.long_usage | |
593 | if [[ -n $long_usage ]]; then |
|
593 | if [[ -n $long_usage ]]; then | |
594 | printf "%s\n" "Options:" |
|
594 | printf "%s\n" "Options:" | |
595 |
|
595 | |||
596 | # :command.usage_flags |
|
596 | # :command.usage_flags | |
597 | # :flag.usage |
|
597 | # :flag.usage | |
598 | printf " %s\n" "--detailed" |
|
598 | printf " %s\n" "--detailed" | |
599 | printf " Display a detailed format\n" |
|
599 | printf " Display a detailed format\n" | |
600 | echo |
|
600 | echo | |
601 |
|
601 | |||
602 | # :flag.usage |
|
602 | # :flag.usage | |
603 | printf " %s\n" "--configs" |
|
603 | printf " %s\n" "--configs" | |
604 | printf " Display a detailed info about configuration files\n" |
|
604 | printf " Display a detailed info about configuration files\n" | |
605 | echo |
|
605 | echo | |
606 |
|
606 | |||
607 | # :flag.usage |
|
607 | # :flag.usage | |
608 | printf " %s\n" "-v" |
|
608 | printf " %s\n" "-v" | |
609 | printf " Verbose output for details on the stack\n" |
|
609 | printf " Verbose output for details on the stack\n" | |
610 | echo |
|
610 | echo | |
611 |
|
611 | |||
612 | # :command.usage_fixed_flags |
|
612 | # :command.usage_fixed_flags | |
613 | printf " %s\n" "--help, -h" |
|
613 | printf " %s\n" "--help, -h" | |
614 | printf " Show this help\n" |
|
614 | printf " Show this help\n" | |
615 | echo |
|
615 | echo | |
616 |
|
616 | |||
617 | fi |
|
617 | fi | |
618 | } |
|
618 | } | |
619 |
|
619 | |||
620 | # :command.usage |
|
620 | # :command.usage | |
621 | rcstack_stack_upgrade_usage() { |
|
621 | rcstack_stack_upgrade_usage() { | |
622 | if [[ -n $long_usage ]]; then |
|
622 | if [[ -n $long_usage ]]; then | |
623 | printf "rcstack stack-upgrade - Upgrade a stack, run stack-upgrade -h for more details\n" |
|
623 | printf "rcstack stack-upgrade - Upgrade a stack, run stack-upgrade -h for more details\n" | |
624 | echo |
|
624 | echo | |
625 |
|
625 | |||
626 | else |
|
626 | else | |
627 | printf "rcstack stack-upgrade - Upgrade a stack, run stack-upgrade -h for more details\n" |
|
627 | printf "rcstack stack-upgrade - Upgrade a stack, run stack-upgrade -h for more details\n" | |
628 | echo |
|
628 | echo | |
629 |
|
629 | |||
630 | fi |
|
630 | fi | |
631 |
|
631 | |||
632 | printf "%s\n" "Usage:" |
|
632 | printf "%s\n" "Usage:" | |
633 | printf " rcstack stack-upgrade [OPTIONS] COMMAND\n" |
|
633 | printf " rcstack stack-upgrade [OPTIONS] COMMAND\n" | |
634 | printf " rcstack stack-upgrade [COMMAND] --help | -h\n" |
|
634 | printf " rcstack stack-upgrade [COMMAND] --help | -h\n" | |
635 | echo |
|
635 | echo | |
636 | # :command.usage_commands |
|
636 | # :command.usage_commands | |
637 | printf "%s\n" "Commands:" |
|
637 | printf "%s\n" "Commands:" | |
638 | printf " %s upgrade the router stack\n" "router " |
|
638 | printf " %s upgrade the router stack\n" "router " | |
639 | printf " %s upgrade the services stack\n" "services " |
|
639 | printf " %s upgrade the services stack\n" "services " | |
640 | printf " %s upgrade the metrics stack\n" "metrics " |
|
640 | printf " %s upgrade the metrics stack\n" "metrics " | |
641 | printf " %s upgrade the rhodecode stack\n" "rhodecode" |
|
641 | printf " %s upgrade the rhodecode stack\n" "rhodecode" | |
642 | echo |
|
642 | echo | |
643 |
|
643 | |||
644 | # :command.long_usage |
|
644 | # :command.long_usage | |
645 | if [[ -n $long_usage ]]; then |
|
645 | if [[ -n $long_usage ]]; then | |
646 | printf "%s\n" "Options:" |
|
646 | printf "%s\n" "Options:" | |
647 |
|
647 | |||
648 | # :command.usage_flags |
|
648 | # :command.usage_flags | |
649 | # :flag.usage |
|
649 | # :flag.usage | |
650 | printf " %s\n" "--stack-prefix STACK_PREFIX" |
|
650 | printf " %s\n" "--stack-prefix STACK_PREFIX" | |
651 | printf " Set custom stack prefix, e.g rc_cluster_apps_ci\n" |
|
651 | printf " Set custom stack prefix, e.g rc_cluster_apps_ci\n" | |
652 | echo |
|
652 | echo | |
653 |
|
653 | |||
654 | # :command.usage_fixed_flags |
|
654 | # :command.usage_fixed_flags | |
655 | printf " %s\n" "--help, -h" |
|
655 | printf " %s\n" "--help, -h" | |
656 | printf " Show this help\n" |
|
656 | printf " Show this help\n" | |
657 | echo |
|
657 | echo | |
658 |
|
658 | |||
659 | # :command.usage_examples |
|
659 | # :command.usage_examples | |
660 | printf "%s\n" "Examples:" |
|
660 | printf "%s\n" "Examples:" | |
661 | 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" |
|
661 | 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" | |
662 | echo |
|
662 | echo | |
663 |
|
663 | |||
664 | fi |
|
664 | fi | |
665 | } |
|
665 | } | |
666 |
|
666 | |||
667 | # :command.usage |
|
667 | # :command.usage | |
668 | rcstack_stack_upgrade_router_usage() { |
|
668 | rcstack_stack_upgrade_router_usage() { | |
669 | if [[ -n $long_usage ]]; then |
|
669 | if [[ -n $long_usage ]]; then | |
670 | printf "rcstack stack-upgrade router - upgrade the router stack\n" |
|
670 | printf "rcstack stack-upgrade router - upgrade the router stack\n" | |
671 | echo |
|
671 | echo | |
672 |
|
672 | |||
673 | else |
|
673 | else | |
674 | printf "rcstack stack-upgrade router - upgrade the router stack\n" |
|
674 | printf "rcstack stack-upgrade router - upgrade the router stack\n" | |
675 | echo |
|
675 | echo | |
676 |
|
676 | |||
677 | fi |
|
677 | fi | |
678 |
|
678 | |||
679 | printf "%s\n" "Usage:" |
|
679 | printf "%s\n" "Usage:" | |
680 | printf " rcstack stack-upgrade router\n" |
|
680 | printf " rcstack stack-upgrade router\n" | |
681 | printf " rcstack stack-upgrade router --help | -h\n" |
|
681 | printf " rcstack stack-upgrade router --help | -h\n" | |
682 | echo |
|
682 | echo | |
683 |
|
683 | |||
684 | # :command.long_usage |
|
684 | # :command.long_usage | |
685 | if [[ -n $long_usage ]]; then |
|
685 | if [[ -n $long_usage ]]; then | |
686 | printf "%s\n" "Options:" |
|
686 | printf "%s\n" "Options:" | |
687 |
|
687 | |||
688 | # :command.usage_fixed_flags |
|
688 | # :command.usage_fixed_flags | |
689 | printf " %s\n" "--help, -h" |
|
689 | printf " %s\n" "--help, -h" | |
690 | printf " Show this help\n" |
|
690 | printf " Show this help\n" | |
691 | echo |
|
691 | echo | |
692 |
|
692 | |||
693 | fi |
|
693 | fi | |
694 | } |
|
694 | } | |
695 |
|
695 | |||
696 | # :command.usage |
|
696 | # :command.usage | |
697 | rcstack_stack_upgrade_services_usage() { |
|
697 | rcstack_stack_upgrade_services_usage() { | |
698 | if [[ -n $long_usage ]]; then |
|
698 | if [[ -n $long_usage ]]; then | |
699 | printf "rcstack stack-upgrade services - upgrade the services stack\n" |
|
699 | printf "rcstack stack-upgrade services - upgrade the services stack\n" | |
700 | echo |
|
700 | echo | |
701 |
|
701 | |||
702 | else |
|
702 | else | |
703 | printf "rcstack stack-upgrade services - upgrade the services stack\n" |
|
703 | printf "rcstack stack-upgrade services - upgrade the services stack\n" | |
704 | echo |
|
704 | echo | |
705 |
|
705 | |||
706 | fi |
|
706 | fi | |
707 |
|
707 | |||
708 | printf "%s\n" "Usage:" |
|
708 | printf "%s\n" "Usage:" | |
709 | printf " rcstack stack-upgrade services\n" |
|
709 | printf " rcstack stack-upgrade services\n" | |
710 | printf " rcstack stack-upgrade services --help | -h\n" |
|
710 | printf " rcstack stack-upgrade services --help | -h\n" | |
711 | echo |
|
711 | echo | |
712 |
|
712 | |||
713 | # :command.long_usage |
|
713 | # :command.long_usage | |
714 | if [[ -n $long_usage ]]; then |
|
714 | if [[ -n $long_usage ]]; then | |
715 | printf "%s\n" "Options:" |
|
715 | printf "%s\n" "Options:" | |
716 |
|
716 | |||
717 | # :command.usage_fixed_flags |
|
717 | # :command.usage_fixed_flags | |
718 | printf " %s\n" "--help, -h" |
|
718 | printf " %s\n" "--help, -h" | |
719 | printf " Show this help\n" |
|
719 | printf " Show this help\n" | |
720 | echo |
|
720 | echo | |
721 |
|
721 | |||
722 | fi |
|
722 | fi | |
723 | } |
|
723 | } | |
724 |
|
724 | |||
725 | # :command.usage |
|
725 | # :command.usage | |
726 | rcstack_stack_upgrade_metrics_usage() { |
|
726 | rcstack_stack_upgrade_metrics_usage() { | |
727 | if [[ -n $long_usage ]]; then |
|
727 | if [[ -n $long_usage ]]; then | |
728 | printf "rcstack stack-upgrade metrics - upgrade the metrics stack\n" |
|
728 | printf "rcstack stack-upgrade metrics - upgrade the metrics stack\n" | |
729 | echo |
|
729 | echo | |
730 |
|
730 | |||
731 | else |
|
731 | else | |
732 | printf "rcstack stack-upgrade metrics - upgrade the metrics stack\n" |
|
732 | printf "rcstack stack-upgrade metrics - upgrade the metrics stack\n" | |
733 | echo |
|
733 | echo | |
734 |
|
734 | |||
735 | fi |
|
735 | fi | |
736 |
|
736 | |||
737 | printf "%s\n" "Usage:" |
|
737 | printf "%s\n" "Usage:" | |
738 | printf " rcstack stack-upgrade metrics\n" |
|
738 | printf " rcstack stack-upgrade metrics\n" | |
739 | printf " rcstack stack-upgrade metrics --help | -h\n" |
|
739 | printf " rcstack stack-upgrade metrics --help | -h\n" | |
740 | echo |
|
740 | echo | |
741 |
|
741 | |||
742 | # :command.long_usage |
|
742 | # :command.long_usage | |
743 | if [[ -n $long_usage ]]; then |
|
743 | if [[ -n $long_usage ]]; then | |
744 | printf "%s\n" "Options:" |
|
744 | printf "%s\n" "Options:" | |
745 |
|
745 | |||
746 | # :command.usage_fixed_flags |
|
746 | # :command.usage_fixed_flags | |
747 | printf " %s\n" "--help, -h" |
|
747 | printf " %s\n" "--help, -h" | |
748 | printf " Show this help\n" |
|
748 | printf " Show this help\n" | |
749 | echo |
|
749 | echo | |
750 |
|
750 | |||
751 | fi |
|
751 | fi | |
752 | } |
|
752 | } | |
753 |
|
753 | |||
754 | # :command.usage |
|
754 | # :command.usage | |
755 | rcstack_stack_upgrade_rhodecode_usage() { |
|
755 | rcstack_stack_upgrade_rhodecode_usage() { | |
756 | if [[ -n $long_usage ]]; then |
|
756 | if [[ -n $long_usage ]]; then | |
757 | printf "rcstack stack-upgrade rhodecode - upgrade the rhodecode stack\n" |
|
757 | printf "rcstack stack-upgrade rhodecode - upgrade the rhodecode stack\n" | |
758 | echo |
|
758 | echo | |
759 |
|
759 | |||
760 | else |
|
760 | else | |
761 | printf "rcstack stack-upgrade rhodecode - upgrade the rhodecode stack\n" |
|
761 | printf "rcstack stack-upgrade rhodecode - upgrade the rhodecode stack\n" | |
762 | echo |
|
762 | echo | |
763 |
|
763 | |||
764 | fi |
|
764 | fi | |
765 |
|
765 | |||
766 | printf "%s\n" "Usage:" |
|
766 | printf "%s\n" "Usage:" | |
767 | printf " rcstack stack-upgrade rhodecode [OPTIONS]\n" |
|
767 | printf " rcstack stack-upgrade rhodecode [OPTIONS]\n" | |
768 | printf " rcstack stack-upgrade rhodecode --help | -h\n" |
|
768 | printf " rcstack stack-upgrade rhodecode --help | -h\n" | |
769 | echo |
|
769 | echo | |
770 |
|
770 | |||
771 | # :command.long_usage |
|
771 | # :command.long_usage | |
772 | if [[ -n $long_usage ]]; then |
|
772 | if [[ -n $long_usage ]]; then | |
773 | printf "%s\n" "Options:" |
|
773 | printf "%s\n" "Options:" | |
774 |
|
774 | |||
775 | # :command.usage_flags |
|
775 | # :command.usage_flags | |
776 | # :flag.usage |
|
776 | # :flag.usage | |
777 | printf " %s\n" "--stop-wait STOP_WAIT" |
|
777 | printf " %s\n" "--stop-wait STOP_WAIT" | |
778 | printf " Number of seconds to wait for stopping old containers, use low value to\n quickly restart and recycle containers\n" |
|
778 | printf " Number of seconds to wait for stopping old containers, use low value to\n quickly restart and recycle containers\n" | |
779 | printf " Default: 120\n" |
|
779 | printf " Default: 120\n" | |
780 | echo |
|
780 | echo | |
781 |
|
781 | |||
782 | # :flag.usage |
|
782 | # :flag.usage | |
783 | printf " %s\n" "--docker-stop-wait DOCKER_STOP_WAIT" |
|
783 | printf " %s\n" "--docker-stop-wait DOCKER_STOP_WAIT" | |
784 | printf " Number of seconds to pass to docker stop command that will wait for\n container to gracefully stop\n" |
|
784 | printf " Number of seconds to pass to docker stop command that will wait for\n container to gracefully stop\n" | |
785 | printf " Default: 3600\n" |
|
785 | printf " Default: 3600\n" | |
786 | echo |
|
786 | echo | |
787 |
|
787 | |||
788 | # :command.usage_fixed_flags |
|
788 | # :command.usage_fixed_flags | |
789 | printf " %s\n" "--help, -h" |
|
789 | printf " %s\n" "--help, -h" | |
790 | printf " Show this help\n" |
|
790 | printf " Show this help\n" | |
791 | echo |
|
791 | echo | |
792 |
|
792 | |||
793 | fi |
|
793 | fi | |
794 | } |
|
794 | } | |
795 |
|
795 | |||
796 | # :command.usage |
|
796 | # :command.usage | |
797 | rcstack_stack_monitor_usage() { |
|
797 | rcstack_stack_monitor_usage() { | |
798 | if [[ -n $long_usage ]]; then |
|
798 | if [[ -n $long_usage ]]; then | |
799 | printf "rcstack stack-monitor - run monitoring on stack items\n" |
|
799 | printf "rcstack stack-monitor - run monitoring on stack items\n" | |
800 | echo |
|
800 | echo | |
801 |
|
801 | |||
802 | else |
|
802 | else | |
803 | printf "rcstack stack-monitor - run monitoring on stack items\n" |
|
803 | printf "rcstack stack-monitor - run monitoring on stack items\n" | |
804 | echo |
|
804 | echo | |
805 |
|
805 | |||
806 | fi |
|
806 | fi | |
807 |
|
807 | |||
808 | printf "%s\n" "Usage:" |
|
808 | printf "%s\n" "Usage:" | |
809 | printf " rcstack stack-monitor COMMAND\n" |
|
809 | printf " rcstack stack-monitor COMMAND\n" | |
810 | printf " rcstack stack-monitor [COMMAND] --help | -h\n" |
|
810 | printf " rcstack stack-monitor [COMMAND] --help | -h\n" | |
811 | echo |
|
811 | echo | |
812 | # :command.usage_commands |
|
812 | # :command.usage_commands | |
813 | printf "%s\n" "Stack Commands:" |
|
813 | printf "%s\n" "Stack Commands:" | |
814 | printf " %s monitor stack containers that are unhealthy and restart them\n" "restart-unhealthy" |
|
814 | printf " %s monitor stack containers that are unhealthy and restart them\n" "restart-unhealthy" | |
815 | echo |
|
815 | echo | |
816 |
|
816 | |||
817 | # :command.long_usage |
|
817 | # :command.long_usage | |
818 | if [[ -n $long_usage ]]; then |
|
818 | if [[ -n $long_usage ]]; then | |
819 | printf "%s\n" "Options:" |
|
819 | printf "%s\n" "Options:" | |
820 |
|
820 | |||
821 | # :command.usage_fixed_flags |
|
821 | # :command.usage_fixed_flags | |
822 | printf " %s\n" "--help, -h" |
|
822 | printf " %s\n" "--help, -h" | |
823 | printf " Show this help\n" |
|
823 | printf " Show this help\n" | |
824 | echo |
|
824 | echo | |
825 |
|
825 | |||
826 | fi |
|
826 | fi | |
827 | } |
|
827 | } | |
828 |
|
828 | |||
829 | # :command.usage |
|
829 | # :command.usage | |
830 | rcstack_stack_monitor_restart_unhealthy_usage() { |
|
830 | rcstack_stack_monitor_restart_unhealthy_usage() { | |
831 | if [[ -n $long_usage ]]; then |
|
831 | if [[ -n $long_usage ]]; then | |
832 | printf "rcstack stack-monitor restart-unhealthy - monitor stack containers that are unhealthy and restart them\n" |
|
832 | printf "rcstack stack-monitor restart-unhealthy - monitor stack containers that are unhealthy and restart them\n" | |
833 | echo |
|
833 | echo | |
834 |
|
834 | |||
835 | else |
|
835 | else | |
836 | printf "rcstack stack-monitor restart-unhealthy - monitor stack containers that are unhealthy and restart them\n" |
|
836 | printf "rcstack stack-monitor restart-unhealthy - monitor stack containers that are unhealthy and restart them\n" | |
837 | echo |
|
837 | echo | |
838 |
|
838 | |||
839 | fi |
|
839 | fi | |
840 |
|
840 | |||
841 | printf "%s\n" "Usage:" |
|
841 | printf "%s\n" "Usage:" | |
842 | printf " rcstack stack-monitor restart-unhealthy [OPTIONS]\n" |
|
842 | printf " rcstack stack-monitor restart-unhealthy [OPTIONS]\n" | |
843 | printf " rcstack stack-monitor restart-unhealthy --help | -h\n" |
|
843 | printf " rcstack stack-monitor restart-unhealthy --help | -h\n" | |
844 | echo |
|
844 | echo | |
845 |
|
845 | |||
846 | # :command.long_usage |
|
846 | # :command.long_usage | |
847 | if [[ -n $long_usage ]]; then |
|
847 | if [[ -n $long_usage ]]; then | |
848 | printf "%s\n" "Options:" |
|
848 | printf "%s\n" "Options:" | |
849 |
|
849 | |||
850 | # :command.usage_flags |
|
850 | # :command.usage_flags | |
851 | # :flag.usage |
|
851 | # :flag.usage | |
852 | printf " %s\n" "--loop LOOP" |
|
852 | printf " %s\n" "--loop LOOP" | |
853 | printf " run in a loop to monitor continuously every N seconds\n" |
|
853 | printf " run in a loop to monitor continuously every N seconds\n" | |
854 | printf " Default: 0\n" |
|
854 | printf " Default: 0\n" | |
855 | echo |
|
855 | echo | |
856 |
|
856 | |||
857 | # :command.usage_fixed_flags |
|
857 | # :command.usage_fixed_flags | |
858 | printf " %s\n" "--help, -h" |
|
858 | printf " %s\n" "--help, -h" | |
859 | printf " Show this help\n" |
|
859 | printf " Show this help\n" | |
860 | echo |
|
860 | echo | |
861 |
|
861 | |||
862 | # :command.usage_examples |
|
862 | # :command.usage_examples | |
863 | printf "%s\n" "Examples:" |
|
863 | printf "%s\n" "Examples:" | |
864 | 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" |
|
864 | 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" | |
865 | echo |
|
865 | echo | |
866 |
|
866 | |||
867 | fi |
|
867 | fi | |
868 | } |
|
868 | } | |
869 |
|
869 | |||
870 | # :command.usage |
|
870 | # :command.usage | |
871 | rcstack_cli_usage() { |
|
871 | rcstack_cli_usage() { | |
872 | if [[ -n $long_usage ]]; then |
|
872 | if [[ -n $long_usage ]]; then | |
873 | printf "rcstack cli - Various CLI tools, run cli -h for more details\n" |
|
873 | printf "rcstack cli - Various CLI tools, run cli -h for more details\n" | |
874 | echo |
|
874 | echo | |
875 |
|
875 | |||
876 | else |
|
876 | else | |
877 | printf "rcstack cli - Various CLI tools, run cli -h for more details\n" |
|
877 | printf "rcstack cli - Various CLI tools, run cli -h for more details\n" | |
878 | echo |
|
878 | echo | |
879 |
|
879 | |||
880 | fi |
|
880 | fi | |
881 |
|
881 | |||
882 | printf "%s\n" "Usage:" |
|
882 | printf "%s\n" "Usage:" | |
883 | printf " rcstack cli COMMAND\n" |
|
883 | printf " rcstack cli COMMAND\n" | |
884 | printf " rcstack cli [COMMAND] --help | -h\n" |
|
884 | printf " rcstack cli [COMMAND] --help | -h\n" | |
885 | echo |
|
885 | echo | |
886 | # :command.usage_commands |
|
886 | # :command.usage_commands | |
887 | printf "%s\n" "Commands:" |
|
887 | printf "%s\n" "Commands:" | |
888 | printf " %s run a custom command on top of docker image from RhodeCode\n" "cmd " |
|
888 | printf " %s run a custom command on top of docker image from RhodeCode\n" "cmd " | |
889 | printf " %s print out stored docker image version\n" "image-info " |
|
889 | printf " %s print out stored docker image version\n" "image-info " | |
890 | printf " %s set version to .runtime.env file\n" "set-runtime-image " |
|
890 | printf " %s set version to .runtime.env file\n" "set-runtime-image " | |
891 | printf " %s get current docker info\n" "docker-info " |
|
891 | printf " %s get current docker info\n" "docker-info " | |
892 | printf " %s force upgrade docker\n" "docker-upgrade " |
|
892 | printf " %s force upgrade docker\n" "docker-upgrade " | |
893 | printf " %s Ishell attached to running RhodeCode instance\n" "ishell " |
|
893 | printf " %s Ishell attached to running RhodeCode instance\n" "ishell " | |
894 | printf " %s CLI for Redis\n" "redis " |
|
894 | printf " %s CLI for Redis\n" "redis " | |
895 | printf " %s CLI with Database connection\n" "db " |
|
895 | printf " %s CLI with Database connection\n" "db " | |
896 | printf " %s CLI to run db upgrade\n" "db-upgrade " |
|
896 | printf " %s CLI to run db upgrade\n" "db-upgrade " | |
897 | 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 " |
|
897 | 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 " | |
898 | printf " %s attach to running instance of RhodeCode, by default it attaches to rhodecode main web app\n" "attach " |
|
898 | printf " %s attach to running instance of RhodeCode, by default it attaches to rhodecode main web app\n" "attach " | |
899 | printf " %s set current setup to either CE (Community) or EE (Enterprise) type\n" "set-edition " |
|
899 | printf " %s set current setup to either CE (Community) or EE (Enterprise) type\n" "set-edition " | |
900 | printf " %s reconfigure the vcsserver.ini file\n" "configure-vcsserver" |
|
900 | printf " %s reconfigure the vcsserver.ini file\n" "configure-vcsserver" | |
901 | printf " %s reconfigure the rhodecode.ini file\n" "configure-rhodecode" |
|
901 | printf " %s reconfigure the rhodecode.ini file\n" "configure-rhodecode" | |
902 | echo |
|
902 | echo | |
903 |
|
903 | |||
904 | # :command.long_usage |
|
904 | # :command.long_usage | |
905 | if [[ -n $long_usage ]]; then |
|
905 | if [[ -n $long_usage ]]; then | |
906 | printf "%s\n" "Options:" |
|
906 | printf "%s\n" "Options:" | |
907 |
|
907 | |||
908 | # :command.usage_fixed_flags |
|
908 | # :command.usage_fixed_flags | |
909 | printf " %s\n" "--help, -h" |
|
909 | printf " %s\n" "--help, -h" | |
910 | printf " Show this help\n" |
|
910 | printf " Show this help\n" | |
911 | echo |
|
911 | echo | |
912 |
|
912 | |||
913 | fi |
|
913 | fi | |
914 | } |
|
914 | } | |
915 |
|
915 | |||
916 | # :command.usage |
|
916 | # :command.usage | |
917 | rcstack_cli_cmd_usage() { |
|
917 | rcstack_cli_cmd_usage() { | |
918 | if [[ -n $long_usage ]]; then |
|
918 | if [[ -n $long_usage ]]; then | |
919 | printf "rcstack cli cmd - run a custom command on top of docker image from RhodeCode\n" |
|
919 | printf "rcstack cli cmd - run a custom command on top of docker image from RhodeCode\n" | |
920 | echo |
|
920 | echo | |
921 |
|
921 | |||
922 | else |
|
922 | else | |
923 | printf "rcstack cli cmd - run a custom command on top of docker image from RhodeCode\n" |
|
923 | printf "rcstack cli cmd - run a custom command on top of docker image from RhodeCode\n" | |
924 | echo |
|
924 | echo | |
925 |
|
925 | |||
926 | fi |
|
926 | fi | |
927 |
|
927 | |||
928 | printf "%s\n" "Usage:" |
|
928 | printf "%s\n" "Usage:" | |
929 | printf " rcstack cli cmd [OPTIONS] [CALL ARGUMENTS...]\n" |
|
929 | printf " rcstack cli cmd [OPTIONS] [CALL ARGUMENTS...]\n" | |
930 | printf " rcstack cli cmd --help | -h\n" |
|
930 | printf " rcstack cli cmd --help | -h\n" | |
931 | echo |
|
931 | echo | |
932 |
|
932 | |||
933 | # :command.long_usage |
|
933 | # :command.long_usage | |
934 | if [[ -n $long_usage ]]; then |
|
934 | if [[ -n $long_usage ]]; then | |
935 | printf "%s\n" "Options:" |
|
935 | printf "%s\n" "Options:" | |
936 |
|
936 | |||
937 | # :command.usage_flags |
|
937 | # :command.usage_flags | |
938 | # :flag.usage |
|
938 | # :flag.usage | |
939 | printf " %s\n" "--env-file-path ENV_FILE_PATH" |
|
939 | printf " %s\n" "--env-file-path ENV_FILE_PATH" | |
940 | printf " Set custom env file\n" |
|
940 | printf " Set custom env file\n" | |
941 | printf " Default: $PWD/.custom/.runtime.env\n" |
|
941 | printf " Default: $PWD/.custom/.runtime.env\n" | |
942 | echo |
|
942 | echo | |
943 |
|
943 | |||
944 | # :command.usage_fixed_flags |
|
944 | # :command.usage_fixed_flags | |
945 | printf " %s\n" "--help, -h" |
|
945 | printf " %s\n" "--help, -h" | |
946 | printf " Show this help\n" |
|
946 | printf " Show this help\n" | |
947 | echo |
|
947 | echo | |
948 |
|
948 | |||
949 | # :command.usage_args |
|
949 | # :command.usage_args | |
950 | printf "%s\n" "Arguments:" |
|
950 | printf "%s\n" "Arguments:" | |
951 |
|
951 | |||
952 | echo " CALL ARGUMENTS..." |
|
952 | echo " CALL ARGUMENTS..." | |
953 | printf " call arguments\n" |
|
953 | printf " call arguments\n" | |
954 | echo |
|
954 | echo | |
955 |
|
955 | |||
956 | fi |
|
956 | fi | |
957 | } |
|
957 | } | |
958 |
|
958 | |||
959 | # :command.usage |
|
959 | # :command.usage | |
960 | rcstack_cli_image_info_usage() { |
|
960 | rcstack_cli_image_info_usage() { | |
961 | if [[ -n $long_usage ]]; then |
|
961 | if [[ -n $long_usage ]]; then | |
962 | printf "rcstack cli image-info - print out stored docker image version\n" |
|
962 | printf "rcstack cli image-info - print out stored docker image version\n" | |
963 | echo |
|
963 | echo | |
964 |
|
964 | |||
965 | else |
|
965 | else | |
966 | printf "rcstack cli image-info - print out stored docker image version\n" |
|
966 | printf "rcstack cli image-info - print out stored docker image version\n" | |
967 | echo |
|
967 | echo | |
968 |
|
968 | |||
969 | fi |
|
969 | fi | |
970 |
|
970 | |||
971 | printf "%s\n" "Usage:" |
|
971 | printf "%s\n" "Usage:" | |
972 | printf " rcstack cli image-info [OPTIONS]\n" |
|
972 | printf " rcstack cli image-info [OPTIONS]\n" | |
973 | printf " rcstack cli image-info --help | -h\n" |
|
973 | printf " rcstack cli image-info --help | -h\n" | |
974 | echo |
|
974 | echo | |
975 |
|
975 | |||
976 | # :command.long_usage |
|
976 | # :command.long_usage | |
977 | if [[ -n $long_usage ]]; then |
|
977 | if [[ -n $long_usage ]]; then | |
978 | printf "%s\n" "Options:" |
|
978 | printf "%s\n" "Options:" | |
979 |
|
979 | |||
980 | # :command.usage_flags |
|
980 | # :command.usage_flags | |
981 | # :flag.usage |
|
981 | # :flag.usage | |
982 | printf " %s\n" "--verbose" |
|
982 | printf " %s\n" "--verbose" | |
983 | printf " rich output about image\n" |
|
983 | printf " rich output about image\n" | |
984 | echo |
|
984 | echo | |
985 |
|
985 | |||
986 | # :command.usage_fixed_flags |
|
986 | # :command.usage_fixed_flags | |
987 | printf " %s\n" "--help, -h" |
|
987 | printf " %s\n" "--help, -h" | |
988 | printf " Show this help\n" |
|
988 | printf " Show this help\n" | |
989 | echo |
|
989 | echo | |
990 |
|
990 | |||
991 | fi |
|
991 | fi | |
992 | } |
|
992 | } | |
993 |
|
993 | |||
994 | # :command.usage |
|
994 | # :command.usage | |
995 | rcstack_cli_set_runtime_image_usage() { |
|
995 | rcstack_cli_set_runtime_image_usage() { | |
996 | if [[ -n $long_usage ]]; then |
|
996 | if [[ -n $long_usage ]]; then | |
997 | printf "rcstack cli set-runtime-image - set version to .runtime.env file\n" |
|
997 | printf "rcstack cli set-runtime-image - set version to .runtime.env file\n" | |
998 | echo |
|
998 | echo | |
999 |
|
999 | |||
1000 | else |
|
1000 | else | |
1001 | printf "rcstack cli set-runtime-image - set version to .runtime.env file\n" |
|
1001 | printf "rcstack cli set-runtime-image - set version to .runtime.env file\n" | |
1002 | echo |
|
1002 | echo | |
1003 |
|
1003 | |||
1004 | fi |
|
1004 | fi | |
1005 |
|
1005 | |||
1006 | printf "%s\n" "Usage:" |
|
1006 | printf "%s\n" "Usage:" | |
1007 | printf " rcstack cli set-runtime-image VERSION\n" |
|
1007 | printf " rcstack cli set-runtime-image VERSION\n" | |
1008 | printf " rcstack cli set-runtime-image --help | -h\n" |
|
1008 | printf " rcstack cli set-runtime-image --help | -h\n" | |
1009 | echo |
|
1009 | echo | |
1010 |
|
1010 | |||
1011 | # :command.long_usage |
|
1011 | # :command.long_usage | |
1012 | if [[ -n $long_usage ]]; then |
|
1012 | if [[ -n $long_usage ]]; then | |
1013 | printf "%s\n" "Options:" |
|
1013 | printf "%s\n" "Options:" | |
1014 |
|
1014 | |||
1015 | # :command.usage_fixed_flags |
|
1015 | # :command.usage_fixed_flags | |
1016 | printf " %s\n" "--help, -h" |
|
1016 | printf " %s\n" "--help, -h" | |
1017 | printf " Show this help\n" |
|
1017 | printf " Show this help\n" | |
1018 | echo |
|
1018 | echo | |
1019 |
|
1019 | |||
1020 | # :command.usage_args |
|
1020 | # :command.usage_args | |
1021 | printf "%s\n" "Arguments:" |
|
1021 | printf "%s\n" "Arguments:" | |
1022 |
|
1022 | |||
1023 | # :argument.usage |
|
1023 | # :argument.usage | |
1024 | printf " %s\n" "VERSION" |
|
1024 | printf " %s\n" "VERSION" | |
1025 | printf " Version of docker image to set e.g '5.0.0'\n" |
|
1025 | printf " Version of docker image to set e.g '5.0.0'\n" | |
1026 | echo |
|
1026 | echo | |
1027 |
|
1027 | |||
1028 | fi |
|
1028 | fi | |
1029 | } |
|
1029 | } | |
1030 |
|
1030 | |||
1031 | # :command.usage |
|
1031 | # :command.usage | |
1032 | rcstack_cli_docker_info_usage() { |
|
1032 | rcstack_cli_docker_info_usage() { | |
1033 | if [[ -n $long_usage ]]; then |
|
1033 | if [[ -n $long_usage ]]; then | |
1034 | printf "rcstack cli docker-info - get current docker info\n" |
|
1034 | printf "rcstack cli docker-info - get current docker info\n" | |
1035 | echo |
|
1035 | echo | |
1036 |
|
1036 | |||
1037 | else |
|
1037 | else | |
1038 | printf "rcstack cli docker-info - get current docker info\n" |
|
1038 | printf "rcstack cli docker-info - get current docker info\n" | |
1039 | echo |
|
1039 | echo | |
1040 |
|
1040 | |||
1041 | fi |
|
1041 | fi | |
1042 |
|
1042 | |||
1043 | printf "%s\n" "Usage:" |
|
1043 | printf "%s\n" "Usage:" | |
1044 | printf " rcstack cli docker-info [OPTIONS]\n" |
|
1044 | printf " rcstack cli docker-info [OPTIONS]\n" | |
1045 | printf " rcstack cli docker-info --help | -h\n" |
|
1045 | printf " rcstack cli docker-info --help | -h\n" | |
1046 | echo |
|
1046 | echo | |
1047 |
|
1047 | |||
1048 | # :command.long_usage |
|
1048 | # :command.long_usage | |
1049 | if [[ -n $long_usage ]]; then |
|
1049 | if [[ -n $long_usage ]]; then | |
1050 | printf "%s\n" "Options:" |
|
1050 | printf "%s\n" "Options:" | |
1051 |
|
1051 | |||
1052 | # :command.usage_flags |
|
1052 | # :command.usage_flags | |
1053 | # :flag.usage |
|
1053 | # :flag.usage | |
1054 | printf " %s\n" "--verbose" |
|
1054 | printf " %s\n" "--verbose" | |
1055 | printf " rich output about docker\n" |
|
1055 | printf " rich output about docker\n" | |
1056 | echo |
|
1056 | echo | |
1057 |
|
1057 | |||
1058 | # :command.usage_fixed_flags |
|
1058 | # :command.usage_fixed_flags | |
1059 | printf " %s\n" "--help, -h" |
|
1059 | printf " %s\n" "--help, -h" | |
1060 | printf " Show this help\n" |
|
1060 | printf " Show this help\n" | |
1061 | echo |
|
1061 | echo | |
1062 |
|
1062 | |||
1063 | fi |
|
1063 | fi | |
1064 | } |
|
1064 | } | |
1065 |
|
1065 | |||
1066 | # :command.usage |
|
1066 | # :command.usage | |
1067 | rcstack_cli_docker_upgrade_usage() { |
|
1067 | rcstack_cli_docker_upgrade_usage() { | |
1068 | if [[ -n $long_usage ]]; then |
|
1068 | if [[ -n $long_usage ]]; then | |
1069 | printf "rcstack cli docker-upgrade - force upgrade docker\n" |
|
1069 | printf "rcstack cli docker-upgrade - force upgrade docker\n" | |
1070 | echo |
|
1070 | echo | |
1071 |
|
1071 | |||
1072 | else |
|
1072 | else | |
1073 | printf "rcstack cli docker-upgrade - force upgrade docker\n" |
|
1073 | printf "rcstack cli docker-upgrade - force upgrade docker\n" | |
1074 | echo |
|
1074 | echo | |
1075 |
|
1075 | |||
1076 | fi |
|
1076 | fi | |
1077 |
|
1077 | |||
1078 | printf "%s\n" "Usage:" |
|
1078 | printf "%s\n" "Usage:" | |
1079 | printf " rcstack cli docker-upgrade\n" |
|
1079 | printf " rcstack cli docker-upgrade\n" | |
1080 | printf " rcstack cli docker-upgrade --help | -h\n" |
|
1080 | printf " rcstack cli docker-upgrade --help | -h\n" | |
1081 | echo |
|
1081 | echo | |
1082 |
|
1082 | |||
1083 | # :command.long_usage |
|
1083 | # :command.long_usage | |
1084 | if [[ -n $long_usage ]]; then |
|
1084 | if [[ -n $long_usage ]]; then | |
1085 | printf "%s\n" "Options:" |
|
1085 | printf "%s\n" "Options:" | |
1086 |
|
1086 | |||
1087 | # :command.usage_fixed_flags |
|
1087 | # :command.usage_fixed_flags | |
1088 | printf " %s\n" "--help, -h" |
|
1088 | printf " %s\n" "--help, -h" | |
1089 | printf " Show this help\n" |
|
1089 | printf " Show this help\n" | |
1090 | echo |
|
1090 | echo | |
1091 |
|
1091 | |||
1092 | fi |
|
1092 | fi | |
1093 | } |
|
1093 | } | |
1094 |
|
1094 | |||
1095 | # :command.usage |
|
1095 | # :command.usage | |
1096 | rcstack_cli_ishell_usage() { |
|
1096 | rcstack_cli_ishell_usage() { | |
1097 | if [[ -n $long_usage ]]; then |
|
1097 | if [[ -n $long_usage ]]; then | |
1098 | printf "rcstack cli ishell - Ishell attached to running RhodeCode instance\n" |
|
1098 | printf "rcstack cli ishell - Ishell attached to running RhodeCode instance\n" | |
1099 | echo |
|
1099 | echo | |
1100 |
|
1100 | |||
1101 | else |
|
1101 | else | |
1102 | printf "rcstack cli ishell - Ishell attached to running RhodeCode instance\n" |
|
1102 | printf "rcstack cli ishell - Ishell attached to running RhodeCode instance\n" | |
1103 | echo |
|
1103 | echo | |
1104 |
|
1104 | |||
1105 | fi |
|
1105 | fi | |
1106 |
|
1106 | |||
1107 | printf "%s\n" "Usage:" |
|
1107 | printf "%s\n" "Usage:" | |
1108 | printf " rcstack cli ishell\n" |
|
1108 | printf " rcstack cli ishell\n" | |
1109 | printf " rcstack cli ishell --help | -h\n" |
|
1109 | printf " rcstack cli ishell --help | -h\n" | |
1110 | echo |
|
1110 | echo | |
1111 |
|
1111 | |||
1112 | # :command.long_usage |
|
1112 | # :command.long_usage | |
1113 | if [[ -n $long_usage ]]; then |
|
1113 | if [[ -n $long_usage ]]; then | |
1114 | printf "%s\n" "Options:" |
|
1114 | printf "%s\n" "Options:" | |
1115 |
|
1115 | |||
1116 | # :command.usage_fixed_flags |
|
1116 | # :command.usage_fixed_flags | |
1117 | printf " %s\n" "--help, -h" |
|
1117 | printf " %s\n" "--help, -h" | |
1118 | printf " Show this help\n" |
|
1118 | printf " Show this help\n" | |
1119 | echo |
|
1119 | echo | |
1120 |
|
1120 | |||
1121 | fi |
|
1121 | fi | |
1122 | } |
|
1122 | } | |
1123 |
|
1123 | |||
1124 | # :command.usage |
|
1124 | # :command.usage | |
1125 | rcstack_cli_redis_usage() { |
|
1125 | rcstack_cli_redis_usage() { | |
1126 | if [[ -n $long_usage ]]; then |
|
1126 | if [[ -n $long_usage ]]; then | |
1127 | printf "rcstack cli redis - CLI for Redis\n" |
|
1127 | printf "rcstack cli redis - CLI for Redis\n" | |
1128 | echo |
|
1128 | echo | |
1129 |
|
1129 | |||
1130 | else |
|
1130 | else | |
1131 | printf "rcstack cli redis - CLI for Redis\n" |
|
1131 | printf "rcstack cli redis - CLI for Redis\n" | |
1132 | echo |
|
1132 | echo | |
1133 |
|
1133 | |||
1134 | fi |
|
1134 | fi | |
1135 |
|
1135 | |||
1136 | printf "%s\n" "Usage:" |
|
1136 | printf "%s\n" "Usage:" | |
1137 | printf " rcstack cli redis\n" |
|
1137 | printf " rcstack cli redis\n" | |
1138 | printf " rcstack cli redis --help | -h\n" |
|
1138 | printf " rcstack cli redis --help | -h\n" | |
1139 | echo |
|
1139 | echo | |
1140 |
|
1140 | |||
1141 | # :command.long_usage |
|
1141 | # :command.long_usage | |
1142 | if [[ -n $long_usage ]]; then |
|
1142 | if [[ -n $long_usage ]]; then | |
1143 | printf "%s\n" "Options:" |
|
1143 | printf "%s\n" "Options:" | |
1144 |
|
1144 | |||
1145 | # :command.usage_fixed_flags |
|
1145 | # :command.usage_fixed_flags | |
1146 | printf " %s\n" "--help, -h" |
|
1146 | printf " %s\n" "--help, -h" | |
1147 | printf " Show this help\n" |
|
1147 | printf " Show this help\n" | |
1148 | echo |
|
1148 | echo | |
1149 |
|
1149 | |||
1150 | fi |
|
1150 | fi | |
1151 | } |
|
1151 | } | |
1152 |
|
1152 | |||
1153 | # :command.usage |
|
1153 | # :command.usage | |
1154 | rcstack_cli_db_usage() { |
|
1154 | rcstack_cli_db_usage() { | |
1155 | if [[ -n $long_usage ]]; then |
|
1155 | if [[ -n $long_usage ]]; then | |
1156 | printf "rcstack cli db - CLI with Database connection\n" |
|
1156 | printf "rcstack cli db - CLI with Database connection\n" | |
1157 | echo |
|
1157 | echo | |
1158 |
|
1158 | |||
1159 | else |
|
1159 | else | |
1160 | printf "rcstack cli db - CLI with Database connection\n" |
|
1160 | printf "rcstack cli db - CLI with Database connection\n" | |
1161 | echo |
|
1161 | echo | |
1162 |
|
1162 | |||
1163 | fi |
|
1163 | fi | |
1164 |
|
1164 | |||
1165 | printf "%s\n" "Usage:" |
|
1165 | printf "%s\n" "Usage:" | |
1166 | printf " rcstack cli db\n" |
|
1166 | printf " rcstack cli db\n" | |
1167 | printf " rcstack cli db --help | -h\n" |
|
1167 | printf " rcstack cli db --help | -h\n" | |
1168 | echo |
|
1168 | echo | |
1169 |
|
1169 | |||
1170 | # :command.long_usage |
|
1170 | # :command.long_usage | |
1171 | if [[ -n $long_usage ]]; then |
|
1171 | if [[ -n $long_usage ]]; then | |
1172 | printf "%s\n" "Options:" |
|
1172 | printf "%s\n" "Options:" | |
1173 |
|
1173 | |||
1174 | # :command.usage_fixed_flags |
|
1174 | # :command.usage_fixed_flags | |
1175 | printf " %s\n" "--help, -h" |
|
1175 | printf " %s\n" "--help, -h" | |
1176 | printf " Show this help\n" |
|
1176 | printf " Show this help\n" | |
1177 | echo |
|
1177 | echo | |
1178 |
|
1178 | |||
1179 | # :command.usage_examples |
|
1179 | # :command.usage_examples | |
1180 | printf "%s\n" "Examples:" |
|
1180 | printf "%s\n" "Examples:" | |
1181 | printf " # restore backup\n - \i /var/rc-data-dump/your_dump.sql\n" |
|
1181 | printf " # restore backup\n - \i /var/rc-data-dump/your_dump.sql\n" | |
1182 | echo |
|
1182 | echo | |
1183 |
|
1183 | |||
1184 | fi |
|
1184 | fi | |
1185 | } |
|
1185 | } | |
1186 |
|
1186 | |||
1187 | # :command.usage |
|
1187 | # :command.usage | |
1188 | rcstack_cli_db_upgrade_usage() { |
|
1188 | rcstack_cli_db_upgrade_usage() { | |
1189 | if [[ -n $long_usage ]]; then |
|
1189 | if [[ -n $long_usage ]]; then | |
1190 | printf "rcstack cli db-upgrade - CLI to run db upgrade\n" |
|
1190 | printf "rcstack cli db-upgrade - CLI to run db upgrade\n" | |
1191 | echo |
|
1191 | echo | |
1192 |
|
1192 | |||
1193 | else |
|
1193 | else | |
1194 | printf "rcstack cli db-upgrade - CLI to run db upgrade\n" |
|
1194 | printf "rcstack cli db-upgrade - CLI to run db upgrade\n" | |
1195 | echo |
|
1195 | echo | |
1196 |
|
1196 | |||
1197 | fi |
|
1197 | fi | |
1198 |
|
1198 | |||
1199 | printf "%s\n" "Usage:" |
|
1199 | printf "%s\n" "Usage:" | |
1200 | printf " rcstack cli db-upgrade\n" |
|
1200 | printf " rcstack cli db-upgrade\n" | |
1201 | printf " rcstack cli db-upgrade --help | -h\n" |
|
1201 | printf " rcstack cli db-upgrade --help | -h\n" | |
1202 | echo |
|
1202 | echo | |
1203 |
|
1203 | |||
1204 | # :command.long_usage |
|
1204 | # :command.long_usage | |
1205 | if [[ -n $long_usage ]]; then |
|
1205 | if [[ -n $long_usage ]]; then | |
1206 | printf "%s\n" "Options:" |
|
1206 | printf "%s\n" "Options:" | |
1207 |
|
1207 | |||
1208 | # :command.usage_fixed_flags |
|
1208 | # :command.usage_fixed_flags | |
1209 | printf " %s\n" "--help, -h" |
|
1209 | printf " %s\n" "--help, -h" | |
1210 | printf " Show this help\n" |
|
1210 | printf " Show this help\n" | |
1211 | echo |
|
1211 | echo | |
1212 |
|
1212 | |||
1213 | fi |
|
1213 | fi | |
1214 | } |
|
1214 | } | |
1215 |
|
1215 | |||
1216 | # :command.usage |
|
1216 | # :command.usage | |
1217 | rcstack_cli_storage_usage() { |
|
1217 | rcstack_cli_storage_usage() { | |
1218 | if [[ -n $long_usage ]]; then |
|
1218 | if [[ -n $long_usage ]]; then | |
1219 | 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" |
|
1219 | 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" | |
1220 | echo |
|
1220 | echo | |
1221 |
|
1221 | |||
1222 | else |
|
1222 | else | |
1223 | 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" |
|
1223 | 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" | |
1224 | echo |
|
1224 | echo | |
1225 |
|
1225 | |||
1226 | fi |
|
1226 | fi | |
1227 |
|
1227 | |||
1228 | printf "%s\n" "Usage:" |
|
1228 | printf "%s\n" "Usage:" | |
1229 | printf " rcstack cli storage [OPTIONS]\n" |
|
1229 | printf " rcstack cli storage [OPTIONS]\n" | |
1230 | printf " rcstack cli storage --help | -h\n" |
|
1230 | printf " rcstack cli storage --help | -h\n" | |
1231 | echo |
|
1231 | echo | |
1232 |
|
1232 | |||
1233 | # :command.long_usage |
|
1233 | # :command.long_usage | |
1234 | if [[ -n $long_usage ]]; then |
|
1234 | if [[ -n $long_usage ]]; then | |
1235 | printf "%s\n" "Options:" |
|
1235 | printf "%s\n" "Options:" | |
1236 |
|
1236 | |||
1237 | # :command.usage_flags |
|
1237 | # :command.usage_flags | |
1238 | # :flag.usage |
|
1238 | # :flag.usage | |
1239 | printf " %s\n" "--attached ATTACHED" |
|
1239 | printf " %s\n" "--attached ATTACHED" | |
1240 | printf " attach to storage of already running vcsserver container instead\n" |
|
1240 | printf " attach to storage of already running vcsserver container instead\n" | |
1241 | echo |
|
1241 | echo | |
1242 |
|
1242 | |||
1243 | # :command.usage_fixed_flags |
|
1243 | # :command.usage_fixed_flags | |
1244 | printf " %s\n" "--help, -h" |
|
1244 | printf " %s\n" "--help, -h" | |
1245 | printf " Show this help\n" |
|
1245 | printf " Show this help\n" | |
1246 | echo |
|
1246 | echo | |
1247 |
|
1247 | |||
1248 | fi |
|
1248 | fi | |
1249 | } |
|
1249 | } | |
1250 |
|
1250 | |||
1251 | # :command.usage |
|
1251 | # :command.usage | |
1252 | rcstack_cli_attach_usage() { |
|
1252 | rcstack_cli_attach_usage() { | |
1253 | if [[ -n $long_usage ]]; then |
|
1253 | if [[ -n $long_usage ]]; then | |
1254 | printf "rcstack cli attach - attach to running instance of RhodeCode, by default it attaches to rhodecode main web app\n" |
|
1254 | printf "rcstack cli attach - attach to running instance of RhodeCode, by default it attaches to rhodecode main web app\n" | |
1255 | echo |
|
1255 | echo | |
1256 |
|
1256 | |||
1257 | else |
|
1257 | else | |
1258 | printf "rcstack cli attach - attach to running instance of RhodeCode, by default it attaches to rhodecode main web app\n" |
|
1258 | printf "rcstack cli attach - attach to running instance of RhodeCode, by default it attaches to rhodecode main web app\n" | |
1259 | echo |
|
1259 | echo | |
1260 |
|
1260 | |||
1261 | fi |
|
1261 | fi | |
1262 |
|
1262 | |||
1263 | printf "%s\n" "Usage:" |
|
1263 | printf "%s\n" "Usage:" | |
1264 | printf " rcstack cli attach [OPTIONS]\n" |
|
1264 | printf " rcstack cli attach [OPTIONS]\n" | |
1265 | printf " rcstack cli attach --help | -h\n" |
|
1265 | printf " rcstack cli attach --help | -h\n" | |
1266 | echo |
|
1266 | echo | |
1267 |
|
1267 | |||
1268 | # :command.long_usage |
|
1268 | # :command.long_usage | |
1269 | if [[ -n $long_usage ]]; then |
|
1269 | if [[ -n $long_usage ]]; then | |
1270 | printf "%s\n" "Options:" |
|
1270 | printf "%s\n" "Options:" | |
1271 |
|
1271 | |||
1272 | # :command.usage_flags |
|
1272 | # :command.usage_flags | |
1273 | # :flag.usage |
|
1273 | # :flag.usage | |
1274 | printf " %s\n" "--instance-type INSTANCE_TYPE" |
|
1274 | printf " %s\n" "--instance-type INSTANCE_TYPE" | |
1275 | printf " type of instance to attach to\n" |
|
1275 | printf " type of instance to attach to\n" | |
1276 | printf " Default: rhodecode\n" |
|
1276 | printf " Default: rhodecode\n" | |
1277 | echo |
|
1277 | echo | |
1278 |
|
1278 | |||
1279 | # :command.usage_fixed_flags |
|
1279 | # :command.usage_fixed_flags | |
1280 | printf " %s\n" "--help, -h" |
|
1280 | printf " %s\n" "--help, -h" | |
1281 | printf " Show this help\n" |
|
1281 | printf " Show this help\n" | |
1282 | echo |
|
1282 | echo | |
1283 |
|
1283 | |||
1284 | # :command.usage_examples |
|
1284 | # :command.usage_examples | |
1285 | printf "%s\n" "Examples:" |
|
1285 | printf "%s\n" "Examples:" | |
1286 | 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" |
|
1286 | 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" | |
1287 | echo |
|
1287 | echo | |
1288 |
|
1288 | |||
1289 | fi |
|
1289 | fi | |
1290 | } |
|
1290 | } | |
1291 |
|
1291 | |||
1292 | # :command.usage |
|
1292 | # :command.usage | |
1293 | rcstack_cli_set_edition_usage() { |
|
1293 | rcstack_cli_set_edition_usage() { | |
1294 | if [[ -n $long_usage ]]; then |
|
1294 | if [[ -n $long_usage ]]; then | |
1295 | printf "rcstack cli set-edition - set current setup to either CE (Community) or EE (Enterprise) type\n" |
|
1295 | printf "rcstack cli set-edition - set current setup to either CE (Community) or EE (Enterprise) type\n" | |
1296 | echo |
|
1296 | echo | |
1297 |
|
1297 | |||
1298 | else |
|
1298 | else | |
1299 | printf "rcstack cli set-edition - set current setup to either CE (Community) or EE (Enterprise) type\n" |
|
1299 | printf "rcstack cli set-edition - set current setup to either CE (Community) or EE (Enterprise) type\n" | |
1300 | echo |
|
1300 | echo | |
1301 |
|
1301 | |||
1302 | fi |
|
1302 | fi | |
1303 |
|
1303 | |||
1304 | printf "%s\n" "Usage:" |
|
1304 | printf "%s\n" "Usage:" | |
1305 | printf " rcstack cli set-edition EDITION_TYPE\n" |
|
1305 | printf " rcstack cli set-edition EDITION_TYPE\n" | |
1306 | printf " rcstack cli set-edition --help | -h\n" |
|
1306 | printf " rcstack cli set-edition --help | -h\n" | |
1307 | echo |
|
1307 | echo | |
1308 |
|
1308 | |||
1309 | # :command.long_usage |
|
1309 | # :command.long_usage | |
1310 | if [[ -n $long_usage ]]; then |
|
1310 | if [[ -n $long_usage ]]; then | |
1311 | printf "%s\n" "Options:" |
|
1311 | printf "%s\n" "Options:" | |
1312 |
|
1312 | |||
1313 | # :command.usage_fixed_flags |
|
1313 | # :command.usage_fixed_flags | |
1314 | printf " %s\n" "--help, -h" |
|
1314 | printf " %s\n" "--help, -h" | |
1315 | printf " Show this help\n" |
|
1315 | printf " Show this help\n" | |
1316 | echo |
|
1316 | echo | |
1317 |
|
1317 | |||
1318 | # :command.usage_args |
|
1318 | # :command.usage_args | |
1319 | printf "%s\n" "Arguments:" |
|
1319 | printf "%s\n" "Arguments:" | |
1320 |
|
1320 | |||
1321 | # :argument.usage |
|
1321 | # :argument.usage | |
1322 | printf " %s\n" "EDITION_TYPE" |
|
1322 | printf " %s\n" "EDITION_TYPE" | |
1323 | printf " pick type CE or EE\n" |
|
1323 | printf " pick type CE or EE\n" | |
1324 | printf " Allowed: ce, ee\n" |
|
1324 | printf " Allowed: ce, ee\n" | |
1325 | echo |
|
1325 | echo | |
1326 |
|
1326 | |||
1327 | # :command.usage_examples |
|
1327 | # :command.usage_examples | |
1328 | printf "%s\n" "Examples:" |
|
1328 | printf "%s\n" "Examples:" | |
1329 | printf " ./rcstack set-edition ce\n" |
|
1329 | printf " ./rcstack set-edition ce\n" | |
1330 | printf " ./rcstack set-edition ee\n" |
|
1330 | printf " ./rcstack set-edition ee\n" | |
1331 | echo |
|
1331 | echo | |
1332 |
|
1332 | |||
1333 | fi |
|
1333 | fi | |
1334 | } |
|
1334 | } | |
1335 |
|
1335 | |||
1336 | # :command.usage |
|
1336 | # :command.usage | |
1337 | rcstack_cli_configure_vcsserver_usage() { |
|
1337 | rcstack_cli_configure_vcsserver_usage() { | |
1338 | if [[ -n $long_usage ]]; then |
|
1338 | if [[ -n $long_usage ]]; then | |
1339 | printf "rcstack cli configure-vcsserver - reconfigure the vcsserver.ini file\n" |
|
1339 | printf "rcstack cli configure-vcsserver - reconfigure the vcsserver.ini file\n" | |
1340 | echo |
|
1340 | echo | |
1341 |
|
1341 | |||
1342 | else |
|
1342 | else | |
1343 | printf "rcstack cli configure-vcsserver - reconfigure the vcsserver.ini file\n" |
|
1343 | printf "rcstack cli configure-vcsserver - reconfigure the vcsserver.ini file\n" | |
1344 | echo |
|
1344 | echo | |
1345 |
|
1345 | |||
1346 | fi |
|
1346 | fi | |
1347 |
|
1347 | |||
1348 | printf "%s\n" "Usage:" |
|
1348 | printf "%s\n" "Usage:" | |
1349 | printf " rcstack cli configure-vcsserver INI_PATH\n" |
|
1349 | printf " rcstack cli configure-vcsserver INI_PATH\n" | |
1350 | printf " rcstack cli configure-vcsserver --help | -h\n" |
|
1350 | printf " rcstack cli configure-vcsserver --help | -h\n" | |
1351 | echo |
|
1351 | echo | |
1352 |
|
1352 | |||
1353 | # :command.long_usage |
|
1353 | # :command.long_usage | |
1354 | if [[ -n $long_usage ]]; then |
|
1354 | if [[ -n $long_usage ]]; then | |
1355 | printf "%s\n" "Options:" |
|
1355 | printf "%s\n" "Options:" | |
1356 |
|
1356 | |||
1357 | # :command.usage_fixed_flags |
|
1357 | # :command.usage_fixed_flags | |
1358 | printf " %s\n" "--help, -h" |
|
1358 | printf " %s\n" "--help, -h" | |
1359 | printf " Show this help\n" |
|
1359 | printf " Show this help\n" | |
1360 | echo |
|
1360 | echo | |
1361 |
|
1361 | |||
1362 | # :command.usage_args |
|
1362 | # :command.usage_args | |
1363 | printf "%s\n" "Arguments:" |
|
1363 | printf "%s\n" "Arguments:" | |
1364 |
|
1364 | |||
1365 | # :argument.usage |
|
1365 | # :argument.usage | |
1366 | printf " %s\n" "INI_PATH" |
|
1366 | printf " %s\n" "INI_PATH" | |
1367 | printf " Path to vcsserver.ini to reconfigure\n" |
|
1367 | printf " Path to vcsserver.ini to reconfigure\n" | |
1368 | echo |
|
1368 | echo | |
1369 |
|
1369 | |||
1370 | # :command.usage_examples |
|
1370 | # :command.usage_examples | |
1371 | printf "%s\n" "Examples:" |
|
1371 | printf "%s\n" "Examples:" | |
1372 | printf " ./rcstack cli configure-vcs config/_shared/vcsserver.ini\n" |
|
1372 | printf " ./rcstack cli configure-vcs config/_shared/vcsserver.ini\n" | |
1373 | echo |
|
1373 | echo | |
1374 |
|
1374 | |||
1375 | fi |
|
1375 | fi | |
1376 | } |
|
1376 | } | |
1377 |
|
1377 | |||
1378 | # :command.usage |
|
1378 | # :command.usage | |
1379 | rcstack_cli_configure_rhodecode_usage() { |
|
1379 | rcstack_cli_configure_rhodecode_usage() { | |
1380 | if [[ -n $long_usage ]]; then |
|
1380 | if [[ -n $long_usage ]]; then | |
1381 | printf "rcstack cli configure-rhodecode - reconfigure the rhodecode.ini file\n" |
|
1381 | printf "rcstack cli configure-rhodecode - reconfigure the rhodecode.ini file\n" | |
1382 | echo |
|
1382 | echo | |
1383 |
|
1383 | |||
1384 | else |
|
1384 | else | |
1385 | printf "rcstack cli configure-rhodecode - reconfigure the rhodecode.ini file\n" |
|
1385 | printf "rcstack cli configure-rhodecode - reconfigure the rhodecode.ini file\n" | |
1386 | echo |
|
1386 | echo | |
1387 |
|
1387 | |||
1388 | fi |
|
1388 | fi | |
1389 |
|
1389 | |||
1390 | printf "%s\n" "Usage:" |
|
1390 | printf "%s\n" "Usage:" | |
1391 | printf " rcstack cli configure-rhodecode INI_PATH\n" |
|
1391 | printf " rcstack cli configure-rhodecode INI_PATH\n" | |
1392 | printf " rcstack cli configure-rhodecode --help | -h\n" |
|
1392 | printf " rcstack cli configure-rhodecode --help | -h\n" | |
1393 | echo |
|
1393 | echo | |
1394 |
|
1394 | |||
1395 | # :command.long_usage |
|
1395 | # :command.long_usage | |
1396 | if [[ -n $long_usage ]]; then |
|
1396 | if [[ -n $long_usage ]]; then | |
1397 | printf "%s\n" "Options:" |
|
1397 | printf "%s\n" "Options:" | |
1398 |
|
1398 | |||
1399 | # :command.usage_fixed_flags |
|
1399 | # :command.usage_fixed_flags | |
1400 | printf " %s\n" "--help, -h" |
|
1400 | printf " %s\n" "--help, -h" | |
1401 | printf " Show this help\n" |
|
1401 | printf " Show this help\n" | |
1402 | echo |
|
1402 | echo | |
1403 |
|
1403 | |||
1404 | # :command.usage_args |
|
1404 | # :command.usage_args | |
1405 | printf "%s\n" "Arguments:" |
|
1405 | printf "%s\n" "Arguments:" | |
1406 |
|
1406 | |||
1407 | # :argument.usage |
|
1407 | # :argument.usage | |
1408 | printf " %s\n" "INI_PATH" |
|
1408 | printf " %s\n" "INI_PATH" | |
1409 | printf " Path to rhodecode.ini to reconfigure\n" |
|
1409 | printf " Path to rhodecode.ini to reconfigure\n" | |
1410 | echo |
|
1410 | echo | |
1411 |
|
1411 | |||
1412 | # :command.usage_examples |
|
1412 | # :command.usage_examples | |
1413 | printf "%s\n" "Examples:" |
|
1413 | printf "%s\n" "Examples:" | |
1414 | printf " ./rcstack cli configure-rhodecode config/_shared/rhodecode.ini\n" |
|
1414 | printf " ./rcstack cli configure-rhodecode config/_shared/rhodecode.ini\n" | |
1415 | echo |
|
1415 | echo | |
1416 |
|
1416 | |||
1417 | fi |
|
1417 | fi | |
1418 | } |
|
1418 | } | |
1419 |
|
1419 | |||
1420 | # :command.usage |
|
1420 | # :command.usage | |
1421 | rcstack_backup_db_usage() { |
|
1421 | rcstack_backup_db_usage() { | |
1422 | if [[ -n $long_usage ]]; then |
|
1422 | if [[ -n $long_usage ]]; then | |
1423 | printf "rcstack backup-db - Backup Database\n" |
|
1423 | printf "rcstack backup-db - Backup Database\n" | |
1424 | echo |
|
1424 | echo | |
1425 |
|
1425 | |||
1426 | else |
|
1426 | else | |
1427 | printf "rcstack backup-db - Backup Database\n" |
|
1427 | printf "rcstack backup-db - Backup Database\n" | |
1428 | echo |
|
1428 | echo | |
1429 |
|
1429 | |||
1430 | fi |
|
1430 | fi | |
1431 |
|
1431 | |||
1432 | printf "%s\n" "Usage:" |
|
1432 | printf "%s\n" "Usage:" | |
1433 | printf " rcstack backup-db DESTINATION\n" |
|
1433 | printf " rcstack backup-db DESTINATION\n" | |
1434 | printf " rcstack backup-db --help | -h\n" |
|
1434 | printf " rcstack backup-db --help | -h\n" | |
1435 | echo |
|
1435 | echo | |
1436 |
|
1436 | |||
1437 | # :command.long_usage |
|
1437 | # :command.long_usage | |
1438 | if [[ -n $long_usage ]]; then |
|
1438 | if [[ -n $long_usage ]]; then | |
1439 | printf "%s\n" "Options:" |
|
1439 | printf "%s\n" "Options:" | |
1440 |
|
1440 | |||
1441 | # :command.usage_fixed_flags |
|
1441 | # :command.usage_fixed_flags | |
1442 | printf " %s\n" "--help, -h" |
|
1442 | printf " %s\n" "--help, -h" | |
1443 | printf " Show this help\n" |
|
1443 | printf " Show this help\n" | |
1444 | echo |
|
1444 | echo | |
1445 |
|
1445 | |||
1446 | # :command.usage_args |
|
1446 | # :command.usage_args | |
1447 | printf "%s\n" "Arguments:" |
|
1447 | printf "%s\n" "Arguments:" | |
1448 |
|
1448 | |||
1449 | # :argument.usage |
|
1449 | # :argument.usage | |
1450 | printf " %s\n" "DESTINATION" |
|
1450 | printf " %s\n" "DESTINATION" | |
1451 | printf " Destination directory to store backup archive\n" |
|
1451 | printf " Destination directory to store backup archive\n" | |
1452 | echo |
|
1452 | echo | |
1453 |
|
1453 | |||
1454 | # :command.usage_examples |
|
1454 | # :command.usage_examples | |
1455 | printf "%s\n" "Examples:" |
|
1455 | printf "%s\n" "Examples:" | |
1456 | 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" |
|
1456 | 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" | |
1457 | echo |
|
1457 | echo | |
1458 |
|
1458 | |||
1459 | fi |
|
1459 | fi | |
1460 | } |
|
1460 | } | |
1461 |
|
1461 | |||
1462 | # :command.usage |
|
1462 | # :command.usage | |
1463 | rcstack_backup_data_usage() { |
|
1463 | rcstack_backup_data_usage() { | |
1464 | if [[ -n $long_usage ]]; then |
|
1464 | if [[ -n $long_usage ]]; then | |
1465 | printf "rcstack backup-data - Backup RhodeCode storage\n" |
|
1465 | printf "rcstack backup-data - Backup RhodeCode storage\n" | |
1466 | echo |
|
1466 | echo | |
1467 |
|
1467 | |||
1468 | else |
|
1468 | else | |
1469 | printf "rcstack backup-data - Backup RhodeCode storage\n" |
|
1469 | printf "rcstack backup-data - Backup RhodeCode storage\n" | |
1470 | echo |
|
1470 | echo | |
1471 |
|
1471 | |||
1472 | fi |
|
1472 | fi | |
1473 |
|
1473 | |||
1474 | printf "%s\n" "Usage:" |
|
1474 | printf "%s\n" "Usage:" | |
1475 | printf " rcstack backup-data DESTINATION\n" |
|
1475 | printf " rcstack backup-data DESTINATION\n" | |
1476 | printf " rcstack backup-data --help | -h\n" |
|
1476 | printf " rcstack backup-data --help | -h\n" | |
1477 | echo |
|
1477 | echo | |
1478 |
|
1478 | |||
1479 | # :command.long_usage |
|
1479 | # :command.long_usage | |
1480 | if [[ -n $long_usage ]]; then |
|
1480 | if [[ -n $long_usage ]]; then | |
1481 | printf "%s\n" "Options:" |
|
1481 | printf "%s\n" "Options:" | |
1482 |
|
1482 | |||
1483 | # :command.usage_fixed_flags |
|
1483 | # :command.usage_fixed_flags | |
1484 | printf " %s\n" "--help, -h" |
|
1484 | printf " %s\n" "--help, -h" | |
1485 | printf " Show this help\n" |
|
1485 | printf " Show this help\n" | |
1486 | echo |
|
1486 | echo | |
1487 |
|
1487 | |||
1488 | # :command.usage_args |
|
1488 | # :command.usage_args | |
1489 | printf "%s\n" "Arguments:" |
|
1489 | printf "%s\n" "Arguments:" | |
1490 |
|
1490 | |||
1491 | # :argument.usage |
|
1491 | # :argument.usage | |
1492 | printf " %s\n" "DESTINATION" |
|
1492 | printf " %s\n" "DESTINATION" | |
1493 | printf " Destination directory to store backup archive\n" |
|
1493 | printf " Destination directory to store backup archive\n" | |
1494 | echo |
|
1494 | echo | |
1495 |
|
1495 | |||
1496 | # :command.usage_examples |
|
1496 | # :command.usage_examples | |
1497 | printf "%s\n" "Examples:" |
|
1497 | printf "%s\n" "Examples:" | |
1498 | printf " # make backup gz compressed for rhodecode containers, and all volumes\n - ./rcstack backup-data /home/my-data-backup\n" |
|
1498 | printf " # make backup gz compressed for rhodecode containers, and all volumes\n - ./rcstack backup-data /home/my-data-backup\n" | |
1499 | echo |
|
1499 | echo | |
1500 |
|
1500 | |||
1501 | fi |
|
1501 | fi | |
1502 | } |
|
1502 | } | |
1503 |
|
1503 | |||
1504 | # :command.usage |
|
1504 | # :command.usage | |
1505 | rcstack_get_build_artifacts_usage() { |
|
1505 | rcstack_get_build_artifacts_usage() { | |
1506 | if [[ -n $long_usage ]]; then |
|
1506 | if [[ -n $long_usage ]]; then | |
1507 | printf "rcstack get-build-artifacts - Fetch Artifacts to run installer based build\n" |
|
1507 | printf "rcstack get-build-artifacts - Fetch Artifacts to run installer based build\n" | |
1508 | echo |
|
1508 | echo | |
1509 |
|
1509 | |||
1510 | else |
|
1510 | else | |
1511 | printf "rcstack get-build-artifacts - Fetch Artifacts to run installer based build\n" |
|
1511 | printf "rcstack get-build-artifacts - Fetch Artifacts to run installer based build\n" | |
1512 | echo |
|
1512 | echo | |
1513 |
|
1513 | |||
1514 | fi |
|
1514 | fi | |
1515 |
|
1515 | |||
1516 | printf "%s\n" "Usage:" |
|
1516 | printf "%s\n" "Usage:" | |
1517 | printf " rcstack get-build-artifacts [OPTIONS]\n" |
|
1517 | printf " rcstack get-build-artifacts [OPTIONS]\n" | |
1518 | printf " rcstack get-build-artifacts --help | -h\n" |
|
1518 | printf " rcstack get-build-artifacts --help | -h\n" | |
1519 | echo |
|
1519 | echo | |
1520 |
|
1520 | |||
1521 | # :command.long_usage |
|
1521 | # :command.long_usage | |
1522 | if [[ -n $long_usage ]]; then |
|
1522 | if [[ -n $long_usage ]]; then | |
1523 | printf "%s\n" "Options:" |
|
1523 | printf "%s\n" "Options:" | |
1524 |
|
1524 | |||
1525 | # :command.usage_flags |
|
1525 | # :command.usage_flags | |
1526 | # :flag.usage |
|
1526 | # :flag.usage | |
1527 | printf " %s\n" "--auth AUTH" |
|
1527 | printf " %s\n" "--auth AUTH" | |
1528 | printf " Specify custom auth for curl e.g -u admin:secret\n" |
|
1528 | printf " Specify custom auth for curl e.g -u admin:secret\n" | |
1529 | printf " Default: \n" |
|
1529 | printf " Default: \n" | |
1530 | echo |
|
1530 | echo | |
1531 |
|
1531 | |||
1532 | # :flag.usage |
|
1532 | # :flag.usage | |
1533 | printf " %s\n" "--installer-url INSTALLER_URL" |
|
1533 | printf " %s\n" "--installer-url INSTALLER_URL" | |
1534 | printf " Installer Download URL\n" |
|
1534 | printf " Installer Download URL\n" | |
1535 | printf " Default: https://dls.rhodecode.com/dls/N2E2ZTY1NzA3NjYxNDA2NTc1NjI3MTcyNzA2MjcxNzIyZTcwNjI3YQ==/rhodecode-control/latest-linux-ee\n" |
|
1535 | printf " Default: https://dls.rhodecode.com/dls/N2E2ZTY1NzA3NjYxNDA2NTc1NjI3MTcyNzA2MjcxNzIyZTcwNjI3YQ==/rhodecode-control/latest-linux-ee\n" | |
1536 | echo |
|
1536 | echo | |
1537 |
|
1537 | |||
1538 | # :flag.usage |
|
1538 | # :flag.usage | |
1539 | printf " %s\n" "--manifest-url MANIFEST_URL" |
|
1539 | printf " %s\n" "--manifest-url MANIFEST_URL" | |
1540 | printf " Manifest file url\n" |
|
1540 | printf " Manifest file url\n" | |
1541 | printf " Default: https://dls.rhodecode.com/linux/MANIFEST\n" |
|
1541 | printf " Default: https://dls.rhodecode.com/linux/MANIFEST\n" | |
1542 | echo |
|
1542 | echo | |
1543 |
|
1543 | |||
1544 | # :flag.usage |
|
1544 | # :flag.usage | |
1545 | printf " %s\n" "--version-name VERSION_NAME" |
|
1545 | printf " %s\n" "--version-name VERSION_NAME" | |
1546 | printf " Specify custom build ver e.g 4.27.0\n" |
|
1546 | printf " Specify custom build ver e.g 4.27.0\n" | |
1547 | printf " Default: $RC_CLI_VERSION_NAME\n" |
|
1547 | printf " Default: $RC_CLI_VERSION_NAME\n" | |
1548 | echo |
|
1548 | echo | |
1549 |
|
1549 | |||
1550 | # :command.usage_fixed_flags |
|
1550 | # :command.usage_fixed_flags | |
1551 | printf " %s\n" "--help, -h" |
|
1551 | printf " %s\n" "--help, -h" | |
1552 | printf " Show this help\n" |
|
1552 | printf " Show this help\n" | |
1553 | echo |
|
1553 | echo | |
1554 |
|
1554 | |||
1555 | fi |
|
1555 | fi | |
1556 | } |
|
1556 | } | |
1557 |
|
1557 | |||
1558 | # :command.usage |
|
1558 | # :command.usage | |
1559 | rcstack_build_installer_usage() { |
|
1559 | rcstack_build_installer_usage() { | |
1560 | if [[ -n $long_usage ]]; then |
|
1560 | if [[ -n $long_usage ]]; then | |
1561 | printf "rcstack build-installer - Build RhodeCode image from installer, ./rcstack get-build-artifacts initially\n" |
|
1561 | printf "rcstack build-installer - Build RhodeCode image from installer, ./rcstack get-build-artifacts initially\n" | |
1562 | echo |
|
1562 | echo | |
1563 |
|
1563 | |||
1564 | else |
|
1564 | else | |
1565 | printf "rcstack build-installer - Build RhodeCode image from installer, ./rcstack get-build-artifacts initially\n" |
|
1565 | printf "rcstack build-installer - Build RhodeCode image from installer, ./rcstack get-build-artifacts initially\n" | |
1566 | echo |
|
1566 | echo | |
1567 |
|
1567 | |||
1568 | fi |
|
1568 | fi | |
1569 |
|
1569 | |||
1570 | printf "%s\n" "Usage:" |
|
1570 | printf "%s\n" "Usage:" | |
1571 | printf " rcstack build-installer [OPTIONS]\n" |
|
1571 | printf " rcstack build-installer [OPTIONS]\n" | |
1572 | printf " rcstack build-installer --help | -h\n" |
|
1572 | printf " rcstack build-installer --help | -h\n" | |
1573 | echo |
|
1573 | echo | |
1574 |
|
1574 | |||
1575 | # :command.long_usage |
|
1575 | # :command.long_usage | |
1576 | if [[ -n $long_usage ]]; then |
|
1576 | if [[ -n $long_usage ]]; then | |
1577 | printf "%s\n" "Options:" |
|
1577 | printf "%s\n" "Options:" | |
1578 |
|
1578 | |||
1579 | # :command.usage_flags |
|
1579 | # :command.usage_flags | |
1580 | # :flag.usage |
|
1580 | # :flag.usage | |
1581 | printf " %s\n" "--version-name VERSION_NAME" |
|
1581 | printf " %s\n" "--version-name VERSION_NAME" | |
1582 | printf " Specify custom build ver e.g 4.27.0\n" |
|
1582 | printf " Specify custom build ver e.g 4.27.0\n" | |
1583 | printf " Default: $RC_CLI_VERSION_NAME\n" |
|
1583 | printf " Default: $RC_CLI_VERSION_NAME\n" | |
1584 | echo |
|
1584 | echo | |
1585 |
|
1585 | |||
1586 | # :command.usage_fixed_flags |
|
1586 | # :command.usage_fixed_flags | |
1587 | printf " %s\n" "--help, -h" |
|
1587 | printf " %s\n" "--help, -h" | |
1588 | printf " Show this help\n" |
|
1588 | printf " Show this help\n" | |
1589 | echo |
|
1589 | echo | |
1590 |
|
1590 | |||
1591 | fi |
|
1591 | fi | |
1592 | } |
|
1592 | } | |
1593 |
|
1593 | |||
1594 | # :command.usage |
|
1594 | # :command.usage | |
1595 | rcstack_get_build_source_usage() { |
|
1595 | rcstack_get_build_source_usage() { | |
1596 | if [[ -n $long_usage ]]; then |
|
1596 | if [[ -n $long_usage ]]; then | |
1597 | printf "rcstack get-build-source - Fetch RhodeCode sources, store in .source dir to run a source-based builds\n" |
|
1597 | printf "rcstack get-build-source - Fetch RhodeCode sources, store in .source dir to run a source-based builds\n" | |
1598 | echo |
|
1598 | echo | |
1599 |
|
1599 | |||
1600 | else |
|
1600 | else | |
1601 | printf "rcstack get-build-source - Fetch RhodeCode sources, store in .source dir to run a source-based builds\n" |
|
1601 | printf "rcstack get-build-source - Fetch RhodeCode sources, store in .source dir to run a source-based builds\n" | |
1602 | echo |
|
1602 | echo | |
1603 |
|
1603 | |||
1604 | fi |
|
1604 | fi | |
1605 |
|
1605 | |||
1606 | printf "%s\n" "Usage:" |
|
1606 | printf "%s\n" "Usage:" | |
1607 | printf " rcstack get-build-source [OPTIONS]\n" |
|
1607 | printf " rcstack get-build-source [OPTIONS]\n" | |
1608 | printf " rcstack get-build-source --help | -h\n" |
|
1608 | printf " rcstack get-build-source --help | -h\n" | |
1609 | echo |
|
1609 | echo | |
1610 |
|
1610 | |||
1611 | # :command.long_usage |
|
1611 | # :command.long_usage | |
1612 | if [[ -n $long_usage ]]; then |
|
1612 | if [[ -n $long_usage ]]; then | |
1613 | printf "%s\n" "Options:" |
|
1613 | printf "%s\n" "Options:" | |
1614 |
|
1614 | |||
1615 | # :command.usage_flags |
|
1615 | # :command.usage_flags | |
1616 | # :flag.usage |
|
1616 | # :flag.usage | |
1617 | printf " %s\n" "--revision REVISION" |
|
1617 | printf " %s\n" "--revision REVISION" | |
1618 | printf " revision to download\n" |
|
1618 | printf " revision to download\n" | |
1619 | printf " Default: default\n" |
|
1619 | printf " Default: default\n" | |
1620 | echo |
|
1620 | echo | |
1621 |
|
1621 | |||
1622 | # :flag.usage |
|
1622 | # :flag.usage | |
1623 | printf " %s\n" "--auth-token AUTH_TOKEN" |
|
1623 | printf " %s\n" "--auth-token AUTH_TOKEN" | |
1624 | printf " Specify AUTH TOKEN to obtain sources\n" |
|
1624 | printf " Specify AUTH TOKEN to obtain sources\n" | |
1625 | echo |
|
1625 | echo | |
1626 |
|
1626 | |||
1627 | # :flag.usage |
|
1627 | # :flag.usage | |
1628 | printf " %s\n" "--server-url SERVER_URL" |
|
1628 | printf " %s\n" "--server-url SERVER_URL" | |
1629 | printf " Specify RhodeCode server location where projects should be downloaded\n" |
|
1629 | printf " Specify RhodeCode server location where projects should be downloaded\n" | |
1630 | printf " Default: https://code.rhodecode.com\n" |
|
1630 | printf " Default: https://code.rhodecode.com\n" | |
1631 | echo |
|
1631 | echo | |
1632 |
|
1632 | |||
1633 | # :command.usage_fixed_flags |
|
1633 | # :command.usage_fixed_flags | |
1634 | printf " %s\n" "--help, -h" |
|
1634 | printf " %s\n" "--help, -h" | |
1635 | printf " Show this help\n" |
|
1635 | printf " Show this help\n" | |
1636 | echo |
|
1636 | echo | |
1637 |
|
1637 | |||
1638 | # :command.usage_examples |
|
1638 | # :command.usage_examples | |
1639 | printf "%s\n" "Examples:" |
|
1639 | printf "%s\n" "Examples:" | |
1640 | printf " ./rcstack get-sources $RC_CLI_VERSION_NAME\n" |
|
1640 | printf " ./rcstack get-sources $RC_CLI_VERSION_NAME\n" | |
1641 | printf " ./rcstack get-sources default --auth-token xyxyxyx --server-url\n https://secret.repo/\n" |
|
1641 | printf " ./rcstack get-sources default --auth-token xyxyxyx --server-url\n https://secret.repo/\n" | |
1642 | echo |
|
1642 | echo | |
1643 |
|
1643 | |||
1644 | fi |
|
1644 | fi | |
1645 | } |
|
1645 | } | |
1646 |
|
1646 | |||
1647 | # :command.usage |
|
1647 | # :command.usage | |
1648 | rcstack_build_source_usage() { |
|
1648 | rcstack_build_source_usage() { | |
1649 | if [[ -n $long_usage ]]; then |
|
1649 | if [[ -n $long_usage ]]; then | |
1650 | printf "rcstack build-source - Build RhodeCode image from source, requires ./rcstack get-build-source initially\n" |
|
1650 | printf "rcstack build-source - Build RhodeCode image from source, requires ./rcstack get-build-source initially\n" | |
1651 | echo |
|
1651 | echo | |
1652 |
|
1652 | |||
1653 | else |
|
1653 | else | |
1654 | printf "rcstack build-source - Build RhodeCode image from source, requires ./rcstack get-build-source initially\n" |
|
1654 | printf "rcstack build-source - Build RhodeCode image from source, requires ./rcstack get-build-source initially\n" | |
1655 | echo |
|
1655 | echo | |
1656 |
|
1656 | |||
1657 | fi |
|
1657 | fi | |
1658 |
|
1658 | |||
1659 | printf "%s\n" "Usage:" |
|
1659 | printf "%s\n" "Usage:" | |
1660 | printf " rcstack build-source [OPTIONS]\n" |
|
1660 | printf " rcstack build-source [OPTIONS]\n" | |
1661 | printf " rcstack build-source --help | -h\n" |
|
1661 | printf " rcstack build-source --help | -h\n" | |
1662 | echo |
|
1662 | echo | |
1663 |
|
1663 | |||
1664 | # :command.long_usage |
|
1664 | # :command.long_usage | |
1665 | if [[ -n $long_usage ]]; then |
|
1665 | if [[ -n $long_usage ]]; then | |
1666 | printf "%s\n" "Options:" |
|
1666 | printf "%s\n" "Options:" | |
1667 |
|
1667 | |||
1668 | # :command.usage_flags |
|
1668 | # :command.usage_flags | |
1669 | # :flag.usage |
|
1669 | # :flag.usage | |
1670 | printf " %s\n" "--version-name VERSION_NAME" |
|
1670 | printf " %s\n" "--version-name VERSION_NAME" | |
1671 | printf " Specify custom build ver e.g 4.27.0\n" |
|
1671 | printf " Specify custom build ver e.g 4.27.0\n" | |
1672 | printf " Default: $RC_CLI_VERSION_NAME\n" |
|
1672 | printf " Default: $RC_CLI_VERSION_NAME\n" | |
1673 | echo |
|
1673 | echo | |
1674 |
|
1674 | |||
1675 | # :flag.usage |
|
1675 | # :flag.usage | |
1676 | printf " %s\n" "--source-build-yaml BUILD_SOURCE_YAML" |
|
1676 | printf " %s\n" "--source-build-yaml BUILD_SOURCE_YAML" | |
1677 | printf " yaml file to build source against\n" |
|
1677 | printf " yaml file to build source against\n" | |
1678 | echo |
|
1678 | echo | |
1679 |
|
1679 | |||
1680 | # :flag.usage |
|
1680 | # :flag.usage | |
1681 | printf " %s\n" "--tag TAG (repeatable)" |
|
1681 | printf " %s\n" "--tag TAG (repeatable)" | |
1682 | printf " tag build image\n" |
|
1682 | printf " tag build image\n" | |
1683 | echo |
|
1683 | echo | |
1684 |
|
1684 | |||
1685 | # :command.usage_fixed_flags |
|
1685 | # :command.usage_fixed_flags | |
1686 | printf " %s\n" "--help, -h" |
|
1686 | printf " %s\n" "--help, -h" | |
1687 | printf " Show this help\n" |
|
1687 | printf " Show this help\n" | |
1688 | echo |
|
1688 | echo | |
1689 |
|
1689 | |||
1690 | # :command.usage_examples |
|
1690 | # :command.usage_examples | |
1691 | printf "%s\n" "Examples:" |
|
1691 | printf "%s\n" "Examples:" | |
1692 | printf " ./rcstack build-source --source-build-yaml\n build_yaml/docker-compose-apps.5.yaml --version-name 5.0.0.beta1 --tag beta\n" |
|
1692 | printf " ./rcstack build-source --source-build-yaml\n build_yaml/docker-compose-apps.5.yaml --version-name 5.0.0.beta1 --tag beta\n" | |
1693 | printf " ./rcstack build-source --source-build-yaml\n build_yaml/docker-compose-apps.venv.yaml --version-name 4.28.0\n" |
|
1693 | printf " ./rcstack build-source --source-build-yaml\n build_yaml/docker-compose-apps.venv.yaml --version-name 4.28.0\n" | |
1694 | echo |
|
1694 | echo | |
1695 |
|
1695 | |||
1696 | fi |
|
1696 | fi | |
1697 | } |
|
1697 | } | |
1698 |
|
1698 | |||
1699 | # :command.usage |
|
1699 | # :command.usage | |
1700 | rcstack__completions_usage() { |
|
1700 | rcstack__completions_usage() { | |
1701 | if [[ -n $long_usage ]]; then |
|
1701 | if [[ -n $long_usage ]]; then | |
1702 | printf "rcstack _completions - Generate completions\n" |
|
1702 | printf "rcstack _completions - Generate completions\n" | |
1703 | echo |
|
1703 | echo | |
1704 |
|
1704 | |||
1705 | else |
|
1705 | else | |
1706 | printf "rcstack _completions - Generate completions\n" |
|
1706 | printf "rcstack _completions - Generate completions\n" | |
1707 | echo |
|
1707 | echo | |
1708 |
|
1708 | |||
1709 | fi |
|
1709 | fi | |
1710 |
|
1710 | |||
1711 | printf "%s\n" "Usage:" |
|
1711 | printf "%s\n" "Usage:" | |
1712 | printf " rcstack _completions\n" |
|
1712 | printf " rcstack _completions\n" | |
1713 | printf " rcstack _completions --help | -h\n" |
|
1713 | printf " rcstack _completions --help | -h\n" | |
1714 | echo |
|
1714 | echo | |
1715 |
|
1715 | |||
1716 | # :command.long_usage |
|
1716 | # :command.long_usage | |
1717 | if [[ -n $long_usage ]]; then |
|
1717 | if [[ -n $long_usage ]]; then | |
1718 | printf "%s\n" "Options:" |
|
1718 | printf "%s\n" "Options:" | |
1719 |
|
1719 | |||
1720 | # :command.usage_fixed_flags |
|
1720 | # :command.usage_fixed_flags | |
1721 | printf " %s\n" "--help, -h" |
|
1721 | printf " %s\n" "--help, -h" | |
1722 | printf " Show this help\n" |
|
1722 | printf " Show this help\n" | |
1723 | echo |
|
1723 | echo | |
1724 |
|
1724 | |||
1725 | fi |
|
1725 | fi | |
1726 | } |
|
1726 | } | |
1727 |
|
1727 | |||
1728 | # :command.normalize_input |
|
1728 | # :command.normalize_input | |
1729 | normalize_input() { |
|
1729 | normalize_input() { | |
1730 | local arg flags |
|
1730 | local arg flags | |
1731 |
|
1731 | |||
1732 | while [[ $# -gt 0 ]]; do |
|
1732 | while [[ $# -gt 0 ]]; do | |
1733 | arg="$1" |
|
1733 | arg="$1" | |
1734 | if [[ $arg =~ ^(--[a-zA-Z0-9_\-]+)=(.+)$ ]]; then |
|
1734 | if [[ $arg =~ ^(--[a-zA-Z0-9_\-]+)=(.+)$ ]]; then | |
1735 | input+=("${BASH_REMATCH[1]}") |
|
1735 | input+=("${BASH_REMATCH[1]}") | |
1736 | input+=("${BASH_REMATCH[2]}") |
|
1736 | input+=("${BASH_REMATCH[2]}") | |
1737 | elif [[ $arg =~ ^(-[a-zA-Z0-9])=(.+)$ ]]; then |
|
1737 | elif [[ $arg =~ ^(-[a-zA-Z0-9])=(.+)$ ]]; then | |
1738 | input+=("${BASH_REMATCH[1]}") |
|
1738 | input+=("${BASH_REMATCH[1]}") | |
1739 | input+=("${BASH_REMATCH[2]}") |
|
1739 | input+=("${BASH_REMATCH[2]}") | |
1740 | elif [[ $arg =~ ^-([a-zA-Z0-9][a-zA-Z0-9]+)$ ]]; then |
|
1740 | elif [[ $arg =~ ^-([a-zA-Z0-9][a-zA-Z0-9]+)$ ]]; then | |
1741 | flags="${BASH_REMATCH[1]}" |
|
1741 | flags="${BASH_REMATCH[1]}" | |
1742 | for ((i = 0; i < ${#flags}; i++)); do |
|
1742 | for ((i = 0; i < ${#flags}; i++)); do | |
1743 | input+=("-${flags:i:1}") |
|
1743 | input+=("-${flags:i:1}") | |
1744 | done |
|
1744 | done | |
1745 | else |
|
1745 | else | |
1746 | input+=("$arg") |
|
1746 | input+=("$arg") | |
1747 | fi |
|
1747 | fi | |
1748 |
|
1748 | |||
1749 | shift |
|
1749 | shift | |
1750 | done |
|
1750 | done | |
1751 | } |
|
1751 | } | |
1752 | # :command.inspect_args |
|
1752 | # :command.inspect_args | |
1753 | inspect_args() { |
|
1753 | inspect_args() { | |
1754 | if ((${#args[@]})); then |
|
1754 | if ((${#args[@]})); then | |
1755 | readarray -t sorted_keys < <(printf '%s\n' "${!args[@]}" | sort) |
|
1755 | readarray -t sorted_keys < <(printf '%s\n' "${!args[@]}" | sort) | |
1756 | echo args: |
|
1756 | echo args: | |
1757 | for k in "${sorted_keys[@]}"; do echo "- \${args[$k]} = ${args[$k]}"; done |
|
1757 | for k in "${sorted_keys[@]}"; do echo "- \${args[$k]} = ${args[$k]}"; done | |
1758 | else |
|
1758 | else | |
1759 | echo args: none |
|
1759 | echo args: none | |
1760 | fi |
|
1760 | fi | |
1761 |
|
1761 | |||
1762 | if ((${#other_args[@]})); then |
|
1762 | if ((${#other_args[@]})); then | |
1763 | echo |
|
1763 | echo | |
1764 | echo other_args: |
|
1764 | echo other_args: | |
1765 | echo "- \${other_args[*]} = ${other_args[*]}" |
|
1765 | echo "- \${other_args[*]} = ${other_args[*]}" | |
1766 | for i in "${!other_args[@]}"; do |
|
1766 | for i in "${!other_args[@]}"; do | |
1767 | echo "- \${other_args[$i]} = ${other_args[$i]}" |
|
1767 | echo "- \${other_args[$i]} = ${other_args[$i]}" | |
1768 | done |
|
1768 | done | |
1769 | fi |
|
1769 | fi | |
1770 |
|
1770 | |||
1771 | if ((${#deps[@]})); then |
|
1771 | if ((${#deps[@]})); then | |
1772 | readarray -t sorted_keys < <(printf '%s\n' "${!deps[@]}" | sort) |
|
1772 | readarray -t sorted_keys < <(printf '%s\n' "${!deps[@]}" | sort) | |
1773 | echo |
|
1773 | echo | |
1774 | echo deps: |
|
1774 | echo deps: | |
1775 | for k in "${sorted_keys[@]}"; do echo "- \${deps[$k]} = ${deps[$k]}"; done |
|
1775 | for k in "${sorted_keys[@]}"; do echo "- \${deps[$k]} = ${deps[$k]}"; done | |
1776 | fi |
|
1776 | fi | |
1777 |
|
1777 | |||
1778 | } |
|
1778 | } | |
1779 |
|
1779 | |||
1780 | # :command.user_lib |
|
1780 | # :command.user_lib | |
1781 | # src/lib/check_bootstrap.sh |
|
1781 | # src/lib/check_bootstrap.sh | |
1782 |
|
1782 | |||
1783 | check_bootstrap() { |
|
1783 | check_bootstrap() { | |
1784 | # Avoid destroying bootstrapping by simple start/stop |
|
1784 | # Avoid destroying bootstrapping by simple start/stop | |
1785 | for stage_name in $BOOTSTRAP_STAGES; do |
|
1785 | for stage_name in $BOOTSTRAP_STAGES; do | |
1786 | if ! config_has_key $stage_name ; then |
|
1786 | if ! config_has_key $stage_name ; then | |
1787 | echo "$(yellow WARNING:) Bootstrap key $stage_name not found in config file $CONFIG_FILE!" |
|
1787 | echo "$(yellow WARNING:) Bootstrap key $stage_name not found in config file $CONFIG_FILE!" | |
1788 | echo "$(yellow NOTICE:) Run this first: ./$RC_SCRIPT_NAME init" |
|
1788 | echo "$(yellow NOTICE:) Run this first: ./$RC_SCRIPT_NAME init" | |
1789 | exit |
|
1789 | exit | |
1790 | fi |
|
1790 | fi | |
1791 | done |
|
1791 | done | |
1792 |
|
1792 | |||
1793 | } |
|
1793 | } | |
1794 |
|
1794 | |||
1795 | # src/lib/colors.sh |
|
1795 | # src/lib/colors.sh | |
1796 | print_in_color() { |
|
1796 | print_in_color() { | |
1797 | local color="$1" |
|
1797 | local color="$1" | |
1798 | shift |
|
1798 | shift | |
1799 | if [[ -z ${NO_COLOR+x} ]]; then |
|
1799 | if [[ -z ${NO_COLOR+x} ]]; then | |
1800 | printf "$color%b\e[0m\n" "$*" |
|
1800 | printf "$color%b\e[0m\n" "$*" | |
1801 | else |
|
1801 | else | |
1802 | printf "%b\n" "$*" |
|
1802 | printf "%b\n" "$*" | |
1803 | fi |
|
1803 | fi | |
1804 | } |
|
1804 | } | |
1805 |
|
1805 | |||
1806 | red() { print_in_color "\e[31m" "$*"; } |
|
1806 | red() { print_in_color "\e[31m" "$*"; } | |
1807 | green() { print_in_color "\e[32m" "$*"; } |
|
1807 | green() { print_in_color "\e[32m" "$*"; } | |
1808 | yellow() { print_in_color "\e[33m" "$*"; } |
|
1808 | yellow() { print_in_color "\e[33m" "$*"; } | |
1809 | blue() { print_in_color "\e[34m" "$*"; } |
|
1809 | blue() { print_in_color "\e[34m" "$*"; } | |
1810 | magenta() { print_in_color "\e[35m" "$*"; } |
|
1810 | magenta() { print_in_color "\e[35m" "$*"; } | |
1811 | cyan() { print_in_color "\e[36m" "$*"; } |
|
1811 | cyan() { print_in_color "\e[36m" "$*"; } | |
1812 | bold() { print_in_color "\e[1m" "$*"; } |
|
1812 | bold() { print_in_color "\e[1m" "$*"; } | |
1813 | underlined() { print_in_color "\e[4m" "$*"; } |
|
1813 | underlined() { print_in_color "\e[4m" "$*"; } | |
1814 | red_bold() { print_in_color "\e[1;31m" "$*"; } |
|
1814 | red_bold() { print_in_color "\e[1;31m" "$*"; } | |
1815 | green_bold() { print_in_color "\e[1;32m" "$*"; } |
|
1815 | green_bold() { print_in_color "\e[1;32m" "$*"; } | |
1816 | yellow_bold() { print_in_color "\e[1;33m" "$*"; } |
|
1816 | yellow_bold() { print_in_color "\e[1;33m" "$*"; } | |
1817 | blue_bold() { print_in_color "\e[1;34m" "$*"; } |
|
1817 | blue_bold() { print_in_color "\e[1;34m" "$*"; } | |
1818 | magenta_bold() { print_in_color "\e[1;35m" "$*"; } |
|
1818 | magenta_bold() { print_in_color "\e[1;35m" "$*"; } | |
1819 | cyan_bold() { print_in_color "\e[1;36m" "$*"; } |
|
1819 | cyan_bold() { print_in_color "\e[1;36m" "$*"; } | |
1820 | red_underlined() { print_in_color "\e[4;31m" "$*"; } |
|
1820 | red_underlined() { print_in_color "\e[4;31m" "$*"; } | |
1821 | green_underlined() { print_in_color "\e[4;32m" "$*"; } |
|
1821 | green_underlined() { print_in_color "\e[4;32m" "$*"; } | |
1822 | yellow_underlined() { print_in_color "\e[4;33m" "$*"; } |
|
1822 | yellow_underlined() { print_in_color "\e[4;33m" "$*"; } | |
1823 | blue_underlined() { print_in_color "\e[4;34m" "$*"; } |
|
1823 | blue_underlined() { print_in_color "\e[4;34m" "$*"; } | |
1824 | magenta_underlined() { print_in_color "\e[4;35m" "$*"; } |
|
1824 | magenta_underlined() { print_in_color "\e[4;35m" "$*"; } | |
1825 | cyan_underlined() { print_in_color "\e[4;36m" "$*"; } |
|
1825 | cyan_underlined() { print_in_color "\e[4;36m" "$*"; } | |
1826 |
|
1826 | |||
1827 | # src/lib/config.sh |
|
1827 | # src/lib/config.sh | |
1828 |
|
1828 | |||
1829 | config_show() { |
|
1829 | config_show() { | |
1830 | config_load |
|
1830 | config_load | |
1831 | ini_show |
|
1831 | ini_show | |
1832 | } |
|
1832 | } | |
1833 |
|
1833 | |||
1834 | config_get() { |
|
1834 | config_get() { | |
1835 | local key="$1" |
|
1835 | local key="$1" | |
1836 | local default_value="$2" |
|
1836 | local default_value="$2" | |
1837 |
|
1837 | |||
1838 | config_load |
|
1838 | config_load | |
1839 | echo "${ini["$key"]:-$default_value}" |
|
1839 | echo "${ini["$key"]:-$default_value}" | |
1840 | } |
|
1840 | } | |
1841 |
|
1841 | |||
1842 | config_set() { |
|
1842 | config_set() { | |
1843 | local key="$1" |
|
1843 | local key="$1" | |
1844 | shift |
|
1844 | shift | |
1845 | local value="$*" |
|
1845 | local value="$*" | |
1846 |
|
1846 | |||
1847 | config_load |
|
1847 | config_load | |
1848 | ini["$key"]="$value" |
|
1848 | ini["$key"]="$value" | |
1849 | config_save |
|
1849 | config_save | |
1850 | } |
|
1850 | } | |
1851 |
|
1851 | |||
1852 | config_del() { |
|
1852 | config_del() { | |
1853 | local key="$1" |
|
1853 | local key="$1" | |
1854 |
|
1854 | |||
1855 | config_load |
|
1855 | config_load | |
1856 | unset "ini[$key]" |
|
1856 | unset "ini[$key]" | |
1857 | config_save |
|
1857 | config_save | |
1858 | } |
|
1858 | } | |
1859 |
|
1859 | |||
1860 | config_keys() { |
|
1860 | config_keys() { | |
1861 | config_load |
|
1861 | config_load | |
1862 | ini_keys |
|
1862 | ini_keys | |
1863 | } |
|
1863 | } | |
1864 |
|
1864 | |||
1865 | config_has_key() { |
|
1865 | config_has_key() { | |
1866 | [[ $(config_get "$1") ]] |
|
1866 | [[ $(config_get "$1") ]] | |
1867 | } |
|
1867 | } | |
1868 |
|
1868 | |||
1869 | config_reload() { |
|
1869 | config_reload() { | |
1870 | declare -g config_loaded=false |
|
1870 | declare -g config_loaded=false | |
1871 | config_load |
|
1871 | config_load | |
1872 | } |
|
1872 | } | |
1873 |
|
1873 | |||
1874 | config_load() { |
|
1874 | config_load() { | |
1875 | [[ "$config_loaded" == "true" ]] && return |
|
1875 | [[ "$config_loaded" == "true" ]] && return | |
1876 |
|
1876 | |||
1877 | declare -g CONFIG_FILE=${CONFIG_FILE:=config.ini} |
|
1877 | declare -g CONFIG_FILE=${CONFIG_FILE:=config.ini} | |
1878 | declare -g config_loaded=true |
|
1878 | declare -g config_loaded=true | |
1879 | [[ -f "$CONFIG_FILE" ]] || touch "$CONFIG_FILE" |
|
1879 | [[ -f "$CONFIG_FILE" ]] || touch "$CONFIG_FILE" | |
1880 | ini_load "$CONFIG_FILE" |
|
1880 | ini_load "$CONFIG_FILE" | |
1881 | } |
|
1881 | } | |
1882 |
|
1882 | |||
1883 | config_save() { |
|
1883 | config_save() { | |
1884 | ini_save "$CONFIG_FILE" |
|
1884 | ini_save "$CONFIG_FILE" | |
1885 | } |
|
1885 | } | |
1886 |
|
1886 | |||
1887 | # src/lib/dotenv.sh |
|
1887 | # src/lib/dotenv.sh | |
1888 |
|
1888 | |||
1889 | __dotenv= |
|
1889 | __dotenv= | |
1890 | __dotenv_file= |
|
1890 | __dotenv_file= | |
1891 | __dotenv_cmd=.env |
|
1891 | __dotenv_cmd=.env | |
1892 |
|
1892 | |||
1893 | .env() { |
|
1893 | .env() { | |
1894 | REPLY=() |
|
1894 | REPLY=() | |
1895 | [[ $__dotenv_file || ${1-} == -* ]] || .env.--file .env || return |
|
1895 | [[ $__dotenv_file || ${1-} == -* ]] || .env.--file .env || return | |
1896 | if declare -F -- ".env.${1-}" >/dev/null; then .env."$@"; return ; fi |
|
1896 | if declare -F -- ".env.${1-}" >/dev/null; then .env."$@"; return ; fi | |
1897 | .env --help >&2; return 64 |
|
1897 | .env --help >&2; return 64 | |
1898 | } |
|
1898 | } | |
1899 |
|
1899 | |||
1900 | .env.-f() { .env.--file "$@"; } |
|
1900 | .env.-f() { .env.--file "$@"; } | |
1901 |
|
1901 | |||
1902 | .env.get() { |
|
1902 | .env.get() { | |
1903 | .env::arg "get requires a key" "$@" && |
|
1903 | .env::arg "get requires a key" "$@" && | |
1904 | [[ "$__dotenv" =~ ^(.*(^|$'\n'))([ ]*)"$1="(.*)$ ]] && |
|
1904 | [[ "$__dotenv" =~ ^(.*(^|$'\n'))([ ]*)"$1="(.*)$ ]] && | |
1905 | REPLY=${BASH_REMATCH[4]%%$'\n'*} && REPLY=${REPLY%"${REPLY##*[![:space:]]}"} |
|
1905 | REPLY=${BASH_REMATCH[4]%%$'\n'*} && REPLY=${REPLY%"${REPLY##*[![:space:]]}"} | |
1906 | } |
|
1906 | } | |
1907 |
|
1907 | |||
1908 | .env.get_or_error() { |
|
1908 | .env.get_or_error() { | |
1909 | .env.get "$@" || { echo "$(red ERROR required key $@ not set in $RUNTIME_ENV file)"; exit 1; } |
|
1909 | .env.get "$@" || { echo "$(red ERROR required key $@ not set in $RUNTIME_ENV file)"; exit 1; } | |
1910 | } |
|
1910 | } | |
1911 |
|
1911 | |||
1912 | .env.parse() { |
|
1912 | .env.parse() { | |
1913 | local line key |
|
1913 | local line key | |
1914 | while IFS= read -r line; do |
|
1914 | while IFS= read -r line; do | |
1915 | line=${line#"${line%%[![:space:]]*}"} # trim leading whitespace |
|
1915 | line=${line#"${line%%[![:space:]]*}"} # trim leading whitespace | |
1916 | line=${line%"${line##*[![:space:]]}"} # trim trailing whitespace |
|
1916 | line=${line%"${line##*[![:space:]]}"} # trim trailing whitespace | |
1917 | if [[ ! "$line" || "$line" == '#'* ]]; then continue ; fi |
|
1917 | if [[ ! "$line" || "$line" == '#'* ]]; then continue ; fi | |
1918 | if (($#)); then |
|
1918 | if (($#)); then | |
1919 | for key; do |
|
1919 | for key; do | |
1920 | if [[ $key == "${line%%=*}" ]]; then REPLY+=("$line"); break; |
|
1920 | if [[ $key == "${line%%=*}" ]]; then REPLY+=("$line"); break; | |
1921 | fi |
|
1921 | fi | |
1922 | done |
|
1922 | done | |
1923 | else |
|
1923 | else | |
1924 | REPLY+=("$line") |
|
1924 | REPLY+=("$line") | |
1925 | fi |
|
1925 | fi | |
1926 | done <<<"$__dotenv" |
|
1926 | done <<<"$__dotenv" | |
1927 | ((${#REPLY[@]})) |
|
1927 | ((${#REPLY[@]})) | |
1928 | } |
|
1928 | } | |
1929 |
|
1929 | |||
1930 | .env.export() { ! .env.parse "$@" || export "${REPLY[@]}"; } |
|
1930 | .env.export() { ! .env.parse "$@" || export "${REPLY[@]}"; } | |
1931 |
|
1931 | |||
1932 | .env.set() { |
|
1932 | .env.set() { | |
1933 | .env::file load || return ; local key saved=$__dotenv |
|
1933 | .env::file load || return ; local key saved=$__dotenv | |
1934 | while (($#)); do |
|
1934 | while (($#)); do | |
1935 | key=${1#+}; key=${key%%=*} |
|
1935 | key=${1#+}; key=${key%%=*} | |
1936 | if .env.get "$key"; then |
|
1936 | if .env.get "$key"; then | |
1937 | REPLY=() |
|
1937 | REPLY=() | |
1938 | if [[ $1 == +* ]]; then shift; continue # skip if already found |
|
1938 | if [[ $1 == +* ]]; then shift; continue # skip if already found | |
1939 | elif [[ $1 == *=* ]]; then |
|
1939 | elif [[ $1 == *=* ]]; then | |
1940 | __dotenv=${BASH_REMATCH[1]}${BASH_REMATCH[3]}$1$'\n'${BASH_REMATCH[4]#*$'\n'} |
|
1940 | __dotenv=${BASH_REMATCH[1]}${BASH_REMATCH[3]}$1$'\n'${BASH_REMATCH[4]#*$'\n'} | |
1941 | else |
|
1941 | else | |
1942 | __dotenv=${BASH_REMATCH[1]}${BASH_REMATCH[4]#*$'\n'} |
|
1942 | __dotenv=${BASH_REMATCH[1]}${BASH_REMATCH[4]#*$'\n'} | |
1943 | continue # delete all occurrences |
|
1943 | continue # delete all occurrences | |
1944 | fi |
|
1944 | fi | |
1945 | elif [[ $1 == *=* ]]; then |
|
1945 | elif [[ $1 == *=* ]]; then | |
1946 | __dotenv+="${1#+}"$'\n' |
|
1946 | __dotenv+="${1#+}"$'\n' | |
1947 | fi |
|
1947 | fi | |
1948 | shift |
|
1948 | shift | |
1949 | done |
|
1949 | done | |
1950 | [[ $__dotenv == "$saved" ]] || .env::file save |
|
1950 | [[ $__dotenv == "$saved" ]] || .env::file save | |
1951 | } |
|
1951 | } | |
1952 |
|
1952 | |||
1953 | .env.puts() { echo "${1-}">>"$__dotenv_file" && __dotenv+="$1"$'\n'; } |
|
1953 | .env.puts() { echo "${1-}">>"$__dotenv_file" && __dotenv+="$1"$'\n'; } | |
1954 |
|
1954 | |||
1955 | .env.generate() { |
|
1955 | .env.generate() { | |
1956 | .env::arg "key required for generate" "$@" || return |
|
1956 | .env::arg "key required for generate" "$@" || return | |
1957 | .env.get "$1" && return || REPLY=$("${@:2}") || return |
|
1957 | .env.get "$1" && return || REPLY=$("${@:2}") || return | |
1958 | .env::one "generate: ouptut of '${*:2}' has more than one line" "$REPLY" || return |
|
1958 | .env::one "generate: ouptut of '${*:2}' has more than one line" "$REPLY" || return | |
1959 | .env.puts "$1=$REPLY" |
|
1959 | .env.puts "$1=$REPLY" | |
1960 | } |
|
1960 | } | |
1961 |
|
1961 | |||
1962 | .env.--file() { |
|
1962 | .env.--file() { | |
1963 | .env::arg "filename required for --file" "$@" || return |
|
1963 | .env::arg "filename required for --file" "$@" || return | |
1964 | __dotenv_file=$1; .env::file load || return |
|
1964 | __dotenv_file=$1; .env::file load || return | |
1965 | (($#<2)) || .env "${@:2}" |
|
1965 | (($#<2)) || .env "${@:2}" | |
1966 | } |
|
1966 | } | |
1967 |
|
1967 | |||
1968 | .env::arg() { [[ "${2-}" ]] || { echo "$__dotenv_cmd: $1" >&2; return 64; }; } |
|
1968 | .env::arg() { [[ "${2-}" ]] || { echo "$__dotenv_cmd: $1" >&2; return 64; }; } | |
1969 |
|
1969 | |||
1970 | .env::one() { [[ "$2" != *$'\n'* ]] || .env::arg "$1"; } |
|
1970 | .env::one() { [[ "$2" != *$'\n'* ]] || .env::arg "$1"; } | |
1971 |
|
1971 | |||
1972 | .env::file() { |
|
1972 | .env::file() { | |
1973 | local REPLY=$__dotenv_file |
|
1973 | local REPLY=$__dotenv_file | |
1974 | case "$1" in |
|
1974 | case "$1" in | |
1975 | load) |
|
1975 | load) | |
1976 | __dotenv=; ! [[ -f "$REPLY" ]] || __dotenv="$(<"$REPLY")"$'\n' || return ;; |
|
1976 | __dotenv=; ! [[ -f "$REPLY" ]] || __dotenv="$(<"$REPLY")"$'\n' || return ;; | |
1977 | save) |
|
1977 | save) | |
1978 | if [[ -L "$REPLY" ]] && declare -F -- realpath.resolved >/dev/null; then |
|
1978 | if [[ -L "$REPLY" ]] && declare -F -- realpath.resolved >/dev/null; then | |
1979 | realpath.resolved "$REPLY" |
|
1979 | realpath.resolved "$REPLY" | |
1980 | fi |
|
1980 | fi | |
1981 | { [[ ! -f "$REPLY" ]] || cp -p "$REPLY" "$REPLY.bak"; } && |
|
1981 | { [[ ! -f "$REPLY" ]] || cp -p "$REPLY" "$REPLY.bak"; } && | |
1982 | printf %s "$__dotenv" >"$REPLY.bak" && mv "$REPLY.bak" "$REPLY" |
|
1982 | printf %s "$__dotenv" >"$REPLY.bak" && mv "$REPLY.bak" "$REPLY" | |
1983 | esac |
|
1983 | esac | |
1984 | } |
|
1984 | } | |
1985 |
|
1985 | |||
1986 | # |
|
1986 | # | |
1987 | #__dotenv() { |
|
1987 | #__dotenv() { | |
1988 | # set -eu |
|
1988 | # set -eu | |
1989 | # __dotenv_cmd=${0##*/} |
|
1989 | # __dotenv_cmd=${0##*/} | |
1990 | # .env.export() { .env.parse "$@" || return 0; printf 'export %q\n' "${REPLY[@]}"; REPLY=(); } |
|
1990 | # .env.export() { .env.parse "$@" || return 0; printf 'export %q\n' "${REPLY[@]}"; REPLY=(); } | |
1991 | # .env "$@" || return $? |
|
1991 | # .env "$@" || return $? | |
1992 | # ${REPLY[@]+printf '%s\n' "${REPLY[@]}"} |
|
1992 | # ${REPLY[@]+printf '%s\n' "${REPLY[@]}"} | |
1993 | #} |
|
1993 | #} | |
1994 | #if [[ $0 == "${BASH_SOURCE-}" ]]; then __dotenv "$@"; exit; fi |
|
1994 | #if [[ $0 == "${BASH_SOURCE-}" ]]; then __dotenv "$@"; exit; fi | |
1995 |
|
1995 | |||
1996 | # src/lib/get_docker_definitions.sh |
|
1996 | # src/lib/get_docker_definitions.sh | |
1997 |
|
1997 | |||
1998 | get_docker_definitions() { |
|
1998 | get_docker_definitions() { | |
1999 | SOURCE_DIR=$PWD |
|
1999 | SOURCE_DIR=$PWD | |
2000 | RHODECODE_DOCKER_HASH=$1 |
|
2000 | RHODECODE_DOCKER_HASH=$1 | |
2001 | FULL_MODE=$2 |
|
2001 | FULL_MODE=$2 | |
2002 | DEBUG=$3 |
|
2002 | DEBUG=$3 | |
2003 |
|
2003 | |||
2004 | # download sources |
|
2004 | # download sources | |
2005 | echo "bootstrap_definitions: download rhodecode docker definitions from $SERVER_URL" |
|
2005 | echo "bootstrap_definitions: download rhodecode docker definitions from $SERVER_URL" | |
2006 | echo "" |
|
2006 | echo "" | |
2007 | extracted_arcive_dir="rhodecode-enterprise-docker-id-bacb-sub-0-archive-all" |
|
2007 | extracted_arcive_dir="rhodecode-enterprise-docker-id-bacb-sub-0-archive-all" | |
2008 |
|
2008 | |||
2009 | if [ $DEBUG ]; then |
|
2009 | if [ $DEBUG ]; then | |
2010 | echo "bootstrap_definitions: downloading: $SERVER_URL/$RHODECODE_DOCKER_HASH.tgz" |
|
2010 | echo "bootstrap_definitions: downloading: $SERVER_URL/$RHODECODE_DOCKER_HASH.tgz" | |
2011 | curl --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/$RHODECODE_DOCKER_HASH.tgz | tar -xz -C $SOURCE_DIR |
|
2011 | curl --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/$RHODECODE_DOCKER_HASH.tgz | tar -xz -C $SOURCE_DIR | |
2012 |
|
2012 | |||
2013 | echo "extracted archive to $SOURCE_DIR" |
|
2013 | echo "extracted archive to $SOURCE_DIR" | |
2014 | echo "bootstrap_definitions: running CP $SOURCE_DIR/$extracted_arcive_dir/* $SOURCE_DIR" |
|
2014 | echo "bootstrap_definitions: running CP $SOURCE_DIR/$extracted_arcive_dir/* $SOURCE_DIR" | |
2015 | cp_backup_verbose $SOURCE_DIR/$extracted_arcive_dir/* $SOURCE_DIR |
|
2015 | cp_backup_verbose $SOURCE_DIR/$extracted_arcive_dir/* $SOURCE_DIR | |
2016 |
|
2016 | |||
2017 | echo "bootstrap_definitions: removing $SOURCE_DIR/$extracted_arcive_dir" |
|
2017 | echo "bootstrap_definitions: removing $SOURCE_DIR/$extracted_arcive_dir" | |
2018 | rm -r $SOURCE_DIR/$extracted_arcive_dir |
|
2018 | rm -r $SOURCE_DIR/$extracted_arcive_dir | |
2019 | else |
|
2019 | else | |
2020 | curl -s --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/$RHODECODE_DOCKER_HASH.tgz | tar -xz -C $SOURCE_DIR |
|
2020 | curl -s --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/$RHODECODE_DOCKER_HASH.tgz | tar -xz -C $SOURCE_DIR | |
2021 |
|
2021 | |||
2022 | cp_backup $SOURCE_DIR/$extracted_arcive_dir/* $SOURCE_DIR |
|
2022 | cp_backup $SOURCE_DIR/$extracted_arcive_dir/* $SOURCE_DIR | |
2023 |
|
2023 | |||
2024 | rm -r $SOURCE_DIR/$extracted_arcive_dir |
|
2024 | rm -r $SOURCE_DIR/$extracted_arcive_dir | |
2025 | fi |
|
2025 | fi | |
2026 |
|
2026 | |||
2027 | echo "$(green bootstrap_definitions: docker definitions extracted to $SOURCE_DIR)" |
|
2027 | echo "$(green bootstrap_definitions: docker definitions extracted to $SOURCE_DIR)" | |
2028 |
|
2028 | |||
2029 | # cleanup of backup files, just good to have, ignore any warnings |
|
2029 | # cleanup of backup files, just good to have, ignore any warnings | |
2030 | # NOTE: Disabled for backward compat |
|
2030 | # NOTE: Disabled for backward compat | |
2031 | #find "$SOURCE_DIR" -nowarn -ignore_readdir_race -iname "*.~*~" -delete 2> /dev/null |
|
2031 | #find "$SOURCE_DIR" -nowarn -ignore_readdir_race -iname "*.~*~" -delete 2> /dev/null | |
2032 |
|
2032 | |||
2033 | # some cleanup of things we don't need in cli |
|
2033 | # some cleanup of things we don't need in cli | |
2034 | if [[ ! $FULL_MODE ]]; then |
|
2034 | if [[ ! $FULL_MODE ]]; then | |
2035 | rm dev-tools |
|
2035 | rm dev-tools | |
2036 | rm -r scripts/dev-tools |
|
2036 | rm -r scripts/dev-tools | |
2037 | rm -r entrypoints.d |
|
2037 | rm -r entrypoints.d | |
2038 | fi |
|
2038 | fi | |
2039 | } |
|
2039 | } | |
2040 |
|
2040 | |||
2041 | # src/lib/ini.sh |
|
2041 | # src/lib/ini.sh | |
2042 |
|
2042 | |||
2043 | ini_load() { |
|
2043 | ini_load() { | |
2044 | declare -gA ini |
|
2044 | declare -gA ini | |
2045 |
|
2045 | |||
2046 | local ini_file="$1" |
|
2046 | local ini_file="$1" | |
2047 |
|
2047 | |||
2048 | local section="" |
|
2048 | local section="" | |
2049 | local key="" |
|
2049 | local key="" | |
2050 | local value="" |
|
2050 | local value="" | |
2051 | local section_regex="^\[(.+)\]" |
|
2051 | local section_regex="^\[(.+)\]" | |
2052 | local key_regex="^([^ =]+) *= *(.*) *$" |
|
2052 | local key_regex="^([^ =]+) *= *(.*) *$" | |
2053 | local comment_regex="^;" |
|
2053 | local comment_regex="^;" | |
2054 |
|
2054 | |||
2055 | while IFS= read -r line; do |
|
2055 | while IFS= read -r line; do | |
2056 | if [[ $line =~ $comment_regex ]]; then |
|
2056 | if [[ $line =~ $comment_regex ]]; then | |
2057 | continue |
|
2057 | continue | |
2058 | elif [[ $line =~ $section_regex ]]; then |
|
2058 | elif [[ $line =~ $section_regex ]]; then | |
2059 | section="${BASH_REMATCH[1]}." |
|
2059 | section="${BASH_REMATCH[1]}." | |
2060 | elif [[ $line =~ $key_regex ]]; then |
|
2060 | elif [[ $line =~ $key_regex ]]; then | |
2061 | key="${BASH_REMATCH[1]}" |
|
2061 | key="${BASH_REMATCH[1]}" | |
2062 | value="${BASH_REMATCH[2]}" |
|
2062 | value="${BASH_REMATCH[2]}" | |
2063 | ini["${section}${key}"]="$value" |
|
2063 | ini["${section}${key}"]="$value" | |
2064 | fi |
|
2064 | fi | |
2065 | done <"$ini_file" |
|
2065 | done <"$ini_file" | |
2066 | } |
|
2066 | } | |
2067 |
|
2067 | |||
2068 | ini_save() { |
|
2068 | ini_save() { | |
2069 | declare -gA ini |
|
2069 | declare -gA ini | |
2070 |
|
2070 | |||
2071 | local ini_file="$1" |
|
2071 | local ini_file="$1" | |
2072 |
|
2072 | |||
2073 | local current_section="" |
|
2073 | local current_section="" | |
2074 | local has_free_keys=false |
|
2074 | local has_free_keys=false | |
2075 |
|
2075 | |||
2076 | rm -f "$ini_file" |
|
2076 | rm -f "$ini_file" | |
2077 |
|
2077 | |||
2078 | for key in $(ini_keys); do |
|
2078 | for key in $(ini_keys); do | |
2079 | [[ $key == *.* ]] && continue |
|
2079 | [[ $key == *.* ]] && continue | |
2080 | has_free_keys=true |
|
2080 | has_free_keys=true | |
2081 | value="${ini[$key]}" |
|
2081 | value="${ini[$key]}" | |
2082 | echo "$key = $value" >>"$ini_file" |
|
2082 | echo "$key = $value" >>"$ini_file" | |
2083 | done |
|
2083 | done | |
2084 |
|
2084 | |||
2085 | [[ "${has_free_keys}" == "true" ]] && echo >>"$ini_file" |
|
2085 | [[ "${has_free_keys}" == "true" ]] && echo >>"$ini_file" | |
2086 |
|
2086 | |||
2087 | for key in $(ini_keys); do |
|
2087 | for key in $(ini_keys); do | |
2088 | [[ $key == *.* ]] || continue |
|
2088 | [[ $key == *.* ]] || continue | |
2089 | value="${ini[$key]}" |
|
2089 | value="${ini[$key]}" | |
2090 | IFS="." read -r section_name key_name <<<"$key" |
|
2090 | IFS="." read -r section_name key_name <<<"$key" | |
2091 |
|
2091 | |||
2092 | if [[ "$current_section" != "$section_name" ]]; then |
|
2092 | if [[ "$current_section" != "$section_name" ]]; then | |
2093 | [[ $current_section ]] && echo >>"$ini_file" |
|
2093 | [[ $current_section ]] && echo >>"$ini_file" | |
2094 | echo "[$section_name]" >>"$ini_file" |
|
2094 | echo "[$section_name]" >>"$ini_file" | |
2095 | current_section="$section_name" |
|
2095 | current_section="$section_name" | |
2096 | fi |
|
2096 | fi | |
2097 |
|
2097 | |||
2098 | echo "$key_name = $value" >>"$ini_file" |
|
2098 | echo "$key_name = $value" >>"$ini_file" | |
2099 | done |
|
2099 | done | |
2100 | } |
|
2100 | } | |
2101 |
|
2101 | |||
2102 | ini_show() { |
|
2102 | ini_show() { | |
2103 | declare -gA ini |
|
2103 | declare -gA ini | |
2104 |
|
2104 | |||
2105 | for key in $(ini_keys); do |
|
2105 | for key in $(ini_keys); do | |
2106 | echo "$key = ${ini[$key]}" |
|
2106 | echo "$key = ${ini[$key]}" | |
2107 | done |
|
2107 | done | |
2108 | } |
|
2108 | } | |
2109 |
|
2109 | |||
2110 | ini_keys() { |
|
2110 | ini_keys() { | |
2111 | declare -gA ini |
|
2111 | declare -gA ini | |
2112 |
|
2112 | |||
2113 | local keys=("${!ini[@]}") |
|
2113 | local keys=("${!ini[@]}") | |
2114 | for a in "${keys[@]}"; do echo "$a"; done | sort |
|
2114 | for a in "${keys[@]}"; do echo "$a"; done | sort | |
2115 | } |
|
2115 | } | |
2116 |
|
2116 | |||
2117 | # src/lib/reconfigure_ini.sh |
|
2117 | # src/lib/reconfigure_ini.sh | |
2118 | sed_replace() { |
|
2118 | sed_replace() { | |
2119 | if [[ $ini_path == "" ]]; then |
|
2119 | if [[ $ini_path == "" ]]; then | |
2120 | echo "ERROR: missing 'ini_path' variable" |
|
2120 | echo "ERROR: missing 'ini_path' variable" | |
2121 | fi |
|
2121 | fi | |
2122 |
|
2122 | |||
2123 | sed_func "$1" "$2" "$ini_path" |
|
2123 | sed_func "$1" "$2" "$ini_path" | |
2124 | } |
|
2124 | } | |
2125 |
|
2125 | |||
2126 | sed_safe_path() { |
|
2126 | sed_safe_path() { | |
2127 | echo $((echo $1|sed -r 's/([\$\.\*\/\[\\^])/\\\1/g'|sed 's/[]]/\[]]/g')>&1) |
|
2127 | echo $((echo $1|sed -r 's/([\$\.\*\/\[\\^])/\\\1/g'|sed 's/[]]/\[]]/g')>&1) | |
2128 | } |
|
2128 | } | |
2129 |
|
2129 | |||
2130 | config_vcsserver_ini() { |
|
2130 | config_vcsserver_ini() { | |
2131 |
|
2131 | |||
2132 | #host/port |
|
2132 | #host/port | |
2133 | sed_replace '^#?host = .*' 'host = 0\.0\.0\.0' |
|
2133 | sed_replace '^#?host = .*' 'host = 0\.0\.0\.0' | |
2134 | sed_replace '^#?port = .*' 'port = 10010' |
|
2134 | sed_replace '^#?port = .*' 'port = 10010' | |
2135 |
|
2135 | |||
2136 | # workers adjustment |
|
2136 | # workers adjustment | |
2137 | sed_replace '^#?workers = .*' 'workers = 1' |
|
2137 | sed_replace '^#?workers = .*' 'workers = 1' | |
2138 | sed_replace '^#?memory_max_usage = .*' 'memory_max_usage = 2147483648' |
|
2138 | sed_replace '^#?memory_max_usage = .*' 'memory_max_usage = 2147483648' | |
2139 | sed_replace '^#?core\.binary_dir = .*' 'core.binary_dir = \/usr\/local\/bin\/rhodecode_bin\/vcs_bin' |
|
2139 | sed_replace '^#?core\.binary_dir = .*' 'core.binary_dir = \/usr\/local\/bin\/rhodecode_bin\/vcs_bin' | |
2140 |
|
2140 | |||
2141 | sed_replace '^#?rc_cache\.repo_object\.expiration_time = .*' '#rc_cache.repo_object.expiration_time = 2592000' |
|
2141 | sed_replace '^#?rc_cache\.repo_object\.expiration_time = .*' '#rc_cache.repo_object.expiration_time = 2592000' | |
2142 | sed_replace '^#?rc_cache\.repo_object\.backend = dogpile\.cache\.rc\.redis_msgpack' 'rc_cache.repo_object.backend = dogpile.cache.rc.redis_msgpack' |
|
2142 | sed_replace '^#?rc_cache\.repo_object\.backend = dogpile\.cache\.rc\.redis_msgpack' 'rc_cache.repo_object.backend = dogpile.cache.rc.redis_msgpack' | |
2143 |
|
2143 | |||
2144 | sed_replace '^#?rc_cache\.repo_object\.arguments\.socket_timeout = .*' 'rc_cache.repo_object.arguments.socket_timeout = 30' |
|
2144 | sed_replace '^#?rc_cache\.repo_object\.arguments\.socket_timeout = .*' 'rc_cache.repo_object.arguments.socket_timeout = 30' | |
2145 | sed_replace '^#?rc_cache\.repo_object\.arguments\.db = .*' 'rc_cache.repo_object.arguments.db = 5' |
|
2145 | sed_replace '^#?rc_cache\.repo_object\.arguments\.db = .*' 'rc_cache.repo_object.arguments.db = 5' | |
2146 | sed_replace '^#?rc_cache\.repo_object\.arguments\.port = .*' 'rc_cache.repo_object.arguments.port = 6379' |
|
2146 | sed_replace '^#?rc_cache\.repo_object\.arguments\.port = .*' 'rc_cache.repo_object.arguments.port = 6379' | |
2147 | sed_replace '^#?rc_cache\.repo_object\.arguments\.host = .*' 'rc_cache.repo_object.arguments.host = redis' |
|
2147 | sed_replace '^#?rc_cache\.repo_object\.arguments\.host = .*' 'rc_cache.repo_object.arguments.host = redis' | |
2148 | sed_replace '^#?rc_cache\.repo_object\.arguments\.redis_expiration_time = .*' 'rc_cache.repo_object.arguments.redis_expiration_time = 3592000' |
|
2148 | sed_replace '^#?rc_cache\.repo_object\.arguments\.redis_expiration_time = .*' 'rc_cache.repo_object.arguments.redis_expiration_time = 3592000' | |
2149 |
|
2149 | |||
2150 | sed_replace '^#?cache_dir = .*' 'cache_dir = \/var\/opt\/rhodecode_data' |
|
2150 | sed_replace '^#?cache_dir = .*' 'cache_dir = \/var\/opt\/rhodecode_data' | |
2151 | sed_replace '^#?formatter = .*' 'formatter = json' |
|
2151 | sed_replace '^#?formatter = .*' 'formatter = json' | |
2152 |
|
2152 | |||
2153 | #statsd enable |
|
2153 | #statsd enable | |
2154 | sed_replace '^#?statsd.enabled = .*' 'statsd.enabled = true' |
|
2154 | sed_replace '^#?statsd.enabled = .*' 'statsd.enabled = true' | |
2155 | sed_replace '^#?statsd.statsd_host = .*' 'statsd.statsd_host = statsd-exporter' |
|
2155 | sed_replace '^#?statsd.statsd_host = .*' 'statsd.statsd_host = statsd-exporter' | |
2156 | sed_replace '^#?statsd.statsd_port = .*' 'statsd.statsd_port = 9125' |
|
2156 | sed_replace '^#?statsd.statsd_port = .*' 'statsd.statsd_port = 9125' | |
2157 |
|
2157 | |||
2158 | } |
|
2158 | } | |
2159 |
|
2159 | |||
2160 | config_rhodecode_ini() { |
|
2160 | config_rhodecode_ini() { | |
2161 | #host/port |
|
2161 | #host/port | |
2162 | sed_replace '^#?host = .*' 'host = 0\.0\.0\.0' |
|
2162 | sed_replace '^#?host = .*' 'host = 0\.0\.0\.0' | |
2163 | sed_replace '^#?port = .*' 'port = 10020' |
|
2163 | sed_replace '^#?port = .*' 'port = 10020' | |
2164 |
|
2164 | |||
2165 | # workers adjustment |
|
2165 | # workers adjustment | |
2166 | sed_replace '^#?workers = .*' 'workers = 1' |
|
2166 | sed_replace '^#?workers = .*' 'workers = 1' | |
2167 | sed_replace '^#?memory_max_usage = .*' 'memory_max_usage = 2147483648' |
|
2167 | sed_replace '^#?memory_max_usage = .*' 'memory_max_usage = 2147483648' | |
2168 |
|
2168 | |||
2169 |
|
2169 | |||
2170 | sed_replace '^#?email_prefix = .*' 'email_prefix = [RhodeCode]' |
|
2170 | sed_replace '^#?email_prefix = .*' 'email_prefix = [RhodeCode]' | |
2171 | sed_replace '^#?app_email_from = .*' "app_email_from = rhodecode-noreply@$RC_HOSTNAME" |
|
2171 | sed_replace '^#?app_email_from = .*' "app_email_from = rhodecode-noreply@$RC_HOSTNAME" | |
2172 | sed_replace '^#?smtp_server = .*' 'smtp_server = localhost' |
|
2172 | sed_replace '^#?smtp_server = .*' 'smtp_server = localhost' | |
2173 |
|
2173 | |||
2174 | # app-instance-uuid |
|
2174 | # app-instance-uuid | |
2175 | sed_replace '^app_instance_uuid = .*' "app_instance_uuid = $RC_APP_INSTANCE_UUID" |
|
2175 | sed_replace '^app_instance_uuid = .*' "app_instance_uuid = $RC_APP_INSTANCE_UUID" | |
2176 |
|
2176 | |||
2177 | # app base |
|
2177 | # app base | |
2178 | sed_replace '^app\.base_url = .*' "app\.base_url = $RC_APP_BASE_URL" |
|
2178 | sed_replace '^app\.base_url = .*' "app\.base_url = $RC_APP_BASE_URL" | |
2179 |
|
2179 | |||
2180 | # set license_token |
|
2180 | # set license_token | |
2181 | sed_replace '^#?license_token =.*' "license_token = $RC_LICENSE_TOKEN" |
|
2181 | sed_replace '^#?license_token =.*' "license_token = $RC_LICENSE_TOKEN" | |
2182 | # set Edition |
|
2182 | # set Edition | |
2183 | sed_replace '^use = egg:rhodecode-enterprise.*' "use = egg:rhodecode-enterprise-$RC_EDITION" |
|
2183 | sed_replace '^use = egg:rhodecode-enterprise.*' "use = egg:rhodecode-enterprise-$RC_EDITION" | |
2184 |
|
2184 | |||
2185 | # enable celery |
|
2185 | # enable celery | |
2186 | sed_replace '^#?use_celery = .*' 'use_celery = true' |
|
2186 | sed_replace '^#?use_celery = .*' 'use_celery = true' | |
2187 |
|
2187 | |||
2188 | # DB |
|
2188 | # DB | |
2189 | sed_replace '^sqlalchemy\.db1\.url =.*' "sqlalchemy\.db1\.url = $RC_SQLALCHEMY_DB1_URL" |
|
2189 | sed_replace '^sqlalchemy\.db1\.url =.*' "sqlalchemy\.db1\.url = $RC_SQLALCHEMY_DB1_URL" | |
2190 |
|
2190 | |||
2191 | #CHANNELSTREAM WS_URL |
|
2191 | #CHANNELSTREAM WS_URL | |
2192 | sed_replace '^#?channelstream\.ws_url =.*' "channelstream\.ws_url = $RC_CHANNELSTREAM_WS_URL" |
|
2192 | sed_replace '^#?channelstream\.ws_url =.*' "channelstream\.ws_url = $RC_CHANNELSTREAM_WS_URL" | |
2193 |
|
2193 | |||
2194 | # set cache dir |
|
2194 | # set cache dir | |
2195 | sed_replace '^#?cache_dir = .*' 'cache_dir = \/var\/opt\/rhodecode_data' |
|
2195 | sed_replace '^#?cache_dir = .*' 'cache_dir = \/var\/opt\/rhodecode_data' | |
2196 |
|
2196 | |||
2197 | # set archive cache dir |
|
2197 | # set archive cache dir | |
2198 | sed_replace '^#?archive_cache_dir = .*' 'archive_cache_dir = \/var\/opt\/rhodecode_data\/tarballcache' |
|
2198 | sed_replace '^#?archive_cache_dir = .*' 'archive_cache_dir = \/var\/opt\/rhodecode_data\/tarballcache' | |
2199 |
|
2199 | |||
2200 | # set file_store path |
|
2200 | # set file_store path | |
2201 | sed_replace '^#?file_store\.storage_path = .*' 'file_store.storage_path = \/var\/opt\/rhodecode_data\/file_store' |
|
2201 | sed_replace '^#?file_store\.storage_path = .*' 'file_store.storage_path = \/var\/opt\/rhodecode_data\/file_store' | |
2202 |
|
2202 | |||
2203 | # cleanup rabbitmq example entry |
|
2203 | # cleanup rabbitmq example entry | |
2204 | sed_replace '^#celery\.broker_url = amqp.*' '' |
|
2204 | sed_replace '^#celery\.broker_url = amqp.*' '' | |
2205 | sed_replace '^#?celery\.broker_url = .*' 'celery\.broker_url = redis:\/\/redis:6379\/8' |
|
2205 | sed_replace '^#?celery\.broker_url = .*' 'celery\.broker_url = redis:\/\/redis:6379\/8' | |
2206 |
|
2206 | |||
2207 | # switch beaker sessions to Redis based |
|
2207 | # switch beaker sessions to Redis based | |
2208 | sed_replace '^#?beaker.session.type = file.*' '#beaker.session.type = file' |
|
2208 | sed_replace '^#?beaker.session.type = file.*' '#beaker.session.type = file' | |
2209 | sed_replace '^#?beaker.session.data_dir = .*' '#beaker.session.data_dir = \/tmp\/data\/sessions' |
|
2209 | sed_replace '^#?beaker.session.data_dir = .*' '#beaker.session.data_dir = \/tmp\/data\/sessions' | |
2210 |
|
2210 | |||
2211 | # enable redis db2 |
|
2211 | # enable redis db2 | |
2212 | sed_replace '^#?beaker\.session\.type = ext:redis' 'beaker.session.type = ext:redis' |
|
2212 | sed_replace '^#?beaker\.session\.type = ext:redis' 'beaker.session.type = ext:redis' | |
2213 | sed_replace '^#?beaker\.session\.url = redis:\/\/127.0.0.1:6379\/2' 'beaker.session.url = redis:\/\/redis:6379\/2' |
|
2213 | sed_replace '^#?beaker\.session\.url = redis:\/\/127.0.0.1:6379\/2' 'beaker.session.url = redis:\/\/redis:6379\/2' | |
2214 |
|
2214 | |||
2215 | # sed_replace '^#?beaker.session.type = ext:database.*' 'beaker.session.type = ext:database' |
|
2215 | # sed_replace '^#?beaker.session.type = ext:database.*' 'beaker.session.type = ext:database' | |
2216 | # sed_replace '^#?beaker.session.sa.url = postgresql.*' 'beaker.session.sa.url = postgresql://{{rhodecode_db_username}}:{{rhodecode_db_password}}@localhost/{{rhodecode_db_name}}' |
|
2216 | # sed_replace '^#?beaker.session.sa.url = postgresql.*' 'beaker.session.sa.url = postgresql://{{rhodecode_db_username}}:{{rhodecode_db_password}}@localhost/{{rhodecode_db_name}}' | |
2217 |
|
2217 | |||
2218 | # hooks reconfigure for auto-bind to host |
|
2218 | # hooks reconfigure for auto-bind to host | |
2219 | sed_replace '^#?vcs.hooks.host = .*' 'vcs.hooks.host = \*' |
|
2219 | sed_replace '^#?vcs.hooks.host = .*' 'vcs.hooks.host = \*' | |
2220 | sed_replace '^#?vcs.server = .*' 'vcs.server = vcsserver:10010' |
|
2220 | sed_replace '^#?vcs.server = .*' 'vcs.server = vcsserver:10010' | |
2221 |
|
2221 | |||
2222 | # enable SVN |
|
2222 | # enable SVN | |
2223 | sed_replace '^#?svn.proxy.generate_config = .*' 'svn.proxy.generate_config = true' |
|
2223 | sed_replace '^#?svn.proxy.generate_config = .*' 'svn.proxy.generate_config = true' | |
2224 |
|
2224 | |||
2225 | # enable SSH |
|
2225 | # enable SSH | |
2226 | sed_replace '^#?ssh.generate_authorized_keyfile = .*' 'ssh.generate_authorized_keyfile = true' |
|
2226 | sed_replace '^#?ssh.generate_authorized_keyfile = .*' 'ssh.generate_authorized_keyfile = true' | |
2227 |
|
2227 | |||
2228 | #statsd enable |
|
2228 | #statsd enable | |
2229 | sed_replace '^#?statsd.enabled = .*' 'statsd.enabled = true' |
|
2229 | sed_replace '^#?statsd.enabled = .*' 'statsd.enabled = true' | |
2230 | sed_replace '^#?statsd.statsd_host = .*' 'statsd.statsd_host = statsd-exporter' |
|
2230 | sed_replace '^#?statsd.statsd_host = .*' 'statsd.statsd_host = statsd-exporter' | |
2231 | sed_replace '^#?statsd.statsd_port = .*' 'statsd.statsd_port = 9125' |
|
2231 | sed_replace '^#?statsd.statsd_port = .*' 'statsd.statsd_port = 9125' | |
2232 |
|
2232 | |||
2233 | # the wrapper_cmd |
|
2233 | # the wrapper_cmd | |
2234 | sed_replace '^#?ssh.wrapper_cmd = .*' 'ssh.wrapper_cmd = \/usr\/local\/bin\/rhodecode_bin\/bin\/rc-ssh-wrapper' |
|
2234 | sed_replace '^#?ssh.wrapper_cmd = .*' 'ssh.wrapper_cmd = \/usr\/local\/bin\/rhodecode_bin\/bin\/rc-ssh-wrapper' | |
2235 |
|
2235 | |||
2236 | sed_replace '^#?api_access_controllers_whitelist = .*' 'api_access_controllers_whitelist = RepoFilesView:repo_archivefile, RepoFilesView:repo_file_raw' |
|
2236 | sed_replace '^#?api_access_controllers_whitelist = .*' 'api_access_controllers_whitelist = RepoFilesView:repo_archivefile, RepoFilesView:repo_file_raw' | |
2237 |
|
2237 | |||
2238 | # # set search to elasticsearch |
|
2238 | # # set search to elasticsearch | |
2239 | # # enabled modules for Whoosh we remove, we have duplicates there.. |
|
2239 | # # enabled modules for Whoosh we remove, we have duplicates there.. | |
2240 | # '^search.module = .*' '' |
|
2240 | # '^search.module = .*' '' | |
2241 | # '^search.location = .*' '' |
|
2241 | # '^search.location = .*' '' | |
2242 | # |
|
2242 | # | |
2243 | # '^#?search.module = .*' 'search.module = rc_elasticsearch' |
|
2243 | # '^#?search.module = .*' 'search.module = rc_elasticsearch' | |
2244 | # '^#?search.location = .*' 'search.location = http://localhost:9200' |
|
2244 | # '^#?search.location = .*' 'search.location = http://localhost:9200' | |
2245 | # '^#?search.es_version = .*' 'search.es_version = 6' |
|
2245 | # '^#?search.es_version = .*' 'search.es_version = 6' | |
2246 |
|
2246 | |||
2247 | # enable Chat |
|
2247 | # enable Chat | |
2248 | sed_replace '^#?chat.enabled = .*' 'chat.enabled = true' |
|
2248 | sed_replace '^#?chat.enabled = .*' 'chat.enabled = true' | |
2249 |
|
2249 | |||
2250 | # logging |
|
2250 | # logging | |
2251 | sed_replace '^#?formatter = .*' 'formatter = json' |
|
2251 | sed_replace '^#?formatter = .*' 'formatter = json' | |
2252 |
|
2252 | |||
2253 | } |
|
2253 | } | |
2254 |
|
2254 | |||
2255 | # src/lib/send_completions.sh |
|
2255 | # src/lib/send_completions.sh | |
2256 |
|
2256 | |||
2257 | # src/lib/utils.sh |
|
2257 | # src/lib/utils.sh | |
2258 |
|
2258 | |||
2259 | generate_md5() { |
|
2259 | generate_md5() { | |
2260 | local input_string="$1" |
|
2260 | local input_string="$1" | |
2261 |
|
2261 | |||
2262 | if command -v md5 &> /dev/null; then |
|
2262 | if command -v md5 &> /dev/null; then | |
2263 | echo -n "$input_string" | md5 |
|
2263 | echo -n "$input_string" | md5 | |
2264 | elif command -v md5sum &> /dev/null; then |
|
2264 | elif command -v md5sum &> /dev/null; then | |
2265 | echo -n "$input_string" | md5sum | awk '{print $1}' |
|
2265 | echo -n "$input_string" | md5sum | awk '{print $1}' | |
2266 | else |
|
2266 | else | |
2267 | echo "Error: Neither md5 nor md5sum command is available. Please make sure this is installed in your system" |
|
2267 | echo "Error: Neither md5 nor md5sum command is available. Please make sure this is installed in your system" | |
2268 | return 1 |
|
2268 | return 1 | |
2269 | fi |
|
2269 | fi | |
2270 | } |
|
2270 | } | |
2271 |
|
2271 | |||
2272 | random_str() { |
|
2272 | random_str() { | |
2273 | len=$1 |
|
2273 | len=$1 | |
2274 | random_generate=$(generate_md5 $RANDOM | head -c $len) |
|
2274 | random_generate=$(generate_md5 $RANDOM | head -c $len) | |
2275 | echo "$random_generate" |
|
2275 | echo "$random_generate" | |
2276 | } |
|
2276 | } | |
2277 |
|
2277 | |||
2278 | # function to copy files with --backup=numbered option |
|
2278 | # function to copy files with --backup=numbered option | |
2279 | detect_cp_backup () { |
|
2279 | detect_cp_backup () { | |
2280 | cp -r -f --update --backup=numbered "$@" 2>/dev/null |
|
2280 | cp -r -f --update --backup=numbered "$@" 2>/dev/null | |
2281 | if [ $? -eq 0 ]; then |
|
2281 | if [ $? -eq 0 ]; then | |
2282 | # if exit status is 0, --backup=numbered worked and return true |
|
2282 | # if exit status is 0, --backup=numbered worked and return true | |
2283 | return 0 |
|
2283 | return 0 | |
2284 | else |
|
2284 | else | |
2285 | # if exit status is not 0, --backup=numbered didn't work and return false |
|
2285 | # if exit status is not 0, --backup=numbered didn't work and return false | |
2286 | return 1 |
|
2286 | return 1 | |
2287 | fi |
|
2287 | fi | |
2288 | } |
|
2288 | } | |
2289 |
|
2289 | |||
2290 | # function that acts like cp |
|
2290 | # function that acts like cp | |
2291 | cp_backup () { |
|
2291 | cp_backup () { | |
2292 | cp -r -f "$@" |
|
2292 | cp -r -f "$@" | |
2293 | } |
|
2293 | } | |
2294 |
|
2294 | |||
2295 | cp_backup_verbose () { |
|
2295 | cp_backup_verbose () { | |
2296 | cp -r -f -v "$@" |
|
2296 | cp -r -f -v "$@" | |
2297 | } |
|
2297 | } | |
2298 |
|
2298 | |||
2299 | # version_gte checks if the version specified in $VERSION is at least the given |
|
2299 | # version_gte checks if the version specified in $VERSION is at least the given | |
2300 | # SemVer (Maj.Minor[.Patch]), or CalVer (YY.MM) version.It returns 0 (success) |
|
2300 | # SemVer (Maj.Minor[.Patch]), or CalVer (YY.MM) version.It returns 0 (success) | |
2301 | # if $VERSION is either unset (=latest) or newer or equal than the specified |
|
2301 | # if $VERSION is either unset (=latest) or newer or equal than the specified | |
2302 | # version, or returns 1 (fail) otherwise. |
|
2302 | # version, or returns 1 (fail) otherwise. | |
2303 | # |
|
2303 | # | |
2304 | # examples: |
|
2304 | # examples: | |
2305 | # |
|
2305 | # | |
2306 | # VERSION=23.0 |
|
2306 | # VERSION=23.0 | |
2307 | # version_gte 23.0 // 0 (success) |
|
2307 | # version_gte 23.0 // 0 (success) | |
2308 | # version_gte 20.10 // 0 (success) |
|
2308 | # version_gte 20.10 // 0 (success) | |
2309 | # version_gte 19.03 // 0 (success) |
|
2309 | # version_gte 19.03 // 0 (success) | |
2310 | # version_gte 21.10 // 1 (fail) |
|
2310 | # version_gte 21.10 // 1 (fail) | |
2311 | version_gte() { |
|
2311 | version_gte() { | |
2312 | if [ -z "$VERSION" ]; then |
|
2312 | if [ -z "$VERSION" ]; then | |
2313 | return 0 |
|
2313 | return 0 | |
2314 | fi |
|
2314 | fi | |
2315 | eval version_compare "$VERSION" "$1" |
|
2315 | eval version_compare "$VERSION" "$1" | |
2316 | } |
|
2316 | } | |
2317 |
|
2317 | |||
2318 | # version_compare compares two version strings (either SemVer (Major.Minor.Path), |
|
2318 | # version_compare compares two version strings (either SemVer (Major.Minor.Path), | |
2319 | # or CalVer (YY.MM) version strings. It returns 0 (success) if version A is newer |
|
2319 | # or CalVer (YY.MM) version strings. It returns 0 (success) if version A is newer | |
2320 | # or equal than version B, or 1 (fail) otherwise. Patch releases and pre-release |
|
2320 | # or equal than version B, or 1 (fail) otherwise. Patch releases and pre-release | |
2321 | # (-alpha/-beta) are not taken into account |
|
2321 | # (-alpha/-beta) are not taken into account | |
2322 | # |
|
2322 | # | |
2323 | # examples: |
|
2323 | # examples: | |
2324 | # |
|
2324 | # | |
2325 | # version_compare 23.0.0 20.10 // 0 (success) |
|
2325 | # version_compare 23.0.0 20.10 // 0 (success) | |
2326 | # version_compare 23.0 20.10 // 0 (success) |
|
2326 | # version_compare 23.0 20.10 // 0 (success) | |
2327 | # version_compare 20.10 19.03 // 0 (success) |
|
2327 | # version_compare 20.10 19.03 // 0 (success) | |
2328 | # version_compare 20.10 20.10 // 0 (success) |
|
2328 | # version_compare 20.10 20.10 // 0 (success) | |
2329 | # version_compare 19.03 20.10 // 1 (fail) |
|
2329 | # version_compare 19.03 20.10 // 1 (fail) | |
2330 | version_compare() ( |
|
2330 | version_compare() ( | |
2331 | set +x |
|
2331 | set +x | |
2332 |
|
2332 | |||
2333 | yy_a="$(echo "$1" | cut -d'.' -f1)" |
|
2333 | yy_a="$(echo "$1" | cut -d'.' -f1)" | |
2334 | yy_b="$(echo "$2" | cut -d'.' -f1)" |
|
2334 | yy_b="$(echo "$2" | cut -d'.' -f1)" | |
2335 | if [ "$yy_a" -lt "$yy_b" ]; then |
|
2335 | if [ "$yy_a" -lt "$yy_b" ]; then | |
2336 | return 1 |
|
2336 | return 1 | |
2337 | fi |
|
2337 | fi | |
2338 | if [ "$yy_a" -gt "$yy_b" ]; then |
|
2338 | if [ "$yy_a" -gt "$yy_b" ]; then | |
2339 | return 0 |
|
2339 | return 0 | |
2340 | fi |
|
2340 | fi | |
2341 | mm_a="$(echo "$1" | cut -d'.' -f2)" |
|
2341 | mm_a="$(echo "$1" | cut -d'.' -f2)" | |
2342 | mm_b="$(echo "$2" | cut -d'.' -f2)" |
|
2342 | mm_b="$(echo "$2" | cut -d'.' -f2)" | |
2343 |
|
2343 | |||
2344 | # trim leading zeros to accommodate CalVer |
|
2344 | # trim leading zeros to accommodate CalVer | |
2345 | mm_a="${mm_a#0}" |
|
2345 | mm_a="${mm_a#0}" | |
2346 | mm_b="${mm_b#0}" |
|
2346 | mm_b="${mm_b#0}" | |
2347 |
|
2347 | |||
2348 | if [ "${mm_a:-0}" -lt "${mm_b:-0}" ]; then |
|
2348 | if [ "${mm_a:-0}" -lt "${mm_b:-0}" ]; then | |
2349 | return 1 |
|
2349 | return 1 | |
2350 | fi |
|
2350 | fi | |
2351 |
|
2351 | |||
2352 | return 0 |
|
2352 | return 0 | |
2353 | ) |
|
2353 | ) | |
2354 |
|
2354 | |||
2355 | # consistent sed function |
|
2355 | # consistent sed function | |
2356 | # example sed_func x y file.txt |
|
2356 | # example sed_func x y file.txt | |
2357 | sed_func() { |
|
2357 | sed_func() { | |
2358 | if [[ $DEBUG ]]; then |
|
2358 | if [[ $DEBUG ]]; then | |
2359 | echo |
|
2359 | echo | |
2360 | echo "sed -i .replaced -E \"s/$1/$2/\" $in_file" |
|
2360 | echo "sed -i .replaced -E \"s/$1/$2/\" $in_file" | |
2361 | echo "pat1: $1" |
|
2361 | echo "pat1: $1" | |
2362 | echo "pat2: $2" |
|
2362 | echo "pat2: $2" | |
2363 | fi |
|
2363 | fi | |
2364 |
|
2364 | |||
2365 | in_file=$3 |
|
2365 | in_file=$3 | |
2366 | sed -i.replaced -E "s/$1/$2/" $in_file |
|
2366 | sed -i.replaced -E "s/$1/$2/" $in_file | |
2367 | } |
|
2367 | } | |
2368 |
|
2368 | |||
2369 | # create a slug from a name |
|
2369 | # create a slug from a name | |
2370 | slugify() { |
|
2370 | slugify() { | |
2371 | local input="$1" |
|
2371 | local input="$1" | |
2372 | local slug |
|
2372 | local slug | |
2373 |
|
2373 | |||
2374 | # Convert to lowercase |
|
2374 | # Convert to lowercase | |
2375 | slug="${input,,}" |
|
2375 | slug="${input,,}" | |
2376 |
|
2376 | |||
2377 | # Replace slashes with underscores |
|
2377 | # Replace slashes with underscores | |
2378 | slug="${slug//\//_}" |
|
2378 | slug="${slug//\//_}" | |
2379 |
|
2379 | |||
2380 | # Replace spaces with hyphens |
|
2380 | # Replace spaces with hyphens | |
2381 | slug="${slug// /_}" |
|
2381 | slug="${slug// /_}" | |
2382 |
|
2382 | |||
2383 | # Remove characters that are not letters, numbers, or hyphens, or underscores |
|
2383 | # Remove characters that are not letters, numbers, or hyphens, or underscores | |
2384 | slug="${slug//[^a-zA-Z0-9-_]/}" |
|
2384 | slug="${slug//[^a-zA-Z0-9-_]/}" | |
2385 |
|
2385 | |||
2386 | echo "$slug" |
|
2386 | echo "$slug" | |
2387 | } |
|
2387 | } | |
2388 |
|
2388 | |||
2389 | # src/lib/validate_stack_exists.sh |
|
2389 | # src/lib/validate_stack_exists.sh | |
2390 |
|
2390 | |||
2391 | validate_stack_exists() { |
|
2391 | validate_stack_exists() { | |
2392 | err="" |
|
2392 | err="" | |
2393 | invalid="1" |
|
2393 | invalid="1" | |
2394 |
|
2394 | |||
2395 | for item in $VALID_SERVICES |
|
2395 | for item in $VALID_SERVICES | |
2396 | do |
|
2396 | do | |
2397 | if [ "$1" == "$item" ]; then |
|
2397 | if [ "$1" == "$item" ]; then | |
2398 | invalid="" |
|
2398 | invalid="" | |
2399 | break |
|
2399 | break | |
2400 | fi |
|
2400 | fi | |
2401 | done |
|
2401 | done | |
2402 |
|
2402 | |||
2403 | if [[ -n $invalid ]]; then |
|
2403 | if [[ -n $invalid ]]; then | |
2404 | err="command '$1' not in list of $VALID_SERVICES" |
|
2404 | err="command '$1' not in list of $VALID_SERVICES" | |
2405 | fi |
|
2405 | fi | |
2406 |
|
2406 | |||
2407 | echo $err |
|
2407 | echo $err | |
2408 | } |
|
2408 | } | |
2409 |
|
2409 | |||
2410 | # src/lib/validations/validate_dir_exists.sh |
|
2410 | # src/lib/validations/validate_dir_exists.sh | |
2411 | validate_dir_exists() { |
|
2411 | validate_dir_exists() { | |
2412 | [[ -d "$1" ]] || echo "must be an existing directory" |
|
2412 | [[ -d "$1" ]] || echo "must be an existing directory" | |
2413 | } |
|
2413 | } | |
2414 |
|
2414 | |||
2415 | # src/lib/validations/validate_file_exists.sh |
|
2415 | # src/lib/validations/validate_file_exists.sh | |
2416 | validate_file_exists() { |
|
2416 | validate_file_exists() { | |
2417 | [[ -f "$1" ]] || echo "must be an existing file" |
|
2417 | [[ -f "$1" ]] || echo "must be an existing file" | |
2418 | } |
|
2418 | } | |
2419 |
|
2419 | |||
2420 | # src/lib/validations/validate_integer.sh |
|
2420 | # src/lib/validations/validate_integer.sh | |
2421 | validate_integer() { |
|
2421 | validate_integer() { | |
2422 | [[ "$1" =~ ^[0-9]+$ ]] || echo "must be an integer" |
|
2422 | [[ "$1" =~ ^[0-9]+$ ]] || echo "must be an integer" | |
2423 | } |
|
2423 | } | |
2424 |
|
2424 | |||
2425 | # src/lib/validations/validate_not_empty.sh |
|
2425 | # src/lib/validations/validate_not_empty.sh | |
2426 | validate_not_empty() { |
|
2426 | validate_not_empty() { | |
2427 | [[ -z "$1" ]] && echo "must not be empty" |
|
2427 | [[ -z "$1" ]] && echo "must not be empty" | |
2428 | } |
|
2428 | } | |
2429 |
|
2429 | |||
2430 | # :command.command_functions |
|
2430 | # :command.command_functions | |
2431 | # :command.function |
|
2431 | # :command.function | |
2432 | rcstack_get_started_command() { |
|
2432 | rcstack_get_started_command() { | |
2433 | # src/get_started_command.sh |
|
2433 | # src/get_started_command.sh | |
2434 | get_started_full |
|
2434 | get_started_full | |
2435 | } |
|
2435 | } | |
2436 |
|
2436 | |||
2437 | # :command.function |
|
2437 | # :command.function | |
2438 | rcstack_init_command() { |
|
2438 | rcstack_init_command() { | |
2439 | # src/init_command.sh |
|
2439 | # src/init_command.sh | |
2440 | DEBUG=${args[--debug]} |
|
2440 | DEBUG=${args[--debug]} | |
2441 | force=${args[--force]} |
|
2441 | force=${args[--force]} | |
2442 | docker_revision=${args[--docker-revision]} |
|
2442 | docker_revision=${args[--docker-revision]} | |
2443 | install_docker=${args[--install-docker]} |
|
2443 | install_docker=${args[--install-docker]} | |
2444 | no_prompt=${args[--no-prompt]} |
|
2444 | no_prompt=${args[--no-prompt]} | |
2445 |
|
2445 | |||
2446 | eval "stages_from_cli=(${args[--stage]})" |
|
2446 | eval "stages_from_cli=(${args[--stage]})" | |
2447 |
|
2447 | |||
2448 | # CLI passed args / defaults |
|
2448 | # CLI passed args / defaults | |
2449 |
|
2449 | |||
2450 | if [[ -z ${args['--arg-rc-edition']} ]]; then |
|
2450 | if [[ -z ${args['--arg-rc-edition']} ]]; then | |
2451 | # set default |
|
2451 | # set default | |
2452 | args['--arg-rc-edition']="ee" |
|
2452 | args['--arg-rc-edition']="ee" | |
2453 | else |
|
2453 | else | |
2454 | # mark we used flag and don't ask in prompts |
|
2454 | # mark we used flag and don't ask in prompts | |
2455 | args['__arg_rc_edition']=1 |
|
2455 | args['__arg_rc_edition']=1 | |
2456 | fi |
|
2456 | fi | |
2457 |
|
2457 | |||
2458 | if [[ -z ${args['--arg-accept-eula']} ]]; then |
|
2458 | if [[ -z ${args['--arg-accept-eula']} ]]; then | |
2459 | # set default |
|
2459 | # set default | |
2460 | args['--arg-accept-eula']="yes" |
|
2460 | args['--arg-accept-eula']="yes" | |
2461 | else |
|
2461 | else | |
2462 | # mark we used flag and don't ask in prompts |
|
2462 | # mark we used flag and don't ask in prompts | |
2463 | args['__arg_accept_eula']=1 |
|
2463 | args['__arg_accept_eula']=1 | |
2464 | fi |
|
2464 | fi | |
2465 |
|
2465 | |||
2466 | if [[ -z ${args['--arg-hostname']} ]]; then |
|
2466 | if [[ -z ${args['--arg-hostname']} ]]; then | |
2467 | # set default |
|
2467 | # set default | |
2468 | args['--arg-hostname']="rhodecode.local" |
|
2468 | args['--arg-hostname']="rhodecode.local" | |
2469 | else |
|
2469 | else | |
2470 | # mark we used flag and don't ask in prompts |
|
2470 | # mark we used flag and don't ask in prompts | |
2471 | args['__arg_hostname']=1 |
|
2471 | args['__arg_hostname']=1 | |
2472 | fi |
|
2472 | fi | |
2473 |
|
2473 | |||
2474 | if [[ -z ${args['--arg-use-ssl']} ]]; then |
|
2474 | if [[ -z ${args['--arg-use-ssl']} ]]; then | |
2475 | # set default |
|
2475 | # set default | |
2476 | args['--arg-use-ssl']="n" |
|
2476 | args['--arg-use-ssl']="n" | |
2477 | else |
|
2477 | else | |
2478 | # mark we used flag and don't ask in prompts |
|
2478 | # mark we used flag and don't ask in prompts | |
2479 | args['__arg_use_ssl']=1 |
|
2479 | args['__arg_use_ssl']=1 | |
2480 | fi |
|
2480 | fi | |
2481 |
|
2481 | |||
2482 | if [[ -z ${args['--arg-admin-email']} ]]; then |
|
2482 | if [[ -z ${args['--arg-admin-email']} ]]; then | |
2483 | # set default |
|
2483 | # set default | |
2484 | args['--arg-admin-email']="admin@${args['--arg-hostname']}" |
|
2484 | args['--arg-admin-email']="admin@${args['--arg-hostname']}" | |
2485 | else |
|
2485 | else | |
2486 | # mark we used flag and don't ask in prompts |
|
2486 | # mark we used flag and don't ask in prompts | |
2487 | args['__arg_admin_email']=1 |
|
2487 | args['__arg_admin_email']=1 | |
2488 | fi |
|
2488 | fi | |
2489 |
|
2489 | |||
2490 | if [[ -z ${args['--arg-admin-user']} ]]; then |
|
2490 | if [[ -z ${args['--arg-admin-user']} ]]; then | |
2491 | # set default |
|
2491 | # set default | |
2492 | args['--arg-admin-user']="admin" |
|
2492 | args['--arg-admin-user']="admin" | |
2493 | else |
|
2493 | else | |
2494 | # mark we used flag and don't ask in prompts |
|
2494 | # mark we used flag and don't ask in prompts | |
2495 | args['__arg_admin_user']=1 |
|
2495 | args['__arg_admin_user']=1 | |
2496 | fi |
|
2496 | fi | |
2497 |
|
2497 | |||
2498 | if [[ -z ${args['--arg-admin-pass']} ]]; then |
|
2498 | if [[ -z ${args['--arg-admin-pass']} ]]; then | |
2499 | # set default |
|
2499 | # set default | |
2500 | args['--arg-admin-pass']="secret4" |
|
2500 | args['--arg-admin-pass']="secret4" | |
2501 | else |
|
2501 | else | |
2502 | # mark we used flag and don't ask in prompts |
|
2502 | # mark we used flag and don't ask in prompts | |
2503 | args['__arg_admin_pass']=1 |
|
2503 | args['__arg_admin_pass']=1 | |
2504 | fi |
|
2504 | fi | |
2505 |
|
2505 | |||
2506 | if [[ -z ${args['--arg-license-token']} ]]; then |
|
2506 | if [[ -z ${args['--arg-license-token']} ]]; then | |
2507 | # set default |
|
2507 | # set default | |
2508 | args['--arg-license-token']="$(random_str 4)"-"$(random_str 4)"-"$(random_str 4)"-"$(random_str 4)" |
|
2508 | args['--arg-license-token']="$(random_str 4)"-"$(random_str 4)"-"$(random_str 4)"-"$(random_str 4)" | |
2509 | else |
|
2509 | else | |
2510 | # mark we used flag and don't ask in prompts |
|
2510 | # mark we used flag and don't ask in prompts | |
2511 | args['__arg_license_token']=1 |
|
2511 | args['__arg_license_token']=1 | |
2512 | fi |
|
2512 | fi | |
2513 |
|
2513 | |||
2514 | if [[ -z ${args['--arg-log-formatter']} ]]; then |
|
2514 | if [[ -z ${args['--arg-log-formatter']} ]]; then | |
2515 | # set default |
|
2515 | # set default | |
2516 | args['--arg-log-formatter']="json" |
|
2516 | args['--arg-log-formatter']="json" | |
2517 | else |
|
2517 | else | |
2518 | # mark we used flag and don't ask in prompts |
|
2518 | # mark we used flag and don't ask in prompts | |
2519 | args['__arg_log_formatter']=1 |
|
2519 | args['__arg_log_formatter']=1 | |
2520 | fi |
|
2520 | fi | |
2521 |
|
2521 | |||
2522 | arg_rc_edition=${args[--arg-rc-edition]} |
|
2522 | arg_rc_edition=${args[--arg-rc-edition]} | |
2523 | arg_accept_eula=${args[--arg-accept-eula]} |
|
2523 | arg_accept_eula=${args[--arg-accept-eula]} | |
2524 | arg_hostname=${args[--arg-hostname]} |
|
2524 | arg_hostname=${args[--arg-hostname]} | |
2525 | arg_use_ssl=${args[--arg-use-ssl]} |
|
2525 | arg_use_ssl=${args[--arg-use-ssl]} | |
2526 | arg_admin_email=${args[--arg-admin-email]} |
|
2526 | arg_admin_email=${args[--arg-admin-email]} | |
2527 | arg_admin_user=${args[--arg-admin-user]} |
|
2527 | arg_admin_user=${args[--arg-admin-user]} | |
2528 | arg_admin_pass=${args[--arg-admin-pass]} |
|
2528 | arg_admin_pass=${args[--arg-admin-pass]} | |
2529 | arg_license_token=${args[--arg-license-token]} |
|
2529 | arg_license_token=${args[--arg-license-token]} | |
2530 | arg_log_formatter=${args[--arg-log-formatter]} |
|
2530 | arg_log_formatter=${args[--arg-log-formatter]} | |
2531 |
|
2531 | |||
2532 | ask_user_for_config() { |
|
2532 | ask_user_for_config() { | |
2533 | local config_done="n" |
|
2533 | local config_done="n" | |
2534 |
|
2534 | |||
2535 | echo "Starting interactive setup..." |
|
2535 | echo "Starting interactive setup..." | |
2536 | echo "" |
|
2536 | echo "" | |
2537 |
|
2537 | |||
2538 | while [[ "$config_done" == "n" ]] |
|
2538 | while [[ "$config_done" == "n" ]] | |
2539 | # config loop start |
|
2539 | # config loop start | |
2540 | do |
|
2540 | do | |
2541 | # edition to install |
|
2541 | # edition to install | |
2542 | if [ ! -z "$arg_rc_edition" ] && [ -z ${args['__arg_rc_edition']} ] |
|
2542 | if [ ! -z "$arg_rc_edition" ] && [ -z ${args['__arg_rc_edition']} ] | |
2543 | then |
|
2543 | then | |
2544 | read -p "Select 'ee' to use Enterprise edition or type 'ce' to use Community free edition: rhodecode-[$arg_rc_edition]: " new_value |
|
2544 | read -p "Select 'ee' to use Enterprise edition or type 'ce' to use Community free edition: rhodecode-[$arg_rc_edition]: " new_value | |
2545 | if [ ! -z "$new_value" ] |
|
2545 | if [ ! -z "$new_value" ] | |
2546 | then |
|
2546 | then | |
2547 | arg_rc_edition="$new_value" |
|
2547 | arg_rc_edition="$new_value" | |
2548 | fi |
|
2548 | fi | |
2549 | fi |
|
2549 | fi | |
2550 |
|
2550 | |||
2551 | if [ ! -z "$arg_accept_eula" ] && [ -z ${args['__arg_accept_eula']} ] |
|
2551 | if [ ! -z "$arg_accept_eula" ] && [ -z ${args['__arg_accept_eula']} ] | |
2552 | then |
|
2552 | then | |
2553 | if [[ $arg_rc_edition == "ee" ]]; then |
|
2553 | if [[ $arg_rc_edition == "ee" ]]; then | |
2554 | #EE EULA |
|
2554 | #EE EULA | |
2555 | 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 |
|
2555 | 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 | |
2556 | else |
|
2556 | else | |
2557 | #CE EULA |
|
2557 | #CE EULA | |
2558 | 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 |
|
2558 | 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 | |
2559 | fi |
|
2559 | fi | |
2560 |
|
2560 | |||
2561 | if [ ! -z "$new_value" ] |
|
2561 | if [ ! -z "$new_value" ] | |
2562 | then |
|
2562 | then | |
2563 | arg_accept_eula="$new_value" |
|
2563 | arg_accept_eula="$new_value" | |
2564 | fi |
|
2564 | fi | |
2565 |
|
2565 | |||
2566 | if [[ $arg_accept_eula != "yes" ]]; then |
|
2566 | if [[ $arg_accept_eula != "yes" ]]; then | |
2567 | echo "$(red please accept EULA by typing yes, no installation is possible without accepted EULA)" |
|
2567 | echo "$(red please accept EULA by typing yes, no installation is possible without accepted EULA)" | |
2568 | exit |
|
2568 | exit | |
2569 | fi |
|
2569 | fi | |
2570 | fi |
|
2570 | fi | |
2571 |
|
2571 | |||
2572 | # ask for license-token IF edition is ee |
|
2572 | # ask for license-token IF edition is ee | |
2573 | if [[ $arg_rc_edition == "ee" ]]; then |
|
2573 | if [[ $arg_rc_edition == "ee" ]]; then | |
2574 | if [ ! -z "$arg_license_token" ] && [ -z ${args['__arg_license_token']} ] |
|
2574 | if [ ! -z "$arg_license_token" ] && [ -z ${args['__arg_license_token']} ] | |
2575 | then |
|
2575 | then | |
2576 | read -p "enter a valid license-token or use pre-generated one [$arg_license_token]: " new_value |
|
2576 | read -p "enter a valid license-token or use pre-generated one [$arg_license_token]: " new_value | |
2577 | if [ ! -z "$new_value" ] |
|
2577 | if [ ! -z "$new_value" ] | |
2578 | then |
|
2578 | then | |
2579 | arg_license_token="$new_value" |
|
2579 | arg_license_token="$new_value" | |
2580 | fi |
|
2580 | fi | |
2581 | fi |
|
2581 | fi | |
2582 | fi |
|
2582 | fi | |
2583 |
|
2583 | |||
2584 | # hostname |
|
2584 | # hostname | |
2585 | if [ ! -z "$arg_hostname" ] && [ -z ${args['__arg_hostname']} ] |
|
2585 | if [ ! -z "$arg_hostname" ] && [ -z ${args['__arg_hostname']} ] | |
2586 | then |
|
2586 | then | |
2587 | read -p "Enter a valid hostname for RhodeCode Stack? [$arg_hostname]: " new_value |
|
2587 | read -p "Enter a valid hostname for RhodeCode Stack? [$arg_hostname]: " new_value | |
2588 | if [ ! -z "$new_value" ] |
|
2588 | if [ ! -z "$new_value" ] | |
2589 | then |
|
2589 | then | |
2590 | arg_hostname="$new_value" |
|
2590 | arg_hostname="$new_value" | |
2591 | fi |
|
2591 | fi | |
2592 | if [[ $arg_hostname =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]] |
|
2592 | if [[ $arg_hostname =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]] | |
2593 | then |
|
2593 | then | |
2594 | echo |
|
2594 | echo | |
2595 | echo "$(red IP addresses are unsupported and will not work. Please provide a DNS hostname)" |
|
2595 | echo "$(red IP addresses are unsupported and will not work. Please provide a DNS hostname)" | |
2596 | echo |
|
2596 | echo | |
2597 | arg_hostname="rc-docker.local" |
|
2597 | arg_hostname="rc-docker.local" | |
2598 | fi |
|
2598 | fi | |
2599 | fi |
|
2599 | fi | |
2600 |
|
2600 | |||
2601 | # use SSL |
|
2601 | # use SSL | |
2602 | if [ ! -z "$arg_use_ssl" ] && [ -z ${args['__arg_use_ssl']} ] |
|
2602 | if [ ! -z "$arg_use_ssl" ] && [ -z ${args['__arg_use_ssl']} ] | |
2603 | then |
|
2603 | then | |
2604 | 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 |
|
2604 | 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 | |
2605 | if [ ! -z "$new_value" ] |
|
2605 | if [ ! -z "$new_value" ] | |
2606 | then |
|
2606 | then | |
2607 | arg_use_ssl="$new_value" |
|
2607 | arg_use_ssl="$new_value" | |
2608 | fi |
|
2608 | fi | |
2609 | fi |
|
2609 | fi | |
2610 |
|
2610 | |||
2611 | # admin email |
|
2611 | # admin email | |
2612 | if [ ! -z "$arg_admin_email" ] && [ -z ${args['__arg_admin_email']} ] |
|
2612 | if [ ! -z "$arg_admin_email" ] && [ -z ${args['__arg_admin_email']} ] | |
2613 | then |
|
2613 | then | |
2614 | read -p "Enter first super-admin email? [$arg_admin_email]: " new_value |
|
2614 | read -p "Enter first super-admin email? [$arg_admin_email]: " new_value | |
2615 | if [ ! -z "$new_value" ] |
|
2615 | if [ ! -z "$new_value" ] | |
2616 | then |
|
2616 | then | |
2617 | arg_admin_email="$new_value" |
|
2617 | arg_admin_email="$new_value" | |
2618 | fi |
|
2618 | fi | |
2619 | fi |
|
2619 | fi | |
2620 |
|
2620 | |||
2621 | # admin user |
|
2621 | # admin user | |
2622 | if [ ! -z "$arg_admin_user" ] && [ -z ${args['__arg_admin_user']} ] |
|
2622 | if [ ! -z "$arg_admin_user" ] && [ -z ${args['__arg_admin_user']} ] | |
2623 | then |
|
2623 | then | |
2624 | read -p "Enter first super-admin account name? [$arg_admin_user]: " new_value |
|
2624 | read -p "Enter first super-admin account name? [$arg_admin_user]: " new_value | |
2625 | if [ ! -z "$new_value" ] |
|
2625 | if [ ! -z "$new_value" ] | |
2626 | then |
|
2626 | then | |
2627 | arg_admin_user="$new_value" |
|
2627 | arg_admin_user="$new_value" | |
2628 | fi |
|
2628 | fi | |
2629 | fi |
|
2629 | fi | |
2630 |
|
2630 | |||
2631 | # admin password |
|
2631 | # admin password | |
2632 | if [ ! -z "$arg_admin_pass" ] && [ -z ${args['__arg_admin_pass']} ] |
|
2632 | if [ ! -z "$arg_admin_pass" ] && [ -z ${args['__arg_admin_pass']} ] | |
2633 | then |
|
2633 | then | |
2634 | read -p "Enter first super-admin account password? [$arg_admin_pass]: " new_value |
|
2634 | read -p "Enter first super-admin account password? [$arg_admin_pass]: " new_value | |
2635 | if [ ! -z "$new_value" ] |
|
2635 | if [ ! -z "$new_value" ] | |
2636 | then |
|
2636 | then | |
2637 | arg_admin_pass="$new_value" |
|
2637 | arg_admin_pass="$new_value" | |
2638 | fi |
|
2638 | fi | |
2639 | fi |
|
2639 | fi | |
2640 |
|
2640 | |||
2641 | echo -e "\nDoes this look right?\n" |
|
2641 | echo -e "\nDoes this look right?\n" | |
2642 | echo "RhodeCode Edition : rhodecode-$arg_rc_edition" |
|
2642 | echo "RhodeCode Edition : rhodecode-$arg_rc_edition" | |
2643 | echo "License Token : $arg_license_token" |
|
2643 | echo "License Token : $arg_license_token" | |
2644 | echo "Hostname : $arg_hostname" |
|
2644 | echo "Hostname : $arg_hostname" | |
2645 | echo "Use SSL : $arg_use_ssl" |
|
2645 | echo "Use SSL : $arg_use_ssl" | |
2646 | echo "Email : $arg_admin_email" |
|
2646 | echo "Email : $arg_admin_email" | |
2647 | echo "Admin user : $arg_admin_user" |
|
2647 | echo "Admin user : $arg_admin_user" | |
2648 | echo "Admin password : $arg_admin_pass" |
|
2648 | echo "Admin password : $arg_admin_pass" | |
2649 | echo "" |
|
2649 | echo "" | |
2650 | read -p "ENTER to continue, 'n' to try again, Ctrl+C to exit: " config_done |
|
2650 | read -p "ENTER to continue, 'n' to try again, Ctrl+C to exit: " config_done | |
2651 |
|
2651 | |||
2652 | # config loop end |
|
2652 | # config loop end | |
2653 | done |
|
2653 | done | |
2654 |
|
2654 | |||
2655 | } |
|
2655 | } | |
2656 |
|
2656 | |||
2657 | check_docker() { |
|
2657 | check_docker() { | |
2658 | (which docker || which docker.io) &>/dev/null |
|
2658 | (which docker || which docker.io) &>/dev/null | |
2659 | } |
|
2659 | } | |
2660 |
|
2660 | |||
2661 | bootstrap_docker_install() { |
|
2661 | bootstrap_docker_install() { | |
2662 | # systemctl enable docker on debian |
|
2662 | # systemctl enable docker on debian | |
2663 | echo "bootstrap_docker_install: trying to check and configure docker" |
|
2663 | echo "bootstrap_docker_install: trying to check and configure docker" | |
2664 | failMsg="Failed to find docker on your PATH" |
|
2664 | failMsg="Failed to find docker on your PATH" | |
2665 |
|
2665 | |||
2666 | if ! check_docker; then |
|
2666 | if ! check_docker; then | |
2667 |
|
2667 | |||
2668 | if [[ $install_docker == "n" ]]; then |
|
2668 | if [[ $install_docker == "n" ]]; then | |
2669 | echo "$(red $failMsg, exiting without docker install)" |
|
2669 | echo "$(red $failMsg, exiting without docker install)" | |
2670 | fi |
|
2670 | fi | |
2671 |
|
2671 | |||
2672 | echo "$(yellow $failMsg, trying docker install)" |
|
2672 | echo "$(yellow $failMsg, trying docker install)" | |
2673 |
|
2673 | |||
2674 | if [[ $install_docker == "y" ]]; then |
|
2674 | if [[ $install_docker == "y" ]]; then | |
2675 | echo "continuing with automated docker installation from https://get.docker.com/ " |
|
2675 | echo "continuing with automated docker installation from https://get.docker.com/ " | |
2676 | else |
|
2676 | else | |
2677 | read -p "Enter to install Docker directly from https://get.docker.com/ or Ctrl+C to exit and install it manually" |
|
2677 | read -p "Enter to install Docker directly from https://get.docker.com/ or Ctrl+C to exit and install it manually" | |
2678 | fi |
|
2678 | fi | |
2679 |
|
2679 | |||
2680 | curl -fsSL https://get.docker.com -o install-docker.sh |
|
2680 | curl -fsSL https://get.docker.com -o install-docker.sh | |
2681 | sh install-docker.sh |
|
2681 | sh install-docker.sh | |
2682 | rm install-docker.sh |
|
2682 | rm install-docker.sh | |
2683 |
|
2683 | |||
2684 | if ! check_docker; then |
|
2684 | if ! check_docker; then | |
2685 | echo "$failMsg" |
|
2685 | echo "$failMsg" | |
2686 | echo "Docker install failed. Quitting." |
|
2686 | echo "Docker install failed. Quitting." | |
2687 | exit 1 |
|
2687 | exit 1 | |
2688 | fi |
|
2688 | fi | |
2689 |
|
2689 | |||
2690 | docker --version |
|
2690 | docker --version | |
2691 |
|
2691 | |||
2692 | fi |
|
2692 | fi | |
2693 | } |
|
2693 | } | |
2694 |
|
2694 | |||
2695 | bootstrap_docker_commons() { |
|
2695 | bootstrap_docker_commons() { | |
2696 |
|
2696 | |||
2697 | echo 'bootstrap_docker_commons: running docker commands.' |
|
2697 | echo 'bootstrap_docker_commons: running docker commands.' | |
2698 |
|
2698 | |||
2699 | echo "bootstrap_docker_commons: creating volume 'rc_datavolume'" |
|
2699 | echo "bootstrap_docker_commons: creating volume 'rc_datavolume'" | |
2700 | docker volume create --label keep=1 --name=rc_datavolume |
|
2700 | docker volume create --label keep=1 --name=rc_datavolume | |
2701 | echo "bootstrap_docker_commons (rc_datavolume): done" |
|
2701 | echo "bootstrap_docker_commons (rc_datavolume): done" | |
2702 | echo "" |
|
2702 | echo "" | |
2703 |
|
2703 | |||
2704 | echo "bootstrap_docker_commons: creating volume 'rc_reposvolume'" |
|
2704 | echo "bootstrap_docker_commons: creating volume 'rc_reposvolume'" | |
2705 | docker volume create --label keep=1 --name=rc_reposvolume |
|
2705 | docker volume create --label keep=1 --name=rc_reposvolume | |
2706 | echo "bootstrap_docker_commons (rc_reposvolume): done" |
|
2706 | echo "bootstrap_docker_commons (rc_reposvolume): done" | |
2707 | echo "" |
|
2707 | echo "" | |
2708 |
|
2708 | |||
2709 | echo "bootstrap_docker_commons: creating network 'rhodecode_network'" |
|
2709 | echo "bootstrap_docker_commons: creating network 'rhodecode_network'" | |
2710 | docker network inspect rhodecode_network >/dev/null 2>&1 || docker network create rhodecode_network |
|
2710 | docker network inspect rhodecode_network >/dev/null 2>&1 || docker network create rhodecode_network | |
2711 | echo "bootstrap_docker_commons (rhodecode_network): done" |
|
2711 | echo "bootstrap_docker_commons (rhodecode_network): done" | |
2712 | echo "" |
|
2712 | echo "" | |
2713 |
|
2713 | |||
2714 | echo "bootstrap_docker_commons: creating loki logging" |
|
2714 | echo "bootstrap_docker_commons: creating loki logging" | |
2715 | loki_driver=$(docker plugin ls --format {{.Name}} --filter enabled=true | grep loki || echo "") |
|
2715 | loki_driver=$(docker plugin ls --format {{.Name}} --filter enabled=true | grep loki || echo "") | |
2716 | if [[ $loki_driver == "" ]]; then |
|
2716 | if [[ $loki_driver == "" ]]; then | |
2717 | docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions |
|
2717 | docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions | |
2718 | else |
|
2718 | else | |
2719 | echo "bootstrap_docker_commons: loki driver already exists" |
|
2719 | echo "bootstrap_docker_commons: loki driver already exists" | |
2720 | fi |
|
2720 | fi | |
2721 | } |
|
2721 | } | |
2722 |
|
2722 | |||
2723 | config_init() { |
|
2723 | config_init() { | |
2724 | loc_config_file=${CONFIG_FILE:=config.ini} |
|
2724 | loc_config_file=${CONFIG_FILE:=config.ini} | |
2725 | [[ -f "$loc_config_file" ]] || touch "$loc_config_file" |
|
2725 | [[ -f "$loc_config_file" ]] || touch "$loc_config_file" | |
2726 | } |
|
2726 | } | |
2727 |
|
2727 | |||
2728 | bootstrap_config() { |
|
2728 | bootstrap_config() { | |
2729 | shared_key=$(random_str 32) |
|
2729 | shared_key=$(random_str 32) | |
2730 | shared_key_md5=$(generate_md5 $shared_key | head -c 32) |
|
2730 | shared_key_md5=$(generate_md5 $shared_key | head -c 32) | |
2731 | db_key=$(random_str 32) |
|
2731 | db_key=$(random_str 32) | |
2732 |
|
2732 | |||
2733 | if [[ ! $no_prompt ]]; then |
|
2733 | if [[ ! $no_prompt ]]; then | |
2734 | ask_user_for_config |
|
2734 | ask_user_for_config | |
2735 | fi |
|
2735 | fi | |
2736 |
|
2736 | |||
2737 | # setup args |
|
2737 | # setup args | |
2738 | license_token=$arg_license_token |
|
2738 | license_token=$arg_license_token | |
2739 | log_formatter=$arg_log_formatter |
|
2739 | log_formatter=$arg_log_formatter | |
2740 | base_domain=$arg_hostname |
|
2740 | base_domain=$arg_hostname | |
2741 | rc_edition=$arg_rc_edition |
|
2741 | rc_edition=$arg_rc_edition | |
2742 |
|
2742 | |||
2743 | is_https=0 |
|
2743 | is_https=0 | |
2744 | if [[ $arg_use_ssl == "y" ]]; then is_https=1; fi |
|
2744 | if [[ $arg_use_ssl == "y" ]]; then is_https=1; fi | |
2745 |
|
2745 | |||
2746 | DB_USER='rhodecode' |
|
2746 | DB_USER='rhodecode' | |
2747 | DB_NAME='rhodecode' |
|
2747 | DB_NAME='rhodecode' | |
2748 |
|
2748 | |||
2749 | if [[ ! -f "$CONFIG_FILE" ]]; then |
|
2749 | if [[ ! -f "$CONFIG_FILE" ]]; then | |
2750 | echo "init new config at: $CONFIG_FILE" |
|
2750 | echo "init new config at: $CONFIG_FILE" | |
2751 | config_init |
|
2751 | config_init | |
2752 | else |
|
2752 | else | |
2753 | echo "re-using existing config at: $CONFIG_FILE" |
|
2753 | echo "re-using existing config at: $CONFIG_FILE" | |
2754 | fi |
|
2754 | fi | |
2755 |
|
2755 | |||
2756 | CUSTOM_DIR_PATH=$PWD/.custom |
|
2756 | CUSTOM_DIR_PATH=$PWD/.custom | |
2757 | mkdir -p "$CUSTOM_DIR_PATH" |
|
2757 | mkdir -p "$CUSTOM_DIR_PATH" | |
2758 | BOOTSTRAP_TMPL=$PWD/templates/runtime.env.tmpl |
|
2758 | BOOTSTRAP_TMPL=$PWD/templates/runtime.env.tmpl | |
2759 | BOOTSTRAP_RUNTIME_ENV=$PWD/.custom/.runtime.env |
|
2759 | BOOTSTRAP_RUNTIME_ENV=$PWD/.custom/.runtime.env | |
2760 |
|
2760 | |||
2761 | # TODO: Pick version |
|
2761 | # TODO: Pick version | |
2762 | ver=0_edge |
|
2762 | ver=0_edge | |
2763 | INI_TARGET=$PWD/config/_shared |
|
2763 | INI_TARGET=$PWD/config/_shared | |
2764 | RHODECODE_INI_TMPL=$PWD/templates/ini/$ver/rhodecode.ini |
|
2764 | RHODECODE_INI_TMPL=$PWD/templates/ini/$ver/rhodecode.ini | |
2765 | VCSSERVER_INI_TMPL=$PWD/templates/ini/$ver/vcsserver.ini |
|
2765 | VCSSERVER_INI_TMPL=$PWD/templates/ini/$ver/vcsserver.ini | |
2766 |
|
2766 | |||
2767 | # break if we didn't use force and definitions exist |
|
2767 | # break if we didn't use force and definitions exist | |
2768 | if [[ -f $BOOTSTRAP_RUNTIME_ENV && ! $force ]]; then |
|
2768 | if [[ -f $BOOTSTRAP_RUNTIME_ENV && ! $force ]]; then | |
2769 | echo "$(yellow bootstrap_config: $BOOTSTRAP_RUNTIME_ENV file exists, not adding any configuration. Use --force to create it anyway)" |
|
2769 | echo "$(yellow bootstrap_config: $BOOTSTRAP_RUNTIME_ENV file exists, not adding any configuration. Use --force to create it anyway)" | |
2770 | return |
|
2770 | return | |
2771 | fi |
|
2771 | fi | |
2772 |
|
2772 | |||
2773 | if [[ -f $BOOTSTRAP_RUNTIME_ENV ]]; then |
|
2773 | if [[ -f $BOOTSTRAP_RUNTIME_ENV ]]; then | |
2774 | echo "$(yellow $BOOTSTRAP_RUNTIME_ENV file exists, are you sure to force re-create it?)" |
|
2774 | echo "$(yellow $BOOTSTRAP_RUNTIME_ENV file exists, are you sure to force re-create it?)" | |
2775 | while true; do |
|
2775 | while true; do | |
2776 | read -p "Would you like to continue with overriding file? [yn] " yn |
|
2776 | read -p "Would you like to continue with overriding file? [yn] " yn | |
2777 | case $yn in |
|
2777 | case $yn in | |
2778 | [Yy]*) break ;; |
|
2778 | [Yy]*) break ;; | |
2779 | [Nn]*) exit ;; |
|
2779 | [Nn]*) exit ;; | |
2780 | *) echo "Please answer y or n." ;; |
|
2780 | *) echo "Please answer y or n." ;; | |
2781 | esac |
|
2781 | esac | |
2782 | done |
|
2782 | done | |
2783 | fi |
|
2783 | fi | |
2784 |
|
2784 | |||
2785 | echo "bootstrap_config: init runtime env config at: $BOOTSTRAP_RUNTIME_ENV" |
|
2785 | echo "bootstrap_config: init runtime env config at: $BOOTSTRAP_RUNTIME_ENV" | |
2786 |
|
2786 | |||
2787 | # Make runtime file |
|
2787 | # Make runtime file | |
2788 | echo "## BOOTSTRAP GENERATED $(date) ##" > $BOOTSTRAP_RUNTIME_ENV |
|
2788 | echo "## BOOTSTRAP GENERATED $(date) ##" > $BOOTSTRAP_RUNTIME_ENV | |
2789 | echo "" >> $BOOTSTRAP_RUNTIME_ENV |
|
2789 | echo "" >> $BOOTSTRAP_RUNTIME_ENV | |
2790 |
|
2790 | |||
2791 | cat $BOOTSTRAP_TMPL >> $BOOTSTRAP_RUNTIME_ENV |
|
2791 | cat $BOOTSTRAP_TMPL >> $BOOTSTRAP_RUNTIME_ENV | |
2792 |
|
2792 | |||
2793 | # Make .ini files |
|
2793 | # Make .ini files | |
2794 | cp -v $RHODECODE_INI_TMPL $INI_TARGET |
|
2794 | cp -v $RHODECODE_INI_TMPL $INI_TARGET | |
2795 | cp -v $VCSSERVER_INI_TMPL $INI_TARGET |
|
2795 | cp -v $VCSSERVER_INI_TMPL $INI_TARGET | |
2796 |
|
2796 | |||
2797 | # init env generator with env file |
|
2797 | # init env generator with env file | |
2798 | .env --file "$BOOTSTRAP_RUNTIME_ENV" |
|
2798 | .env --file "$BOOTSTRAP_RUNTIME_ENV" | |
2799 |
|
2799 | |||
2800 | .env set RC_EDITION=$rc_edition |
|
2800 | .env set RC_EDITION=$rc_edition | |
2801 | .env set DB_PASSWORD=$db_key |
|
2801 | .env set DB_PASSWORD=$db_key | |
2802 |
|
2802 | |||
2803 | .env set RHODECODE_USER_EMAIL=$arg_admin_email |
|
2803 | .env set RHODECODE_USER_EMAIL=$arg_admin_email | |
2804 | .env set RHODECODE_USER_NAME=$arg_admin_user |
|
2804 | .env set RHODECODE_USER_NAME=$arg_admin_user | |
2805 | .env set RHODECODE_USER_PASS=$arg_admin_pass |
|
2805 | .env set RHODECODE_USER_PASS=$arg_admin_pass | |
2806 |
|
2806 | |||
2807 | .env set RC_ENCRYPTED_SECRET=$shared_key |
|
2807 | .env set RC_ENCRYPTED_SECRET=$shared_key | |
2808 |
|
2808 | |||
2809 | rc_db1="postgresql://$DB_USER:$db_key@database/$DB_NAME" |
|
2809 | rc_db1="postgresql://$DB_USER:$db_key@database/$DB_NAME" | |
2810 | .env set RC_DB_URL="$rc_db1" |
|
2810 | .env set RC_DB_URL="$rc_db1" | |
2811 | .env set RC_SQLALCHEMY_DB1_URL="$rc_db1" |
|
2811 | .env set RC_SQLALCHEMY_DB1_URL="$rc_db1" | |
2812 |
|
2812 | |||
2813 | .env set RC_LICENSE_TOKEN=$license_token |
|
2813 | .env set RC_LICENSE_TOKEN=$license_token | |
2814 | .env set RC_HOSTNAME=$base_domain |
|
2814 | .env set RC_HOSTNAME=$base_domain | |
2815 |
|
2815 | |||
2816 | if [[ $is_https == 1 ]]; then |
|
2816 | if [[ $is_https == 1 ]]; then | |
2817 | app_base_url=https://$base_domain |
|
2817 | app_base_url=https://$base_domain | |
2818 | else |
|
2818 | else | |
2819 | app_base_url=http://$base_domain |
|
2819 | app_base_url=http://$base_domain | |
2820 | fi |
|
2820 | fi | |
2821 |
|
2821 | |||
2822 | .env set RC_APP_BASE_URL=$app_base_url |
|
2822 | .env set RC_APP_BASE_URL=$app_base_url | |
2823 |
|
2823 | |||
2824 | .env set RC_LOKI_AUTH=loki-auth:$shared_key@ |
|
2824 | .env set RC_LOKI_AUTH=loki-auth:$shared_key@ | |
2825 |
|
2825 | |||
2826 | .env puts '' |
|
2826 | .env puts '' | |
2827 | .env puts '# Log formatter option' |
|
2827 | .env puts '# Log formatter option' | |
2828 | .env set RC_LOGGING_FORMATTER=$log_formatter |
|
2828 | .env set RC_LOGGING_FORMATTER=$log_formatter | |
2829 | .env set RC_USE_CELERY=true |
|
2829 | .env set RC_USE_CELERY=true | |
2830 |
|
2830 | |||
2831 | .env puts '' |
|
2831 | .env puts '' | |
2832 | .env puts '# Channelstream config' |
|
2832 | .env puts '# Channelstream config' | |
2833 | .env set RC_CHANNELSTREAM_SERVER=channelstream:8000 |
|
2833 | .env set RC_CHANNELSTREAM_SERVER=channelstream:8000 | |
2834 |
|
2834 | |||
2835 | if [[ $is_https == 1 ]]; then |
|
2835 | if [[ $is_https == 1 ]]; then | |
2836 | rc_channelstream_url="wss://$base_domain/_channelstream" |
|
2836 | rc_channelstream_url="wss://$base_domain/_channelstream" | |
2837 | else |
|
2837 | else | |
2838 | rc_channelstream_url="ws://$base_domain/_channelstream" |
|
2838 | rc_channelstream_url="ws://$base_domain/_channelstream" | |
2839 | fi |
|
2839 | fi | |
2840 |
|
2840 | |||
2841 | .env set RC_CHANNELSTREAM_WS_URL=$rc_channelstream_url |
|
2841 | .env set RC_CHANNELSTREAM_WS_URL=$rc_channelstream_url | |
2842 |
|
2842 | |||
2843 | .env set CHANNELSTREAM_ALLOW_POSTING_FROM=0.0.0.0 |
|
2843 | .env set CHANNELSTREAM_ALLOW_POSTING_FROM=0.0.0.0 | |
2844 |
|
2844 | |||
2845 | .env puts '' |
|
2845 | .env puts '' | |
2846 | .env puts '# Channelstream secrets' |
|
2846 | .env puts '# Channelstream secrets' | |
2847 | .env set CHANNELSTREAM_SECRET=$shared_key |
|
2847 | .env set CHANNELSTREAM_SECRET=$shared_key | |
2848 | .env set RC_CHANNELSTREAM_SECRET=$shared_key |
|
2848 | .env set RC_CHANNELSTREAM_SECRET=$shared_key | |
2849 |
|
2849 | |||
2850 | .env puts '' |
|
2850 | .env puts '' | |
2851 | .env puts '# Channelstream admin' |
|
2851 | .env puts '# Channelstream admin' | |
2852 | .env set CHANNELSTREAM_ADMIN_SECRET=$shared_key |
|
2852 | .env set CHANNELSTREAM_ADMIN_SECRET=$shared_key | |
2853 | .env set RC_CHANNELSTREAM_ADMIN_SECRET=$shared_key |
|
2853 | .env set RC_CHANNELSTREAM_ADMIN_SECRET=$shared_key | |
2854 |
|
2854 | |||
2855 | .env puts '' |
|
2855 | .env puts '' | |
2856 | .env puts '# SSH PORT' |
|
2856 | .env puts '# SSH PORT' | |
2857 | .env set RC_SSH_PORT=9022 |
|
2857 | .env set RC_SSH_PORT=9022 | |
2858 |
|
2858 | |||
2859 | ini_path=$INI_TARGET/vcsserver.ini |
|
2859 | ini_path=$INI_TARGET/vcsserver.ini | |
2860 | config_vcsserver_ini |
|
2860 | config_vcsserver_ini | |
2861 |
|
2861 | |||
2862 | ini_path=$INI_TARGET/rhodecode.ini |
|
2862 | ini_path=$INI_TARGET/rhodecode.ini | |
2863 | RC_EDITION=$rc_edition |
|
2863 | RC_EDITION=$rc_edition | |
2864 | RC_LICENSE_TOKEN=$license_token |
|
2864 | RC_LICENSE_TOKEN=$license_token | |
2865 | RC_HOSTNAME=$(sed_safe_path $base_domain) |
|
2865 | RC_HOSTNAME=$(sed_safe_path $base_domain) | |
2866 | RC_APP_BASE_URL=$(sed_safe_path $app_base_url) |
|
2866 | RC_APP_BASE_URL=$(sed_safe_path $app_base_url) | |
2867 | RC_SQLALCHEMY_DB1_URL=$(sed_safe_path $rc_db1) |
|
2867 | RC_SQLALCHEMY_DB1_URL=$(sed_safe_path $rc_db1) | |
2868 | RC_CHANNELSTREAM_WS_URL=$(sed_safe_path $rc_channelstream_url) |
|
2868 | RC_CHANNELSTREAM_WS_URL=$(sed_safe_path $rc_channelstream_url) | |
2869 | config_rhodecode_ini |
|
2869 | config_rhodecode_ini | |
2870 |
|
2870 | |||
2871 | touch $BOOTSTRAP_RUNTIME_ENV |
|
2871 | touch $BOOTSTRAP_RUNTIME_ENV | |
2872 |
|
2872 | |||
2873 | } |
|
2873 | } | |
2874 |
|
2874 | |||
2875 | bootstrap_definitions() { |
|
2875 | bootstrap_definitions() { | |
2876 |
|
2876 | |||
2877 | # This is needed for bootstrap_definitions |
|
2877 | # This is needed for bootstrap_definitions | |
2878 | AUTH_TOKEN=${args[--auth-token]} |
|
2878 | AUTH_TOKEN=${args[--auth-token]} | |
2879 | SERVER_URL=${args[--server-url]} |
|
2879 | SERVER_URL=${args[--server-url]} | |
2880 |
|
2880 | |||
2881 | DEFINITIONS_EXIST="" |
|
2881 | DEFINITIONS_EXIST="" | |
2882 | CHECK_FILES="\ |
|
2882 | CHECK_FILES="\ | |
2883 | docker-compose-services.yaml \ |
|
2883 | docker-compose-services.yaml \ | |
2884 | docker-compose-apps.yaml \ |
|
2884 | docker-compose-apps.yaml \ | |
2885 | docker-compose-metrics.yaml \ |
|
2885 | docker-compose-metrics.yaml \ | |
2886 | docker-compose-router.yaml \ |
|
2886 | docker-compose-router.yaml \ | |
2887 | " |
|
2887 | " | |
2888 | for check_file in $CHECK_FILES; do |
|
2888 | for check_file in $CHECK_FILES; do | |
2889 | if [[ -f "$check_file" ]]; then |
|
2889 | if [[ -f "$check_file" ]]; then | |
2890 | DEFINITIONS_EXIST="1" |
|
2890 | DEFINITIONS_EXIST="1" | |
2891 | fi |
|
2891 | fi | |
2892 | done |
|
2892 | done | |
2893 |
|
2893 | |||
2894 | # break if we didn't use force and definitions exist |
|
2894 | # break if we didn't use force and definitions exist | |
2895 | if [[ -n $DEFINITIONS_EXIST && ! $force ]]; then |
|
2895 | if [[ -n $DEFINITIONS_EXIST && ! $force ]]; then | |
2896 | echo "$(yellow bootstrap_definitions: skipping docker defs creation, existing files found. Use --force to create them anyway)" |
|
2896 | echo "$(yellow bootstrap_definitions: skipping docker defs creation, existing files found. Use --force to create them anyway)" | |
2897 | return |
|
2897 | return | |
2898 | fi |
|
2898 | fi | |
2899 |
|
2899 | |||
2900 | if [[ -n $DEFINITIONS_EXIST ]]; then |
|
2900 | if [[ -n $DEFINITIONS_EXIST ]]; then | |
2901 | echo "$(yellow docker definitions exists, are you sure to force re-create them?)" |
|
2901 | echo "$(yellow docker definitions exists, are you sure to force re-create them?)" | |
2902 | while true; do |
|
2902 | while true; do | |
2903 | read -p "Would you like to continue with overriding files? [yn] " yn |
|
2903 | read -p "Would you like to continue with overriding files? [yn] " yn | |
2904 | case $yn in |
|
2904 | case $yn in | |
2905 | [Yy]*) break ;; |
|
2905 | [Yy]*) break ;; | |
2906 | [Nn]*) exit ;; |
|
2906 | [Nn]*) exit ;; | |
2907 | *) echo "Please answer y or n." ;; |
|
2907 | *) echo "Please answer y or n." ;; | |
2908 | esac |
|
2908 | esac | |
2909 | done |
|
2909 | done | |
2910 | fi |
|
2910 | fi | |
2911 |
|
2911 | |||
2912 | FULL_MODE=1 |
|
2912 | FULL_MODE=1 | |
2913 | # This expects the $AUTH_TOKEN and $SERVER_URL be present |
|
2913 | # This expects the $AUTH_TOKEN and $SERVER_URL be present | |
2914 | get_docker_definitions $docker_revision $FULL_MODE $DEBUG |
|
2914 | get_docker_definitions $docker_revision $FULL_MODE $DEBUG | |
2915 |
|
2915 | |||
2916 | } |
|
2916 | } | |
2917 |
|
2917 | |||
2918 | bootstrap_overrides() { |
|
2918 | bootstrap_overrides() { | |
2919 | templates=$YAML_TEMPLATES |
|
2919 | templates=$YAML_TEMPLATES | |
2920 |
|
2920 | |||
2921 | target_dir=$PWD/.custom |
|
2921 | target_dir=$PWD/.custom | |
2922 |
|
2922 | |||
2923 | for o_file in $templates; do |
|
2923 | for o_file in $templates; do | |
2924 | target_file=$target_dir/$o_file |
|
2924 | target_file=$target_dir/$o_file | |
2925 | if [[ ! -f "$target_file" ]]; then |
|
2925 | if [[ ! -f "$target_file" ]]; then | |
2926 | echo "copy override file $o_file" |
|
2926 | echo "copy override file $o_file" | |
2927 | cp -v $PWD/templates/$o_file $target_file |
|
2927 | cp -v $PWD/templates/$o_file $target_file | |
2928 | else |
|
2928 | else | |
2929 | echo "file $target_file existing, skipping..." |
|
2929 | echo "file $target_file existing, skipping..." | |
2930 | fi |
|
2930 | fi | |
2931 | done |
|
2931 | done | |
2932 | mkdir -p $target_dir/traefik_custom |
|
2932 | mkdir -p $target_dir/traefik_custom | |
2933 | cp -r $PWD/config/traefik/* $target_dir/traefik_custom/ |
|
2933 | cp -r $PWD/config/traefik/* $target_dir/traefik_custom/ | |
2934 |
|
2934 | |||
2935 | echo "$(green bootstrap_overrides: overrides extracted to $target_dir)" |
|
2935 | echo "$(green bootstrap_overrides: overrides extracted to $target_dir)" | |
2936 |
|
2936 | |||
2937 | # save our loki auth using md5 encryption so the auth works OOTB |
|
2937 | # save our loki auth using md5 encryption so the auth works OOTB | |
2938 | echo "loki-auth:$shared_key_md5" >> $target_dir/traefik_custom/dynamic/.htpasswd |
|
2938 | echo "loki-auth:$shared_key_md5" >> $target_dir/traefik_custom/dynamic/.htpasswd | |
2939 |
|
2939 | |||
2940 | # change our templates and adjust using enable SSH |
|
2940 | # change our templates and adjust using enable SSH | |
2941 | if [[ $arg_use_ssl == "y" ]]; then |
|
2941 | if [[ $arg_use_ssl == "y" ]]; then | |
2942 | echo "enabling SSL on .override.yaml templates" |
|
2942 | echo "enabling SSL on .override.yaml templates" | |
2943 |
|
2943 | |||
2944 | metrics_replace() { |
|
2944 | metrics_replace() { | |
2945 | metrics_tmpl=$target_dir/docker-compose-metrics.override.yaml |
|
2945 | metrics_tmpl=$target_dir/docker-compose-metrics.override.yaml | |
2946 | sed_func "$1" "$2" "$metrics_tmpl" |
|
2946 | sed_func "$1" "$2" "$metrics_tmpl" | |
2947 | } |
|
2947 | } | |
2948 |
|
2948 | |||
2949 | metrics_replace '# # Enable http\+https' ' # Enable http\+https' |
|
2949 | metrics_replace '# # Enable http\+https' ' # Enable http\+https' | |
2950 | metrics_replace '# - "traefik.http.routers.grafana.entrypoints=http,https"' ' - "traefik.http.routers.grafana.entrypoints=http,https"' |
|
2950 | metrics_replace '# - "traefik.http.routers.grafana.entrypoints=http,https"' ' - "traefik.http.routers.grafana.entrypoints=http,https"' | |
2951 |
|
2951 | |||
2952 | services_replace() { |
|
2952 | services_replace() { | |
2953 | services_tmpl=$target_dir/docker-compose-services.override.yaml |
|
2953 | services_tmpl=$target_dir/docker-compose-services.override.yaml | |
2954 | sed_func "$1" "$2" "$services_tmpl" |
|
2954 | sed_func "$1" "$2" "$services_tmpl" | |
2955 | } |
|
2955 | } | |
2956 |
|
2956 | |||
2957 | services_replace '# # Enable http\+https' ' # Enable http\+https' |
|
2957 | services_replace '# # Enable http\+https' ' # Enable http\+https' | |
2958 | services_replace '# - "traefik.http.routers.channelstream.entrypoints=http,https"' ' - "traefik.http.routers.channelstream.entrypoints=http,https"' |
|
2958 | services_replace '# - "traefik.http.routers.channelstream.entrypoints=http,https"' ' - "traefik.http.routers.channelstream.entrypoints=http,https"' | |
2959 | services_replace '# - "traefik.http.routers.nginx-statics.entrypoints=http,https"' ' - "traefik.http.routers.nginx-statics.entrypoints=http,https"' |
|
2959 | services_replace '# - "traefik.http.routers.nginx-statics.entrypoints=http,https"' ' - "traefik.http.routers.nginx-statics.entrypoints=http,https"' | |
2960 |
|
2960 | |||
2961 | apps_replace() { |
|
2961 | apps_replace() { | |
2962 | apps_tmpl=$target_dir/docker-compose-apps.override.yaml |
|
2962 | apps_tmpl=$target_dir/docker-compose-apps.override.yaml | |
2963 | sed_func "$1" "$2" "$apps_tmpl" |
|
2963 | sed_func "$1" "$2" "$apps_tmpl" | |
2964 | } |
|
2964 | } | |
2965 |
|
2965 | |||
2966 | apps_replace '# # Enable http\+https' ' # Enable http\+https' |
|
2966 | apps_replace '# # Enable http\+https' ' # Enable http\+https' | |
2967 | apps_replace '# - "traefik.http.routers.rhodecode.entrypoints=http,https"' ' - "traefik.http.routers.rhodecode.entrypoints=http,https"' |
|
2967 | apps_replace '# - "traefik.http.routers.rhodecode.entrypoints=http,https"' ' - "traefik.http.routers.rhodecode.entrypoints=http,https"' | |
2968 |
|
2968 | |||
2969 | fi |
|
2969 | fi | |
2970 | } |
|
2970 | } | |
2971 |
|
2971 | |||
2972 | cur_date=$(date '+%Y-%m-%d %H:%M:%S') |
|
2972 | cur_date=$(date '+%Y-%m-%d %H:%M:%S') | |
2973 |
|
2973 | |||
2974 | # Init the config ! |
|
2974 | # Init the config ! | |
2975 | if [[ ! -f "$CONFIG_FILE" ]]; then |
|
2975 | if [[ ! -f "$CONFIG_FILE" ]]; then | |
2976 | echo "config: init new config at: $CONFIG_FILE" |
|
2976 | echo "config: init new config at: $CONFIG_FILE" | |
2977 | config_init |
|
2977 | config_init | |
2978 | else |
|
2978 | else | |
2979 | echo "config: re-using present config at: $CONFIG_FILE" |
|
2979 | echo "config: re-using present config at: $CONFIG_FILE" | |
2980 | fi |
|
2980 | fi | |
2981 |
|
2981 | |||
2982 | run_stages=$BOOTSTRAP_STAGES |
|
2982 | run_stages=$BOOTSTRAP_STAGES | |
2983 |
|
2983 | |||
2984 | if [ ! ${#stages_from_cli[@]} -eq 0 ]; then |
|
2984 | if [ ! ${#stages_from_cli[@]} -eq 0 ]; then | |
2985 | echo "Using custom stages to run init command..." |
|
2985 | echo "Using custom stages to run init command..." | |
2986 | run_stages=${stages_from_cli[@]} |
|
2986 | run_stages=${stages_from_cli[@]} | |
2987 | fi |
|
2987 | fi | |
2988 |
|
2988 | |||
2989 | for stage_name in $run_stages; do |
|
2989 | for stage_name in $run_stages; do | |
2990 |
|
2990 | |||
2991 | stage_func=$(get_stage_function $stage_name) |
|
2991 | stage_func=$(get_stage_function $stage_name) | |
2992 |
|
2992 | |||
2993 | if ! config_has_key $stage_name ; then |
|
2993 | if ! config_has_key $stage_name ; then | |
2994 | echo "$(green \* bootstrap: \'$stage_name\' stage not found\; running now... )" |
|
2994 | echo "$(green \* bootstrap: \'$stage_name\' stage not found\; running now... )" | |
2995 | $stage_func |
|
2995 | $stage_func | |
2996 | config_set "$stage_name" $cur_date |
|
2996 | config_set "$stage_name" $cur_date | |
2997 | else |
|
2997 | else | |
2998 | if [ $force ]; then |
|
2998 | if [ $force ]; then | |
2999 | echo "$(green \* bootstrap: \'$stage_name\' is present!\; FORCE running now... )" |
|
2999 | echo "$(green \* bootstrap: \'$stage_name\' is present!\; FORCE running now... )" | |
3000 | $stage_func $force |
|
3000 | $stage_func $force | |
3001 | config_set "$stage_name" $cur_date |
|
3001 | config_set "$stage_name" $cur_date | |
3002 | else |
|
3002 | else | |
3003 | echo "$(yellow \* bootstrap: \'$stage_name\' stage already present, use --force to run it again)" |
|
3003 | echo "$(yellow \* bootstrap: \'$stage_name\' stage already present, use --force to run it again)" | |
3004 | fi |
|
3004 | fi | |
3005 | fi |
|
3005 | fi | |
3006 |
|
3006 | |||
3007 | done |
|
3007 | done | |
3008 |
|
3008 | |||
3009 | echo "" |
|
3009 | echo "" | |
3010 | echo "~~~~ $(green Bootstrap completed) ~~~~" |
|
3010 | echo "~~~~ $(green Bootstrap completed) ~~~~" | |
3011 |
|
3011 | |||
3012 | get_started |
|
3012 | get_started | |
3013 |
|
3013 | |||
3014 | } |
|
3014 | } | |
3015 |
|
3015 | |||
3016 | # :command.function |
|
3016 | # :command.function | |
3017 | rcstack_self_update_command() { |
|
3017 | rcstack_self_update_command() { | |
3018 | # src/self_update_command.sh |
|
3018 | # src/self_update_command.sh | |
3019 | check_bootstrap |
|
3019 | check_bootstrap | |
3020 |
|
3020 | |||
3021 | DEBUG=${args[--debug]} |
|
3021 | DEBUG=${args[--debug]} | |
3022 | FORCE=${args[--force]} |
|
3022 | FORCE=${args[--force]} | |
3023 |
|
3023 | |||
3024 | # This is needed for bootstrap_definitions |
|
3024 | # This is needed for bootstrap_definitions | |
3025 | AUTH_TOKEN=${args[--auth-token]} |
|
3025 | AUTH_TOKEN=${args[--auth-token]} | |
3026 | SERVER_URL=${args[--server-url]} |
|
3026 | SERVER_URL=${args[--server-url]} | |
3027 |
|
3027 | |||
3028 | update_docker_image=${args[--update-docker-image]} |
|
3028 | update_docker_image=${args[--update-docker-image]} | |
3029 |
|
3029 | |||
3030 | cli_revision=${args[--cli-revision]} |
|
3030 | cli_revision=${args[--cli-revision]} | |
3031 | docker_revision=${args[--docker-revision]} |
|
3031 | docker_revision=${args[--docker-revision]} | |
3032 |
|
3032 | |||
3033 | FETCH_FROM=https://dls.rhodecode.com/get/$cli_revision |
|
3033 | FETCH_FROM=https://dls.rhodecode.com/get/$cli_revision | |
3034 |
|
3034 | |||
3035 | FINAL_TARGET=$PWD/scripts/rcstack/rcstack |
|
3035 | FINAL_TARGET=$PWD/scripts/rcstack/rcstack | |
3036 |
|
3036 | |||
3037 | DL_TARGET=$PWD/scripts/rcstack/rcstack.tmp |
|
3037 | DL_TARGET=$PWD/scripts/rcstack/rcstack.tmp | |
3038 |
|
3038 | |||
3039 | #ensure we have this dir ! |
|
3039 | #ensure we have this dir ! | |
3040 | mkdir -p $PWD/scripts/rcstack |
|
3040 | mkdir -p $PWD/scripts/rcstack | |
3041 |
|
3041 | |||
3042 | .env --file $RUNTIME_ENV |
|
3042 | .env --file $RUNTIME_ENV | |
3043 | .env get_or_error RC_VERSION |
|
3043 | .env get_or_error RC_VERSION | |
3044 |
|
3044 | |||
3045 | ENV_VER=$REPLY |
|
3045 | ENV_VER=$REPLY | |
3046 |
|
3046 | |||
3047 | echo "self-update: downloading new $RC_SCRIPT_NAME script from $FETCH_FROM" |
|
3047 | echo "self-update: downloading new $RC_SCRIPT_NAME script from $FETCH_FROM" | |
3048 |
|
3048 | |||
3049 | if [[ $FORCE ]]; then |
|
3049 | if [[ $FORCE ]]; then | |
3050 | echo "$(yellow self-update: --force used, doing forced update)" |
|
3050 | echo "$(yellow self-update: --force used, doing forced update)" | |
3051 | fi |
|
3051 | fi | |
3052 |
|
3052 | |||
3053 | if [[ $DEBUG ]]; then |
|
3053 | if [[ $DEBUG ]]; then | |
3054 | echo "running: curl -L -ss --fail -o $DL_TARGET $FETCH_FROM" |
|
3054 | echo "running: curl -L -ss --fail -o $DL_TARGET $FETCH_FROM" | |
3055 | fi |
|
3055 | fi | |
3056 |
|
3056 | |||
3057 | curl -L -ss --fail -o $DL_TARGET $FETCH_FROM |
|
3057 | curl -L -ss --fail -o $DL_TARGET $FETCH_FROM | |
3058 |
|
3058 | |||
3059 | chmod +x $DL_TARGET |
|
3059 | chmod +x $DL_TARGET | |
3060 |
|
3060 | |||
3061 | version_old=0 |
|
3061 | version_old=0 | |
3062 | rc_version_old=0 |
|
3062 | rc_version_old=0 | |
3063 |
|
3063 | |||
3064 | # check if we have OLD file, in case we don't just set versions to 0 |
|
3064 | # check if we have OLD file, in case we don't just set versions to 0 | |
3065 | if [[ -f "$FINAL_TARGET" ]]; then |
|
3065 | if [[ -f "$FINAL_TARGET" ]]; then | |
3066 | version_old=$($FINAL_TARGET --version) |
|
3066 | version_old=$($FINAL_TARGET --version) | |
3067 | rc_version_old=$($FINAL_TARGET cli image-info) |
|
3067 | rc_version_old=$($FINAL_TARGET cli image-info) | |
3068 | fi |
|
3068 | fi | |
3069 |
|
3069 | |||
3070 | version_dl=$($DL_TARGET --version) |
|
3070 | version_dl=$($DL_TARGET --version) | |
3071 | rc_version_dl=$($DL_TARGET cli image-info) |
|
3071 | rc_version_dl=$($DL_TARGET cli image-info) | |
3072 |
|
3072 | |||
3073 | echo "self-update: $RC_SCRIPT_NAME version downloaded: $version_dl" |
|
3073 | echo "self-update: $RC_SCRIPT_NAME version downloaded: $version_dl" | |
3074 |
|
3074 | |||
3075 | if [[ $DEBUG ]]; then |
|
3075 | if [[ $DEBUG ]]; then | |
3076 | echo "DEBUG: old-script ver: $version_old" |
|
3076 | echo "DEBUG: old-script ver: $version_old" | |
3077 | echo "DEBUG: new-script ver: $version_dl" |
|
3077 | echo "DEBUG: new-script ver: $version_dl" | |
3078 | echo "DEBUG: " |
|
3078 | echo "DEBUG: " | |
3079 | echo "DEBUG: .runtime.env set version $ENV_VER" |
|
3079 | echo "DEBUG: .runtime.env set version $ENV_VER" | |
3080 | echo "DEBUG: " |
|
3080 | echo "DEBUG: " | |
3081 | echo "DEBUG: old-script: RC VERSION: $rc_version_old" |
|
3081 | echo "DEBUG: old-script: RC VERSION: $rc_version_old" | |
3082 | echo "DEBUG: new-script: RC VERSION: $rc_version_dl" |
|
3082 | echo "DEBUG: new-script: RC VERSION: $rc_version_dl" | |
3083 | fi |
|
3083 | fi | |
3084 |
|
3084 | |||
3085 | if [[ $version_old == "$version_dl" ]]; then |
|
3085 | if [[ $version_old == "$version_dl" ]]; then | |
3086 |
|
3086 | |||
3087 | if [[ $FORCE ]]; then |
|
3087 | if [[ $FORCE ]]; then | |
3088 | echo "$(yellow self-update: downloaded version is the same as current version $version_dl, continue with --force...)" |
|
3088 | echo "$(yellow self-update: downloaded version is the same as current version $version_dl, continue with --force...)" | |
3089 | else |
|
3089 | else | |
3090 | echo "self-update: downloaded version is the same as current version $version_dl, exiting..." |
|
3090 | echo "self-update: downloaded version is the same as current version $version_dl, exiting..." | |
3091 | exit |
|
3091 | exit | |
3092 | fi |
|
3092 | fi | |
3093 |
|
3093 | |||
3094 | fi |
|
3094 | fi | |
3095 |
|
3095 | |||
3096 | docker_image_update() { |
|
3096 | docker_image_update() { | |
3097 |
|
3097 | |||
3098 | echo "$(green self-update: saving new RC_VERSION=$rc_version_dl to runtime.env file)" |
|
3098 | echo "$(green self-update: saving new RC_VERSION=$rc_version_dl to runtime.env file)" | |
3099 | echo "currently .runtime.env file uses image: $ENV_VER" |
|
3099 | echo "currently .runtime.env file uses image: $ENV_VER" | |
3100 |
|
3100 | |||
3101 | if [[ $update_docker_image == "y" ]]; then |
|
3101 | if [[ $update_docker_image == "y" ]]; then | |
3102 | echo "continuing with automated forced installer version saved into .runtime.env" |
|
3102 | echo "continuing with automated forced installer version saved into .runtime.env" | |
3103 | .env set RC_VERSION=$rc_version_dl |
|
3103 | .env set RC_VERSION=$rc_version_dl | |
3104 | else |
|
3104 | else | |
3105 | while true; do |
|
3105 | while true; do | |
3106 | read -p "self-update: Would you like to continue with setting RC_VERSION=$rc_version_dl into .runtime.env file? [yn] " yn |
|
3106 | read -p "self-update: Would you like to continue with setting RC_VERSION=$rc_version_dl into .runtime.env file? [yn] " yn | |
3107 | case $yn in |
|
3107 | case $yn in | |
3108 | [Yy]*) |
|
3108 | [Yy]*) | |
3109 | .env set RC_VERSION=$rc_version_dl |
|
3109 | .env set RC_VERSION=$rc_version_dl | |
3110 | echo "self-update: new version set into config" |
|
3110 | echo "self-update: new version set into config" | |
3111 | break ;; |
|
3111 | break ;; | |
3112 | [Nn]*) |
|
3112 | [Nn]*) | |
3113 | break ;; |
|
3113 | break ;; | |
3114 | *) echo "Please answer y or n." ;; |
|
3114 | *) echo "Please answer y or n." ;; | |
3115 | esac |
|
3115 | esac | |
3116 | done |
|
3116 | done | |
3117 | fi |
|
3117 | fi | |
3118 | } |
|
3118 | } | |
3119 |
|
3119 | |||
3120 | if [[ $rc_version_old == "$rc_version_dl" ]]; then |
|
3120 | if [[ $rc_version_old == "$rc_version_dl" ]]; then | |
3121 | echo "self-update: docker image defined by RC_VERSION=$rc_version_dl seems to be up-to date" |
|
3121 | echo "self-update: docker image defined by RC_VERSION=$rc_version_dl seems to be up-to date" | |
3122 |
|
3122 | |||
3123 | if [[ $FORCE ]]; then |
|
3123 | if [[ $FORCE ]]; then | |
3124 | echo "$(yellow self-update: continue with --force...)" |
|
3124 | echo "$(yellow self-update: continue with --force...)" | |
3125 | docker_image_update |
|
3125 | docker_image_update | |
3126 | fi |
|
3126 | fi | |
3127 |
|
3127 | |||
3128 | else |
|
3128 | else | |
3129 | docker_image_update |
|
3129 | docker_image_update | |
3130 | fi |
|
3130 | fi | |
3131 |
|
3131 | |||
3132 | echo "self-update: updating cli $RC_SCRIPT_NAME script to new version: $version_dl" |
|
3132 | echo "self-update: updating cli $RC_SCRIPT_NAME script to new version: $version_dl" | |
3133 |
|
3133 | |||
3134 | if [[ -f "$FINAL_TARGET" ]]; then |
|
3134 | if [[ -f "$FINAL_TARGET" ]]; then | |
3135 | rm $FINAL_TARGET && mv -v $DL_TARGET $FINAL_TARGET |
|
3135 | rm $FINAL_TARGET && mv -v $DL_TARGET $FINAL_TARGET | |
3136 | else |
|
3136 | else | |
3137 | mv -v $DL_TARGET $FINAL_TARGET |
|
3137 | mv -v $DL_TARGET $FINAL_TARGET | |
3138 | fi |
|
3138 | fi | |
3139 |
|
3139 | |||
3140 | echo "$(green self-update: updating docker definitions to $docker_revision)" |
|
3140 | echo "$(green self-update: updating docker definitions to $docker_revision)" | |
3141 |
|
3141 | |||
3142 | FULL_MODE=1 |
|
3142 | FULL_MODE=1 | |
3143 | # This expects the $AUTH_TOKEN and $SERVER_URL be present |
|
3143 | # This expects the $AUTH_TOKEN and $SERVER_URL be present | |
3144 | get_docker_definitions $docker_revision $FULL_MODE $DEBUG |
|
3144 | get_docker_definitions $docker_revision $FULL_MODE $DEBUG | |
3145 |
|
3145 | |||
3146 | echo "$(green self-update: successfully update to $version_dl)" |
|
3146 | echo "$(green self-update: successfully update to $version_dl)" | |
3147 | exit |
|
3147 | exit | |
3148 | } |
|
3148 | } | |
3149 |
|
3149 | |||
3150 | # :command.function |
|
3150 | # :command.function | |
3151 | rcstack_stack_router_command() { |
|
3151 | rcstack_stack_router_command() { | |
3152 | # src/stack_router_command.sh |
|
3152 | # src/stack_router_command.sh | |
3153 | check_bootstrap |
|
3153 | check_bootstrap | |
3154 |
|
3154 | |||
3155 | DEBUG=${args[--debug]} |
|
3155 | DEBUG=${args[--debug]} | |
3156 | ENV_FILE=${args[--env-file-path]} |
|
3156 | ENV_FILE=${args[--env-file-path]} | |
3157 |
|
3157 | |||
3158 | if [[ ! -f $RC_STACK_ROUTER_EXT ]]; then |
|
3158 | if [[ ! -f $RC_STACK_ROUTER_EXT ]]; then | |
3159 | RC_STACK_ROUTER_EXT="" |
|
3159 | RC_STACK_ROUTER_EXT="" | |
3160 | else |
|
3160 | else | |
3161 | RC_STACK_ROUTER_EXT="-f $RC_STACK_ROUTER_EXT" |
|
3161 | RC_STACK_ROUTER_EXT="-f $RC_STACK_ROUTER_EXT" | |
3162 | fi |
|
3162 | fi | |
3163 |
|
3163 | |||
3164 | CMD_ROUTER="\ |
|
3164 | CMD_ROUTER="\ | |
3165 | RC_ENV_FILE=$ENV_FILE docker compose \ |
|
3165 | RC_ENV_FILE=$ENV_FILE docker compose \ | |
3166 | --env-file $ENV_FILE \ |
|
3166 | --env-file $ENV_FILE \ | |
3167 | $ENV_EXPAND \ |
|
3167 | $ENV_EXPAND \ | |
3168 | -p rc_cluster_router \ |
|
3168 | -p rc_cluster_router \ | |
3169 | -f docker-compose-base.yaml \ |
|
3169 | -f docker-compose-base.yaml \ | |
3170 | -f docker-compose-router.yaml $RC_STACK_ROUTER_EXT" |
|
3170 | -f docker-compose-router.yaml $RC_STACK_ROUTER_EXT" | |
3171 |
|
3171 | |||
3172 | if [[ $DEBUG ]]; then |
|
3172 | if [[ $DEBUG ]]; then | |
3173 | echo "---" |
|
3173 | echo "---" | |
3174 | echo "stacks docker: $RC_STACK_ROUTER_EXT_LCL" |
|
3174 | echo "stacks docker: $RC_STACK_ROUTER_EXT_LCL" | |
3175 | echo "running command: ${CMD_ROUTER}" |
|
3175 | echo "running command: ${CMD_ROUTER}" | |
3176 | echo "ARGS: ${other_args[*]}" |
|
3176 | echo "ARGS: ${other_args[*]}" | |
3177 | echo "---" |
|
3177 | echo "---" | |
3178 | fi |
|
3178 | fi | |
3179 | eval "${CMD_ROUTER} ${other_args[*]}" |
|
3179 | eval "${CMD_ROUTER} ${other_args[*]}" | |
3180 |
|
3180 | |||
3181 | } |
|
3181 | } | |
3182 |
|
3182 | |||
3183 | # :command.function |
|
3183 | # :command.function | |
3184 | rcstack_stack_metrics_command() { |
|
3184 | rcstack_stack_metrics_command() { | |
3185 | # src/stack_metrics_command.sh |
|
3185 | # src/stack_metrics_command.sh | |
3186 | check_bootstrap |
|
3186 | check_bootstrap | |
3187 |
|
3187 | |||
3188 | DEBUG=${args[--debug]} |
|
3188 | DEBUG=${args[--debug]} | |
3189 | ENV_FILE=${args[--env-file-path]} |
|
3189 | ENV_FILE=${args[--env-file-path]} | |
3190 |
|
3190 | |||
3191 | if [[ ! -f $RC_STACK_METRICS_EXT ]]; then |
|
3191 | if [[ ! -f $RC_STACK_METRICS_EXT ]]; then | |
3192 | RC_STACK_METRICS_EXT_LCL="" |
|
3192 | RC_STACK_METRICS_EXT_LCL="" | |
3193 | else |
|
3193 | else | |
3194 | RC_STACK_METRICS_EXT_LCL="-f $RC_STACK_METRICS_EXT" |
|
3194 | RC_STACK_METRICS_EXT_LCL="-f $RC_STACK_METRICS_EXT" | |
3195 | fi |
|
3195 | fi | |
3196 |
|
3196 | |||
3197 | CMD_METRICS="\ |
|
3197 | CMD_METRICS="\ | |
3198 | RC_ENV_FILE=$ENV_FILE docker compose \ |
|
3198 | RC_ENV_FILE=$ENV_FILE docker compose \ | |
3199 | --env-file $ENV_FILE \ |
|
3199 | --env-file $ENV_FILE \ | |
3200 | $ENV_EXPAND \ |
|
3200 | $ENV_EXPAND \ | |
3201 | -p rc_cluster_metrics \ |
|
3201 | -p rc_cluster_metrics \ | |
3202 | -f docker-compose-base.yaml \ |
|
3202 | -f docker-compose-base.yaml \ | |
3203 | -f docker-compose-metrics.yaml $RC_STACK_METRICS_EXT_LCL" |
|
3203 | -f docker-compose-metrics.yaml $RC_STACK_METRICS_EXT_LCL" | |
3204 |
|
3204 | |||
3205 | if [[ $DEBUG ]]; then |
|
3205 | if [[ $DEBUG ]]; then | |
3206 | echo "---" |
|
3206 | echo "---" | |
3207 | echo "stacks docker: $RC_STACK_METRICS_EXT_LCL" |
|
3207 | echo "stacks docker: $RC_STACK_METRICS_EXT_LCL" | |
3208 | echo "running command: ${CMD_METRICS}" |
|
3208 | echo "running command: ${CMD_METRICS}" | |
3209 | echo "ARGS: ${other_args[*]}" |
|
3209 | echo "ARGS: ${other_args[*]}" | |
3210 | echo "---" |
|
3210 | echo "---" | |
3211 | fi |
|
3211 | fi | |
3212 | eval "${CMD_METRICS} ${other_args[*]}" |
|
3212 | eval "${CMD_METRICS} ${other_args[*]}" | |
3213 | } |
|
3213 | } | |
3214 |
|
3214 | |||
3215 | # :command.function |
|
3215 | # :command.function | |
3216 | rcstack_stack_services_command() { |
|
3216 | rcstack_stack_services_command() { | |
3217 | # src/stack_services_command.sh |
|
3217 | # src/stack_services_command.sh | |
3218 | check_bootstrap |
|
3218 | check_bootstrap | |
3219 |
|
3219 | |||
3220 | DEBUG=${args[--debug]} |
|
3220 | DEBUG=${args[--debug]} | |
3221 | ENV_FILE=${args[--env-file-path]} |
|
3221 | ENV_FILE=${args[--env-file-path]} | |
3222 |
|
3222 | |||
3223 | if [[ ! -f $RC_STACK_SERVICES_EXT ]]; then |
|
3223 | if [[ ! -f $RC_STACK_SERVICES_EXT ]]; then | |
3224 | RC_STACK_SERVICES_EXT_LCL="" |
|
3224 | RC_STACK_SERVICES_EXT_LCL="" | |
3225 | else |
|
3225 | else | |
3226 | RC_STACK_SERVICES_EXT_LCL="-f $RC_STACK_SERVICES_EXT" |
|
3226 | RC_STACK_SERVICES_EXT_LCL="-f $RC_STACK_SERVICES_EXT" | |
3227 | fi |
|
3227 | fi | |
3228 |
|
3228 | |||
3229 | RC_STACK_PROFILES="--profile database --profile redis --profile elasticsearch --profile channelstream" |
|
3229 | RC_STACK_PROFILES="--profile database --profile redis --profile elasticsearch --profile channelstream" | |
3230 |
|
3230 | |||
3231 | CMD_SERVICES="\ |
|
3231 | CMD_SERVICES="\ | |
3232 | RC_ENV_FILE=$ENV_FILE docker compose \ |
|
3232 | RC_ENV_FILE=$ENV_FILE docker compose \ | |
3233 | --env-file $ENV_FILE \ |
|
3233 | --env-file $ENV_FILE \ | |
3234 | $ENV_EXPAND \ |
|
3234 | $ENV_EXPAND \ | |
3235 | $RC_STACK_PROFILES \ |
|
3235 | $RC_STACK_PROFILES \ | |
3236 | -p rc_cluster_services \ |
|
3236 | -p rc_cluster_services \ | |
3237 | -f docker-compose-base.yaml \ |
|
3237 | -f docker-compose-base.yaml \ | |
3238 | -f docker-compose-services.yaml $RC_STACK_SERVICES_EXT_LCL" |
|
3238 | -f docker-compose-services.yaml $RC_STACK_SERVICES_EXT_LCL" | |
3239 |
|
3239 | |||
3240 | if [[ $DEBUG ]]; then |
|
3240 | if [[ $DEBUG ]]; then | |
3241 | echo "---" |
|
3241 | echo "---" | |
3242 | echo "stacks docker: $RC_STACK_SERVICES_EXT_LCL" |
|
3242 | echo "stacks docker: $RC_STACK_SERVICES_EXT_LCL" | |
3243 | echo "running command: ${CMD_SERVICES}" |
|
3243 | echo "running command: ${CMD_SERVICES}" | |
3244 | echo "ARGS: ${other_args[*]}" |
|
3244 | echo "ARGS: ${other_args[*]}" | |
3245 | echo "---" |
|
3245 | echo "---" | |
3246 | fi |
|
3246 | fi | |
3247 |
|
3247 | |||
3248 | eval "${CMD_SERVICES} ${other_args[*]}" |
|
3248 | eval "${CMD_SERVICES} ${other_args[*]}" | |
3249 | } |
|
3249 | } | |
3250 |
|
3250 | |||
3251 | # :command.function |
|
3251 | # :command.function | |
3252 | rcstack_stack_rhodecode_command() { |
|
3252 | rcstack_stack_rhodecode_command() { | |
3253 | # src/stack_rhodecode_command.sh |
|
3253 | # src/stack_rhodecode_command.sh | |
3254 | check_bootstrap |
|
3254 | check_bootstrap | |
3255 |
|
3255 | |||
3256 | DEBUG=${args[--debug]} |
|
3256 | DEBUG=${args[--debug]} | |
3257 | ENV_FILE=${args[--env-file-path]} |
|
3257 | ENV_FILE=${args[--env-file-path]} | |
3258 |
|
3258 | |||
3259 | stack_prefix=${args[--stack-prefix]} |
|
3259 | stack_prefix=${args[--stack-prefix]} | |
3260 | if [[ $stack_prefix == "" ]]; then |
|
3260 | if [[ $stack_prefix == "" ]]; then | |
3261 | stack_prefix="rc_cluster_apps" |
|
3261 | stack_prefix="rc_cluster_apps" | |
3262 | fi |
|
3262 | fi | |
3263 |
|
3263 | |||
3264 | if [[ ! -f $RC_STACK_RHODECODE_EXT ]]; then |
|
3264 | if [[ ! -f $RC_STACK_RHODECODE_EXT ]]; then | |
3265 | RC_STACK_RHODECODE_EXT_LCL="" |
|
3265 | RC_STACK_RHODECODE_EXT_LCL="" | |
3266 | else |
|
3266 | else | |
3267 | RC_STACK_RHODECODE_EXT_LCL="-f $RC_STACK_RHODECODE_EXT" |
|
3267 | RC_STACK_RHODECODE_EXT_LCL="-f $RC_STACK_RHODECODE_EXT" | |
3268 | fi |
|
3268 | fi | |
3269 |
|
3269 | |||
3270 | CMD_RHODECODE="\ |
|
3270 | CMD_RHODECODE="\ | |
3271 | RC_ENV_FILE=$ENV_FILE docker compose \ |
|
3271 | RC_ENV_FILE=$ENV_FILE docker compose \ | |
3272 | --env-file $ENV_FILE \ |
|
3272 | --env-file $ENV_FILE \ | |
3273 | $ENV_EXPAND \ |
|
3273 | $ENV_EXPAND \ | |
3274 | -p $stack_prefix \ |
|
3274 | -p $stack_prefix \ | |
3275 | -f docker-compose-base.yaml \ |
|
3275 | -f docker-compose-base.yaml \ | |
3276 | -f docker-compose-apps.yaml $RC_STACK_RHODECODE_EXT_LCL" |
|
3276 | -f docker-compose-apps.yaml $RC_STACK_RHODECODE_EXT_LCL" | |
3277 |
|
3277 | |||
3278 | sub_cmd=${other_args[0]} |
|
3278 | sub_cmd=${other_args[0]} | |
3279 |
|
3279 | |||
3280 | if [[ $sub_cmd == "up" ]]; then |
|
3280 | if [[ $sub_cmd == "up" ]]; then | |
3281 | declare -a final_args=( "$sub_cmd" "--no-color" "--no-build" "${other_args[@]:1}" ) |
|
3281 | declare -a final_args=( "$sub_cmd" "--no-color" "--no-build" "${other_args[@]:1}" ) | |
3282 | else |
|
3282 | else | |
3283 | declare -a final_args=( "$sub_cmd" "${other_args[@]:1}" ) |
|
3283 | declare -a final_args=( "$sub_cmd" "${other_args[@]:1}" ) | |
3284 | fi |
|
3284 | fi | |
3285 |
|
3285 | |||
3286 | if [[ $DEBUG ]]; then |
|
3286 | if [[ $DEBUG ]]; then | |
3287 | echo "---" |
|
3287 | echo "---" | |
3288 | echo "stacks docker: $RC_STACK_RHODECODE_EXT_LCL" |
|
3288 | echo "stacks docker: $RC_STACK_RHODECODE_EXT_LCL" | |
3289 | echo "running command: ${CMD_RHODECODE}" |
|
3289 | echo "running command: ${CMD_RHODECODE}" | |
3290 | echo "ARGS: ${final_args[*]}" |
|
3290 | echo "ARGS: ${final_args[*]}" | |
3291 | echo "---" |
|
3291 | echo "---" | |
3292 | fi |
|
3292 | fi | |
3293 | eval "${CMD_RHODECODE} ${final_args[*]}" |
|
3293 | eval "${CMD_RHODECODE} ${final_args[*]}" | |
3294 |
|
3294 | |||
3295 | } |
|
3295 | } | |
3296 |
|
3296 | |||
3297 | # :command.function |
|
3297 | # :command.function | |
3298 | rcstack_stack_all_command() { |
|
3298 | rcstack_stack_all_command() { | |
3299 | # src/stack_all_command.sh |
|
3299 | # src/stack_all_command.sh | |
3300 | check_bootstrap |
|
3300 | check_bootstrap | |
3301 |
|
3301 | |||
3302 | DEBUG=${args[--debug]} |
|
3302 | DEBUG=${args[--debug]} | |
3303 |
|
3303 | |||
3304 | stack_lst=$VALID_SERVICES |
|
3304 | stack_lst=$VALID_SERVICES | |
3305 |
|
3305 | |||
3306 | for stack in $stack_lst; do |
|
3306 | for stack in $stack_lst; do | |
3307 | ./$RC_SCRIPT_NAME stack $stack ${other_args[*]} |
|
3307 | ./$RC_SCRIPT_NAME stack $stack ${other_args[*]} | |
3308 | done |
|
3308 | done | |
3309 |
|
3309 | |||
3310 | } |
|
3310 | } | |
3311 |
|
3311 | |||
3312 | # :command.function |
|
3312 | # :command.function | |
3313 | rcstack_stack_status_command() { |
|
3313 | rcstack_stack_status_command() { | |
3314 | # src/stack_status_command.sh |
|
3314 | # src/stack_status_command.sh | |
3315 | check_bootstrap |
|
3315 | check_bootstrap | |
3316 | DEBUG=${args[--debug]} |
|
3316 | DEBUG=${args[--debug]} | |
3317 | DETAILED=${args[--detailed]} |
|
3317 | DETAILED=${args[--detailed]} | |
3318 | CONFIGS=${args[--configs]} |
|
3318 | CONFIGS=${args[--configs]} | |
3319 | VERBOSE=${args[-v]} |
|
3319 | VERBOSE=${args[-v]} | |
3320 |
|
3320 | |||
3321 | .env --file $RUNTIME_ENV |
|
3321 | .env --file $RUNTIME_ENV | |
3322 | .env get_or_error RC_APP_BASE_URL |
|
3322 | .env get_or_error RC_APP_BASE_URL | |
3323 | RC_APP_BASE_URL=$REPLY |
|
3323 | RC_APP_BASE_URL=$REPLY | |
3324 |
|
3324 | |||
3325 | .env get_or_error RC_VERSION |
|
3325 | .env get_or_error RC_VERSION | |
3326 | RC_VERSION=$REPLY |
|
3326 | RC_VERSION=$REPLY | |
3327 |
|
3327 | |||
3328 | .env get_or_error RC_SSH_PORT |
|
3328 | .env get_or_error RC_SSH_PORT | |
3329 | RC_SSH_PORT=$REPLY |
|
3329 | RC_SSH_PORT=$REPLY | |
3330 |
|
3330 | |||
3331 | .env get_or_error RC_EDITION |
|
3331 | .env get_or_error RC_EDITION | |
3332 | RC_EDITION=$REPLY |
|
3332 | RC_EDITION=$REPLY | |
3333 |
|
3333 | |||
3334 | .env get_or_error RC_LICENSE_TOKEN |
|
3334 | .env get_or_error RC_LICENSE_TOKEN | |
3335 | RC_LICENSE_TOKEN=$REPLY |
|
3335 | RC_LICENSE_TOKEN=$REPLY | |
3336 |
|
3336 | |||
3337 | if [[ $DEBUG ]]; then |
|
3337 | if [[ $DEBUG ]]; then | |
3338 | echo "---" |
|
3338 | echo "---" | |
3339 | ps_cmd=$(docker ps --filter=name=rc_cluster --format="{{.ID}}") |
|
3339 | ps_cmd=$(docker ps --filter=name=rc_cluster --format="{{.ID}}") | |
3340 |
|
3340 | |||
3341 | for service in $ps_cmd; do |
|
3341 | for service in $ps_cmd; do | |
3342 |
|
3342 | |||
3343 | servicename=`docker inspect --format '{{ .Name }}' $service` |
|
3343 | servicename=`docker inspect --format '{{ .Name }}' $service` | |
3344 | servicename=${servicename:1} |
|
3344 | servicename=${servicename:1} | |
3345 | echo $servicename |
|
3345 | echo $servicename | |
3346 | docker inspect $service --format='{{.State.Status}}: {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' |
|
3346 | docker inspect $service --format='{{.State.Status}}: {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' | |
3347 | echo "" |
|
3347 | echo "" | |
3348 |
|
3348 | |||
3349 | done |
|
3349 | done | |
3350 | echo "---" |
|
3350 | echo "---" | |
3351 | fi |
|
3351 | fi | |
3352 |
|
3352 | |||
3353 | echo "Running hostname: $RC_APP_BASE_URL" |
|
3353 | echo "Running hostname: $RC_APP_BASE_URL" | |
3354 | if [[ $VERBOSE ]]; then |
|
3354 | if [[ $VERBOSE ]]; then | |
3355 | printf "SSH Port: $RC_SSH_PORT\n" |
|
3355 | printf "SSH Port: $RC_SSH_PORT\n" | |
3356 | printf "Edition: $RC_EDITION:$RC_VERSION\n" |
|
3356 | printf "Edition: $RC_EDITION:$RC_VERSION\n" | |
3357 | printf "License: $RC_LICENSE_TOKEN\n" |
|
3357 | printf "License: $RC_LICENSE_TOKEN\n" | |
3358 | printf "\n" |
|
3358 | printf "\n" | |
3359 | fi |
|
3359 | fi | |
3360 |
|
3360 | |||
3361 | if [[ $CONFIGS ]]; then |
|
3361 | if [[ $CONFIGS ]]; then | |
3362 | printf "rcstack:\n" |
|
3362 | printf "rcstack:\n" | |
3363 | printf " config (in-host): $RUNTIME_ENV\n" |
|
3363 | printf " config (in-host): $RUNTIME_ENV\n" | |
3364 |
|
3364 | |||
3365 | printf "RhodeCode:\n" |
|
3365 | printf "RhodeCode:\n" | |
3366 | printf " ini (in-host): $rhodecode_default_config_path\n" |
|
3366 | printf " ini (in-host): $rhodecode_default_config_path\n" | |
3367 | printf " volumes (in-container):\n" |
|
3367 | printf " volumes (in-container):\n" | |
3368 | printf " repo-store: /var/opt/rhodecode_repo_store\n" |
|
3368 | printf " repo-store: /var/opt/rhodecode_repo_store\n" | |
3369 | printf " data-store: /var/opt/rhodecode_data\n" |
|
3369 | printf " data-store: /var/opt/rhodecode_data\n" | |
3370 |
|
3370 | |||
3371 | printf "VCSServer:\n" |
|
3371 | printf "VCSServer:\n" | |
3372 | printf " ini (in-host): $vcsserver_default_config_path\n" |
|
3372 | printf " ini (in-host): $vcsserver_default_config_path\n" | |
3373 | printf " volumes (in-container):\n" |
|
3373 | printf " volumes (in-container):\n" | |
3374 | printf " repo-store: /var/opt/rhodecode_repo_store\n" |
|
3374 | printf " repo-store: /var/opt/rhodecode_repo_store\n" | |
3375 | printf " data-store: /var/opt/rhodecode_data\n" |
|
3375 | printf " data-store: /var/opt/rhodecode_data\n" | |
3376 |
|
3376 | |||
3377 | printf "Traefik (router):\n" |
|
3377 | printf "Traefik (router):\n" | |
3378 | printf " ssl-certs definitions: .custom/traefik_custom/dynamic/traefik_dynamic_custom.yaml\n" |
|
3378 | printf " ssl-certs definitions: .custom/traefik_custom/dynamic/traefik_dynamic_custom.yaml\n" | |
3379 | printf " ssl-certs dir: .custom/traefik_custom/dynamic/certs/\n" |
|
3379 | printf " ssl-certs dir: .custom/traefik_custom/dynamic/certs/\n" | |
3380 |
|
3380 | |||
3381 | fi |
|
3381 | fi | |
3382 |
|
3382 | |||
3383 | if [[ $DETAILED ]]; then |
|
3383 | if [[ $DETAILED ]]; then | |
3384 | ps_cmd=$(docker ps --filter=name=rc_cluster --format="{{.ID}}") |
|
3384 | ps_cmd=$(docker ps --filter=name=rc_cluster --format="{{.ID}}") | |
3385 |
|
3385 | |||
3386 | for service in $ps_cmd; do |
|
3386 | for service in $ps_cmd; do | |
3387 | servicename=`docker inspect --format '{{ .Name }}' $service` |
|
3387 | servicename=`docker inspect --format '{{ .Name }}' $service` | |
3388 | servicename=${servicename:1} |
|
3388 | servicename=${servicename:1} | |
3389 | printf "CONTAINER:\\t$servicename\n" |
|
3389 | printf "CONTAINER:\\t$servicename\n" | |
3390 | printf "LOGS:\\t\\tdocker logs --tail=100 $service\n" |
|
3390 | printf "LOGS:\\t\\tdocker logs --tail=100 $service\n" | |
3391 | docker ps --filter=name=$servicename --format="ID:\\t\\t{{.ID}}\nIMAGE:\\t\\t{{.Image}}\nSTATUS:\\t\\t{{.Status}}\nPORTS:\\t\\t{{.Ports}}\n" |
|
3391 | docker ps --filter=name=$servicename --format="ID:\\t\\t{{.ID}}\nIMAGE:\\t\\t{{.Image}}\nSTATUS:\\t\\t{{.Status}}\nPORTS:\\t\\t{{.Ports}}\n" | |
3392 | echo "" |
|
3392 | echo "" | |
3393 | done |
|
3393 | done | |
3394 | else |
|
3394 | else | |
3395 | 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 ) |
|
3395 | 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 ) | |
3396 | fi |
|
3396 | fi | |
3397 |
|
3397 | |||
3398 | } |
|
3398 | } | |
3399 |
|
3399 | |||
3400 | # :command.function |
|
3400 | # :command.function | |
3401 | rcstack_stack_upgrade_router_command() { |
|
3401 | rcstack_stack_upgrade_router_command() { | |
3402 | # src/stack_upgrade_router_command.sh |
|
3402 | # src/stack_upgrade_router_command.sh | |
3403 | echo "Upgrading this stack with:" |
|
3403 | echo "Upgrading this stack with:" | |
3404 | echo "./$RC_SCRIPT_NAME stack router up --force-recreate --detach" |
|
3404 | echo "./$RC_SCRIPT_NAME stack router up --force-recreate --detach" | |
3405 | echo "" |
|
3405 | echo "" | |
3406 | echo "NOTE: To reclaim space occupied by old images, run:" |
|
3406 | echo "NOTE: To reclaim space occupied by old images, run:" | |
3407 | echo "docker image prune -f" |
|
3407 | echo "docker image prune -f" | |
3408 |
|
3408 | |||
3409 | ./$RC_SCRIPT_NAME stack router up --force-recreate --detach |
|
3409 | ./$RC_SCRIPT_NAME stack router up --force-recreate --detach | |
3410 |
|
3410 | |||
3411 | } |
|
3411 | } | |
3412 |
|
3412 | |||
3413 | # :command.function |
|
3413 | # :command.function | |
3414 | rcstack_stack_upgrade_services_command() { |
|
3414 | rcstack_stack_upgrade_services_command() { | |
3415 | # src/stack_upgrade_services_command.sh |
|
3415 | # src/stack_upgrade_services_command.sh | |
3416 | echo "Upgrading this stack with:" |
|
3416 | echo "Upgrading this stack with:" | |
3417 | echo "./$RC_SCRIPT_NAME stack services up --force-recreate --detach" |
|
3417 | echo "./$RC_SCRIPT_NAME stack services up --force-recreate --detach" | |
3418 | echo "" |
|
3418 | echo "" | |
3419 | echo "NOTE: To reclaim space occupied by old images, run:" |
|
3419 | echo "NOTE: To reclaim space occupied by old images, run:" | |
3420 | echo "docker image prune -f" |
|
3420 | echo "docker image prune -f" | |
3421 |
|
3421 | |||
3422 | ./$RC_SCRIPT_NAME stack services up --force-recreate --detach |
|
3422 | ./$RC_SCRIPT_NAME stack services up --force-recreate --detach | |
3423 |
|
3423 | |||
3424 | } |
|
3424 | } | |
3425 |
|
3425 | |||
3426 | # :command.function |
|
3426 | # :command.function | |
3427 | rcstack_stack_upgrade_metrics_command() { |
|
3427 | rcstack_stack_upgrade_metrics_command() { | |
3428 | # src/stack_upgrade_metrics_command.sh |
|
3428 | # src/stack_upgrade_metrics_command.sh | |
3429 | echo "To upgrading this stack with:" |
|
3429 | echo "To upgrading this stack with:" | |
3430 | echo "./$RC_SCRIPT_NAME stack metrics up --force-recreate --detach" |
|
3430 | echo "./$RC_SCRIPT_NAME stack metrics up --force-recreate --detach" | |
3431 | echo "" |
|
3431 | echo "" | |
3432 | echo "NOTE: To reclaim space occupied by old images, run:" |
|
3432 | echo "NOTE: To reclaim space occupied by old images, run:" | |
3433 | echo "docker image prune -f" |
|
3433 | echo "docker image prune -f" | |
3434 |
|
3434 | |||
3435 | ./$RC_SCRIPT_NAME stack metrics up --force-recreate --detach |
|
3435 | ./$RC_SCRIPT_NAME stack metrics up --force-recreate --detach | |
3436 |
|
3436 | |||
3437 | } |
|
3437 | } | |
3438 |
|
3438 | |||
3439 | # :command.function |
|
3439 | # :command.function | |
3440 | rcstack_stack_upgrade_rhodecode_command() { |
|
3440 | rcstack_stack_upgrade_rhodecode_command() { | |
3441 | # src/stack_upgrade_rhodecode_command.sh |
|
3441 | # src/stack_upgrade_rhodecode_command.sh | |
3442 | check_bootstrap |
|
3442 | check_bootstrap | |
3443 |
|
3443 | |||
3444 | stop_wait=${args[--stop-wait]} |
|
3444 | stop_wait=${args[--stop-wait]} | |
3445 | docker_stop_wait=${args[--docker-stop-wait]} |
|
3445 | docker_stop_wait=${args[--docker-stop-wait]} | |
3446 |
|
3446 | |||
3447 | stack_prefix=${args[--stack-prefix]} |
|
3447 | stack_prefix=${args[--stack-prefix]} | |
3448 | if [[ $stack_prefix == "" ]]; then |
|
3448 | if [[ $stack_prefix == "" ]]; then | |
3449 | stack_prefix="rc_cluster_apps" |
|
3449 | stack_prefix="rc_cluster_apps" | |
3450 | fi |
|
3450 | fi | |
3451 |
|
3451 | |||
3452 | # search docker IDs for current service |
|
3452 | # search docker IDs for current service | |
3453 | .env --file $RUNTIME_ENV |
|
3453 | .env --file $RUNTIME_ENV | |
3454 |
|
3454 | |||
3455 | .env get_or_error RC_VERSION |
|
3455 | .env get_or_error RC_VERSION | |
3456 | RC_VERSION=$REPLY |
|
3456 | RC_VERSION=$REPLY | |
3457 |
|
3457 | |||
3458 | .env get_or_error RC_EDITION |
|
3458 | .env get_or_error RC_EDITION | |
3459 | RC_EDITION=$REPLY |
|
3459 | RC_EDITION=$REPLY | |
3460 |
|
3460 | |||
3461 | echo "Pulling new image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION}" |
|
3461 | echo "Pulling new image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION}" | |
3462 | echo "WARNING: about to start downloading the RhodeCode base image" |
|
3462 | echo "WARNING: about to start downloading the RhodeCode base image" | |
3463 | echo "This process may take anywhere between a few minutes to an hour, depending on your network speed" |
|
3463 | echo "This process may take anywhere between a few minutes to an hour, depending on your network speed" | |
3464 | echo "running: docker pull -q rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION}" |
|
3464 | echo "running: docker pull -q rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION}" | |
3465 |
|
3465 | |||
3466 | eval "docker pull -q rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION}" |
|
3466 | eval "docker pull -q rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION}" | |
3467 |
|
3467 | |||
3468 | have_tty=1 |
|
3468 | have_tty=1 | |
3469 | # Set a dummy terminal type if none set |
|
3469 | # Set a dummy terminal type if none set | |
3470 | [[ -z "$TERM" ]] && export have_tty=0 |
|
3470 | [[ -z "$TERM" ]] && export have_tty=0 | |
3471 | [[ ! -t 1 ]] && export have_tty=0 |
|
3471 | [[ ! -t 1 ]] && export have_tty=0 | |
3472 |
|
3472 | |||
3473 | set_cursor() { |
|
3473 | set_cursor() { | |
3474 | if [[ $have_tty == 1 ]]; then |
|
3474 | if [[ $have_tty == 1 ]]; then | |
3475 | tput $1 |
|
3475 | tput $1 | |
3476 | fi |
|
3476 | fi | |
3477 | } |
|
3477 | } | |
3478 |
|
3478 | |||
3479 | stop_containers() { |
|
3479 | stop_containers() { | |
3480 | target_container=$1 |
|
3480 | target_container=$1 | |
3481 | docker_stop_wait=$2 |
|
3481 | docker_stop_wait=$2 | |
3482 | stop_wait=$3 |
|
3482 | stop_wait=$3 | |
3483 | target_containers_pat="$stack_prefix-$target_container-*" |
|
3483 | target_containers_pat="$stack_prefix-$target_container-*" | |
3484 |
|
3484 | |||
3485 | # array with OLD containers |
|
3485 | # array with OLD containers | |
3486 | local -a old_docker_ids |
|
3486 | local -a old_docker_ids | |
3487 | readarray -t old_docker_ids < <(docker ps --filter name="$target_containers_pat" -q) |
|
3487 | readarray -t old_docker_ids < <(docker ps --filter name="$target_containers_pat" -q) | |
3488 |
|
3488 | |||
3489 | scale=${#old_docker_ids[@]} |
|
3489 | scale=${#old_docker_ids[@]} | |
3490 | scale_2=$(( scale * 2 )) |
|
3490 | scale_2=$(( scale * 2 )) | |
3491 |
|
3491 | |||
3492 | echo "" |
|
3492 | echo "" | |
3493 | echo "Found $scale old container[s] for $target_container" |
|
3493 | echo "Found $scale old container[s] for $target_container" | |
3494 | echo "Old container-ids:" "${old_docker_ids[@]}" |
|
3494 | echo "Old container-ids:" "${old_docker_ids[@]}" | |
3495 | echo "" |
|
3495 | echo "" | |
3496 |
|
3496 | |||
3497 | if [[ $scale == "0" ]]; then |
|
3497 | if [[ $scale == "0" ]]; then | |
3498 | echo "No previous services found, doing a regular start for $target_container" |
|
3498 | echo "No previous services found, doing a regular start for $target_container" | |
3499 | ./$RC_SCRIPT_NAME stack rhodecode up $target_container --detach |
|
3499 | ./$RC_SCRIPT_NAME stack rhodecode up $target_container --detach | |
3500 | return |
|
3500 | return | |
3501 | else |
|
3501 | else | |
3502 | echo "Scaling to 2x ($scale_2 total) containers for $target_container" |
|
3502 | echo "Scaling to 2x ($scale_2 total) containers for $target_container" | |
3503 | ./$RC_SCRIPT_NAME stack rhodecode up $target_container --no-recreate --detach --scale $target_container=$scale_2 |
|
3503 | ./$RC_SCRIPT_NAME stack rhodecode up $target_container --no-recreate --detach --scale $target_container=$scale_2 | |
3504 | fi |
|
3504 | fi | |
3505 |
|
3505 | |||
3506 | # array with ALL new containers |
|
3506 | # array with ALL new containers | |
3507 | local -a scaled_docker_ids |
|
3507 | local -a scaled_docker_ids | |
3508 | readarray -t scaled_docker_ids < <(docker ps --filter name="$target_containers_pat" -q) |
|
3508 | readarray -t scaled_docker_ids < <(docker ps --filter name="$target_containers_pat" -q) | |
3509 |
|
3509 | |||
3510 | echo "Scaling completed, running $scale_2 services for upgrade purpose..." |
|
3510 | echo "Scaling completed, running $scale_2 services for upgrade purpose..." | |
3511 | echo "new docker-ids:" "${scaled_docker_ids[@]}" |
|
3511 | echo "new docker-ids:" "${scaled_docker_ids[@]}" | |
3512 |
|
3512 | |||
3513 | # calculate just NEW containers |
|
3513 | # calculate just NEW containers | |
3514 | declare -A new_container_check |
|
3514 | declare -A new_container_check | |
3515 |
|
3515 | |||
3516 | # Mark elements of the first initial docker |
|
3516 | # Mark elements of the first initial docker | |
3517 | for docker_id in "${old_docker_ids[@]}"; do |
|
3517 | for docker_id in "${old_docker_ids[@]}"; do | |
3518 | new_container_check[$docker_id]=1 |
|
3518 | new_container_check[$docker_id]=1 | |
3519 | done |
|
3519 | done | |
3520 |
|
3520 | |||
3521 | local new_docker_ids_str |
|
3521 | local new_docker_ids_str | |
3522 | new_docker_ids_str="" |
|
3522 | new_docker_ids_str="" | |
3523 |
|
3523 | |||
3524 | # Check if elements of the second array are not in the first |
|
3524 | # Check if elements of the second array are not in the first | |
3525 | for n_docker_id in "${scaled_docker_ids[@]}"; do |
|
3525 | for n_docker_id in "${scaled_docker_ids[@]}"; do | |
3526 | # if $docker_id in new services is empty in the last array we ADD it :) |
|
3526 | # if $docker_id in new services is empty in the last array we ADD it :) | |
3527 | if [[ -z ${new_container_check[$n_docker_id]} ]]; then |
|
3527 | if [[ -z ${new_container_check[$n_docker_id]} ]]; then | |
3528 | new_docker_ids_str+=" $n_docker_id " |
|
3528 | new_docker_ids_str+=" $n_docker_id " | |
3529 | fi |
|
3529 | fi | |
3530 | done |
|
3530 | done | |
3531 |
|
3531 | |||
3532 | echo "Stopping $scale old $target_container containers " |
|
3532 | echo "Stopping $scale old $target_container containers " | |
3533 | echo "killing docker-ids:" "${old_docker_ids[@]}" |
|
3533 | echo "killing docker-ids:" "${old_docker_ids[@]}" | |
3534 |
|
3534 | |||
3535 | spin='β Ύβ ½β »β β ―β ·' |
|
3535 | spin='β Ύβ ½β »β β ―β ·' | |
3536 | charwidth=1 |
|
3536 | charwidth=1 | |
3537 |
|
3537 | |||
3538 | # wait the required stop-wait time |
|
3538 | # wait the required stop-wait time | |
3539 | #HC: docker inspect --format='{{.Name}}: {{json .ContainerId .State.Health.Status}}' <container-id> |
|
3539 | #HC: docker inspect --format='{{.Name}}: {{json .ContainerId .State.Health.Status}}' <container-id> | |
3540 | local i |
|
3540 | local i | |
3541 | i=$(($stop_wait * 10)) |
|
3541 | i=$(($stop_wait * 10)) | |
3542 |
|
3542 | |||
3543 | local status |
|
3543 | local status | |
3544 | status='' |
|
3544 | status='' | |
3545 |
|
3545 | |||
3546 | # cursor invisible |
|
3546 | # cursor invisible | |
3547 | set_cursor civis |
|
3547 | set_cursor civis | |
3548 | while true |
|
3548 | while true | |
3549 | s=$((i / 10)) |
|
3549 | s=$((i / 10)) | |
3550 | do |
|
3550 | do | |
3551 | i=$(($i-1)) |
|
3551 | i=$(($i-1)) | |
3552 | if [[ $i -lt 1 ]]; then |
|
3552 | if [[ $i -lt 1 ]]; then | |
3553 | break |
|
3553 | break | |
3554 | fi |
|
3554 | fi | |
3555 |
|
3555 | |||
3556 | if [[ "$(($i % 10))" == 0 ]]; |
|
3556 | if [[ "$(($i % 10))" == 0 ]]; | |
3557 | then |
|
3557 | then | |
3558 | is_at_sec=1 |
|
3558 | is_at_sec=1 | |
3559 | else |
|
3559 | else | |
3560 | is_at_sec=0 |
|
3560 | is_at_sec=0 | |
3561 | fi |
|
3561 | fi | |
3562 |
|
3562 | |||
3563 | local new_docker_ids_status_cnt |
|
3563 | local new_docker_ids_status_cnt | |
3564 |
|
3564 | |||
3565 | if [[ $is_at_sec == 1 ]]; then |
|
3565 | if [[ $is_at_sec == 1 ]]; then | |
3566 |
|
3566 | |||
3567 | new_docker_ids_status_cnt=$(docker inspect --format='{{.State.Health.Status}}' $new_docker_ids_str | grep -c "healthy" || echo "") |
|
3567 | new_docker_ids_status_cnt=$(docker inspect --format='{{.State.Health.Status}}' $new_docker_ids_str | grep -c "healthy" || echo "") | |
3568 |
|
3568 | |||
3569 | if [[ $new_docker_ids_status_cnt -eq $scale ]]; then |
|
3569 | if [[ $new_docker_ids_status_cnt -eq $scale ]]; then | |
3570 | echo "All $target_container are in HEALTHY state; stopping old ones now" |
|
3570 | echo "All $target_container are in HEALTHY state; stopping old ones now" | |
3571 | echo "" |
|
3571 | echo "" | |
3572 | break |
|
3572 | break | |
3573 | fi |
|
3573 | fi | |
3574 |
|
3574 | |||
3575 | fi |
|
3575 | fi | |
3576 |
|
3576 | |||
3577 | k=$(((k + $charwidth) % ${#spin})) |
|
3577 | k=$(((k + $charwidth) % ${#spin})) | |
3578 |
|
3578 | |||
3579 | if [[ $have_tty == 1 ]]; then |
|
3579 | if [[ $have_tty == 1 ]]; then | |
3580 | printf "%s stopping $scale old containers once they are in HEALTHY state, or in $s s..." "${spin:$k:$charwidth}" |
|
3580 | printf "%s stopping $scale old containers once they are in HEALTHY state, or in $s s..." "${spin:$k:$charwidth}" | |
3581 | printf "\r" |
|
3581 | printf "\r" | |
3582 | else |
|
3582 | else | |
3583 | if [[ $is_at_sec == 1 ]]; then |
|
3583 | if [[ $is_at_sec == 1 ]]; then | |
3584 | echo "stopping $scale old containers once they are in HEALTHY state, or in $s s..." |
|
3584 | echo "stopping $scale old containers once they are in HEALTHY state, or in $s s..." | |
3585 | fi |
|
3585 | fi | |
3586 | fi |
|
3586 | fi | |
3587 |
|
3587 | |||
3588 | sleep .1 |
|
3588 | sleep .1 | |
3589 | done |
|
3589 | done | |
3590 | set_cursor cnorm |
|
3590 | set_cursor cnorm | |
3591 |
|
3591 | |||
3592 | for container in "${old_docker_ids[@]}" |
|
3592 | for container in "${old_docker_ids[@]}" | |
3593 | do |
|
3593 | do | |
3594 | echo "now running container $container stop with --time $docker_stop_wait" |
|
3594 | echo "now running container $container stop with --time $docker_stop_wait" | |
3595 | docker stop --time "$docker_stop_wait" "$container" > /dev/null |
|
3595 | docker stop --time "$docker_stop_wait" "$container" > /dev/null | |
3596 | docker rm "$container" > /dev/null |
|
3596 | docker rm "$container" > /dev/null | |
3597 | echo "Stopped $container" |
|
3597 | echo "Stopped $container" | |
3598 | done |
|
3598 | done | |
3599 |
|
3599 | |||
3600 | } |
|
3600 | } | |
3601 |
|
3601 | |||
3602 | # VCSSERVER Containers |
|
3602 | # VCSSERVER Containers | |
3603 | stop_containers "vcsserver" $docker_stop_wait $stop_wait |
|
3603 | stop_containers "vcsserver" $docker_stop_wait $stop_wait | |
3604 |
|
3604 | |||
3605 | # RHODECODE Containers |
|
3605 | # RHODECODE Containers | |
3606 | stop_containers "rhodecode" $docker_stop_wait $stop_wait |
|
3606 | stop_containers "rhodecode" $docker_stop_wait $stop_wait | |
3607 |
|
3607 | |||
3608 | # SSHD Containers |
|
3608 | # SSHD Containers | |
3609 | stop_containers "sshd" $docker_stop_wait $stop_wait |
|
3609 | stop_containers "sshd" $docker_stop_wait $stop_wait | |
3610 |
|
3610 | |||
3611 | # SVN Containers |
|
3611 | # SVN Containers | |
3612 | stop_containers "svn" $docker_stop_wait $stop_wait |
|
3612 | stop_containers "svn" $docker_stop_wait $stop_wait | |
3613 |
|
3613 | |||
3614 | ./$RC_SCRIPT_NAME stack rhodecode up celery --force-recreate --detach |
|
3614 | ./$RC_SCRIPT_NAME stack rhodecode up celery --force-recreate --detach | |
3615 | ./$RC_SCRIPT_NAME stack rhodecode up celery-beat --force-recreate --detach |
|
3615 | ./$RC_SCRIPT_NAME stack rhodecode up celery-beat --force-recreate --detach | |
3616 |
|
3616 | |||
3617 | echo "Upgrade to rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION} completed" |
|
3617 | echo "Upgrade to rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION} completed" | |
3618 | exit |
|
3618 | exit | |
3619 |
|
3619 | |||
3620 | } |
|
3620 | } | |
3621 |
|
3621 | |||
3622 | # :command.function |
|
3622 | # :command.function | |
3623 | rcstack_stack_monitor_restart_unhealthy_command() { |
|
3623 | rcstack_stack_monitor_restart_unhealthy_command() { | |
3624 | # src/stack_monitor_restart_unhealthy_command.sh |
|
3624 | # src/stack_monitor_restart_unhealthy_command.sh | |
3625 | check_bootstrap |
|
3625 | check_bootstrap | |
3626 |
|
3626 | |||
3627 | DEBUG=${args[--debug]} |
|
3627 | DEBUG=${args[--debug]} | |
3628 | loop=${args[--loop]} |
|
3628 | loop=${args[--loop]} | |
3629 |
|
3629 | |||
3630 | get_unhealthy() { |
|
3630 | get_unhealthy() { | |
3631 | unhealthy=$(docker ps --filter health=unhealthy --filter label=autoheal=true --format "{{.ID}}") |
|
3631 | unhealthy=$(docker ps --filter health=unhealthy --filter label=autoheal=true --format "{{.ID}}") | |
3632 |
|
3632 | |||
3633 | if [[ $unhealthy == "" ]]; then |
|
3633 | if [[ $unhealthy == "" ]]; then | |
3634 | echo "$(green stack-monitor: no unhealthy containers found)" |
|
3634 | echo "$(green stack-monitor: no unhealthy containers found)" | |
3635 | else |
|
3635 | else | |
3636 | echo "$(yellow stack-monitor: found unhealthy containers $unhealthy)" |
|
3636 | echo "$(yellow stack-monitor: found unhealthy containers $unhealthy)" | |
3637 | fi |
|
3637 | fi | |
3638 |
|
3638 | |||
3639 | for container in $unhealthy |
|
3639 | for container in $unhealthy | |
3640 | do |
|
3640 | do | |
3641 | docker stats --no-stream --format '{{.ID}}\t{{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.NetIO}}\t{{.BlockIO}}' $container |
|
3641 | docker stats --no-stream --format '{{.ID}}\t{{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.NetIO}}\t{{.BlockIO}}' $container | |
3642 | echo "stack-monitor: restart $container" |
|
3642 | echo "stack-monitor: restart $container" | |
3643 | docker restart --time=10 $container |
|
3643 | docker restart --time=10 $container | |
3644 | done |
|
3644 | done | |
3645 |
|
3645 | |||
3646 | } |
|
3646 | } | |
3647 |
|
3647 | |||
3648 | if [[ ! $loop == "0" ]]; then |
|
3648 | if [[ ! $loop == "0" ]]; then | |
3649 |
|
3649 | |||
3650 | while true |
|
3650 | while true | |
3651 | do |
|
3651 | do | |
3652 | date_formatted=$(date) |
|
3652 | date_formatted=$(date) | |
3653 | echo "stack-monitor: loop-run every $loop seconds..., $date_formatted" |
|
3653 | echo "stack-monitor: loop-run every $loop seconds..., $date_formatted" | |
3654 | # loop run |
|
3654 | # loop run | |
3655 | NO_COLOR=1 get_unhealthy |
|
3655 | NO_COLOR=1 get_unhealthy | |
3656 | echo "Next execution in $loop s..." && \ |
|
3656 | echo "Next execution in $loop s..." && \ | |
3657 | sleep $loop |
|
3657 | sleep $loop | |
3658 | echo "" |
|
3658 | echo "" | |
3659 | done |
|
3659 | done | |
3660 |
|
3660 | |||
3661 | else |
|
3661 | else | |
3662 |
|
3662 | |||
3663 | # one time run |
|
3663 | # one time run | |
3664 | get_unhealthy |
|
3664 | get_unhealthy | |
3665 | fi |
|
3665 | fi | |
3666 |
|
3666 | |||
3667 | exit |
|
3667 | exit | |
3668 |
|
3668 | |||
3669 | } |
|
3669 | } | |
3670 |
|
3670 | |||
3671 | # :command.function |
|
3671 | # :command.function | |
3672 | rcstack_cli_cmd_command() { |
|
3672 | rcstack_cli_cmd_command() { | |
3673 | # src/cli_cmd_command.sh |
|
3673 | # src/cli_cmd_command.sh | |
3674 | check_bootstrap |
|
3674 | check_bootstrap | |
3675 |
|
3675 | |||
3676 | DEBUG=${args[--debug]} |
|
3676 | DEBUG=${args[--debug]} | |
3677 | ENV_FILE=${args[--env-file-path]} |
|
3677 | ENV_FILE=${args[--env-file-path]} | |
3678 |
|
3678 | |||
3679 | printf "attaching $PWD/config/_shared \t\tunder: /vol/confvolume\n" |
|
3679 | printf "attaching $PWD/config/_shared \t\tunder: /vol/confvolume\n" | |
3680 |
|
3680 | |||
3681 | #printf "attaching rc_reposvolume \t\tunder: /vol/repovolume\n" |
|
3681 | #printf "attaching rc_reposvolume \t\tunder: /vol/repovolume\n" | |
3682 | #printf "attaching \$PWD/.custom/storage \t\tunder: /vol/backupvolume\n" |
|
3682 | #printf "attaching \$PWD/.custom/storage \t\tunder: /vol/backupvolume\n" | |
3683 |
|
3683 | |||
3684 | if [ ${#other_args[@]} -eq 0 ]; then |
|
3684 | if [ ${#other_args[@]} -eq 0 ]; then | |
3685 | other_args[${#other_args[@]}]="echo 'please provide a valid cmd arg...'" |
|
3685 | other_args[${#other_args[@]}]="echo 'please provide a valid cmd arg...'" | |
3686 | fi |
|
3686 | fi | |
3687 |
|
3687 | |||
3688 | CMD_RHODECODE="\ |
|
3688 | CMD_RHODECODE="\ | |
3689 | RC_ENV_FILE=$ENV_FILE docker compose \ |
|
3689 | RC_ENV_FILE=$ENV_FILE docker compose \ | |
3690 | --env-file $ENV_FILE \ |
|
3690 | --env-file $ENV_FILE \ | |
3691 | $ENV_EXPAND \ |
|
3691 | $ENV_EXPAND \ | |
3692 | -p cmd-run \ |
|
3692 | -p cmd-run \ | |
3693 | -f docker-compose-base.yaml \ |
|
3693 | -f docker-compose-base.yaml \ | |
3694 | -f docker-compose-apps.yaml \ |
|
3694 | -f docker-compose-apps.yaml \ | |
3695 | run \ |
|
3695 | run \ | |
3696 | --volume=$PWD/config/_shared:/vol/confvolume \ |
|
3696 | --volume=$PWD/config/_shared:/vol/confvolume \ | |
3697 | --workdir=/vol/confvolume \ |
|
3697 | --workdir=/vol/confvolume \ | |
3698 | -it \ |
|
3698 | -it \ | |
3699 | vcsserver" |
|
3699 | vcsserver" | |
3700 |
|
3700 | |||
3701 | if [[ $DEBUG ]]; then |
|
3701 | if [[ $DEBUG ]]; then | |
3702 | echo $CMD_RHODECODE |
|
3702 | echo $CMD_RHODECODE | |
3703 | echo ${other_args[*]} |
|
3703 | echo ${other_args[*]} | |
3704 | fi |
|
3704 | fi | |
3705 |
|
3705 | |||
3706 | eval "${CMD_RHODECODE} ${other_args[*]}" |
|
3706 | eval "${CMD_RHODECODE} ${other_args[*]}" | |
3707 |
|
3707 | |||
3708 | } |
|
3708 | } | |
3709 |
|
3709 | |||
3710 | # :command.function |
|
3710 | # :command.function | |
3711 | rcstack_cli_image_info_command() { |
|
3711 | rcstack_cli_image_info_command() { | |
3712 | # src/cli_image_info_command.sh |
|
3712 | # src/cli_image_info_command.sh | |
3713 |
|
3713 | |||
3714 | verbose=${args[--verbose]} |
|
3714 | verbose=${args[--verbose]} | |
3715 |
|
3715 | |||
3716 | if [[ $verbose ]]; then |
|
3716 | if [[ $verbose ]]; then | |
3717 |
|
3717 | |||
3718 | ver="unknown" |
|
3718 | ver="unknown" | |
3719 | if [[ -f $RUNTIME_ENV ]]; then |
|
3719 | if [[ -f $RUNTIME_ENV ]]; then | |
3720 | .env --file $RUNTIME_ENV |
|
3720 | .env --file $RUNTIME_ENV | |
3721 | .env get_or_error RC_VERSION |
|
3721 | .env get_or_error RC_VERSION | |
3722 | ver=$REPLY |
|
3722 | ver=$REPLY | |
3723 | fi |
|
3723 | fi | |
3724 |
|
3724 | |||
3725 | echo "Image stored version: $rc_image_ver" |
|
3725 | echo "Image stored version: $rc_image_ver" | |
3726 | echo "Image from runtime: $ver" |
|
3726 | echo "Image from runtime: $ver" | |
3727 | echo "runtime-file=$RUNTIME_ENV" |
|
3727 | echo "runtime-file=$RUNTIME_ENV" | |
3728 | echo "RC_VERSION=$ver" |
|
3728 | echo "RC_VERSION=$ver" | |
3729 | else |
|
3729 | else | |
3730 | echo $rc_image_ver |
|
3730 | echo $rc_image_ver | |
3731 | fi |
|
3731 | fi | |
3732 |
|
3732 | |||
3733 | } |
|
3733 | } | |
3734 |
|
3734 | |||
3735 | # :command.function |
|
3735 | # :command.function | |
3736 | rcstack_cli_set_runtime_image_command() { |
|
3736 | rcstack_cli_set_runtime_image_command() { | |
3737 | # src/cli_set_runtime_image_command.sh |
|
3737 | # src/cli_set_runtime_image_command.sh | |
3738 | set_ver=${args[version]} |
|
3738 | set_ver=${args[version]} | |
3739 |
|
3739 | |||
3740 | .env --file $RUNTIME_ENV |
|
3740 | .env --file $RUNTIME_ENV | |
3741 | echo "setting runtime version to $set_ver into $RUNTIME_ENV" |
|
3741 | echo "setting runtime version to $set_ver into $RUNTIME_ENV" | |
3742 |
|
3742 | |||
3743 | .env set RC_VERSION=$set_ver |
|
3743 | .env set RC_VERSION=$set_ver | |
3744 |
|
3744 | |||
3745 | echo "New version set to $set_ver" |
|
3745 | echo "New version set to $set_ver" | |
3746 |
|
3746 | |||
3747 | } |
|
3747 | } | |
3748 |
|
3748 | |||
3749 | # :command.function |
|
3749 | # :command.function | |
3750 | rcstack_cli_docker_info_command() { |
|
3750 | rcstack_cli_docker_info_command() { | |
3751 | # src/cli_docker_info_command.sh |
|
3751 | # src/cli_docker_info_command.sh | |
3752 | verbose=${args[--verbose]} |
|
3752 | verbose=${args[--verbose]} | |
3753 |
|
3753 | |||
3754 | docker --version |
|
3754 | docker --version | |
3755 | docker compose version |
|
3755 | docker compose version | |
3756 |
|
3756 | |||
3757 | if [[ $verbose ]]; then |
|
3757 | if [[ $verbose ]]; then | |
3758 | echo "-- DETAILED DOCKER INFO --" |
|
3758 | echo "-- DETAILED DOCKER INFO --" | |
3759 | docker version |
|
3759 | docker version | |
3760 | fi |
|
3760 | fi | |
3761 |
|
3761 | |||
3762 | } |
|
3762 | } | |
3763 |
|
3763 | |||
3764 | # :command.function |
|
3764 | # :command.function | |
3765 | rcstack_cli_docker_upgrade_command() { |
|
3765 | rcstack_cli_docker_upgrade_command() { | |
3766 | # src/cli_docker_upgrade_command.sh |
|
3766 | # src/cli_docker_upgrade_command.sh | |
|
3767 | DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker} | |||
|
3768 | DOCKER_CLI_PLUGINS=$DOCKER_CONFIG/cli-plugins | |||
|
3769 | ||||
|
3770 | if [[ -f "$DOCKER_CLI_PLUGINS/docker-compose" ]]; then | |||
|
3771 | echo "found docker-compose at $DOCKER_CLI_PLUGINS, removing it now..." | |||
|
3772 | rm -rf "$DOCKER_CLI_PLUGINS/docker-compose" | |||
|
3773 | fi | |||
|
3774 | ||||
3767 | curl https://get.docker.com/ | sh |
|
3775 | curl https://get.docker.com/ | sh | |
3768 |
|
3776 | |||
3769 | } |
|
3777 | } | |
3770 |
|
3778 | |||
3771 | # :command.function |
|
3779 | # :command.function | |
3772 | rcstack_cli_ishell_command() { |
|
3780 | rcstack_cli_ishell_command() { | |
3773 | # src/cli_ishell_command.sh |
|
3781 | # src/cli_ishell_command.sh | |
3774 | instance_type=rhodecode |
|
3782 | instance_type=rhodecode | |
3775 |
|
3783 | |||
3776 | match_name=rc_cluster_apps- |
|
3784 | match_name=rc_cluster_apps- | |
3777 | docker_id=$(docker ps --filter name=$match_name -q | head -n1) |
|
3785 | docker_id=$(docker ps --filter name=$match_name -q | head -n1) | |
3778 |
|
3786 | |||
3779 | if [[ $docker_id == "" ]]; then |
|
3787 | if [[ $docker_id == "" ]]; then | |
3780 | echo "$(yellow cannot find instance to attach by name *$match_name*)" |
|
3788 | echo "$(yellow cannot find instance to attach by name *$match_name*)" | |
3781 | exit 1 |
|
3789 | exit 1 | |
3782 | fi |
|
3790 | fi | |
3783 |
|
3791 | |||
3784 | docker exec -it --tty $docker_id /usr/local/bin/rhodecode_bin/bin/rc-ishell /etc/rhodecode/conf/rhodecode.ini |
|
3792 | docker exec -it --tty $docker_id /usr/local/bin/rhodecode_bin/bin/rc-ishell /etc/rhodecode/conf/rhodecode.ini | |
3785 |
|
3793 | |||
3786 | } |
|
3794 | } | |
3787 |
|
3795 | |||
3788 | # :command.function |
|
3796 | # :command.function | |
3789 | rcstack_cli_redis_command() { |
|
3797 | rcstack_cli_redis_command() { | |
3790 | # src/cli_redis_command.sh |
|
3798 | # src/cli_redis_command.sh | |
3791 | check_bootstrap |
|
3799 | check_bootstrap | |
3792 |
|
3800 | |||
3793 | DEBUG=${args[--debug]} |
|
3801 | DEBUG=${args[--debug]} | |
3794 |
|
3802 | |||
3795 | target_container=rc_cluster_services-redis-1 |
|
3803 | target_container=rc_cluster_services-redis-1 | |
3796 | docker_id=$(docker ps --filter name=$target_container -q) |
|
3804 | docker_id=$(docker ps --filter name=$target_container -q) | |
3797 |
|
3805 | |||
3798 | if [[ $DEBUG ]]; then |
|
3806 | if [[ $DEBUG ]]; then | |
3799 | echo "container id: $docker_id, based on $target_container filter" |
|
3807 | echo "container id: $docker_id, based on $target_container filter" | |
3800 | docker ps |
|
3808 | docker ps | |
3801 | fi |
|
3809 | fi | |
3802 |
|
3810 | |||
3803 | if [ "$docker_id" == "" ]; then |
|
3811 | if [ "$docker_id" == "" ]; then | |
3804 | MSG="Cannot find container ID with name $target_container" |
|
3812 | MSG="Cannot find container ID with name $target_container" | |
3805 | echo "$(red $MSG)" |
|
3813 | echo "$(red $MSG)" | |
3806 | exit 1 |
|
3814 | exit 1 | |
3807 | fi |
|
3815 | fi | |
3808 |
|
3816 | |||
3809 | if [[ $DEBUG ]]; then |
|
3817 | if [[ $DEBUG ]]; then | |
3810 | echo "Running |docker exec --interactive --tty $docker_id $CMD|" |
|
3818 | echo "Running |docker exec --interactive --tty $docker_id $CMD|" | |
3811 | echo "docker exec --interactive --tty $docker_id /bin/bash -c 'redis-cli'" |
|
3819 | echo "docker exec --interactive --tty $docker_id /bin/bash -c 'redis-cli'" | |
3812 | fi |
|
3820 | fi | |
3813 |
|
3821 | |||
3814 | eval "docker exec --interactive --tty $docker_id /bin/bash -c 'redis-cli'" |
|
3822 | eval "docker exec --interactive --tty $docker_id /bin/bash -c 'redis-cli'" | |
3815 |
|
3823 | |||
3816 | } |
|
3824 | } | |
3817 |
|
3825 | |||
3818 | # :command.function |
|
3826 | # :command.function | |
3819 | rcstack_cli_db_command() { |
|
3827 | rcstack_cli_db_command() { | |
3820 | # src/cli_db_command.sh |
|
3828 | # src/cli_db_command.sh | |
3821 | check_bootstrap |
|
3829 | check_bootstrap | |
3822 |
|
3830 | |||
3823 | DEBUG=${args[--debug]} |
|
3831 | DEBUG=${args[--debug]} | |
3824 |
|
3832 | |||
3825 | target_container=rc_cluster_services-database-* |
|
3833 | target_container=rc_cluster_services-database-* | |
3826 | docker_id=$(docker ps --filter name=$target_container -q | head -n1) |
|
3834 | docker_id=$(docker ps --filter name=$target_container -q | head -n1) | |
3827 |
|
3835 | |||
3828 | if [[ $DEBUG ]]; then |
|
3836 | if [[ $DEBUG ]]; then | |
3829 | echo "container id: $docker_id, based on $target_container filter" |
|
3837 | echo "container id: $docker_id, based on $target_container filter" | |
3830 | docker ps |
|
3838 | docker ps | |
3831 | fi |
|
3839 | fi | |
3832 |
|
3840 | |||
3833 | if [ "$docker_id" == "" ]; then |
|
3841 | if [ "$docker_id" == "" ]; then | |
3834 | MSG="Cannot find container ID with name $target_container" |
|
3842 | MSG="Cannot find container ID with name $target_container" | |
3835 | echo "$(red $MSG)" |
|
3843 | echo "$(red $MSG)" | |
3836 | exit 1 |
|
3844 | exit 1 | |
3837 | fi |
|
3845 | fi | |
3838 |
|
3846 | |||
3839 | .env --file $RUNTIME_ENV |
|
3847 | .env --file $RUNTIME_ENV | |
3840 |
|
3848 | |||
3841 | .env get_or_error DB_PASSWORD |
|
3849 | .env get_or_error DB_PASSWORD | |
3842 | DB_PASSWORD=$REPLY |
|
3850 | DB_PASSWORD=$REPLY | |
3843 |
|
3851 | |||
3844 | .env get_or_error DB_NAME |
|
3852 | .env get_or_error DB_NAME | |
3845 | DB_NAME=$REPLY |
|
3853 | DB_NAME=$REPLY | |
3846 |
|
3854 | |||
3847 | .env get_or_error DB_USER |
|
3855 | .env get_or_error DB_USER | |
3848 | DB_USER=$REPLY |
|
3856 | DB_USER=$REPLY | |
3849 |
|
3857 | |||
3850 | if [[ $DEBUG ]]; then |
|
3858 | if [[ $DEBUG ]]; then | |
3851 | echo "Running |docker exec --env-file $RUNTIME_ENV --interactive --tty $docker_id $CMD|" |
|
3859 | echo "Running |docker exec --env-file $RUNTIME_ENV --interactive --tty $docker_id $CMD|" | |
3852 | echo "docker exec --interactive --tty $docker_id /bin/bash -c 'PGPASSWORD=$DB_PASSWORD psql --username=$DB_USER --dbname=$DB_NAME'" |
|
3860 | echo "docker exec --interactive --tty $docker_id /bin/bash -c 'PGPASSWORD=$DB_PASSWORD psql --username=$DB_USER --dbname=$DB_NAME'" | |
3853 | fi |
|
3861 | fi | |
3854 |
|
3862 | |||
3855 | printf "attaching pg_data \t\t\tunder: /var/lib/postgresql/data\n" |
|
3863 | printf "attaching pg_data \t\t\tunder: /var/lib/postgresql/data\n" | |
3856 | printf "attaching \$PWD/.custom/db_dump \t\tunder: /var/rc-data-dump\n" |
|
3864 | printf "attaching \$PWD/.custom/db_dump \t\tunder: /var/rc-data-dump\n" | |
3857 | printf "restore dump:\n\i /var/rc-data-dump/your_dump.sql\n\n" |
|
3865 | printf "restore dump:\n\i /var/rc-data-dump/your_dump.sql\n\n" | |
3858 |
|
3866 | |||
3859 | eval "docker exec --env-file $RUNTIME_ENV --interactive --tty $docker_id /bin/bash -c 'PGPASSWORD=$DB_PASSWORD psql --username=$DB_USER --dbname=$DB_NAME'" |
|
3867 | eval "docker exec --env-file $RUNTIME_ENV --interactive --tty $docker_id /bin/bash -c 'PGPASSWORD=$DB_PASSWORD psql --username=$DB_USER --dbname=$DB_NAME'" | |
3860 |
|
3868 | |||
3861 | } |
|
3869 | } | |
3862 |
|
3870 | |||
3863 | # :command.function |
|
3871 | # :command.function | |
3864 | rcstack_cli_db_upgrade_command() { |
|
3872 | rcstack_cli_db_upgrade_command() { | |
3865 | # src/cli_db_upgrade_command.sh |
|
3873 | # src/cli_db_upgrade_command.sh | |
3866 | check_bootstrap |
|
3874 | check_bootstrap | |
3867 |
|
3875 | |||
3868 | DEBUG=${args[--debug]} |
|
3876 | DEBUG=${args[--debug]} | |
3869 |
|
3877 | |||
3870 | target_container=rc_cluster_services-database-* |
|
3878 | target_container=rc_cluster_services-database-* | |
3871 | docker_id=$(docker ps --filter name=$target_container -q | head -n1) |
|
3879 | docker_id=$(docker ps --filter name=$target_container -q | head -n1) | |
3872 |
|
3880 | |||
3873 | if [[ $DEBUG ]]; then |
|
3881 | if [[ $DEBUG ]]; then | |
3874 | echo "container id: $docker_id, based on $target_container filter" |
|
3882 | echo "container id: $docker_id, based on $target_container filter" | |
3875 | docker ps |
|
3883 | docker ps | |
3876 | fi |
|
3884 | fi | |
3877 |
|
3885 | |||
3878 | if [ "$docker_id" == "" ]; then |
|
3886 | if [ "$docker_id" == "" ]; then | |
3879 | MSG="Cannot find container ID with name $target_container" |
|
3887 | MSG="Cannot find container ID with name $target_container" | |
3880 | echo "$(red $MSG)" |
|
3888 | echo "$(red $MSG)" | |
3881 | exit 1 |
|
3889 | exit 1 | |
3882 | fi |
|
3890 | fi | |
3883 |
|
3891 | |||
3884 | if [[ $DEBUG ]]; then |
|
3892 | if [[ $DEBUG ]]; then | |
3885 | echo "./$RC_SCRIPT_NAME stack rhodecode exec rhodecode /usr/local/bin/rhodecode_bin/bin/rc-upgrade-db /etc/rhodecode/conf/rhodecode.ini --force-yes" |
|
3893 | echo "./$RC_SCRIPT_NAME stack rhodecode exec rhodecode /usr/local/bin/rhodecode_bin/bin/rc-upgrade-db /etc/rhodecode/conf/rhodecode.ini --force-yes" | |
3886 | fi |
|
3894 | fi | |
3887 |
|
3895 | |||
3888 | ./$RC_SCRIPT_NAME stack rhodecode exec rhodecode /usr/local/bin/rhodecode_bin/bin/rc-upgrade-db /etc/rhodecode/conf/rhodecode.ini --force-yes |
|
3896 | ./$RC_SCRIPT_NAME stack rhodecode exec rhodecode /usr/local/bin/rhodecode_bin/bin/rc-upgrade-db /etc/rhodecode/conf/rhodecode.ini --force-yes | |
3889 | } |
|
3897 | } | |
3890 |
|
3898 | |||
3891 | # :command.function |
|
3899 | # :command.function | |
3892 | rcstack_cli_storage_command() { |
|
3900 | rcstack_cli_storage_command() { | |
3893 | # src/cli_storage_command.sh |
|
3901 | # src/cli_storage_command.sh | |
3894 | check_bootstrap |
|
3902 | check_bootstrap | |
3895 |
|
3903 | |||
3896 | DEBUG=${args[--debug]} |
|
3904 | DEBUG=${args[--debug]} | |
3897 | ENV_FILE=${args[--env-file-path]} |
|
3905 | ENV_FILE=${args[--env-file-path]} | |
3898 | ATTACHED=${args[--attached]} |
|
3906 | ATTACHED=${args[--attached]} | |
3899 |
|
3907 | |||
3900 | if [[ $DEBUG ]]; then |
|
3908 | if [[ $DEBUG ]]; then | |
3901 | echo "rc_datavolume inspection..." |
|
3909 | echo "rc_datavolume inspection..." | |
3902 | docker volume inspect rc_datavolume |
|
3910 | docker volume inspect rc_datavolume | |
3903 |
|
3911 | |||
3904 | echo "rc_reposvolume inspection..." |
|
3912 | echo "rc_reposvolume inspection..." | |
3905 | docker volume inspect rc_reposvolume |
|
3913 | docker volume inspect rc_reposvolume | |
3906 | fi |
|
3914 | fi | |
3907 |
|
3915 | |||
3908 | # |
|
3916 | # | |
3909 | #if [[ $DEBUG ]]; then |
|
3917 | #if [[ $DEBUG ]]; then | |
3910 | # echo "image id: $image_id, based on $target_container filter" |
|
3918 | # echo "image id: $image_id, based on $target_container filter" | |
3911 | # docker image ls |
|
3919 | # docker image ls | |
3912 | # echo "---" |
|
3920 | # echo "---" | |
3913 | #fi |
|
3921 | #fi | |
3914 | # rename a volume |
|
3922 | # rename a volume | |
3915 | #docker volume create --name <new_volume> |
|
3923 | #docker volume create --name <new_volume> | |
3916 | #docker run --rm -it -v <old_volume>:/from -v <new_volume>:/to alpine ash -c "cd /from ; cp -av . /to" |
|
3924 | #docker run --rm -it -v <old_volume>:/from -v <new_volume>:/to alpine ash -c "cd /from ; cp -av . /to" | |
3917 | #docker volume rm <old_volume> |
|
3925 | #docker volume rm <old_volume> | |
3918 | if [[ $ATTACHED ]]; then |
|
3926 | if [[ $ATTACHED ]]; then | |
3919 | printf "Starting with attached mode to vcsserver !" |
|
3927 | printf "Starting with attached mode to vcsserver !" | |
3920 | printf "present rc_datavolume \t\tunder: /var/opt/rhodecode_data\n" |
|
3928 | printf "present rc_datavolume \t\tunder: /var/opt/rhodecode_data\n" | |
3921 | printf "present rc_reposvolume \t\tunder: /var/opt/rhodecode_repo_store\n" |
|
3929 | printf "present rc_reposvolume \t\tunder: /var/opt/rhodecode_repo_store\n" | |
3922 | printf "present confvolume \t\tunder: /etc/rhodecode/conf\n" |
|
3930 | printf "present confvolume \t\tunder: /etc/rhodecode/conf\n" | |
3923 |
|
3931 | |||
3924 | match_name=rc_cluster_apps-vcsserver |
|
3932 | match_name=rc_cluster_apps-vcsserver | |
3925 | docker_id=$(docker ps --filter name=$match_name -q | head -n1) |
|
3933 | docker_id=$(docker ps --filter name=$match_name -q | head -n1) | |
3926 |
|
3934 | |||
3927 | if [[ $docker_id == "" ]]; then |
|
3935 | if [[ $docker_id == "" ]]; then | |
3928 | echo "$(yellow cannot find instance to attach by name *$match_name*)" |
|
3936 | echo "$(yellow cannot find instance to attach by name *$match_name*)" | |
3929 | exit 1 |
|
3937 | exit 1 | |
3930 | fi |
|
3938 | fi | |
3931 |
|
3939 | |||
3932 | docker exec -it --tty --workdir /var/opt $docker_id bash |
|
3940 | docker exec -it --tty --workdir /var/opt $docker_id bash | |
3933 |
|
3941 | |||
3934 | else |
|
3942 | else | |
3935 | printf "attaching rc_datavolume \t\tunder: /vol/datavolume\n" |
|
3943 | printf "attaching rc_datavolume \t\tunder: /vol/datavolume\n" | |
3936 | printf "attaching rc_reposvolume \t\tunder: /vol/repovolume\n" |
|
3944 | printf "attaching rc_reposvolume \t\tunder: /vol/repovolume\n" | |
3937 | printf "attaching \$PWD/.custom/storage \t\tunder: /vol/backupvolume\n" |
|
3945 | printf "attaching \$PWD/.custom/storage \t\tunder: /vol/backupvolume\n" | |
3938 |
|
3946 | |||
3939 | docker run --rm \ |
|
3947 | docker run --rm \ | |
3940 | -it \ |
|
3948 | -it \ | |
3941 | --volume $PWD/.custom/storage:/vol/backupvolume \ |
|
3949 | --volume $PWD/.custom/storage:/vol/backupvolume \ | |
3942 | --volume rc_datavolume:/vol/datavolume \ |
|
3950 | --volume rc_datavolume:/vol/datavolume \ | |
3943 | --volume rc_reposvolume:/vol/repovolume \ |
|
3951 | --volume rc_reposvolume:/vol/repovolume \ | |
3944 | --workdir="/vol" \ |
|
3952 | --workdir="/vol" \ | |
3945 | $BASE_OPS_IMAGE \ |
|
3953 | $BASE_OPS_IMAGE \ | |
3946 | /bin/bash |
|
3954 | /bin/bash | |
3947 | fi |
|
3955 | fi | |
3948 |
|
3956 | |||
3949 | } |
|
3957 | } | |
3950 |
|
3958 | |||
3951 | # :command.function |
|
3959 | # :command.function | |
3952 | rcstack_cli_attach_command() { |
|
3960 | rcstack_cli_attach_command() { | |
3953 | # src/cli_attach_command.sh |
|
3961 | # src/cli_attach_command.sh | |
3954 | instance_type=${args[--instance-type]} |
|
3962 | instance_type=${args[--instance-type]} | |
3955 |
|
3963 | |||
3956 | match_name=rc_cluster_apps-$instance_type |
|
3964 | match_name=rc_cluster_apps-$instance_type | |
3957 | docker_id=$(docker ps --filter name=$match_name -q | head -n1) |
|
3965 | docker_id=$(docker ps --filter name=$match_name -q | head -n1) | |
3958 |
|
3966 | |||
3959 | if [[ $docker_id == "" ]]; then |
|
3967 | if [[ $docker_id == "" ]]; then | |
3960 | echo "$(yellow cannot find instance to attach by name *$match_name*)" |
|
3968 | echo "$(yellow cannot find instance to attach by name *$match_name*)" | |
3961 | exit 1 |
|
3969 | exit 1 | |
3962 | fi |
|
3970 | fi | |
3963 |
|
3971 | |||
3964 | docker exec -it --tty $docker_id bash |
|
3972 | docker exec -it --tty $docker_id bash | |
3965 |
|
3973 | |||
3966 | } |
|
3974 | } | |
3967 |
|
3975 | |||
3968 | # :command.function |
|
3976 | # :command.function | |
3969 | rcstack_cli_set_edition_command() { |
|
3977 | rcstack_cli_set_edition_command() { | |
3970 | # src/cli_set_edition_command.sh |
|
3978 | # src/cli_set_edition_command.sh | |
3971 | INI_TARGET=$PWD/config/_shared |
|
3979 | INI_TARGET=$PWD/config/_shared | |
3972 | BOOTSTRAP_RUNTIME_ENV=$PWD/.custom/.runtime.env |
|
3980 | BOOTSTRAP_RUNTIME_ENV=$PWD/.custom/.runtime.env | |
3973 |
|
3981 | |||
3974 | RC_EDITION=${args[edition_type]} |
|
3982 | RC_EDITION=${args[edition_type]} | |
3975 | ini_path=$INI_TARGET/rhodecode.ini |
|
3983 | ini_path=$INI_TARGET/rhodecode.ini | |
3976 |
|
3984 | |||
3977 | echo "Setting current installation as rhodecode-$RC_EDITION type" |
|
3985 | echo "Setting current installation as rhodecode-$RC_EDITION type" | |
3978 |
|
3986 | |||
3979 | echo "configure $ini_path" |
|
3987 | echo "configure $ini_path" | |
3980 | sed_replace '^use = egg:rhodecode-enterprise.*' "use = egg:rhodecode-enterprise-$RC_EDITION" |
|
3988 | sed_replace '^use = egg:rhodecode-enterprise.*' "use = egg:rhodecode-enterprise-$RC_EDITION" | |
3981 |
|
3989 | |||
3982 | echo "" |
|
3990 | echo "" | |
3983 | echo "configure $BOOTSTRAP_RUNTIME_ENV" |
|
3991 | echo "configure $BOOTSTRAP_RUNTIME_ENV" | |
3984 | .env --file "$BOOTSTRAP_RUNTIME_ENV" |
|
3992 | .env --file "$BOOTSTRAP_RUNTIME_ENV" | |
3985 | .env set RC_EDITION=$RC_EDITION |
|
3993 | .env set RC_EDITION=$RC_EDITION | |
3986 |
|
3994 | |||
3987 | echo "Configuration done, run " |
|
3995 | echo "Configuration done, run " | |
3988 | echo "./$RC_SCRIPT_NAME stack-upgrade rhodecode" |
|
3996 | echo "./$RC_SCRIPT_NAME stack-upgrade rhodecode" | |
3989 |
|
3997 | |||
3990 | } |
|
3998 | } | |
3991 |
|
3999 | |||
3992 | # :command.function |
|
4000 | # :command.function | |
3993 | rcstack_cli_configure_vcsserver_command() { |
|
4001 | rcstack_cli_configure_vcsserver_command() { | |
3994 | # src/cli_configure_vcsserver_command.sh |
|
4002 | # src/cli_configure_vcsserver_command.sh | |
3995 | ini_path=${args[ini_path]} |
|
4003 | ini_path=${args[ini_path]} | |
3996 | DEBUG=${args[--debug]} |
|
4004 | DEBUG=${args[--debug]} | |
3997 |
|
4005 | |||
3998 | config_vcsserver_ini |
|
4006 | config_vcsserver_ini | |
3999 |
|
4007 | |||
4000 | echo |
|
4008 | echo | |
4001 | echo "reconfigure of $ini_path completed" |
|
4009 | echo "reconfigure of $ini_path completed" | |
4002 |
|
4010 | |||
4003 | } |
|
4011 | } | |
4004 |
|
4012 | |||
4005 | # :command.function |
|
4013 | # :command.function | |
4006 | rcstack_cli_configure_rhodecode_command() { |
|
4014 | rcstack_cli_configure_rhodecode_command() { | |
4007 | # src/cli_configure_rhodecode_command.sh |
|
4015 | # src/cli_configure_rhodecode_command.sh | |
4008 | ini_path=${args[ini_path]} |
|
4016 | ini_path=${args[ini_path]} | |
4009 | DEBUG=${args[--debug]} |
|
4017 | DEBUG=${args[--debug]} | |
4010 |
|
4018 | |||
4011 | # read generated secrets etc from our .env file |
|
4019 | # read generated secrets etc from our .env file | |
4012 | .env --file $RUNTIME_ENV |
|
4020 | .env --file $RUNTIME_ENV | |
4013 |
|
4021 | |||
4014 | .env get RC_LICENSE_TOKEN |
|
4022 | .env get RC_LICENSE_TOKEN | |
4015 | RC_LICENSE_TOKEN=$REPLY |
|
4023 | RC_LICENSE_TOKEN=$REPLY | |
4016 |
|
4024 | |||
4017 | .env get RC_EDITION |
|
4025 | .env get RC_EDITION | |
4018 | RC_EDITION=$REPLY |
|
4026 | RC_EDITION=$REPLY | |
4019 |
|
4027 | |||
4020 | .env get RC_HOSTNAME |
|
4028 | .env get RC_HOSTNAME | |
4021 | RC_HOSTNAME=$(sed_safe_path $REPLY) |
|
4029 | RC_HOSTNAME=$(sed_safe_path $REPLY) | |
4022 |
|
4030 | |||
4023 | .env get RC_APP_BASE_URL |
|
4031 | .env get RC_APP_BASE_URL | |
4024 | RC_APP_BASE_URL=$(sed_safe_path $REPLY) |
|
4032 | RC_APP_BASE_URL=$(sed_safe_path $REPLY) | |
4025 |
|
4033 | |||
4026 | .env get RC_SQLALCHEMY_DB1_URL |
|
4034 | .env get RC_SQLALCHEMY_DB1_URL | |
4027 | RC_SQLALCHEMY_DB1_URL=$(sed_safe_path $REPLY) |
|
4035 | RC_SQLALCHEMY_DB1_URL=$(sed_safe_path $REPLY) | |
4028 |
|
4036 | |||
4029 | .env get RC_CHANNELSTREAM_WS_URL |
|
4037 | .env get RC_CHANNELSTREAM_WS_URL | |
4030 | RC_CHANNELSTREAM_WS_URL=$(sed_safe_path $REPLY) |
|
4038 | RC_CHANNELSTREAM_WS_URL=$(sed_safe_path $REPLY) | |
4031 |
|
4039 | |||
4032 | # $ini_path needs to be defined! |
|
4040 | # $ini_path needs to be defined! | |
4033 | config_rhodecode_ini |
|
4041 | config_rhodecode_ini | |
4034 |
|
4042 | |||
4035 | echo |
|
4043 | echo | |
4036 | echo "reconfigure of $ini_path completed" |
|
4044 | echo "reconfigure of $ini_path completed" | |
4037 | } |
|
4045 | } | |
4038 |
|
4046 | |||
4039 | # :command.function |
|
4047 | # :command.function | |
4040 | rcstack_backup_db_command() { |
|
4048 | rcstack_backup_db_command() { | |
4041 | # src/backup_db_command.sh |
|
4049 | # src/backup_db_command.sh | |
4042 | check_bootstrap |
|
4050 | check_bootstrap | |
4043 |
|
4051 | |||
4044 | DEBUG=${args[--debug]} |
|
4052 | DEBUG=${args[--debug]} | |
4045 | DESTINATION=${args[destination]} |
|
4053 | DESTINATION=${args[destination]} | |
4046 |
|
4054 | |||
4047 | backup_name=rc_db_dump-$(date +%Y-%m-%d).sql.gz |
|
4055 | backup_name=rc_db_dump-$(date +%Y-%m-%d).sql.gz | |
4048 | echo "creating backup: $backup_name" |
|
4056 | echo "creating backup: $backup_name" | |
4049 |
|
4057 | |||
4050 | target_container=rc_cluster_services-database-* |
|
4058 | target_container=rc_cluster_services-database-* | |
4051 | docker_id=$(docker ps --filter name=$target_container -q | head -n1) |
|
4059 | docker_id=$(docker ps --filter name=$target_container -q | head -n1) | |
4052 |
|
4060 | |||
4053 | if [[ $DEBUG ]]; then |
|
4061 | if [[ $DEBUG ]]; then | |
4054 | echo "container id: $docker_id, based on $target_container filter" |
|
4062 | echo "container id: $docker_id, based on $target_container filter" | |
4055 | docker ps |
|
4063 | docker ps | |
4056 | echo "---" |
|
4064 | echo "---" | |
4057 | fi |
|
4065 | fi | |
4058 |
|
4066 | |||
4059 | if [ "$docker_id" == "" ]; then |
|
4067 | if [ "$docker_id" == "" ]; then | |
4060 | MSG="Cannot find container ID with name $target_container" |
|
4068 | MSG="Cannot find container ID with name $target_container" | |
4061 | echo "$(red $MSG)" |
|
4069 | echo "$(red $MSG)" | |
4062 | exit 1 |
|
4070 | exit 1 | |
4063 | fi |
|
4071 | fi | |
4064 |
|
4072 | |||
4065 | .env --file $RUNTIME_ENV |
|
4073 | .env --file $RUNTIME_ENV | |
4066 |
|
4074 | |||
4067 | .env get_or_error DB_PASSWORD |
|
4075 | .env get_or_error DB_PASSWORD | |
4068 | DB_PASSWORD=$REPLY |
|
4076 | DB_PASSWORD=$REPLY | |
4069 |
|
4077 | |||
4070 | .env get_or_error DB_NAME |
|
4078 | .env get_or_error DB_NAME | |
4071 | DB_NAME=$REPLY |
|
4079 | DB_NAME=$REPLY | |
4072 |
|
4080 | |||
4073 | .env get_or_error DB_USER |
|
4081 | .env get_or_error DB_USER | |
4074 | DB_USER=$REPLY |
|
4082 | DB_USER=$REPLY | |
4075 |
|
4083 | |||
4076 | if [[ $DEBUG ]]; then |
|
4084 | if [[ $DEBUG ]]; then | |
4077 | 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'" |
|
4085 | 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'" | |
4078 | echo "dump placed in /var/rc-data-dump/$backup_name" |
|
4086 | echo "dump placed in /var/rc-data-dump/$backup_name" | |
4079 | echo "run docker cp $docker_id:/var/rc-data-dump/$backup_name $PWD to copy the file into your host machine" |
|
4087 | echo "run docker cp $docker_id:/var/rc-data-dump/$backup_name $PWD to copy the file into your host machine" | |
4080 | fi |
|
4088 | fi | |
4081 |
|
4089 | |||
4082 | set -euo pipefail |
|
4090 | set -euo pipefail | |
4083 |
|
4091 | |||
4084 | 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" |
|
4092 | 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" | |
4085 |
|
4093 | |||
4086 | echo "$(green Backup created in container volume under: /var/rc-data-dump/$backup_name !)" |
|
4094 | echo "$(green Backup created in container volume under: /var/rc-data-dump/$backup_name !)" | |
4087 | echo "to copy this file into your host machine run:" |
|
4095 | echo "to copy this file into your host machine run:" | |
4088 | echo "docker cp $docker_id:/var/rc-data-dump/$backup_name $PWD" |
|
4096 | echo "docker cp $docker_id:/var/rc-data-dump/$backup_name $PWD" | |
4089 |
|
4097 | |||
4090 | } |
|
4098 | } | |
4091 |
|
4099 | |||
4092 | # :command.function |
|
4100 | # :command.function | |
4093 | rcstack_backup_data_command() { |
|
4101 | rcstack_backup_data_command() { | |
4094 | # src/backup_data_command.sh |
|
4102 | # src/backup_data_command.sh | |
4095 | check_bootstrap |
|
4103 | check_bootstrap | |
4096 |
|
4104 | |||
4097 | DEBUG=${args[--debug]} |
|
4105 | DEBUG=${args[--debug]} | |
4098 | DESTINATION=${args[destination]} |
|
4106 | DESTINATION=${args[destination]} | |
4099 |
|
4107 | |||
4100 | echo "$(green_bold Creating backup of rcstack volumes)" |
|
4108 | echo "$(green_bold Creating backup of rcstack volumes)" | |
4101 |
|
4109 | |||
4102 | backup_date=$(date +%Y-%m-%d) |
|
4110 | backup_date=$(date +%Y-%m-%d) | |
4103 | backup_name_prefix=rc_data_dump |
|
4111 | backup_name_prefix=rc_data_dump | |
4104 |
|
4112 | |||
4105 | target_container=rc_cluster_apps-rhodecode-* |
|
4113 | target_container=rc_cluster_apps-rhodecode-* | |
4106 |
|
4114 | |||
4107 | docker_id=$(docker ps --filter name=$target_container -q | head -n1) |
|
4115 | docker_id=$(docker ps --filter name=$target_container -q | head -n1) | |
4108 |
|
4116 | |||
4109 | if [[ $DEBUG ]]; then |
|
4117 | if [[ $DEBUG ]]; then | |
4110 | echo "container id: $docker_id, based on $target_container filter" |
|
4118 | echo "container id: $docker_id, based on $target_container filter" | |
4111 | docker ps |
|
4119 | docker ps | |
4112 | echo "---" |
|
4120 | echo "---" | |
4113 | fi |
|
4121 | fi | |
4114 |
|
4122 | |||
4115 | if [ "$docker_id" == "" ]; then |
|
4123 | if [ "$docker_id" == "" ]; then | |
4116 | MSG="Cannot find container ID with name $target_container" |
|
4124 | MSG="Cannot find container ID with name $target_container" | |
4117 | echo "$(red $MSG)" |
|
4125 | echo "$(red $MSG)" | |
4118 | exit 1 |
|
4126 | exit 1 | |
4119 | fi |
|
4127 | fi | |
4120 |
|
4128 | |||
4121 | set -euo pipefail |
|
4129 | set -euo pipefail | |
4122 |
|
4130 | |||
4123 | echo "$(green_bold Following volumes will be backed-up:)" |
|
4131 | echo "$(green_bold Following volumes will be backed-up:)" | |
4124 |
|
4132 | |||
4125 | volumes=$(docker inspect --format "{{ range .Mounts }}{{ println .Destination }}{{ end }}" $docker_id) |
|
4133 | volumes=$(docker inspect --format "{{ range .Mounts }}{{ println .Destination }}{{ end }}" $docker_id) | |
4126 | destination_dir=$DESTINATION |
|
4134 | destination_dir=$DESTINATION | |
4127 |
|
4135 | |||
4128 | spacer="_" |
|
4136 | spacer="_" | |
4129 | for vol in $volumes; do |
|
4137 | for vol in $volumes; do | |
4130 | echo "Volume: $vol" |
|
4138 | echo "Volume: $vol" | |
4131 | vol_name=$(slugify $vol) |
|
4139 | vol_name=$(slugify $vol) | |
4132 | backup_slug="$backup_name_prefix$spacer$vol_name$spacer$backup_date" |
|
4140 | backup_slug="$backup_name_prefix$spacer$vol_name$spacer$backup_date" | |
4133 |
|
4141 | |||
4134 | docker run --rm -v $destination_dir:/backup --volumes-from "$docker_id" $BASE_OPS_IMAGE tar -czvf /backup/$backup_slug.tar.gz "$vol" |
|
4142 | docker run --rm -v $destination_dir:/backup --volumes-from "$docker_id" $BASE_OPS_IMAGE tar -czvf /backup/$backup_slug.tar.gz "$vol" | |
4135 | done |
|
4143 | done | |
4136 |
|
4144 | |||
4137 | echo "$(green Backup created in: \'$destination_dir\')" |
|
4145 | echo "$(green Backup created in: \'$destination_dir\')" | |
4138 |
|
4146 | |||
4139 | ls -la $destination_dir | grep $backup_name_prefix |
|
4147 | ls -la $destination_dir | grep $backup_name_prefix | |
4140 |
|
4148 | |||
4141 | #docker-volume-restore-compressed() { |
|
4149 | #docker-volume-restore-compressed() { | |
4142 | # destination_dir=$1 |
|
4150 | # destination_dir=$1 | |
4143 | # container=$2 |
|
4151 | # container=$2 | |
4144 | # |
|
4152 | # | |
4145 | # docker run --rm -v $destination_dir:/backup --volumes-from "$container" debian:jessie tar -xzvf /backup/backup.tar.gz "${@:3}" |
|
4153 | # docker run --rm -v $destination_dir:/backup --volumes-from "$container" debian:jessie tar -xzvf /backup/backup.tar.gz "${@:3}" | |
4146 | # echo "Double checking files..." |
|
4154 | # echo "Double checking files..." | |
4147 | # docker run --rm -v $destination_dir:/backup --volumes-from "$container" debian:jessie ls -lh "${@:2}" |
|
4155 | # docker run --rm -v $destination_dir:/backup --volumes-from "$container" debian:jessie ls -lh "${@:2}" | |
4148 | #} |
|
4156 | #} | |
4149 | } |
|
4157 | } | |
4150 |
|
4158 | |||
4151 | # :command.function |
|
4159 | # :command.function | |
4152 | rcstack_get_build_artifacts_command() { |
|
4160 | rcstack_get_build_artifacts_command() { | |
4153 | # src/get_build_artifacts_command.sh |
|
4161 | # src/get_build_artifacts_command.sh | |
4154 | check_bootstrap |
|
4162 | check_bootstrap | |
4155 |
|
4163 | |||
4156 | DEBUG=${args[--debug]} |
|
4164 | DEBUG=${args[--debug]} | |
4157 | AUTH=${args[--auth]} |
|
4165 | AUTH=${args[--auth]} | |
4158 | INSTALLER_URL=${args[--installer-url]} |
|
4166 | INSTALLER_URL=${args[--installer-url]} | |
4159 | MANIFEST_URL=${args[--manifest-url]} |
|
4167 | MANIFEST_URL=${args[--manifest-url]} | |
4160 | RC_VERSION=${args[--version-name]} |
|
4168 | RC_VERSION=${args[--version-name]} | |
4161 | VER=$RC_VERSION |
|
4169 | VER=$RC_VERSION | |
4162 |
|
4170 | |||
4163 | CACHE_DIR=$PWD/.cache |
|
4171 | CACHE_DIR=$PWD/.cache | |
4164 | VER_REGEX="$VER+x86_64" |
|
4172 | VER_REGEX="$VER+x86_64" | |
4165 |
|
4173 | |||
4166 | if [[ $VER == "" ]]; then |
|
4174 | if [[ $VER == "" ]]; then | |
4167 | msg="Version is empty, please set --version-name correctly" |
|
4175 | msg="Version is empty, please set --version-name correctly" | |
4168 | echo "$(red $msg)" |
|
4176 | echo "$(red $msg)" | |
4169 | exit 1 |
|
4177 | exit 1 | |
4170 | fi |
|
4178 | fi | |
4171 |
|
4179 | |||
4172 | echo "Downloading Artifacts for version: $VER" |
|
4180 | echo "Downloading Artifacts for version: $VER" | |
4173 | mkdir -p $CACHE_DIR |
|
4181 | mkdir -p $CACHE_DIR | |
4174 |
|
4182 | |||
4175 | echo "1/4 Checking available downloads from MANIFEST file" |
|
4183 | echo "1/4 Checking available downloads from MANIFEST file" | |
4176 |
|
4184 | |||
4177 | ARTS=$(curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" | cut -d ' ' -f 2) |
|
4185 | ARTS=$(curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" | cut -d ' ' -f 2) | |
4178 |
|
4186 | |||
4179 | if [[ $DEBUG ]]; then |
|
4187 | if [[ $DEBUG ]]; then | |
4180 | echo "DEBUG START" |
|
4188 | echo "DEBUG START" | |
4181 | curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" || echo "no regex match" |
|
4189 | curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" || echo "no regex match" | |
4182 | curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" | cut -d ' ' -f 2 |
|
4190 | curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" | cut -d ' ' -f 2 | |
4183 | echo "Found following artifacts:" |
|
4191 | echo "Found following artifacts:" | |
4184 | echo $ARTS |
|
4192 | echo $ARTS | |
4185 | echo "DEBUG END" |
|
4193 | echo "DEBUG END" | |
4186 | fi |
|
4194 | fi | |
4187 |
|
4195 | |||
4188 | if [[ $ARTS == "" ]]; then |
|
4196 | if [[ $ARTS == "" ]]; then | |
4189 | MSG="Failed to found any MANIFEST entries for version $VER make sure there exists release with that version or use --version to specify different version" |
|
4197 | MSG="Failed to found any MANIFEST entries for version $VER make sure there exists release with that version or use --version to specify different version" | |
4190 | echo "$(red $MSG)" |
|
4198 | echo "$(red $MSG)" | |
4191 | exit 1 |
|
4199 | exit 1 | |
4192 | fi |
|
4200 | fi | |
4193 |
|
4201 | |||
4194 | echo "2/4 Downloading locale-archive" |
|
4202 | echo "2/4 Downloading locale-archive" | |
4195 | curl -L https://dls.rhodecode.com/assets/locale-archive -J -O |
|
4203 | curl -L https://dls.rhodecode.com/assets/locale-archive -J -O | |
4196 | mv -v locale-archive "$CACHE_DIR" |
|
4204 | mv -v locale-archive "$CACHE_DIR" | |
4197 |
|
4205 | |||
4198 | # vcsserver/ce/ee |
|
4206 | # vcsserver/ce/ee | |
4199 | echo "3/4 Downloading installer artifacts" |
|
4207 | echo "3/4 Downloading installer artifacts" | |
4200 | for url in $ARTS; do |
|
4208 | for url in $ARTS; do | |
4201 | echo "Downloading $url with $AUTH" |
|
4209 | echo "Downloading $url with $AUTH" | |
4202 | curl $AUTH --fail-early -L ${url} -J -O |
|
4210 | curl $AUTH --fail-early -L ${url} -J -O | |
4203 | done |
|
4211 | done | |
4204 |
|
4212 | |||
4205 | #for url in $(curl -s $MANIFEST_URL | grep --ignore-case -E 'control.+\+x86_64' | cut -d ' ' -f 2); do |
|
4213 | #for url in $(curl -s $MANIFEST_URL | grep --ignore-case -E 'control.+\+x86_64' | cut -d ' ' -f 2); do | |
4206 | # echo "Downloading $url" |
|
4214 | # echo "Downloading $url" | |
4207 | # curl -L ${url} -J -O |
|
4215 | # curl -L ${url} -J -O | |
4208 | #done |
|
4216 | #done | |
4209 |
|
4217 | |||
4210 | echo "4/4 Downloading installer from $INSTALLER_URL" |
|
4218 | echo "4/4 Downloading installer from $INSTALLER_URL" | |
4211 | curl $AUTH -L $INSTALLER_URL -J -O |
|
4219 | curl $AUTH -L $INSTALLER_URL -J -O | |
4212 |
|
4220 | |||
4213 | INSTALLER=$(ls -Art RhodeCode-installer-* | tail -n 1) |
|
4221 | INSTALLER=$(ls -Art RhodeCode-installer-* | tail -n 1) | |
4214 | if [[ -n $INSTALLER ]]; then |
|
4222 | if [[ -n $INSTALLER ]]; then | |
4215 | chmod +x "${INSTALLER}" |
|
4223 | chmod +x "${INSTALLER}" | |
4216 | fi |
|
4224 | fi | |
4217 |
|
4225 | |||
4218 | echo "Copying artifacts into $CACHE_DIR" |
|
4226 | echo "Copying artifacts into $CACHE_DIR" | |
4219 |
|
4227 | |||
4220 | mv -v "${INSTALLER}" $CACHE_DIR |
|
4228 | mv -v "${INSTALLER}" $CACHE_DIR | |
4221 | mv -v *.bz2 $CACHE_DIR |
|
4229 | mv -v *.bz2 $CACHE_DIR | |
4222 | ls -lh $CACHE_DIR |
|
4230 | ls -lh $CACHE_DIR | |
4223 |
|
4231 | |||
4224 | } |
|
4232 | } | |
4225 |
|
4233 | |||
4226 | # :command.function |
|
4234 | # :command.function | |
4227 | rcstack_build_installer_command() { |
|
4235 | rcstack_build_installer_command() { | |
4228 | # src/build_installer_command.sh |
|
4236 | # src/build_installer_command.sh | |
4229 | check_bootstrap |
|
4237 | check_bootstrap | |
4230 |
|
4238 | |||
4231 | rc_version=${args[--version-name]} |
|
4239 | rc_version=${args[--version-name]} | |
4232 | export RC_VERSION=$rc_version |
|
4240 | export RC_VERSION=$rc_version | |
4233 | eval "echo INSTALLER BASED BUILDING${RC_VERSION}" |
|
4241 | eval "echo INSTALLER BASED BUILDING${RC_VERSION}" | |
4234 |
|
4242 | |||
4235 | RC_VERSION=$rc_version ./$RC_SCRIPT_NAME stack rhodecode build --progress plain rhodecode |
|
4243 | RC_VERSION=$rc_version ./$RC_SCRIPT_NAME stack rhodecode build --progress plain rhodecode | |
4236 |
|
4244 | |||
4237 | } |
|
4245 | } | |
4238 |
|
4246 | |||
4239 | # :command.function |
|
4247 | # :command.function | |
4240 | rcstack_get_build_source_command() { |
|
4248 | rcstack_get_build_source_command() { | |
4241 | # src/get_build_source_command.sh |
|
4249 | # src/get_build_source_command.sh | |
4242 |
|
4250 | |||
4243 | NO_INIT=${args[--no-init-check]} |
|
4251 | NO_INIT=${args[--no-init-check]} | |
4244 |
|
4252 | |||
4245 | if [[ ! $NO_INIT ]]; then |
|
4253 | if [[ ! $NO_INIT ]]; then | |
4246 | check_bootstrap |
|
4254 | check_bootstrap | |
4247 | fi |
|
4255 | fi | |
4248 |
|
4256 | |||
4249 | DEBUG=${args[--debug]} |
|
4257 | DEBUG=${args[--debug]} | |
4250 | AUTH_TOKEN=${args[--auth-token]} |
|
4258 | AUTH_TOKEN=${args[--auth-token]} | |
4251 | SERVER_URL=${args[--server-url]} |
|
4259 | SERVER_URL=${args[--server-url]} | |
4252 | revision=${args[--revision]} |
|
4260 | revision=${args[--revision]} | |
4253 |
|
4261 | |||
4254 | SOURCE_DIR=$PWD/.source |
|
4262 | SOURCE_DIR=$PWD/.source | |
4255 |
|
4263 | |||
4256 | RHODECODE_VCS_HASH=$revision |
|
4264 | RHODECODE_VCS_HASH=$revision | |
4257 | RHODECODE_CE_HASH=$revision |
|
4265 | RHODECODE_CE_HASH=$revision | |
4258 | RHODECODE_EE_HASH=$revision |
|
4266 | RHODECODE_EE_HASH=$revision | |
4259 |
|
4267 | |||
4260 | # download sources |
|
4268 | # download sources | |
4261 | echo "** download rhodecode source for build from $SERVER_URL using '$revision' hash **" |
|
4269 | echo "** download rhodecode source for build from $SERVER_URL using '$revision' hash **" | |
4262 | mkdir -p $SOURCE_DIR |
|
4270 | mkdir -p $SOURCE_DIR | |
4263 |
|
4271 | |||
4264 | echo "getting $SERVER_URL/rhodecode-vcsserver/archive/$RHODECODE_VCS_HASH.tgz" |
|
4272 | echo "getting $SERVER_URL/rhodecode-vcsserver/archive/$RHODECODE_VCS_HASH.tgz" | |
4265 | curl --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-vcsserver/archive/$RHODECODE_VCS_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR |
|
4273 | curl --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-vcsserver/archive/$RHODECODE_VCS_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR | |
4266 |
|
4274 | |||
4267 | echo "getting $SERVER_URL/rhodecode-enterprise-ce/archive/$RHODECODE_CE_HASH.tgz" |
|
4275 | echo "getting $SERVER_URL/rhodecode-enterprise-ce/archive/$RHODECODE_CE_HASH.tgz" | |
4268 | curl --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-enterprise-ce/archive/$RHODECODE_CE_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR |
|
4276 | curl --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-enterprise-ce/archive/$RHODECODE_CE_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR | |
4269 |
|
4277 | |||
4270 | echo "getting $SERVER_URL/rhodecode-enterprise-ee/archive/$RHODECODE_EE_HASH.tgz" |
|
4278 | echo "getting $SERVER_URL/rhodecode-enterprise-ee/archive/$RHODECODE_EE_HASH.tgz" | |
4271 | curl --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-enterprise-ee/archive/$RHODECODE_EE_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR |
|
4279 | curl --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-enterprise-ee/archive/$RHODECODE_EE_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR | |
4272 |
|
4280 | |||
4273 | rm -rf $SOURCE_DIR/rhodecode-vcsserver && \ |
|
4281 | rm -rf $SOURCE_DIR/rhodecode-vcsserver && \ | |
4274 | mv $SOURCE_DIR/*rhodecode-vcsserver-* $SOURCE_DIR/rhodecode-vcsserver |
|
4282 | mv $SOURCE_DIR/*rhodecode-vcsserver-* $SOURCE_DIR/rhodecode-vcsserver | |
4275 | rm -rf $SOURCE_DIR/rhodecode-vcsserver/.hg |
|
4283 | rm -rf $SOURCE_DIR/rhodecode-vcsserver/.hg | |
4276 |
|
4284 | |||
4277 | rm -rf $SOURCE_DIR/rhodecode-enterprise-ce && \ |
|
4285 | rm -rf $SOURCE_DIR/rhodecode-enterprise-ce && \ | |
4278 | mv $SOURCE_DIR/*rhodecode-enterprise-ce-* $SOURCE_DIR/rhodecode-enterprise-ce |
|
4286 | mv $SOURCE_DIR/*rhodecode-enterprise-ce-* $SOURCE_DIR/rhodecode-enterprise-ce | |
4279 | rm -rf $SOURCE_DIR/rhodecode-enterprise-ce/.hg |
|
4287 | rm -rf $SOURCE_DIR/rhodecode-enterprise-ce/.hg | |
4280 |
|
4288 | |||
4281 | rm -rf $SOURCE_DIR/rhodecode-enterprise-ee && \ |
|
4289 | rm -rf $SOURCE_DIR/rhodecode-enterprise-ee && \ | |
4282 | mv $SOURCE_DIR/*rhodecode-enterprise-ee-* $SOURCE_DIR/rhodecode-enterprise-ee |
|
4290 | mv $SOURCE_DIR/*rhodecode-enterprise-ee-* $SOURCE_DIR/rhodecode-enterprise-ee | |
4283 | rm -rf $SOURCE_DIR/rhodecode-enterprise-ee/.hg |
|
4291 | rm -rf $SOURCE_DIR/rhodecode-enterprise-ee/.hg | |
4284 |
|
4292 | |||
4285 | echo "downloading sources done to $SOURCE_DIR, directory now consists:" |
|
4293 | echo "downloading sources done to $SOURCE_DIR, directory now consists:" | |
4286 | ls -l $SOURCE_DIR |
|
4294 | ls -l $SOURCE_DIR | |
4287 |
|
4295 | |||
4288 | echo "" |
|
4296 | echo "" | |
4289 | date_formatted=$(date +%Y.%m.%d.1) |
|
4297 | date_formatted=$(date +%Y.%m.%d.1) | |
4290 | echo "to create source based build run:" |
|
4298 | echo "to create source based build run:" | |
4291 | echo " ./$RC_SCRIPT_NAME build-source --version-name 4.28.0.REL.$date_formatted --tag edge" |
|
4299 | echo " ./$RC_SCRIPT_NAME build-source --version-name 4.28.0.REL.$date_formatted --tag edge" | |
4292 |
|
4300 | |||
4293 | } |
|
4301 | } | |
4294 |
|
4302 | |||
4295 | # :command.function |
|
4303 | # :command.function | |
4296 | rcstack_build_source_command() { |
|
4304 | rcstack_build_source_command() { | |
4297 | # src/build_source_command.sh |
|
4305 | # src/build_source_command.sh | |
4298 | check_bootstrap |
|
4306 | check_bootstrap | |
4299 |
|
4307 | |||
4300 | rc_version=${args[--version-name]} |
|
4308 | rc_version=${args[--version-name]} | |
4301 | source_build_yaml=${args[--source-build-yaml]} |
|
4309 | source_build_yaml=${args[--source-build-yaml]} | |
4302 |
|
4310 | |||
4303 | eval "tags_data=(${args[--tag]})" |
|
4311 | eval "tags_data=(${args[--tag]})" | |
4304 |
|
4312 | |||
4305 | export RC_VERSION=$rc_version |
|
4313 | export RC_VERSION=$rc_version | |
4306 | export RC_EDITION=ee |
|
4314 | export RC_EDITION=ee | |
4307 | echo "build_source: SOURCE BASED BUILDING: $rc_version" |
|
4315 | echo "build_source: SOURCE BASED BUILDING: $rc_version" | |
4308 | echo "" |
|
4316 | echo "" | |
4309 |
|
4317 | |||
4310 | DOCKER_SCAN_SUGGEST=false RC_VERSION=$rc_version ./$RC_SCRIPT_NAME stack rhodecode -f $source_build_yaml build --progress plain rhodecode |
|
4318 | DOCKER_SCAN_SUGGEST=false RC_VERSION=$rc_version ./$RC_SCRIPT_NAME stack rhodecode -f $source_build_yaml build --progress plain rhodecode | |
4311 |
|
4319 | |||
4312 | # now tag the ee to ce |
|
4320 | # now tag the ee to ce | |
4313 | docker tag rhodecode/rhodecode-ee:$rc_version rhodecode/rhodecode-ce:$rc_version |
|
4321 | docker tag rhodecode/rhodecode-ee:$rc_version rhodecode/rhodecode-ce:$rc_version | |
4314 |
|
4322 | |||
4315 | # apply the tags |
|
4323 | # apply the tags | |
4316 | for tag in "${tags_data[@]}"; do |
|
4324 | for tag in "${tags_data[@]}"; do | |
4317 | echo "build_source: creating tag:$tag" |
|
4325 | echo "build_source: creating tag:$tag" | |
4318 | docker tag rhodecode/rhodecode-ee:$rc_version rhodecode/rhodecode-ee:$tag |
|
4326 | docker tag rhodecode/rhodecode-ee:$rc_version rhodecode/rhodecode-ee:$tag | |
4319 | docker tag rhodecode/rhodecode-ee:$rc_version rhodecode/rhodecode-ce:$tag |
|
4327 | docker tag rhodecode/rhodecode-ee:$rc_version rhodecode/rhodecode-ce:$tag | |
4320 | done |
|
4328 | done | |
4321 |
|
4329 | |||
4322 | echo "build_source: consider setting release version using" |
|
4330 | echo "build_source: consider setting release version using" | |
4323 | echo " ./$RC_SCRIPT_NAME cli set-runtime-image $rc_version" |
|
4331 | echo " ./$RC_SCRIPT_NAME cli set-runtime-image $rc_version" | |
4324 |
|
4332 | |||
4325 | echo "build_source: push this image using" |
|
4333 | echo "build_source: push this image using" | |
4326 | echo " docker push rhodecode/rhodecode-ee:$rc_version" |
|
4334 | echo " docker push rhodecode/rhodecode-ee:$rc_version" | |
4327 | echo " docker push rhodecode/rhodecode-ce:$rc_version" |
|
4335 | echo " docker push rhodecode/rhodecode-ce:$rc_version" | |
4328 |
|
4336 | |||
4329 | for tag in "${tags_data[@]}"; do |
|
4337 | for tag in "${tags_data[@]}"; do | |
4330 | echo " docker push rhodecode/rhodecode-ee:$tag" |
|
4338 | echo " docker push rhodecode/rhodecode-ee:$tag" | |
4331 | echo " docker push rhodecode/rhodecode-ce:$tag" |
|
4339 | echo " docker push rhodecode/rhodecode-ce:$tag" | |
4332 | done |
|
4340 | done | |
4333 | } |
|
4341 | } | |
4334 |
|
4342 | |||
4335 | # :command.function |
|
4343 | # :command.function | |
4336 | rcstack__completions_command() { |
|
4344 | rcstack__completions_command() { | |
4337 | # src/_completions_command.sh |
|
4345 | # src/_completions_command.sh | |
4338 | send_completions |
|
4346 | send_completions | |
4339 | } |
|
4347 | } | |
4340 |
|
4348 | |||
4341 | # :command.parse_requirements |
|
4349 | # :command.parse_requirements | |
4342 | parse_requirements() { |
|
4350 | parse_requirements() { | |
4343 | # :command.fixed_flags_filter |
|
4351 | # :command.fixed_flags_filter | |
4344 | while [[ $# -gt 0 ]]; do |
|
4352 | while [[ $# -gt 0 ]]; do | |
4345 | case "${1:-}" in |
|
4353 | case "${1:-}" in | |
4346 | --version | -v) |
|
4354 | --version | -v) | |
4347 | version_command |
|
4355 | version_command | |
4348 | exit |
|
4356 | exit | |
4349 | ;; |
|
4357 | ;; | |
4350 |
|
4358 | |||
4351 | --help | -h) |
|
4359 | --help | -h) | |
4352 | long_usage=yes |
|
4360 | long_usage=yes | |
4353 | rcstack_usage |
|
4361 | rcstack_usage | |
4354 | exit |
|
4362 | exit | |
4355 | ;; |
|
4363 | ;; | |
4356 |
|
4364 | |||
4357 | # :flag.case |
|
4365 | # :flag.case | |
4358 | --debug) |
|
4366 | --debug) | |
4359 |
|
4367 | |||
4360 | # :flag.case_no_arg |
|
4368 | # :flag.case_no_arg | |
4361 | args['--debug']=1 |
|
4369 | args['--debug']=1 | |
4362 | shift |
|
4370 | shift | |
4363 | ;; |
|
4371 | ;; | |
4364 |
|
4372 | |||
4365 | # :flag.case |
|
4373 | # :flag.case | |
4366 | --no-init-check) |
|
4374 | --no-init-check) | |
4367 |
|
4375 | |||
4368 | # :flag.case_no_arg |
|
4376 | # :flag.case_no_arg | |
4369 | args['--no-init-check']=1 |
|
4377 | args['--no-init-check']=1 | |
4370 | shift |
|
4378 | shift | |
4371 | ;; |
|
4379 | ;; | |
4372 |
|
4380 | |||
4373 | *) |
|
4381 | *) | |
4374 | break |
|
4382 | break | |
4375 | ;; |
|
4383 | ;; | |
4376 |
|
4384 | |||
4377 | esac |
|
4385 | esac | |
4378 | done |
|
4386 | done | |
4379 |
|
4387 | |||
4380 | # :command.environment_variables_filter |
|
4388 | # :command.environment_variables_filter | |
4381 | # :command.environment_variables_default |
|
4389 | # :command.environment_variables_default | |
4382 | export RCC_CONFIG="${RCC_CONFIG:-.rcstack.ini}" |
|
4390 | export RCC_CONFIG="${RCC_CONFIG:-.rcstack.ini}" | |
4383 | export RC_STACK_ROUTER_EXT="${RC_STACK_ROUTER_EXT:-.custom/docker-compose-router.override.yaml}" |
|
4391 | export RC_STACK_ROUTER_EXT="${RC_STACK_ROUTER_EXT:-.custom/docker-compose-router.override.yaml}" | |
4384 | export RC_STACK_METRICS_EXT="${RC_STACK_METRICS_EXT:-.custom/docker-compose-metrics.override.yaml}" |
|
4392 | export RC_STACK_METRICS_EXT="${RC_STACK_METRICS_EXT:-.custom/docker-compose-metrics.override.yaml}" | |
4385 | export RC_STACK_SERVICES_EXT="${RC_STACK_SERVICES_EXT:-.custom/docker-compose-services.override.yaml}" |
|
4393 | export RC_STACK_SERVICES_EXT="${RC_STACK_SERVICES_EXT:-.custom/docker-compose-services.override.yaml}" | |
4386 | export RC_STACK_RHODECODE_EXT="${RC_STACK_RHODECODE_EXT:-.custom/docker-compose-apps.override.yaml}" |
|
4394 | export RC_STACK_RHODECODE_EXT="${RC_STACK_RHODECODE_EXT:-.custom/docker-compose-apps.override.yaml}" | |
4387 |
|
4395 | |||
4388 | # :command.command_filter |
|
4396 | # :command.command_filter | |
4389 | action=${1:-} |
|
4397 | action=${1:-} | |
4390 |
|
4398 | |||
4391 | case $action in |
|
4399 | case $action in | |
4392 | -*) ;; |
|
4400 | -*) ;; | |
4393 |
|
4401 | |||
4394 | get-started) |
|
4402 | get-started) | |
4395 | action="get-started" |
|
4403 | action="get-started" | |
4396 | shift |
|
4404 | shift | |
4397 | rcstack_get_started_parse_requirements "$@" |
|
4405 | rcstack_get_started_parse_requirements "$@" | |
4398 | shift $# |
|
4406 | shift $# | |
4399 | ;; |
|
4407 | ;; | |
4400 |
|
4408 | |||
4401 | init) |
|
4409 | init) | |
4402 | action="init" |
|
4410 | action="init" | |
4403 | shift |
|
4411 | shift | |
4404 | rcstack_init_parse_requirements "$@" |
|
4412 | rcstack_init_parse_requirements "$@" | |
4405 | shift $# |
|
4413 | shift $# | |
4406 | ;; |
|
4414 | ;; | |
4407 |
|
4415 | |||
4408 | self-update) |
|
4416 | self-update) | |
4409 | action="self-update" |
|
4417 | action="self-update" | |
4410 | shift |
|
4418 | shift | |
4411 | rcstack_self_update_parse_requirements "$@" |
|
4419 | rcstack_self_update_parse_requirements "$@" | |
4412 | shift $# |
|
4420 | shift $# | |
4413 | ;; |
|
4421 | ;; | |
4414 |
|
4422 | |||
4415 | stack) |
|
4423 | stack) | |
4416 | action="stack" |
|
4424 | action="stack" | |
4417 | shift |
|
4425 | shift | |
4418 | rcstack_stack_parse_requirements "$@" |
|
4426 | rcstack_stack_parse_requirements "$@" | |
4419 | shift $# |
|
4427 | shift $# | |
4420 | ;; |
|
4428 | ;; | |
4421 |
|
4429 | |||
4422 | stack-status | status) |
|
4430 | stack-status | status) | |
4423 | action="stack-status" |
|
4431 | action="stack-status" | |
4424 | shift |
|
4432 | shift | |
4425 | rcstack_stack_status_parse_requirements "$@" |
|
4433 | rcstack_stack_status_parse_requirements "$@" | |
4426 | shift $# |
|
4434 | shift $# | |
4427 | ;; |
|
4435 | ;; | |
4428 |
|
4436 | |||
4429 | stack-upgrade) |
|
4437 | stack-upgrade) | |
4430 | action="stack-upgrade" |
|
4438 | action="stack-upgrade" | |
4431 | shift |
|
4439 | shift | |
4432 | rcstack_stack_upgrade_parse_requirements "$@" |
|
4440 | rcstack_stack_upgrade_parse_requirements "$@" | |
4433 | shift $# |
|
4441 | shift $# | |
4434 | ;; |
|
4442 | ;; | |
4435 |
|
4443 | |||
4436 | stack-monitor) |
|
4444 | stack-monitor) | |
4437 | action="stack-monitor" |
|
4445 | action="stack-monitor" | |
4438 | shift |
|
4446 | shift | |
4439 | rcstack_stack_monitor_parse_requirements "$@" |
|
4447 | rcstack_stack_monitor_parse_requirements "$@" | |
4440 | shift $# |
|
4448 | shift $# | |
4441 | ;; |
|
4449 | ;; | |
4442 |
|
4450 | |||
4443 | cli) |
|
4451 | cli) | |
4444 | action="cli" |
|
4452 | action="cli" | |
4445 | shift |
|
4453 | shift | |
4446 | rcstack_cli_parse_requirements "$@" |
|
4454 | rcstack_cli_parse_requirements "$@" | |
4447 | shift $# |
|
4455 | shift $# | |
4448 | ;; |
|
4456 | ;; | |
4449 |
|
4457 | |||
4450 | backup-db) |
|
4458 | backup-db) | |
4451 | action="backup-db" |
|
4459 | action="backup-db" | |
4452 | shift |
|
4460 | shift | |
4453 | rcstack_backup_db_parse_requirements "$@" |
|
4461 | rcstack_backup_db_parse_requirements "$@" | |
4454 | shift $# |
|
4462 | shift $# | |
4455 | ;; |
|
4463 | ;; | |
4456 |
|
4464 | |||
4457 | backup-data) |
|
4465 | backup-data) | |
4458 | action="backup-data" |
|
4466 | action="backup-data" | |
4459 | shift |
|
4467 | shift | |
4460 | rcstack_backup_data_parse_requirements "$@" |
|
4468 | rcstack_backup_data_parse_requirements "$@" | |
4461 | shift $# |
|
4469 | shift $# | |
4462 | ;; |
|
4470 | ;; | |
4463 |
|
4471 | |||
4464 | get-build-artifacts) |
|
4472 | get-build-artifacts) | |
4465 | action="get-build-artifacts" |
|
4473 | action="get-build-artifacts" | |
4466 | shift |
|
4474 | shift | |
4467 | rcstack_get_build_artifacts_parse_requirements "$@" |
|
4475 | rcstack_get_build_artifacts_parse_requirements "$@" | |
4468 | shift $# |
|
4476 | shift $# | |
4469 | ;; |
|
4477 | ;; | |
4470 |
|
4478 | |||
4471 | build-installer) |
|
4479 | build-installer) | |
4472 | action="build-installer" |
|
4480 | action="build-installer" | |
4473 | shift |
|
4481 | shift | |
4474 | rcstack_build_installer_parse_requirements "$@" |
|
4482 | rcstack_build_installer_parse_requirements "$@" | |
4475 | shift $# |
|
4483 | shift $# | |
4476 | ;; |
|
4484 | ;; | |
4477 |
|
4485 | |||
4478 | get-build-source) |
|
4486 | get-build-source) | |
4479 | action="get-build-source" |
|
4487 | action="get-build-source" | |
4480 | shift |
|
4488 | shift | |
4481 | rcstack_get_build_source_parse_requirements "$@" |
|
4489 | rcstack_get_build_source_parse_requirements "$@" | |
4482 | shift $# |
|
4490 | shift $# | |
4483 | ;; |
|
4491 | ;; | |
4484 |
|
4492 | |||
4485 | build-source) |
|
4493 | build-source) | |
4486 | action="build-source" |
|
4494 | action="build-source" | |
4487 | shift |
|
4495 | shift | |
4488 | rcstack_build_source_parse_requirements "$@" |
|
4496 | rcstack_build_source_parse_requirements "$@" | |
4489 | shift $# |
|
4497 | shift $# | |
4490 | ;; |
|
4498 | ;; | |
4491 |
|
4499 | |||
4492 | _completions) |
|
4500 | _completions) | |
4493 | action="_completions" |
|
4501 | action="_completions" | |
4494 | shift |
|
4502 | shift | |
4495 | rcstack__completions_parse_requirements "$@" |
|
4503 | rcstack__completions_parse_requirements "$@" | |
4496 | shift $# |
|
4504 | shift $# | |
4497 | ;; |
|
4505 | ;; | |
4498 |
|
4506 | |||
4499 | # :command.command_fallback |
|
4507 | # :command.command_fallback | |
4500 | "") |
|
4508 | "") | |
4501 | rcstack_usage >&2 |
|
4509 | rcstack_usage >&2 | |
4502 | exit 1 |
|
4510 | exit 1 | |
4503 | ;; |
|
4511 | ;; | |
4504 |
|
4512 | |||
4505 | *) |
|
4513 | *) | |
4506 | printf "invalid command: %s\n" "$action" >&2 |
|
4514 | printf "invalid command: %s\n" "$action" >&2 | |
4507 | exit 1 |
|
4515 | exit 1 | |
4508 | ;; |
|
4516 | ;; | |
4509 |
|
4517 | |||
4510 | esac |
|
4518 | esac | |
4511 |
|
4519 | |||
4512 | # :command.parse_requirements_while |
|
4520 | # :command.parse_requirements_while | |
4513 | while [[ $# -gt 0 ]]; do |
|
4521 | while [[ $# -gt 0 ]]; do | |
4514 | key="$1" |
|
4522 | key="$1" | |
4515 | case "$key" in |
|
4523 | case "$key" in | |
4516 |
|
4524 | |||
4517 | -?*) |
|
4525 | -?*) | |
4518 | printf "invalid option: %s\n" "$key" >&2 |
|
4526 | printf "invalid option: %s\n" "$key" >&2 | |
4519 | exit 1 |
|
4527 | exit 1 | |
4520 | ;; |
|
4528 | ;; | |
4521 |
|
4529 | |||
4522 | *) |
|
4530 | *) | |
4523 | # :command.parse_requirements_case |
|
4531 | # :command.parse_requirements_case | |
4524 | # :command.parse_requirements_case_simple |
|
4532 | # :command.parse_requirements_case_simple | |
4525 | printf "invalid argument: %s\n" "$key" >&2 |
|
4533 | printf "invalid argument: %s\n" "$key" >&2 | |
4526 | exit 1 |
|
4534 | exit 1 | |
4527 |
|
4535 | |||
4528 | ;; |
|
4536 | ;; | |
4529 |
|
4537 | |||
4530 | esac |
|
4538 | esac | |
4531 | done |
|
4539 | done | |
4532 |
|
4540 | |||
4533 | } |
|
4541 | } | |
4534 |
|
4542 | |||
4535 | # :command.parse_requirements |
|
4543 | # :command.parse_requirements | |
4536 | rcstack_get_started_parse_requirements() { |
|
4544 | rcstack_get_started_parse_requirements() { | |
4537 | # :command.fixed_flags_filter |
|
4545 | # :command.fixed_flags_filter | |
4538 | while [[ $# -gt 0 ]]; do |
|
4546 | while [[ $# -gt 0 ]]; do | |
4539 | case "${1:-}" in |
|
4547 | case "${1:-}" in | |
4540 | --help | -h) |
|
4548 | --help | -h) | |
4541 | long_usage=yes |
|
4549 | long_usage=yes | |
4542 | rcstack_get_started_usage |
|
4550 | rcstack_get_started_usage | |
4543 | exit |
|
4551 | exit | |
4544 | ;; |
|
4552 | ;; | |
4545 |
|
4553 | |||
4546 | *) |
|
4554 | *) | |
4547 | break |
|
4555 | break | |
4548 | ;; |
|
4556 | ;; | |
4549 |
|
4557 | |||
4550 | esac |
|
4558 | esac | |
4551 | done |
|
4559 | done | |
4552 |
|
4560 | |||
4553 | # :command.command_filter |
|
4561 | # :command.command_filter | |
4554 | action="get-started" |
|
4562 | action="get-started" | |
4555 |
|
4563 | |||
4556 | # :command.parse_requirements_while |
|
4564 | # :command.parse_requirements_while | |
4557 | while [[ $# -gt 0 ]]; do |
|
4565 | while [[ $# -gt 0 ]]; do | |
4558 | key="$1" |
|
4566 | key="$1" | |
4559 | case "$key" in |
|
4567 | case "$key" in | |
4560 |
|
4568 | |||
4561 | -?*) |
|
4569 | -?*) | |
4562 | printf "invalid option: %s\n" "$key" >&2 |
|
4570 | printf "invalid option: %s\n" "$key" >&2 | |
4563 | exit 1 |
|
4571 | exit 1 | |
4564 | ;; |
|
4572 | ;; | |
4565 |
|
4573 | |||
4566 | *) |
|
4574 | *) | |
4567 | # :command.parse_requirements_case |
|
4575 | # :command.parse_requirements_case | |
4568 | # :command.parse_requirements_case_simple |
|
4576 | # :command.parse_requirements_case_simple | |
4569 | printf "invalid argument: %s\n" "$key" >&2 |
|
4577 | printf "invalid argument: %s\n" "$key" >&2 | |
4570 | exit 1 |
|
4578 | exit 1 | |
4571 |
|
4579 | |||
4572 | ;; |
|
4580 | ;; | |
4573 |
|
4581 | |||
4574 | esac |
|
4582 | esac | |
4575 | done |
|
4583 | done | |
4576 |
|
4584 | |||
4577 | } |
|
4585 | } | |
4578 |
|
4586 | |||
4579 | # :command.parse_requirements |
|
4587 | # :command.parse_requirements | |
4580 | rcstack_init_parse_requirements() { |
|
4588 | rcstack_init_parse_requirements() { | |
4581 | # :command.fixed_flags_filter |
|
4589 | # :command.fixed_flags_filter | |
4582 | while [[ $# -gt 0 ]]; do |
|
4590 | while [[ $# -gt 0 ]]; do | |
4583 | case "${1:-}" in |
|
4591 | case "${1:-}" in | |
4584 | --help | -h) |
|
4592 | --help | -h) | |
4585 | long_usage=yes |
|
4593 | long_usage=yes | |
4586 | rcstack_init_usage |
|
4594 | rcstack_init_usage | |
4587 | exit |
|
4595 | exit | |
4588 | ;; |
|
4596 | ;; | |
4589 |
|
4597 | |||
4590 | *) |
|
4598 | *) | |
4591 | break |
|
4599 | break | |
4592 | ;; |
|
4600 | ;; | |
4593 |
|
4601 | |||
4594 | esac |
|
4602 | esac | |
4595 | done |
|
4603 | done | |
4596 |
|
4604 | |||
4597 | # :command.dependencies_filter |
|
4605 | # :command.dependencies_filter | |
4598 | if command -v curl >/dev/null 2>&1; then |
|
4606 | if command -v curl >/dev/null 2>&1; then | |
4599 | deps['curl']="$(command -v curl | head -n1)" |
|
4607 | deps['curl']="$(command -v curl | head -n1)" | |
4600 | else |
|
4608 | else | |
4601 | printf "missing dependency: curl\n" >&2 |
|
4609 | printf "missing dependency: curl\n" >&2 | |
4602 | exit 1 |
|
4610 | exit 1 | |
4603 | fi |
|
4611 | fi | |
4604 |
|
4612 | |||
4605 | if command -v tar >/dev/null 2>&1; then |
|
4613 | if command -v tar >/dev/null 2>&1; then | |
4606 | deps['tar']="$(command -v tar | head -n1)" |
|
4614 | deps['tar']="$(command -v tar | head -n1)" | |
4607 | else |
|
4615 | else | |
4608 | printf "missing dependency: tar\n" >&2 |
|
4616 | printf "missing dependency: tar\n" >&2 | |
4609 | exit 1 |
|
4617 | exit 1 | |
4610 | fi |
|
4618 | fi | |
4611 |
|
4619 | |||
4612 | if command -v find >/dev/null 2>&1; then |
|
4620 | if command -v find >/dev/null 2>&1; then | |
4613 | deps['find']="$(command -v find | head -n1)" |
|
4621 | deps['find']="$(command -v find | head -n1)" | |
4614 | else |
|
4622 | else | |
4615 | printf "missing dependency: find\n" >&2 |
|
4623 | printf "missing dependency: find\n" >&2 | |
4616 | exit 1 |
|
4624 | exit 1 | |
4617 | fi |
|
4625 | fi | |
4618 |
|
4626 | |||
4619 | # :command.command_filter |
|
4627 | # :command.command_filter | |
4620 | action="init" |
|
4628 | action="init" | |
4621 |
|
4629 | |||
4622 | # :command.parse_requirements_while |
|
4630 | # :command.parse_requirements_while | |
4623 | while [[ $# -gt 0 ]]; do |
|
4631 | while [[ $# -gt 0 ]]; do | |
4624 | key="$1" |
|
4632 | key="$1" | |
4625 | case "$key" in |
|
4633 | case "$key" in | |
4626 | # :flag.case |
|
4634 | # :flag.case | |
4627 | --arg-rc-edition) |
|
4635 | --arg-rc-edition) | |
4628 |
|
4636 | |||
4629 | # :flag.case_arg |
|
4637 | # :flag.case_arg | |
4630 | if [[ -n ${2+x} ]]; then |
|
4638 | if [[ -n ${2+x} ]]; then | |
4631 |
|
4639 | |||
4632 | args['--arg-rc-edition']="$2" |
|
4640 | args['--arg-rc-edition']="$2" | |
4633 | shift |
|
4641 | shift | |
4634 | shift |
|
4642 | shift | |
4635 | else |
|
4643 | else | |
4636 | printf "%s\n" "--arg-rc-edition requires an argument: --arg-rc-edition ARG_RC_EDITION" >&2 |
|
4644 | printf "%s\n" "--arg-rc-edition requires an argument: --arg-rc-edition ARG_RC_EDITION" >&2 | |
4637 | exit 1 |
|
4645 | exit 1 | |
4638 | fi |
|
4646 | fi | |
4639 | ;; |
|
4647 | ;; | |
4640 |
|
4648 | |||
4641 | # :flag.case |
|
4649 | # :flag.case | |
4642 | --arg-hostname) |
|
4650 | --arg-hostname) | |
4643 |
|
4651 | |||
4644 | # :flag.case_arg |
|
4652 | # :flag.case_arg | |
4645 | if [[ -n ${2+x} ]]; then |
|
4653 | if [[ -n ${2+x} ]]; then | |
4646 |
|
4654 | |||
4647 | args['--arg-hostname']="$2" |
|
4655 | args['--arg-hostname']="$2" | |
4648 | shift |
|
4656 | shift | |
4649 | shift |
|
4657 | shift | |
4650 | else |
|
4658 | else | |
4651 | printf "%s\n" "--arg-hostname requires an argument: --arg-hostname ARG_HOSTNAME" >&2 |
|
4659 | printf "%s\n" "--arg-hostname requires an argument: --arg-hostname ARG_HOSTNAME" >&2 | |
4652 | exit 1 |
|
4660 | exit 1 | |
4653 | fi |
|
4661 | fi | |
4654 | ;; |
|
4662 | ;; | |
4655 |
|
4663 | |||
4656 | # :flag.case |
|
4664 | # :flag.case | |
4657 | --arg-use-ssl) |
|
4665 | --arg-use-ssl) | |
4658 |
|
4666 | |||
4659 | # :flag.case_arg |
|
4667 | # :flag.case_arg | |
4660 | if [[ -n ${2+x} ]]; then |
|
4668 | if [[ -n ${2+x} ]]; then | |
4661 |
|
4669 | |||
4662 | args['--arg-use-ssl']="$2" |
|
4670 | args['--arg-use-ssl']="$2" | |
4663 | shift |
|
4671 | shift | |
4664 | shift |
|
4672 | shift | |
4665 | else |
|
4673 | else | |
4666 | printf "%s\n" "--arg-use-ssl requires an argument: --arg-use-ssl ARG_USE_SSL" >&2 |
|
4674 | printf "%s\n" "--arg-use-ssl requires an argument: --arg-use-ssl ARG_USE_SSL" >&2 | |
4667 | exit 1 |
|
4675 | exit 1 | |
4668 | fi |
|
4676 | fi | |
4669 | ;; |
|
4677 | ;; | |
4670 |
|
4678 | |||
4671 | # :flag.case |
|
4679 | # :flag.case | |
4672 | --arg-admin-email) |
|
4680 | --arg-admin-email) | |
4673 |
|
4681 | |||
4674 | # :flag.case_arg |
|
4682 | # :flag.case_arg | |
4675 | if [[ -n ${2+x} ]]; then |
|
4683 | if [[ -n ${2+x} ]]; then | |
4676 |
|
4684 | |||
4677 | args['--arg-admin-email']="$2" |
|
4685 | args['--arg-admin-email']="$2" | |
4678 | shift |
|
4686 | shift | |
4679 | shift |
|
4687 | shift | |
4680 | else |
|
4688 | else | |
4681 | printf "%s\n" "--arg-admin-email requires an argument: --arg-admin-email ARG_ADMIN_EMAIL" >&2 |
|
4689 | printf "%s\n" "--arg-admin-email requires an argument: --arg-admin-email ARG_ADMIN_EMAIL" >&2 | |
4682 | exit 1 |
|
4690 | exit 1 | |
4683 | fi |
|
4691 | fi | |
4684 | ;; |
|
4692 | ;; | |
4685 |
|
4693 | |||
4686 | # :flag.case |
|
4694 | # :flag.case | |
4687 | --arg-admin-user) |
|
4695 | --arg-admin-user) | |
4688 |
|
4696 | |||
4689 | # :flag.case_arg |
|
4697 | # :flag.case_arg | |
4690 | if [[ -n ${2+x} ]]; then |
|
4698 | if [[ -n ${2+x} ]]; then | |
4691 |
|
4699 | |||
4692 | args['--arg-admin-user']="$2" |
|
4700 | args['--arg-admin-user']="$2" | |
4693 | shift |
|
4701 | shift | |
4694 | shift |
|
4702 | shift | |
4695 | else |
|
4703 | else | |
4696 | printf "%s\n" "--arg-admin-user requires an argument: --arg-admin-user ARG_ADMIN_USER" >&2 |
|
4704 | printf "%s\n" "--arg-admin-user requires an argument: --arg-admin-user ARG_ADMIN_USER" >&2 | |
4697 | exit 1 |
|
4705 | exit 1 | |
4698 | fi |
|
4706 | fi | |
4699 | ;; |
|
4707 | ;; | |
4700 |
|
4708 | |||
4701 | # :flag.case |
|
4709 | # :flag.case | |
4702 | --arg-admin-pass) |
|
4710 | --arg-admin-pass) | |
4703 |
|
4711 | |||
4704 | # :flag.case_arg |
|
4712 | # :flag.case_arg | |
4705 | if [[ -n ${2+x} ]]; then |
|
4713 | if [[ -n ${2+x} ]]; then | |
4706 |
|
4714 | |||
4707 | args['--arg-admin-pass']="$2" |
|
4715 | args['--arg-admin-pass']="$2" | |
4708 | shift |
|
4716 | shift | |
4709 | shift |
|
4717 | shift | |
4710 | else |
|
4718 | else | |
4711 | printf "%s\n" "--arg-admin-pass requires an argument: --arg-admin-pass ARG_ADMIN_PASS" >&2 |
|
4719 | printf "%s\n" "--arg-admin-pass requires an argument: --arg-admin-pass ARG_ADMIN_PASS" >&2 | |
4712 | exit 1 |
|
4720 | exit 1 | |
4713 | fi |
|
4721 | fi | |
4714 | ;; |
|
4722 | ;; | |
4715 |
|
4723 | |||
4716 | # :flag.case |
|
4724 | # :flag.case | |
4717 | --arg-license-token) |
|
4725 | --arg-license-token) | |
4718 |
|
4726 | |||
4719 | # :flag.case_arg |
|
4727 | # :flag.case_arg | |
4720 | if [[ -n ${2+x} ]]; then |
|
4728 | if [[ -n ${2+x} ]]; then | |
4721 |
|
4729 | |||
4722 | args['--arg-license-token']="$2" |
|
4730 | args['--arg-license-token']="$2" | |
4723 | shift |
|
4731 | shift | |
4724 | shift |
|
4732 | shift | |
4725 | else |
|
4733 | else | |
4726 | printf "%s\n" "--arg-license-token requires an argument: --arg-license-token ARG_ADMIN_TOKEN" >&2 |
|
4734 | printf "%s\n" "--arg-license-token requires an argument: --arg-license-token ARG_ADMIN_TOKEN" >&2 | |
4727 | exit 1 |
|
4735 | exit 1 | |
4728 | fi |
|
4736 | fi | |
4729 | ;; |
|
4737 | ;; | |
4730 |
|
4738 | |||
4731 | # :flag.case |
|
4739 | # :flag.case | |
4732 | --no-prompt) |
|
4740 | --no-prompt) | |
4733 |
|
4741 | |||
4734 | # :flag.case_no_arg |
|
4742 | # :flag.case_no_arg | |
4735 | args['--no-prompt']=1 |
|
4743 | args['--no-prompt']=1 | |
4736 | shift |
|
4744 | shift | |
4737 | ;; |
|
4745 | ;; | |
4738 |
|
4746 | |||
4739 | # :flag.case |
|
4747 | # :flag.case | |
4740 | --force | -f) |
|
4748 | --force | -f) | |
4741 |
|
4749 | |||
4742 | # :flag.case_no_arg |
|
4750 | # :flag.case_no_arg | |
4743 | args['--force']=1 |
|
4751 | args['--force']=1 | |
4744 | shift |
|
4752 | shift | |
4745 | ;; |
|
4753 | ;; | |
4746 |
|
4754 | |||
4747 | # :flag.case |
|
4755 | # :flag.case | |
4748 | --stage) |
|
4756 | --stage) | |
4749 |
|
4757 | |||
4750 | # :flag.case_arg |
|
4758 | # :flag.case_arg | |
4751 | if [[ -n ${2+x} ]]; then |
|
4759 | if [[ -n ${2+x} ]]; then | |
4752 |
|
4760 | |||
4753 | if [[ -z ${args['--stage']+x} ]]; then |
|
4761 | if [[ -z ${args['--stage']+x} ]]; then | |
4754 | args['--stage']="\"$2\"" |
|
4762 | args['--stage']="\"$2\"" | |
4755 | else |
|
4763 | else | |
4756 | args['--stage']="${args[--stage]} \"$2\"" |
|
4764 | args['--stage']="${args[--stage]} \"$2\"" | |
4757 | fi |
|
4765 | fi | |
4758 | shift |
|
4766 | shift | |
4759 | shift |
|
4767 | shift | |
4760 | else |
|
4768 | else | |
4761 | printf "%s\n" "--stage requires an argument: --stage STAGE" >&2 |
|
4769 | printf "%s\n" "--stage requires an argument: --stage STAGE" >&2 | |
4762 | exit 1 |
|
4770 | exit 1 | |
4763 | fi |
|
4771 | fi | |
4764 | ;; |
|
4772 | ;; | |
4765 |
|
4773 | |||
4766 | # :flag.case |
|
4774 | # :flag.case | |
4767 | --docker-revision) |
|
4775 | --docker-revision) | |
4768 |
|
4776 | |||
4769 | # :flag.case_arg |
|
4777 | # :flag.case_arg | |
4770 | if [[ -n ${2+x} ]]; then |
|
4778 | if [[ -n ${2+x} ]]; then | |
4771 |
|
4779 | |||
4772 | args['--docker-revision']="$2" |
|
4780 | args['--docker-revision']="$2" | |
4773 | shift |
|
4781 | shift | |
4774 | shift |
|
4782 | shift | |
4775 | else |
|
4783 | else | |
4776 | printf "%s\n" "--docker-revision requires an argument: --docker-revision DOCKER_REVISION" >&2 |
|
4784 | printf "%s\n" "--docker-revision requires an argument: --docker-revision DOCKER_REVISION" >&2 | |
4777 | exit 1 |
|
4785 | exit 1 | |
4778 | fi |
|
4786 | fi | |
4779 | ;; |
|
4787 | ;; | |
4780 |
|
4788 | |||
4781 | # :flag.case |
|
4789 | # :flag.case | |
4782 | --install-docker) |
|
4790 | --install-docker) | |
4783 |
|
4791 | |||
4784 | # :flag.case_arg |
|
4792 | # :flag.case_arg | |
4785 | if [[ -n ${2+x} ]]; then |
|
4793 | if [[ -n ${2+x} ]]; then | |
4786 |
|
4794 | |||
4787 | args['--install-docker']="$2" |
|
4795 | args['--install-docker']="$2" | |
4788 | shift |
|
4796 | shift | |
4789 | shift |
|
4797 | shift | |
4790 | else |
|
4798 | else | |
4791 | printf "%s\n" "--install-docker requires an argument: --install-docker INSTALL_DOCKER" >&2 |
|
4799 | printf "%s\n" "--install-docker requires an argument: --install-docker INSTALL_DOCKER" >&2 | |
4792 | exit 1 |
|
4800 | exit 1 | |
4793 | fi |
|
4801 | fi | |
4794 | ;; |
|
4802 | ;; | |
4795 |
|
4803 | |||
4796 | # :flag.case |
|
4804 | # :flag.case | |
4797 | --server-url) |
|
4805 | --server-url) | |
4798 |
|
4806 | |||
4799 | # :flag.case_arg |
|
4807 | # :flag.case_arg | |
4800 | if [[ -n ${2+x} ]]; then |
|
4808 | if [[ -n ${2+x} ]]; then | |
4801 |
|
4809 | |||
4802 | args['--server-url']="$2" |
|
4810 | args['--server-url']="$2" | |
4803 | shift |
|
4811 | shift | |
4804 | shift |
|
4812 | shift | |
4805 | else |
|
4813 | else | |
4806 | printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2 |
|
4814 | printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2 | |
4807 | exit 1 |
|
4815 | exit 1 | |
4808 | fi |
|
4816 | fi | |
4809 | ;; |
|
4817 | ;; | |
4810 |
|
4818 | |||
4811 | # :flag.case |
|
4819 | # :flag.case | |
4812 | --auth-token) |
|
4820 | --auth-token) | |
4813 |
|
4821 | |||
4814 | # :flag.case_arg |
|
4822 | # :flag.case_arg | |
4815 | if [[ -n ${2+x} ]]; then |
|
4823 | if [[ -n ${2+x} ]]; then | |
4816 |
|
4824 | |||
4817 | args['--auth-token']="$2" |
|
4825 | args['--auth-token']="$2" | |
4818 | shift |
|
4826 | shift | |
4819 | shift |
|
4827 | shift | |
4820 | else |
|
4828 | else | |
4821 | printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2 |
|
4829 | printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2 | |
4822 | exit 1 |
|
4830 | exit 1 | |
4823 | fi |
|
4831 | fi | |
4824 | ;; |
|
4832 | ;; | |
4825 |
|
4833 | |||
4826 | -?*) |
|
4834 | -?*) | |
4827 | printf "invalid option: %s\n" "$key" >&2 |
|
4835 | printf "invalid option: %s\n" "$key" >&2 | |
4828 | exit 1 |
|
4836 | exit 1 | |
4829 | ;; |
|
4837 | ;; | |
4830 |
|
4838 | |||
4831 | *) |
|
4839 | *) | |
4832 | # :command.parse_requirements_case |
|
4840 | # :command.parse_requirements_case | |
4833 | # :command.parse_requirements_case_simple |
|
4841 | # :command.parse_requirements_case_simple | |
4834 | printf "invalid argument: %s\n" "$key" >&2 |
|
4842 | printf "invalid argument: %s\n" "$key" >&2 | |
4835 | exit 1 |
|
4843 | exit 1 | |
4836 |
|
4844 | |||
4837 | ;; |
|
4845 | ;; | |
4838 |
|
4846 | |||
4839 | esac |
|
4847 | esac | |
4840 | done |
|
4848 | done | |
4841 |
|
4849 | |||
4842 | # :command.default_assignments |
|
4850 | # :command.default_assignments | |
4843 | [[ -n ${args['--docker-revision']:-} ]] || args['--docker-revision']="stable" |
|
4851 | [[ -n ${args['--docker-revision']:-} ]] || args['--docker-revision']="stable" | |
4844 | [[ -n ${args['--server-url']:-} ]] || args['--server-url']="https://dls.rhodecode.com/get_archive" |
|
4852 | [[ -n ${args['--server-url']:-} ]] || args['--server-url']="https://dls.rhodecode.com/get_archive" | |
4845 |
|
4853 | |||
4846 | } |
|
4854 | } | |
4847 |
|
4855 | |||
4848 | # :command.parse_requirements |
|
4856 | # :command.parse_requirements | |
4849 | rcstack_self_update_parse_requirements() { |
|
4857 | rcstack_self_update_parse_requirements() { | |
4850 | # :command.fixed_flags_filter |
|
4858 | # :command.fixed_flags_filter | |
4851 | while [[ $# -gt 0 ]]; do |
|
4859 | while [[ $# -gt 0 ]]; do | |
4852 | case "${1:-}" in |
|
4860 | case "${1:-}" in | |
4853 | --help | -h) |
|
4861 | --help | -h) | |
4854 | long_usage=yes |
|
4862 | long_usage=yes | |
4855 | rcstack_self_update_usage |
|
4863 | rcstack_self_update_usage | |
4856 | exit |
|
4864 | exit | |
4857 | ;; |
|
4865 | ;; | |
4858 |
|
4866 | |||
4859 | *) |
|
4867 | *) | |
4860 | break |
|
4868 | break | |
4861 | ;; |
|
4869 | ;; | |
4862 |
|
4870 | |||
4863 | esac |
|
4871 | esac | |
4864 | done |
|
4872 | done | |
4865 |
|
4873 | |||
4866 | # :command.dependencies_filter |
|
4874 | # :command.dependencies_filter | |
4867 | if command -v curl >/dev/null 2>&1; then |
|
4875 | if command -v curl >/dev/null 2>&1; then | |
4868 | deps['curl']="$(command -v curl | head -n1)" |
|
4876 | deps['curl']="$(command -v curl | head -n1)" | |
4869 | else |
|
4877 | else | |
4870 | printf "missing dependency: curl\n" >&2 |
|
4878 | printf "missing dependency: curl\n" >&2 | |
4871 | exit 1 |
|
4879 | exit 1 | |
4872 | fi |
|
4880 | fi | |
4873 |
|
4881 | |||
4874 | if command -v tar >/dev/null 2>&1; then |
|
4882 | if command -v tar >/dev/null 2>&1; then | |
4875 | deps['tar']="$(command -v tar | head -n1)" |
|
4883 | deps['tar']="$(command -v tar | head -n1)" | |
4876 | else |
|
4884 | else | |
4877 | printf "missing dependency: tar\n" >&2 |
|
4885 | printf "missing dependency: tar\n" >&2 | |
4878 | exit 1 |
|
4886 | exit 1 | |
4879 | fi |
|
4887 | fi | |
4880 |
|
4888 | |||
4881 | # :command.command_filter |
|
4889 | # :command.command_filter | |
4882 | action="self-update" |
|
4890 | action="self-update" | |
4883 |
|
4891 | |||
4884 | # :command.parse_requirements_while |
|
4892 | # :command.parse_requirements_while | |
4885 | while [[ $# -gt 0 ]]; do |
|
4893 | while [[ $# -gt 0 ]]; do | |
4886 | key="$1" |
|
4894 | key="$1" | |
4887 | case "$key" in |
|
4895 | case "$key" in | |
4888 | # :flag.case |
|
4896 | # :flag.case | |
4889 | --force) |
|
4897 | --force) | |
4890 |
|
4898 | |||
4891 | # :flag.case_no_arg |
|
4899 | # :flag.case_no_arg | |
4892 | args['--force']=1 |
|
4900 | args['--force']=1 | |
4893 | shift |
|
4901 | shift | |
4894 | ;; |
|
4902 | ;; | |
4895 |
|
4903 | |||
4896 | # :flag.case |
|
4904 | # :flag.case | |
4897 | --update-docker-image) |
|
4905 | --update-docker-image) | |
4898 |
|
4906 | |||
4899 | # :flag.case_arg |
|
4907 | # :flag.case_arg | |
4900 | if [[ -n ${2+x} ]]; then |
|
4908 | if [[ -n ${2+x} ]]; then | |
4901 |
|
4909 | |||
4902 | args['--update-docker-image']="$2" |
|
4910 | args['--update-docker-image']="$2" | |
4903 | shift |
|
4911 | shift | |
4904 | shift |
|
4912 | shift | |
4905 | else |
|
4913 | else | |
4906 | printf "%s\n" "--update-docker-image requires an argument: --update-docker-image UPDATE_DOCKER_IMAGE" >&2 |
|
4914 | printf "%s\n" "--update-docker-image requires an argument: --update-docker-image UPDATE_DOCKER_IMAGE" >&2 | |
4907 | exit 1 |
|
4915 | exit 1 | |
4908 | fi |
|
4916 | fi | |
4909 | ;; |
|
4917 | ;; | |
4910 |
|
4918 | |||
4911 | # :flag.case |
|
4919 | # :flag.case | |
4912 | --cli-revision) |
|
4920 | --cli-revision) | |
4913 |
|
4921 | |||
4914 | # :flag.case_arg |
|
4922 | # :flag.case_arg | |
4915 | if [[ -n ${2+x} ]]; then |
|
4923 | if [[ -n ${2+x} ]]; then | |
4916 |
|
4924 | |||
4917 | args['--cli-revision']="$2" |
|
4925 | args['--cli-revision']="$2" | |
4918 | shift |
|
4926 | shift | |
4919 | shift |
|
4927 | shift | |
4920 | else |
|
4928 | else | |
4921 | printf "%s\n" "--cli-revision requires an argument: --cli-revision CLI_REVISION" >&2 |
|
4929 | printf "%s\n" "--cli-revision requires an argument: --cli-revision CLI_REVISION" >&2 | |
4922 | exit 1 |
|
4930 | exit 1 | |
4923 | fi |
|
4931 | fi | |
4924 | ;; |
|
4932 | ;; | |
4925 |
|
4933 | |||
4926 | # :flag.case |
|
4934 | # :flag.case | |
4927 | --docker-revision) |
|
4935 | --docker-revision) | |
4928 |
|
4936 | |||
4929 | # :flag.case_arg |
|
4937 | # :flag.case_arg | |
4930 | if [[ -n ${2+x} ]]; then |
|
4938 | if [[ -n ${2+x} ]]; then | |
4931 |
|
4939 | |||
4932 | args['--docker-revision']="$2" |
|
4940 | args['--docker-revision']="$2" | |
4933 | shift |
|
4941 | shift | |
4934 | shift |
|
4942 | shift | |
4935 | else |
|
4943 | else | |
4936 | printf "%s\n" "--docker-revision requires an argument: --docker-revision DOCKER_REVISION" >&2 |
|
4944 | printf "%s\n" "--docker-revision requires an argument: --docker-revision DOCKER_REVISION" >&2 | |
4937 | exit 1 |
|
4945 | exit 1 | |
4938 | fi |
|
4946 | fi | |
4939 | ;; |
|
4947 | ;; | |
4940 |
|
4948 | |||
4941 | # :flag.case |
|
4949 | # :flag.case | |
4942 | --server-url) |
|
4950 | --server-url) | |
4943 |
|
4951 | |||
4944 | # :flag.case_arg |
|
4952 | # :flag.case_arg | |
4945 | if [[ -n ${2+x} ]]; then |
|
4953 | if [[ -n ${2+x} ]]; then | |
4946 |
|
4954 | |||
4947 | args['--server-url']="$2" |
|
4955 | args['--server-url']="$2" | |
4948 | shift |
|
4956 | shift | |
4949 | shift |
|
4957 | shift | |
4950 | else |
|
4958 | else | |
4951 | printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2 |
|
4959 | printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2 | |
4952 | exit 1 |
|
4960 | exit 1 | |
4953 | fi |
|
4961 | fi | |
4954 | ;; |
|
4962 | ;; | |
4955 |
|
4963 | |||
4956 | # :flag.case |
|
4964 | # :flag.case | |
4957 | --auth-token) |
|
4965 | --auth-token) | |
4958 |
|
4966 | |||
4959 | # :flag.case_arg |
|
4967 | # :flag.case_arg | |
4960 | if [[ -n ${2+x} ]]; then |
|
4968 | if [[ -n ${2+x} ]]; then | |
4961 |
|
4969 | |||
4962 | args['--auth-token']="$2" |
|
4970 | args['--auth-token']="$2" | |
4963 | shift |
|
4971 | shift | |
4964 | shift |
|
4972 | shift | |
4965 | else |
|
4973 | else | |
4966 | printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2 |
|
4974 | printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2 | |
4967 | exit 1 |
|
4975 | exit 1 | |
4968 | fi |
|
4976 | fi | |
4969 | ;; |
|
4977 | ;; | |
4970 |
|
4978 | |||
4971 | -?*) |
|
4979 | -?*) | |
4972 | printf "invalid option: %s\n" "$key" >&2 |
|
4980 | printf "invalid option: %s\n" "$key" >&2 | |
4973 | exit 1 |
|
4981 | exit 1 | |
4974 | ;; |
|
4982 | ;; | |
4975 |
|
4983 | |||
4976 | *) |
|
4984 | *) | |
4977 | # :command.parse_requirements_case |
|
4985 | # :command.parse_requirements_case | |
4978 | # :command.parse_requirements_case_simple |
|
4986 | # :command.parse_requirements_case_simple | |
4979 | printf "invalid argument: %s\n" "$key" >&2 |
|
4987 | printf "invalid argument: %s\n" "$key" >&2 | |
4980 | exit 1 |
|
4988 | exit 1 | |
4981 |
|
4989 | |||
4982 | ;; |
|
4990 | ;; | |
4983 |
|
4991 | |||
4984 | esac |
|
4992 | esac | |
4985 | done |
|
4993 | done | |
4986 |
|
4994 | |||
4987 | # :command.default_assignments |
|
4995 | # :command.default_assignments | |
4988 | [[ -n ${args['--cli-revision']:-} ]] || args['--cli-revision']="stable" |
|
4996 | [[ -n ${args['--cli-revision']:-} ]] || args['--cli-revision']="stable" | |
4989 | [[ -n ${args['--docker-revision']:-} ]] || args['--docker-revision']="stable" |
|
4997 | [[ -n ${args['--docker-revision']:-} ]] || args['--docker-revision']="stable" | |
4990 | [[ -n ${args['--server-url']:-} ]] || args['--server-url']="https://dls.rhodecode.com/get_archive" |
|
4998 | [[ -n ${args['--server-url']:-} ]] || args['--server-url']="https://dls.rhodecode.com/get_archive" | |
4991 |
|
4999 | |||
4992 | } |
|
5000 | } | |
4993 |
|
5001 | |||
4994 | # :command.parse_requirements |
|
5002 | # :command.parse_requirements | |
4995 | rcstack_stack_parse_requirements() { |
|
5003 | rcstack_stack_parse_requirements() { | |
4996 | # :command.fixed_flags_filter |
|
5004 | # :command.fixed_flags_filter | |
4997 | while [[ $# -gt 0 ]]; do |
|
5005 | while [[ $# -gt 0 ]]; do | |
4998 | case "${1:-}" in |
|
5006 | case "${1:-}" in | |
4999 | --help | -h) |
|
5007 | --help | -h) | |
5000 | long_usage=yes |
|
5008 | long_usage=yes | |
5001 | rcstack_stack_usage |
|
5009 | rcstack_stack_usage | |
5002 | exit |
|
5010 | exit | |
5003 | ;; |
|
5011 | ;; | |
5004 |
|
5012 | |||
5005 | # :flag.case |
|
5013 | # :flag.case | |
5006 | --env-file-path) |
|
5014 | --env-file-path) | |
5007 |
|
5015 | |||
5008 | # :flag.case_arg |
|
5016 | # :flag.case_arg | |
5009 | if [[ -n ${2+x} ]]; then |
|
5017 | if [[ -n ${2+x} ]]; then | |
5010 | # :flag.validations |
|
5018 | # :flag.validations | |
5011 | if [[ -n $(validate_file_exists "$2") ]]; then |
|
5019 | if [[ -n $(validate_file_exists "$2") ]]; then | |
5012 | printf "validation error in %s:\n%s\n" "--env-file-path ENV_FILE_PATH" "$(validate_file_exists "$2")" >&2 |
|
5020 | printf "validation error in %s:\n%s\n" "--env-file-path ENV_FILE_PATH" "$(validate_file_exists "$2")" >&2 | |
5013 | exit 1 |
|
5021 | exit 1 | |
5014 | fi |
|
5022 | fi | |
5015 |
|
5023 | |||
5016 | args['--env-file-path']="$2" |
|
5024 | args['--env-file-path']="$2" | |
5017 | shift |
|
5025 | shift | |
5018 | shift |
|
5026 | shift | |
5019 | else |
|
5027 | else | |
5020 | printf "%s\n" "--env-file-path requires an argument: --env-file-path ENV_FILE_PATH" >&2 |
|
5028 | printf "%s\n" "--env-file-path requires an argument: --env-file-path ENV_FILE_PATH" >&2 | |
5021 | exit 1 |
|
5029 | exit 1 | |
5022 | fi |
|
5030 | fi | |
5023 | ;; |
|
5031 | ;; | |
5024 |
|
5032 | |||
5025 | # :flag.case |
|
5033 | # :flag.case | |
5026 | --stack-prefix) |
|
5034 | --stack-prefix) | |
5027 |
|
5035 | |||
5028 | # :flag.case_arg |
|
5036 | # :flag.case_arg | |
5029 | if [[ -n ${2+x} ]]; then |
|
5037 | if [[ -n ${2+x} ]]; then | |
5030 |
|
5038 | |||
5031 | args['--stack-prefix']="$2" |
|
5039 | args['--stack-prefix']="$2" | |
5032 | shift |
|
5040 | shift | |
5033 | shift |
|
5041 | shift | |
5034 | else |
|
5042 | else | |
5035 | printf "%s\n" "--stack-prefix requires an argument: --stack-prefix STACK_PREFIX" >&2 |
|
5043 | printf "%s\n" "--stack-prefix requires an argument: --stack-prefix STACK_PREFIX" >&2 | |
5036 | exit 1 |
|
5044 | exit 1 | |
5037 | fi |
|
5045 | fi | |
5038 | ;; |
|
5046 | ;; | |
5039 |
|
5047 | |||
5040 | *) |
|
5048 | *) | |
5041 | break |
|
5049 | break | |
5042 | ;; |
|
5050 | ;; | |
5043 |
|
5051 | |||
5044 | esac |
|
5052 | esac | |
5045 | done |
|
5053 | done | |
5046 |
|
5054 | |||
5047 | # :command.command_filter |
|
5055 | # :command.command_filter | |
5048 | action=${1:-} |
|
5056 | action=${1:-} | |
5049 |
|
5057 | |||
5050 | case $action in |
|
5058 | case $action in | |
5051 | -*) ;; |
|
5059 | -*) ;; | |
5052 |
|
5060 | |||
5053 | router) |
|
5061 | router) | |
5054 | action="router" |
|
5062 | action="router" | |
5055 | shift |
|
5063 | shift | |
5056 | rcstack_stack_router_parse_requirements "$@" |
|
5064 | rcstack_stack_router_parse_requirements "$@" | |
5057 | shift $# |
|
5065 | shift $# | |
5058 | ;; |
|
5066 | ;; | |
5059 |
|
5067 | |||
5060 | metrics) |
|
5068 | metrics) | |
5061 | action="metrics" |
|
5069 | action="metrics" | |
5062 | shift |
|
5070 | shift | |
5063 | rcstack_stack_metrics_parse_requirements "$@" |
|
5071 | rcstack_stack_metrics_parse_requirements "$@" | |
5064 | shift $# |
|
5072 | shift $# | |
5065 | ;; |
|
5073 | ;; | |
5066 |
|
5074 | |||
5067 | services) |
|
5075 | services) | |
5068 | action="services" |
|
5076 | action="services" | |
5069 | shift |
|
5077 | shift | |
5070 | rcstack_stack_services_parse_requirements "$@" |
|
5078 | rcstack_stack_services_parse_requirements "$@" | |
5071 | shift $# |
|
5079 | shift $# | |
5072 | ;; |
|
5080 | ;; | |
5073 |
|
5081 | |||
5074 | rhodecode) |
|
5082 | rhodecode) | |
5075 | action="rhodecode" |
|
5083 | action="rhodecode" | |
5076 | shift |
|
5084 | shift | |
5077 | rcstack_stack_rhodecode_parse_requirements "$@" |
|
5085 | rcstack_stack_rhodecode_parse_requirements "$@" | |
5078 | shift $# |
|
5086 | shift $# | |
5079 | ;; |
|
5087 | ;; | |
5080 |
|
5088 | |||
5081 | all) |
|
5089 | all) | |
5082 | action="all" |
|
5090 | action="all" | |
5083 | shift |
|
5091 | shift | |
5084 | rcstack_stack_all_parse_requirements "$@" |
|
5092 | rcstack_stack_all_parse_requirements "$@" | |
5085 | shift $# |
|
5093 | shift $# | |
5086 | ;; |
|
5094 | ;; | |
5087 |
|
5095 | |||
5088 | # :command.command_fallback |
|
5096 | # :command.command_fallback | |
5089 | "") |
|
5097 | "") | |
5090 | rcstack_stack_usage >&2 |
|
5098 | rcstack_stack_usage >&2 | |
5091 | exit 1 |
|
5099 | exit 1 | |
5092 | ;; |
|
5100 | ;; | |
5093 |
|
5101 | |||
5094 | *) |
|
5102 | *) | |
5095 | printf "invalid command: %s\n" "$action" >&2 |
|
5103 | printf "invalid command: %s\n" "$action" >&2 | |
5096 | exit 1 |
|
5104 | exit 1 | |
5097 | ;; |
|
5105 | ;; | |
5098 |
|
5106 | |||
5099 | esac |
|
5107 | esac | |
5100 |
|
5108 | |||
5101 | # :command.parse_requirements_while |
|
5109 | # :command.parse_requirements_while | |
5102 | while [[ $# -gt 0 ]]; do |
|
5110 | while [[ $# -gt 0 ]]; do | |
5103 | key="$1" |
|
5111 | key="$1" | |
5104 | case "$key" in |
|
5112 | case "$key" in | |
5105 |
|
5113 | |||
5106 | -?*) |
|
5114 | -?*) | |
5107 | printf "invalid option: %s\n" "$key" >&2 |
|
5115 | printf "invalid option: %s\n" "$key" >&2 | |
5108 | exit 1 |
|
5116 | exit 1 | |
5109 | ;; |
|
5117 | ;; | |
5110 |
|
5118 | |||
5111 | *) |
|
5119 | *) | |
5112 | # :command.parse_requirements_case |
|
5120 | # :command.parse_requirements_case | |
5113 | # :command.parse_requirements_case_simple |
|
5121 | # :command.parse_requirements_case_simple | |
5114 | printf "invalid argument: %s\n" "$key" >&2 |
|
5122 | printf "invalid argument: %s\n" "$key" >&2 | |
5115 | exit 1 |
|
5123 | exit 1 | |
5116 |
|
5124 | |||
5117 | ;; |
|
5125 | ;; | |
5118 |
|
5126 | |||
5119 | esac |
|
5127 | esac | |
5120 | done |
|
5128 | done | |
5121 |
|
5129 | |||
5122 | # :command.default_assignments |
|
5130 | # :command.default_assignments | |
5123 | [[ -n ${args['--env-file-path']:-} ]] || args['--env-file-path']="$PWD/.custom/.runtime.env" |
|
5131 | [[ -n ${args['--env-file-path']:-} ]] || args['--env-file-path']="$PWD/.custom/.runtime.env" | |
5124 |
|
5132 | |||
5125 | } |
|
5133 | } | |
5126 |
|
5134 | |||
5127 | # :command.parse_requirements |
|
5135 | # :command.parse_requirements | |
5128 | rcstack_stack_router_parse_requirements() { |
|
5136 | rcstack_stack_router_parse_requirements() { | |
5129 | # :command.fixed_flags_filter |
|
5137 | # :command.fixed_flags_filter | |
5130 | while [[ $# -gt 0 ]]; do |
|
5138 | while [[ $# -gt 0 ]]; do | |
5131 | case "${1:-}" in |
|
5139 | case "${1:-}" in | |
5132 | --help | -h) |
|
5140 | --help | -h) | |
5133 | long_usage=yes |
|
5141 | long_usage=yes | |
5134 | rcstack_stack_router_usage |
|
5142 | rcstack_stack_router_usage | |
5135 | exit |
|
5143 | exit | |
5136 | ;; |
|
5144 | ;; | |
5137 |
|
5145 | |||
5138 | *) |
|
5146 | *) | |
5139 | break |
|
5147 | break | |
5140 | ;; |
|
5148 | ;; | |
5141 |
|
5149 | |||
5142 | esac |
|
5150 | esac | |
5143 | done |
|
5151 | done | |
5144 |
|
5152 | |||
5145 | # :command.command_filter |
|
5153 | # :command.command_filter | |
5146 | action="stack router" |
|
5154 | action="stack router" | |
5147 |
|
5155 | |||
5148 | # :command.parse_requirements_while |
|
5156 | # :command.parse_requirements_while | |
5149 | while [[ $# -gt 0 ]]; do |
|
5157 | while [[ $# -gt 0 ]]; do | |
5150 | key="$1" |
|
5158 | key="$1" | |
5151 | case "$key" in |
|
5159 | case "$key" in | |
5152 |
|
5160 | |||
5153 | --) |
|
5161 | --) | |
5154 | shift |
|
5162 | shift | |
5155 | other_args+=("$@") |
|
5163 | other_args+=("$@") | |
5156 | break |
|
5164 | break | |
5157 | ;; |
|
5165 | ;; | |
5158 |
|
5166 | |||
5159 | -?*) |
|
5167 | -?*) | |
5160 | other_args+=("$1") |
|
5168 | other_args+=("$1") | |
5161 | shift |
|
5169 | shift | |
5162 | ;; |
|
5170 | ;; | |
5163 |
|
5171 | |||
5164 | *) |
|
5172 | *) | |
5165 | # :command.parse_requirements_case |
|
5173 | # :command.parse_requirements_case | |
5166 | # :command.parse_requirements_case_catch_all |
|
5174 | # :command.parse_requirements_case_catch_all | |
5167 | other_args+=("$1") |
|
5175 | other_args+=("$1") | |
5168 | shift |
|
5176 | shift | |
5169 |
|
5177 | |||
5170 | ;; |
|
5178 | ;; | |
5171 |
|
5179 | |||
5172 | esac |
|
5180 | esac | |
5173 | done |
|
5181 | done | |
5174 |
|
5182 | |||
5175 | } |
|
5183 | } | |
5176 |
|
5184 | |||
5177 | # :command.parse_requirements |
|
5185 | # :command.parse_requirements | |
5178 | rcstack_stack_metrics_parse_requirements() { |
|
5186 | rcstack_stack_metrics_parse_requirements() { | |
5179 | # :command.fixed_flags_filter |
|
5187 | # :command.fixed_flags_filter | |
5180 | while [[ $# -gt 0 ]]; do |
|
5188 | while [[ $# -gt 0 ]]; do | |
5181 | case "${1:-}" in |
|
5189 | case "${1:-}" in | |
5182 | --help | -h) |
|
5190 | --help | -h) | |
5183 | long_usage=yes |
|
5191 | long_usage=yes | |
5184 | rcstack_stack_metrics_usage |
|
5192 | rcstack_stack_metrics_usage | |
5185 | exit |
|
5193 | exit | |
5186 | ;; |
|
5194 | ;; | |
5187 |
|
5195 | |||
5188 | *) |
|
5196 | *) | |
5189 | break |
|
5197 | break | |
5190 | ;; |
|
5198 | ;; | |
5191 |
|
5199 | |||
5192 | esac |
|
5200 | esac | |
5193 | done |
|
5201 | done | |
5194 |
|
5202 | |||
5195 | # :command.command_filter |
|
5203 | # :command.command_filter | |
5196 | action="stack metrics" |
|
5204 | action="stack metrics" | |
5197 |
|
5205 | |||
5198 | # :command.parse_requirements_while |
|
5206 | # :command.parse_requirements_while | |
5199 | while [[ $# -gt 0 ]]; do |
|
5207 | while [[ $# -gt 0 ]]; do | |
5200 | key="$1" |
|
5208 | key="$1" | |
5201 | case "$key" in |
|
5209 | case "$key" in | |
5202 |
|
5210 | |||
5203 | --) |
|
5211 | --) | |
5204 | shift |
|
5212 | shift | |
5205 | other_args+=("$@") |
|
5213 | other_args+=("$@") | |
5206 | break |
|
5214 | break | |
5207 | ;; |
|
5215 | ;; | |
5208 |
|
5216 | |||
5209 | -?*) |
|
5217 | -?*) | |
5210 | other_args+=("$1") |
|
5218 | other_args+=("$1") | |
5211 | shift |
|
5219 | shift | |
5212 | ;; |
|
5220 | ;; | |
5213 |
|
5221 | |||
5214 | *) |
|
5222 | *) | |
5215 | # :command.parse_requirements_case |
|
5223 | # :command.parse_requirements_case | |
5216 | # :command.parse_requirements_case_catch_all |
|
5224 | # :command.parse_requirements_case_catch_all | |
5217 | other_args+=("$1") |
|
5225 | other_args+=("$1") | |
5218 | shift |
|
5226 | shift | |
5219 |
|
5227 | |||
5220 | ;; |
|
5228 | ;; | |
5221 |
|
5229 | |||
5222 | esac |
|
5230 | esac | |
5223 | done |
|
5231 | done | |
5224 |
|
5232 | |||
5225 | } |
|
5233 | } | |
5226 |
|
5234 | |||
5227 | # :command.parse_requirements |
|
5235 | # :command.parse_requirements | |
5228 | rcstack_stack_services_parse_requirements() { |
|
5236 | rcstack_stack_services_parse_requirements() { | |
5229 | # :command.fixed_flags_filter |
|
5237 | # :command.fixed_flags_filter | |
5230 | while [[ $# -gt 0 ]]; do |
|
5238 | while [[ $# -gt 0 ]]; do | |
5231 | case "${1:-}" in |
|
5239 | case "${1:-}" in | |
5232 | --help | -h) |
|
5240 | --help | -h) | |
5233 | long_usage=yes |
|
5241 | long_usage=yes | |
5234 | rcstack_stack_services_usage |
|
5242 | rcstack_stack_services_usage | |
5235 | exit |
|
5243 | exit | |
5236 | ;; |
|
5244 | ;; | |
5237 |
|
5245 | |||
5238 | *) |
|
5246 | *) | |
5239 | break |
|
5247 | break | |
5240 | ;; |
|
5248 | ;; | |
5241 |
|
5249 | |||
5242 | esac |
|
5250 | esac | |
5243 | done |
|
5251 | done | |
5244 |
|
5252 | |||
5245 | # :command.command_filter |
|
5253 | # :command.command_filter | |
5246 | action="stack services" |
|
5254 | action="stack services" | |
5247 |
|
5255 | |||
5248 | # :command.parse_requirements_while |
|
5256 | # :command.parse_requirements_while | |
5249 | while [[ $# -gt 0 ]]; do |
|
5257 | while [[ $# -gt 0 ]]; do | |
5250 | key="$1" |
|
5258 | key="$1" | |
5251 | case "$key" in |
|
5259 | case "$key" in | |
5252 |
|
5260 | |||
5253 | --) |
|
5261 | --) | |
5254 | shift |
|
5262 | shift | |
5255 | other_args+=("$@") |
|
5263 | other_args+=("$@") | |
5256 | break |
|
5264 | break | |
5257 | ;; |
|
5265 | ;; | |
5258 |
|
5266 | |||
5259 | -?*) |
|
5267 | -?*) | |
5260 | other_args+=("$1") |
|
5268 | other_args+=("$1") | |
5261 | shift |
|
5269 | shift | |
5262 | ;; |
|
5270 | ;; | |
5263 |
|
5271 | |||
5264 | *) |
|
5272 | *) | |
5265 | # :command.parse_requirements_case |
|
5273 | # :command.parse_requirements_case | |
5266 | # :command.parse_requirements_case_catch_all |
|
5274 | # :command.parse_requirements_case_catch_all | |
5267 | other_args+=("$1") |
|
5275 | other_args+=("$1") | |
5268 | shift |
|
5276 | shift | |
5269 |
|
5277 | |||
5270 | ;; |
|
5278 | ;; | |
5271 |
|
5279 | |||
5272 | esac |
|
5280 | esac | |
5273 | done |
|
5281 | done | |
5274 |
|
5282 | |||
5275 | } |
|
5283 | } | |
5276 |
|
5284 | |||
5277 | # :command.parse_requirements |
|
5285 | # :command.parse_requirements | |
5278 | rcstack_stack_rhodecode_parse_requirements() { |
|
5286 | rcstack_stack_rhodecode_parse_requirements() { | |
5279 | # :command.fixed_flags_filter |
|
5287 | # :command.fixed_flags_filter | |
5280 | while [[ $# -gt 0 ]]; do |
|
5288 | while [[ $# -gt 0 ]]; do | |
5281 | case "${1:-}" in |
|
5289 | case "${1:-}" in | |
5282 | --help | -h) |
|
5290 | --help | -h) | |
5283 | long_usage=yes |
|
5291 | long_usage=yes | |
5284 | rcstack_stack_rhodecode_usage |
|
5292 | rcstack_stack_rhodecode_usage | |
5285 | exit |
|
5293 | exit | |
5286 | ;; |
|
5294 | ;; | |
5287 |
|
5295 | |||
5288 | *) |
|
5296 | *) | |
5289 | break |
|
5297 | break | |
5290 | ;; |
|
5298 | ;; | |
5291 |
|
5299 | |||
5292 | esac |
|
5300 | esac | |
5293 | done |
|
5301 | done | |
5294 |
|
5302 | |||
5295 | # :command.command_filter |
|
5303 | # :command.command_filter | |
5296 | action="stack rhodecode" |
|
5304 | action="stack rhodecode" | |
5297 |
|
5305 | |||
5298 | # :command.parse_requirements_while |
|
5306 | # :command.parse_requirements_while | |
5299 | while [[ $# -gt 0 ]]; do |
|
5307 | while [[ $# -gt 0 ]]; do | |
5300 | key="$1" |
|
5308 | key="$1" | |
5301 | case "$key" in |
|
5309 | case "$key" in | |
5302 |
|
5310 | |||
5303 | --) |
|
5311 | --) | |
5304 | shift |
|
5312 | shift | |
5305 | other_args+=("$@") |
|
5313 | other_args+=("$@") | |
5306 | break |
|
5314 | break | |
5307 | ;; |
|
5315 | ;; | |
5308 |
|
5316 | |||
5309 | -?*) |
|
5317 | -?*) | |
5310 | other_args+=("$1") |
|
5318 | other_args+=("$1") | |
5311 | shift |
|
5319 | shift | |
5312 | ;; |
|
5320 | ;; | |
5313 |
|
5321 | |||
5314 | *) |
|
5322 | *) | |
5315 | # :command.parse_requirements_case |
|
5323 | # :command.parse_requirements_case | |
5316 | # :command.parse_requirements_case_catch_all |
|
5324 | # :command.parse_requirements_case_catch_all | |
5317 | other_args+=("$1") |
|
5325 | other_args+=("$1") | |
5318 | shift |
|
5326 | shift | |
5319 |
|
5327 | |||
5320 | ;; |
|
5328 | ;; | |
5321 |
|
5329 | |||
5322 | esac |
|
5330 | esac | |
5323 | done |
|
5331 | done | |
5324 |
|
5332 | |||
5325 | } |
|
5333 | } | |
5326 |
|
5334 | |||
5327 | # :command.parse_requirements |
|
5335 | # :command.parse_requirements | |
5328 | rcstack_stack_all_parse_requirements() { |
|
5336 | rcstack_stack_all_parse_requirements() { | |
5329 | # :command.fixed_flags_filter |
|
5337 | # :command.fixed_flags_filter | |
5330 | while [[ $# -gt 0 ]]; do |
|
5338 | while [[ $# -gt 0 ]]; do | |
5331 | case "${1:-}" in |
|
5339 | case "${1:-}" in | |
5332 | --help | -h) |
|
5340 | --help | -h) | |
5333 | long_usage=yes |
|
5341 | long_usage=yes | |
5334 | rcstack_stack_all_usage |
|
5342 | rcstack_stack_all_usage | |
5335 | exit |
|
5343 | exit | |
5336 | ;; |
|
5344 | ;; | |
5337 |
|
5345 | |||
5338 | *) |
|
5346 | *) | |
5339 | break |
|
5347 | break | |
5340 | ;; |
|
5348 | ;; | |
5341 |
|
5349 | |||
5342 | esac |
|
5350 | esac | |
5343 | done |
|
5351 | done | |
5344 |
|
5352 | |||
5345 | # :command.command_filter |
|
5353 | # :command.command_filter | |
5346 | action="stack all" |
|
5354 | action="stack all" | |
5347 |
|
5355 | |||
5348 | # :command.parse_requirements_while |
|
5356 | # :command.parse_requirements_while | |
5349 | while [[ $# -gt 0 ]]; do |
|
5357 | while [[ $# -gt 0 ]]; do | |
5350 | key="$1" |
|
5358 | key="$1" | |
5351 | case "$key" in |
|
5359 | case "$key" in | |
5352 |
|
5360 | |||
5353 | --) |
|
5361 | --) | |
5354 | shift |
|
5362 | shift | |
5355 | other_args+=("$@") |
|
5363 | other_args+=("$@") | |
5356 | break |
|
5364 | break | |
5357 | ;; |
|
5365 | ;; | |
5358 |
|
5366 | |||
5359 | -?*) |
|
5367 | -?*) | |
5360 | other_args+=("$1") |
|
5368 | other_args+=("$1") | |
5361 | shift |
|
5369 | shift | |
5362 | ;; |
|
5370 | ;; | |
5363 |
|
5371 | |||
5364 | *) |
|
5372 | *) | |
5365 | # :command.parse_requirements_case |
|
5373 | # :command.parse_requirements_case | |
5366 | # :command.parse_requirements_case_catch_all |
|
5374 | # :command.parse_requirements_case_catch_all | |
5367 | other_args+=("$1") |
|
5375 | other_args+=("$1") | |
5368 | shift |
|
5376 | shift | |
5369 |
|
5377 | |||
5370 | ;; |
|
5378 | ;; | |
5371 |
|
5379 | |||
5372 | esac |
|
5380 | esac | |
5373 | done |
|
5381 | done | |
5374 |
|
5382 | |||
5375 | } |
|
5383 | } | |
5376 |
|
5384 | |||
5377 | # :command.parse_requirements |
|
5385 | # :command.parse_requirements | |
5378 | rcstack_stack_status_parse_requirements() { |
|
5386 | rcstack_stack_status_parse_requirements() { | |
5379 | # :command.fixed_flags_filter |
|
5387 | # :command.fixed_flags_filter | |
5380 | while [[ $# -gt 0 ]]; do |
|
5388 | while [[ $# -gt 0 ]]; do | |
5381 | case "${1:-}" in |
|
5389 | case "${1:-}" in | |
5382 | --help | -h) |
|
5390 | --help | -h) | |
5383 | long_usage=yes |
|
5391 | long_usage=yes | |
5384 | rcstack_stack_status_usage |
|
5392 | rcstack_stack_status_usage | |
5385 | exit |
|
5393 | exit | |
5386 | ;; |
|
5394 | ;; | |
5387 |
|
5395 | |||
5388 | *) |
|
5396 | *) | |
5389 | break |
|
5397 | break | |
5390 | ;; |
|
5398 | ;; | |
5391 |
|
5399 | |||
5392 | esac |
|
5400 | esac | |
5393 | done |
|
5401 | done | |
5394 |
|
5402 | |||
5395 | # :command.command_filter |
|
5403 | # :command.command_filter | |
5396 | action="stack-status" |
|
5404 | action="stack-status" | |
5397 |
|
5405 | |||
5398 | # :command.parse_requirements_while |
|
5406 | # :command.parse_requirements_while | |
5399 | while [[ $# -gt 0 ]]; do |
|
5407 | while [[ $# -gt 0 ]]; do | |
5400 | key="$1" |
|
5408 | key="$1" | |
5401 | case "$key" in |
|
5409 | case "$key" in | |
5402 | # :flag.case |
|
5410 | # :flag.case | |
5403 | --detailed) |
|
5411 | --detailed) | |
5404 |
|
5412 | |||
5405 | # :flag.case_no_arg |
|
5413 | # :flag.case_no_arg | |
5406 | args['--detailed']=1 |
|
5414 | args['--detailed']=1 | |
5407 | shift |
|
5415 | shift | |
5408 | ;; |
|
5416 | ;; | |
5409 |
|
5417 | |||
5410 | # :flag.case |
|
5418 | # :flag.case | |
5411 | --configs) |
|
5419 | --configs) | |
5412 |
|
5420 | |||
5413 | # :flag.case_no_arg |
|
5421 | # :flag.case_no_arg | |
5414 | args['--configs']=1 |
|
5422 | args['--configs']=1 | |
5415 | shift |
|
5423 | shift | |
5416 | ;; |
|
5424 | ;; | |
5417 |
|
5425 | |||
5418 | # :flag.case |
|
5426 | # :flag.case | |
5419 | -v) |
|
5427 | -v) | |
5420 |
|
5428 | |||
5421 | # :flag.case_no_arg |
|
5429 | # :flag.case_no_arg | |
5422 | args['-v']=1 |
|
5430 | args['-v']=1 | |
5423 | shift |
|
5431 | shift | |
5424 | ;; |
|
5432 | ;; | |
5425 |
|
5433 | |||
5426 | -?*) |
|
5434 | -?*) | |
5427 | printf "invalid option: %s\n" "$key" >&2 |
|
5435 | printf "invalid option: %s\n" "$key" >&2 | |
5428 | exit 1 |
|
5436 | exit 1 | |
5429 | ;; |
|
5437 | ;; | |
5430 |
|
5438 | |||
5431 | *) |
|
5439 | *) | |
5432 | # :command.parse_requirements_case |
|
5440 | # :command.parse_requirements_case | |
5433 | # :command.parse_requirements_case_simple |
|
5441 | # :command.parse_requirements_case_simple | |
5434 | printf "invalid argument: %s\n" "$key" >&2 |
|
5442 | printf "invalid argument: %s\n" "$key" >&2 | |
5435 | exit 1 |
|
5443 | exit 1 | |
5436 |
|
5444 | |||
5437 | ;; |
|
5445 | ;; | |
5438 |
|
5446 | |||
5439 | esac |
|
5447 | esac | |
5440 | done |
|
5448 | done | |
5441 |
|
5449 | |||
5442 | } |
|
5450 | } | |
5443 |
|
5451 | |||
5444 | # :command.parse_requirements |
|
5452 | # :command.parse_requirements | |
5445 | rcstack_stack_upgrade_parse_requirements() { |
|
5453 | rcstack_stack_upgrade_parse_requirements() { | |
5446 | # :command.fixed_flags_filter |
|
5454 | # :command.fixed_flags_filter | |
5447 | while [[ $# -gt 0 ]]; do |
|
5455 | while [[ $# -gt 0 ]]; do | |
5448 | case "${1:-}" in |
|
5456 | case "${1:-}" in | |
5449 | --help | -h) |
|
5457 | --help | -h) | |
5450 | long_usage=yes |
|
5458 | long_usage=yes | |
5451 | rcstack_stack_upgrade_usage |
|
5459 | rcstack_stack_upgrade_usage | |
5452 | exit |
|
5460 | exit | |
5453 | ;; |
|
5461 | ;; | |
5454 |
|
5462 | |||
5455 | # :flag.case |
|
5463 | # :flag.case | |
5456 | --stack-prefix) |
|
5464 | --stack-prefix) | |
5457 |
|
5465 | |||
5458 | # :flag.case_arg |
|
5466 | # :flag.case_arg | |
5459 | if [[ -n ${2+x} ]]; then |
|
5467 | if [[ -n ${2+x} ]]; then | |
5460 |
|
5468 | |||
5461 | args['--stack-prefix']="$2" |
|
5469 | args['--stack-prefix']="$2" | |
5462 | shift |
|
5470 | shift | |
5463 | shift |
|
5471 | shift | |
5464 | else |
|
5472 | else | |
5465 | printf "%s\n" "--stack-prefix requires an argument: --stack-prefix STACK_PREFIX" >&2 |
|
5473 | printf "%s\n" "--stack-prefix requires an argument: --stack-prefix STACK_PREFIX" >&2 | |
5466 | exit 1 |
|
5474 | exit 1 | |
5467 | fi |
|
5475 | fi | |
5468 | ;; |
|
5476 | ;; | |
5469 |
|
5477 | |||
5470 | *) |
|
5478 | *) | |
5471 | break |
|
5479 | break | |
5472 | ;; |
|
5480 | ;; | |
5473 |
|
5481 | |||
5474 | esac |
|
5482 | esac | |
5475 | done |
|
5483 | done | |
5476 |
|
5484 | |||
5477 | # :command.command_filter |
|
5485 | # :command.command_filter | |
5478 | action=${1:-} |
|
5486 | action=${1:-} | |
5479 |
|
5487 | |||
5480 | case $action in |
|
5488 | case $action in | |
5481 | -*) ;; |
|
5489 | -*) ;; | |
5482 |
|
5490 | |||
5483 | router) |
|
5491 | router) | |
5484 | action="router" |
|
5492 | action="router" | |
5485 | shift |
|
5493 | shift | |
5486 | rcstack_stack_upgrade_router_parse_requirements "$@" |
|
5494 | rcstack_stack_upgrade_router_parse_requirements "$@" | |
5487 | shift $# |
|
5495 | shift $# | |
5488 | ;; |
|
5496 | ;; | |
5489 |
|
5497 | |||
5490 | services) |
|
5498 | services) | |
5491 | action="services" |
|
5499 | action="services" | |
5492 | shift |
|
5500 | shift | |
5493 | rcstack_stack_upgrade_services_parse_requirements "$@" |
|
5501 | rcstack_stack_upgrade_services_parse_requirements "$@" | |
5494 | shift $# |
|
5502 | shift $# | |
5495 | ;; |
|
5503 | ;; | |
5496 |
|
5504 | |||
5497 | metrics) |
|
5505 | metrics) | |
5498 | action="metrics" |
|
5506 | action="metrics" | |
5499 | shift |
|
5507 | shift | |
5500 | rcstack_stack_upgrade_metrics_parse_requirements "$@" |
|
5508 | rcstack_stack_upgrade_metrics_parse_requirements "$@" | |
5501 | shift $# |
|
5509 | shift $# | |
5502 | ;; |
|
5510 | ;; | |
5503 |
|
5511 | |||
5504 | rhodecode) |
|
5512 | rhodecode) | |
5505 | action="rhodecode" |
|
5513 | action="rhodecode" | |
5506 | shift |
|
5514 | shift | |
5507 | rcstack_stack_upgrade_rhodecode_parse_requirements "$@" |
|
5515 | rcstack_stack_upgrade_rhodecode_parse_requirements "$@" | |
5508 | shift $# |
|
5516 | shift $# | |
5509 | ;; |
|
5517 | ;; | |
5510 |
|
5518 | |||
5511 | # :command.command_fallback |
|
5519 | # :command.command_fallback | |
5512 | "") |
|
5520 | "") | |
5513 | rcstack_stack_upgrade_usage >&2 |
|
5521 | rcstack_stack_upgrade_usage >&2 | |
5514 | exit 1 |
|
5522 | exit 1 | |
5515 | ;; |
|
5523 | ;; | |
5516 |
|
5524 | |||
5517 | *) |
|
5525 | *) | |
5518 | printf "invalid command: %s\n" "$action" >&2 |
|
5526 | printf "invalid command: %s\n" "$action" >&2 | |
5519 | exit 1 |
|
5527 | exit 1 | |
5520 | ;; |
|
5528 | ;; | |
5521 |
|
5529 | |||
5522 | esac |
|
5530 | esac | |
5523 |
|
5531 | |||
5524 | # :command.parse_requirements_while |
|
5532 | # :command.parse_requirements_while | |
5525 | while [[ $# -gt 0 ]]; do |
|
5533 | while [[ $# -gt 0 ]]; do | |
5526 | key="$1" |
|
5534 | key="$1" | |
5527 | case "$key" in |
|
5535 | case "$key" in | |
5528 |
|
5536 | |||
5529 | -?*) |
|
5537 | -?*) | |
5530 | printf "invalid option: %s\n" "$key" >&2 |
|
5538 | printf "invalid option: %s\n" "$key" >&2 | |
5531 | exit 1 |
|
5539 | exit 1 | |
5532 | ;; |
|
5540 | ;; | |
5533 |
|
5541 | |||
5534 | *) |
|
5542 | *) | |
5535 | # :command.parse_requirements_case |
|
5543 | # :command.parse_requirements_case | |
5536 | # :command.parse_requirements_case_simple |
|
5544 | # :command.parse_requirements_case_simple | |
5537 | printf "invalid argument: %s\n" "$key" >&2 |
|
5545 | printf "invalid argument: %s\n" "$key" >&2 | |
5538 | exit 1 |
|
5546 | exit 1 | |
5539 |
|
5547 | |||
5540 | ;; |
|
5548 | ;; | |
5541 |
|
5549 | |||
5542 | esac |
|
5550 | esac | |
5543 | done |
|
5551 | done | |
5544 |
|
5552 | |||
5545 | } |
|
5553 | } | |
5546 |
|
5554 | |||
5547 | # :command.parse_requirements |
|
5555 | # :command.parse_requirements | |
5548 | rcstack_stack_upgrade_router_parse_requirements() { |
|
5556 | rcstack_stack_upgrade_router_parse_requirements() { | |
5549 | # :command.fixed_flags_filter |
|
5557 | # :command.fixed_flags_filter | |
5550 | while [[ $# -gt 0 ]]; do |
|
5558 | while [[ $# -gt 0 ]]; do | |
5551 | case "${1:-}" in |
|
5559 | case "${1:-}" in | |
5552 | --help | -h) |
|
5560 | --help | -h) | |
5553 | long_usage=yes |
|
5561 | long_usage=yes | |
5554 | rcstack_stack_upgrade_router_usage |
|
5562 | rcstack_stack_upgrade_router_usage | |
5555 | exit |
|
5563 | exit | |
5556 | ;; |
|
5564 | ;; | |
5557 |
|
5565 | |||
5558 | *) |
|
5566 | *) | |
5559 | break |
|
5567 | break | |
5560 | ;; |
|
5568 | ;; | |
5561 |
|
5569 | |||
5562 | esac |
|
5570 | esac | |
5563 | done |
|
5571 | done | |
5564 |
|
5572 | |||
5565 | # :command.command_filter |
|
5573 | # :command.command_filter | |
5566 | action="stack-upgrade router" |
|
5574 | action="stack-upgrade router" | |
5567 |
|
5575 | |||
5568 | # :command.parse_requirements_while |
|
5576 | # :command.parse_requirements_while | |
5569 | while [[ $# -gt 0 ]]; do |
|
5577 | while [[ $# -gt 0 ]]; do | |
5570 | key="$1" |
|
5578 | key="$1" | |
5571 | case "$key" in |
|
5579 | case "$key" in | |
5572 |
|
5580 | |||
5573 | -?*) |
|
5581 | -?*) | |
5574 | printf "invalid option: %s\n" "$key" >&2 |
|
5582 | printf "invalid option: %s\n" "$key" >&2 | |
5575 | exit 1 |
|
5583 | exit 1 | |
5576 | ;; |
|
5584 | ;; | |
5577 |
|
5585 | |||
5578 | *) |
|
5586 | *) | |
5579 | # :command.parse_requirements_case |
|
5587 | # :command.parse_requirements_case | |
5580 | # :command.parse_requirements_case_simple |
|
5588 | # :command.parse_requirements_case_simple | |
5581 | printf "invalid argument: %s\n" "$key" >&2 |
|
5589 | printf "invalid argument: %s\n" "$key" >&2 | |
5582 | exit 1 |
|
5590 | exit 1 | |
5583 |
|
5591 | |||
5584 | ;; |
|
5592 | ;; | |
5585 |
|
5593 | |||
5586 | esac |
|
5594 | esac | |
5587 | done |
|
5595 | done | |
5588 |
|
5596 | |||
5589 | } |
|
5597 | } | |
5590 |
|
5598 | |||
5591 | # :command.parse_requirements |
|
5599 | # :command.parse_requirements | |
5592 | rcstack_stack_upgrade_services_parse_requirements() { |
|
5600 | rcstack_stack_upgrade_services_parse_requirements() { | |
5593 | # :command.fixed_flags_filter |
|
5601 | # :command.fixed_flags_filter | |
5594 | while [[ $# -gt 0 ]]; do |
|
5602 | while [[ $# -gt 0 ]]; do | |
5595 | case "${1:-}" in |
|
5603 | case "${1:-}" in | |
5596 | --help | -h) |
|
5604 | --help | -h) | |
5597 | long_usage=yes |
|
5605 | long_usage=yes | |
5598 | rcstack_stack_upgrade_services_usage |
|
5606 | rcstack_stack_upgrade_services_usage | |
5599 | exit |
|
5607 | exit | |
5600 | ;; |
|
5608 | ;; | |
5601 |
|
5609 | |||
5602 | *) |
|
5610 | *) | |
5603 | break |
|
5611 | break | |
5604 | ;; |
|
5612 | ;; | |
5605 |
|
5613 | |||
5606 | esac |
|
5614 | esac | |
5607 | done |
|
5615 | done | |
5608 |
|
5616 | |||
5609 | # :command.command_filter |
|
5617 | # :command.command_filter | |
5610 | action="stack-upgrade services" |
|
5618 | action="stack-upgrade services" | |
5611 |
|
5619 | |||
5612 | # :command.parse_requirements_while |
|
5620 | # :command.parse_requirements_while | |
5613 | while [[ $# -gt 0 ]]; do |
|
5621 | while [[ $# -gt 0 ]]; do | |
5614 | key="$1" |
|
5622 | key="$1" | |
5615 | case "$key" in |
|
5623 | case "$key" in | |
5616 |
|
5624 | |||
5617 | -?*) |
|
5625 | -?*) | |
5618 | printf "invalid option: %s\n" "$key" >&2 |
|
5626 | printf "invalid option: %s\n" "$key" >&2 | |
5619 | exit 1 |
|
5627 | exit 1 | |
5620 | ;; |
|
5628 | ;; | |
5621 |
|
5629 | |||
5622 | *) |
|
5630 | *) | |
5623 | # :command.parse_requirements_case |
|
5631 | # :command.parse_requirements_case | |
5624 | # :command.parse_requirements_case_simple |
|
5632 | # :command.parse_requirements_case_simple | |
5625 | printf "invalid argument: %s\n" "$key" >&2 |
|
5633 | printf "invalid argument: %s\n" "$key" >&2 | |
5626 | exit 1 |
|
5634 | exit 1 | |
5627 |
|
5635 | |||
5628 | ;; |
|
5636 | ;; | |
5629 |
|
5637 | |||
5630 | esac |
|
5638 | esac | |
5631 | done |
|
5639 | done | |
5632 |
|
5640 | |||
5633 | } |
|
5641 | } | |
5634 |
|
5642 | |||
5635 | # :command.parse_requirements |
|
5643 | # :command.parse_requirements | |
5636 | rcstack_stack_upgrade_metrics_parse_requirements() { |
|
5644 | rcstack_stack_upgrade_metrics_parse_requirements() { | |
5637 | # :command.fixed_flags_filter |
|
5645 | # :command.fixed_flags_filter | |
5638 | while [[ $# -gt 0 ]]; do |
|
5646 | while [[ $# -gt 0 ]]; do | |
5639 | case "${1:-}" in |
|
5647 | case "${1:-}" in | |
5640 | --help | -h) |
|
5648 | --help | -h) | |
5641 | long_usage=yes |
|
5649 | long_usage=yes | |
5642 | rcstack_stack_upgrade_metrics_usage |
|
5650 | rcstack_stack_upgrade_metrics_usage | |
5643 | exit |
|
5651 | exit | |
5644 | ;; |
|
5652 | ;; | |
5645 |
|
5653 | |||
5646 | *) |
|
5654 | *) | |
5647 | break |
|
5655 | break | |
5648 | ;; |
|
5656 | ;; | |
5649 |
|
5657 | |||
5650 | esac |
|
5658 | esac | |
5651 | done |
|
5659 | done | |
5652 |
|
5660 | |||
5653 | # :command.command_filter |
|
5661 | # :command.command_filter | |
5654 | action="stack-upgrade metrics" |
|
5662 | action="stack-upgrade metrics" | |
5655 |
|
5663 | |||
5656 | # :command.parse_requirements_while |
|
5664 | # :command.parse_requirements_while | |
5657 | while [[ $# -gt 0 ]]; do |
|
5665 | while [[ $# -gt 0 ]]; do | |
5658 | key="$1" |
|
5666 | key="$1" | |
5659 | case "$key" in |
|
5667 | case "$key" in | |
5660 |
|
5668 | |||
5661 | -?*) |
|
5669 | -?*) | |
5662 | printf "invalid option: %s\n" "$key" >&2 |
|
5670 | printf "invalid option: %s\n" "$key" >&2 | |
5663 | exit 1 |
|
5671 | exit 1 | |
5664 | ;; |
|
5672 | ;; | |
5665 |
|
5673 | |||
5666 | *) |
|
5674 | *) | |
5667 | # :command.parse_requirements_case |
|
5675 | # :command.parse_requirements_case | |
5668 | # :command.parse_requirements_case_simple |
|
5676 | # :command.parse_requirements_case_simple | |
5669 | printf "invalid argument: %s\n" "$key" >&2 |
|
5677 | printf "invalid argument: %s\n" "$key" >&2 | |
5670 | exit 1 |
|
5678 | exit 1 | |
5671 |
|
5679 | |||
5672 | ;; |
|
5680 | ;; | |
5673 |
|
5681 | |||
5674 | esac |
|
5682 | esac | |
5675 | done |
|
5683 | done | |
5676 |
|
5684 | |||
5677 | } |
|
5685 | } | |
5678 |
|
5686 | |||
5679 | # :command.parse_requirements |
|
5687 | # :command.parse_requirements | |
5680 | rcstack_stack_upgrade_rhodecode_parse_requirements() { |
|
5688 | rcstack_stack_upgrade_rhodecode_parse_requirements() { | |
5681 | # :command.fixed_flags_filter |
|
5689 | # :command.fixed_flags_filter | |
5682 | while [[ $# -gt 0 ]]; do |
|
5690 | while [[ $# -gt 0 ]]; do | |
5683 | case "${1:-}" in |
|
5691 | case "${1:-}" in | |
5684 | --help | -h) |
|
5692 | --help | -h) | |
5685 | long_usage=yes |
|
5693 | long_usage=yes | |
5686 | rcstack_stack_upgrade_rhodecode_usage |
|
5694 | rcstack_stack_upgrade_rhodecode_usage | |
5687 | exit |
|
5695 | exit | |
5688 | ;; |
|
5696 | ;; | |
5689 |
|
5697 | |||
5690 | *) |
|
5698 | *) | |
5691 | break |
|
5699 | break | |
5692 | ;; |
|
5700 | ;; | |
5693 |
|
5701 | |||
5694 | esac |
|
5702 | esac | |
5695 | done |
|
5703 | done | |
5696 |
|
5704 | |||
5697 | # :command.command_filter |
|
5705 | # :command.command_filter | |
5698 | action="stack-upgrade rhodecode" |
|
5706 | action="stack-upgrade rhodecode" | |
5699 |
|
5707 | |||
5700 | # :command.parse_requirements_while |
|
5708 | # :command.parse_requirements_while | |
5701 | while [[ $# -gt 0 ]]; do |
|
5709 | while [[ $# -gt 0 ]]; do | |
5702 | key="$1" |
|
5710 | key="$1" | |
5703 | case "$key" in |
|
5711 | case "$key" in | |
5704 | # :flag.case |
|
5712 | # :flag.case | |
5705 | --stop-wait) |
|
5713 | --stop-wait) | |
5706 |
|
5714 | |||
5707 | # :flag.case_arg |
|
5715 | # :flag.case_arg | |
5708 | if [[ -n ${2+x} ]]; then |
|
5716 | if [[ -n ${2+x} ]]; then | |
5709 |
|
5717 | |||
5710 | args['--stop-wait']="$2" |
|
5718 | args['--stop-wait']="$2" | |
5711 | shift |
|
5719 | shift | |
5712 | shift |
|
5720 | shift | |
5713 | else |
|
5721 | else | |
5714 | printf "%s\n" "--stop-wait requires an argument: --stop-wait STOP_WAIT" >&2 |
|
5722 | printf "%s\n" "--stop-wait requires an argument: --stop-wait STOP_WAIT" >&2 | |
5715 | exit 1 |
|
5723 | exit 1 | |
5716 | fi |
|
5724 | fi | |
5717 | ;; |
|
5725 | ;; | |
5718 |
|
5726 | |||
5719 | # :flag.case |
|
5727 | # :flag.case | |
5720 | --docker-stop-wait) |
|
5728 | --docker-stop-wait) | |
5721 |
|
5729 | |||
5722 | # :flag.case_arg |
|
5730 | # :flag.case_arg | |
5723 | if [[ -n ${2+x} ]]; then |
|
5731 | if [[ -n ${2+x} ]]; then | |
5724 |
|
5732 | |||
5725 | args['--docker-stop-wait']="$2" |
|
5733 | args['--docker-stop-wait']="$2" | |
5726 | shift |
|
5734 | shift | |
5727 | shift |
|
5735 | shift | |
5728 | else |
|
5736 | else | |
5729 | printf "%s\n" "--docker-stop-wait requires an argument: --docker-stop-wait DOCKER_STOP_WAIT" >&2 |
|
5737 | printf "%s\n" "--docker-stop-wait requires an argument: --docker-stop-wait DOCKER_STOP_WAIT" >&2 | |
5730 | exit 1 |
|
5738 | exit 1 | |
5731 | fi |
|
5739 | fi | |
5732 | ;; |
|
5740 | ;; | |
5733 |
|
5741 | |||
5734 | -?*) |
|
5742 | -?*) | |
5735 | printf "invalid option: %s\n" "$key" >&2 |
|
5743 | printf "invalid option: %s\n" "$key" >&2 | |
5736 | exit 1 |
|
5744 | exit 1 | |
5737 | ;; |
|
5745 | ;; | |
5738 |
|
5746 | |||
5739 | *) |
|
5747 | *) | |
5740 | # :command.parse_requirements_case |
|
5748 | # :command.parse_requirements_case | |
5741 | # :command.parse_requirements_case_simple |
|
5749 | # :command.parse_requirements_case_simple | |
5742 | printf "invalid argument: %s\n" "$key" >&2 |
|
5750 | printf "invalid argument: %s\n" "$key" >&2 | |
5743 | exit 1 |
|
5751 | exit 1 | |
5744 |
|
5752 | |||
5745 | ;; |
|
5753 | ;; | |
5746 |
|
5754 | |||
5747 | esac |
|
5755 | esac | |
5748 | done |
|
5756 | done | |
5749 |
|
5757 | |||
5750 | # :command.default_assignments |
|
5758 | # :command.default_assignments | |
5751 | [[ -n ${args['--stop-wait']:-} ]] || args['--stop-wait']="120" |
|
5759 | [[ -n ${args['--stop-wait']:-} ]] || args['--stop-wait']="120" | |
5752 | [[ -n ${args['--docker-stop-wait']:-} ]] || args['--docker-stop-wait']="3600" |
|
5760 | [[ -n ${args['--docker-stop-wait']:-} ]] || args['--docker-stop-wait']="3600" | |
5753 |
|
5761 | |||
5754 | } |
|
5762 | } | |
5755 |
|
5763 | |||
5756 | # :command.parse_requirements |
|
5764 | # :command.parse_requirements | |
5757 | rcstack_stack_monitor_parse_requirements() { |
|
5765 | rcstack_stack_monitor_parse_requirements() { | |
5758 | # :command.fixed_flags_filter |
|
5766 | # :command.fixed_flags_filter | |
5759 | while [[ $# -gt 0 ]]; do |
|
5767 | while [[ $# -gt 0 ]]; do | |
5760 | case "${1:-}" in |
|
5768 | case "${1:-}" in | |
5761 | --help | -h) |
|
5769 | --help | -h) | |
5762 | long_usage=yes |
|
5770 | long_usage=yes | |
5763 | rcstack_stack_monitor_usage |
|
5771 | rcstack_stack_monitor_usage | |
5764 | exit |
|
5772 | exit | |
5765 | ;; |
|
5773 | ;; | |
5766 |
|
5774 | |||
5767 | *) |
|
5775 | *) | |
5768 | break |
|
5776 | break | |
5769 | ;; |
|
5777 | ;; | |
5770 |
|
5778 | |||
5771 | esac |
|
5779 | esac | |
5772 | done |
|
5780 | done | |
5773 |
|
5781 | |||
5774 | # :command.command_filter |
|
5782 | # :command.command_filter | |
5775 | action=${1:-} |
|
5783 | action=${1:-} | |
5776 |
|
5784 | |||
5777 | case $action in |
|
5785 | case $action in | |
5778 | -*) ;; |
|
5786 | -*) ;; | |
5779 |
|
5787 | |||
5780 | restart-unhealthy) |
|
5788 | restart-unhealthy) | |
5781 | action="restart-unhealthy" |
|
5789 | action="restart-unhealthy" | |
5782 | shift |
|
5790 | shift | |
5783 | rcstack_stack_monitor_restart_unhealthy_parse_requirements "$@" |
|
5791 | rcstack_stack_monitor_restart_unhealthy_parse_requirements "$@" | |
5784 | shift $# |
|
5792 | shift $# | |
5785 | ;; |
|
5793 | ;; | |
5786 |
|
5794 | |||
5787 | # :command.command_fallback |
|
5795 | # :command.command_fallback | |
5788 | "") |
|
5796 | "") | |
5789 | rcstack_stack_monitor_usage >&2 |
|
5797 | rcstack_stack_monitor_usage >&2 | |
5790 | exit 1 |
|
5798 | exit 1 | |
5791 | ;; |
|
5799 | ;; | |
5792 |
|
5800 | |||
5793 | *) |
|
5801 | *) | |
5794 | printf "invalid command: %s\n" "$action" >&2 |
|
5802 | printf "invalid command: %s\n" "$action" >&2 | |
5795 | exit 1 |
|
5803 | exit 1 | |
5796 | ;; |
|
5804 | ;; | |
5797 |
|
5805 | |||
5798 | esac |
|
5806 | esac | |
5799 |
|
5807 | |||
5800 | # :command.parse_requirements_while |
|
5808 | # :command.parse_requirements_while | |
5801 | while [[ $# -gt 0 ]]; do |
|
5809 | while [[ $# -gt 0 ]]; do | |
5802 | key="$1" |
|
5810 | key="$1" | |
5803 | case "$key" in |
|
5811 | case "$key" in | |
5804 |
|
5812 | |||
5805 | -?*) |
|
5813 | -?*) | |
5806 | printf "invalid option: %s\n" "$key" >&2 |
|
5814 | printf "invalid option: %s\n" "$key" >&2 | |
5807 | exit 1 |
|
5815 | exit 1 | |
5808 | ;; |
|
5816 | ;; | |
5809 |
|
5817 | |||
5810 | *) |
|
5818 | *) | |
5811 | # :command.parse_requirements_case |
|
5819 | # :command.parse_requirements_case | |
5812 | # :command.parse_requirements_case_simple |
|
5820 | # :command.parse_requirements_case_simple | |
5813 | printf "invalid argument: %s\n" "$key" >&2 |
|
5821 | printf "invalid argument: %s\n" "$key" >&2 | |
5814 | exit 1 |
|
5822 | exit 1 | |
5815 |
|
5823 | |||
5816 | ;; |
|
5824 | ;; | |
5817 |
|
5825 | |||
5818 | esac |
|
5826 | esac | |
5819 | done |
|
5827 | done | |
5820 |
|
5828 | |||
5821 | } |
|
5829 | } | |
5822 |
|
5830 | |||
5823 | # :command.parse_requirements |
|
5831 | # :command.parse_requirements | |
5824 | rcstack_stack_monitor_restart_unhealthy_parse_requirements() { |
|
5832 | rcstack_stack_monitor_restart_unhealthy_parse_requirements() { | |
5825 | # :command.fixed_flags_filter |
|
5833 | # :command.fixed_flags_filter | |
5826 | while [[ $# -gt 0 ]]; do |
|
5834 | while [[ $# -gt 0 ]]; do | |
5827 | case "${1:-}" in |
|
5835 | case "${1:-}" in | |
5828 | --help | -h) |
|
5836 | --help | -h) | |
5829 | long_usage=yes |
|
5837 | long_usage=yes | |
5830 | rcstack_stack_monitor_restart_unhealthy_usage |
|
5838 | rcstack_stack_monitor_restart_unhealthy_usage | |
5831 | exit |
|
5839 | exit | |
5832 | ;; |
|
5840 | ;; | |
5833 |
|
5841 | |||
5834 | *) |
|
5842 | *) | |
5835 | break |
|
5843 | break | |
5836 | ;; |
|
5844 | ;; | |
5837 |
|
5845 | |||
5838 | esac |
|
5846 | esac | |
5839 | done |
|
5847 | done | |
5840 |
|
5848 | |||
5841 | # :command.command_filter |
|
5849 | # :command.command_filter | |
5842 | action="stack-monitor restart-unhealthy" |
|
5850 | action="stack-monitor restart-unhealthy" | |
5843 |
|
5851 | |||
5844 | # :command.parse_requirements_while |
|
5852 | # :command.parse_requirements_while | |
5845 | while [[ $# -gt 0 ]]; do |
|
5853 | while [[ $# -gt 0 ]]; do | |
5846 | key="$1" |
|
5854 | key="$1" | |
5847 | case "$key" in |
|
5855 | case "$key" in | |
5848 | # :flag.case |
|
5856 | # :flag.case | |
5849 | --loop) |
|
5857 | --loop) | |
5850 |
|
5858 | |||
5851 | # :flag.case_arg |
|
5859 | # :flag.case_arg | |
5852 | if [[ -n ${2+x} ]]; then |
|
5860 | if [[ -n ${2+x} ]]; then | |
5853 | # :flag.validations |
|
5861 | # :flag.validations | |
5854 | if [[ -n $(validate_integer "$2") ]]; then |
|
5862 | if [[ -n $(validate_integer "$2") ]]; then | |
5855 | printf "validation error in %s:\n%s\n" "--loop LOOP" "$(validate_integer "$2")" >&2 |
|
5863 | printf "validation error in %s:\n%s\n" "--loop LOOP" "$(validate_integer "$2")" >&2 | |
5856 | exit 1 |
|
5864 | exit 1 | |
5857 | fi |
|
5865 | fi | |
5858 |
|
5866 | |||
5859 | args['--loop']="$2" |
|
5867 | args['--loop']="$2" | |
5860 | shift |
|
5868 | shift | |
5861 | shift |
|
5869 | shift | |
5862 | else |
|
5870 | else | |
5863 | printf "%s\n" "--loop requires an argument: --loop LOOP" >&2 |
|
5871 | printf "%s\n" "--loop requires an argument: --loop LOOP" >&2 | |
5864 | exit 1 |
|
5872 | exit 1 | |
5865 | fi |
|
5873 | fi | |
5866 | ;; |
|
5874 | ;; | |
5867 |
|
5875 | |||
5868 | -?*) |
|
5876 | -?*) | |
5869 | printf "invalid option: %s\n" "$key" >&2 |
|
5877 | printf "invalid option: %s\n" "$key" >&2 | |
5870 | exit 1 |
|
5878 | exit 1 | |
5871 | ;; |
|
5879 | ;; | |
5872 |
|
5880 | |||
5873 | *) |
|
5881 | *) | |
5874 | # :command.parse_requirements_case |
|
5882 | # :command.parse_requirements_case | |
5875 | # :command.parse_requirements_case_simple |
|
5883 | # :command.parse_requirements_case_simple | |
5876 | printf "invalid argument: %s\n" "$key" >&2 |
|
5884 | printf "invalid argument: %s\n" "$key" >&2 | |
5877 | exit 1 |
|
5885 | exit 1 | |
5878 |
|
5886 | |||
5879 | ;; |
|
5887 | ;; | |
5880 |
|
5888 | |||
5881 | esac |
|
5889 | esac | |
5882 | done |
|
5890 | done | |
5883 |
|
5891 | |||
5884 | # :command.default_assignments |
|
5892 | # :command.default_assignments | |
5885 | [[ -n ${args['--loop']:-} ]] || args['--loop']="0" |
|
5893 | [[ -n ${args['--loop']:-} ]] || args['--loop']="0" | |
5886 |
|
5894 | |||
5887 | } |
|
5895 | } | |
5888 |
|
5896 | |||
5889 | # :command.parse_requirements |
|
5897 | # :command.parse_requirements | |
5890 | rcstack_cli_parse_requirements() { |
|
5898 | rcstack_cli_parse_requirements() { | |
5891 | # :command.fixed_flags_filter |
|
5899 | # :command.fixed_flags_filter | |
5892 | while [[ $# -gt 0 ]]; do |
|
5900 | while [[ $# -gt 0 ]]; do | |
5893 | case "${1:-}" in |
|
5901 | case "${1:-}" in | |
5894 | --help | -h) |
|
5902 | --help | -h) | |
5895 | long_usage=yes |
|
5903 | long_usage=yes | |
5896 | rcstack_cli_usage |
|
5904 | rcstack_cli_usage | |
5897 | exit |
|
5905 | exit | |
5898 | ;; |
|
5906 | ;; | |
5899 |
|
5907 | |||
5900 | *) |
|
5908 | *) | |
5901 | break |
|
5909 | break | |
5902 | ;; |
|
5910 | ;; | |
5903 |
|
5911 | |||
5904 | esac |
|
5912 | esac | |
5905 | done |
|
5913 | done | |
5906 |
|
5914 | |||
5907 | # :command.command_filter |
|
5915 | # :command.command_filter | |
5908 | action=${1:-} |
|
5916 | action=${1:-} | |
5909 |
|
5917 | |||
5910 | case $action in |
|
5918 | case $action in | |
5911 | -*) ;; |
|
5919 | -*) ;; | |
5912 |
|
5920 | |||
5913 | cmd) |
|
5921 | cmd) | |
5914 | action="cmd" |
|
5922 | action="cmd" | |
5915 | shift |
|
5923 | shift | |
5916 | rcstack_cli_cmd_parse_requirements "$@" |
|
5924 | rcstack_cli_cmd_parse_requirements "$@" | |
5917 | shift $# |
|
5925 | shift $# | |
5918 | ;; |
|
5926 | ;; | |
5919 |
|
5927 | |||
5920 | image-info) |
|
5928 | image-info) | |
5921 | action="image-info" |
|
5929 | action="image-info" | |
5922 | shift |
|
5930 | shift | |
5923 | rcstack_cli_image_info_parse_requirements "$@" |
|
5931 | rcstack_cli_image_info_parse_requirements "$@" | |
5924 | shift $# |
|
5932 | shift $# | |
5925 | ;; |
|
5933 | ;; | |
5926 |
|
5934 | |||
5927 | set-runtime-image) |
|
5935 | set-runtime-image) | |
5928 | action="set-runtime-image" |
|
5936 | action="set-runtime-image" | |
5929 | shift |
|
5937 | shift | |
5930 | rcstack_cli_set_runtime_image_parse_requirements "$@" |
|
5938 | rcstack_cli_set_runtime_image_parse_requirements "$@" | |
5931 | shift $# |
|
5939 | shift $# | |
5932 | ;; |
|
5940 | ;; | |
5933 |
|
5941 | |||
5934 | docker-info) |
|
5942 | docker-info) | |
5935 | action="docker-info" |
|
5943 | action="docker-info" | |
5936 | shift |
|
5944 | shift | |
5937 | rcstack_cli_docker_info_parse_requirements "$@" |
|
5945 | rcstack_cli_docker_info_parse_requirements "$@" | |
5938 | shift $# |
|
5946 | shift $# | |
5939 | ;; |
|
5947 | ;; | |
5940 |
|
5948 | |||
5941 | docker-upgrade) |
|
5949 | docker-upgrade) | |
5942 | action="docker-upgrade" |
|
5950 | action="docker-upgrade" | |
5943 | shift |
|
5951 | shift | |
5944 | rcstack_cli_docker_upgrade_parse_requirements "$@" |
|
5952 | rcstack_cli_docker_upgrade_parse_requirements "$@" | |
5945 | shift $# |
|
5953 | shift $# | |
5946 | ;; |
|
5954 | ;; | |
5947 |
|
5955 | |||
5948 | ishell) |
|
5956 | ishell) | |
5949 | action="ishell" |
|
5957 | action="ishell" | |
5950 | shift |
|
5958 | shift | |
5951 | rcstack_cli_ishell_parse_requirements "$@" |
|
5959 | rcstack_cli_ishell_parse_requirements "$@" | |
5952 | shift $# |
|
5960 | shift $# | |
5953 | ;; |
|
5961 | ;; | |
5954 |
|
5962 | |||
5955 | redis) |
|
5963 | redis) | |
5956 | action="redis" |
|
5964 | action="redis" | |
5957 | shift |
|
5965 | shift | |
5958 | rcstack_cli_redis_parse_requirements "$@" |
|
5966 | rcstack_cli_redis_parse_requirements "$@" | |
5959 | shift $# |
|
5967 | shift $# | |
5960 | ;; |
|
5968 | ;; | |
5961 |
|
5969 | |||
5962 | db) |
|
5970 | db) | |
5963 | action="db" |
|
5971 | action="db" | |
5964 | shift |
|
5972 | shift | |
5965 | rcstack_cli_db_parse_requirements "$@" |
|
5973 | rcstack_cli_db_parse_requirements "$@" | |
5966 | shift $# |
|
5974 | shift $# | |
5967 | ;; |
|
5975 | ;; | |
5968 |
|
5976 | |||
5969 | db-upgrade) |
|
5977 | db-upgrade) | |
5970 | action="db-upgrade" |
|
5978 | action="db-upgrade" | |
5971 | shift |
|
5979 | shift | |
5972 | rcstack_cli_db_upgrade_parse_requirements "$@" |
|
5980 | rcstack_cli_db_upgrade_parse_requirements "$@" | |
5973 | shift $# |
|
5981 | shift $# | |
5974 | ;; |
|
5982 | ;; | |
5975 |
|
5983 | |||
5976 | storage) |
|
5984 | storage) | |
5977 | action="storage" |
|
5985 | action="storage" | |
5978 | shift |
|
5986 | shift | |
5979 | rcstack_cli_storage_parse_requirements "$@" |
|
5987 | rcstack_cli_storage_parse_requirements "$@" | |
5980 | shift $# |
|
5988 | shift $# | |
5981 | ;; |
|
5989 | ;; | |
5982 |
|
5990 | |||
5983 | attach) |
|
5991 | attach) | |
5984 | action="attach" |
|
5992 | action="attach" | |
5985 | shift |
|
5993 | shift | |
5986 | rcstack_cli_attach_parse_requirements "$@" |
|
5994 | rcstack_cli_attach_parse_requirements "$@" | |
5987 | shift $# |
|
5995 | shift $# | |
5988 | ;; |
|
5996 | ;; | |
5989 |
|
5997 | |||
5990 | set-edition) |
|
5998 | set-edition) | |
5991 | action="set-edition" |
|
5999 | action="set-edition" | |
5992 | shift |
|
6000 | shift | |
5993 | rcstack_cli_set_edition_parse_requirements "$@" |
|
6001 | rcstack_cli_set_edition_parse_requirements "$@" | |
5994 | shift $# |
|
6002 | shift $# | |
5995 | ;; |
|
6003 | ;; | |
5996 |
|
6004 | |||
5997 | configure-vcsserver) |
|
6005 | configure-vcsserver) | |
5998 | action="configure-vcsserver" |
|
6006 | action="configure-vcsserver" | |
5999 | shift |
|
6007 | shift | |
6000 | rcstack_cli_configure_vcsserver_parse_requirements "$@" |
|
6008 | rcstack_cli_configure_vcsserver_parse_requirements "$@" | |
6001 | shift $# |
|
6009 | shift $# | |
6002 | ;; |
|
6010 | ;; | |
6003 |
|
6011 | |||
6004 | configure-rhodecode) |
|
6012 | configure-rhodecode) | |
6005 | action="configure-rhodecode" |
|
6013 | action="configure-rhodecode" | |
6006 | shift |
|
6014 | shift | |
6007 | rcstack_cli_configure_rhodecode_parse_requirements "$@" |
|
6015 | rcstack_cli_configure_rhodecode_parse_requirements "$@" | |
6008 | shift $# |
|
6016 | shift $# | |
6009 | ;; |
|
6017 | ;; | |
6010 |
|
6018 | |||
6011 | # :command.command_fallback |
|
6019 | # :command.command_fallback | |
6012 | "") |
|
6020 | "") | |
6013 | rcstack_cli_usage >&2 |
|
6021 | rcstack_cli_usage >&2 | |
6014 | exit 1 |
|
6022 | exit 1 | |
6015 | ;; |
|
6023 | ;; | |
6016 |
|
6024 | |||
6017 | *) |
|
6025 | *) | |
6018 | printf "invalid command: %s\n" "$action" >&2 |
|
6026 | printf "invalid command: %s\n" "$action" >&2 | |
6019 | exit 1 |
|
6027 | exit 1 | |
6020 | ;; |
|
6028 | ;; | |
6021 |
|
6029 | |||
6022 | esac |
|
6030 | esac | |
6023 |
|
6031 | |||
6024 | # :command.parse_requirements_while |
|
6032 | # :command.parse_requirements_while | |
6025 | while [[ $# -gt 0 ]]; do |
|
6033 | while [[ $# -gt 0 ]]; do | |
6026 | key="$1" |
|
6034 | key="$1" | |
6027 | case "$key" in |
|
6035 | case "$key" in | |
6028 |
|
6036 | |||
6029 | -?*) |
|
6037 | -?*) | |
6030 | printf "invalid option: %s\n" "$key" >&2 |
|
6038 | printf "invalid option: %s\n" "$key" >&2 | |
6031 | exit 1 |
|
6039 | exit 1 | |
6032 | ;; |
|
6040 | ;; | |
6033 |
|
6041 | |||
6034 | *) |
|
6042 | *) | |
6035 | # :command.parse_requirements_case |
|
6043 | # :command.parse_requirements_case | |
6036 | # :command.parse_requirements_case_simple |
|
6044 | # :command.parse_requirements_case_simple | |
6037 | printf "invalid argument: %s\n" "$key" >&2 |
|
6045 | printf "invalid argument: %s\n" "$key" >&2 | |
6038 | exit 1 |
|
6046 | exit 1 | |
6039 |
|
6047 | |||
6040 | ;; |
|
6048 | ;; | |
6041 |
|
6049 | |||
6042 | esac |
|
6050 | esac | |
6043 | done |
|
6051 | done | |
6044 |
|
6052 | |||
6045 | } |
|
6053 | } | |
6046 |
|
6054 | |||
6047 | # :command.parse_requirements |
|
6055 | # :command.parse_requirements | |
6048 | rcstack_cli_cmd_parse_requirements() { |
|
6056 | rcstack_cli_cmd_parse_requirements() { | |
6049 | # :command.fixed_flags_filter |
|
6057 | # :command.fixed_flags_filter | |
6050 | while [[ $# -gt 0 ]]; do |
|
6058 | while [[ $# -gt 0 ]]; do | |
6051 | case "${1:-}" in |
|
6059 | case "${1:-}" in | |
6052 | --help | -h) |
|
6060 | --help | -h) | |
6053 | long_usage=yes |
|
6061 | long_usage=yes | |
6054 | rcstack_cli_cmd_usage |
|
6062 | rcstack_cli_cmd_usage | |
6055 | exit |
|
6063 | exit | |
6056 | ;; |
|
6064 | ;; | |
6057 |
|
6065 | |||
6058 | *) |
|
6066 | *) | |
6059 | break |
|
6067 | break | |
6060 | ;; |
|
6068 | ;; | |
6061 |
|
6069 | |||
6062 | esac |
|
6070 | esac | |
6063 | done |
|
6071 | done | |
6064 |
|
6072 | |||
6065 | # :command.command_filter |
|
6073 | # :command.command_filter | |
6066 | action="cli cmd" |
|
6074 | action="cli cmd" | |
6067 |
|
6075 | |||
6068 | # :command.parse_requirements_while |
|
6076 | # :command.parse_requirements_while | |
6069 | while [[ $# -gt 0 ]]; do |
|
6077 | while [[ $# -gt 0 ]]; do | |
6070 | key="$1" |
|
6078 | key="$1" | |
6071 | case "$key" in |
|
6079 | case "$key" in | |
6072 | # :flag.case |
|
6080 | # :flag.case | |
6073 | --env-file-path) |
|
6081 | --env-file-path) | |
6074 |
|
6082 | |||
6075 | # :flag.case_arg |
|
6083 | # :flag.case_arg | |
6076 | if [[ -n ${2+x} ]]; then |
|
6084 | if [[ -n ${2+x} ]]; then | |
6077 | # :flag.validations |
|
6085 | # :flag.validations | |
6078 | if [[ -n $(validate_file_exists "$2") ]]; then |
|
6086 | if [[ -n $(validate_file_exists "$2") ]]; then | |
6079 | printf "validation error in %s:\n%s\n" "--env-file-path ENV_FILE_PATH" "$(validate_file_exists "$2")" >&2 |
|
6087 | printf "validation error in %s:\n%s\n" "--env-file-path ENV_FILE_PATH" "$(validate_file_exists "$2")" >&2 | |
6080 | exit 1 |
|
6088 | exit 1 | |
6081 | fi |
|
6089 | fi | |
6082 |
|
6090 | |||
6083 | args['--env-file-path']="$2" |
|
6091 | args['--env-file-path']="$2" | |
6084 | shift |
|
6092 | shift | |
6085 | shift |
|
6093 | shift | |
6086 | else |
|
6094 | else | |
6087 | printf "%s\n" "--env-file-path requires an argument: --env-file-path ENV_FILE_PATH" >&2 |
|
6095 | printf "%s\n" "--env-file-path requires an argument: --env-file-path ENV_FILE_PATH" >&2 | |
6088 | exit 1 |
|
6096 | exit 1 | |
6089 | fi |
|
6097 | fi | |
6090 | ;; |
|
6098 | ;; | |
6091 |
|
6099 | |||
6092 | --) |
|
6100 | --) | |
6093 | shift |
|
6101 | shift | |
6094 | other_args+=("$@") |
|
6102 | other_args+=("$@") | |
6095 | break |
|
6103 | break | |
6096 | ;; |
|
6104 | ;; | |
6097 |
|
6105 | |||
6098 | -?*) |
|
6106 | -?*) | |
6099 | other_args+=("$1") |
|
6107 | other_args+=("$1") | |
6100 | shift |
|
6108 | shift | |
6101 | ;; |
|
6109 | ;; | |
6102 |
|
6110 | |||
6103 | *) |
|
6111 | *) | |
6104 | # :command.parse_requirements_case |
|
6112 | # :command.parse_requirements_case | |
6105 | # :command.parse_requirements_case_catch_all |
|
6113 | # :command.parse_requirements_case_catch_all | |
6106 | other_args+=("$1") |
|
6114 | other_args+=("$1") | |
6107 | shift |
|
6115 | shift | |
6108 |
|
6116 | |||
6109 | ;; |
|
6117 | ;; | |
6110 |
|
6118 | |||
6111 | esac |
|
6119 | esac | |
6112 | done |
|
6120 | done | |
6113 |
|
6121 | |||
6114 | # :command.default_assignments |
|
6122 | # :command.default_assignments | |
6115 | [[ -n ${args['--env-file-path']:-} ]] || args['--env-file-path']="$PWD/.custom/.runtime.env" |
|
6123 | [[ -n ${args['--env-file-path']:-} ]] || args['--env-file-path']="$PWD/.custom/.runtime.env" | |
6116 |
|
6124 | |||
6117 | } |
|
6125 | } | |
6118 |
|
6126 | |||
6119 | # :command.parse_requirements |
|
6127 | # :command.parse_requirements | |
6120 | rcstack_cli_image_info_parse_requirements() { |
|
6128 | rcstack_cli_image_info_parse_requirements() { | |
6121 | # :command.fixed_flags_filter |
|
6129 | # :command.fixed_flags_filter | |
6122 | while [[ $# -gt 0 ]]; do |
|
6130 | while [[ $# -gt 0 ]]; do | |
6123 | case "${1:-}" in |
|
6131 | case "${1:-}" in | |
6124 | --help | -h) |
|
6132 | --help | -h) | |
6125 | long_usage=yes |
|
6133 | long_usage=yes | |
6126 | rcstack_cli_image_info_usage |
|
6134 | rcstack_cli_image_info_usage | |
6127 | exit |
|
6135 | exit | |
6128 | ;; |
|
6136 | ;; | |
6129 |
|
6137 | |||
6130 | *) |
|
6138 | *) | |
6131 | break |
|
6139 | break | |
6132 | ;; |
|
6140 | ;; | |
6133 |
|
6141 | |||
6134 | esac |
|
6142 | esac | |
6135 | done |
|
6143 | done | |
6136 |
|
6144 | |||
6137 | # :command.command_filter |
|
6145 | # :command.command_filter | |
6138 | action="cli image-info" |
|
6146 | action="cli image-info" | |
6139 |
|
6147 | |||
6140 | # :command.parse_requirements_while |
|
6148 | # :command.parse_requirements_while | |
6141 | while [[ $# -gt 0 ]]; do |
|
6149 | while [[ $# -gt 0 ]]; do | |
6142 | key="$1" |
|
6150 | key="$1" | |
6143 | case "$key" in |
|
6151 | case "$key" in | |
6144 | # :flag.case |
|
6152 | # :flag.case | |
6145 | --verbose) |
|
6153 | --verbose) | |
6146 |
|
6154 | |||
6147 | # :flag.case_no_arg |
|
6155 | # :flag.case_no_arg | |
6148 | args['--verbose']=1 |
|
6156 | args['--verbose']=1 | |
6149 | shift |
|
6157 | shift | |
6150 | ;; |
|
6158 | ;; | |
6151 |
|
6159 | |||
6152 | -?*) |
|
6160 | -?*) | |
6153 | printf "invalid option: %s\n" "$key" >&2 |
|
6161 | printf "invalid option: %s\n" "$key" >&2 | |
6154 | exit 1 |
|
6162 | exit 1 | |
6155 | ;; |
|
6163 | ;; | |
6156 |
|
6164 | |||
6157 | *) |
|
6165 | *) | |
6158 | # :command.parse_requirements_case |
|
6166 | # :command.parse_requirements_case | |
6159 | # :command.parse_requirements_case_simple |
|
6167 | # :command.parse_requirements_case_simple | |
6160 | printf "invalid argument: %s\n" "$key" >&2 |
|
6168 | printf "invalid argument: %s\n" "$key" >&2 | |
6161 | exit 1 |
|
6169 | exit 1 | |
6162 |
|
6170 | |||
6163 | ;; |
|
6171 | ;; | |
6164 |
|
6172 | |||
6165 | esac |
|
6173 | esac | |
6166 | done |
|
6174 | done | |
6167 |
|
6175 | |||
6168 | } |
|
6176 | } | |
6169 |
|
6177 | |||
6170 | # :command.parse_requirements |
|
6178 | # :command.parse_requirements | |
6171 | rcstack_cli_set_runtime_image_parse_requirements() { |
|
6179 | rcstack_cli_set_runtime_image_parse_requirements() { | |
6172 | # :command.fixed_flags_filter |
|
6180 | # :command.fixed_flags_filter | |
6173 | while [[ $# -gt 0 ]]; do |
|
6181 | while [[ $# -gt 0 ]]; do | |
6174 | case "${1:-}" in |
|
6182 | case "${1:-}" in | |
6175 | --help | -h) |
|
6183 | --help | -h) | |
6176 | long_usage=yes |
|
6184 | long_usage=yes | |
6177 | rcstack_cli_set_runtime_image_usage |
|
6185 | rcstack_cli_set_runtime_image_usage | |
6178 | exit |
|
6186 | exit | |
6179 | ;; |
|
6187 | ;; | |
6180 |
|
6188 | |||
6181 | *) |
|
6189 | *) | |
6182 | break |
|
6190 | break | |
6183 | ;; |
|
6191 | ;; | |
6184 |
|
6192 | |||
6185 | esac |
|
6193 | esac | |
6186 | done |
|
6194 | done | |
6187 |
|
6195 | |||
6188 | # :command.command_filter |
|
6196 | # :command.command_filter | |
6189 | action="cli set-runtime-image" |
|
6197 | action="cli set-runtime-image" | |
6190 |
|
6198 | |||
6191 | # :command.parse_requirements_while |
|
6199 | # :command.parse_requirements_while | |
6192 | while [[ $# -gt 0 ]]; do |
|
6200 | while [[ $# -gt 0 ]]; do | |
6193 | key="$1" |
|
6201 | key="$1" | |
6194 | case "$key" in |
|
6202 | case "$key" in | |
6195 |
|
6203 | |||
6196 | -?*) |
|
6204 | -?*) | |
6197 | printf "invalid option: %s\n" "$key" >&2 |
|
6205 | printf "invalid option: %s\n" "$key" >&2 | |
6198 | exit 1 |
|
6206 | exit 1 | |
6199 | ;; |
|
6207 | ;; | |
6200 |
|
6208 | |||
6201 | *) |
|
6209 | *) | |
6202 | # :command.parse_requirements_case |
|
6210 | # :command.parse_requirements_case | |
6203 | # :command.parse_requirements_case_simple |
|
6211 | # :command.parse_requirements_case_simple | |
6204 | if [[ -z ${args['version']+x} ]]; then |
|
6212 | if [[ -z ${args['version']+x} ]]; then | |
6205 |
|
6213 | |||
6206 | args['version']=$1 |
|
6214 | args['version']=$1 | |
6207 | shift |
|
6215 | shift | |
6208 | else |
|
6216 | else | |
6209 | printf "invalid argument: %s\n" "$key" >&2 |
|
6217 | printf "invalid argument: %s\n" "$key" >&2 | |
6210 | exit 1 |
|
6218 | exit 1 | |
6211 | fi |
|
6219 | fi | |
6212 |
|
6220 | |||
6213 | ;; |
|
6221 | ;; | |
6214 |
|
6222 | |||
6215 | esac |
|
6223 | esac | |
6216 | done |
|
6224 | done | |
6217 |
|
6225 | |||
6218 | # :command.required_args_filter |
|
6226 | # :command.required_args_filter | |
6219 | if [[ -z ${args['version']+x} ]]; then |
|
6227 | if [[ -z ${args['version']+x} ]]; then | |
6220 | printf "missing required argument: VERSION\nusage: rcstack cli set-runtime-image VERSION\n" >&2 |
|
6228 | printf "missing required argument: VERSION\nusage: rcstack cli set-runtime-image VERSION\n" >&2 | |
6221 | exit 1 |
|
6229 | exit 1 | |
6222 | fi |
|
6230 | fi | |
6223 |
|
6231 | |||
6224 | } |
|
6232 | } | |
6225 |
|
6233 | |||
6226 | # :command.parse_requirements |
|
6234 | # :command.parse_requirements | |
6227 | rcstack_cli_docker_info_parse_requirements() { |
|
6235 | rcstack_cli_docker_info_parse_requirements() { | |
6228 | # :command.fixed_flags_filter |
|
6236 | # :command.fixed_flags_filter | |
6229 | while [[ $# -gt 0 ]]; do |
|
6237 | while [[ $# -gt 0 ]]; do | |
6230 | case "${1:-}" in |
|
6238 | case "${1:-}" in | |
6231 | --help | -h) |
|
6239 | --help | -h) | |
6232 | long_usage=yes |
|
6240 | long_usage=yes | |
6233 | rcstack_cli_docker_info_usage |
|
6241 | rcstack_cli_docker_info_usage | |
6234 | exit |
|
6242 | exit | |
6235 | ;; |
|
6243 | ;; | |
6236 |
|
6244 | |||
6237 | *) |
|
6245 | *) | |
6238 | break |
|
6246 | break | |
6239 | ;; |
|
6247 | ;; | |
6240 |
|
6248 | |||
6241 | esac |
|
6249 | esac | |
6242 | done |
|
6250 | done | |
6243 |
|
6251 | |||
6244 | # :command.command_filter |
|
6252 | # :command.command_filter | |
6245 | action="cli docker-info" |
|
6253 | action="cli docker-info" | |
6246 |
|
6254 | |||
6247 | # :command.parse_requirements_while |
|
6255 | # :command.parse_requirements_while | |
6248 | while [[ $# -gt 0 ]]; do |
|
6256 | while [[ $# -gt 0 ]]; do | |
6249 | key="$1" |
|
6257 | key="$1" | |
6250 | case "$key" in |
|
6258 | case "$key" in | |
6251 | # :flag.case |
|
6259 | # :flag.case | |
6252 | --verbose) |
|
6260 | --verbose) | |
6253 |
|
6261 | |||
6254 | # :flag.case_no_arg |
|
6262 | # :flag.case_no_arg | |
6255 | args['--verbose']=1 |
|
6263 | args['--verbose']=1 | |
6256 | shift |
|
6264 | shift | |
6257 | ;; |
|
6265 | ;; | |
6258 |
|
6266 | |||
6259 | -?*) |
|
6267 | -?*) | |
6260 | printf "invalid option: %s\n" "$key" >&2 |
|
6268 | printf "invalid option: %s\n" "$key" >&2 | |
6261 | exit 1 |
|
6269 | exit 1 | |
6262 | ;; |
|
6270 | ;; | |
6263 |
|
6271 | |||
6264 | *) |
|
6272 | *) | |
6265 | # :command.parse_requirements_case |
|
6273 | # :command.parse_requirements_case | |
6266 | # :command.parse_requirements_case_simple |
|
6274 | # :command.parse_requirements_case_simple | |
6267 | printf "invalid argument: %s\n" "$key" >&2 |
|
6275 | printf "invalid argument: %s\n" "$key" >&2 | |
6268 | exit 1 |
|
6276 | exit 1 | |
6269 |
|
6277 | |||
6270 | ;; |
|
6278 | ;; | |
6271 |
|
6279 | |||
6272 | esac |
|
6280 | esac | |
6273 | done |
|
6281 | done | |
6274 |
|
6282 | |||
6275 | } |
|
6283 | } | |
6276 |
|
6284 | |||
6277 | # :command.parse_requirements |
|
6285 | # :command.parse_requirements | |
6278 | rcstack_cli_docker_upgrade_parse_requirements() { |
|
6286 | rcstack_cli_docker_upgrade_parse_requirements() { | |
6279 | # :command.fixed_flags_filter |
|
6287 | # :command.fixed_flags_filter | |
6280 | while [[ $# -gt 0 ]]; do |
|
6288 | while [[ $# -gt 0 ]]; do | |
6281 | case "${1:-}" in |
|
6289 | case "${1:-}" in | |
6282 | --help | -h) |
|
6290 | --help | -h) | |
6283 | long_usage=yes |
|
6291 | long_usage=yes | |
6284 | rcstack_cli_docker_upgrade_usage |
|
6292 | rcstack_cli_docker_upgrade_usage | |
6285 | exit |
|
6293 | exit | |
6286 | ;; |
|
6294 | ;; | |
6287 |
|
6295 | |||
6288 | *) |
|
6296 | *) | |
6289 | break |
|
6297 | break | |
6290 | ;; |
|
6298 | ;; | |
6291 |
|
6299 | |||
6292 | esac |
|
6300 | esac | |
6293 | done |
|
6301 | done | |
6294 |
|
6302 | |||
6295 | # :command.command_filter |
|
6303 | # :command.command_filter | |
6296 | action="cli docker-upgrade" |
|
6304 | action="cli docker-upgrade" | |
6297 |
|
6305 | |||
6298 | # :command.parse_requirements_while |
|
6306 | # :command.parse_requirements_while | |
6299 | while [[ $# -gt 0 ]]; do |
|
6307 | while [[ $# -gt 0 ]]; do | |
6300 | key="$1" |
|
6308 | key="$1" | |
6301 | case "$key" in |
|
6309 | case "$key" in | |
6302 |
|
6310 | |||
6303 | -?*) |
|
6311 | -?*) | |
6304 | printf "invalid option: %s\n" "$key" >&2 |
|
6312 | printf "invalid option: %s\n" "$key" >&2 | |
6305 | exit 1 |
|
6313 | exit 1 | |
6306 | ;; |
|
6314 | ;; | |
6307 |
|
6315 | |||
6308 | *) |
|
6316 | *) | |
6309 | # :command.parse_requirements_case |
|
6317 | # :command.parse_requirements_case | |
6310 | # :command.parse_requirements_case_simple |
|
6318 | # :command.parse_requirements_case_simple | |
6311 | printf "invalid argument: %s\n" "$key" >&2 |
|
6319 | printf "invalid argument: %s\n" "$key" >&2 | |
6312 | exit 1 |
|
6320 | exit 1 | |
6313 |
|
6321 | |||
6314 | ;; |
|
6322 | ;; | |
6315 |
|
6323 | |||
6316 | esac |
|
6324 | esac | |
6317 | done |
|
6325 | done | |
6318 |
|
6326 | |||
6319 | } |
|
6327 | } | |
6320 |
|
6328 | |||
6321 | # :command.parse_requirements |
|
6329 | # :command.parse_requirements | |
6322 | rcstack_cli_ishell_parse_requirements() { |
|
6330 | rcstack_cli_ishell_parse_requirements() { | |
6323 | # :command.fixed_flags_filter |
|
6331 | # :command.fixed_flags_filter | |
6324 | while [[ $# -gt 0 ]]; do |
|
6332 | while [[ $# -gt 0 ]]; do | |
6325 | case "${1:-}" in |
|
6333 | case "${1:-}" in | |
6326 | --help | -h) |
|
6334 | --help | -h) | |
6327 | long_usage=yes |
|
6335 | long_usage=yes | |
6328 | rcstack_cli_ishell_usage |
|
6336 | rcstack_cli_ishell_usage | |
6329 | exit |
|
6337 | exit | |
6330 | ;; |
|
6338 | ;; | |
6331 |
|
6339 | |||
6332 | *) |
|
6340 | *) | |
6333 | break |
|
6341 | break | |
6334 | ;; |
|
6342 | ;; | |
6335 |
|
6343 | |||
6336 | esac |
|
6344 | esac | |
6337 | done |
|
6345 | done | |
6338 |
|
6346 | |||
6339 | # :command.command_filter |
|
6347 | # :command.command_filter | |
6340 | action="cli ishell" |
|
6348 | action="cli ishell" | |
6341 |
|
6349 | |||
6342 | # :command.parse_requirements_while |
|
6350 | # :command.parse_requirements_while | |
6343 | while [[ $# -gt 0 ]]; do |
|
6351 | while [[ $# -gt 0 ]]; do | |
6344 | key="$1" |
|
6352 | key="$1" | |
6345 | case "$key" in |
|
6353 | case "$key" in | |
6346 |
|
6354 | |||
6347 | -?*) |
|
6355 | -?*) | |
6348 | printf "invalid option: %s\n" "$key" >&2 |
|
6356 | printf "invalid option: %s\n" "$key" >&2 | |
6349 | exit 1 |
|
6357 | exit 1 | |
6350 | ;; |
|
6358 | ;; | |
6351 |
|
6359 | |||
6352 | *) |
|
6360 | *) | |
6353 | # :command.parse_requirements_case |
|
6361 | # :command.parse_requirements_case | |
6354 | # :command.parse_requirements_case_simple |
|
6362 | # :command.parse_requirements_case_simple | |
6355 | printf "invalid argument: %s\n" "$key" >&2 |
|
6363 | printf "invalid argument: %s\n" "$key" >&2 | |
6356 | exit 1 |
|
6364 | exit 1 | |
6357 |
|
6365 | |||
6358 | ;; |
|
6366 | ;; | |
6359 |
|
6367 | |||
6360 | esac |
|
6368 | esac | |
6361 | done |
|
6369 | done | |
6362 |
|
6370 | |||
6363 | } |
|
6371 | } | |
6364 |
|
6372 | |||
6365 | # :command.parse_requirements |
|
6373 | # :command.parse_requirements | |
6366 | rcstack_cli_redis_parse_requirements() { |
|
6374 | rcstack_cli_redis_parse_requirements() { | |
6367 | # :command.fixed_flags_filter |
|
6375 | # :command.fixed_flags_filter | |
6368 | while [[ $# -gt 0 ]]; do |
|
6376 | while [[ $# -gt 0 ]]; do | |
6369 | case "${1:-}" in |
|
6377 | case "${1:-}" in | |
6370 | --help | -h) |
|
6378 | --help | -h) | |
6371 | long_usage=yes |
|
6379 | long_usage=yes | |
6372 | rcstack_cli_redis_usage |
|
6380 | rcstack_cli_redis_usage | |
6373 | exit |
|
6381 | exit | |
6374 | ;; |
|
6382 | ;; | |
6375 |
|
6383 | |||
6376 | *) |
|
6384 | *) | |
6377 | break |
|
6385 | break | |
6378 | ;; |
|
6386 | ;; | |
6379 |
|
6387 | |||
6380 | esac |
|
6388 | esac | |
6381 | done |
|
6389 | done | |
6382 |
|
6390 | |||
6383 | # :command.command_filter |
|
6391 | # :command.command_filter | |
6384 | action="cli redis" |
|
6392 | action="cli redis" | |
6385 |
|
6393 | |||
6386 | # :command.parse_requirements_while |
|
6394 | # :command.parse_requirements_while | |
6387 | while [[ $# -gt 0 ]]; do |
|
6395 | while [[ $# -gt 0 ]]; do | |
6388 | key="$1" |
|
6396 | key="$1" | |
6389 | case "$key" in |
|
6397 | case "$key" in | |
6390 |
|
6398 | |||
6391 | -?*) |
|
6399 | -?*) | |
6392 | printf "invalid option: %s\n" "$key" >&2 |
|
6400 | printf "invalid option: %s\n" "$key" >&2 | |
6393 | exit 1 |
|
6401 | exit 1 | |
6394 | ;; |
|
6402 | ;; | |
6395 |
|
6403 | |||
6396 | *) |
|
6404 | *) | |
6397 | # :command.parse_requirements_case |
|
6405 | # :command.parse_requirements_case | |
6398 | # :command.parse_requirements_case_simple |
|
6406 | # :command.parse_requirements_case_simple | |
6399 | printf "invalid argument: %s\n" "$key" >&2 |
|
6407 | printf "invalid argument: %s\n" "$key" >&2 | |
6400 | exit 1 |
|
6408 | exit 1 | |
6401 |
|
6409 | |||
6402 | ;; |
|
6410 | ;; | |
6403 |
|
6411 | |||
6404 | esac |
|
6412 | esac | |
6405 | done |
|
6413 | done | |
6406 |
|
6414 | |||
6407 | } |
|
6415 | } | |
6408 |
|
6416 | |||
6409 | # :command.parse_requirements |
|
6417 | # :command.parse_requirements | |
6410 | rcstack_cli_db_parse_requirements() { |
|
6418 | rcstack_cli_db_parse_requirements() { | |
6411 | # :command.fixed_flags_filter |
|
6419 | # :command.fixed_flags_filter | |
6412 | while [[ $# -gt 0 ]]; do |
|
6420 | while [[ $# -gt 0 ]]; do | |
6413 | case "${1:-}" in |
|
6421 | case "${1:-}" in | |
6414 | --help | -h) |
|
6422 | --help | -h) | |
6415 | long_usage=yes |
|
6423 | long_usage=yes | |
6416 | rcstack_cli_db_usage |
|
6424 | rcstack_cli_db_usage | |
6417 | exit |
|
6425 | exit | |
6418 | ;; |
|
6426 | ;; | |
6419 |
|
6427 | |||
6420 | *) |
|
6428 | *) | |
6421 | break |
|
6429 | break | |
6422 | ;; |
|
6430 | ;; | |
6423 |
|
6431 | |||
6424 | esac |
|
6432 | esac | |
6425 | done |
|
6433 | done | |
6426 |
|
6434 | |||
6427 | # :command.command_filter |
|
6435 | # :command.command_filter | |
6428 | action="cli db" |
|
6436 | action="cli db" | |
6429 |
|
6437 | |||
6430 | # :command.parse_requirements_while |
|
6438 | # :command.parse_requirements_while | |
6431 | while [[ $# -gt 0 ]]; do |
|
6439 | while [[ $# -gt 0 ]]; do | |
6432 | key="$1" |
|
6440 | key="$1" | |
6433 | case "$key" in |
|
6441 | case "$key" in | |
6434 |
|
6442 | |||
6435 | -?*) |
|
6443 | -?*) | |
6436 | printf "invalid option: %s\n" "$key" >&2 |
|
6444 | printf "invalid option: %s\n" "$key" >&2 | |
6437 | exit 1 |
|
6445 | exit 1 | |
6438 | ;; |
|
6446 | ;; | |
6439 |
|
6447 | |||
6440 | *) |
|
6448 | *) | |
6441 | # :command.parse_requirements_case |
|
6449 | # :command.parse_requirements_case | |
6442 | # :command.parse_requirements_case_simple |
|
6450 | # :command.parse_requirements_case_simple | |
6443 | printf "invalid argument: %s\n" "$key" >&2 |
|
6451 | printf "invalid argument: %s\n" "$key" >&2 | |
6444 | exit 1 |
|
6452 | exit 1 | |
6445 |
|
6453 | |||
6446 | ;; |
|
6454 | ;; | |
6447 |
|
6455 | |||
6448 | esac |
|
6456 | esac | |
6449 | done |
|
6457 | done | |
6450 |
|
6458 | |||
6451 | } |
|
6459 | } | |
6452 |
|
6460 | |||
6453 | # :command.parse_requirements |
|
6461 | # :command.parse_requirements | |
6454 | rcstack_cli_db_upgrade_parse_requirements() { |
|
6462 | rcstack_cli_db_upgrade_parse_requirements() { | |
6455 | # :command.fixed_flags_filter |
|
6463 | # :command.fixed_flags_filter | |
6456 | while [[ $# -gt 0 ]]; do |
|
6464 | while [[ $# -gt 0 ]]; do | |
6457 | case "${1:-}" in |
|
6465 | case "${1:-}" in | |
6458 | --help | -h) |
|
6466 | --help | -h) | |
6459 | long_usage=yes |
|
6467 | long_usage=yes | |
6460 | rcstack_cli_db_upgrade_usage |
|
6468 | rcstack_cli_db_upgrade_usage | |
6461 | exit |
|
6469 | exit | |
6462 | ;; |
|
6470 | ;; | |
6463 |
|
6471 | |||
6464 | *) |
|
6472 | *) | |
6465 | break |
|
6473 | break | |
6466 | ;; |
|
6474 | ;; | |
6467 |
|
6475 | |||
6468 | esac |
|
6476 | esac | |
6469 | done |
|
6477 | done | |
6470 |
|
6478 | |||
6471 | # :command.command_filter |
|
6479 | # :command.command_filter | |
6472 | action="cli db-upgrade" |
|
6480 | action="cli db-upgrade" | |
6473 |
|
6481 | |||
6474 | # :command.parse_requirements_while |
|
6482 | # :command.parse_requirements_while | |
6475 | while [[ $# -gt 0 ]]; do |
|
6483 | while [[ $# -gt 0 ]]; do | |
6476 | key="$1" |
|
6484 | key="$1" | |
6477 | case "$key" in |
|
6485 | case "$key" in | |
6478 |
|
6486 | |||
6479 | -?*) |
|
6487 | -?*) | |
6480 | printf "invalid option: %s\n" "$key" >&2 |
|
6488 | printf "invalid option: %s\n" "$key" >&2 | |
6481 | exit 1 |
|
6489 | exit 1 | |
6482 | ;; |
|
6490 | ;; | |
6483 |
|
6491 | |||
6484 | *) |
|
6492 | *) | |
6485 | # :command.parse_requirements_case |
|
6493 | # :command.parse_requirements_case | |
6486 | # :command.parse_requirements_case_simple |
|
6494 | # :command.parse_requirements_case_simple | |
6487 | printf "invalid argument: %s\n" "$key" >&2 |
|
6495 | printf "invalid argument: %s\n" "$key" >&2 | |
6488 | exit 1 |
|
6496 | exit 1 | |
6489 |
|
6497 | |||
6490 | ;; |
|
6498 | ;; | |
6491 |
|
6499 | |||
6492 | esac |
|
6500 | esac | |
6493 | done |
|
6501 | done | |
6494 |
|
6502 | |||
6495 | } |
|
6503 | } | |
6496 |
|
6504 | |||
6497 | # :command.parse_requirements |
|
6505 | # :command.parse_requirements | |
6498 | rcstack_cli_storage_parse_requirements() { |
|
6506 | rcstack_cli_storage_parse_requirements() { | |
6499 | # :command.fixed_flags_filter |
|
6507 | # :command.fixed_flags_filter | |
6500 | while [[ $# -gt 0 ]]; do |
|
6508 | while [[ $# -gt 0 ]]; do | |
6501 | case "${1:-}" in |
|
6509 | case "${1:-}" in | |
6502 | --help | -h) |
|
6510 | --help | -h) | |
6503 | long_usage=yes |
|
6511 | long_usage=yes | |
6504 | rcstack_cli_storage_usage |
|
6512 | rcstack_cli_storage_usage | |
6505 | exit |
|
6513 | exit | |
6506 | ;; |
|
6514 | ;; | |
6507 |
|
6515 | |||
6508 | *) |
|
6516 | *) | |
6509 | break |
|
6517 | break | |
6510 | ;; |
|
6518 | ;; | |
6511 |
|
6519 | |||
6512 | esac |
|
6520 | esac | |
6513 | done |
|
6521 | done | |
6514 |
|
6522 | |||
6515 | # :command.command_filter |
|
6523 | # :command.command_filter | |
6516 | action="cli storage" |
|
6524 | action="cli storage" | |
6517 |
|
6525 | |||
6518 | # :command.parse_requirements_while |
|
6526 | # :command.parse_requirements_while | |
6519 | while [[ $# -gt 0 ]]; do |
|
6527 | while [[ $# -gt 0 ]]; do | |
6520 | key="$1" |
|
6528 | key="$1" | |
6521 | case "$key" in |
|
6529 | case "$key" in | |
6522 | # :flag.case |
|
6530 | # :flag.case | |
6523 | --attached) |
|
6531 | --attached) | |
6524 |
|
6532 | |||
6525 | # :flag.case_arg |
|
6533 | # :flag.case_arg | |
6526 | if [[ -n ${2+x} ]]; then |
|
6534 | if [[ -n ${2+x} ]]; then | |
6527 |
|
6535 | |||
6528 | args['--attached']="$2" |
|
6536 | args['--attached']="$2" | |
6529 | shift |
|
6537 | shift | |
6530 | shift |
|
6538 | shift | |
6531 | else |
|
6539 | else | |
6532 | printf "%s\n" "--attached requires an argument: --attached ATTACHED" >&2 |
|
6540 | printf "%s\n" "--attached requires an argument: --attached ATTACHED" >&2 | |
6533 | exit 1 |
|
6541 | exit 1 | |
6534 | fi |
|
6542 | fi | |
6535 | ;; |
|
6543 | ;; | |
6536 |
|
6544 | |||
6537 | -?*) |
|
6545 | -?*) | |
6538 | printf "invalid option: %s\n" "$key" >&2 |
|
6546 | printf "invalid option: %s\n" "$key" >&2 | |
6539 | exit 1 |
|
6547 | exit 1 | |
6540 | ;; |
|
6548 | ;; | |
6541 |
|
6549 | |||
6542 | *) |
|
6550 | *) | |
6543 | # :command.parse_requirements_case |
|
6551 | # :command.parse_requirements_case | |
6544 | # :command.parse_requirements_case_simple |
|
6552 | # :command.parse_requirements_case_simple | |
6545 | printf "invalid argument: %s\n" "$key" >&2 |
|
6553 | printf "invalid argument: %s\n" "$key" >&2 | |
6546 | exit 1 |
|
6554 | exit 1 | |
6547 |
|
6555 | |||
6548 | ;; |
|
6556 | ;; | |
6549 |
|
6557 | |||
6550 | esac |
|
6558 | esac | |
6551 | done |
|
6559 | done | |
6552 |
|
6560 | |||
6553 | } |
|
6561 | } | |
6554 |
|
6562 | |||
6555 | # :command.parse_requirements |
|
6563 | # :command.parse_requirements | |
6556 | rcstack_cli_attach_parse_requirements() { |
|
6564 | rcstack_cli_attach_parse_requirements() { | |
6557 | # :command.fixed_flags_filter |
|
6565 | # :command.fixed_flags_filter | |
6558 | while [[ $# -gt 0 ]]; do |
|
6566 | while [[ $# -gt 0 ]]; do | |
6559 | case "${1:-}" in |
|
6567 | case "${1:-}" in | |
6560 | --help | -h) |
|
6568 | --help | -h) | |
6561 | long_usage=yes |
|
6569 | long_usage=yes | |
6562 | rcstack_cli_attach_usage |
|
6570 | rcstack_cli_attach_usage | |
6563 | exit |
|
6571 | exit | |
6564 | ;; |
|
6572 | ;; | |
6565 |
|
6573 | |||
6566 | *) |
|
6574 | *) | |
6567 | break |
|
6575 | break | |
6568 | ;; |
|
6576 | ;; | |
6569 |
|
6577 | |||
6570 | esac |
|
6578 | esac | |
6571 | done |
|
6579 | done | |
6572 |
|
6580 | |||
6573 | # :command.command_filter |
|
6581 | # :command.command_filter | |
6574 | action="cli attach" |
|
6582 | action="cli attach" | |
6575 |
|
6583 | |||
6576 | # :command.parse_requirements_while |
|
6584 | # :command.parse_requirements_while | |
6577 | while [[ $# -gt 0 ]]; do |
|
6585 | while [[ $# -gt 0 ]]; do | |
6578 | key="$1" |
|
6586 | key="$1" | |
6579 | case "$key" in |
|
6587 | case "$key" in | |
6580 | # :flag.case |
|
6588 | # :flag.case | |
6581 | --instance-type) |
|
6589 | --instance-type) | |
6582 |
|
6590 | |||
6583 | # :flag.case_arg |
|
6591 | # :flag.case_arg | |
6584 | if [[ -n ${2+x} ]]; then |
|
6592 | if [[ -n ${2+x} ]]; then | |
6585 |
|
6593 | |||
6586 | args['--instance-type']="$2" |
|
6594 | args['--instance-type']="$2" | |
6587 | shift |
|
6595 | shift | |
6588 | shift |
|
6596 | shift | |
6589 | else |
|
6597 | else | |
6590 | printf "%s\n" "--instance-type requires an argument: --instance-type INSTANCE_TYPE" >&2 |
|
6598 | printf "%s\n" "--instance-type requires an argument: --instance-type INSTANCE_TYPE" >&2 | |
6591 | exit 1 |
|
6599 | exit 1 | |
6592 | fi |
|
6600 | fi | |
6593 | ;; |
|
6601 | ;; | |
6594 |
|
6602 | |||
6595 | -?*) |
|
6603 | -?*) | |
6596 | printf "invalid option: %s\n" "$key" >&2 |
|
6604 | printf "invalid option: %s\n" "$key" >&2 | |
6597 | exit 1 |
|
6605 | exit 1 | |
6598 | ;; |
|
6606 | ;; | |
6599 |
|
6607 | |||
6600 | *) |
|
6608 | *) | |
6601 | # :command.parse_requirements_case |
|
6609 | # :command.parse_requirements_case | |
6602 | # :command.parse_requirements_case_simple |
|
6610 | # :command.parse_requirements_case_simple | |
6603 | printf "invalid argument: %s\n" "$key" >&2 |
|
6611 | printf "invalid argument: %s\n" "$key" >&2 | |
6604 | exit 1 |
|
6612 | exit 1 | |
6605 |
|
6613 | |||
6606 | ;; |
|
6614 | ;; | |
6607 |
|
6615 | |||
6608 | esac |
|
6616 | esac | |
6609 | done |
|
6617 | done | |
6610 |
|
6618 | |||
6611 | # :command.default_assignments |
|
6619 | # :command.default_assignments | |
6612 | [[ -n ${args['--instance-type']:-} ]] || args['--instance-type']="rhodecode" |
|
6620 | [[ -n ${args['--instance-type']:-} ]] || args['--instance-type']="rhodecode" | |
6613 |
|
6621 | |||
6614 | } |
|
6622 | } | |
6615 |
|
6623 | |||
6616 | # :command.parse_requirements |
|
6624 | # :command.parse_requirements | |
6617 | rcstack_cli_set_edition_parse_requirements() { |
|
6625 | rcstack_cli_set_edition_parse_requirements() { | |
6618 | # :command.fixed_flags_filter |
|
6626 | # :command.fixed_flags_filter | |
6619 | while [[ $# -gt 0 ]]; do |
|
6627 | while [[ $# -gt 0 ]]; do | |
6620 | case "${1:-}" in |
|
6628 | case "${1:-}" in | |
6621 | --help | -h) |
|
6629 | --help | -h) | |
6622 | long_usage=yes |
|
6630 | long_usage=yes | |
6623 | rcstack_cli_set_edition_usage |
|
6631 | rcstack_cli_set_edition_usage | |
6624 | exit |
|
6632 | exit | |
6625 | ;; |
|
6633 | ;; | |
6626 |
|
6634 | |||
6627 | *) |
|
6635 | *) | |
6628 | break |
|
6636 | break | |
6629 | ;; |
|
6637 | ;; | |
6630 |
|
6638 | |||
6631 | esac |
|
6639 | esac | |
6632 | done |
|
6640 | done | |
6633 |
|
6641 | |||
6634 | # :command.command_filter |
|
6642 | # :command.command_filter | |
6635 | action="cli set-edition" |
|
6643 | action="cli set-edition" | |
6636 |
|
6644 | |||
6637 | # :command.parse_requirements_while |
|
6645 | # :command.parse_requirements_while | |
6638 | while [[ $# -gt 0 ]]; do |
|
6646 | while [[ $# -gt 0 ]]; do | |
6639 | key="$1" |
|
6647 | key="$1" | |
6640 | case "$key" in |
|
6648 | case "$key" in | |
6641 |
|
6649 | |||
6642 | -?*) |
|
6650 | -?*) | |
6643 | printf "invalid option: %s\n" "$key" >&2 |
|
6651 | printf "invalid option: %s\n" "$key" >&2 | |
6644 | exit 1 |
|
6652 | exit 1 | |
6645 | ;; |
|
6653 | ;; | |
6646 |
|
6654 | |||
6647 | *) |
|
6655 | *) | |
6648 | # :command.parse_requirements_case |
|
6656 | # :command.parse_requirements_case | |
6649 | # :command.parse_requirements_case_simple |
|
6657 | # :command.parse_requirements_case_simple | |
6650 | if [[ -z ${args['edition_type']+x} ]]; then |
|
6658 | if [[ -z ${args['edition_type']+x} ]]; then | |
6651 |
|
6659 | |||
6652 | args['edition_type']=$1 |
|
6660 | args['edition_type']=$1 | |
6653 | shift |
|
6661 | shift | |
6654 | else |
|
6662 | else | |
6655 | printf "invalid argument: %s\n" "$key" >&2 |
|
6663 | printf "invalid argument: %s\n" "$key" >&2 | |
6656 | exit 1 |
|
6664 | exit 1 | |
6657 | fi |
|
6665 | fi | |
6658 |
|
6666 | |||
6659 | ;; |
|
6667 | ;; | |
6660 |
|
6668 | |||
6661 | esac |
|
6669 | esac | |
6662 | done |
|
6670 | done | |
6663 |
|
6671 | |||
6664 | # :command.required_args_filter |
|
6672 | # :command.required_args_filter | |
6665 | if [[ -z ${args['edition_type']+x} ]]; then |
|
6673 | if [[ -z ${args['edition_type']+x} ]]; then | |
6666 | printf "missing required argument: EDITION_TYPE\nusage: rcstack cli set-edition EDITION_TYPE\n" >&2 |
|
6674 | printf "missing required argument: EDITION_TYPE\nusage: rcstack cli set-edition EDITION_TYPE\n" >&2 | |
6667 | exit 1 |
|
6675 | exit 1 | |
6668 | fi |
|
6676 | fi | |
6669 |
|
6677 | |||
6670 | # :command.whitelist_filter |
|
6678 | # :command.whitelist_filter | |
6671 | if [[ -n ${args['edition_type']} ]] && [[ ! ${args['edition_type']} =~ ^(ce|ee)$ ]]; then |
|
6679 | if [[ -n ${args['edition_type']} ]] && [[ ! ${args['edition_type']} =~ ^(ce|ee)$ ]]; then | |
6672 | printf "%s\n" "edition_type must be one of: ce, ee" >&2 |
|
6680 | printf "%s\n" "edition_type must be one of: ce, ee" >&2 | |
6673 | exit 1 |
|
6681 | exit 1 | |
6674 | fi |
|
6682 | fi | |
6675 |
|
6683 | |||
6676 | } |
|
6684 | } | |
6677 |
|
6685 | |||
6678 | # :command.parse_requirements |
|
6686 | # :command.parse_requirements | |
6679 | rcstack_cli_configure_vcsserver_parse_requirements() { |
|
6687 | rcstack_cli_configure_vcsserver_parse_requirements() { | |
6680 | # :command.fixed_flags_filter |
|
6688 | # :command.fixed_flags_filter | |
6681 | while [[ $# -gt 0 ]]; do |
|
6689 | while [[ $# -gt 0 ]]; do | |
6682 | case "${1:-}" in |
|
6690 | case "${1:-}" in | |
6683 | --help | -h) |
|
6691 | --help | -h) | |
6684 | long_usage=yes |
|
6692 | long_usage=yes | |
6685 | rcstack_cli_configure_vcsserver_usage |
|
6693 | rcstack_cli_configure_vcsserver_usage | |
6686 | exit |
|
6694 | exit | |
6687 | ;; |
|
6695 | ;; | |
6688 |
|
6696 | |||
6689 | *) |
|
6697 | *) | |
6690 | break |
|
6698 | break | |
6691 | ;; |
|
6699 | ;; | |
6692 |
|
6700 | |||
6693 | esac |
|
6701 | esac | |
6694 | done |
|
6702 | done | |
6695 |
|
6703 | |||
6696 | # :command.command_filter |
|
6704 | # :command.command_filter | |
6697 | action="cli configure-vcsserver" |
|
6705 | action="cli configure-vcsserver" | |
6698 |
|
6706 | |||
6699 | # :command.parse_requirements_while |
|
6707 | # :command.parse_requirements_while | |
6700 | while [[ $# -gt 0 ]]; do |
|
6708 | while [[ $# -gt 0 ]]; do | |
6701 | key="$1" |
|
6709 | key="$1" | |
6702 | case "$key" in |
|
6710 | case "$key" in | |
6703 |
|
6711 | |||
6704 | -?*) |
|
6712 | -?*) | |
6705 | printf "invalid option: %s\n" "$key" >&2 |
|
6713 | printf "invalid option: %s\n" "$key" >&2 | |
6706 | exit 1 |
|
6714 | exit 1 | |
6707 | ;; |
|
6715 | ;; | |
6708 |
|
6716 | |||
6709 | *) |
|
6717 | *) | |
6710 | # :command.parse_requirements_case |
|
6718 | # :command.parse_requirements_case | |
6711 | # :command.parse_requirements_case_simple |
|
6719 | # :command.parse_requirements_case_simple | |
6712 | if [[ -z ${args['ini_path']+x} ]]; then |
|
6720 | if [[ -z ${args['ini_path']+x} ]]; then | |
6713 | # :argument.validations |
|
6721 | # :argument.validations | |
6714 | if [[ -n $(validate_file_exists "$1") ]]; then |
|
6722 | if [[ -n $(validate_file_exists "$1") ]]; then | |
6715 | printf "validation error in %s:\n%s\n" "INI_PATH" "$(validate_file_exists "$1")" >&2 |
|
6723 | printf "validation error in %s:\n%s\n" "INI_PATH" "$(validate_file_exists "$1")" >&2 | |
6716 | exit 1 |
|
6724 | exit 1 | |
6717 | fi |
|
6725 | fi | |
6718 |
|
6726 | |||
6719 | args['ini_path']=$1 |
|
6727 | args['ini_path']=$1 | |
6720 | shift |
|
6728 | shift | |
6721 | else |
|
6729 | else | |
6722 | printf "invalid argument: %s\n" "$key" >&2 |
|
6730 | printf "invalid argument: %s\n" "$key" >&2 | |
6723 | exit 1 |
|
6731 | exit 1 | |
6724 | fi |
|
6732 | fi | |
6725 |
|
6733 | |||
6726 | ;; |
|
6734 | ;; | |
6727 |
|
6735 | |||
6728 | esac |
|
6736 | esac | |
6729 | done |
|
6737 | done | |
6730 |
|
6738 | |||
6731 | # :command.required_args_filter |
|
6739 | # :command.required_args_filter | |
6732 | if [[ -z ${args['ini_path']+x} ]]; then |
|
6740 | if [[ -z ${args['ini_path']+x} ]]; then | |
6733 | printf "missing required argument: INI_PATH\nusage: rcstack cli configure-vcsserver INI_PATH\n" >&2 |
|
6741 | printf "missing required argument: INI_PATH\nusage: rcstack cli configure-vcsserver INI_PATH\n" >&2 | |
6734 | exit 1 |
|
6742 | exit 1 | |
6735 | fi |
|
6743 | fi | |
6736 |
|
6744 | |||
6737 | } |
|
6745 | } | |
6738 |
|
6746 | |||
6739 | # :command.parse_requirements |
|
6747 | # :command.parse_requirements | |
6740 | rcstack_cli_configure_rhodecode_parse_requirements() { |
|
6748 | rcstack_cli_configure_rhodecode_parse_requirements() { | |
6741 | # :command.fixed_flags_filter |
|
6749 | # :command.fixed_flags_filter | |
6742 | while [[ $# -gt 0 ]]; do |
|
6750 | while [[ $# -gt 0 ]]; do | |
6743 | case "${1:-}" in |
|
6751 | case "${1:-}" in | |
6744 | --help | -h) |
|
6752 | --help | -h) | |
6745 | long_usage=yes |
|
6753 | long_usage=yes | |
6746 | rcstack_cli_configure_rhodecode_usage |
|
6754 | rcstack_cli_configure_rhodecode_usage | |
6747 | exit |
|
6755 | exit | |
6748 | ;; |
|
6756 | ;; | |
6749 |
|
6757 | |||
6750 | *) |
|
6758 | *) | |
6751 | break |
|
6759 | break | |
6752 | ;; |
|
6760 | ;; | |
6753 |
|
6761 | |||
6754 | esac |
|
6762 | esac | |
6755 | done |
|
6763 | done | |
6756 |
|
6764 | |||
6757 | # :command.command_filter |
|
6765 | # :command.command_filter | |
6758 | action="cli configure-rhodecode" |
|
6766 | action="cli configure-rhodecode" | |
6759 |
|
6767 | |||
6760 | # :command.parse_requirements_while |
|
6768 | # :command.parse_requirements_while | |
6761 | while [[ $# -gt 0 ]]; do |
|
6769 | while [[ $# -gt 0 ]]; do | |
6762 | key="$1" |
|
6770 | key="$1" | |
6763 | case "$key" in |
|
6771 | case "$key" in | |
6764 |
|
6772 | |||
6765 | -?*) |
|
6773 | -?*) | |
6766 | printf "invalid option: %s\n" "$key" >&2 |
|
6774 | printf "invalid option: %s\n" "$key" >&2 | |
6767 | exit 1 |
|
6775 | exit 1 | |
6768 | ;; |
|
6776 | ;; | |
6769 |
|
6777 | |||
6770 | *) |
|
6778 | *) | |
6771 | # :command.parse_requirements_case |
|
6779 | # :command.parse_requirements_case | |
6772 | # :command.parse_requirements_case_simple |
|
6780 | # :command.parse_requirements_case_simple | |
6773 | if [[ -z ${args['ini_path']+x} ]]; then |
|
6781 | if [[ -z ${args['ini_path']+x} ]]; then | |
6774 | # :argument.validations |
|
6782 | # :argument.validations | |
6775 | if [[ -n $(validate_file_exists "$1") ]]; then |
|
6783 | if [[ -n $(validate_file_exists "$1") ]]; then | |
6776 | printf "validation error in %s:\n%s\n" "INI_PATH" "$(validate_file_exists "$1")" >&2 |
|
6784 | printf "validation error in %s:\n%s\n" "INI_PATH" "$(validate_file_exists "$1")" >&2 | |
6777 | exit 1 |
|
6785 | exit 1 | |
6778 | fi |
|
6786 | fi | |
6779 |
|
6787 | |||
6780 | args['ini_path']=$1 |
|
6788 | args['ini_path']=$1 | |
6781 | shift |
|
6789 | shift | |
6782 | else |
|
6790 | else | |
6783 | printf "invalid argument: %s\n" "$key" >&2 |
|
6791 | printf "invalid argument: %s\n" "$key" >&2 | |
6784 | exit 1 |
|
6792 | exit 1 | |
6785 | fi |
|
6793 | fi | |
6786 |
|
6794 | |||
6787 | ;; |
|
6795 | ;; | |
6788 |
|
6796 | |||
6789 | esac |
|
6797 | esac | |
6790 | done |
|
6798 | done | |
6791 |
|
6799 | |||
6792 | # :command.required_args_filter |
|
6800 | # :command.required_args_filter | |
6793 | if [[ -z ${args['ini_path']+x} ]]; then |
|
6801 | if [[ -z ${args['ini_path']+x} ]]; then | |
6794 | printf "missing required argument: INI_PATH\nusage: rcstack cli configure-rhodecode INI_PATH\n" >&2 |
|
6802 | printf "missing required argument: INI_PATH\nusage: rcstack cli configure-rhodecode INI_PATH\n" >&2 | |
6795 | exit 1 |
|
6803 | exit 1 | |
6796 | fi |
|
6804 | fi | |
6797 |
|
6805 | |||
6798 | } |
|
6806 | } | |
6799 |
|
6807 | |||
6800 | # :command.parse_requirements |
|
6808 | # :command.parse_requirements | |
6801 | rcstack_backup_db_parse_requirements() { |
|
6809 | rcstack_backup_db_parse_requirements() { | |
6802 | # :command.fixed_flags_filter |
|
6810 | # :command.fixed_flags_filter | |
6803 | while [[ $# -gt 0 ]]; do |
|
6811 | while [[ $# -gt 0 ]]; do | |
6804 | case "${1:-}" in |
|
6812 | case "${1:-}" in | |
6805 | --help | -h) |
|
6813 | --help | -h) | |
6806 | long_usage=yes |
|
6814 | long_usage=yes | |
6807 | rcstack_backup_db_usage |
|
6815 | rcstack_backup_db_usage | |
6808 | exit |
|
6816 | exit | |
6809 | ;; |
|
6817 | ;; | |
6810 |
|
6818 | |||
6811 | *) |
|
6819 | *) | |
6812 | break |
|
6820 | break | |
6813 | ;; |
|
6821 | ;; | |
6814 |
|
6822 | |||
6815 | esac |
|
6823 | esac | |
6816 | done |
|
6824 | done | |
6817 |
|
6825 | |||
6818 | # :command.dependencies_filter |
|
6826 | # :command.dependencies_filter | |
6819 | if command -v tar >/dev/null 2>&1; then |
|
6827 | if command -v tar >/dev/null 2>&1; then | |
6820 | deps['tar']="$(command -v tar | head -n1)" |
|
6828 | deps['tar']="$(command -v tar | head -n1)" | |
6821 | else |
|
6829 | else | |
6822 | printf "missing dependency: tar\n" >&2 |
|
6830 | printf "missing dependency: tar\n" >&2 | |
6823 | exit 1 |
|
6831 | exit 1 | |
6824 | fi |
|
6832 | fi | |
6825 |
|
6833 | |||
6826 | if command -v gzip >/dev/null 2>&1; then |
|
6834 | if command -v gzip >/dev/null 2>&1; then | |
6827 | deps['gzip']="$(command -v gzip | head -n1)" |
|
6835 | deps['gzip']="$(command -v gzip | head -n1)" | |
6828 | else |
|
6836 | else | |
6829 | printf "missing dependency: gzip\n" >&2 |
|
6837 | printf "missing dependency: gzip\n" >&2 | |
6830 | exit 1 |
|
6838 | exit 1 | |
6831 | fi |
|
6839 | fi | |
6832 |
|
6840 | |||
6833 | # :command.command_filter |
|
6841 | # :command.command_filter | |
6834 | action="backup-db" |
|
6842 | action="backup-db" | |
6835 |
|
6843 | |||
6836 | # :command.parse_requirements_while |
|
6844 | # :command.parse_requirements_while | |
6837 | while [[ $# -gt 0 ]]; do |
|
6845 | while [[ $# -gt 0 ]]; do | |
6838 | key="$1" |
|
6846 | key="$1" | |
6839 | case "$key" in |
|
6847 | case "$key" in | |
6840 |
|
6848 | |||
6841 | -?*) |
|
6849 | -?*) | |
6842 | printf "invalid option: %s\n" "$key" >&2 |
|
6850 | printf "invalid option: %s\n" "$key" >&2 | |
6843 | exit 1 |
|
6851 | exit 1 | |
6844 | ;; |
|
6852 | ;; | |
6845 |
|
6853 | |||
6846 | *) |
|
6854 | *) | |
6847 | # :command.parse_requirements_case |
|
6855 | # :command.parse_requirements_case | |
6848 | # :command.parse_requirements_case_simple |
|
6856 | # :command.parse_requirements_case_simple | |
6849 | if [[ -z ${args['destination']+x} ]]; then |
|
6857 | if [[ -z ${args['destination']+x} ]]; then | |
6850 | # :argument.validations |
|
6858 | # :argument.validations | |
6851 | if [[ -n $(validate_dir_exists "$1") ]]; then |
|
6859 | if [[ -n $(validate_dir_exists "$1") ]]; then | |
6852 | printf "validation error in %s:\n%s\n" "DESTINATION" "$(validate_dir_exists "$1")" >&2 |
|
6860 | printf "validation error in %s:\n%s\n" "DESTINATION" "$(validate_dir_exists "$1")" >&2 | |
6853 | exit 1 |
|
6861 | exit 1 | |
6854 | fi |
|
6862 | fi | |
6855 |
|
6863 | |||
6856 | args['destination']=$1 |
|
6864 | args['destination']=$1 | |
6857 | shift |
|
6865 | shift | |
6858 | else |
|
6866 | else | |
6859 | printf "invalid argument: %s\n" "$key" >&2 |
|
6867 | printf "invalid argument: %s\n" "$key" >&2 | |
6860 | exit 1 |
|
6868 | exit 1 | |
6861 | fi |
|
6869 | fi | |
6862 |
|
6870 | |||
6863 | ;; |
|
6871 | ;; | |
6864 |
|
6872 | |||
6865 | esac |
|
6873 | esac | |
6866 | done |
|
6874 | done | |
6867 |
|
6875 | |||
6868 | # :command.required_args_filter |
|
6876 | # :command.required_args_filter | |
6869 | if [[ -z ${args['destination']+x} ]]; then |
|
6877 | if [[ -z ${args['destination']+x} ]]; then | |
6870 | printf "missing required argument: DESTINATION\nusage: rcstack backup-db DESTINATION\n" >&2 |
|
6878 | printf "missing required argument: DESTINATION\nusage: rcstack backup-db DESTINATION\n" >&2 | |
6871 | exit 1 |
|
6879 | exit 1 | |
6872 | fi |
|
6880 | fi | |
6873 |
|
6881 | |||
6874 | } |
|
6882 | } | |
6875 |
|
6883 | |||
6876 | # :command.parse_requirements |
|
6884 | # :command.parse_requirements | |
6877 | rcstack_backup_data_parse_requirements() { |
|
6885 | rcstack_backup_data_parse_requirements() { | |
6878 | # :command.fixed_flags_filter |
|
6886 | # :command.fixed_flags_filter | |
6879 | while [[ $# -gt 0 ]]; do |
|
6887 | while [[ $# -gt 0 ]]; do | |
6880 | case "${1:-}" in |
|
6888 | case "${1:-}" in | |
6881 | --help | -h) |
|
6889 | --help | -h) | |
6882 | long_usage=yes |
|
6890 | long_usage=yes | |
6883 | rcstack_backup_data_usage |
|
6891 | rcstack_backup_data_usage | |
6884 | exit |
|
6892 | exit | |
6885 | ;; |
|
6893 | ;; | |
6886 |
|
6894 | |||
6887 | *) |
|
6895 | *) | |
6888 | break |
|
6896 | break | |
6889 | ;; |
|
6897 | ;; | |
6890 |
|
6898 | |||
6891 | esac |
|
6899 | esac | |
6892 | done |
|
6900 | done | |
6893 |
|
6901 | |||
6894 | # :command.dependencies_filter |
|
6902 | # :command.dependencies_filter | |
6895 | if command -v tar >/dev/null 2>&1; then |
|
6903 | if command -v tar >/dev/null 2>&1; then | |
6896 | deps['tar']="$(command -v tar | head -n1)" |
|
6904 | deps['tar']="$(command -v tar | head -n1)" | |
6897 | else |
|
6905 | else | |
6898 | printf "missing dependency: tar\n" >&2 |
|
6906 | printf "missing dependency: tar\n" >&2 | |
6899 | exit 1 |
|
6907 | exit 1 | |
6900 | fi |
|
6908 | fi | |
6901 |
|
6909 | |||
6902 | if command -v gzip >/dev/null 2>&1; then |
|
6910 | if command -v gzip >/dev/null 2>&1; then | |
6903 | deps['gzip']="$(command -v gzip | head -n1)" |
|
6911 | deps['gzip']="$(command -v gzip | head -n1)" | |
6904 | else |
|
6912 | else | |
6905 | printf "missing dependency: gzip\n" >&2 |
|
6913 | printf "missing dependency: gzip\n" >&2 | |
6906 | exit 1 |
|
6914 | exit 1 | |
6907 | fi |
|
6915 | fi | |
6908 |
|
6916 | |||
6909 | # :command.command_filter |
|
6917 | # :command.command_filter | |
6910 | action="backup-data" |
|
6918 | action="backup-data" | |
6911 |
|
6919 | |||
6912 | # :command.parse_requirements_while |
|
6920 | # :command.parse_requirements_while | |
6913 | while [[ $# -gt 0 ]]; do |
|
6921 | while [[ $# -gt 0 ]]; do | |
6914 | key="$1" |
|
6922 | key="$1" | |
6915 | case "$key" in |
|
6923 | case "$key" in | |
6916 |
|
6924 | |||
6917 | -?*) |
|
6925 | -?*) | |
6918 | printf "invalid option: %s\n" "$key" >&2 |
|
6926 | printf "invalid option: %s\n" "$key" >&2 | |
6919 | exit 1 |
|
6927 | exit 1 | |
6920 | ;; |
|
6928 | ;; | |
6921 |
|
6929 | |||
6922 | *) |
|
6930 | *) | |
6923 | # :command.parse_requirements_case |
|
6931 | # :command.parse_requirements_case | |
6924 | # :command.parse_requirements_case_simple |
|
6932 | # :command.parse_requirements_case_simple | |
6925 | if [[ -z ${args['destination']+x} ]]; then |
|
6933 | if [[ -z ${args['destination']+x} ]]; then | |
6926 | # :argument.validations |
|
6934 | # :argument.validations | |
6927 | if [[ -n $(validate_dir_exists "$1") ]]; then |
|
6935 | if [[ -n $(validate_dir_exists "$1") ]]; then | |
6928 | printf "validation error in %s:\n%s\n" "DESTINATION" "$(validate_dir_exists "$1")" >&2 |
|
6936 | printf "validation error in %s:\n%s\n" "DESTINATION" "$(validate_dir_exists "$1")" >&2 | |
6929 | exit 1 |
|
6937 | exit 1 | |
6930 | fi |
|
6938 | fi | |
6931 |
|
6939 | |||
6932 | args['destination']=$1 |
|
6940 | args['destination']=$1 | |
6933 | shift |
|
6941 | shift | |
6934 | else |
|
6942 | else | |
6935 | printf "invalid argument: %s\n" "$key" >&2 |
|
6943 | printf "invalid argument: %s\n" "$key" >&2 | |
6936 | exit 1 |
|
6944 | exit 1 | |
6937 | fi |
|
6945 | fi | |
6938 |
|
6946 | |||
6939 | ;; |
|
6947 | ;; | |
6940 |
|
6948 | |||
6941 | esac |
|
6949 | esac | |
6942 | done |
|
6950 | done | |
6943 |
|
6951 | |||
6944 | # :command.required_args_filter |
|
6952 | # :command.required_args_filter | |
6945 | if [[ -z ${args['destination']+x} ]]; then |
|
6953 | if [[ -z ${args['destination']+x} ]]; then | |
6946 | printf "missing required argument: DESTINATION\nusage: rcstack backup-data DESTINATION\n" >&2 |
|
6954 | printf "missing required argument: DESTINATION\nusage: rcstack backup-data DESTINATION\n" >&2 | |
6947 | exit 1 |
|
6955 | exit 1 | |
6948 | fi |
|
6956 | fi | |
6949 |
|
6957 | |||
6950 | } |
|
6958 | } | |
6951 |
|
6959 | |||
6952 | # :command.parse_requirements |
|
6960 | # :command.parse_requirements | |
6953 | rcstack_get_build_artifacts_parse_requirements() { |
|
6961 | rcstack_get_build_artifacts_parse_requirements() { | |
6954 | # :command.fixed_flags_filter |
|
6962 | # :command.fixed_flags_filter | |
6955 | while [[ $# -gt 0 ]]; do |
|
6963 | while [[ $# -gt 0 ]]; do | |
6956 | case "${1:-}" in |
|
6964 | case "${1:-}" in | |
6957 | --help | -h) |
|
6965 | --help | -h) | |
6958 | long_usage=yes |
|
6966 | long_usage=yes | |
6959 | rcstack_get_build_artifacts_usage |
|
6967 | rcstack_get_build_artifacts_usage | |
6960 | exit |
|
6968 | exit | |
6961 | ;; |
|
6969 | ;; | |
6962 |
|
6970 | |||
6963 | *) |
|
6971 | *) | |
6964 | break |
|
6972 | break | |
6965 | ;; |
|
6973 | ;; | |
6966 |
|
6974 | |||
6967 | esac |
|
6975 | esac | |
6968 | done |
|
6976 | done | |
6969 |
|
6977 | |||
6970 | # :command.command_filter |
|
6978 | # :command.command_filter | |
6971 | action="get-build-artifacts" |
|
6979 | action="get-build-artifacts" | |
6972 |
|
6980 | |||
6973 | # :command.parse_requirements_while |
|
6981 | # :command.parse_requirements_while | |
6974 | while [[ $# -gt 0 ]]; do |
|
6982 | while [[ $# -gt 0 ]]; do | |
6975 | key="$1" |
|
6983 | key="$1" | |
6976 | case "$key" in |
|
6984 | case "$key" in | |
6977 | # :flag.case |
|
6985 | # :flag.case | |
6978 | --auth) |
|
6986 | --auth) | |
6979 |
|
6987 | |||
6980 | # :flag.case_arg |
|
6988 | # :flag.case_arg | |
6981 | if [[ -n ${2+x} ]]; then |
|
6989 | if [[ -n ${2+x} ]]; then | |
6982 |
|
6990 | |||
6983 | args['--auth']="$2" |
|
6991 | args['--auth']="$2" | |
6984 | shift |
|
6992 | shift | |
6985 | shift |
|
6993 | shift | |
6986 | else |
|
6994 | else | |
6987 | printf "%s\n" "--auth requires an argument: --auth AUTH" >&2 |
|
6995 | printf "%s\n" "--auth requires an argument: --auth AUTH" >&2 | |
6988 | exit 1 |
|
6996 | exit 1 | |
6989 | fi |
|
6997 | fi | |
6990 | ;; |
|
6998 | ;; | |
6991 |
|
6999 | |||
6992 | # :flag.case |
|
7000 | # :flag.case | |
6993 | --installer-url) |
|
7001 | --installer-url) | |
6994 |
|
7002 | |||
6995 | # :flag.case_arg |
|
7003 | # :flag.case_arg | |
6996 | if [[ -n ${2+x} ]]; then |
|
7004 | if [[ -n ${2+x} ]]; then | |
6997 |
|
7005 | |||
6998 | args['--installer-url']="$2" |
|
7006 | args['--installer-url']="$2" | |
6999 | shift |
|
7007 | shift | |
7000 | shift |
|
7008 | shift | |
7001 | else |
|
7009 | else | |
7002 | printf "%s\n" "--installer-url requires an argument: --installer-url INSTALLER_URL" >&2 |
|
7010 | printf "%s\n" "--installer-url requires an argument: --installer-url INSTALLER_URL" >&2 | |
7003 | exit 1 |
|
7011 | exit 1 | |
7004 | fi |
|
7012 | fi | |
7005 | ;; |
|
7013 | ;; | |
7006 |
|
7014 | |||
7007 | # :flag.case |
|
7015 | # :flag.case | |
7008 | --manifest-url) |
|
7016 | --manifest-url) | |
7009 |
|
7017 | |||
7010 | # :flag.case_arg |
|
7018 | # :flag.case_arg | |
7011 | if [[ -n ${2+x} ]]; then |
|
7019 | if [[ -n ${2+x} ]]; then | |
7012 |
|
7020 | |||
7013 | args['--manifest-url']="$2" |
|
7021 | args['--manifest-url']="$2" | |
7014 | shift |
|
7022 | shift | |
7015 | shift |
|
7023 | shift | |
7016 | else |
|
7024 | else | |
7017 | printf "%s\n" "--manifest-url requires an argument: --manifest-url MANIFEST_URL" >&2 |
|
7025 | printf "%s\n" "--manifest-url requires an argument: --manifest-url MANIFEST_URL" >&2 | |
7018 | exit 1 |
|
7026 | exit 1 | |
7019 | fi |
|
7027 | fi | |
7020 | ;; |
|
7028 | ;; | |
7021 |
|
7029 | |||
7022 | # :flag.case |
|
7030 | # :flag.case | |
7023 | --version-name) |
|
7031 | --version-name) | |
7024 |
|
7032 | |||
7025 | # :flag.case_arg |
|
7033 | # :flag.case_arg | |
7026 | if [[ -n ${2+x} ]]; then |
|
7034 | if [[ -n ${2+x} ]]; then | |
7027 |
|
7035 | |||
7028 | args['--version-name']="$2" |
|
7036 | args['--version-name']="$2" | |
7029 | shift |
|
7037 | shift | |
7030 | shift |
|
7038 | shift | |
7031 | else |
|
7039 | else | |
7032 | printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2 |
|
7040 | printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2 | |
7033 | exit 1 |
|
7041 | exit 1 | |
7034 | fi |
|
7042 | fi | |
7035 | ;; |
|
7043 | ;; | |
7036 |
|
7044 | |||
7037 | -?*) |
|
7045 | -?*) | |
7038 | printf "invalid option: %s\n" "$key" >&2 |
|
7046 | printf "invalid option: %s\n" "$key" >&2 | |
7039 | exit 1 |
|
7047 | exit 1 | |
7040 | ;; |
|
7048 | ;; | |
7041 |
|
7049 | |||
7042 | *) |
|
7050 | *) | |
7043 | # :command.parse_requirements_case |
|
7051 | # :command.parse_requirements_case | |
7044 | # :command.parse_requirements_case_simple |
|
7052 | # :command.parse_requirements_case_simple | |
7045 | printf "invalid argument: %s\n" "$key" >&2 |
|
7053 | printf "invalid argument: %s\n" "$key" >&2 | |
7046 | exit 1 |
|
7054 | exit 1 | |
7047 |
|
7055 | |||
7048 | ;; |
|
7056 | ;; | |
7049 |
|
7057 | |||
7050 | esac |
|
7058 | esac | |
7051 | done |
|
7059 | done | |
7052 |
|
7060 | |||
7053 | # :command.default_assignments |
|
7061 | # :command.default_assignments | |
7054 | [[ -n ${args['--auth']:-} ]] || args['--auth']="" |
|
7062 | [[ -n ${args['--auth']:-} ]] || args['--auth']="" | |
7055 | [[ -n ${args['--installer-url']:-} ]] || args['--installer-url']="https://dls.rhodecode.com/dls/N2E2ZTY1NzA3NjYxNDA2NTc1NjI3MTcyNzA2MjcxNzIyZTcwNjI3YQ==/rhodecode-control/latest-linux-ee" |
|
7063 | [[ -n ${args['--installer-url']:-} ]] || args['--installer-url']="https://dls.rhodecode.com/dls/N2E2ZTY1NzA3NjYxNDA2NTc1NjI3MTcyNzA2MjcxNzIyZTcwNjI3YQ==/rhodecode-control/latest-linux-ee" | |
7056 | [[ -n ${args['--manifest-url']:-} ]] || args['--manifest-url']="https://dls.rhodecode.com/linux/MANIFEST" |
|
7064 | [[ -n ${args['--manifest-url']:-} ]] || args['--manifest-url']="https://dls.rhodecode.com/linux/MANIFEST" | |
7057 | [[ -n ${args['--version-name']:-} ]] || args['--version-name']="$RC_CLI_VERSION_NAME" |
|
7065 | [[ -n ${args['--version-name']:-} ]] || args['--version-name']="$RC_CLI_VERSION_NAME" | |
7058 |
|
7066 | |||
7059 | } |
|
7067 | } | |
7060 |
|
7068 | |||
7061 | # :command.parse_requirements |
|
7069 | # :command.parse_requirements | |
7062 | rcstack_build_installer_parse_requirements() { |
|
7070 | rcstack_build_installer_parse_requirements() { | |
7063 | # :command.fixed_flags_filter |
|
7071 | # :command.fixed_flags_filter | |
7064 | while [[ $# -gt 0 ]]; do |
|
7072 | while [[ $# -gt 0 ]]; do | |
7065 | case "${1:-}" in |
|
7073 | case "${1:-}" in | |
7066 | --help | -h) |
|
7074 | --help | -h) | |
7067 | long_usage=yes |
|
7075 | long_usage=yes | |
7068 | rcstack_build_installer_usage |
|
7076 | rcstack_build_installer_usage | |
7069 | exit |
|
7077 | exit | |
7070 | ;; |
|
7078 | ;; | |
7071 |
|
7079 | |||
7072 | *) |
|
7080 | *) | |
7073 | break |
|
7081 | break | |
7074 | ;; |
|
7082 | ;; | |
7075 |
|
7083 | |||
7076 | esac |
|
7084 | esac | |
7077 | done |
|
7085 | done | |
7078 |
|
7086 | |||
7079 | # :command.command_filter |
|
7087 | # :command.command_filter | |
7080 | action="build-installer" |
|
7088 | action="build-installer" | |
7081 |
|
7089 | |||
7082 | # :command.parse_requirements_while |
|
7090 | # :command.parse_requirements_while | |
7083 | while [[ $# -gt 0 ]]; do |
|
7091 | while [[ $# -gt 0 ]]; do | |
7084 | key="$1" |
|
7092 | key="$1" | |
7085 | case "$key" in |
|
7093 | case "$key" in | |
7086 | # :flag.case |
|
7094 | # :flag.case | |
7087 | --version-name) |
|
7095 | --version-name) | |
7088 |
|
7096 | |||
7089 | # :flag.case_arg |
|
7097 | # :flag.case_arg | |
7090 | if [[ -n ${2+x} ]]; then |
|
7098 | if [[ -n ${2+x} ]]; then | |
7091 |
|
7099 | |||
7092 | args['--version-name']="$2" |
|
7100 | args['--version-name']="$2" | |
7093 | shift |
|
7101 | shift | |
7094 | shift |
|
7102 | shift | |
7095 | else |
|
7103 | else | |
7096 | printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2 |
|
7104 | printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2 | |
7097 | exit 1 |
|
7105 | exit 1 | |
7098 | fi |
|
7106 | fi | |
7099 | ;; |
|
7107 | ;; | |
7100 |
|
7108 | |||
7101 | -?*) |
|
7109 | -?*) | |
7102 | printf "invalid option: %s\n" "$key" >&2 |
|
7110 | printf "invalid option: %s\n" "$key" >&2 | |
7103 | exit 1 |
|
7111 | exit 1 | |
7104 | ;; |
|
7112 | ;; | |
7105 |
|
7113 | |||
7106 | *) |
|
7114 | *) | |
7107 | # :command.parse_requirements_case |
|
7115 | # :command.parse_requirements_case | |
7108 | # :command.parse_requirements_case_simple |
|
7116 | # :command.parse_requirements_case_simple | |
7109 | printf "invalid argument: %s\n" "$key" >&2 |
|
7117 | printf "invalid argument: %s\n" "$key" >&2 | |
7110 | exit 1 |
|
7118 | exit 1 | |
7111 |
|
7119 | |||
7112 | ;; |
|
7120 | ;; | |
7113 |
|
7121 | |||
7114 | esac |
|
7122 | esac | |
7115 | done |
|
7123 | done | |
7116 |
|
7124 | |||
7117 | # :command.default_assignments |
|
7125 | # :command.default_assignments | |
7118 | [[ -n ${args['--version-name']:-} ]] || args['--version-name']="$RC_CLI_VERSION_NAME" |
|
7126 | [[ -n ${args['--version-name']:-} ]] || args['--version-name']="$RC_CLI_VERSION_NAME" | |
7119 |
|
7127 | |||
7120 | } |
|
7128 | } | |
7121 |
|
7129 | |||
7122 | # :command.parse_requirements |
|
7130 | # :command.parse_requirements | |
7123 | rcstack_get_build_source_parse_requirements() { |
|
7131 | rcstack_get_build_source_parse_requirements() { | |
7124 | # :command.fixed_flags_filter |
|
7132 | # :command.fixed_flags_filter | |
7125 | while [[ $# -gt 0 ]]; do |
|
7133 | while [[ $# -gt 0 ]]; do | |
7126 | case "${1:-}" in |
|
7134 | case "${1:-}" in | |
7127 | --help | -h) |
|
7135 | --help | -h) | |
7128 | long_usage=yes |
|
7136 | long_usage=yes | |
7129 | rcstack_get_build_source_usage |
|
7137 | rcstack_get_build_source_usage | |
7130 | exit |
|
7138 | exit | |
7131 | ;; |
|
7139 | ;; | |
7132 |
|
7140 | |||
7133 | *) |
|
7141 | *) | |
7134 | break |
|
7142 | break | |
7135 | ;; |
|
7143 | ;; | |
7136 |
|
7144 | |||
7137 | esac |
|
7145 | esac | |
7138 | done |
|
7146 | done | |
7139 |
|
7147 | |||
7140 | # :command.dependencies_filter |
|
7148 | # :command.dependencies_filter | |
7141 | if command -v curl >/dev/null 2>&1; then |
|
7149 | if command -v curl >/dev/null 2>&1; then | |
7142 | deps['curl']="$(command -v curl | head -n1)" |
|
7150 | deps['curl']="$(command -v curl | head -n1)" | |
7143 | else |
|
7151 | else | |
7144 | printf "missing dependency: curl\n" >&2 |
|
7152 | printf "missing dependency: curl\n" >&2 | |
7145 | exit 1 |
|
7153 | exit 1 | |
7146 | fi |
|
7154 | fi | |
7147 |
|
7155 | |||
7148 | if command -v tar >/dev/null 2>&1; then |
|
7156 | if command -v tar >/dev/null 2>&1; then | |
7149 | deps['tar']="$(command -v tar | head -n1)" |
|
7157 | deps['tar']="$(command -v tar | head -n1)" | |
7150 | else |
|
7158 | else | |
7151 | printf "missing dependency: tar\n" >&2 |
|
7159 | printf "missing dependency: tar\n" >&2 | |
7152 | exit 1 |
|
7160 | exit 1 | |
7153 | fi |
|
7161 | fi | |
7154 |
|
7162 | |||
7155 | # :command.command_filter |
|
7163 | # :command.command_filter | |
7156 | action="get-build-source" |
|
7164 | action="get-build-source" | |
7157 |
|
7165 | |||
7158 | # :command.parse_requirements_while |
|
7166 | # :command.parse_requirements_while | |
7159 | while [[ $# -gt 0 ]]; do |
|
7167 | while [[ $# -gt 0 ]]; do | |
7160 | key="$1" |
|
7168 | key="$1" | |
7161 | case "$key" in |
|
7169 | case "$key" in | |
7162 | # :flag.case |
|
7170 | # :flag.case | |
7163 | --revision) |
|
7171 | --revision) | |
7164 |
|
7172 | |||
7165 | # :flag.case_arg |
|
7173 | # :flag.case_arg | |
7166 | if [[ -n ${2+x} ]]; then |
|
7174 | if [[ -n ${2+x} ]]; then | |
7167 |
|
7175 | |||
7168 | args['--revision']="$2" |
|
7176 | args['--revision']="$2" | |
7169 | shift |
|
7177 | shift | |
7170 | shift |
|
7178 | shift | |
7171 | else |
|
7179 | else | |
7172 | printf "%s\n" "--revision requires an argument: --revision REVISION" >&2 |
|
7180 | printf "%s\n" "--revision requires an argument: --revision REVISION" >&2 | |
7173 | exit 1 |
|
7181 | exit 1 | |
7174 | fi |
|
7182 | fi | |
7175 | ;; |
|
7183 | ;; | |
7176 |
|
7184 | |||
7177 | # :flag.case |
|
7185 | # :flag.case | |
7178 | --auth-token) |
|
7186 | --auth-token) | |
7179 |
|
7187 | |||
7180 | # :flag.case_arg |
|
7188 | # :flag.case_arg | |
7181 | if [[ -n ${2+x} ]]; then |
|
7189 | if [[ -n ${2+x} ]]; then | |
7182 |
|
7190 | |||
7183 | args['--auth-token']="$2" |
|
7191 | args['--auth-token']="$2" | |
7184 | shift |
|
7192 | shift | |
7185 | shift |
|
7193 | shift | |
7186 | else |
|
7194 | else | |
7187 | printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2 |
|
7195 | printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2 | |
7188 | exit 1 |
|
7196 | exit 1 | |
7189 | fi |
|
7197 | fi | |
7190 | ;; |
|
7198 | ;; | |
7191 |
|
7199 | |||
7192 | # :flag.case |
|
7200 | # :flag.case | |
7193 | --server-url) |
|
7201 | --server-url) | |
7194 |
|
7202 | |||
7195 | # :flag.case_arg |
|
7203 | # :flag.case_arg | |
7196 | if [[ -n ${2+x} ]]; then |
|
7204 | if [[ -n ${2+x} ]]; then | |
7197 |
|
7205 | |||
7198 | args['--server-url']="$2" |
|
7206 | args['--server-url']="$2" | |
7199 | shift |
|
7207 | shift | |
7200 | shift |
|
7208 | shift | |
7201 | else |
|
7209 | else | |
7202 | printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2 |
|
7210 | printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2 | |
7203 | exit 1 |
|
7211 | exit 1 | |
7204 | fi |
|
7212 | fi | |
7205 | ;; |
|
7213 | ;; | |
7206 |
|
7214 | |||
7207 | -?*) |
|
7215 | -?*) | |
7208 | printf "invalid option: %s\n" "$key" >&2 |
|
7216 | printf "invalid option: %s\n" "$key" >&2 | |
7209 | exit 1 |
|
7217 | exit 1 | |
7210 | ;; |
|
7218 | ;; | |
7211 |
|
7219 | |||
7212 | *) |
|
7220 | *) | |
7213 | # :command.parse_requirements_case |
|
7221 | # :command.parse_requirements_case | |
7214 | # :command.parse_requirements_case_simple |
|
7222 | # :command.parse_requirements_case_simple | |
7215 | printf "invalid argument: %s\n" "$key" >&2 |
|
7223 | printf "invalid argument: %s\n" "$key" >&2 | |
7216 | exit 1 |
|
7224 | exit 1 | |
7217 |
|
7225 | |||
7218 | ;; |
|
7226 | ;; | |
7219 |
|
7227 | |||
7220 | esac |
|
7228 | esac | |
7221 | done |
|
7229 | done | |
7222 |
|
7230 | |||
7223 | # :command.default_assignments |
|
7231 | # :command.default_assignments | |
7224 | [[ -n ${args['--revision']:-} ]] || args['--revision']="default" |
|
7232 | [[ -n ${args['--revision']:-} ]] || args['--revision']="default" | |
7225 | [[ -n ${args['--server-url']:-} ]] || args['--server-url']="https://code.rhodecode.com" |
|
7233 | [[ -n ${args['--server-url']:-} ]] || args['--server-url']="https://code.rhodecode.com" | |
7226 |
|
7234 | |||
7227 | } |
|
7235 | } | |
7228 |
|
7236 | |||
7229 | # :command.parse_requirements |
|
7237 | # :command.parse_requirements | |
7230 | rcstack_build_source_parse_requirements() { |
|
7238 | rcstack_build_source_parse_requirements() { | |
7231 | # :command.fixed_flags_filter |
|
7239 | # :command.fixed_flags_filter | |
7232 | while [[ $# -gt 0 ]]; do |
|
7240 | while [[ $# -gt 0 ]]; do | |
7233 | case "${1:-}" in |
|
7241 | case "${1:-}" in | |
7234 | --help | -h) |
|
7242 | --help | -h) | |
7235 | long_usage=yes |
|
7243 | long_usage=yes | |
7236 | rcstack_build_source_usage |
|
7244 | rcstack_build_source_usage | |
7237 | exit |
|
7245 | exit | |
7238 | ;; |
|
7246 | ;; | |
7239 |
|
7247 | |||
7240 | *) |
|
7248 | *) | |
7241 | break |
|
7249 | break | |
7242 | ;; |
|
7250 | ;; | |
7243 |
|
7251 | |||
7244 | esac |
|
7252 | esac | |
7245 | done |
|
7253 | done | |
7246 |
|
7254 | |||
7247 | # :command.command_filter |
|
7255 | # :command.command_filter | |
7248 | action="build-source" |
|
7256 | action="build-source" | |
7249 |
|
7257 | |||
7250 | # :command.parse_requirements_while |
|
7258 | # :command.parse_requirements_while | |
7251 | while [[ $# -gt 0 ]]; do |
|
7259 | while [[ $# -gt 0 ]]; do | |
7252 | key="$1" |
|
7260 | key="$1" | |
7253 | case "$key" in |
|
7261 | case "$key" in | |
7254 | # :flag.case |
|
7262 | # :flag.case | |
7255 | --version-name) |
|
7263 | --version-name) | |
7256 |
|
7264 | |||
7257 | # :flag.case_arg |
|
7265 | # :flag.case_arg | |
7258 | if [[ -n ${2+x} ]]; then |
|
7266 | if [[ -n ${2+x} ]]; then | |
7259 |
|
7267 | |||
7260 | args['--version-name']="$2" |
|
7268 | args['--version-name']="$2" | |
7261 | shift |
|
7269 | shift | |
7262 | shift |
|
7270 | shift | |
7263 | else |
|
7271 | else | |
7264 | printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2 |
|
7272 | printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2 | |
7265 | exit 1 |
|
7273 | exit 1 | |
7266 | fi |
|
7274 | fi | |
7267 | ;; |
|
7275 | ;; | |
7268 |
|
7276 | |||
7269 | # :flag.case |
|
7277 | # :flag.case | |
7270 | --source-build-yaml) |
|
7278 | --source-build-yaml) | |
7271 |
|
7279 | |||
7272 | # :flag.case_arg |
|
7280 | # :flag.case_arg | |
7273 | if [[ -n ${2+x} ]]; then |
|
7281 | if [[ -n ${2+x} ]]; then | |
7274 |
|
7282 | |||
7275 | args['--source-build-yaml']="$2" |
|
7283 | args['--source-build-yaml']="$2" | |
7276 | shift |
|
7284 | shift | |
7277 | shift |
|
7285 | shift | |
7278 | else |
|
7286 | else | |
7279 | printf "%s\n" "--source-build-yaml requires an argument: --source-build-yaml BUILD_SOURCE_YAML" >&2 |
|
7287 | printf "%s\n" "--source-build-yaml requires an argument: --source-build-yaml BUILD_SOURCE_YAML" >&2 | |
7280 | exit 1 |
|
7288 | exit 1 | |
7281 | fi |
|
7289 | fi | |
7282 | ;; |
|
7290 | ;; | |
7283 |
|
7291 | |||
7284 | # :flag.case |
|
7292 | # :flag.case | |
7285 | --tag) |
|
7293 | --tag) | |
7286 |
|
7294 | |||
7287 | # :flag.case_arg |
|
7295 | # :flag.case_arg | |
7288 | if [[ -n ${2+x} ]]; then |
|
7296 | if [[ -n ${2+x} ]]; then | |
7289 |
|
7297 | |||
7290 | if [[ -z ${args['--tag']+x} ]]; then |
|
7298 | if [[ -z ${args['--tag']+x} ]]; then | |
7291 | args['--tag']="\"$2\"" |
|
7299 | args['--tag']="\"$2\"" | |
7292 | else |
|
7300 | else | |
7293 | args['--tag']="${args[--tag]} \"$2\"" |
|
7301 | args['--tag']="${args[--tag]} \"$2\"" | |
7294 | fi |
|
7302 | fi | |
7295 | shift |
|
7303 | shift | |
7296 | shift |
|
7304 | shift | |
7297 | else |
|
7305 | else | |
7298 | printf "%s\n" "--tag requires an argument: --tag TAG" >&2 |
|
7306 | printf "%s\n" "--tag requires an argument: --tag TAG" >&2 | |
7299 | exit 1 |
|
7307 | exit 1 | |
7300 | fi |
|
7308 | fi | |
7301 | ;; |
|
7309 | ;; | |
7302 |
|
7310 | |||
7303 | -?*) |
|
7311 | -?*) | |
7304 | printf "invalid option: %s\n" "$key" >&2 |
|
7312 | printf "invalid option: %s\n" "$key" >&2 | |
7305 | exit 1 |
|
7313 | exit 1 | |
7306 | ;; |
|
7314 | ;; | |
7307 |
|
7315 | |||
7308 | *) |
|
7316 | *) | |
7309 | # :command.parse_requirements_case |
|
7317 | # :command.parse_requirements_case | |
7310 | # :command.parse_requirements_case_simple |
|
7318 | # :command.parse_requirements_case_simple | |
7311 | printf "invalid argument: %s\n" "$key" >&2 |
|
7319 | printf "invalid argument: %s\n" "$key" >&2 | |
7312 | exit 1 |
|
7320 | exit 1 | |
7313 |
|
7321 | |||
7314 | ;; |
|
7322 | ;; | |
7315 |
|
7323 | |||
7316 | esac |
|
7324 | esac | |
7317 | done |
|
7325 | done | |
7318 |
|
7326 | |||
7319 | # :command.default_assignments |
|
7327 | # :command.default_assignments | |
7320 | [[ -n ${args['--version-name']:-} ]] || args['--version-name']="$RC_CLI_VERSION_NAME" |
|
7328 | [[ -n ${args['--version-name']:-} ]] || args['--version-name']="$RC_CLI_VERSION_NAME" | |
7321 |
|
7329 | |||
7322 | } |
|
7330 | } | |
7323 |
|
7331 | |||
7324 | # :command.parse_requirements |
|
7332 | # :command.parse_requirements | |
7325 | rcstack__completions_parse_requirements() { |
|
7333 | rcstack__completions_parse_requirements() { | |
7326 | # :command.fixed_flags_filter |
|
7334 | # :command.fixed_flags_filter | |
7327 | while [[ $# -gt 0 ]]; do |
|
7335 | while [[ $# -gt 0 ]]; do | |
7328 | case "${1:-}" in |
|
7336 | case "${1:-}" in | |
7329 | --help | -h) |
|
7337 | --help | -h) | |
7330 | long_usage=yes |
|
7338 | long_usage=yes | |
7331 | rcstack__completions_usage |
|
7339 | rcstack__completions_usage | |
7332 | exit |
|
7340 | exit | |
7333 | ;; |
|
7341 | ;; | |
7334 |
|
7342 | |||
7335 | *) |
|
7343 | *) | |
7336 | break |
|
7344 | break | |
7337 | ;; |
|
7345 | ;; | |
7338 |
|
7346 | |||
7339 | esac |
|
7347 | esac | |
7340 | done |
|
7348 | done | |
7341 |
|
7349 | |||
7342 | # :command.command_filter |
|
7350 | # :command.command_filter | |
7343 | action="_completions" |
|
7351 | action="_completions" | |
7344 |
|
7352 | |||
7345 | # :command.parse_requirements_while |
|
7353 | # :command.parse_requirements_while | |
7346 | while [[ $# -gt 0 ]]; do |
|
7354 | while [[ $# -gt 0 ]]; do | |
7347 | key="$1" |
|
7355 | key="$1" | |
7348 | case "$key" in |
|
7356 | case "$key" in | |
7349 |
|
7357 | |||
7350 | -?*) |
|
7358 | -?*) | |
7351 | printf "invalid option: %s\n" "$key" >&2 |
|
7359 | printf "invalid option: %s\n" "$key" >&2 | |
7352 | exit 1 |
|
7360 | exit 1 | |
7353 | ;; |
|
7361 | ;; | |
7354 |
|
7362 | |||
7355 | *) |
|
7363 | *) | |
7356 | # :command.parse_requirements_case |
|
7364 | # :command.parse_requirements_case | |
7357 | # :command.parse_requirements_case_simple |
|
7365 | # :command.parse_requirements_case_simple | |
7358 | printf "invalid argument: %s\n" "$key" >&2 |
|
7366 | printf "invalid argument: %s\n" "$key" >&2 | |
7359 | exit 1 |
|
7367 | exit 1 | |
7360 |
|
7368 | |||
7361 | ;; |
|
7369 | ;; | |
7362 |
|
7370 | |||
7363 | esac |
|
7371 | esac | |
7364 | done |
|
7372 | done | |
7365 |
|
7373 | |||
7366 | } |
|
7374 | } | |
7367 |
|
7375 | |||
7368 | # :command.initialize |
|
7376 | # :command.initialize | |
7369 | initialize() { |
|
7377 | initialize() { | |
7370 | version="5.5.0" |
|
7378 | version="5.5.0" | |
7371 | long_usage='' |
|
7379 | long_usage='' | |
7372 | set -e |
|
7380 | set -e | |
7373 |
|
7381 | |||
7374 | # :command.environment_variables_default |
|
7382 | # :command.environment_variables_default | |
7375 | export RCC_CONFIG="${RCC_CONFIG:-.rcstack.ini}" |
|
7383 | export RCC_CONFIG="${RCC_CONFIG:-.rcstack.ini}" | |
7376 | export RC_STACK_ROUTER_EXT="${RC_STACK_ROUTER_EXT:-.custom/docker-compose-router.override.yaml}" |
|
7384 | export RC_STACK_ROUTER_EXT="${RC_STACK_ROUTER_EXT:-.custom/docker-compose-router.override.yaml}" | |
7377 | export RC_STACK_METRICS_EXT="${RC_STACK_METRICS_EXT:-.custom/docker-compose-metrics.override.yaml}" |
|
7385 | export RC_STACK_METRICS_EXT="${RC_STACK_METRICS_EXT:-.custom/docker-compose-metrics.override.yaml}" | |
7378 | export RC_STACK_SERVICES_EXT="${RC_STACK_SERVICES_EXT:-.custom/docker-compose-services.override.yaml}" |
|
7386 | export RC_STACK_SERVICES_EXT="${RC_STACK_SERVICES_EXT:-.custom/docker-compose-services.override.yaml}" | |
7379 | export RC_STACK_RHODECODE_EXT="${RC_STACK_RHODECODE_EXT:-.custom/docker-compose-apps.override.yaml}" |
|
7387 | export RC_STACK_RHODECODE_EXT="${RC_STACK_RHODECODE_EXT:-.custom/docker-compose-apps.override.yaml}" | |
7380 |
|
7388 | |||
7381 | # src/initialize.sh |
|
7389 | # src/initialize.sh | |
7382 |
|
7390 | |||
7383 | rc_image_ver=4.28.0 |
|
7391 | rc_image_ver=4.28.0 | |
7384 |
|
7392 | |||
7385 | rhodecode_default_config_path=config/_shared/rhodecode.ini |
|
7393 | rhodecode_default_config_path=config/_shared/rhodecode.ini | |
7386 | vcsserver_default_config_path=config/_shared/vcsserver.ini |
|
7394 | vcsserver_default_config_path=config/_shared/vcsserver.ini | |
7387 |
|
7395 | |||
7388 | RC_STACK_ROUTER_VER=1.0.0 |
|
7396 | RC_STACK_ROUTER_VER=1.0.0 | |
7389 | RC_STACK_SERVICES_VER=1.0.0 |
|
7397 | RC_STACK_SERVICES_VER=1.0.0 | |
7390 | RC_STACK_RHODECODE_VER=1.0.0 |
|
7398 | RC_STACK_RHODECODE_VER=1.0.0 | |
7391 | RC_STACK_METRICS_VER=1.0.0 |
|
7399 | RC_STACK_METRICS_VER=1.0.0 | |
7392 |
|
7400 | |||
7393 | RC_SCRIPT_NAME=rcstack |
|
7401 | RC_SCRIPT_NAME=rcstack | |
7394 | # bootstrap file is a config file at the same time |
|
7402 | # bootstrap file is a config file at the same time | |
7395 | CONFIG_FILE=${RCC_CONFIG:=.rcstack.ini} |
|
7403 | CONFIG_FILE=${RCC_CONFIG:=.rcstack.ini} | |
7396 |
|
7404 | |||
7397 | # runtime env file |
|
7405 | # runtime env file | |
7398 | RUNTIME_ENV=$PWD/.custom/.runtime.env |
|
7406 | RUNTIME_ENV=$PWD/.custom/.runtime.env | |
7399 |
|
7407 | |||
7400 | # STACK_LIST |
|
7408 | # STACK_LIST | |
7401 | VALID_SERVICES="router metrics services rhodecode" |
|
7409 | VALID_SERVICES="router metrics services rhodecode" | |
7402 | DOCKER_DEFS_WORK_DIR="docker_defs" |
|
7410 | DOCKER_DEFS_WORK_DIR="docker_defs" | |
7403 |
|
7411 | |||
7404 | # stage key, saved in .rcstack.ini : stage func to execute |
|
7412 | # stage key, saved in .rcstack.ini : stage func to execute | |
7405 | BOOTSTRAP_STAGES="\ |
|
7413 | BOOTSTRAP_STAGES="\ | |
7406 | bootstrap_v1_docker_install \ |
|
7414 | bootstrap_v1_docker_install \ | |
7407 | bootstrap_v1_docker_commons \ |
|
7415 | bootstrap_v1_docker_commons \ | |
7408 | bootstrap_v1_definitions \ |
|
7416 | bootstrap_v1_definitions \ | |
7409 | bootstrap_v1_config \ |
|
7417 | bootstrap_v1_config \ | |
7410 | bootstrap_v1_overrides \ |
|
7418 | bootstrap_v1_overrides \ | |
7411 | " |
|
7419 | " | |
7412 |
|
7420 | |||
7413 | YAML_TEMPLATES="\ |
|
7421 | YAML_TEMPLATES="\ | |
7414 | docker-compose-apps.override.yaml |
|
7422 | docker-compose-apps.override.yaml | |
7415 | docker-compose-metrics.override.yaml |
|
7423 | docker-compose-metrics.override.yaml | |
7416 | docker-compose-router.override.yaml |
|
7424 | docker-compose-router.override.yaml | |
7417 | docker-compose-services.override.yaml |
|
7425 | docker-compose-services.override.yaml | |
7418 | runtime.env.tmpl |
|
7426 | runtime.env.tmpl | |
7419 | " |
|
7427 | " | |
7420 |
|
7428 | |||
7421 | BASE_OPS_IMAGE="ubuntu:22.04" |
|
7429 | BASE_OPS_IMAGE="ubuntu:22.04" | |
7422 |
|
7430 | |||
7423 | get_stage_function() { |
|
7431 | get_stage_function() { | |
7424 | stage_name=$1 |
|
7432 | stage_name=$1 | |
7425 |
|
7433 | |||
7426 | case $stage_name in |
|
7434 | case $stage_name in | |
7427 | bootstrap_v1_docker_install) |
|
7435 | bootstrap_v1_docker_install) | |
7428 | stage_func=bootstrap_docker_install |
|
7436 | stage_func=bootstrap_docker_install | |
7429 | ;; |
|
7437 | ;; | |
7430 | bootstrap_v1_docker_commons) |
|
7438 | bootstrap_v1_docker_commons) | |
7431 | stage_func=bootstrap_docker_commons |
|
7439 | stage_func=bootstrap_docker_commons | |
7432 | ;; |
|
7440 | ;; | |
7433 | bootstrap_v1_definitions) |
|
7441 | bootstrap_v1_definitions) | |
7434 | stage_func=bootstrap_definitions |
|
7442 | stage_func=bootstrap_definitions | |
7435 | ;; |
|
7443 | ;; | |
7436 | bootstrap_v1_config) |
|
7444 | bootstrap_v1_config) | |
7437 | stage_func=bootstrap_config |
|
7445 | stage_func=bootstrap_config | |
7438 | ;; |
|
7446 | ;; | |
7439 | bootstrap_v1_overrides) |
|
7447 | bootstrap_v1_overrides) | |
7440 | stage_func=bootstrap_overrides |
|
7448 | stage_func=bootstrap_overrides | |
7441 | ;; |
|
7449 | ;; | |
7442 | *) |
|
7450 | *) | |
7443 | echo "can't find function for stage $stage_name" |
|
7451 | echo "can't find function for stage $stage_name" | |
7444 | exit 1 |
|
7452 | exit 1 | |
7445 | esac |
|
7453 | esac | |
7446 |
|
7454 | |||
7447 | echo $stage_func |
|
7455 | echo $stage_func | |
7448 | } |
|
7456 | } | |
7449 |
|
7457 | |||
7450 | #echo "1 ----" |
|
7458 | #echo "1 ----" | |
7451 | #echo $RC_STACK_SERVICES_EXT |
|
7459 | #echo $RC_STACK_SERVICES_EXT | |
7452 | #echo $RC_STACK_METRICS_EXT |
|
7460 | #echo $RC_STACK_METRICS_EXT | |
7453 | #echo "1 -----" |
|
7461 | #echo "1 -----" | |
7454 |
|
7462 | |||
7455 | #echo '2 ----' |
|
7463 | #echo '2 ----' | |
7456 | #grep -v -e '^#' "$ENV_FILE" | xargs -I {} echo \'{}\' |
|
7464 | #grep -v -e '^#' "$ENV_FILE" | xargs -I {} echo \'{}\' | |
7457 | #echo '2 ----' |
|
7465 | #echo '2 ----' | |
7458 |
|
7466 | |||
7459 | #expose env vars from ./rcstack config |
|
7467 | #expose env vars from ./rcstack config | |
7460 | #if [[ -f $ENV_FILE ]]; then |
|
7468 | #if [[ -f $ENV_FILE ]]; then | |
7461 | # eval $(grep -v -e '^#' "$ENV_FILE" | xargs -I {} echo export \'{}\') |
|
7469 | # eval $(grep -v -e '^#' "$ENV_FILE" | xargs -I {} echo export \'{}\') | |
7462 | #fi |
|
7470 | #fi | |
7463 |
|
7471 | |||
7464 | #ENV_EXPAND="" |
|
7472 | #ENV_EXPAND="" | |
7465 | #for k in $(config_keys); do |
|
7473 | #for k in $(config_keys); do | |
7466 | # k_upper=${k^^} |
|
7474 | # k_upper=${k^^} | |
7467 | # env_entry="-e $k_upper='$(config_get "$k")' " |
|
7475 | # env_entry="-e $k_upper='$(config_get "$k")' " | |
7468 | # ENV_EXPAND+=$env_entry; |
|
7476 | # ENV_EXPAND+=$env_entry; | |
7469 | # #echo $env_expand |
|
7477 | # #echo $env_expand | |
7470 | #done |
|
7478 | #done | |
7471 |
|
7479 | |||
7472 | # |
|
7480 | # | |
7473 | #echo "3 ----" |
|
7481 | #echo "3 ----" | |
7474 | #echo $RC_STACK_SERVICES_EXT |
|
7482 | #echo $RC_STACK_SERVICES_EXT | |
7475 | #echo $RC_STACK_METRICS_EXT |
|
7483 | #echo $RC_STACK_METRICS_EXT | |
7476 | #echo $RC_STACK_RHODECODE_EXT |
|
7484 | #echo $RC_STACK_RHODECODE_EXT | |
7477 | #echo "3 -----" |
|
7485 | #echo "3 -----" | |
7478 |
|
7486 | |||
7479 | #env | grep RC_ |
|
7487 | #env | grep RC_ | |
7480 |
|
7488 | |||
7481 | docker_ping_host() { |
|
7489 | docker_ping_host() { | |
7482 | PING_HOST="$1" |
|
7490 | PING_HOST="$1" | |
7483 | docker run --network rhodecode_network --rm alpine ping "$PING_HOST" |
|
7491 | docker run --network rhodecode_network --rm alpine ping "$PING_HOST" | |
7484 | } |
|
7492 | } | |
7485 |
|
7493 | |||
7486 | get_started() { |
|
7494 | get_started() { | |
7487 | echo "" |
|
7495 | echo "" | |
7488 | echo "To start using RhodeCode run the following stacks using './$RC_SCRIPT_NAME stack [STACK_NAME]'" |
|
7496 | echo "To start using RhodeCode run the following stacks using './$RC_SCRIPT_NAME stack [STACK_NAME]'" | |
7489 | echo "Check './$RC_SCRIPT_NAME stack --help' for more examples and options" |
|
7497 | echo "Check './$RC_SCRIPT_NAME stack --help' for more examples and options" | |
7490 | echo "$(green_bold IMPORTANT): init command generates some secrets/config inside $RUNTIME_ENV file." |
|
7498 | echo "$(green_bold IMPORTANT): init command generates some secrets/config inside $RUNTIME_ENV file." | |
7491 | echo "Check and adjust those settings if needed." |
|
7499 | echo "Check and adjust those settings if needed." | |
7492 | echo "" |
|
7500 | echo "" | |
7493 | echo "$(bold Run the stacks in following order):" |
|
7501 | echo "$(bold Run the stacks in following order):" | |
7494 | echo "" |
|
7502 | echo "" | |
7495 | echo "$(green_bold 1\) router [Mandatory]): run the edge router to control stack traffic / domain access and optionally SSL termination" |
|
7503 | echo "$(green_bold 1\) router [Mandatory]): run the edge router to control stack traffic / domain access and optionally SSL termination" | |
7496 | echo "IMPORTANT: router binds to some common ports 80, 443, SSH (9022), Loki (3100) if those are not available, please adjust them" |
|
7504 | echo "IMPORTANT: router binds to some common ports 80, 443, SSH (9022), Loki (3100) if those are not available, please adjust them" | |
7497 | echo "To configure this stack before running check: $RC_STACK_ROUTER_EXT" |
|
7505 | echo "To configure this stack before running check: $RC_STACK_ROUTER_EXT" | |
7498 | echo "" |
|
7506 | echo "" | |
7499 | echo "./$RC_SCRIPT_NAME stack router up --detach" |
|
7507 | echo "./$RC_SCRIPT_NAME stack router up --detach" | |
7500 | echo "" |
|
7508 | echo "" | |
7501 | echo "$(green_bold 2\) services [Mandatory]): run the services, like database, redis, channelstream etc..." |
|
7509 | echo "$(green_bold 2\) services [Mandatory]): run the services, like database, redis, channelstream etc..." | |
7502 | echo "IMPORTANT: if you like to run your own database, or redis please adjust before running" |
|
7510 | echo "IMPORTANT: if you like to run your own database, or redis please adjust before running" | |
7503 | echo "To configure this stack before running check: $RC_STACK_SERVICES_EXT" |
|
7511 | echo "To configure this stack before running check: $RC_STACK_SERVICES_EXT" | |
7504 | echo "" |
|
7512 | echo "" | |
7505 | echo "./$RC_SCRIPT_NAME stack services up --detach" |
|
7513 | echo "./$RC_SCRIPT_NAME stack services up --detach" | |
7506 | echo "" |
|
7514 | echo "" | |
7507 | echo "$(green_bold 3\) rhodecode [Mandatory]): run the rhodecode app stack" |
|
7515 | echo "$(green_bold 3\) rhodecode [Mandatory]): run the rhodecode app stack" | |
7508 | echo "To configure this stack before running check: $RC_STACK_RHODECODE_EXT" |
|
7516 | echo "To configure this stack before running check: $RC_STACK_RHODECODE_EXT" | |
7509 | echo "" |
|
7517 | echo "" | |
7510 | echo "./$RC_SCRIPT_NAME stack rhodecode up --detach" |
|
7518 | echo "./$RC_SCRIPT_NAME stack rhodecode up --detach" | |
7511 | echo "" |
|
7519 | echo "" | |
7512 | echo "$(yellow_bold 4\) metrics [Optional]): run the monitoring stack, this includes grafana/prometheus logging/metrics system" |
|
7520 | echo "$(yellow_bold 4\) metrics [Optional]): run the monitoring stack, this includes grafana/prometheus logging/metrics system" | |
7513 | echo "To configure this stack before running check: $RC_STACK_METRICS_EXT" |
|
7521 | echo "To configure this stack before running check: $RC_STACK_METRICS_EXT" | |
7514 | echo "" |
|
7522 | echo "" | |
7515 | echo "./$RC_SCRIPT_NAME stack metrics up --detach" |
|
7523 | echo "./$RC_SCRIPT_NAME stack metrics up --detach" | |
7516 | echo "" |
|
7524 | echo "" | |
7517 | echo "$(bold [Status]): check services run status, ports etc.." |
|
7525 | echo "$(bold [Status]): check services run status, ports etc.." | |
7518 | echo "./$RC_SCRIPT_NAME status -v --configs" |
|
7526 | echo "./$RC_SCRIPT_NAME status -v --configs" | |
7519 | echo "" |
|
7527 | echo "" | |
7520 | echo "$(bold [All]): shorthand to run all stacks (detached with -d)" |
|
7528 | echo "$(bold [All]): shorthand to run all stacks (detached with -d)" | |
7521 | echo "./$RC_SCRIPT_NAME stack all up -d" |
|
7529 | echo "./$RC_SCRIPT_NAME stack all up -d" | |
7522 | echo "" |
|
7530 | echo "" | |
7523 | echo "$(bold [Logs]): check service logs" |
|
7531 | echo "$(bold [Logs]): check service logs" | |
7524 | echo "./$RC_SCRIPT_NAME stack [STACK_NAME] logs" |
|
7532 | echo "./$RC_SCRIPT_NAME stack [STACK_NAME] logs" | |
7525 | } |
|
7533 | } | |
7526 |
|
7534 | |||
7527 | get_started_full() { |
|
7535 | get_started_full() { | |
7528 | echo "$(blue_bold [~~~~ GET STARTED ~~~~~])" |
|
7536 | echo "$(blue_bold [~~~~ GET STARTED ~~~~~])" | |
7529 | echo "$(green_bold Having problems / need help? Reach out to us here:) https://community.rhodecode.com" |
|
7537 | echo "$(green_bold Having problems / need help? Reach out to us here:) https://community.rhodecode.com" | |
7530 | echo "" |
|
7538 | echo "" | |
7531 | echo "./$RC_SCRIPT_NAME is a CLI based installer/manager for RhodeCode Cluster Stack" |
|
7539 | echo "./$RC_SCRIPT_NAME is a CLI based installer/manager for RhodeCode Cluster Stack" | |
7532 | echo "./$RC_SCRIPT_NAME -h is your friend, in case of doubt, check examples and usage options with -h / --help flag" |
|
7540 | echo "./$RC_SCRIPT_NAME -h is your friend, in case of doubt, check examples and usage options with -h / --help flag" | |
7533 | echo "" |
|
7541 | echo "" | |
7534 | echo "$(yellow_bold [First time run])" |
|
7542 | echo "$(yellow_bold [First time run])" | |
7535 | echo "run './$RC_SCRIPT_NAME init' to setup docker and download required installer files." |
|
7543 | echo "run './$RC_SCRIPT_NAME init' to setup docker and download required installer files." | |
7536 | echo "./$RC_SCRIPT_NAME can install Docker for you, or install it manually before running init command" |
|
7544 | echo "./$RC_SCRIPT_NAME can install Docker for you, or install it manually before running init command" | |
7537 |
|
7545 | |||
7538 | get_started |
|
7546 | get_started | |
7539 | } |
|
7547 | } | |
7540 |
|
7548 | |||
7541 | } |
|
7549 | } | |
7542 |
|
7550 | |||
7543 | # :command.run |
|
7551 | # :command.run | |
7544 | run() { |
|
7552 | run() { | |
7545 | declare -A args=() |
|
7553 | declare -A args=() | |
7546 | declare -A deps=() |
|
7554 | declare -A deps=() | |
7547 | declare -a other_args=() |
|
7555 | declare -a other_args=() | |
7548 | declare -a input=() |
|
7556 | declare -a input=() | |
7549 | normalize_input "$@" |
|
7557 | normalize_input "$@" | |
7550 | parse_requirements "${input[@]}" |
|
7558 | parse_requirements "${input[@]}" | |
7551 |
|
7559 | |||
7552 | case "$action" in |
|
7560 | case "$action" in | |
7553 | "get-started") rcstack_get_started_command ;; |
|
7561 | "get-started") rcstack_get_started_command ;; | |
7554 | "init") rcstack_init_command ;; |
|
7562 | "init") rcstack_init_command ;; | |
7555 | "self-update") rcstack_self_update_command ;; |
|
7563 | "self-update") rcstack_self_update_command ;; | |
7556 | "stack") rcstack_stack_command ;; |
|
7564 | "stack") rcstack_stack_command ;; | |
7557 | "stack router") rcstack_stack_router_command ;; |
|
7565 | "stack router") rcstack_stack_router_command ;; | |
7558 | "stack metrics") rcstack_stack_metrics_command ;; |
|
7566 | "stack metrics") rcstack_stack_metrics_command ;; | |
7559 | "stack services") rcstack_stack_services_command ;; |
|
7567 | "stack services") rcstack_stack_services_command ;; | |
7560 | "stack rhodecode") rcstack_stack_rhodecode_command ;; |
|
7568 | "stack rhodecode") rcstack_stack_rhodecode_command ;; | |
7561 | "stack all") rcstack_stack_all_command ;; |
|
7569 | "stack all") rcstack_stack_all_command ;; | |
7562 | "stack-status") rcstack_stack_status_command ;; |
|
7570 | "stack-status") rcstack_stack_status_command ;; | |
7563 | "stack-upgrade") rcstack_stack_upgrade_command ;; |
|
7571 | "stack-upgrade") rcstack_stack_upgrade_command ;; | |
7564 | "stack-upgrade router") rcstack_stack_upgrade_router_command ;; |
|
7572 | "stack-upgrade router") rcstack_stack_upgrade_router_command ;; | |
7565 | "stack-upgrade services") rcstack_stack_upgrade_services_command ;; |
|
7573 | "stack-upgrade services") rcstack_stack_upgrade_services_command ;; | |
7566 | "stack-upgrade metrics") rcstack_stack_upgrade_metrics_command ;; |
|
7574 | "stack-upgrade metrics") rcstack_stack_upgrade_metrics_command ;; | |
7567 | "stack-upgrade rhodecode") rcstack_stack_upgrade_rhodecode_command ;; |
|
7575 | "stack-upgrade rhodecode") rcstack_stack_upgrade_rhodecode_command ;; | |
7568 | "stack-monitor") rcstack_stack_monitor_command ;; |
|
7576 | "stack-monitor") rcstack_stack_monitor_command ;; | |
7569 | "stack-monitor restart-unhealthy") rcstack_stack_monitor_restart_unhealthy_command ;; |
|
7577 | "stack-monitor restart-unhealthy") rcstack_stack_monitor_restart_unhealthy_command ;; | |
7570 | "cli") rcstack_cli_command ;; |
|
7578 | "cli") rcstack_cli_command ;; | |
7571 | "cli cmd") rcstack_cli_cmd_command ;; |
|
7579 | "cli cmd") rcstack_cli_cmd_command ;; | |
7572 | "cli image-info") rcstack_cli_image_info_command ;; |
|
7580 | "cli image-info") rcstack_cli_image_info_command ;; | |
7573 | "cli set-runtime-image") rcstack_cli_set_runtime_image_command ;; |
|
7581 | "cli set-runtime-image") rcstack_cli_set_runtime_image_command ;; | |
7574 | "cli docker-info") rcstack_cli_docker_info_command ;; |
|
7582 | "cli docker-info") rcstack_cli_docker_info_command ;; | |
7575 | "cli docker-upgrade") rcstack_cli_docker_upgrade_command ;; |
|
7583 | "cli docker-upgrade") rcstack_cli_docker_upgrade_command ;; | |
7576 | "cli ishell") rcstack_cli_ishell_command ;; |
|
7584 | "cli ishell") rcstack_cli_ishell_command ;; | |
7577 | "cli redis") rcstack_cli_redis_command ;; |
|
7585 | "cli redis") rcstack_cli_redis_command ;; | |
7578 | "cli db") rcstack_cli_db_command ;; |
|
7586 | "cli db") rcstack_cli_db_command ;; | |
7579 | "cli db-upgrade") rcstack_cli_db_upgrade_command ;; |
|
7587 | "cli db-upgrade") rcstack_cli_db_upgrade_command ;; | |
7580 | "cli storage") rcstack_cli_storage_command ;; |
|
7588 | "cli storage") rcstack_cli_storage_command ;; | |
7581 | "cli attach") rcstack_cli_attach_command ;; |
|
7589 | "cli attach") rcstack_cli_attach_command ;; | |
7582 | "cli set-edition") rcstack_cli_set_edition_command ;; |
|
7590 | "cli set-edition") rcstack_cli_set_edition_command ;; | |
7583 | "cli configure-vcsserver") rcstack_cli_configure_vcsserver_command ;; |
|
7591 | "cli configure-vcsserver") rcstack_cli_configure_vcsserver_command ;; | |
7584 | "cli configure-rhodecode") rcstack_cli_configure_rhodecode_command ;; |
|
7592 | "cli configure-rhodecode") rcstack_cli_configure_rhodecode_command ;; | |
7585 | "backup-db") rcstack_backup_db_command ;; |
|
7593 | "backup-db") rcstack_backup_db_command ;; | |
7586 | "backup-data") rcstack_backup_data_command ;; |
|
7594 | "backup-data") rcstack_backup_data_command ;; | |
7587 | "get-build-artifacts") rcstack_get_build_artifacts_command ;; |
|
7595 | "get-build-artifacts") rcstack_get_build_artifacts_command ;; | |
7588 | "build-installer") rcstack_build_installer_command ;; |
|
7596 | "build-installer") rcstack_build_installer_command ;; | |
7589 | "get-build-source") rcstack_get_build_source_command ;; |
|
7597 | "get-build-source") rcstack_get_build_source_command ;; | |
7590 | "build-source") rcstack_build_source_command ;; |
|
7598 | "build-source") rcstack_build_source_command ;; | |
7591 | "_completions") rcstack__completions_command ;; |
|
7599 | "_completions") rcstack__completions_command ;; | |
7592 | esac |
|
7600 | esac | |
7593 | } |
|
7601 | } | |
7594 |
|
7602 | |||
7595 | initialize |
|
7603 | initialize | |
7596 | run "$@" |
|
7604 | run "$@" |
General Comments 0
You need to be logged in to leave comments.
Login now