Show More
@@ -1,464 +1,491 b'' | |||||
1 | .. :changelog: |
|
1 | .. :changelog: | |
2 |
|
2 | |||
3 | Release History |
|
3 | Release History | |
4 | --------------- |
|
4 | --------------- | |
5 |
|
5 | |||
|
6 | v5.11.1 (2024-06-03) | |||
|
7 | ++++++++++++++++++++ | |||
|
8 | ||||
|
9 | Features | |||
|
10 | ^^^^^^^^ | |||
|
11 | ||||
|
12 | ||||
|
13 | Fixes | |||
|
14 | ^^^^^ | |||
|
15 | ||||
|
16 | ||||
|
17 | Chore | |||
|
18 | ^^^^^ | |||
|
19 | ||||
|
20 | **release:** set 5.0.2 as default installation method | |||
|
21 | ||||
|
22 | Docs | |||
|
23 | ^^^^ | |||
|
24 | ||||
|
25 | ||||
6 | v5.11.0 (2024-05-31) |
|
26 | v5.11.0 (2024-05-31) | |
7 | ++++++++++++++++++++ |
|
27 | ++++++++++++++++++++ | |
8 |
|
28 | |||
9 | Features |
|
29 | Features | |
10 | ^^^^^^^^ |
|
30 | ^^^^^^^^ | |
11 |
|
31 | |||
12 | * **services:** improved startup health-checks |
|
32 | * **services:** improved startup health-checks | |
13 |
|
33 | |||
14 | Fixes |
|
34 | Fixes | |
15 | ^^^^^ |
|
35 | ^^^^^ | |
16 |
|
36 | |||
17 | * **config:** fixed redis configuration to be more flexible |
|
37 | * **config:** fixed redis configuration to be more flexible | |
18 | * **configuration:** no longer set smtp server as it's leads to email sending error by default |
|
38 | * **configuration:** no longer set smtp server as it's leads to email sending error by default | |
19 | * **nginx:** fixed nginx static data detection and path misconfiguration |
|
39 | * **nginx:** fixed nginx static data detection and path misconfiguration | |
20 |
|
40 | |||
|
41 | Chore | |||
|
42 | ^^^^^ | |||
|
43 | ||||
|
44 | ||||
|
45 | Docs | |||
|
46 | ^^^^ | |||
|
47 | ||||
21 | v5.10.1 (2024-05-23) |
|
48 | v5.10.1 (2024-05-23) | |
22 | ++++++++++++++++++++ |
|
49 | ++++++++++++++++++++ | |
23 |
|
50 | |||
24 | Features |
|
51 | Features | |
25 | ^^^^^^^^ |
|
52 | ^^^^^^^^ | |
26 |
|
53 | |||
27 |
|
54 | |||
28 | Fixes |
|
55 | Fixes | |
29 | ^^^^^ |
|
56 | ^^^^^ | |
30 |
|
57 | |||
31 |
|
58 | |||
32 | Chore |
|
59 | Chore | |
33 | ^^^^^ |
|
60 | ^^^^^ | |
34 |
|
61 | |||
35 | * **release:** set 5.0.1 as default installation method |
|
62 | * **release:** set 5.0.1 as default installation method | |
36 |
|
63 | |||
37 | Docs |
|
64 | Docs | |
38 | ^^^^ |
|
65 | ^^^^ | |
39 |
|
66 | |||
40 | v5.10.0 (2024-05-23) |
|
67 | v5.10.0 (2024-05-23) | |
41 | ++++++++++++++++++++ |
|
68 | ++++++++++++++++++++ | |
42 |
|
69 | |||
43 | Features |
|
70 | Features | |
44 | ^^^^^^^^ |
|
71 | ^^^^^^^^ | |
45 |
|
72 | |||
46 | * **dev-tools:** add image version logic for release images |
|
73 | * **dev-tools:** add image version logic for release images | |
47 | * **healtcheck:** use start_period/start_interval for faster HC checks |
|
74 | * **healtcheck:** use start_period/start_interval for faster HC checks | |
48 | * **runtime-deps:** added dependent apps to ensure proper startup order |
|
75 | * **runtime-deps:** added dependent apps to ensure proper startup order | |
49 | * **svn-apache:** optimize dirs, and remove documentRoot that can cause problems |
|
76 | * **svn-apache:** optimize dirs, and remove documentRoot that can cause problems | |
50 |
|
77 | |||
51 | Fixes |
|
78 | Fixes | |
52 | ^^^^^ |
|
79 | ^^^^^ | |
53 |
|
80 | |||
54 | * **nginx:** fixed some edge cases issues with shared mounts on nginx |
|
81 | * **nginx:** fixed some edge cases issues with shared mounts on nginx | |
55 | * **run-deps:** cannot cross check for dependencies outside of apps |
|
82 | * **run-deps:** cannot cross check for dependencies outside of apps | |
56 |
|
83 | |||
57 | Chore |
|
84 | Chore | |
58 | ^^^^^ |
|
85 | ^^^^^ | |
59 |
|
86 | |||
60 | * **configs:** fixed 5.1 default hooks backend |
|
87 | * **configs:** fixed 5.1 default hooks backend | |
61 | * **svn:** bumped httpd service to 2.4.59 |
|
88 | * **svn:** bumped httpd service to 2.4.59 | |
62 |
|
89 | |||
63 | Docs |
|
90 | Docs | |
64 | ^^^^ |
|
91 | ^^^^ | |
65 |
|
92 | |||
66 | * fixes some info about installation for custom rcstack |
|
93 | * fixes some info about installation for custom rcstack | |
67 | * added more clarity on migration-to-docker data move |
|
94 | * added more clarity on migration-to-docker data move | |
68 |
|
95 | |||
69 | v5.9.0 (2024-05-14) |
|
96 | v5.9.0 (2024-05-14) | |
70 | +++++++++++++++++++ |
|
97 | +++++++++++++++++++ | |
71 |
|
98 | |||
72 | Features |
|
99 | Features | |
73 | ^^^^^^^^ |
|
100 | ^^^^^^^^ | |
74 |
|
101 | |||
75 | * **self-update:** updated strings/docs on self-update |
|
102 | * **self-update:** updated strings/docs on self-update | |
76 | * **self-update:** added smarter upgrade logic for rcstack |
|
103 | * **self-update:** added smarter upgrade logic for rcstack | |
77 | * **self-update:** added migration logic for self-update command |
|
104 | * **self-update:** added migration logic for self-update command | |
78 | * **build-image:** bumped python to 3.11.9 |
|
105 | * **build-image:** bumped python to 3.11.9 | |
79 | * **configs:** allow per-version config logic, and 'edge' for others |
|
106 | * **configs:** allow per-version config logic, and 'edge' for others | |
80 | * **db:** db commands now support postgres and mysql |
|
107 | * **db:** db commands now support postgres and mysql | |
81 | * **init:** configure DB replicas according to select DB type |
|
108 | * **init:** configure DB replicas according to select DB type | |
82 | * **init:** added option to accept EULA from CLI flag |
|
109 | * **init:** added option to accept EULA from CLI flag | |
83 | * **installation:** allow setting a custom DB and version to during installation |
|
110 | * **installation:** allow setting a custom DB and version to during installation | |
84 | * **metrics:** bumped metrics stack versions |
|
111 | * **metrics:** bumped metrics stack versions | |
85 | * **router:** bumped edge router traefik to 2.11 as it's only supported now |
|
112 | * **router:** bumped edge router traefik to 2.11 as it's only supported now | |
86 | * **dev-tools:** fixed ee command for dev tools |
|
113 | * **dev-tools:** fixed ee command for dev tools | |
87 | * **dev-tools:** allow non-interactive run of vcs/ce code for CI integration |
|
114 | * **dev-tools:** allow non-interactive run of vcs/ce code for CI integration | |
88 | * **dev-tools:** allow source-dir config for better CI integration |
|
115 | * **dev-tools:** allow source-dir config for better CI integration | |
89 | * **dev-tools:** updated various components for better UX/Debug |
|
116 | * **dev-tools:** updated various components for better UX/Debug | |
90 |
|
117 | |||
91 | Fixes |
|
118 | Fixes | |
92 | ^^^^^ |
|
119 | ^^^^^ | |
93 |
|
120 | |||
94 | * **docs:** updated docs and instructions |
|
121 | * **docs:** updated docs and instructions | |
95 | * **docs:** fixed mixed up paths of git/hg large objects in docker migration |
|
122 | * **docs:** fixed mixed up paths of git/hg large objects in docker migration | |
96 | * **ini-config:** store shared key in env to generate the proper data |
|
123 | * **ini-config:** store shared key in env to generate the proper data | |
97 | * **runtime:** don't hardcode the version into template for runtime env |
|
124 | * **runtime:** don't hardcode the version into template for runtime env | |
98 | * **self-update:** don't leak DEBUG flag from semver |
|
125 | * **self-update:** don't leak DEBUG flag from semver | |
99 | * **services:** create a dedicated mysql data volume |
|
126 | * **services:** create a dedicated mysql data volume | |
100 | * **static-sync:** use rsync for better multi-node startup compatability |
|
127 | * **static-sync:** use rsync for better multi-node startup compatability | |
101 | * **utils:** fixed missing sed_func |
|
128 | * **utils:** fixed missing sed_func | |
102 |
|
129 | |||
103 | Chore |
|
130 | Chore | |
104 | ^^^^^ |
|
131 | ^^^^^ | |
105 |
|
132 | |||
106 | * **dbs:** bumped database deps |
|
133 | * **dbs:** bumped database deps | |
107 | * **services:** bumped library/nginx:1.25.5 |
|
134 | * **services:** bumped library/nginx:1.25.5 | |
108 |
|
135 | |||
109 | Docs |
|
136 | Docs | |
110 | ^^^^ |
|
137 | ^^^^ | |
111 |
|
138 | |||
112 | * added info about release channel to use |
|
139 | * added info about release channel to use | |
113 |
|
140 | |||
114 | v5.8.0 (2024-04-17) |
|
141 | v5.8.0 (2024-04-17) | |
115 | +++++++++++++++++++ |
|
142 | +++++++++++++++++++ | |
116 |
|
143 | |||
117 | Features |
|
144 | Features | |
118 | ^^^^^^^^ |
|
145 | ^^^^^^^^ | |
119 |
|
146 | |||
120 | * **redis:** added --db flag to pick redis DB to connect to |
|
147 | * **redis:** added --db flag to pick redis DB to connect to | |
121 | * **router:** allow proper ports override to specify custom ports on router. |
|
148 | * **router:** allow proper ports override to specify custom ports on router. | |
122 | * **dev-env:** fast start celery/ssh on dev env, but replace them with code-based instances if they are started |
|
149 | * **dev-env:** fast start celery/ssh on dev env, but replace them with code-based instances if they are started | |
123 | * **dev-env:** optimized celery/ssh dev instances startup options |
|
150 | * **dev-env:** optimized celery/ssh dev instances startup options | |
124 | * **dev-tools:** allow running celery/celeryd for dev in more flexible ways |
|
151 | * **dev-tools:** allow running celery/celeryd for dev in more flexible ways | |
125 |
|
152 | |||
126 | Fixes |
|
153 | Fixes | |
127 | ^^^^^ |
|
154 | ^^^^^ | |
128 |
|
155 | |||
129 | * **celery:** use higher CLI value for max-tasks-per-child as a default for rcstack |
|
156 | * **celery:** use higher CLI value for max-tasks-per-child as a default for rcstack | |
130 | * **celery:** make sure celery workers get proper hostnames set for scaling |
|
157 | * **celery:** make sure celery workers get proper hostnames set for scaling | |
131 | * **cli-tools:** fixed issue with CLI tools selecting node for execution for older docker |
|
158 | * **cli-tools:** fixed issue with CLI tools selecting node for execution for older docker | |
132 | * **db:** fixed missing profiles for selecting different database type |
|
159 | * **db:** fixed missing profiles for selecting different database type | |
133 | * **dev-tools:** fix SSH port bind on dev version of sshd server |
|
160 | * **dev-tools:** fix SSH port bind on dev version of sshd server | |
134 | * **dev-tools:** make celeryd start with dev-env |
|
161 | * **dev-tools:** make celeryd start with dev-env | |
135 | * **docs:** fixed error in docs syntax |
|
162 | * **docs:** fixed error in docs syntax | |
136 | * **docs:** fixed ordering |
|
163 | * **docs:** fixed ordering | |
137 | * **docs:** added info about SVN re-config when moving to Docker |
|
164 | * **docs:** added info about SVN re-config when moving to Docker | |
138 | * **docs:** remove skip to content which is redundant |
|
165 | * **docs:** remove skip to content which is redundant | |
139 | * **getting-started:** added more explicit info how to start all using single command |
|
166 | * **getting-started:** added more explicit info how to start all using single command | |
140 | * **svn:** fixed default apache config |
|
167 | * **svn:** fixed default apache config | |
141 |
|
168 | |||
142 | Chore |
|
169 | Chore | |
143 | ^^^^^ |
|
170 | ^^^^^ | |
144 |
|
171 | |||
145 | * **docker compose:** remove file version strings as they are deprecated since new compose version |
|
172 | * **docker compose:** remove file version strings as they are deprecated since new compose version | |
146 | * **deps:** use python 3.11.8 from now on |
|
173 | * **deps:** use python 3.11.8 from now on | |
147 | * **docs:** added few extra inline comments on port changes on traefik |
|
174 | * **docs:** added few extra inline comments on port changes on traefik | |
148 | * **version:** bumped to 5.8.0 |
|
175 | * **version:** bumped to 5.8.0 | |
149 |
|
176 | |||
150 | Docs |
|
177 | Docs | |
151 | ^^^^ |
|
178 | ^^^^ | |
152 |
|
179 | |||
153 | * updated docs with custom SSL ports and other fixes |
|
180 | * updated docs with custom SSL ports and other fixes | |
154 | * fixed missing migration step that would make sure proper permissions are set on filesystem |
|
181 | * fixed missing migration step that would make sure proper permissions are set on filesystem | |
155 | * **dev:** updated dev docs |
|
182 | * **dev:** updated dev docs | |
156 | * **install:** updated docs for installation topics |
|
183 | * **install:** updated docs for installation topics | |
157 | * **migration:** added intersphinx compat link to migration |
|
184 | * **migration:** added intersphinx compat link to migration | |
158 | * **scaling:** updates scaling section to instruct how to scale ssh and celery |
|
185 | * **scaling:** updates scaling section to instruct how to scale ssh and celery | |
159 |
|
186 | |||
160 | v5.7.0 (2024-01-31) |
|
187 | v5.7.0 (2024-01-31) | |
161 | +++++++++++++++++++ |
|
188 | +++++++++++++++++++ | |
162 |
|
189 | |||
163 | Features |
|
190 | Features | |
164 | ^^^^^^^^ |
|
191 | ^^^^^^^^ | |
165 |
|
192 | |||
166 | * **cli-commands:** cli commands now use compose execute for a consistent behaviour and user execute control |
|
193 | * **cli-commands:** cli commands now use compose execute for a consistent behaviour and user execute control | |
167 | * **cli-commands:** cli commands now allow to pass in --user flag to control which user executes the command |
|
194 | * **cli-commands:** cli commands now allow to pass in --user flag to control which user executes the command | |
168 | * **docs:** added comprehensive full text search doc guide |
|
195 | * **docs:** added comprehensive full text search doc guide | |
169 | * **dev-tools:** allow running sshd on dev mode |
|
196 | * **dev-tools:** allow running sshd on dev mode | |
170 |
|
197 | |||
171 | Fixes |
|
198 | Fixes | |
172 | ^^^^^ |
|
199 | ^^^^^ | |
173 |
|
200 | |||
174 | * **build-image:** fix presence of .rhoderc to improve UX when indexing on fresh installations |
|
201 | * **build-image:** fix presence of .rhoderc to improve UX when indexing on fresh installations | |
175 | * **traefik:** fixed bad letsencrypt acme storage path |
|
202 | * **traefik:** fixed bad letsencrypt acme storage path | |
176 |
|
203 | |||
177 | Chore |
|
204 | Chore | |
178 | ^^^^^ |
|
205 | ^^^^^ | |
179 |
|
206 | |||
180 | * **self-update:** small logging changes for self-update output |
|
207 | * **self-update:** small logging changes for self-update output | |
181 | * **version:** bumped version to 5.7.0 |
|
208 | * **version:** bumped version to 5.7.0 | |
182 |
|
209 | |||
183 | Dev |
|
210 | Dev | |
184 | ^^^ |
|
211 | ^^^ | |
185 |
|
212 | |||
186 | * **tools:** small fixes for dev-tools |
|
213 | * **tools:** small fixes for dev-tools | |
187 |
|
214 | |||
188 | Docs |
|
215 | Docs | |
189 | ^^^^ |
|
216 | ^^^^ | |
190 |
|
217 | |||
191 | * **build:** updated docs build image and templates |
|
218 | * **build:** updated docs build image and templates | |
192 | * **fix:** fixed acme storage path example |
|
219 | * **fix:** fixed acme storage path example | |
193 | * **misc:** various docs improvements |
|
220 | * **misc:** various docs improvements | |
194 |
|
221 | |||
195 | v5.6.0 (2024-01-15) |
|
222 | v5.6.0 (2024-01-15) | |
196 | +++++++++++++++++++ |
|
223 | +++++++++++++++++++ | |
197 |
|
224 | |||
198 | Features |
|
225 | Features | |
199 | ^^^^^^^^ |
|
226 | ^^^^^^^^ | |
200 |
|
227 | |||
201 | * **cli:** added support to run without TTY for CLI commands |
|
228 | * **cli:** added support to run without TTY for CLI commands | |
202 | * **docker-upgrade:** added a new option to upgrade docker system via rcstack on linux os. |
|
229 | * **docker-upgrade:** added a new option to upgrade docker system via rcstack on linux os. | |
203 | * **upgrade:** ensure docker compose gets upgraded on docker upgrade command |
|
230 | * **upgrade:** ensure docker compose gets upgraded on docker upgrade command | |
204 | * **core:** removed all build commands from rcstack, they are now part of dev-tools |
|
231 | * **core:** removed all build commands from rcstack, they are now part of dev-tools | |
205 | * **dev-tools:** refactor and rename CLI build commands |
|
232 | * **dev-tools:** refactor and rename CLI build commands | |
206 |
|
233 | |||
207 | Fixes |
|
234 | Fixes | |
208 | ^^^^^ |
|
235 | ^^^^^ | |
209 |
|
236 | |||
210 | * **backup-db:** backup-db now writes a backup to DESTINATION argument passed |
|
237 | * **backup-db:** backup-db now writes a backup to DESTINATION argument passed | |
211 | * **docker-upgrade:** added more info for compose upgrade |
|
238 | * **docker-upgrade:** added more info for compose upgrade | |
212 |
|
239 | |||
213 | Build |
|
240 | Build | |
214 | ^^^^^ |
|
241 | ^^^^^ | |
215 |
|
242 | |||
216 | * **git-lfs:** add latest git-lfs binary into docker image |
|
243 | * **git-lfs:** add latest git-lfs binary into docker image | |
217 | * **docker-5:** improve image building, added labels |
|
244 | * **docker-5:** improve image building, added labels | |
218 | * **release:** standardize release changelog settings |
|
245 | * **release:** standardize release changelog settings | |
219 |
|
246 | |||
220 | Chore |
|
247 | Chore | |
221 | ^^^^^ |
|
248 | ^^^^^ | |
222 |
|
249 | |||
223 | * **deps:** bumped metrics stack deps |
|
250 | * **deps:** bumped metrics stack deps | |
224 | * **deps:** bumped redis to 7.2.4 |
|
251 | * **deps:** bumped redis to 7.2.4 | |
225 | * **version:** version bump to 5.6.0 |
|
252 | * **version:** version bump to 5.6.0 | |
226 |
|
253 | |||
227 |
|
254 | |||
228 | v5.5.0 (2023-12-28) |
|
255 | v5.5.0 (2023-12-28) | |
229 | +++++++++++++++++++ |
|
256 | +++++++++++++++++++ | |
230 |
|
257 | |||
231 | Features |
|
258 | Features | |
232 | ^^^^^^^^ |
|
259 | ^^^^^^^^ | |
233 |
|
260 | |||
234 | * **cli:** made reading from .runtime.env file error prone. Proper warning will be displayed once errors are found |
|
261 | * **cli:** made reading from .runtime.env file error prone. Proper warning will be displayed once errors are found | |
235 | * **stack-upgrade:** change order of upgrade, sshd code should go before svn for faster and more reliable upgrade |
|
262 | * **stack-upgrade:** change order of upgrade, sshd code should go before svn for faster and more reliable upgrade | |
236 |
|
263 | |||
237 | Fixes |
|
264 | Fixes | |
238 | ^^^^^ |
|
265 | ^^^^^ | |
239 |
|
266 | |||
240 | * **backup:** fixed backup commands not processing all volumes, but just last |
|
267 | * **backup:** fixed backup commands not processing all volumes, but just last | |
241 | * **build:** fixed script to obtain build archives |
|
268 | * **build:** fixed script to obtain build archives | |
242 | * **dev-tools:** make it more explicit to set WORKSPACE_HOME |
|
269 | * **dev-tools:** make it more explicit to set WORKSPACE_HOME | |
243 | * **docs-build:** changes/adjustments for building docs |
|
270 | * **docs-build:** changes/adjustments for building docs | |
244 | * **help:** fixed stack upgrade help lines for CLI |
|
271 | * **help:** fixed stack upgrade help lines for CLI | |
245 | * **stack-upgrade:** stack-upgrade will work correctly when no previous containers were running |
|
272 | * **stack-upgrade:** stack-upgrade will work correctly when no previous containers were running | |
246 |
|
273 | |||
247 | Dev |
|
274 | Dev | |
248 | ^^^ |
|
275 | ^^^ | |
249 |
|
276 | |||
250 | * **build:** added static file checker during a build command |
|
277 | * **build:** added static file checker during a build command | |
251 |
|
278 | |||
252 | Docs |
|
279 | Docs | |
253 | ^^^^ |
|
280 | ^^^^ | |
254 |
|
281 | |||
255 | * **dev-build:** added step-by-step instructions for dev env setup and setup_dev.sh for easier installation |
|
282 | * **dev-build:** added step-by-step instructions for dev env setup and setup_dev.sh for easier installation | |
256 | * **develop:** added dev docs to setup env for development |
|
283 | * **develop:** added dev docs to setup env for development | |
257 | * **docs-build:** fixed docs build how to |
|
284 | * **docs-build:** fixed docs build how to | |
258 | * **upgrade:** explain how to avoid scale 2x on upgrade |
|
285 | * **upgrade:** explain how to avoid scale 2x on upgrade | |
259 | * **docs:** fixed docs warning |
|
286 | * **docs:** fixed docs warning | |
260 | * **docs:** fixed develop docs |
|
287 | * **docs:** fixed develop docs | |
261 | * **docs:** made it clear about changes on statsd TTL |
|
288 | * **docs:** made it clear about changes on statsd TTL | |
262 |
|
289 | |||
263 |
|
290 | |||
264 | v5.4.0 (2023-12-13) |
|
291 | v5.4.0 (2023-12-13) | |
265 | +++++++++++++++++++ |
|
292 | +++++++++++++++++++ | |
266 |
|
293 | |||
267 | Features |
|
294 | Features | |
268 | ^^^^^^^^ |
|
295 | ^^^^^^^^ | |
269 |
|
296 | |||
270 | * **grafana:** format IP addresses with fixed width for loki entries |
|
297 | * **grafana:** format IP addresses with fixed width for loki entries | |
271 | * **self-update:** added --update-docker-image to force set version from installer |
|
298 | * **self-update:** added --update-docker-image to force set version from installer | |
272 | * **ssh:** allow fully custom ssh port for k8s setup |
|
299 | * **ssh:** allow fully custom ssh port for k8s setup | |
273 | * **ssl:** ensure all services get SSL enabled during init phase |
|
300 | * **ssl:** ensure all services get SSL enabled during init phase | |
274 | * **status:** add more information on status with --config flag |
|
301 | * **status:** add more information on status with --config flag | |
275 |
|
302 | |||
276 | Fixes |
|
303 | Fixes | |
277 | ^^^^^ |
|
304 | ^^^^^ | |
278 |
|
305 | |||
279 | * **ssl:** show properly how to enable mounts for custom traefik ssl |
|
306 | * **ssl:** show properly how to enable mounts for custom traefik ssl | |
280 | * **static-files:** fixed missing JS plugins wiped during a build |
|
307 | * **static-files:** fixed missing JS plugins wiped during a build | |
281 |
|
308 | |||
282 | Build |
|
309 | Build | |
283 | ^^^^^ |
|
310 | ^^^^^ | |
284 |
|
311 | |||
285 | * **router:** bumped traefik to v2.10.7 |
|
312 | * **router:** bumped traefik to v2.10.7 | |
286 | * **services:** bumped postgresql to 14.10 |
|
313 | * **services:** bumped postgresql to 14.10 | |
287 | * **services:** bumped redis to 7.2.3 |
|
314 | * **services:** bumped redis to 7.2.3 | |
288 |
|
315 | |||
289 | Dev |
|
316 | Dev | |
290 | ^^^ |
|
317 | ^^^ | |
291 |
|
318 | |||
292 | * **tools:** added better entrypoints to start dev envs |
|
319 | * **tools:** added better entrypoints to start dev envs | |
293 |
|
320 | |||
294 | Docs |
|
321 | Docs | |
295 | ^^^^ |
|
322 | ^^^^ | |
296 |
|
323 | |||
297 | * **requirements:** add info about basic requirements for hardware |
|
324 | * **requirements:** add info about basic requirements for hardware | |
298 | * **ssl:** cleanup example cert files names |
|
325 | * **ssl:** cleanup example cert files names | |
299 |
|
326 | |||
300 |
|
327 | |||
301 |
|
328 | |||
302 | v5.3.0 (2023-11-29) |
|
329 | v5.3.0 (2023-11-29) | |
303 | +++++++++++++++++++ |
|
330 | +++++++++++++++++++ | |
304 |
|
331 | |||
305 | Features |
|
332 | Features | |
306 | ^^^^^^^^ |
|
333 | ^^^^^^^^ | |
307 |
|
334 | |||
308 | * **docker:** added force docker upgrade and docker version commands |
|
335 | * **docker:** added force docker upgrade and docker version commands | |
309 | * **docs:** build docs using docker image |
|
336 | * **docs:** build docs using docker image | |
310 | * **docs:** enabled google analytics on docs |
|
337 | * **docs:** enabled google analytics on docs | |
311 | * **grafana:** updated grafana dashboard with better metrics |
|
338 | * **grafana:** updated grafana dashboard with better metrics | |
312 | * **overrides:** added example how to mount own source code on rhodecode |
|
339 | * **overrides:** added example how to mount own source code on rhodecode | |
313 | * **stack:** added new cli cmd option to run a custom command on top of image |
|
340 | * **stack:** added new cli cmd option to run a custom command on top of image | |
314 | * **status:** added -v flag to print some useful info on the stack status |
|
341 | * **status:** added -v flag to print some useful info on the stack status | |
315 |
|
342 | |||
316 | Fixes |
|
343 | Fixes | |
317 | ^^^^^ |
|
344 | ^^^^^ | |
318 |
|
345 | |||
319 | * **docs:** fixed ssh port in docs |
|
346 | * **docs:** fixed ssh port in docs | |
320 | * **elasticsearch:** tune options for ES cluster to work properly under docker |
|
347 | * **elasticsearch:** tune options for ES cluster to work properly under docker | |
321 | * **init:** fixed bug with sed on linux systems |
|
348 | * **init:** fixed bug with sed on linux systems | |
322 |
|
349 | |||
323 | Build |
|
350 | Build | |
324 | ^^^^^ |
|
351 | ^^^^^ | |
325 |
|
352 | |||
326 | * **pip:** bumped pip version to 23.3.1 |
|
353 | * **pip:** bumped pip version to 23.3.1 | |
327 |
|
354 | |||
328 | Chore |
|
355 | Chore | |
329 | ^^^^^ |
|
356 | ^^^^^ | |
330 |
|
357 | |||
331 | * **spelling:** improve info about used commit on init/update |
|
358 | * **spelling:** improve info about used commit on init/update | |
332 |
|
359 | |||
333 | Dev |
|
360 | Dev | |
334 | ^^^ |
|
361 | ^^^ | |
335 |
|
362 | |||
336 | * **tools:** set new version setting logic on top of dev-tools |
|
363 | * **tools:** set new version setting logic on top of dev-tools | |
337 |
|
364 | |||
338 | Docs |
|
365 | Docs | |
339 | ^^^^ |
|
366 | ^^^^ | |
340 |
|
367 | |||
341 | * **configuration:** added info about turning off elasticsearch |
|
368 | * **configuration:** added info about turning off elasticsearch | |
342 | * **index:** show latest version for index page |
|
369 | * **index:** show latest version for index page | |
343 | * **rcstack-help:** fix instructions for getting rcstack at stable |
|
370 | * **rcstack-help:** fix instructions for getting rcstack at stable | |
344 | * **ssl:** improve ssl certificates docs |
|
371 | * **ssl:** improve ssl certificates docs | |
345 | * **ssl:** added info about troubleshooting the SSL certs |
|
372 | * **ssl:** added info about troubleshooting the SSL certs | |
346 |
|
373 | |||
347 | v5.2.0 (2023-11-08) |
|
374 | v5.2.0 (2023-11-08) | |
348 | +++++++++++++++++++ |
|
375 | +++++++++++++++++++ | |
349 |
|
376 | |||
350 |
|
377 | |||
351 | Features |
|
378 | Features | |
352 | ^^^^^^^^ |
|
379 | ^^^^^^^^ | |
353 |
|
380 | |||
354 | * **os-support:** beta support for OSX installation |
|
381 | * **os-support:** beta support for OSX installation | |
355 | * **compatability:** used unified sed function for better OS compatability |
|
382 | * **compatability:** used unified sed function for better OS compatability | |
356 | * **install:** improved logic of init script re-run with --force |
|
383 | * **install:** improved logic of init script re-run with --force | |
357 |
|
384 | |||
358 | Fixes |
|
385 | Fixes | |
359 | ^^^^^ |
|
386 | ^^^^^ | |
360 |
|
387 | |||
361 | * **docker-image:** fixed symlink creation for svn and git |
|
388 | * **docker-image:** fixed symlink creation for svn and git | |
362 |
|
389 | |||
363 | Build |
|
390 | Build | |
364 | ^^^^^ |
|
391 | ^^^^^ | |
365 |
|
392 | |||
366 | * **certs:** fixed a missing blank .crt file allowing to specify custom certs |
|
393 | * **certs:** fixed a missing blank .crt file allowing to specify custom certs | |
367 | * **metrics:** bumped metrics stack |
|
394 | * **metrics:** bumped metrics stack | |
368 | * **services:** bumped services stack |
|
395 | * **services:** bumped services stack | |
369 | * **ssl:** updated and stored default cert file bundle exposed inside containers |
|
396 | * **ssl:** updated and stored default cert file bundle exposed inside containers | |
370 |
|
397 | |||
371 | Chore |
|
398 | Chore | |
372 | ^^^^^ |
|
399 | ^^^^^ | |
373 |
|
400 | |||
374 | * **comments:** added info about Loki auth format |
|
401 | * **comments:** added info about Loki auth format | |
375 |
|
402 | |||
376 | Dev |
|
403 | Dev | |
377 | ^^^ |
|
404 | ^^^ | |
378 |
|
405 | |||
379 | * **dev-tools:** improve starting dev images via docker |
|
406 | * **dev-tools:** improve starting dev images via docker | |
380 |
|
407 | |||
381 | Docs |
|
408 | Docs | |
382 | ^^^^ |
|
409 | ^^^^ | |
383 |
|
410 | |||
384 | * **os-support:** added information about supported OS |
|
411 | * **os-support:** added information about supported OS | |
385 | * **ssl:** added information about ssl certificate handling for rcstack |
|
412 | * **ssl:** added information about ssl certificate handling for rcstack | |
386 | * **upgrade:** added information about faster upgrade |
|
413 | * **upgrade:** added information about faster upgrade | |
387 |
|
414 | |||
388 |
|
415 | |||
389 | v5.1.0 (2023-11-02) |
|
416 | v5.1.0 (2023-11-02) | |
390 | +++++++++++++++++++ |
|
417 | +++++++++++++++++++ | |
391 |
|
418 | |||
392 | Fixes |
|
419 | Fixes | |
393 | ^^^^^ |
|
420 | ^^^^^ | |
394 |
|
421 | |||
395 | * **core:** moved the custom build files and definition to subfolders |
|
422 | * **core:** moved the custom build files and definition to subfolders | |
396 | * **core:** fixed svn apps to not override by default SVN env variables |
|
423 | * **core:** fixed svn apps to not override by default SVN env variables | |
397 |
|
424 | |||
398 | Chore |
|
425 | Chore | |
399 | ^^^^^ |
|
426 | ^^^^^ | |
400 |
|
427 | |||
401 | * **ignore:** added extra ignore dirs in config |
|
428 | * **ignore:** added extra ignore dirs in config | |
402 |
|
429 | |||
403 | Docs |
|
430 | Docs | |
404 | ^^^^ |
|
431 | ^^^^ | |
405 |
|
432 | |||
406 | * **migration:** added more comprehensive instructions for upgrade task |
|
433 | * **migration:** added more comprehensive instructions for upgrade task | |
407 | * **upgrade:** added additional step for upgrade doc |
|
434 | * **upgrade:** added additional step for upgrade doc | |
408 |
|
435 | |||
409 |
|
436 | |||
410 | v5.0.8 (2023-10-25) |
|
437 | v5.0.8 (2023-10-25) | |
411 | +++++++++++++++++++ |
|
438 | +++++++++++++++++++ | |
412 |
|
439 | |||
413 | Fixes |
|
440 | Fixes | |
414 | ^^^^^ |
|
441 | ^^^^^ | |
415 |
|
442 | |||
416 |
|
443 | |||
417 | * **services**: fixed healthcheck syntax to be more reliable |
|
444 | * **services**: fixed healthcheck syntax to be more reliable | |
418 |
|
445 | |||
419 | Chore |
|
446 | Chore | |
420 | ^^^^^ |
|
447 | ^^^^^ | |
421 |
|
448 | |||
422 | * **dependencies**: bumped to traefik:v2.10.5 |
|
449 | * **dependencies**: bumped to traefik:v2.10.5 | |
423 | * **dependencies**: bumped to library/redis:7.0.14 |
|
450 | * **dependencies**: bumped to library/redis:7.0.14 | |
424 |
|
451 | |||
425 | Docs |
|
452 | Docs | |
426 | ^^^^ |
|
453 | ^^^^ | |
427 |
|
454 | |||
428 | * **migration**: updated migration guide |
|
455 | * **migration**: updated migration guide | |
429 |
|
456 | |||
430 |
|
457 | |||
431 | v5.0.7 (2023-10-23) |
|
458 | v5.0.7 (2023-10-23) | |
432 | +++++++++++++++++++ |
|
459 | +++++++++++++++++++ | |
433 |
|
460 | |||
434 | * docs: updated few instructions on image management |
|
461 | * docs: updated few instructions on image management | |
435 | * svn[bugfix]: fixed svn configs for custom build |
|
462 | * svn[bugfix]: fixed svn configs for custom build | |
436 | * svn: bumped httpd to .58 |
|
463 | * svn: bumped httpd to .58 | |
437 | * cli[bugfix]: fixed issue with runtime-image-info command |
|
464 | * cli[bugfix]: fixed issue with runtime-image-info command | |
438 | * monitoring: fixed label position on grafana dashboard |
|
465 | * monitoring: fixed label position on grafana dashboard | |
439 |
|
466 | |||
440 |
|
467 | |||
441 | v5.0.6 (2023-10-12) |
|
468 | v5.0.6 (2023-10-12) | |
442 | +++++++++++++++++++ |
|
469 | +++++++++++++++++++ | |
443 |
|
470 | |||
444 | * rcstack asks for EULA for CE/EE versions |
|
471 | * rcstack asks for EULA for CE/EE versions | |
445 |
|
472 | |||
446 |
|
473 | |||
447 | v5.0.5 (2023-10-10) |
|
474 | v5.0.5 (2023-10-10) | |
448 | +++++++++++++++++++ |
|
475 | +++++++++++++++++++ | |
449 |
|
476 | |||
450 | * expose DOMAIN/_pages to expose "pages" like drop-folder to serve static pages |
|
477 | * expose DOMAIN/_pages to expose "pages" like drop-folder to serve static pages | |
451 | * change documentation to RST |
|
478 | * change documentation to RST | |
452 |
|
479 | |||
453 |
|
480 | |||
454 | v5.0.4 (2023-09-29) |
|
481 | v5.0.4 (2023-09-29) | |
455 | +++++++++++++++++++ |
|
482 | +++++++++++++++++++ | |
456 |
|
483 | |||
457 | * rcstack: remove dependency for md5sum, this allows to run on macOS |
|
484 | * rcstack: remove dependency for md5sum, this allows to run on macOS | |
458 | * nginx: cleanup configuration files to single conf file |
|
485 | * nginx: cleanup configuration files to single conf file | |
459 |
|
486 | |||
460 |
|
487 | |||
461 | v5.0.0 (2023-09-21) |
|
488 | v5.0.0 (2023-09-21) | |
462 | +++++++++++++++++++ |
|
489 | +++++++++++++++++++ | |
463 |
|
490 | |||
464 | * initial release for new python3 RhodeCode installer |
|
491 | * initial release for new python3 RhodeCode installer |
@@ -1,7991 +1,7991 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 | printf " %s Perform rcstack upgrade procedure. This aims at changing existing installations with some changes required that are not backward compatible\n" "self-upgrade " |
|
45 | printf " %s Perform rcstack upgrade procedure. This aims at changing existing installations with some changes required that are not backward compatible\n" "self-upgrade " | |
46 | echo |
|
46 | echo | |
47 | printf "%s\n" "Stack Commands:" |
|
47 | printf "%s\n" "Stack Commands:" | |
48 | printf " %s Run one of available cluster stacks, run stack -h for more details\n" "stack " |
|
48 | printf " %s Run one of available cluster stacks, run stack -h for more details\n" "stack " | |
49 | printf " %s Show stack status\n" "stack-status " |
|
49 | printf " %s Show stack status\n" "stack-status " | |
50 | printf " %s Upgrade a stack, run stack-upgrade -h for more details\n" "stack-upgrade" |
|
50 | printf " %s Upgrade a stack, run stack-upgrade -h for more details\n" "stack-upgrade" | |
51 | printf " %s run monitoring on stack items\n" "stack-monitor" |
|
51 | printf " %s run monitoring on stack items\n" "stack-monitor" | |
52 | echo |
|
52 | echo | |
53 | printf "%s\n" "CLI Commands:" |
|
53 | printf "%s\n" "CLI Commands:" | |
54 | printf " %s Various CLI tools, run cli -h for more details\n" "cli " |
|
54 | printf " %s Various CLI tools, run cli -h for more details\n" "cli " | |
55 | echo |
|
55 | echo | |
56 | printf "%s\n" "Backup Commands:" |
|
56 | printf "%s\n" "Backup Commands:" | |
57 | printf " %s Backup Database\n" "backup-db " |
|
57 | printf " %s Backup Database\n" "backup-db " | |
58 | printf " %s Backup RhodeCode storage\n" "backup-data " |
|
58 | printf " %s Backup RhodeCode storage\n" "backup-data " | |
59 | echo |
|
59 | echo | |
60 |
|
60 | |||
61 | # :command.long_usage |
|
61 | # :command.long_usage | |
62 | if [[ -n $long_usage ]]; then |
|
62 | if [[ -n $long_usage ]]; then | |
63 | printf "%s\n" "Options:" |
|
63 | printf "%s\n" "Options:" | |
64 |
|
64 | |||
65 | # :command.usage_flags |
|
65 | # :command.usage_flags | |
66 | # :flag.usage |
|
66 | # :flag.usage | |
67 | printf " %s\n" "--debug" |
|
67 | printf " %s\n" "--debug" | |
68 | printf " Enable debug and detailed output. Add --debug right after ./rcstack command.\n E.g. ./rcstack --debug COMMAND\n" |
|
68 | printf " Enable debug and detailed output. Add --debug right after ./rcstack command.\n E.g. ./rcstack --debug COMMAND\n" | |
69 | echo |
|
69 | echo | |
70 |
|
70 | |||
71 | # :flag.usage |
|
71 | # :flag.usage | |
72 | printf " %s\n" "--no-init-check" |
|
72 | printf " %s\n" "--no-init-check" | |
73 | printf " Skip check for ./rcstack init call\n" |
|
73 | printf " Skip check for ./rcstack init call\n" | |
74 | echo |
|
74 | echo | |
75 |
|
75 | |||
76 | # :command.usage_fixed_flags |
|
76 | # :command.usage_fixed_flags | |
77 | printf " %s\n" "--help, -h" |
|
77 | printf " %s\n" "--help, -h" | |
78 | printf " Show this help\n" |
|
78 | printf " Show this help\n" | |
79 | echo |
|
79 | echo | |
80 | printf " %s\n" "--version, -v" |
|
80 | printf " %s\n" "--version, -v" | |
81 | printf " Show version number\n" |
|
81 | printf " Show version number\n" | |
82 | echo |
|
82 | echo | |
83 |
|
83 | |||
84 | # :command.usage_environment_variables |
|
84 | # :command.usage_environment_variables | |
85 | printf "%s\n" "Environment Variables:" |
|
85 | printf "%s\n" "Environment Variables:" | |
86 |
|
86 | |||
87 | # :environment_variable.usage |
|
87 | # :environment_variable.usage | |
88 | printf " %s\n" "RCC_CONFIG" |
|
88 | printf " %s\n" "RCC_CONFIG" | |
89 | printf " default config file for rcstack\n" |
|
89 | printf " default config file for rcstack\n" | |
90 | printf " Default: .rcstack.ini\n" |
|
90 | printf " Default: .rcstack.ini\n" | |
91 | echo |
|
91 | echo | |
92 |
|
92 | |||
93 | # :environment_variable.usage |
|
93 | # :environment_variable.usage | |
94 | printf " %s\n" "AUTH_TOKEN" |
|
94 | printf " %s\n" "AUTH_TOKEN" | |
95 | printf " Set your RhodeCode AUTH Token\n" |
|
95 | printf " Set your RhodeCode AUTH Token\n" | |
96 | echo |
|
96 | echo | |
97 |
|
97 | |||
98 | # :environment_variable.usage |
|
98 | # :environment_variable.usage | |
99 | printf " %s\n" "RC_STACK_ROUTER_EXT" |
|
99 | printf " %s\n" "RC_STACK_ROUTER_EXT" | |
100 | printf "\n" |
|
100 | printf "\n" | |
101 | printf " Default: .custom/docker-compose-router.override.yaml\n" |
|
101 | printf " Default: .custom/docker-compose-router.override.yaml\n" | |
102 | echo |
|
102 | echo | |
103 |
|
103 | |||
104 | # :environment_variable.usage |
|
104 | # :environment_variable.usage | |
105 | printf " %s\n" "RC_STACK_METRICS_EXT" |
|
105 | printf " %s\n" "RC_STACK_METRICS_EXT" | |
106 | printf "\n" |
|
106 | printf "\n" | |
107 | printf " Default: .custom/docker-compose-metrics.override.yaml\n" |
|
107 | printf " Default: .custom/docker-compose-metrics.override.yaml\n" | |
108 | echo |
|
108 | echo | |
109 |
|
109 | |||
110 | # :environment_variable.usage |
|
110 | # :environment_variable.usage | |
111 | printf " %s\n" "RC_STACK_SERVICES_EXT" |
|
111 | printf " %s\n" "RC_STACK_SERVICES_EXT" | |
112 | printf "\n" |
|
112 | printf "\n" | |
113 | printf " Default: .custom/docker-compose-services.override.yaml\n" |
|
113 | printf " Default: .custom/docker-compose-services.override.yaml\n" | |
114 | echo |
|
114 | echo | |
115 |
|
115 | |||
116 | # :environment_variable.usage |
|
116 | # :environment_variable.usage | |
117 | printf " %s\n" "RC_STACK_RHODECODE_EXT" |
|
117 | printf " %s\n" "RC_STACK_RHODECODE_EXT" | |
118 | printf "\n" |
|
118 | printf "\n" | |
119 | printf " Default: .custom/docker-compose-apps.override.yaml\n" |
|
119 | printf " Default: .custom/docker-compose-apps.override.yaml\n" | |
120 | echo |
|
120 | echo | |
121 |
|
121 | |||
122 | # :command.footer |
|
122 | # :command.footer | |
123 | printf "RhodeCode Inc 2024\n\n" |
|
123 | printf "RhodeCode Inc 2024\n\n" | |
124 | echo |
|
124 | echo | |
125 |
|
125 | |||
126 | fi |
|
126 | fi | |
127 | } |
|
127 | } | |
128 |
|
128 | |||
129 | # :command.usage |
|
129 | # :command.usage | |
130 | rcstack_get_started_usage() { |
|
130 | rcstack_get_started_usage() { | |
131 | if [[ -n $long_usage ]]; then |
|
131 | if [[ -n $long_usage ]]; then | |
132 | printf "rcstack get-started - Print instructions to get started with rhodecode docker stack\n" |
|
132 | printf "rcstack get-started - Print instructions to get started with rhodecode docker stack\n" | |
133 | echo |
|
133 | echo | |
134 |
|
134 | |||
135 | else |
|
135 | else | |
136 | printf "rcstack get-started - Print instructions to get started with rhodecode docker stack\n" |
|
136 | printf "rcstack get-started - Print instructions to get started with rhodecode docker stack\n" | |
137 | echo |
|
137 | echo | |
138 |
|
138 | |||
139 | fi |
|
139 | fi | |
140 |
|
140 | |||
141 | printf "%s\n" "Usage:" |
|
141 | printf "%s\n" "Usage:" | |
142 | printf " rcstack get-started\n" |
|
142 | printf " rcstack get-started\n" | |
143 | printf " rcstack get-started --help | -h\n" |
|
143 | printf " rcstack get-started --help | -h\n" | |
144 | echo |
|
144 | echo | |
145 |
|
145 | |||
146 | # :command.long_usage |
|
146 | # :command.long_usage | |
147 | if [[ -n $long_usage ]]; then |
|
147 | if [[ -n $long_usage ]]; then | |
148 | printf "%s\n" "Options:" |
|
148 | printf "%s\n" "Options:" | |
149 |
|
149 | |||
150 | # :command.usage_fixed_flags |
|
150 | # :command.usage_fixed_flags | |
151 | printf " %s\n" "--help, -h" |
|
151 | printf " %s\n" "--help, -h" | |
152 | printf " Show this help\n" |
|
152 | printf " Show this help\n" | |
153 | echo |
|
153 | echo | |
154 |
|
154 | |||
155 | fi |
|
155 | fi | |
156 | } |
|
156 | } | |
157 |
|
157 | |||
158 | # :command.usage |
|
158 | # :command.usage | |
159 | rcstack_init_usage() { |
|
159 | rcstack_init_usage() { | |
160 | if [[ -n $long_usage ]]; then |
|
160 | if [[ -n $long_usage ]]; then | |
161 | printf "rcstack init - Bootstrap this machine, check docker version and install rhodecode-network\n" |
|
161 | printf "rcstack init - Bootstrap this machine, check docker version and install rhodecode-network\n" | |
162 | echo |
|
162 | echo | |
163 |
|
163 | |||
164 | else |
|
164 | else | |
165 | printf "rcstack init - Bootstrap this machine, check docker version and install rhodecode-network\n" |
|
165 | printf "rcstack init - Bootstrap this machine, check docker version and install rhodecode-network\n" | |
166 | echo |
|
166 | echo | |
167 |
|
167 | |||
168 | fi |
|
168 | fi | |
169 |
|
169 | |||
170 | printf "%s\n" "Usage:" |
|
170 | printf "%s\n" "Usage:" | |
171 | printf " rcstack init [OPTIONS]\n" |
|
171 | printf " rcstack init [OPTIONS]\n" | |
172 | printf " rcstack init --help | -h\n" |
|
172 | printf " rcstack init --help | -h\n" | |
173 | echo |
|
173 | echo | |
174 |
|
174 | |||
175 | # :command.long_usage |
|
175 | # :command.long_usage | |
176 | if [[ -n $long_usage ]]; then |
|
176 | if [[ -n $long_usage ]]; then | |
177 | printf "%s\n" "Options:" |
|
177 | printf "%s\n" "Options:" | |
178 |
|
178 | |||
179 | # :command.usage_flags |
|
179 | # :command.usage_flags | |
180 | # :flag.usage |
|
180 | # :flag.usage | |
181 | printf " %s\n" "--arg-accept-eula" |
|
181 | printf " %s\n" "--arg-accept-eula" | |
182 | printf " accept EULA automatically\n" |
|
182 | printf " accept EULA automatically\n" | |
183 | echo |
|
183 | echo | |
184 |
|
184 | |||
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 | printf " Allowed: ce, ee\n" |
|
188 | printf " Allowed: ce, ee\n" | |
189 | echo |
|
189 | echo | |
190 |
|
190 | |||
191 | # :flag.usage |
|
191 | # :flag.usage | |
192 | printf " %s\n" "--arg-rc-version ARG_RC_VERSION" |
|
192 | printf " %s\n" "--arg-rc-version ARG_RC_VERSION" | |
193 | printf " specify version to install, e.g 5.0.1\n" |
|
193 | printf " specify version to install, e.g 5.0.1\n" | |
194 | echo |
|
194 | echo | |
195 |
|
195 | |||
196 | # :flag.usage |
|
196 | # :flag.usage | |
197 | printf " %s\n" "--arg-hostname ARG_HOSTNAME" |
|
197 | printf " %s\n" "--arg-hostname ARG_HOSTNAME" | |
198 | printf " specify hostname [hostname.example.com] for setup\n" |
|
198 | printf " specify hostname [hostname.example.com] for setup\n" | |
199 | echo |
|
199 | echo | |
200 |
|
200 | |||
201 | # :flag.usage |
|
201 | # :flag.usage | |
202 | printf " %s\n" "--arg-database-type ARG_DATABASE_TYPE" |
|
202 | printf " %s\n" "--arg-database-type ARG_DATABASE_TYPE" | |
203 | printf " pick database type for installation, 'postgres', 'mysql', 'none', choose\n none for sqlite or own DB hosting\n" |
|
203 | printf " pick database type for installation, 'postgres', 'mysql', 'none', choose\n none for sqlite or own DB hosting\n" | |
204 | printf " Allowed: postgres, mysql, none\n" |
|
204 | printf " Allowed: postgres, mysql, none\n" | |
205 | echo |
|
205 | echo | |
206 |
|
206 | |||
207 | # :flag.usage |
|
207 | # :flag.usage | |
208 | printf " %s\n" "--arg-use-ssl ARG_USE_SSL" |
|
208 | printf " %s\n" "--arg-use-ssl ARG_USE_SSL" | |
209 | printf " specify use_ssl [y|n] for setup\n" |
|
209 | printf " specify use_ssl [y|n] for setup\n" | |
210 | printf " Allowed: y, n\n" |
|
210 | printf " Allowed: y, n\n" | |
211 | echo |
|
211 | echo | |
212 |
|
212 | |||
213 | # :flag.usage |
|
213 | # :flag.usage | |
214 | printf " %s\n" "--arg-admin-email ARG_ADMIN_EMAIL" |
|
214 | printf " %s\n" "--arg-admin-email ARG_ADMIN_EMAIL" | |
215 | printf " specify admin_email [foo@example.com] for setup\n" |
|
215 | printf " specify admin_email [foo@example.com] for setup\n" | |
216 | echo |
|
216 | echo | |
217 |
|
217 | |||
218 | # :flag.usage |
|
218 | # :flag.usage | |
219 | printf " %s\n" "--arg-admin-user ARG_ADMIN_USER" |
|
219 | printf " %s\n" "--arg-admin-user ARG_ADMIN_USER" | |
220 | printf " specify admin_user [admin] for setup\n" |
|
220 | printf " specify admin_user [admin] for setup\n" | |
221 | echo |
|
221 | echo | |
222 |
|
222 | |||
223 | # :flag.usage |
|
223 | # :flag.usage | |
224 | printf " %s\n" "--arg-admin-pass ARG_ADMIN_PASS" |
|
224 | printf " %s\n" "--arg-admin-pass ARG_ADMIN_PASS" | |
225 | printf " specify admin_pass [secretpassword] for setup\n" |
|
225 | printf " specify admin_pass [secretpassword] for setup\n" | |
226 | echo |
|
226 | echo | |
227 |
|
227 | |||
228 | # :flag.usage |
|
228 | # :flag.usage | |
229 | printf " %s\n" "--arg-license-token ARG_ADMIN_TOKEN" |
|
229 | printf " %s\n" "--arg-license-token ARG_ADMIN_TOKEN" | |
230 | printf " specify license_token [abcd-abcd-abcd-abcd] for setup\n" |
|
230 | printf " specify license_token [abcd-abcd-abcd-abcd] for setup\n" | |
231 | echo |
|
231 | echo | |
232 |
|
232 | |||
233 | # :flag.usage |
|
233 | # :flag.usage | |
234 | printf " %s\n" "--no-prompt" |
|
234 | printf " %s\n" "--no-prompt" | |
235 | printf " Don't use interactive prompt to ask setup questions. Use defaults instead\n" |
|
235 | printf " Don't use interactive prompt to ask setup questions. Use defaults instead\n" | |
236 | echo |
|
236 | echo | |
237 |
|
237 | |||
238 | # :flag.usage |
|
238 | # :flag.usage | |
239 | printf " %s\n" "--force, -f" |
|
239 | printf " %s\n" "--force, -f" | |
240 | printf " Overwrite existing files\n" |
|
240 | printf " Overwrite existing files\n" | |
241 | echo |
|
241 | echo | |
242 |
|
242 | |||
243 | # :flag.usage |
|
243 | # :flag.usage | |
244 | printf " %s\n" "--stage STAGE (repeatable)" |
|
244 | printf " %s\n" "--stage STAGE (repeatable)" | |
245 | printf " specify one or more stages to run\n" |
|
245 | printf " specify one or more stages to run\n" | |
246 | echo |
|
246 | echo | |
247 |
|
247 | |||
248 | # :flag.usage |
|
248 | # :flag.usage | |
249 | printf " %s\n" "--docker-revision DOCKER_REVISION" |
|
249 | printf " %s\n" "--docker-revision DOCKER_REVISION" | |
250 | printf " revision to fetch new docker definitions.\n" |
|
250 | printf " revision to fetch new docker definitions.\n" | |
251 | printf " Default: stable\n" |
|
251 | printf " Default: stable\n" | |
252 | echo |
|
252 | echo | |
253 |
|
253 | |||
254 | # :flag.usage |
|
254 | # :flag.usage | |
255 | printf " %s\n" "--install-docker INSTALL_DOCKER" |
|
255 | printf " %s\n" "--install-docker INSTALL_DOCKER" | |
256 | printf " answer [y]es or [n]o to question to install docker\n" |
|
256 | printf " answer [y]es or [n]o to question to install docker\n" | |
257 | echo |
|
257 | echo | |
258 |
|
258 | |||
259 | # :flag.usage |
|
259 | # :flag.usage | |
260 | printf " %s\n" "--server-url SERVER_URL" |
|
260 | printf " %s\n" "--server-url SERVER_URL" | |
261 | printf " Specify RhodeCode server location where the rcstack archive should be\n downloaded from\n" |
|
261 | printf " Specify RhodeCode server location where the rcstack archive should be\n downloaded from\n" | |
262 | printf " Default: https://dls.rhodecode.com/get_archive\n" |
|
262 | printf " Default: https://dls.rhodecode.com/get_archive\n" | |
263 | echo |
|
263 | echo | |
264 |
|
264 | |||
265 | # :flag.usage |
|
265 | # :flag.usage | |
266 | printf " %s\n" "--auth-token AUTH_TOKEN" |
|
266 | printf " %s\n" "--auth-token AUTH_TOKEN" | |
267 | printf " Optionally specify AUTH TOKEN to obtain sources\n" |
|
267 | printf " Optionally specify AUTH TOKEN to obtain sources\n" | |
268 | echo |
|
268 | echo | |
269 |
|
269 | |||
270 | # :command.usage_fixed_flags |
|
270 | # :command.usage_fixed_flags | |
271 | printf " %s\n" "--help, -h" |
|
271 | printf " %s\n" "--help, -h" | |
272 | printf " Show this help\n" |
|
272 | printf " Show this help\n" | |
273 | echo |
|
273 | echo | |
274 |
|
274 | |||
275 | # :command.usage_examples |
|
275 | # :command.usage_examples | |
276 | printf "%s\n" "Examples:" |
|
276 | printf "%s\n" "Examples:" | |
277 | 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" |
|
277 | 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" | |
278 | echo |
|
278 | echo | |
279 |
|
279 | |||
280 | fi |
|
280 | fi | |
281 | } |
|
281 | } | |
282 |
|
282 | |||
283 | # :command.usage |
|
283 | # :command.usage | |
284 | rcstack_self_update_usage() { |
|
284 | rcstack_self_update_usage() { | |
285 | if [[ -n $long_usage ]]; then |
|
285 | if [[ -n $long_usage ]]; then | |
286 | printf "rcstack self-update - Update rcstack and it's docker definitions\n" |
|
286 | printf "rcstack self-update - Update rcstack and it's docker definitions\n" | |
287 | echo |
|
287 | echo | |
288 |
|
288 | |||
289 | else |
|
289 | else | |
290 | printf "rcstack self-update - Update rcstack and it's docker definitions\n" |
|
290 | printf "rcstack self-update - Update rcstack and it's docker definitions\n" | |
291 | echo |
|
291 | echo | |
292 |
|
292 | |||
293 | fi |
|
293 | fi | |
294 |
|
294 | |||
295 | printf "%s\n" "Usage:" |
|
295 | printf "%s\n" "Usage:" | |
296 | printf " rcstack self-update [OPTIONS]\n" |
|
296 | printf " rcstack self-update [OPTIONS]\n" | |
297 | printf " rcstack self-update --help | -h\n" |
|
297 | printf " rcstack self-update --help | -h\n" | |
298 | echo |
|
298 | echo | |
299 |
|
299 | |||
300 | # :command.long_usage |
|
300 | # :command.long_usage | |
301 | if [[ -n $long_usage ]]; then |
|
301 | if [[ -n $long_usage ]]; then | |
302 | printf "%s\n" "Options:" |
|
302 | printf "%s\n" "Options:" | |
303 |
|
303 | |||
304 | # :command.usage_flags |
|
304 | # :command.usage_flags | |
305 | # :flag.usage |
|
305 | # :flag.usage | |
306 | printf " %s\n" "--force" |
|
306 | printf " %s\n" "--force" | |
307 | printf " Ignore same-version skip check. Runs same logic as there would be new\n version available\n" |
|
307 | printf " Ignore same-version skip check. Runs same logic as there would be new\n version available\n" | |
308 | echo |
|
308 | echo | |
309 |
|
309 | |||
310 | # :flag.usage |
|
310 | # :flag.usage | |
311 | printf " %s\n" "--update-docker-image UPDATE_DOCKER_IMAGE" |
|
311 | printf " %s\n" "--update-docker-image UPDATE_DOCKER_IMAGE" | |
312 | printf " answer [y]es or [n]o to question to set docker image from installer stored\n version.\n" |
|
312 | printf " answer [y]es or [n]o to question to set docker image from installer stored\n version.\n" | |
313 | echo |
|
313 | echo | |
314 |
|
314 | |||
315 | # :flag.usage |
|
315 | # :flag.usage | |
316 | printf " %s\n" "--cli-file CLI_FILE" |
|
316 | printf " %s\n" "--cli-file CLI_FILE" | |
317 | printf " file path to fetch new rcstack cli tool.\n" |
|
317 | printf " file path to fetch new rcstack cli tool.\n" | |
318 | echo |
|
318 | echo | |
319 |
|
319 | |||
320 | # :flag.usage |
|
320 | # :flag.usage | |
321 | printf " %s\n" "--cli-revision CLI_REVISION" |
|
321 | printf " %s\n" "--cli-revision CLI_REVISION" | |
322 | printf " commit or branch to fetch new rcstack cli tool.\n" |
|
322 | printf " commit or branch to fetch new rcstack cli tool.\n" | |
323 | printf " Default: stable\n" |
|
323 | printf " Default: stable\n" | |
324 | echo |
|
324 | echo | |
325 |
|
325 | |||
326 | # :flag.usage |
|
326 | # :flag.usage | |
327 | printf " %s\n" "--docker-revision DOCKER_REVISION" |
|
327 | printf " %s\n" "--docker-revision DOCKER_REVISION" | |
328 | printf " commit or branch to fetch new docker definitions.\n" |
|
328 | printf " commit or branch to fetch new docker definitions.\n" | |
329 | printf " Default: stable\n" |
|
329 | printf " Default: stable\n" | |
330 | echo |
|
330 | echo | |
331 |
|
331 | |||
332 | # :flag.usage |
|
332 | # :flag.usage | |
333 | printf " %s\n" "--server-url SERVER_URL" |
|
333 | printf " %s\n" "--server-url SERVER_URL" | |
334 | printf " Specify RhodeCode server location where the rcstack archive should be\n downloaded from\n" |
|
334 | printf " Specify RhodeCode server location where the rcstack archive should be\n downloaded from\n" | |
335 | printf " Default: https://dls.rhodecode.com/get_archive\n" |
|
335 | printf " Default: https://dls.rhodecode.com/get_archive\n" | |
336 | echo |
|
336 | echo | |
337 |
|
337 | |||
338 | # :flag.usage |
|
338 | # :flag.usage | |
339 | printf " %s\n" "--auth-token AUTH_TOKEN" |
|
339 | printf " %s\n" "--auth-token AUTH_TOKEN" | |
340 | printf " Optionally specify AUTH TOKEN to obtain sources\n" |
|
340 | printf " Optionally specify AUTH TOKEN to obtain sources\n" | |
341 | echo |
|
341 | echo | |
342 |
|
342 | |||
343 | # :command.usage_fixed_flags |
|
343 | # :command.usage_fixed_flags | |
344 | printf " %s\n" "--help, -h" |
|
344 | printf " %s\n" "--help, -h" | |
345 | printf " Show this help\n" |
|
345 | printf " Show this help\n" | |
346 | echo |
|
346 | echo | |
347 |
|
347 | |||
348 | # :command.usage_examples |
|
348 | # :command.usage_examples | |
349 | printf "%s\n" "Examples:" |
|
349 | printf "%s\n" "Examples:" | |
350 | 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" |
|
350 | 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" | |
351 | echo |
|
351 | echo | |
352 |
|
352 | |||
353 | fi |
|
353 | fi | |
354 | } |
|
354 | } | |
355 |
|
355 | |||
356 | # :command.usage |
|
356 | # :command.usage | |
357 | rcstack_self_upgrade_usage() { |
|
357 | rcstack_self_upgrade_usage() { | |
358 | if [[ -n $long_usage ]]; then |
|
358 | if [[ -n $long_usage ]]; then | |
359 | printf "rcstack self-upgrade - Perform rcstack upgrade procedure. This aims at changing existing installations with some changes required that are not backward compatible\n" |
|
359 | printf "rcstack self-upgrade - Perform rcstack upgrade procedure. This aims at changing existing installations with some changes required that are not backward compatible\n" | |
360 | echo |
|
360 | echo | |
361 |
|
361 | |||
362 | else |
|
362 | else | |
363 | printf "rcstack self-upgrade - Perform rcstack upgrade procedure. This aims at changing existing installations with some changes required that are not backward compatible\n" |
|
363 | printf "rcstack self-upgrade - Perform rcstack upgrade procedure. This aims at changing existing installations with some changes required that are not backward compatible\n" | |
364 | echo |
|
364 | echo | |
365 |
|
365 | |||
366 | fi |
|
366 | fi | |
367 |
|
367 | |||
368 | printf "%s\n" "Usage:" |
|
368 | printf "%s\n" "Usage:" | |
369 | printf " rcstack self-upgrade [OPTIONS]\n" |
|
369 | printf " rcstack self-upgrade [OPTIONS]\n" | |
370 | printf " rcstack self-upgrade --help | -h\n" |
|
370 | printf " rcstack self-upgrade --help | -h\n" | |
371 | echo |
|
371 | echo | |
372 |
|
372 | |||
373 | # :command.long_usage |
|
373 | # :command.long_usage | |
374 | if [[ -n $long_usage ]]; then |
|
374 | if [[ -n $long_usage ]]; then | |
375 | printf "%s\n" "Options:" |
|
375 | printf "%s\n" "Options:" | |
376 |
|
376 | |||
377 | # :command.usage_flags |
|
377 | # :command.usage_flags | |
378 | # :flag.usage |
|
378 | # :flag.usage | |
379 | printf " %s\n" "--from-ver FROM_VER" |
|
379 | printf " %s\n" "--from-ver FROM_VER" | |
380 | printf " optionally define from which version we upgrade\n" |
|
380 | printf " optionally define from which version we upgrade\n" | |
381 | echo |
|
381 | echo | |
382 |
|
382 | |||
383 | # :flag.usage |
|
383 | # :flag.usage | |
384 | printf " %s\n" "--to-ver TO_VER" |
|
384 | printf " %s\n" "--to-ver TO_VER" | |
385 | printf " optionally define to which version we upgrade\n" |
|
385 | printf " optionally define to which version we upgrade\n" | |
386 | echo |
|
386 | echo | |
387 |
|
387 | |||
388 | # :command.usage_fixed_flags |
|
388 | # :command.usage_fixed_flags | |
389 | printf " %s\n" "--help, -h" |
|
389 | printf " %s\n" "--help, -h" | |
390 | printf " Show this help\n" |
|
390 | printf " Show this help\n" | |
391 | echo |
|
391 | echo | |
392 |
|
392 | |||
393 | # :command.usage_examples |
|
393 | # :command.usage_examples | |
394 | printf "%s\n" "Examples:" |
|
394 | printf "%s\n" "Examples:" | |
395 | printf " # simply to update it to a new version\n - ./rccstack self-upgrade \n \n # simply to update it to a new version\n - ./rccstack self-upgrade --from-ver=5.7.0 --to-ver=5.9.0\n" |
|
395 | printf " # simply to update it to a new version\n - ./rccstack self-upgrade \n \n # simply to update it to a new version\n - ./rccstack self-upgrade --from-ver=5.7.0 --to-ver=5.9.0\n" | |
396 | echo |
|
396 | echo | |
397 |
|
397 | |||
398 | fi |
|
398 | fi | |
399 | } |
|
399 | } | |
400 |
|
400 | |||
401 | # :command.usage |
|
401 | # :command.usage | |
402 | rcstack_stack_usage() { |
|
402 | rcstack_stack_usage() { | |
403 | if [[ -n $long_usage ]]; then |
|
403 | if [[ -n $long_usage ]]; then | |
404 | printf "rcstack stack - Run one of available cluster stacks, run stack -h for more details\n" |
|
404 | printf "rcstack stack - Run one of available cluster stacks, run stack -h for more details\n" | |
405 | echo |
|
405 | echo | |
406 |
|
406 | |||
407 | else |
|
407 | else | |
408 | printf "rcstack stack - Run one of available cluster stacks, run stack -h for more details\n" |
|
408 | printf "rcstack stack - Run one of available cluster stacks, run stack -h for more details\n" | |
409 | echo |
|
409 | echo | |
410 |
|
410 | |||
411 | fi |
|
411 | fi | |
412 |
|
412 | |||
413 | printf "%s\n" "Usage:" |
|
413 | printf "%s\n" "Usage:" | |
414 | printf " rcstack stack [OPTIONS] COMMAND\n" |
|
414 | printf " rcstack stack [OPTIONS] COMMAND\n" | |
415 | printf " rcstack stack [COMMAND] --help | -h\n" |
|
415 | printf " rcstack stack [COMMAND] --help | -h\n" | |
416 | echo |
|
416 | echo | |
417 | # :command.usage_commands |
|
417 | # :command.usage_commands | |
418 | printf "%s\n" "Commands:" |
|
418 | printf "%s\n" "Commands:" | |
419 | printf " %s execute commands for the router stack\n" "router " |
|
419 | printf " %s execute commands for the router stack\n" "router " | |
420 | printf " %s execute commands for the router stack\n" "metrics " |
|
420 | printf " %s execute commands for the router stack\n" "metrics " | |
421 | printf " %s execute commands for the router stack\n" "services " |
|
421 | printf " %s execute commands for the router stack\n" "services " | |
422 | printf " %s execute commands for the router stack\n" "rhodecode" |
|
422 | printf " %s execute commands for the router stack\n" "rhodecode" | |
423 | printf " %s execute commands for all stacks in order\n" "all " |
|
423 | printf " %s execute commands for all stacks in order\n" "all " | |
424 | echo |
|
424 | echo | |
425 |
|
425 | |||
426 | # :command.long_usage |
|
426 | # :command.long_usage | |
427 | if [[ -n $long_usage ]]; then |
|
427 | if [[ -n $long_usage ]]; then | |
428 | printf "%s\n" "Options:" |
|
428 | printf "%s\n" "Options:" | |
429 |
|
429 | |||
430 | # :command.usage_flags |
|
430 | # :command.usage_flags | |
431 | # :flag.usage |
|
431 | # :flag.usage | |
432 | printf " %s\n" "--env-file-path ENV_FILE_PATH" |
|
432 | printf " %s\n" "--env-file-path ENV_FILE_PATH" | |
433 | printf " Set custom env file\n" |
|
433 | printf " Set custom env file\n" | |
434 | printf " Default: $PWD/.custom/.runtime.env\n" |
|
434 | printf " Default: $PWD/.custom/.runtime.env\n" | |
435 | echo |
|
435 | echo | |
436 |
|
436 | |||
437 | # :flag.usage |
|
437 | # :flag.usage | |
438 | printf " %s\n" "--stack-prefix STACK_PREFIX" |
|
438 | printf " %s\n" "--stack-prefix STACK_PREFIX" | |
439 | printf " Set custom stack prefix, e.g rc_cluster_apps_ci\n" |
|
439 | printf " Set custom stack prefix, e.g rc_cluster_apps_ci\n" | |
440 | echo |
|
440 | echo | |
441 |
|
441 | |||
442 | # :command.usage_fixed_flags |
|
442 | # :command.usage_fixed_flags | |
443 | printf " %s\n" "--help, -h" |
|
443 | printf " %s\n" "--help, -h" | |
444 | printf " Show this help\n" |
|
444 | printf " Show this help\n" | |
445 | echo |
|
445 | echo | |
446 |
|
446 | |||
447 | # :command.usage_examples |
|
447 | # :command.usage_examples | |
448 | printf "%s\n" "Examples:" |
|
448 | printf "%s\n" "Examples:" | |
449 | 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" |
|
449 | 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" | |
450 | echo |
|
450 | echo | |
451 |
|
451 | |||
452 | fi |
|
452 | fi | |
453 | } |
|
453 | } | |
454 |
|
454 | |||
455 | # :command.usage |
|
455 | # :command.usage | |
456 | rcstack_stack_router_usage() { |
|
456 | rcstack_stack_router_usage() { | |
457 | if [[ -n $long_usage ]]; then |
|
457 | if [[ -n $long_usage ]]; then | |
458 | printf "rcstack stack router - execute commands for the router stack\n" |
|
458 | printf "rcstack stack router - execute commands for the router stack\n" | |
459 | echo |
|
459 | echo | |
460 |
|
460 | |||
461 | else |
|
461 | else | |
462 | printf "rcstack stack router - execute commands for the router stack\n" |
|
462 | printf "rcstack stack router - execute commands for the router stack\n" | |
463 | echo |
|
463 | echo | |
464 |
|
464 | |||
465 | fi |
|
465 | fi | |
466 |
|
466 | |||
467 | printf "%s\n" "Usage:" |
|
467 | printf "%s\n" "Usage:" | |
468 | printf " rcstack stack router [SERVICES PARAMS...]\n" |
|
468 | printf " rcstack stack router [SERVICES PARAMS...]\n" | |
469 | printf " rcstack stack router --help | -h\n" |
|
469 | printf " rcstack stack router --help | -h\n" | |
470 | echo |
|
470 | echo | |
471 |
|
471 | |||
472 | # :command.long_usage |
|
472 | # :command.long_usage | |
473 | if [[ -n $long_usage ]]; then |
|
473 | if [[ -n $long_usage ]]; then | |
474 | printf "%s\n" "Options:" |
|
474 | printf "%s\n" "Options:" | |
475 |
|
475 | |||
476 | # :command.usage_fixed_flags |
|
476 | # :command.usage_fixed_flags | |
477 | printf " %s\n" "--help, -h" |
|
477 | printf " %s\n" "--help, -h" | |
478 | printf " Show this help\n" |
|
478 | printf " Show this help\n" | |
479 | echo |
|
479 | echo | |
480 |
|
480 | |||
481 | # :command.usage_args |
|
481 | # :command.usage_args | |
482 | printf "%s\n" "Arguments:" |
|
482 | printf "%s\n" "Arguments:" | |
483 |
|
483 | |||
484 | echo " SERVICES PARAMS..." |
|
484 | echo " SERVICES PARAMS..." | |
485 | printf " Additional arguments or flags for services command\n" |
|
485 | printf " Additional arguments or flags for services command\n" | |
486 | echo |
|
486 | echo | |
487 |
|
487 | |||
488 | fi |
|
488 | fi | |
489 | } |
|
489 | } | |
490 |
|
490 | |||
491 | # :command.usage |
|
491 | # :command.usage | |
492 | rcstack_stack_metrics_usage() { |
|
492 | rcstack_stack_metrics_usage() { | |
493 | if [[ -n $long_usage ]]; then |
|
493 | if [[ -n $long_usage ]]; then | |
494 | printf "rcstack stack metrics - execute commands for the router stack\n" |
|
494 | printf "rcstack stack metrics - execute commands for the router stack\n" | |
495 | echo |
|
495 | echo | |
496 |
|
496 | |||
497 | else |
|
497 | else | |
498 | printf "rcstack stack metrics - execute commands for the router stack\n" |
|
498 | printf "rcstack stack metrics - execute commands for the router stack\n" | |
499 | echo |
|
499 | echo | |
500 |
|
500 | |||
501 | fi |
|
501 | fi | |
502 |
|
502 | |||
503 | printf "%s\n" "Usage:" |
|
503 | printf "%s\n" "Usage:" | |
504 | printf " rcstack stack metrics [SERVICES PARAMS...]\n" |
|
504 | printf " rcstack stack metrics [SERVICES PARAMS...]\n" | |
505 | printf " rcstack stack metrics --help | -h\n" |
|
505 | printf " rcstack stack metrics --help | -h\n" | |
506 | echo |
|
506 | echo | |
507 |
|
507 | |||
508 | # :command.long_usage |
|
508 | # :command.long_usage | |
509 | if [[ -n $long_usage ]]; then |
|
509 | if [[ -n $long_usage ]]; then | |
510 | printf "%s\n" "Options:" |
|
510 | printf "%s\n" "Options:" | |
511 |
|
511 | |||
512 | # :command.usage_fixed_flags |
|
512 | # :command.usage_fixed_flags | |
513 | printf " %s\n" "--help, -h" |
|
513 | printf " %s\n" "--help, -h" | |
514 | printf " Show this help\n" |
|
514 | printf " Show this help\n" | |
515 | echo |
|
515 | echo | |
516 |
|
516 | |||
517 | # :command.usage_args |
|
517 | # :command.usage_args | |
518 | printf "%s\n" "Arguments:" |
|
518 | printf "%s\n" "Arguments:" | |
519 |
|
519 | |||
520 | echo " SERVICES PARAMS..." |
|
520 | echo " SERVICES PARAMS..." | |
521 | printf " Additional arguments or flags for services command\n" |
|
521 | printf " Additional arguments or flags for services command\n" | |
522 | echo |
|
522 | echo | |
523 |
|
523 | |||
524 | fi |
|
524 | fi | |
525 | } |
|
525 | } | |
526 |
|
526 | |||
527 | # :command.usage |
|
527 | # :command.usage | |
528 | rcstack_stack_services_usage() { |
|
528 | rcstack_stack_services_usage() { | |
529 | if [[ -n $long_usage ]]; then |
|
529 | if [[ -n $long_usage ]]; then | |
530 | printf "rcstack stack services - execute commands for the router stack\n" |
|
530 | printf "rcstack stack services - execute commands for the router stack\n" | |
531 | echo |
|
531 | echo | |
532 |
|
532 | |||
533 | else |
|
533 | else | |
534 | printf "rcstack stack services - execute commands for the router stack\n" |
|
534 | printf "rcstack stack services - execute commands for the router stack\n" | |
535 | echo |
|
535 | echo | |
536 |
|
536 | |||
537 | fi |
|
537 | fi | |
538 |
|
538 | |||
539 | printf "%s\n" "Usage:" |
|
539 | printf "%s\n" "Usage:" | |
540 | printf " rcstack stack services [SERVICES PARAMS...]\n" |
|
540 | printf " rcstack stack services [SERVICES PARAMS...]\n" | |
541 | printf " rcstack stack services --help | -h\n" |
|
541 | printf " rcstack stack services --help | -h\n" | |
542 | echo |
|
542 | echo | |
543 |
|
543 | |||
544 | # :command.long_usage |
|
544 | # :command.long_usage | |
545 | if [[ -n $long_usage ]]; then |
|
545 | if [[ -n $long_usage ]]; then | |
546 | printf "%s\n" "Options:" |
|
546 | printf "%s\n" "Options:" | |
547 |
|
547 | |||
548 | # :command.usage_fixed_flags |
|
548 | # :command.usage_fixed_flags | |
549 | printf " %s\n" "--help, -h" |
|
549 | printf " %s\n" "--help, -h" | |
550 | printf " Show this help\n" |
|
550 | printf " Show this help\n" | |
551 | echo |
|
551 | echo | |
552 |
|
552 | |||
553 | # :command.usage_args |
|
553 | # :command.usage_args | |
554 | printf "%s\n" "Arguments:" |
|
554 | printf "%s\n" "Arguments:" | |
555 |
|
555 | |||
556 | echo " SERVICES PARAMS..." |
|
556 | echo " SERVICES PARAMS..." | |
557 | printf " Additional arguments or flags for services command\n" |
|
557 | printf " Additional arguments or flags for services command\n" | |
558 | echo |
|
558 | echo | |
559 |
|
559 | |||
560 | fi |
|
560 | fi | |
561 | } |
|
561 | } | |
562 |
|
562 | |||
563 | # :command.usage |
|
563 | # :command.usage | |
564 | rcstack_stack_rhodecode_usage() { |
|
564 | rcstack_stack_rhodecode_usage() { | |
565 | if [[ -n $long_usage ]]; then |
|
565 | if [[ -n $long_usage ]]; then | |
566 | printf "rcstack stack rhodecode - execute commands for the router stack\n" |
|
566 | printf "rcstack stack rhodecode - execute commands for the router stack\n" | |
567 | echo |
|
567 | echo | |
568 |
|
568 | |||
569 | else |
|
569 | else | |
570 | printf "rcstack stack rhodecode - execute commands for the router stack\n" |
|
570 | printf "rcstack stack rhodecode - execute commands for the router stack\n" | |
571 | echo |
|
571 | echo | |
572 |
|
572 | |||
573 | fi |
|
573 | fi | |
574 |
|
574 | |||
575 | printf "%s\n" "Usage:" |
|
575 | printf "%s\n" "Usage:" | |
576 | printf " rcstack stack rhodecode [SERVICES PARAMS...]\n" |
|
576 | printf " rcstack stack rhodecode [SERVICES PARAMS...]\n" | |
577 | printf " rcstack stack rhodecode --help | -h\n" |
|
577 | printf " rcstack stack rhodecode --help | -h\n" | |
578 | echo |
|
578 | echo | |
579 |
|
579 | |||
580 | # :command.long_usage |
|
580 | # :command.long_usage | |
581 | if [[ -n $long_usage ]]; then |
|
581 | if [[ -n $long_usage ]]; then | |
582 | printf "%s\n" "Options:" |
|
582 | printf "%s\n" "Options:" | |
583 |
|
583 | |||
584 | # :command.usage_fixed_flags |
|
584 | # :command.usage_fixed_flags | |
585 | printf " %s\n" "--help, -h" |
|
585 | printf " %s\n" "--help, -h" | |
586 | printf " Show this help\n" |
|
586 | printf " Show this help\n" | |
587 | echo |
|
587 | echo | |
588 |
|
588 | |||
589 | # :command.usage_args |
|
589 | # :command.usage_args | |
590 | printf "%s\n" "Arguments:" |
|
590 | printf "%s\n" "Arguments:" | |
591 |
|
591 | |||
592 | echo " SERVICES PARAMS..." |
|
592 | echo " SERVICES PARAMS..." | |
593 | printf " Additional arguments or flags for services command\n" |
|
593 | printf " Additional arguments or flags for services command\n" | |
594 | echo |
|
594 | echo | |
595 |
|
595 | |||
596 | fi |
|
596 | fi | |
597 | } |
|
597 | } | |
598 |
|
598 | |||
599 | # :command.usage |
|
599 | # :command.usage | |
600 | rcstack_stack_all_usage() { |
|
600 | rcstack_stack_all_usage() { | |
601 | if [[ -n $long_usage ]]; then |
|
601 | if [[ -n $long_usage ]]; then | |
602 | printf "rcstack stack all - execute commands for all stacks in order\n" |
|
602 | printf "rcstack stack all - execute commands for all stacks in order\n" | |
603 | echo |
|
603 | echo | |
604 |
|
604 | |||
605 | else |
|
605 | else | |
606 | printf "rcstack stack all - execute commands for all stacks in order\n" |
|
606 | printf "rcstack stack all - execute commands for all stacks in order\n" | |
607 | echo |
|
607 | echo | |
608 |
|
608 | |||
609 | fi |
|
609 | fi | |
610 |
|
610 | |||
611 | printf "%s\n" "Usage:" |
|
611 | printf "%s\n" "Usage:" | |
612 | printf " rcstack stack all [SERVICES PARAMS...]\n" |
|
612 | printf " rcstack stack all [SERVICES PARAMS...]\n" | |
613 | printf " rcstack stack all --help | -h\n" |
|
613 | printf " rcstack stack all --help | -h\n" | |
614 | echo |
|
614 | echo | |
615 |
|
615 | |||
616 | # :command.long_usage |
|
616 | # :command.long_usage | |
617 | if [[ -n $long_usage ]]; then |
|
617 | if [[ -n $long_usage ]]; then | |
618 | printf "%s\n" "Options:" |
|
618 | printf "%s\n" "Options:" | |
619 |
|
619 | |||
620 | # :command.usage_fixed_flags |
|
620 | # :command.usage_fixed_flags | |
621 | printf " %s\n" "--help, -h" |
|
621 | printf " %s\n" "--help, -h" | |
622 | printf " Show this help\n" |
|
622 | printf " Show this help\n" | |
623 | echo |
|
623 | echo | |
624 |
|
624 | |||
625 | # :command.usage_args |
|
625 | # :command.usage_args | |
626 | printf "%s\n" "Arguments:" |
|
626 | printf "%s\n" "Arguments:" | |
627 |
|
627 | |||
628 | echo " SERVICES PARAMS..." |
|
628 | echo " SERVICES PARAMS..." | |
629 | printf " Additional arguments or flags for services command\n" |
|
629 | printf " Additional arguments or flags for services command\n" | |
630 | echo |
|
630 | echo | |
631 |
|
631 | |||
632 | fi |
|
632 | fi | |
633 | } |
|
633 | } | |
634 |
|
634 | |||
635 | # :command.usage |
|
635 | # :command.usage | |
636 | rcstack_stack_status_usage() { |
|
636 | rcstack_stack_status_usage() { | |
637 | if [[ -n $long_usage ]]; then |
|
637 | if [[ -n $long_usage ]]; then | |
638 | printf "rcstack stack-status - Show stack status\n" |
|
638 | printf "rcstack stack-status - Show stack status\n" | |
639 | echo |
|
639 | echo | |
640 |
|
640 | |||
641 | else |
|
641 | else | |
642 | printf "rcstack stack-status - Show stack status\n" |
|
642 | printf "rcstack stack-status - Show stack status\n" | |
643 | echo |
|
643 | echo | |
644 |
|
644 | |||
645 | fi |
|
645 | fi | |
646 |
|
646 | |||
647 | printf "Alias: status\n" |
|
647 | printf "Alias: status\n" | |
648 | echo |
|
648 | echo | |
649 |
|
649 | |||
650 | printf "%s\n" "Usage:" |
|
650 | printf "%s\n" "Usage:" | |
651 | printf " rcstack stack-status [OPTIONS]\n" |
|
651 | printf " rcstack stack-status [OPTIONS]\n" | |
652 | printf " rcstack stack-status --help | -h\n" |
|
652 | printf " rcstack stack-status --help | -h\n" | |
653 | echo |
|
653 | echo | |
654 |
|
654 | |||
655 | # :command.long_usage |
|
655 | # :command.long_usage | |
656 | if [[ -n $long_usage ]]; then |
|
656 | if [[ -n $long_usage ]]; then | |
657 | printf "%s\n" "Options:" |
|
657 | printf "%s\n" "Options:" | |
658 |
|
658 | |||
659 | # :command.usage_flags |
|
659 | # :command.usage_flags | |
660 | # :flag.usage |
|
660 | # :flag.usage | |
661 | printf " %s\n" "--detailed" |
|
661 | printf " %s\n" "--detailed" | |
662 | printf " Display a detailed format\n" |
|
662 | printf " Display a detailed format\n" | |
663 | echo |
|
663 | echo | |
664 |
|
664 | |||
665 | # :flag.usage |
|
665 | # :flag.usage | |
666 | printf " %s\n" "--configs, -c" |
|
666 | printf " %s\n" "--configs, -c" | |
667 | printf " Display a detailed info about configuration files\n" |
|
667 | printf " Display a detailed info about configuration files\n" | |
668 | echo |
|
668 | echo | |
669 |
|
669 | |||
670 | # :flag.usage |
|
670 | # :flag.usage | |
671 | printf " %s\n" "--verbose, -v" |
|
671 | printf " %s\n" "--verbose, -v" | |
672 | printf " Verbose output for details on the stack\n" |
|
672 | printf " Verbose output for details on the stack\n" | |
673 | echo |
|
673 | echo | |
674 |
|
674 | |||
675 | # :command.usage_fixed_flags |
|
675 | # :command.usage_fixed_flags | |
676 | printf " %s\n" "--help, -h" |
|
676 | printf " %s\n" "--help, -h" | |
677 | printf " Show this help\n" |
|
677 | printf " Show this help\n" | |
678 | echo |
|
678 | echo | |
679 |
|
679 | |||
680 | fi |
|
680 | fi | |
681 | } |
|
681 | } | |
682 |
|
682 | |||
683 | # :command.usage |
|
683 | # :command.usage | |
684 | rcstack_stack_upgrade_usage() { |
|
684 | rcstack_stack_upgrade_usage() { | |
685 | if [[ -n $long_usage ]]; then |
|
685 | if [[ -n $long_usage ]]; then | |
686 | printf "rcstack stack-upgrade - Upgrade a stack, run stack-upgrade -h for more details\n" |
|
686 | printf "rcstack stack-upgrade - Upgrade a stack, run stack-upgrade -h for more details\n" | |
687 | echo |
|
687 | echo | |
688 |
|
688 | |||
689 | else |
|
689 | else | |
690 | printf "rcstack stack-upgrade - Upgrade a stack, run stack-upgrade -h for more details\n" |
|
690 | printf "rcstack stack-upgrade - Upgrade a stack, run stack-upgrade -h for more details\n" | |
691 | echo |
|
691 | echo | |
692 |
|
692 | |||
693 | fi |
|
693 | fi | |
694 |
|
694 | |||
695 | printf "%s\n" "Usage:" |
|
695 | printf "%s\n" "Usage:" | |
696 | printf " rcstack stack-upgrade [OPTIONS] COMMAND\n" |
|
696 | printf " rcstack stack-upgrade [OPTIONS] COMMAND\n" | |
697 | printf " rcstack stack-upgrade [COMMAND] --help | -h\n" |
|
697 | printf " rcstack stack-upgrade [COMMAND] --help | -h\n" | |
698 | echo |
|
698 | echo | |
699 | # :command.usage_commands |
|
699 | # :command.usage_commands | |
700 | printf "%s\n" "Commands:" |
|
700 | printf "%s\n" "Commands:" | |
701 | printf " %s upgrade the router stack\n" "router " |
|
701 | printf " %s upgrade the router stack\n" "router " | |
702 | printf " %s upgrade the services stack\n" "services " |
|
702 | printf " %s upgrade the services stack\n" "services " | |
703 | printf " %s upgrade the metrics stack\n" "metrics " |
|
703 | printf " %s upgrade the metrics stack\n" "metrics " | |
704 | printf " %s upgrade the rhodecode stack\n" "rhodecode" |
|
704 | printf " %s upgrade the rhodecode stack\n" "rhodecode" | |
705 | echo |
|
705 | echo | |
706 |
|
706 | |||
707 | # :command.long_usage |
|
707 | # :command.long_usage | |
708 | if [[ -n $long_usage ]]; then |
|
708 | if [[ -n $long_usage ]]; then | |
709 | printf "%s\n" "Options:" |
|
709 | printf "%s\n" "Options:" | |
710 |
|
710 | |||
711 | # :command.usage_flags |
|
711 | # :command.usage_flags | |
712 | # :flag.usage |
|
712 | # :flag.usage | |
713 | printf " %s\n" "--stack-prefix STACK_PREFIX" |
|
713 | printf " %s\n" "--stack-prefix STACK_PREFIX" | |
714 | printf " Set custom stack prefix, e.g rc_cluster_apps_ci\n" |
|
714 | printf " Set custom stack prefix, e.g rc_cluster_apps_ci\n" | |
715 | echo |
|
715 | echo | |
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 | # :command.usage_examples |
|
722 | # :command.usage_examples | |
723 | printf "%s\n" "Examples:" |
|
723 | printf "%s\n" "Examples:" | |
724 | 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" |
|
724 | 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" | |
725 | echo |
|
725 | echo | |
726 |
|
726 | |||
727 | fi |
|
727 | fi | |
728 | } |
|
728 | } | |
729 |
|
729 | |||
730 | # :command.usage |
|
730 | # :command.usage | |
731 | rcstack_stack_upgrade_router_usage() { |
|
731 | rcstack_stack_upgrade_router_usage() { | |
732 | if [[ -n $long_usage ]]; then |
|
732 | if [[ -n $long_usage ]]; then | |
733 | printf "rcstack stack-upgrade router - upgrade the router stack\n" |
|
733 | printf "rcstack stack-upgrade router - upgrade the router stack\n" | |
734 | echo |
|
734 | echo | |
735 |
|
735 | |||
736 | else |
|
736 | else | |
737 | printf "rcstack stack-upgrade router - upgrade the router stack\n" |
|
737 | printf "rcstack stack-upgrade router - upgrade the router stack\n" | |
738 | echo |
|
738 | echo | |
739 |
|
739 | |||
740 | fi |
|
740 | fi | |
741 |
|
741 | |||
742 | printf "%s\n" "Usage:" |
|
742 | printf "%s\n" "Usage:" | |
743 | printf " rcstack stack-upgrade router\n" |
|
743 | printf " rcstack stack-upgrade router\n" | |
744 | printf " rcstack stack-upgrade router --help | -h\n" |
|
744 | printf " rcstack stack-upgrade router --help | -h\n" | |
745 | echo |
|
745 | echo | |
746 |
|
746 | |||
747 | # :command.long_usage |
|
747 | # :command.long_usage | |
748 | if [[ -n $long_usage ]]; then |
|
748 | if [[ -n $long_usage ]]; then | |
749 | printf "%s\n" "Options:" |
|
749 | printf "%s\n" "Options:" | |
750 |
|
750 | |||
751 | # :command.usage_fixed_flags |
|
751 | # :command.usage_fixed_flags | |
752 | printf " %s\n" "--help, -h" |
|
752 | printf " %s\n" "--help, -h" | |
753 | printf " Show this help\n" |
|
753 | printf " Show this help\n" | |
754 | echo |
|
754 | echo | |
755 |
|
755 | |||
756 | fi |
|
756 | fi | |
757 | } |
|
757 | } | |
758 |
|
758 | |||
759 | # :command.usage |
|
759 | # :command.usage | |
760 | rcstack_stack_upgrade_services_usage() { |
|
760 | rcstack_stack_upgrade_services_usage() { | |
761 | if [[ -n $long_usage ]]; then |
|
761 | if [[ -n $long_usage ]]; then | |
762 | printf "rcstack stack-upgrade services - upgrade the services stack\n" |
|
762 | printf "rcstack stack-upgrade services - upgrade the services stack\n" | |
763 | echo |
|
763 | echo | |
764 |
|
764 | |||
765 | else |
|
765 | else | |
766 | printf "rcstack stack-upgrade services - upgrade the services stack\n" |
|
766 | printf "rcstack stack-upgrade services - upgrade the services stack\n" | |
767 | echo |
|
767 | echo | |
768 |
|
768 | |||
769 | fi |
|
769 | fi | |
770 |
|
770 | |||
771 | printf "%s\n" "Usage:" |
|
771 | printf "%s\n" "Usage:" | |
772 | printf " rcstack stack-upgrade services\n" |
|
772 | printf " rcstack stack-upgrade services\n" | |
773 | printf " rcstack stack-upgrade services --help | -h\n" |
|
773 | printf " rcstack stack-upgrade services --help | -h\n" | |
774 | echo |
|
774 | echo | |
775 |
|
775 | |||
776 | # :command.long_usage |
|
776 | # :command.long_usage | |
777 | if [[ -n $long_usage ]]; then |
|
777 | if [[ -n $long_usage ]]; then | |
778 | printf "%s\n" "Options:" |
|
778 | printf "%s\n" "Options:" | |
779 |
|
779 | |||
780 | # :command.usage_fixed_flags |
|
780 | # :command.usage_fixed_flags | |
781 | printf " %s\n" "--help, -h" |
|
781 | printf " %s\n" "--help, -h" | |
782 | printf " Show this help\n" |
|
782 | printf " Show this help\n" | |
783 | echo |
|
783 | echo | |
784 |
|
784 | |||
785 | fi |
|
785 | fi | |
786 | } |
|
786 | } | |
787 |
|
787 | |||
788 | # :command.usage |
|
788 | # :command.usage | |
789 | rcstack_stack_upgrade_metrics_usage() { |
|
789 | rcstack_stack_upgrade_metrics_usage() { | |
790 | if [[ -n $long_usage ]]; then |
|
790 | if [[ -n $long_usage ]]; then | |
791 | printf "rcstack stack-upgrade metrics - upgrade the metrics stack\n" |
|
791 | printf "rcstack stack-upgrade metrics - upgrade the metrics stack\n" | |
792 | echo |
|
792 | echo | |
793 |
|
793 | |||
794 | else |
|
794 | else | |
795 | printf "rcstack stack-upgrade metrics - upgrade the metrics stack\n" |
|
795 | printf "rcstack stack-upgrade metrics - upgrade the metrics stack\n" | |
796 | echo |
|
796 | echo | |
797 |
|
797 | |||
798 | fi |
|
798 | fi | |
799 |
|
799 | |||
800 | printf "%s\n" "Usage:" |
|
800 | printf "%s\n" "Usage:" | |
801 | printf " rcstack stack-upgrade metrics\n" |
|
801 | printf " rcstack stack-upgrade metrics\n" | |
802 | printf " rcstack stack-upgrade metrics --help | -h\n" |
|
802 | printf " rcstack stack-upgrade metrics --help | -h\n" | |
803 | echo |
|
803 | echo | |
804 |
|
804 | |||
805 | # :command.long_usage |
|
805 | # :command.long_usage | |
806 | if [[ -n $long_usage ]]; then |
|
806 | if [[ -n $long_usage ]]; then | |
807 | printf "%s\n" "Options:" |
|
807 | printf "%s\n" "Options:" | |
808 |
|
808 | |||
809 | # :command.usage_fixed_flags |
|
809 | # :command.usage_fixed_flags | |
810 | printf " %s\n" "--help, -h" |
|
810 | printf " %s\n" "--help, -h" | |
811 | printf " Show this help\n" |
|
811 | printf " Show this help\n" | |
812 | echo |
|
812 | echo | |
813 |
|
813 | |||
814 | fi |
|
814 | fi | |
815 | } |
|
815 | } | |
816 |
|
816 | |||
817 | # :command.usage |
|
817 | # :command.usage | |
818 | rcstack_stack_upgrade_rhodecode_usage() { |
|
818 | rcstack_stack_upgrade_rhodecode_usage() { | |
819 | if [[ -n $long_usage ]]; then |
|
819 | if [[ -n $long_usage ]]; then | |
820 | printf "rcstack stack-upgrade rhodecode - upgrade the rhodecode stack\n" |
|
820 | printf "rcstack stack-upgrade rhodecode - upgrade the rhodecode stack\n" | |
821 | echo |
|
821 | echo | |
822 |
|
822 | |||
823 | else |
|
823 | else | |
824 | printf "rcstack stack-upgrade rhodecode - upgrade the rhodecode stack\n" |
|
824 | printf "rcstack stack-upgrade rhodecode - upgrade the rhodecode stack\n" | |
825 | echo |
|
825 | echo | |
826 |
|
826 | |||
827 | fi |
|
827 | fi | |
828 |
|
828 | |||
829 | printf "%s\n" "Usage:" |
|
829 | printf "%s\n" "Usage:" | |
830 | printf " rcstack stack-upgrade rhodecode [OPTIONS]\n" |
|
830 | printf " rcstack stack-upgrade rhodecode [OPTIONS]\n" | |
831 | printf " rcstack stack-upgrade rhodecode --help | -h\n" |
|
831 | printf " rcstack stack-upgrade rhodecode --help | -h\n" | |
832 | echo |
|
832 | echo | |
833 |
|
833 | |||
834 | # :command.long_usage |
|
834 | # :command.long_usage | |
835 | if [[ -n $long_usage ]]; then |
|
835 | if [[ -n $long_usage ]]; then | |
836 | printf "%s\n" "Options:" |
|
836 | printf "%s\n" "Options:" | |
837 |
|
837 | |||
838 | # :command.usage_flags |
|
838 | # :command.usage_flags | |
839 | # :flag.usage |
|
839 | # :flag.usage | |
840 | printf " %s\n" "--stop-wait STOP_WAIT" |
|
840 | printf " %s\n" "--stop-wait STOP_WAIT" | |
841 | printf " Number of seconds to wait for stopping old containers, use low value to\n quickly restart and recycle containers\n" |
|
841 | printf " Number of seconds to wait for stopping old containers, use low value to\n quickly restart and recycle containers\n" | |
842 | printf " Default: 120\n" |
|
842 | printf " Default: 120\n" | |
843 | echo |
|
843 | echo | |
844 |
|
844 | |||
845 | # :flag.usage |
|
845 | # :flag.usage | |
846 | printf " %s\n" "--docker-stop-wait DOCKER_STOP_WAIT" |
|
846 | printf " %s\n" "--docker-stop-wait DOCKER_STOP_WAIT" | |
847 | printf " Number of seconds to pass to docker stop command that will wait for\n container to gracefully stop\n" |
|
847 | printf " Number of seconds to pass to docker stop command that will wait for\n container to gracefully stop\n" | |
848 | printf " Default: 3600\n" |
|
848 | printf " Default: 3600\n" | |
849 | echo |
|
849 | echo | |
850 |
|
850 | |||
851 | # :command.usage_fixed_flags |
|
851 | # :command.usage_fixed_flags | |
852 | printf " %s\n" "--help, -h" |
|
852 | printf " %s\n" "--help, -h" | |
853 | printf " Show this help\n" |
|
853 | printf " Show this help\n" | |
854 | echo |
|
854 | echo | |
855 |
|
855 | |||
856 | fi |
|
856 | fi | |
857 | } |
|
857 | } | |
858 |
|
858 | |||
859 | # :command.usage |
|
859 | # :command.usage | |
860 | rcstack_stack_monitor_usage() { |
|
860 | rcstack_stack_monitor_usage() { | |
861 | if [[ -n $long_usage ]]; then |
|
861 | if [[ -n $long_usage ]]; then | |
862 | printf "rcstack stack-monitor - run monitoring on stack items\n" |
|
862 | printf "rcstack stack-monitor - run monitoring on stack items\n" | |
863 | echo |
|
863 | echo | |
864 |
|
864 | |||
865 | else |
|
865 | else | |
866 | printf "rcstack stack-monitor - run monitoring on stack items\n" |
|
866 | printf "rcstack stack-monitor - run monitoring on stack items\n" | |
867 | echo |
|
867 | echo | |
868 |
|
868 | |||
869 | fi |
|
869 | fi | |
870 |
|
870 | |||
871 | printf "%s\n" "Usage:" |
|
871 | printf "%s\n" "Usage:" | |
872 | printf " rcstack stack-monitor COMMAND\n" |
|
872 | printf " rcstack stack-monitor COMMAND\n" | |
873 | printf " rcstack stack-monitor [COMMAND] --help | -h\n" |
|
873 | printf " rcstack stack-monitor [COMMAND] --help | -h\n" | |
874 | echo |
|
874 | echo | |
875 | # :command.usage_commands |
|
875 | # :command.usage_commands | |
876 | printf "%s\n" "Stack Commands:" |
|
876 | printf "%s\n" "Stack Commands:" | |
877 | printf " %s monitor stack containers that are unhealthy and restart them\n" "restart-unhealthy" |
|
877 | printf " %s monitor stack containers that are unhealthy and restart them\n" "restart-unhealthy" | |
878 | echo |
|
878 | echo | |
879 |
|
879 | |||
880 | # :command.long_usage |
|
880 | # :command.long_usage | |
881 | if [[ -n $long_usage ]]; then |
|
881 | if [[ -n $long_usage ]]; then | |
882 | printf "%s\n" "Options:" |
|
882 | printf "%s\n" "Options:" | |
883 |
|
883 | |||
884 | # :command.usage_fixed_flags |
|
884 | # :command.usage_fixed_flags | |
885 | printf " %s\n" "--help, -h" |
|
885 | printf " %s\n" "--help, -h" | |
886 | printf " Show this help\n" |
|
886 | printf " Show this help\n" | |
887 | echo |
|
887 | echo | |
888 |
|
888 | |||
889 | fi |
|
889 | fi | |
890 | } |
|
890 | } | |
891 |
|
891 | |||
892 | # :command.usage |
|
892 | # :command.usage | |
893 | rcstack_stack_monitor_restart_unhealthy_usage() { |
|
893 | rcstack_stack_monitor_restart_unhealthy_usage() { | |
894 | if [[ -n $long_usage ]]; then |
|
894 | if [[ -n $long_usage ]]; then | |
895 | printf "rcstack stack-monitor restart-unhealthy - monitor stack containers that are unhealthy and restart them\n" |
|
895 | printf "rcstack stack-monitor restart-unhealthy - monitor stack containers that are unhealthy and restart them\n" | |
896 | echo |
|
896 | echo | |
897 |
|
897 | |||
898 | else |
|
898 | else | |
899 | printf "rcstack stack-monitor restart-unhealthy - monitor stack containers that are unhealthy and restart them\n" |
|
899 | printf "rcstack stack-monitor restart-unhealthy - monitor stack containers that are unhealthy and restart them\n" | |
900 | echo |
|
900 | echo | |
901 |
|
901 | |||
902 | fi |
|
902 | fi | |
903 |
|
903 | |||
904 | printf "%s\n" "Usage:" |
|
904 | printf "%s\n" "Usage:" | |
905 | printf " rcstack stack-monitor restart-unhealthy [OPTIONS]\n" |
|
905 | printf " rcstack stack-monitor restart-unhealthy [OPTIONS]\n" | |
906 | printf " rcstack stack-monitor restart-unhealthy --help | -h\n" |
|
906 | printf " rcstack stack-monitor restart-unhealthy --help | -h\n" | |
907 | echo |
|
907 | echo | |
908 |
|
908 | |||
909 | # :command.long_usage |
|
909 | # :command.long_usage | |
910 | if [[ -n $long_usage ]]; then |
|
910 | if [[ -n $long_usage ]]; then | |
911 | printf "%s\n" "Options:" |
|
911 | printf "%s\n" "Options:" | |
912 |
|
912 | |||
913 | # :command.usage_flags |
|
913 | # :command.usage_flags | |
914 | # :flag.usage |
|
914 | # :flag.usage | |
915 | printf " %s\n" "--loop LOOP" |
|
915 | printf " %s\n" "--loop LOOP" | |
916 | printf " run in a loop to monitor continuously every N seconds\n" |
|
916 | printf " run in a loop to monitor continuously every N seconds\n" | |
917 | printf " Default: 0\n" |
|
917 | printf " Default: 0\n" | |
918 | echo |
|
918 | echo | |
919 |
|
919 | |||
920 | # :command.usage_fixed_flags |
|
920 | # :command.usage_fixed_flags | |
921 | printf " %s\n" "--help, -h" |
|
921 | printf " %s\n" "--help, -h" | |
922 | printf " Show this help\n" |
|
922 | printf " Show this help\n" | |
923 | echo |
|
923 | echo | |
924 |
|
924 | |||
925 | # :command.usage_examples |
|
925 | # :command.usage_examples | |
926 | printf "%s\n" "Examples:" |
|
926 | printf "%s\n" "Examples:" | |
927 | 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" |
|
927 | 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" | |
928 | echo |
|
928 | echo | |
929 |
|
929 | |||
930 | fi |
|
930 | fi | |
931 | } |
|
931 | } | |
932 |
|
932 | |||
933 | # :command.usage |
|
933 | # :command.usage | |
934 | rcstack_cli_usage() { |
|
934 | rcstack_cli_usage() { | |
935 | if [[ -n $long_usage ]]; then |
|
935 | if [[ -n $long_usage ]]; then | |
936 | printf "rcstack cli - Various CLI tools, run cli -h for more details\n" |
|
936 | printf "rcstack cli - Various CLI tools, run cli -h for more details\n" | |
937 | echo |
|
937 | echo | |
938 |
|
938 | |||
939 | else |
|
939 | else | |
940 | printf "rcstack cli - Various CLI tools, run cli -h for more details\n" |
|
940 | printf "rcstack cli - Various CLI tools, run cli -h for more details\n" | |
941 | echo |
|
941 | echo | |
942 |
|
942 | |||
943 | fi |
|
943 | fi | |
944 |
|
944 | |||
945 | printf "%s\n" "Usage:" |
|
945 | printf "%s\n" "Usage:" | |
946 | printf " rcstack cli COMMAND\n" |
|
946 | printf " rcstack cli COMMAND\n" | |
947 | printf " rcstack cli [COMMAND] --help | -h\n" |
|
947 | printf " rcstack cli [COMMAND] --help | -h\n" | |
948 | echo |
|
948 | echo | |
949 | # :command.usage_commands |
|
949 | # :command.usage_commands | |
950 | printf "%s\n" "Commands:" |
|
950 | printf "%s\n" "Commands:" | |
951 | printf " %s run a custom command on top of docker image from RhodeCode\n" "cmd " |
|
951 | printf " %s run a custom command on top of docker image from RhodeCode\n" "cmd " | |
952 | printf " %s ishell attached to running RhodeCode instance\n" "ishell " |
|
952 | printf " %s ishell attached to running RhodeCode instance\n" "ishell " | |
953 | printf " %s print out stored docker image version\n" "image-info " |
|
953 | printf " %s print out stored docker image version\n" "image-info " | |
954 | printf " %s set version to .runtime.env file\n" "set-runtime-image " |
|
954 | printf " %s set version to .runtime.env file\n" "set-runtime-image " | |
955 | printf " %s get current docker info\n" "docker-info " |
|
955 | printf " %s get current docker info\n" "docker-info " | |
956 | printf " %s force upgrade docker\n" "docker-upgrade " |
|
956 | printf " %s force upgrade docker\n" "docker-upgrade " | |
957 | printf " %s CLI for Redis\n" "redis " |
|
957 | printf " %s CLI for Redis\n" "redis " | |
958 | printf " %s CLI with Database connection\n" "db " |
|
958 | printf " %s CLI with Database connection\n" "db " | |
959 | printf " %s CLI to run db upgrade\n" "db-upgrade " |
|
959 | printf " %s CLI to run db upgrade\n" "db-upgrade " | |
960 | 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 " |
|
960 | 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 " | |
961 | printf " %s attach to running instance of RhodeCode, by default it attaches to rhodecode main web app\n" "attach " |
|
961 | printf " %s attach to running instance of RhodeCode, by default it attaches to rhodecode main web app\n" "attach " | |
962 | printf " %s set current setup to either CE (Community) or EE (Enterprise) type\n" "set-edition " |
|
962 | printf " %s set current setup to either CE (Community) or EE (Enterprise) type\n" "set-edition " | |
963 | printf " %s reconfigure the vcsserver.ini file\n" "configure-vcsserver" |
|
963 | printf " %s reconfigure the vcsserver.ini file\n" "configure-vcsserver" | |
964 | printf " %s reconfigure the rhodecode.ini file\n" "configure-rhodecode" |
|
964 | printf " %s reconfigure the rhodecode.ini file\n" "configure-rhodecode" | |
965 | echo |
|
965 | echo | |
966 |
|
966 | |||
967 | # :command.long_usage |
|
967 | # :command.long_usage | |
968 | if [[ -n $long_usage ]]; then |
|
968 | if [[ -n $long_usage ]]; then | |
969 | printf "%s\n" "Options:" |
|
969 | printf "%s\n" "Options:" | |
970 |
|
970 | |||
971 | # :command.usage_fixed_flags |
|
971 | # :command.usage_fixed_flags | |
972 | printf " %s\n" "--help, -h" |
|
972 | printf " %s\n" "--help, -h" | |
973 | printf " Show this help\n" |
|
973 | printf " Show this help\n" | |
974 | echo |
|
974 | echo | |
975 |
|
975 | |||
976 | fi |
|
976 | fi | |
977 | } |
|
977 | } | |
978 |
|
978 | |||
979 | # :command.usage |
|
979 | # :command.usage | |
980 | rcstack_cli_cmd_usage() { |
|
980 | rcstack_cli_cmd_usage() { | |
981 | if [[ -n $long_usage ]]; then |
|
981 | if [[ -n $long_usage ]]; then | |
982 | printf "rcstack cli cmd - run a custom command on top of docker image from RhodeCode\n" |
|
982 | printf "rcstack cli cmd - run a custom command on top of docker image from RhodeCode\n" | |
983 | echo |
|
983 | echo | |
984 |
|
984 | |||
985 | else |
|
985 | else | |
986 | printf "rcstack cli cmd - run a custom command on top of docker image from RhodeCode\n" |
|
986 | printf "rcstack cli cmd - run a custom command on top of docker image from RhodeCode\n" | |
987 | echo |
|
987 | echo | |
988 |
|
988 | |||
989 | fi |
|
989 | fi | |
990 |
|
990 | |||
991 | printf "%s\n" "Usage:" |
|
991 | printf "%s\n" "Usage:" | |
992 | printf " rcstack cli cmd [OPTIONS] [CALL ARGUMENTS...]\n" |
|
992 | printf " rcstack cli cmd [OPTIONS] [CALL ARGUMENTS...]\n" | |
993 | printf " rcstack cli cmd --help | -h\n" |
|
993 | printf " rcstack cli cmd --help | -h\n" | |
994 | echo |
|
994 | echo | |
995 |
|
995 | |||
996 | # :command.long_usage |
|
996 | # :command.long_usage | |
997 | if [[ -n $long_usage ]]; then |
|
997 | if [[ -n $long_usage ]]; then | |
998 | printf "%s\n" "Options:" |
|
998 | printf "%s\n" "Options:" | |
999 |
|
999 | |||
1000 | # :command.usage_flags |
|
1000 | # :command.usage_flags | |
1001 | # :flag.usage |
|
1001 | # :flag.usage | |
1002 | printf " %s\n" "--no-tty" |
|
1002 | printf " %s\n" "--no-tty" | |
1003 | printf " when running docker command don't attach to TTY. Useful for running a script\n out of shell context, e.g crontab\n" |
|
1003 | printf " when running docker command don't attach to TTY. Useful for running a script\n out of shell context, e.g crontab\n" | |
1004 | echo |
|
1004 | echo | |
1005 |
|
1005 | |||
1006 | # :flag.usage |
|
1006 | # :flag.usage | |
1007 | printf " %s\n" "--user" |
|
1007 | printf " %s\n" "--user" | |
1008 | printf " User to run the command as, e.g root / rhodecode\n" |
|
1008 | printf " User to run the command as, e.g root / rhodecode\n" | |
1009 | echo |
|
1009 | echo | |
1010 |
|
1010 | |||
1011 | # :flag.usage |
|
1011 | # :flag.usage | |
1012 | printf " %s\n" "--env-file-path ENV_FILE_PATH" |
|
1012 | printf " %s\n" "--env-file-path ENV_FILE_PATH" | |
1013 | printf " Set custom env file\n" |
|
1013 | printf " Set custom env file\n" | |
1014 | printf " Default: $PWD/.custom/.runtime.env\n" |
|
1014 | printf " Default: $PWD/.custom/.runtime.env\n" | |
1015 | echo |
|
1015 | echo | |
1016 |
|
1016 | |||
1017 | # :command.usage_fixed_flags |
|
1017 | # :command.usage_fixed_flags | |
1018 | printf " %s\n" "--help, -h" |
|
1018 | printf " %s\n" "--help, -h" | |
1019 | printf " Show this help\n" |
|
1019 | printf " Show this help\n" | |
1020 | echo |
|
1020 | echo | |
1021 |
|
1021 | |||
1022 | # :command.usage_args |
|
1022 | # :command.usage_args | |
1023 | printf "%s\n" "Arguments:" |
|
1023 | printf "%s\n" "Arguments:" | |
1024 |
|
1024 | |||
1025 | echo " CALL ARGUMENTS..." |
|
1025 | echo " CALL ARGUMENTS..." | |
1026 | printf " call arguments\n" |
|
1026 | printf " call arguments\n" | |
1027 | echo |
|
1027 | echo | |
1028 |
|
1028 | |||
1029 | fi |
|
1029 | fi | |
1030 | } |
|
1030 | } | |
1031 |
|
1031 | |||
1032 | # :command.usage |
|
1032 | # :command.usage | |
1033 | rcstack_cli_ishell_usage() { |
|
1033 | rcstack_cli_ishell_usage() { | |
1034 | if [[ -n $long_usage ]]; then |
|
1034 | if [[ -n $long_usage ]]; then | |
1035 | printf "rcstack cli ishell - ishell attached to running RhodeCode instance\n" |
|
1035 | printf "rcstack cli ishell - ishell attached to running RhodeCode instance\n" | |
1036 | echo |
|
1036 | echo | |
1037 |
|
1037 | |||
1038 | else |
|
1038 | else | |
1039 | printf "rcstack cli ishell - ishell attached to running RhodeCode instance\n" |
|
1039 | printf "rcstack cli ishell - ishell attached to running RhodeCode instance\n" | |
1040 | echo |
|
1040 | echo | |
1041 |
|
1041 | |||
1042 | fi |
|
1042 | fi | |
1043 |
|
1043 | |||
1044 | printf "%s\n" "Usage:" |
|
1044 | printf "%s\n" "Usage:" | |
1045 | printf " rcstack cli ishell [OPTIONS]\n" |
|
1045 | printf " rcstack cli ishell [OPTIONS]\n" | |
1046 | printf " rcstack cli ishell --help | -h\n" |
|
1046 | printf " rcstack cli ishell --help | -h\n" | |
1047 | echo |
|
1047 | echo | |
1048 |
|
1048 | |||
1049 | # :command.long_usage |
|
1049 | # :command.long_usage | |
1050 | if [[ -n $long_usage ]]; then |
|
1050 | if [[ -n $long_usage ]]; then | |
1051 | printf "%s\n" "Options:" |
|
1051 | printf "%s\n" "Options:" | |
1052 |
|
1052 | |||
1053 | # :command.usage_flags |
|
1053 | # :command.usage_flags | |
1054 | # :flag.usage |
|
1054 | # :flag.usage | |
1055 | printf " %s\n" "--no-tty" |
|
1055 | printf " %s\n" "--no-tty" | |
1056 | printf " when running docker command don't attach to TTY. Useful for running a script\n out of shell context, e.g crontab\n" |
|
1056 | printf " when running docker command don't attach to TTY. Useful for running a script\n out of shell context, e.g crontab\n" | |
1057 | echo |
|
1057 | echo | |
1058 |
|
1058 | |||
1059 | # :flag.usage |
|
1059 | # :flag.usage | |
1060 | printf " %s\n" "--user" |
|
1060 | printf " %s\n" "--user" | |
1061 | printf " User to run the command as, e.g root / rhodecode\n" |
|
1061 | printf " User to run the command as, e.g root / rhodecode\n" | |
1062 | echo |
|
1062 | echo | |
1063 |
|
1063 | |||
1064 | # :flag.usage |
|
1064 | # :flag.usage | |
1065 | printf " %s\n" "--env-file-path ENV_FILE_PATH" |
|
1065 | printf " %s\n" "--env-file-path ENV_FILE_PATH" | |
1066 | printf " Set custom env file\n" |
|
1066 | printf " Set custom env file\n" | |
1067 | printf " Default: $PWD/.custom/.runtime.env\n" |
|
1067 | printf " Default: $PWD/.custom/.runtime.env\n" | |
1068 | echo |
|
1068 | echo | |
1069 |
|
1069 | |||
1070 | # :command.usage_fixed_flags |
|
1070 | # :command.usage_fixed_flags | |
1071 | printf " %s\n" "--help, -h" |
|
1071 | printf " %s\n" "--help, -h" | |
1072 | printf " Show this help\n" |
|
1072 | printf " Show this help\n" | |
1073 | echo |
|
1073 | echo | |
1074 |
|
1074 | |||
1075 | fi |
|
1075 | fi | |
1076 | } |
|
1076 | } | |
1077 |
|
1077 | |||
1078 | # :command.usage |
|
1078 | # :command.usage | |
1079 | rcstack_cli_image_info_usage() { |
|
1079 | rcstack_cli_image_info_usage() { | |
1080 | if [[ -n $long_usage ]]; then |
|
1080 | if [[ -n $long_usage ]]; then | |
1081 | printf "rcstack cli image-info - print out stored docker image version\n" |
|
1081 | printf "rcstack cli image-info - print out stored docker image version\n" | |
1082 | echo |
|
1082 | echo | |
1083 |
|
1083 | |||
1084 | else |
|
1084 | else | |
1085 | printf "rcstack cli image-info - print out stored docker image version\n" |
|
1085 | printf "rcstack cli image-info - print out stored docker image version\n" | |
1086 | echo |
|
1086 | echo | |
1087 |
|
1087 | |||
1088 | fi |
|
1088 | fi | |
1089 |
|
1089 | |||
1090 | printf "%s\n" "Usage:" |
|
1090 | printf "%s\n" "Usage:" | |
1091 | printf " rcstack cli image-info [OPTIONS]\n" |
|
1091 | printf " rcstack cli image-info [OPTIONS]\n" | |
1092 | printf " rcstack cli image-info --help | -h\n" |
|
1092 | printf " rcstack cli image-info --help | -h\n" | |
1093 | echo |
|
1093 | echo | |
1094 |
|
1094 | |||
1095 | # :command.long_usage |
|
1095 | # :command.long_usage | |
1096 | if [[ -n $long_usage ]]; then |
|
1096 | if [[ -n $long_usage ]]; then | |
1097 | printf "%s\n" "Options:" |
|
1097 | printf "%s\n" "Options:" | |
1098 |
|
1098 | |||
1099 | # :command.usage_flags |
|
1099 | # :command.usage_flags | |
1100 | # :flag.usage |
|
1100 | # :flag.usage | |
1101 | printf " %s\n" "--verbose" |
|
1101 | printf " %s\n" "--verbose" | |
1102 | printf " rich output about image\n" |
|
1102 | printf " rich output about image\n" | |
1103 | echo |
|
1103 | echo | |
1104 |
|
1104 | |||
1105 | # :command.usage_fixed_flags |
|
1105 | # :command.usage_fixed_flags | |
1106 | printf " %s\n" "--help, -h" |
|
1106 | printf " %s\n" "--help, -h" | |
1107 | printf " Show this help\n" |
|
1107 | printf " Show this help\n" | |
1108 | echo |
|
1108 | echo | |
1109 |
|
1109 | |||
1110 | fi |
|
1110 | fi | |
1111 | } |
|
1111 | } | |
1112 |
|
1112 | |||
1113 | # :command.usage |
|
1113 | # :command.usage | |
1114 | rcstack_cli_set_runtime_image_usage() { |
|
1114 | rcstack_cli_set_runtime_image_usage() { | |
1115 | if [[ -n $long_usage ]]; then |
|
1115 | if [[ -n $long_usage ]]; then | |
1116 | printf "rcstack cli set-runtime-image - set version to .runtime.env file\n" |
|
1116 | printf "rcstack cli set-runtime-image - set version to .runtime.env file\n" | |
1117 | echo |
|
1117 | echo | |
1118 |
|
1118 | |||
1119 | else |
|
1119 | else | |
1120 | printf "rcstack cli set-runtime-image - set version to .runtime.env file\n" |
|
1120 | printf "rcstack cli set-runtime-image - set version to .runtime.env file\n" | |
1121 | echo |
|
1121 | echo | |
1122 |
|
1122 | |||
1123 | fi |
|
1123 | fi | |
1124 |
|
1124 | |||
1125 | printf "%s\n" "Usage:" |
|
1125 | printf "%s\n" "Usage:" | |
1126 | printf " rcstack cli set-runtime-image VERSION\n" |
|
1126 | printf " rcstack cli set-runtime-image VERSION\n" | |
1127 | printf " rcstack cli set-runtime-image --help | -h\n" |
|
1127 | printf " rcstack cli set-runtime-image --help | -h\n" | |
1128 | echo |
|
1128 | echo | |
1129 |
|
1129 | |||
1130 | # :command.long_usage |
|
1130 | # :command.long_usage | |
1131 | if [[ -n $long_usage ]]; then |
|
1131 | if [[ -n $long_usage ]]; then | |
1132 | printf "%s\n" "Options:" |
|
1132 | printf "%s\n" "Options:" | |
1133 |
|
1133 | |||
1134 | # :command.usage_fixed_flags |
|
1134 | # :command.usage_fixed_flags | |
1135 | printf " %s\n" "--help, -h" |
|
1135 | printf " %s\n" "--help, -h" | |
1136 | printf " Show this help\n" |
|
1136 | printf " Show this help\n" | |
1137 | echo |
|
1137 | echo | |
1138 |
|
1138 | |||
1139 | # :command.usage_args |
|
1139 | # :command.usage_args | |
1140 | printf "%s\n" "Arguments:" |
|
1140 | printf "%s\n" "Arguments:" | |
1141 |
|
1141 | |||
1142 | # :argument.usage |
|
1142 | # :argument.usage | |
1143 | printf " %s\n" "VERSION" |
|
1143 | printf " %s\n" "VERSION" | |
1144 | printf " Version of docker image to set e.g '5.0.0'\n" |
|
1144 | printf " Version of docker image to set e.g '5.0.0'\n" | |
1145 | echo |
|
1145 | echo | |
1146 |
|
1146 | |||
1147 | fi |
|
1147 | fi | |
1148 | } |
|
1148 | } | |
1149 |
|
1149 | |||
1150 | # :command.usage |
|
1150 | # :command.usage | |
1151 | rcstack_cli_docker_info_usage() { |
|
1151 | rcstack_cli_docker_info_usage() { | |
1152 | if [[ -n $long_usage ]]; then |
|
1152 | if [[ -n $long_usage ]]; then | |
1153 | printf "rcstack cli docker-info - get current docker info\n" |
|
1153 | printf "rcstack cli docker-info - get current docker info\n" | |
1154 | echo |
|
1154 | echo | |
1155 |
|
1155 | |||
1156 | else |
|
1156 | else | |
1157 | printf "rcstack cli docker-info - get current docker info\n" |
|
1157 | printf "rcstack cli docker-info - get current docker info\n" | |
1158 | echo |
|
1158 | echo | |
1159 |
|
1159 | |||
1160 | fi |
|
1160 | fi | |
1161 |
|
1161 | |||
1162 | printf "%s\n" "Usage:" |
|
1162 | printf "%s\n" "Usage:" | |
1163 | printf " rcstack cli docker-info [OPTIONS]\n" |
|
1163 | printf " rcstack cli docker-info [OPTIONS]\n" | |
1164 | printf " rcstack cli docker-info --help | -h\n" |
|
1164 | printf " rcstack cli docker-info --help | -h\n" | |
1165 | echo |
|
1165 | echo | |
1166 |
|
1166 | |||
1167 | # :command.long_usage |
|
1167 | # :command.long_usage | |
1168 | if [[ -n $long_usage ]]; then |
|
1168 | if [[ -n $long_usage ]]; then | |
1169 | printf "%s\n" "Options:" |
|
1169 | printf "%s\n" "Options:" | |
1170 |
|
1170 | |||
1171 | # :command.usage_flags |
|
1171 | # :command.usage_flags | |
1172 | # :flag.usage |
|
1172 | # :flag.usage | |
1173 | printf " %s\n" "--verbose" |
|
1173 | printf " %s\n" "--verbose" | |
1174 | printf " rich output about docker\n" |
|
1174 | printf " rich output about docker\n" | |
1175 | echo |
|
1175 | echo | |
1176 |
|
1176 | |||
1177 | # :command.usage_fixed_flags |
|
1177 | # :command.usage_fixed_flags | |
1178 | printf " %s\n" "--help, -h" |
|
1178 | printf " %s\n" "--help, -h" | |
1179 | printf " Show this help\n" |
|
1179 | printf " Show this help\n" | |
1180 | echo |
|
1180 | echo | |
1181 |
|
1181 | |||
1182 | fi |
|
1182 | fi | |
1183 | } |
|
1183 | } | |
1184 |
|
1184 | |||
1185 | # :command.usage |
|
1185 | # :command.usage | |
1186 | rcstack_cli_docker_upgrade_usage() { |
|
1186 | rcstack_cli_docker_upgrade_usage() { | |
1187 | if [[ -n $long_usage ]]; then |
|
1187 | if [[ -n $long_usage ]]; then | |
1188 | printf "rcstack cli docker-upgrade - force upgrade docker\n" |
|
1188 | printf "rcstack cli docker-upgrade - force upgrade docker\n" | |
1189 | echo |
|
1189 | echo | |
1190 |
|
1190 | |||
1191 | else |
|
1191 | else | |
1192 | printf "rcstack cli docker-upgrade - force upgrade docker\n" |
|
1192 | printf "rcstack cli docker-upgrade - force upgrade docker\n" | |
1193 | echo |
|
1193 | echo | |
1194 |
|
1194 | |||
1195 | fi |
|
1195 | fi | |
1196 |
|
1196 | |||
1197 | printf "%s\n" "Usage:" |
|
1197 | printf "%s\n" "Usage:" | |
1198 | printf " rcstack cli docker-upgrade [OPTIONS]\n" |
|
1198 | printf " rcstack cli docker-upgrade [OPTIONS]\n" | |
1199 | printf " rcstack cli docker-upgrade --help | -h\n" |
|
1199 | printf " rcstack cli docker-upgrade --help | -h\n" | |
1200 | echo |
|
1200 | echo | |
1201 |
|
1201 | |||
1202 | # :command.long_usage |
|
1202 | # :command.long_usage | |
1203 | if [[ -n $long_usage ]]; then |
|
1203 | if [[ -n $long_usage ]]; then | |
1204 | printf "%s\n" "Options:" |
|
1204 | printf "%s\n" "Options:" | |
1205 |
|
1205 | |||
1206 | # :command.usage_flags |
|
1206 | # :command.usage_flags | |
1207 | # :flag.usage |
|
1207 | # :flag.usage | |
1208 | printf " %s\n" "--compose" |
|
1208 | printf " %s\n" "--compose" | |
1209 | printf " run an upgrade of docker compose to latest version\n" |
|
1209 | printf " run an upgrade of docker compose to latest version\n" | |
1210 | echo |
|
1210 | echo | |
1211 |
|
1211 | |||
1212 | # :command.usage_fixed_flags |
|
1212 | # :command.usage_fixed_flags | |
1213 | printf " %s\n" "--help, -h" |
|
1213 | printf " %s\n" "--help, -h" | |
1214 | printf " Show this help\n" |
|
1214 | printf " Show this help\n" | |
1215 | echo |
|
1215 | echo | |
1216 |
|
1216 | |||
1217 | fi |
|
1217 | fi | |
1218 | } |
|
1218 | } | |
1219 |
|
1219 | |||
1220 | # :command.usage |
|
1220 | # :command.usage | |
1221 | rcstack_cli_redis_usage() { |
|
1221 | rcstack_cli_redis_usage() { | |
1222 | if [[ -n $long_usage ]]; then |
|
1222 | if [[ -n $long_usage ]]; then | |
1223 | printf "rcstack cli redis - CLI for Redis\n" |
|
1223 | printf "rcstack cli redis - CLI for Redis\n" | |
1224 | echo |
|
1224 | echo | |
1225 |
|
1225 | |||
1226 | else |
|
1226 | else | |
1227 | printf "rcstack cli redis - CLI for Redis\n" |
|
1227 | printf "rcstack cli redis - CLI for Redis\n" | |
1228 | echo |
|
1228 | echo | |
1229 |
|
1229 | |||
1230 | fi |
|
1230 | fi | |
1231 |
|
1231 | |||
1232 | printf "%s\n" "Usage:" |
|
1232 | printf "%s\n" "Usage:" | |
1233 | printf " rcstack cli redis [OPTIONS]\n" |
|
1233 | printf " rcstack cli redis [OPTIONS]\n" | |
1234 | printf " rcstack cli redis --help | -h\n" |
|
1234 | printf " rcstack cli redis --help | -h\n" | |
1235 | echo |
|
1235 | echo | |
1236 |
|
1236 | |||
1237 | # :command.long_usage |
|
1237 | # :command.long_usage | |
1238 | if [[ -n $long_usage ]]; then |
|
1238 | if [[ -n $long_usage ]]; then | |
1239 | printf "%s\n" "Options:" |
|
1239 | printf "%s\n" "Options:" | |
1240 |
|
1240 | |||
1241 | # :command.usage_flags |
|
1241 | # :command.usage_flags | |
1242 | # :flag.usage |
|
1242 | # :flag.usage | |
1243 | printf " %s\n" "--no-tty" |
|
1243 | printf " %s\n" "--no-tty" | |
1244 | printf " when running docker command don't attach to TTY. Useful for running a script\n out of shell context, e.g crontab\n" |
|
1244 | printf " when running docker command don't attach to TTY. Useful for running a script\n out of shell context, e.g crontab\n" | |
1245 | echo |
|
1245 | echo | |
1246 |
|
1246 | |||
1247 | # :flag.usage |
|
1247 | # :flag.usage | |
1248 | printf " %s\n" "--user" |
|
1248 | printf " %s\n" "--user" | |
1249 | printf " User to run the command as, e.g root / rhodecode\n" |
|
1249 | printf " User to run the command as, e.g root / rhodecode\n" | |
1250 | echo |
|
1250 | echo | |
1251 |
|
1251 | |||
1252 | # :flag.usage |
|
1252 | # :flag.usage | |
1253 | printf " %s\n" "--env-file-path ENV_FILE_PATH" |
|
1253 | printf " %s\n" "--env-file-path ENV_FILE_PATH" | |
1254 | printf " Set custom env file\n" |
|
1254 | printf " Set custom env file\n" | |
1255 | printf " Default: $PWD/.custom/.runtime.env\n" |
|
1255 | printf " Default: $PWD/.custom/.runtime.env\n" | |
1256 | echo |
|
1256 | echo | |
1257 |
|
1257 | |||
1258 | # :flag.usage |
|
1258 | # :flag.usage | |
1259 | printf " %s\n" "--db DB" |
|
1259 | printf " %s\n" "--db DB" | |
1260 | printf " select Redis db, defaults 0\n" |
|
1260 | printf " select Redis db, defaults 0\n" | |
1261 | printf " Default: 0\n" |
|
1261 | printf " Default: 0\n" | |
1262 | echo |
|
1262 | echo | |
1263 |
|
1263 | |||
1264 | # :command.usage_fixed_flags |
|
1264 | # :command.usage_fixed_flags | |
1265 | printf " %s\n" "--help, -h" |
|
1265 | printf " %s\n" "--help, -h" | |
1266 | printf " Show this help\n" |
|
1266 | printf " Show this help\n" | |
1267 | echo |
|
1267 | echo | |
1268 |
|
1268 | |||
1269 | # :command.usage_examples |
|
1269 | # :command.usage_examples | |
1270 | printf "%s\n" "Examples:" |
|
1270 | printf "%s\n" "Examples:" | |
1271 | printf " # run the redis CLI\n - ./rcstack cli redis\n # run a command without TTY\n - echo 'KEYS *' | ./rcstack cli redis --no-tty\n" |
|
1271 | printf " # run the redis CLI\n - ./rcstack cli redis\n # run a command without TTY\n - echo 'KEYS *' | ./rcstack cli redis --no-tty\n" | |
1272 | echo |
|
1272 | echo | |
1273 |
|
1273 | |||
1274 | fi |
|
1274 | fi | |
1275 | } |
|
1275 | } | |
1276 |
|
1276 | |||
1277 | # :command.usage |
|
1277 | # :command.usage | |
1278 | rcstack_cli_db_usage() { |
|
1278 | rcstack_cli_db_usage() { | |
1279 | if [[ -n $long_usage ]]; then |
|
1279 | if [[ -n $long_usage ]]; then | |
1280 | printf "rcstack cli db - CLI with Database connection\n" |
|
1280 | printf "rcstack cli db - CLI with Database connection\n" | |
1281 | echo |
|
1281 | echo | |
1282 |
|
1282 | |||
1283 | else |
|
1283 | else | |
1284 | printf "rcstack cli db - CLI with Database connection\n" |
|
1284 | printf "rcstack cli db - CLI with Database connection\n" | |
1285 | echo |
|
1285 | echo | |
1286 |
|
1286 | |||
1287 | fi |
|
1287 | fi | |
1288 |
|
1288 | |||
1289 | printf "%s\n" "Usage:" |
|
1289 | printf "%s\n" "Usage:" | |
1290 | printf " rcstack cli db [OPTIONS]\n" |
|
1290 | printf " rcstack cli db [OPTIONS]\n" | |
1291 | printf " rcstack cli db --help | -h\n" |
|
1291 | printf " rcstack cli db --help | -h\n" | |
1292 | echo |
|
1292 | echo | |
1293 |
|
1293 | |||
1294 | # :command.long_usage |
|
1294 | # :command.long_usage | |
1295 | if [[ -n $long_usage ]]; then |
|
1295 | if [[ -n $long_usage ]]; then | |
1296 | printf "%s\n" "Options:" |
|
1296 | printf "%s\n" "Options:" | |
1297 |
|
1297 | |||
1298 | # :command.usage_flags |
|
1298 | # :command.usage_flags | |
1299 | # :flag.usage |
|
1299 | # :flag.usage | |
1300 | printf " %s\n" "--no-tty" |
|
1300 | printf " %s\n" "--no-tty" | |
1301 | printf " when running docker command don't attach to TTY. Useful for running a script\n out of shell context, e.g crontab\n" |
|
1301 | printf " when running docker command don't attach to TTY. Useful for running a script\n out of shell context, e.g crontab\n" | |
1302 | echo |
|
1302 | echo | |
1303 |
|
1303 | |||
1304 | # :flag.usage |
|
1304 | # :flag.usage | |
1305 | printf " %s\n" "--user" |
|
1305 | printf " %s\n" "--user" | |
1306 | printf " User to run the command as, e.g root / rhodecode\n" |
|
1306 | printf " User to run the command as, e.g root / rhodecode\n" | |
1307 | echo |
|
1307 | echo | |
1308 |
|
1308 | |||
1309 | # :flag.usage |
|
1309 | # :flag.usage | |
1310 | printf " %s\n" "--env-file-path ENV_FILE_PATH" |
|
1310 | printf " %s\n" "--env-file-path ENV_FILE_PATH" | |
1311 | printf " Set custom env file\n" |
|
1311 | printf " Set custom env file\n" | |
1312 | printf " Default: $PWD/.custom/.runtime.env\n" |
|
1312 | printf " Default: $PWD/.custom/.runtime.env\n" | |
1313 | echo |
|
1313 | echo | |
1314 |
|
1314 | |||
1315 | # :command.usage_fixed_flags |
|
1315 | # :command.usage_fixed_flags | |
1316 | printf " %s\n" "--help, -h" |
|
1316 | printf " %s\n" "--help, -h" | |
1317 | printf " Show this help\n" |
|
1317 | printf " Show this help\n" | |
1318 | echo |
|
1318 | echo | |
1319 |
|
1319 | |||
1320 | # :command.usage_examples |
|
1320 | # :command.usage_examples | |
1321 | printf "%s\n" "Examples:" |
|
1321 | printf "%s\n" "Examples:" | |
1322 | printf " # restore backup\n - \i /var/rc-data-dump/your_dump.sql\n" |
|
1322 | printf " # restore backup\n - \i /var/rc-data-dump/your_dump.sql\n" | |
1323 | echo |
|
1323 | echo | |
1324 |
|
1324 | |||
1325 | fi |
|
1325 | fi | |
1326 | } |
|
1326 | } | |
1327 |
|
1327 | |||
1328 | # :command.usage |
|
1328 | # :command.usage | |
1329 | rcstack_cli_db_upgrade_usage() { |
|
1329 | rcstack_cli_db_upgrade_usage() { | |
1330 | if [[ -n $long_usage ]]; then |
|
1330 | if [[ -n $long_usage ]]; then | |
1331 | printf "rcstack cli db-upgrade - CLI to run db upgrade\n" |
|
1331 | printf "rcstack cli db-upgrade - CLI to run db upgrade\n" | |
1332 | echo |
|
1332 | echo | |
1333 |
|
1333 | |||
1334 | else |
|
1334 | else | |
1335 | printf "rcstack cli db-upgrade - CLI to run db upgrade\n" |
|
1335 | printf "rcstack cli db-upgrade - CLI to run db upgrade\n" | |
1336 | echo |
|
1336 | echo | |
1337 |
|
1337 | |||
1338 | fi |
|
1338 | fi | |
1339 |
|
1339 | |||
1340 | printf "%s\n" "Usage:" |
|
1340 | printf "%s\n" "Usage:" | |
1341 | printf " rcstack cli db-upgrade\n" |
|
1341 | printf " rcstack cli db-upgrade\n" | |
1342 | printf " rcstack cli db-upgrade --help | -h\n" |
|
1342 | printf " rcstack cli db-upgrade --help | -h\n" | |
1343 | echo |
|
1343 | echo | |
1344 |
|
1344 | |||
1345 | # :command.long_usage |
|
1345 | # :command.long_usage | |
1346 | if [[ -n $long_usage ]]; then |
|
1346 | if [[ -n $long_usage ]]; then | |
1347 | printf "%s\n" "Options:" |
|
1347 | printf "%s\n" "Options:" | |
1348 |
|
1348 | |||
1349 | # :command.usage_fixed_flags |
|
1349 | # :command.usage_fixed_flags | |
1350 | printf " %s\n" "--help, -h" |
|
1350 | printf " %s\n" "--help, -h" | |
1351 | printf " Show this help\n" |
|
1351 | printf " Show this help\n" | |
1352 | echo |
|
1352 | echo | |
1353 |
|
1353 | |||
1354 | fi |
|
1354 | fi | |
1355 | } |
|
1355 | } | |
1356 |
|
1356 | |||
1357 | # :command.usage |
|
1357 | # :command.usage | |
1358 | rcstack_cli_storage_usage() { |
|
1358 | rcstack_cli_storage_usage() { | |
1359 | if [[ -n $long_usage ]]; then |
|
1359 | if [[ -n $long_usage ]]; then | |
1360 | 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" |
|
1360 | 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" | |
1361 | echo |
|
1361 | echo | |
1362 |
|
1362 | |||
1363 | else |
|
1363 | else | |
1364 | 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" |
|
1364 | 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" | |
1365 | echo |
|
1365 | echo | |
1366 |
|
1366 | |||
1367 | fi |
|
1367 | fi | |
1368 |
|
1368 | |||
1369 | printf "%s\n" "Usage:" |
|
1369 | printf "%s\n" "Usage:" | |
1370 | printf " rcstack cli storage [OPTIONS]\n" |
|
1370 | printf " rcstack cli storage [OPTIONS]\n" | |
1371 | printf " rcstack cli storage --help | -h\n" |
|
1371 | printf " rcstack cli storage --help | -h\n" | |
1372 | echo |
|
1372 | echo | |
1373 |
|
1373 | |||
1374 | # :command.long_usage |
|
1374 | # :command.long_usage | |
1375 | if [[ -n $long_usage ]]; then |
|
1375 | if [[ -n $long_usage ]]; then | |
1376 | printf "%s\n" "Options:" |
|
1376 | printf "%s\n" "Options:" | |
1377 |
|
1377 | |||
1378 | # :command.usage_flags |
|
1378 | # :command.usage_flags | |
1379 | # :flag.usage |
|
1379 | # :flag.usage | |
1380 | printf " %s\n" "--no-tty" |
|
1380 | printf " %s\n" "--no-tty" | |
1381 | printf " when running docker command don't attach to TTY. Useful for running a script\n out of shell context, e.g crontab\n" |
|
1381 | printf " when running docker command don't attach to TTY. Useful for running a script\n out of shell context, e.g crontab\n" | |
1382 | echo |
|
1382 | echo | |
1383 |
|
1383 | |||
1384 | # :flag.usage |
|
1384 | # :flag.usage | |
1385 | printf " %s\n" "--attached ATTACHED" |
|
1385 | printf " %s\n" "--attached ATTACHED" | |
1386 | printf " attach to storage of already running vcsserver container instead\n" |
|
1386 | printf " attach to storage of already running vcsserver container instead\n" | |
1387 | echo |
|
1387 | echo | |
1388 |
|
1388 | |||
1389 | # :command.usage_fixed_flags |
|
1389 | # :command.usage_fixed_flags | |
1390 | printf " %s\n" "--help, -h" |
|
1390 | printf " %s\n" "--help, -h" | |
1391 | printf " Show this help\n" |
|
1391 | printf " Show this help\n" | |
1392 | echo |
|
1392 | echo | |
1393 |
|
1393 | |||
1394 | fi |
|
1394 | fi | |
1395 | } |
|
1395 | } | |
1396 |
|
1396 | |||
1397 | # :command.usage |
|
1397 | # :command.usage | |
1398 | rcstack_cli_attach_usage() { |
|
1398 | rcstack_cli_attach_usage() { | |
1399 | if [[ -n $long_usage ]]; then |
|
1399 | if [[ -n $long_usage ]]; then | |
1400 | printf "rcstack cli attach - attach to running instance of RhodeCode, by default it attaches to rhodecode main web app\n" |
|
1400 | printf "rcstack cli attach - attach to running instance of RhodeCode, by default it attaches to rhodecode main web app\n" | |
1401 | echo |
|
1401 | echo | |
1402 |
|
1402 | |||
1403 | else |
|
1403 | else | |
1404 | printf "rcstack cli attach - attach to running instance of RhodeCode, by default it attaches to rhodecode main web app\n" |
|
1404 | printf "rcstack cli attach - attach to running instance of RhodeCode, by default it attaches to rhodecode main web app\n" | |
1405 | echo |
|
1405 | echo | |
1406 |
|
1406 | |||
1407 | fi |
|
1407 | fi | |
1408 |
|
1408 | |||
1409 | printf "%s\n" "Usage:" |
|
1409 | printf "%s\n" "Usage:" | |
1410 | printf " rcstack cli attach [OPTIONS]\n" |
|
1410 | printf " rcstack cli attach [OPTIONS]\n" | |
1411 | printf " rcstack cli attach --help | -h\n" |
|
1411 | printf " rcstack cli attach --help | -h\n" | |
1412 | echo |
|
1412 | echo | |
1413 |
|
1413 | |||
1414 | # :command.long_usage |
|
1414 | # :command.long_usage | |
1415 | if [[ -n $long_usage ]]; then |
|
1415 | if [[ -n $long_usage ]]; then | |
1416 | printf "%s\n" "Options:" |
|
1416 | printf "%s\n" "Options:" | |
1417 |
|
1417 | |||
1418 | # :command.usage_flags |
|
1418 | # :command.usage_flags | |
1419 | # :flag.usage |
|
1419 | # :flag.usage | |
1420 | printf " %s\n" "--no-tty" |
|
1420 | printf " %s\n" "--no-tty" | |
1421 | printf " when running docker command don't attach to TTY. Useful for running a script\n out of shell context, e.g crontab\n" |
|
1421 | printf " when running docker command don't attach to TTY. Useful for running a script\n out of shell context, e.g crontab\n" | |
1422 | echo |
|
1422 | echo | |
1423 |
|
1423 | |||
1424 | # :flag.usage |
|
1424 | # :flag.usage | |
1425 | printf " %s\n" "--instance-type INSTANCE_TYPE" |
|
1425 | printf " %s\n" "--instance-type INSTANCE_TYPE" | |
1426 | printf " type of instance to attach to\n" |
|
1426 | printf " type of instance to attach to\n" | |
1427 | printf " Default: rhodecode\n" |
|
1427 | printf " Default: rhodecode\n" | |
1428 | echo |
|
1428 | echo | |
1429 |
|
1429 | |||
1430 | # :command.usage_fixed_flags |
|
1430 | # :command.usage_fixed_flags | |
1431 | printf " %s\n" "--help, -h" |
|
1431 | printf " %s\n" "--help, -h" | |
1432 | printf " Show this help\n" |
|
1432 | printf " Show this help\n" | |
1433 | echo |
|
1433 | echo | |
1434 |
|
1434 | |||
1435 | # :command.usage_examples |
|
1435 | # :command.usage_examples | |
1436 | printf "%s\n" "Examples:" |
|
1436 | printf "%s\n" "Examples:" | |
1437 | 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" |
|
1437 | 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" | |
1438 | echo |
|
1438 | echo | |
1439 |
|
1439 | |||
1440 | fi |
|
1440 | fi | |
1441 | } |
|
1441 | } | |
1442 |
|
1442 | |||
1443 | # :command.usage |
|
1443 | # :command.usage | |
1444 | rcstack_cli_set_edition_usage() { |
|
1444 | rcstack_cli_set_edition_usage() { | |
1445 | if [[ -n $long_usage ]]; then |
|
1445 | if [[ -n $long_usage ]]; then | |
1446 | printf "rcstack cli set-edition - set current setup to either CE (Community) or EE (Enterprise) type\n" |
|
1446 | printf "rcstack cli set-edition - set current setup to either CE (Community) or EE (Enterprise) type\n" | |
1447 | echo |
|
1447 | echo | |
1448 |
|
1448 | |||
1449 | else |
|
1449 | else | |
1450 | printf "rcstack cli set-edition - set current setup to either CE (Community) or EE (Enterprise) type\n" |
|
1450 | printf "rcstack cli set-edition - set current setup to either CE (Community) or EE (Enterprise) type\n" | |
1451 | echo |
|
1451 | echo | |
1452 |
|
1452 | |||
1453 | fi |
|
1453 | fi | |
1454 |
|
1454 | |||
1455 | printf "%s\n" "Usage:" |
|
1455 | printf "%s\n" "Usage:" | |
1456 | printf " rcstack cli set-edition EDITION_TYPE\n" |
|
1456 | printf " rcstack cli set-edition EDITION_TYPE\n" | |
1457 | printf " rcstack cli set-edition --help | -h\n" |
|
1457 | printf " rcstack cli set-edition --help | -h\n" | |
1458 | echo |
|
1458 | echo | |
1459 |
|
1459 | |||
1460 | # :command.long_usage |
|
1460 | # :command.long_usage | |
1461 | if [[ -n $long_usage ]]; then |
|
1461 | if [[ -n $long_usage ]]; then | |
1462 | printf "%s\n" "Options:" |
|
1462 | printf "%s\n" "Options:" | |
1463 |
|
1463 | |||
1464 | # :command.usage_fixed_flags |
|
1464 | # :command.usage_fixed_flags | |
1465 | printf " %s\n" "--help, -h" |
|
1465 | printf " %s\n" "--help, -h" | |
1466 | printf " Show this help\n" |
|
1466 | printf " Show this help\n" | |
1467 | echo |
|
1467 | echo | |
1468 |
|
1468 | |||
1469 | # :command.usage_args |
|
1469 | # :command.usage_args | |
1470 | printf "%s\n" "Arguments:" |
|
1470 | printf "%s\n" "Arguments:" | |
1471 |
|
1471 | |||
1472 | # :argument.usage |
|
1472 | # :argument.usage | |
1473 | printf " %s\n" "EDITION_TYPE" |
|
1473 | printf " %s\n" "EDITION_TYPE" | |
1474 | printf " pick type CE or EE\n" |
|
1474 | printf " pick type CE or EE\n" | |
1475 | printf " Allowed: ce, ee\n" |
|
1475 | printf " Allowed: ce, ee\n" | |
1476 | echo |
|
1476 | echo | |
1477 |
|
1477 | |||
1478 | # :command.usage_examples |
|
1478 | # :command.usage_examples | |
1479 | printf "%s\n" "Examples:" |
|
1479 | printf "%s\n" "Examples:" | |
1480 | printf " ./rcstack set-edition ce\n" |
|
1480 | printf " ./rcstack set-edition ce\n" | |
1481 | printf " ./rcstack set-edition ee\n" |
|
1481 | printf " ./rcstack set-edition ee\n" | |
1482 | echo |
|
1482 | echo | |
1483 |
|
1483 | |||
1484 | fi |
|
1484 | fi | |
1485 | } |
|
1485 | } | |
1486 |
|
1486 | |||
1487 | # :command.usage |
|
1487 | # :command.usage | |
1488 | rcstack_cli_configure_vcsserver_usage() { |
|
1488 | rcstack_cli_configure_vcsserver_usage() { | |
1489 | if [[ -n $long_usage ]]; then |
|
1489 | if [[ -n $long_usage ]]; then | |
1490 | printf "rcstack cli configure-vcsserver - reconfigure the vcsserver.ini file\n" |
|
1490 | printf "rcstack cli configure-vcsserver - reconfigure the vcsserver.ini file\n" | |
1491 | echo |
|
1491 | echo | |
1492 |
|
1492 | |||
1493 | else |
|
1493 | else | |
1494 | printf "rcstack cli configure-vcsserver - reconfigure the vcsserver.ini file\n" |
|
1494 | printf "rcstack cli configure-vcsserver - reconfigure the vcsserver.ini file\n" | |
1495 | echo |
|
1495 | echo | |
1496 |
|
1496 | |||
1497 | fi |
|
1497 | fi | |
1498 |
|
1498 | |||
1499 | printf "%s\n" "Usage:" |
|
1499 | printf "%s\n" "Usage:" | |
1500 | printf " rcstack cli configure-vcsserver INI_PATH\n" |
|
1500 | printf " rcstack cli configure-vcsserver INI_PATH\n" | |
1501 | printf " rcstack cli configure-vcsserver --help | -h\n" |
|
1501 | printf " rcstack cli configure-vcsserver --help | -h\n" | |
1502 | echo |
|
1502 | echo | |
1503 |
|
1503 | |||
1504 | # :command.long_usage |
|
1504 | # :command.long_usage | |
1505 | if [[ -n $long_usage ]]; then |
|
1505 | if [[ -n $long_usage ]]; then | |
1506 | printf "%s\n" "Options:" |
|
1506 | printf "%s\n" "Options:" | |
1507 |
|
1507 | |||
1508 | # :command.usage_fixed_flags |
|
1508 | # :command.usage_fixed_flags | |
1509 | printf " %s\n" "--help, -h" |
|
1509 | printf " %s\n" "--help, -h" | |
1510 | printf " Show this help\n" |
|
1510 | printf " Show this help\n" | |
1511 | echo |
|
1511 | echo | |
1512 |
|
1512 | |||
1513 | # :command.usage_args |
|
1513 | # :command.usage_args | |
1514 | printf "%s\n" "Arguments:" |
|
1514 | printf "%s\n" "Arguments:" | |
1515 |
|
1515 | |||
1516 | # :argument.usage |
|
1516 | # :argument.usage | |
1517 | printf " %s\n" "INI_PATH" |
|
1517 | printf " %s\n" "INI_PATH" | |
1518 | printf " Path to vcsserver.ini to reconfigure\n" |
|
1518 | printf " Path to vcsserver.ini to reconfigure\n" | |
1519 | echo |
|
1519 | echo | |
1520 |
|
1520 | |||
1521 | # :command.usage_examples |
|
1521 | # :command.usage_examples | |
1522 | printf "%s\n" "Examples:" |
|
1522 | printf "%s\n" "Examples:" | |
1523 | printf " ./rcstack cli configure-vcs config/_shared/vcsserver.ini\n" |
|
1523 | printf " ./rcstack cli configure-vcs config/_shared/vcsserver.ini\n" | |
1524 | echo |
|
1524 | echo | |
1525 |
|
1525 | |||
1526 | fi |
|
1526 | fi | |
1527 | } |
|
1527 | } | |
1528 |
|
1528 | |||
1529 | # :command.usage |
|
1529 | # :command.usage | |
1530 | rcstack_cli_configure_rhodecode_usage() { |
|
1530 | rcstack_cli_configure_rhodecode_usage() { | |
1531 | if [[ -n $long_usage ]]; then |
|
1531 | if [[ -n $long_usage ]]; then | |
1532 | printf "rcstack cli configure-rhodecode - reconfigure the rhodecode.ini file\n" |
|
1532 | printf "rcstack cli configure-rhodecode - reconfigure the rhodecode.ini file\n" | |
1533 | echo |
|
1533 | echo | |
1534 |
|
1534 | |||
1535 | else |
|
1535 | else | |
1536 | printf "rcstack cli configure-rhodecode - reconfigure the rhodecode.ini file\n" |
|
1536 | printf "rcstack cli configure-rhodecode - reconfigure the rhodecode.ini file\n" | |
1537 | echo |
|
1537 | echo | |
1538 |
|
1538 | |||
1539 | fi |
|
1539 | fi | |
1540 |
|
1540 | |||
1541 | printf "%s\n" "Usage:" |
|
1541 | printf "%s\n" "Usage:" | |
1542 | printf " rcstack cli configure-rhodecode INI_PATH\n" |
|
1542 | printf " rcstack cli configure-rhodecode INI_PATH\n" | |
1543 | printf " rcstack cli configure-rhodecode --help | -h\n" |
|
1543 | printf " rcstack cli configure-rhodecode --help | -h\n" | |
1544 | echo |
|
1544 | echo | |
1545 |
|
1545 | |||
1546 | # :command.long_usage |
|
1546 | # :command.long_usage | |
1547 | if [[ -n $long_usage ]]; then |
|
1547 | if [[ -n $long_usage ]]; then | |
1548 | printf "%s\n" "Options:" |
|
1548 | printf "%s\n" "Options:" | |
1549 |
|
1549 | |||
1550 | # :command.usage_fixed_flags |
|
1550 | # :command.usage_fixed_flags | |
1551 | printf " %s\n" "--help, -h" |
|
1551 | printf " %s\n" "--help, -h" | |
1552 | printf " Show this help\n" |
|
1552 | printf " Show this help\n" | |
1553 | echo |
|
1553 | echo | |
1554 |
|
1554 | |||
1555 | # :command.usage_args |
|
1555 | # :command.usage_args | |
1556 | printf "%s\n" "Arguments:" |
|
1556 | printf "%s\n" "Arguments:" | |
1557 |
|
1557 | |||
1558 | # :argument.usage |
|
1558 | # :argument.usage | |
1559 | printf " %s\n" "INI_PATH" |
|
1559 | printf " %s\n" "INI_PATH" | |
1560 | printf " Path to rhodecode.ini to reconfigure\n" |
|
1560 | printf " Path to rhodecode.ini to reconfigure\n" | |
1561 | echo |
|
1561 | echo | |
1562 |
|
1562 | |||
1563 | # :command.usage_examples |
|
1563 | # :command.usage_examples | |
1564 | printf "%s\n" "Examples:" |
|
1564 | printf "%s\n" "Examples:" | |
1565 | printf " ./rcstack cli configure-rhodecode config/_shared/rhodecode.ini\n" |
|
1565 | printf " ./rcstack cli configure-rhodecode config/_shared/rhodecode.ini\n" | |
1566 | echo |
|
1566 | echo | |
1567 |
|
1567 | |||
1568 | fi |
|
1568 | fi | |
1569 | } |
|
1569 | } | |
1570 |
|
1570 | |||
1571 | # :command.usage |
|
1571 | # :command.usage | |
1572 | rcstack_backup_db_usage() { |
|
1572 | rcstack_backup_db_usage() { | |
1573 | if [[ -n $long_usage ]]; then |
|
1573 | if [[ -n $long_usage ]]; then | |
1574 | printf "rcstack backup-db - Backup Database\n" |
|
1574 | printf "rcstack backup-db - Backup Database\n" | |
1575 | echo |
|
1575 | echo | |
1576 |
|
1576 | |||
1577 | else |
|
1577 | else | |
1578 | printf "rcstack backup-db - Backup Database\n" |
|
1578 | printf "rcstack backup-db - Backup Database\n" | |
1579 | echo |
|
1579 | echo | |
1580 |
|
1580 | |||
1581 | fi |
|
1581 | fi | |
1582 |
|
1582 | |||
1583 | printf "%s\n" "Usage:" |
|
1583 | printf "%s\n" "Usage:" | |
1584 | printf " rcstack backup-db DESTINATION\n" |
|
1584 | printf " rcstack backup-db DESTINATION\n" | |
1585 | printf " rcstack backup-db --help | -h\n" |
|
1585 | printf " rcstack backup-db --help | -h\n" | |
1586 | echo |
|
1586 | echo | |
1587 |
|
1587 | |||
1588 | # :command.long_usage |
|
1588 | # :command.long_usage | |
1589 | if [[ -n $long_usage ]]; then |
|
1589 | if [[ -n $long_usage ]]; then | |
1590 | printf "%s\n" "Options:" |
|
1590 | printf "%s\n" "Options:" | |
1591 |
|
1591 | |||
1592 | # :command.usage_fixed_flags |
|
1592 | # :command.usage_fixed_flags | |
1593 | printf " %s\n" "--help, -h" |
|
1593 | printf " %s\n" "--help, -h" | |
1594 | printf " Show this help\n" |
|
1594 | printf " Show this help\n" | |
1595 | echo |
|
1595 | echo | |
1596 |
|
1596 | |||
1597 | # :command.usage_args |
|
1597 | # :command.usage_args | |
1598 | printf "%s\n" "Arguments:" |
|
1598 | printf "%s\n" "Arguments:" | |
1599 |
|
1599 | |||
1600 | # :argument.usage |
|
1600 | # :argument.usage | |
1601 | printf " %s\n" "DESTINATION" |
|
1601 | printf " %s\n" "DESTINATION" | |
1602 | printf " Destination directory to store backup archive\n" |
|
1602 | printf " Destination directory to store backup archive\n" | |
1603 | echo |
|
1603 | echo | |
1604 |
|
1604 | |||
1605 | # :command.usage_examples |
|
1605 | # :command.usage_examples | |
1606 | printf "%s\n" "Examples:" |
|
1606 | printf "%s\n" "Examples:" | |
1607 | 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" |
|
1607 | 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" | |
1608 | echo |
|
1608 | echo | |
1609 |
|
1609 | |||
1610 | fi |
|
1610 | fi | |
1611 | } |
|
1611 | } | |
1612 |
|
1612 | |||
1613 | # :command.usage |
|
1613 | # :command.usage | |
1614 | rcstack_backup_data_usage() { |
|
1614 | rcstack_backup_data_usage() { | |
1615 | if [[ -n $long_usage ]]; then |
|
1615 | if [[ -n $long_usage ]]; then | |
1616 | printf "rcstack backup-data - Backup RhodeCode storage\n" |
|
1616 | printf "rcstack backup-data - Backup RhodeCode storage\n" | |
1617 | echo |
|
1617 | echo | |
1618 |
|
1618 | |||
1619 | else |
|
1619 | else | |
1620 | printf "rcstack backup-data - Backup RhodeCode storage\n" |
|
1620 | printf "rcstack backup-data - Backup RhodeCode storage\n" | |
1621 | echo |
|
1621 | echo | |
1622 |
|
1622 | |||
1623 | fi |
|
1623 | fi | |
1624 |
|
1624 | |||
1625 | printf "%s\n" "Usage:" |
|
1625 | printf "%s\n" "Usage:" | |
1626 | printf " rcstack backup-data DESTINATION\n" |
|
1626 | printf " rcstack backup-data DESTINATION\n" | |
1627 | printf " rcstack backup-data --help | -h\n" |
|
1627 | printf " rcstack backup-data --help | -h\n" | |
1628 | echo |
|
1628 | echo | |
1629 |
|
1629 | |||
1630 | # :command.long_usage |
|
1630 | # :command.long_usage | |
1631 | if [[ -n $long_usage ]]; then |
|
1631 | if [[ -n $long_usage ]]; then | |
1632 | printf "%s\n" "Options:" |
|
1632 | printf "%s\n" "Options:" | |
1633 |
|
1633 | |||
1634 | # :command.usage_fixed_flags |
|
1634 | # :command.usage_fixed_flags | |
1635 | printf " %s\n" "--help, -h" |
|
1635 | printf " %s\n" "--help, -h" | |
1636 | printf " Show this help\n" |
|
1636 | printf " Show this help\n" | |
1637 | echo |
|
1637 | echo | |
1638 |
|
1638 | |||
1639 | # :command.usage_args |
|
1639 | # :command.usage_args | |
1640 | printf "%s\n" "Arguments:" |
|
1640 | printf "%s\n" "Arguments:" | |
1641 |
|
1641 | |||
1642 | # :argument.usage |
|
1642 | # :argument.usage | |
1643 | printf " %s\n" "DESTINATION" |
|
1643 | printf " %s\n" "DESTINATION" | |
1644 | printf " Destination directory to store backup archive\n" |
|
1644 | printf " Destination directory to store backup archive\n" | |
1645 | echo |
|
1645 | echo | |
1646 |
|
1646 | |||
1647 | # :command.usage_examples |
|
1647 | # :command.usage_examples | |
1648 | printf "%s\n" "Examples:" |
|
1648 | printf "%s\n" "Examples:" | |
1649 | printf " # make backup gz compressed for rhodecode containers, and all volumes\n - ./rcstack backup-data /home/my-data-backup\n" |
|
1649 | printf " # make backup gz compressed for rhodecode containers, and all volumes\n - ./rcstack backup-data /home/my-data-backup\n" | |
1650 | echo |
|
1650 | echo | |
1651 |
|
1651 | |||
1652 | fi |
|
1652 | fi | |
1653 | } |
|
1653 | } | |
1654 |
|
1654 | |||
1655 | # :command.usage |
|
1655 | # :command.usage | |
1656 | rcstack__completions_usage() { |
|
1656 | rcstack__completions_usage() { | |
1657 | if [[ -n $long_usage ]]; then |
|
1657 | if [[ -n $long_usage ]]; then | |
1658 | printf "rcstack _completions - Generate completions\n" |
|
1658 | printf "rcstack _completions - Generate completions\n" | |
1659 | echo |
|
1659 | echo | |
1660 |
|
1660 | |||
1661 | else |
|
1661 | else | |
1662 | printf "rcstack _completions - Generate completions\n" |
|
1662 | printf "rcstack _completions - Generate completions\n" | |
1663 | echo |
|
1663 | echo | |
1664 |
|
1664 | |||
1665 | fi |
|
1665 | fi | |
1666 |
|
1666 | |||
1667 | printf "%s\n" "Usage:" |
|
1667 | printf "%s\n" "Usage:" | |
1668 | printf " rcstack _completions\n" |
|
1668 | printf " rcstack _completions\n" | |
1669 | printf " rcstack _completions --help | -h\n" |
|
1669 | printf " rcstack _completions --help | -h\n" | |
1670 | echo |
|
1670 | echo | |
1671 |
|
1671 | |||
1672 | # :command.long_usage |
|
1672 | # :command.long_usage | |
1673 | if [[ -n $long_usage ]]; then |
|
1673 | if [[ -n $long_usage ]]; then | |
1674 | printf "%s\n" "Options:" |
|
1674 | printf "%s\n" "Options:" | |
1675 |
|
1675 | |||
1676 | # :command.usage_fixed_flags |
|
1676 | # :command.usage_fixed_flags | |
1677 | printf " %s\n" "--help, -h" |
|
1677 | printf " %s\n" "--help, -h" | |
1678 | printf " Show this help\n" |
|
1678 | printf " Show this help\n" | |
1679 | echo |
|
1679 | echo | |
1680 |
|
1680 | |||
1681 | fi |
|
1681 | fi | |
1682 | } |
|
1682 | } | |
1683 |
|
1683 | |||
1684 | # :command.normalize_input |
|
1684 | # :command.normalize_input | |
1685 | normalize_input() { |
|
1685 | normalize_input() { | |
1686 | local arg flags |
|
1686 | local arg flags | |
1687 |
|
1687 | |||
1688 | while [[ $# -gt 0 ]]; do |
|
1688 | while [[ $# -gt 0 ]]; do | |
1689 | arg="$1" |
|
1689 | arg="$1" | |
1690 | if [[ $arg =~ ^(--[a-zA-Z0-9_\-]+)=(.+)$ ]]; then |
|
1690 | if [[ $arg =~ ^(--[a-zA-Z0-9_\-]+)=(.+)$ ]]; then | |
1691 | input+=("${BASH_REMATCH[1]}") |
|
1691 | input+=("${BASH_REMATCH[1]}") | |
1692 | input+=("${BASH_REMATCH[2]}") |
|
1692 | input+=("${BASH_REMATCH[2]}") | |
1693 | elif [[ $arg =~ ^(-[a-zA-Z0-9])=(.+)$ ]]; then |
|
1693 | elif [[ $arg =~ ^(-[a-zA-Z0-9])=(.+)$ ]]; then | |
1694 | input+=("${BASH_REMATCH[1]}") |
|
1694 | input+=("${BASH_REMATCH[1]}") | |
1695 | input+=("${BASH_REMATCH[2]}") |
|
1695 | input+=("${BASH_REMATCH[2]}") | |
1696 | elif [[ $arg =~ ^-([a-zA-Z0-9][a-zA-Z0-9]+)$ ]]; then |
|
1696 | elif [[ $arg =~ ^-([a-zA-Z0-9][a-zA-Z0-9]+)$ ]]; then | |
1697 | flags="${BASH_REMATCH[1]}" |
|
1697 | flags="${BASH_REMATCH[1]}" | |
1698 | for ((i = 0; i < ${#flags}; i++)); do |
|
1698 | for ((i = 0; i < ${#flags}; i++)); do | |
1699 | input+=("-${flags:i:1}") |
|
1699 | input+=("-${flags:i:1}") | |
1700 | done |
|
1700 | done | |
1701 | else |
|
1701 | else | |
1702 | input+=("$arg") |
|
1702 | input+=("$arg") | |
1703 | fi |
|
1703 | fi | |
1704 |
|
1704 | |||
1705 | shift |
|
1705 | shift | |
1706 | done |
|
1706 | done | |
1707 | } |
|
1707 | } | |
1708 | # :command.inspect_args |
|
1708 | # :command.inspect_args | |
1709 | inspect_args() { |
|
1709 | inspect_args() { | |
1710 | if ((${#args[@]})); then |
|
1710 | if ((${#args[@]})); then | |
1711 | readarray -t sorted_keys < <(printf '%s\n' "${!args[@]}" | sort) |
|
1711 | readarray -t sorted_keys < <(printf '%s\n' "${!args[@]}" | sort) | |
1712 | echo args: |
|
1712 | echo args: | |
1713 | for k in "${sorted_keys[@]}"; do echo "- \${args[$k]} = ${args[$k]}"; done |
|
1713 | for k in "${sorted_keys[@]}"; do echo "- \${args[$k]} = ${args[$k]}"; done | |
1714 | else |
|
1714 | else | |
1715 | echo args: none |
|
1715 | echo args: none | |
1716 | fi |
|
1716 | fi | |
1717 |
|
1717 | |||
1718 | if ((${#other_args[@]})); then |
|
1718 | if ((${#other_args[@]})); then | |
1719 | echo |
|
1719 | echo | |
1720 | echo other_args: |
|
1720 | echo other_args: | |
1721 | echo "- \${other_args[*]} = ${other_args[*]}" |
|
1721 | echo "- \${other_args[*]} = ${other_args[*]}" | |
1722 | for i in "${!other_args[@]}"; do |
|
1722 | for i in "${!other_args[@]}"; do | |
1723 | echo "- \${other_args[$i]} = ${other_args[$i]}" |
|
1723 | echo "- \${other_args[$i]} = ${other_args[$i]}" | |
1724 | done |
|
1724 | done | |
1725 | fi |
|
1725 | fi | |
1726 |
|
1726 | |||
1727 | if ((${#deps[@]})); then |
|
1727 | if ((${#deps[@]})); then | |
1728 | readarray -t sorted_keys < <(printf '%s\n' "${!deps[@]}" | sort) |
|
1728 | readarray -t sorted_keys < <(printf '%s\n' "${!deps[@]}" | sort) | |
1729 | echo |
|
1729 | echo | |
1730 | echo deps: |
|
1730 | echo deps: | |
1731 | for k in "${sorted_keys[@]}"; do echo "- \${deps[$k]} = ${deps[$k]}"; done |
|
1731 | for k in "${sorted_keys[@]}"; do echo "- \${deps[$k]} = ${deps[$k]}"; done | |
1732 | fi |
|
1732 | fi | |
1733 |
|
1733 | |||
1734 | } |
|
1734 | } | |
1735 |
|
1735 | |||
1736 | # :command.user_lib |
|
1736 | # :command.user_lib | |
1737 | # src/lib/check_bootstrap.sh |
|
1737 | # src/lib/check_bootstrap.sh | |
1738 |
|
1738 | |||
1739 | check_bootstrap() { |
|
1739 | check_bootstrap() { | |
1740 | # Avoid destroying bootstrapping by simple start/stop |
|
1740 | # Avoid destroying bootstrapping by simple start/stop | |
1741 | for stage_name in $BOOTSTRAP_STAGES; do |
|
1741 | for stage_name in $BOOTSTRAP_STAGES; do | |
1742 | if ! config_has_key $stage_name ; then |
|
1742 | if ! config_has_key $stage_name ; then | |
1743 | echo "$(yellow WARNING:) Bootstrap key $stage_name not found in config file $CONFIG_FILE!" |
|
1743 | echo "$(yellow WARNING:) Bootstrap key $stage_name not found in config file $CONFIG_FILE!" | |
1744 | echo "$(yellow NOTICE:) Run this first: ./$RC_SCRIPT_NAME init" |
|
1744 | echo "$(yellow NOTICE:) Run this first: ./$RC_SCRIPT_NAME init" | |
1745 | exit |
|
1745 | exit | |
1746 | fi |
|
1746 | fi | |
1747 | done |
|
1747 | done | |
1748 |
|
1748 | |||
1749 | } |
|
1749 | } | |
1750 |
|
1750 | |||
1751 | # src/lib/colors.sh |
|
1751 | # src/lib/colors.sh | |
1752 | print_in_color() { |
|
1752 | print_in_color() { | |
1753 | local color="$1" |
|
1753 | local color="$1" | |
1754 | shift |
|
1754 | shift | |
1755 | if [[ -z ${NO_COLOR+x} ]]; then |
|
1755 | if [[ -z ${NO_COLOR+x} ]]; then | |
1756 | printf "$color%b\e[0m\n" "$*" |
|
1756 | printf "$color%b\e[0m\n" "$*" | |
1757 | else |
|
1757 | else | |
1758 | printf "%b\n" "$*" |
|
1758 | printf "%b\n" "$*" | |
1759 | fi |
|
1759 | fi | |
1760 | } |
|
1760 | } | |
1761 |
|
1761 | |||
1762 | red() { print_in_color "\e[31m" "$*"; } |
|
1762 | red() { print_in_color "\e[31m" "$*"; } | |
1763 | green() { print_in_color "\e[32m" "$*"; } |
|
1763 | green() { print_in_color "\e[32m" "$*"; } | |
1764 | yellow() { print_in_color "\e[33m" "$*"; } |
|
1764 | yellow() { print_in_color "\e[33m" "$*"; } | |
1765 | blue() { print_in_color "\e[34m" "$*"; } |
|
1765 | blue() { print_in_color "\e[34m" "$*"; } | |
1766 | magenta() { print_in_color "\e[35m" "$*"; } |
|
1766 | magenta() { print_in_color "\e[35m" "$*"; } | |
1767 | cyan() { print_in_color "\e[36m" "$*"; } |
|
1767 | cyan() { print_in_color "\e[36m" "$*"; } | |
1768 | bold() { print_in_color "\e[1m" "$*"; } |
|
1768 | bold() { print_in_color "\e[1m" "$*"; } | |
1769 | underlined() { print_in_color "\e[4m" "$*"; } |
|
1769 | underlined() { print_in_color "\e[4m" "$*"; } | |
1770 | red_bold() { print_in_color "\e[1;31m" "$*"; } |
|
1770 | red_bold() { print_in_color "\e[1;31m" "$*"; } | |
1771 | green_bold() { print_in_color "\e[1;32m" "$*"; } |
|
1771 | green_bold() { print_in_color "\e[1;32m" "$*"; } | |
1772 | yellow_bold() { print_in_color "\e[1;33m" "$*"; } |
|
1772 | yellow_bold() { print_in_color "\e[1;33m" "$*"; } | |
1773 | blue_bold() { print_in_color "\e[1;34m" "$*"; } |
|
1773 | blue_bold() { print_in_color "\e[1;34m" "$*"; } | |
1774 | magenta_bold() { print_in_color "\e[1;35m" "$*"; } |
|
1774 | magenta_bold() { print_in_color "\e[1;35m" "$*"; } | |
1775 | cyan_bold() { print_in_color "\e[1;36m" "$*"; } |
|
1775 | cyan_bold() { print_in_color "\e[1;36m" "$*"; } | |
1776 | red_underlined() { print_in_color "\e[4;31m" "$*"; } |
|
1776 | red_underlined() { print_in_color "\e[4;31m" "$*"; } | |
1777 | green_underlined() { print_in_color "\e[4;32m" "$*"; } |
|
1777 | green_underlined() { print_in_color "\e[4;32m" "$*"; } | |
1778 | yellow_underlined() { print_in_color "\e[4;33m" "$*"; } |
|
1778 | yellow_underlined() { print_in_color "\e[4;33m" "$*"; } | |
1779 | blue_underlined() { print_in_color "\e[4;34m" "$*"; } |
|
1779 | blue_underlined() { print_in_color "\e[4;34m" "$*"; } | |
1780 | magenta_underlined() { print_in_color "\e[4;35m" "$*"; } |
|
1780 | magenta_underlined() { print_in_color "\e[4;35m" "$*"; } | |
1781 | cyan_underlined() { print_in_color "\e[4;36m" "$*"; } |
|
1781 | cyan_underlined() { print_in_color "\e[4;36m" "$*"; } | |
1782 |
|
1782 | |||
1783 | # src/lib/config.sh |
|
1783 | # src/lib/config.sh | |
1784 |
|
1784 | |||
1785 | config_show() { |
|
1785 | config_show() { | |
1786 | config_load |
|
1786 | config_load | |
1787 | ini_show |
|
1787 | ini_show | |
1788 | } |
|
1788 | } | |
1789 |
|
1789 | |||
1790 | config_get() { |
|
1790 | config_get() { | |
1791 | local key="$1" |
|
1791 | local key="$1" | |
1792 | local default_value="$2" |
|
1792 | local default_value="$2" | |
1793 |
|
1793 | |||
1794 | config_load |
|
1794 | config_load | |
1795 | echo "${ini["$key"]:-$default_value}" |
|
1795 | echo "${ini["$key"]:-$default_value}" | |
1796 | } |
|
1796 | } | |
1797 |
|
1797 | |||
1798 | config_set() { |
|
1798 | config_set() { | |
1799 | local key="$1" |
|
1799 | local key="$1" | |
1800 | shift |
|
1800 | shift | |
1801 | local value="$*" |
|
1801 | local value="$*" | |
1802 |
|
1802 | |||
1803 | config_load |
|
1803 | config_load | |
1804 | ini["$key"]="$value" |
|
1804 | ini["$key"]="$value" | |
1805 | config_save |
|
1805 | config_save | |
1806 | } |
|
1806 | } | |
1807 |
|
1807 | |||
1808 | config_del() { |
|
1808 | config_del() { | |
1809 | local key="$1" |
|
1809 | local key="$1" | |
1810 |
|
1810 | |||
1811 | config_load |
|
1811 | config_load | |
1812 | unset "ini[$key]" |
|
1812 | unset "ini[$key]" | |
1813 | config_save |
|
1813 | config_save | |
1814 | } |
|
1814 | } | |
1815 |
|
1815 | |||
1816 | config_keys() { |
|
1816 | config_keys() { | |
1817 | config_load |
|
1817 | config_load | |
1818 | ini_keys |
|
1818 | ini_keys | |
1819 | } |
|
1819 | } | |
1820 |
|
1820 | |||
1821 | config_has_key() { |
|
1821 | config_has_key() { | |
1822 | [[ $(config_get "$1") ]] |
|
1822 | [[ $(config_get "$1") ]] | |
1823 | } |
|
1823 | } | |
1824 |
|
1824 | |||
1825 | config_reload() { |
|
1825 | config_reload() { | |
1826 | declare -g config_loaded=false |
|
1826 | declare -g config_loaded=false | |
1827 | config_load |
|
1827 | config_load | |
1828 | } |
|
1828 | } | |
1829 |
|
1829 | |||
1830 | config_load() { |
|
1830 | config_load() { | |
1831 | [[ "$config_loaded" == "true" ]] && return |
|
1831 | [[ "$config_loaded" == "true" ]] && return | |
1832 |
|
1832 | |||
1833 | declare -g CONFIG_FILE=${CONFIG_FILE:=config.ini} |
|
1833 | declare -g CONFIG_FILE=${CONFIG_FILE:=config.ini} | |
1834 | declare -g config_loaded=true |
|
1834 | declare -g config_loaded=true | |
1835 | [[ -f "$CONFIG_FILE" ]] || touch "$CONFIG_FILE" |
|
1835 | [[ -f "$CONFIG_FILE" ]] || touch "$CONFIG_FILE" | |
1836 | ini_load "$CONFIG_FILE" |
|
1836 | ini_load "$CONFIG_FILE" | |
1837 | } |
|
1837 | } | |
1838 |
|
1838 | |||
1839 | config_save() { |
|
1839 | config_save() { | |
1840 | ini_save "$CONFIG_FILE" |
|
1840 | ini_save "$CONFIG_FILE" | |
1841 | } |
|
1841 | } | |
1842 |
|
1842 | |||
1843 | # src/lib/dotenv.sh |
|
1843 | # src/lib/dotenv.sh | |
1844 |
|
1844 | |||
1845 | __dotenv= |
|
1845 | __dotenv= | |
1846 | __dotenv_file= |
|
1846 | __dotenv_file= | |
1847 | __dotenv_cmd=.env |
|
1847 | __dotenv_cmd=.env | |
1848 |
|
1848 | |||
1849 | .env() { |
|
1849 | .env() { | |
1850 | REPLY=() |
|
1850 | REPLY=() | |
1851 | [[ $__dotenv_file || ${1-} == -* ]] || .env.--file .env || return |
|
1851 | [[ $__dotenv_file || ${1-} == -* ]] || .env.--file .env || return | |
1852 | if declare -F -- ".env.${1-}" >/dev/null; then .env."$@"; return ; fi |
|
1852 | if declare -F -- ".env.${1-}" >/dev/null; then .env."$@"; return ; fi | |
1853 | .env --help >&2; return 64 |
|
1853 | .env --help >&2; return 64 | |
1854 | } |
|
1854 | } | |
1855 |
|
1855 | |||
1856 | .env.-f() { .env.--file "$@"; } |
|
1856 | .env.-f() { .env.--file "$@"; } | |
1857 |
|
1857 | |||
1858 | .env.get() { |
|
1858 | .env.get() { | |
1859 | .env::arg "get requires a key" "$@" && |
|
1859 | .env::arg "get requires a key" "$@" && | |
1860 | [[ "$__dotenv" =~ ^(.*(^|$'\n'))([ ]*)"$1="(.*)$ ]] && |
|
1860 | [[ "$__dotenv" =~ ^(.*(^|$'\n'))([ ]*)"$1="(.*)$ ]] && | |
1861 | REPLY=${BASH_REMATCH[4]%%$'\n'*} && REPLY=${REPLY%"${REPLY##*[![:space:]]}"} |
|
1861 | REPLY=${BASH_REMATCH[4]%%$'\n'*} && REPLY=${REPLY%"${REPLY##*[![:space:]]}"} | |
1862 | } |
|
1862 | } | |
1863 |
|
1863 | |||
1864 | .env.get_or_error() { |
|
1864 | .env.get_or_error() { | |
1865 | .env.get "$@" || { echo "$(red ERROR required key $@ not set in $RUNTIME_ENV file)"; exit 1; } |
|
1865 | .env.get "$@" || { echo "$(red ERROR required key $@ not set in $RUNTIME_ENV file)"; exit 1; } | |
1866 | } |
|
1866 | } | |
1867 |
|
1867 | |||
1868 | .env.parse() { |
|
1868 | .env.parse() { | |
1869 | local line key |
|
1869 | local line key | |
1870 | while IFS= read -r line; do |
|
1870 | while IFS= read -r line; do | |
1871 | line=${line#"${line%%[![:space:]]*}"} # trim leading whitespace |
|
1871 | line=${line#"${line%%[![:space:]]*}"} # trim leading whitespace | |
1872 | line=${line%"${line##*[![:space:]]}"} # trim trailing whitespace |
|
1872 | line=${line%"${line##*[![:space:]]}"} # trim trailing whitespace | |
1873 | if [[ ! "$line" || "$line" == '#'* ]]; then continue ; fi |
|
1873 | if [[ ! "$line" || "$line" == '#'* ]]; then continue ; fi | |
1874 | if (($#)); then |
|
1874 | if (($#)); then | |
1875 | for key; do |
|
1875 | for key; do | |
1876 | if [[ $key == "${line%%=*}" ]]; then REPLY+=("$line"); break; |
|
1876 | if [[ $key == "${line%%=*}" ]]; then REPLY+=("$line"); break; | |
1877 | fi |
|
1877 | fi | |
1878 | done |
|
1878 | done | |
1879 | else |
|
1879 | else | |
1880 | REPLY+=("$line") |
|
1880 | REPLY+=("$line") | |
1881 | fi |
|
1881 | fi | |
1882 | done <<<"$__dotenv" |
|
1882 | done <<<"$__dotenv" | |
1883 | ((${#REPLY[@]})) |
|
1883 | ((${#REPLY[@]})) | |
1884 | } |
|
1884 | } | |
1885 |
|
1885 | |||
1886 | .env.export() { ! .env.parse "$@" || export "${REPLY[@]}"; } |
|
1886 | .env.export() { ! .env.parse "$@" || export "${REPLY[@]}"; } | |
1887 |
|
1887 | |||
1888 | .env.set() { |
|
1888 | .env.set() { | |
1889 | .env::file load || return ; local key saved=$__dotenv |
|
1889 | .env::file load || return ; local key saved=$__dotenv | |
1890 | while (($#)); do |
|
1890 | while (($#)); do | |
1891 | key=${1#+}; key=${key%%=*} |
|
1891 | key=${1#+}; key=${key%%=*} | |
1892 | if .env.get "$key"; then |
|
1892 | if .env.get "$key"; then | |
1893 | REPLY=() |
|
1893 | REPLY=() | |
1894 | if [[ $1 == +* ]]; then shift; continue # skip if already found |
|
1894 | if [[ $1 == +* ]]; then shift; continue # skip if already found | |
1895 | elif [[ $1 == *=* ]]; then |
|
1895 | elif [[ $1 == *=* ]]; then | |
1896 | __dotenv=${BASH_REMATCH[1]}${BASH_REMATCH[3]}$1$'\n'${BASH_REMATCH[4]#*$'\n'} |
|
1896 | __dotenv=${BASH_REMATCH[1]}${BASH_REMATCH[3]}$1$'\n'${BASH_REMATCH[4]#*$'\n'} | |
1897 | else |
|
1897 | else | |
1898 | __dotenv=${BASH_REMATCH[1]}${BASH_REMATCH[4]#*$'\n'} |
|
1898 | __dotenv=${BASH_REMATCH[1]}${BASH_REMATCH[4]#*$'\n'} | |
1899 | continue # delete all occurrences |
|
1899 | continue # delete all occurrences | |
1900 | fi |
|
1900 | fi | |
1901 | elif [[ $1 == *=* ]]; then |
|
1901 | elif [[ $1 == *=* ]]; then | |
1902 | __dotenv+="${1#+}"$'\n' |
|
1902 | __dotenv+="${1#+}"$'\n' | |
1903 | fi |
|
1903 | fi | |
1904 | shift |
|
1904 | shift | |
1905 | done |
|
1905 | done | |
1906 | [[ $__dotenv == "$saved" ]] || .env::file save |
|
1906 | [[ $__dotenv == "$saved" ]] || .env::file save | |
1907 | } |
|
1907 | } | |
1908 |
|
1908 | |||
1909 | .env.puts() { echo "${1-}">>"$__dotenv_file" && __dotenv+="$1"$'\n'; } |
|
1909 | .env.puts() { echo "${1-}">>"$__dotenv_file" && __dotenv+="$1"$'\n'; } | |
1910 |
|
1910 | |||
1911 | .env.generate() { |
|
1911 | .env.generate() { | |
1912 | .env::arg "key required for generate" "$@" || return |
|
1912 | .env::arg "key required for generate" "$@" || return | |
1913 | .env.get "$1" && return || REPLY=$("${@:2}") || return |
|
1913 | .env.get "$1" && return || REPLY=$("${@:2}") || return | |
1914 | .env::one "generate: ouptut of '${*:2}' has more than one line" "$REPLY" || return |
|
1914 | .env::one "generate: ouptut of '${*:2}' has more than one line" "$REPLY" || return | |
1915 | .env.puts "$1=$REPLY" |
|
1915 | .env.puts "$1=$REPLY" | |
1916 | } |
|
1916 | } | |
1917 |
|
1917 | |||
1918 | .env.--file() { |
|
1918 | .env.--file() { | |
1919 | .env::arg "filename required for --file" "$@" || return |
|
1919 | .env::arg "filename required for --file" "$@" || return | |
1920 | __dotenv_file=$1; .env::file load || return |
|
1920 | __dotenv_file=$1; .env::file load || return | |
1921 | (($#<2)) || .env "${@:2}" |
|
1921 | (($#<2)) || .env "${@:2}" | |
1922 | } |
|
1922 | } | |
1923 |
|
1923 | |||
1924 | .env::arg() { [[ "${2-}" ]] || { echo "$__dotenv_cmd: $1" >&2; return 64; }; } |
|
1924 | .env::arg() { [[ "${2-}" ]] || { echo "$__dotenv_cmd: $1" >&2; return 64; }; } | |
1925 |
|
1925 | |||
1926 | .env::one() { [[ "$2" != *$'\n'* ]] || .env::arg "$1"; } |
|
1926 | .env::one() { [[ "$2" != *$'\n'* ]] || .env::arg "$1"; } | |
1927 |
|
1927 | |||
1928 | .env::file() { |
|
1928 | .env::file() { | |
1929 | local REPLY=$__dotenv_file |
|
1929 | local REPLY=$__dotenv_file | |
1930 | case "$1" in |
|
1930 | case "$1" in | |
1931 | load) |
|
1931 | load) | |
1932 | __dotenv=; ! [[ -f "$REPLY" ]] || __dotenv="$(<"$REPLY")"$'\n' || return ;; |
|
1932 | __dotenv=; ! [[ -f "$REPLY" ]] || __dotenv="$(<"$REPLY")"$'\n' || return ;; | |
1933 | save) |
|
1933 | save) | |
1934 | if [[ -L "$REPLY" ]] && declare -F -- realpath.resolved >/dev/null; then |
|
1934 | if [[ -L "$REPLY" ]] && declare -F -- realpath.resolved >/dev/null; then | |
1935 | realpath.resolved "$REPLY" |
|
1935 | realpath.resolved "$REPLY" | |
1936 | fi |
|
1936 | fi | |
1937 | { [[ ! -f "$REPLY" ]] || cp -p "$REPLY" "$REPLY.bak"; } && |
|
1937 | { [[ ! -f "$REPLY" ]] || cp -p "$REPLY" "$REPLY.bak"; } && | |
1938 | printf %s "$__dotenv" >"$REPLY.bak" && cp -f "$REPLY.bak" "$REPLY" && rm -f "$REPLY.bak" |
|
1938 | printf %s "$__dotenv" >"$REPLY.bak" && cp -f "$REPLY.bak" "$REPLY" && rm -f "$REPLY.bak" | |
1939 | esac |
|
1939 | esac | |
1940 | } |
|
1940 | } | |
1941 |
|
1941 | |||
1942 | # |
|
1942 | # | |
1943 | #__dotenv() { |
|
1943 | #__dotenv() { | |
1944 | # set -eu |
|
1944 | # set -eu | |
1945 | # __dotenv_cmd=${0##*/} |
|
1945 | # __dotenv_cmd=${0##*/} | |
1946 | # .env.export() { .env.parse "$@" || return 0; printf 'export %q\n' "${REPLY[@]}"; REPLY=(); } |
|
1946 | # .env.export() { .env.parse "$@" || return 0; printf 'export %q\n' "${REPLY[@]}"; REPLY=(); } | |
1947 | # .env "$@" || return $? |
|
1947 | # .env "$@" || return $? | |
1948 | # ${REPLY[@]+printf '%s\n' "${REPLY[@]}"} |
|
1948 | # ${REPLY[@]+printf '%s\n' "${REPLY[@]}"} | |
1949 | #} |
|
1949 | #} | |
1950 | #if [[ $0 == "${BASH_SOURCE-}" ]]; then __dotenv "$@"; exit; fi |
|
1950 | #if [[ $0 == "${BASH_SOURCE-}" ]]; then __dotenv "$@"; exit; fi | |
1951 |
|
1951 | |||
1952 | # src/lib/get_docker_definitions.sh |
|
1952 | # src/lib/get_docker_definitions.sh | |
1953 |
|
1953 | |||
1954 | get_docker_definitions() { |
|
1954 | get_docker_definitions() { | |
1955 | SOURCE_DIR=$PWD |
|
1955 | SOURCE_DIR=$PWD | |
1956 | RHODECODE_DOCKER_HASH=$1 |
|
1956 | RHODECODE_DOCKER_HASH=$1 | |
1957 | FULL_MODE=$2 |
|
1957 | FULL_MODE=$2 | |
1958 | DEBUG=$3 |
|
1958 | DEBUG=$3 | |
1959 |
|
1959 | |||
1960 | final_archive_url="$SERVER_URL/$RHODECODE_DOCKER_HASH.tgz" |
|
1960 | final_archive_url="$SERVER_URL/$RHODECODE_DOCKER_HASH.tgz" | |
1961 | extracted_archive_dir="rhodecode-enterprise-docker-id-bacb-sub-0-archive-all" |
|
1961 | extracted_archive_dir="rhodecode-enterprise-docker-id-bacb-sub-0-archive-all" | |
1962 |
|
1962 | |||
1963 | # download sources |
|
1963 | # download sources | |
1964 | echo "bootstrap_definitions: download rhodecode docker definitions from: $final_archive_url" |
|
1964 | echo "bootstrap_definitions: download rhodecode docker definitions from: $final_archive_url" | |
1965 | echo "" |
|
1965 | echo "" | |
1966 |
|
1966 | |||
1967 | if [ $DEBUG ]; then |
|
1967 | if [ $DEBUG ]; then | |
1968 | echo "bootstrap_definitions: downloading: $SERVER_URL/$RHODECODE_DOCKER_HASH.tgz" |
|
1968 | echo "bootstrap_definitions: downloading: $SERVER_URL/$RHODECODE_DOCKER_HASH.tgz" | |
1969 | curl --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $final_archive_url | tar -xz -C "$SOURCE_DIR" |
|
1969 | curl --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $final_archive_url | tar -xz -C "$SOURCE_DIR" | |
1970 |
|
1970 | |||
1971 | echo "extracted archive to $SOURCE_DIR" |
|
1971 | echo "extracted archive to $SOURCE_DIR" | |
1972 | echo "bootstrap_definitions: running CP $SOURCE_DIR/$extracted_archive_dir/* $SOURCE_DIR" |
|
1972 | echo "bootstrap_definitions: running CP $SOURCE_DIR/$extracted_archive_dir/* $SOURCE_DIR" | |
1973 | cp -r -f -v $SOURCE_DIR/$extracted_archive_dir/* $SOURCE_DIR |
|
1973 | cp -r -f -v $SOURCE_DIR/$extracted_archive_dir/* $SOURCE_DIR | |
1974 |
|
1974 | |||
1975 | echo "bootstrap_definitions: removing $SOURCE_DIR/$extracted_archive_dir" |
|
1975 | echo "bootstrap_definitions: removing $SOURCE_DIR/$extracted_archive_dir" | |
1976 | rm -r "$SOURCE_DIR/$extracted_archive_dir" |
|
1976 | rm -r "$SOURCE_DIR/$extracted_archive_dir" | |
1977 | else |
|
1977 | else | |
1978 | curl -s --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $final_archive_url | tar -xz -C "$SOURCE_DIR" |
|
1978 | curl -s --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $final_archive_url | tar -xz -C "$SOURCE_DIR" | |
1979 |
|
1979 | |||
1980 | cp -r -f $SOURCE_DIR/$extracted_archive_dir/* $SOURCE_DIR |
|
1980 | cp -r -f $SOURCE_DIR/$extracted_archive_dir/* $SOURCE_DIR | |
1981 |
|
1981 | |||
1982 | rm -r "$SOURCE_DIR/$extracted_archive_dir" |
|
1982 | rm -r "$SOURCE_DIR/$extracted_archive_dir" | |
1983 | fi |
|
1983 | fi | |
1984 |
|
1984 | |||
1985 | echo "$(green bootstrap_definitions: docker definitions extracted to $SOURCE_DIR)" |
|
1985 | echo "$(green bootstrap_definitions: docker definitions extracted to $SOURCE_DIR)" | |
1986 |
|
1986 | |||
1987 | # cleanup of backup files, just good to have, ignore any warnings |
|
1987 | # cleanup of backup files, just good to have, ignore any warnings | |
1988 | # NOTE: Disabled for backward compat |
|
1988 | # NOTE: Disabled for backward compat | |
1989 | #find "$SOURCE_DIR" -nowarn -ignore_readdir_race -iname "*.~*~" -delete 2> /dev/null |
|
1989 | #find "$SOURCE_DIR" -nowarn -ignore_readdir_race -iname "*.~*~" -delete 2> /dev/null | |
1990 |
|
1990 | |||
1991 | # some cleanup of things we don't need in cli |
|
1991 | # some cleanup of things we don't need in cli | |
1992 | if [[ ! $FULL_MODE ]]; then |
|
1992 | if [[ ! $FULL_MODE ]]; then | |
1993 | rm dev-tools |
|
1993 | rm dev-tools | |
1994 | rm -r scripts/dev-tools |
|
1994 | rm -r scripts/dev-tools | |
1995 | rm -r entrypoints.d |
|
1995 | rm -r entrypoints.d | |
1996 | fi |
|
1996 | fi | |
1997 | } |
|
1997 | } | |
1998 |
|
1998 | |||
1999 | # src/lib/ini.sh |
|
1999 | # src/lib/ini.sh | |
2000 |
|
2000 | |||
2001 | ini_load() { |
|
2001 | ini_load() { | |
2002 | declare -gA ini |
|
2002 | declare -gA ini | |
2003 |
|
2003 | |||
2004 | local ini_file="$1" |
|
2004 | local ini_file="$1" | |
2005 |
|
2005 | |||
2006 | local section="" |
|
2006 | local section="" | |
2007 | local key="" |
|
2007 | local key="" | |
2008 | local value="" |
|
2008 | local value="" | |
2009 | local section_regex="^\[(.+)\]" |
|
2009 | local section_regex="^\[(.+)\]" | |
2010 | local key_regex="^([^ =]+) *= *(.*) *$" |
|
2010 | local key_regex="^([^ =]+) *= *(.*) *$" | |
2011 | local comment_regex="^;" |
|
2011 | local comment_regex="^;" | |
2012 |
|
2012 | |||
2013 | while IFS= read -r line; do |
|
2013 | while IFS= read -r line; do | |
2014 | if [[ $line =~ $comment_regex ]]; then |
|
2014 | if [[ $line =~ $comment_regex ]]; then | |
2015 | continue |
|
2015 | continue | |
2016 | elif [[ $line =~ $section_regex ]]; then |
|
2016 | elif [[ $line =~ $section_regex ]]; then | |
2017 | section="${BASH_REMATCH[1]}." |
|
2017 | section="${BASH_REMATCH[1]}." | |
2018 | elif [[ $line =~ $key_regex ]]; then |
|
2018 | elif [[ $line =~ $key_regex ]]; then | |
2019 | key="${BASH_REMATCH[1]}" |
|
2019 | key="${BASH_REMATCH[1]}" | |
2020 | value="${BASH_REMATCH[2]}" |
|
2020 | value="${BASH_REMATCH[2]}" | |
2021 | ini["${section}${key}"]="$value" |
|
2021 | ini["${section}${key}"]="$value" | |
2022 | fi |
|
2022 | fi | |
2023 | done <"$ini_file" |
|
2023 | done <"$ini_file" | |
2024 | } |
|
2024 | } | |
2025 |
|
2025 | |||
2026 | ini_save() { |
|
2026 | ini_save() { | |
2027 | declare -gA ini |
|
2027 | declare -gA ini | |
2028 |
|
2028 | |||
2029 | local ini_file="$1" |
|
2029 | local ini_file="$1" | |
2030 |
|
2030 | |||
2031 | local current_section="" |
|
2031 | local current_section="" | |
2032 | local has_free_keys=false |
|
2032 | local has_free_keys=false | |
2033 |
|
2033 | |||
2034 | rm -f "$ini_file" |
|
2034 | rm -f "$ini_file" | |
2035 |
|
2035 | |||
2036 | for key in $(ini_keys); do |
|
2036 | for key in $(ini_keys); do | |
2037 | [[ $key == *.* ]] && continue |
|
2037 | [[ $key == *.* ]] && continue | |
2038 | has_free_keys=true |
|
2038 | has_free_keys=true | |
2039 | value="${ini[$key]}" |
|
2039 | value="${ini[$key]}" | |
2040 | echo "$key = $value" >>"$ini_file" |
|
2040 | echo "$key = $value" >>"$ini_file" | |
2041 | done |
|
2041 | done | |
2042 |
|
2042 | |||
2043 | [[ "${has_free_keys}" == "true" ]] && echo >>"$ini_file" |
|
2043 | [[ "${has_free_keys}" == "true" ]] && echo >>"$ini_file" | |
2044 |
|
2044 | |||
2045 | for key in $(ini_keys); do |
|
2045 | for key in $(ini_keys); do | |
2046 | [[ $key == *.* ]] || continue |
|
2046 | [[ $key == *.* ]] || continue | |
2047 | value="${ini[$key]}" |
|
2047 | value="${ini[$key]}" | |
2048 | IFS="." read -r section_name key_name <<<"$key" |
|
2048 | IFS="." read -r section_name key_name <<<"$key" | |
2049 |
|
2049 | |||
2050 | if [[ "$current_section" != "$section_name" ]]; then |
|
2050 | if [[ "$current_section" != "$section_name" ]]; then | |
2051 | [[ $current_section ]] && echo >>"$ini_file" |
|
2051 | [[ $current_section ]] && echo >>"$ini_file" | |
2052 | echo "[$section_name]" >>"$ini_file" |
|
2052 | echo "[$section_name]" >>"$ini_file" | |
2053 | current_section="$section_name" |
|
2053 | current_section="$section_name" | |
2054 | fi |
|
2054 | fi | |
2055 |
|
2055 | |||
2056 | echo "$key_name = $value" >>"$ini_file" |
|
2056 | echo "$key_name = $value" >>"$ini_file" | |
2057 | done |
|
2057 | done | |
2058 | } |
|
2058 | } | |
2059 |
|
2059 | |||
2060 | ini_show() { |
|
2060 | ini_show() { | |
2061 | declare -gA ini |
|
2061 | declare -gA ini | |
2062 |
|
2062 | |||
2063 | for key in $(ini_keys); do |
|
2063 | for key in $(ini_keys); do | |
2064 | echo "$key = ${ini[$key]}" |
|
2064 | echo "$key = ${ini[$key]}" | |
2065 | done |
|
2065 | done | |
2066 | } |
|
2066 | } | |
2067 |
|
2067 | |||
2068 | ini_keys() { |
|
2068 | ini_keys() { | |
2069 | declare -gA ini |
|
2069 | declare -gA ini | |
2070 |
|
2070 | |||
2071 | local keys=("${!ini[@]}") |
|
2071 | local keys=("${!ini[@]}") | |
2072 | for a in "${keys[@]}"; do echo "$a"; done | sort |
|
2072 | for a in "${keys[@]}"; do echo "$a"; done | sort | |
2073 | } |
|
2073 | } | |
2074 |
|
2074 | |||
2075 | # src/lib/reconfigure_ini.sh |
|
2075 | # src/lib/reconfigure_ini.sh | |
2076 | sed_replace() { |
|
2076 | sed_replace() { | |
2077 | if [[ $ini_path == "" ]]; then |
|
2077 | if [[ $ini_path == "" ]]; then | |
2078 | echo "ERROR: missing 'ini_path' variable" |
|
2078 | echo "ERROR: missing 'ini_path' variable" | |
2079 | fi |
|
2079 | fi | |
2080 |
|
2080 | |||
2081 | sed_func "$1" "$2" "$ini_path" |
|
2081 | sed_func "$1" "$2" "$ini_path" | |
2082 | } |
|
2082 | } | |
2083 |
|
2083 | |||
2084 | sed_safe_path() { |
|
2084 | sed_safe_path() { | |
2085 | echo $((echo $1|sed -r 's/([\$\.\*\/\[\\^])/\\\1/g'|sed 's/[]]/\[]]/g')>&1) |
|
2085 | echo $((echo $1|sed -r 's/([\$\.\*\/\[\\^])/\\\1/g'|sed 's/[]]/\[]]/g')>&1) | |
2086 | } |
|
2086 | } | |
2087 |
|
2087 | |||
2088 | config_vcsserver_ini() { |
|
2088 | config_vcsserver_ini() { | |
2089 |
|
2089 | |||
2090 | #host/port |
|
2090 | #host/port | |
2091 | sed_replace '^#?host = .*' 'host = 0\.0\.0\.0' |
|
2091 | sed_replace '^#?host = .*' 'host = 0\.0\.0\.0' | |
2092 | sed_replace '^#?port = .*' 'port = 10010' |
|
2092 | sed_replace '^#?port = .*' 'port = 10010' | |
2093 |
|
2093 | |||
2094 | # workers adjustment |
|
2094 | # workers adjustment | |
2095 | sed_replace '^#?workers = .*' 'workers = 1' |
|
2095 | sed_replace '^#?workers = .*' 'workers = 1' | |
2096 | sed_replace '^#?memory_max_usage = .*' 'memory_max_usage = 2147483648' |
|
2096 | sed_replace '^#?memory_max_usage = .*' 'memory_max_usage = 2147483648' | |
2097 | sed_replace '^#?core\.binary_dir = .*' 'core.binary_dir = \/usr\/local\/bin\/rhodecode_bin\/vcs_bin' |
|
2097 | sed_replace '^#?core\.binary_dir = .*' 'core.binary_dir = \/usr\/local\/bin\/rhodecode_bin\/vcs_bin' | |
2098 |
|
2098 | |||
2099 | sed_replace '^#?cache_dir = .*' 'cache_dir = \/var\/opt\/rhodecode_data' |
|
2099 | sed_replace '^#?cache_dir = .*' 'cache_dir = \/var\/opt\/rhodecode_data' | |
2100 |
|
2100 | |||
2101 | sed_replace '^#?rc_cache\.repo_object\.expiration_time = .*' '#rc_cache.repo_object.expiration_time = 2592000' |
|
2101 | sed_replace '^#?rc_cache\.repo_object\.expiration_time = .*' '#rc_cache.repo_object.expiration_time = 2592000' | |
2102 | sed_replace '^#?rc_cache\.repo_object\.backend = dogpile\.cache\.rc\.redis_msgpack' 'rc_cache.repo_object.backend = dogpile.cache.rc.redis_msgpack' |
|
2102 | sed_replace '^#?rc_cache\.repo_object\.backend = dogpile\.cache\.rc\.redis_msgpack' 'rc_cache.repo_object.backend = dogpile.cache.rc.redis_msgpack' | |
2103 |
|
2103 | |||
2104 | sed_replace '^#?rc_cache\.repo_object\.arguments\.socket_timeout = .*' 'rc_cache.repo_object.arguments.socket_timeout = 30' |
|
2104 | sed_replace '^#?rc_cache\.repo_object\.arguments\.socket_timeout = .*' 'rc_cache.repo_object.arguments.socket_timeout = 30' | |
2105 | sed_replace '^#?rc_cache\.repo_object\.arguments\.db = .*' 'rc_cache.repo_object.arguments.db = 5' |
|
2105 | sed_replace '^#?rc_cache\.repo_object\.arguments\.db = .*' 'rc_cache.repo_object.arguments.db = 5' | |
2106 | sed_replace '^#?rc_cache\.repo_object\.arguments\.port = .*' 'rc_cache.repo_object.arguments.port = 6379' |
|
2106 | sed_replace '^#?rc_cache\.repo_object\.arguments\.port = .*' 'rc_cache.repo_object.arguments.port = 6379' | |
2107 | sed_replace '^#?rc_cache\.repo_object\.arguments\.host = .*' 'rc_cache.repo_object.arguments.host = redis' |
|
2107 | sed_replace '^#?rc_cache\.repo_object\.arguments\.host = .*' 'rc_cache.repo_object.arguments.host = redis' | |
2108 | sed_replace '^#?rc_cache\.repo_object\.arguments\.redis_expiration_time = .*' 'rc_cache.repo_object.arguments.redis_expiration_time = 3592000' |
|
2108 | sed_replace '^#?rc_cache\.repo_object\.arguments\.redis_expiration_time = .*' 'rc_cache.repo_object.arguments.redis_expiration_time = 3592000' | |
2109 |
|
2109 | |||
2110 | #statsd enable |
|
2110 | #statsd enable | |
2111 | sed_replace '^#?statsd.enabled = .*' 'statsd.enabled = true' |
|
2111 | sed_replace '^#?statsd.enabled = .*' 'statsd.enabled = true' | |
2112 | sed_replace '^#?statsd.statsd_host = .*' 'statsd.statsd_host = statsd-exporter' |
|
2112 | sed_replace '^#?statsd.statsd_host = .*' 'statsd.statsd_host = statsd-exporter' | |
2113 | sed_replace '^#?statsd.statsd_port = .*' 'statsd.statsd_port = 9125' |
|
2113 | sed_replace '^#?statsd.statsd_port = .*' 'statsd.statsd_port = 9125' | |
2114 |
|
2114 | |||
2115 | } |
|
2115 | } | |
2116 |
|
2116 | |||
2117 | config_rhodecode_ini() { |
|
2117 | config_rhodecode_ini() { | |
2118 | #host/port |
|
2118 | #host/port | |
2119 | sed_replace '^#?host = .*' 'host = 0\.0\.0\.0' |
|
2119 | sed_replace '^#?host = .*' 'host = 0\.0\.0\.0' | |
2120 | sed_replace '^#?port = .*' 'port = 10020' |
|
2120 | sed_replace '^#?port = .*' 'port = 10020' | |
2121 |
|
2121 | |||
2122 |
|
2122 | |||
2123 | sed_replace '^#?email_prefix = .*' 'email_prefix = [RhodeCode]' |
|
2123 | sed_replace '^#?email_prefix = .*' 'email_prefix = [RhodeCode]' | |
2124 | sed_replace '^#?app_email_from = .*' "app_email_from = rhodecode-noreply@$RC_HOSTNAME" |
|
2124 | sed_replace '^#?app_email_from = .*' "app_email_from = rhodecode-noreply@$RC_HOSTNAME" | |
2125 |
|
2125 | |||
2126 | # app-instance-uuid |
|
2126 | # app-instance-uuid | |
2127 | sed_replace '^app_instance_uuid = .*' "app_instance_uuid = $RC_APP_INSTANCE_UUID" |
|
2127 | sed_replace '^app_instance_uuid = .*' "app_instance_uuid = $RC_APP_INSTANCE_UUID" | |
2128 |
|
2128 | |||
2129 | # app base |
|
2129 | # app base | |
2130 | sed_replace '^app\.base_url = .*' "app\.base_url = $RC_APP_BASE_URL" |
|
2130 | sed_replace '^app\.base_url = .*' "app\.base_url = $RC_APP_BASE_URL" | |
2131 |
|
2131 | |||
2132 | sed_replace '^app\.service_api\.host = .*' "app\.service_api\.host = http:\/\/rhodecode:10020" |
|
2132 | sed_replace '^app\.service_api\.host = .*' "app\.service_api\.host = http:\/\/rhodecode:10020" | |
2133 | sed_replace '^app\.service_api\.token = .*' "app\.service_api\.token = $RC_SHARED_KEY" |
|
2133 | sed_replace '^app\.service_api\.token = .*' "app\.service_api\.token = $RC_SHARED_KEY" | |
2134 |
|
2134 | |||
2135 | # set license_token |
|
2135 | # set license_token | |
2136 | sed_replace '^#?license_token =.*' "license_token = $RC_LICENSE_TOKEN" |
|
2136 | sed_replace '^#?license_token =.*' "license_token = $RC_LICENSE_TOKEN" | |
2137 | # set Edition |
|
2137 | # set Edition | |
2138 | sed_replace '^use = egg:rhodecode-enterprise.*' "use = egg:rhodecode-enterprise-$RC_EDITION" |
|
2138 | sed_replace '^use = egg:rhodecode-enterprise.*' "use = egg:rhodecode-enterprise-$RC_EDITION" | |
2139 |
|
2139 | |||
2140 | # enable celery |
|
2140 | # enable celery | |
2141 | sed_replace '^#?use_celery = .*' 'use_celery = true' |
|
2141 | sed_replace '^#?use_celery = .*' 'use_celery = true' | |
2142 |
|
2142 | |||
2143 | # DB |
|
2143 | # DB | |
2144 | sed_replace '^sqlalchemy\.db1\.url =.*' "sqlalchemy\.db1\.url = $RC_SQLALCHEMY_DB1_URL" |
|
2144 | sed_replace '^sqlalchemy\.db1\.url =.*' "sqlalchemy\.db1\.url = $RC_SQLALCHEMY_DB1_URL" | |
2145 |
|
2145 | |||
2146 | #CHANNELSTREAM WS_URL |
|
2146 | #CHANNELSTREAM WS_URL | |
2147 | sed_replace '^#?channelstream\.ws_url =.*' "channelstream\.ws_url = $RC_CHANNELSTREAM_WS_URL" |
|
2147 | sed_replace '^#?channelstream\.ws_url =.*' "channelstream\.ws_url = $RC_CHANNELSTREAM_WS_URL" | |
2148 |
|
2148 | |||
2149 | # set cache dir |
|
2149 | # set cache dir | |
2150 | sed_replace '^#?cache_dir = .*' 'cache_dir = \/var\/opt\/rhodecode_data' |
|
2150 | sed_replace '^#?cache_dir = .*' 'cache_dir = \/var\/opt\/rhodecode_data' | |
2151 |
|
2151 | |||
2152 | # set archive cache dir |
|
2152 | # set archive cache dir | |
2153 | sed_replace '^#?archive_cache_dir = .*' 'archive_cache_dir = \/var\/opt\/rhodecode_data\/tarballcache' |
|
2153 | sed_replace '^#?archive_cache_dir = .*' 'archive_cache_dir = \/var\/opt\/rhodecode_data\/tarballcache' | |
2154 |
|
2154 | |||
2155 | # set file_store path |
|
2155 | # set file_store path | |
2156 | sed_replace '^#?file_store\.storage_path = .*' 'file_store.storage_path = \/var\/opt\/rhodecode_data\/file_store' |
|
2156 | sed_replace '^#?file_store\.storage_path = .*' 'file_store.storage_path = \/var\/opt\/rhodecode_data\/file_store' | |
2157 |
|
2157 | |||
2158 | # cleanup rabbitmq example entry |
|
2158 | # cleanup rabbitmq example entry | |
2159 | sed_replace '^#celery\.broker_url = amqp.*' '' |
|
2159 | sed_replace '^#celery\.broker_url = amqp.*' '' | |
2160 | sed_replace '^#?celery\.broker_url = .*' 'celery\.broker_url = redis:\/\/redis:6379\/8' |
|
2160 | sed_replace '^#?celery\.broker_url = .*' 'celery\.broker_url = redis:\/\/redis:6379\/8' | |
2161 | sed_replace '^#?celery\.result_backend = .*' 'celery\.result_backend = redis:\/\/redis:6379\/8' |
|
2161 | sed_replace '^#?celery\.result_backend = .*' 'celery\.result_backend = redis:\/\/redis:6379\/8' | |
2162 |
|
2162 | |||
2163 | # switch beaker sessions to Redis based |
|
2163 | # switch beaker sessions to Redis based | |
2164 | sed_replace '^#?beaker.session.type = file.*' '#beaker.session.type = file' |
|
2164 | sed_replace '^#?beaker.session.type = file.*' '#beaker.session.type = file' | |
2165 | sed_replace '^#?beaker.session.data_dir = .*' '#beaker.session.data_dir = \/tmp\/data\/sessions' |
|
2165 | sed_replace '^#?beaker.session.data_dir = .*' '#beaker.session.data_dir = \/tmp\/data\/sessions' | |
2166 |
|
2166 | |||
2167 | # enable redis db2 |
|
2167 | # enable redis db2 | |
2168 | sed_replace '^#?beaker\.session\.type = ext:redis' 'beaker.session.type = ext:redis' |
|
2168 | sed_replace '^#?beaker\.session\.type = ext:redis' 'beaker.session.type = ext:redis' | |
2169 | sed_replace '^#?beaker\.session\.url = redis:\/\/.+\/2' 'beaker.session.url = redis:\/\/redis:6379\/2' |
|
2169 | sed_replace '^#?beaker\.session\.url = redis:\/\/.+\/2' 'beaker.session.url = redis:\/\/redis:6379\/2' | |
2170 |
|
2170 | |||
2171 | # sed_replace '^#?beaker.session.type = ext:database.*' 'beaker.session.type = ext:database' |
|
2171 | # sed_replace '^#?beaker.session.type = ext:database.*' 'beaker.session.type = ext:database' | |
2172 | # sed_replace '^#?beaker.session.sa.url = postgresql.*' 'beaker.session.sa.url = postgresql://{{rhodecode_db_username}}:{{rhodecode_db_password}}@localhost/{{rhodecode_db_name}}' |
|
2172 | # sed_replace '^#?beaker.session.sa.url = postgresql.*' 'beaker.session.sa.url = postgresql://{{rhodecode_db_username}}:{{rhodecode_db_password}}@localhost/{{rhodecode_db_name}}' | |
2173 |
|
2173 | |||
2174 | # hooks reconfigure for auto-bind to host |
|
2174 | # hooks reconfigure for auto-bind to host | |
2175 | sed_replace '^#?vcs.hooks.host = .*' 'vcs.hooks.host = \*' |
|
2175 | sed_replace '^#?vcs.hooks.host = .*' 'vcs.hooks.host = \*' | |
2176 | sed_replace '^#?vcs.server = .*' 'vcs.server = vcsserver:10010' |
|
2176 | sed_replace '^#?vcs.server = .*' 'vcs.server = vcsserver:10010' | |
2177 |
|
2177 | |||
2178 | # enable SVN |
|
2178 | # enable SVN | |
2179 | sed_replace '^#?svn.proxy.generate_config = .*' 'svn.proxy.generate_config = true' |
|
2179 | sed_replace '^#?svn.proxy.generate_config = .*' 'svn.proxy.generate_config = true' | |
2180 |
|
2180 | |||
2181 | # enable SSH |
|
2181 | # enable SSH | |
2182 | sed_replace '^#?ssh.generate_authorized_keyfile = .*' 'ssh.generate_authorized_keyfile = true' |
|
2182 | sed_replace '^#?ssh.generate_authorized_keyfile = .*' 'ssh.generate_authorized_keyfile = true' | |
2183 |
|
2183 | |||
2184 | #statsd enable |
|
2184 | #statsd enable | |
2185 | sed_replace '^#?statsd.enabled = .*' 'statsd.enabled = true' |
|
2185 | sed_replace '^#?statsd.enabled = .*' 'statsd.enabled = true' | |
2186 | sed_replace '^#?statsd.statsd_host = .*' 'statsd.statsd_host = statsd-exporter' |
|
2186 | sed_replace '^#?statsd.statsd_host = .*' 'statsd.statsd_host = statsd-exporter' | |
2187 | sed_replace '^#?statsd.statsd_port = .*' 'statsd.statsd_port = 9125' |
|
2187 | sed_replace '^#?statsd.statsd_port = .*' 'statsd.statsd_port = 9125' | |
2188 |
|
2188 | |||
2189 | # the wrapper_cmd |
|
2189 | # the wrapper_cmd | |
2190 | sed_replace '^#?ssh.wrapper_cmd = .*' 'ssh.wrapper_cmd = \/usr\/local\/bin\/rhodecode_bin\/bin\/rc-ssh-wrapper' |
|
2190 | sed_replace '^#?ssh.wrapper_cmd = .*' 'ssh.wrapper_cmd = \/usr\/local\/bin\/rhodecode_bin\/bin\/rc-ssh-wrapper' | |
2191 |
|
2191 | |||
2192 | sed_replace '^#?api_access_controllers_whitelist = .*' 'api_access_controllers_whitelist = RepoFilesView:repo_archivefile, RepoFilesView:repo_file_raw' |
|
2192 | sed_replace '^#?api_access_controllers_whitelist = .*' 'api_access_controllers_whitelist = RepoFilesView:repo_archivefile, RepoFilesView:repo_file_raw' | |
2193 |
|
2193 | |||
2194 | # # set search to elasticsearch |
|
2194 | # # set search to elasticsearch | |
2195 | # # enabled modules for Whoosh we remove, we have duplicates there.. |
|
2195 | # # enabled modules for Whoosh we remove, we have duplicates there.. | |
2196 | # '^search.module = .*' '' |
|
2196 | # '^search.module = .*' '' | |
2197 | # '^search.location = .*' '' |
|
2197 | # '^search.location = .*' '' | |
2198 | # |
|
2198 | # | |
2199 | # '^#?search.module = .*' 'search.module = rc_elasticsearch' |
|
2199 | # '^#?search.module = .*' 'search.module = rc_elasticsearch' | |
2200 | # '^#?search.location = .*' 'search.location = http://localhost:9200' |
|
2200 | # '^#?search.location = .*' 'search.location = http://localhost:9200' | |
2201 | # '^#?search.es_version = .*' 'search.es_version = 6' |
|
2201 | # '^#?search.es_version = .*' 'search.es_version = 6' | |
2202 |
|
2202 | |||
2203 | # enable Chat |
|
2203 | # enable Chat | |
2204 | sed_replace '^#?chat.enabled = .*' 'chat.enabled = true' |
|
2204 | sed_replace '^#?chat.enabled = .*' 'chat.enabled = true' | |
2205 |
|
2205 | |||
2206 | } |
|
2206 | } | |
2207 |
|
2207 | |||
2208 | # src/lib/send_completions.sh |
|
2208 | # src/lib/send_completions.sh | |
2209 |
|
2209 | |||
2210 | # src/lib/utils.sh |
|
2210 | # src/lib/utils.sh | |
2211 |
|
2211 | |||
2212 | generate_md5() { |
|
2212 | generate_md5() { | |
2213 | local input_string="$1" |
|
2213 | local input_string="$1" | |
2214 |
|
2214 | |||
2215 | if command -v md5 &> /dev/null; then |
|
2215 | if command -v md5 &> /dev/null; then | |
2216 | echo -n "$input_string" | md5 |
|
2216 | echo -n "$input_string" | md5 | |
2217 | elif command -v md5sum &> /dev/null; then |
|
2217 | elif command -v md5sum &> /dev/null; then | |
2218 | echo -n "$input_string" | md5sum | awk '{print $1}' |
|
2218 | echo -n "$input_string" | md5sum | awk '{print $1}' | |
2219 | else |
|
2219 | else | |
2220 | echo "Error: Neither md5 nor md5sum command is available. Please make sure this is installed in your system" |
|
2220 | echo "Error: Neither md5 nor md5sum command is available. Please make sure this is installed in your system" | |
2221 | return 1 |
|
2221 | return 1 | |
2222 | fi |
|
2222 | fi | |
2223 | } |
|
2223 | } | |
2224 |
|
2224 | |||
2225 | random_str() { |
|
2225 | random_str() { | |
2226 | len=$1 |
|
2226 | len=$1 | |
2227 | random_generate=$(generate_md5 $RANDOM | head -c $len) |
|
2227 | random_generate=$(generate_md5 $RANDOM | head -c $len) | |
2228 | echo "$random_generate" |
|
2228 | echo "$random_generate" | |
2229 | } |
|
2229 | } | |
2230 |
|
2230 | |||
2231 | semver_debug() { |
|
2231 | semver_debug() { | |
2232 | if [ "$semver_debug" = "debug" ]; then printf "DEBUG: %s$1 \n"; fi |
|
2232 | if [ "$semver_debug" = "debug" ]; then printf "DEBUG: %s$1 \n"; fi | |
2233 | } |
|
2233 | } | |
2234 |
|
2234 | |||
2235 | # params char |
|
2235 | # params char | |
2236 | # returns Integer |
|
2236 | # returns Integer | |
2237 | ord() { |
|
2237 | ord() { | |
2238 | printf '%d' "'$1" |
|
2238 | printf '%d' "'$1" | |
2239 | } |
|
2239 | } | |
2240 |
|
2240 | |||
2241 | isNumber() { |
|
2241 | isNumber() { | |
2242 | string=$1 |
|
2242 | string=$1 | |
2243 | char="" |
|
2243 | char="" | |
2244 | while true; do |
|
2244 | while true; do | |
2245 | substract="${string#?}" # All but the first character of the string |
|
2245 | substract="${string#?}" # All but the first character of the string | |
2246 | char="${string%"$substract"}" # Remove $rest, and you're left with the first character |
|
2246 | char="${string%"$substract"}" # Remove $rest, and you're left with the first character | |
2247 | string="$substract" |
|
2247 | string="$substract" | |
2248 | # no more chars to compare then success |
|
2248 | # no more chars to compare then success | |
2249 | if [ -z "$char" ]; then |
|
2249 | if [ -z "$char" ]; then | |
2250 | printf "true" |
|
2250 | printf "true" | |
2251 | return 1 |
|
2251 | return 1 | |
2252 | fi |
|
2252 | fi | |
2253 | # break if some of the chars is not a number |
|
2253 | # break if some of the chars is not a number | |
2254 | if [ "$(ord "$char")" -lt 48 ] || [ "$(ord "$char")" -gt 57 ]; then |
|
2254 | if [ "$(ord "$char")" -lt 48 ] || [ "$(ord "$char")" -gt 57 ]; then | |
2255 | printf "false" |
|
2255 | printf "false" | |
2256 | return 0 |
|
2256 | return 0 | |
2257 | fi |
|
2257 | fi | |
2258 | done |
|
2258 | done | |
2259 | } |
|
2259 | } | |
2260 |
|
2260 | |||
2261 | # params string {String}, Index {Number} |
|
2261 | # params string {String}, Index {Number} | |
2262 | # returns char |
|
2262 | # returns char | |
2263 | getChar() { |
|
2263 | getChar() { | |
2264 | string=$1 |
|
2264 | string=$1 | |
2265 | index=$2 |
|
2265 | index=$2 | |
2266 | cursor=-1 |
|
2266 | cursor=-1 | |
2267 | char="" |
|
2267 | char="" | |
2268 | while [ "$cursor" != "$index" ]; do |
|
2268 | while [ "$cursor" != "$index" ]; do | |
2269 | substract="${string#?}" # All but the first character of the string |
|
2269 | substract="${string#?}" # All but the first character of the string | |
2270 | char="${string%"$substract"}" # Remove $rest, and you're left with the first character |
|
2270 | char="${string%"$substract"}" # Remove $rest, and you're left with the first character | |
2271 | string="$substract" |
|
2271 | string="$substract" | |
2272 | cursor=$((cursor + 1)) |
|
2272 | cursor=$((cursor + 1)) | |
2273 | done |
|
2273 | done | |
2274 | printf "%s$char" |
|
2274 | printf "%s$char" | |
2275 | } |
|
2275 | } | |
2276 |
|
2276 | |||
2277 | outcome() { |
|
2277 | outcome() { | |
2278 | semver_result=$1 |
|
2278 | semver_result=$1 | |
2279 | #printf "%s$semver_result\n" |
|
2279 | #printf "%s$semver_result\n" | |
2280 | } |
|
2280 | } | |
2281 |
|
2281 | |||
2282 | compareNumber() { |
|
2282 | compareNumber() { | |
2283 | if [ -z "$1" ] && [ -z "$2" ]; then |
|
2283 | if [ -z "$1" ] && [ -z "$2" ]; then | |
2284 | printf "%s" "0" |
|
2284 | printf "%s" "0" | |
2285 | return |
|
2285 | return | |
2286 | fi |
|
2286 | fi | |
2287 |
|
2287 | |||
2288 | [ $(($2 - $1)) -gt 0 ] && printf "%s" "-1" |
|
2288 | [ $(($2 - $1)) -gt 0 ] && printf "%s" "-1" | |
2289 | [ $(($2 - $1)) -lt 0 ] && printf "1" |
|
2289 | [ $(($2 - $1)) -lt 0 ] && printf "1" | |
2290 | [ $(($2 - $1)) = 0 ] && printf "0" |
|
2290 | [ $(($2 - $1)) = 0 ] && printf "0" | |
2291 | } |
|
2291 | } | |
2292 |
|
2292 | |||
2293 | compareString() { |
|
2293 | compareString() { | |
2294 | semver_result=false |
|
2294 | semver_result=false | |
2295 | index=0 |
|
2295 | index=0 | |
2296 | while true |
|
2296 | while true | |
2297 | do |
|
2297 | do | |
2298 | a=$(getChar "$1" $index) |
|
2298 | a=$(getChar "$1" $index) | |
2299 | b=$(getChar "$2" $index) |
|
2299 | b=$(getChar "$2" $index) | |
2300 |
|
2300 | |||
2301 | if [ -z "$a" ] && [ -z "$b" ] |
|
2301 | if [ -z "$a" ] && [ -z "$b" ] | |
2302 | then |
|
2302 | then | |
2303 | printf "0" |
|
2303 | printf "0" | |
2304 | return |
|
2304 | return | |
2305 | fi |
|
2305 | fi | |
2306 |
|
2306 | |||
2307 | ord_a=$(ord "$a") |
|
2307 | ord_a=$(ord "$a") | |
2308 | ord_b=$(ord "$b") |
|
2308 | ord_b=$(ord "$b") | |
2309 |
|
2309 | |||
2310 | if [ "$(compareNumber "$ord_a" "$ord_b")" != "0" ]; then |
|
2310 | if [ "$(compareNumber "$ord_a" "$ord_b")" != "0" ]; then | |
2311 | printf "%s" "$(compareNumber "$ord_a" "$ord_b")" |
|
2311 | printf "%s" "$(compareNumber "$ord_a" "$ord_b")" | |
2312 | return |
|
2312 | return | |
2313 | fi |
|
2313 | fi | |
2314 |
|
2314 | |||
2315 | index=$((index + 1)) |
|
2315 | index=$((index + 1)) | |
2316 | done |
|
2316 | done | |
2317 | } |
|
2317 | } | |
2318 |
|
2318 | |||
2319 | includesString() { |
|
2319 | includesString() { | |
2320 | string="$1" |
|
2320 | string="$1" | |
2321 | substring="$2" |
|
2321 | substring="$2" | |
2322 | if [ "${string#*"$substring"}" != "$string" ] |
|
2322 | if [ "${string#*"$substring"}" != "$string" ] | |
2323 | then |
|
2323 | then | |
2324 | printf "1" |
|
2324 | printf "1" | |
2325 | return 1 # $substring is in $string |
|
2325 | return 1 # $substring is in $string | |
2326 | fi |
|
2326 | fi | |
2327 | printf "0" |
|
2327 | printf "0" | |
2328 | return 0 # $substring is not in $string |
|
2328 | return 0 # $substring is not in $string | |
2329 | } |
|
2329 | } | |
2330 |
|
2330 | |||
2331 | removeLeadingV() { |
|
2331 | removeLeadingV() { | |
2332 | printf "%s${1#v}" |
|
2332 | printf "%s${1#v}" | |
2333 | } |
|
2333 | } | |
2334 |
|
2334 | |||
2335 | # https://github.com/Ariel-Rodriguez/sh-semversion-2/pull/2 |
|
2335 | # https://github.com/Ariel-Rodriguez/sh-semversion-2/pull/2 | |
2336 | # Spec #2 https://semver.org/#spec-item-2 |
|
2336 | # Spec #2 https://semver.org/#spec-item-2 | |
2337 | # MUST NOT contain leading zeroes |
|
2337 | # MUST NOT contain leading zeroes | |
2338 | normalizeZero() { |
|
2338 | normalizeZero() { | |
2339 | next=$(printf %s "${1#0}") |
|
2339 | next=$(printf %s "${1#0}") | |
2340 | if [ -z "$next" ]; then |
|
2340 | if [ -z "$next" ]; then | |
2341 | printf %s "$1" |
|
2341 | printf %s "$1" | |
2342 | fi |
|
2342 | fi | |
2343 | printf %s "$next" |
|
2343 | printf %s "$next" | |
2344 | } |
|
2344 | } | |
2345 |
|
2345 | |||
2346 | semver_compare() { |
|
2346 | semver_compare() { | |
2347 |
|
2347 | |||
2348 | # returns 1 when A greater than B |
|
2348 | # returns 1 when A greater than B | |
2349 | # returns 0 when A equals B |
|
2349 | # returns 0 when A equals B | |
2350 | # returns -1 when A lower than B |
|
2350 | # returns -1 when A lower than B | |
2351 |
|
2351 | |||
2352 | firstParam=$1 #1.2.4-alpha.beta+METADATA |
|
2352 | firstParam=$1 #1.2.4-alpha.beta+METADATA | |
2353 | secondParam=$2 #1.2.4-alpha.beta.2+METADATA |
|
2353 | secondParam=$2 #1.2.4-alpha.beta.2+METADATA | |
2354 | semver_debug=${3:-1} |
|
2354 | semver_debug=${3:-1} | |
2355 | semver_verbose=${4:-1} |
|
2355 | semver_verbose=${4:-1} | |
2356 |
|
2356 | |||
2357 | [ "$semver_verbose" = "verbose" ] && set -x |
|
2357 | [ "$semver_verbose" = "verbose" ] && set -x | |
2358 |
|
2358 | |||
2359 | version_a=$(printf %s "$firstParam" | cut -d'+' -f 1) |
|
2359 | version_a=$(printf %s "$firstParam" | cut -d'+' -f 1) | |
2360 | version_a=$(removeLeadingV "$version_a") |
|
2360 | version_a=$(removeLeadingV "$version_a") | |
2361 | version_b=$(printf %s "$secondParam" | cut -d'+' -f 1) |
|
2361 | version_b=$(printf %s "$secondParam" | cut -d'+' -f 1) | |
2362 | version_b=$(removeLeadingV "$version_b") |
|
2362 | version_b=$(removeLeadingV "$version_b") | |
2363 |
|
2363 | |||
2364 | a_major=$(printf %s "$version_a" | cut -d'.' -f 1) |
|
2364 | a_major=$(printf %s "$version_a" | cut -d'.' -f 1) | |
2365 | a_minor=$(printf %s "$version_a" | cut -d'.' -f 2) |
|
2365 | a_minor=$(printf %s "$version_a" | cut -d'.' -f 2) | |
2366 | a_patch=$(printf %s "$version_a" | cut -d'.' -f 3 | cut -d'-' -f 1) |
|
2366 | a_patch=$(printf %s "$version_a" | cut -d'.' -f 3 | cut -d'-' -f 1) | |
2367 | a_pre="" |
|
2367 | a_pre="" | |
2368 | if [ "$(includesString "$version_a" -)" = 1 ]; then |
|
2368 | if [ "$(includesString "$version_a" -)" = 1 ]; then | |
2369 | a_pre=$(printf %s"${version_a#"$a_major.$a_minor.$a_patch-"}") |
|
2369 | a_pre=$(printf %s"${version_a#"$a_major.$a_minor.$a_patch-"}") | |
2370 | fi |
|
2370 | fi | |
2371 |
|
2371 | |||
2372 | b_major=$(printf %s "$version_b" | cut -d'.' -f 1) |
|
2372 | b_major=$(printf %s "$version_b" | cut -d'.' -f 1) | |
2373 | b_minor=$(printf %s "$version_b" | cut -d'.' -f 2) |
|
2373 | b_minor=$(printf %s "$version_b" | cut -d'.' -f 2) | |
2374 | b_patch=$(printf %s "$version_b" | cut -d'.' -f 3 | cut -d'-' -f 1) |
|
2374 | b_patch=$(printf %s "$version_b" | cut -d'.' -f 3 | cut -d'-' -f 1) | |
2375 | b_pre="" |
|
2375 | b_pre="" | |
2376 | if [ "$(includesString "$version_b" -)" = 1 ]; then |
|
2376 | if [ "$(includesString "$version_b" -)" = 1 ]; then | |
2377 | b_pre=$(printf %s"${version_b#"$b_major.$b_minor.$b_patch-"}") |
|
2377 | b_pre=$(printf %s"${version_b#"$b_major.$b_minor.$b_patch-"}") | |
2378 | fi |
|
2378 | fi | |
2379 |
|
2379 | |||
2380 | a_major=$(normalizeZero "$a_major") |
|
2380 | a_major=$(normalizeZero "$a_major") | |
2381 | a_minor=$(normalizeZero "$a_minor") |
|
2381 | a_minor=$(normalizeZero "$a_minor") | |
2382 | a_patch=$(normalizeZero "$a_patch") |
|
2382 | a_patch=$(normalizeZero "$a_patch") | |
2383 | b_major=$(normalizeZero "$b_major") |
|
2383 | b_major=$(normalizeZero "$b_major") | |
2384 | b_minor=$(normalizeZero "$b_minor") |
|
2384 | b_minor=$(normalizeZero "$b_minor") | |
2385 | b_patch=$(normalizeZero "$b_patch") |
|
2385 | b_patch=$(normalizeZero "$b_patch") | |
2386 |
|
2386 | |||
2387 | unit_types="MAJOR MINOR PATCH" |
|
2387 | unit_types="MAJOR MINOR PATCH" | |
2388 | a_normalized="$a_major $a_minor $a_patch" |
|
2388 | a_normalized="$a_major $a_minor $a_patch" | |
2389 | b_normalized="$b_major $b_minor $b_patch" |
|
2389 | b_normalized="$b_major $b_minor $b_patch" | |
2390 |
|
2390 | |||
2391 | semver_debug "Detected: $a_major $a_minor $a_patch identifiers: $a_pre" |
|
2391 | semver_debug "Detected: $a_major $a_minor $a_patch identifiers: $a_pre" | |
2392 | semver_debug "Detected: $b_major $b_minor $b_patch identifiers: $b_pre" |
|
2392 | semver_debug "Detected: $b_major $b_minor $b_patch identifiers: $b_pre" | |
2393 |
|
2393 | |||
2394 | # |
|
2394 | # | |
2395 | # Find difference between Major Minor or Patch |
|
2395 | # Find difference between Major Minor or Patch | |
2396 | # |
|
2396 | # | |
2397 |
|
2397 | |||
2398 | cursor=1 |
|
2398 | cursor=1 | |
2399 | while [ "$cursor" -lt 4 ] |
|
2399 | while [ "$cursor" -lt 4 ] | |
2400 | do |
|
2400 | do | |
2401 | a=$(printf %s "$a_normalized" | cut -d' ' -f $cursor) |
|
2401 | a=$(printf %s "$a_normalized" | cut -d' ' -f $cursor) | |
2402 | b=$(printf %s "$b_normalized" | cut -d' ' -f $cursor) |
|
2402 | b=$(printf %s "$b_normalized" | cut -d' ' -f $cursor) | |
2403 | if [ "$a" != "$b" ] |
|
2403 | if [ "$a" != "$b" ] | |
2404 | then |
|
2404 | then | |
2405 | semver_debug "$(printf %s "$unit_types" | cut -d' ' -f $cursor) is different" |
|
2405 | semver_debug "$(printf %s "$unit_types" | cut -d' ' -f $cursor) is different" | |
2406 | outcome "$(compareNumber "$a" "$b")" |
|
2406 | outcome "$(compareNumber "$a" "$b")" | |
2407 | return |
|
2407 | return | |
2408 | fi; |
|
2408 | fi; | |
2409 | semver_debug "$(printf "%s" "$unit_types" | cut -d' ' -f $cursor) are equal" |
|
2409 | semver_debug "$(printf "%s" "$unit_types" | cut -d' ' -f $cursor) are equal" | |
2410 | cursor=$((cursor + 1)) |
|
2410 | cursor=$((cursor + 1)) | |
2411 | done |
|
2411 | done | |
2412 |
|
2412 | |||
2413 | # |
|
2413 | # | |
2414 | # Find difference between pre release identifiers |
|
2414 | # Find difference between pre release identifiers | |
2415 | # |
|
2415 | # | |
2416 |
|
2416 | |||
2417 | if [ -z "$a_pre" ] && [ -z "$b_pre" ]; then |
|
2417 | if [ -z "$a_pre" ] && [ -z "$b_pre" ]; then | |
2418 | semver_debug "Because both are equals" |
|
2418 | semver_debug "Because both are equals" | |
2419 | outcome "0" |
|
2419 | outcome "0" | |
2420 | return |
|
2420 | return | |
2421 | fi |
|
2421 | fi | |
2422 |
|
2422 | |||
2423 | # Spec 11.3 a pre-release version has lower precedence than a normal version: |
|
2423 | # Spec 11.3 a pre-release version has lower precedence than a normal version: | |
2424 | # 1.0.0 < 1.0.0-alpha |
|
2424 | # 1.0.0 < 1.0.0-alpha | |
2425 | if [ -z "$a_pre" ]; then |
|
2425 | if [ -z "$a_pre" ]; then | |
2426 | semver_debug "Because A is the stable release. Pre-release version has lower precedence than a released version" |
|
2426 | semver_debug "Because A is the stable release. Pre-release version has lower precedence than a released version" | |
2427 | outcome "1" |
|
2427 | outcome "1" | |
2428 | return |
|
2428 | return | |
2429 | fi |
|
2429 | fi | |
2430 | # 1.0.0-alpha < 1.0.0 |
|
2430 | # 1.0.0-alpha < 1.0.0 | |
2431 | if [ -z "$b_pre" ]; then |
|
2431 | if [ -z "$b_pre" ]; then | |
2432 | semver_debug "Because B is the stable release. Pre-release version has lower precedence than a released version" |
|
2432 | semver_debug "Because B is the stable release. Pre-release version has lower precedence than a released version" | |
2433 | outcome "-1" |
|
2433 | outcome "-1" | |
2434 | return |
|
2434 | return | |
2435 | fi |
|
2435 | fi | |
2436 |
|
2436 | |||
2437 | isSingleIdentifier() { |
|
2437 | isSingleIdentifier() { | |
2438 | substract="${2#?}" |
|
2438 | substract="${2#?}" | |
2439 | if [ "${1%"$2"}" = "" ]; then |
|
2439 | if [ "${1%"$2"}" = "" ]; then | |
2440 | printf "true" |
|
2440 | printf "true" | |
2441 | return 1; |
|
2441 | return 1; | |
2442 | fi |
|
2442 | fi | |
2443 | return 0 |
|
2443 | return 0 | |
2444 | } |
|
2444 | } | |
2445 |
|
2445 | |||
2446 | cursor=1 |
|
2446 | cursor=1 | |
2447 | while [ $cursor -lt 5 ] |
|
2447 | while [ $cursor -lt 5 ] | |
2448 | do |
|
2448 | do | |
2449 | a=$(printf %s "$a_pre" | cut -d'.' -f $cursor) |
|
2449 | a=$(printf %s "$a_pre" | cut -d'.' -f $cursor) | |
2450 | b=$(printf %s "$b_pre" | cut -d'.' -f $cursor) |
|
2450 | b=$(printf %s "$b_pre" | cut -d'.' -f $cursor) | |
2451 |
|
2451 | |||
2452 | semver_debug "Comparing identifier $a with $b" |
|
2452 | semver_debug "Comparing identifier $a with $b" | |
2453 |
|
2453 | |||
2454 | # Exit when there is nothing else to compare. |
|
2454 | # Exit when there is nothing else to compare. | |
2455 | # Most likely because they are equals |
|
2455 | # Most likely because they are equals | |
2456 | if [ -z "$a" ] && [ -z "$b" ] |
|
2456 | if [ -z "$a" ] && [ -z "$b" ] | |
2457 | then |
|
2457 | then | |
2458 | semver_debug "are equals" |
|
2458 | semver_debug "are equals" | |
2459 | outcome "0" |
|
2459 | outcome "0" | |
2460 | return |
|
2460 | return | |
2461 | fi; |
|
2461 | fi; | |
2462 |
|
2462 | |||
2463 | # Spec #11 https://semver.org/#spec-item-11 |
|
2463 | # Spec #11 https://semver.org/#spec-item-11 | |
2464 | # Precedence for two pre-release versions with the same major, minor, and patch version |
|
2464 | # Precedence for two pre-release versions with the same major, minor, and patch version | |
2465 | # MUST be determined by comparing each dot separated identifier from left to right until a difference is found |
|
2465 | # MUST be determined by comparing each dot separated identifier from left to right until a difference is found | |
2466 |
|
2466 | |||
2467 | # Spec 11.4.4: A larger set of pre-release fields has a higher precedence than a smaller set, if all of the preceding identifiers are equal. |
|
2467 | # Spec 11.4.4: A larger set of pre-release fields has a higher precedence than a smaller set, if all of the preceding identifiers are equal. | |
2468 |
|
2468 | |||
2469 | if [ -n "$a" ] && [ -z "$b" ]; then |
|
2469 | if [ -n "$a" ] && [ -z "$b" ]; then | |
2470 | # When A is larger than B and preidentifiers are 1+n |
|
2470 | # When A is larger than B and preidentifiers are 1+n | |
2471 | # 1.0.0-alpha.beta.1 1.0.0-alpha.beta |
|
2471 | # 1.0.0-alpha.beta.1 1.0.0-alpha.beta | |
2472 | # 1.0.0-alpha.beta.1.2 1.0.0-alpha.beta.1 |
|
2472 | # 1.0.0-alpha.beta.1.2 1.0.0-alpha.beta.1 | |
2473 | semver_debug "Because A has larger set of pre-identifiers" |
|
2473 | semver_debug "Because A has larger set of pre-identifiers" | |
2474 | outcome "1" |
|
2474 | outcome "1" | |
2475 | return |
|
2475 | return | |
2476 | fi |
|
2476 | fi | |
2477 |
|
2477 | |||
2478 | # When A is shorter than B and preidentifiers are 1+n |
|
2478 | # When A is shorter than B and preidentifiers are 1+n | |
2479 | # 1.0.0-alpha.beta 1.0.0-alpha.beta.d |
|
2479 | # 1.0.0-alpha.beta 1.0.0-alpha.beta.d | |
2480 | # 1.0.0-alpha.beta 1.0.0-alpha.beta.1.2 |
|
2480 | # 1.0.0-alpha.beta 1.0.0-alpha.beta.1.2 | |
2481 | if [ -z "$a" ] && [ -n "$b" ]; then |
|
2481 | if [ -z "$a" ] && [ -n "$b" ]; then | |
2482 | semver_debug "Because B has larger set of pre-identifiers" |
|
2482 | semver_debug "Because B has larger set of pre-identifiers" | |
2483 | outcome "-1" |
|
2483 | outcome "-1" | |
2484 | return |
|
2484 | return | |
2485 | fi |
|
2485 | fi | |
2486 |
|
2486 | |||
2487 | # Spec #11.4.1 |
|
2487 | # Spec #11.4.1 | |
2488 | # Identifiers consisting of only digits are compared numerically. |
|
2488 | # Identifiers consisting of only digits are compared numerically. | |
2489 | if [ "$(isNumber "$a")" = "true" ] || [ "$(isNumber "$b")" = "true" ]; then |
|
2489 | if [ "$(isNumber "$a")" = "true" ] || [ "$(isNumber "$b")" = "true" ]; then | |
2490 |
|
2490 | |||
2491 | # if both identifiers are numbers, then compare and proceed |
|
2491 | # if both identifiers are numbers, then compare and proceed | |
2492 | # 1.0.0-beta.3 1.0.0-beta.2 |
|
2492 | # 1.0.0-beta.3 1.0.0-beta.2 | |
2493 | if [ "$(isNumber "$a")" = "true" ] && [ "$(isNumber "$b")" = "true" ]; then |
|
2493 | if [ "$(isNumber "$a")" = "true" ] && [ "$(isNumber "$b")" = "true" ]; then | |
2494 | if [ "$(compareNumber "$a" "$b")" != "0" ]; then |
|
2494 | if [ "$(compareNumber "$a" "$b")" != "0" ]; then | |
2495 | semver_debug "Number is not equal $(compareNumber "$a" "$b")" |
|
2495 | semver_debug "Number is not equal $(compareNumber "$a" "$b")" | |
2496 | outcome "$(compareNumber "$a" "$b")" |
|
2496 | outcome "$(compareNumber "$a" "$b")" | |
2497 | return |
|
2497 | return | |
2498 | fi |
|
2498 | fi | |
2499 | fi |
|
2499 | fi | |
2500 |
|
2500 | |||
2501 | # Spec 11.4.3 |
|
2501 | # Spec 11.4.3 | |
2502 | # 1.0.0-alpha.1 1.0.0-alpha.beta.d |
|
2502 | # 1.0.0-alpha.1 1.0.0-alpha.beta.d | |
2503 | # 1.0.0-beta.3 1.0.0-1.2 |
|
2503 | # 1.0.0-beta.3 1.0.0-1.2 | |
2504 | if [ "$(isNumber "$a")" = "false" ]; then |
|
2504 | if [ "$(isNumber "$a")" = "false" ]; then | |
2505 | semver_debug "Because Numeric identifiers always have lower precedence than non-numeric identifiers." |
|
2505 | semver_debug "Because Numeric identifiers always have lower precedence than non-numeric identifiers." | |
2506 | outcome "1" |
|
2506 | outcome "1" | |
2507 | return |
|
2507 | return | |
2508 | fi |
|
2508 | fi | |
2509 | # 1.0.0-alpha.d 1.0.0-alpha.beta.1 |
|
2509 | # 1.0.0-alpha.d 1.0.0-alpha.beta.1 | |
2510 | # 1.0.0-1.1 1.0.0-beta.1.2 |
|
2510 | # 1.0.0-1.1 1.0.0-beta.1.2 | |
2511 | if [ "$(isNumber "$b")" = "false" ]; then |
|
2511 | if [ "$(isNumber "$b")" = "false" ]; then | |
2512 | semver_debug "Because Numeric identifiers always have lower precedence than non-numeric identifiers." |
|
2512 | semver_debug "Because Numeric identifiers always have lower precedence than non-numeric identifiers." | |
2513 | outcome "-1" |
|
2513 | outcome "-1" | |
2514 | return |
|
2514 | return | |
2515 | fi |
|
2515 | fi | |
2516 | else |
|
2516 | else | |
2517 | # Spec 11.4.2 |
|
2517 | # Spec 11.4.2 | |
2518 | # Identifiers with letters or hyphens are compared lexically in ASCII sort order. |
|
2518 | # Identifiers with letters or hyphens are compared lexically in ASCII sort order. | |
2519 | # 1.0.0-alpha 1.0.0-beta.alpha |
|
2519 | # 1.0.0-alpha 1.0.0-beta.alpha | |
2520 | if [ "$(compareString "$a" "$b")" != "0" ]; then |
|
2520 | if [ "$(compareString "$a" "$b")" != "0" ]; then | |
2521 | semver_debug "cardinal is not equal $(compareString a b)" |
|
2521 | semver_debug "cardinal is not equal $(compareString a b)" | |
2522 | outcome "$(compareString "$a" "$b")" |
|
2522 | outcome "$(compareString "$a" "$b")" | |
2523 | return |
|
2523 | return | |
2524 | fi |
|
2524 | fi | |
2525 | fi |
|
2525 | fi | |
2526 |
|
2526 | |||
2527 | # Edge case when there is single identifier exaple: x.y.z-beta |
|
2527 | # Edge case when there is single identifier exaple: x.y.z-beta | |
2528 | if [ "$cursor" = 1 ]; then |
|
2528 | if [ "$cursor" = 1 ]; then | |
2529 |
|
2529 | |||
2530 | # When both versions are single return equals |
|
2530 | # When both versions are single return equals | |
2531 | # 1.0.0-alpha 1.0.0-alpha |
|
2531 | # 1.0.0-alpha 1.0.0-alpha | |
2532 | if [ -n "$(isSingleIdentifier "$b_pre" "$b")" ] && [ -n "$(isSingleIdentifier "$a_pre" "$a")" ]; then |
|
2532 | if [ -n "$(isSingleIdentifier "$b_pre" "$b")" ] && [ -n "$(isSingleIdentifier "$a_pre" "$a")" ]; then | |
2533 | semver_debug "Because both have single identifier" |
|
2533 | semver_debug "Because both have single identifier" | |
2534 | outcome "0" |
|
2534 | outcome "0" | |
2535 | return |
|
2535 | return | |
2536 | fi |
|
2536 | fi | |
2537 |
|
2537 | |||
2538 | # Return greater when has more identifiers |
|
2538 | # Return greater when has more identifiers | |
2539 | # Spec 11.4.4: A larger set of pre-release fields has a higher precedence than a smaller set, if all of the preceding identifiers are equal. |
|
2539 | # Spec 11.4.4: A larger set of pre-release fields has a higher precedence than a smaller set, if all of the preceding identifiers are equal. | |
2540 |
|
2540 | |||
2541 | # When A is larger than B |
|
2541 | # When A is larger than B | |
2542 | # 1.0.0-alpha.beta 1.0.0-alpha |
|
2542 | # 1.0.0-alpha.beta 1.0.0-alpha | |
2543 | if [ -n "$(isSingleIdentifier "$b_pre" "$b")" ] && [ -z "$(isSingleIdentifier "$a_pre" "$a")" ]; then |
|
2543 | if [ -n "$(isSingleIdentifier "$b_pre" "$b")" ] && [ -z "$(isSingleIdentifier "$a_pre" "$a")" ]; then | |
2544 | semver_debug "Because of single identifier, A has more pre-identifiers" |
|
2544 | semver_debug "Because of single identifier, A has more pre-identifiers" | |
2545 | outcome "1" |
|
2545 | outcome "1" | |
2546 | return |
|
2546 | return | |
2547 | fi |
|
2547 | fi | |
2548 |
|
2548 | |||
2549 | # When A is shorter than B |
|
2549 | # When A is shorter than B | |
2550 | # 1.0.0-alpha 1.0.0-alpha.beta |
|
2550 | # 1.0.0-alpha 1.0.0-alpha.beta | |
2551 | if [ -z "$(isSingleIdentifier "$b_pre" "$b")" ] && [ -n "$(isSingleIdentifier "$a_pre" "$a")" ]; then |
|
2551 | if [ -z "$(isSingleIdentifier "$b_pre" "$b")" ] && [ -n "$(isSingleIdentifier "$a_pre" "$a")" ]; then | |
2552 | semver_debug "Because of single identifier, B has more pre-identifiers" |
|
2552 | semver_debug "Because of single identifier, B has more pre-identifiers" | |
2553 | outcome "-1" |
|
2553 | outcome "-1" | |
2554 | return |
|
2554 | return | |
2555 | fi |
|
2555 | fi | |
2556 | fi |
|
2556 | fi | |
2557 |
|
2557 | |||
2558 | # Proceed to the next identifier because previous comparition was equal. |
|
2558 | # Proceed to the next identifier because previous comparition was equal. | |
2559 | cursor=$((cursor + 1)) |
|
2559 | cursor=$((cursor + 1)) | |
2560 | done |
|
2560 | done | |
2561 | } |
|
2561 | } | |
2562 |
|
2562 | |||
2563 | # consistent sed function |
|
2563 | # consistent sed function | |
2564 | # example sed_func x y file.txt |
|
2564 | # example sed_func x y file.txt | |
2565 | sed_func() { |
|
2565 | sed_func() { | |
2566 | if [[ $DEBUG ]]; then |
|
2566 | if [[ $DEBUG ]]; then | |
2567 | echo |
|
2567 | echo | |
2568 | echo "sed -i .replaced -E \"s/$1/$2/\" $in_file" |
|
2568 | echo "sed -i .replaced -E \"s/$1/$2/\" $in_file" | |
2569 | echo "pat1: $1" |
|
2569 | echo "pat1: $1" | |
2570 | echo "pat2: $2" |
|
2570 | echo "pat2: $2" | |
2571 | fi |
|
2571 | fi | |
2572 |
|
2572 | |||
2573 | in_file=$3 |
|
2573 | in_file=$3 | |
2574 | sed -i.replaced -E "s/$1/$2/" $in_file |
|
2574 | sed -i.replaced -E "s/$1/$2/" $in_file | |
2575 | } |
|
2575 | } | |
2576 |
|
2576 | |||
2577 | # create a slug from a name |
|
2577 | # create a slug from a name | |
2578 | slugify() { |
|
2578 | slugify() { | |
2579 | local input="$1" |
|
2579 | local input="$1" | |
2580 | local slug |
|
2580 | local slug | |
2581 |
|
2581 | |||
2582 | # Convert to lowercase |
|
2582 | # Convert to lowercase | |
2583 | slug="${input,,}" |
|
2583 | slug="${input,,}" | |
2584 |
|
2584 | |||
2585 | # Replace slashes with underscores |
|
2585 | # Replace slashes with underscores | |
2586 | slug="${slug//\//_}" |
|
2586 | slug="${slug//\//_}" | |
2587 |
|
2587 | |||
2588 | # Replace spaces with hyphens |
|
2588 | # Replace spaces with hyphens | |
2589 | slug="${slug// /_}" |
|
2589 | slug="${slug// /_}" | |
2590 |
|
2590 | |||
2591 | # Remove characters that are not letters, numbers, or hyphens, or underscores |
|
2591 | # Remove characters that are not letters, numbers, or hyphens, or underscores | |
2592 | slug="${slug//[^a-zA-Z0-9-_]/}" |
|
2592 | slug="${slug//[^a-zA-Z0-9-_]/}" | |
2593 |
|
2593 | |||
2594 | echo "$slug" |
|
2594 | echo "$slug" | |
2595 | } |
|
2595 | } | |
2596 |
|
2596 | |||
2597 | check_os() { |
|
2597 | check_os() { | |
2598 | echo `uname -s` |
|
2598 | echo `uname -s` | |
2599 | } |
|
2599 | } | |
2600 |
|
2600 | |||
2601 | check_macos_memory() { |
|
2601 | check_macos_memory() { | |
2602 | echo $(($(memory_pressure | head -n 1 | awk '{ print $4 }') / 1024 / 1024 / 1024)) |
|
2602 | echo $(($(memory_pressure | head -n 1 | awk '{ print $4 }') / 1024 / 1024 / 1024)) | |
2603 | } |
|
2603 | } | |
2604 |
|
2604 | |||
2605 | check_linux_memory() { |
|
2605 | check_linux_memory() { | |
2606 | mem=`free -m --si | awk ' /Mem:/ {print $2}'` |
|
2606 | mem=`free -m --si | awk ' /Mem:/ {print $2}'` | |
2607 | if [ "$mem" -ge 990 -a "$mem" -lt 1000 ]; then |
|
2607 | if [ "$mem" -ge 990 -a "$mem" -lt 1000 ]; then | |
2608 | echo 1 |
|
2608 | echo 1 | |
2609 | else |
|
2609 | else | |
2610 | echo `free -g --si | awk ' /Mem:/ {print $2} '` |
|
2610 | echo `free -g --si | awk ' /Mem:/ {print $2} '` | |
2611 | fi |
|
2611 | fi | |
2612 | } |
|
2612 | } | |
2613 |
|
2613 | |||
2614 | # src/lib/validate_stack_exists.sh |
|
2614 | # src/lib/validate_stack_exists.sh | |
2615 |
|
2615 | |||
2616 | validate_stack_exists() { |
|
2616 | validate_stack_exists() { | |
2617 | err="" |
|
2617 | err="" | |
2618 | invalid="1" |
|
2618 | invalid="1" | |
2619 |
|
2619 | |||
2620 | for item in $VALID_SERVICES |
|
2620 | for item in $VALID_SERVICES | |
2621 | do |
|
2621 | do | |
2622 | if [ "$1" == "$item" ]; then |
|
2622 | if [ "$1" == "$item" ]; then | |
2623 | invalid="" |
|
2623 | invalid="" | |
2624 | break |
|
2624 | break | |
2625 | fi |
|
2625 | fi | |
2626 | done |
|
2626 | done | |
2627 |
|
2627 | |||
2628 | if [[ -n $invalid ]]; then |
|
2628 | if [[ -n $invalid ]]; then | |
2629 | err="command '$1' not in list of $VALID_SERVICES" |
|
2629 | err="command '$1' not in list of $VALID_SERVICES" | |
2630 | fi |
|
2630 | fi | |
2631 |
|
2631 | |||
2632 | echo $err |
|
2632 | echo $err | |
2633 | } |
|
2633 | } | |
2634 |
|
2634 | |||
2635 | # src/lib/validations/validate_dir_exists.sh |
|
2635 | # src/lib/validations/validate_dir_exists.sh | |
2636 | validate_dir_exists() { |
|
2636 | validate_dir_exists() { | |
2637 | [[ -d "$1" ]] || echo "must be an existing directory" |
|
2637 | [[ -d "$1" ]] || echo "must be an existing directory" | |
2638 | } |
|
2638 | } | |
2639 |
|
2639 | |||
2640 | # src/lib/validations/validate_file_exists.sh |
|
2640 | # src/lib/validations/validate_file_exists.sh | |
2641 | validate_file_exists() { |
|
2641 | validate_file_exists() { | |
2642 | [[ -f "$1" ]] || echo "must be an existing file" |
|
2642 | [[ -f "$1" ]] || echo "must be an existing file" | |
2643 | } |
|
2643 | } | |
2644 |
|
2644 | |||
2645 | # src/lib/validations/validate_integer.sh |
|
2645 | # src/lib/validations/validate_integer.sh | |
2646 | validate_integer() { |
|
2646 | validate_integer() { | |
2647 | [[ "$1" =~ ^[0-9]+$ ]] || echo "must be an integer" |
|
2647 | [[ "$1" =~ ^[0-9]+$ ]] || echo "must be an integer" | |
2648 | } |
|
2648 | } | |
2649 |
|
2649 | |||
2650 | # src/lib/validations/validate_not_empty.sh |
|
2650 | # src/lib/validations/validate_not_empty.sh | |
2651 | validate_not_empty() { |
|
2651 | validate_not_empty() { | |
2652 | [[ -z "$1" ]] && echo "must not be empty" |
|
2652 | [[ -z "$1" ]] && echo "must not be empty" | |
2653 | } |
|
2653 | } | |
2654 |
|
2654 | |||
2655 | # :command.command_functions |
|
2655 | # :command.command_functions | |
2656 | # :command.function |
|
2656 | # :command.function | |
2657 | rcstack_get_started_command() { |
|
2657 | rcstack_get_started_command() { | |
2658 | # src/get_started_command.sh |
|
2658 | # src/get_started_command.sh | |
2659 | get_started_full |
|
2659 | get_started_full | |
2660 | } |
|
2660 | } | |
2661 |
|
2661 | |||
2662 | # :command.function |
|
2662 | # :command.function | |
2663 | rcstack_init_command() { |
|
2663 | rcstack_init_command() { | |
2664 | # src/init_command.sh |
|
2664 | # src/init_command.sh | |
2665 | DEBUG=${args[--debug]} |
|
2665 | DEBUG=${args[--debug]} | |
2666 | force=${args[--force]} |
|
2666 | force=${args[--force]} | |
2667 | docker_revision=${args[--docker-revision]} |
|
2667 | docker_revision=${args[--docker-revision]} | |
2668 | install_docker=${args[--install-docker]} |
|
2668 | install_docker=${args[--install-docker]} | |
2669 | no_prompt=${args[--no-prompt]} |
|
2669 | no_prompt=${args[--no-prompt]} | |
2670 |
|
2670 | |||
2671 | eval "stages_from_cli=(${args[--stage]})" |
|
2671 | eval "stages_from_cli=(${args[--stage]})" | |
2672 |
|
2672 | |||
2673 | # CLI passed args / defaults |
|
2673 | # CLI passed args / defaults | |
2674 |
|
2674 | |||
2675 | if [[ -z ${args['--arg-rc-edition']} ]]; then |
|
2675 | if [[ -z ${args['--arg-rc-edition']} ]]; then | |
2676 | # set default |
|
2676 | # set default | |
2677 | args['--arg-rc-edition']="ee" |
|
2677 | args['--arg-rc-edition']="ee" | |
2678 | else |
|
2678 | else | |
2679 | # mark we used flag and don't ask in prompts |
|
2679 | # mark we used flag and don't ask in prompts | |
2680 | args['__arg_rc_edition']=1 |
|
2680 | args['__arg_rc_edition']=1 | |
2681 | fi |
|
2681 | fi | |
2682 |
|
2682 | |||
2683 | if [[ -z ${args['--arg-rc-version']} ]]; then |
|
2683 | if [[ -z ${args['--arg-rc-version']} ]]; then | |
2684 | # set default |
|
2684 | # set default | |
2685 | args['--arg-rc-version']=$rc_image_ver |
|
2685 | args['--arg-rc-version']=$rc_image_ver | |
2686 | else |
|
2686 | else | |
2687 | # mark we used flag and don't ask in prompts |
|
2687 | # mark we used flag and don't ask in prompts | |
2688 | args['__arg_rc_version']=1 |
|
2688 | args['__arg_rc_version']=1 | |
2689 | fi |
|
2689 | fi | |
2690 |
|
2690 | |||
2691 | if [[ -z ${args['--arg-accept-eula']} ]]; then |
|
2691 | if [[ -z ${args['--arg-accept-eula']} ]]; then | |
2692 | # set default |
|
2692 | # set default | |
2693 | args['--arg-accept-eula']="yes" |
|
2693 | args['--arg-accept-eula']="yes" | |
2694 | else |
|
2694 | else | |
2695 | # mark we used flag and don't ask in prompts |
|
2695 | # mark we used flag and don't ask in prompts | |
2696 | args['__arg_accept_eula']=1 |
|
2696 | args['__arg_accept_eula']=1 | |
2697 | fi |
|
2697 | fi | |
2698 |
|
2698 | |||
2699 | if [[ -z ${args['--arg-hostname']} ]]; then |
|
2699 | if [[ -z ${args['--arg-hostname']} ]]; then | |
2700 | # set default |
|
2700 | # set default | |
2701 | args['--arg-hostname']="rhodecode.local" |
|
2701 | args['--arg-hostname']="rhodecode.local" | |
2702 | else |
|
2702 | else | |
2703 | # mark we used flag and don't ask in prompts |
|
2703 | # mark we used flag and don't ask in prompts | |
2704 | args['__arg_hostname']=1 |
|
2704 | args['__arg_hostname']=1 | |
2705 | fi |
|
2705 | fi | |
2706 |
|
2706 | |||
2707 | if [[ -z ${args['--arg-use-ssl']} ]]; then |
|
2707 | if [[ -z ${args['--arg-use-ssl']} ]]; then | |
2708 | # set default |
|
2708 | # set default | |
2709 | args['--arg-use-ssl']="n" |
|
2709 | args['--arg-use-ssl']="n" | |
2710 | else |
|
2710 | else | |
2711 | # mark we used flag and don't ask in prompts |
|
2711 | # mark we used flag and don't ask in prompts | |
2712 | args['__arg_use_ssl']=1 |
|
2712 | args['__arg_use_ssl']=1 | |
2713 | fi |
|
2713 | fi | |
2714 |
|
2714 | |||
2715 | if [[ -z ${args['--arg-database-type']} ]]; then |
|
2715 | if [[ -z ${args['--arg-database-type']} ]]; then | |
2716 | # set default |
|
2716 | # set default | |
2717 | args['--arg-database-type']="postgres" |
|
2717 | args['--arg-database-type']="postgres" | |
2718 | else |
|
2718 | else | |
2719 | # mark we used flag and don't ask in prompts |
|
2719 | # mark we used flag and don't ask in prompts | |
2720 | args['__arg_database_type']=1 |
|
2720 | args['__arg_database_type']=1 | |
2721 | fi |
|
2721 | fi | |
2722 |
|
2722 | |||
2723 | if [[ -z ${args['--arg-admin-email']} ]]; then |
|
2723 | if [[ -z ${args['--arg-admin-email']} ]]; then | |
2724 | # set default |
|
2724 | # set default | |
2725 | args['--arg-admin-email']="admin@${args['--arg-hostname']}" |
|
2725 | args['--arg-admin-email']="admin@${args['--arg-hostname']}" | |
2726 | else |
|
2726 | else | |
2727 | # mark we used flag and don't ask in prompts |
|
2727 | # mark we used flag and don't ask in prompts | |
2728 | args['__arg_admin_email']=1 |
|
2728 | args['__arg_admin_email']=1 | |
2729 | fi |
|
2729 | fi | |
2730 |
|
2730 | |||
2731 | if [[ -z ${args['--arg-admin-user']} ]]; then |
|
2731 | if [[ -z ${args['--arg-admin-user']} ]]; then | |
2732 | # set default |
|
2732 | # set default | |
2733 | args['--arg-admin-user']="admin" |
|
2733 | args['--arg-admin-user']="admin" | |
2734 | else |
|
2734 | else | |
2735 | # mark we used flag and don't ask in prompts |
|
2735 | # mark we used flag and don't ask in prompts | |
2736 | args['__arg_admin_user']=1 |
|
2736 | args['__arg_admin_user']=1 | |
2737 | fi |
|
2737 | fi | |
2738 |
|
2738 | |||
2739 | if [[ -z ${args['--arg-admin-pass']} ]]; then |
|
2739 | if [[ -z ${args['--arg-admin-pass']} ]]; then | |
2740 | # set default |
|
2740 | # set default | |
2741 | args['--arg-admin-pass']="secret4" |
|
2741 | args['--arg-admin-pass']="secret4" | |
2742 | else |
|
2742 | else | |
2743 | # mark we used flag and don't ask in prompts |
|
2743 | # mark we used flag and don't ask in prompts | |
2744 | args['__arg_admin_pass']=1 |
|
2744 | args['__arg_admin_pass']=1 | |
2745 | fi |
|
2745 | fi | |
2746 |
|
2746 | |||
2747 | if [[ -z ${args['--arg-license-token']} ]]; then |
|
2747 | if [[ -z ${args['--arg-license-token']} ]]; then | |
2748 | # set default |
|
2748 | # set default | |
2749 | args['--arg-license-token']="$(random_str 4)"-"$(random_str 4)"-"$(random_str 4)"-"$(random_str 4)" |
|
2749 | args['--arg-license-token']="$(random_str 4)"-"$(random_str 4)"-"$(random_str 4)"-"$(random_str 4)" | |
2750 | else |
|
2750 | else | |
2751 | # mark we used flag and don't ask in prompts |
|
2751 | # mark we used flag and don't ask in prompts | |
2752 | args['__arg_license_token']=1 |
|
2752 | args['__arg_license_token']=1 | |
2753 | fi |
|
2753 | fi | |
2754 |
|
2754 | |||
2755 | arg_rc_edition=${args[--arg-rc-edition]} |
|
2755 | arg_rc_edition=${args[--arg-rc-edition]} | |
2756 | arg_rc_version=${args[--arg-rc-version]} |
|
2756 | arg_rc_version=${args[--arg-rc-version]} | |
2757 | arg_accept_eula=${args[--arg-accept-eula]} |
|
2757 | arg_accept_eula=${args[--arg-accept-eula]} | |
2758 | arg_hostname=${args[--arg-hostname]} |
|
2758 | arg_hostname=${args[--arg-hostname]} | |
2759 | arg_database_type=${args[--arg-database-type]} |
|
2759 | arg_database_type=${args[--arg-database-type]} | |
2760 | arg_use_ssl=${args[--arg-use-ssl]} |
|
2760 | arg_use_ssl=${args[--arg-use-ssl]} | |
2761 | arg_admin_email=${args[--arg-admin-email]} |
|
2761 | arg_admin_email=${args[--arg-admin-email]} | |
2762 | arg_admin_user=${args[--arg-admin-user]} |
|
2762 | arg_admin_user=${args[--arg-admin-user]} | |
2763 | arg_admin_pass=${args[--arg-admin-pass]} |
|
2763 | arg_admin_pass=${args[--arg-admin-pass]} | |
2764 | arg_license_token=${args[--arg-license-token]} |
|
2764 | arg_license_token=${args[--arg-license-token]} | |
2765 |
|
2765 | |||
2766 | ask_user_for_config() { |
|
2766 | ask_user_for_config() { | |
2767 | local config_done="n" |
|
2767 | local config_done="n" | |
2768 |
|
2768 | |||
2769 | echo "Starting interactive setup for v:$arg_rc_version..." |
|
2769 | echo "Starting interactive setup for v:$arg_rc_version..." | |
2770 | echo "" |
|
2770 | echo "" | |
2771 |
|
2771 | |||
2772 | while [[ "$config_done" == "n" ]] |
|
2772 | while [[ "$config_done" == "n" ]] | |
2773 | # config loop start |
|
2773 | # config loop start | |
2774 | do |
|
2774 | do | |
2775 | # edition to install |
|
2775 | # edition to install | |
2776 | if [ ! -z "$arg_rc_edition" ] && [ -z ${args['__arg_rc_edition']} ] |
|
2776 | if [ ! -z "$arg_rc_edition" ] && [ -z ${args['__arg_rc_edition']} ] | |
2777 | then |
|
2777 | then | |
2778 | read -p "Select 'ee' to use Enterprise edition or type 'ce' to use Community free edition: rhodecode-[$arg_rc_edition]: " new_value |
|
2778 | read -p "Select 'ee' to use Enterprise edition or type 'ce' to use Community free edition: rhodecode-[$arg_rc_edition]: " new_value | |
2779 | if [ ! -z "$new_value" ] |
|
2779 | if [ ! -z "$new_value" ] | |
2780 | then |
|
2780 | then | |
2781 | arg_rc_edition="$new_value" |
|
2781 | arg_rc_edition="$new_value" | |
2782 | fi |
|
2782 | fi | |
2783 |
|
2783 | |||
2784 | # validation |
|
2784 | # validation | |
2785 | if [[ ! $arg_rc_edition =~ ^(ce|ee)$ ]]; then |
|
2785 | if [[ ! $arg_rc_edition =~ ^(ce|ee)$ ]]; then | |
2786 | echo |
|
2786 | echo | |
2787 | echo "$(red edition_type must be one of: ce, ee not $arg_rc_edition, defaulting to ee)" |
|
2787 | echo "$(red edition_type must be one of: ce, ee not $arg_rc_edition, defaulting to ee)" | |
2788 | echo |
|
2788 | echo | |
2789 | arg_rc_edition="ee" |
|
2789 | arg_rc_edition="ee" | |
2790 | fi |
|
2790 | fi | |
2791 |
|
2791 | |||
2792 | fi |
|
2792 | fi | |
2793 |
|
2793 | |||
2794 | if [ ! -z "$arg_accept_eula" ] && [ -z ${args['__arg_accept_eula']} ] |
|
2794 | if [ ! -z "$arg_accept_eula" ] && [ -z ${args['__arg_accept_eula']} ] | |
2795 | then |
|
2795 | then | |
2796 | if [[ $arg_rc_edition == "ee" ]]; then |
|
2796 | if [[ $arg_rc_edition == "ee" ]]; then | |
2797 | #EE EULA |
|
2797 | #EE EULA | |
2798 | 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 |
|
2798 | 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 | |
2799 | else |
|
2799 | else | |
2800 | #CE EULA |
|
2800 | #CE EULA | |
2801 | 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 |
|
2801 | 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 | |
2802 | fi |
|
2802 | fi | |
2803 |
|
2803 | |||
2804 | if [ ! -z "$new_value" ] |
|
2804 | if [ ! -z "$new_value" ] | |
2805 | then |
|
2805 | then | |
2806 | arg_accept_eula="$new_value" |
|
2806 | arg_accept_eula="$new_value" | |
2807 | fi |
|
2807 | fi | |
2808 |
|
2808 | |||
2809 | if [[ $arg_accept_eula != "yes" ]]; then |
|
2809 | if [[ $arg_accept_eula != "yes" ]]; then | |
2810 | echo "$(red please accept EULA by typing yes, no installation is possible without accepted EULA)" |
|
2810 | echo "$(red please accept EULA by typing yes, no installation is possible without accepted EULA)" | |
2811 | exit |
|
2811 | exit | |
2812 | fi |
|
2812 | fi | |
2813 | fi |
|
2813 | fi | |
2814 |
|
2814 | |||
2815 | # ask for license-token IF edition is ee |
|
2815 | # ask for license-token IF edition is ee | |
2816 | if [[ $arg_rc_edition == "ee" ]]; then |
|
2816 | if [[ $arg_rc_edition == "ee" ]]; then | |
2817 | if [ ! -z "$arg_license_token" ] && [ -z ${args['__arg_license_token']} ] |
|
2817 | if [ ! -z "$arg_license_token" ] && [ -z ${args['__arg_license_token']} ] | |
2818 | then |
|
2818 | then | |
2819 | read -p "enter a valid license-token or use pre-generated one [$arg_license_token]: " new_value |
|
2819 | read -p "enter a valid license-token or use pre-generated one [$arg_license_token]: " new_value | |
2820 | if [ ! -z "$new_value" ] |
|
2820 | if [ ! -z "$new_value" ] | |
2821 | then |
|
2821 | then | |
2822 | arg_license_token="$new_value" |
|
2822 | arg_license_token="$new_value" | |
2823 | fi |
|
2823 | fi | |
2824 | fi |
|
2824 | fi | |
2825 | fi |
|
2825 | fi | |
2826 |
|
2826 | |||
2827 | # hostname |
|
2827 | # hostname | |
2828 | if [ ! -z "$arg_hostname" ] && [ -z ${args['__arg_hostname']} ] |
|
2828 | if [ ! -z "$arg_hostname" ] && [ -z ${args['__arg_hostname']} ] | |
2829 | then |
|
2829 | then | |
2830 | read -p "Enter a valid hostname for RhodeCode Stack? [$arg_hostname]: " new_value |
|
2830 | read -p "Enter a valid hostname for RhodeCode Stack? [$arg_hostname]: " new_value | |
2831 | if [ ! -z "$new_value" ] |
|
2831 | if [ ! -z "$new_value" ] | |
2832 | then |
|
2832 | then | |
2833 | arg_hostname="$new_value" |
|
2833 | arg_hostname="$new_value" | |
2834 | fi |
|
2834 | fi | |
2835 |
|
2835 | |||
2836 | # validation |
|
2836 | # validation | |
2837 | if [[ $arg_hostname =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]] |
|
2837 | if [[ $arg_hostname =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]] | |
2838 | then |
|
2838 | then | |
2839 | echo |
|
2839 | echo | |
2840 | echo "$(red IP addresses are unsupported and will not work. Please provide a DNS hostname)" |
|
2840 | echo "$(red IP addresses are unsupported and will not work. Please provide a DNS hostname)" | |
2841 | echo |
|
2841 | echo | |
2842 | arg_hostname="rc-docker.local" |
|
2842 | arg_hostname="rc-docker.local" | |
2843 | fi |
|
2843 | fi | |
2844 | fi |
|
2844 | fi | |
2845 |
|
2845 | |||
2846 | # database type |
|
2846 | # database type | |
2847 | if [ ! -z "$arg_database_type" ] && [ -z ${args['__arg_database_type']} ] |
|
2847 | if [ ! -z "$arg_database_type" ] && [ -z ${args['__arg_database_type']} ] | |
2848 | then |
|
2848 | then | |
2849 | read -p "Enter a database type? postgres, mysql, none [$arg_database_type]: " new_value |
|
2849 | read -p "Enter a database type? postgres, mysql, none [$arg_database_type]: " new_value | |
2850 | if [ ! -z "$new_value" ] |
|
2850 | if [ ! -z "$new_value" ] | |
2851 | then |
|
2851 | then | |
2852 | arg_database_type="$new_value" |
|
2852 | arg_database_type="$new_value" | |
2853 | fi |
|
2853 | fi | |
2854 |
|
2854 | |||
2855 | # validation |
|
2855 | # validation | |
2856 | if [[ ! $arg_database_type =~ ^(postgres|mysql|none)$ ]] |
|
2856 | if [[ ! $arg_database_type =~ ^(postgres|mysql|none)$ ]] | |
2857 | then |
|
2857 | then | |
2858 | echo |
|
2858 | echo | |
2859 | echo "$(red database type must be one of postgres, mysql, none, defaulting to postgres)" |
|
2859 | echo "$(red database type must be one of postgres, mysql, none, defaulting to postgres)" | |
2860 | echo |
|
2860 | echo | |
2861 | arg_database_type="postgres" |
|
2861 | arg_database_type="postgres" | |
2862 | fi |
|
2862 | fi | |
2863 | fi |
|
2863 | fi | |
2864 |
|
2864 | |||
2865 | # use SSL |
|
2865 | # use SSL | |
2866 | if [ ! -z "$arg_use_ssl" ] && [ -z ${args['__arg_use_ssl']} ] |
|
2866 | if [ ! -z "$arg_use_ssl" ] && [ -z ${args['__arg_use_ssl']} ] | |
2867 | then |
|
2867 | then | |
2868 | 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 |
|
2868 | 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 | |
2869 | if [ ! -z "$new_value" ] |
|
2869 | if [ ! -z "$new_value" ] | |
2870 | then |
|
2870 | then | |
2871 | arg_use_ssl="$new_value" |
|
2871 | arg_use_ssl="$new_value" | |
2872 | fi |
|
2872 | fi | |
2873 | fi |
|
2873 | fi | |
2874 |
|
2874 | |||
2875 | # admin email |
|
2875 | # admin email | |
2876 | if [ ! -z "$arg_admin_email" ] && [ -z ${args['__arg_admin_email']} ] |
|
2876 | if [ ! -z "$arg_admin_email" ] && [ -z ${args['__arg_admin_email']} ] | |
2877 | then |
|
2877 | then | |
2878 | read -p "Enter first super-admin email? [$arg_admin_email]: " new_value |
|
2878 | read -p "Enter first super-admin email? [$arg_admin_email]: " new_value | |
2879 | if [ ! -z "$new_value" ] |
|
2879 | if [ ! -z "$new_value" ] | |
2880 | then |
|
2880 | then | |
2881 | arg_admin_email="$new_value" |
|
2881 | arg_admin_email="$new_value" | |
2882 | fi |
|
2882 | fi | |
2883 | fi |
|
2883 | fi | |
2884 |
|
2884 | |||
2885 | # admin user |
|
2885 | # admin user | |
2886 | if [ ! -z "$arg_admin_user" ] && [ -z ${args['__arg_admin_user']} ] |
|
2886 | if [ ! -z "$arg_admin_user" ] && [ -z ${args['__arg_admin_user']} ] | |
2887 | then |
|
2887 | then | |
2888 | read -p "Enter first super-admin account name? [$arg_admin_user]: " new_value |
|
2888 | read -p "Enter first super-admin account name? [$arg_admin_user]: " new_value | |
2889 | if [ ! -z "$new_value" ] |
|
2889 | if [ ! -z "$new_value" ] | |
2890 | then |
|
2890 | then | |
2891 | arg_admin_user="$new_value" |
|
2891 | arg_admin_user="$new_value" | |
2892 | fi |
|
2892 | fi | |
2893 | fi |
|
2893 | fi | |
2894 |
|
2894 | |||
2895 | # admin password |
|
2895 | # admin password | |
2896 | if [ ! -z "$arg_admin_pass" ] && [ -z ${args['__arg_admin_pass']} ] |
|
2896 | if [ ! -z "$arg_admin_pass" ] && [ -z ${args['__arg_admin_pass']} ] | |
2897 | then |
|
2897 | then | |
2898 | read -p "Enter first super-admin account password? [$arg_admin_pass]: " new_value |
|
2898 | read -p "Enter first super-admin account password? [$arg_admin_pass]: " new_value | |
2899 | if [ ! -z "$new_value" ] |
|
2899 | if [ ! -z "$new_value" ] | |
2900 | then |
|
2900 | then | |
2901 | arg_admin_pass="$new_value" |
|
2901 | arg_admin_pass="$new_value" | |
2902 | fi |
|
2902 | fi | |
2903 | fi |
|
2903 | fi | |
2904 |
|
2904 | |||
2905 | echo -e "\nDoes this look right?\n" |
|
2905 | echo -e "\nDoes this look right?\n" | |
2906 | echo "RhodeCode Edition : rhodecode-$arg_rc_edition @v:$arg_rc_version" |
|
2906 | echo "RhodeCode Edition : rhodecode-$arg_rc_edition @v:$arg_rc_version" | |
2907 | echo "License Token : $arg_license_token" |
|
2907 | echo "License Token : $arg_license_token" | |
2908 | echo "Hostname : $arg_hostname" |
|
2908 | echo "Hostname : $arg_hostname" | |
2909 | echo "Database : $arg_database_type" |
|
2909 | echo "Database : $arg_database_type" | |
2910 | echo "Use SSL : $arg_use_ssl" |
|
2910 | echo "Use SSL : $arg_use_ssl" | |
2911 | echo "Email : $arg_admin_email" |
|
2911 | echo "Email : $arg_admin_email" | |
2912 | echo "Admin user : $arg_admin_user" |
|
2912 | echo "Admin user : $arg_admin_user" | |
2913 | echo "Admin password : $arg_admin_pass" |
|
2913 | echo "Admin password : $arg_admin_pass" | |
2914 | echo "" |
|
2914 | echo "" | |
2915 | read -p "ENTER to continue, 'n' to try again, Ctrl+C to exit: " config_done |
|
2915 | read -p "ENTER to continue, 'n' to try again, Ctrl+C to exit: " config_done | |
2916 |
|
2916 | |||
2917 | # config loop end |
|
2917 | # config loop end | |
2918 | done |
|
2918 | done | |
2919 |
|
2919 | |||
2920 | } |
|
2920 | } | |
2921 |
|
2921 | |||
2922 | check_docker() { |
|
2922 | check_docker() { | |
2923 | (which docker || which docker.io) &>/dev/null |
|
2923 | (which docker || which docker.io) &>/dev/null | |
2924 | } |
|
2924 | } | |
2925 |
|
2925 | |||
2926 | bootstrap_docker_install() { |
|
2926 | bootstrap_docker_install() { | |
2927 | # systemctl enable docker on debian |
|
2927 | # systemctl enable docker on debian | |
2928 | echo "bootstrap_docker_install: trying to check and configure docker" |
|
2928 | echo "bootstrap_docker_install: trying to check and configure docker" | |
2929 | failMsg="Failed to find docker on your PATH" |
|
2929 | failMsg="Failed to find docker on your PATH" | |
2930 |
|
2930 | |||
2931 | if ! check_docker; then |
|
2931 | if ! check_docker; then | |
2932 |
|
2932 | |||
2933 | if [[ $install_docker == "n" ]]; then |
|
2933 | if [[ $install_docker == "n" ]]; then | |
2934 | echo "$(red $failMsg, exiting without docker install)" |
|
2934 | echo "$(red $failMsg, exiting without docker install)" | |
2935 | fi |
|
2935 | fi | |
2936 |
|
2936 | |||
2937 | echo "$(yellow $failMsg, trying docker install)" |
|
2937 | echo "$(yellow $failMsg, trying docker install)" | |
2938 |
|
2938 | |||
2939 | if [[ $install_docker == "y" ]]; then |
|
2939 | if [[ $install_docker == "y" ]]; then | |
2940 | echo "continuing with automated docker installation from https://get.docker.com/ " |
|
2940 | echo "continuing with automated docker installation from https://get.docker.com/ " | |
2941 | else |
|
2941 | else | |
2942 | read -p "Enter to install Docker directly from https://get.docker.com/ or Ctrl+C to exit and install it manually" |
|
2942 | read -p "Enter to install Docker directly from https://get.docker.com/ or Ctrl+C to exit and install it manually" | |
2943 | fi |
|
2943 | fi | |
2944 |
|
2944 | |||
2945 | curl -fsSL https://get.docker.com -o install-docker.sh |
|
2945 | curl -fsSL https://get.docker.com -o install-docker.sh | |
2946 | sh install-docker.sh |
|
2946 | sh install-docker.sh | |
2947 | rm install-docker.sh |
|
2947 | rm install-docker.sh | |
2948 |
|
2948 | |||
2949 | if ! check_docker; then |
|
2949 | if ! check_docker; then | |
2950 | echo "$failMsg" |
|
2950 | echo "$failMsg" | |
2951 | echo "Docker install failed. Quitting." |
|
2951 | echo "Docker install failed. Quitting." | |
2952 | exit 1 |
|
2952 | exit 1 | |
2953 | fi |
|
2953 | fi | |
2954 |
|
2954 | |||
2955 | docker --version |
|
2955 | docker --version | |
2956 |
|
2956 | |||
2957 | fi |
|
2957 | fi | |
2958 | } |
|
2958 | } | |
2959 |
|
2959 | |||
2960 | bootstrap_docker_commons() { |
|
2960 | bootstrap_docker_commons() { | |
2961 |
|
2961 | |||
2962 | echo 'bootstrap_docker_commons: running docker commands.' |
|
2962 | echo 'bootstrap_docker_commons: running docker commands.' | |
2963 |
|
2963 | |||
2964 | echo "bootstrap_docker_commons: creating volume 'rc_datavolume'" |
|
2964 | echo "bootstrap_docker_commons: creating volume 'rc_datavolume'" | |
2965 | docker volume create --label keep=1 --name=rc_datavolume |
|
2965 | docker volume create --label keep=1 --name=rc_datavolume | |
2966 | echo "bootstrap_docker_commons (rc_datavolume): done" |
|
2966 | echo "bootstrap_docker_commons (rc_datavolume): done" | |
2967 | echo "" |
|
2967 | echo "" | |
2968 |
|
2968 | |||
2969 | echo "bootstrap_docker_commons: creating volume 'rc_reposvolume'" |
|
2969 | echo "bootstrap_docker_commons: creating volume 'rc_reposvolume'" | |
2970 | docker volume create --label keep=1 --name=rc_reposvolume |
|
2970 | docker volume create --label keep=1 --name=rc_reposvolume | |
2971 | echo "bootstrap_docker_commons (rc_reposvolume): done" |
|
2971 | echo "bootstrap_docker_commons (rc_reposvolume): done" | |
2972 | echo "" |
|
2972 | echo "" | |
2973 |
|
2973 | |||
2974 | echo "bootstrap_docker_commons: creating network 'rhodecode_network'" |
|
2974 | echo "bootstrap_docker_commons: creating network 'rhodecode_network'" | |
2975 | docker network inspect rhodecode_network >/dev/null 2>&1 || docker network create rhodecode_network |
|
2975 | docker network inspect rhodecode_network >/dev/null 2>&1 || docker network create rhodecode_network | |
2976 | echo "bootstrap_docker_commons (rhodecode_network): done" |
|
2976 | echo "bootstrap_docker_commons (rhodecode_network): done" | |
2977 | echo "" |
|
2977 | echo "" | |
2978 |
|
2978 | |||
2979 | echo "bootstrap_docker_commons: creating loki logging" |
|
2979 | echo "bootstrap_docker_commons: creating loki logging" | |
2980 | loki_driver=$(docker plugin ls --format {{.Name}} --filter enabled=true | grep loki || echo "") |
|
2980 | loki_driver=$(docker plugin ls --format {{.Name}} --filter enabled=true | grep loki || echo "") | |
2981 | if [[ $loki_driver == "" ]]; then |
|
2981 | if [[ $loki_driver == "" ]]; then | |
2982 | docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions |
|
2982 | docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions | |
2983 | else |
|
2983 | else | |
2984 | echo "bootstrap_docker_commons: loki driver already exists" |
|
2984 | echo "bootstrap_docker_commons: loki driver already exists" | |
2985 | fi |
|
2985 | fi | |
2986 | } |
|
2986 | } | |
2987 |
|
2987 | |||
2988 | config_init() { |
|
2988 | config_init() { | |
2989 | loc_config_file=${CONFIG_FILE:=config.ini} |
|
2989 | loc_config_file=${CONFIG_FILE:=config.ini} | |
2990 | [[ -f "$loc_config_file" ]] || touch "$loc_config_file" |
|
2990 | [[ -f "$loc_config_file" ]] || touch "$loc_config_file" | |
2991 | } |
|
2991 | } | |
2992 |
|
2992 | |||
2993 | bootstrap_config() { |
|
2993 | bootstrap_config() { | |
2994 | shared_key=$(random_str 32) |
|
2994 | shared_key=$(random_str 32) | |
2995 | shared_key_md5=$(generate_md5 $shared_key | head -c 32) |
|
2995 | shared_key_md5=$(generate_md5 $shared_key | head -c 32) | |
2996 | db_key=$(random_str 32) |
|
2996 | db_key=$(random_str 32) | |
2997 |
|
2997 | |||
2998 | if [[ ! $no_prompt ]]; then |
|
2998 | if [[ ! $no_prompt ]]; then | |
2999 | ask_user_for_config |
|
2999 | ask_user_for_config | |
3000 | fi |
|
3000 | fi | |
3001 |
|
3001 | |||
3002 | # setup args |
|
3002 | # setup args | |
3003 | license_token=$arg_license_token |
|
3003 | license_token=$arg_license_token | |
3004 | log_formatter=$arg_log_formatter |
|
3004 | log_formatter=$arg_log_formatter | |
3005 | base_domain=$arg_hostname |
|
3005 | base_domain=$arg_hostname | |
3006 | rc_edition=$arg_rc_edition |
|
3006 | rc_edition=$arg_rc_edition | |
3007 | rc_version=$arg_rc_version |
|
3007 | rc_version=$arg_rc_version | |
3008 | database_type=$arg_database_type |
|
3008 | database_type=$arg_database_type | |
3009 |
|
3009 | |||
3010 | is_https=0 |
|
3010 | is_https=0 | |
3011 | if [[ $arg_use_ssl == "y" ]]; then is_https=1; fi |
|
3011 | if [[ $arg_use_ssl == "y" ]]; then is_https=1; fi | |
3012 |
|
3012 | |||
3013 | DB_USER='rhodecode' |
|
3013 | DB_USER='rhodecode' | |
3014 | DB_NAME='rhodecode' |
|
3014 | DB_NAME='rhodecode' | |
3015 |
|
3015 | |||
3016 | if [[ ! -f "$CONFIG_FILE" ]]; then |
|
3016 | if [[ ! -f "$CONFIG_FILE" ]]; then | |
3017 | echo "init new config at: $CONFIG_FILE" |
|
3017 | echo "init new config at: $CONFIG_FILE" | |
3018 | config_init |
|
3018 | config_init | |
3019 | else |
|
3019 | else | |
3020 | echo "re-using existing config at: $CONFIG_FILE" |
|
3020 | echo "re-using existing config at: $CONFIG_FILE" | |
3021 | fi |
|
3021 | fi | |
3022 |
|
3022 | |||
3023 | CUSTOM_DIR_PATH=$PWD/.custom |
|
3023 | CUSTOM_DIR_PATH=$PWD/.custom | |
3024 | mkdir -p "$CUSTOM_DIR_PATH" |
|
3024 | mkdir -p "$CUSTOM_DIR_PATH" | |
3025 | BOOTSTRAP_TMPL=$PWD/templates/runtime.env.tmpl |
|
3025 | BOOTSTRAP_TMPL=$PWD/templates/runtime.env.tmpl | |
3026 | BOOTSTRAP_RUNTIME_ENV=$PWD/.custom/.runtime.env |
|
3026 | BOOTSTRAP_RUNTIME_ENV=$PWD/.custom/.runtime.env | |
3027 |
|
3027 | |||
3028 | ver1="$(echo "$rc_version" | cut -d'.' -f1)" |
|
3028 | ver1="$(echo "$rc_version" | cut -d'.' -f1)" | |
3029 | ver2="$(echo "$rc_version" | cut -d'.' -f2)" |
|
3029 | ver2="$(echo "$rc_version" | cut -d'.' -f2)" | |
3030 |
|
3030 | |||
3031 | tmpl_ver="$ver1.$ver2" |
|
3031 | tmpl_ver="$ver1.$ver2" | |
3032 |
|
3032 | |||
3033 | if [[ ! -d $PWD/templates/ini/$tmpl_ver ]]; then |
|
3033 | if [[ ! -d $PWD/templates/ini/$tmpl_ver ]]; then | |
3034 | # no config dir exist, assume latest... |
|
3034 | # no config dir exist, assume latest... | |
3035 | tmpl_ver=edge |
|
3035 | tmpl_ver=edge | |
3036 | fi |
|
3036 | fi | |
3037 |
|
3037 | |||
3038 | INI_TARGET=$PWD/config/_shared |
|
3038 | INI_TARGET=$PWD/config/_shared | |
3039 | RHODECODE_INI_NAME=rhodecode.ini |
|
3039 | RHODECODE_INI_NAME=rhodecode.ini | |
3040 | RHODECODE_INI_TMPL=$PWD/templates/ini/$tmpl_ver/$RHODECODE_INI_NAME |
|
3040 | RHODECODE_INI_TMPL=$PWD/templates/ini/$tmpl_ver/$RHODECODE_INI_NAME | |
3041 | VCSSERVER_INI_NAME=vcsserver.ini |
|
3041 | VCSSERVER_INI_NAME=vcsserver.ini | |
3042 | VCSSERVER_INI_TMPL=$PWD/templates/ini/$tmpl_ver/$VCSSERVER_INI_NAME |
|
3042 | VCSSERVER_INI_TMPL=$PWD/templates/ini/$tmpl_ver/$VCSSERVER_INI_NAME | |
3043 |
|
3043 | |||
3044 | # break if we didn't use force and definitions exist |
|
3044 | # break if we didn't use force and definitions exist | |
3045 | if [[ -f $BOOTSTRAP_RUNTIME_ENV && ! $force ]]; then |
|
3045 | if [[ -f $BOOTSTRAP_RUNTIME_ENV && ! $force ]]; then | |
3046 | echo "$(yellow bootstrap_config: $BOOTSTRAP_RUNTIME_ENV file exists, not adding any configuration. Use --force to create it anyway)" |
|
3046 | echo "$(yellow bootstrap_config: $BOOTSTRAP_RUNTIME_ENV file exists, not adding any configuration. Use --force to create it anyway)" | |
3047 | return |
|
3047 | return | |
3048 | fi |
|
3048 | fi | |
3049 |
|
3049 | |||
3050 | if [[ -f $BOOTSTRAP_RUNTIME_ENV ]]; then |
|
3050 | if [[ -f $BOOTSTRAP_RUNTIME_ENV ]]; then | |
3051 | echo "$(yellow $BOOTSTRAP_RUNTIME_ENV file exists, are you sure to force re-create it?)" |
|
3051 | echo "$(yellow $BOOTSTRAP_RUNTIME_ENV file exists, are you sure to force re-create it?)" | |
3052 | while true; do |
|
3052 | while true; do | |
3053 | read -p "Would you like to continue with overriding file? [yn] " yn |
|
3053 | read -p "Would you like to continue with overriding file? [yn] " yn | |
3054 | case $yn in |
|
3054 | case $yn in | |
3055 | [Yy]*) break ;; |
|
3055 | [Yy]*) break ;; | |
3056 | [Nn]*) exit ;; |
|
3056 | [Nn]*) exit ;; | |
3057 | *) echo "Please answer y or n." ;; |
|
3057 | *) echo "Please answer y or n." ;; | |
3058 | esac |
|
3058 | esac | |
3059 | done |
|
3059 | done | |
3060 | fi |
|
3060 | fi | |
3061 |
|
3061 | |||
3062 | echo "bootstrap_config: init runtime env config at: $BOOTSTRAP_RUNTIME_ENV" |
|
3062 | echo "bootstrap_config: init runtime env config at: $BOOTSTRAP_RUNTIME_ENV" | |
3063 |
|
3063 | |||
3064 | # Make runtime file |
|
3064 | # Make runtime file | |
3065 | echo "## BOOTSTRAP GENERATED $(date) ##" > $BOOTSTRAP_RUNTIME_ENV |
|
3065 | echo "## BOOTSTRAP GENERATED $(date) ##" > $BOOTSTRAP_RUNTIME_ENV | |
3066 | echo "" >> "$BOOTSTRAP_RUNTIME_ENV" |
|
3066 | echo "" >> "$BOOTSTRAP_RUNTIME_ENV" | |
3067 |
|
3067 | |||
3068 | cat $BOOTSTRAP_TMPL >> $BOOTSTRAP_RUNTIME_ENV |
|
3068 | cat $BOOTSTRAP_TMPL >> $BOOTSTRAP_RUNTIME_ENV | |
3069 |
|
3069 | |||
3070 | # Make .ini files |
|
3070 | # Make .ini files | |
3071 | cp -v $RHODECODE_INI_TMPL $INI_TARGET |
|
3071 | cp -v $RHODECODE_INI_TMPL $INI_TARGET | |
3072 | echo "## rcstack config ver:$rc_version" | cat - "$INI_TARGET/$RHODECODE_INI_NAME" > temp_rc_ini && mv temp_rc_ini "$INI_TARGET/$RHODECODE_INI_NAME" |
|
3072 | echo "## rcstack config ver:$rc_version" | cat - "$INI_TARGET/$RHODECODE_INI_NAME" > temp_rc_ini && mv temp_rc_ini "$INI_TARGET/$RHODECODE_INI_NAME" | |
3073 |
|
3073 | |||
3074 | cp -v $VCSSERVER_INI_TMPL $INI_TARGET |
|
3074 | cp -v $VCSSERVER_INI_TMPL $INI_TARGET | |
3075 | echo "## rcstack config ver:$rc_version" | cat - "$INI_TARGET/$VCSSERVER_INI_NAME" > temp_vcs_ini && mv temp_vcs_ini "$INI_TARGET/$VCSSERVER_INI_NAME" |
|
3075 | echo "## rcstack config ver:$rc_version" | cat - "$INI_TARGET/$VCSSERVER_INI_NAME" > temp_vcs_ini && mv temp_vcs_ini "$INI_TARGET/$VCSSERVER_INI_NAME" | |
3076 |
|
3076 | |||
3077 | # init env generator with env file |
|
3077 | # init env generator with env file | |
3078 | .env --file "$BOOTSTRAP_RUNTIME_ENV" |
|
3078 | .env --file "$BOOTSTRAP_RUNTIME_ENV" | |
3079 |
|
3079 | |||
3080 | .env set RC_EDITION=$rc_edition |
|
3080 | .env set RC_EDITION=$rc_edition | |
3081 | .env set RC_VERSION=$rc_version |
|
3081 | .env set RC_VERSION=$rc_version | |
3082 | .env set DB_PASSWORD=$db_key |
|
3082 | .env set DB_PASSWORD=$db_key | |
3083 |
|
3083 | |||
3084 | .env set RHODECODE_USER_EMAIL=$arg_admin_email |
|
3084 | .env set RHODECODE_USER_EMAIL=$arg_admin_email | |
3085 | .env set RHODECODE_USER_NAME=$arg_admin_user |
|
3085 | .env set RHODECODE_USER_NAME=$arg_admin_user | |
3086 | .env set RHODECODE_USER_PASS=$arg_admin_pass |
|
3086 | .env set RHODECODE_USER_PASS=$arg_admin_pass | |
3087 |
|
3087 | |||
3088 | .env set RC_ENCRYPTED_SECRET=$shared_key |
|
3088 | .env set RC_ENCRYPTED_SECRET=$shared_key | |
3089 | .env set RC_SHARED_KEY=$shared_key |
|
3089 | .env set RC_SHARED_KEY=$shared_key | |
3090 |
|
3090 | |||
3091 | if [[ $database_type == "postgres" ]]; then |
|
3091 | if [[ $database_type == "postgres" ]]; then | |
3092 | rc_db1="postgresql://$DB_USER:$db_key@database/$DB_NAME" |
|
3092 | rc_db1="postgresql://$DB_USER:$db_key@database/$DB_NAME" | |
3093 | elif [[ $database_type == "mysql" ]]; then |
|
3093 | elif [[ $database_type == "mysql" ]]; then | |
3094 | rc_db1="mysql://$DB_USER:$db_key@database-mysql/$DB_NAME?charset=utf8" |
|
3094 | rc_db1="mysql://$DB_USER:$db_key@database-mysql/$DB_NAME?charset=utf8" | |
3095 | else |
|
3095 | else | |
3096 | rc_db1="sqlite:///%(here)s/rhodecode.db?timeout=30" |
|
3096 | rc_db1="sqlite:///%(here)s/rhodecode.db?timeout=30" | |
3097 | fi |
|
3097 | fi | |
3098 |
|
3098 | |||
3099 | .env set DB_TYPE=$database_type |
|
3099 | .env set DB_TYPE=$database_type | |
3100 | .env set RC_DB_URL="$rc_db1" |
|
3100 | .env set RC_DB_URL="$rc_db1" | |
3101 | .env set RC_SQLALCHEMY_DB1_URL="$rc_db1" |
|
3101 | .env set RC_SQLALCHEMY_DB1_URL="$rc_db1" | |
3102 |
|
3102 | |||
3103 | .env set RC_LICENSE_TOKEN=$license_token |
|
3103 | .env set RC_LICENSE_TOKEN=$license_token | |
3104 | .env set RC_HOSTNAME=$base_domain |
|
3104 | .env set RC_HOSTNAME=$base_domain | |
3105 |
|
3105 | |||
3106 | if [[ $is_https == 1 ]]; then |
|
3106 | if [[ $is_https == 1 ]]; then | |
3107 | app_base_url=https://$base_domain |
|
3107 | app_base_url=https://$base_domain | |
3108 | else |
|
3108 | else | |
3109 | app_base_url=http://$base_domain |
|
3109 | app_base_url=http://$base_domain | |
3110 | fi |
|
3110 | fi | |
3111 |
|
3111 | |||
3112 | .env set RC_APP_BASE_URL=$app_base_url |
|
3112 | .env set RC_APP_BASE_URL=$app_base_url | |
3113 |
|
3113 | |||
3114 | .env set RC_LOKI_AUTH=loki-auth:$shared_key@ |
|
3114 | .env set RC_LOKI_AUTH=loki-auth:$shared_key@ | |
3115 |
|
3115 | |||
3116 | .env puts '' |
|
3116 | .env puts '' | |
3117 | .env puts '# Log formatter option' |
|
3117 | .env puts '# Log formatter option' | |
3118 | .env set RC_LOGGING_FORMATTER=$log_formatter |
|
3118 | .env set RC_LOGGING_FORMATTER=$log_formatter | |
3119 | .env set RC_USE_CELERY=true |
|
3119 | .env set RC_USE_CELERY=true | |
3120 |
|
3120 | |||
3121 | .env puts '' |
|
3121 | .env puts '' | |
3122 | .env puts '# Channelstream config' |
|
3122 | .env puts '# Channelstream config' | |
3123 | .env set RC_CHANNELSTREAM_SERVER=channelstream:8000 |
|
3123 | .env set RC_CHANNELSTREAM_SERVER=channelstream:8000 | |
3124 |
|
3124 | |||
3125 | if [[ $is_https == 1 ]]; then |
|
3125 | if [[ $is_https == 1 ]]; then | |
3126 | rc_channelstream_url="wss://$base_domain/_channelstream" |
|
3126 | rc_channelstream_url="wss://$base_domain/_channelstream" | |
3127 | else |
|
3127 | else | |
3128 | rc_channelstream_url="ws://$base_domain/_channelstream" |
|
3128 | rc_channelstream_url="ws://$base_domain/_channelstream" | |
3129 | fi |
|
3129 | fi | |
3130 |
|
3130 | |||
3131 | .env set RC_CHANNELSTREAM_WS_URL=$rc_channelstream_url |
|
3131 | .env set RC_CHANNELSTREAM_WS_URL=$rc_channelstream_url | |
3132 |
|
3132 | |||
3133 | .env set CHANNELSTREAM_ALLOW_POSTING_FROM=0.0.0.0 |
|
3133 | .env set CHANNELSTREAM_ALLOW_POSTING_FROM=0.0.0.0 | |
3134 |
|
3134 | |||
3135 | .env puts '' |
|
3135 | .env puts '' | |
3136 | .env puts '# Channelstream secrets' |
|
3136 | .env puts '# Channelstream secrets' | |
3137 | .env set CHANNELSTREAM_SECRET=$shared_key |
|
3137 | .env set CHANNELSTREAM_SECRET=$shared_key | |
3138 | .env set RC_CHANNELSTREAM_SECRET=$shared_key |
|
3138 | .env set RC_CHANNELSTREAM_SECRET=$shared_key | |
3139 |
|
3139 | |||
3140 | .env puts '' |
|
3140 | .env puts '' | |
3141 | .env puts '# Channelstream admin' |
|
3141 | .env puts '# Channelstream admin' | |
3142 | .env set CHANNELSTREAM_ADMIN_SECRET=$shared_key |
|
3142 | .env set CHANNELSTREAM_ADMIN_SECRET=$shared_key | |
3143 | .env set RC_CHANNELSTREAM_ADMIN_SECRET=$shared_key |
|
3143 | .env set RC_CHANNELSTREAM_ADMIN_SECRET=$shared_key | |
3144 |
|
3144 | |||
3145 | .env puts '' |
|
3145 | .env puts '' | |
3146 | .env puts '# SSH PORT' |
|
3146 | .env puts '# SSH PORT' | |
3147 | .env set RC_SSH_PORT=9022 |
|
3147 | .env set RC_SSH_PORT=9022 | |
3148 |
|
3148 | |||
3149 | ini_path="$INI_TARGET/$VCSSERVER_INI_NAME" |
|
3149 | ini_path="$INI_TARGET/$VCSSERVER_INI_NAME" | |
3150 | config_vcsserver_ini |
|
3150 | config_vcsserver_ini | |
3151 |
|
3151 | |||
3152 | ini_path="$INI_TARGET/$RHODECODE_INI_NAME" |
|
3152 | ini_path="$INI_TARGET/$RHODECODE_INI_NAME" | |
3153 | RC_EDITION=$rc_edition |
|
3153 | RC_EDITION=$rc_edition | |
3154 | RC_LICENSE_TOKEN=$license_token |
|
3154 | RC_LICENSE_TOKEN=$license_token | |
3155 | RC_HOSTNAME=$(sed_safe_path $base_domain) |
|
3155 | RC_HOSTNAME=$(sed_safe_path $base_domain) | |
3156 | RC_APP_BASE_URL=$(sed_safe_path $app_base_url) |
|
3156 | RC_APP_BASE_URL=$(sed_safe_path $app_base_url) | |
3157 | RC_SQLALCHEMY_DB1_URL=$(sed_safe_path $rc_db1) |
|
3157 | RC_SQLALCHEMY_DB1_URL=$(sed_safe_path $rc_db1) | |
3158 | RC_CHANNELSTREAM_WS_URL=$(sed_safe_path $rc_channelstream_url) |
|
3158 | RC_CHANNELSTREAM_WS_URL=$(sed_safe_path $rc_channelstream_url) | |
3159 | RC_SHARED_KEY=$shared_key |
|
3159 | RC_SHARED_KEY=$shared_key | |
3160 | config_rhodecode_ini |
|
3160 | config_rhodecode_ini | |
3161 |
|
3161 | |||
3162 | touch $BOOTSTRAP_RUNTIME_ENV |
|
3162 | touch $BOOTSTRAP_RUNTIME_ENV | |
3163 |
|
3163 | |||
3164 | } |
|
3164 | } | |
3165 |
|
3165 | |||
3166 | bootstrap_definitions() { |
|
3166 | bootstrap_definitions() { | |
3167 |
|
3167 | |||
3168 | # This is needed for bootstrap_definitions |
|
3168 | # This is needed for bootstrap_definitions | |
3169 | AUTH_TOKEN=${args[--auth-token]} |
|
3169 | AUTH_TOKEN=${args[--auth-token]} | |
3170 | SERVER_URL=${args[--server-url]} |
|
3170 | SERVER_URL=${args[--server-url]} | |
3171 |
|
3171 | |||
3172 | DEFINITIONS_EXIST="" |
|
3172 | DEFINITIONS_EXIST="" | |
3173 | CHECK_FILES="\ |
|
3173 | CHECK_FILES="\ | |
3174 | docker-compose-services.yaml \ |
|
3174 | docker-compose-services.yaml \ | |
3175 | docker-compose-apps.yaml \ |
|
3175 | docker-compose-apps.yaml \ | |
3176 | docker-compose-metrics.yaml \ |
|
3176 | docker-compose-metrics.yaml \ | |
3177 | docker-compose-router.yaml \ |
|
3177 | docker-compose-router.yaml \ | |
3178 | " |
|
3178 | " | |
3179 | for check_file in $CHECK_FILES; do |
|
3179 | for check_file in $CHECK_FILES; do | |
3180 | if [[ -f "$check_file" ]]; then |
|
3180 | if [[ -f "$check_file" ]]; then | |
3181 | DEFINITIONS_EXIST="1" |
|
3181 | DEFINITIONS_EXIST="1" | |
3182 | fi |
|
3182 | fi | |
3183 | done |
|
3183 | done | |
3184 |
|
3184 | |||
3185 | # break if we didn't use force and definitions exist |
|
3185 | # break if we didn't use force and definitions exist | |
3186 | if [[ -n $DEFINITIONS_EXIST && ! $force ]]; then |
|
3186 | if [[ -n $DEFINITIONS_EXIST && ! $force ]]; then | |
3187 | echo "$(yellow bootstrap_definitions: skipping docker defs creation, existing files found. Use --force to create them anyway)" |
|
3187 | echo "$(yellow bootstrap_definitions: skipping docker defs creation, existing files found. Use --force to create them anyway)" | |
3188 | return |
|
3188 | return | |
3189 | fi |
|
3189 | fi | |
3190 | definitions_override_decision=true |
|
3190 | definitions_override_decision=true | |
3191 |
|
3191 | |||
3192 | if [[ -n $DEFINITIONS_EXIST ]]; then |
|
3192 | if [[ -n $DEFINITIONS_EXIST ]]; then | |
3193 | echo "$(yellow docker definitions exists, are you sure to force re-create them?)" |
|
3193 | echo "$(yellow docker definitions exists, are you sure to force re-create them?)" | |
3194 | definitions_override_decision=false |
|
3194 | definitions_override_decision=false | |
3195 | while true; do |
|
3195 | while true; do | |
3196 | read -p "Would you like to continue with overriding files? [yn] " yn |
|
3196 | read -p "Would you like to continue with overriding files? [yn] " yn | |
3197 | case $yn in |
|
3197 | case $yn in | |
3198 | [Yy]*) |
|
3198 | [Yy]*) | |
3199 | definitions_override_decision=true |
|
3199 | definitions_override_decision=true | |
3200 | break |
|
3200 | break | |
3201 | ;; |
|
3201 | ;; | |
3202 | [Nn]*) |
|
3202 | [Nn]*) | |
3203 | definitions_override_decision=false |
|
3203 | definitions_override_decision=false | |
3204 | break |
|
3204 | break | |
3205 | ;; |
|
3205 | ;; | |
3206 | *) |
|
3206 | *) | |
3207 | echo "Please answer y or n." |
|
3207 | echo "Please answer y or n." | |
3208 | ;; |
|
3208 | ;; | |
3209 | esac |
|
3209 | esac | |
3210 | done |
|
3210 | done | |
3211 | fi |
|
3211 | fi | |
3212 |
|
3212 | |||
3213 | if [[ "$definitions_override_decision" == true ]]; then |
|
3213 | if [[ "$definitions_override_decision" == true ]]; then | |
3214 | FULL_MODE=1 |
|
3214 | FULL_MODE=1 | |
3215 | # This expects the $AUTH_TOKEN and $SERVER_URL be present |
|
3215 | # This expects the $AUTH_TOKEN and $SERVER_URL be present | |
3216 | get_docker_definitions $docker_revision $FULL_MODE $DEBUG |
|
3216 | get_docker_definitions $docker_revision $FULL_MODE $DEBUG | |
3217 | else |
|
3217 | else | |
3218 | echo "$(yellow No docker definition override)" |
|
3218 | echo "$(yellow No docker definition override)" | |
3219 | # Add commands for cancellation or other actions here. |
|
3219 | # Add commands for cancellation or other actions here. | |
3220 | fi |
|
3220 | fi | |
3221 |
|
3221 | |||
3222 | } |
|
3222 | } | |
3223 |
|
3223 | |||
3224 | bootstrap_overrides() { |
|
3224 | bootstrap_overrides() { | |
3225 | templates=$YAML_TEMPLATES |
|
3225 | templates=$YAML_TEMPLATES | |
3226 |
|
3226 | |||
3227 | target_dir=$PWD/.custom |
|
3227 | target_dir=$PWD/.custom | |
3228 |
|
3228 | |||
3229 | for o_file in $templates; do |
|
3229 | for o_file in $templates; do | |
3230 | target_file=$target_dir/$o_file |
|
3230 | target_file=$target_dir/$o_file | |
3231 | if [[ ! -f "$target_file" ]]; then |
|
3231 | if [[ ! -f "$target_file" ]]; then | |
3232 | echo "copy override file $o_file" |
|
3232 | echo "copy override file $o_file" | |
3233 | cp -v $PWD/templates/$o_file $target_file |
|
3233 | cp -v $PWD/templates/$o_file $target_file | |
3234 | else |
|
3234 | else | |
3235 | echo "file $target_file existing, skipping..." |
|
3235 | echo "file $target_file existing, skipping..." | |
3236 | fi |
|
3236 | fi | |
3237 | done |
|
3237 | done | |
3238 | mkdir -p $target_dir/traefik_custom |
|
3238 | mkdir -p $target_dir/traefik_custom | |
3239 | cp -r $PWD/config/traefik/* $target_dir/traefik_custom/ |
|
3239 | cp -r $PWD/config/traefik/* $target_dir/traefik_custom/ | |
3240 |
|
3240 | |||
3241 | echo "$(green bootstrap_overrides: overrides extracted to $target_dir)" |
|
3241 | echo "$(green bootstrap_overrides: overrides extracted to $target_dir)" | |
3242 |
|
3242 | |||
3243 | # save our loki auth using md5 encryption so the auth works OOTB |
|
3243 | # save our loki auth using md5 encryption so the auth works OOTB | |
3244 | echo "loki-auth:$shared_key_md5" >> $target_dir/traefik_custom/dynamic/.htpasswd |
|
3244 | echo "loki-auth:$shared_key_md5" >> $target_dir/traefik_custom/dynamic/.htpasswd | |
3245 |
|
3245 | |||
3246 | services_tmpl=$target_dir/docker-compose-services.override.yaml |
|
3246 | services_tmpl=$target_dir/docker-compose-services.override.yaml | |
3247 | metrics_tmpl=$target_dir/docker-compose-metrics.override.yaml |
|
3247 | metrics_tmpl=$target_dir/docker-compose-metrics.override.yaml | |
3248 | apps_tmpl=$target_dir/docker-compose-apps.override.yaml |
|
3248 | apps_tmpl=$target_dir/docker-compose-apps.override.yaml | |
3249 |
|
3249 | |||
3250 | # change our templates and adjust using enable SSH |
|
3250 | # change our templates and adjust using enable SSH | |
3251 | if [[ $arg_use_ssl == "y" ]]; then |
|
3251 | if [[ $arg_use_ssl == "y" ]]; then | |
3252 | echo "enabling SSL on .override.yaml templates" |
|
3252 | echo "enabling SSL on .override.yaml templates" | |
3253 |
|
3253 | |||
3254 | metrics_replace() { |
|
3254 | metrics_replace() { | |
3255 | sed_func "$1" "$2" "$metrics_tmpl" |
|
3255 | sed_func "$1" "$2" "$metrics_tmpl" | |
3256 | } |
|
3256 | } | |
3257 |
|
3257 | |||
3258 | metrics_replace '# # Enable http\+https' ' # Enable http\+https' |
|
3258 | metrics_replace '# # Enable http\+https' ' # Enable http\+https' | |
3259 | metrics_replace '# - "traefik.http.routers.grafana.entrypoints=http,https"' ' - "traefik.http.routers.grafana.entrypoints=http,https"' |
|
3259 | metrics_replace '# - "traefik.http.routers.grafana.entrypoints=http,https"' ' - "traefik.http.routers.grafana.entrypoints=http,https"' | |
3260 |
|
3260 | |||
3261 | services_replace() { |
|
3261 | services_replace() { | |
3262 | sed_func "$1" "$2" "$services_tmpl" |
|
3262 | sed_func "$1" "$2" "$services_tmpl" | |
3263 | } |
|
3263 | } | |
3264 |
|
3264 | |||
3265 | services_replace '# # Enable http\+https' ' # Enable http\+https' |
|
3265 | services_replace '# # Enable http\+https' ' # Enable http\+https' | |
3266 | services_replace '# - "traefik.http.routers.channelstream.entrypoints=http,https"' ' - "traefik.http.routers.channelstream.entrypoints=http,https"' |
|
3266 | services_replace '# - "traefik.http.routers.channelstream.entrypoints=http,https"' ' - "traefik.http.routers.channelstream.entrypoints=http,https"' | |
3267 | services_replace '# - "traefik.http.routers.nginx-statics.entrypoints=http,https"' ' - "traefik.http.routers.nginx-statics.entrypoints=http,https"' |
|
3267 | services_replace '# - "traefik.http.routers.nginx-statics.entrypoints=http,https"' ' - "traefik.http.routers.nginx-statics.entrypoints=http,https"' | |
3268 |
|
3268 | |||
3269 | apps_replace() { |
|
3269 | apps_replace() { | |
3270 | sed_func "$1" "$2" "$apps_tmpl" |
|
3270 | sed_func "$1" "$2" "$apps_tmpl" | |
3271 | } |
|
3271 | } | |
3272 |
|
3272 | |||
3273 | apps_replace '# # Enable http\+https' ' # Enable http\+https' |
|
3273 | apps_replace '# # Enable http\+https' ' # Enable http\+https' | |
3274 | apps_replace '# - "traefik.http.routers.rhodecode.entrypoints=http,https"' ' - "traefik.http.routers.rhodecode.entrypoints=http,https"' |
|
3274 | apps_replace '# - "traefik.http.routers.rhodecode.entrypoints=http,https"' ' - "traefik.http.routers.rhodecode.entrypoints=http,https"' | |
3275 |
|
3275 | |||
3276 | fi |
|
3276 | fi | |
3277 |
|
3277 | |||
3278 | if [[ $arg_database_type == "postgres" ]]; then |
|
3278 | if [[ $arg_database_type == "postgres" ]]; then | |
3279 | sed -i -E '/^ database:/,/replicas: [0-9]+/ s/replicas: [0-9]+/replicas: 1/' $services_tmpl |
|
3279 | sed -i -E '/^ database:/,/replicas: [0-9]+/ s/replicas: [0-9]+/replicas: 1/' $services_tmpl | |
3280 | sed -i -E '/^ database-mysql:/,/replicas: [0-9]+/ s/replicas: [0-9]+/replicas: 0/' $services_tmpl |
|
3280 | sed -i -E '/^ database-mysql:/,/replicas: [0-9]+/ s/replicas: [0-9]+/replicas: 0/' $services_tmpl | |
3281 | elif [[ $arg_database_type == "mysql" ]]; then |
|
3281 | elif [[ $arg_database_type == "mysql" ]]; then | |
3282 | sed -i -E '/^ database:/,/replicas: [0-9]+/ s/replicas: [0-9]+/replicas: 0/' $services_tmpl |
|
3282 | sed -i -E '/^ database:/,/replicas: [0-9]+/ s/replicas: [0-9]+/replicas: 0/' $services_tmpl | |
3283 | sed -i -E '/^ database-mysql:/,/replicas: [0-9]+/ s/replicas: [0-9]+/replicas: 1/' $services_tmpl |
|
3283 | sed -i -E '/^ database-mysql:/,/replicas: [0-9]+/ s/replicas: [0-9]+/replicas: 1/' $services_tmpl | |
3284 | else |
|
3284 | else | |
3285 | # BOTH Disabled |
|
3285 | # BOTH Disabled | |
3286 | sed -i -E '/^ database:/,/replicas: [0-9]+/ s/replicas: [0-9]+/replicas: 0/' $services_tmpl |
|
3286 | sed -i -E '/^ database:/,/replicas: [0-9]+/ s/replicas: [0-9]+/replicas: 0/' $services_tmpl | |
3287 | sed -i -E '/^ database-mysql:/,/replicas: [0-9]+/ s/replicas: [0-9]+/replicas: 0/' $services_tmpl |
|
3287 | sed -i -E '/^ database-mysql:/,/replicas: [0-9]+/ s/replicas: [0-9]+/replicas: 0/' $services_tmpl | |
3288 | fi |
|
3288 | fi | |
3289 |
|
3289 | |||
3290 | } |
|
3290 | } | |
3291 |
|
3291 | |||
3292 | cur_date=$(date '+%Y-%m-%d %H:%M:%S') |
|
3292 | cur_date=$(date '+%Y-%m-%d %H:%M:%S') | |
3293 |
|
3293 | |||
3294 | # Init the config ! |
|
3294 | # Init the config ! | |
3295 | if [[ ! -f "$CONFIG_FILE" ]]; then |
|
3295 | if [[ ! -f "$CONFIG_FILE" ]]; then | |
3296 | echo "config: init new config at: $CONFIG_FILE" |
|
3296 | echo "config: init new config at: $CONFIG_FILE" | |
3297 | config_init |
|
3297 | config_init | |
3298 | else |
|
3298 | else | |
3299 | echo "config: re-using present config at: $CONFIG_FILE" |
|
3299 | echo "config: re-using present config at: $CONFIG_FILE" | |
3300 | fi |
|
3300 | fi | |
3301 |
|
3301 | |||
3302 | run_stages=$BOOTSTRAP_STAGES |
|
3302 | run_stages=$BOOTSTRAP_STAGES | |
3303 |
|
3303 | |||
3304 | if [ ! ${#stages_from_cli[@]} -eq 0 ]; then |
|
3304 | if [ ! ${#stages_from_cli[@]} -eq 0 ]; then | |
3305 | echo "Using custom stages to run init command..." |
|
3305 | echo "Using custom stages to run init command..." | |
3306 | run_stages=${stages_from_cli[@]} |
|
3306 | run_stages=${stages_from_cli[@]} | |
3307 | fi |
|
3307 | fi | |
3308 |
|
3308 | |||
3309 | for stage_name in $run_stages; do |
|
3309 | for stage_name in $run_stages; do | |
3310 |
|
3310 | |||
3311 | stage_func=$(get_stage_function $stage_name) |
|
3311 | stage_func=$(get_stage_function $stage_name) | |
3312 |
|
3312 | |||
3313 | if ! config_has_key $stage_name ; then |
|
3313 | if ! config_has_key $stage_name ; then | |
3314 | echo "$(green \* bootstrap: \'$stage_name\' stage not found\; running now... )" |
|
3314 | echo "$(green \* bootstrap: \'$stage_name\' stage not found\; running now... )" | |
3315 | $stage_func |
|
3315 | $stage_func | |
3316 | config_set "$stage_name" $cur_date |
|
3316 | config_set "$stage_name" $cur_date | |
3317 | else |
|
3317 | else | |
3318 | if [ $force ]; then |
|
3318 | if [ $force ]; then | |
3319 | echo "$(green \* bootstrap: \'$stage_name\' is present!\; FORCE running now... )" |
|
3319 | echo "$(green \* bootstrap: \'$stage_name\' is present!\; FORCE running now... )" | |
3320 | $stage_func $force |
|
3320 | $stage_func $force | |
3321 | config_set "$stage_name" $cur_date |
|
3321 | config_set "$stage_name" $cur_date | |
3322 | else |
|
3322 | else | |
3323 | echo "$(yellow \* bootstrap: \'$stage_name\' stage already present, use --force to run it again)" |
|
3323 | echo "$(yellow \* bootstrap: \'$stage_name\' stage already present, use --force to run it again)" | |
3324 | fi |
|
3324 | fi | |
3325 | fi |
|
3325 | fi | |
3326 |
|
3326 | |||
3327 | done |
|
3327 | done | |
3328 |
|
3328 | |||
3329 | echo "" |
|
3329 | echo "" | |
3330 | echo "~~~~ $(green Bootstrap completed) ~~~~" |
|
3330 | echo "~~~~ $(green Bootstrap completed) ~~~~" | |
3331 |
|
3331 | |||
3332 | get_started |
|
3332 | get_started | |
3333 |
|
3333 | |||
3334 | } |
|
3334 | } | |
3335 |
|
3335 | |||
3336 | # :command.function |
|
3336 | # :command.function | |
3337 | rcstack_self_update_command() { |
|
3337 | rcstack_self_update_command() { | |
3338 | # src/self_update_command.sh |
|
3338 | # src/self_update_command.sh | |
3339 | check_bootstrap |
|
3339 | check_bootstrap | |
3340 |
|
3340 | |||
3341 | FORCE=${args[--force]} |
|
3341 | FORCE=${args[--force]} | |
3342 | DEBUG=${args[--debug]} |
|
3342 | DEBUG=${args[--debug]} | |
3343 |
|
3343 | |||
3344 | # This is needed for bootstrap_definitions |
|
3344 | # This is needed for bootstrap_definitions | |
3345 | AUTH_TOKEN=${args[--auth-token]} |
|
3345 | AUTH_TOKEN=${args[--auth-token]} | |
3346 | SERVER_URL=${args[--server-url]} |
|
3346 | SERVER_URL=${args[--server-url]} | |
3347 |
|
3347 | |||
3348 | update_docker_image=${args[--update-docker-image]} |
|
3348 | update_docker_image=${args[--update-docker-image]} | |
3349 |
|
3349 | |||
3350 | rcstack_channel=${args[--cli-revision]} |
|
3350 | rcstack_channel=${args[--cli-revision]} | |
3351 | rcstack_file_channel=${args[--cli-file]} |
|
3351 | rcstack_file_channel=${args[--cli-file]} | |
3352 | docker_channel=${args[--docker-revision]} |
|
3352 | docker_channel=${args[--docker-revision]} | |
3353 |
|
3353 | |||
3354 | FETCH_FROM=https://dls.rhodecode.com/get/$rcstack_channel |
|
3354 | FETCH_FROM=https://dls.rhodecode.com/get/$rcstack_channel | |
3355 |
|
3355 | |||
3356 | RCSCRIPT_FINAL_TARGET=$PWD/scripts/rcstack/rcstack |
|
3356 | RCSCRIPT_FINAL_TARGET=$PWD/scripts/rcstack/rcstack | |
3357 |
|
3357 | |||
3358 | RCSTACK_DL_TARGET=$PWD/scripts/rcstack/rcstack.tmp |
|
3358 | RCSTACK_DL_TARGET=$PWD/scripts/rcstack/rcstack.tmp | |
3359 |
|
3359 | |||
3360 | #ensure we have this dir ! |
|
3360 | #ensure we have this dir ! | |
3361 | mkdir -p $PWD/scripts/rcstack |
|
3361 | mkdir -p $PWD/scripts/rcstack | |
3362 |
|
3362 | |||
3363 | .env --file $RUNTIME_ENV |
|
3363 | .env --file $RUNTIME_ENV | |
3364 | .env get_or_error RC_VERSION |
|
3364 | .env get_or_error RC_VERSION | |
3365 |
|
3365 | |||
3366 | ENV_VER=$REPLY |
|
3366 | ENV_VER=$REPLY | |
3367 |
|
3367 | |||
3368 | echo "self-update: downloading new $RC_SCRIPT_NAME script from $FETCH_FROM" |
|
3368 | echo "self-update: downloading new $RC_SCRIPT_NAME script from $FETCH_FROM" | |
3369 |
|
3369 | |||
3370 | if [[ $FORCE ]]; then |
|
3370 | if [[ $FORCE ]]; then | |
3371 | echo "$(yellow self-update: --force used, doing forced update)" |
|
3371 | echo "$(yellow self-update: --force used, doing forced update)" | |
3372 | fi |
|
3372 | fi | |
3373 |
|
3373 | |||
3374 | if [[ $DEBUG ]]; then |
|
3374 | if [[ $DEBUG ]]; then | |
3375 | echo "running: curl -L -ss --fail -o $RCSTACK_DL_TARGET $FETCH_FROM" |
|
3375 | echo "running: curl -L -ss --fail -o $RCSTACK_DL_TARGET $FETCH_FROM" | |
3376 | fi |
|
3376 | fi | |
3377 |
|
3377 | |||
3378 | curl -L -ss --fail -o $RCSTACK_DL_TARGET $FETCH_FROM |
|
3378 | curl -L -ss --fail -o $RCSTACK_DL_TARGET $FETCH_FROM | |
3379 |
|
3379 | |||
3380 | # if we specified --cli-file, now USE this to obtain final script |
|
3380 | # if we specified --cli-file, now USE this to obtain final script | |
3381 |
|
3381 | |||
3382 | if [[ -n $rcstack_file_channel ]]; then |
|
3382 | if [[ -n $rcstack_file_channel ]]; then | |
3383 | echo "getting rcstack file from path $rcstack_file_channel" |
|
3383 | echo "getting rcstack file from path $rcstack_file_channel" | |
3384 | cp -v $rcstack_file_channel $RCSTACK_DL_TARGET |
|
3384 | cp -v $rcstack_file_channel $RCSTACK_DL_TARGET | |
3385 | fi |
|
3385 | fi | |
3386 |
|
3386 | |||
3387 | chmod +x $RCSTACK_DL_TARGET |
|
3387 | chmod +x $RCSTACK_DL_TARGET | |
3388 |
|
3388 | |||
3389 | version_old=0 |
|
3389 | version_old=0 | |
3390 | rc_version_old=0 |
|
3390 | rc_version_old=0 | |
3391 |
|
3391 | |||
3392 | # check if we have OLD file, in case we don't just set versions to 0 |
|
3392 | # check if we have OLD file, in case we don't just set versions to 0 | |
3393 | if [[ -f "$RCSCRIPT_FINAL_TARGET" ]]; then |
|
3393 | if [[ -f "$RCSCRIPT_FINAL_TARGET" ]]; then | |
3394 | version_old=$($RCSCRIPT_FINAL_TARGET --version) |
|
3394 | version_old=$($RCSCRIPT_FINAL_TARGET --version) | |
3395 | rc_version_old=$($RCSCRIPT_FINAL_TARGET cli image-info) |
|
3395 | rc_version_old=$($RCSCRIPT_FINAL_TARGET cli image-info) | |
3396 | fi |
|
3396 | fi | |
3397 |
|
3397 | |||
3398 | version_dl=$($RCSTACK_DL_TARGET --version) |
|
3398 | version_dl=$($RCSTACK_DL_TARGET --version) | |
3399 | rc_version_dl=$($RCSTACK_DL_TARGET cli image-info) |
|
3399 | rc_version_dl=$($RCSTACK_DL_TARGET cli image-info) | |
3400 |
|
3400 | |||
3401 | echo "self-update: $RC_SCRIPT_NAME version downloaded: $version_dl" |
|
3401 | echo "self-update: $RC_SCRIPT_NAME version downloaded: $version_dl" | |
3402 |
|
3402 | |||
3403 | if [[ $DEBUG ]]; then |
|
3403 | if [[ $DEBUG ]]; then | |
3404 | echo "DEBUG: old-script ver: $version_old" |
|
3404 | echo "DEBUG: old-script ver: $version_old" | |
3405 | echo "DEBUG: new-script ver: $version_dl" |
|
3405 | echo "DEBUG: new-script ver: $version_dl" | |
3406 | echo "DEBUG: " |
|
3406 | echo "DEBUG: " | |
3407 | echo "DEBUG: .runtime.env set version $ENV_VER" |
|
3407 | echo "DEBUG: .runtime.env set version $ENV_VER" | |
3408 | echo "DEBUG: " |
|
3408 | echo "DEBUG: " | |
3409 | echo "DEBUG: old-script: RC VERSION: $rc_version_old" |
|
3409 | echo "DEBUG: old-script: RC VERSION: $rc_version_old" | |
3410 | echo "DEBUG: new-script: RC VERSION: $rc_version_dl" |
|
3410 | echo "DEBUG: new-script: RC VERSION: $rc_version_dl" | |
3411 | fi |
|
3411 | fi | |
3412 |
|
3412 | |||
3413 | # returns 1 when A greater than B |
|
3413 | # returns 1 when A greater than B | |
3414 | # returns 0 when A equals B |
|
3414 | # returns 0 when A equals B | |
3415 | # returns -1 when A lower than B |
|
3415 | # returns -1 when A lower than B | |
3416 | # defines $semver_result |
|
3416 | # defines $semver_result | |
3417 | semver_compare "$version_old" "$version_dl" |
|
3417 | semver_compare "$version_old" "$version_dl" | |
3418 |
|
3418 | |||
3419 | # logic if 0, 1 we have lower or equal version vs the new one |
|
3419 | # logic if 0, 1 we have lower or equal version vs the new one | |
3420 | if [[ $semver_result == "-1" ]]; then |
|
3420 | if [[ $semver_result == "-1" ]]; then | |
3421 | # if -1 the DL version is never than we have locally |
|
3421 | # if -1 the DL version is never than we have locally | |
3422 | echo "Found new version of rcstack $version_dl, continuing with update ..." |
|
3422 | echo "Found new version of rcstack $version_dl, continuing with update ..." | |
3423 | else |
|
3423 | else | |
3424 | # otherwise we use older or same... |
|
3424 | # otherwise we use older or same... | |
3425 | if [[ $FORCE ]]; then |
|
3425 | if [[ $FORCE ]]; then | |
3426 | echo "$(yellow "self-update: downloaded rcstack version ($version_dl) is old or same as current ($version_old), continuing update with --force flag")" |
|
3426 | echo "$(yellow "self-update: downloaded rcstack version ($version_dl) is old or same as current ($version_old), continuing update with --force flag")" | |
3427 | else |
|
3427 | else | |
3428 | echo "self-update: downloaded rcstack version ($version_dl) is old or same as current ($version_old), exiting..." |
|
3428 | echo "self-update: downloaded rcstack version ($version_dl) is old or same as current ($version_old), exiting..." | |
3429 | exit |
|
3429 | exit | |
3430 | fi |
|
3430 | fi | |
3431 | fi |
|
3431 | fi | |
3432 |
|
3432 | |||
3433 | docker_image_update() { |
|
3433 | docker_image_update() { | |
3434 |
|
3434 | |||
3435 | echo "$(green self-update: checking if RC_VERSION=$rc_version_dl should be saved to runtime.env file)" |
|
3435 | echo "$(green self-update: checking if RC_VERSION=$rc_version_dl should be saved to runtime.env file)" | |
3436 | echo "self-update: currently .runtime.env file uses image: $ENV_VER" |
|
3436 | echo "self-update: currently .runtime.env file uses image: $ENV_VER" | |
3437 |
|
3437 | |||
3438 | if [[ $update_docker_image == "y" ]]; then |
|
3438 | if [[ $update_docker_image == "y" ]]; then | |
3439 | echo "continuing with automated forced installer version saved into .runtime.env" |
|
3439 | echo "continuing with automated forced installer version saved into .runtime.env" | |
3440 | .env set RC_VERSION=$rc_version_dl |
|
3440 | .env set RC_VERSION=$rc_version_dl | |
3441 | else |
|
3441 | else | |
3442 | while true; do |
|
3442 | while true; do | |
3443 | read -p "self-update: Would you like to continue with setting RC_VERSION=$rc_version_dl over RC_VERSION=$ENV_VER into .runtime.env file? [yn] " yn |
|
3443 | read -p "self-update: Would you like to continue with setting RC_VERSION=$rc_version_dl over RC_VERSION=$ENV_VER into .runtime.env file? [yn] " yn | |
3444 | case $yn in |
|
3444 | case $yn in | |
3445 | [Yy]*) |
|
3445 | [Yy]*) | |
3446 | .env set RC_VERSION=$rc_version_dl |
|
3446 | .env set RC_VERSION=$rc_version_dl | |
3447 | echo "self-update: new version set into config" |
|
3447 | echo "self-update: new version set into config" | |
3448 | break ;; |
|
3448 | break ;; | |
3449 | [Nn]*) |
|
3449 | [Nn]*) | |
3450 | break ;; |
|
3450 | break ;; | |
3451 | *) echo "Please answer y or n." ;; |
|
3451 | *) echo "Please answer y or n." ;; | |
3452 | esac |
|
3452 | esac | |
3453 | done |
|
3453 | done | |
3454 | fi |
|
3454 | fi | |
3455 | } |
|
3455 | } | |
3456 |
|
3456 | |||
3457 | # returns 1 when A greater than B |
|
3457 | # returns 1 when A greater than B | |
3458 | # returns 0 when A equals B |
|
3458 | # returns 0 when A equals B | |
3459 | # returns -1 when A lower than B |
|
3459 | # returns -1 when A lower than B | |
3460 | # defines $semver_result |
|
3460 | # defines $semver_result | |
3461 | semver_compare "$rc_version_old" "$rc_version_dl" |
|
3461 | semver_compare "$rc_version_old" "$rc_version_dl" | |
3462 |
|
3462 | |||
3463 | # logic if 0, 1 we have lower or equal version vs the new one |
|
3463 | # logic if 0, 1 we have lower or equal version vs the new one | |
3464 | if [[ $semver_result == "-1" ]]; then |
|
3464 | if [[ $semver_result == "-1" ]]; then | |
3465 | # if -1 the DL version is never than we have locally |
|
3465 | # if -1 the DL version is never than we have locally | |
3466 | docker_image_update |
|
3466 | docker_image_update | |
3467 | else |
|
3467 | else | |
3468 | # otherwise we use older or same... |
|
3468 | # otherwise we use older or same... | |
3469 | echo "self-update: docker image defined by RC_VERSION=$rc_version_dl seems to be up-to date" |
|
3469 | echo "self-update: docker image defined by RC_VERSION=$rc_version_dl seems to be up-to date" | |
3470 | if [[ $FORCE ]]; then |
|
3470 | if [[ $FORCE ]]; then | |
3471 | echo "$(yellow self-update: continuing update with --force flag)" |
|
3471 | echo "$(yellow self-update: continuing update with --force flag)" | |
3472 | docker_image_update |
|
3472 | docker_image_update | |
3473 | fi |
|
3473 | fi | |
3474 | fi |
|
3474 | fi | |
3475 |
|
3475 | |||
3476 | echo "$(green self-update: updating docker definitions to $docker_channel)" |
|
3476 | echo "$(green self-update: updating docker definitions to $docker_channel)" | |
3477 |
|
3477 | |||
3478 | FULL_MODE=1 |
|
3478 | FULL_MODE=1 | |
3479 | # This expects the $AUTH_TOKEN and $SERVER_URL be present |
|
3479 | # This expects the $AUTH_TOKEN and $SERVER_URL be present | |
3480 | get_docker_definitions $docker_channel $FULL_MODE $DEBUG |
|
3480 | get_docker_definitions $docker_channel $FULL_MODE $DEBUG | |
3481 |
|
3481 | |||
3482 | # run self upgrade from the NEW script... |
|
3482 | # run self upgrade from the NEW script... | |
3483 | if [[ $DEBUG ]]; then |
|
3483 | if [[ $DEBUG ]]; then | |
3484 | eval "$RCSTACK_DL_TARGET --debug self-upgrade --from-ver=$version_old --to-ver=$version" |
|
3484 | eval "$RCSTACK_DL_TARGET --debug self-upgrade --from-ver=$version_old --to-ver=$version" | |
3485 | else |
|
3485 | else | |
3486 | eval "$RCSTACK_DL_TARGET self-upgrade --from-ver=$version_old --to-ver=$version" |
|
3486 | eval "$RCSTACK_DL_TARGET self-upgrade --from-ver=$version_old --to-ver=$version" | |
3487 | fi |
|
3487 | fi | |
3488 |
|
3488 | |||
3489 | echo "self-update: updating cli $RC_SCRIPT_NAME script to new version: $version_dl" |
|
3489 | echo "self-update: updating cli $RC_SCRIPT_NAME script to new version: $version_dl" | |
3490 | if [[ -f "$RCSCRIPT_FINAL_TARGET" ]]; then |
|
3490 | if [[ -f "$RCSCRIPT_FINAL_TARGET" ]]; then | |
3491 | rm $RCSCRIPT_FINAL_TARGET && mv -v $RCSTACK_DL_TARGET $RCSCRIPT_FINAL_TARGET |
|
3491 | rm $RCSCRIPT_FINAL_TARGET && mv -v $RCSTACK_DL_TARGET $RCSCRIPT_FINAL_TARGET | |
3492 | else |
|
3492 | else | |
3493 | mv -v $RCSTACK_DL_TARGET $RCSCRIPT_FINAL_TARGET |
|
3493 | mv -v $RCSTACK_DL_TARGET $RCSCRIPT_FINAL_TARGET | |
3494 | fi |
|
3494 | fi | |
3495 |
|
3495 | |||
3496 | echo "$(green self-update: successfully update to $version_dl)" |
|
3496 | echo "$(green self-update: successfully update to $version_dl)" | |
3497 | exit |
|
3497 | exit | |
3498 | } |
|
3498 | } | |
3499 |
|
3499 | |||
3500 | # :command.function |
|
3500 | # :command.function | |
3501 | rcstack_self_upgrade_command() { |
|
3501 | rcstack_self_upgrade_command() { | |
3502 | # src/self_upgrade_command.sh |
|
3502 | # src/self_upgrade_command.sh | |
3503 |
|
3503 | |||
3504 | DEBUG=${args[--debug]} |
|
3504 | DEBUG=${args[--debug]} | |
3505 |
|
3505 | |||
3506 | version_old=${args[--from-ver]} |
|
3506 | version_old=${args[--from-ver]} | |
3507 | version_new=${args[--to-ver]} |
|
3507 | version_new=${args[--to-ver]} | |
3508 | internal_version_old=$(./$RC_SCRIPT_NAME --version) |
|
3508 | internal_version_old=$(./$RC_SCRIPT_NAME --version) | |
3509 |
|
3509 | |||
3510 | if [[ -z $version_old ]]; then |
|
3510 | if [[ -z $version_old ]]; then | |
3511 | # use internal version |
|
3511 | # use internal version | |
3512 | version_old=$internal_version_old |
|
3512 | version_old=$internal_version_old | |
3513 |
|
3513 | |||
3514 | fi |
|
3514 | fi | |
3515 |
|
3515 | |||
3516 | semver_compare "$version_old" "5.7.0" |
|
3516 | semver_compare "$version_old" "5.7.0" | |
3517 | if [[ $DEBUG ]]; then |
|
3517 | if [[ $DEBUG ]]; then | |
3518 | echo "Checking if $version_old >= 5.7.0, $semver_result" |
|
3518 | echo "Checking if $version_old >= 5.7.0, $semver_result" | |
3519 | semver_compare "$version_old" "5.7.0" "debug" |
|
3519 | semver_compare "$version_old" "5.7.0" "debug" | |
3520 | else |
|
3520 | else | |
3521 | semver_compare "$version_old" "5.7.0" |
|
3521 | semver_compare "$version_old" "5.7.0" | |
3522 | fi |
|
3522 | fi | |
3523 |
|
3523 | |||
3524 | if [[ $semver_result == "-1" ]]; then |
|
3524 | if [[ $semver_result == "-1" ]]; then | |
3525 | echo "rcstack post 5.7.0 upgrade..." |
|
3525 | echo "rcstack post 5.7.0 upgrade..." | |
3526 |
|
3526 | |||
3527 | .env get RC_USE_CELERY || .env set RC_USE_CELERY=true |
|
3527 | .env get RC_USE_CELERY || .env set RC_USE_CELERY=true | |
3528 | .env get RC_SSH_PORT || .env set RC_SSH_PORT=9022 |
|
3528 | .env get RC_SSH_PORT || .env set RC_SSH_PORT=9022 | |
3529 |
|
3529 | |||
3530 | fi |
|
3530 | fi | |
3531 |
|
3531 | |||
3532 | if [[ $DEBUG ]]; then |
|
3532 | if [[ $DEBUG ]]; then | |
3533 | echo "Checking if $version_old >= 5.9.0, $semver_result" |
|
3533 | echo "Checking if $version_old >= 5.9.0, $semver_result" | |
3534 | semver_compare "$version_old" "5.9.0" "debug" |
|
3534 | semver_compare "$version_old" "5.9.0" "debug" | |
3535 | else |
|
3535 | else | |
3536 | semver_compare "$version_old" "5.9.0" |
|
3536 | semver_compare "$version_old" "5.9.0" | |
3537 | fi |
|
3537 | fi | |
3538 |
|
3538 | |||
3539 | if [[ $semver_result == "-1" ]]; then |
|
3539 | if [[ $semver_result == "-1" ]]; then | |
3540 | echo "rcstack post 5.9.0 upgrade..." |
|
3540 | echo "rcstack post 5.9.0 upgrade..." | |
3541 | shared_key=$(random_str 32) |
|
3541 | shared_key=$(random_str 32) | |
3542 |
|
3542 | |||
3543 | .env get RC_ENCRYPTED_SECRET || .env set RC_ENCRYPTED_SECRET=$shared_key |
|
3543 | .env get RC_ENCRYPTED_SECRET || .env set RC_ENCRYPTED_SECRET=$shared_key | |
3544 | .env get DB_TYPE || .env set DB_TYPE="postgres" |
|
3544 | .env get DB_TYPE || .env set DB_TYPE="postgres" | |
3545 | .env get RC_SHARED_KEY || .env set RC_SHARED_KEY=$shared_key |
|
3545 | .env get RC_SHARED_KEY || .env set RC_SHARED_KEY=$shared_key | |
3546 |
|
3546 | |||
3547 | fi |
|
3547 | fi | |
3548 |
|
3548 | |||
3549 | echo "$(green self-upgrade: upgraded rcstack)" |
|
3549 | echo "$(green self-upgrade: upgraded rcstack)" | |
3550 |
|
3550 | |||
3551 | } |
|
3551 | } | |
3552 |
|
3552 | |||
3553 | # :command.function |
|
3553 | # :command.function | |
3554 | rcstack_stack_router_command() { |
|
3554 | rcstack_stack_router_command() { | |
3555 | # src/stack_router_command.sh |
|
3555 | # src/stack_router_command.sh | |
3556 | check_bootstrap |
|
3556 | check_bootstrap | |
3557 |
|
3557 | |||
3558 | DEBUG=${args[--debug]} |
|
3558 | DEBUG=${args[--debug]} | |
3559 | ENV_FILE=${args[--env-file-path]} |
|
3559 | ENV_FILE=${args[--env-file-path]} | |
3560 |
|
3560 | |||
3561 | if [[ ! -f $RC_STACK_ROUTER_EXT ]]; then |
|
3561 | if [[ ! -f $RC_STACK_ROUTER_EXT ]]; then | |
3562 | RC_STACK_ROUTER_EXT="" |
|
3562 | RC_STACK_ROUTER_EXT="" | |
3563 | else |
|
3563 | else | |
3564 | RC_STACK_ROUTER_EXT="-f $RC_STACK_ROUTER_EXT" |
|
3564 | RC_STACK_ROUTER_EXT="-f $RC_STACK_ROUTER_EXT" | |
3565 | fi |
|
3565 | fi | |
3566 |
|
3566 | |||
3567 | CMD_ROUTER="\ |
|
3567 | CMD_ROUTER="\ | |
3568 | RC_ENV_FILE=$ENV_FILE docker compose \ |
|
3568 | RC_ENV_FILE=$ENV_FILE docker compose \ | |
3569 | --env-file $ENV_FILE \ |
|
3569 | --env-file $ENV_FILE \ | |
3570 | $ENV_EXPAND \ |
|
3570 | $ENV_EXPAND \ | |
3571 | -p rc_cluster_router \ |
|
3571 | -p rc_cluster_router \ | |
3572 | -f docker-compose-base.yaml \ |
|
3572 | -f docker-compose-base.yaml \ | |
3573 | -f docker-compose-router.yaml $RC_STACK_ROUTER_EXT" |
|
3573 | -f docker-compose-router.yaml $RC_STACK_ROUTER_EXT" | |
3574 |
|
3574 | |||
3575 | if [[ $DEBUG ]]; then |
|
3575 | if [[ $DEBUG ]]; then | |
3576 | echo "---" |
|
3576 | echo "---" | |
3577 | echo "stacks docker: $RC_STACK_ROUTER_EXT_LCL" |
|
3577 | echo "stacks docker: $RC_STACK_ROUTER_EXT_LCL" | |
3578 | echo "running command: ${CMD_ROUTER}" |
|
3578 | echo "running command: ${CMD_ROUTER}" | |
3579 | echo "ARGS: ${other_args[*]}" |
|
3579 | echo "ARGS: ${other_args[*]}" | |
3580 | echo "---" |
|
3580 | echo "---" | |
3581 | fi |
|
3581 | fi | |
3582 | eval "${CMD_ROUTER} ${other_args[*]}" |
|
3582 | eval "${CMD_ROUTER} ${other_args[*]}" | |
3583 |
|
3583 | |||
3584 | } |
|
3584 | } | |
3585 |
|
3585 | |||
3586 | # :command.function |
|
3586 | # :command.function | |
3587 | rcstack_stack_metrics_command() { |
|
3587 | rcstack_stack_metrics_command() { | |
3588 | # src/stack_metrics_command.sh |
|
3588 | # src/stack_metrics_command.sh | |
3589 | check_bootstrap |
|
3589 | check_bootstrap | |
3590 |
|
3590 | |||
3591 | DEBUG=${args[--debug]} |
|
3591 | DEBUG=${args[--debug]} | |
3592 | ENV_FILE=${args[--env-file-path]} |
|
3592 | ENV_FILE=${args[--env-file-path]} | |
3593 |
|
3593 | |||
3594 | if [[ ! -f $RC_STACK_METRICS_EXT ]]; then |
|
3594 | if [[ ! -f $RC_STACK_METRICS_EXT ]]; then | |
3595 | RC_STACK_METRICS_EXT_LCL="" |
|
3595 | RC_STACK_METRICS_EXT_LCL="" | |
3596 | else |
|
3596 | else | |
3597 | RC_STACK_METRICS_EXT_LCL="-f $RC_STACK_METRICS_EXT" |
|
3597 | RC_STACK_METRICS_EXT_LCL="-f $RC_STACK_METRICS_EXT" | |
3598 | fi |
|
3598 | fi | |
3599 |
|
3599 | |||
3600 | CMD_METRICS="\ |
|
3600 | CMD_METRICS="\ | |
3601 | RC_ENV_FILE=$ENV_FILE docker compose \ |
|
3601 | RC_ENV_FILE=$ENV_FILE docker compose \ | |
3602 | --env-file $ENV_FILE \ |
|
3602 | --env-file $ENV_FILE \ | |
3603 | $ENV_EXPAND \ |
|
3603 | $ENV_EXPAND \ | |
3604 | -p rc_cluster_metrics \ |
|
3604 | -p rc_cluster_metrics \ | |
3605 | -f docker-compose-base.yaml \ |
|
3605 | -f docker-compose-base.yaml \ | |
3606 | -f docker-compose-metrics.yaml $RC_STACK_METRICS_EXT_LCL" |
|
3606 | -f docker-compose-metrics.yaml $RC_STACK_METRICS_EXT_LCL" | |
3607 |
|
3607 | |||
3608 | if [[ $DEBUG ]]; then |
|
3608 | if [[ $DEBUG ]]; then | |
3609 | echo "---" |
|
3609 | echo "---" | |
3610 | echo "stacks docker: $RC_STACK_METRICS_EXT_LCL" |
|
3610 | echo "stacks docker: $RC_STACK_METRICS_EXT_LCL" | |
3611 | echo "running command: ${CMD_METRICS}" |
|
3611 | echo "running command: ${CMD_METRICS}" | |
3612 | echo "ARGS: ${other_args[*]}" |
|
3612 | echo "ARGS: ${other_args[*]}" | |
3613 | echo "---" |
|
3613 | echo "---" | |
3614 | fi |
|
3614 | fi | |
3615 | eval "${CMD_METRICS} ${other_args[*]}" |
|
3615 | eval "${CMD_METRICS} ${other_args[*]}" | |
3616 | } |
|
3616 | } | |
3617 |
|
3617 | |||
3618 | # :command.function |
|
3618 | # :command.function | |
3619 | rcstack_stack_services_command() { |
|
3619 | rcstack_stack_services_command() { | |
3620 | # src/stack_services_command.sh |
|
3620 | # src/stack_services_command.sh | |
3621 | check_bootstrap |
|
3621 | check_bootstrap | |
3622 |
|
3622 | |||
3623 | DEBUG=${args[--debug]} |
|
3623 | DEBUG=${args[--debug]} | |
3624 | ENV_FILE=${args[--env-file-path]} |
|
3624 | ENV_FILE=${args[--env-file-path]} | |
3625 |
|
3625 | |||
3626 | if [[ ! -f $RC_STACK_SERVICES_EXT ]]; then |
|
3626 | if [[ ! -f $RC_STACK_SERVICES_EXT ]]; then | |
3627 | RC_STACK_SERVICES_EXT_LCL="" |
|
3627 | RC_STACK_SERVICES_EXT_LCL="" | |
3628 | else |
|
3628 | else | |
3629 | RC_STACK_SERVICES_EXT_LCL="-f $RC_STACK_SERVICES_EXT" |
|
3629 | RC_STACK_SERVICES_EXT_LCL="-f $RC_STACK_SERVICES_EXT" | |
3630 | fi |
|
3630 | fi | |
3631 |
|
3631 | |||
3632 | RC_STACK_PROFILES="--profile database --profile redis --profile elasticsearch --profile channelstream" |
|
3632 | RC_STACK_PROFILES="--profile database --profile redis --profile elasticsearch --profile channelstream" | |
3633 |
|
3633 | |||
3634 | CMD_SERVICES="\ |
|
3634 | CMD_SERVICES="\ | |
3635 | RC_ENV_FILE=$ENV_FILE docker compose \ |
|
3635 | RC_ENV_FILE=$ENV_FILE docker compose \ | |
3636 | --env-file $ENV_FILE \ |
|
3636 | --env-file $ENV_FILE \ | |
3637 | $ENV_EXPAND \ |
|
3637 | $ENV_EXPAND \ | |
3638 | $RC_STACK_PROFILES \ |
|
3638 | $RC_STACK_PROFILES \ | |
3639 | --project-name rc_cluster_services \ |
|
3639 | --project-name rc_cluster_services \ | |
3640 | -f docker-compose-base.yaml \ |
|
3640 | -f docker-compose-base.yaml \ | |
3641 | -f docker-compose-services.yaml $RC_STACK_SERVICES_EXT_LCL" |
|
3641 | -f docker-compose-services.yaml $RC_STACK_SERVICES_EXT_LCL" | |
3642 |
|
3642 | |||
3643 | if [[ $DEBUG ]]; then |
|
3643 | if [[ $DEBUG ]]; then | |
3644 | echo "---" |
|
3644 | echo "---" | |
3645 | echo "stacks docker: $RC_STACK_SERVICES_EXT_LCL" |
|
3645 | echo "stacks docker: $RC_STACK_SERVICES_EXT_LCL" | |
3646 | echo "running command: ${CMD_SERVICES}" |
|
3646 | echo "running command: ${CMD_SERVICES}" | |
3647 | echo "ARGS: ${other_args[*]}" |
|
3647 | echo "ARGS: ${other_args[*]}" | |
3648 | echo "---" |
|
3648 | echo "---" | |
3649 | fi |
|
3649 | fi | |
3650 |
|
3650 | |||
3651 | eval "${CMD_SERVICES} ${other_args[*]}" |
|
3651 | eval "${CMD_SERVICES} ${other_args[*]}" | |
3652 | } |
|
3652 | } | |
3653 |
|
3653 | |||
3654 | # :command.function |
|
3654 | # :command.function | |
3655 | rcstack_stack_rhodecode_command() { |
|
3655 | rcstack_stack_rhodecode_command() { | |
3656 | # src/stack_rhodecode_command.sh |
|
3656 | # src/stack_rhodecode_command.sh | |
3657 | check_bootstrap |
|
3657 | check_bootstrap | |
3658 |
|
3658 | |||
3659 | DEBUG=${args[--debug]} |
|
3659 | DEBUG=${args[--debug]} | |
3660 | ENV_FILE=${args[--env-file-path]} |
|
3660 | ENV_FILE=${args[--env-file-path]} | |
3661 |
|
3661 | |||
3662 | stack_prefix=${args[--stack-prefix]} |
|
3662 | stack_prefix=${args[--stack-prefix]} | |
3663 | if [[ $stack_prefix == "" ]]; then |
|
3663 | if [[ $stack_prefix == "" ]]; then | |
3664 | stack_prefix="rc_cluster_apps" |
|
3664 | stack_prefix="rc_cluster_apps" | |
3665 | fi |
|
3665 | fi | |
3666 |
|
3666 | |||
3667 | if [[ ! -f $RC_STACK_RHODECODE_EXT ]]; then |
|
3667 | if [[ ! -f $RC_STACK_RHODECODE_EXT ]]; then | |
3668 | RC_STACK_RHODECODE_EXT_LCL="" |
|
3668 | RC_STACK_RHODECODE_EXT_LCL="" | |
3669 | else |
|
3669 | else | |
3670 | RC_STACK_RHODECODE_EXT_LCL="-f $RC_STACK_RHODECODE_EXT" |
|
3670 | RC_STACK_RHODECODE_EXT_LCL="-f $RC_STACK_RHODECODE_EXT" | |
3671 | fi |
|
3671 | fi | |
3672 |
|
3672 | |||
3673 | CMD_RHODECODE="\ |
|
3673 | CMD_RHODECODE="\ | |
3674 | RC_ENV_FILE=$ENV_FILE docker compose \ |
|
3674 | RC_ENV_FILE=$ENV_FILE docker compose \ | |
3675 | --env-file $ENV_FILE \ |
|
3675 | --env-file $ENV_FILE \ | |
3676 | $ENV_EXPAND \ |
|
3676 | $ENV_EXPAND \ | |
3677 | -p $stack_prefix \ |
|
3677 | -p $stack_prefix \ | |
3678 | -f docker-compose-base.yaml \ |
|
3678 | -f docker-compose-base.yaml \ | |
3679 | -f docker-compose-apps.yaml $RC_STACK_RHODECODE_EXT_LCL" |
|
3679 | -f docker-compose-apps.yaml $RC_STACK_RHODECODE_EXT_LCL" | |
3680 |
|
3680 | |||
3681 | sub_cmd=${other_args[0]} |
|
3681 | sub_cmd=${other_args[0]} | |
3682 |
|
3682 | |||
3683 | if [[ $sub_cmd == "up" ]]; then |
|
3683 | if [[ $sub_cmd == "up" ]]; then | |
3684 | declare -a final_args=( "$sub_cmd" "--no-color" "--no-build" "${other_args[@]:1}" ) |
|
3684 | declare -a final_args=( "$sub_cmd" "--no-color" "--no-build" "${other_args[@]:1}" ) | |
3685 | else |
|
3685 | else | |
3686 | declare -a final_args=( "$sub_cmd" "${other_args[@]:1}" ) |
|
3686 | declare -a final_args=( "$sub_cmd" "${other_args[@]:1}" ) | |
3687 | fi |
|
3687 | fi | |
3688 |
|
3688 | |||
3689 | if [[ $DEBUG ]]; then |
|
3689 | if [[ $DEBUG ]]; then | |
3690 | echo "---" |
|
3690 | echo "---" | |
3691 | echo "stacks docker: $RC_STACK_RHODECODE_EXT_LCL" |
|
3691 | echo "stacks docker: $RC_STACK_RHODECODE_EXT_LCL" | |
3692 | echo "running command: ${CMD_RHODECODE}" |
|
3692 | echo "running command: ${CMD_RHODECODE}" | |
3693 | echo "ARGS: ${final_args[*]}" |
|
3693 | echo "ARGS: ${final_args[*]}" | |
3694 | echo "---" |
|
3694 | echo "---" | |
3695 | fi |
|
3695 | fi | |
3696 | eval "${CMD_RHODECODE} ${final_args[*]}" |
|
3696 | eval "${CMD_RHODECODE} ${final_args[*]}" | |
3697 |
|
3697 | |||
3698 | } |
|
3698 | } | |
3699 |
|
3699 | |||
3700 | # :command.function |
|
3700 | # :command.function | |
3701 | rcstack_stack_all_command() { |
|
3701 | rcstack_stack_all_command() { | |
3702 | # src/stack_all_command.sh |
|
3702 | # src/stack_all_command.sh | |
3703 | check_bootstrap |
|
3703 | check_bootstrap | |
3704 |
|
3704 | |||
3705 | DEBUG=${args[--debug]} |
|
3705 | DEBUG=${args[--debug]} | |
3706 |
|
3706 | |||
3707 | stack_lst=$VALID_SERVICES |
|
3707 | stack_lst=$VALID_SERVICES | |
3708 |
|
3708 | |||
3709 | for stack in $stack_lst; do |
|
3709 | for stack in $stack_lst; do | |
3710 | ./$RC_SCRIPT_NAME stack $stack ${other_args[*]} |
|
3710 | ./$RC_SCRIPT_NAME stack $stack ${other_args[*]} | |
3711 | done |
|
3711 | done | |
3712 |
|
3712 | |||
3713 | } |
|
3713 | } | |
3714 |
|
3714 | |||
3715 | # :command.function |
|
3715 | # :command.function | |
3716 | rcstack_stack_status_command() { |
|
3716 | rcstack_stack_status_command() { | |
3717 | # src/stack_status_command.sh |
|
3717 | # src/stack_status_command.sh | |
3718 | check_bootstrap |
|
3718 | check_bootstrap | |
3719 | DEBUG=${args[--debug]} |
|
3719 | DEBUG=${args[--debug]} | |
3720 | DETAILED=${args[--detailed]} |
|
3720 | DETAILED=${args[--detailed]} | |
3721 | CONFIGS=${args[--configs]} |
|
3721 | CONFIGS=${args[--configs]} | |
3722 | VERBOSE=${args[-v]} |
|
3722 | VERBOSE=${args[-v]} | |
3723 |
|
3723 | |||
3724 | .env --file $RUNTIME_ENV |
|
3724 | .env --file $RUNTIME_ENV | |
3725 | .env get_or_error RC_APP_BASE_URL |
|
3725 | .env get_or_error RC_APP_BASE_URL | |
3726 | RC_APP_BASE_URL=$REPLY |
|
3726 | RC_APP_BASE_URL=$REPLY | |
3727 |
|
3727 | |||
3728 | .env get_or_error RC_VERSION |
|
3728 | .env get_or_error RC_VERSION | |
3729 | RC_VERSION=$REPLY |
|
3729 | RC_VERSION=$REPLY | |
3730 |
|
3730 | |||
3731 | .env get_or_error RC_SSH_PORT |
|
3731 | .env get_or_error RC_SSH_PORT | |
3732 | RC_SSH_PORT=$REPLY |
|
3732 | RC_SSH_PORT=$REPLY | |
3733 |
|
3733 | |||
3734 | .env get_or_error RC_EDITION |
|
3734 | .env get_or_error RC_EDITION | |
3735 | RC_EDITION=$REPLY |
|
3735 | RC_EDITION=$REPLY | |
3736 |
|
3736 | |||
3737 | .env get_or_error RC_LICENSE_TOKEN |
|
3737 | .env get_or_error RC_LICENSE_TOKEN | |
3738 | RC_LICENSE_TOKEN=$REPLY |
|
3738 | RC_LICENSE_TOKEN=$REPLY | |
3739 |
|
3739 | |||
3740 | if [[ $DEBUG ]]; then |
|
3740 | if [[ $DEBUG ]]; then | |
3741 | echo "---" |
|
3741 | echo "---" | |
3742 | ps_cmd=$(docker ps --filter=name=rc_cluster --format="{{.ID}}") |
|
3742 | ps_cmd=$(docker ps --filter=name=rc_cluster --format="{{.ID}}") | |
3743 |
|
3743 | |||
3744 | for service in $ps_cmd; do |
|
3744 | for service in $ps_cmd; do | |
3745 |
|
3745 | |||
3746 | servicename=`docker inspect --format '{{ .Name }}' $service` |
|
3746 | servicename=`docker inspect --format '{{ .Name }}' $service` | |
3747 | servicename=${servicename:1} |
|
3747 | servicename=${servicename:1} | |
3748 | echo $servicename |
|
3748 | echo $servicename | |
3749 | docker inspect $service --format='{{.State.Status}}: {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' |
|
3749 | docker inspect $service --format='{{.State.Status}}: {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' | |
3750 | echo "" |
|
3750 | echo "" | |
3751 |
|
3751 | |||
3752 | done |
|
3752 | done | |
3753 | echo "---" |
|
3753 | echo "---" | |
3754 | fi |
|
3754 | fi | |
3755 |
|
3755 | |||
3756 | echo "Running hostname: $RC_APP_BASE_URL" |
|
3756 | echo "Running hostname: $RC_APP_BASE_URL" | |
3757 | if [[ $VERBOSE ]]; then |
|
3757 | if [[ $VERBOSE ]]; then | |
3758 | printf "SSH Port: $RC_SSH_PORT\n" |
|
3758 | printf "SSH Port: $RC_SSH_PORT\n" | |
3759 | printf "Edition: $RC_EDITION:$RC_VERSION\n" |
|
3759 | printf "Edition: $RC_EDITION:$RC_VERSION\n" | |
3760 | printf "License: $RC_LICENSE_TOKEN\n" |
|
3760 | printf "License: $RC_LICENSE_TOKEN\n" | |
3761 | printf "\n" |
|
3761 | printf "\n" | |
3762 | fi |
|
3762 | fi | |
3763 |
|
3763 | |||
3764 | if [[ $CONFIGS ]]; then |
|
3764 | if [[ $CONFIGS ]]; then | |
3765 | printf "rcstack:\n" |
|
3765 | printf "rcstack:\n" | |
3766 | printf " config (in-host): $RUNTIME_ENV\n" |
|
3766 | printf " config (in-host): $RUNTIME_ENV\n" | |
3767 |
|
3767 | |||
3768 | printf "RhodeCode:\n" |
|
3768 | printf "RhodeCode:\n" | |
3769 | printf " ini (in-host): $rhodecode_default_config_path\n" |
|
3769 | printf " ini (in-host): $rhodecode_default_config_path\n" | |
3770 | printf " volumes (in-container):\n" |
|
3770 | printf " volumes (in-container):\n" | |
3771 | printf " repo-store: /var/opt/rhodecode_repo_store\n" |
|
3771 | printf " repo-store: /var/opt/rhodecode_repo_store\n" | |
3772 | printf " data-store: /var/opt/rhodecode_data\n" |
|
3772 | printf " data-store: /var/opt/rhodecode_data\n" | |
3773 |
|
3773 | |||
3774 | printf "VCSServer:\n" |
|
3774 | printf "VCSServer:\n" | |
3775 | printf " ini (in-host): $vcsserver_default_config_path\n" |
|
3775 | printf " ini (in-host): $vcsserver_default_config_path\n" | |
3776 | printf " volumes (in-container):\n" |
|
3776 | printf " volumes (in-container):\n" | |
3777 | printf " repo-store: /var/opt/rhodecode_repo_store\n" |
|
3777 | printf " repo-store: /var/opt/rhodecode_repo_store\n" | |
3778 | printf " data-store: /var/opt/rhodecode_data\n" |
|
3778 | printf " data-store: /var/opt/rhodecode_data\n" | |
3779 |
|
3779 | |||
3780 | printf "Traefik (router):\n" |
|
3780 | printf "Traefik (router):\n" | |
3781 | printf " ssl-certs definitions: .custom/traefik_custom/dynamic/traefik_dynamic_custom.yaml\n" |
|
3781 | printf " ssl-certs definitions: .custom/traefik_custom/dynamic/traefik_dynamic_custom.yaml\n" | |
3782 | printf " ssl-certs dir: .custom/traefik_custom/dynamic/certs/\n" |
|
3782 | printf " ssl-certs dir: .custom/traefik_custom/dynamic/certs/\n" | |
3783 |
|
3783 | |||
3784 | fi |
|
3784 | fi | |
3785 |
|
3785 | |||
3786 | if [[ $DETAILED ]]; then |
|
3786 | if [[ $DETAILED ]]; then | |
3787 | ps_cmd=$(docker ps --filter=name=rc_cluster --format="{{.ID}}") |
|
3787 | ps_cmd=$(docker ps --filter=name=rc_cluster --format="{{.ID}}") | |
3788 |
|
3788 | |||
3789 | for service in $ps_cmd; do |
|
3789 | for service in $ps_cmd; do | |
3790 | servicename=`docker inspect --format '{{ .Name }}' $service` |
|
3790 | servicename=`docker inspect --format '{{ .Name }}' $service` | |
3791 | servicename=${servicename:1} |
|
3791 | servicename=${servicename:1} | |
3792 | printf "CONTAINER:\\t$servicename\n" |
|
3792 | printf "CONTAINER:\\t$servicename\n" | |
3793 | printf "LOGS:\\t\\tdocker logs --tail=100 $service\n" |
|
3793 | printf "LOGS:\\t\\tdocker logs --tail=100 $service\n" | |
3794 | docker ps --filter=name=$servicename --format="ID:\\t\\t{{.ID}}\nIMAGE:\\t\\t{{.Image}}\nSTATUS:\\t\\t{{.Status}}\nPORTS:\\t\\t{{.Ports}}\n" |
|
3794 | docker ps --filter=name=$servicename --format="ID:\\t\\t{{.ID}}\nIMAGE:\\t\\t{{.Image}}\nSTATUS:\\t\\t{{.Status}}\nPORTS:\\t\\t{{.Ports}}\n" | |
3795 | echo "" |
|
3795 | echo "" | |
3796 | done |
|
3796 | done | |
3797 | else |
|
3797 | else | |
3798 | 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 ) |
|
3798 | 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 ) | |
3799 | fi |
|
3799 | fi | |
3800 |
|
3800 | |||
3801 | } |
|
3801 | } | |
3802 |
|
3802 | |||
3803 | # :command.function |
|
3803 | # :command.function | |
3804 | rcstack_stack_upgrade_router_command() { |
|
3804 | rcstack_stack_upgrade_router_command() { | |
3805 | # src/stack_upgrade_router_command.sh |
|
3805 | # src/stack_upgrade_router_command.sh | |
3806 | echo "Upgrading this stack with:" |
|
3806 | echo "Upgrading this stack with:" | |
3807 | echo "./$RC_SCRIPT_NAME stack router up --force-recreate --detach" |
|
3807 | echo "./$RC_SCRIPT_NAME stack router up --force-recreate --detach" | |
3808 | echo "" |
|
3808 | echo "" | |
3809 | echo "NOTE: To reclaim space occupied by old images, run:" |
|
3809 | echo "NOTE: To reclaim space occupied by old images, run:" | |
3810 | echo "docker image prune -f" |
|
3810 | echo "docker image prune -f" | |
3811 |
|
3811 | |||
3812 | ./$RC_SCRIPT_NAME stack router up --force-recreate --detach |
|
3812 | ./$RC_SCRIPT_NAME stack router up --force-recreate --detach | |
3813 |
|
3813 | |||
3814 | } |
|
3814 | } | |
3815 |
|
3815 | |||
3816 | # :command.function |
|
3816 | # :command.function | |
3817 | rcstack_stack_upgrade_services_command() { |
|
3817 | rcstack_stack_upgrade_services_command() { | |
3818 | # src/stack_upgrade_services_command.sh |
|
3818 | # src/stack_upgrade_services_command.sh | |
3819 | echo "Upgrading this stack with:" |
|
3819 | echo "Upgrading this stack with:" | |
3820 | echo "./$RC_SCRIPT_NAME stack services up --force-recreate --detach" |
|
3820 | echo "./$RC_SCRIPT_NAME stack services up --force-recreate --detach" | |
3821 | echo "" |
|
3821 | echo "" | |
3822 | echo "NOTE: To reclaim space occupied by old images, run:" |
|
3822 | echo "NOTE: To reclaim space occupied by old images, run:" | |
3823 | echo "docker image prune -f" |
|
3823 | echo "docker image prune -f" | |
3824 |
|
3824 | |||
3825 | ./$RC_SCRIPT_NAME stack services up --force-recreate --detach |
|
3825 | ./$RC_SCRIPT_NAME stack services up --force-recreate --detach | |
3826 |
|
3826 | |||
3827 | } |
|
3827 | } | |
3828 |
|
3828 | |||
3829 | # :command.function |
|
3829 | # :command.function | |
3830 | rcstack_stack_upgrade_metrics_command() { |
|
3830 | rcstack_stack_upgrade_metrics_command() { | |
3831 | # src/stack_upgrade_metrics_command.sh |
|
3831 | # src/stack_upgrade_metrics_command.sh | |
3832 | echo "To upgrading this stack with:" |
|
3832 | echo "To upgrading this stack with:" | |
3833 | echo "./$RC_SCRIPT_NAME stack metrics up --force-recreate --detach" |
|
3833 | echo "./$RC_SCRIPT_NAME stack metrics up --force-recreate --detach" | |
3834 | echo "" |
|
3834 | echo "" | |
3835 | echo "NOTE: To reclaim space occupied by old images, run:" |
|
3835 | echo "NOTE: To reclaim space occupied by old images, run:" | |
3836 | echo "docker image prune -f" |
|
3836 | echo "docker image prune -f" | |
3837 |
|
3837 | |||
3838 | ./$RC_SCRIPT_NAME stack metrics up --force-recreate --detach |
|
3838 | ./$RC_SCRIPT_NAME stack metrics up --force-recreate --detach | |
3839 |
|
3839 | |||
3840 | } |
|
3840 | } | |
3841 |
|
3841 | |||
3842 | # :command.function |
|
3842 | # :command.function | |
3843 | rcstack_stack_upgrade_rhodecode_command() { |
|
3843 | rcstack_stack_upgrade_rhodecode_command() { | |
3844 | # src/stack_upgrade_rhodecode_command.sh |
|
3844 | # src/stack_upgrade_rhodecode_command.sh | |
3845 | check_bootstrap |
|
3845 | check_bootstrap | |
3846 |
|
3846 | |||
3847 | stop_wait=${args[--stop-wait]} |
|
3847 | stop_wait=${args[--stop-wait]} | |
3848 | docker_stop_wait=${args[--docker-stop-wait]} |
|
3848 | docker_stop_wait=${args[--docker-stop-wait]} | |
3849 |
|
3849 | |||
3850 | stack_prefix=${args[--stack-prefix]} |
|
3850 | stack_prefix=${args[--stack-prefix]} | |
3851 | if [[ $stack_prefix == "" ]]; then |
|
3851 | if [[ $stack_prefix == "" ]]; then | |
3852 | stack_prefix="rc_cluster_apps" |
|
3852 | stack_prefix="rc_cluster_apps" | |
3853 | fi |
|
3853 | fi | |
3854 |
|
3854 | |||
3855 | # search docker IDs for current service |
|
3855 | # search docker IDs for current service | |
3856 | .env --file $RUNTIME_ENV |
|
3856 | .env --file $RUNTIME_ENV | |
3857 |
|
3857 | |||
3858 | .env get_or_error RC_VERSION |
|
3858 | .env get_or_error RC_VERSION | |
3859 | RC_VERSION=$REPLY |
|
3859 | RC_VERSION=$REPLY | |
3860 |
|
3860 | |||
3861 | .env get_or_error RC_EDITION |
|
3861 | .env get_or_error RC_EDITION | |
3862 | RC_EDITION=$REPLY |
|
3862 | RC_EDITION=$REPLY | |
3863 |
|
3863 | |||
3864 | echo "Pulling new image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION}" |
|
3864 | echo "Pulling new image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION}" | |
3865 | echo "WARNING: about to start downloading the RhodeCode base image" |
|
3865 | echo "WARNING: about to start downloading the RhodeCode base image" | |
3866 | echo "This process may take anywhere between a few minutes to an hour, depending on your network speed" |
|
3866 | echo "This process may take anywhere between a few minutes to an hour, depending on your network speed" | |
3867 | echo "running: docker pull -q rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION}" |
|
3867 | echo "running: docker pull -q rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION}" | |
3868 |
|
3868 | |||
3869 | eval "docker pull -q rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION}" |
|
3869 | eval "docker pull -q rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION}" | |
3870 |
|
3870 | |||
3871 | have_tty=1 |
|
3871 | have_tty=1 | |
3872 | # Set a dummy terminal type if none set |
|
3872 | # Set a dummy terminal type if none set | |
3873 | [[ -z "$TERM" ]] && export have_tty=0 |
|
3873 | [[ -z "$TERM" ]] && export have_tty=0 | |
3874 | [[ ! -t 1 ]] && export have_tty=0 |
|
3874 | [[ ! -t 1 ]] && export have_tty=0 | |
3875 |
|
3875 | |||
3876 | set_cursor() { |
|
3876 | set_cursor() { | |
3877 | if [[ $have_tty == 1 ]]; then |
|
3877 | if [[ $have_tty == 1 ]]; then | |
3878 | tput $1 |
|
3878 | tput $1 | |
3879 | fi |
|
3879 | fi | |
3880 | } |
|
3880 | } | |
3881 |
|
3881 | |||
3882 | stop_containers() { |
|
3882 | stop_containers() { | |
3883 | target_container=$1 |
|
3883 | target_container=$1 | |
3884 | docker_stop_wait=$2 |
|
3884 | docker_stop_wait=$2 | |
3885 | stop_wait=$3 |
|
3885 | stop_wait=$3 | |
3886 | target_containers_pat="$stack_prefix-$target_container-*" |
|
3886 | target_containers_pat="$stack_prefix-$target_container-*" | |
3887 |
|
3887 | |||
3888 | # array with OLD containers |
|
3888 | # array with OLD containers | |
3889 | local -a old_docker_ids |
|
3889 | local -a old_docker_ids | |
3890 | readarray -t old_docker_ids < <(docker ps --filter name="$target_containers_pat" -q) |
|
3890 | readarray -t old_docker_ids < <(docker ps --filter name="$target_containers_pat" -q) | |
3891 |
|
3891 | |||
3892 | scale=${#old_docker_ids[@]} |
|
3892 | scale=${#old_docker_ids[@]} | |
3893 | scale_2=$(( scale * 2 )) |
|
3893 | scale_2=$(( scale * 2 )) | |
3894 |
|
3894 | |||
3895 | echo "" |
|
3895 | echo "" | |
3896 | echo "Found $scale old container[s] for $target_container" |
|
3896 | echo "Found $scale old container[s] for $target_container" | |
3897 | echo "Old container-ids:" "${old_docker_ids[@]}" |
|
3897 | echo "Old container-ids:" "${old_docker_ids[@]}" | |
3898 | echo "" |
|
3898 | echo "" | |
3899 |
|
3899 | |||
3900 | if [[ $scale == "0" ]]; then |
|
3900 | if [[ $scale == "0" ]]; then | |
3901 | echo "No previous services found, doing a regular start for $target_container" |
|
3901 | echo "No previous services found, doing a regular start for $target_container" | |
3902 | ./$RC_SCRIPT_NAME stack rhodecode up $target_container --detach |
|
3902 | ./$RC_SCRIPT_NAME stack rhodecode up $target_container --detach | |
3903 | return |
|
3903 | return | |
3904 | else |
|
3904 | else | |
3905 | echo "Scaling to 2x ($scale_2 total) containers for $target_container" |
|
3905 | echo "Scaling to 2x ($scale_2 total) containers for $target_container" | |
3906 | ./$RC_SCRIPT_NAME stack rhodecode up $target_container --no-recreate --detach --scale $target_container=$scale_2 |
|
3906 | ./$RC_SCRIPT_NAME stack rhodecode up $target_container --no-recreate --detach --scale $target_container=$scale_2 | |
3907 | fi |
|
3907 | fi | |
3908 |
|
3908 | |||
3909 | # array with ALL new containers |
|
3909 | # array with ALL new containers | |
3910 | local -a scaled_docker_ids |
|
3910 | local -a scaled_docker_ids | |
3911 | readarray -t scaled_docker_ids < <(docker ps --filter name="$target_containers_pat" -q) |
|
3911 | readarray -t scaled_docker_ids < <(docker ps --filter name="$target_containers_pat" -q) | |
3912 |
|
3912 | |||
3913 | echo "Scaling completed, running $scale_2 services for upgrade purpose..." |
|
3913 | echo "Scaling completed, running $scale_2 services for upgrade purpose..." | |
3914 | echo "new docker-ids:" "${scaled_docker_ids[@]}" |
|
3914 | echo "new docker-ids:" "${scaled_docker_ids[@]}" | |
3915 |
|
3915 | |||
3916 | # calculate just NEW containers |
|
3916 | # calculate just NEW containers | |
3917 | declare -A new_container_check |
|
3917 | declare -A new_container_check | |
3918 |
|
3918 | |||
3919 | # Mark elements of the first initial docker |
|
3919 | # Mark elements of the first initial docker | |
3920 | for docker_id in "${old_docker_ids[@]}"; do |
|
3920 | for docker_id in "${old_docker_ids[@]}"; do | |
3921 | new_container_check[$docker_id]=1 |
|
3921 | new_container_check[$docker_id]=1 | |
3922 | done |
|
3922 | done | |
3923 |
|
3923 | |||
3924 | local new_docker_ids_str |
|
3924 | local new_docker_ids_str | |
3925 | new_docker_ids_str="" |
|
3925 | new_docker_ids_str="" | |
3926 |
|
3926 | |||
3927 | # Check if elements of the second array are not in the first |
|
3927 | # Check if elements of the second array are not in the first | |
3928 | for n_docker_id in "${scaled_docker_ids[@]}"; do |
|
3928 | for n_docker_id in "${scaled_docker_ids[@]}"; do | |
3929 | # if $docker_id in new services is empty in the last array we ADD it :) |
|
3929 | # if $docker_id in new services is empty in the last array we ADD it :) | |
3930 | if [[ -z ${new_container_check[$n_docker_id]} ]]; then |
|
3930 | if [[ -z ${new_container_check[$n_docker_id]} ]]; then | |
3931 | new_docker_ids_str+=" $n_docker_id " |
|
3931 | new_docker_ids_str+=" $n_docker_id " | |
3932 | fi |
|
3932 | fi | |
3933 | done |
|
3933 | done | |
3934 |
|
3934 | |||
3935 | echo "Stopping $scale old $target_container containers " |
|
3935 | echo "Stopping $scale old $target_container containers " | |
3936 | echo "killing docker-ids:" "${old_docker_ids[@]}" |
|
3936 | echo "killing docker-ids:" "${old_docker_ids[@]}" | |
3937 |
|
3937 | |||
3938 | spin='β Ύβ ½β »β β ―β ·' |
|
3938 | spin='β Ύβ ½β »β β ―β ·' | |
3939 | charwidth=1 |
|
3939 | charwidth=1 | |
3940 |
|
3940 | |||
3941 | # wait the required stop-wait time |
|
3941 | # wait the required stop-wait time | |
3942 | #HC: docker inspect --format='{{.Name}}: {{json .ContainerId .State.Health.Status}}' <container-id> |
|
3942 | #HC: docker inspect --format='{{.Name}}: {{json .ContainerId .State.Health.Status}}' <container-id> | |
3943 | local i |
|
3943 | local i | |
3944 | i=$(($stop_wait * 10)) |
|
3944 | i=$(($stop_wait * 10)) | |
3945 |
|
3945 | |||
3946 | local status |
|
3946 | local status | |
3947 | status='' |
|
3947 | status='' | |
3948 |
|
3948 | |||
3949 | # cursor invisible |
|
3949 | # cursor invisible | |
3950 | set_cursor civis |
|
3950 | set_cursor civis | |
3951 | while true |
|
3951 | while true | |
3952 | s=$((i / 10)) |
|
3952 | s=$((i / 10)) | |
3953 | do |
|
3953 | do | |
3954 | i=$(($i-1)) |
|
3954 | i=$(($i-1)) | |
3955 | if [[ $i -lt 1 ]]; then |
|
3955 | if [[ $i -lt 1 ]]; then | |
3956 | break |
|
3956 | break | |
3957 | fi |
|
3957 | fi | |
3958 |
|
3958 | |||
3959 | if [[ "$(($i % 10))" == 0 ]]; |
|
3959 | if [[ "$(($i % 10))" == 0 ]]; | |
3960 | then |
|
3960 | then | |
3961 | is_at_sec=1 |
|
3961 | is_at_sec=1 | |
3962 | else |
|
3962 | else | |
3963 | is_at_sec=0 |
|
3963 | is_at_sec=0 | |
3964 | fi |
|
3964 | fi | |
3965 |
|
3965 | |||
3966 | local new_docker_ids_status_cnt |
|
3966 | local new_docker_ids_status_cnt | |
3967 |
|
3967 | |||
3968 | if [[ $is_at_sec == 1 ]]; then |
|
3968 | if [[ $is_at_sec == 1 ]]; then | |
3969 |
|
3969 | |||
3970 | new_docker_ids_status_cnt=$(docker inspect --format='{{.State.Health.Status}}' $new_docker_ids_str | grep -c "healthy" || echo "") |
|
3970 | new_docker_ids_status_cnt=$(docker inspect --format='{{.State.Health.Status}}' $new_docker_ids_str | grep -c "healthy" || echo "") | |
3971 |
|
3971 | |||
3972 | if [[ $new_docker_ids_status_cnt -eq $scale ]]; then |
|
3972 | if [[ $new_docker_ids_status_cnt -eq $scale ]]; then | |
3973 | echo "All $target_container are in HEALTHY state; stopping old ones now" |
|
3973 | echo "All $target_container are in HEALTHY state; stopping old ones now" | |
3974 | echo "" |
|
3974 | echo "" | |
3975 | break |
|
3975 | break | |
3976 | fi |
|
3976 | fi | |
3977 |
|
3977 | |||
3978 | fi |
|
3978 | fi | |
3979 |
|
3979 | |||
3980 | k=$(((k + $charwidth) % ${#spin})) |
|
3980 | k=$(((k + $charwidth) % ${#spin})) | |
3981 |
|
3981 | |||
3982 | if [[ $have_tty == 1 ]]; then |
|
3982 | if [[ $have_tty == 1 ]]; then | |
3983 | printf "%s stopping $scale old containers once they are in HEALTHY state, or in $s s..." "${spin:$k:$charwidth}" |
|
3983 | printf "%s stopping $scale old containers once they are in HEALTHY state, or in $s s..." "${spin:$k:$charwidth}" | |
3984 | printf "\r" |
|
3984 | printf "\r" | |
3985 | else |
|
3985 | else | |
3986 | if [[ $is_at_sec == 1 ]]; then |
|
3986 | if [[ $is_at_sec == 1 ]]; then | |
3987 | echo "stopping $scale old containers once they are in HEALTHY state, or in $s s..." |
|
3987 | echo "stopping $scale old containers once they are in HEALTHY state, or in $s s..." | |
3988 | fi |
|
3988 | fi | |
3989 | fi |
|
3989 | fi | |
3990 |
|
3990 | |||
3991 | sleep .1 |
|
3991 | sleep .1 | |
3992 | done |
|
3992 | done | |
3993 | set_cursor cnorm |
|
3993 | set_cursor cnorm | |
3994 |
|
3994 | |||
3995 | for container in "${old_docker_ids[@]}" |
|
3995 | for container in "${old_docker_ids[@]}" | |
3996 | do |
|
3996 | do | |
3997 | echo "now running container $container stop with --time $docker_stop_wait" |
|
3997 | echo "now running container $container stop with --time $docker_stop_wait" | |
3998 | docker stop --time "$docker_stop_wait" "$container" > /dev/null |
|
3998 | docker stop --time "$docker_stop_wait" "$container" > /dev/null | |
3999 | docker rm "$container" > /dev/null |
|
3999 | docker rm "$container" > /dev/null | |
4000 | echo "Stopped $container" |
|
4000 | echo "Stopped $container" | |
4001 | done |
|
4001 | done | |
4002 |
|
4002 | |||
4003 | } |
|
4003 | } | |
4004 |
|
4004 | |||
4005 | # VCSSERVER Containers |
|
4005 | # VCSSERVER Containers | |
4006 | stop_containers "vcsserver" $docker_stop_wait $stop_wait |
|
4006 | stop_containers "vcsserver" $docker_stop_wait $stop_wait | |
4007 |
|
4007 | |||
4008 | # RHODECODE Containers |
|
4008 | # RHODECODE Containers | |
4009 | stop_containers "rhodecode" $docker_stop_wait $stop_wait |
|
4009 | stop_containers "rhodecode" $docker_stop_wait $stop_wait | |
4010 |
|
4010 | |||
4011 | # SSHD Containers |
|
4011 | # SSHD Containers | |
4012 | stop_containers "sshd" $docker_stop_wait $stop_wait |
|
4012 | stop_containers "sshd" $docker_stop_wait $stop_wait | |
4013 |
|
4013 | |||
4014 | # SVN Containers |
|
4014 | # SVN Containers | |
4015 | stop_containers "svn" $docker_stop_wait $stop_wait |
|
4015 | stop_containers "svn" $docker_stop_wait $stop_wait | |
4016 |
|
4016 | |||
4017 | ./$RC_SCRIPT_NAME stack rhodecode up celery --force-recreate --detach |
|
4017 | ./$RC_SCRIPT_NAME stack rhodecode up celery --force-recreate --detach | |
4018 | ./$RC_SCRIPT_NAME stack rhodecode up celery-beat --force-recreate --detach |
|
4018 | ./$RC_SCRIPT_NAME stack rhodecode up celery-beat --force-recreate --detach | |
4019 |
|
4019 | |||
4020 | echo "Upgrade to rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION} completed" |
|
4020 | echo "Upgrade to rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION} completed" | |
4021 | exit |
|
4021 | exit | |
4022 |
|
4022 | |||
4023 | } |
|
4023 | } | |
4024 |
|
4024 | |||
4025 | # :command.function |
|
4025 | # :command.function | |
4026 | rcstack_stack_monitor_restart_unhealthy_command() { |
|
4026 | rcstack_stack_monitor_restart_unhealthy_command() { | |
4027 | # src/stack_monitor_restart_unhealthy_command.sh |
|
4027 | # src/stack_monitor_restart_unhealthy_command.sh | |
4028 | check_bootstrap |
|
4028 | check_bootstrap | |
4029 |
|
4029 | |||
4030 | DEBUG=${args[--debug]} |
|
4030 | DEBUG=${args[--debug]} | |
4031 | loop=${args[--loop]} |
|
4031 | loop=${args[--loop]} | |
4032 |
|
4032 | |||
4033 | get_unhealthy() { |
|
4033 | get_unhealthy() { | |
4034 | unhealthy=$(docker ps --filter health=unhealthy --filter label=autoheal=true --format "{{.ID}}") |
|
4034 | unhealthy=$(docker ps --filter health=unhealthy --filter label=autoheal=true --format "{{.ID}}") | |
4035 |
|
4035 | |||
4036 | if [[ $unhealthy == "" ]]; then |
|
4036 | if [[ $unhealthy == "" ]]; then | |
4037 | echo "$(green stack-monitor: no unhealthy containers found)" |
|
4037 | echo "$(green stack-monitor: no unhealthy containers found)" | |
4038 | else |
|
4038 | else | |
4039 | echo "$(yellow stack-monitor: found unhealthy containers $unhealthy)" |
|
4039 | echo "$(yellow stack-monitor: found unhealthy containers $unhealthy)" | |
4040 | fi |
|
4040 | fi | |
4041 |
|
4041 | |||
4042 | for container in $unhealthy |
|
4042 | for container in $unhealthy | |
4043 | do |
|
4043 | do | |
4044 | docker stats --no-stream --format '{{.ID}}\t{{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.NetIO}}\t{{.BlockIO}}' $container |
|
4044 | docker stats --no-stream --format '{{.ID}}\t{{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.NetIO}}\t{{.BlockIO}}' $container | |
4045 | echo "stack-monitor: restart $container" |
|
4045 | echo "stack-monitor: restart $container" | |
4046 | docker restart --time=10 $container |
|
4046 | docker restart --time=10 $container | |
4047 | done |
|
4047 | done | |
4048 |
|
4048 | |||
4049 | } |
|
4049 | } | |
4050 |
|
4050 | |||
4051 | if [[ ! $loop == "0" ]]; then |
|
4051 | if [[ ! $loop == "0" ]]; then | |
4052 |
|
4052 | |||
4053 | while true |
|
4053 | while true | |
4054 | do |
|
4054 | do | |
4055 | date_formatted=$(date) |
|
4055 | date_formatted=$(date) | |
4056 | echo "stack-monitor: loop-run every $loop seconds..., $date_formatted" |
|
4056 | echo "stack-monitor: loop-run every $loop seconds..., $date_formatted" | |
4057 | # loop run |
|
4057 | # loop run | |
4058 | NO_COLOR=1 get_unhealthy |
|
4058 | NO_COLOR=1 get_unhealthy | |
4059 | echo "Next execution in $loop s..." && \ |
|
4059 | echo "Next execution in $loop s..." && \ | |
4060 | sleep $loop |
|
4060 | sleep $loop | |
4061 | echo "" |
|
4061 | echo "" | |
4062 | done |
|
4062 | done | |
4063 |
|
4063 | |||
4064 | else |
|
4064 | else | |
4065 |
|
4065 | |||
4066 | # one time run |
|
4066 | # one time run | |
4067 | get_unhealthy |
|
4067 | get_unhealthy | |
4068 | fi |
|
4068 | fi | |
4069 |
|
4069 | |||
4070 | exit |
|
4070 | exit | |
4071 |
|
4071 | |||
4072 | } |
|
4072 | } | |
4073 |
|
4073 | |||
4074 | # :command.function |
|
4074 | # :command.function | |
4075 | rcstack_cli_cmd_command() { |
|
4075 | rcstack_cli_cmd_command() { | |
4076 | # src/cli_cmd_command.sh |
|
4076 | # src/cli_cmd_command.sh | |
4077 | check_bootstrap |
|
4077 | check_bootstrap | |
4078 |
|
4078 | |||
4079 | if [[ -z ${args['--user']} ]]; then |
|
4079 | if [[ -z ${args['--user']} ]]; then | |
4080 | # set default, user if the flag is not used |
|
4080 | # set default, user if the flag is not used | |
4081 | args['--user']='root' |
|
4081 | args['--user']='root' | |
4082 | fi |
|
4082 | fi | |
4083 |
|
4083 | |||
4084 | DEBUG=${args[--debug]} |
|
4084 | DEBUG=${args[--debug]} | |
4085 | RUN_WITHOUT_TTY=${args[--no-tty]} |
|
4085 | RUN_WITHOUT_TTY=${args[--no-tty]} | |
4086 | ENV_FILE=${args[--env-file-path]} |
|
4086 | ENV_FILE=${args[--env-file-path]} | |
4087 | EXEC_USER=${args[--user]} |
|
4087 | EXEC_USER=${args[--user]} | |
4088 |
|
4088 | |||
4089 | INTERACTIVE_FLAGS="--interactive --tty" |
|
4089 | INTERACTIVE_FLAGS="--interactive --tty" | |
4090 | if [[ $RUN_WITHOUT_TTY ]]; then |
|
4090 | if [[ $RUN_WITHOUT_TTY ]]; then | |
4091 | INTERACTIVE_FLAGS="--interactive" |
|
4091 | INTERACTIVE_FLAGS="--interactive" | |
4092 | fi |
|
4092 | fi | |
4093 |
|
4093 | |||
4094 | proj_name=rc_cluster_apps |
|
4094 | proj_name=rc_cluster_apps | |
4095 | # use vcsserver here because it won't do any extra logic like rhodecode image does |
|
4095 | # use vcsserver here because it won't do any extra logic like rhodecode image does | |
4096 | instance_type=vcsserver |
|
4096 | instance_type=vcsserver | |
4097 |
|
4097 | |||
4098 | if [ ${#other_args[@]} -eq 0 ]; then |
|
4098 | if [ ${#other_args[@]} -eq 0 ]; then | |
4099 | other_args[${#other_args[@]}]="echo 'please provide a valid cmd arg...'" |
|
4099 | other_args[${#other_args[@]}]="echo 'please provide a valid cmd arg...'" | |
4100 | fi |
|
4100 | fi | |
4101 |
|
4101 | |||
4102 | printf "*Volumes*:\n" |
|
4102 | printf "*Volumes*:\n" | |
4103 | printf " attaching $PWD/config/_shared \t\tunder: /vol/confvolume\n" |
|
4103 | printf " attaching $PWD/config/_shared \t\tunder: /vol/confvolume\n" | |
4104 | printf "\n" |
|
4104 | printf "\n" | |
4105 |
|
4105 | |||
4106 | #printf "attaching rc_reposvolume \t\tunder: /vol/repovolume\n" |
|
4106 | #printf "attaching rc_reposvolume \t\tunder: /vol/repovolume\n" | |
4107 | #printf "attaching \$PWD/.custom/storage \t\tunder: /vol/backupvolume\n" |
|
4107 | #printf "attaching \$PWD/.custom/storage \t\tunder: /vol/backupvolume\n" | |
4108 |
|
4108 | |||
4109 | CMD_EXEC="\ |
|
4109 | CMD_EXEC="\ | |
4110 | RC_ENV_FILE=$ENV_FILE docker compose \ |
|
4110 | RC_ENV_FILE=$ENV_FILE docker compose \ | |
4111 | --env-file $ENV_FILE \ |
|
4111 | --env-file $ENV_FILE \ | |
4112 | $ENV_EXPAND \ |
|
4112 | $ENV_EXPAND \ | |
4113 | --project-name $proj_name \ |
|
4113 | --project-name $proj_name \ | |
4114 | -f docker-compose-base.yaml \ |
|
4114 | -f docker-compose-base.yaml \ | |
4115 | -f docker-compose-apps.yaml \ |
|
4115 | -f docker-compose-apps.yaml \ | |
4116 | run \ |
|
4116 | run \ | |
4117 | --user $EXEC_USER \ |
|
4117 | --user $EXEC_USER \ | |
4118 | --rm \ |
|
4118 | --rm \ | |
4119 | $INTERACTIVE_FLAGS \ |
|
4119 | $INTERACTIVE_FLAGS \ | |
4120 | --volume=$PWD/config/_shared:/vol/confvolume \ |
|
4120 | --volume=$PWD/config/_shared:/vol/confvolume \ | |
4121 | --workdir=/vol/confvolume \ |
|
4121 | --workdir=/vol/confvolume \ | |
4122 | $instance_type" |
|
4122 | $instance_type" | |
4123 |
|
4123 | |||
4124 | if [[ $DEBUG ]]; then |
|
4124 | if [[ $DEBUG ]]; then | |
4125 | echo $CMD_EXEC |
|
4125 | echo $CMD_EXEC | |
4126 | echo ${other_args[*]} |
|
4126 | echo ${other_args[*]} | |
4127 | fi |
|
4127 | fi | |
4128 |
|
4128 | |||
4129 | eval "${CMD_EXEC} ${other_args[*]}" |
|
4129 | eval "${CMD_EXEC} ${other_args[*]}" | |
4130 |
|
4130 | |||
4131 | } |
|
4131 | } | |
4132 |
|
4132 | |||
4133 | # :command.function |
|
4133 | # :command.function | |
4134 | rcstack_cli_ishell_command() { |
|
4134 | rcstack_cli_ishell_command() { | |
4135 | # src/cli_ishell_command.sh |
|
4135 | # src/cli_ishell_command.sh | |
4136 | check_bootstrap |
|
4136 | check_bootstrap | |
4137 |
|
4137 | |||
4138 | if [[ -z ${args['--user']} ]]; then |
|
4138 | if [[ -z ${args['--user']} ]]; then | |
4139 | # set default, user if the flag is not used |
|
4139 | # set default, user if the flag is not used | |
4140 | args['--user']='rhodecode' |
|
4140 | args['--user']='rhodecode' | |
4141 | fi |
|
4141 | fi | |
4142 |
|
4142 | |||
4143 | DEBUG=${args[--debug]} |
|
4143 | DEBUG=${args[--debug]} | |
4144 | RUN_WITHOUT_TTY=${args[--no-tty]} |
|
4144 | RUN_WITHOUT_TTY=${args[--no-tty]} | |
4145 | ENV_FILE=${args[--env-file-path]} |
|
4145 | ENV_FILE=${args[--env-file-path]} | |
4146 | EXEC_USER=${args[--user]} |
|
4146 | EXEC_USER=${args[--user]} | |
4147 |
|
4147 | |||
4148 | INTERACTIVE_FLAGS="--interactive --tty" |
|
4148 | INTERACTIVE_FLAGS="--interactive --tty" | |
4149 | if [[ $RUN_WITHOUT_TTY ]]; then |
|
4149 | if [[ $RUN_WITHOUT_TTY ]]; then | |
4150 | INTERACTIVE_FLAGS="--interactive" |
|
4150 | INTERACTIVE_FLAGS="--interactive" | |
4151 | fi |
|
4151 | fi | |
4152 |
|
4152 | |||
4153 | proj_name=rc_cluster_apps |
|
4153 | proj_name=rc_cluster_apps | |
4154 | instance_type=rhodecode |
|
4154 | instance_type=rhodecode | |
4155 |
|
4155 | |||
4156 | docker_id=$(docker ps --filter name=$proj_name-$instance_type -q | head -n1) |
|
4156 | docker_id=$(docker ps --filter name=$proj_name-$instance_type -q | head -n1) | |
4157 | if [[ $docker_id == "" ]]; then |
|
4157 | if [[ $docker_id == "" ]]; then | |
4158 | echo "$(yellow cannot find docker instance \($proj_name-$instance_type\) for command execution. Please make sure it is running.)" |
|
4158 | echo "$(yellow cannot find docker instance \($proj_name-$instance_type\) for command execution. Please make sure it is running.)" | |
4159 | exit 1 |
|
4159 | exit 1 | |
4160 | fi |
|
4160 | fi | |
4161 |
|
4161 | |||
4162 | index_num=$(docker inspect "$docker_id" --format '{{ index .Config.Labels "com.docker.compose.container-number" }}') |
|
4162 | index_num=$(docker inspect "$docker_id" --format '{{ index .Config.Labels "com.docker.compose.container-number" }}') | |
4163 | if [[ -z "$index_num" ]] |
|
4163 | if [[ -z "$index_num" ]] | |
4164 | then |
|
4164 | then | |
4165 | index_num="0" |
|
4165 | index_num="0" | |
4166 | fi |
|
4166 | fi | |
4167 |
|
4167 | |||
4168 | RC_STACK_PROFILES="--profile database --profile redis --profile elasticsearch --profile channelstream" |
|
4168 | RC_STACK_PROFILES="--profile database --profile redis --profile elasticsearch --profile channelstream" | |
4169 |
|
4169 | |||
4170 | CMD_EXEC="\ |
|
4170 | CMD_EXEC="\ | |
4171 | RC_ENV_FILE=$ENV_FILE docker compose \ |
|
4171 | RC_ENV_FILE=$ENV_FILE docker compose \ | |
4172 | --env-file $ENV_FILE \ |
|
4172 | --env-file $ENV_FILE \ | |
4173 | $ENV_EXPAND \ |
|
4173 | $ENV_EXPAND \ | |
4174 | $RC_STACK_PROFILES \ |
|
4174 | $RC_STACK_PROFILES \ | |
4175 | --project-name $proj_name \ |
|
4175 | --project-name $proj_name \ | |
4176 | -f docker-compose-base.yaml \ |
|
4176 | -f docker-compose-base.yaml \ | |
4177 | -f docker-compose-apps.yaml \ |
|
4177 | -f docker-compose-apps.yaml \ | |
4178 | exec \ |
|
4178 | exec \ | |
4179 | --index $index_num \ |
|
4179 | --index $index_num \ | |
4180 | --user $EXEC_USER \ |
|
4180 | --user $EXEC_USER \ | |
4181 | $INTERACTIVE_FLAGS \ |
|
4181 | $INTERACTIVE_FLAGS \ | |
4182 | $instance_type \ |
|
4182 | $instance_type \ | |
4183 | /usr/local/bin/rhodecode_bin/bin/rc-ishell \ |
|
4183 | /usr/local/bin/rhodecode_bin/bin/rc-ishell \ | |
4184 | /etc/rhodecode/conf/rhodecode.ini" |
|
4184 | /etc/rhodecode/conf/rhodecode.ini" | |
4185 |
|
4185 | |||
4186 | if [[ $DEBUG ]]; then |
|
4186 | if [[ $DEBUG ]]; then | |
4187 | echo $CMD_EXEC |
|
4187 | echo $CMD_EXEC | |
4188 | echo ${other_args[*]} |
|
4188 | echo ${other_args[*]} | |
4189 | fi |
|
4189 | fi | |
4190 |
|
4190 | |||
4191 | eval "${CMD_EXEC}" |
|
4191 | eval "${CMD_EXEC}" | |
4192 |
|
4192 | |||
4193 | } |
|
4193 | } | |
4194 |
|
4194 | |||
4195 | # :command.function |
|
4195 | # :command.function | |
4196 | rcstack_cli_image_info_command() { |
|
4196 | rcstack_cli_image_info_command() { | |
4197 | # src/cli_image_info_command.sh |
|
4197 | # src/cli_image_info_command.sh | |
4198 |
|
4198 | |||
4199 | verbose=${args[--verbose]} |
|
4199 | verbose=${args[--verbose]} | |
4200 |
|
4200 | |||
4201 | if [[ $verbose ]]; then |
|
4201 | if [[ $verbose ]]; then | |
4202 |
|
4202 | |||
4203 | ver="unknown" |
|
4203 | ver="unknown" | |
4204 | if [[ -f $RUNTIME_ENV ]]; then |
|
4204 | if [[ -f $RUNTIME_ENV ]]; then | |
4205 | .env --file $RUNTIME_ENV |
|
4205 | .env --file $RUNTIME_ENV | |
4206 | .env get_or_error RC_VERSION |
|
4206 | .env get_or_error RC_VERSION | |
4207 | ver=$REPLY |
|
4207 | ver=$REPLY | |
4208 | fi |
|
4208 | fi | |
4209 |
|
4209 | |||
4210 | echo "Image stored version: $rc_image_ver" |
|
4210 | echo "Image stored version: $rc_image_ver" | |
4211 | echo "Image from runtime: $ver" |
|
4211 | echo "Image from runtime: $ver" | |
4212 | echo "runtime-file=$RUNTIME_ENV" |
|
4212 | echo "runtime-file=$RUNTIME_ENV" | |
4213 | echo "RC_VERSION=$ver" |
|
4213 | echo "RC_VERSION=$ver" | |
4214 | else |
|
4214 | else | |
4215 | echo $rc_image_ver |
|
4215 | echo $rc_image_ver | |
4216 | fi |
|
4216 | fi | |
4217 |
|
4217 | |||
4218 | } |
|
4218 | } | |
4219 |
|
4219 | |||
4220 | # :command.function |
|
4220 | # :command.function | |
4221 | rcstack_cli_set_runtime_image_command() { |
|
4221 | rcstack_cli_set_runtime_image_command() { | |
4222 | # src/cli_set_runtime_image_command.sh |
|
4222 | # src/cli_set_runtime_image_command.sh | |
4223 | set_ver=${args[version]} |
|
4223 | set_ver=${args[version]} | |
4224 |
|
4224 | |||
4225 | .env --file $RUNTIME_ENV |
|
4225 | .env --file $RUNTIME_ENV | |
4226 | echo "setting runtime version to $set_ver into $RUNTIME_ENV" |
|
4226 | echo "setting runtime version to $set_ver into $RUNTIME_ENV" | |
4227 |
|
4227 | |||
4228 | .env set RC_VERSION=$set_ver |
|
4228 | .env set RC_VERSION=$set_ver | |
4229 |
|
4229 | |||
4230 | echo "New version set to $set_ver" |
|
4230 | echo "New version set to $set_ver" | |
4231 |
|
4231 | |||
4232 | } |
|
4232 | } | |
4233 |
|
4233 | |||
4234 | # :command.function |
|
4234 | # :command.function | |
4235 | rcstack_cli_docker_info_command() { |
|
4235 | rcstack_cli_docker_info_command() { | |
4236 | # src/cli_docker_info_command.sh |
|
4236 | # src/cli_docker_info_command.sh | |
4237 | verbose=${args[--verbose]} |
|
4237 | verbose=${args[--verbose]} | |
4238 |
|
4238 | |||
4239 | docker --version |
|
4239 | docker --version | |
4240 | docker compose version |
|
4240 | docker compose version | |
4241 |
|
4241 | |||
4242 | if [[ $verbose ]]; then |
|
4242 | if [[ $verbose ]]; then | |
4243 | echo "-- DETAILED DOCKER INFO --" |
|
4243 | echo "-- DETAILED DOCKER INFO --" | |
4244 | docker version |
|
4244 | docker version | |
4245 | fi |
|
4245 | fi | |
4246 |
|
4246 | |||
4247 | } |
|
4247 | } | |
4248 |
|
4248 | |||
4249 | # :command.function |
|
4249 | # :command.function | |
4250 | rcstack_cli_docker_upgrade_command() { |
|
4250 | rcstack_cli_docker_upgrade_command() { | |
4251 | # src/cli_docker_upgrade_command.sh |
|
4251 | # src/cli_docker_upgrade_command.sh | |
4252 | DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker} |
|
4252 | DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker} | |
4253 | DOCKER_CLI_PLUGINS=$DOCKER_CONFIG/cli-plugins |
|
4253 | DOCKER_CLI_PLUGINS=$DOCKER_CONFIG/cli-plugins | |
4254 | upgrade_compose=${args[--compose]} |
|
4254 | upgrade_compose=${args[--compose]} | |
4255 |
|
4255 | |||
4256 | compose_script_name="install-docker.sh" |
|
4256 | compose_script_name="install-docker.sh" | |
4257 |
|
4257 | |||
4258 | curl -fsSL https://get.docker.com -o "$compose_script_name" |
|
4258 | curl -fsSL https://get.docker.com -o "$compose_script_name" | |
4259 | # sh install-docker.sh --version 23.0 |
|
4259 | # sh install-docker.sh --version 23.0 | |
4260 | sh "$compose_script_name" |
|
4260 | sh "$compose_script_name" | |
4261 | rm -rf "$compose_script_name" |
|
4261 | rm -rf "$compose_script_name" | |
4262 |
|
4262 | |||
4263 | if [[ $upgrade_compose ]]; then |
|
4263 | if [[ $upgrade_compose ]]; then | |
4264 |
|
4264 | |||
4265 | os_type=$(check_os) |
|
4265 | os_type=$(check_os) | |
4266 | if [ "$os_type" != "Linux" ]; then |
|
4266 | if [ "$os_type" != "Linux" ]; then | |
4267 | echo "$(red compose upgrade is only available for Linux architecture, got \'$os_type\' instead)" |
|
4267 | echo "$(red compose upgrade is only available for Linux architecture, got \'$os_type\' instead)" | |
4268 | exit |
|
4268 | exit | |
4269 | fi |
|
4269 | fi | |
4270 |
|
4270 | |||
4271 | # just ensure we have this dir |
|
4271 | # just ensure we have this dir | |
4272 | mkdir -p "$DOCKER_CLI_PLUGINS" |
|
4272 | mkdir -p "$DOCKER_CLI_PLUGINS" | |
4273 |
|
4273 | |||
4274 | if [[ -f "$DOCKER_CLI_PLUGINS/docker-compose" ]]; then |
|
4274 | if [[ -f "$DOCKER_CLI_PLUGINS/docker-compose" ]]; then | |
4275 | echo "found docker-compose at $DOCKER_CLI_PLUGINS, removing it now..." |
|
4275 | echo "found docker-compose at $DOCKER_CLI_PLUGINS, removing it now..." | |
4276 | rm -rf "$DOCKER_CLI_PLUGINS/docker-compose" |
|
4276 | rm -rf "$DOCKER_CLI_PLUGINS/docker-compose" | |
4277 | fi |
|
4277 | fi | |
4278 |
|
4278 | |||
4279 | NEW_COMPOSE_VERSION=$(curl --silent https://api.github.com/repos/docker/compose/releases/latest | grep -Po '"tag_name": "\K.*\d') |
|
4279 | NEW_COMPOSE_VERSION=$(curl --silent https://api.github.com/repos/docker/compose/releases/latest | grep -Po '"tag_name": "\K.*\d') | |
4280 | echo "new compose version $NEW_COMPOSE_VERSION to be installed in $DOCKER_CLI_PLUGINS" |
|
4280 | echo "new compose version $NEW_COMPOSE_VERSION to be installed in $DOCKER_CLI_PLUGINS" | |
4281 | curl -fsSL https://github.com/docker/compose/releases/download/$NEW_COMPOSE_VERSION/docker-compose-linux-x86_64 -o $DOCKER_CLI_PLUGINS/docker-compose |
|
4281 | curl -fsSL https://github.com/docker/compose/releases/download/$NEW_COMPOSE_VERSION/docker-compose-linux-x86_64 -o $DOCKER_CLI_PLUGINS/docker-compose | |
4282 | chmod +x $DOCKER_CLI_PLUGINS/docker-compose |
|
4282 | chmod +x $DOCKER_CLI_PLUGINS/docker-compose | |
4283 | echo "updated compose to $NEW_COMPOSE_VERSION" |
|
4283 | echo "updated compose to $NEW_COMPOSE_VERSION" | |
4284 | fi |
|
4284 | fi | |
4285 |
|
4285 | |||
4286 | } |
|
4286 | } | |
4287 |
|
4287 | |||
4288 | # :command.function |
|
4288 | # :command.function | |
4289 | rcstack_cli_redis_command() { |
|
4289 | rcstack_cli_redis_command() { | |
4290 | # src/cli_redis_command.sh |
|
4290 | # src/cli_redis_command.sh | |
4291 | check_bootstrap |
|
4291 | check_bootstrap | |
4292 |
|
4292 | |||
4293 | if [[ -z ${args['--user']} ]]; then |
|
4293 | if [[ -z ${args['--user']} ]]; then | |
4294 | # set default, user if the flag is not used |
|
4294 | # set default, user if the flag is not used | |
4295 | args['--user']='root' |
|
4295 | args['--user']='root' | |
4296 | fi |
|
4296 | fi | |
4297 |
|
4297 | |||
4298 | DEBUG=${args[--debug]} |
|
4298 | DEBUG=${args[--debug]} | |
4299 | RUN_WITHOUT_TTY=${args[--no-tty]} |
|
4299 | RUN_WITHOUT_TTY=${args[--no-tty]} | |
4300 | ENV_FILE=${args[--env-file-path]} |
|
4300 | ENV_FILE=${args[--env-file-path]} | |
4301 | EXEC_USER=${args[--user]} |
|
4301 | EXEC_USER=${args[--user]} | |
4302 | db_num=${args[--db]} |
|
4302 | db_num=${args[--db]} | |
4303 |
|
4303 | |||
4304 | INTERACTIVE_FLAGS="--interactive --tty" |
|
4304 | INTERACTIVE_FLAGS="--interactive --tty" | |
4305 | if [[ $RUN_WITHOUT_TTY ]]; then |
|
4305 | if [[ $RUN_WITHOUT_TTY ]]; then | |
4306 | INTERACTIVE_FLAGS="--interactive" |
|
4306 | INTERACTIVE_FLAGS="--interactive" | |
4307 | fi |
|
4307 | fi | |
4308 |
|
4308 | |||
4309 | proj_name=rc_cluster_services |
|
4309 | proj_name=rc_cluster_services | |
4310 | instance_type=redis |
|
4310 | instance_type=redis | |
4311 |
|
4311 | |||
4312 | docker_id=$(docker ps --filter name=$proj_name-$instance_type -q | head -n1) |
|
4312 | docker_id=$(docker ps --filter name=$proj_name-$instance_type -q | head -n1) | |
4313 | if [[ $docker_id == "" ]]; then |
|
4313 | if [[ $docker_id == "" ]]; then | |
4314 | echo "$(yellow cannot find docker instance \($proj_name-$instance_type\) for command execution. Please make sure it is running.)" |
|
4314 | echo "$(yellow cannot find docker instance \($proj_name-$instance_type\) for command execution. Please make sure it is running.)" | |
4315 | exit 1 |
|
4315 | exit 1 | |
4316 | fi |
|
4316 | fi | |
4317 |
|
4317 | |||
4318 | index_num=$(docker inspect "$docker_id" --format '{{ index .Config.Labels "com.docker.compose.container-number" }}') |
|
4318 | index_num=$(docker inspect "$docker_id" --format '{{ index .Config.Labels "com.docker.compose.container-number" }}') | |
4319 | if [[ -z "$index_num" ]] |
|
4319 | if [[ -z "$index_num" ]] | |
4320 | then |
|
4320 | then | |
4321 | index_num="0" |
|
4321 | index_num="0" | |
4322 | fi |
|
4322 | fi | |
4323 |
|
4323 | |||
4324 | RC_STACK_PROFILES="--profile database --profile redis --profile elasticsearch --profile channelstream" |
|
4324 | RC_STACK_PROFILES="--profile database --profile redis --profile elasticsearch --profile channelstream" | |
4325 |
|
4325 | |||
4326 | CMD_EXEC="\ |
|
4326 | CMD_EXEC="\ | |
4327 | RC_ENV_FILE=$ENV_FILE docker compose \ |
|
4327 | RC_ENV_FILE=$ENV_FILE docker compose \ | |
4328 | --env-file $ENV_FILE \ |
|
4328 | --env-file $ENV_FILE \ | |
4329 | $ENV_EXPAND \ |
|
4329 | $ENV_EXPAND \ | |
4330 | $RC_STACK_PROFILES \ |
|
4330 | $RC_STACK_PROFILES \ | |
4331 | --project-name $proj_name \ |
|
4331 | --project-name $proj_name \ | |
4332 | -f docker-compose-base.yaml \ |
|
4332 | -f docker-compose-base.yaml \ | |
4333 | -f docker-compose-services.yaml \ |
|
4333 | -f docker-compose-services.yaml \ | |
4334 | exec \ |
|
4334 | exec \ | |
4335 | --user $EXEC_USER \ |
|
4335 | --user $EXEC_USER \ | |
4336 | $INTERACTIVE_FLAGS \ |
|
4336 | $INTERACTIVE_FLAGS \ | |
4337 | $instance_type \ |
|
4337 | $instance_type \ | |
4338 | /bin/bash -c 'redis-cli -n $db_num'" |
|
4338 | /bin/bash -c 'redis-cli -n $db_num'" | |
4339 |
|
4339 | |||
4340 | if [[ $DEBUG ]]; then |
|
4340 | if [[ $DEBUG ]]; then | |
4341 | echo $CMD_EXEC |
|
4341 | echo $CMD_EXEC | |
4342 | echo ${other_args[*]} |
|
4342 | echo ${other_args[*]} | |
4343 | fi |
|
4343 | fi | |
4344 |
|
4344 | |||
4345 | eval "${CMD_EXEC}" |
|
4345 | eval "${CMD_EXEC}" | |
4346 |
|
4346 | |||
4347 | } |
|
4347 | } | |
4348 |
|
4348 | |||
4349 | # :command.function |
|
4349 | # :command.function | |
4350 | rcstack_cli_db_command() { |
|
4350 | rcstack_cli_db_command() { | |
4351 | # src/cli_db_command.sh |
|
4351 | # src/cli_db_command.sh | |
4352 | check_bootstrap |
|
4352 | check_bootstrap | |
4353 |
|
4353 | |||
4354 | if [[ -z ${args['--user']} ]]; then |
|
4354 | if [[ -z ${args['--user']} ]]; then | |
4355 | # set default, user if the flag is not used |
|
4355 | # set default, user if the flag is not used | |
4356 | args['--user']='root' |
|
4356 | args['--user']='root' | |
4357 | fi |
|
4357 | fi | |
4358 |
|
4358 | |||
4359 | DEBUG=${args[--debug]} |
|
4359 | DEBUG=${args[--debug]} | |
4360 | RUN_WITHOUT_TTY=${args[--no-tty]} |
|
4360 | RUN_WITHOUT_TTY=${args[--no-tty]} | |
4361 | ENV_FILE=${args[--env-file-path]} |
|
4361 | ENV_FILE=${args[--env-file-path]} | |
4362 | EXEC_USER=${args[--user]} |
|
4362 | EXEC_USER=${args[--user]} | |
4363 |
|
4363 | |||
4364 | INTERACTIVE_FLAGS="--interactive --tty" |
|
4364 | INTERACTIVE_FLAGS="--interactive --tty" | |
4365 | if [[ $RUN_WITHOUT_TTY ]]; then |
|
4365 | if [[ $RUN_WITHOUT_TTY ]]; then | |
4366 | INTERACTIVE_FLAGS="--interactive" |
|
4366 | INTERACTIVE_FLAGS="--interactive" | |
4367 | fi |
|
4367 | fi | |
4368 |
|
4368 | |||
4369 | .env --file $ENV_FILE |
|
4369 | .env --file $ENV_FILE | |
4370 |
|
4370 | |||
4371 | .env get_or_error DB_TYPE |
|
4371 | .env get_or_error DB_TYPE | |
4372 | DB_TYPE=$REPLY |
|
4372 | DB_TYPE=$REPLY | |
4373 |
|
4373 | |||
4374 | .env get_or_error DB_PASSWORD |
|
4374 | .env get_or_error DB_PASSWORD | |
4375 | DB_PASSWORD=$REPLY |
|
4375 | DB_PASSWORD=$REPLY | |
4376 |
|
4376 | |||
4377 | .env get_or_error DB_NAME |
|
4377 | .env get_or_error DB_NAME | |
4378 | DB_NAME=$REPLY |
|
4378 | DB_NAME=$REPLY | |
4379 |
|
4379 | |||
4380 | .env get_or_error DB_USER |
|
4380 | .env get_or_error DB_USER | |
4381 | DB_USER=$REPLY |
|
4381 | DB_USER=$REPLY | |
4382 |
|
4382 | |||
4383 | proj_name=rc_cluster_services |
|
4383 | proj_name=rc_cluster_services | |
4384 |
|
4384 | |||
4385 | if [[ $DB_TYPE == "postgres" ]]; then |
|
4385 | if [[ $DB_TYPE == "postgres" ]]; then | |
4386 | instance_type=database |
|
4386 | instance_type=database | |
4387 | DB_CMD="PGPASSWORD=$DB_PASSWORD psql --username=$DB_USER --dbname=$DB_NAME" |
|
4387 | DB_CMD="PGPASSWORD=$DB_PASSWORD psql --username=$DB_USER --dbname=$DB_NAME" | |
4388 | elif [[ $DB_TYPE == "mysql" ]]; then |
|
4388 | elif [[ $DB_TYPE == "mysql" ]]; then | |
4389 | instance_type=database-mysql |
|
4389 | instance_type=database-mysql | |
4390 | DB_CMD="mysql --user=$DB_USER --password=$DB_PASSWORD $DB_NAME" |
|
4390 | DB_CMD="mysql --user=$DB_USER --password=$DB_PASSWORD $DB_NAME" | |
4391 |
|
4391 | |||
4392 | else |
|
4392 | else | |
4393 | echo "$(red no database type selected via DB_TYPE var)" |
|
4393 | echo "$(red no database type selected via DB_TYPE var)" | |
4394 | exit 1 |
|
4394 | exit 1 | |
4395 | fi |
|
4395 | fi | |
4396 |
|
4396 | |||
4397 | docker_id=$(docker ps --filter name=$proj_name-$instance_type -q | head -n1) |
|
4397 | docker_id=$(docker ps --filter name=$proj_name-$instance_type -q | head -n1) | |
4398 | if [[ $docker_id == "" ]]; then |
|
4398 | if [[ $docker_id == "" ]]; then | |
4399 | echo "$(yellow cannot find docker instance \($proj_name-$instance_type\) for command execution. Please make sure it is running.)" |
|
4399 | echo "$(yellow cannot find docker instance \($proj_name-$instance_type\) for command execution. Please make sure it is running.)" | |
4400 | exit 1 |
|
4400 | exit 1 | |
4401 | fi |
|
4401 | fi | |
4402 |
|
4402 | |||
4403 | index_num=$(docker inspect "$docker_id" --format '{{ index .Config.Labels "com.docker.compose.container-number" }}') |
|
4403 | index_num=$(docker inspect "$docker_id" --format '{{ index .Config.Labels "com.docker.compose.container-number" }}') | |
4404 | if [[ -z "$index_num" ]] |
|
4404 | if [[ -z "$index_num" ]] | |
4405 | then |
|
4405 | then | |
4406 | index_num="0" |
|
4406 | index_num="0" | |
4407 | fi |
|
4407 | fi | |
4408 |
|
4408 | |||
4409 | RC_STACK_PROFILES="--profile database --profile redis --profile elasticsearch --profile channelstream" |
|
4409 | RC_STACK_PROFILES="--profile database --profile redis --profile elasticsearch --profile channelstream" | |
4410 |
|
4410 | |||
4411 | CMD_EXEC="\ |
|
4411 | CMD_EXEC="\ | |
4412 | RC_ENV_FILE=$ENV_FILE docker compose \ |
|
4412 | RC_ENV_FILE=$ENV_FILE docker compose \ | |
4413 | --env-file $ENV_FILE \ |
|
4413 | --env-file $ENV_FILE \ | |
4414 | $ENV_EXPAND \ |
|
4414 | $ENV_EXPAND \ | |
4415 | $RC_STACK_PROFILES \ |
|
4415 | $RC_STACK_PROFILES \ | |
4416 | --project-name $proj_name \ |
|
4416 | --project-name $proj_name \ | |
4417 | -f docker-compose-base.yaml \ |
|
4417 | -f docker-compose-base.yaml \ | |
4418 | -f docker-compose-services.yaml \ |
|
4418 | -f docker-compose-services.yaml \ | |
4419 | exec \ |
|
4419 | exec \ | |
4420 | --user $EXEC_USER \ |
|
4420 | --user $EXEC_USER \ | |
4421 | $INTERACTIVE_FLAGS \ |
|
4421 | $INTERACTIVE_FLAGS \ | |
4422 | $instance_type \ |
|
4422 | $instance_type \ | |
4423 | /bin/bash -c '$DB_CMD'" |
|
4423 | /bin/bash -c '$DB_CMD'" | |
4424 |
|
4424 | |||
4425 | if [[ $DEBUG ]]; then |
|
4425 | if [[ $DEBUG ]]; then | |
4426 | echo $CMD_EXEC |
|
4426 | echo $CMD_EXEC | |
4427 | echo ${other_args[*]} |
|
4427 | echo ${other_args[*]} | |
4428 | fi |
|
4428 | fi | |
4429 |
|
4429 | |||
4430 | if [[ $DB_TYPE == "postgres" ]]; then |
|
4430 | if [[ $DB_TYPE == "postgres" ]]; then | |
4431 | printf "*Volumes*:\n" |
|
4431 | printf "*Volumes*:\n" | |
4432 | printf " attaching pg_data under: /var/lib/postgresql/data\n" |
|
4432 | printf " attaching pg_data under: /var/lib/postgresql/data\n" | |
4433 | printf " attaching \$PWD/.custom/db_dump under: /var/rc-data-dump\n" |
|
4433 | printf " attaching \$PWD/.custom/db_dump under: /var/rc-data-dump\n" | |
4434 | printf "\n" |
|
4434 | printf "\n" | |
4435 | printf "*Restore dump*:\n" |
|
4435 | printf "*Restore dump*:\n" | |
4436 | printf " \i /var/rc-data-dump/your_dump.sql\n" |
|
4436 | printf " \i /var/rc-data-dump/your_dump.sql\n" | |
4437 | printf "\n" |
|
4437 | printf "\n" | |
4438 | elif [[ $DB_TYPE == "mysql" ]]; then |
|
4438 | elif [[ $DB_TYPE == "mysql" ]]; then | |
4439 | printf "*Volumes*:\n" |
|
4439 | printf "*Volumes*:\n" | |
4440 | printf " attaching mysql_data under: /var/lib/mysql\n" |
|
4440 | printf " attaching mysql_data under: /var/lib/mysql\n" | |
4441 | printf " attaching \$PWD/.custom/db_dump under: /var/rc-data-dump\n" |
|
4441 | printf " attaching \$PWD/.custom/db_dump under: /var/rc-data-dump\n" | |
4442 | printf "\n" |
|
4442 | printf "\n" | |
4443 | fi |
|
4443 | fi | |
4444 |
|
4444 | |||
4445 | eval "${CMD_EXEC}" |
|
4445 | eval "${CMD_EXEC}" | |
4446 |
|
4446 | |||
4447 | } |
|
4447 | } | |
4448 |
|
4448 | |||
4449 | # :command.function |
|
4449 | # :command.function | |
4450 | rcstack_cli_db_upgrade_command() { |
|
4450 | rcstack_cli_db_upgrade_command() { | |
4451 | # src/cli_db_upgrade_command.sh |
|
4451 | # src/cli_db_upgrade_command.sh | |
4452 | check_bootstrap |
|
4452 | check_bootstrap | |
4453 |
|
4453 | |||
4454 | DEBUG=${args[--debug]} |
|
4454 | DEBUG=${args[--debug]} | |
4455 |
|
4455 | |||
4456 | target_container=rc_cluster_services-database-* |
|
4456 | target_container=rc_cluster_services-database-* | |
4457 | docker_id=$(docker ps --filter name=$target_container -q | head -n1) |
|
4457 | docker_id=$(docker ps --filter name=$target_container -q | head -n1) | |
4458 |
|
4458 | |||
4459 | if [[ $DEBUG ]]; then |
|
4459 | if [[ $DEBUG ]]; then | |
4460 | echo "container id: $docker_id, based on $target_container filter" |
|
4460 | echo "container id: $docker_id, based on $target_container filter" | |
4461 | docker ps |
|
4461 | docker ps | |
4462 | fi |
|
4462 | fi | |
4463 |
|
4463 | |||
4464 | if [ "$docker_id" == "" ]; then |
|
4464 | if [ "$docker_id" == "" ]; then | |
4465 | MSG="Cannot find container ID with name $target_container" |
|
4465 | MSG="Cannot find container ID with name $target_container" | |
4466 | echo "$(red $MSG)" |
|
4466 | echo "$(red $MSG)" | |
4467 | exit 1 |
|
4467 | exit 1 | |
4468 | fi |
|
4468 | fi | |
4469 |
|
4469 | |||
4470 | if [[ $DEBUG ]]; then |
|
4470 | if [[ $DEBUG ]]; then | |
4471 | echo "./$RC_SCRIPT_NAME stack rhodecode exec rhodecode /usr/local/bin/rhodecode_bin/bin/rc-upgrade-db /etc/rhodecode/conf/rhodecode.ini --force-yes" |
|
4471 | echo "./$RC_SCRIPT_NAME stack rhodecode exec rhodecode /usr/local/bin/rhodecode_bin/bin/rc-upgrade-db /etc/rhodecode/conf/rhodecode.ini --force-yes" | |
4472 | fi |
|
4472 | fi | |
4473 |
|
4473 | |||
4474 | ./$RC_SCRIPT_NAME stack rhodecode exec rhodecode /usr/local/bin/rhodecode_bin/bin/rc-upgrade-db /etc/rhodecode/conf/rhodecode.ini --force-yes |
|
4474 | ./$RC_SCRIPT_NAME stack rhodecode exec rhodecode /usr/local/bin/rhodecode_bin/bin/rc-upgrade-db /etc/rhodecode/conf/rhodecode.ini --force-yes | |
4475 | } |
|
4475 | } | |
4476 |
|
4476 | |||
4477 | # :command.function |
|
4477 | # :command.function | |
4478 | rcstack_cli_storage_command() { |
|
4478 | rcstack_cli_storage_command() { | |
4479 | # src/cli_storage_command.sh |
|
4479 | # src/cli_storage_command.sh | |
4480 | check_bootstrap |
|
4480 | check_bootstrap | |
4481 |
|
4481 | |||
4482 | DEBUG=${args[--debug]} |
|
4482 | DEBUG=${args[--debug]} | |
4483 | RUN_WITHOUT_TTY=${args[--no-tty]} |
|
4483 | RUN_WITHOUT_TTY=${args[--no-tty]} | |
4484 | INTERACTIVE_FLAGS="--interactive --tty" |
|
4484 | INTERACTIVE_FLAGS="--interactive --tty" | |
4485 | if [[ $RUN_WITHOUT_TTY ]]; then |
|
4485 | if [[ $RUN_WITHOUT_TTY ]]; then | |
4486 | INTERACTIVE_FLAGS="--interactive" |
|
4486 | INTERACTIVE_FLAGS="--interactive" | |
4487 | fi |
|
4487 | fi | |
4488 |
|
4488 | |||
4489 | ENV_FILE=${args[--env-file-path]} |
|
4489 | ENV_FILE=${args[--env-file-path]} | |
4490 | ATTACHED=${args[--attached]} |
|
4490 | ATTACHED=${args[--attached]} | |
4491 |
|
4491 | |||
4492 | if [[ $DEBUG ]]; then |
|
4492 | if [[ $DEBUG ]]; then | |
4493 | echo "rc_datavolume inspection..." |
|
4493 | echo "rc_datavolume inspection..." | |
4494 | docker volume inspect rc_datavolume |
|
4494 | docker volume inspect rc_datavolume | |
4495 |
|
4495 | |||
4496 | echo "rc_reposvolume inspection..." |
|
4496 | echo "rc_reposvolume inspection..." | |
4497 | docker volume inspect rc_reposvolume |
|
4497 | docker volume inspect rc_reposvolume | |
4498 | fi |
|
4498 | fi | |
4499 |
|
4499 | |||
4500 | # |
|
4500 | # | |
4501 | #if [[ $DEBUG ]]; then |
|
4501 | #if [[ $DEBUG ]]; then | |
4502 | # echo "image id: $image_id, based on $target_container filter" |
|
4502 | # echo "image id: $image_id, based on $target_container filter" | |
4503 | # docker image ls |
|
4503 | # docker image ls | |
4504 | # echo "---" |
|
4504 | # echo "---" | |
4505 | #fi |
|
4505 | #fi | |
4506 | # rename a volume |
|
4506 | # rename a volume | |
4507 | #docker volume create --name <new_volume> |
|
4507 | #docker volume create --name <new_volume> | |
4508 | #docker run --rm -it -v <old_volume>:/from -v <new_volume>:/to alpine ash -c "cd /from ; cp -av . /to" |
|
4508 | #docker run --rm -it -v <old_volume>:/from -v <new_volume>:/to alpine ash -c "cd /from ; cp -av . /to" | |
4509 | #docker volume rm <old_volume> |
|
4509 | #docker volume rm <old_volume> | |
4510 |
|
4510 | |||
4511 | if [[ $ATTACHED ]]; then |
|
4511 | if [[ $ATTACHED ]]; then | |
4512 | printf "Starting with attached mode to vcsserver !" |
|
4512 | printf "Starting with attached mode to vcsserver !" | |
4513 | printf "present rc_datavolume \t\tunder: /var/opt/rhodecode_data\n" |
|
4513 | printf "present rc_datavolume \t\tunder: /var/opt/rhodecode_data\n" | |
4514 | printf "present rc_reposvolume \t\tunder: /var/opt/rhodecode_repo_store\n" |
|
4514 | printf "present rc_reposvolume \t\tunder: /var/opt/rhodecode_repo_store\n" | |
4515 | printf "present confvolume \t\tunder: /etc/rhodecode/conf\n" |
|
4515 | printf "present confvolume \t\tunder: /etc/rhodecode/conf\n" | |
4516 |
|
4516 | |||
4517 | match_name=rc_cluster_apps-vcsserver |
|
4517 | match_name=rc_cluster_apps-vcsserver | |
4518 |
|
4518 | |||
4519 | docker_id=$(docker ps --filter name=$match_name -q | head -n1) |
|
4519 | docker_id=$(docker ps --filter name=$match_name -q | head -n1) | |
4520 | if [[ $docker_id == "" ]]; then |
|
4520 | if [[ $docker_id == "" ]]; then | |
4521 | echo "$(yellow cannot find instance to attach by name *$match_name*)" |
|
4521 | echo "$(yellow cannot find instance to attach by name *$match_name*)" | |
4522 | exit 1 |
|
4522 | exit 1 | |
4523 | fi |
|
4523 | fi | |
4524 |
|
4524 | |||
4525 | docker exec \ |
|
4525 | docker exec \ | |
4526 | $INTERACTIVE_FLAGS \ |
|
4526 | $INTERACTIVE_FLAGS \ | |
4527 | --workdir /var/opt $docker_id bash |
|
4527 | --workdir /var/opt $docker_id bash | |
4528 |
|
4528 | |||
4529 | else |
|
4529 | else | |
4530 | printf "attaching rc_datavolume \t\tunder: /vol/datavolume\n" |
|
4530 | printf "attaching rc_datavolume \t\tunder: /vol/datavolume\n" | |
4531 | printf "attaching rc_reposvolume \t\tunder: /vol/repovolume\n" |
|
4531 | printf "attaching rc_reposvolume \t\tunder: /vol/repovolume\n" | |
4532 | printf "attaching \$PWD/.custom/storage \t\tunder: /vol/backupvolume\n" |
|
4532 | printf "attaching \$PWD/.custom/storage \t\tunder: /vol/backupvolume\n" | |
4533 |
|
4533 | |||
4534 | docker run --rm \ |
|
4534 | docker run --rm \ | |
4535 | $INTERACTIVE_FLAGS \ |
|
4535 | $INTERACTIVE_FLAGS \ | |
4536 | --volume $PWD/.custom/storage:/vol/backupvolume \ |
|
4536 | --volume $PWD/.custom/storage:/vol/backupvolume \ | |
4537 | --volume rc_datavolume:/vol/datavolume \ |
|
4537 | --volume rc_datavolume:/vol/datavolume \ | |
4538 | --volume rc_reposvolume:/vol/repovolume \ |
|
4538 | --volume rc_reposvolume:/vol/repovolume \ | |
4539 | --workdir="/vol" \ |
|
4539 | --workdir="/vol" \ | |
4540 | $BASE_OPS_IMAGE \ |
|
4540 | $BASE_OPS_IMAGE \ | |
4541 | /bin/bash |
|
4541 | /bin/bash | |
4542 | fi |
|
4542 | fi | |
4543 |
|
4543 | |||
4544 | } |
|
4544 | } | |
4545 |
|
4545 | |||
4546 | # :command.function |
|
4546 | # :command.function | |
4547 | rcstack_cli_attach_command() { |
|
4547 | rcstack_cli_attach_command() { | |
4548 | # src/cli_attach_command.sh |
|
4548 | # src/cli_attach_command.sh | |
4549 | check_bootstrap |
|
4549 | check_bootstrap | |
4550 | RUN_WITHOUT_TTY=${args[--no-tty]} |
|
4550 | RUN_WITHOUT_TTY=${args[--no-tty]} | |
4551 | INTERACTIVE_FLAGS="--interactive --tty" |
|
4551 | INTERACTIVE_FLAGS="--interactive --tty" | |
4552 | if [[ $RUN_WITHOUT_TTY ]]; then |
|
4552 | if [[ $RUN_WITHOUT_TTY ]]; then | |
4553 | INTERACTIVE_FLAGS="--interactive" |
|
4553 | INTERACTIVE_FLAGS="--interactive" | |
4554 | fi |
|
4554 | fi | |
4555 |
|
4555 | |||
4556 | instance_type=${args[--instance-type]} |
|
4556 | instance_type=${args[--instance-type]} | |
4557 |
|
4557 | |||
4558 | match_name=rc_cluster_apps-$instance_type |
|
4558 | match_name=rc_cluster_apps-$instance_type | |
4559 |
|
4559 | |||
4560 | docker_id=$(docker ps --filter name=$match_name -q | head -n1) |
|
4560 | docker_id=$(docker ps --filter name=$match_name -q | head -n1) | |
4561 | if [[ $docker_id == "" ]]; then |
|
4561 | if [[ $docker_id == "" ]]; then | |
4562 | echo "$(yellow cannot find instance to attach by name *$match_name*)" |
|
4562 | echo "$(yellow cannot find instance to attach by name *$match_name*)" | |
4563 | exit 1 |
|
4563 | exit 1 | |
4564 | fi |
|
4564 | fi | |
4565 |
|
4565 | |||
4566 | docker exec \ |
|
4566 | docker exec \ | |
4567 | $INTERACTIVE_FLAGS \ |
|
4567 | $INTERACTIVE_FLAGS \ | |
4568 | $docker_id bash |
|
4568 | $docker_id bash | |
4569 |
|
4569 | |||
4570 | } |
|
4570 | } | |
4571 |
|
4571 | |||
4572 | # :command.function |
|
4572 | # :command.function | |
4573 | rcstack_cli_set_edition_command() { |
|
4573 | rcstack_cli_set_edition_command() { | |
4574 | # src/cli_set_edition_command.sh |
|
4574 | # src/cli_set_edition_command.sh | |
4575 | INI_TARGET=$PWD/config/_shared |
|
4575 | INI_TARGET=$PWD/config/_shared | |
4576 | BOOTSTRAP_RUNTIME_ENV=$PWD/.custom/.runtime.env |
|
4576 | BOOTSTRAP_RUNTIME_ENV=$PWD/.custom/.runtime.env | |
4577 |
|
4577 | |||
4578 | RC_EDITION=${args[edition_type]} |
|
4578 | RC_EDITION=${args[edition_type]} | |
4579 | ini_path=$INI_TARGET/rhodecode.ini |
|
4579 | ini_path=$INI_TARGET/rhodecode.ini | |
4580 | DEBUG=${args[--debug]} |
|
4580 | DEBUG=${args[--debug]} | |
4581 |
|
4581 | |||
4582 | echo "set-edition: setting current installation as rhodecode-$RC_EDITION type" |
|
4582 | echo "set-edition: setting current installation as rhodecode-$RC_EDITION type" | |
4583 |
|
4583 | |||
4584 | echo "set-edition: configure $ini_path" |
|
4584 | echo "set-edition: configure $ini_path" | |
4585 | sed_replace '^use = egg:rhodecode-enterprise.*' "use = egg:rhodecode-enterprise-$RC_EDITION" |
|
4585 | sed_replace '^use = egg:rhodecode-enterprise.*' "use = egg:rhodecode-enterprise-$RC_EDITION" | |
4586 | echo "set-edition: configure $BOOTSTRAP_RUNTIME_ENV" |
|
4586 | echo "set-edition: configure $BOOTSTRAP_RUNTIME_ENV" | |
4587 | .env --file "$BOOTSTRAP_RUNTIME_ENV" |
|
4587 | .env --file "$BOOTSTRAP_RUNTIME_ENV" | |
4588 | .env set RC_EDITION=$RC_EDITION |
|
4588 | .env set RC_EDITION=$RC_EDITION | |
4589 |
|
4589 | |||
4590 | echo "set-edition: configuration done, run " |
|
4590 | echo "set-edition: configuration done, run " | |
4591 | echo "./$RC_SCRIPT_NAME stack-upgrade rhodecode" |
|
4591 | echo "./$RC_SCRIPT_NAME stack-upgrade rhodecode" | |
4592 |
|
4592 | |||
4593 | } |
|
4593 | } | |
4594 |
|
4594 | |||
4595 | # :command.function |
|
4595 | # :command.function | |
4596 | rcstack_cli_configure_vcsserver_command() { |
|
4596 | rcstack_cli_configure_vcsserver_command() { | |
4597 | # src/cli_configure_vcsserver_command.sh |
|
4597 | # src/cli_configure_vcsserver_command.sh | |
4598 | ini_path=${args[ini_path]} |
|
4598 | ini_path=${args[ini_path]} | |
4599 | DEBUG=${args[--debug]} |
|
4599 | DEBUG=${args[--debug]} | |
4600 |
|
4600 | |||
4601 | config_vcsserver_ini |
|
4601 | config_vcsserver_ini | |
4602 |
|
4602 | |||
4603 | echo |
|
4603 | echo | |
4604 | echo "reconfigure of $ini_path completed" |
|
4604 | echo "reconfigure of $ini_path completed" | |
4605 |
|
4605 | |||
4606 | } |
|
4606 | } | |
4607 |
|
4607 | |||
4608 | # :command.function |
|
4608 | # :command.function | |
4609 | rcstack_cli_configure_rhodecode_command() { |
|
4609 | rcstack_cli_configure_rhodecode_command() { | |
4610 | # src/cli_configure_rhodecode_command.sh |
|
4610 | # src/cli_configure_rhodecode_command.sh | |
4611 | ini_path=${args[ini_path]} |
|
4611 | ini_path=${args[ini_path]} | |
4612 | DEBUG=${args[--debug]} |
|
4612 | DEBUG=${args[--debug]} | |
4613 |
|
4613 | |||
4614 | # read generated secrets etc from our .env file |
|
4614 | # read generated secrets etc from our .env file | |
4615 | .env --file $RUNTIME_ENV |
|
4615 | .env --file $RUNTIME_ENV | |
4616 |
|
4616 | |||
4617 | .env get RC_LICENSE_TOKEN |
|
4617 | .env get RC_LICENSE_TOKEN | |
4618 | RC_LICENSE_TOKEN=$REPLY |
|
4618 | RC_LICENSE_TOKEN=$REPLY | |
4619 |
|
4619 | |||
4620 | .env get RC_EDITION |
|
4620 | .env get RC_EDITION | |
4621 | RC_EDITION=$REPLY |
|
4621 | RC_EDITION=$REPLY | |
4622 |
|
4622 | |||
4623 | .env get RC_SHARED_KEY |
|
4623 | .env get RC_SHARED_KEY | |
4624 | RC_SHARED_KEY=$REPLY |
|
4624 | RC_SHARED_KEY=$REPLY | |
4625 |
|
4625 | |||
4626 | .env get RC_HOSTNAME |
|
4626 | .env get RC_HOSTNAME | |
4627 | RC_HOSTNAME=$(sed_safe_path $REPLY) |
|
4627 | RC_HOSTNAME=$(sed_safe_path $REPLY) | |
4628 |
|
4628 | |||
4629 | .env get RC_APP_BASE_URL |
|
4629 | .env get RC_APP_BASE_URL | |
4630 | RC_APP_BASE_URL=$(sed_safe_path $REPLY) |
|
4630 | RC_APP_BASE_URL=$(sed_safe_path $REPLY) | |
4631 |
|
4631 | |||
4632 | .env get RC_SQLALCHEMY_DB1_URL |
|
4632 | .env get RC_SQLALCHEMY_DB1_URL | |
4633 | RC_SQLALCHEMY_DB1_URL=$(sed_safe_path $REPLY) |
|
4633 | RC_SQLALCHEMY_DB1_URL=$(sed_safe_path $REPLY) | |
4634 |
|
4634 | |||
4635 | .env get RC_CHANNELSTREAM_WS_URL |
|
4635 | .env get RC_CHANNELSTREAM_WS_URL | |
4636 | RC_CHANNELSTREAM_WS_URL=$(sed_safe_path $REPLY) |
|
4636 | RC_CHANNELSTREAM_WS_URL=$(sed_safe_path $REPLY) | |
4637 |
|
4637 | |||
4638 | # $ini_path needs to be defined! |
|
4638 | # $ini_path needs to be defined! | |
4639 | config_rhodecode_ini |
|
4639 | config_rhodecode_ini | |
4640 |
|
4640 | |||
4641 | echo |
|
4641 | echo | |
4642 | echo "reconfigure of $ini_path completed" |
|
4642 | echo "reconfigure of $ini_path completed" | |
4643 | } |
|
4643 | } | |
4644 |
|
4644 | |||
4645 | # :command.function |
|
4645 | # :command.function | |
4646 | rcstack_backup_db_command() { |
|
4646 | rcstack_backup_db_command() { | |
4647 | # src/backup_db_command.sh |
|
4647 | # src/backup_db_command.sh | |
4648 | check_bootstrap |
|
4648 | check_bootstrap | |
4649 |
|
4649 | |||
4650 | DEBUG=${args[--debug]} |
|
4650 | DEBUG=${args[--debug]} | |
4651 | DESTINATION=${args[destination]} |
|
4651 | DESTINATION=${args[destination]} | |
4652 |
|
4652 | |||
4653 | backup_date=$(date +%Y-%m-%d) |
|
4653 | backup_date=$(date +%Y-%m-%d) | |
4654 | backup_name_prefix=rc_db_dump |
|
4654 | backup_name_prefix=rc_db_dump | |
4655 |
|
4655 | |||
4656 | echo "$(green_bold Creating backup of rcstack database)" |
|
4656 | echo "$(green_bold Creating backup of rcstack database)" | |
4657 |
|
4657 | |||
4658 | .env --file $RUNTIME_ENV |
|
4658 | .env --file $RUNTIME_ENV | |
4659 |
|
4659 | |||
4660 | .env get_or_error DB_TYPE |
|
4660 | .env get_or_error DB_TYPE | |
4661 | DB_TYPE=$REPLY |
|
4661 | DB_TYPE=$REPLY | |
4662 |
|
4662 | |||
4663 | .env get_or_error DB_PASSWORD |
|
4663 | .env get_or_error DB_PASSWORD | |
4664 | DB_PASSWORD=$REPLY |
|
4664 | DB_PASSWORD=$REPLY | |
4665 |
|
4665 | |||
4666 | .env get_or_error DB_NAME |
|
4666 | .env get_or_error DB_NAME | |
4667 | DB_NAME=$REPLY |
|
4667 | DB_NAME=$REPLY | |
4668 |
|
4668 | |||
4669 | .env get_or_error DB_USER |
|
4669 | .env get_or_error DB_USER | |
4670 | DB_USER=$REPLY |
|
4670 | DB_USER=$REPLY | |
4671 |
|
4671 | |||
4672 | proj_name=rc_cluster_services |
|
4672 | proj_name=rc_cluster_services | |
4673 |
|
4673 | |||
4674 | if [[ $DB_TYPE == "postgres" ]]; then |
|
4674 | if [[ $DB_TYPE == "postgres" ]]; then | |
4675 | instance_type=database |
|
4675 | instance_type=database | |
4676 | DB_CMD="PGPASSWORD=$DB_PASSWORD psql --username=$DB_USER --dbname=$DB_NAME" |
|
4676 | DB_CMD="PGPASSWORD=$DB_PASSWORD psql --username=$DB_USER --dbname=$DB_NAME" | |
4677 | elif [[ $DB_TYPE == "mysql" ]]; then |
|
4677 | elif [[ $DB_TYPE == "mysql" ]]; then | |
4678 | instance_type=database-mysql |
|
4678 | instance_type=database-mysql | |
4679 | DB_CMD="mysql --user=$DB_USER --password=$DB_PASSWORD $DB_NAME" |
|
4679 | DB_CMD="mysql --user=$DB_USER --password=$DB_PASSWORD $DB_NAME" | |
4680 |
|
4680 | |||
4681 | else |
|
4681 | else | |
4682 | echo "$(red no database type selected via DB_TYPE var)" |
|
4682 | echo "$(red no database type selected via DB_TYPE var)" | |
4683 | exit 1 |
|
4683 | exit 1 | |
4684 | fi |
|
4684 | fi | |
4685 |
|
4685 | |||
4686 | docker_id=$(docker ps --filter name=$proj_name-$instance_type-1 -q | head -n1) |
|
4686 | docker_id=$(docker ps --filter name=$proj_name-$instance_type-1 -q | head -n1) | |
4687 | if [[ $docker_id == "" ]]; then |
|
4687 | if [[ $docker_id == "" ]]; then | |
4688 | echo "$(yellow cannot find docker instance \($proj_name-$instance_type\) for command execution. Please make sure it is running.)" |
|
4688 | echo "$(yellow cannot find docker instance \($proj_name-$instance_type\) for command execution. Please make sure it is running.)" | |
4689 | exit 1 |
|
4689 | exit 1 | |
4690 | fi |
|
4690 | fi | |
4691 |
|
4691 | |||
4692 | index_num=$(docker inspect "$docker_id" --format '{{ index .Config.Labels "com.docker.compose.container-number" }}') |
|
4692 | index_num=$(docker inspect "$docker_id" --format '{{ index .Config.Labels "com.docker.compose.container-number" }}') | |
4693 | if [[ -z "$index_num" ]] |
|
4693 | if [[ -z "$index_num" ]] | |
4694 | then |
|
4694 | then | |
4695 | index_num="0" |
|
4695 | index_num="0" | |
4696 | fi |
|
4696 | fi | |
4697 |
|
4697 | |||
4698 | destination_dir=$DESTINATION |
|
4698 | destination_dir=$DESTINATION | |
4699 | spacer="_" |
|
4699 | spacer="_" | |
4700 | backup_name="$backup_name_prefix$spacer$backup_date.sql.gz" |
|
4700 | backup_name="$backup_name_prefix$spacer$backup_date.sql.gz" | |
4701 |
|
4701 | |||
4702 | set -euo pipefail |
|
4702 | set -euo pipefail | |
4703 |
|
4703 | |||
4704 | if [[ $DB_TYPE == "postgres" ]]; then |
|
4704 | if [[ $DB_TYPE == "postgres" ]]; then | |
4705 | BACKUP_CMD="pg_dump --inserts -U $DB_USER -h 127.0.0.1 --dbname=$DB_NAME | gzip > /var/rc-data-dump/$backup_name" |
|
4705 | BACKUP_CMD="pg_dump --inserts -U $DB_USER -h 127.0.0.1 --dbname=$DB_NAME | gzip > /var/rc-data-dump/$backup_name" | |
4706 |
|
4706 | |||
4707 | if [[ $DEBUG ]]; then |
|
4707 | if [[ $DEBUG ]]; then | |
4708 | echo "docker-instance: $docker_id" |
|
4708 | echo "docker-instance: $docker_id" | |
4709 | echo "docker exec -e $BACKUP_CMD" |
|
4709 | echo "docker exec -e $BACKUP_CMD" | |
4710 | echo "dump placed in /var/rc-data-dump/$backup_name" |
|
4710 | echo "dump placed in /var/rc-data-dump/$backup_name" | |
4711 | echo "run docker cp $docker_id:/var/rc-data-dump/$backup_name $PWD to copy the file into your host machine" |
|
4711 | echo "run docker cp $docker_id:/var/rc-data-dump/$backup_name $PWD to copy the file into your host machine" | |
4712 | fi |
|
4712 | fi | |
4713 | docker exec -e PGPASSWORD=$DB_PASSWORD $docker_id /bin/bash -c "$BACKUP_CMD" |
|
4713 | docker exec -e PGPASSWORD=$DB_PASSWORD $docker_id /bin/bash -c "$BACKUP_CMD" | |
4714 |
|
4714 | |||
4715 | elif [[ $DB_TYPE == "mysql" ]]; then |
|
4715 | elif [[ $DB_TYPE == "mysql" ]]; then | |
4716 | BACKUP_CMD="mysqldump --user=$DB_USER --password=$DB_PASSWORD --host=localhost $DB_NAME | gzip > /var/rc-data-dump/$backup_name" |
|
4716 | BACKUP_CMD="mysqldump --user=$DB_USER --password=$DB_PASSWORD --host=localhost $DB_NAME | gzip > /var/rc-data-dump/$backup_name" | |
4717 |
|
4717 | |||
4718 | if [[ $DEBUG ]]; then |
|
4718 | if [[ $DEBUG ]]; then | |
4719 | echo "docker-instance: $docker_id" |
|
4719 | echo "docker-instance: $docker_id" | |
4720 | echo "docker exec -e $BACKUP_CMD" |
|
4720 | echo "docker exec -e $BACKUP_CMD" | |
4721 | echo "dump placed in /var/rc-data-dump/$backup_name" |
|
4721 | echo "dump placed in /var/rc-data-dump/$backup_name" | |
4722 | echo "run docker cp $docker_id:/var/rc-data-dump/$backup_name $PWD to copy the file into your host machine" |
|
4722 | echo "run docker cp $docker_id:/var/rc-data-dump/$backup_name $PWD to copy the file into your host machine" | |
4723 | fi |
|
4723 | fi | |
4724 |
|
4724 | |||
4725 | docker exec $docker_id /bin/bash -c "$BACKUP_CMD" |
|
4725 | docker exec $docker_id /bin/bash -c "$BACKUP_CMD" | |
4726 | fi |
|
4726 | fi | |
4727 |
|
4727 | |||
4728 | docker cp $docker_id:/var/rc-data-dump/$backup_name $destination_dir |
|
4728 | docker cp $docker_id:/var/rc-data-dump/$backup_name $destination_dir | |
4729 |
|
4729 | |||
4730 | echo "$(green Backup created in: \'$destination_dir\')" |
|
4730 | echo "$(green Backup created in: \'$destination_dir\')" | |
4731 | ls -la $destination_dir | grep $backup_name_prefix |
|
4731 | ls -la $destination_dir | grep $backup_name_prefix | |
4732 |
|
4732 | |||
4733 | } |
|
4733 | } | |
4734 |
|
4734 | |||
4735 | # :command.function |
|
4735 | # :command.function | |
4736 | rcstack_backup_data_command() { |
|
4736 | rcstack_backup_data_command() { | |
4737 | # src/backup_data_command.sh |
|
4737 | # src/backup_data_command.sh | |
4738 | check_bootstrap |
|
4738 | check_bootstrap | |
4739 |
|
4739 | |||
4740 | DEBUG=${args[--debug]} |
|
4740 | DEBUG=${args[--debug]} | |
4741 | DESTINATION=${args[destination]} |
|
4741 | DESTINATION=${args[destination]} | |
4742 |
|
4742 | |||
4743 | echo "$(green_bold Creating backup of rcstack volumes)" |
|
4743 | echo "$(green_bold Creating backup of rcstack volumes)" | |
4744 |
|
4744 | |||
4745 | backup_date=$(date +%Y-%m-%d) |
|
4745 | backup_date=$(date +%Y-%m-%d) | |
4746 | backup_name_prefix=rc_data_dump |
|
4746 | backup_name_prefix=rc_data_dump | |
4747 |
|
4747 | |||
4748 | target_container=rc_cluster_apps-rhodecode-* |
|
4748 | target_container=rc_cluster_apps-rhodecode-* | |
4749 |
|
4749 | |||
4750 | docker_id=$(docker ps --filter name=$target_container -q | head -n1) |
|
4750 | docker_id=$(docker ps --filter name=$target_container -q | head -n1) | |
4751 |
|
4751 | |||
4752 | if [[ $DEBUG ]]; then |
|
4752 | if [[ $DEBUG ]]; then | |
4753 | echo "container id: $docker_id, based on $target_container filter" |
|
4753 | echo "container id: $docker_id, based on $target_container filter" | |
4754 | docker ps |
|
4754 | docker ps | |
4755 | echo "---" |
|
4755 | echo "---" | |
4756 | fi |
|
4756 | fi | |
4757 |
|
4757 | |||
4758 | if [ "$docker_id" == "" ]; then |
|
4758 | if [ "$docker_id" == "" ]; then | |
4759 | MSG="Cannot find container ID with name $target_container" |
|
4759 | MSG="Cannot find container ID with name $target_container" | |
4760 | echo "$(red $MSG)" |
|
4760 | echo "$(red $MSG)" | |
4761 | exit 1 |
|
4761 | exit 1 | |
4762 | fi |
|
4762 | fi | |
4763 |
|
4763 | |||
4764 | set -euo pipefail |
|
4764 | set -euo pipefail | |
4765 |
|
4765 | |||
4766 | echo "$(green_bold Following volumes will be backed-up:)" |
|
4766 | echo "$(green_bold Following volumes will be backed-up:)" | |
4767 |
|
4767 | |||
4768 | volumes=$(docker inspect --format "{{ range .Mounts }}{{ println .Destination }}{{ end }}" $docker_id) |
|
4768 | volumes=$(docker inspect --format "{{ range .Mounts }}{{ println .Destination }}{{ end }}" $docker_id) | |
4769 | destination_dir=$DESTINATION |
|
4769 | destination_dir=$DESTINATION | |
4770 |
|
4770 | |||
4771 | spacer="_" |
|
4771 | spacer="_" | |
4772 | for vol in $volumes; do |
|
4772 | for vol in $volumes; do | |
4773 | echo "Volume: $vol" |
|
4773 | echo "Volume: $vol" | |
4774 | vol_name=$(slugify $vol) |
|
4774 | vol_name=$(slugify $vol) | |
4775 | backup_slug="$backup_name_prefix$spacer$vol_name$spacer$backup_date" |
|
4775 | backup_slug="$backup_name_prefix$spacer$vol_name$spacer$backup_date" | |
4776 |
|
4776 | |||
4777 | docker run --rm -v $destination_dir:/backup --volumes-from "$docker_id" $BASE_OPS_IMAGE tar -czvf /backup/$backup_slug.tar.gz "$vol" |
|
4777 | docker run --rm -v $destination_dir:/backup --volumes-from "$docker_id" $BASE_OPS_IMAGE tar -czvf /backup/$backup_slug.tar.gz "$vol" | |
4778 | done |
|
4778 | done | |
4779 |
|
4779 | |||
4780 | echo "$(green Backup created in: \'$destination_dir\')" |
|
4780 | echo "$(green Backup created in: \'$destination_dir\')" | |
4781 | ls -la $destination_dir | grep $backup_name_prefix |
|
4781 | ls -la $destination_dir | grep $backup_name_prefix | |
4782 |
|
4782 | |||
4783 | #docker-volume-restore-compressed() { |
|
4783 | #docker-volume-restore-compressed() { | |
4784 | # destination_dir=$1 |
|
4784 | # destination_dir=$1 | |
4785 | # container=$2 |
|
4785 | # container=$2 | |
4786 | # |
|
4786 | # | |
4787 | # docker run --rm -v $destination_dir:/backup --volumes-from "$container" debian:jessie tar -xzvf /backup/backup.tar.gz "${@:3}" |
|
4787 | # docker run --rm -v $destination_dir:/backup --volumes-from "$container" debian:jessie tar -xzvf /backup/backup.tar.gz "${@:3}" | |
4788 | # echo "Double checking files..." |
|
4788 | # echo "Double checking files..." | |
4789 | # docker run --rm -v $destination_dir:/backup --volumes-from "$container" debian:jessie ls -lh "${@:2}" |
|
4789 | # docker run --rm -v $destination_dir:/backup --volumes-from "$container" debian:jessie ls -lh "${@:2}" | |
4790 | #} |
|
4790 | #} | |
4791 | } |
|
4791 | } | |
4792 |
|
4792 | |||
4793 | # :command.function |
|
4793 | # :command.function | |
4794 | rcstack__completions_command() { |
|
4794 | rcstack__completions_command() { | |
4795 | # src/_completions_command.sh |
|
4795 | # src/_completions_command.sh | |
4796 | send_completions |
|
4796 | send_completions | |
4797 | } |
|
4797 | } | |
4798 |
|
4798 | |||
4799 | # :command.parse_requirements |
|
4799 | # :command.parse_requirements | |
4800 | parse_requirements() { |
|
4800 | parse_requirements() { | |
4801 | # :command.fixed_flags_filter |
|
4801 | # :command.fixed_flags_filter | |
4802 | while [[ $# -gt 0 ]]; do |
|
4802 | while [[ $# -gt 0 ]]; do | |
4803 | case "${1:-}" in |
|
4803 | case "${1:-}" in | |
4804 | --version | -v) |
|
4804 | --version | -v) | |
4805 | version_command |
|
4805 | version_command | |
4806 | exit |
|
4806 | exit | |
4807 | ;; |
|
4807 | ;; | |
4808 |
|
4808 | |||
4809 | --help | -h) |
|
4809 | --help | -h) | |
4810 | long_usage=yes |
|
4810 | long_usage=yes | |
4811 | rcstack_usage |
|
4811 | rcstack_usage | |
4812 | exit |
|
4812 | exit | |
4813 | ;; |
|
4813 | ;; | |
4814 |
|
4814 | |||
4815 | # :flag.case |
|
4815 | # :flag.case | |
4816 | --debug) |
|
4816 | --debug) | |
4817 |
|
4817 | |||
4818 | # :flag.case_no_arg |
|
4818 | # :flag.case_no_arg | |
4819 | args['--debug']=1 |
|
4819 | args['--debug']=1 | |
4820 | shift |
|
4820 | shift | |
4821 | ;; |
|
4821 | ;; | |
4822 |
|
4822 | |||
4823 | # :flag.case |
|
4823 | # :flag.case | |
4824 | --no-init-check) |
|
4824 | --no-init-check) | |
4825 |
|
4825 | |||
4826 | # :flag.case_no_arg |
|
4826 | # :flag.case_no_arg | |
4827 | args['--no-init-check']=1 |
|
4827 | args['--no-init-check']=1 | |
4828 | shift |
|
4828 | shift | |
4829 | ;; |
|
4829 | ;; | |
4830 |
|
4830 | |||
4831 | *) |
|
4831 | *) | |
4832 | break |
|
4832 | break | |
4833 | ;; |
|
4833 | ;; | |
4834 |
|
4834 | |||
4835 | esac |
|
4835 | esac | |
4836 | done |
|
4836 | done | |
4837 |
|
4837 | |||
4838 | # :command.environment_variables_filter |
|
4838 | # :command.environment_variables_filter | |
4839 | # :command.environment_variables_default |
|
4839 | # :command.environment_variables_default | |
4840 | export RCC_CONFIG="${RCC_CONFIG:-.rcstack.ini}" |
|
4840 | export RCC_CONFIG="${RCC_CONFIG:-.rcstack.ini}" | |
4841 | export RC_STACK_ROUTER_EXT="${RC_STACK_ROUTER_EXT:-.custom/docker-compose-router.override.yaml}" |
|
4841 | export RC_STACK_ROUTER_EXT="${RC_STACK_ROUTER_EXT:-.custom/docker-compose-router.override.yaml}" | |
4842 | export RC_STACK_METRICS_EXT="${RC_STACK_METRICS_EXT:-.custom/docker-compose-metrics.override.yaml}" |
|
4842 | export RC_STACK_METRICS_EXT="${RC_STACK_METRICS_EXT:-.custom/docker-compose-metrics.override.yaml}" | |
4843 | export RC_STACK_SERVICES_EXT="${RC_STACK_SERVICES_EXT:-.custom/docker-compose-services.override.yaml}" |
|
4843 | export RC_STACK_SERVICES_EXT="${RC_STACK_SERVICES_EXT:-.custom/docker-compose-services.override.yaml}" | |
4844 | export RC_STACK_RHODECODE_EXT="${RC_STACK_RHODECODE_EXT:-.custom/docker-compose-apps.override.yaml}" |
|
4844 | export RC_STACK_RHODECODE_EXT="${RC_STACK_RHODECODE_EXT:-.custom/docker-compose-apps.override.yaml}" | |
4845 |
|
4845 | |||
4846 | # :command.command_filter |
|
4846 | # :command.command_filter | |
4847 | action=${1:-} |
|
4847 | action=${1:-} | |
4848 |
|
4848 | |||
4849 | case $action in |
|
4849 | case $action in | |
4850 | -*) ;; |
|
4850 | -*) ;; | |
4851 |
|
4851 | |||
4852 | get-started) |
|
4852 | get-started) | |
4853 | action="get-started" |
|
4853 | action="get-started" | |
4854 | shift |
|
4854 | shift | |
4855 | rcstack_get_started_parse_requirements "$@" |
|
4855 | rcstack_get_started_parse_requirements "$@" | |
4856 | shift $# |
|
4856 | shift $# | |
4857 | ;; |
|
4857 | ;; | |
4858 |
|
4858 | |||
4859 | init) |
|
4859 | init) | |
4860 | action="init" |
|
4860 | action="init" | |
4861 | shift |
|
4861 | shift | |
4862 | rcstack_init_parse_requirements "$@" |
|
4862 | rcstack_init_parse_requirements "$@" | |
4863 | shift $# |
|
4863 | shift $# | |
4864 | ;; |
|
4864 | ;; | |
4865 |
|
4865 | |||
4866 | self-update) |
|
4866 | self-update) | |
4867 | action="self-update" |
|
4867 | action="self-update" | |
4868 | shift |
|
4868 | shift | |
4869 | rcstack_self_update_parse_requirements "$@" |
|
4869 | rcstack_self_update_parse_requirements "$@" | |
4870 | shift $# |
|
4870 | shift $# | |
4871 | ;; |
|
4871 | ;; | |
4872 |
|
4872 | |||
4873 | self-upgrade) |
|
4873 | self-upgrade) | |
4874 | action="self-upgrade" |
|
4874 | action="self-upgrade" | |
4875 | shift |
|
4875 | shift | |
4876 | rcstack_self_upgrade_parse_requirements "$@" |
|
4876 | rcstack_self_upgrade_parse_requirements "$@" | |
4877 | shift $# |
|
4877 | shift $# | |
4878 | ;; |
|
4878 | ;; | |
4879 |
|
4879 | |||
4880 | stack) |
|
4880 | stack) | |
4881 | action="stack" |
|
4881 | action="stack" | |
4882 | shift |
|
4882 | shift | |
4883 | rcstack_stack_parse_requirements "$@" |
|
4883 | rcstack_stack_parse_requirements "$@" | |
4884 | shift $# |
|
4884 | shift $# | |
4885 | ;; |
|
4885 | ;; | |
4886 |
|
4886 | |||
4887 | stack-status | status) |
|
4887 | stack-status | status) | |
4888 | action="stack-status" |
|
4888 | action="stack-status" | |
4889 | shift |
|
4889 | shift | |
4890 | rcstack_stack_status_parse_requirements "$@" |
|
4890 | rcstack_stack_status_parse_requirements "$@" | |
4891 | shift $# |
|
4891 | shift $# | |
4892 | ;; |
|
4892 | ;; | |
4893 |
|
4893 | |||
4894 | stack-upgrade) |
|
4894 | stack-upgrade) | |
4895 | action="stack-upgrade" |
|
4895 | action="stack-upgrade" | |
4896 | shift |
|
4896 | shift | |
4897 | rcstack_stack_upgrade_parse_requirements "$@" |
|
4897 | rcstack_stack_upgrade_parse_requirements "$@" | |
4898 | shift $# |
|
4898 | shift $# | |
4899 | ;; |
|
4899 | ;; | |
4900 |
|
4900 | |||
4901 | stack-monitor) |
|
4901 | stack-monitor) | |
4902 | action="stack-monitor" |
|
4902 | action="stack-monitor" | |
4903 | shift |
|
4903 | shift | |
4904 | rcstack_stack_monitor_parse_requirements "$@" |
|
4904 | rcstack_stack_monitor_parse_requirements "$@" | |
4905 | shift $# |
|
4905 | shift $# | |
4906 | ;; |
|
4906 | ;; | |
4907 |
|
4907 | |||
4908 | cli) |
|
4908 | cli) | |
4909 | action="cli" |
|
4909 | action="cli" | |
4910 | shift |
|
4910 | shift | |
4911 | rcstack_cli_parse_requirements "$@" |
|
4911 | rcstack_cli_parse_requirements "$@" | |
4912 | shift $# |
|
4912 | shift $# | |
4913 | ;; |
|
4913 | ;; | |
4914 |
|
4914 | |||
4915 | backup-db) |
|
4915 | backup-db) | |
4916 | action="backup-db" |
|
4916 | action="backup-db" | |
4917 | shift |
|
4917 | shift | |
4918 | rcstack_backup_db_parse_requirements "$@" |
|
4918 | rcstack_backup_db_parse_requirements "$@" | |
4919 | shift $# |
|
4919 | shift $# | |
4920 | ;; |
|
4920 | ;; | |
4921 |
|
4921 | |||
4922 | backup-data) |
|
4922 | backup-data) | |
4923 | action="backup-data" |
|
4923 | action="backup-data" | |
4924 | shift |
|
4924 | shift | |
4925 | rcstack_backup_data_parse_requirements "$@" |
|
4925 | rcstack_backup_data_parse_requirements "$@" | |
4926 | shift $# |
|
4926 | shift $# | |
4927 | ;; |
|
4927 | ;; | |
4928 |
|
4928 | |||
4929 | _completions) |
|
4929 | _completions) | |
4930 | action="_completions" |
|
4930 | action="_completions" | |
4931 | shift |
|
4931 | shift | |
4932 | rcstack__completions_parse_requirements "$@" |
|
4932 | rcstack__completions_parse_requirements "$@" | |
4933 | shift $# |
|
4933 | shift $# | |
4934 | ;; |
|
4934 | ;; | |
4935 |
|
4935 | |||
4936 | # :command.command_fallback |
|
4936 | # :command.command_fallback | |
4937 | "") |
|
4937 | "") | |
4938 | rcstack_usage >&2 |
|
4938 | rcstack_usage >&2 | |
4939 | exit 1 |
|
4939 | exit 1 | |
4940 | ;; |
|
4940 | ;; | |
4941 |
|
4941 | |||
4942 | *) |
|
4942 | *) | |
4943 | printf "invalid command: %s\n" "$action" >&2 |
|
4943 | printf "invalid command: %s\n" "$action" >&2 | |
4944 | exit 1 |
|
4944 | exit 1 | |
4945 | ;; |
|
4945 | ;; | |
4946 |
|
4946 | |||
4947 | esac |
|
4947 | esac | |
4948 |
|
4948 | |||
4949 | # :command.parse_requirements_while |
|
4949 | # :command.parse_requirements_while | |
4950 | while [[ $# -gt 0 ]]; do |
|
4950 | while [[ $# -gt 0 ]]; do | |
4951 | key="$1" |
|
4951 | key="$1" | |
4952 | case "$key" in |
|
4952 | case "$key" in | |
4953 |
|
4953 | |||
4954 | -?*) |
|
4954 | -?*) | |
4955 | printf "invalid option: %s\n" "$key" >&2 |
|
4955 | printf "invalid option: %s\n" "$key" >&2 | |
4956 | exit 1 |
|
4956 | exit 1 | |
4957 | ;; |
|
4957 | ;; | |
4958 |
|
4958 | |||
4959 | *) |
|
4959 | *) | |
4960 | # :command.parse_requirements_case |
|
4960 | # :command.parse_requirements_case | |
4961 | # :command.parse_requirements_case_simple |
|
4961 | # :command.parse_requirements_case_simple | |
4962 | printf "invalid argument: %s\n" "$key" >&2 |
|
4962 | printf "invalid argument: %s\n" "$key" >&2 | |
4963 | exit 1 |
|
4963 | exit 1 | |
4964 |
|
4964 | |||
4965 | ;; |
|
4965 | ;; | |
4966 |
|
4966 | |||
4967 | esac |
|
4967 | esac | |
4968 | done |
|
4968 | done | |
4969 |
|
4969 | |||
4970 | } |
|
4970 | } | |
4971 |
|
4971 | |||
4972 | # :command.parse_requirements |
|
4972 | # :command.parse_requirements | |
4973 | rcstack_get_started_parse_requirements() { |
|
4973 | rcstack_get_started_parse_requirements() { | |
4974 | # :command.fixed_flags_filter |
|
4974 | # :command.fixed_flags_filter | |
4975 | while [[ $# -gt 0 ]]; do |
|
4975 | while [[ $# -gt 0 ]]; do | |
4976 | case "${1:-}" in |
|
4976 | case "${1:-}" in | |
4977 | --help | -h) |
|
4977 | --help | -h) | |
4978 | long_usage=yes |
|
4978 | long_usage=yes | |
4979 | rcstack_get_started_usage |
|
4979 | rcstack_get_started_usage | |
4980 | exit |
|
4980 | exit | |
4981 | ;; |
|
4981 | ;; | |
4982 |
|
4982 | |||
4983 | *) |
|
4983 | *) | |
4984 | break |
|
4984 | break | |
4985 | ;; |
|
4985 | ;; | |
4986 |
|
4986 | |||
4987 | esac |
|
4987 | esac | |
4988 | done |
|
4988 | done | |
4989 |
|
4989 | |||
4990 | # :command.command_filter |
|
4990 | # :command.command_filter | |
4991 | action="get-started" |
|
4991 | action="get-started" | |
4992 |
|
4992 | |||
4993 | # :command.parse_requirements_while |
|
4993 | # :command.parse_requirements_while | |
4994 | while [[ $# -gt 0 ]]; do |
|
4994 | while [[ $# -gt 0 ]]; do | |
4995 | key="$1" |
|
4995 | key="$1" | |
4996 | case "$key" in |
|
4996 | case "$key" in | |
4997 |
|
4997 | |||
4998 | -?*) |
|
4998 | -?*) | |
4999 | printf "invalid option: %s\n" "$key" >&2 |
|
4999 | printf "invalid option: %s\n" "$key" >&2 | |
5000 | exit 1 |
|
5000 | exit 1 | |
5001 | ;; |
|
5001 | ;; | |
5002 |
|
5002 | |||
5003 | *) |
|
5003 | *) | |
5004 | # :command.parse_requirements_case |
|
5004 | # :command.parse_requirements_case | |
5005 | # :command.parse_requirements_case_simple |
|
5005 | # :command.parse_requirements_case_simple | |
5006 | printf "invalid argument: %s\n" "$key" >&2 |
|
5006 | printf "invalid argument: %s\n" "$key" >&2 | |
5007 | exit 1 |
|
5007 | exit 1 | |
5008 |
|
5008 | |||
5009 | ;; |
|
5009 | ;; | |
5010 |
|
5010 | |||
5011 | esac |
|
5011 | esac | |
5012 | done |
|
5012 | done | |
5013 |
|
5013 | |||
5014 | } |
|
5014 | } | |
5015 |
|
5015 | |||
5016 | # :command.parse_requirements |
|
5016 | # :command.parse_requirements | |
5017 | rcstack_init_parse_requirements() { |
|
5017 | rcstack_init_parse_requirements() { | |
5018 | # :command.fixed_flags_filter |
|
5018 | # :command.fixed_flags_filter | |
5019 | while [[ $# -gt 0 ]]; do |
|
5019 | while [[ $# -gt 0 ]]; do | |
5020 | case "${1:-}" in |
|
5020 | case "${1:-}" in | |
5021 | --help | -h) |
|
5021 | --help | -h) | |
5022 | long_usage=yes |
|
5022 | long_usage=yes | |
5023 | rcstack_init_usage |
|
5023 | rcstack_init_usage | |
5024 | exit |
|
5024 | exit | |
5025 | ;; |
|
5025 | ;; | |
5026 |
|
5026 | |||
5027 | *) |
|
5027 | *) | |
5028 | break |
|
5028 | break | |
5029 | ;; |
|
5029 | ;; | |
5030 |
|
5030 | |||
5031 | esac |
|
5031 | esac | |
5032 | done |
|
5032 | done | |
5033 |
|
5033 | |||
5034 | # :command.dependencies_filter |
|
5034 | # :command.dependencies_filter | |
5035 | if command -v curl >/dev/null 2>&1; then |
|
5035 | if command -v curl >/dev/null 2>&1; then | |
5036 | deps['curl']="$(command -v curl | head -n1)" |
|
5036 | deps['curl']="$(command -v curl | head -n1)" | |
5037 | else |
|
5037 | else | |
5038 | printf "missing dependency: curl\n" >&2 |
|
5038 | printf "missing dependency: curl\n" >&2 | |
5039 | exit 1 |
|
5039 | exit 1 | |
5040 | fi |
|
5040 | fi | |
5041 |
|
5041 | |||
5042 | if command -v tar >/dev/null 2>&1; then |
|
5042 | if command -v tar >/dev/null 2>&1; then | |
5043 | deps['tar']="$(command -v tar | head -n1)" |
|
5043 | deps['tar']="$(command -v tar | head -n1)" | |
5044 | else |
|
5044 | else | |
5045 | printf "missing dependency: tar\n" >&2 |
|
5045 | printf "missing dependency: tar\n" >&2 | |
5046 | exit 1 |
|
5046 | exit 1 | |
5047 | fi |
|
5047 | fi | |
5048 |
|
5048 | |||
5049 | if command -v find >/dev/null 2>&1; then |
|
5049 | if command -v find >/dev/null 2>&1; then | |
5050 | deps['find']="$(command -v find | head -n1)" |
|
5050 | deps['find']="$(command -v find | head -n1)" | |
5051 | else |
|
5051 | else | |
5052 | printf "missing dependency: find\n" >&2 |
|
5052 | printf "missing dependency: find\n" >&2 | |
5053 | exit 1 |
|
5053 | exit 1 | |
5054 | fi |
|
5054 | fi | |
5055 |
|
5055 | |||
5056 | # :command.command_filter |
|
5056 | # :command.command_filter | |
5057 | action="init" |
|
5057 | action="init" | |
5058 |
|
5058 | |||
5059 | # :command.parse_requirements_while |
|
5059 | # :command.parse_requirements_while | |
5060 | while [[ $# -gt 0 ]]; do |
|
5060 | while [[ $# -gt 0 ]]; do | |
5061 | key="$1" |
|
5061 | key="$1" | |
5062 | case "$key" in |
|
5062 | case "$key" in | |
5063 | # :flag.case |
|
5063 | # :flag.case | |
5064 | --arg-accept-eula) |
|
5064 | --arg-accept-eula) | |
5065 |
|
5065 | |||
5066 | # :flag.case_no_arg |
|
5066 | # :flag.case_no_arg | |
5067 | args['--arg-accept-eula']=1 |
|
5067 | args['--arg-accept-eula']=1 | |
5068 | shift |
|
5068 | shift | |
5069 | ;; |
|
5069 | ;; | |
5070 |
|
5070 | |||
5071 | # :flag.case |
|
5071 | # :flag.case | |
5072 | --arg-rc-edition) |
|
5072 | --arg-rc-edition) | |
5073 |
|
5073 | |||
5074 | # :flag.case_arg |
|
5074 | # :flag.case_arg | |
5075 | if [[ -n ${2+x} ]]; then |
|
5075 | if [[ -n ${2+x} ]]; then | |
5076 |
|
5076 | |||
5077 | args['--arg-rc-edition']="$2" |
|
5077 | args['--arg-rc-edition']="$2" | |
5078 | shift |
|
5078 | shift | |
5079 | shift |
|
5079 | shift | |
5080 | else |
|
5080 | else | |
5081 | printf "%s\n" "--arg-rc-edition requires an argument: --arg-rc-edition ARG_RC_EDITION" >&2 |
|
5081 | printf "%s\n" "--arg-rc-edition requires an argument: --arg-rc-edition ARG_RC_EDITION" >&2 | |
5082 | exit 1 |
|
5082 | exit 1 | |
5083 | fi |
|
5083 | fi | |
5084 | ;; |
|
5084 | ;; | |
5085 |
|
5085 | |||
5086 | # :flag.case |
|
5086 | # :flag.case | |
5087 | --arg-rc-version) |
|
5087 | --arg-rc-version) | |
5088 |
|
5088 | |||
5089 | # :flag.case_arg |
|
5089 | # :flag.case_arg | |
5090 | if [[ -n ${2+x} ]]; then |
|
5090 | if [[ -n ${2+x} ]]; then | |
5091 |
|
5091 | |||
5092 | args['--arg-rc-version']="$2" |
|
5092 | args['--arg-rc-version']="$2" | |
5093 | shift |
|
5093 | shift | |
5094 | shift |
|
5094 | shift | |
5095 | else |
|
5095 | else | |
5096 | printf "%s\n" "--arg-rc-version requires an argument: --arg-rc-version ARG_RC_VERSION" >&2 |
|
5096 | printf "%s\n" "--arg-rc-version requires an argument: --arg-rc-version ARG_RC_VERSION" >&2 | |
5097 | exit 1 |
|
5097 | exit 1 | |
5098 | fi |
|
5098 | fi | |
5099 | ;; |
|
5099 | ;; | |
5100 |
|
5100 | |||
5101 | # :flag.case |
|
5101 | # :flag.case | |
5102 | --arg-hostname) |
|
5102 | --arg-hostname) | |
5103 |
|
5103 | |||
5104 | # :flag.case_arg |
|
5104 | # :flag.case_arg | |
5105 | if [[ -n ${2+x} ]]; then |
|
5105 | if [[ -n ${2+x} ]]; then | |
5106 |
|
5106 | |||
5107 | args['--arg-hostname']="$2" |
|
5107 | args['--arg-hostname']="$2" | |
5108 | shift |
|
5108 | shift | |
5109 | shift |
|
5109 | shift | |
5110 | else |
|
5110 | else | |
5111 | printf "%s\n" "--arg-hostname requires an argument: --arg-hostname ARG_HOSTNAME" >&2 |
|
5111 | printf "%s\n" "--arg-hostname requires an argument: --arg-hostname ARG_HOSTNAME" >&2 | |
5112 | exit 1 |
|
5112 | exit 1 | |
5113 | fi |
|
5113 | fi | |
5114 | ;; |
|
5114 | ;; | |
5115 |
|
5115 | |||
5116 | # :flag.case |
|
5116 | # :flag.case | |
5117 | --arg-database-type) |
|
5117 | --arg-database-type) | |
5118 |
|
5118 | |||
5119 | # :flag.case_arg |
|
5119 | # :flag.case_arg | |
5120 | if [[ -n ${2+x} ]]; then |
|
5120 | if [[ -n ${2+x} ]]; then | |
5121 |
|
5121 | |||
5122 | args['--arg-database-type']="$2" |
|
5122 | args['--arg-database-type']="$2" | |
5123 | shift |
|
5123 | shift | |
5124 | shift |
|
5124 | shift | |
5125 | else |
|
5125 | else | |
5126 | printf "%s\n" "--arg-database-type requires an argument: --arg-database-type ARG_DATABASE_TYPE" >&2 |
|
5126 | printf "%s\n" "--arg-database-type requires an argument: --arg-database-type ARG_DATABASE_TYPE" >&2 | |
5127 | exit 1 |
|
5127 | exit 1 | |
5128 | fi |
|
5128 | fi | |
5129 | ;; |
|
5129 | ;; | |
5130 |
|
5130 | |||
5131 | # :flag.case |
|
5131 | # :flag.case | |
5132 | --arg-use-ssl) |
|
5132 | --arg-use-ssl) | |
5133 |
|
5133 | |||
5134 | # :flag.case_arg |
|
5134 | # :flag.case_arg | |
5135 | if [[ -n ${2+x} ]]; then |
|
5135 | if [[ -n ${2+x} ]]; then | |
5136 |
|
5136 | |||
5137 | args['--arg-use-ssl']="$2" |
|
5137 | args['--arg-use-ssl']="$2" | |
5138 | shift |
|
5138 | shift | |
5139 | shift |
|
5139 | shift | |
5140 | else |
|
5140 | else | |
5141 | printf "%s\n" "--arg-use-ssl requires an argument: --arg-use-ssl ARG_USE_SSL" >&2 |
|
5141 | printf "%s\n" "--arg-use-ssl requires an argument: --arg-use-ssl ARG_USE_SSL" >&2 | |
5142 | exit 1 |
|
5142 | exit 1 | |
5143 | fi |
|
5143 | fi | |
5144 | ;; |
|
5144 | ;; | |
5145 |
|
5145 | |||
5146 | # :flag.case |
|
5146 | # :flag.case | |
5147 | --arg-admin-email) |
|
5147 | --arg-admin-email) | |
5148 |
|
5148 | |||
5149 | # :flag.case_arg |
|
5149 | # :flag.case_arg | |
5150 | if [[ -n ${2+x} ]]; then |
|
5150 | if [[ -n ${2+x} ]]; then | |
5151 |
|
5151 | |||
5152 | args['--arg-admin-email']="$2" |
|
5152 | args['--arg-admin-email']="$2" | |
5153 | shift |
|
5153 | shift | |
5154 | shift |
|
5154 | shift | |
5155 | else |
|
5155 | else | |
5156 | printf "%s\n" "--arg-admin-email requires an argument: --arg-admin-email ARG_ADMIN_EMAIL" >&2 |
|
5156 | printf "%s\n" "--arg-admin-email requires an argument: --arg-admin-email ARG_ADMIN_EMAIL" >&2 | |
5157 | exit 1 |
|
5157 | exit 1 | |
5158 | fi |
|
5158 | fi | |
5159 | ;; |
|
5159 | ;; | |
5160 |
|
5160 | |||
5161 | # :flag.case |
|
5161 | # :flag.case | |
5162 | --arg-admin-user) |
|
5162 | --arg-admin-user) | |
5163 |
|
5163 | |||
5164 | # :flag.case_arg |
|
5164 | # :flag.case_arg | |
5165 | if [[ -n ${2+x} ]]; then |
|
5165 | if [[ -n ${2+x} ]]; then | |
5166 |
|
5166 | |||
5167 | args['--arg-admin-user']="$2" |
|
5167 | args['--arg-admin-user']="$2" | |
5168 | shift |
|
5168 | shift | |
5169 | shift |
|
5169 | shift | |
5170 | else |
|
5170 | else | |
5171 | printf "%s\n" "--arg-admin-user requires an argument: --arg-admin-user ARG_ADMIN_USER" >&2 |
|
5171 | printf "%s\n" "--arg-admin-user requires an argument: --arg-admin-user ARG_ADMIN_USER" >&2 | |
5172 | exit 1 |
|
5172 | exit 1 | |
5173 | fi |
|
5173 | fi | |
5174 | ;; |
|
5174 | ;; | |
5175 |
|
5175 | |||
5176 | # :flag.case |
|
5176 | # :flag.case | |
5177 | --arg-admin-pass) |
|
5177 | --arg-admin-pass) | |
5178 |
|
5178 | |||
5179 | # :flag.case_arg |
|
5179 | # :flag.case_arg | |
5180 | if [[ -n ${2+x} ]]; then |
|
5180 | if [[ -n ${2+x} ]]; then | |
5181 |
|
5181 | |||
5182 | args['--arg-admin-pass']="$2" |
|
5182 | args['--arg-admin-pass']="$2" | |
5183 | shift |
|
5183 | shift | |
5184 | shift |
|
5184 | shift | |
5185 | else |
|
5185 | else | |
5186 | printf "%s\n" "--arg-admin-pass requires an argument: --arg-admin-pass ARG_ADMIN_PASS" >&2 |
|
5186 | printf "%s\n" "--arg-admin-pass requires an argument: --arg-admin-pass ARG_ADMIN_PASS" >&2 | |
5187 | exit 1 |
|
5187 | exit 1 | |
5188 | fi |
|
5188 | fi | |
5189 | ;; |
|
5189 | ;; | |
5190 |
|
5190 | |||
5191 | # :flag.case |
|
5191 | # :flag.case | |
5192 | --arg-license-token) |
|
5192 | --arg-license-token) | |
5193 |
|
5193 | |||
5194 | # :flag.case_arg |
|
5194 | # :flag.case_arg | |
5195 | if [[ -n ${2+x} ]]; then |
|
5195 | if [[ -n ${2+x} ]]; then | |
5196 |
|
5196 | |||
5197 | args['--arg-license-token']="$2" |
|
5197 | args['--arg-license-token']="$2" | |
5198 | shift |
|
5198 | shift | |
5199 | shift |
|
5199 | shift | |
5200 | else |
|
5200 | else | |
5201 | printf "%s\n" "--arg-license-token requires an argument: --arg-license-token ARG_ADMIN_TOKEN" >&2 |
|
5201 | printf "%s\n" "--arg-license-token requires an argument: --arg-license-token ARG_ADMIN_TOKEN" >&2 | |
5202 | exit 1 |
|
5202 | exit 1 | |
5203 | fi |
|
5203 | fi | |
5204 | ;; |
|
5204 | ;; | |
5205 |
|
5205 | |||
5206 | # :flag.case |
|
5206 | # :flag.case | |
5207 | --no-prompt) |
|
5207 | --no-prompt) | |
5208 |
|
5208 | |||
5209 | # :flag.case_no_arg |
|
5209 | # :flag.case_no_arg | |
5210 | args['--no-prompt']=1 |
|
5210 | args['--no-prompt']=1 | |
5211 | shift |
|
5211 | shift | |
5212 | ;; |
|
5212 | ;; | |
5213 |
|
5213 | |||
5214 | # :flag.case |
|
5214 | # :flag.case | |
5215 | --force | -f) |
|
5215 | --force | -f) | |
5216 |
|
5216 | |||
5217 | # :flag.case_no_arg |
|
5217 | # :flag.case_no_arg | |
5218 | args['--force']=1 |
|
5218 | args['--force']=1 | |
5219 | shift |
|
5219 | shift | |
5220 | ;; |
|
5220 | ;; | |
5221 |
|
5221 | |||
5222 | # :flag.case |
|
5222 | # :flag.case | |
5223 | --stage) |
|
5223 | --stage) | |
5224 |
|
5224 | |||
5225 | # :flag.case_arg |
|
5225 | # :flag.case_arg | |
5226 | if [[ -n ${2+x} ]]; then |
|
5226 | if [[ -n ${2+x} ]]; then | |
5227 |
|
5227 | |||
5228 | if [[ -z ${args['--stage']+x} ]]; then |
|
5228 | if [[ -z ${args['--stage']+x} ]]; then | |
5229 | args['--stage']="\"$2\"" |
|
5229 | args['--stage']="\"$2\"" | |
5230 | else |
|
5230 | else | |
5231 | args['--stage']="${args[--stage]} \"$2\"" |
|
5231 | args['--stage']="${args[--stage]} \"$2\"" | |
5232 | fi |
|
5232 | fi | |
5233 | shift |
|
5233 | shift | |
5234 | shift |
|
5234 | shift | |
5235 | else |
|
5235 | else | |
5236 | printf "%s\n" "--stage requires an argument: --stage STAGE" >&2 |
|
5236 | printf "%s\n" "--stage requires an argument: --stage STAGE" >&2 | |
5237 | exit 1 |
|
5237 | exit 1 | |
5238 | fi |
|
5238 | fi | |
5239 | ;; |
|
5239 | ;; | |
5240 |
|
5240 | |||
5241 | # :flag.case |
|
5241 | # :flag.case | |
5242 | --docker-revision) |
|
5242 | --docker-revision) | |
5243 |
|
5243 | |||
5244 | # :flag.case_arg |
|
5244 | # :flag.case_arg | |
5245 | if [[ -n ${2+x} ]]; then |
|
5245 | if [[ -n ${2+x} ]]; then | |
5246 |
|
5246 | |||
5247 | args['--docker-revision']="$2" |
|
5247 | args['--docker-revision']="$2" | |
5248 | shift |
|
5248 | shift | |
5249 | shift |
|
5249 | shift | |
5250 | else |
|
5250 | else | |
5251 | printf "%s\n" "--docker-revision requires an argument: --docker-revision DOCKER_REVISION" >&2 |
|
5251 | printf "%s\n" "--docker-revision requires an argument: --docker-revision DOCKER_REVISION" >&2 | |
5252 | exit 1 |
|
5252 | exit 1 | |
5253 | fi |
|
5253 | fi | |
5254 | ;; |
|
5254 | ;; | |
5255 |
|
5255 | |||
5256 | # :flag.case |
|
5256 | # :flag.case | |
5257 | --install-docker) |
|
5257 | --install-docker) | |
5258 |
|
5258 | |||
5259 | # :flag.case_arg |
|
5259 | # :flag.case_arg | |
5260 | if [[ -n ${2+x} ]]; then |
|
5260 | if [[ -n ${2+x} ]]; then | |
5261 |
|
5261 | |||
5262 | args['--install-docker']="$2" |
|
5262 | args['--install-docker']="$2" | |
5263 | shift |
|
5263 | shift | |
5264 | shift |
|
5264 | shift | |
5265 | else |
|
5265 | else | |
5266 | printf "%s\n" "--install-docker requires an argument: --install-docker INSTALL_DOCKER" >&2 |
|
5266 | printf "%s\n" "--install-docker requires an argument: --install-docker INSTALL_DOCKER" >&2 | |
5267 | exit 1 |
|
5267 | exit 1 | |
5268 | fi |
|
5268 | fi | |
5269 | ;; |
|
5269 | ;; | |
5270 |
|
5270 | |||
5271 | # :flag.case |
|
5271 | # :flag.case | |
5272 | --server-url) |
|
5272 | --server-url) | |
5273 |
|
5273 | |||
5274 | # :flag.case_arg |
|
5274 | # :flag.case_arg | |
5275 | if [[ -n ${2+x} ]]; then |
|
5275 | if [[ -n ${2+x} ]]; then | |
5276 |
|
5276 | |||
5277 | args['--server-url']="$2" |
|
5277 | args['--server-url']="$2" | |
5278 | shift |
|
5278 | shift | |
5279 | shift |
|
5279 | shift | |
5280 | else |
|
5280 | else | |
5281 | printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2 |
|
5281 | printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2 | |
5282 | exit 1 |
|
5282 | exit 1 | |
5283 | fi |
|
5283 | fi | |
5284 | ;; |
|
5284 | ;; | |
5285 |
|
5285 | |||
5286 | # :flag.case |
|
5286 | # :flag.case | |
5287 | --auth-token) |
|
5287 | --auth-token) | |
5288 |
|
5288 | |||
5289 | # :flag.case_arg |
|
5289 | # :flag.case_arg | |
5290 | if [[ -n ${2+x} ]]; then |
|
5290 | if [[ -n ${2+x} ]]; then | |
5291 |
|
5291 | |||
5292 | args['--auth-token']="$2" |
|
5292 | args['--auth-token']="$2" | |
5293 | shift |
|
5293 | shift | |
5294 | shift |
|
5294 | shift | |
5295 | else |
|
5295 | else | |
5296 | printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2 |
|
5296 | printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2 | |
5297 | exit 1 |
|
5297 | exit 1 | |
5298 | fi |
|
5298 | fi | |
5299 | ;; |
|
5299 | ;; | |
5300 |
|
5300 | |||
5301 | -?*) |
|
5301 | -?*) | |
5302 | printf "invalid option: %s\n" "$key" >&2 |
|
5302 | printf "invalid option: %s\n" "$key" >&2 | |
5303 | exit 1 |
|
5303 | exit 1 | |
5304 | ;; |
|
5304 | ;; | |
5305 |
|
5305 | |||
5306 | *) |
|
5306 | *) | |
5307 | # :command.parse_requirements_case |
|
5307 | # :command.parse_requirements_case | |
5308 | # :command.parse_requirements_case_simple |
|
5308 | # :command.parse_requirements_case_simple | |
5309 | printf "invalid argument: %s\n" "$key" >&2 |
|
5309 | printf "invalid argument: %s\n" "$key" >&2 | |
5310 | exit 1 |
|
5310 | exit 1 | |
5311 |
|
5311 | |||
5312 | ;; |
|
5312 | ;; | |
5313 |
|
5313 | |||
5314 | esac |
|
5314 | esac | |
5315 | done |
|
5315 | done | |
5316 |
|
5316 | |||
5317 | # :command.default_assignments |
|
5317 | # :command.default_assignments | |
5318 | [[ -n ${args['--docker-revision']:-} ]] || args['--docker-revision']="stable" |
|
5318 | [[ -n ${args['--docker-revision']:-} ]] || args['--docker-revision']="stable" | |
5319 | [[ -n ${args['--server-url']:-} ]] || args['--server-url']="https://dls.rhodecode.com/get_archive" |
|
5319 | [[ -n ${args['--server-url']:-} ]] || args['--server-url']="https://dls.rhodecode.com/get_archive" | |
5320 |
|
5320 | |||
5321 | # :command.whitelist_filter |
|
5321 | # :command.whitelist_filter | |
5322 | if [[ ${args['--arg-rc-edition']} ]] && [[ ! ${args['--arg-rc-edition']} =~ ^(ce|ee)$ ]]; then |
|
5322 | if [[ ${args['--arg-rc-edition']} ]] && [[ ! ${args['--arg-rc-edition']} =~ ^(ce|ee)$ ]]; then | |
5323 | printf "%s\n" "--arg-rc-edition must be one of: ce, ee" >&2 |
|
5323 | printf "%s\n" "--arg-rc-edition must be one of: ce, ee" >&2 | |
5324 | exit 1 |
|
5324 | exit 1 | |
5325 | fi |
|
5325 | fi | |
5326 | if [[ ${args['--arg-database-type']} ]] && [[ ! ${args['--arg-database-type']} =~ ^(postgres|mysql|none)$ ]]; then |
|
5326 | if [[ ${args['--arg-database-type']} ]] && [[ ! ${args['--arg-database-type']} =~ ^(postgres|mysql|none)$ ]]; then | |
5327 | printf "%s\n" "--arg-database-type must be one of: postgres, mysql, none" >&2 |
|
5327 | printf "%s\n" "--arg-database-type must be one of: postgres, mysql, none" >&2 | |
5328 | exit 1 |
|
5328 | exit 1 | |
5329 | fi |
|
5329 | fi | |
5330 | if [[ ${args['--arg-use-ssl']} ]] && [[ ! ${args['--arg-use-ssl']} =~ ^(y|n)$ ]]; then |
|
5330 | if [[ ${args['--arg-use-ssl']} ]] && [[ ! ${args['--arg-use-ssl']} =~ ^(y|n)$ ]]; then | |
5331 | printf "%s\n" "--arg-use-ssl must be one of: y, n" >&2 |
|
5331 | printf "%s\n" "--arg-use-ssl must be one of: y, n" >&2 | |
5332 | exit 1 |
|
5332 | exit 1 | |
5333 | fi |
|
5333 | fi | |
5334 |
|
5334 | |||
5335 | } |
|
5335 | } | |
5336 |
|
5336 | |||
5337 | # :command.parse_requirements |
|
5337 | # :command.parse_requirements | |
5338 | rcstack_self_update_parse_requirements() { |
|
5338 | rcstack_self_update_parse_requirements() { | |
5339 | # :command.fixed_flags_filter |
|
5339 | # :command.fixed_flags_filter | |
5340 | while [[ $# -gt 0 ]]; do |
|
5340 | while [[ $# -gt 0 ]]; do | |
5341 | case "${1:-}" in |
|
5341 | case "${1:-}" in | |
5342 | --help | -h) |
|
5342 | --help | -h) | |
5343 | long_usage=yes |
|
5343 | long_usage=yes | |
5344 | rcstack_self_update_usage |
|
5344 | rcstack_self_update_usage | |
5345 | exit |
|
5345 | exit | |
5346 | ;; |
|
5346 | ;; | |
5347 |
|
5347 | |||
5348 | *) |
|
5348 | *) | |
5349 | break |
|
5349 | break | |
5350 | ;; |
|
5350 | ;; | |
5351 |
|
5351 | |||
5352 | esac |
|
5352 | esac | |
5353 | done |
|
5353 | done | |
5354 |
|
5354 | |||
5355 | # :command.dependencies_filter |
|
5355 | # :command.dependencies_filter | |
5356 | if command -v curl >/dev/null 2>&1; then |
|
5356 | if command -v curl >/dev/null 2>&1; then | |
5357 | deps['curl']="$(command -v curl | head -n1)" |
|
5357 | deps['curl']="$(command -v curl | head -n1)" | |
5358 | else |
|
5358 | else | |
5359 | printf "missing dependency: curl\n" >&2 |
|
5359 | printf "missing dependency: curl\n" >&2 | |
5360 | exit 1 |
|
5360 | exit 1 | |
5361 | fi |
|
5361 | fi | |
5362 |
|
5362 | |||
5363 | if command -v tar >/dev/null 2>&1; then |
|
5363 | if command -v tar >/dev/null 2>&1; then | |
5364 | deps['tar']="$(command -v tar | head -n1)" |
|
5364 | deps['tar']="$(command -v tar | head -n1)" | |
5365 | else |
|
5365 | else | |
5366 | printf "missing dependency: tar\n" >&2 |
|
5366 | printf "missing dependency: tar\n" >&2 | |
5367 | exit 1 |
|
5367 | exit 1 | |
5368 | fi |
|
5368 | fi | |
5369 |
|
5369 | |||
5370 | # :command.command_filter |
|
5370 | # :command.command_filter | |
5371 | action="self-update" |
|
5371 | action="self-update" | |
5372 |
|
5372 | |||
5373 | # :command.parse_requirements_while |
|
5373 | # :command.parse_requirements_while | |
5374 | while [[ $# -gt 0 ]]; do |
|
5374 | while [[ $# -gt 0 ]]; do | |
5375 | key="$1" |
|
5375 | key="$1" | |
5376 | case "$key" in |
|
5376 | case "$key" in | |
5377 | # :flag.case |
|
5377 | # :flag.case | |
5378 | --force) |
|
5378 | --force) | |
5379 |
|
5379 | |||
5380 | # :flag.case_no_arg |
|
5380 | # :flag.case_no_arg | |
5381 | args['--force']=1 |
|
5381 | args['--force']=1 | |
5382 | shift |
|
5382 | shift | |
5383 | ;; |
|
5383 | ;; | |
5384 |
|
5384 | |||
5385 | # :flag.case |
|
5385 | # :flag.case | |
5386 | --update-docker-image) |
|
5386 | --update-docker-image) | |
5387 |
|
5387 | |||
5388 | # :flag.case_arg |
|
5388 | # :flag.case_arg | |
5389 | if [[ -n ${2+x} ]]; then |
|
5389 | if [[ -n ${2+x} ]]; then | |
5390 |
|
5390 | |||
5391 | args['--update-docker-image']="$2" |
|
5391 | args['--update-docker-image']="$2" | |
5392 | shift |
|
5392 | shift | |
5393 | shift |
|
5393 | shift | |
5394 | else |
|
5394 | else | |
5395 | printf "%s\n" "--update-docker-image requires an argument: --update-docker-image UPDATE_DOCKER_IMAGE" >&2 |
|
5395 | printf "%s\n" "--update-docker-image requires an argument: --update-docker-image UPDATE_DOCKER_IMAGE" >&2 | |
5396 | exit 1 |
|
5396 | exit 1 | |
5397 | fi |
|
5397 | fi | |
5398 | ;; |
|
5398 | ;; | |
5399 |
|
5399 | |||
5400 | # :flag.case |
|
5400 | # :flag.case | |
5401 | --cli-file) |
|
5401 | --cli-file) | |
5402 | # :flag.conflicts |
|
5402 | # :flag.conflicts | |
5403 | if [[ -n "${args['--cli-revision']:-}" ]]; then |
|
5403 | if [[ -n "${args['--cli-revision']:-}" ]]; then | |
5404 | printf "conflicting options: %s cannot be used with %s\n" "$key" "--cli-revision" >&2 |
|
5404 | printf "conflicting options: %s cannot be used with %s\n" "$key" "--cli-revision" >&2 | |
5405 | exit 1 |
|
5405 | exit 1 | |
5406 | fi |
|
5406 | fi | |
5407 |
|
5407 | |||
5408 | # :flag.case_arg |
|
5408 | # :flag.case_arg | |
5409 | if [[ -n ${2+x} ]]; then |
|
5409 | if [[ -n ${2+x} ]]; then | |
5410 |
|
5410 | |||
5411 | args['--cli-file']="$2" |
|
5411 | args['--cli-file']="$2" | |
5412 | shift |
|
5412 | shift | |
5413 | shift |
|
5413 | shift | |
5414 | else |
|
5414 | else | |
5415 | printf "%s\n" "--cli-file requires an argument: --cli-file CLI_FILE" >&2 |
|
5415 | printf "%s\n" "--cli-file requires an argument: --cli-file CLI_FILE" >&2 | |
5416 | exit 1 |
|
5416 | exit 1 | |
5417 | fi |
|
5417 | fi | |
5418 | ;; |
|
5418 | ;; | |
5419 |
|
5419 | |||
5420 | # :flag.case |
|
5420 | # :flag.case | |
5421 | --cli-revision) |
|
5421 | --cli-revision) | |
5422 | # :flag.conflicts |
|
5422 | # :flag.conflicts | |
5423 | if [[ -n "${args['--cli-file']:-}" ]]; then |
|
5423 | if [[ -n "${args['--cli-file']:-}" ]]; then | |
5424 | printf "conflicting options: %s cannot be used with %s\n" "$key" "--cli-file" >&2 |
|
5424 | printf "conflicting options: %s cannot be used with %s\n" "$key" "--cli-file" >&2 | |
5425 | exit 1 |
|
5425 | exit 1 | |
5426 | fi |
|
5426 | fi | |
5427 |
|
5427 | |||
5428 | # :flag.case_arg |
|
5428 | # :flag.case_arg | |
5429 | if [[ -n ${2+x} ]]; then |
|
5429 | if [[ -n ${2+x} ]]; then | |
5430 |
|
5430 | |||
5431 | args['--cli-revision']="$2" |
|
5431 | args['--cli-revision']="$2" | |
5432 | shift |
|
5432 | shift | |
5433 | shift |
|
5433 | shift | |
5434 | else |
|
5434 | else | |
5435 | printf "%s\n" "--cli-revision requires an argument: --cli-revision CLI_REVISION" >&2 |
|
5435 | printf "%s\n" "--cli-revision requires an argument: --cli-revision CLI_REVISION" >&2 | |
5436 | exit 1 |
|
5436 | exit 1 | |
5437 | fi |
|
5437 | fi | |
5438 | ;; |
|
5438 | ;; | |
5439 |
|
5439 | |||
5440 | # :flag.case |
|
5440 | # :flag.case | |
5441 | --docker-revision) |
|
5441 | --docker-revision) | |
5442 |
|
5442 | |||
5443 | # :flag.case_arg |
|
5443 | # :flag.case_arg | |
5444 | if [[ -n ${2+x} ]]; then |
|
5444 | if [[ -n ${2+x} ]]; then | |
5445 |
|
5445 | |||
5446 | args['--docker-revision']="$2" |
|
5446 | args['--docker-revision']="$2" | |
5447 | shift |
|
5447 | shift | |
5448 | shift |
|
5448 | shift | |
5449 | else |
|
5449 | else | |
5450 | printf "%s\n" "--docker-revision requires an argument: --docker-revision DOCKER_REVISION" >&2 |
|
5450 | printf "%s\n" "--docker-revision requires an argument: --docker-revision DOCKER_REVISION" >&2 | |
5451 | exit 1 |
|
5451 | exit 1 | |
5452 | fi |
|
5452 | fi | |
5453 | ;; |
|
5453 | ;; | |
5454 |
|
5454 | |||
5455 | # :flag.case |
|
5455 | # :flag.case | |
5456 | --server-url) |
|
5456 | --server-url) | |
5457 |
|
5457 | |||
5458 | # :flag.case_arg |
|
5458 | # :flag.case_arg | |
5459 | if [[ -n ${2+x} ]]; then |
|
5459 | if [[ -n ${2+x} ]]; then | |
5460 |
|
5460 | |||
5461 | args['--server-url']="$2" |
|
5461 | args['--server-url']="$2" | |
5462 | shift |
|
5462 | shift | |
5463 | shift |
|
5463 | shift | |
5464 | else |
|
5464 | else | |
5465 | printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2 |
|
5465 | printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2 | |
5466 | exit 1 |
|
5466 | exit 1 | |
5467 | fi |
|
5467 | fi | |
5468 | ;; |
|
5468 | ;; | |
5469 |
|
5469 | |||
5470 | # :flag.case |
|
5470 | # :flag.case | |
5471 | --auth-token) |
|
5471 | --auth-token) | |
5472 |
|
5472 | |||
5473 | # :flag.case_arg |
|
5473 | # :flag.case_arg | |
5474 | if [[ -n ${2+x} ]]; then |
|
5474 | if [[ -n ${2+x} ]]; then | |
5475 |
|
5475 | |||
5476 | args['--auth-token']="$2" |
|
5476 | args['--auth-token']="$2" | |
5477 | shift |
|
5477 | shift | |
5478 | shift |
|
5478 | shift | |
5479 | else |
|
5479 | else | |
5480 | printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2 |
|
5480 | printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2 | |
5481 | exit 1 |
|
5481 | exit 1 | |
5482 | fi |
|
5482 | fi | |
5483 | ;; |
|
5483 | ;; | |
5484 |
|
5484 | |||
5485 | -?*) |
|
5485 | -?*) | |
5486 | printf "invalid option: %s\n" "$key" >&2 |
|
5486 | printf "invalid option: %s\n" "$key" >&2 | |
5487 | exit 1 |
|
5487 | exit 1 | |
5488 | ;; |
|
5488 | ;; | |
5489 |
|
5489 | |||
5490 | *) |
|
5490 | *) | |
5491 | # :command.parse_requirements_case |
|
5491 | # :command.parse_requirements_case | |
5492 | # :command.parse_requirements_case_simple |
|
5492 | # :command.parse_requirements_case_simple | |
5493 | printf "invalid argument: %s\n" "$key" >&2 |
|
5493 | printf "invalid argument: %s\n" "$key" >&2 | |
5494 | exit 1 |
|
5494 | exit 1 | |
5495 |
|
5495 | |||
5496 | ;; |
|
5496 | ;; | |
5497 |
|
5497 | |||
5498 | esac |
|
5498 | esac | |
5499 | done |
|
5499 | done | |
5500 |
|
5500 | |||
5501 | # :command.default_assignments |
|
5501 | # :command.default_assignments | |
5502 | [[ -n ${args['--cli-revision']:-} ]] || args['--cli-revision']="stable" |
|
5502 | [[ -n ${args['--cli-revision']:-} ]] || args['--cli-revision']="stable" | |
5503 | [[ -n ${args['--docker-revision']:-} ]] || args['--docker-revision']="stable" |
|
5503 | [[ -n ${args['--docker-revision']:-} ]] || args['--docker-revision']="stable" | |
5504 | [[ -n ${args['--server-url']:-} ]] || args['--server-url']="https://dls.rhodecode.com/get_archive" |
|
5504 | [[ -n ${args['--server-url']:-} ]] || args['--server-url']="https://dls.rhodecode.com/get_archive" | |
5505 |
|
5505 | |||
5506 | } |
|
5506 | } | |
5507 |
|
5507 | |||
5508 | # :command.parse_requirements |
|
5508 | # :command.parse_requirements | |
5509 | rcstack_self_upgrade_parse_requirements() { |
|
5509 | rcstack_self_upgrade_parse_requirements() { | |
5510 | # :command.fixed_flags_filter |
|
5510 | # :command.fixed_flags_filter | |
5511 | while [[ $# -gt 0 ]]; do |
|
5511 | while [[ $# -gt 0 ]]; do | |
5512 | case "${1:-}" in |
|
5512 | case "${1:-}" in | |
5513 | --help | -h) |
|
5513 | --help | -h) | |
5514 | long_usage=yes |
|
5514 | long_usage=yes | |
5515 | rcstack_self_upgrade_usage |
|
5515 | rcstack_self_upgrade_usage | |
5516 | exit |
|
5516 | exit | |
5517 | ;; |
|
5517 | ;; | |
5518 |
|
5518 | |||
5519 | *) |
|
5519 | *) | |
5520 | break |
|
5520 | break | |
5521 | ;; |
|
5521 | ;; | |
5522 |
|
5522 | |||
5523 | esac |
|
5523 | esac | |
5524 | done |
|
5524 | done | |
5525 |
|
5525 | |||
5526 | # :command.dependencies_filter |
|
5526 | # :command.dependencies_filter | |
5527 | if command -v curl >/dev/null 2>&1; then |
|
5527 | if command -v curl >/dev/null 2>&1; then | |
5528 | deps['curl']="$(command -v curl | head -n1)" |
|
5528 | deps['curl']="$(command -v curl | head -n1)" | |
5529 | else |
|
5529 | else | |
5530 | printf "missing dependency: curl\n" >&2 |
|
5530 | printf "missing dependency: curl\n" >&2 | |
5531 | exit 1 |
|
5531 | exit 1 | |
5532 | fi |
|
5532 | fi | |
5533 |
|
5533 | |||
5534 | if command -v tar >/dev/null 2>&1; then |
|
5534 | if command -v tar >/dev/null 2>&1; then | |
5535 | deps['tar']="$(command -v tar | head -n1)" |
|
5535 | deps['tar']="$(command -v tar | head -n1)" | |
5536 | else |
|
5536 | else | |
5537 | printf "missing dependency: tar\n" >&2 |
|
5537 | printf "missing dependency: tar\n" >&2 | |
5538 | exit 1 |
|
5538 | exit 1 | |
5539 | fi |
|
5539 | fi | |
5540 |
|
5540 | |||
5541 | # :command.command_filter |
|
5541 | # :command.command_filter | |
5542 | action="self-upgrade" |
|
5542 | action="self-upgrade" | |
5543 |
|
5543 | |||
5544 | # :command.parse_requirements_while |
|
5544 | # :command.parse_requirements_while | |
5545 | while [[ $# -gt 0 ]]; do |
|
5545 | while [[ $# -gt 0 ]]; do | |
5546 | key="$1" |
|
5546 | key="$1" | |
5547 | case "$key" in |
|
5547 | case "$key" in | |
5548 | # :flag.case |
|
5548 | # :flag.case | |
5549 | --from-ver) |
|
5549 | --from-ver) | |
5550 |
|
5550 | |||
5551 | # :flag.case_arg |
|
5551 | # :flag.case_arg | |
5552 | if [[ -n ${2+x} ]]; then |
|
5552 | if [[ -n ${2+x} ]]; then | |
5553 |
|
5553 | |||
5554 | args['--from-ver']="$2" |
|
5554 | args['--from-ver']="$2" | |
5555 | shift |
|
5555 | shift | |
5556 | shift |
|
5556 | shift | |
5557 | else |
|
5557 | else | |
5558 | printf "%s\n" "--from-ver requires an argument: --from-ver FROM_VER" >&2 |
|
5558 | printf "%s\n" "--from-ver requires an argument: --from-ver FROM_VER" >&2 | |
5559 | exit 1 |
|
5559 | exit 1 | |
5560 | fi |
|
5560 | fi | |
5561 | ;; |
|
5561 | ;; | |
5562 |
|
5562 | |||
5563 | # :flag.case |
|
5563 | # :flag.case | |
5564 | --to-ver) |
|
5564 | --to-ver) | |
5565 |
|
5565 | |||
5566 | # :flag.case_arg |
|
5566 | # :flag.case_arg | |
5567 | if [[ -n ${2+x} ]]; then |
|
5567 | if [[ -n ${2+x} ]]; then | |
5568 |
|
5568 | |||
5569 | args['--to-ver']="$2" |
|
5569 | args['--to-ver']="$2" | |
5570 | shift |
|
5570 | shift | |
5571 | shift |
|
5571 | shift | |
5572 | else |
|
5572 | else | |
5573 | printf "%s\n" "--to-ver requires an argument: --to-ver TO_VER" >&2 |
|
5573 | printf "%s\n" "--to-ver requires an argument: --to-ver TO_VER" >&2 | |
5574 | exit 1 |
|
5574 | exit 1 | |
5575 | fi |
|
5575 | fi | |
5576 | ;; |
|
5576 | ;; | |
5577 |
|
5577 | |||
5578 | -?*) |
|
5578 | -?*) | |
5579 | printf "invalid option: %s\n" "$key" >&2 |
|
5579 | printf "invalid option: %s\n" "$key" >&2 | |
5580 | exit 1 |
|
5580 | exit 1 | |
5581 | ;; |
|
5581 | ;; | |
5582 |
|
5582 | |||
5583 | *) |
|
5583 | *) | |
5584 | # :command.parse_requirements_case |
|
5584 | # :command.parse_requirements_case | |
5585 | # :command.parse_requirements_case_simple |
|
5585 | # :command.parse_requirements_case_simple | |
5586 | printf "invalid argument: %s\n" "$key" >&2 |
|
5586 | printf "invalid argument: %s\n" "$key" >&2 | |
5587 | exit 1 |
|
5587 | exit 1 | |
5588 |
|
5588 | |||
5589 | ;; |
|
5589 | ;; | |
5590 |
|
5590 | |||
5591 | esac |
|
5591 | esac | |
5592 | done |
|
5592 | done | |
5593 |
|
5593 | |||
5594 | } |
|
5594 | } | |
5595 |
|
5595 | |||
5596 | # :command.parse_requirements |
|
5596 | # :command.parse_requirements | |
5597 | rcstack_stack_parse_requirements() { |
|
5597 | rcstack_stack_parse_requirements() { | |
5598 | # :command.fixed_flags_filter |
|
5598 | # :command.fixed_flags_filter | |
5599 | while [[ $# -gt 0 ]]; do |
|
5599 | while [[ $# -gt 0 ]]; do | |
5600 | case "${1:-}" in |
|
5600 | case "${1:-}" in | |
5601 | --help | -h) |
|
5601 | --help | -h) | |
5602 | long_usage=yes |
|
5602 | long_usage=yes | |
5603 | rcstack_stack_usage |
|
5603 | rcstack_stack_usage | |
5604 | exit |
|
5604 | exit | |
5605 | ;; |
|
5605 | ;; | |
5606 |
|
5606 | |||
5607 | # :flag.case |
|
5607 | # :flag.case | |
5608 | --env-file-path) |
|
5608 | --env-file-path) | |
5609 |
|
5609 | |||
5610 | # :flag.case_arg |
|
5610 | # :flag.case_arg | |
5611 | if [[ -n ${2+x} ]]; then |
|
5611 | if [[ -n ${2+x} ]]; then | |
5612 | # :flag.validations |
|
5612 | # :flag.validations | |
5613 | if [[ -n $(validate_file_exists "$2") ]]; then |
|
5613 | if [[ -n $(validate_file_exists "$2") ]]; then | |
5614 | printf "validation error in %s:\n%s\n" "--env-file-path ENV_FILE_PATH" "$(validate_file_exists "$2")" >&2 |
|
5614 | printf "validation error in %s:\n%s\n" "--env-file-path ENV_FILE_PATH" "$(validate_file_exists "$2")" >&2 | |
5615 | exit 1 |
|
5615 | exit 1 | |
5616 | fi |
|
5616 | fi | |
5617 |
|
5617 | |||
5618 | args['--env-file-path']="$2" |
|
5618 | args['--env-file-path']="$2" | |
5619 | shift |
|
5619 | shift | |
5620 | shift |
|
5620 | shift | |
5621 | else |
|
5621 | else | |
5622 | printf "%s\n" "--env-file-path requires an argument: --env-file-path ENV_FILE_PATH" >&2 |
|
5622 | printf "%s\n" "--env-file-path requires an argument: --env-file-path ENV_FILE_PATH" >&2 | |
5623 | exit 1 |
|
5623 | exit 1 | |
5624 | fi |
|
5624 | fi | |
5625 | ;; |
|
5625 | ;; | |
5626 |
|
5626 | |||
5627 | # :flag.case |
|
5627 | # :flag.case | |
5628 | --stack-prefix) |
|
5628 | --stack-prefix) | |
5629 |
|
5629 | |||
5630 | # :flag.case_arg |
|
5630 | # :flag.case_arg | |
5631 | if [[ -n ${2+x} ]]; then |
|
5631 | if [[ -n ${2+x} ]]; then | |
5632 |
|
5632 | |||
5633 | args['--stack-prefix']="$2" |
|
5633 | args['--stack-prefix']="$2" | |
5634 | shift |
|
5634 | shift | |
5635 | shift |
|
5635 | shift | |
5636 | else |
|
5636 | else | |
5637 | printf "%s\n" "--stack-prefix requires an argument: --stack-prefix STACK_PREFIX" >&2 |
|
5637 | printf "%s\n" "--stack-prefix requires an argument: --stack-prefix STACK_PREFIX" >&2 | |
5638 | exit 1 |
|
5638 | exit 1 | |
5639 | fi |
|
5639 | fi | |
5640 | ;; |
|
5640 | ;; | |
5641 |
|
5641 | |||
5642 | *) |
|
5642 | *) | |
5643 | break |
|
5643 | break | |
5644 | ;; |
|
5644 | ;; | |
5645 |
|
5645 | |||
5646 | esac |
|
5646 | esac | |
5647 | done |
|
5647 | done | |
5648 |
|
5648 | |||
5649 | # :command.command_filter |
|
5649 | # :command.command_filter | |
5650 | action=${1:-} |
|
5650 | action=${1:-} | |
5651 |
|
5651 | |||
5652 | case $action in |
|
5652 | case $action in | |
5653 | -*) ;; |
|
5653 | -*) ;; | |
5654 |
|
5654 | |||
5655 | router) |
|
5655 | router) | |
5656 | action="router" |
|
5656 | action="router" | |
5657 | shift |
|
5657 | shift | |
5658 | rcstack_stack_router_parse_requirements "$@" |
|
5658 | rcstack_stack_router_parse_requirements "$@" | |
5659 | shift $# |
|
5659 | shift $# | |
5660 | ;; |
|
5660 | ;; | |
5661 |
|
5661 | |||
5662 | metrics) |
|
5662 | metrics) | |
5663 | action="metrics" |
|
5663 | action="metrics" | |
5664 | shift |
|
5664 | shift | |
5665 | rcstack_stack_metrics_parse_requirements "$@" |
|
5665 | rcstack_stack_metrics_parse_requirements "$@" | |
5666 | shift $# |
|
5666 | shift $# | |
5667 | ;; |
|
5667 | ;; | |
5668 |
|
5668 | |||
5669 | services) |
|
5669 | services) | |
5670 | action="services" |
|
5670 | action="services" | |
5671 | shift |
|
5671 | shift | |
5672 | rcstack_stack_services_parse_requirements "$@" |
|
5672 | rcstack_stack_services_parse_requirements "$@" | |
5673 | shift $# |
|
5673 | shift $# | |
5674 | ;; |
|
5674 | ;; | |
5675 |
|
5675 | |||
5676 | rhodecode) |
|
5676 | rhodecode) | |
5677 | action="rhodecode" |
|
5677 | action="rhodecode" | |
5678 | shift |
|
5678 | shift | |
5679 | rcstack_stack_rhodecode_parse_requirements "$@" |
|
5679 | rcstack_stack_rhodecode_parse_requirements "$@" | |
5680 | shift $# |
|
5680 | shift $# | |
5681 | ;; |
|
5681 | ;; | |
5682 |
|
5682 | |||
5683 | all) |
|
5683 | all) | |
5684 | action="all" |
|
5684 | action="all" | |
5685 | shift |
|
5685 | shift | |
5686 | rcstack_stack_all_parse_requirements "$@" |
|
5686 | rcstack_stack_all_parse_requirements "$@" | |
5687 | shift $# |
|
5687 | shift $# | |
5688 | ;; |
|
5688 | ;; | |
5689 |
|
5689 | |||
5690 | # :command.command_fallback |
|
5690 | # :command.command_fallback | |
5691 | "") |
|
5691 | "") | |
5692 | rcstack_stack_usage >&2 |
|
5692 | rcstack_stack_usage >&2 | |
5693 | exit 1 |
|
5693 | exit 1 | |
5694 | ;; |
|
5694 | ;; | |
5695 |
|
5695 | |||
5696 | *) |
|
5696 | *) | |
5697 | printf "invalid command: %s\n" "$action" >&2 |
|
5697 | printf "invalid command: %s\n" "$action" >&2 | |
5698 | exit 1 |
|
5698 | exit 1 | |
5699 | ;; |
|
5699 | ;; | |
5700 |
|
5700 | |||
5701 | esac |
|
5701 | esac | |
5702 |
|
5702 | |||
5703 | # :command.parse_requirements_while |
|
5703 | # :command.parse_requirements_while | |
5704 | while [[ $# -gt 0 ]]; do |
|
5704 | while [[ $# -gt 0 ]]; do | |
5705 | key="$1" |
|
5705 | key="$1" | |
5706 | case "$key" in |
|
5706 | case "$key" in | |
5707 |
|
5707 | |||
5708 | -?*) |
|
5708 | -?*) | |
5709 | printf "invalid option: %s\n" "$key" >&2 |
|
5709 | printf "invalid option: %s\n" "$key" >&2 | |
5710 | exit 1 |
|
5710 | exit 1 | |
5711 | ;; |
|
5711 | ;; | |
5712 |
|
5712 | |||
5713 | *) |
|
5713 | *) | |
5714 | # :command.parse_requirements_case |
|
5714 | # :command.parse_requirements_case | |
5715 | # :command.parse_requirements_case_simple |
|
5715 | # :command.parse_requirements_case_simple | |
5716 | printf "invalid argument: %s\n" "$key" >&2 |
|
5716 | printf "invalid argument: %s\n" "$key" >&2 | |
5717 | exit 1 |
|
5717 | exit 1 | |
5718 |
|
5718 | |||
5719 | ;; |
|
5719 | ;; | |
5720 |
|
5720 | |||
5721 | esac |
|
5721 | esac | |
5722 | done |
|
5722 | done | |
5723 |
|
5723 | |||
5724 | # :command.default_assignments |
|
5724 | # :command.default_assignments | |
5725 | [[ -n ${args['--env-file-path']:-} ]] || args['--env-file-path']="$PWD/.custom/.runtime.env" |
|
5725 | [[ -n ${args['--env-file-path']:-} ]] || args['--env-file-path']="$PWD/.custom/.runtime.env" | |
5726 |
|
5726 | |||
5727 | } |
|
5727 | } | |
5728 |
|
5728 | |||
5729 | # :command.parse_requirements |
|
5729 | # :command.parse_requirements | |
5730 | rcstack_stack_router_parse_requirements() { |
|
5730 | rcstack_stack_router_parse_requirements() { | |
5731 | # :command.fixed_flags_filter |
|
5731 | # :command.fixed_flags_filter | |
5732 | while [[ $# -gt 0 ]]; do |
|
5732 | while [[ $# -gt 0 ]]; do | |
5733 | case "${1:-}" in |
|
5733 | case "${1:-}" in | |
5734 | --help | -h) |
|
5734 | --help | -h) | |
5735 | long_usage=yes |
|
5735 | long_usage=yes | |
5736 | rcstack_stack_router_usage |
|
5736 | rcstack_stack_router_usage | |
5737 | exit |
|
5737 | exit | |
5738 | ;; |
|
5738 | ;; | |
5739 |
|
5739 | |||
5740 | *) |
|
5740 | *) | |
5741 | break |
|
5741 | break | |
5742 | ;; |
|
5742 | ;; | |
5743 |
|
5743 | |||
5744 | esac |
|
5744 | esac | |
5745 | done |
|
5745 | done | |
5746 |
|
5746 | |||
5747 | # :command.command_filter |
|
5747 | # :command.command_filter | |
5748 | action="stack router" |
|
5748 | action="stack router" | |
5749 |
|
5749 | |||
5750 | # :command.parse_requirements_while |
|
5750 | # :command.parse_requirements_while | |
5751 | while [[ $# -gt 0 ]]; do |
|
5751 | while [[ $# -gt 0 ]]; do | |
5752 | key="$1" |
|
5752 | key="$1" | |
5753 | case "$key" in |
|
5753 | case "$key" in | |
5754 |
|
5754 | |||
5755 | --) |
|
5755 | --) | |
5756 | shift |
|
5756 | shift | |
5757 | other_args+=("$@") |
|
5757 | other_args+=("$@") | |
5758 | break |
|
5758 | break | |
5759 | ;; |
|
5759 | ;; | |
5760 |
|
5760 | |||
5761 | -?*) |
|
5761 | -?*) | |
5762 | other_args+=("$1") |
|
5762 | other_args+=("$1") | |
5763 | shift |
|
5763 | shift | |
5764 | ;; |
|
5764 | ;; | |
5765 |
|
5765 | |||
5766 | *) |
|
5766 | *) | |
5767 | # :command.parse_requirements_case |
|
5767 | # :command.parse_requirements_case | |
5768 | # :command.parse_requirements_case_catch_all |
|
5768 | # :command.parse_requirements_case_catch_all | |
5769 | other_args+=("$1") |
|
5769 | other_args+=("$1") | |
5770 | shift |
|
5770 | shift | |
5771 |
|
5771 | |||
5772 | ;; |
|
5772 | ;; | |
5773 |
|
5773 | |||
5774 | esac |
|
5774 | esac | |
5775 | done |
|
5775 | done | |
5776 |
|
5776 | |||
5777 | } |
|
5777 | } | |
5778 |
|
5778 | |||
5779 | # :command.parse_requirements |
|
5779 | # :command.parse_requirements | |
5780 | rcstack_stack_metrics_parse_requirements() { |
|
5780 | rcstack_stack_metrics_parse_requirements() { | |
5781 | # :command.fixed_flags_filter |
|
5781 | # :command.fixed_flags_filter | |
5782 | while [[ $# -gt 0 ]]; do |
|
5782 | while [[ $# -gt 0 ]]; do | |
5783 | case "${1:-}" in |
|
5783 | case "${1:-}" in | |
5784 | --help | -h) |
|
5784 | --help | -h) | |
5785 | long_usage=yes |
|
5785 | long_usage=yes | |
5786 | rcstack_stack_metrics_usage |
|
5786 | rcstack_stack_metrics_usage | |
5787 | exit |
|
5787 | exit | |
5788 | ;; |
|
5788 | ;; | |
5789 |
|
5789 | |||
5790 | *) |
|
5790 | *) | |
5791 | break |
|
5791 | break | |
5792 | ;; |
|
5792 | ;; | |
5793 |
|
5793 | |||
5794 | esac |
|
5794 | esac | |
5795 | done |
|
5795 | done | |
5796 |
|
5796 | |||
5797 | # :command.command_filter |
|
5797 | # :command.command_filter | |
5798 | action="stack metrics" |
|
5798 | action="stack metrics" | |
5799 |
|
5799 | |||
5800 | # :command.parse_requirements_while |
|
5800 | # :command.parse_requirements_while | |
5801 | while [[ $# -gt 0 ]]; do |
|
5801 | while [[ $# -gt 0 ]]; do | |
5802 | key="$1" |
|
5802 | key="$1" | |
5803 | case "$key" in |
|
5803 | case "$key" in | |
5804 |
|
5804 | |||
5805 | --) |
|
5805 | --) | |
5806 | shift |
|
5806 | shift | |
5807 | other_args+=("$@") |
|
5807 | other_args+=("$@") | |
5808 | break |
|
5808 | break | |
5809 | ;; |
|
5809 | ;; | |
5810 |
|
5810 | |||
5811 | -?*) |
|
5811 | -?*) | |
5812 | other_args+=("$1") |
|
5812 | other_args+=("$1") | |
5813 | shift |
|
5813 | shift | |
5814 | ;; |
|
5814 | ;; | |
5815 |
|
5815 | |||
5816 | *) |
|
5816 | *) | |
5817 | # :command.parse_requirements_case |
|
5817 | # :command.parse_requirements_case | |
5818 | # :command.parse_requirements_case_catch_all |
|
5818 | # :command.parse_requirements_case_catch_all | |
5819 | other_args+=("$1") |
|
5819 | other_args+=("$1") | |
5820 | shift |
|
5820 | shift | |
5821 |
|
5821 | |||
5822 | ;; |
|
5822 | ;; | |
5823 |
|
5823 | |||
5824 | esac |
|
5824 | esac | |
5825 | done |
|
5825 | done | |
5826 |
|
5826 | |||
5827 | } |
|
5827 | } | |
5828 |
|
5828 | |||
5829 | # :command.parse_requirements |
|
5829 | # :command.parse_requirements | |
5830 | rcstack_stack_services_parse_requirements() { |
|
5830 | rcstack_stack_services_parse_requirements() { | |
5831 | # :command.fixed_flags_filter |
|
5831 | # :command.fixed_flags_filter | |
5832 | while [[ $# -gt 0 ]]; do |
|
5832 | while [[ $# -gt 0 ]]; do | |
5833 | case "${1:-}" in |
|
5833 | case "${1:-}" in | |
5834 | --help | -h) |
|
5834 | --help | -h) | |
5835 | long_usage=yes |
|
5835 | long_usage=yes | |
5836 | rcstack_stack_services_usage |
|
5836 | rcstack_stack_services_usage | |
5837 | exit |
|
5837 | exit | |
5838 | ;; |
|
5838 | ;; | |
5839 |
|
5839 | |||
5840 | *) |
|
5840 | *) | |
5841 | break |
|
5841 | break | |
5842 | ;; |
|
5842 | ;; | |
5843 |
|
5843 | |||
5844 | esac |
|
5844 | esac | |
5845 | done |
|
5845 | done | |
5846 |
|
5846 | |||
5847 | # :command.command_filter |
|
5847 | # :command.command_filter | |
5848 | action="stack services" |
|
5848 | action="stack services" | |
5849 |
|
5849 | |||
5850 | # :command.parse_requirements_while |
|
5850 | # :command.parse_requirements_while | |
5851 | while [[ $# -gt 0 ]]; do |
|
5851 | while [[ $# -gt 0 ]]; do | |
5852 | key="$1" |
|
5852 | key="$1" | |
5853 | case "$key" in |
|
5853 | case "$key" in | |
5854 |
|
5854 | |||
5855 | --) |
|
5855 | --) | |
5856 | shift |
|
5856 | shift | |
5857 | other_args+=("$@") |
|
5857 | other_args+=("$@") | |
5858 | break |
|
5858 | break | |
5859 | ;; |
|
5859 | ;; | |
5860 |
|
5860 | |||
5861 | -?*) |
|
5861 | -?*) | |
5862 | other_args+=("$1") |
|
5862 | other_args+=("$1") | |
5863 | shift |
|
5863 | shift | |
5864 | ;; |
|
5864 | ;; | |
5865 |
|
5865 | |||
5866 | *) |
|
5866 | *) | |
5867 | # :command.parse_requirements_case |
|
5867 | # :command.parse_requirements_case | |
5868 | # :command.parse_requirements_case_catch_all |
|
5868 | # :command.parse_requirements_case_catch_all | |
5869 | other_args+=("$1") |
|
5869 | other_args+=("$1") | |
5870 | shift |
|
5870 | shift | |
5871 |
|
5871 | |||
5872 | ;; |
|
5872 | ;; | |
5873 |
|
5873 | |||
5874 | esac |
|
5874 | esac | |
5875 | done |
|
5875 | done | |
5876 |
|
5876 | |||
5877 | } |
|
5877 | } | |
5878 |
|
5878 | |||
5879 | # :command.parse_requirements |
|
5879 | # :command.parse_requirements | |
5880 | rcstack_stack_rhodecode_parse_requirements() { |
|
5880 | rcstack_stack_rhodecode_parse_requirements() { | |
5881 | # :command.fixed_flags_filter |
|
5881 | # :command.fixed_flags_filter | |
5882 | while [[ $# -gt 0 ]]; do |
|
5882 | while [[ $# -gt 0 ]]; do | |
5883 | case "${1:-}" in |
|
5883 | case "${1:-}" in | |
5884 | --help | -h) |
|
5884 | --help | -h) | |
5885 | long_usage=yes |
|
5885 | long_usage=yes | |
5886 | rcstack_stack_rhodecode_usage |
|
5886 | rcstack_stack_rhodecode_usage | |
5887 | exit |
|
5887 | exit | |
5888 | ;; |
|
5888 | ;; | |
5889 |
|
5889 | |||
5890 | *) |
|
5890 | *) | |
5891 | break |
|
5891 | break | |
5892 | ;; |
|
5892 | ;; | |
5893 |
|
5893 | |||
5894 | esac |
|
5894 | esac | |
5895 | done |
|
5895 | done | |
5896 |
|
5896 | |||
5897 | # :command.command_filter |
|
5897 | # :command.command_filter | |
5898 | action="stack rhodecode" |
|
5898 | action="stack rhodecode" | |
5899 |
|
5899 | |||
5900 | # :command.parse_requirements_while |
|
5900 | # :command.parse_requirements_while | |
5901 | while [[ $# -gt 0 ]]; do |
|
5901 | while [[ $# -gt 0 ]]; do | |
5902 | key="$1" |
|
5902 | key="$1" | |
5903 | case "$key" in |
|
5903 | case "$key" in | |
5904 |
|
5904 | |||
5905 | --) |
|
5905 | --) | |
5906 | shift |
|
5906 | shift | |
5907 | other_args+=("$@") |
|
5907 | other_args+=("$@") | |
5908 | break |
|
5908 | break | |
5909 | ;; |
|
5909 | ;; | |
5910 |
|
5910 | |||
5911 | -?*) |
|
5911 | -?*) | |
5912 | other_args+=("$1") |
|
5912 | other_args+=("$1") | |
5913 | shift |
|
5913 | shift | |
5914 | ;; |
|
5914 | ;; | |
5915 |
|
5915 | |||
5916 | *) |
|
5916 | *) | |
5917 | # :command.parse_requirements_case |
|
5917 | # :command.parse_requirements_case | |
5918 | # :command.parse_requirements_case_catch_all |
|
5918 | # :command.parse_requirements_case_catch_all | |
5919 | other_args+=("$1") |
|
5919 | other_args+=("$1") | |
5920 | shift |
|
5920 | shift | |
5921 |
|
5921 | |||
5922 | ;; |
|
5922 | ;; | |
5923 |
|
5923 | |||
5924 | esac |
|
5924 | esac | |
5925 | done |
|
5925 | done | |
5926 |
|
5926 | |||
5927 | } |
|
5927 | } | |
5928 |
|
5928 | |||
5929 | # :command.parse_requirements |
|
5929 | # :command.parse_requirements | |
5930 | rcstack_stack_all_parse_requirements() { |
|
5930 | rcstack_stack_all_parse_requirements() { | |
5931 | # :command.fixed_flags_filter |
|
5931 | # :command.fixed_flags_filter | |
5932 | while [[ $# -gt 0 ]]; do |
|
5932 | while [[ $# -gt 0 ]]; do | |
5933 | case "${1:-}" in |
|
5933 | case "${1:-}" in | |
5934 | --help | -h) |
|
5934 | --help | -h) | |
5935 | long_usage=yes |
|
5935 | long_usage=yes | |
5936 | rcstack_stack_all_usage |
|
5936 | rcstack_stack_all_usage | |
5937 | exit |
|
5937 | exit | |
5938 | ;; |
|
5938 | ;; | |
5939 |
|
5939 | |||
5940 | *) |
|
5940 | *) | |
5941 | break |
|
5941 | break | |
5942 | ;; |
|
5942 | ;; | |
5943 |
|
5943 | |||
5944 | esac |
|
5944 | esac | |
5945 | done |
|
5945 | done | |
5946 |
|
5946 | |||
5947 | # :command.command_filter |
|
5947 | # :command.command_filter | |
5948 | action="stack all" |
|
5948 | action="stack all" | |
5949 |
|
5949 | |||
5950 | # :command.parse_requirements_while |
|
5950 | # :command.parse_requirements_while | |
5951 | while [[ $# -gt 0 ]]; do |
|
5951 | while [[ $# -gt 0 ]]; do | |
5952 | key="$1" |
|
5952 | key="$1" | |
5953 | case "$key" in |
|
5953 | case "$key" in | |
5954 |
|
5954 | |||
5955 | --) |
|
5955 | --) | |
5956 | shift |
|
5956 | shift | |
5957 | other_args+=("$@") |
|
5957 | other_args+=("$@") | |
5958 | break |
|
5958 | break | |
5959 | ;; |
|
5959 | ;; | |
5960 |
|
5960 | |||
5961 | -?*) |
|
5961 | -?*) | |
5962 | other_args+=("$1") |
|
5962 | other_args+=("$1") | |
5963 | shift |
|
5963 | shift | |
5964 | ;; |
|
5964 | ;; | |
5965 |
|
5965 | |||
5966 | *) |
|
5966 | *) | |
5967 | # :command.parse_requirements_case |
|
5967 | # :command.parse_requirements_case | |
5968 | # :command.parse_requirements_case_catch_all |
|
5968 | # :command.parse_requirements_case_catch_all | |
5969 | other_args+=("$1") |
|
5969 | other_args+=("$1") | |
5970 | shift |
|
5970 | shift | |
5971 |
|
5971 | |||
5972 | ;; |
|
5972 | ;; | |
5973 |
|
5973 | |||
5974 | esac |
|
5974 | esac | |
5975 | done |
|
5975 | done | |
5976 |
|
5976 | |||
5977 | } |
|
5977 | } | |
5978 |
|
5978 | |||
5979 | # :command.parse_requirements |
|
5979 | # :command.parse_requirements | |
5980 | rcstack_stack_status_parse_requirements() { |
|
5980 | rcstack_stack_status_parse_requirements() { | |
5981 | # :command.fixed_flags_filter |
|
5981 | # :command.fixed_flags_filter | |
5982 | while [[ $# -gt 0 ]]; do |
|
5982 | while [[ $# -gt 0 ]]; do | |
5983 | case "${1:-}" in |
|
5983 | case "${1:-}" in | |
5984 | --help | -h) |
|
5984 | --help | -h) | |
5985 | long_usage=yes |
|
5985 | long_usage=yes | |
5986 | rcstack_stack_status_usage |
|
5986 | rcstack_stack_status_usage | |
5987 | exit |
|
5987 | exit | |
5988 | ;; |
|
5988 | ;; | |
5989 |
|
5989 | |||
5990 | *) |
|
5990 | *) | |
5991 | break |
|
5991 | break | |
5992 | ;; |
|
5992 | ;; | |
5993 |
|
5993 | |||
5994 | esac |
|
5994 | esac | |
5995 | done |
|
5995 | done | |
5996 |
|
5996 | |||
5997 | # :command.command_filter |
|
5997 | # :command.command_filter | |
5998 | action="stack-status" |
|
5998 | action="stack-status" | |
5999 |
|
5999 | |||
6000 | # :command.parse_requirements_while |
|
6000 | # :command.parse_requirements_while | |
6001 | while [[ $# -gt 0 ]]; do |
|
6001 | while [[ $# -gt 0 ]]; do | |
6002 | key="$1" |
|
6002 | key="$1" | |
6003 | case "$key" in |
|
6003 | case "$key" in | |
6004 | # :flag.case |
|
6004 | # :flag.case | |
6005 | --detailed) |
|
6005 | --detailed) | |
6006 |
|
6006 | |||
6007 | # :flag.case_no_arg |
|
6007 | # :flag.case_no_arg | |
6008 | args['--detailed']=1 |
|
6008 | args['--detailed']=1 | |
6009 | shift |
|
6009 | shift | |
6010 | ;; |
|
6010 | ;; | |
6011 |
|
6011 | |||
6012 | # :flag.case |
|
6012 | # :flag.case | |
6013 | --configs | -c) |
|
6013 | --configs | -c) | |
6014 |
|
6014 | |||
6015 | # :flag.case_no_arg |
|
6015 | # :flag.case_no_arg | |
6016 | args['--configs']=1 |
|
6016 | args['--configs']=1 | |
6017 | shift |
|
6017 | shift | |
6018 | ;; |
|
6018 | ;; | |
6019 |
|
6019 | |||
6020 | # :flag.case |
|
6020 | # :flag.case | |
6021 | --verbose | -v) |
|
6021 | --verbose | -v) | |
6022 |
|
6022 | |||
6023 | # :flag.case_no_arg |
|
6023 | # :flag.case_no_arg | |
6024 | args['--verbose']=1 |
|
6024 | args['--verbose']=1 | |
6025 | shift |
|
6025 | shift | |
6026 | ;; |
|
6026 | ;; | |
6027 |
|
6027 | |||
6028 | -?*) |
|
6028 | -?*) | |
6029 | printf "invalid option: %s\n" "$key" >&2 |
|
6029 | printf "invalid option: %s\n" "$key" >&2 | |
6030 | exit 1 |
|
6030 | exit 1 | |
6031 | ;; |
|
6031 | ;; | |
6032 |
|
6032 | |||
6033 | *) |
|
6033 | *) | |
6034 | # :command.parse_requirements_case |
|
6034 | # :command.parse_requirements_case | |
6035 | # :command.parse_requirements_case_simple |
|
6035 | # :command.parse_requirements_case_simple | |
6036 | printf "invalid argument: %s\n" "$key" >&2 |
|
6036 | printf "invalid argument: %s\n" "$key" >&2 | |
6037 | exit 1 |
|
6037 | exit 1 | |
6038 |
|
6038 | |||
6039 | ;; |
|
6039 | ;; | |
6040 |
|
6040 | |||
6041 | esac |
|
6041 | esac | |
6042 | done |
|
6042 | done | |
6043 |
|
6043 | |||
6044 | } |
|
6044 | } | |
6045 |
|
6045 | |||
6046 | # :command.parse_requirements |
|
6046 | # :command.parse_requirements | |
6047 | rcstack_stack_upgrade_parse_requirements() { |
|
6047 | rcstack_stack_upgrade_parse_requirements() { | |
6048 | # :command.fixed_flags_filter |
|
6048 | # :command.fixed_flags_filter | |
6049 | while [[ $# -gt 0 ]]; do |
|
6049 | while [[ $# -gt 0 ]]; do | |
6050 | case "${1:-}" in |
|
6050 | case "${1:-}" in | |
6051 | --help | -h) |
|
6051 | --help | -h) | |
6052 | long_usage=yes |
|
6052 | long_usage=yes | |
6053 | rcstack_stack_upgrade_usage |
|
6053 | rcstack_stack_upgrade_usage | |
6054 | exit |
|
6054 | exit | |
6055 | ;; |
|
6055 | ;; | |
6056 |
|
6056 | |||
6057 | # :flag.case |
|
6057 | # :flag.case | |
6058 | --stack-prefix) |
|
6058 | --stack-prefix) | |
6059 |
|
6059 | |||
6060 | # :flag.case_arg |
|
6060 | # :flag.case_arg | |
6061 | if [[ -n ${2+x} ]]; then |
|
6061 | if [[ -n ${2+x} ]]; then | |
6062 |
|
6062 | |||
6063 | args['--stack-prefix']="$2" |
|
6063 | args['--stack-prefix']="$2" | |
6064 | shift |
|
6064 | shift | |
6065 | shift |
|
6065 | shift | |
6066 | else |
|
6066 | else | |
6067 | printf "%s\n" "--stack-prefix requires an argument: --stack-prefix STACK_PREFIX" >&2 |
|
6067 | printf "%s\n" "--stack-prefix requires an argument: --stack-prefix STACK_PREFIX" >&2 | |
6068 | exit 1 |
|
6068 | exit 1 | |
6069 | fi |
|
6069 | fi | |
6070 | ;; |
|
6070 | ;; | |
6071 |
|
6071 | |||
6072 | *) |
|
6072 | *) | |
6073 | break |
|
6073 | break | |
6074 | ;; |
|
6074 | ;; | |
6075 |
|
6075 | |||
6076 | esac |
|
6076 | esac | |
6077 | done |
|
6077 | done | |
6078 |
|
6078 | |||
6079 | # :command.command_filter |
|
6079 | # :command.command_filter | |
6080 | action=${1:-} |
|
6080 | action=${1:-} | |
6081 |
|
6081 | |||
6082 | case $action in |
|
6082 | case $action in | |
6083 | -*) ;; |
|
6083 | -*) ;; | |
6084 |
|
6084 | |||
6085 | router) |
|
6085 | router) | |
6086 | action="router" |
|
6086 | action="router" | |
6087 | shift |
|
6087 | shift | |
6088 | rcstack_stack_upgrade_router_parse_requirements "$@" |
|
6088 | rcstack_stack_upgrade_router_parse_requirements "$@" | |
6089 | shift $# |
|
6089 | shift $# | |
6090 | ;; |
|
6090 | ;; | |
6091 |
|
6091 | |||
6092 | services) |
|
6092 | services) | |
6093 | action="services" |
|
6093 | action="services" | |
6094 | shift |
|
6094 | shift | |
6095 | rcstack_stack_upgrade_services_parse_requirements "$@" |
|
6095 | rcstack_stack_upgrade_services_parse_requirements "$@" | |
6096 | shift $# |
|
6096 | shift $# | |
6097 | ;; |
|
6097 | ;; | |
6098 |
|
6098 | |||
6099 | metrics) |
|
6099 | metrics) | |
6100 | action="metrics" |
|
6100 | action="metrics" | |
6101 | shift |
|
6101 | shift | |
6102 | rcstack_stack_upgrade_metrics_parse_requirements "$@" |
|
6102 | rcstack_stack_upgrade_metrics_parse_requirements "$@" | |
6103 | shift $# |
|
6103 | shift $# | |
6104 | ;; |
|
6104 | ;; | |
6105 |
|
6105 | |||
6106 | rhodecode) |
|
6106 | rhodecode) | |
6107 | action="rhodecode" |
|
6107 | action="rhodecode" | |
6108 | shift |
|
6108 | shift | |
6109 | rcstack_stack_upgrade_rhodecode_parse_requirements "$@" |
|
6109 | rcstack_stack_upgrade_rhodecode_parse_requirements "$@" | |
6110 | shift $# |
|
6110 | shift $# | |
6111 | ;; |
|
6111 | ;; | |
6112 |
|
6112 | |||
6113 | # :command.command_fallback |
|
6113 | # :command.command_fallback | |
6114 | "") |
|
6114 | "") | |
6115 | rcstack_stack_upgrade_usage >&2 |
|
6115 | rcstack_stack_upgrade_usage >&2 | |
6116 | exit 1 |
|
6116 | exit 1 | |
6117 | ;; |
|
6117 | ;; | |
6118 |
|
6118 | |||
6119 | *) |
|
6119 | *) | |
6120 | printf "invalid command: %s\n" "$action" >&2 |
|
6120 | printf "invalid command: %s\n" "$action" >&2 | |
6121 | exit 1 |
|
6121 | exit 1 | |
6122 | ;; |
|
6122 | ;; | |
6123 |
|
6123 | |||
6124 | esac |
|
6124 | esac | |
6125 |
|
6125 | |||
6126 | # :command.parse_requirements_while |
|
6126 | # :command.parse_requirements_while | |
6127 | while [[ $# -gt 0 ]]; do |
|
6127 | while [[ $# -gt 0 ]]; do | |
6128 | key="$1" |
|
6128 | key="$1" | |
6129 | case "$key" in |
|
6129 | case "$key" in | |
6130 |
|
6130 | |||
6131 | -?*) |
|
6131 | -?*) | |
6132 | printf "invalid option: %s\n" "$key" >&2 |
|
6132 | printf "invalid option: %s\n" "$key" >&2 | |
6133 | exit 1 |
|
6133 | exit 1 | |
6134 | ;; |
|
6134 | ;; | |
6135 |
|
6135 | |||
6136 | *) |
|
6136 | *) | |
6137 | # :command.parse_requirements_case |
|
6137 | # :command.parse_requirements_case | |
6138 | # :command.parse_requirements_case_simple |
|
6138 | # :command.parse_requirements_case_simple | |
6139 | printf "invalid argument: %s\n" "$key" >&2 |
|
6139 | printf "invalid argument: %s\n" "$key" >&2 | |
6140 | exit 1 |
|
6140 | exit 1 | |
6141 |
|
6141 | |||
6142 | ;; |
|
6142 | ;; | |
6143 |
|
6143 | |||
6144 | esac |
|
6144 | esac | |
6145 | done |
|
6145 | done | |
6146 |
|
6146 | |||
6147 | } |
|
6147 | } | |
6148 |
|
6148 | |||
6149 | # :command.parse_requirements |
|
6149 | # :command.parse_requirements | |
6150 | rcstack_stack_upgrade_router_parse_requirements() { |
|
6150 | rcstack_stack_upgrade_router_parse_requirements() { | |
6151 | # :command.fixed_flags_filter |
|
6151 | # :command.fixed_flags_filter | |
6152 | while [[ $# -gt 0 ]]; do |
|
6152 | while [[ $# -gt 0 ]]; do | |
6153 | case "${1:-}" in |
|
6153 | case "${1:-}" in | |
6154 | --help | -h) |
|
6154 | --help | -h) | |
6155 | long_usage=yes |
|
6155 | long_usage=yes | |
6156 | rcstack_stack_upgrade_router_usage |
|
6156 | rcstack_stack_upgrade_router_usage | |
6157 | exit |
|
6157 | exit | |
6158 | ;; |
|
6158 | ;; | |
6159 |
|
6159 | |||
6160 | *) |
|
6160 | *) | |
6161 | break |
|
6161 | break | |
6162 | ;; |
|
6162 | ;; | |
6163 |
|
6163 | |||
6164 | esac |
|
6164 | esac | |
6165 | done |
|
6165 | done | |
6166 |
|
6166 | |||
6167 | # :command.command_filter |
|
6167 | # :command.command_filter | |
6168 | action="stack-upgrade router" |
|
6168 | action="stack-upgrade router" | |
6169 |
|
6169 | |||
6170 | # :command.parse_requirements_while |
|
6170 | # :command.parse_requirements_while | |
6171 | while [[ $# -gt 0 ]]; do |
|
6171 | while [[ $# -gt 0 ]]; do | |
6172 | key="$1" |
|
6172 | key="$1" | |
6173 | case "$key" in |
|
6173 | case "$key" in | |
6174 |
|
6174 | |||
6175 | -?*) |
|
6175 | -?*) | |
6176 | printf "invalid option: %s\n" "$key" >&2 |
|
6176 | printf "invalid option: %s\n" "$key" >&2 | |
6177 | exit 1 |
|
6177 | exit 1 | |
6178 | ;; |
|
6178 | ;; | |
6179 |
|
6179 | |||
6180 | *) |
|
6180 | *) | |
6181 | # :command.parse_requirements_case |
|
6181 | # :command.parse_requirements_case | |
6182 | # :command.parse_requirements_case_simple |
|
6182 | # :command.parse_requirements_case_simple | |
6183 | printf "invalid argument: %s\n" "$key" >&2 |
|
6183 | printf "invalid argument: %s\n" "$key" >&2 | |
6184 | exit 1 |
|
6184 | exit 1 | |
6185 |
|
6185 | |||
6186 | ;; |
|
6186 | ;; | |
6187 |
|
6187 | |||
6188 | esac |
|
6188 | esac | |
6189 | done |
|
6189 | done | |
6190 |
|
6190 | |||
6191 | } |
|
6191 | } | |
6192 |
|
6192 | |||
6193 | # :command.parse_requirements |
|
6193 | # :command.parse_requirements | |
6194 | rcstack_stack_upgrade_services_parse_requirements() { |
|
6194 | rcstack_stack_upgrade_services_parse_requirements() { | |
6195 | # :command.fixed_flags_filter |
|
6195 | # :command.fixed_flags_filter | |
6196 | while [[ $# -gt 0 ]]; do |
|
6196 | while [[ $# -gt 0 ]]; do | |
6197 | case "${1:-}" in |
|
6197 | case "${1:-}" in | |
6198 | --help | -h) |
|
6198 | --help | -h) | |
6199 | long_usage=yes |
|
6199 | long_usage=yes | |
6200 | rcstack_stack_upgrade_services_usage |
|
6200 | rcstack_stack_upgrade_services_usage | |
6201 | exit |
|
6201 | exit | |
6202 | ;; |
|
6202 | ;; | |
6203 |
|
6203 | |||
6204 | *) |
|
6204 | *) | |
6205 | break |
|
6205 | break | |
6206 | ;; |
|
6206 | ;; | |
6207 |
|
6207 | |||
6208 | esac |
|
6208 | esac | |
6209 | done |
|
6209 | done | |
6210 |
|
6210 | |||
6211 | # :command.command_filter |
|
6211 | # :command.command_filter | |
6212 | action="stack-upgrade services" |
|
6212 | action="stack-upgrade services" | |
6213 |
|
6213 | |||
6214 | # :command.parse_requirements_while |
|
6214 | # :command.parse_requirements_while | |
6215 | while [[ $# -gt 0 ]]; do |
|
6215 | while [[ $# -gt 0 ]]; do | |
6216 | key="$1" |
|
6216 | key="$1" | |
6217 | case "$key" in |
|
6217 | case "$key" in | |
6218 |
|
6218 | |||
6219 | -?*) |
|
6219 | -?*) | |
6220 | printf "invalid option: %s\n" "$key" >&2 |
|
6220 | printf "invalid option: %s\n" "$key" >&2 | |
6221 | exit 1 |
|
6221 | exit 1 | |
6222 | ;; |
|
6222 | ;; | |
6223 |
|
6223 | |||
6224 | *) |
|
6224 | *) | |
6225 | # :command.parse_requirements_case |
|
6225 | # :command.parse_requirements_case | |
6226 | # :command.parse_requirements_case_simple |
|
6226 | # :command.parse_requirements_case_simple | |
6227 | printf "invalid argument: %s\n" "$key" >&2 |
|
6227 | printf "invalid argument: %s\n" "$key" >&2 | |
6228 | exit 1 |
|
6228 | exit 1 | |
6229 |
|
6229 | |||
6230 | ;; |
|
6230 | ;; | |
6231 |
|
6231 | |||
6232 | esac |
|
6232 | esac | |
6233 | done |
|
6233 | done | |
6234 |
|
6234 | |||
6235 | } |
|
6235 | } | |
6236 |
|
6236 | |||
6237 | # :command.parse_requirements |
|
6237 | # :command.parse_requirements | |
6238 | rcstack_stack_upgrade_metrics_parse_requirements() { |
|
6238 | rcstack_stack_upgrade_metrics_parse_requirements() { | |
6239 | # :command.fixed_flags_filter |
|
6239 | # :command.fixed_flags_filter | |
6240 | while [[ $# -gt 0 ]]; do |
|
6240 | while [[ $# -gt 0 ]]; do | |
6241 | case "${1:-}" in |
|
6241 | case "${1:-}" in | |
6242 | --help | -h) |
|
6242 | --help | -h) | |
6243 | long_usage=yes |
|
6243 | long_usage=yes | |
6244 | rcstack_stack_upgrade_metrics_usage |
|
6244 | rcstack_stack_upgrade_metrics_usage | |
6245 | exit |
|
6245 | exit | |
6246 | ;; |
|
6246 | ;; | |
6247 |
|
6247 | |||
6248 | *) |
|
6248 | *) | |
6249 | break |
|
6249 | break | |
6250 | ;; |
|
6250 | ;; | |
6251 |
|
6251 | |||
6252 | esac |
|
6252 | esac | |
6253 | done |
|
6253 | done | |
6254 |
|
6254 | |||
6255 | # :command.command_filter |
|
6255 | # :command.command_filter | |
6256 | action="stack-upgrade metrics" |
|
6256 | action="stack-upgrade metrics" | |
6257 |
|
6257 | |||
6258 | # :command.parse_requirements_while |
|
6258 | # :command.parse_requirements_while | |
6259 | while [[ $# -gt 0 ]]; do |
|
6259 | while [[ $# -gt 0 ]]; do | |
6260 | key="$1" |
|
6260 | key="$1" | |
6261 | case "$key" in |
|
6261 | case "$key" in | |
6262 |
|
6262 | |||
6263 | -?*) |
|
6263 | -?*) | |
6264 | printf "invalid option: %s\n" "$key" >&2 |
|
6264 | printf "invalid option: %s\n" "$key" >&2 | |
6265 | exit 1 |
|
6265 | exit 1 | |
6266 | ;; |
|
6266 | ;; | |
6267 |
|
6267 | |||
6268 | *) |
|
6268 | *) | |
6269 | # :command.parse_requirements_case |
|
6269 | # :command.parse_requirements_case | |
6270 | # :command.parse_requirements_case_simple |
|
6270 | # :command.parse_requirements_case_simple | |
6271 | printf "invalid argument: %s\n" "$key" >&2 |
|
6271 | printf "invalid argument: %s\n" "$key" >&2 | |
6272 | exit 1 |
|
6272 | exit 1 | |
6273 |
|
6273 | |||
6274 | ;; |
|
6274 | ;; | |
6275 |
|
6275 | |||
6276 | esac |
|
6276 | esac | |
6277 | done |
|
6277 | done | |
6278 |
|
6278 | |||
6279 | } |
|
6279 | } | |
6280 |
|
6280 | |||
6281 | # :command.parse_requirements |
|
6281 | # :command.parse_requirements | |
6282 | rcstack_stack_upgrade_rhodecode_parse_requirements() { |
|
6282 | rcstack_stack_upgrade_rhodecode_parse_requirements() { | |
6283 | # :command.fixed_flags_filter |
|
6283 | # :command.fixed_flags_filter | |
6284 | while [[ $# -gt 0 ]]; do |
|
6284 | while [[ $# -gt 0 ]]; do | |
6285 | case "${1:-}" in |
|
6285 | case "${1:-}" in | |
6286 | --help | -h) |
|
6286 | --help | -h) | |
6287 | long_usage=yes |
|
6287 | long_usage=yes | |
6288 | rcstack_stack_upgrade_rhodecode_usage |
|
6288 | rcstack_stack_upgrade_rhodecode_usage | |
6289 | exit |
|
6289 | exit | |
6290 | ;; |
|
6290 | ;; | |
6291 |
|
6291 | |||
6292 | *) |
|
6292 | *) | |
6293 | break |
|
6293 | break | |
6294 | ;; |
|
6294 | ;; | |
6295 |
|
6295 | |||
6296 | esac |
|
6296 | esac | |
6297 | done |
|
6297 | done | |
6298 |
|
6298 | |||
6299 | # :command.command_filter |
|
6299 | # :command.command_filter | |
6300 | action="stack-upgrade rhodecode" |
|
6300 | action="stack-upgrade rhodecode" | |
6301 |
|
6301 | |||
6302 | # :command.parse_requirements_while |
|
6302 | # :command.parse_requirements_while | |
6303 | while [[ $# -gt 0 ]]; do |
|
6303 | while [[ $# -gt 0 ]]; do | |
6304 | key="$1" |
|
6304 | key="$1" | |
6305 | case "$key" in |
|
6305 | case "$key" in | |
6306 | # :flag.case |
|
6306 | # :flag.case | |
6307 | --stop-wait) |
|
6307 | --stop-wait) | |
6308 |
|
6308 | |||
6309 | # :flag.case_arg |
|
6309 | # :flag.case_arg | |
6310 | if [[ -n ${2+x} ]]; then |
|
6310 | if [[ -n ${2+x} ]]; then | |
6311 |
|
6311 | |||
6312 | args['--stop-wait']="$2" |
|
6312 | args['--stop-wait']="$2" | |
6313 | shift |
|
6313 | shift | |
6314 | shift |
|
6314 | shift | |
6315 | else |
|
6315 | else | |
6316 | printf "%s\n" "--stop-wait requires an argument: --stop-wait STOP_WAIT" >&2 |
|
6316 | printf "%s\n" "--stop-wait requires an argument: --stop-wait STOP_WAIT" >&2 | |
6317 | exit 1 |
|
6317 | exit 1 | |
6318 | fi |
|
6318 | fi | |
6319 | ;; |
|
6319 | ;; | |
6320 |
|
6320 | |||
6321 | # :flag.case |
|
6321 | # :flag.case | |
6322 | --docker-stop-wait) |
|
6322 | --docker-stop-wait) | |
6323 |
|
6323 | |||
6324 | # :flag.case_arg |
|
6324 | # :flag.case_arg | |
6325 | if [[ -n ${2+x} ]]; then |
|
6325 | if [[ -n ${2+x} ]]; then | |
6326 |
|
6326 | |||
6327 | args['--docker-stop-wait']="$2" |
|
6327 | args['--docker-stop-wait']="$2" | |
6328 | shift |
|
6328 | shift | |
6329 | shift |
|
6329 | shift | |
6330 | else |
|
6330 | else | |
6331 | printf "%s\n" "--docker-stop-wait requires an argument: --docker-stop-wait DOCKER_STOP_WAIT" >&2 |
|
6331 | printf "%s\n" "--docker-stop-wait requires an argument: --docker-stop-wait DOCKER_STOP_WAIT" >&2 | |
6332 | exit 1 |
|
6332 | exit 1 | |
6333 | fi |
|
6333 | fi | |
6334 | ;; |
|
6334 | ;; | |
6335 |
|
6335 | |||
6336 | -?*) |
|
6336 | -?*) | |
6337 | printf "invalid option: %s\n" "$key" >&2 |
|
6337 | printf "invalid option: %s\n" "$key" >&2 | |
6338 | exit 1 |
|
6338 | exit 1 | |
6339 | ;; |
|
6339 | ;; | |
6340 |
|
6340 | |||
6341 | *) |
|
6341 | *) | |
6342 | # :command.parse_requirements_case |
|
6342 | # :command.parse_requirements_case | |
6343 | # :command.parse_requirements_case_simple |
|
6343 | # :command.parse_requirements_case_simple | |
6344 | printf "invalid argument: %s\n" "$key" >&2 |
|
6344 | printf "invalid argument: %s\n" "$key" >&2 | |
6345 | exit 1 |
|
6345 | exit 1 | |
6346 |
|
6346 | |||
6347 | ;; |
|
6347 | ;; | |
6348 |
|
6348 | |||
6349 | esac |
|
6349 | esac | |
6350 | done |
|
6350 | done | |
6351 |
|
6351 | |||
6352 | # :command.default_assignments |
|
6352 | # :command.default_assignments | |
6353 | [[ -n ${args['--stop-wait']:-} ]] || args['--stop-wait']="120" |
|
6353 | [[ -n ${args['--stop-wait']:-} ]] || args['--stop-wait']="120" | |
6354 | [[ -n ${args['--docker-stop-wait']:-} ]] || args['--docker-stop-wait']="3600" |
|
6354 | [[ -n ${args['--docker-stop-wait']:-} ]] || args['--docker-stop-wait']="3600" | |
6355 |
|
6355 | |||
6356 | } |
|
6356 | } | |
6357 |
|
6357 | |||
6358 | # :command.parse_requirements |
|
6358 | # :command.parse_requirements | |
6359 | rcstack_stack_monitor_parse_requirements() { |
|
6359 | rcstack_stack_monitor_parse_requirements() { | |
6360 | # :command.fixed_flags_filter |
|
6360 | # :command.fixed_flags_filter | |
6361 | while [[ $# -gt 0 ]]; do |
|
6361 | while [[ $# -gt 0 ]]; do | |
6362 | case "${1:-}" in |
|
6362 | case "${1:-}" in | |
6363 | --help | -h) |
|
6363 | --help | -h) | |
6364 | long_usage=yes |
|
6364 | long_usage=yes | |
6365 | rcstack_stack_monitor_usage |
|
6365 | rcstack_stack_monitor_usage | |
6366 | exit |
|
6366 | exit | |
6367 | ;; |
|
6367 | ;; | |
6368 |
|
6368 | |||
6369 | *) |
|
6369 | *) | |
6370 | break |
|
6370 | break | |
6371 | ;; |
|
6371 | ;; | |
6372 |
|
6372 | |||
6373 | esac |
|
6373 | esac | |
6374 | done |
|
6374 | done | |
6375 |
|
6375 | |||
6376 | # :command.command_filter |
|
6376 | # :command.command_filter | |
6377 | action=${1:-} |
|
6377 | action=${1:-} | |
6378 |
|
6378 | |||
6379 | case $action in |
|
6379 | case $action in | |
6380 | -*) ;; |
|
6380 | -*) ;; | |
6381 |
|
6381 | |||
6382 | restart-unhealthy) |
|
6382 | restart-unhealthy) | |
6383 | action="restart-unhealthy" |
|
6383 | action="restart-unhealthy" | |
6384 | shift |
|
6384 | shift | |
6385 | rcstack_stack_monitor_restart_unhealthy_parse_requirements "$@" |
|
6385 | rcstack_stack_monitor_restart_unhealthy_parse_requirements "$@" | |
6386 | shift $# |
|
6386 | shift $# | |
6387 | ;; |
|
6387 | ;; | |
6388 |
|
6388 | |||
6389 | # :command.command_fallback |
|
6389 | # :command.command_fallback | |
6390 | "") |
|
6390 | "") | |
6391 | rcstack_stack_monitor_usage >&2 |
|
6391 | rcstack_stack_monitor_usage >&2 | |
6392 | exit 1 |
|
6392 | exit 1 | |
6393 | ;; |
|
6393 | ;; | |
6394 |
|
6394 | |||
6395 | *) |
|
6395 | *) | |
6396 | printf "invalid command: %s\n" "$action" >&2 |
|
6396 | printf "invalid command: %s\n" "$action" >&2 | |
6397 | exit 1 |
|
6397 | exit 1 | |
6398 | ;; |
|
6398 | ;; | |
6399 |
|
6399 | |||
6400 | esac |
|
6400 | esac | |
6401 |
|
6401 | |||
6402 | # :command.parse_requirements_while |
|
6402 | # :command.parse_requirements_while | |
6403 | while [[ $# -gt 0 ]]; do |
|
6403 | while [[ $# -gt 0 ]]; do | |
6404 | key="$1" |
|
6404 | key="$1" | |
6405 | case "$key" in |
|
6405 | case "$key" in | |
6406 |
|
6406 | |||
6407 | -?*) |
|
6407 | -?*) | |
6408 | printf "invalid option: %s\n" "$key" >&2 |
|
6408 | printf "invalid option: %s\n" "$key" >&2 | |
6409 | exit 1 |
|
6409 | exit 1 | |
6410 | ;; |
|
6410 | ;; | |
6411 |
|
6411 | |||
6412 | *) |
|
6412 | *) | |
6413 | # :command.parse_requirements_case |
|
6413 | # :command.parse_requirements_case | |
6414 | # :command.parse_requirements_case_simple |
|
6414 | # :command.parse_requirements_case_simple | |
6415 | printf "invalid argument: %s\n" "$key" >&2 |
|
6415 | printf "invalid argument: %s\n" "$key" >&2 | |
6416 | exit 1 |
|
6416 | exit 1 | |
6417 |
|
6417 | |||
6418 | ;; |
|
6418 | ;; | |
6419 |
|
6419 | |||
6420 | esac |
|
6420 | esac | |
6421 | done |
|
6421 | done | |
6422 |
|
6422 | |||
6423 | } |
|
6423 | } | |
6424 |
|
6424 | |||
6425 | # :command.parse_requirements |
|
6425 | # :command.parse_requirements | |
6426 | rcstack_stack_monitor_restart_unhealthy_parse_requirements() { |
|
6426 | rcstack_stack_monitor_restart_unhealthy_parse_requirements() { | |
6427 | # :command.fixed_flags_filter |
|
6427 | # :command.fixed_flags_filter | |
6428 | while [[ $# -gt 0 ]]; do |
|
6428 | while [[ $# -gt 0 ]]; do | |
6429 | case "${1:-}" in |
|
6429 | case "${1:-}" in | |
6430 | --help | -h) |
|
6430 | --help | -h) | |
6431 | long_usage=yes |
|
6431 | long_usage=yes | |
6432 | rcstack_stack_monitor_restart_unhealthy_usage |
|
6432 | rcstack_stack_monitor_restart_unhealthy_usage | |
6433 | exit |
|
6433 | exit | |
6434 | ;; |
|
6434 | ;; | |
6435 |
|
6435 | |||
6436 | *) |
|
6436 | *) | |
6437 | break |
|
6437 | break | |
6438 | ;; |
|
6438 | ;; | |
6439 |
|
6439 | |||
6440 | esac |
|
6440 | esac | |
6441 | done |
|
6441 | done | |
6442 |
|
6442 | |||
6443 | # :command.command_filter |
|
6443 | # :command.command_filter | |
6444 | action="stack-monitor restart-unhealthy" |
|
6444 | action="stack-monitor restart-unhealthy" | |
6445 |
|
6445 | |||
6446 | # :command.parse_requirements_while |
|
6446 | # :command.parse_requirements_while | |
6447 | while [[ $# -gt 0 ]]; do |
|
6447 | while [[ $# -gt 0 ]]; do | |
6448 | key="$1" |
|
6448 | key="$1" | |
6449 | case "$key" in |
|
6449 | case "$key" in | |
6450 | # :flag.case |
|
6450 | # :flag.case | |
6451 | --loop) |
|
6451 | --loop) | |
6452 |
|
6452 | |||
6453 | # :flag.case_arg |
|
6453 | # :flag.case_arg | |
6454 | if [[ -n ${2+x} ]]; then |
|
6454 | if [[ -n ${2+x} ]]; then | |
6455 | # :flag.validations |
|
6455 | # :flag.validations | |
6456 | if [[ -n $(validate_integer "$2") ]]; then |
|
6456 | if [[ -n $(validate_integer "$2") ]]; then | |
6457 | printf "validation error in %s:\n%s\n" "--loop LOOP" "$(validate_integer "$2")" >&2 |
|
6457 | printf "validation error in %s:\n%s\n" "--loop LOOP" "$(validate_integer "$2")" >&2 | |
6458 | exit 1 |
|
6458 | exit 1 | |
6459 | fi |
|
6459 | fi | |
6460 |
|
6460 | |||
6461 | args['--loop']="$2" |
|
6461 | args['--loop']="$2" | |
6462 | shift |
|
6462 | shift | |
6463 | shift |
|
6463 | shift | |
6464 | else |
|
6464 | else | |
6465 | printf "%s\n" "--loop requires an argument: --loop LOOP" >&2 |
|
6465 | printf "%s\n" "--loop requires an argument: --loop LOOP" >&2 | |
6466 | exit 1 |
|
6466 | exit 1 | |
6467 | fi |
|
6467 | fi | |
6468 | ;; |
|
6468 | ;; | |
6469 |
|
6469 | |||
6470 | -?*) |
|
6470 | -?*) | |
6471 | printf "invalid option: %s\n" "$key" >&2 |
|
6471 | printf "invalid option: %s\n" "$key" >&2 | |
6472 | exit 1 |
|
6472 | exit 1 | |
6473 | ;; |
|
6473 | ;; | |
6474 |
|
6474 | |||
6475 | *) |
|
6475 | *) | |
6476 | # :command.parse_requirements_case |
|
6476 | # :command.parse_requirements_case | |
6477 | # :command.parse_requirements_case_simple |
|
6477 | # :command.parse_requirements_case_simple | |
6478 | printf "invalid argument: %s\n" "$key" >&2 |
|
6478 | printf "invalid argument: %s\n" "$key" >&2 | |
6479 | exit 1 |
|
6479 | exit 1 | |
6480 |
|
6480 | |||
6481 | ;; |
|
6481 | ;; | |
6482 |
|
6482 | |||
6483 | esac |
|
6483 | esac | |
6484 | done |
|
6484 | done | |
6485 |
|
6485 | |||
6486 | # :command.default_assignments |
|
6486 | # :command.default_assignments | |
6487 | [[ -n ${args['--loop']:-} ]] || args['--loop']="0" |
|
6487 | [[ -n ${args['--loop']:-} ]] || args['--loop']="0" | |
6488 |
|
6488 | |||
6489 | } |
|
6489 | } | |
6490 |
|
6490 | |||
6491 | # :command.parse_requirements |
|
6491 | # :command.parse_requirements | |
6492 | rcstack_cli_parse_requirements() { |
|
6492 | rcstack_cli_parse_requirements() { | |
6493 | # :command.fixed_flags_filter |
|
6493 | # :command.fixed_flags_filter | |
6494 | while [[ $# -gt 0 ]]; do |
|
6494 | while [[ $# -gt 0 ]]; do | |
6495 | case "${1:-}" in |
|
6495 | case "${1:-}" in | |
6496 | --help | -h) |
|
6496 | --help | -h) | |
6497 | long_usage=yes |
|
6497 | long_usage=yes | |
6498 | rcstack_cli_usage |
|
6498 | rcstack_cli_usage | |
6499 | exit |
|
6499 | exit | |
6500 | ;; |
|
6500 | ;; | |
6501 |
|
6501 | |||
6502 | *) |
|
6502 | *) | |
6503 | break |
|
6503 | break | |
6504 | ;; |
|
6504 | ;; | |
6505 |
|
6505 | |||
6506 | esac |
|
6506 | esac | |
6507 | done |
|
6507 | done | |
6508 |
|
6508 | |||
6509 | # :command.command_filter |
|
6509 | # :command.command_filter | |
6510 | action=${1:-} |
|
6510 | action=${1:-} | |
6511 |
|
6511 | |||
6512 | case $action in |
|
6512 | case $action in | |
6513 | -*) ;; |
|
6513 | -*) ;; | |
6514 |
|
6514 | |||
6515 | cmd) |
|
6515 | cmd) | |
6516 | action="cmd" |
|
6516 | action="cmd" | |
6517 | shift |
|
6517 | shift | |
6518 | rcstack_cli_cmd_parse_requirements "$@" |
|
6518 | rcstack_cli_cmd_parse_requirements "$@" | |
6519 | shift $# |
|
6519 | shift $# | |
6520 | ;; |
|
6520 | ;; | |
6521 |
|
6521 | |||
6522 | ishell) |
|
6522 | ishell) | |
6523 | action="ishell" |
|
6523 | action="ishell" | |
6524 | shift |
|
6524 | shift | |
6525 | rcstack_cli_ishell_parse_requirements "$@" |
|
6525 | rcstack_cli_ishell_parse_requirements "$@" | |
6526 | shift $# |
|
6526 | shift $# | |
6527 | ;; |
|
6527 | ;; | |
6528 |
|
6528 | |||
6529 | image-info) |
|
6529 | image-info) | |
6530 | action="image-info" |
|
6530 | action="image-info" | |
6531 | shift |
|
6531 | shift | |
6532 | rcstack_cli_image_info_parse_requirements "$@" |
|
6532 | rcstack_cli_image_info_parse_requirements "$@" | |
6533 | shift $# |
|
6533 | shift $# | |
6534 | ;; |
|
6534 | ;; | |
6535 |
|
6535 | |||
6536 | set-runtime-image) |
|
6536 | set-runtime-image) | |
6537 | action="set-runtime-image" |
|
6537 | action="set-runtime-image" | |
6538 | shift |
|
6538 | shift | |
6539 | rcstack_cli_set_runtime_image_parse_requirements "$@" |
|
6539 | rcstack_cli_set_runtime_image_parse_requirements "$@" | |
6540 | shift $# |
|
6540 | shift $# | |
6541 | ;; |
|
6541 | ;; | |
6542 |
|
6542 | |||
6543 | docker-info) |
|
6543 | docker-info) | |
6544 | action="docker-info" |
|
6544 | action="docker-info" | |
6545 | shift |
|
6545 | shift | |
6546 | rcstack_cli_docker_info_parse_requirements "$@" |
|
6546 | rcstack_cli_docker_info_parse_requirements "$@" | |
6547 | shift $# |
|
6547 | shift $# | |
6548 | ;; |
|
6548 | ;; | |
6549 |
|
6549 | |||
6550 | docker-upgrade) |
|
6550 | docker-upgrade) | |
6551 | action="docker-upgrade" |
|
6551 | action="docker-upgrade" | |
6552 | shift |
|
6552 | shift | |
6553 | rcstack_cli_docker_upgrade_parse_requirements "$@" |
|
6553 | rcstack_cli_docker_upgrade_parse_requirements "$@" | |
6554 | shift $# |
|
6554 | shift $# | |
6555 | ;; |
|
6555 | ;; | |
6556 |
|
6556 | |||
6557 | redis) |
|
6557 | redis) | |
6558 | action="redis" |
|
6558 | action="redis" | |
6559 | shift |
|
6559 | shift | |
6560 | rcstack_cli_redis_parse_requirements "$@" |
|
6560 | rcstack_cli_redis_parse_requirements "$@" | |
6561 | shift $# |
|
6561 | shift $# | |
6562 | ;; |
|
6562 | ;; | |
6563 |
|
6563 | |||
6564 | db) |
|
6564 | db) | |
6565 | action="db" |
|
6565 | action="db" | |
6566 | shift |
|
6566 | shift | |
6567 | rcstack_cli_db_parse_requirements "$@" |
|
6567 | rcstack_cli_db_parse_requirements "$@" | |
6568 | shift $# |
|
6568 | shift $# | |
6569 | ;; |
|
6569 | ;; | |
6570 |
|
6570 | |||
6571 | db-upgrade) |
|
6571 | db-upgrade) | |
6572 | action="db-upgrade" |
|
6572 | action="db-upgrade" | |
6573 | shift |
|
6573 | shift | |
6574 | rcstack_cli_db_upgrade_parse_requirements "$@" |
|
6574 | rcstack_cli_db_upgrade_parse_requirements "$@" | |
6575 | shift $# |
|
6575 | shift $# | |
6576 | ;; |
|
6576 | ;; | |
6577 |
|
6577 | |||
6578 | storage) |
|
6578 | storage) | |
6579 | action="storage" |
|
6579 | action="storage" | |
6580 | shift |
|
6580 | shift | |
6581 | rcstack_cli_storage_parse_requirements "$@" |
|
6581 | rcstack_cli_storage_parse_requirements "$@" | |
6582 | shift $# |
|
6582 | shift $# | |
6583 | ;; |
|
6583 | ;; | |
6584 |
|
6584 | |||
6585 | attach) |
|
6585 | attach) | |
6586 | action="attach" |
|
6586 | action="attach" | |
6587 | shift |
|
6587 | shift | |
6588 | rcstack_cli_attach_parse_requirements "$@" |
|
6588 | rcstack_cli_attach_parse_requirements "$@" | |
6589 | shift $# |
|
6589 | shift $# | |
6590 | ;; |
|
6590 | ;; | |
6591 |
|
6591 | |||
6592 | set-edition) |
|
6592 | set-edition) | |
6593 | action="set-edition" |
|
6593 | action="set-edition" | |
6594 | shift |
|
6594 | shift | |
6595 | rcstack_cli_set_edition_parse_requirements "$@" |
|
6595 | rcstack_cli_set_edition_parse_requirements "$@" | |
6596 | shift $# |
|
6596 | shift $# | |
6597 | ;; |
|
6597 | ;; | |
6598 |
|
6598 | |||
6599 | configure-vcsserver) |
|
6599 | configure-vcsserver) | |
6600 | action="configure-vcsserver" |
|
6600 | action="configure-vcsserver" | |
6601 | shift |
|
6601 | shift | |
6602 | rcstack_cli_configure_vcsserver_parse_requirements "$@" |
|
6602 | rcstack_cli_configure_vcsserver_parse_requirements "$@" | |
6603 | shift $# |
|
6603 | shift $# | |
6604 | ;; |
|
6604 | ;; | |
6605 |
|
6605 | |||
6606 | configure-rhodecode) |
|
6606 | configure-rhodecode) | |
6607 | action="configure-rhodecode" |
|
6607 | action="configure-rhodecode" | |
6608 | shift |
|
6608 | shift | |
6609 | rcstack_cli_configure_rhodecode_parse_requirements "$@" |
|
6609 | rcstack_cli_configure_rhodecode_parse_requirements "$@" | |
6610 | shift $# |
|
6610 | shift $# | |
6611 | ;; |
|
6611 | ;; | |
6612 |
|
6612 | |||
6613 | # :command.command_fallback |
|
6613 | # :command.command_fallback | |
6614 | "") |
|
6614 | "") | |
6615 | rcstack_cli_usage >&2 |
|
6615 | rcstack_cli_usage >&2 | |
6616 | exit 1 |
|
6616 | exit 1 | |
6617 | ;; |
|
6617 | ;; | |
6618 |
|
6618 | |||
6619 | *) |
|
6619 | *) | |
6620 | printf "invalid command: %s\n" "$action" >&2 |
|
6620 | printf "invalid command: %s\n" "$action" >&2 | |
6621 | exit 1 |
|
6621 | exit 1 | |
6622 | ;; |
|
6622 | ;; | |
6623 |
|
6623 | |||
6624 | esac |
|
6624 | esac | |
6625 |
|
6625 | |||
6626 | # :command.parse_requirements_while |
|
6626 | # :command.parse_requirements_while | |
6627 | while [[ $# -gt 0 ]]; do |
|
6627 | while [[ $# -gt 0 ]]; do | |
6628 | key="$1" |
|
6628 | key="$1" | |
6629 | case "$key" in |
|
6629 | case "$key" in | |
6630 |
|
6630 | |||
6631 | -?*) |
|
6631 | -?*) | |
6632 | printf "invalid option: %s\n" "$key" >&2 |
|
6632 | printf "invalid option: %s\n" "$key" >&2 | |
6633 | exit 1 |
|
6633 | exit 1 | |
6634 | ;; |
|
6634 | ;; | |
6635 |
|
6635 | |||
6636 | *) |
|
6636 | *) | |
6637 | # :command.parse_requirements_case |
|
6637 | # :command.parse_requirements_case | |
6638 | # :command.parse_requirements_case_simple |
|
6638 | # :command.parse_requirements_case_simple | |
6639 | printf "invalid argument: %s\n" "$key" >&2 |
|
6639 | printf "invalid argument: %s\n" "$key" >&2 | |
6640 | exit 1 |
|
6640 | exit 1 | |
6641 |
|
6641 | |||
6642 | ;; |
|
6642 | ;; | |
6643 |
|
6643 | |||
6644 | esac |
|
6644 | esac | |
6645 | done |
|
6645 | done | |
6646 |
|
6646 | |||
6647 | } |
|
6647 | } | |
6648 |
|
6648 | |||
6649 | # :command.parse_requirements |
|
6649 | # :command.parse_requirements | |
6650 | rcstack_cli_cmd_parse_requirements() { |
|
6650 | rcstack_cli_cmd_parse_requirements() { | |
6651 | # :command.fixed_flags_filter |
|
6651 | # :command.fixed_flags_filter | |
6652 | while [[ $# -gt 0 ]]; do |
|
6652 | while [[ $# -gt 0 ]]; do | |
6653 | case "${1:-}" in |
|
6653 | case "${1:-}" in | |
6654 | --help | -h) |
|
6654 | --help | -h) | |
6655 | long_usage=yes |
|
6655 | long_usage=yes | |
6656 | rcstack_cli_cmd_usage |
|
6656 | rcstack_cli_cmd_usage | |
6657 | exit |
|
6657 | exit | |
6658 | ;; |
|
6658 | ;; | |
6659 |
|
6659 | |||
6660 | *) |
|
6660 | *) | |
6661 | break |
|
6661 | break | |
6662 | ;; |
|
6662 | ;; | |
6663 |
|
6663 | |||
6664 | esac |
|
6664 | esac | |
6665 | done |
|
6665 | done | |
6666 |
|
6666 | |||
6667 | # :command.command_filter |
|
6667 | # :command.command_filter | |
6668 | action="cli cmd" |
|
6668 | action="cli cmd" | |
6669 |
|
6669 | |||
6670 | # :command.parse_requirements_while |
|
6670 | # :command.parse_requirements_while | |
6671 | while [[ $# -gt 0 ]]; do |
|
6671 | while [[ $# -gt 0 ]]; do | |
6672 | key="$1" |
|
6672 | key="$1" | |
6673 | case "$key" in |
|
6673 | case "$key" in | |
6674 | # :flag.case |
|
6674 | # :flag.case | |
6675 | --no-tty) |
|
6675 | --no-tty) | |
6676 |
|
6676 | |||
6677 | # :flag.case_no_arg |
|
6677 | # :flag.case_no_arg | |
6678 | args['--no-tty']=1 |
|
6678 | args['--no-tty']=1 | |
6679 | shift |
|
6679 | shift | |
6680 | ;; |
|
6680 | ;; | |
6681 |
|
6681 | |||
6682 | # :flag.case |
|
6682 | # :flag.case | |
6683 | --user) |
|
6683 | --user) | |
6684 |
|
6684 | |||
6685 | # :flag.case_no_arg |
|
6685 | # :flag.case_no_arg | |
6686 | args['--user']=1 |
|
6686 | args['--user']=1 | |
6687 | shift |
|
6687 | shift | |
6688 | ;; |
|
6688 | ;; | |
6689 |
|
6689 | |||
6690 | # :flag.case |
|
6690 | # :flag.case | |
6691 | --env-file-path) |
|
6691 | --env-file-path) | |
6692 |
|
6692 | |||
6693 | # :flag.case_arg |
|
6693 | # :flag.case_arg | |
6694 | if [[ -n ${2+x} ]]; then |
|
6694 | if [[ -n ${2+x} ]]; then | |
6695 | # :flag.validations |
|
6695 | # :flag.validations | |
6696 | if [[ -n $(validate_file_exists "$2") ]]; then |
|
6696 | if [[ -n $(validate_file_exists "$2") ]]; then | |
6697 | printf "validation error in %s:\n%s\n" "--env-file-path ENV_FILE_PATH" "$(validate_file_exists "$2")" >&2 |
|
6697 | printf "validation error in %s:\n%s\n" "--env-file-path ENV_FILE_PATH" "$(validate_file_exists "$2")" >&2 | |
6698 | exit 1 |
|
6698 | exit 1 | |
6699 | fi |
|
6699 | fi | |
6700 |
|
6700 | |||
6701 | args['--env-file-path']="$2" |
|
6701 | args['--env-file-path']="$2" | |
6702 | shift |
|
6702 | shift | |
6703 | shift |
|
6703 | shift | |
6704 | else |
|
6704 | else | |
6705 | printf "%s\n" "--env-file-path requires an argument: --env-file-path ENV_FILE_PATH" >&2 |
|
6705 | printf "%s\n" "--env-file-path requires an argument: --env-file-path ENV_FILE_PATH" >&2 | |
6706 | exit 1 |
|
6706 | exit 1 | |
6707 | fi |
|
6707 | fi | |
6708 | ;; |
|
6708 | ;; | |
6709 |
|
6709 | |||
6710 | --) |
|
6710 | --) | |
6711 | shift |
|
6711 | shift | |
6712 | other_args+=("$@") |
|
6712 | other_args+=("$@") | |
6713 | break |
|
6713 | break | |
6714 | ;; |
|
6714 | ;; | |
6715 |
|
6715 | |||
6716 | -?*) |
|
6716 | -?*) | |
6717 | other_args+=("$1") |
|
6717 | other_args+=("$1") | |
6718 | shift |
|
6718 | shift | |
6719 | ;; |
|
6719 | ;; | |
6720 |
|
6720 | |||
6721 | *) |
|
6721 | *) | |
6722 | # :command.parse_requirements_case |
|
6722 | # :command.parse_requirements_case | |
6723 | # :command.parse_requirements_case_catch_all |
|
6723 | # :command.parse_requirements_case_catch_all | |
6724 | other_args+=("$1") |
|
6724 | other_args+=("$1") | |
6725 | shift |
|
6725 | shift | |
6726 |
|
6726 | |||
6727 | ;; |
|
6727 | ;; | |
6728 |
|
6728 | |||
6729 | esac |
|
6729 | esac | |
6730 | done |
|
6730 | done | |
6731 |
|
6731 | |||
6732 | # :command.default_assignments |
|
6732 | # :command.default_assignments | |
6733 | [[ -n ${args['--env-file-path']:-} ]] || args['--env-file-path']="$PWD/.custom/.runtime.env" |
|
6733 | [[ -n ${args['--env-file-path']:-} ]] || args['--env-file-path']="$PWD/.custom/.runtime.env" | |
6734 |
|
6734 | |||
6735 | } |
|
6735 | } | |
6736 |
|
6736 | |||
6737 | # :command.parse_requirements |
|
6737 | # :command.parse_requirements | |
6738 | rcstack_cli_ishell_parse_requirements() { |
|
6738 | rcstack_cli_ishell_parse_requirements() { | |
6739 | # :command.fixed_flags_filter |
|
6739 | # :command.fixed_flags_filter | |
6740 | while [[ $# -gt 0 ]]; do |
|
6740 | while [[ $# -gt 0 ]]; do | |
6741 | case "${1:-}" in |
|
6741 | case "${1:-}" in | |
6742 | --help | -h) |
|
6742 | --help | -h) | |
6743 | long_usage=yes |
|
6743 | long_usage=yes | |
6744 | rcstack_cli_ishell_usage |
|
6744 | rcstack_cli_ishell_usage | |
6745 | exit |
|
6745 | exit | |
6746 | ;; |
|
6746 | ;; | |
6747 |
|
6747 | |||
6748 | *) |
|
6748 | *) | |
6749 | break |
|
6749 | break | |
6750 | ;; |
|
6750 | ;; | |
6751 |
|
6751 | |||
6752 | esac |
|
6752 | esac | |
6753 | done |
|
6753 | done | |
6754 |
|
6754 | |||
6755 | # :command.command_filter |
|
6755 | # :command.command_filter | |
6756 | action="cli ishell" |
|
6756 | action="cli ishell" | |
6757 |
|
6757 | |||
6758 | # :command.parse_requirements_while |
|
6758 | # :command.parse_requirements_while | |
6759 | while [[ $# -gt 0 ]]; do |
|
6759 | while [[ $# -gt 0 ]]; do | |
6760 | key="$1" |
|
6760 | key="$1" | |
6761 | case "$key" in |
|
6761 | case "$key" in | |
6762 | # :flag.case |
|
6762 | # :flag.case | |
6763 | --no-tty) |
|
6763 | --no-tty) | |
6764 |
|
6764 | |||
6765 | # :flag.case_no_arg |
|
6765 | # :flag.case_no_arg | |
6766 | args['--no-tty']=1 |
|
6766 | args['--no-tty']=1 | |
6767 | shift |
|
6767 | shift | |
6768 | ;; |
|
6768 | ;; | |
6769 |
|
6769 | |||
6770 | # :flag.case |
|
6770 | # :flag.case | |
6771 | --user) |
|
6771 | --user) | |
6772 |
|
6772 | |||
6773 | # :flag.case_no_arg |
|
6773 | # :flag.case_no_arg | |
6774 | args['--user']=1 |
|
6774 | args['--user']=1 | |
6775 | shift |
|
6775 | shift | |
6776 | ;; |
|
6776 | ;; | |
6777 |
|
6777 | |||
6778 | # :flag.case |
|
6778 | # :flag.case | |
6779 | --env-file-path) |
|
6779 | --env-file-path) | |
6780 |
|
6780 | |||
6781 | # :flag.case_arg |
|
6781 | # :flag.case_arg | |
6782 | if [[ -n ${2+x} ]]; then |
|
6782 | if [[ -n ${2+x} ]]; then | |
6783 | # :flag.validations |
|
6783 | # :flag.validations | |
6784 | if [[ -n $(validate_file_exists "$2") ]]; then |
|
6784 | if [[ -n $(validate_file_exists "$2") ]]; then | |
6785 | printf "validation error in %s:\n%s\n" "--env-file-path ENV_FILE_PATH" "$(validate_file_exists "$2")" >&2 |
|
6785 | printf "validation error in %s:\n%s\n" "--env-file-path ENV_FILE_PATH" "$(validate_file_exists "$2")" >&2 | |
6786 | exit 1 |
|
6786 | exit 1 | |
6787 | fi |
|
6787 | fi | |
6788 |
|
6788 | |||
6789 | args['--env-file-path']="$2" |
|
6789 | args['--env-file-path']="$2" | |
6790 | shift |
|
6790 | shift | |
6791 | shift |
|
6791 | shift | |
6792 | else |
|
6792 | else | |
6793 | printf "%s\n" "--env-file-path requires an argument: --env-file-path ENV_FILE_PATH" >&2 |
|
6793 | printf "%s\n" "--env-file-path requires an argument: --env-file-path ENV_FILE_PATH" >&2 | |
6794 | exit 1 |
|
6794 | exit 1 | |
6795 | fi |
|
6795 | fi | |
6796 | ;; |
|
6796 | ;; | |
6797 |
|
6797 | |||
6798 | -?*) |
|
6798 | -?*) | |
6799 | printf "invalid option: %s\n" "$key" >&2 |
|
6799 | printf "invalid option: %s\n" "$key" >&2 | |
6800 | exit 1 |
|
6800 | exit 1 | |
6801 | ;; |
|
6801 | ;; | |
6802 |
|
6802 | |||
6803 | *) |
|
6803 | *) | |
6804 | # :command.parse_requirements_case |
|
6804 | # :command.parse_requirements_case | |
6805 | # :command.parse_requirements_case_simple |
|
6805 | # :command.parse_requirements_case_simple | |
6806 | printf "invalid argument: %s\n" "$key" >&2 |
|
6806 | printf "invalid argument: %s\n" "$key" >&2 | |
6807 | exit 1 |
|
6807 | exit 1 | |
6808 |
|
6808 | |||
6809 | ;; |
|
6809 | ;; | |
6810 |
|
6810 | |||
6811 | esac |
|
6811 | esac | |
6812 | done |
|
6812 | done | |
6813 |
|
6813 | |||
6814 | # :command.default_assignments |
|
6814 | # :command.default_assignments | |
6815 | [[ -n ${args['--env-file-path']:-} ]] || args['--env-file-path']="$PWD/.custom/.runtime.env" |
|
6815 | [[ -n ${args['--env-file-path']:-} ]] || args['--env-file-path']="$PWD/.custom/.runtime.env" | |
6816 |
|
6816 | |||
6817 | } |
|
6817 | } | |
6818 |
|
6818 | |||
6819 | # :command.parse_requirements |
|
6819 | # :command.parse_requirements | |
6820 | rcstack_cli_image_info_parse_requirements() { |
|
6820 | rcstack_cli_image_info_parse_requirements() { | |
6821 | # :command.fixed_flags_filter |
|
6821 | # :command.fixed_flags_filter | |
6822 | while [[ $# -gt 0 ]]; do |
|
6822 | while [[ $# -gt 0 ]]; do | |
6823 | case "${1:-}" in |
|
6823 | case "${1:-}" in | |
6824 | --help | -h) |
|
6824 | --help | -h) | |
6825 | long_usage=yes |
|
6825 | long_usage=yes | |
6826 | rcstack_cli_image_info_usage |
|
6826 | rcstack_cli_image_info_usage | |
6827 | exit |
|
6827 | exit | |
6828 | ;; |
|
6828 | ;; | |
6829 |
|
6829 | |||
6830 | *) |
|
6830 | *) | |
6831 | break |
|
6831 | break | |
6832 | ;; |
|
6832 | ;; | |
6833 |
|
6833 | |||
6834 | esac |
|
6834 | esac | |
6835 | done |
|
6835 | done | |
6836 |
|
6836 | |||
6837 | # :command.command_filter |
|
6837 | # :command.command_filter | |
6838 | action="cli image-info" |
|
6838 | action="cli image-info" | |
6839 |
|
6839 | |||
6840 | # :command.parse_requirements_while |
|
6840 | # :command.parse_requirements_while | |
6841 | while [[ $# -gt 0 ]]; do |
|
6841 | while [[ $# -gt 0 ]]; do | |
6842 | key="$1" |
|
6842 | key="$1" | |
6843 | case "$key" in |
|
6843 | case "$key" in | |
6844 | # :flag.case |
|
6844 | # :flag.case | |
6845 | --verbose) |
|
6845 | --verbose) | |
6846 |
|
6846 | |||
6847 | # :flag.case_no_arg |
|
6847 | # :flag.case_no_arg | |
6848 | args['--verbose']=1 |
|
6848 | args['--verbose']=1 | |
6849 | shift |
|
6849 | shift | |
6850 | ;; |
|
6850 | ;; | |
6851 |
|
6851 | |||
6852 | -?*) |
|
6852 | -?*) | |
6853 | printf "invalid option: %s\n" "$key" >&2 |
|
6853 | printf "invalid option: %s\n" "$key" >&2 | |
6854 | exit 1 |
|
6854 | exit 1 | |
6855 | ;; |
|
6855 | ;; | |
6856 |
|
6856 | |||
6857 | *) |
|
6857 | *) | |
6858 | # :command.parse_requirements_case |
|
6858 | # :command.parse_requirements_case | |
6859 | # :command.parse_requirements_case_simple |
|
6859 | # :command.parse_requirements_case_simple | |
6860 | printf "invalid argument: %s\n" "$key" >&2 |
|
6860 | printf "invalid argument: %s\n" "$key" >&2 | |
6861 | exit 1 |
|
6861 | exit 1 | |
6862 |
|
6862 | |||
6863 | ;; |
|
6863 | ;; | |
6864 |
|
6864 | |||
6865 | esac |
|
6865 | esac | |
6866 | done |
|
6866 | done | |
6867 |
|
6867 | |||
6868 | } |
|
6868 | } | |
6869 |
|
6869 | |||
6870 | # :command.parse_requirements |
|
6870 | # :command.parse_requirements | |
6871 | rcstack_cli_set_runtime_image_parse_requirements() { |
|
6871 | rcstack_cli_set_runtime_image_parse_requirements() { | |
6872 | # :command.fixed_flags_filter |
|
6872 | # :command.fixed_flags_filter | |
6873 | while [[ $# -gt 0 ]]; do |
|
6873 | while [[ $# -gt 0 ]]; do | |
6874 | case "${1:-}" in |
|
6874 | case "${1:-}" in | |
6875 | --help | -h) |
|
6875 | --help | -h) | |
6876 | long_usage=yes |
|
6876 | long_usage=yes | |
6877 | rcstack_cli_set_runtime_image_usage |
|
6877 | rcstack_cli_set_runtime_image_usage | |
6878 | exit |
|
6878 | exit | |
6879 | ;; |
|
6879 | ;; | |
6880 |
|
6880 | |||
6881 | *) |
|
6881 | *) | |
6882 | break |
|
6882 | break | |
6883 | ;; |
|
6883 | ;; | |
6884 |
|
6884 | |||
6885 | esac |
|
6885 | esac | |
6886 | done |
|
6886 | done | |
6887 |
|
6887 | |||
6888 | # :command.command_filter |
|
6888 | # :command.command_filter | |
6889 | action="cli set-runtime-image" |
|
6889 | action="cli set-runtime-image" | |
6890 |
|
6890 | |||
6891 | # :command.parse_requirements_while |
|
6891 | # :command.parse_requirements_while | |
6892 | while [[ $# -gt 0 ]]; do |
|
6892 | while [[ $# -gt 0 ]]; do | |
6893 | key="$1" |
|
6893 | key="$1" | |
6894 | case "$key" in |
|
6894 | case "$key" in | |
6895 |
|
6895 | |||
6896 | -?*) |
|
6896 | -?*) | |
6897 | printf "invalid option: %s\n" "$key" >&2 |
|
6897 | printf "invalid option: %s\n" "$key" >&2 | |
6898 | exit 1 |
|
6898 | exit 1 | |
6899 | ;; |
|
6899 | ;; | |
6900 |
|
6900 | |||
6901 | *) |
|
6901 | *) | |
6902 | # :command.parse_requirements_case |
|
6902 | # :command.parse_requirements_case | |
6903 | # :command.parse_requirements_case_simple |
|
6903 | # :command.parse_requirements_case_simple | |
6904 | if [[ -z ${args['version']+x} ]]; then |
|
6904 | if [[ -z ${args['version']+x} ]]; then | |
6905 |
|
6905 | |||
6906 | args['version']=$1 |
|
6906 | args['version']=$1 | |
6907 | shift |
|
6907 | shift | |
6908 | else |
|
6908 | else | |
6909 | printf "invalid argument: %s\n" "$key" >&2 |
|
6909 | printf "invalid argument: %s\n" "$key" >&2 | |
6910 | exit 1 |
|
6910 | exit 1 | |
6911 | fi |
|
6911 | fi | |
6912 |
|
6912 | |||
6913 | ;; |
|
6913 | ;; | |
6914 |
|
6914 | |||
6915 | esac |
|
6915 | esac | |
6916 | done |
|
6916 | done | |
6917 |
|
6917 | |||
6918 | # :command.required_args_filter |
|
6918 | # :command.required_args_filter | |
6919 | if [[ -z ${args['version']+x} ]]; then |
|
6919 | if [[ -z ${args['version']+x} ]]; then | |
6920 | printf "missing required argument: VERSION\nusage: rcstack cli set-runtime-image VERSION\n" >&2 |
|
6920 | printf "missing required argument: VERSION\nusage: rcstack cli set-runtime-image VERSION\n" >&2 | |
6921 | exit 1 |
|
6921 | exit 1 | |
6922 | fi |
|
6922 | fi | |
6923 |
|
6923 | |||
6924 | } |
|
6924 | } | |
6925 |
|
6925 | |||
6926 | # :command.parse_requirements |
|
6926 | # :command.parse_requirements | |
6927 | rcstack_cli_docker_info_parse_requirements() { |
|
6927 | rcstack_cli_docker_info_parse_requirements() { | |
6928 | # :command.fixed_flags_filter |
|
6928 | # :command.fixed_flags_filter | |
6929 | while [[ $# -gt 0 ]]; do |
|
6929 | while [[ $# -gt 0 ]]; do | |
6930 | case "${1:-}" in |
|
6930 | case "${1:-}" in | |
6931 | --help | -h) |
|
6931 | --help | -h) | |
6932 | long_usage=yes |
|
6932 | long_usage=yes | |
6933 | rcstack_cli_docker_info_usage |
|
6933 | rcstack_cli_docker_info_usage | |
6934 | exit |
|
6934 | exit | |
6935 | ;; |
|
6935 | ;; | |
6936 |
|
6936 | |||
6937 | *) |
|
6937 | *) | |
6938 | break |
|
6938 | break | |
6939 | ;; |
|
6939 | ;; | |
6940 |
|
6940 | |||
6941 | esac |
|
6941 | esac | |
6942 | done |
|
6942 | done | |
6943 |
|
6943 | |||
6944 | # :command.command_filter |
|
6944 | # :command.command_filter | |
6945 | action="cli docker-info" |
|
6945 | action="cli docker-info" | |
6946 |
|
6946 | |||
6947 | # :command.parse_requirements_while |
|
6947 | # :command.parse_requirements_while | |
6948 | while [[ $# -gt 0 ]]; do |
|
6948 | while [[ $# -gt 0 ]]; do | |
6949 | key="$1" |
|
6949 | key="$1" | |
6950 | case "$key" in |
|
6950 | case "$key" in | |
6951 | # :flag.case |
|
6951 | # :flag.case | |
6952 | --verbose) |
|
6952 | --verbose) | |
6953 |
|
6953 | |||
6954 | # :flag.case_no_arg |
|
6954 | # :flag.case_no_arg | |
6955 | args['--verbose']=1 |
|
6955 | args['--verbose']=1 | |
6956 | shift |
|
6956 | shift | |
6957 | ;; |
|
6957 | ;; | |
6958 |
|
6958 | |||
6959 | -?*) |
|
6959 | -?*) | |
6960 | printf "invalid option: %s\n" "$key" >&2 |
|
6960 | printf "invalid option: %s\n" "$key" >&2 | |
6961 | exit 1 |
|
6961 | exit 1 | |
6962 | ;; |
|
6962 | ;; | |
6963 |
|
6963 | |||
6964 | *) |
|
6964 | *) | |
6965 | # :command.parse_requirements_case |
|
6965 | # :command.parse_requirements_case | |
6966 | # :command.parse_requirements_case_simple |
|
6966 | # :command.parse_requirements_case_simple | |
6967 | printf "invalid argument: %s\n" "$key" >&2 |
|
6967 | printf "invalid argument: %s\n" "$key" >&2 | |
6968 | exit 1 |
|
6968 | exit 1 | |
6969 |
|
6969 | |||
6970 | ;; |
|
6970 | ;; | |
6971 |
|
6971 | |||
6972 | esac |
|
6972 | esac | |
6973 | done |
|
6973 | done | |
6974 |
|
6974 | |||
6975 | } |
|
6975 | } | |
6976 |
|
6976 | |||
6977 | # :command.parse_requirements |
|
6977 | # :command.parse_requirements | |
6978 | rcstack_cli_docker_upgrade_parse_requirements() { |
|
6978 | rcstack_cli_docker_upgrade_parse_requirements() { | |
6979 | # :command.fixed_flags_filter |
|
6979 | # :command.fixed_flags_filter | |
6980 | while [[ $# -gt 0 ]]; do |
|
6980 | while [[ $# -gt 0 ]]; do | |
6981 | case "${1:-}" in |
|
6981 | case "${1:-}" in | |
6982 | --help | -h) |
|
6982 | --help | -h) | |
6983 | long_usage=yes |
|
6983 | long_usage=yes | |
6984 | rcstack_cli_docker_upgrade_usage |
|
6984 | rcstack_cli_docker_upgrade_usage | |
6985 | exit |
|
6985 | exit | |
6986 | ;; |
|
6986 | ;; | |
6987 |
|
6987 | |||
6988 | *) |
|
6988 | *) | |
6989 | break |
|
6989 | break | |
6990 | ;; |
|
6990 | ;; | |
6991 |
|
6991 | |||
6992 | esac |
|
6992 | esac | |
6993 | done |
|
6993 | done | |
6994 |
|
6994 | |||
6995 | # :command.command_filter |
|
6995 | # :command.command_filter | |
6996 | action="cli docker-upgrade" |
|
6996 | action="cli docker-upgrade" | |
6997 |
|
6997 | |||
6998 | # :command.parse_requirements_while |
|
6998 | # :command.parse_requirements_while | |
6999 | while [[ $# -gt 0 ]]; do |
|
6999 | while [[ $# -gt 0 ]]; do | |
7000 | key="$1" |
|
7000 | key="$1" | |
7001 | case "$key" in |
|
7001 | case "$key" in | |
7002 | # :flag.case |
|
7002 | # :flag.case | |
7003 | --compose) |
|
7003 | --compose) | |
7004 |
|
7004 | |||
7005 | # :flag.case_no_arg |
|
7005 | # :flag.case_no_arg | |
7006 | args['--compose']=1 |
|
7006 | args['--compose']=1 | |
7007 | shift |
|
7007 | shift | |
7008 | ;; |
|
7008 | ;; | |
7009 |
|
7009 | |||
7010 | -?*) |
|
7010 | -?*) | |
7011 | printf "invalid option: %s\n" "$key" >&2 |
|
7011 | printf "invalid option: %s\n" "$key" >&2 | |
7012 | exit 1 |
|
7012 | exit 1 | |
7013 | ;; |
|
7013 | ;; | |
7014 |
|
7014 | |||
7015 | *) |
|
7015 | *) | |
7016 | # :command.parse_requirements_case |
|
7016 | # :command.parse_requirements_case | |
7017 | # :command.parse_requirements_case_simple |
|
7017 | # :command.parse_requirements_case_simple | |
7018 | printf "invalid argument: %s\n" "$key" >&2 |
|
7018 | printf "invalid argument: %s\n" "$key" >&2 | |
7019 | exit 1 |
|
7019 | exit 1 | |
7020 |
|
7020 | |||
7021 | ;; |
|
7021 | ;; | |
7022 |
|
7022 | |||
7023 | esac |
|
7023 | esac | |
7024 | done |
|
7024 | done | |
7025 |
|
7025 | |||
7026 | } |
|
7026 | } | |
7027 |
|
7027 | |||
7028 | # :command.parse_requirements |
|
7028 | # :command.parse_requirements | |
7029 | rcstack_cli_redis_parse_requirements() { |
|
7029 | rcstack_cli_redis_parse_requirements() { | |
7030 | # :command.fixed_flags_filter |
|
7030 | # :command.fixed_flags_filter | |
7031 | while [[ $# -gt 0 ]]; do |
|
7031 | while [[ $# -gt 0 ]]; do | |
7032 | case "${1:-}" in |
|
7032 | case "${1:-}" in | |
7033 | --help | -h) |
|
7033 | --help | -h) | |
7034 | long_usage=yes |
|
7034 | long_usage=yes | |
7035 | rcstack_cli_redis_usage |
|
7035 | rcstack_cli_redis_usage | |
7036 | exit |
|
7036 | exit | |
7037 | ;; |
|
7037 | ;; | |
7038 |
|
7038 | |||
7039 | *) |
|
7039 | *) | |
7040 | break |
|
7040 | break | |
7041 | ;; |
|
7041 | ;; | |
7042 |
|
7042 | |||
7043 | esac |
|
7043 | esac | |
7044 | done |
|
7044 | done | |
7045 |
|
7045 | |||
7046 | # :command.command_filter |
|
7046 | # :command.command_filter | |
7047 | action="cli redis" |
|
7047 | action="cli redis" | |
7048 |
|
7048 | |||
7049 | # :command.parse_requirements_while |
|
7049 | # :command.parse_requirements_while | |
7050 | while [[ $# -gt 0 ]]; do |
|
7050 | while [[ $# -gt 0 ]]; do | |
7051 | key="$1" |
|
7051 | key="$1" | |
7052 | case "$key" in |
|
7052 | case "$key" in | |
7053 | # :flag.case |
|
7053 | # :flag.case | |
7054 | --no-tty) |
|
7054 | --no-tty) | |
7055 |
|
7055 | |||
7056 | # :flag.case_no_arg |
|
7056 | # :flag.case_no_arg | |
7057 | args['--no-tty']=1 |
|
7057 | args['--no-tty']=1 | |
7058 | shift |
|
7058 | shift | |
7059 | ;; |
|
7059 | ;; | |
7060 |
|
7060 | |||
7061 | # :flag.case |
|
7061 | # :flag.case | |
7062 | --user) |
|
7062 | --user) | |
7063 |
|
7063 | |||
7064 | # :flag.case_no_arg |
|
7064 | # :flag.case_no_arg | |
7065 | args['--user']=1 |
|
7065 | args['--user']=1 | |
7066 | shift |
|
7066 | shift | |
7067 | ;; |
|
7067 | ;; | |
7068 |
|
7068 | |||
7069 | # :flag.case |
|
7069 | # :flag.case | |
7070 | --env-file-path) |
|
7070 | --env-file-path) | |
7071 |
|
7071 | |||
7072 | # :flag.case_arg |
|
7072 | # :flag.case_arg | |
7073 | if [[ -n ${2+x} ]]; then |
|
7073 | if [[ -n ${2+x} ]]; then | |
7074 | # :flag.validations |
|
7074 | # :flag.validations | |
7075 | if [[ -n $(validate_file_exists "$2") ]]; then |
|
7075 | if [[ -n $(validate_file_exists "$2") ]]; then | |
7076 | printf "validation error in %s:\n%s\n" "--env-file-path ENV_FILE_PATH" "$(validate_file_exists "$2")" >&2 |
|
7076 | printf "validation error in %s:\n%s\n" "--env-file-path ENV_FILE_PATH" "$(validate_file_exists "$2")" >&2 | |
7077 | exit 1 |
|
7077 | exit 1 | |
7078 | fi |
|
7078 | fi | |
7079 |
|
7079 | |||
7080 | args['--env-file-path']="$2" |
|
7080 | args['--env-file-path']="$2" | |
7081 | shift |
|
7081 | shift | |
7082 | shift |
|
7082 | shift | |
7083 | else |
|
7083 | else | |
7084 | printf "%s\n" "--env-file-path requires an argument: --env-file-path ENV_FILE_PATH" >&2 |
|
7084 | printf "%s\n" "--env-file-path requires an argument: --env-file-path ENV_FILE_PATH" >&2 | |
7085 | exit 1 |
|
7085 | exit 1 | |
7086 | fi |
|
7086 | fi | |
7087 | ;; |
|
7087 | ;; | |
7088 |
|
7088 | |||
7089 | # :flag.case |
|
7089 | # :flag.case | |
7090 | --db) |
|
7090 | --db) | |
7091 |
|
7091 | |||
7092 | # :flag.case_arg |
|
7092 | # :flag.case_arg | |
7093 | if [[ -n ${2+x} ]]; then |
|
7093 | if [[ -n ${2+x} ]]; then | |
7094 |
|
7094 | |||
7095 | args['--db']="$2" |
|
7095 | args['--db']="$2" | |
7096 | shift |
|
7096 | shift | |
7097 | shift |
|
7097 | shift | |
7098 | else |
|
7098 | else | |
7099 | printf "%s\n" "--db requires an argument: --db DB" >&2 |
|
7099 | printf "%s\n" "--db requires an argument: --db DB" >&2 | |
7100 | exit 1 |
|
7100 | exit 1 | |
7101 | fi |
|
7101 | fi | |
7102 | ;; |
|
7102 | ;; | |
7103 |
|
7103 | |||
7104 | -?*) |
|
7104 | -?*) | |
7105 | printf "invalid option: %s\n" "$key" >&2 |
|
7105 | printf "invalid option: %s\n" "$key" >&2 | |
7106 | exit 1 |
|
7106 | exit 1 | |
7107 | ;; |
|
7107 | ;; | |
7108 |
|
7108 | |||
7109 | *) |
|
7109 | *) | |
7110 | # :command.parse_requirements_case |
|
7110 | # :command.parse_requirements_case | |
7111 | # :command.parse_requirements_case_simple |
|
7111 | # :command.parse_requirements_case_simple | |
7112 | printf "invalid argument: %s\n" "$key" >&2 |
|
7112 | printf "invalid argument: %s\n" "$key" >&2 | |
7113 | exit 1 |
|
7113 | exit 1 | |
7114 |
|
7114 | |||
7115 | ;; |
|
7115 | ;; | |
7116 |
|
7116 | |||
7117 | esac |
|
7117 | esac | |
7118 | done |
|
7118 | done | |
7119 |
|
7119 | |||
7120 | # :command.default_assignments |
|
7120 | # :command.default_assignments | |
7121 | [[ -n ${args['--env-file-path']:-} ]] || args['--env-file-path']="$PWD/.custom/.runtime.env" |
|
7121 | [[ -n ${args['--env-file-path']:-} ]] || args['--env-file-path']="$PWD/.custom/.runtime.env" | |
7122 | [[ -n ${args['--db']:-} ]] || args['--db']="0" |
|
7122 | [[ -n ${args['--db']:-} ]] || args['--db']="0" | |
7123 |
|
7123 | |||
7124 | } |
|
7124 | } | |
7125 |
|
7125 | |||
7126 | # :command.parse_requirements |
|
7126 | # :command.parse_requirements | |
7127 | rcstack_cli_db_parse_requirements() { |
|
7127 | rcstack_cli_db_parse_requirements() { | |
7128 | # :command.fixed_flags_filter |
|
7128 | # :command.fixed_flags_filter | |
7129 | while [[ $# -gt 0 ]]; do |
|
7129 | while [[ $# -gt 0 ]]; do | |
7130 | case "${1:-}" in |
|
7130 | case "${1:-}" in | |
7131 | --help | -h) |
|
7131 | --help | -h) | |
7132 | long_usage=yes |
|
7132 | long_usage=yes | |
7133 | rcstack_cli_db_usage |
|
7133 | rcstack_cli_db_usage | |
7134 | exit |
|
7134 | exit | |
7135 | ;; |
|
7135 | ;; | |
7136 |
|
7136 | |||
7137 | *) |
|
7137 | *) | |
7138 | break |
|
7138 | break | |
7139 | ;; |
|
7139 | ;; | |
7140 |
|
7140 | |||
7141 | esac |
|
7141 | esac | |
7142 | done |
|
7142 | done | |
7143 |
|
7143 | |||
7144 | # :command.command_filter |
|
7144 | # :command.command_filter | |
7145 | action="cli db" |
|
7145 | action="cli db" | |
7146 |
|
7146 | |||
7147 | # :command.parse_requirements_while |
|
7147 | # :command.parse_requirements_while | |
7148 | while [[ $# -gt 0 ]]; do |
|
7148 | while [[ $# -gt 0 ]]; do | |
7149 | key="$1" |
|
7149 | key="$1" | |
7150 | case "$key" in |
|
7150 | case "$key" in | |
7151 | # :flag.case |
|
7151 | # :flag.case | |
7152 | --no-tty) |
|
7152 | --no-tty) | |
7153 |
|
7153 | |||
7154 | # :flag.case_no_arg |
|
7154 | # :flag.case_no_arg | |
7155 | args['--no-tty']=1 |
|
7155 | args['--no-tty']=1 | |
7156 | shift |
|
7156 | shift | |
7157 | ;; |
|
7157 | ;; | |
7158 |
|
7158 | |||
7159 | # :flag.case |
|
7159 | # :flag.case | |
7160 | --user) |
|
7160 | --user) | |
7161 |
|
7161 | |||
7162 | # :flag.case_no_arg |
|
7162 | # :flag.case_no_arg | |
7163 | args['--user']=1 |
|
7163 | args['--user']=1 | |
7164 | shift |
|
7164 | shift | |
7165 | ;; |
|
7165 | ;; | |
7166 |
|
7166 | |||
7167 | # :flag.case |
|
7167 | # :flag.case | |
7168 | --env-file-path) |
|
7168 | --env-file-path) | |
7169 |
|
7169 | |||
7170 | # :flag.case_arg |
|
7170 | # :flag.case_arg | |
7171 | if [[ -n ${2+x} ]]; then |
|
7171 | if [[ -n ${2+x} ]]; then | |
7172 | # :flag.validations |
|
7172 | # :flag.validations | |
7173 | if [[ -n $(validate_file_exists "$2") ]]; then |
|
7173 | if [[ -n $(validate_file_exists "$2") ]]; then | |
7174 | printf "validation error in %s:\n%s\n" "--env-file-path ENV_FILE_PATH" "$(validate_file_exists "$2")" >&2 |
|
7174 | printf "validation error in %s:\n%s\n" "--env-file-path ENV_FILE_PATH" "$(validate_file_exists "$2")" >&2 | |
7175 | exit 1 |
|
7175 | exit 1 | |
7176 | fi |
|
7176 | fi | |
7177 |
|
7177 | |||
7178 | args['--env-file-path']="$2" |
|
7178 | args['--env-file-path']="$2" | |
7179 | shift |
|
7179 | shift | |
7180 | shift |
|
7180 | shift | |
7181 | else |
|
7181 | else | |
7182 | printf "%s\n" "--env-file-path requires an argument: --env-file-path ENV_FILE_PATH" >&2 |
|
7182 | printf "%s\n" "--env-file-path requires an argument: --env-file-path ENV_FILE_PATH" >&2 | |
7183 | exit 1 |
|
7183 | exit 1 | |
7184 | fi |
|
7184 | fi | |
7185 | ;; |
|
7185 | ;; | |
7186 |
|
7186 | |||
7187 | -?*) |
|
7187 | -?*) | |
7188 | printf "invalid option: %s\n" "$key" >&2 |
|
7188 | printf "invalid option: %s\n" "$key" >&2 | |
7189 | exit 1 |
|
7189 | exit 1 | |
7190 | ;; |
|
7190 | ;; | |
7191 |
|
7191 | |||
7192 | *) |
|
7192 | *) | |
7193 | # :command.parse_requirements_case |
|
7193 | # :command.parse_requirements_case | |
7194 | # :command.parse_requirements_case_simple |
|
7194 | # :command.parse_requirements_case_simple | |
7195 | printf "invalid argument: %s\n" "$key" >&2 |
|
7195 | printf "invalid argument: %s\n" "$key" >&2 | |
7196 | exit 1 |
|
7196 | exit 1 | |
7197 |
|
7197 | |||
7198 | ;; |
|
7198 | ;; | |
7199 |
|
7199 | |||
7200 | esac |
|
7200 | esac | |
7201 | done |
|
7201 | done | |
7202 |
|
7202 | |||
7203 | # :command.default_assignments |
|
7203 | # :command.default_assignments | |
7204 | [[ -n ${args['--env-file-path']:-} ]] || args['--env-file-path']="$PWD/.custom/.runtime.env" |
|
7204 | [[ -n ${args['--env-file-path']:-} ]] || args['--env-file-path']="$PWD/.custom/.runtime.env" | |
7205 |
|
7205 | |||
7206 | } |
|
7206 | } | |
7207 |
|
7207 | |||
7208 | # :command.parse_requirements |
|
7208 | # :command.parse_requirements | |
7209 | rcstack_cli_db_upgrade_parse_requirements() { |
|
7209 | rcstack_cli_db_upgrade_parse_requirements() { | |
7210 | # :command.fixed_flags_filter |
|
7210 | # :command.fixed_flags_filter | |
7211 | while [[ $# -gt 0 ]]; do |
|
7211 | while [[ $# -gt 0 ]]; do | |
7212 | case "${1:-}" in |
|
7212 | case "${1:-}" in | |
7213 | --help | -h) |
|
7213 | --help | -h) | |
7214 | long_usage=yes |
|
7214 | long_usage=yes | |
7215 | rcstack_cli_db_upgrade_usage |
|
7215 | rcstack_cli_db_upgrade_usage | |
7216 | exit |
|
7216 | exit | |
7217 | ;; |
|
7217 | ;; | |
7218 |
|
7218 | |||
7219 | *) |
|
7219 | *) | |
7220 | break |
|
7220 | break | |
7221 | ;; |
|
7221 | ;; | |
7222 |
|
7222 | |||
7223 | esac |
|
7223 | esac | |
7224 | done |
|
7224 | done | |
7225 |
|
7225 | |||
7226 | # :command.command_filter |
|
7226 | # :command.command_filter | |
7227 | action="cli db-upgrade" |
|
7227 | action="cli db-upgrade" | |
7228 |
|
7228 | |||
7229 | # :command.parse_requirements_while |
|
7229 | # :command.parse_requirements_while | |
7230 | while [[ $# -gt 0 ]]; do |
|
7230 | while [[ $# -gt 0 ]]; do | |
7231 | key="$1" |
|
7231 | key="$1" | |
7232 | case "$key" in |
|
7232 | case "$key" in | |
7233 |
|
7233 | |||
7234 | -?*) |
|
7234 | -?*) | |
7235 | printf "invalid option: %s\n" "$key" >&2 |
|
7235 | printf "invalid option: %s\n" "$key" >&2 | |
7236 | exit 1 |
|
7236 | exit 1 | |
7237 | ;; |
|
7237 | ;; | |
7238 |
|
7238 | |||
7239 | *) |
|
7239 | *) | |
7240 | # :command.parse_requirements_case |
|
7240 | # :command.parse_requirements_case | |
7241 | # :command.parse_requirements_case_simple |
|
7241 | # :command.parse_requirements_case_simple | |
7242 | printf "invalid argument: %s\n" "$key" >&2 |
|
7242 | printf "invalid argument: %s\n" "$key" >&2 | |
7243 | exit 1 |
|
7243 | exit 1 | |
7244 |
|
7244 | |||
7245 | ;; |
|
7245 | ;; | |
7246 |
|
7246 | |||
7247 | esac |
|
7247 | esac | |
7248 | done |
|
7248 | done | |
7249 |
|
7249 | |||
7250 | } |
|
7250 | } | |
7251 |
|
7251 | |||
7252 | # :command.parse_requirements |
|
7252 | # :command.parse_requirements | |
7253 | rcstack_cli_storage_parse_requirements() { |
|
7253 | rcstack_cli_storage_parse_requirements() { | |
7254 | # :command.fixed_flags_filter |
|
7254 | # :command.fixed_flags_filter | |
7255 | while [[ $# -gt 0 ]]; do |
|
7255 | while [[ $# -gt 0 ]]; do | |
7256 | case "${1:-}" in |
|
7256 | case "${1:-}" in | |
7257 | --help | -h) |
|
7257 | --help | -h) | |
7258 | long_usage=yes |
|
7258 | long_usage=yes | |
7259 | rcstack_cli_storage_usage |
|
7259 | rcstack_cli_storage_usage | |
7260 | exit |
|
7260 | exit | |
7261 | ;; |
|
7261 | ;; | |
7262 |
|
7262 | |||
7263 | *) |
|
7263 | *) | |
7264 | break |
|
7264 | break | |
7265 | ;; |
|
7265 | ;; | |
7266 |
|
7266 | |||
7267 | esac |
|
7267 | esac | |
7268 | done |
|
7268 | done | |
7269 |
|
7269 | |||
7270 | # :command.command_filter |
|
7270 | # :command.command_filter | |
7271 | action="cli storage" |
|
7271 | action="cli storage" | |
7272 |
|
7272 | |||
7273 | # :command.parse_requirements_while |
|
7273 | # :command.parse_requirements_while | |
7274 | while [[ $# -gt 0 ]]; do |
|
7274 | while [[ $# -gt 0 ]]; do | |
7275 | key="$1" |
|
7275 | key="$1" | |
7276 | case "$key" in |
|
7276 | case "$key" in | |
7277 | # :flag.case |
|
7277 | # :flag.case | |
7278 | --no-tty) |
|
7278 | --no-tty) | |
7279 |
|
7279 | |||
7280 | # :flag.case_no_arg |
|
7280 | # :flag.case_no_arg | |
7281 | args['--no-tty']=1 |
|
7281 | args['--no-tty']=1 | |
7282 | shift |
|
7282 | shift | |
7283 | ;; |
|
7283 | ;; | |
7284 |
|
7284 | |||
7285 | # :flag.case |
|
7285 | # :flag.case | |
7286 | --attached) |
|
7286 | --attached) | |
7287 |
|
7287 | |||
7288 | # :flag.case_arg |
|
7288 | # :flag.case_arg | |
7289 | if [[ -n ${2+x} ]]; then |
|
7289 | if [[ -n ${2+x} ]]; then | |
7290 |
|
7290 | |||
7291 | args['--attached']="$2" |
|
7291 | args['--attached']="$2" | |
7292 | shift |
|
7292 | shift | |
7293 | shift |
|
7293 | shift | |
7294 | else |
|
7294 | else | |
7295 | printf "%s\n" "--attached requires an argument: --attached ATTACHED" >&2 |
|
7295 | printf "%s\n" "--attached requires an argument: --attached ATTACHED" >&2 | |
7296 | exit 1 |
|
7296 | exit 1 | |
7297 | fi |
|
7297 | fi | |
7298 | ;; |
|
7298 | ;; | |
7299 |
|
7299 | |||
7300 | -?*) |
|
7300 | -?*) | |
7301 | printf "invalid option: %s\n" "$key" >&2 |
|
7301 | printf "invalid option: %s\n" "$key" >&2 | |
7302 | exit 1 |
|
7302 | exit 1 | |
7303 | ;; |
|
7303 | ;; | |
7304 |
|
7304 | |||
7305 | *) |
|
7305 | *) | |
7306 | # :command.parse_requirements_case |
|
7306 | # :command.parse_requirements_case | |
7307 | # :command.parse_requirements_case_simple |
|
7307 | # :command.parse_requirements_case_simple | |
7308 | printf "invalid argument: %s\n" "$key" >&2 |
|
7308 | printf "invalid argument: %s\n" "$key" >&2 | |
7309 | exit 1 |
|
7309 | exit 1 | |
7310 |
|
7310 | |||
7311 | ;; |
|
7311 | ;; | |
7312 |
|
7312 | |||
7313 | esac |
|
7313 | esac | |
7314 | done |
|
7314 | done | |
7315 |
|
7315 | |||
7316 | } |
|
7316 | } | |
7317 |
|
7317 | |||
7318 | # :command.parse_requirements |
|
7318 | # :command.parse_requirements | |
7319 | rcstack_cli_attach_parse_requirements() { |
|
7319 | rcstack_cli_attach_parse_requirements() { | |
7320 | # :command.fixed_flags_filter |
|
7320 | # :command.fixed_flags_filter | |
7321 | while [[ $# -gt 0 ]]; do |
|
7321 | while [[ $# -gt 0 ]]; do | |
7322 | case "${1:-}" in |
|
7322 | case "${1:-}" in | |
7323 | --help | -h) |
|
7323 | --help | -h) | |
7324 | long_usage=yes |
|
7324 | long_usage=yes | |
7325 | rcstack_cli_attach_usage |
|
7325 | rcstack_cli_attach_usage | |
7326 | exit |
|
7326 | exit | |
7327 | ;; |
|
7327 | ;; | |
7328 |
|
7328 | |||
7329 | *) |
|
7329 | *) | |
7330 | break |
|
7330 | break | |
7331 | ;; |
|
7331 | ;; | |
7332 |
|
7332 | |||
7333 | esac |
|
7333 | esac | |
7334 | done |
|
7334 | done | |
7335 |
|
7335 | |||
7336 | # :command.command_filter |
|
7336 | # :command.command_filter | |
7337 | action="cli attach" |
|
7337 | action="cli attach" | |
7338 |
|
7338 | |||
7339 | # :command.parse_requirements_while |
|
7339 | # :command.parse_requirements_while | |
7340 | while [[ $# -gt 0 ]]; do |
|
7340 | while [[ $# -gt 0 ]]; do | |
7341 | key="$1" |
|
7341 | key="$1" | |
7342 | case "$key" in |
|
7342 | case "$key" in | |
7343 | # :flag.case |
|
7343 | # :flag.case | |
7344 | --no-tty) |
|
7344 | --no-tty) | |
7345 |
|
7345 | |||
7346 | # :flag.case_no_arg |
|
7346 | # :flag.case_no_arg | |
7347 | args['--no-tty']=1 |
|
7347 | args['--no-tty']=1 | |
7348 | shift |
|
7348 | shift | |
7349 | ;; |
|
7349 | ;; | |
7350 |
|
7350 | |||
7351 | # :flag.case |
|
7351 | # :flag.case | |
7352 | --instance-type) |
|
7352 | --instance-type) | |
7353 |
|
7353 | |||
7354 | # :flag.case_arg |
|
7354 | # :flag.case_arg | |
7355 | if [[ -n ${2+x} ]]; then |
|
7355 | if [[ -n ${2+x} ]]; then | |
7356 |
|
7356 | |||
7357 | args['--instance-type']="$2" |
|
7357 | args['--instance-type']="$2" | |
7358 | shift |
|
7358 | shift | |
7359 | shift |
|
7359 | shift | |
7360 | else |
|
7360 | else | |
7361 | printf "%s\n" "--instance-type requires an argument: --instance-type INSTANCE_TYPE" >&2 |
|
7361 | printf "%s\n" "--instance-type requires an argument: --instance-type INSTANCE_TYPE" >&2 | |
7362 | exit 1 |
|
7362 | exit 1 | |
7363 | fi |
|
7363 | fi | |
7364 | ;; |
|
7364 | ;; | |
7365 |
|
7365 | |||
7366 | -?*) |
|
7366 | -?*) | |
7367 | printf "invalid option: %s\n" "$key" >&2 |
|
7367 | printf "invalid option: %s\n" "$key" >&2 | |
7368 | exit 1 |
|
7368 | exit 1 | |
7369 | ;; |
|
7369 | ;; | |
7370 |
|
7370 | |||
7371 | *) |
|
7371 | *) | |
7372 | # :command.parse_requirements_case |
|
7372 | # :command.parse_requirements_case | |
7373 | # :command.parse_requirements_case_simple |
|
7373 | # :command.parse_requirements_case_simple | |
7374 | printf "invalid argument: %s\n" "$key" >&2 |
|
7374 | printf "invalid argument: %s\n" "$key" >&2 | |
7375 | exit 1 |
|
7375 | exit 1 | |
7376 |
|
7376 | |||
7377 | ;; |
|
7377 | ;; | |
7378 |
|
7378 | |||
7379 | esac |
|
7379 | esac | |
7380 | done |
|
7380 | done | |
7381 |
|
7381 | |||
7382 | # :command.default_assignments |
|
7382 | # :command.default_assignments | |
7383 | [[ -n ${args['--instance-type']:-} ]] || args['--instance-type']="rhodecode" |
|
7383 | [[ -n ${args['--instance-type']:-} ]] || args['--instance-type']="rhodecode" | |
7384 |
|
7384 | |||
7385 | } |
|
7385 | } | |
7386 |
|
7386 | |||
7387 | # :command.parse_requirements |
|
7387 | # :command.parse_requirements | |
7388 | rcstack_cli_set_edition_parse_requirements() { |
|
7388 | rcstack_cli_set_edition_parse_requirements() { | |
7389 | # :command.fixed_flags_filter |
|
7389 | # :command.fixed_flags_filter | |
7390 | while [[ $# -gt 0 ]]; do |
|
7390 | while [[ $# -gt 0 ]]; do | |
7391 | case "${1:-}" in |
|
7391 | case "${1:-}" in | |
7392 | --help | -h) |
|
7392 | --help | -h) | |
7393 | long_usage=yes |
|
7393 | long_usage=yes | |
7394 | rcstack_cli_set_edition_usage |
|
7394 | rcstack_cli_set_edition_usage | |
7395 | exit |
|
7395 | exit | |
7396 | ;; |
|
7396 | ;; | |
7397 |
|
7397 | |||
7398 | *) |
|
7398 | *) | |
7399 | break |
|
7399 | break | |
7400 | ;; |
|
7400 | ;; | |
7401 |
|
7401 | |||
7402 | esac |
|
7402 | esac | |
7403 | done |
|
7403 | done | |
7404 |
|
7404 | |||
7405 | # :command.command_filter |
|
7405 | # :command.command_filter | |
7406 | action="cli set-edition" |
|
7406 | action="cli set-edition" | |
7407 |
|
7407 | |||
7408 | # :command.parse_requirements_while |
|
7408 | # :command.parse_requirements_while | |
7409 | while [[ $# -gt 0 ]]; do |
|
7409 | while [[ $# -gt 0 ]]; do | |
7410 | key="$1" |
|
7410 | key="$1" | |
7411 | case "$key" in |
|
7411 | case "$key" in | |
7412 |
|
7412 | |||
7413 | -?*) |
|
7413 | -?*) | |
7414 | printf "invalid option: %s\n" "$key" >&2 |
|
7414 | printf "invalid option: %s\n" "$key" >&2 | |
7415 | exit 1 |
|
7415 | exit 1 | |
7416 | ;; |
|
7416 | ;; | |
7417 |
|
7417 | |||
7418 | *) |
|
7418 | *) | |
7419 | # :command.parse_requirements_case |
|
7419 | # :command.parse_requirements_case | |
7420 | # :command.parse_requirements_case_simple |
|
7420 | # :command.parse_requirements_case_simple | |
7421 | if [[ -z ${args['edition_type']+x} ]]; then |
|
7421 | if [[ -z ${args['edition_type']+x} ]]; then | |
7422 |
|
7422 | |||
7423 | args['edition_type']=$1 |
|
7423 | args['edition_type']=$1 | |
7424 | shift |
|
7424 | shift | |
7425 | else |
|
7425 | else | |
7426 | printf "invalid argument: %s\n" "$key" >&2 |
|
7426 | printf "invalid argument: %s\n" "$key" >&2 | |
7427 | exit 1 |
|
7427 | exit 1 | |
7428 | fi |
|
7428 | fi | |
7429 |
|
7429 | |||
7430 | ;; |
|
7430 | ;; | |
7431 |
|
7431 | |||
7432 | esac |
|
7432 | esac | |
7433 | done |
|
7433 | done | |
7434 |
|
7434 | |||
7435 | # :command.required_args_filter |
|
7435 | # :command.required_args_filter | |
7436 | if [[ -z ${args['edition_type']+x} ]]; then |
|
7436 | if [[ -z ${args['edition_type']+x} ]]; then | |
7437 | printf "missing required argument: EDITION_TYPE\nusage: rcstack cli set-edition EDITION_TYPE\n" >&2 |
|
7437 | printf "missing required argument: EDITION_TYPE\nusage: rcstack cli set-edition EDITION_TYPE\n" >&2 | |
7438 | exit 1 |
|
7438 | exit 1 | |
7439 | fi |
|
7439 | fi | |
7440 |
|
7440 | |||
7441 | # :command.whitelist_filter |
|
7441 | # :command.whitelist_filter | |
7442 | if [[ -n ${args['edition_type']} ]] && [[ ! ${args['edition_type']} =~ ^(ce|ee)$ ]]; then |
|
7442 | if [[ -n ${args['edition_type']} ]] && [[ ! ${args['edition_type']} =~ ^(ce|ee)$ ]]; then | |
7443 | printf "%s\n" "edition_type must be one of: ce, ee" >&2 |
|
7443 | printf "%s\n" "edition_type must be one of: ce, ee" >&2 | |
7444 | exit 1 |
|
7444 | exit 1 | |
7445 | fi |
|
7445 | fi | |
7446 |
|
7446 | |||
7447 | } |
|
7447 | } | |
7448 |
|
7448 | |||
7449 | # :command.parse_requirements |
|
7449 | # :command.parse_requirements | |
7450 | rcstack_cli_configure_vcsserver_parse_requirements() { |
|
7450 | rcstack_cli_configure_vcsserver_parse_requirements() { | |
7451 | # :command.fixed_flags_filter |
|
7451 | # :command.fixed_flags_filter | |
7452 | while [[ $# -gt 0 ]]; do |
|
7452 | while [[ $# -gt 0 ]]; do | |
7453 | case "${1:-}" in |
|
7453 | case "${1:-}" in | |
7454 | --help | -h) |
|
7454 | --help | -h) | |
7455 | long_usage=yes |
|
7455 | long_usage=yes | |
7456 | rcstack_cli_configure_vcsserver_usage |
|
7456 | rcstack_cli_configure_vcsserver_usage | |
7457 | exit |
|
7457 | exit | |
7458 | ;; |
|
7458 | ;; | |
7459 |
|
7459 | |||
7460 | *) |
|
7460 | *) | |
7461 | break |
|
7461 | break | |
7462 | ;; |
|
7462 | ;; | |
7463 |
|
7463 | |||
7464 | esac |
|
7464 | esac | |
7465 | done |
|
7465 | done | |
7466 |
|
7466 | |||
7467 | # :command.command_filter |
|
7467 | # :command.command_filter | |
7468 | action="cli configure-vcsserver" |
|
7468 | action="cli configure-vcsserver" | |
7469 |
|
7469 | |||
7470 | # :command.parse_requirements_while |
|
7470 | # :command.parse_requirements_while | |
7471 | while [[ $# -gt 0 ]]; do |
|
7471 | while [[ $# -gt 0 ]]; do | |
7472 | key="$1" |
|
7472 | key="$1" | |
7473 | case "$key" in |
|
7473 | case "$key" in | |
7474 |
|
7474 | |||
7475 | -?*) |
|
7475 | -?*) | |
7476 | printf "invalid option: %s\n" "$key" >&2 |
|
7476 | printf "invalid option: %s\n" "$key" >&2 | |
7477 | exit 1 |
|
7477 | exit 1 | |
7478 | ;; |
|
7478 | ;; | |
7479 |
|
7479 | |||
7480 | *) |
|
7480 | *) | |
7481 | # :command.parse_requirements_case |
|
7481 | # :command.parse_requirements_case | |
7482 | # :command.parse_requirements_case_simple |
|
7482 | # :command.parse_requirements_case_simple | |
7483 | if [[ -z ${args['ini_path']+x} ]]; then |
|
7483 | if [[ -z ${args['ini_path']+x} ]]; then | |
7484 | # :argument.validations |
|
7484 | # :argument.validations | |
7485 | if [[ -n $(validate_file_exists "$1") ]]; then |
|
7485 | if [[ -n $(validate_file_exists "$1") ]]; then | |
7486 | printf "validation error in %s:\n%s\n" "INI_PATH" "$(validate_file_exists "$1")" >&2 |
|
7486 | printf "validation error in %s:\n%s\n" "INI_PATH" "$(validate_file_exists "$1")" >&2 | |
7487 | exit 1 |
|
7487 | exit 1 | |
7488 | fi |
|
7488 | fi | |
7489 |
|
7489 | |||
7490 | args['ini_path']=$1 |
|
7490 | args['ini_path']=$1 | |
7491 | shift |
|
7491 | shift | |
7492 | else |
|
7492 | else | |
7493 | printf "invalid argument: %s\n" "$key" >&2 |
|
7493 | printf "invalid argument: %s\n" "$key" >&2 | |
7494 | exit 1 |
|
7494 | exit 1 | |
7495 | fi |
|
7495 | fi | |
7496 |
|
7496 | |||
7497 | ;; |
|
7497 | ;; | |
7498 |
|
7498 | |||
7499 | esac |
|
7499 | esac | |
7500 | done |
|
7500 | done | |
7501 |
|
7501 | |||
7502 | # :command.required_args_filter |
|
7502 | # :command.required_args_filter | |
7503 | if [[ -z ${args['ini_path']+x} ]]; then |
|
7503 | if [[ -z ${args['ini_path']+x} ]]; then | |
7504 | printf "missing required argument: INI_PATH\nusage: rcstack cli configure-vcsserver INI_PATH\n" >&2 |
|
7504 | printf "missing required argument: INI_PATH\nusage: rcstack cli configure-vcsserver INI_PATH\n" >&2 | |
7505 | exit 1 |
|
7505 | exit 1 | |
7506 | fi |
|
7506 | fi | |
7507 |
|
7507 | |||
7508 | } |
|
7508 | } | |
7509 |
|
7509 | |||
7510 | # :command.parse_requirements |
|
7510 | # :command.parse_requirements | |
7511 | rcstack_cli_configure_rhodecode_parse_requirements() { |
|
7511 | rcstack_cli_configure_rhodecode_parse_requirements() { | |
7512 | # :command.fixed_flags_filter |
|
7512 | # :command.fixed_flags_filter | |
7513 | while [[ $# -gt 0 ]]; do |
|
7513 | while [[ $# -gt 0 ]]; do | |
7514 | case "${1:-}" in |
|
7514 | case "${1:-}" in | |
7515 | --help | -h) |
|
7515 | --help | -h) | |
7516 | long_usage=yes |
|
7516 | long_usage=yes | |
7517 | rcstack_cli_configure_rhodecode_usage |
|
7517 | rcstack_cli_configure_rhodecode_usage | |
7518 | exit |
|
7518 | exit | |
7519 | ;; |
|
7519 | ;; | |
7520 |
|
7520 | |||
7521 | *) |
|
7521 | *) | |
7522 | break |
|
7522 | break | |
7523 | ;; |
|
7523 | ;; | |
7524 |
|
7524 | |||
7525 | esac |
|
7525 | esac | |
7526 | done |
|
7526 | done | |
7527 |
|
7527 | |||
7528 | # :command.command_filter |
|
7528 | # :command.command_filter | |
7529 | action="cli configure-rhodecode" |
|
7529 | action="cli configure-rhodecode" | |
7530 |
|
7530 | |||
7531 | # :command.parse_requirements_while |
|
7531 | # :command.parse_requirements_while | |
7532 | while [[ $# -gt 0 ]]; do |
|
7532 | while [[ $# -gt 0 ]]; do | |
7533 | key="$1" |
|
7533 | key="$1" | |
7534 | case "$key" in |
|
7534 | case "$key" in | |
7535 |
|
7535 | |||
7536 | -?*) |
|
7536 | -?*) | |
7537 | printf "invalid option: %s\n" "$key" >&2 |
|
7537 | printf "invalid option: %s\n" "$key" >&2 | |
7538 | exit 1 |
|
7538 | exit 1 | |
7539 | ;; |
|
7539 | ;; | |
7540 |
|
7540 | |||
7541 | *) |
|
7541 | *) | |
7542 | # :command.parse_requirements_case |
|
7542 | # :command.parse_requirements_case | |
7543 | # :command.parse_requirements_case_simple |
|
7543 | # :command.parse_requirements_case_simple | |
7544 | if [[ -z ${args['ini_path']+x} ]]; then |
|
7544 | if [[ -z ${args['ini_path']+x} ]]; then | |
7545 | # :argument.validations |
|
7545 | # :argument.validations | |
7546 | if [[ -n $(validate_file_exists "$1") ]]; then |
|
7546 | if [[ -n $(validate_file_exists "$1") ]]; then | |
7547 | printf "validation error in %s:\n%s\n" "INI_PATH" "$(validate_file_exists "$1")" >&2 |
|
7547 | printf "validation error in %s:\n%s\n" "INI_PATH" "$(validate_file_exists "$1")" >&2 | |
7548 | exit 1 |
|
7548 | exit 1 | |
7549 | fi |
|
7549 | fi | |
7550 |
|
7550 | |||
7551 | args['ini_path']=$1 |
|
7551 | args['ini_path']=$1 | |
7552 | shift |
|
7552 | shift | |
7553 | else |
|
7553 | else | |
7554 | printf "invalid argument: %s\n" "$key" >&2 |
|
7554 | printf "invalid argument: %s\n" "$key" >&2 | |
7555 | exit 1 |
|
7555 | exit 1 | |
7556 | fi |
|
7556 | fi | |
7557 |
|
7557 | |||
7558 | ;; |
|
7558 | ;; | |
7559 |
|
7559 | |||
7560 | esac |
|
7560 | esac | |
7561 | done |
|
7561 | done | |
7562 |
|
7562 | |||
7563 | # :command.required_args_filter |
|
7563 | # :command.required_args_filter | |
7564 | if [[ -z ${args['ini_path']+x} ]]; then |
|
7564 | if [[ -z ${args['ini_path']+x} ]]; then | |
7565 | printf "missing required argument: INI_PATH\nusage: rcstack cli configure-rhodecode INI_PATH\n" >&2 |
|
7565 | printf "missing required argument: INI_PATH\nusage: rcstack cli configure-rhodecode INI_PATH\n" >&2 | |
7566 | exit 1 |
|
7566 | exit 1 | |
7567 | fi |
|
7567 | fi | |
7568 |
|
7568 | |||
7569 | } |
|
7569 | } | |
7570 |
|
7570 | |||
7571 | # :command.parse_requirements |
|
7571 | # :command.parse_requirements | |
7572 | rcstack_backup_db_parse_requirements() { |
|
7572 | rcstack_backup_db_parse_requirements() { | |
7573 | # :command.fixed_flags_filter |
|
7573 | # :command.fixed_flags_filter | |
7574 | while [[ $# -gt 0 ]]; do |
|
7574 | while [[ $# -gt 0 ]]; do | |
7575 | case "${1:-}" in |
|
7575 | case "${1:-}" in | |
7576 | --help | -h) |
|
7576 | --help | -h) | |
7577 | long_usage=yes |
|
7577 | long_usage=yes | |
7578 | rcstack_backup_db_usage |
|
7578 | rcstack_backup_db_usage | |
7579 | exit |
|
7579 | exit | |
7580 | ;; |
|
7580 | ;; | |
7581 |
|
7581 | |||
7582 | *) |
|
7582 | *) | |
7583 | break |
|
7583 | break | |
7584 | ;; |
|
7584 | ;; | |
7585 |
|
7585 | |||
7586 | esac |
|
7586 | esac | |
7587 | done |
|
7587 | done | |
7588 |
|
7588 | |||
7589 | # :command.dependencies_filter |
|
7589 | # :command.dependencies_filter | |
7590 | if command -v tar >/dev/null 2>&1; then |
|
7590 | if command -v tar >/dev/null 2>&1; then | |
7591 | deps['tar']="$(command -v tar | head -n1)" |
|
7591 | deps['tar']="$(command -v tar | head -n1)" | |
7592 | else |
|
7592 | else | |
7593 | printf "missing dependency: tar\n" >&2 |
|
7593 | printf "missing dependency: tar\n" >&2 | |
7594 | exit 1 |
|
7594 | exit 1 | |
7595 | fi |
|
7595 | fi | |
7596 |
|
7596 | |||
7597 | if command -v gzip >/dev/null 2>&1; then |
|
7597 | if command -v gzip >/dev/null 2>&1; then | |
7598 | deps['gzip']="$(command -v gzip | head -n1)" |
|
7598 | deps['gzip']="$(command -v gzip | head -n1)" | |
7599 | else |
|
7599 | else | |
7600 | printf "missing dependency: gzip\n" >&2 |
|
7600 | printf "missing dependency: gzip\n" >&2 | |
7601 | exit 1 |
|
7601 | exit 1 | |
7602 | fi |
|
7602 | fi | |
7603 |
|
7603 | |||
7604 | # :command.command_filter |
|
7604 | # :command.command_filter | |
7605 | action="backup-db" |
|
7605 | action="backup-db" | |
7606 |
|
7606 | |||
7607 | # :command.parse_requirements_while |
|
7607 | # :command.parse_requirements_while | |
7608 | while [[ $# -gt 0 ]]; do |
|
7608 | while [[ $# -gt 0 ]]; do | |
7609 | key="$1" |
|
7609 | key="$1" | |
7610 | case "$key" in |
|
7610 | case "$key" in | |
7611 |
|
7611 | |||
7612 | -?*) |
|
7612 | -?*) | |
7613 | printf "invalid option: %s\n" "$key" >&2 |
|
7613 | printf "invalid option: %s\n" "$key" >&2 | |
7614 | exit 1 |
|
7614 | exit 1 | |
7615 | ;; |
|
7615 | ;; | |
7616 |
|
7616 | |||
7617 | *) |
|
7617 | *) | |
7618 | # :command.parse_requirements_case |
|
7618 | # :command.parse_requirements_case | |
7619 | # :command.parse_requirements_case_simple |
|
7619 | # :command.parse_requirements_case_simple | |
7620 | if [[ -z ${args['destination']+x} ]]; then |
|
7620 | if [[ -z ${args['destination']+x} ]]; then | |
7621 | # :argument.validations |
|
7621 | # :argument.validations | |
7622 | if [[ -n $(validate_dir_exists "$1") ]]; then |
|
7622 | if [[ -n $(validate_dir_exists "$1") ]]; then | |
7623 | printf "validation error in %s:\n%s\n" "DESTINATION" "$(validate_dir_exists "$1")" >&2 |
|
7623 | printf "validation error in %s:\n%s\n" "DESTINATION" "$(validate_dir_exists "$1")" >&2 | |
7624 | exit 1 |
|
7624 | exit 1 | |
7625 | fi |
|
7625 | fi | |
7626 |
|
7626 | |||
7627 | args['destination']=$1 |
|
7627 | args['destination']=$1 | |
7628 | shift |
|
7628 | shift | |
7629 | else |
|
7629 | else | |
7630 | printf "invalid argument: %s\n" "$key" >&2 |
|
7630 | printf "invalid argument: %s\n" "$key" >&2 | |
7631 | exit 1 |
|
7631 | exit 1 | |
7632 | fi |
|
7632 | fi | |
7633 |
|
7633 | |||
7634 | ;; |
|
7634 | ;; | |
7635 |
|
7635 | |||
7636 | esac |
|
7636 | esac | |
7637 | done |
|
7637 | done | |
7638 |
|
7638 | |||
7639 | # :command.required_args_filter |
|
7639 | # :command.required_args_filter | |
7640 | if [[ -z ${args['destination']+x} ]]; then |
|
7640 | if [[ -z ${args['destination']+x} ]]; then | |
7641 | printf "missing required argument: DESTINATION\nusage: rcstack backup-db DESTINATION\n" >&2 |
|
7641 | printf "missing required argument: DESTINATION\nusage: rcstack backup-db DESTINATION\n" >&2 | |
7642 | exit 1 |
|
7642 | exit 1 | |
7643 | fi |
|
7643 | fi | |
7644 |
|
7644 | |||
7645 | } |
|
7645 | } | |
7646 |
|
7646 | |||
7647 | # :command.parse_requirements |
|
7647 | # :command.parse_requirements | |
7648 | rcstack_backup_data_parse_requirements() { |
|
7648 | rcstack_backup_data_parse_requirements() { | |
7649 | # :command.fixed_flags_filter |
|
7649 | # :command.fixed_flags_filter | |
7650 | while [[ $# -gt 0 ]]; do |
|
7650 | while [[ $# -gt 0 ]]; do | |
7651 | case "${1:-}" in |
|
7651 | case "${1:-}" in | |
7652 | --help | -h) |
|
7652 | --help | -h) | |
7653 | long_usage=yes |
|
7653 | long_usage=yes | |
7654 | rcstack_backup_data_usage |
|
7654 | rcstack_backup_data_usage | |
7655 | exit |
|
7655 | exit | |
7656 | ;; |
|
7656 | ;; | |
7657 |
|
7657 | |||
7658 | *) |
|
7658 | *) | |
7659 | break |
|
7659 | break | |
7660 | ;; |
|
7660 | ;; | |
7661 |
|
7661 | |||
7662 | esac |
|
7662 | esac | |
7663 | done |
|
7663 | done | |
7664 |
|
7664 | |||
7665 | # :command.dependencies_filter |
|
7665 | # :command.dependencies_filter | |
7666 | if command -v tar >/dev/null 2>&1; then |
|
7666 | if command -v tar >/dev/null 2>&1; then | |
7667 | deps['tar']="$(command -v tar | head -n1)" |
|
7667 | deps['tar']="$(command -v tar | head -n1)" | |
7668 | else |
|
7668 | else | |
7669 | printf "missing dependency: tar\n" >&2 |
|
7669 | printf "missing dependency: tar\n" >&2 | |
7670 | exit 1 |
|
7670 | exit 1 | |
7671 | fi |
|
7671 | fi | |
7672 |
|
7672 | |||
7673 | if command -v gzip >/dev/null 2>&1; then |
|
7673 | if command -v gzip >/dev/null 2>&1; then | |
7674 | deps['gzip']="$(command -v gzip | head -n1)" |
|
7674 | deps['gzip']="$(command -v gzip | head -n1)" | |
7675 | else |
|
7675 | else | |
7676 | printf "missing dependency: gzip\n" >&2 |
|
7676 | printf "missing dependency: gzip\n" >&2 | |
7677 | exit 1 |
|
7677 | exit 1 | |
7678 | fi |
|
7678 | fi | |
7679 |
|
7679 | |||
7680 | # :command.command_filter |
|
7680 | # :command.command_filter | |
7681 | action="backup-data" |
|
7681 | action="backup-data" | |
7682 |
|
7682 | |||
7683 | # :command.parse_requirements_while |
|
7683 | # :command.parse_requirements_while | |
7684 | while [[ $# -gt 0 ]]; do |
|
7684 | while [[ $# -gt 0 ]]; do | |
7685 | key="$1" |
|
7685 | key="$1" | |
7686 | case "$key" in |
|
7686 | case "$key" in | |
7687 |
|
7687 | |||
7688 | -?*) |
|
7688 | -?*) | |
7689 | printf "invalid option: %s\n" "$key" >&2 |
|
7689 | printf "invalid option: %s\n" "$key" >&2 | |
7690 | exit 1 |
|
7690 | exit 1 | |
7691 | ;; |
|
7691 | ;; | |
7692 |
|
7692 | |||
7693 | *) |
|
7693 | *) | |
7694 | # :command.parse_requirements_case |
|
7694 | # :command.parse_requirements_case | |
7695 | # :command.parse_requirements_case_simple |
|
7695 | # :command.parse_requirements_case_simple | |
7696 | if [[ -z ${args['destination']+x} ]]; then |
|
7696 | if [[ -z ${args['destination']+x} ]]; then | |
7697 | # :argument.validations |
|
7697 | # :argument.validations | |
7698 | if [[ -n $(validate_dir_exists "$1") ]]; then |
|
7698 | if [[ -n $(validate_dir_exists "$1") ]]; then | |
7699 | printf "validation error in %s:\n%s\n" "DESTINATION" "$(validate_dir_exists "$1")" >&2 |
|
7699 | printf "validation error in %s:\n%s\n" "DESTINATION" "$(validate_dir_exists "$1")" >&2 | |
7700 | exit 1 |
|
7700 | exit 1 | |
7701 | fi |
|
7701 | fi | |
7702 |
|
7702 | |||
7703 | args['destination']=$1 |
|
7703 | args['destination']=$1 | |
7704 | shift |
|
7704 | shift | |
7705 | else |
|
7705 | else | |
7706 | printf "invalid argument: %s\n" "$key" >&2 |
|
7706 | printf "invalid argument: %s\n" "$key" >&2 | |
7707 | exit 1 |
|
7707 | exit 1 | |
7708 | fi |
|
7708 | fi | |
7709 |
|
7709 | |||
7710 | ;; |
|
7710 | ;; | |
7711 |
|
7711 | |||
7712 | esac |
|
7712 | esac | |
7713 | done |
|
7713 | done | |
7714 |
|
7714 | |||
7715 | # :command.required_args_filter |
|
7715 | # :command.required_args_filter | |
7716 | if [[ -z ${args['destination']+x} ]]; then |
|
7716 | if [[ -z ${args['destination']+x} ]]; then | |
7717 | printf "missing required argument: DESTINATION\nusage: rcstack backup-data DESTINATION\n" >&2 |
|
7717 | printf "missing required argument: DESTINATION\nusage: rcstack backup-data DESTINATION\n" >&2 | |
7718 | exit 1 |
|
7718 | exit 1 | |
7719 | fi |
|
7719 | fi | |
7720 |
|
7720 | |||
7721 | } |
|
7721 | } | |
7722 |
|
7722 | |||
7723 | # :command.parse_requirements |
|
7723 | # :command.parse_requirements | |
7724 | rcstack__completions_parse_requirements() { |
|
7724 | rcstack__completions_parse_requirements() { | |
7725 | # :command.fixed_flags_filter |
|
7725 | # :command.fixed_flags_filter | |
7726 | while [[ $# -gt 0 ]]; do |
|
7726 | while [[ $# -gt 0 ]]; do | |
7727 | case "${1:-}" in |
|
7727 | case "${1:-}" in | |
7728 | --help | -h) |
|
7728 | --help | -h) | |
7729 | long_usage=yes |
|
7729 | long_usage=yes | |
7730 | rcstack__completions_usage |
|
7730 | rcstack__completions_usage | |
7731 | exit |
|
7731 | exit | |
7732 | ;; |
|
7732 | ;; | |
7733 |
|
7733 | |||
7734 | *) |
|
7734 | *) | |
7735 | break |
|
7735 | break | |
7736 | ;; |
|
7736 | ;; | |
7737 |
|
7737 | |||
7738 | esac |
|
7738 | esac | |
7739 | done |
|
7739 | done | |
7740 |
|
7740 | |||
7741 | # :command.command_filter |
|
7741 | # :command.command_filter | |
7742 | action="_completions" |
|
7742 | action="_completions" | |
7743 |
|
7743 | |||
7744 | # :command.parse_requirements_while |
|
7744 | # :command.parse_requirements_while | |
7745 | while [[ $# -gt 0 ]]; do |
|
7745 | while [[ $# -gt 0 ]]; do | |
7746 | key="$1" |
|
7746 | key="$1" | |
7747 | case "$key" in |
|
7747 | case "$key" in | |
7748 |
|
7748 | |||
7749 | -?*) |
|
7749 | -?*) | |
7750 | printf "invalid option: %s\n" "$key" >&2 |
|
7750 | printf "invalid option: %s\n" "$key" >&2 | |
7751 | exit 1 |
|
7751 | exit 1 | |
7752 | ;; |
|
7752 | ;; | |
7753 |
|
7753 | |||
7754 | *) |
|
7754 | *) | |
7755 | # :command.parse_requirements_case |
|
7755 | # :command.parse_requirements_case | |
7756 | # :command.parse_requirements_case_simple |
|
7756 | # :command.parse_requirements_case_simple | |
7757 | printf "invalid argument: %s\n" "$key" >&2 |
|
7757 | printf "invalid argument: %s\n" "$key" >&2 | |
7758 | exit 1 |
|
7758 | exit 1 | |
7759 |
|
7759 | |||
7760 | ;; |
|
7760 | ;; | |
7761 |
|
7761 | |||
7762 | esac |
|
7762 | esac | |
7763 | done |
|
7763 | done | |
7764 |
|
7764 | |||
7765 | } |
|
7765 | } | |
7766 |
|
7766 | |||
7767 | # :command.initialize |
|
7767 | # :command.initialize | |
7768 | initialize() { |
|
7768 | initialize() { | |
7769 |
version="5.11. |
|
7769 | version="5.11.1" | |
7770 | long_usage='' |
|
7770 | long_usage='' | |
7771 | set -e |
|
7771 | set -e | |
7772 |
|
7772 | |||
7773 | # :command.environment_variables_default |
|
7773 | # :command.environment_variables_default | |
7774 | export RCC_CONFIG="${RCC_CONFIG:-.rcstack.ini}" |
|
7774 | export RCC_CONFIG="${RCC_CONFIG:-.rcstack.ini}" | |
7775 | export RC_STACK_ROUTER_EXT="${RC_STACK_ROUTER_EXT:-.custom/docker-compose-router.override.yaml}" |
|
7775 | export RC_STACK_ROUTER_EXT="${RC_STACK_ROUTER_EXT:-.custom/docker-compose-router.override.yaml}" | |
7776 | export RC_STACK_METRICS_EXT="${RC_STACK_METRICS_EXT:-.custom/docker-compose-metrics.override.yaml}" |
|
7776 | export RC_STACK_METRICS_EXT="${RC_STACK_METRICS_EXT:-.custom/docker-compose-metrics.override.yaml}" | |
7777 | export RC_STACK_SERVICES_EXT="${RC_STACK_SERVICES_EXT:-.custom/docker-compose-services.override.yaml}" |
|
7777 | export RC_STACK_SERVICES_EXT="${RC_STACK_SERVICES_EXT:-.custom/docker-compose-services.override.yaml}" | |
7778 | export RC_STACK_RHODECODE_EXT="${RC_STACK_RHODECODE_EXT:-.custom/docker-compose-apps.override.yaml}" |
|
7778 | export RC_STACK_RHODECODE_EXT="${RC_STACK_RHODECODE_EXT:-.custom/docker-compose-apps.override.yaml}" | |
7779 |
|
7779 | |||
7780 | # src/initialize.sh |
|
7780 | # src/initialize.sh | |
7781 |
|
7781 | |||
7782 |
rc_image_ver=5.0. |
|
7782 | rc_image_ver=5.0.2 | |
7783 |
|
7783 | |||
7784 | rhodecode_default_config_path=config/_shared/rhodecode.ini |
|
7784 | rhodecode_default_config_path=config/_shared/rhodecode.ini | |
7785 | vcsserver_default_config_path=config/_shared/vcsserver.ini |
|
7785 | vcsserver_default_config_path=config/_shared/vcsserver.ini | |
7786 |
|
7786 | |||
7787 | RC_STACK_ROUTER_VER=1.0.0 |
|
7787 | RC_STACK_ROUTER_VER=1.0.0 | |
7788 | RC_STACK_SERVICES_VER=1.0.0 |
|
7788 | RC_STACK_SERVICES_VER=1.0.0 | |
7789 | RC_STACK_RHODECODE_VER=1.0.0 |
|
7789 | RC_STACK_RHODECODE_VER=1.0.0 | |
7790 | RC_STACK_METRICS_VER=1.0.0 |
|
7790 | RC_STACK_METRICS_VER=1.0.0 | |
7791 |
|
7791 | |||
7792 | RC_SCRIPT_NAME=rcstack |
|
7792 | RC_SCRIPT_NAME=rcstack | |
7793 | # bootstrap file is a config file at the same time |
|
7793 | # bootstrap file is a config file at the same time | |
7794 | CONFIG_FILE=${RCC_CONFIG:=.rcstack.ini} |
|
7794 | CONFIG_FILE=${RCC_CONFIG:=.rcstack.ini} | |
7795 |
|
7795 | |||
7796 | # runtime env file |
|
7796 | # runtime env file | |
7797 | RUNTIME_ENV=$PWD/.custom/.runtime.env |
|
7797 | RUNTIME_ENV=$PWD/.custom/.runtime.env | |
7798 |
|
7798 | |||
7799 | # STACK_LIST |
|
7799 | # STACK_LIST | |
7800 | VALID_SERVICES="router metrics services rhodecode" |
|
7800 | VALID_SERVICES="router metrics services rhodecode" | |
7801 | DOCKER_DEFS_WORK_DIR="docker_defs" |
|
7801 | DOCKER_DEFS_WORK_DIR="docker_defs" | |
7802 |
|
7802 | |||
7803 | # stage key, saved in .rcstack.ini : stage func to execute |
|
7803 | # stage key, saved in .rcstack.ini : stage func to execute | |
7804 | BOOTSTRAP_STAGES="\ |
|
7804 | BOOTSTRAP_STAGES="\ | |
7805 | bootstrap_v1_docker_install \ |
|
7805 | bootstrap_v1_docker_install \ | |
7806 | bootstrap_v1_docker_commons \ |
|
7806 | bootstrap_v1_docker_commons \ | |
7807 | bootstrap_v1_definitions \ |
|
7807 | bootstrap_v1_definitions \ | |
7808 | bootstrap_v1_config \ |
|
7808 | bootstrap_v1_config \ | |
7809 | bootstrap_v1_overrides \ |
|
7809 | bootstrap_v1_overrides \ | |
7810 | " |
|
7810 | " | |
7811 |
|
7811 | |||
7812 | YAML_TEMPLATES="\ |
|
7812 | YAML_TEMPLATES="\ | |
7813 | docker-compose-apps.override.yaml |
|
7813 | docker-compose-apps.override.yaml | |
7814 | docker-compose-metrics.override.yaml |
|
7814 | docker-compose-metrics.override.yaml | |
7815 | docker-compose-router.override.yaml |
|
7815 | docker-compose-router.override.yaml | |
7816 | docker-compose-services.override.yaml |
|
7816 | docker-compose-services.override.yaml | |
7817 | runtime.env.tmpl |
|
7817 | runtime.env.tmpl | |
7818 | " |
|
7818 | " | |
7819 |
|
7819 | |||
7820 | BASE_OPS_IMAGE="ubuntu:22.04" |
|
7820 | BASE_OPS_IMAGE="ubuntu:22.04" | |
7821 |
|
7821 | |||
7822 | get_stage_function() { |
|
7822 | get_stage_function() { | |
7823 | stage_name=$1 |
|
7823 | stage_name=$1 | |
7824 |
|
7824 | |||
7825 | case $stage_name in |
|
7825 | case $stage_name in | |
7826 | bootstrap_v1_docker_install) |
|
7826 | bootstrap_v1_docker_install) | |
7827 | stage_func=bootstrap_docker_install |
|
7827 | stage_func=bootstrap_docker_install | |
7828 | ;; |
|
7828 | ;; | |
7829 | bootstrap_v1_docker_commons) |
|
7829 | bootstrap_v1_docker_commons) | |
7830 | stage_func=bootstrap_docker_commons |
|
7830 | stage_func=bootstrap_docker_commons | |
7831 | ;; |
|
7831 | ;; | |
7832 | bootstrap_v1_definitions) |
|
7832 | bootstrap_v1_definitions) | |
7833 | stage_func=bootstrap_definitions |
|
7833 | stage_func=bootstrap_definitions | |
7834 | ;; |
|
7834 | ;; | |
7835 | bootstrap_v1_config) |
|
7835 | bootstrap_v1_config) | |
7836 | stage_func=bootstrap_config |
|
7836 | stage_func=bootstrap_config | |
7837 | ;; |
|
7837 | ;; | |
7838 | bootstrap_v1_overrides) |
|
7838 | bootstrap_v1_overrides) | |
7839 | stage_func=bootstrap_overrides |
|
7839 | stage_func=bootstrap_overrides | |
7840 | ;; |
|
7840 | ;; | |
7841 | *) |
|
7841 | *) | |
7842 | echo "can't find function for stage $stage_name" |
|
7842 | echo "can't find function for stage $stage_name" | |
7843 | exit 1 |
|
7843 | exit 1 | |
7844 | esac |
|
7844 | esac | |
7845 |
|
7845 | |||
7846 | echo $stage_func |
|
7846 | echo $stage_func | |
7847 | } |
|
7847 | } | |
7848 |
|
7848 | |||
7849 | #echo "1 ----" |
|
7849 | #echo "1 ----" | |
7850 | #echo $RC_STACK_SERVICES_EXT |
|
7850 | #echo $RC_STACK_SERVICES_EXT | |
7851 | #echo $RC_STACK_METRICS_EXT |
|
7851 | #echo $RC_STACK_METRICS_EXT | |
7852 | #echo "1 -----" |
|
7852 | #echo "1 -----" | |
7853 |
|
7853 | |||
7854 | #echo '2 ----' |
|
7854 | #echo '2 ----' | |
7855 | #grep -v -e '^#' "$ENV_FILE" | xargs -I {} echo \'{}\' |
|
7855 | #grep -v -e '^#' "$ENV_FILE" | xargs -I {} echo \'{}\' | |
7856 | #echo '2 ----' |
|
7856 | #echo '2 ----' | |
7857 |
|
7857 | |||
7858 | #expose env vars from ./rcstack config |
|
7858 | #expose env vars from ./rcstack config | |
7859 | #if [[ -f $ENV_FILE ]]; then |
|
7859 | #if [[ -f $ENV_FILE ]]; then | |
7860 | # eval $(grep -v -e '^#' "$ENV_FILE" | xargs -I {} echo export \'{}\') |
|
7860 | # eval $(grep -v -e '^#' "$ENV_FILE" | xargs -I {} echo export \'{}\') | |
7861 | #fi |
|
7861 | #fi | |
7862 |
|
7862 | |||
7863 | #ENV_EXPAND="" |
|
7863 | #ENV_EXPAND="" | |
7864 | #for k in $(config_keys); do |
|
7864 | #for k in $(config_keys); do | |
7865 | # k_upper=${k^^} |
|
7865 | # k_upper=${k^^} | |
7866 | # env_entry="-e $k_upper='$(config_get "$k")' " |
|
7866 | # env_entry="-e $k_upper='$(config_get "$k")' " | |
7867 | # ENV_EXPAND+=$env_entry; |
|
7867 | # ENV_EXPAND+=$env_entry; | |
7868 | # #echo $env_expand |
|
7868 | # #echo $env_expand | |
7869 | #done |
|
7869 | #done | |
7870 |
|
7870 | |||
7871 | # |
|
7871 | # | |
7872 | #echo "3 ----" |
|
7872 | #echo "3 ----" | |
7873 | #echo $RC_STACK_SERVICES_EXT |
|
7873 | #echo $RC_STACK_SERVICES_EXT | |
7874 | #echo $RC_STACK_METRICS_EXT |
|
7874 | #echo $RC_STACK_METRICS_EXT | |
7875 | #echo $RC_STACK_RHODECODE_EXT |
|
7875 | #echo $RC_STACK_RHODECODE_EXT | |
7876 | #echo "3 -----" |
|
7876 | #echo "3 -----" | |
7877 |
|
7877 | |||
7878 | #env | grep RC_ |
|
7878 | #env | grep RC_ | |
7879 |
|
7879 | |||
7880 | docker_ping_host() { |
|
7880 | docker_ping_host() { | |
7881 | PING_HOST="$1" |
|
7881 | PING_HOST="$1" | |
7882 | docker run --network rhodecode_network --rm alpine ping "$PING_HOST" |
|
7882 | docker run --network rhodecode_network --rm alpine ping "$PING_HOST" | |
7883 | } |
|
7883 | } | |
7884 |
|
7884 | |||
7885 | get_started() { |
|
7885 | get_started() { | |
7886 | echo "" |
|
7886 | echo "" | |
7887 | echo "To start using RhodeCode run the following stacks using './$RC_SCRIPT_NAME stack [STACK_NAME]'" |
|
7887 | echo "To start using RhodeCode run the following stacks using './$RC_SCRIPT_NAME stack [STACK_NAME]'" | |
7888 | echo "Check './$RC_SCRIPT_NAME stack --help' for more examples and options" |
|
7888 | echo "Check './$RC_SCRIPT_NAME stack --help' for more examples and options" | |
7889 | echo "$(green_bold IMPORTANT): init command generates some secrets/config inside $RUNTIME_ENV file." |
|
7889 | echo "$(green_bold IMPORTANT): init command generates some secrets/config inside $RUNTIME_ENV file." | |
7890 | echo "Check and adjust those settings if needed." |
|
7890 | echo "Check and adjust those settings if needed." | |
7891 | echo "" |
|
7891 | echo "" | |
7892 | echo "$(bold Run the stacks in following order):" |
|
7892 | echo "$(bold Run the stacks in following order):" | |
7893 | echo "$(bold [NOTE]): Instead of running stacks independent, one can use shorthand to run all stacks in order (detached with -d)" |
|
7893 | echo "$(bold [NOTE]): Instead of running stacks independent, one can use shorthand to run all stacks in order (detached with -d)" | |
7894 | echo "./$RC_SCRIPT_NAME stack all up -d" |
|
7894 | echo "./$RC_SCRIPT_NAME stack all up -d" | |
7895 | echo "" |
|
7895 | echo "" | |
7896 | echo "$(green_bold 1\) router [Mandatory]): run the edge router to control stack traffic / domain access and optionally SSL termination" |
|
7896 | echo "$(green_bold 1\) router [Mandatory]): run the edge router to control stack traffic / domain access and optionally SSL termination" | |
7897 | echo "IMPORTANT: router binds to some common ports 80, 443, SSH (9022), Loki (3100) if those are not available, please adjust them" |
|
7897 | echo "IMPORTANT: router binds to some common ports 80, 443, SSH (9022), Loki (3100) if those are not available, please adjust them" | |
7898 | echo "To configure this stack before running check: $RC_STACK_ROUTER_EXT" |
|
7898 | echo "To configure this stack before running check: $RC_STACK_ROUTER_EXT" | |
7899 | echo "" |
|
7899 | echo "" | |
7900 | echo "./$RC_SCRIPT_NAME stack router up --detach" |
|
7900 | echo "./$RC_SCRIPT_NAME stack router up --detach" | |
7901 | echo "" |
|
7901 | echo "" | |
7902 | echo "$(green_bold 2\) services [Mandatory]): run the services, like database, redis, channelstream etc..." |
|
7902 | echo "$(green_bold 2\) services [Mandatory]): run the services, like database, redis, channelstream etc..." | |
7903 | echo "IMPORTANT: if you like to run your own database, or redis please adjust before running" |
|
7903 | echo "IMPORTANT: if you like to run your own database, or redis please adjust before running" | |
7904 | echo "To configure this stack before running check: $RC_STACK_SERVICES_EXT" |
|
7904 | echo "To configure this stack before running check: $RC_STACK_SERVICES_EXT" | |
7905 | echo "" |
|
7905 | echo "" | |
7906 | echo "./$RC_SCRIPT_NAME stack services up --detach" |
|
7906 | echo "./$RC_SCRIPT_NAME stack services up --detach" | |
7907 | echo "" |
|
7907 | echo "" | |
7908 | echo "$(green_bold 3\) rhodecode [Mandatory]): run the rhodecode app stack" |
|
7908 | echo "$(green_bold 3\) rhodecode [Mandatory]): run the rhodecode app stack" | |
7909 | echo "To configure this stack before running check: $RC_STACK_RHODECODE_EXT" |
|
7909 | echo "To configure this stack before running check: $RC_STACK_RHODECODE_EXT" | |
7910 | echo "" |
|
7910 | echo "" | |
7911 | echo "./$RC_SCRIPT_NAME stack rhodecode up --detach" |
|
7911 | echo "./$RC_SCRIPT_NAME stack rhodecode up --detach" | |
7912 | echo "" |
|
7912 | echo "" | |
7913 | echo "$(yellow_bold 4\) metrics [Optional]): run the monitoring stack, this includes grafana/prometheus logging/metrics system" |
|
7913 | echo "$(yellow_bold 4\) metrics [Optional]): run the monitoring stack, this includes grafana/prometheus logging/metrics system" | |
7914 | echo "To configure this stack before running check: $RC_STACK_METRICS_EXT" |
|
7914 | echo "To configure this stack before running check: $RC_STACK_METRICS_EXT" | |
7915 | echo "" |
|
7915 | echo "" | |
7916 | echo "./$RC_SCRIPT_NAME stack metrics up --detach" |
|
7916 | echo "./$RC_SCRIPT_NAME stack metrics up --detach" | |
7917 | echo "" |
|
7917 | echo "" | |
7918 | echo "$(bold [Status]): check services run status, ports etc.." |
|
7918 | echo "$(bold [Status]): check services run status, ports etc.." | |
7919 | echo "./$RC_SCRIPT_NAME status -v --configs" |
|
7919 | echo "./$RC_SCRIPT_NAME status -v --configs" | |
7920 | echo "" |
|
7920 | echo "" | |
7921 | echo "$(bold [Logs]): check service logs" |
|
7921 | echo "$(bold [Logs]): check service logs" | |
7922 | echo "./$RC_SCRIPT_NAME stack [STACK_NAME] logs" |
|
7922 | echo "./$RC_SCRIPT_NAME stack [STACK_NAME] logs" | |
7923 | } |
|
7923 | } | |
7924 |
|
7924 | |||
7925 | get_started_full() { |
|
7925 | get_started_full() { | |
7926 | echo "$(blue_bold [~~~~ GET STARTED ~~~~~])" |
|
7926 | echo "$(blue_bold [~~~~ GET STARTED ~~~~~])" | |
7927 | echo "$(green_bold Having problems / need help? Reach out to us here:) https://community.rhodecode.com" |
|
7927 | echo "$(green_bold Having problems / need help? Reach out to us here:) https://community.rhodecode.com" | |
7928 | echo "" |
|
7928 | echo "" | |
7929 | echo "./$RC_SCRIPT_NAME is a CLI based installer/manager for RhodeCode Cluster Stack" |
|
7929 | echo "./$RC_SCRIPT_NAME is a CLI based installer/manager for RhodeCode Cluster Stack" | |
7930 | echo "./$RC_SCRIPT_NAME -h is your friend, in case of doubt, check examples and usage options with -h / --help flag" |
|
7930 | echo "./$RC_SCRIPT_NAME -h is your friend, in case of doubt, check examples and usage options with -h / --help flag" | |
7931 | echo "" |
|
7931 | echo "" | |
7932 | echo "$(yellow_bold [First time run])" |
|
7932 | echo "$(yellow_bold [First time run])" | |
7933 | echo "run './$RC_SCRIPT_NAME init' to setup docker and download required installer files." |
|
7933 | echo "run './$RC_SCRIPT_NAME init' to setup docker and download required installer files." | |
7934 | echo "./$RC_SCRIPT_NAME can install Docker for you, or install it manually before running init command" |
|
7934 | echo "./$RC_SCRIPT_NAME can install Docker for you, or install it manually before running init command" | |
7935 |
|
7935 | |||
7936 | get_started |
|
7936 | get_started | |
7937 | } |
|
7937 | } | |
7938 |
|
7938 | |||
7939 | } |
|
7939 | } | |
7940 |
|
7940 | |||
7941 | # :command.run |
|
7941 | # :command.run | |
7942 | run() { |
|
7942 | run() { | |
7943 | declare -A args=() |
|
7943 | declare -A args=() | |
7944 | declare -A deps=() |
|
7944 | declare -A deps=() | |
7945 | declare -a other_args=() |
|
7945 | declare -a other_args=() | |
7946 | declare -a input=() |
|
7946 | declare -a input=() | |
7947 | normalize_input "$@" |
|
7947 | normalize_input "$@" | |
7948 | parse_requirements "${input[@]}" |
|
7948 | parse_requirements "${input[@]}" | |
7949 |
|
7949 | |||
7950 | case "$action" in |
|
7950 | case "$action" in | |
7951 | "get-started") rcstack_get_started_command ;; |
|
7951 | "get-started") rcstack_get_started_command ;; | |
7952 | "init") rcstack_init_command ;; |
|
7952 | "init") rcstack_init_command ;; | |
7953 | "self-update") rcstack_self_update_command ;; |
|
7953 | "self-update") rcstack_self_update_command ;; | |
7954 | "self-upgrade") rcstack_self_upgrade_command ;; |
|
7954 | "self-upgrade") rcstack_self_upgrade_command ;; | |
7955 | "stack") rcstack_stack_command ;; |
|
7955 | "stack") rcstack_stack_command ;; | |
7956 | "stack router") rcstack_stack_router_command ;; |
|
7956 | "stack router") rcstack_stack_router_command ;; | |
7957 | "stack metrics") rcstack_stack_metrics_command ;; |
|
7957 | "stack metrics") rcstack_stack_metrics_command ;; | |
7958 | "stack services") rcstack_stack_services_command ;; |
|
7958 | "stack services") rcstack_stack_services_command ;; | |
7959 | "stack rhodecode") rcstack_stack_rhodecode_command ;; |
|
7959 | "stack rhodecode") rcstack_stack_rhodecode_command ;; | |
7960 | "stack all") rcstack_stack_all_command ;; |
|
7960 | "stack all") rcstack_stack_all_command ;; | |
7961 | "stack-status") rcstack_stack_status_command ;; |
|
7961 | "stack-status") rcstack_stack_status_command ;; | |
7962 | "stack-upgrade") rcstack_stack_upgrade_command ;; |
|
7962 | "stack-upgrade") rcstack_stack_upgrade_command ;; | |
7963 | "stack-upgrade router") rcstack_stack_upgrade_router_command ;; |
|
7963 | "stack-upgrade router") rcstack_stack_upgrade_router_command ;; | |
7964 | "stack-upgrade services") rcstack_stack_upgrade_services_command ;; |
|
7964 | "stack-upgrade services") rcstack_stack_upgrade_services_command ;; | |
7965 | "stack-upgrade metrics") rcstack_stack_upgrade_metrics_command ;; |
|
7965 | "stack-upgrade metrics") rcstack_stack_upgrade_metrics_command ;; | |
7966 | "stack-upgrade rhodecode") rcstack_stack_upgrade_rhodecode_command ;; |
|
7966 | "stack-upgrade rhodecode") rcstack_stack_upgrade_rhodecode_command ;; | |
7967 | "stack-monitor") rcstack_stack_monitor_command ;; |
|
7967 | "stack-monitor") rcstack_stack_monitor_command ;; | |
7968 | "stack-monitor restart-unhealthy") rcstack_stack_monitor_restart_unhealthy_command ;; |
|
7968 | "stack-monitor restart-unhealthy") rcstack_stack_monitor_restart_unhealthy_command ;; | |
7969 | "cli") rcstack_cli_command ;; |
|
7969 | "cli") rcstack_cli_command ;; | |
7970 | "cli cmd") rcstack_cli_cmd_command ;; |
|
7970 | "cli cmd") rcstack_cli_cmd_command ;; | |
7971 | "cli ishell") rcstack_cli_ishell_command ;; |
|
7971 | "cli ishell") rcstack_cli_ishell_command ;; | |
7972 | "cli image-info") rcstack_cli_image_info_command ;; |
|
7972 | "cli image-info") rcstack_cli_image_info_command ;; | |
7973 | "cli set-runtime-image") rcstack_cli_set_runtime_image_command ;; |
|
7973 | "cli set-runtime-image") rcstack_cli_set_runtime_image_command ;; | |
7974 | "cli docker-info") rcstack_cli_docker_info_command ;; |
|
7974 | "cli docker-info") rcstack_cli_docker_info_command ;; | |
7975 | "cli docker-upgrade") rcstack_cli_docker_upgrade_command ;; |
|
7975 | "cli docker-upgrade") rcstack_cli_docker_upgrade_command ;; | |
7976 | "cli redis") rcstack_cli_redis_command ;; |
|
7976 | "cli redis") rcstack_cli_redis_command ;; | |
7977 | "cli db") rcstack_cli_db_command ;; |
|
7977 | "cli db") rcstack_cli_db_command ;; | |
7978 | "cli db-upgrade") rcstack_cli_db_upgrade_command ;; |
|
7978 | "cli db-upgrade") rcstack_cli_db_upgrade_command ;; | |
7979 | "cli storage") rcstack_cli_storage_command ;; |
|
7979 | "cli storage") rcstack_cli_storage_command ;; | |
7980 | "cli attach") rcstack_cli_attach_command ;; |
|
7980 | "cli attach") rcstack_cli_attach_command ;; | |
7981 | "cli set-edition") rcstack_cli_set_edition_command ;; |
|
7981 | "cli set-edition") rcstack_cli_set_edition_command ;; | |
7982 | "cli configure-vcsserver") rcstack_cli_configure_vcsserver_command ;; |
|
7982 | "cli configure-vcsserver") rcstack_cli_configure_vcsserver_command ;; | |
7983 | "cli configure-rhodecode") rcstack_cli_configure_rhodecode_command ;; |
|
7983 | "cli configure-rhodecode") rcstack_cli_configure_rhodecode_command ;; | |
7984 | "backup-db") rcstack_backup_db_command ;; |
|
7984 | "backup-db") rcstack_backup_db_command ;; | |
7985 | "backup-data") rcstack_backup_data_command ;; |
|
7985 | "backup-data") rcstack_backup_data_command ;; | |
7986 | "_completions") rcstack__completions_command ;; |
|
7986 | "_completions") rcstack__completions_command ;; | |
7987 | esac |
|
7987 | esac | |
7988 | } |
|
7988 | } | |
7989 |
|
7989 | |||
7990 | initialize |
|
7990 | initialize | |
7991 | run "$@" |
|
7991 | run "$@" |
@@ -1,480 +1,480 b'' | |||||
1 | # virtualenv-install for 5.X |
|
1 | # virtualenv-install for 5.X | |
2 |
|
2 | |||
3 | FROM ubuntu:22.04 |
|
3 | FROM ubuntu:22.04 | |
4 | # Using 22.04 LTS Release |
|
4 | # Using 22.04 LTS Release | |
5 |
|
5 | |||
6 | ARG TZ="UTC" |
|
6 | ARG TZ="UTC" | |
7 | ARG LOCALE_TYPE=en_US.UTF-8 |
|
7 | ARG LOCALE_TYPE=en_US.UTF-8 | |
8 | ARG RHODECODE_TYPE=Enterprise |
|
8 | ARG RHODECODE_TYPE=Enterprise | |
9 |
|
9 | |||
10 | ARG RHODECODE_DB=sqlite |
|
10 | ARG RHODECODE_DB=sqlite | |
11 | ARG RHODECODE_USER_NAME=admin |
|
11 | ARG RHODECODE_USER_NAME=admin | |
12 | ARG RHODECODE_USER_PASS=secret4 |
|
12 | ARG RHODECODE_USER_PASS=secret4 | |
13 | ARG RHODECODE_USER_EMAIL=admin@server.local |
|
13 | ARG RHODECODE_USER_EMAIL=admin@server.local | |
14 |
|
14 | |||
15 | # env are runtime |
|
15 | # env are runtime | |
16 | ENV \ |
|
16 | ENV \ | |
17 | TZ=${TZ} \ |
|
17 | TZ=${TZ} \ | |
18 | LOCALE_TYPE=${LOCALE_TYPE} \ |
|
18 | LOCALE_TYPE=${LOCALE_TYPE} \ | |
19 | \ |
|
19 | \ | |
20 | ## Define type we build, and the instance we'll create |
|
20 | ## Define type we build, and the instance we'll create | |
21 | RHODECODE_TYPE=${RHODECODE_TYPE} \ |
|
21 | RHODECODE_TYPE=${RHODECODE_TYPE} \ | |
22 | RC_TYPE_ID=enterprise-1 \ |
|
22 | RC_TYPE_ID=enterprise-1 \ | |
23 | \ |
|
23 | \ | |
24 | ## set DB, default sqlite |
|
24 | ## set DB, default sqlite | |
25 | RHODECODE_DB=${RHODECODE_DB} \ |
|
25 | RHODECODE_DB=${RHODECODE_DB} \ | |
26 | \ |
|
26 | \ | |
27 | ## set app bootstrap required data |
|
27 | ## set app bootstrap required data | |
28 | RHODECODE_USER_NAME=${RHODECODE_USER_NAME} \ |
|
28 | RHODECODE_USER_NAME=${RHODECODE_USER_NAME} \ | |
29 | RHODECODE_USER_PASS=${RHODECODE_USER_PASS} \ |
|
29 | RHODECODE_USER_PASS=${RHODECODE_USER_PASS} \ | |
30 | RHODECODE_USER_EMAIL=${RHODECODE_USER_EMAIL} \ |
|
30 | RHODECODE_USER_EMAIL=${RHODECODE_USER_EMAIL} \ | |
31 | \ |
|
31 | \ | |
32 | RC_USER=rhodecode \ |
|
32 | RC_USER=rhodecode \ | |
33 | \ |
|
33 | \ | |
34 | # SVN CONFIG |
|
34 | # SVN CONFIG | |
35 | MOD_DAV_SVN_CONF_FILE=/etc/rhodecode/conf/svn/mod_dav_svn.conf \ |
|
35 | MOD_DAV_SVN_CONF_FILE=/etc/rhodecode/conf/svn/mod_dav_svn.conf \ | |
36 | MOD_DAV_SVN_PORT=8090 \ |
|
36 | MOD_DAV_SVN_PORT=8090 \ | |
37 | MOD_DAV_SVN_LOG_LEVEL=info \ |
|
37 | MOD_DAV_SVN_LOG_LEVEL=info \ | |
38 | MOD_DAV_CORE_MODULES_DIR=/home/rhodecode/apache2/modules \ |
|
38 | MOD_DAV_CORE_MODULES_DIR=/home/rhodecode/apache2/modules \ | |
39 | MOD_DAV_SVN_MODULE=/home/rhodecode/subversion/libexec/mod_dav_svn.so \ |
|
39 | MOD_DAV_SVN_MODULE=/home/rhodecode/subversion/libexec/mod_dav_svn.so \ | |
40 | \ |
|
40 | \ | |
41 | # SSHD CONFIG |
|
41 | # SSHD CONFIG | |
42 | SSHD_CONF_FILE=/etc/rhodecode/sshd_config \ |
|
42 | SSHD_CONF_FILE=/etc/rhodecode/sshd_config \ | |
43 | \ |
|
43 | \ | |
44 | SHARED_CONF_DIR=/etc/rhodecode/conf \ |
|
44 | SHARED_CONF_DIR=/etc/rhodecode/conf \ | |
45 | BUILD_CONF=/etc/rhodecode/conf_build \ |
|
45 | BUILD_CONF=/etc/rhodecode/conf_build \ | |
46 | BUILD_BIN_DIR=/usr/local/bin/rhodecode_bin \ |
|
46 | BUILD_BIN_DIR=/usr/local/bin/rhodecode_bin \ | |
47 | RHODECODE_STATIC_DIR=/var/opt/rhodecode_static \ |
|
47 | RHODECODE_STATIC_DIR=/var/opt/rhodecode_static \ | |
48 | RHODECODE_DATA_DIR=/var/opt/rhodecode_data \ |
|
48 | RHODECODE_DATA_DIR=/var/opt/rhodecode_data \ | |
49 | RHODECODE_REPO_DIR=/var/opt/rhodecode_repo_store \ |
|
49 | RHODECODE_REPO_DIR=/var/opt/rhodecode_repo_store \ | |
50 | RHODECODE_HTTP_PORT=10020 \ |
|
50 | RHODECODE_HTTP_PORT=10020 \ | |
51 | RHODECODE_VCS_PORT=10010 \ |
|
51 | RHODECODE_VCS_PORT=10010 \ | |
52 | RHODECODE_HOST=0.0.0.0 \ |
|
52 | RHODECODE_HOST=0.0.0.0 \ | |
53 | RHODECODE_VCS_HOST=127.0.0.1 |
|
53 | RHODECODE_VCS_HOST=127.0.0.1 | |
54 |
|
54 | |||
55 |
|
55 | |||
56 | ENV SSH_DEPS \ |
|
56 | ENV SSH_DEPS \ | |
57 | openssh-server |
|
57 | openssh-server | |
58 |
|
58 | |||
59 | ENV SVN_DEPS \ |
|
59 | ENV SVN_DEPS \ | |
60 | "" |
|
60 | "" | |
61 |
|
61 | |||
62 | ENV SVN_DEV_DEPS \ |
|
62 | ENV SVN_DEV_DEPS \ | |
63 | libtool automake autoconf libapr1-dev libaprutil1-dev libdb5.3-dev liblz4-dev libpcre3-dev \ |
|
63 | libtool automake autoconf libapr1-dev libaprutil1-dev libdb5.3-dev liblz4-dev libpcre3-dev \ | |
64 | libperl-dev libserf-dev libneon27-gnutls-dev libutf8proc-dev py3c-dev gettext tcl-dev |
|
64 | libperl-dev libserf-dev libneon27-gnutls-dev libutf8proc-dev py3c-dev gettext tcl-dev | |
65 |
|
65 | |||
66 | ENV PYTHON_DEPS \ |
|
66 | ENV PYTHON_DEPS \ | |
67 | python3.11 |
|
67 | python3.11 | |
68 | ENV PYTHON_DEV_DEPS \ |
|
68 | ENV PYTHON_DEV_DEPS \ | |
69 | python3.11-dev build-essential libpq-dev libmysqlclient-dev libxmlsec1-dev libxml2-dev libsqlite3-dev \ |
|
69 | python3.11-dev build-essential libpq-dev libmysqlclient-dev libxmlsec1-dev libxml2-dev libsqlite3-dev \ | |
70 | liblzma-dev libzmq3-dev libldap2-dev libsasl2-dev libcurl4-openssl-dev libssl-dev libxslt-dev |
|
70 | liblzma-dev libzmq3-dev libldap2-dev libsasl2-dev libcurl4-openssl-dev libssl-dev libxslt-dev | |
71 |
|
71 | |||
72 | ENV EXTRA_DEPS \ |
|
72 | ENV EXTRA_DEPS \ | |
73 | vim rsync pkg-config openssl libbz2-1.0 libbz2-dev sqlite3 cpanminus libapr1 |
|
73 | vim rsync pkg-config openssl libbz2-1.0 libbz2-dev sqlite3 cpanminus libapr1 | |
74 |
|
74 | |||
75 | # define which deps from the above should be removed in cleanup phase |
|
75 | # define which deps from the above should be removed in cleanup phase | |
76 | ENV CLEANUP_DEPS \ |
|
76 | ENV CLEANUP_DEPS \ | |
77 | $PYTHON_DEV_DEPS $SVN_DEV_DEPS |
|
77 | $PYTHON_DEV_DEPS $SVN_DEV_DEPS | |
78 | ENV CLEANUP_DEPS "" |
|
78 | ENV CLEANUP_DEPS "" | |
79 |
|
79 | |||
80 | # https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa |
|
80 | # https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa | |
81 | RUN \ |
|
81 | RUN \ | |
82 | echo "** install base packages && python 3.11.9 **" && \ |
|
82 | echo "** install base packages && python 3.11.9 **" && \ | |
83 | set -eux; \ |
|
83 | set -eux; \ | |
84 | apt-get update; \ |
|
84 | apt-get update; \ | |
85 | apt-get install -y ca-certificates curl openssl gpg; \ |
|
85 | apt-get install -y ca-certificates curl openssl gpg; \ | |
86 | curl -fsSL https://keyserver.ubuntu.com/pks/lookup\?op\=get\&search\=0xba6932366a755776 | gpg --dearmor -o /usr/share/keyrings/python-3.gpg; \ |
|
86 | curl -fsSL https://keyserver.ubuntu.com/pks/lookup\?op\=get\&search\=0xba6932366a755776 | gpg --dearmor -o /usr/share/keyrings/python-3.gpg; \ | |
87 | echo "deb [signed-by=/usr/share/keyrings/python-3.gpg] https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu jammy main" >> /etc/apt/sources.list; \ |
|
87 | echo "deb [signed-by=/usr/share/keyrings/python-3.gpg] https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu jammy main" >> /etc/apt/sources.list; \ | |
88 | echo "deb-src [signed-by=/usr/share/keyrings/python-3.gpg] https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu jammy main" >> /etc/apt/sources.list; \ |
|
88 | echo "deb-src [signed-by=/usr/share/keyrings/python-3.gpg] https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu jammy main" >> /etc/apt/sources.list; \ | |
89 | \ |
|
89 | \ | |
90 | savedAptMark="$(apt-mark showmanual)"; \ |
|
90 | savedAptMark="$(apt-mark showmanual)"; \ | |
91 | apt-get update; \ |
|
91 | apt-get update; \ | |
92 | DEBIAN_FRONTEND="noninteractive" \ |
|
92 | DEBIAN_FRONTEND="noninteractive" \ | |
93 | apt-get install -y --no-install-recommends \ |
|
93 | apt-get install -y --no-install-recommends \ | |
94 | tini \ |
|
94 | tini \ | |
95 | bash \ |
|
95 | bash \ | |
96 | binutils \ |
|
96 | binutils \ | |
97 | tzdata \ |
|
97 | tzdata \ | |
98 | locales \ |
|
98 | locales \ | |
99 | openssl \ |
|
99 | openssl \ | |
100 | curl \ |
|
100 | curl \ | |
101 | sudo \ |
|
101 | sudo \ | |
102 | gosu \ |
|
102 | gosu \ | |
103 | bzip2 unzip \ |
|
103 | bzip2 unzip \ | |
104 | $PYTHON_DEPS $PYTHON_DEV_DEPS\ |
|
104 | $PYTHON_DEPS $PYTHON_DEV_DEPS\ | |
105 | $SSH_DEPS \ |
|
105 | $SSH_DEPS \ | |
106 | $SVN_DEPS $SVN_DEV_DEPS\ |
|
106 | $SVN_DEPS $SVN_DEV_DEPS\ | |
107 | $EXTRA_DEPS \ |
|
107 | $EXTRA_DEPS \ | |
108 | ; \ |
|
108 | ; \ | |
109 | rm -rf /var/lib/apt/lists/*; |
|
109 | rm -rf /var/lib/apt/lists/*; | |
110 |
|
110 | |||
111 | RUN \ |
|
111 | RUN \ | |
112 | echo "** Configure the locales **" && \ |
|
112 | echo "** Configure the locales **" && \ | |
113 | sed -i "s/^# ${LOCALE_TYPE}/${LOCALE_TYPE}/g" /etc/locale.gen && \ |
|
113 | sed -i "s/^# ${LOCALE_TYPE}/${LOCALE_TYPE}/g" /etc/locale.gen && \ | |
114 | locale-gen |
|
114 | locale-gen | |
115 |
|
115 | |||
116 | # locale-archive is a fix for old nix glibc2.26 locales available |
|
116 | # locale-archive is a fix for old nix glibc2.26 locales available | |
117 | ENV \ |
|
117 | ENV \ | |
118 | #LOCALE_ARCHIVE=/var/opt/locale-archive \ |
|
118 | #LOCALE_ARCHIVE=/var/opt/locale-archive \ | |
119 | LANG=${LOCALE_TYPE} \ |
|
119 | LANG=${LOCALE_TYPE} \ | |
120 | LANGUAGE=${LOCALE_TYPE} \ |
|
120 | LANGUAGE=${LOCALE_TYPE} \ | |
121 | LC_ALL=${LOCALE_TYPE} |
|
121 | LC_ALL=${LOCALE_TYPE} | |
122 |
|
122 | |||
123 | # configure the system user |
|
123 | # configure the system user | |
124 | # explicitly set uid/gid to guarantee that it won't change in the future |
|
124 | # explicitly set uid/gid to guarantee that it won't change in the future | |
125 | # the values 999:999 are identical to the current user/group id assigned |
|
125 | # the values 999:999 are identical to the current user/group id assigned | |
126 | RUN \ |
|
126 | RUN \ | |
127 | echo "** Create system user $RC_USER **" && \ |
|
127 | echo "** Create system user $RC_USER **" && \ | |
128 | groupadd --system --gid 999 $RC_USER && \ |
|
128 | groupadd --system --gid 999 $RC_USER && \ | |
129 | useradd --system --gid $RC_USER --uid 999 --shell /bin/bash $RC_USER && \ |
|
129 | useradd --system --gid $RC_USER --uid 999 --shell /bin/bash $RC_USER && \ | |
130 | usermod -G $RC_USER $RC_USER |
|
130 | usermod -G $RC_USER $RC_USER | |
131 |
|
131 | |||
132 | # Add new user docker to sudo group |
|
132 | # Add new user docker to sudo group | |
133 | RUN \ |
|
133 | RUN \ | |
134 | adduser $RC_USER sudo |
|
134 | adduser $RC_USER sudo | |
135 |
|
135 | |||
136 | # Ensure sudo group users are not |
|
136 | # Ensure sudo group users are not | |
137 | # asked for a password when using |
|
137 | # asked for a password when using | |
138 | # sudo command by ammending sudoers file |
|
138 | # sudo command by ammending sudoers file | |
139 | RUN \ |
|
139 | RUN \ | |
140 | echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers |
|
140 | echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers | |
141 |
|
141 | |||
142 | # set the defult bash shell |
|
142 | # set the defult bash shell | |
143 | SHELL ["/bin/bash", "-c"] |
|
143 | SHELL ["/bin/bash", "-c"] | |
144 |
|
144 | |||
145 | # Fix and set a timezone |
|
145 | # Fix and set a timezone | |
146 | RUN \ |
|
146 | RUN \ | |
147 | echo "** configure the timezone **" && \ |
|
147 | echo "** configure the timezone **" && \ | |
148 | rm /etc/localtime && cp /usr/share/zoneinfo/$TZ /etc/localtime && \ |
|
148 | rm /etc/localtime && cp /usr/share/zoneinfo/$TZ /etc/localtime && \ | |
149 | echo $TZ > /etc/timezone |
|
149 | echo $TZ > /etc/timezone | |
150 |
|
150 | |||
151 |
|
151 | |||
152 | RUN \ |
|
152 | RUN \ | |
153 | echo "** prepare rhodecode store and cache **" && \ |
|
153 | echo "** prepare rhodecode store and cache **" && \ | |
154 | install -d -m 0755 -o $RC_USER -g $RC_USER /opt/rhodecode && \ |
|
154 | install -d -m 0755 -o $RC_USER -g $RC_USER /opt/rhodecode && \ | |
155 | install -d -m 0755 -o $RC_USER -g $RC_USER /usr/local/bin/rhodecode_bin && \ |
|
155 | install -d -m 0755 -o $RC_USER -g $RC_USER /usr/local/bin/rhodecode_bin && \ | |
156 | install -d -m 0755 -o $RC_USER -g $RC_USER $RHODECODE_STATIC_DIR && \ |
|
156 | install -d -m 0755 -o $RC_USER -g $RC_USER $RHODECODE_STATIC_DIR && \ | |
157 | install -d -m 0755 -o $RC_USER -g $RC_USER $RHODECODE_REPO_DIR && \ |
|
157 | install -d -m 0755 -o $RC_USER -g $RC_USER $RHODECODE_REPO_DIR && \ | |
158 | install -d -m 0755 -o $RC_USER -g $RC_USER $RHODECODE_DATA_DIR && \ |
|
158 | install -d -m 0755 -o $RC_USER -g $RC_USER $RHODECODE_DATA_DIR && \ | |
159 | install -d -m 0755 -o $RC_USER -g $RC_USER $BUILD_CONF && \ |
|
159 | install -d -m 0755 -o $RC_USER -g $RC_USER $BUILD_CONF && \ | |
160 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/ && \ |
|
160 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/ && \ | |
161 | install -m 0755 -o $RC_USER -g $RC_USER /dev/null /home/$RC_USER/.rhoderc && \ |
|
161 | install -m 0755 -o $RC_USER -g $RC_USER /dev/null /home/$RC_USER/.rhoderc && \ | |
162 | install -d -m 0700 -o $RC_USER -g $RC_USER /home/$RC_USER/venv && \ |
|
162 | install -d -m 0700 -o $RC_USER -g $RC_USER /home/$RC_USER/venv && \ | |
163 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/rhodecode-vcsserver && \ |
|
163 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/rhodecode-vcsserver && \ | |
164 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/rhodecode-enterprise-ce && \ |
|
164 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/rhodecode-enterprise-ce && \ | |
165 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/rhodecode-enterprise-ee && \ |
|
165 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/rhodecode-enterprise-ee && \ | |
166 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/.rccontrol && \ |
|
166 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/.rccontrol && \ | |
167 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/.rccontrol/cache && \ |
|
167 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/.rccontrol/cache && \ | |
168 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/.rccontrol/bootstrap && \ |
|
168 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/.rccontrol/bootstrap && \ | |
169 | install -d -m 0700 -o $RC_USER -g $RC_USER /home/$RC_USER/.ssh |
|
169 | install -d -m 0700 -o $RC_USER -g $RC_USER /home/$RC_USER/.ssh | |
170 |
|
170 | |||
171 | # expose our custom sshd config |
|
171 | # expose our custom sshd config | |
172 | COPY service/sshd/sshd_config $SSHD_CONF_FILE |
|
172 | COPY service/sshd/sshd_config $SSHD_CONF_FILE | |
173 |
|
173 | |||
174 | # change to non-root user for RUN commands |
|
174 | # change to non-root user for RUN commands | |
175 | USER $RC_USER |
|
175 | USER $RC_USER | |
176 | WORKDIR /home/$RC_USER |
|
176 | WORKDIR /home/$RC_USER | |
177 |
|
177 | |||
178 | ENV \ |
|
178 | ENV \ | |
179 | VENV_PATH=/home/$RC_USER/venv |
|
179 | VENV_PATH=/home/$RC_USER/venv | |
180 |
|
180 | |||
181 | ENV \ |
|
181 | ENV \ | |
182 | PYTHON_VERSION=python3.11 \ |
|
182 | PYTHON_VERSION=python3.11 \ | |
183 | PYTHON_EXECUTABLE=/usr/bin/python3.11 \ |
|
183 | PYTHON_EXECUTABLE=/usr/bin/python3.11 \ | |
184 | PYTHON=$VENV_PATH/bin/python3.11 \ |
|
184 | PYTHON=$VENV_PATH/bin/python3.11 \ | |
185 | PIP_EXECUTABLE=$VENV_PATH/bin/pip \ |
|
185 | PIP_EXECUTABLE=$VENV_PATH/bin/pip \ | |
186 | # make venv application scripts visible |
|
186 | # make venv application scripts visible | |
187 | PATH=$VENV_PATH/bin:/home/$RC_USER/.local/bin:$PATH |
|
187 | PATH=$VENV_PATH/bin:/home/$RC_USER/.local/bin:$PATH | |
188 |
|
188 | |||
189 | # check new versions here: https://pypi.org/project/pip/ |
|
189 | # check new versions here: https://pypi.org/project/pip/ | |
190 | RUN \ |
|
190 | RUN \ | |
191 | echo "** get pip **" && \ |
|
191 | echo "** get pip **" && \ | |
192 | curl -sSL https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \ |
|
192 | curl -sSL https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \ | |
193 | $PYTHON_EXECUTABLE get-pip.py \ |
|
193 | $PYTHON_EXECUTABLE get-pip.py \ | |
194 | --disable-pip-version-check \ |
|
194 | --disable-pip-version-check \ | |
195 | --no-cache-dir \ |
|
195 | --no-cache-dir \ | |
196 | --no-compile \ |
|
196 | --no-compile \ | |
197 | "pip==24.0" && \ |
|
197 | "pip==24.0" && \ | |
198 | rm get-pip.py |
|
198 | rm get-pip.py | |
199 |
|
199 | |||
200 | RUN \ |
|
200 | RUN \ | |
201 | /home/$RC_USER/.local/bin/pip install --user virtualenv |
|
201 | /home/$RC_USER/.local/bin/pip install --user virtualenv | |
202 |
|
202 | |||
203 | RUN \ |
|
203 | RUN \ | |
204 | /home/$RC_USER/.local/bin/virtualenv --python="$PYTHON_EXECUTABLE" $VENV_PATH && \ |
|
204 | /home/$RC_USER/.local/bin/virtualenv --python="$PYTHON_EXECUTABLE" $VENV_PATH && \ | |
205 | /home/$RC_USER/.local/bin/pip install --upgrade pip |
|
205 | /home/$RC_USER/.local/bin/pip install --upgrade pip | |
206 |
|
206 | |||
207 | # swig install |
|
207 | # swig install | |
208 | ENV \ |
|
208 | ENV \ | |
209 | RC_SWIG_VERSION=3.0.12 \ |
|
209 | RC_SWIG_VERSION=3.0.12 \ | |
210 | PATH=/usr/local/bin/:$PATH |
|
210 | PATH=/usr/local/bin/:$PATH | |
211 |
|
211 | |||
212 | RUN \ |
|
212 | RUN \ | |
213 | echo "** install swig packages $RC_SWIG_VERSION **" && \ |
|
213 | echo "** install swig packages $RC_SWIG_VERSION **" && \ | |
214 | curl -L https://sourceforge.net/projects/swig/files/swig/swig-$RC_SWIG_VERSION/swig-$RC_SWIG_VERSION.tar.gz/download -o swig.tar.gz && \ |
|
214 | curl -L https://sourceforge.net/projects/swig/files/swig/swig-$RC_SWIG_VERSION/swig-$RC_SWIG_VERSION.tar.gz/download -o swig.tar.gz && \ | |
215 | tar xfz swig.tar.gz && rm swig.tar.gz && \ |
|
215 | tar xfz swig.tar.gz && rm swig.tar.gz && \ | |
216 | cd swig-$RC_SWIG_VERSION && \ |
|
216 | cd swig-$RC_SWIG_VERSION && \ | |
217 | ./configure --with-python=$PYTHON && \ |
|
217 | ./configure --with-python=$PYTHON && \ | |
218 | make && \ |
|
218 | make && \ | |
219 | sudo make install && \ |
|
219 | sudo make install && \ | |
220 | cd ../ && sudo rm -rf swig-$RC_SWIG_VERSION |
|
220 | cd ../ && sudo rm -rf swig-$RC_SWIG_VERSION | |
221 |
|
221 | |||
222 | # GIT Install |
|
222 | # GIT Install | |
223 | ENV \ |
|
223 | ENV \ | |
224 | RC_GIT_VER=2.44.0 \ |
|
224 | RC_GIT_VER=2.44.0 \ | |
225 | # make git scripts visible |
|
225 | # make git scripts visible | |
226 | PATH=/home/$RC_USER/git/bin:$PATH |
|
226 | PATH=/home/$RC_USER/git/bin:$PATH | |
227 |
|
227 | |||
228 | RUN \ |
|
228 | RUN \ | |
229 | echo "** install git packages $RC_GIT_VER **" && \ |
|
229 | echo "** install git packages $RC_GIT_VER **" && \ | |
230 | curl -L https://www.kernel.org/pub/software/scm/git/git-$RC_GIT_VER.tar.gz -o git.tar.gz && \ |
|
230 | curl -L https://www.kernel.org/pub/software/scm/git/git-$RC_GIT_VER.tar.gz -o git.tar.gz && \ | |
231 | tar xfz git.tar.gz && rm git.tar.gz && \ |
|
231 | tar xfz git.tar.gz && rm git.tar.gz && \ | |
232 | cd git-$RC_GIT_VER && \ |
|
232 | cd git-$RC_GIT_VER && \ | |
233 | ./configure --prefix=/home/$RC_USER/git && \ |
|
233 | ./configure --prefix=/home/$RC_USER/git && \ | |
234 | make NO_GETTEXT=yes NO_MSGFMT=yes && \ |
|
234 | make NO_GETTEXT=yes NO_MSGFMT=yes && \ | |
235 | sudo make install && \ |
|
235 | sudo make install && \ | |
236 | cd ../ && sudo rm -rf git-$RC_GIT_VER |
|
236 | cd ../ && sudo rm -rf git-$RC_GIT_VER | |
237 |
|
237 | |||
238 | RUN \ |
|
238 | RUN \ | |
239 | echo "** install git symlinks **" && \ |
|
239 | echo "** install git symlinks **" && \ | |
240 | mkdir -p $BUILD_BIN_DIR/vcs_bin && \ |
|
240 | mkdir -p $BUILD_BIN_DIR/vcs_bin && \ | |
241 | sudo chown $RC_USER:$RC_USER /home/$RC_USER/git && \ |
|
241 | sudo chown $RC_USER:$RC_USER /home/$RC_USER/git && \ | |
242 | ln -s /home/$RC_USER/git/bin/* $BUILD_BIN_DIR/vcs_bin/ |
|
242 | ln -s /home/$RC_USER/git/bin/* $BUILD_BIN_DIR/vcs_bin/ | |
243 |
|
243 | |||
244 | # GIT LFS install |
|
244 | # GIT LFS install | |
245 | # https://github.com/git-lfs/git-lfs/releases |
|
245 | # https://github.com/git-lfs/git-lfs/releases | |
246 | ENV \ |
|
246 | ENV \ | |
247 | RC_GIT_LFS_VER=3.4.1 \ |
|
247 | RC_GIT_LFS_VER=3.4.1 \ | |
248 | PATH=/home/$RC_USER/git-lfs/bin:$PATH |
|
248 | PATH=/home/$RC_USER/git-lfs/bin:$PATH | |
249 |
|
249 | |||
250 | RUN \ |
|
250 | RUN \ | |
251 | echo "** install git LFS packages $RC_GIT_LFS_VER **" && \ |
|
251 | echo "** install git LFS packages $RC_GIT_LFS_VER **" && \ | |
252 | curl -L https://github.com/git-lfs/git-lfs/releases/download/v$RC_GIT_LFS_VER/git-lfs-linux-amd64-v$RC_GIT_LFS_VER.tar.gz -o git_lfs.tar.gz && \ |
|
252 | curl -L https://github.com/git-lfs/git-lfs/releases/download/v$RC_GIT_LFS_VER/git-lfs-linux-amd64-v$RC_GIT_LFS_VER.tar.gz -o git_lfs.tar.gz && \ | |
253 | tar xfz git_lfs.tar.gz && rm git_lfs.tar.gz && \ |
|
253 | tar xfz git_lfs.tar.gz && rm git_lfs.tar.gz && \ | |
254 | mv git-lfs-$RC_GIT_LFS_VER git-lfs && \ |
|
254 | mv git-lfs-$RC_GIT_LFS_VER git-lfs && \ | |
255 | rm -rf git-lfs/man && \ |
|
255 | rm -rf git-lfs/man && \ | |
256 | cd git-lfs && \ |
|
256 | cd git-lfs && \ | |
257 | sudo PREFIX=/home/$RC_USER/git ./install.sh && \ |
|
257 | sudo PREFIX=/home/$RC_USER/git ./install.sh && \ | |
258 | rm install.sh README.md CHANGELOG.md |
|
258 | rm install.sh README.md CHANGELOG.md | |
259 |
|
259 | |||
260 | RUN \ |
|
260 | RUN \ | |
261 | echo "** install git-lfs symlinks **" && \ |
|
261 | echo "** install git-lfs symlinks **" && \ | |
262 | mkdir -p $BUILD_BIN_DIR/vcs_bin && \ |
|
262 | mkdir -p $BUILD_BIN_DIR/vcs_bin && \ | |
263 | sudo chown $RC_USER:$RC_USER /home/$RC_USER/git-lfs && \ |
|
263 | sudo chown $RC_USER:$RC_USER /home/$RC_USER/git-lfs && \ | |
264 | ln -s /home/$RC_USER/git-lfs/* $BUILD_BIN_DIR/vcs_bin/ |
|
264 | ln -s /home/$RC_USER/git-lfs/* $BUILD_BIN_DIR/vcs_bin/ | |
265 |
|
265 | |||
266 | # Apache2 install, check here for new versions: https://httpd.apache.org/ |
|
266 | # Apache2 install, check here for new versions: https://httpd.apache.org/ | |
267 | ENV \ |
|
267 | ENV \ | |
268 | RC_APACHE2_VER=2.4.59 \ |
|
268 | RC_APACHE2_VER=2.4.59 \ | |
269 | # make apache scripts visible |
|
269 | # make apache scripts visible | |
270 | PATH=/home/$RC_USER/apache2/bin:$PATH |
|
270 | PATH=/home/$RC_USER/apache2/bin:$PATH | |
271 |
|
271 | |||
272 | RUN \ |
|
272 | RUN \ | |
273 | echo "** install Apache packages $RC_SVN_VER **" && \ |
|
273 | echo "** install Apache packages $RC_SVN_VER **" && \ | |
274 | curl -L https://archive.apache.org/dist/httpd/httpd-$RC_APACHE2_VER.tar.gz -o apache2.tar.gz && \ |
|
274 | curl -L https://archive.apache.org/dist/httpd/httpd-$RC_APACHE2_VER.tar.gz -o apache2.tar.gz && \ | |
275 | tar xfz apache2.tar.gz && rm apache2.tar.gz && \ |
|
275 | tar xfz apache2.tar.gz && rm apache2.tar.gz && \ | |
276 | cd httpd-$RC_APACHE2_VER && \ |
|
276 | cd httpd-$RC_APACHE2_VER && \ | |
277 | ./configure --prefix=/home/$RC_USER/apache2 --enable-mods-shared=reallyall --enable-dav --enable-authn-anon && \ |
|
277 | ./configure --prefix=/home/$RC_USER/apache2 --enable-mods-shared=reallyall --enable-dav --enable-authn-anon && \ | |
278 | make && \ |
|
278 | make && \ | |
279 | make install && \ |
|
279 | make install && \ | |
280 | cd ../ && sudo rm -rf httpd-$RC_APACHE2_VER |
|
280 | cd ../ && sudo rm -rf httpd-$RC_APACHE2_VER | |
281 |
|
281 | |||
282 | # custom SVN virtualhost |
|
282 | # custom SVN virtualhost | |
283 | COPY \ |
|
283 | COPY \ | |
284 | service/svn/virtualhost.conf /home/$RC_USER/apache2/conf/virtualhost.conf |
|
284 | service/svn/virtualhost.conf /home/$RC_USER/apache2/conf/virtualhost.conf | |
285 |
|
285 | |||
286 | RUN \ |
|
286 | RUN \ | |
287 | echo "**** Apache config ****" && \ |
|
287 | echo "**** Apache config ****" && \ | |
288 | rm -rf /home/$RC_USER/apache2/htdocs && \ |
|
288 | rm -rf /home/$RC_USER/apache2/htdocs && \ | |
289 | rm -rf /home/$RC_USER/apache2/icons && \ |
|
289 | rm -rf /home/$RC_USER/apache2/icons && \ | |
290 | rm -rf /home/$RC_USER/apache2/manual && \ |
|
290 | rm -rf /home/$RC_USER/apache2/manual && \ | |
291 | rm -rf /home/$RC_USER/apache2/man && \ |
|
291 | rm -rf /home/$RC_USER/apache2/man && \ | |
292 | sed -i "s/DocumentRoot/#DocumentRoot/g" /home/$RC_USER/apache2/conf/httpd.conf && \ |
|
292 | sed -i "s/DocumentRoot/#DocumentRoot/g" /home/$RC_USER/apache2/conf/httpd.conf && \ | |
293 | sed -i "s/Listen 80/Listen ${MOD_DAV_SVN_PORT}/g" /home/$RC_USER/apache2/conf/httpd.conf && \ |
|
293 | sed -i "s/Listen 80/Listen ${MOD_DAV_SVN_PORT}/g" /home/$RC_USER/apache2/conf/httpd.conf && \ | |
294 | sed -i "s/#LoadModule dav_module modules\/mod_dav.so/LoadModule dav_module modules\/mod_dav.so/g" /home/$RC_USER/apache2/conf/httpd.conf && \ |
|
294 | sed -i "s/#LoadModule dav_module modules\/mod_dav.so/LoadModule dav_module modules\/mod_dav.so/g" /home/$RC_USER/apache2/conf/httpd.conf && \ | |
295 | sed -i "s/User daemon/User ${RC_USER}/g" /home/$RC_USER/apache2/conf/httpd.conf && \ |
|
295 | sed -i "s/User daemon/User ${RC_USER}/g" /home/$RC_USER/apache2/conf/httpd.conf && \ | |
296 | sed -i "s/Group daemon/Group ${RC_USER}/g" /home/$RC_USER/apache2/conf/httpd.conf && \ |
|
296 | sed -i "s/Group daemon/Group ${RC_USER}/g" /home/$RC_USER/apache2/conf/httpd.conf && \ | |
297 | sed -i "s/ServerAdmin you@example.com/ServerAdmin admin@${HOSTNAME}/g" /home/$RC_USER/apache2/conf/httpd.conf && \ |
|
297 | sed -i "s/ServerAdmin you@example.com/ServerAdmin admin@${HOSTNAME}/g" /home/$RC_USER/apache2/conf/httpd.conf && \ | |
298 | sed -i "s/ServerName buildkitsandbox/ServerName ${HOSTNAME}/g" /home/$RC_USER/apache2/conf/httpd.conf && \ |
|
298 | sed -i "s/ServerName buildkitsandbox/ServerName ${HOSTNAME}/g" /home/$RC_USER/apache2/conf/httpd.conf && \ | |
299 | sed -i "s/#Include conf\/extra\/httpd-vhosts.conf/Include conf\/virtualhost.conf/g" /home/$RC_USER/apache2/conf/httpd.conf |
|
299 | sed -i "s/#Include conf\/extra\/httpd-vhosts.conf/Include conf\/virtualhost.conf/g" /home/$RC_USER/apache2/conf/httpd.conf | |
300 |
|
300 | |||
301 |
|
301 | |||
302 | # Subversion install |
|
302 | # Subversion install | |
303 | # https://svn.apache.org/repos/asf/subversion/trunk/subversion/bindings/swig/INSTALL |
|
303 | # https://svn.apache.org/repos/asf/subversion/trunk/subversion/bindings/swig/INSTALL | |
304 | # new versions: https://subversion.apache.org/download.cgi |
|
304 | # new versions: https://subversion.apache.org/download.cgi | |
305 | # https://downloads.apache.org/subversion |
|
305 | # https://downloads.apache.org/subversion | |
306 |
|
306 | |||
307 | ENV \ |
|
307 | ENV \ | |
308 | RC_SVN_VER=1.14.2 \ |
|
308 | RC_SVN_VER=1.14.2 \ | |
309 | SVN_PREFIX=/home/$RC_USER/subversion \ |
|
309 | SVN_PREFIX=/home/$RC_USER/subversion \ | |
310 | # make svn scripts visible |
|
310 | # make svn scripts visible | |
311 | PATH=/home/$RC_USER/subversion/bin:$PATH |
|
311 | PATH=/home/$RC_USER/subversion/bin:$PATH | |
312 |
|
312 | |||
313 |
|
313 | |||
314 | RUN \ |
|
314 | RUN \ | |
315 | echo "** install svn packages $RC_SVN_VER **" && \ |
|
315 | echo "** install svn packages $RC_SVN_VER **" && \ | |
316 | curl -L https://downloads.apache.org/subversion/subversion-$RC_SVN_VER.tar.gz -o subversion.tar.gz && \ |
|
316 | curl -L https://downloads.apache.org/subversion/subversion-$RC_SVN_VER.tar.gz -o subversion.tar.gz && \ | |
317 | tar xfz subversion.tar.gz && rm subversion.tar.gz && \ |
|
317 | tar xfz subversion.tar.gz && rm subversion.tar.gz && \ | |
318 | cd subversion-$RC_SVN_VER && \ |
|
318 | cd subversion-$RC_SVN_VER && \ | |
319 | ./autogen.sh && \ |
|
319 | ./autogen.sh && \ | |
320 | ./configure --prefix=$SVN_PREFIX --with-apxs=/home/$RC_USER/apache2/bin/apxs --enable-mod-activation --with-swig=/usr/local/bin/swig && \ |
|
320 | ./configure --prefix=$SVN_PREFIX --with-apxs=/home/$RC_USER/apache2/bin/apxs --enable-mod-activation --with-swig=/usr/local/bin/swig && \ | |
321 | make && \ |
|
321 | make && \ | |
322 | sudo make install && \ |
|
322 | sudo make install && \ | |
323 | sudo make clean-swig-py && \ |
|
323 | sudo make clean-swig-py && \ | |
324 | sudo make swig-py swig_pydir=$VENV_PATH/lib/$PYTHON_VERSION/site-packages/libsvn swig_pydir_extra=$VENV_PATH/lib/$PYTHON_VERSION/site-packages/svn && \ |
|
324 | sudo make swig-py swig_pydir=$VENV_PATH/lib/$PYTHON_VERSION/site-packages/libsvn swig_pydir_extra=$VENV_PATH/lib/$PYTHON_VERSION/site-packages/svn && \ | |
325 | sudo make install-swig-py swig_pydir=$VENV_PATH/lib/$PYTHON_VERSION/site-packages/libsvn swig_pydir_extra=$VENV_PATH/lib/$PYTHON_VERSION/site-packages/svn && \ |
|
325 | sudo make install-swig-py swig_pydir=$VENV_PATH/lib/$PYTHON_VERSION/site-packages/libsvn swig_pydir_extra=$VENV_PATH/lib/$PYTHON_VERSION/site-packages/svn && \ | |
326 | sudo ldconfig -v && \ |
|
326 | sudo ldconfig -v && \ | |
327 | cd ../ && sudo rm -rf subversion-$RC_SVN_VER |
|
327 | cd ../ && sudo rm -rf subversion-$RC_SVN_VER | |
328 |
|
328 | |||
329 | RUN \ |
|
329 | RUN \ | |
330 | echo "** install svn symlinks **" && \ |
|
330 | echo "** install svn symlinks **" && \ | |
331 | mkdir -p $BUILD_BIN_DIR/vcs_bin && \ |
|
331 | mkdir -p $BUILD_BIN_DIR/vcs_bin && \ | |
332 | sudo chown $RC_USER:$RC_USER /home/$RC_USER/subversion && \ |
|
332 | sudo chown $RC_USER:$RC_USER /home/$RC_USER/subversion && \ | |
333 | echo $(strings $MOD_DAV_SVN_MODULE | grep 'Powered by') > $BUILD_BIN_DIR/vcs_bin/mod_dav_svn.version && \ |
|
333 | echo $(strings $MOD_DAV_SVN_MODULE | grep 'Powered by') > $BUILD_BIN_DIR/vcs_bin/mod_dav_svn.version && \ | |
334 | ln -s /home/$RC_USER/subversion/bin/* $BUILD_BIN_DIR/vcs_bin/ |
|
334 | ln -s /home/$RC_USER/subversion/bin/* $BUILD_BIN_DIR/vcs_bin/ | |
335 |
|
335 | |||
336 | #TODO: compile libgit2 |
|
336 | #TODO: compile libgit2 | |
337 | #https://www.pygit2.org/install.html#advanced |
|
337 | #https://www.pygit2.org/install.html#advanced | |
338 | #ENV \ |
|
338 | #ENV \ | |
339 | # RC_LIBGIT2_VER=1.14.2 \ |
|
339 | # RC_LIBGIT2_VER=1.14.2 \ | |
340 | # curl -L https://github.com/libgit2/libgit2/archive/refs/tags/v$RC_LIBGIT2_VER.tar.gz -o libgit2.tar.gz |
|
340 | # curl -L https://github.com/libgit2/libgit2/archive/refs/tags/v$RC_LIBGIT2_VER.tar.gz -o libgit2.tar.gz | |
341 | # tar xzf libgit2.tar.gz && rm libgit2.tar.gz |
|
341 | # tar xzf libgit2.tar.gz && rm libgit2.tar.gz | |
342 | # cd libgit2-$RC_LIBGIT2_VER/ |
|
342 | # cd libgit2-$RC_LIBGIT2_VER/ | |
343 | # cmake . |
|
343 | # cmake . | |
344 | # make |
|
344 | # make | |
345 | # sudo make install \ |
|
345 | # sudo make install \ | |
346 | # |
|
346 | # | |
347 |
|
347 | |||
348 |
ARG RHODECODE_VERSION=5.0. |
|
348 | ARG RHODECODE_VERSION=5.0.2 | |
349 |
|
349 | |||
350 | # env are runtime |
|
350 | # env are runtime | |
351 | ENV \ |
|
351 | ENV \ | |
352 | ## SETUP ARGS FOR INSTALLATION ## |
|
352 | ## SETUP ARGS FOR INSTALLATION ## | |
353 | ## set version we build on, get from .env or set default ver |
|
353 | ## set version we build on, get from .env or set default ver | |
354 | RHODECODE_VERSION=${RHODECODE_VERSION} |
|
354 | RHODECODE_VERSION=${RHODECODE_VERSION} | |
355 |
|
355 | |||
356 | RUN \ |
|
356 | RUN \ | |
357 | echo 'export PS1=">> rhodecode-docker-$RHODECODE_VERSION \W \$ "' | sudo tee -a /root/.bashrc && \ |
|
357 | echo 'export PS1=">> rhodecode-docker-$RHODECODE_VERSION \W \$ "' | sudo tee -a /root/.bashrc && \ | |
358 | echo 'export PS1=">> rhodecode-docker-$RHODECODE_VERSION \W \$ "' | sudo tee -a /home/$RC_USER/.bashrc |
|
358 | echo 'export PS1=">> rhodecode-docker-$RHODECODE_VERSION \W \$ "' | sudo tee -a /home/$RC_USER/.bashrc | |
359 |
|
359 | |||
360 | # Copy artifacts |
|
360 | # Copy artifacts | |
361 | #COPY --chown=$RC_USER:$RC_USER .cache/locale-archive /var/opt/ |
|
361 | #COPY --chown=$RC_USER:$RC_USER .cache/locale-archive /var/opt/ | |
362 | COPY --chown=$RC_USER:$RC_USER config/_shared/rhodecode_enterprise.license /home/$RC_USER/.rccontrol/bootstrap/ |
|
362 | COPY --chown=$RC_USER:$RC_USER config/_shared/rhodecode_enterprise.license /home/$RC_USER/.rccontrol/bootstrap/ | |
363 | COPY --chown=$RC_USER:$RC_USER service/rhodecode/bootstrap/* /home/$RC_USER/.rccontrol/bootstrap/ |
|
363 | COPY --chown=$RC_USER:$RC_USER service/rhodecode/bootstrap/* /home/$RC_USER/.rccontrol/bootstrap/ | |
364 | COPY --chown=$RC_USER:$RC_USER .source/ /home/$RC_USER/ |
|
364 | COPY --chown=$RC_USER:$RC_USER .source/ /home/$RC_USER/ | |
365 |
|
365 | |||
366 | # VCS |
|
366 | # VCS | |
367 | RUN \ |
|
367 | RUN \ | |
368 | echo "** install vcsserver ${RHODECODE_VERSION} **" && \ |
|
368 | echo "** install vcsserver ${RHODECODE_VERSION} **" && \ | |
369 | $PIP_EXECUTABLE install --disable-pip-version-check --trusted-host pypi.python.org --no-cache-dir \ |
|
369 | $PIP_EXECUTABLE install --disable-pip-version-check --trusted-host pypi.python.org --no-cache-dir \ | |
370 | -r /home/$RC_USER/rhodecode-vcsserver/requirements.txt && \ |
|
370 | -r /home/$RC_USER/rhodecode-vcsserver/requirements.txt && \ | |
371 | $PIP_EXECUTABLE install /home/$RC_USER/rhodecode-vcsserver |
|
371 | $PIP_EXECUTABLE install /home/$RC_USER/rhodecode-vcsserver | |
372 |
|
372 | |||
373 | RUN \ |
|
373 | RUN \ | |
374 | #echo "** copy config of vcsserver ${RHODECODE_VERSION} **" && \ |
|
374 | #echo "** copy config of vcsserver ${RHODECODE_VERSION} **" && \ | |
375 | VCSSERVER_PATH=/home/$RC_USER/rhodecode-vcsserver && \ |
|
375 | VCSSERVER_PATH=/home/$RC_USER/rhodecode-vcsserver && \ | |
376 | rsync -a $VENV_PATH/bin/ $BUILD_BIN_DIR/vcs_bin/ && \ |
|
376 | rsync -a $VENV_PATH/bin/ $BUILD_BIN_DIR/vcs_bin/ && \ | |
377 | cp -v ${VCSSERVER_PATH}/configs/production.ini $BUILD_CONF/vcsserver.ini && \ |
|
377 | cp -v ${VCSSERVER_PATH}/configs/production.ini $BUILD_CONF/vcsserver.ini && \ | |
378 | cp -v ${VCSSERVER_PATH}/configs/gunicorn_config.py $BUILD_CONF/gunicorn_conf_vcs.py && \ |
|
378 | cp -v ${VCSSERVER_PATH}/configs/gunicorn_config.py $BUILD_CONF/gunicorn_conf_vcs.py && \ | |
379 | echo "Done copy config of vcsserver" |
|
379 | echo "Done copy config of vcsserver" | |
380 |
|
380 | |||
381 | # CE |
|
381 | # CE | |
382 | RUN \ |
|
382 | RUN \ | |
383 | echo "** install rhodecode-ce ${RHODECODE_VERSION} **" && \ |
|
383 | echo "** install rhodecode-ce ${RHODECODE_VERSION} **" && \ | |
384 | $PIP_EXECUTABLE install --disable-pip-version-check --trusted-host pypi.python.org --no-cache-dir \ |
|
384 | $PIP_EXECUTABLE install --disable-pip-version-check --trusted-host pypi.python.org --no-cache-dir \ | |
385 | -r /home/$RC_USER/rhodecode-enterprise-ce/requirements_rc_tools.txt \ |
|
385 | -r /home/$RC_USER/rhodecode-enterprise-ce/requirements_rc_tools.txt \ | |
386 | -r /home/$RC_USER/rhodecode-enterprise-ce/requirements.txt && \ |
|
386 | -r /home/$RC_USER/rhodecode-enterprise-ce/requirements.txt && \ | |
387 | $PIP_EXECUTABLE install /home/$RC_USER/rhodecode-enterprise-ce |
|
387 | $PIP_EXECUTABLE install /home/$RC_USER/rhodecode-enterprise-ce | |
388 |
|
388 | |||
389 | RUN \ |
|
389 | RUN \ | |
390 | echo "** copy config of rhodecode-ce ${RHODECODE_VERSION} **" && \ |
|
390 | echo "** copy config of rhodecode-ce ${RHODECODE_VERSION} **" && \ | |
391 | RHODECODE_PATH=/home/$RC_USER/rhodecode-enterprise-ce && \ |
|
391 | RHODECODE_PATH=/home/$RC_USER/rhodecode-enterprise-ce && \ | |
392 | rsync -a $VENV_PATH/bin/ $BUILD_BIN_DIR/bin/ && \ |
|
392 | rsync -a $VENV_PATH/bin/ $BUILD_BIN_DIR/bin/ && \ | |
393 | cp -v ${RHODECODE_PATH}/configs/production.ini $BUILD_CONF/rhodecode.ini && \ |
|
393 | cp -v ${RHODECODE_PATH}/configs/production.ini $BUILD_CONF/rhodecode.ini && \ | |
394 | cp -v ${RHODECODE_PATH}/configs/gunicorn_config.py $BUILD_CONF/gunicorn_conf_rc.py && \ |
|
394 | cp -v ${RHODECODE_PATH}/configs/gunicorn_config.py $BUILD_CONF/gunicorn_conf_rc.py && \ | |
395 | mkdir -p $RHODECODE_STATIC_DIR/static/ && cp -Rf /${RHODECODE_PATH}/rhodecode/public/* $RHODECODE_STATIC_DIR/static/ && chmod 755 -R $RHODECODE_STATIC_DIR/static/ && \ |
|
395 | mkdir -p $RHODECODE_STATIC_DIR/static/ && cp -Rf /${RHODECODE_PATH}/rhodecode/public/* $RHODECODE_STATIC_DIR/static/ && chmod 755 -R $RHODECODE_STATIC_DIR/static/ && \ | |
396 | echo "Done copy config of rhodecode-ce" |
|
396 | echo "Done copy config of rhodecode-ce" | |
397 |
|
397 | |||
398 | # EE |
|
398 | # EE | |
399 | RUN \ |
|
399 | RUN \ | |
400 | echo "** install rhodecode-ee ${RHODECODE_VERSION} **" && \ |
|
400 | echo "** install rhodecode-ee ${RHODECODE_VERSION} **" && \ | |
401 | $PIP_EXECUTABLE install --disable-pip-version-check --trusted-host pypi.python.org --no-cache-dir \ |
|
401 | $PIP_EXECUTABLE install --disable-pip-version-check --trusted-host pypi.python.org --no-cache-dir \ | |
402 | -r /home/$RC_USER/rhodecode-enterprise-ee/requirements.txt && \ |
|
402 | -r /home/$RC_USER/rhodecode-enterprise-ee/requirements.txt && \ | |
403 | $PIP_EXECUTABLE install /home/$RC_USER/rhodecode-enterprise-ee |
|
403 | $PIP_EXECUTABLE install /home/$RC_USER/rhodecode-enterprise-ee | |
404 |
|
404 | |||
405 | RUN \ |
|
405 | RUN \ | |
406 | echo "** copy config of rhodecode-ee ${RHODECODE_VERSION} **" && \ |
|
406 | echo "** copy config of rhodecode-ee ${RHODECODE_VERSION} **" && \ | |
407 | RHODECODE_PATH=/home/$RC_USER/rhodecode-enterprise-ee && \ |
|
407 | RHODECODE_PATH=/home/$RC_USER/rhodecode-enterprise-ee && \ | |
408 | rsync -a $VENV_PATH/bin/ $BUILD_BIN_DIR/bin/ && \ |
|
408 | rsync -a $VENV_PATH/bin/ $BUILD_BIN_DIR/bin/ && \ | |
409 | cp -v ${RHODECODE_PATH}/configs/production.ini $BUILD_CONF/rhodecode.ini && \ |
|
409 | cp -v ${RHODECODE_PATH}/configs/production.ini $BUILD_CONF/rhodecode.ini && \ | |
410 | cp -v ${RHODECODE_PATH}/configs/gunicorn_config.py $BUILD_CONF/gunicorn_conf_rc.py && \ |
|
410 | cp -v ${RHODECODE_PATH}/configs/gunicorn_config.py $BUILD_CONF/gunicorn_conf_rc.py && \ | |
411 | mkdir -p $RHODECODE_STATIC_DIR/static/ && cp -Rf /${RHODECODE_PATH}/rc_ee/public/* $RHODECODE_STATIC_DIR/static/ && chmod 755 -R $RHODECODE_STATIC_DIR/static/ && \ |
|
411 | mkdir -p $RHODECODE_STATIC_DIR/static/ && cp -Rf /${RHODECODE_PATH}/rc_ee/public/* $RHODECODE_STATIC_DIR/static/ && chmod 755 -R $RHODECODE_STATIC_DIR/static/ && \ | |
412 | echo "Done copy config of rhodecode-ee" |
|
412 | echo "Done copy config of rhodecode-ee" | |
413 |
|
413 | |||
414 | RUN \ |
|
414 | RUN \ | |
415 | echo "** STATIC FILE CHECK **" && \ |
|
415 | echo "** STATIC FILE CHECK **" && \ | |
416 | find $RHODECODE_STATIC_DIR/static/ -type f -name "*.less" -delete && \ |
|
416 | find $RHODECODE_STATIC_DIR/static/ -type f -name "*.less" -delete && \ | |
417 | rm $RHODECODE_STATIC_DIR/static/js/scripts.js && \ |
|
417 | rm $RHODECODE_STATIC_DIR/static/js/scripts.js && \ | |
418 | /home/$RC_USER/rhodecode-enterprise-ce/rhodecode/tests/scripts/static-file-check.sh $RHODECODE_STATIC_DIR/static/ && \ |
|
418 | /home/$RC_USER/rhodecode-enterprise-ce/rhodecode/tests/scripts/static-file-check.sh $RHODECODE_STATIC_DIR/static/ && \ | |
419 | echo "Done static file check" |
|
419 | echo "Done static file check" | |
420 |
|
420 | |||
421 |
|
421 | |||
422 | RUN \ |
|
422 | RUN \ | |
423 | echo "** cleanup of EE code **" && \ |
|
423 | echo "** cleanup of EE code **" && \ | |
424 | for out in "rc_ee" "rc_auth_plugins" "rc_chat" "rc_elasticsearch" "rc_integrations" "rc_license" "rc_reviewers"; do \ |
|
424 | for out in "rc_ee" "rc_auth_plugins" "rc_chat" "rc_elasticsearch" "rc_integrations" "rc_license" "rc_reviewers"; do \ | |
425 | echo ; \ |
|
425 | echo ; \ | |
426 | echo "cleanup of '$VENV_PATH/lib/$PYTHON_VERSION/site-packages/$out'"; \ |
|
426 | echo "cleanup of '$VENV_PATH/lib/$PYTHON_VERSION/site-packages/$out'"; \ | |
427 | rm -rf $VENV_PATH/lib/$PYTHON_VERSION/site-packages/$out/tests; \ |
|
427 | rm -rf $VENV_PATH/lib/$PYTHON_VERSION/site-packages/$out/tests; \ | |
428 | rm -rf `find $VENV_PATH/lib/$PYTHON_VERSION/site-packages/$out -path "*__pycache__"`; \ |
|
428 | rm -rf `find $VENV_PATH/lib/$PYTHON_VERSION/site-packages/$out -path "*__pycache__"`; \ | |
429 | rm -f `find $VENV_PATH/lib/$PYTHON_VERSION/site-packages/$out -type f \( -name "*.py" -o -name "*.c" \) -not -name "__init__.py" -not -path "*celerylib/tasks.py"`; \ |
|
429 | rm -f `find $VENV_PATH/lib/$PYTHON_VERSION/site-packages/$out -type f \( -name "*.py" -o -name "*.c" \) -not -name "__init__.py" -not -path "*celerylib/tasks.py"`; \ | |
430 | rm -f `echo "\`find $VENV_PATH/lib/$PYTHON_VERSION/site-packages/$out -type f -name \"*.so\"\` " | sed -e "s/\.so[ \t]*/\.pyc /g"`; \ |
|
430 | rm -f `echo "\`find $VENV_PATH/lib/$PYTHON_VERSION/site-packages/$out -type f -name \"*.so\"\` " | sed -e "s/\.so[ \t]*/\.pyc /g"`; \ | |
431 | done |
|
431 | done | |
432 |
|
432 | |||
433 |
|
433 | |||
434 | USER root |
|
434 | USER root | |
435 |
|
435 | |||
436 | RUN \ |
|
436 | RUN \ | |
437 | echo "**** cleanup ****" && \ |
|
437 | echo "**** cleanup ****" && \ | |
438 | apt-get remove -y $CLEANUP_DEPS && \ |
|
438 | apt-get remove -y $CLEANUP_DEPS && \ | |
439 | apt-get autoclean -y && \ |
|
439 | apt-get autoclean -y && \ | |
440 | rm -rf /tmp/* && \ |
|
440 | rm -rf /tmp/* && \ | |
441 | rm -rf /home/$RC_USER/.cache/pip && \ |
|
441 | rm -rf /home/$RC_USER/.cache/pip && \ | |
442 | rm -f /home/$RC_USER/.rccontrol/cache/RhodeCode-* && \ |
|
442 | rm -f /home/$RC_USER/.rccontrol/cache/RhodeCode-* && \ | |
443 | rm -rf /var/lib/apt/lists/* && \ |
|
443 | rm -rf /var/lib/apt/lists/* && \ | |
444 | rm -rf /var/cache/apk/* && \ |
|
444 | rm -rf /var/cache/apk/* && \ | |
445 | rm -f ${SUPERVISOR_CONF} && \ |
|
445 | rm -f ${SUPERVISOR_CONF} && \ | |
446 | echo "Done cleanup" |
|
446 | echo "Done cleanup" | |
447 |
|
447 | |||
448 | RUN \ |
|
448 | RUN \ | |
449 | echo "**** cleanup source ****" && \ |
|
449 | echo "**** cleanup source ****" && \ | |
450 | rm -rf /home/$RC_USER/*.sh && \ |
|
450 | rm -rf /home/$RC_USER/*.sh && \ | |
451 | rm -rf /home/$RC_USER/rhodecode-vcsserver && \ |
|
451 | rm -rf /home/$RC_USER/rhodecode-vcsserver && \ | |
452 | rm -rf /home/$RC_USER/rhodecode-enterprise-ce && \ |
|
452 | rm -rf /home/$RC_USER/rhodecode-enterprise-ce && \ | |
453 | rm -rf /home/$RC_USER/rhodecode-enterprise-ee && \ |
|
453 | rm -rf /home/$RC_USER/rhodecode-enterprise-ee && \ | |
454 | echo "Done cleanup source" |
|
454 | echo "Done cleanup source" | |
455 |
|
455 | |||
456 | # copy entrypoints |
|
456 | # copy entrypoints | |
457 | COPY entrypoints.d/entrypoint.sh /opt/entrypoints.d/entrypoint.sh |
|
457 | COPY entrypoints.d/entrypoint.sh /opt/entrypoints.d/entrypoint.sh | |
458 |
|
458 | |||
459 | RUN chmod +x /opt/entrypoints.d/entrypoint.sh |
|
459 | RUN chmod +x /opt/entrypoints.d/entrypoint.sh | |
460 |
|
460 | |||
461 | # config volume |
|
461 | # config volume | |
462 | VOLUME /etc/rhodecode/conf |
|
462 | VOLUME /etc/rhodecode/conf | |
463 |
|
463 | |||
464 | # repo store volume |
|
464 | # repo store volume | |
465 | VOLUME /var/opt/rhodecode_repo_store |
|
465 | VOLUME /var/opt/rhodecode_repo_store | |
466 |
|
466 | |||
467 | # data volume |
|
467 | # data volume | |
468 | VOLUME /var/opt/rhodecode_data |
|
468 | VOLUME /var/opt/rhodecode_data | |
469 |
|
469 | |||
470 | ENTRYPOINT ["/opt/entrypoints.d/entrypoint.sh"] |
|
470 | ENTRYPOINT ["/opt/entrypoints.d/entrypoint.sh"] | |
471 |
|
471 | |||
472 | # Tag images with commit references... |
|
472 | # Tag images with commit references... | |
473 | ARG VCS_SHA="stable" |
|
473 | ARG VCS_SHA="stable" | |
474 | ARG CE_SHA="stable" |
|
474 | ARG CE_SHA="stable" | |
475 | ARG EE_SHA="stable" |
|
475 | ARG EE_SHA="stable" | |
476 |
|
476 | |||
477 | LABEL org.label-schema.vcs-ref.vcsserver.ce="$VCS_SHA" org.label-schema.vcs-ref.rhodecode.ce="$CE_SHA" org.label-schema.vcs-ref.rhodecode.ee="$EE_SHA" |
|
477 | LABEL org.label-schema.vcs-ref.vcsserver.ce="$VCS_SHA" org.label-schema.vcs-ref.rhodecode.ce="$CE_SHA" org.label-schema.vcs-ref.rhodecode.ee="$EE_SHA" | |
478 |
|
478 | |||
479 | # compose can override this |
|
479 | # compose can override this | |
480 | CMD [ "$BUILD_BIN_DIR/bin/gunicorn", "--error-logfile=-", "--paster=/etc/rhodecode/conf_build/rhodecode.ini", "--config=/etc/rhodecode/conf_build/gunicorn_conf_rc.py" ] |
|
480 | CMD [ "$BUILD_BIN_DIR/bin/gunicorn", "--error-logfile=-", "--paster=/etc/rhodecode/conf_build/rhodecode.ini", "--config=/etc/rhodecode/conf_build/gunicorn_conf_rc.py" ] |
General Comments 0
You need to be logged in to leave comments.
Login now