Show More
@@ -1,393 +1,393 b'' | |||||
1 | # RhodeCode Cluster |
|
1 | # RhodeCode Cluster | |
2 |
|
2 | |||
3 | RhodeCode Cluster is a multi-node highly-scalable setup to run |
|
3 | RhodeCode Cluster is a multi-node highly-scalable setup to run | |
4 | RhodeCode, Edge Router(Traefik + SSL) and Metrics Stack (Prometheus, Loki, Grafana) and |
|
4 | RhodeCode, Edge Router(Traefik + SSL) and Metrics Stack (Prometheus, Loki, Grafana) and | |
5 | all its additional components in single environment using Docker. |
|
5 | all its additional components in single environment using Docker. | |
6 |
|
6 | |||
7 | Using a docker-compose this setup creates following services for RhodeCode: |
|
7 | Using a docker-compose this setup creates following services for RhodeCode: | |
8 |
|
8 | |||
9 | Edge-Router: |
|
9 | Edge-Router: | |
10 |
|
10 | |||
11 | - Traefik, Edge Router, SSL termination etc |
|
11 | - Traefik, Edge Router, SSL termination etc | |
12 |
|
12 | |||
13 | Core Services: |
|
13 | Core Services: | |
14 |
|
14 | |||
15 | - Database (defaults to PostgreSQL) |
|
15 | - Database (defaults to PostgreSQL) | |
16 | - Redis, acts as cache and queue exchange |
|
16 | - Redis, acts as cache and queue exchange | |
17 | - ChannelStream - live websocket communications |
|
17 | - ChannelStream - live websocket communications | |
18 | - Nginx (static/channelstream) proxy serving RhodeCode static files and channelstream communication |
|
18 | - Nginx (static/channelstream) proxy serving RhodeCode static files and channelstream communication | |
19 | - Elasticsearch (full text search backend) |
|
19 | - Elasticsearch (full text search backend) | |
20 |
|
20 | |||
21 | RhodeCode |
|
21 | RhodeCode | |
22 |
|
22 | |||
23 | - RhodeCode CE/EE |
|
23 | - RhodeCode CE/EE | |
24 | - VCSServer for GIT/SVN/HG support |
|
24 | - VCSServer for GIT/SVN/HG support | |
25 | - SSH Server for cloning over SSH |
|
25 | - SSH Server for cloning over SSH | |
26 | - SVN webserver for HTTP support over SVN |
|
26 | - SVN webserver for HTTP support over SVN | |
27 | - Celery workers for asynchronous tasks |
|
27 | - Celery workers for asynchronous tasks | |
28 | - Celery beat for automation tasks |
|
28 | - Celery beat for automation tasks | |
29 |
|
29 | |||
30 | Metrics |
|
30 | Metrics | |
31 |
|
31 | |||
32 | - Loki, logs aggregation |
|
32 | - Loki, logs aggregation | |
33 | - Grafana, metrics Dashboard |
|
33 | - Grafana, metrics Dashboard | |
34 | - Prometheus, metrics time-series |
|
34 | - Prometheus, metrics time-series | |
35 | - Statsd-exporter - statsd to Prometheus bridge |
|
35 | - Statsd-exporter - statsd to Prometheus bridge | |
36 | - Node-exporter - machine stats and usage |
|
36 | - Node-exporter - machine stats and usage | |
37 | - Promtail - log scraping |
|
37 | - Promtail - log scraping | |
38 |
|
38 | |||
39 | ##rcstack for Linux, new docker based installer |
|
39 | ##rcstack for Linux, new docker based installer | |
40 |
|
40 | |||
41 | To get started with RhodeCode get the new shell installer called rcstack |
|
41 | To get started with RhodeCode get the new shell installer called rcstack | |
42 |
|
42 | |||
43 | ``` |
|
43 | ``` | |
44 | mkdir docker-rhodecode && cd docker-rhodecode |
|
44 | mkdir docker-rhodecode && cd docker-rhodecode | |
45 |
curl -s -o rcstack https:// |
|
45 | curl -L -s -o rcstack https://dls.rhodecode.com/get/master && chmod +x rcstack | |
46 | ./rcstack get-started |
|
46 | ./rcstack get-started | |
47 | ``` |
|
47 | ``` | |
48 |
|
48 | |||
49 | ## Pre requisites |
|
49 | ## Pre requisites | |
50 |
|
50 | |||
51 | To Run this stack Docker engine and Docker Compose needs to be installed on the host machine. |
|
51 | To Run this stack Docker engine and Docker Compose needs to be installed on the host machine. | |
52 | Please run `./rcstack init` to install docker using the installer, or |
|
52 | Please run `./rcstack init` to install docker using the installer, or | |
53 | visit docker site and install docker (min version 20.10) and docker compose: |
|
53 | visit docker site and install docker (min version 20.10) and docker compose: | |
54 |
|
54 | |||
55 | - https://docs.docker.com/engine/install/ |
|
55 | - https://docs.docker.com/engine/install/ | |
56 | - https://docs.docker.com/compose/install/ |
|
56 | - https://docs.docker.com/compose/install/ | |
57 |
|
57 | |||
58 | ./rcstack init can install docker on linux machine, but if manual installation is |
|
58 | ./rcstack init can install docker on linux machine, but if manual installation is | |
59 | required it's also possible by simply installing docker before |
|
59 | required it's also possible by simply installing docker before | |
60 |
|
60 | |||
61 |
|
61 | |||
62 |
|
62 | |||
63 | # Quick install tutorial |
|
63 | # Quick install tutorial | |
64 |
|
64 | |||
65 | Those are step-by-step installation/run steps. |
|
65 | Those are step-by-step installation/run steps. | |
66 |
|
66 | |||
67 | create configurations / docker definitions: |
|
67 | create configurations / docker definitions: | |
68 |
|
68 | |||
69 | ./rcstack init |
|
69 | ./rcstack init | |
70 |
|
70 | |||
71 | At this point a custom file under .custom/.runtime.env was created. Adjust it if required. |
|
71 | At this point a custom file under .custom/.runtime.env was created. Adjust it if required. | |
72 |
|
72 | |||
73 | Start Traefik router that would handle all incoming traffic, load balance. A valid domain needs to be present in |
|
73 | Start Traefik router that would handle all incoming traffic, load balance. A valid domain needs to be present in | |
74 | .custom/.runtime.env to access the RhodeCOde |
|
74 | .custom/.runtime.env to access the RhodeCOde | |
75 |
|
75 | |||
76 | ./rcstack stack router up --detach |
|
76 | ./rcstack stack router up --detach | |
77 |
|
77 | |||
78 | Start the database and bootstrap it |
|
78 | Start the database and bootstrap it | |
79 |
|
79 | |||
80 | ./rcontrol stack database up --detach |
|
80 | ./rcontrol stack database up --detach | |
81 |
|
81 | |||
82 | Start other services required |
|
82 | Start other services required | |
83 |
|
83 | |||
84 | ./rcstack stack services up --detach |
|
84 | ./rcstack stack services up --detach | |
85 |
|
85 | |||
86 | Start RhodeCode stack |
|
86 | Start RhodeCode stack | |
87 |
|
87 | |||
88 | ./rcstack stack rhodecode up --detach |
|
88 | ./rcstack stack rhodecode up --detach | |
89 |
|
89 | |||
90 | Check stack status |
|
90 | Check stack status | |
91 |
|
91 | |||
92 | ./rcstack status |
|
92 | ./rcstack status | |
93 |
|
93 | |||
94 | Output should look similar like this: |
|
94 | Output should look similar like this: | |
95 |
|
95 | |||
96 | --- |
|
96 | --- | |
97 | CONTAINER ID IMAGE STATUS NAMES PORTS |
|
97 | CONTAINER ID IMAGE STATUS NAMES PORTS | |
98 | ef54fc528e3a traefik:v2.9.5 Up 2 hours rc_cluster_router-traefik-1 0.0.0.0:80->80/tcp, :::80->80/tcp |
|
98 | ef54fc528e3a traefik:v2.9.5 Up 2 hours rc_cluster_router-traefik-1 0.0.0.0:80->80/tcp, :::80->80/tcp | |
99 | f3ea0539e8b0 rhodecode/rhodecode-ee:4.28.0 Up 2 hours (healthy) rc_cluster_apps-rhodecode-1 0.0.0.0:10020->10020/tcp, :::10020->10020/tcp |
|
99 | f3ea0539e8b0 rhodecode/rhodecode-ee:4.28.0 Up 2 hours (healthy) rc_cluster_apps-rhodecode-1 0.0.0.0:10020->10020/tcp, :::10020->10020/tcp | |
100 | 2be52ba58ffe rhodecode/rhodecode-ee:4.28.0 Up 2 hours (healthy) rc_cluster_apps-vcsserver-1 |
|
100 | 2be52ba58ffe rhodecode/rhodecode-ee:4.28.0 Up 2 hours (healthy) rc_cluster_apps-vcsserver-1 | |
101 | 7cd730ad3263 rhodecode/rhodecode-ee:4.28.0 Up 2 hours (healthy) rc_cluster_apps-celery-1 |
|
101 | 7cd730ad3263 rhodecode/rhodecode-ee:4.28.0 Up 2 hours (healthy) rc_cluster_apps-celery-1 | |
102 | dfa231342c87 rhodecode/rhodecode-ee:4.28.0 Up 2 hours (healthy) rc_cluster_apps-celery-beat-1 |
|
102 | dfa231342c87 rhodecode/rhodecode-ee:4.28.0 Up 2 hours (healthy) rc_cluster_apps-celery-beat-1 | |
103 | d3d76ce2de96 rhodecode/rhodecode-ee:4.28.0 Up 2 hours (healthy) rc_cluster_apps-sshd-1 |
|
103 | d3d76ce2de96 rhodecode/rhodecode-ee:4.28.0 Up 2 hours (healthy) rc_cluster_apps-sshd-1 | |
104 | daaac329414b rhodecode/rhodecode-ee:4.28.0 Up 2 hours (healthy) rc_cluster_apps-svn-1 |
|
104 | daaac329414b rhodecode/rhodecode-ee:4.28.0 Up 2 hours (healthy) rc_cluster_apps-svn-1 | |
105 | 7b8504fb9acb nginx:1.23.2 Up 2 hours (healthy) rc_cluster_services-nginx-1 80/tcp |
|
105 | 7b8504fb9acb nginx:1.23.2 Up 2 hours (healthy) rc_cluster_services-nginx-1 80/tcp | |
106 | 7279c25feb6b elasticsearch:6.8.23 Up 2 hours (healthy) rc_cluster_services-elasticsearch-1 9200/tcp, 9300/tcp |
|
106 | 7279c25feb6b elasticsearch:6.8.23 Up 2 hours (healthy) rc_cluster_services-elasticsearch-1 9200/tcp, 9300/tcp | |
107 | 19fb93587493 redis:7.0.5 Up 2 hours (healthy) rc_cluster_services-redis-1 6379/tcp |
|
107 | 19fb93587493 redis:7.0.5 Up 2 hours (healthy) rc_cluster_services-redis-1 6379/tcp | |
108 | fb77fb6496c6 channelstream/channelstream:0.7.1 Up 2 hours (healthy) rc_cluster_services-channelstream-1 8000/tcp |
|
108 | fb77fb6496c6 channelstream/channelstream:0.7.1 Up 2 hours (healthy) rc_cluster_services-channelstream-1 8000/tcp | |
109 | cb6c5c022f5b postgres:14.6 Up 2 hours (healthy) rc_cluster_services-database-1 5432/tcp |
|
109 | cb6c5c022f5b postgres:14.6 Up 2 hours (healthy) rc_cluster_services-database-1 5432/tcp | |
110 |
|
110 | |||
111 | # Standalone cluster build from installer |
|
111 | # Standalone cluster build from installer | |
112 |
|
112 | |||
113 | If you;d like to build your own custom image here's a quick how to.: |
|
113 | If you;d like to build your own custom image here's a quick how to.: | |
114 | Follow these steps to build and run the RhodeCode Cluster via Docker-compose. |
|
114 | Follow these steps to build and run the RhodeCode Cluster via Docker-compose. | |
115 |
|
115 | |||
116 | 1) Run: |
|
116 | 1) Run: | |
117 |
|
117 | |||
118 | ./rcstack init |
|
118 | ./rcstack init | |
119 |
|
119 | |||
120 | 2) Run artifacts fetch like installer and certain needed build binaries: |
|
120 | 2) Run artifacts fetch like installer and certain needed build binaries: | |
121 |
|
121 | |||
122 | Start by fetching required installer binaries. This is required to create both |
|
122 | Start by fetching required installer binaries. This is required to create both | |
123 | simple build and full compose setup. |
|
123 | simple build and full compose setup. | |
124 | Please use the `--version-name VERSION_NAME` flag to adjust RhodeCode version if needed. |
|
124 | Please use the `--version-name VERSION_NAME` flag to adjust RhodeCode version if needed. | |
125 | (e.g. --version-name "4.24.1") |
|
125 | (e.g. --version-name "4.24.1") | |
126 |
|
126 | |||
127 | ``` |
|
127 | ``` | |
128 | ./rcstack get-build-artifacts |
|
128 | ./rcstack get-build-artifacts | |
129 | ``` |
|
129 | ``` | |
130 |
|
130 | |||
131 | This will download required installer files and put them into the `.cache` directory. |
|
131 | This will download required installer files and put them into the `.cache` directory. | |
132 | This directory should look similar to that after downloads have finish: |
|
132 | This directory should look similar to that after downloads have finish: | |
133 |
|
133 | |||
134 | ``` |
|
134 | ``` | |
135 | drwxr-xr-x 8 rcdev rcdev 256B Feb 8 13:35 . |
|
135 | drwxr-xr-x 8 rcdev rcdev 256B Feb 8 13:35 . | |
136 | drwxr-xr-x 14 rcdev rcdev 448B Feb 8 10:40 .. |
|
136 | drwxr-xr-x 14 rcdev rcdev 448B Feb 8 10:40 .. | |
137 | -rw-r--r-- 1 rcdev rcdev 0B Feb 8 20:44 .dirkeep |
|
137 | -rw-r--r-- 1 rcdev rcdev 0B Feb 8 20:44 .dirkeep | |
138 | -rwxr-xr-x 1 rcdev rcdev 241M Feb 8 13:35 RhodeCode-installer-linux-build20210208_0800 |
|
138 | -rwxr-xr-x 1 rcdev rcdev 241M Feb 8 13:35 RhodeCode-installer-linux-build20210208_0800 | |
139 | -rw-r--r-- 1 rcdev rcdev 156M Feb 8 13:35 RhodeCodeCommunity-4.24.1+x86_64-linux_build20210208_0800.tar.bz2 |
|
139 | -rw-r--r-- 1 rcdev rcdev 156M Feb 8 13:35 RhodeCodeCommunity-4.24.1+x86_64-linux_build20210208_0800.tar.bz2 | |
140 | -rw-r--r-- 1 rcdev rcdev 171M Feb 8 13:35 RhodeCodeEnterprise-4.24.1+x86_64-linux_build20210208_0800.tar.bz2 |
|
140 | -rw-r--r-- 1 rcdev rcdev 171M Feb 8 13:35 RhodeCodeEnterprise-4.24.1+x86_64-linux_build20210208_0800.tar.bz2 | |
141 | -rw-r--r-- 1 rcdev rcdev 145M Feb 8 13:35 RhodeCodeVCSServer-4.24.1+x86_64-linux_build20210208_0800.tar.bz2 |
|
141 | -rw-r--r-- 1 rcdev rcdev 145M Feb 8 13:35 RhodeCodeVCSServer-4.24.1+x86_64-linux_build20210208_0800.tar.bz2 | |
142 | -rw-r--r-- 1 rcdev rcdev 109M Feb 8 13:35 locale-archive |
|
142 | -rw-r--r-- 1 rcdev rcdev 109M Feb 8 13:35 locale-archive | |
143 | ``` |
|
143 | ``` | |
144 |
|
144 | |||
145 |
|
145 | |||
146 | 3) Create the build |
|
146 | 3) Create the build | |
147 |
|
147 | |||
148 | ./rcstack build-installer |
|
148 | ./rcstack build-installer | |
149 |
|
149 | |||
150 | # Standalone cluster build from source code |
|
150 | # Standalone cluster build from source code | |
151 |
|
151 | |||
152 | There's an option to build the latest release from the source code as a docker installation. |
|
152 | There's an option to build the latest release from the source code as a docker installation. | |
153 | If you;d like to build your own custom image based on the source code here's a quick how to.: |
|
153 | If you;d like to build your own custom image based on the source code here's a quick how to.: | |
154 | Follow these steps to build and run the RhodeCode Cluster via Docker-compose. |
|
154 | Follow these steps to build and run the RhodeCode Cluster via Docker-compose. | |
155 |
|
155 | |||
156 | 1) Run init to setup needed docker env and files: |
|
156 | 1) Run init to setup needed docker env and files: | |
157 |
|
157 | |||
158 | ./rcstack init |
|
158 | ./rcstack init | |
159 |
|
159 | |||
160 | 2) Run artifacts fetch like installer and certain needed build binaries: |
|
160 | 2) Run artifacts fetch like installer and certain needed build binaries: | |
161 |
|
161 | |||
162 | Start by fetching required installer binaries. |
|
162 | Start by fetching required installer binaries. | |
163 | Only local-archive is required to be present, installer is disregarded for source build |
|
163 | Only local-archive is required to be present, installer is disregarded for source build | |
164 |
|
164 | |||
165 | ``` |
|
165 | ``` | |
166 | ./rcstack get-build-artifacts |
|
166 | ./rcstack get-build-artifacts | |
167 | ``` |
|
167 | ``` | |
168 |
|
168 | |||
169 | This will download required installer files and put them into the `.cache` directory. |
|
169 | This will download required installer files and put them into the `.cache` directory. | |
170 | This directory should look similar to that after downloads have finish: |
|
170 | This directory should look similar to that after downloads have finish: | |
171 |
|
171 | |||
172 | ``` |
|
172 | ``` | |
173 | drwxr-xr-x 8 rcdev rcdev 256B Feb 8 13:35 . |
|
173 | drwxr-xr-x 8 rcdev rcdev 256B Feb 8 13:35 . | |
174 | drwxr-xr-x 14 rcdev rcdev 448B Feb 8 10:40 .. |
|
174 | drwxr-xr-x 14 rcdev rcdev 448B Feb 8 10:40 .. | |
175 | -rw-r--r-- 1 rcdev rcdev 0B Feb 8 20:44 .dirkeep |
|
175 | -rw-r--r-- 1 rcdev rcdev 0B Feb 8 20:44 .dirkeep | |
176 | -rwxr-xr-x 1 rcdev rcdev 241M Feb 8 13:35 RhodeCode-installer-linux-build20210208_0800 |
|
176 | -rwxr-xr-x 1 rcdev rcdev 241M Feb 8 13:35 RhodeCode-installer-linux-build20210208_0800 | |
177 | -rw-r--r-- 1 rcdev rcdev 156M Feb 8 13:35 RhodeCodeCommunity-4.24.1+x86_64-linux_build20210208_0800.tar.bz2 |
|
177 | -rw-r--r-- 1 rcdev rcdev 156M Feb 8 13:35 RhodeCodeCommunity-4.24.1+x86_64-linux_build20210208_0800.tar.bz2 | |
178 | -rw-r--r-- 1 rcdev rcdev 171M Feb 8 13:35 RhodeCodeEnterprise-4.24.1+x86_64-linux_build20210208_0800.tar.bz2 |
|
178 | -rw-r--r-- 1 rcdev rcdev 171M Feb 8 13:35 RhodeCodeEnterprise-4.24.1+x86_64-linux_build20210208_0800.tar.bz2 | |
179 | -rw-r--r-- 1 rcdev rcdev 145M Feb 8 13:35 RhodeCodeVCSServer-4.24.1+x86_64-linux_build20210208_0800.tar.bz2 |
|
179 | -rw-r--r-- 1 rcdev rcdev 145M Feb 8 13:35 RhodeCodeVCSServer-4.24.1+x86_64-linux_build20210208_0800.tar.bz2 | |
180 | -rw-r--r-- 1 rcdev rcdev 109M Feb 8 13:35 locale-archive |
|
180 | -rw-r--r-- 1 rcdev rcdev 109M Feb 8 13:35 locale-archive | |
181 | ``` |
|
181 | ``` | |
182 |
|
182 | |||
183 | 3) get source code needed to create a build |
|
183 | 3) get source code needed to create a build | |
184 |
|
184 | |||
185 | This step will create source code copies into the `.source/` path. So it will look like this: |
|
185 | This step will create source code copies into the `.source/` path. So it will look like this: | |
186 |
|
186 | |||
187 | ``` |
|
187 | ``` | |
188 | -rw-r--r-- 1 docker docker 0 Nov 25 12:27 .dirkeep |
|
188 | -rw-r--r-- 1 docker docker 0 Nov 25 12:27 .dirkeep | |
189 | drwxr-xr-x 1 docker docker 1184 Nov 25 12:27 rhodecode-enterprise-ce |
|
189 | drwxr-xr-x 1 docker docker 1184 Nov 25 12:27 rhodecode-enterprise-ce | |
190 | drwxr-xr-x 1 docker docker 1120 Nov 25 12:27 rhodecode-enterprise-ee |
|
190 | drwxr-xr-x 1 docker docker 1120 Nov 25 12:27 rhodecode-enterprise-ee | |
191 | drwxr-xr-x 1 docker docker 800 Nov 25 12:27 rhodecode-vcsserver |
|
191 | drwxr-xr-x 1 docker docker 800 Nov 25 12:27 rhodecode-vcsserver | |
192 | ``` |
|
192 | ``` | |
193 |
|
193 | |||
194 | If you have the 3 required projects source code already, this step can be omitted, and the |
|
194 | If you have the 3 required projects source code already, this step can be omitted, and the | |
195 | sources can be copied to the `.source/` directory. note: symlinks don't work. |
|
195 | sources can be copied to the `.source/` directory. note: symlinks don't work. | |
196 |
|
196 | |||
197 | - https://code.rhodecode.com/rhodecode-vcsserver |
|
197 | - https://code.rhodecode.com/rhodecode-vcsserver | |
198 | - https://code.rhodecode.com/rhodecode-enterprise-ce |
|
198 | - https://code.rhodecode.com/rhodecode-enterprise-ce | |
199 | - https://code.rhodecode.com/rhodecode-enterprise-ee (assuming access is granted to this) |
|
199 | - https://code.rhodecode.com/rhodecode-enterprise-ee (assuming access is granted to this) | |
200 |
|
200 | |||
201 | Run this to fetch the sources |
|
201 | Run this to fetch the sources | |
202 |
|
202 | |||
203 | ``` |
|
203 | ``` | |
204 | ./rcstack get-build-source --revision=default --auth-token=xxxx --server-url=https://code.rhodecode.com/sources |
|
204 | ./rcstack get-build-source --revision=default --auth-token=xxxx --server-url=https://code.rhodecode.com/sources | |
205 | ``` |
|
205 | ``` | |
206 |
|
206 | |||
207 |
|
207 | |||
208 | 4) Create the build |
|
208 | 4) Create the build | |
209 |
|
209 | |||
210 | ``` |
|
210 | ``` | |
211 | ./rcstack build-source --version-name 4.28.0.REL.2022.12.12 |
|
211 | ./rcstack build-source --version-name 4.28.0.REL.2022.12.12 | |
212 | ``` |
|
212 | ``` | |
213 |
|
213 | |||
214 | # Operation |
|
214 | # Operation | |
215 |
|
215 | |||
216 | ## Data structure |
|
216 | ## Data structure | |
217 |
|
217 | |||
218 | There are 4 volumes defined: |
|
218 | There are 4 volumes defined: | |
219 |
|
219 | |||
220 |
|
220 | |||
221 | - `/etc/rhodecode/conf` |
|
221 | - `/etc/rhodecode/conf` | |
222 |
|
222 | |||
223 | Shared volume used for configuration files for rhodecode, vcsserver and supervisord, and some cache data |
|
223 | Shared volume used for configuration files for rhodecode, vcsserver and supervisord, and some cache data | |
224 |
|
224 | |||
225 | - `/var/opt/rhodecode_repo_store` |
|
225 | - `/var/opt/rhodecode_repo_store` | |
226 |
|
226 | |||
227 | Used for main repository storage where repositories would be stored |
|
227 | Used for main repository storage where repositories would be stored | |
228 |
|
228 | |||
229 | - `/var/opt/rhodecode_data` |
|
229 | - `/var/opt/rhodecode_data` | |
230 |
|
230 | |||
231 | Data dir for rhodecode cache/lock files, or user sessions (for file backend) |
|
231 | Data dir for rhodecode cache/lock files, or user sessions (for file backend) | |
232 |
|
232 | |||
233 |
|
233 | |||
234 | ## Set License for EE version |
|
234 | ## Set License for EE version | |
235 |
|
235 | |||
236 | In order to install EE edition a license file is required to be present. |
|
236 | In order to install EE edition a license file is required to be present. | |
237 | It can contain your current license, or when empty license can be applied via Web interface. |
|
237 | It can contain your current license, or when empty license can be applied via Web interface. | |
238 |
|
238 | |||
239 | To apply it during build phase save your raw license data into a file |
|
239 | To apply it during build phase save your raw license data into a file | |
240 |
|
240 | |||
241 | `config/rhodecode_enterprise.license` |
|
241 | `config/rhodecode_enterprise.license` | |
242 |
|
242 | |||
243 | If this file is present build phase will read it and license will be applied at creation. |
|
243 | If this file is present build phase will read it and license will be applied at creation. | |
244 | This file can also be empty and license can be applied via a WEB interface after first login. |
|
244 | This file can also be empty and license can be applied via a WEB interface after first login. | |
245 |
|
245 | |||
246 | ## Run Docker compose build: |
|
246 | ## Run Docker compose build: | |
247 |
|
247 | |||
248 | *This will build RhodeCode based on downloaded installer packages.* |
|
248 | *This will build RhodeCode based on downloaded installer packages.* | |
249 |
|
249 | |||
250 | To create a full stack we need to run the database container, so it's ready to |
|
250 | To create a full stack we need to run the database container, so it's ready to | |
251 | build the docker image. |
|
251 | build the docker image. | |
252 |
|
252 | |||
253 | _Disk space problems?_ |
|
253 | _Disk space problems?_ | |
254 |
|
254 | |||
255 | ``` |
|
255 | ``` | |
256 | docker system df |
|
256 | docker system df | |
257 | docker builder prune -f |
|
257 | docker builder prune -f | |
258 | # optionally |
|
258 | # optionally | |
259 | docker image prune -a |
|
259 | docker image prune -a | |
260 | ``` |
|
260 | ``` | |
261 |
|
261 | |||
262 | ### Creating & building images |
|
262 | ### Creating & building images | |
263 |
|
263 | |||
264 | 1) start with running the required database for the build stage in the background. |
|
264 | 1) start with running the required database for the build stage in the background. | |
265 |
|
265 | |||
266 | ``` |
|
266 | ``` | |
267 | docker-compose up --detach database |
|
267 | docker-compose up --detach database | |
268 | ``` |
|
268 | ``` | |
269 |
|
269 | |||
270 | This will start our postgres database, and expose it to the network. |
|
270 | This will start our postgres database, and expose it to the network. | |
271 | Postgres DB is configured to output logs into a stdout |
|
271 | Postgres DB is configured to output logs into a stdout | |
272 |
|
272 | |||
273 | 2) We can now run the full installation. Database needs to be running for the next build command. |
|
273 | 2) We can now run the full installation. Database needs to be running for the next build command. | |
274 | This will build the rhodecode base image used for rhodecode, vcsserver, celery, ssh, svn |
|
274 | This will build the rhodecode base image used for rhodecode, vcsserver, celery, ssh, svn | |
275 | Then it will build all other components required. |
|
275 | Then it will build all other components required. | |
276 |
|
276 | |||
277 | ``` |
|
277 | ``` | |
278 | docker-compose build rhodecode |
|
278 | docker-compose build rhodecode | |
279 | docker-compose build |
|
279 | docker-compose build | |
280 | ``` |
|
280 | ``` | |
281 |
|
281 | |||
282 | 4) Once we build all required containers, we can run the whole stack using `docker-compose up` |
|
282 | 4) Once we build all required containers, we can run the whole stack using `docker-compose up` | |
283 |
|
283 | |||
284 | ``` |
|
284 | ``` | |
285 | docker-compose up |
|
285 | docker-compose up | |
286 | ``` |
|
286 | ``` | |
287 |
|
287 | |||
288 | If running locally you can access Running RhodeCode via Nginx under: |
|
288 | If running locally you can access Running RhodeCode via Nginx under: | |
289 | http://localhost:8888 |
|
289 | http://localhost:8888 | |
290 |
|
290 | |||
291 | localhost can be changed to the server IP where docker is running. |
|
291 | localhost can be changed to the server IP where docker is running. | |
292 |
|
292 | |||
293 |
|
293 | |||
294 | In case for bigger setups docker-compose can scale more rhodecode/vcsserver workers: |
|
294 | In case for bigger setups docker-compose can scale more rhodecode/vcsserver workers: | |
295 |
|
295 | |||
296 | ``` |
|
296 | ``` | |
297 | docker-compose up --scale vcsserver=3 rhodecode=3 |
|
297 | docker-compose up --scale vcsserver=3 rhodecode=3 | |
298 | ``` |
|
298 | ``` | |
299 |
|
299 | |||
300 | Logging is pushed to stdout from all services. |
|
300 | Logging is pushed to stdout from all services. | |
301 |
|
301 | |||
302 |
|
302 | |||
303 | ### Upgrade procedure: |
|
303 | ### Upgrade procedure: | |
304 |
|
304 | |||
305 | - run ./rcstack self-update |
|
305 | - run ./rcstack self-update | |
306 | - run ./rcstack stack-upgrade to get upgrade instructions |
|
306 | - run ./rcstack stack-upgrade to get upgrade instructions | |
307 |
|
307 | |||
308 |
|
308 | |||
309 | With this done, you can now proceed with every step of normal source installation (Creating & building images), but instead of using |
|
309 | With this done, you can now proceed with every step of normal source installation (Creating & building images), but instead of using | |
310 | just `docker-compose` command it needs to be replaced with `docker-compose -f docker-compose.yaml -f docker-compose.source.yaml` |
|
310 | just `docker-compose` command it needs to be replaced with `docker-compose -f docker-compose.yaml -f docker-compose.source.yaml` | |
311 |
|
311 | |||
312 | For example to override the installer build with the source `rhodecode` based image, and also setting proper version, run: |
|
312 | For example to override the installer build with the source `rhodecode` based image, and also setting proper version, run: | |
313 |
|
313 | |||
314 | ``` |
|
314 | ``` | |
315 | RC_VERSION="4.28.0.SRC.2022.12.12.1" docker-compose -f docker-compose-apps.yaml -f docker-compose.source.yaml build --no-cache --progress=plain rhodecode |
|
315 | RC_VERSION="4.28.0.SRC.2022.12.12.1" docker-compose -f docker-compose-apps.yaml -f docker-compose.source.yaml build --no-cache --progress=plain rhodecode | |
316 | ``` |
|
316 | ``` | |
317 |
|
317 | |||
318 | NOTE THAT it's recommended to keep rc_version and source_Ver the same |
|
318 | NOTE THAT it's recommended to keep rc_version and source_Ver the same | |
319 |
|
319 | |||
320 | ## Simple community build |
|
320 | ## Simple community build | |
321 |
|
321 | |||
322 | Build docker RhodeCode `Community` without any dependencies (redis, external db) using |
|
322 | Build docker RhodeCode `Community` without any dependencies (redis, external db) using | |
323 | simple sqlite database and file based caches. |
|
323 | simple sqlite database and file based caches. | |
324 | This is a fully running instance good for small use with 3-5 users. |
|
324 | This is a fully running instance good for small use with 3-5 users. | |
325 |
|
325 | |||
326 | ``` |
|
326 | ``` | |
327 | docker build -t rhodecode/rhodecode-ce:4.23.2 -f rhodecode.dockerfile \ |
|
327 | docker build -t rhodecode/rhodecode-ce:4.23.2 -f rhodecode.dockerfile \ | |
328 | -e RHODECODE_TYPE=Community \ |
|
328 | -e RHODECODE_TYPE=Community \ | |
329 | -e RHODECODE_VERSION=4.23.2 \ |
|
329 | -e RHODECODE_VERSION=4.23.2 \ | |
330 | -e RHODECODE_DB=sqlite \ |
|
330 | -e RHODECODE_DB=sqlite \ | |
331 | -e RHODECODE_USER_NAME=admin \ |
|
331 | -e RHODECODE_USER_NAME=admin \ | |
332 | -e RHODECODE_USER_PASS=secret4 \ |
|
332 | -e RHODECODE_USER_PASS=secret4 \ | |
333 | -e RHODECODE_USER_EMAIL=support@rhodecode.com \ |
|
333 | -e RHODECODE_USER_EMAIL=support@rhodecode.com \ | |
334 | . |
|
334 | . | |
335 | ``` |
|
335 | ``` | |
336 |
|
336 | |||
337 | note: for debugging better to add `--progress plain` into the build command to obtain all the output from the build. |
|
337 | note: for debugging better to add `--progress plain` into the build command to obtain all the output from the build. | |
338 | To Build against existing running Postgres or MySQL you can specify: |
|
338 | To Build against existing running Postgres or MySQL you can specify: | |
339 |
|
339 | |||
340 | --build-arg RHODECODE_DB=postgresql://postgres:secret@database/rhodecode |
|
340 | --build-arg RHODECODE_DB=postgresql://postgres:secret@database/rhodecode | |
341 | --build-arg RHODECODE_DB=mysql://root:secret@localhost/rhodecode?charset=utf8 |
|
341 | --build-arg RHODECODE_DB=mysql://root:secret@localhost/rhodecode?charset=utf8 | |
342 |
|
342 | |||
343 |
|
343 | |||
344 | To copy over the data into volumes use such command: |
|
344 | To copy over the data into volumes use such command: | |
345 | ``` |
|
345 | ``` | |
346 | docker run -v logvolume:/data --name data_vol busybox true |
|
346 | docker run -v logvolume:/data --name data_vol busybox true | |
347 | docker cp . data_vol:/data |
|
347 | docker cp . data_vol:/data | |
348 | docker rm data_vol |
|
348 | docker rm data_vol | |
349 | ``` |
|
349 | ``` | |
350 |
|
350 | |||
351 | Run the container, mounting the required volumes. By default the application would be |
|
351 | Run the container, mounting the required volumes. By default the application would be | |
352 | available at http://localhost:10020, and default login is (unless specified differently in the build command) |
|
352 | available at http://localhost:10020, and default login is (unless specified differently in the build command) | |
353 |
|
353 | |||
354 | ``` |
|
354 | ``` | |
355 | user: admin |
|
355 | user: admin | |
356 | password: secret4 |
|
356 | password: secret4 | |
357 | ``` |
|
357 | ``` | |
358 |
|
358 | |||
359 | We've not built our image using specific version. It's time to run it: |
|
359 | We've not built our image using specific version. It's time to run it: | |
360 | We specify the run.ini by selecting config option we have locally |
|
360 | We specify the run.ini by selecting config option we have locally | |
361 |
|
361 | |||
362 | ``` |
|
362 | ``` | |
363 | docker run \ |
|
363 | docker run \ | |
364 | --name rhodecode-container \ |
|
364 | --name rhodecode-container \ | |
365 | --publish 10020:10020 \ |
|
365 | --publish 10020:10020 \ | |
366 | --restart unless-stopped \ |
|
366 | --restart unless-stopped \ | |
367 | --volume $PWD/config:/etc/rhodecode/conf \ |
|
367 | --volume $PWD/config:/etc/rhodecode/conf \ | |
368 | --volume $PWD/config/rhodecode.ini:/etc/rhodecode/conf_build/rhodecode.ini \ |
|
368 | --volume $PWD/config/rhodecode.ini:/etc/rhodecode/conf_build/rhodecode.ini \ | |
369 | 'rhodecode/rhodecode-ee:4.23.2' |
|
369 | 'rhodecode/rhodecode-ee:4.23.2' | |
370 | ``` |
|
370 | ``` | |
371 |
|
371 | |||
372 | Enter container |
|
372 | Enter container | |
373 |
|
373 | |||
374 | ``` |
|
374 | ``` | |
375 | docker exec -it rhodecode-container /bin/bash |
|
375 | docker exec -it rhodecode-container /bin/bash | |
376 | ``` |
|
376 | ``` | |
377 |
|
377 | |||
378 | Enter interactive shell |
|
378 | Enter interactive shell | |
379 |
|
379 | |||
380 | ``` |
|
380 | ``` | |
381 | docker exec -it rhodecode-container /usr/local/bin/rhodecode_bin/bin/rc-ishell /etc/rhodecode/conf/rhodecode.ini |
|
381 | docker exec -it rhodecode-container /usr/local/bin/rhodecode_bin/bin/rc-ishell /etc/rhodecode/conf/rhodecode.ini | |
382 | ``` |
|
382 | ``` | |
383 |
|
383 | |||
384 | Run Database migrations |
|
384 | Run Database migrations | |
385 | ``` |
|
385 | ``` | |
386 | docker exec -it rhodecode-container /usr/local/bin/rhodecode_bin/bin/rc-upgrade-db /etc/rhodecode/conf/rhodecode.ini --force-yes |
|
386 | docker exec -it rhodecode-container /usr/local/bin/rhodecode_bin/bin/rc-upgrade-db /etc/rhodecode/conf/rhodecode.ini --force-yes | |
387 | ``` |
|
387 | ``` | |
388 |
|
388 | |||
389 |
|
389 | |||
390 |
|
390 | |||
391 | ### Registry for docker swarm |
|
391 | ### Registry for docker swarm | |
392 |
|
392 | |||
393 | docker run -d -p 5000:5000 --restart always --name registry registry:2 No newline at end of file |
|
393 | docker run -d -p 5000:5000 --restart always --name registry registry:2 |
@@ -1,5699 +1,5710 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 - CLI for installing and managing RhodeCode Cluster Stack\n" |
|
23 | printf "rcstack - CLI for installing and managing RhodeCode Cluster Stack\n" | |
24 | echo |
|
24 | echo | |
25 |
|
25 | |||
26 | else |
|
26 | else | |
27 | printf "rcstack - CLI for installing and managing RhodeCode Cluster Stack\n" |
|
27 | printf "rcstack - CLI for installing and managing RhodeCode Cluster Stack\n" | |
28 | echo |
|
28 | echo | |
29 |
|
29 | |||
30 | fi |
|
30 | fi | |
31 |
|
31 | |||
32 | printf "%s\n" "Usage:" |
|
32 | printf "%s\n" "Usage:" | |
33 | printf " rcstack [OPTIONS] COMMAND\n" |
|
33 | printf " rcstack [OPTIONS] COMMAND\n" | |
34 | printf " rcstack [COMMAND] --help | -h\n" |
|
34 | printf " rcstack [COMMAND] --help | -h\n" | |
35 | printf " rcstack --version | -v\n" |
|
35 | printf " rcstack --version | -v\n" | |
36 | echo |
|
36 | echo | |
37 | # :command.usage_commands |
|
37 | # :command.usage_commands | |
38 | printf "%s\n" "Commands:" |
|
38 | printf "%s\n" "Commands:" | |
39 | printf " %s Print instructions to get started with rhodecode docker stack\n" "get-started " |
|
39 | printf " %s Print instructions to get started with rhodecode docker stack\n" "get-started " | |
40 | printf " %s Bootstrap this machine, check docker version and install rhodecode-network\n" "init " |
|
40 | printf " %s Bootstrap this machine, check docker version and install rhodecode-network\n" "init " | |
41 | printf " %s Update rcstack and it's docker definitions\n" "self-update " |
|
41 | printf " %s Update rcstack and it's docker definitions\n" "self-update " | |
42 | echo |
|
42 | echo | |
43 | printf "%s\n" "Stack Commands:" |
|
43 | printf "%s\n" "Stack Commands:" | |
44 | printf " %s Run one of available cluster stacks, run stack -h for more details\n" "stack " |
|
44 | printf " %s Run one of available cluster stacks, run stack -h for more details\n" "stack " | |
45 | printf " %s Show stack status\n" "stack-status " |
|
45 | printf " %s Show stack status\n" "stack-status " | |
46 | printf " %s Upgrade a stack, run stack-upgrade -h for more details\n" "stack-upgrade " |
|
46 | printf " %s Upgrade a stack, run stack-upgrade -h for more details\n" "stack-upgrade " | |
47 | echo |
|
47 | echo | |
48 | printf "%s\n" "CLI Commands:" |
|
48 | printf "%s\n" "CLI Commands:" | |
49 | printf " %s Various CLI tools, run cli -h for more details\n" "cli " |
|
49 | printf " %s Various CLI tools, run cli -h for more details\n" "cli " | |
50 | echo |
|
50 | echo | |
51 | printf "%s\n" "Backup Commands:" |
|
51 | printf "%s\n" "Backup Commands:" | |
52 | printf " %s Backup Database\n" "backup-db " |
|
52 | printf " %s Backup Database\n" "backup-db " | |
53 | printf " %s Backup RhodeCode storage\n" "backup-data " |
|
53 | printf " %s Backup RhodeCode storage\n" "backup-data " | |
54 | echo |
|
54 | echo | |
55 | printf "%s\n" "Build Commands:" |
|
55 | printf "%s\n" "Build Commands:" | |
56 | printf " %s Fetch Artifacts to run installer based build\n" "get-build-artifacts" |
|
56 | printf " %s Fetch Artifacts to run installer based build\n" "get-build-artifacts" | |
57 | printf " %s Build RhodeCode image from installer, ./rcstack get-build-artifacts initially\n" "build-installer " |
|
57 | printf " %s Build RhodeCode image from installer, ./rcstack get-build-artifacts initially\n" "build-installer " | |
58 | printf " %s Fetch RhodeCode sources, store in .source dir to run a source-based builds\n" "get-build-source " |
|
58 | printf " %s Fetch RhodeCode sources, store in .source dir to run a source-based builds\n" "get-build-source " | |
59 | printf " %s Build RhodeCode image from source, requires ./rcstack get-build-source initially\n" "build-source " |
|
59 | printf " %s Build RhodeCode image from source, requires ./rcstack get-build-source initially\n" "build-source " | |
60 | echo |
|
60 | echo | |
61 |
|
61 | |||
62 | # :command.long_usage |
|
62 | # :command.long_usage | |
63 | if [[ -n $long_usage ]]; then |
|
63 | if [[ -n $long_usage ]]; then | |
64 | printf "%s\n" "Options:" |
|
64 | printf "%s\n" "Options:" | |
65 |
|
65 | |||
66 | # :command.usage_fixed_flags |
|
66 | # :command.usage_fixed_flags | |
67 | printf " %s\n" "--help, -h" |
|
67 | printf " %s\n" "--help, -h" | |
68 | printf " Show this help\n" |
|
68 | printf " Show this help\n" | |
69 | echo |
|
69 | echo | |
70 | printf " %s\n" "--version, -v" |
|
70 | printf " %s\n" "--version, -v" | |
71 | printf " Show version number\n" |
|
71 | printf " Show version number\n" | |
72 | echo |
|
72 | echo | |
73 |
|
73 | |||
74 | # :command.usage_flags |
|
74 | # :command.usage_flags | |
75 | # :flag.usage |
|
75 | # :flag.usage | |
76 | printf " %s\n" "--debug" |
|
76 | printf " %s\n" "--debug" | |
77 | printf " Enable debug and detailed output\n" |
|
77 | printf " Enable debug and detailed output\n" | |
78 | echo |
|
78 | echo | |
79 |
|
79 | |||
80 | # :flag.usage |
|
80 | # :flag.usage | |
81 | printf " %s\n" "--no-init-check" |
|
81 | printf " %s\n" "--no-init-check" | |
82 | printf " Skip check for ./rcstack init call\n" |
|
82 | printf " Skip check for ./rcstack init call\n" | |
83 | echo |
|
83 | echo | |
84 |
|
84 | |||
85 | # :command.usage_environment_variables |
|
85 | # :command.usage_environment_variables | |
86 | printf "%s\n" "Environment Variables:" |
|
86 | printf "%s\n" "Environment Variables:" | |
87 |
|
87 | |||
88 | # :environment_variable.usage |
|
88 | # :environment_variable.usage | |
89 | printf " %s\n" "RCC_CONFIG" |
|
89 | printf " %s\n" "RCC_CONFIG" | |
90 | printf " default config file for rcstack\n" |
|
90 | printf " default config file for rcstack\n" | |
91 | printf " Default: .rcstack.ini\n" |
|
91 | printf " Default: .rcstack.ini\n" | |
92 | echo |
|
92 | echo | |
93 |
|
93 | |||
94 | # :environment_variable.usage |
|
94 | # :environment_variable.usage | |
95 | printf " %s\n" "AUTH_TOKEN" |
|
95 | printf " %s\n" "AUTH_TOKEN" | |
96 | printf " Set your RhodeCode AUTH Token\n" |
|
96 | printf " Set your RhodeCode AUTH Token\n" | |
97 | echo |
|
97 | echo | |
98 |
|
98 | |||
99 | # :environment_variable.usage |
|
99 | # :environment_variable.usage | |
100 | printf " %s\n" "RC_STACK_ROUTER_EXT" |
|
100 | printf " %s\n" "RC_STACK_ROUTER_EXT" | |
101 | printf "\n" |
|
101 | printf "\n" | |
102 | printf " Default: .custom/docker-compose-router.override.yaml\n" |
|
102 | printf " Default: .custom/docker-compose-router.override.yaml\n" | |
103 | echo |
|
103 | echo | |
104 |
|
104 | |||
105 | # :environment_variable.usage |
|
105 | # :environment_variable.usage | |
106 | printf " %s\n" "RC_STACK_METRICS_EXT" |
|
106 | printf " %s\n" "RC_STACK_METRICS_EXT" | |
107 | printf "\n" |
|
107 | printf "\n" | |
108 | printf " Default: .custom/docker-compose-metrics.override.yaml\n" |
|
108 | printf " Default: .custom/docker-compose-metrics.override.yaml\n" | |
109 | echo |
|
109 | echo | |
110 |
|
110 | |||
111 | # :environment_variable.usage |
|
111 | # :environment_variable.usage | |
112 | printf " %s\n" "RC_STACK_SERVICES_EXT" |
|
112 | printf " %s\n" "RC_STACK_SERVICES_EXT" | |
113 | printf "\n" |
|
113 | printf "\n" | |
114 | printf " Default: .custom/docker-compose-services.override.yaml\n" |
|
114 | printf " Default: .custom/docker-compose-services.override.yaml\n" | |
115 | echo |
|
115 | echo | |
116 |
|
116 | |||
117 | # :environment_variable.usage |
|
117 | # :environment_variable.usage | |
118 | printf " %s\n" "RC_STACK_RHODECODE_EXT" |
|
118 | printf " %s\n" "RC_STACK_RHODECODE_EXT" | |
119 | printf "\n" |
|
119 | printf "\n" | |
120 | printf " Default: .custom/docker-compose-apps.override.yaml\n" |
|
120 | printf " Default: .custom/docker-compose-apps.override.yaml\n" | |
121 | echo |
|
121 | echo | |
122 |
|
122 | |||
123 | # :command.footer |
|
123 | # :command.footer | |
124 | printf "RhodeCode Inc 2023\n\n" |
|
124 | printf "RhodeCode Inc 2023\n\n" | |
125 | echo |
|
125 | echo | |
126 |
|
126 | |||
127 | fi |
|
127 | fi | |
128 | } |
|
128 | } | |
129 |
|
129 | |||
130 | # :command.usage |
|
130 | # :command.usage | |
131 | rcstack_get_started_usage() { |
|
131 | rcstack_get_started_usage() { | |
132 | if [[ -n $long_usage ]]; then |
|
132 | if [[ -n $long_usage ]]; then | |
133 | printf "rcstack get-started - Print instructions to get started with rhodecode docker stack\n" |
|
133 | printf "rcstack get-started - Print instructions to get started with rhodecode docker stack\n" | |
134 | echo |
|
134 | echo | |
135 |
|
135 | |||
136 | else |
|
136 | else | |
137 | printf "rcstack get-started - Print instructions to get started with rhodecode docker stack\n" |
|
137 | printf "rcstack get-started - Print instructions to get started with rhodecode docker stack\n" | |
138 | echo |
|
138 | echo | |
139 |
|
139 | |||
140 | fi |
|
140 | fi | |
141 |
|
141 | |||
142 | printf "%s\n" "Usage:" |
|
142 | printf "%s\n" "Usage:" | |
143 | printf " rcstack get-started\n" |
|
143 | printf " rcstack get-started\n" | |
144 | printf " rcstack get-started --help | -h\n" |
|
144 | printf " rcstack get-started --help | -h\n" | |
145 | echo |
|
145 | echo | |
146 |
|
146 | |||
147 | # :command.long_usage |
|
147 | # :command.long_usage | |
148 | if [[ -n $long_usage ]]; then |
|
148 | if [[ -n $long_usage ]]; then | |
149 | printf "%s\n" "Options:" |
|
149 | printf "%s\n" "Options:" | |
150 |
|
150 | |||
151 | # :command.usage_fixed_flags |
|
151 | # :command.usage_fixed_flags | |
152 | printf " %s\n" "--help, -h" |
|
152 | printf " %s\n" "--help, -h" | |
153 | printf " Show this help\n" |
|
153 | printf " Show this help\n" | |
154 | echo |
|
154 | echo | |
155 |
|
155 | |||
156 | fi |
|
156 | fi | |
157 | } |
|
157 | } | |
158 |
|
158 | |||
159 | # :command.usage |
|
159 | # :command.usage | |
160 | rcstack_init_usage() { |
|
160 | rcstack_init_usage() { | |
161 | if [[ -n $long_usage ]]; then |
|
161 | if [[ -n $long_usage ]]; then | |
162 | printf "rcstack init - Bootstrap this machine, check docker version and install rhodecode-network\n" |
|
162 | printf "rcstack init - Bootstrap this machine, check docker version and install rhodecode-network\n" | |
163 | echo |
|
163 | echo | |
164 |
|
164 | |||
165 | else |
|
165 | else | |
166 | printf "rcstack init - Bootstrap this machine, check docker version and install rhodecode-network\n" |
|
166 | printf "rcstack init - Bootstrap this machine, check docker version and install rhodecode-network\n" | |
167 | echo |
|
167 | echo | |
168 |
|
168 | |||
169 | fi |
|
169 | fi | |
170 |
|
170 | |||
171 | printf "%s\n" "Usage:" |
|
171 | printf "%s\n" "Usage:" | |
172 | printf " rcstack init [OPTIONS]\n" |
|
172 | printf " rcstack init [OPTIONS]\n" | |
173 | printf " rcstack init --help | -h\n" |
|
173 | printf " rcstack init --help | -h\n" | |
174 | echo |
|
174 | echo | |
175 |
|
175 | |||
176 | # :command.long_usage |
|
176 | # :command.long_usage | |
177 | if [[ -n $long_usage ]]; then |
|
177 | if [[ -n $long_usage ]]; then | |
178 | printf "%s\n" "Options:" |
|
178 | printf "%s\n" "Options:" | |
179 |
|
179 | |||
180 | # :command.usage_fixed_flags |
|
180 | # :command.usage_fixed_flags | |
181 | printf " %s\n" "--help, -h" |
|
181 | printf " %s\n" "--help, -h" | |
182 | printf " Show this help\n" |
|
182 | printf " Show this help\n" | |
183 | echo |
|
183 | echo | |
184 |
|
184 | |||
185 | # :command.usage_flags |
|
185 | # :command.usage_flags | |
186 | # :flag.usage |
|
186 | # :flag.usage | |
187 | printf " %s\n" "--force, -f" |
|
187 | printf " %s\n" "--force, -f" | |
188 | printf " Overwrite existing files\n" |
|
188 | printf " Overwrite existing files\n" | |
189 | echo |
|
189 | echo | |
190 |
|
190 | |||
191 | # :flag.usage |
|
191 | # :flag.usage | |
192 | printf " %s\n" "--auth-token AUTH_TOKEN" |
|
192 | printf " %s\n" "--auth-token AUTH_TOKEN" | |
193 | printf " Optionally specify AUTH TOKEN to obtain sources\n" |
|
193 | printf " Optionally specify AUTH TOKEN to obtain sources\n" | |
194 | echo |
|
194 | echo | |
195 |
|
195 | |||
196 | # :flag.usage |
|
196 | # :flag.usage | |
197 | printf " %s\n" "--server-url SERVER_URL" |
|
197 | printf " %s\n" "--server-url SERVER_URL" | |
198 | printf " Specify RhodeCode server location where projects should be downloaded\n" |
|
198 | printf " Specify RhodeCode server location where projects should be downloaded\n" | |
199 | printf " Default: https://code.rhodecode.com\n" |
|
199 | printf " Default: https://code.rhodecode.com\n" | |
200 | echo |
|
200 | echo | |
201 |
|
201 | |||
202 | # :flag.usage |
|
202 | # :flag.usage | |
203 | printf " %s\n" "--revision REVISION" |
|
203 | printf " %s\n" "--revision REVISION" | |
204 | printf " revision to fetch new definitions.\n" |
|
204 | printf " revision to fetch new definitions.\n" | |
205 | printf " Default: master\n" |
|
205 | printf " Default: master\n" | |
206 | echo |
|
206 | echo | |
207 |
|
207 | |||
208 | # :flag.usage |
|
208 | # :flag.usage | |
209 | printf " %s\n" "--install-docker INSTALL_DOCKER" |
|
209 | printf " %s\n" "--install-docker INSTALL_DOCKER" | |
210 | printf " answer [y]es or [n]o to question to install docker\n" |
|
210 | printf " answer [y]es or [n]o to question to install docker\n" | |
211 | echo |
|
211 | echo | |
212 |
|
212 | |||
213 | # :command.usage_examples |
|
213 | # :command.usage_examples | |
214 | printf "%s\n" "Examples:" |
|
214 | printf "%s\n" "Examples:" | |
215 | 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" |
|
215 | 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" | |
216 | echo |
|
216 | echo | |
217 |
|
217 | |||
218 | fi |
|
218 | fi | |
219 | } |
|
219 | } | |
220 |
|
220 | |||
221 | # :command.usage |
|
221 | # :command.usage | |
222 | rcstack_self_update_usage() { |
|
222 | rcstack_self_update_usage() { | |
223 | if [[ -n $long_usage ]]; then |
|
223 | if [[ -n $long_usage ]]; then | |
224 | printf "rcstack self-update - Update rcstack and it's docker definitions\n" |
|
224 | printf "rcstack self-update - Update rcstack and it's docker definitions\n" | |
225 | echo |
|
225 | echo | |
226 |
|
226 | |||
227 | else |
|
227 | else | |
228 | printf "rcstack self-update - Update rcstack and it's docker definitions\n" |
|
228 | printf "rcstack self-update - Update rcstack and it's docker definitions\n" | |
229 | echo |
|
229 | echo | |
230 |
|
230 | |||
231 | fi |
|
231 | fi | |
232 |
|
232 | |||
233 | printf "%s\n" "Usage:" |
|
233 | printf "%s\n" "Usage:" | |
234 | printf " rcstack self-update [OPTIONS]\n" |
|
234 | printf " rcstack self-update [OPTIONS]\n" | |
235 | printf " rcstack self-update --help | -h\n" |
|
235 | printf " rcstack self-update --help | -h\n" | |
236 | echo |
|
236 | echo | |
237 |
|
237 | |||
238 | # :command.long_usage |
|
238 | # :command.long_usage | |
239 | if [[ -n $long_usage ]]; then |
|
239 | if [[ -n $long_usage ]]; then | |
240 | printf "%s\n" "Options:" |
|
240 | printf "%s\n" "Options:" | |
241 |
|
241 | |||
242 | # :command.usage_fixed_flags |
|
242 | # :command.usage_fixed_flags | |
243 | printf " %s\n" "--help, -h" |
|
243 | printf " %s\n" "--help, -h" | |
244 | printf " Show this help\n" |
|
244 | printf " Show this help\n" | |
245 | echo |
|
245 | echo | |
246 |
|
246 | |||
247 | # :command.usage_flags |
|
247 | # :command.usage_flags | |
248 | # :flag.usage |
|
248 | # :flag.usage | |
249 | printf " %s\n" "--installer-revision INSTALLER_REVISION" |
|
249 | printf " %s\n" "--installer-revision INSTALLER_REVISION" | |
250 | printf " revision to fetch new installer.\n" |
|
250 | printf " revision to fetch new installer.\n" | |
251 | printf " Default: master\n" |
|
251 | printf " Default: master\n" | |
252 | echo |
|
252 | echo | |
253 |
|
253 | |||
254 | # :flag.usage |
|
254 | # :flag.usage | |
255 | printf " %s\n" "--revision REVISION" |
|
255 | printf " %s\n" "--revision REVISION" | |
256 | printf " revision to fetch new docker definitions.\n" |
|
256 | printf " revision to fetch new docker definitions.\n" | |
257 | printf " Default: master\n" |
|
257 | printf " Default: master\n" | |
258 | echo |
|
258 | echo | |
259 |
|
259 | |||
260 | # :flag.usage |
|
260 | # :flag.usage | |
261 | printf " %s\n" "--auth-token AUTH_TOKEN" |
|
261 | printf " %s\n" "--auth-token AUTH_TOKEN" | |
262 | printf " Optionally specify AUTH TOKEN to obtain sources\n" |
|
262 | printf " Optionally specify AUTH TOKEN to obtain sources\n" | |
263 | echo |
|
263 | echo | |
264 |
|
264 | |||
265 | # :flag.usage |
|
265 | # :flag.usage | |
266 | printf " %s\n" "--server-url SERVER_URL" |
|
266 | printf " %s\n" "--server-url SERVER_URL" | |
267 | printf " Specify RhodeCode server location where projects should be downloaded\n" |
|
267 | printf " Specify RhodeCode server location where projects should be downloaded\n" | |
268 | printf " Default: https://code.rhodecode.com\n" |
|
268 | printf " Default: https://code.rhodecode.com\n" | |
269 | echo |
|
269 | echo | |
270 |
|
270 | |||
271 | # :command.usage_examples |
|
271 | # :command.usage_examples | |
272 | printf "%s\n" "Examples:" |
|
272 | printf "%s\n" "Examples:" | |
273 |
printf " - ./rccstack self-update simply to update it to a new version\n - ./rccstack self-update --installer-revision=dev --revision=dev |
|
273 | printf " - ./rccstack self-update simply to update it to a new version\n \n # to fetch dev branch and install it\n - ./rccstack self-update --installer-revision=dev --revision=dev\n \n # In case rcstack breaks, you can re-download the stack script using curl\n curl -L -s -o rcstack https://dls.rhodecode.com/get/master && chmod +x rcstack\n" | |
274 | echo |
|
274 | echo | |
275 |
|
275 | |||
276 | fi |
|
276 | fi | |
277 | } |
|
277 | } | |
278 |
|
278 | |||
279 | # :command.usage |
|
279 | # :command.usage | |
280 | rcstack_stack_usage() { |
|
280 | rcstack_stack_usage() { | |
281 | if [[ -n $long_usage ]]; then |
|
281 | if [[ -n $long_usage ]]; then | |
282 | printf "rcstack stack - Run one of available cluster stacks, run stack -h for more details\n" |
|
282 | printf "rcstack stack - Run one of available cluster stacks, run stack -h for more details\n" | |
283 | echo |
|
283 | echo | |
284 |
|
284 | |||
285 | else |
|
285 | else | |
286 | printf "rcstack stack - Run one of available cluster stacks, run stack -h for more details\n" |
|
286 | printf "rcstack stack - Run one of available cluster stacks, run stack -h for more details\n" | |
287 | echo |
|
287 | echo | |
288 |
|
288 | |||
289 | fi |
|
289 | fi | |
290 |
|
290 | |||
291 | printf "%s\n" "Usage:" |
|
291 | printf "%s\n" "Usage:" | |
292 | printf " rcstack stack [OPTIONS] COMMAND\n" |
|
292 | printf " rcstack stack [OPTIONS] COMMAND\n" | |
293 | printf " rcstack stack [COMMAND] --help | -h\n" |
|
293 | printf " rcstack stack [COMMAND] --help | -h\n" | |
294 | echo |
|
294 | echo | |
295 | # :command.usage_commands |
|
295 | # :command.usage_commands | |
296 | printf "%s\n" "Commands:" |
|
296 | printf "%s\n" "Commands:" | |
297 | printf " %s run the router stack\n" "router " |
|
297 | printf " %s run the router stack\n" "router " | |
298 | printf " %s run the router stack\n" "metrics " |
|
298 | printf " %s run the router stack\n" "metrics " | |
299 | printf " %s run the router stack\n" "services " |
|
299 | printf " %s run the router stack\n" "services " | |
300 | printf " %s run the router stack\n" "rhodecode" |
|
300 | printf " %s run the router stack\n" "rhodecode" | |
301 | printf " %s run all stacks\n" "all " |
|
301 | printf " %s run all stacks\n" "all " | |
302 | echo |
|
302 | echo | |
303 |
|
303 | |||
304 | # :command.long_usage |
|
304 | # :command.long_usage | |
305 | if [[ -n $long_usage ]]; then |
|
305 | if [[ -n $long_usage ]]; then | |
306 | printf "%s\n" "Options:" |
|
306 | printf "%s\n" "Options:" | |
307 |
|
307 | |||
308 | # :command.usage_fixed_flags |
|
308 | # :command.usage_fixed_flags | |
309 | printf " %s\n" "--help, -h" |
|
309 | printf " %s\n" "--help, -h" | |
310 | printf " Show this help\n" |
|
310 | printf " Show this help\n" | |
311 | echo |
|
311 | echo | |
312 |
|
312 | |||
313 | # :command.usage_flags |
|
313 | # :command.usage_flags | |
314 | # :flag.usage |
|
314 | # :flag.usage | |
315 | printf " %s\n" "--env-file-path ENV_FILE_PATH" |
|
315 | printf " %s\n" "--env-file-path ENV_FILE_PATH" | |
316 | printf " Set custom env file\n" |
|
316 | printf " Set custom env file\n" | |
317 | printf " Default: $PWD/.custom/.runtime.env\n" |
|
317 | printf " Default: $PWD/.custom/.runtime.env\n" | |
318 | echo |
|
318 | echo | |
319 |
|
319 | |||
320 | # :command.usage_examples |
|
320 | # :command.usage_examples | |
321 | printf "%s\n" "Examples:" |
|
321 | printf "%s\n" "Examples:" | |
322 | printf " # running stack\n - ./rcstack stack router up # run router stack with output to stdout\n - ./rcstack stack router up --detach # run router stack detached\n - ./rcstack stack router down # stop whole router stack\n - ./rcstack stack router ps # check status of router stack\n \n # logs, use logs -f to follow/tail --until 1h to limit for last time\n - ./rcstack stack services logs -f database\n \n # scale a single stack service[s] to more replicas (horizontally), use\n overrides files to permanently set scale\n - ./rcstack stack rhodecode up --detach --no-recreate --scale rhodecode=2\n --scale vcsserver=2\n \n # run router stack with your overrides compose file\n - ./rcstack stack router -f docker-overrides.yaml up -d\n" |
|
322 | printf " # running stack\n - ./rcstack stack router up # run router stack with output to stdout\n - ./rcstack stack router up --detach # run router stack detached\n - ./rcstack stack router down # stop whole router stack\n - ./rcstack stack router ps # check status of router stack\n \n # logs, use logs -f to follow/tail --until 1h to limit for last time\n - ./rcstack stack services logs -f database\n \n # scale a single stack service[s] to more replicas (horizontally), use\n overrides files to permanently set scale\n - ./rcstack stack rhodecode up --detach --no-recreate --scale rhodecode=2\n --scale vcsserver=2\n \n # run router stack with your overrides compose file\n - ./rcstack stack router -f docker-overrides.yaml up -d\n" | |
323 | echo |
|
323 | echo | |
324 |
|
324 | |||
325 | fi |
|
325 | fi | |
326 | } |
|
326 | } | |
327 |
|
327 | |||
328 | # :command.usage |
|
328 | # :command.usage | |
329 | rcstack_stack_router_usage() { |
|
329 | rcstack_stack_router_usage() { | |
330 | if [[ -n $long_usage ]]; then |
|
330 | if [[ -n $long_usage ]]; then | |
331 | printf "rcstack stack router - run the router stack\n" |
|
331 | printf "rcstack stack router - run the router stack\n" | |
332 | echo |
|
332 | echo | |
333 |
|
333 | |||
334 | else |
|
334 | else | |
335 | printf "rcstack stack router - run the router stack\n" |
|
335 | printf "rcstack stack router - run the router stack\n" | |
336 | echo |
|
336 | echo | |
337 |
|
337 | |||
338 | fi |
|
338 | fi | |
339 |
|
339 | |||
340 | printf "%s\n" "Usage:" |
|
340 | printf "%s\n" "Usage:" | |
341 | printf " rcstack stack router [SERVICES PARAMS...]\n" |
|
341 | printf " rcstack stack router [SERVICES PARAMS...]\n" | |
342 | printf " rcstack stack router --help | -h\n" |
|
342 | printf " rcstack stack router --help | -h\n" | |
343 | echo |
|
343 | echo | |
344 |
|
344 | |||
345 | # :command.long_usage |
|
345 | # :command.long_usage | |
346 | if [[ -n $long_usage ]]; then |
|
346 | if [[ -n $long_usage ]]; then | |
347 | printf "%s\n" "Options:" |
|
347 | printf "%s\n" "Options:" | |
348 |
|
348 | |||
349 | # :command.usage_fixed_flags |
|
349 | # :command.usage_fixed_flags | |
350 | printf " %s\n" "--help, -h" |
|
350 | printf " %s\n" "--help, -h" | |
351 | printf " Show this help\n" |
|
351 | printf " Show this help\n" | |
352 | echo |
|
352 | echo | |
353 |
|
353 | |||
354 | # :command.usage_args |
|
354 | # :command.usage_args | |
355 | printf "%s\n" "Arguments:" |
|
355 | printf "%s\n" "Arguments:" | |
356 |
|
356 | |||
357 | echo " SERVICES PARAMS..." |
|
357 | echo " SERVICES PARAMS..." | |
358 | printf " Additional arguments or flags for services command\n" |
|
358 | printf " Additional arguments or flags for services command\n" | |
359 | echo |
|
359 | echo | |
360 |
|
360 | |||
361 | fi |
|
361 | fi | |
362 | } |
|
362 | } | |
363 |
|
363 | |||
364 | # :command.usage |
|
364 | # :command.usage | |
365 | rcstack_stack_metrics_usage() { |
|
365 | rcstack_stack_metrics_usage() { | |
366 | if [[ -n $long_usage ]]; then |
|
366 | if [[ -n $long_usage ]]; then | |
367 | printf "rcstack stack metrics - run the router stack\n" |
|
367 | printf "rcstack stack metrics - run the router stack\n" | |
368 | echo |
|
368 | echo | |
369 |
|
369 | |||
370 | else |
|
370 | else | |
371 | printf "rcstack stack metrics - run the router stack\n" |
|
371 | printf "rcstack stack metrics - run the router stack\n" | |
372 | echo |
|
372 | echo | |
373 |
|
373 | |||
374 | fi |
|
374 | fi | |
375 |
|
375 | |||
376 | printf "%s\n" "Usage:" |
|
376 | printf "%s\n" "Usage:" | |
377 | printf " rcstack stack metrics [SERVICES PARAMS...]\n" |
|
377 | printf " rcstack stack metrics [SERVICES PARAMS...]\n" | |
378 | printf " rcstack stack metrics --help | -h\n" |
|
378 | printf " rcstack stack metrics --help | -h\n" | |
379 | echo |
|
379 | echo | |
380 |
|
380 | |||
381 | # :command.long_usage |
|
381 | # :command.long_usage | |
382 | if [[ -n $long_usage ]]; then |
|
382 | if [[ -n $long_usage ]]; then | |
383 | printf "%s\n" "Options:" |
|
383 | printf "%s\n" "Options:" | |
384 |
|
384 | |||
385 | # :command.usage_fixed_flags |
|
385 | # :command.usage_fixed_flags | |
386 | printf " %s\n" "--help, -h" |
|
386 | printf " %s\n" "--help, -h" | |
387 | printf " Show this help\n" |
|
387 | printf " Show this help\n" | |
388 | echo |
|
388 | echo | |
389 |
|
389 | |||
390 | # :command.usage_args |
|
390 | # :command.usage_args | |
391 | printf "%s\n" "Arguments:" |
|
391 | printf "%s\n" "Arguments:" | |
392 |
|
392 | |||
393 | echo " SERVICES PARAMS..." |
|
393 | echo " SERVICES PARAMS..." | |
394 | printf " Additional arguments or flags for services command\n" |
|
394 | printf " Additional arguments or flags for services command\n" | |
395 | echo |
|
395 | echo | |
396 |
|
396 | |||
397 | fi |
|
397 | fi | |
398 | } |
|
398 | } | |
399 |
|
399 | |||
400 | # :command.usage |
|
400 | # :command.usage | |
401 | rcstack_stack_services_usage() { |
|
401 | rcstack_stack_services_usage() { | |
402 | if [[ -n $long_usage ]]; then |
|
402 | if [[ -n $long_usage ]]; then | |
403 | printf "rcstack stack services - run the router stack\n" |
|
403 | printf "rcstack stack services - run the router stack\n" | |
404 | echo |
|
404 | echo | |
405 |
|
405 | |||
406 | else |
|
406 | else | |
407 | printf "rcstack stack services - run the router stack\n" |
|
407 | printf "rcstack stack services - run the router stack\n" | |
408 | echo |
|
408 | echo | |
409 |
|
409 | |||
410 | fi |
|
410 | fi | |
411 |
|
411 | |||
412 | printf "%s\n" "Usage:" |
|
412 | printf "%s\n" "Usage:" | |
413 | printf " rcstack stack services [SERVICES PARAMS...]\n" |
|
413 | printf " rcstack stack services [SERVICES PARAMS...]\n" | |
414 | printf " rcstack stack services --help | -h\n" |
|
414 | printf " rcstack stack services --help | -h\n" | |
415 | echo |
|
415 | echo | |
416 |
|
416 | |||
417 | # :command.long_usage |
|
417 | # :command.long_usage | |
418 | if [[ -n $long_usage ]]; then |
|
418 | if [[ -n $long_usage ]]; then | |
419 | printf "%s\n" "Options:" |
|
419 | printf "%s\n" "Options:" | |
420 |
|
420 | |||
421 | # :command.usage_fixed_flags |
|
421 | # :command.usage_fixed_flags | |
422 | printf " %s\n" "--help, -h" |
|
422 | printf " %s\n" "--help, -h" | |
423 | printf " Show this help\n" |
|
423 | printf " Show this help\n" | |
424 | echo |
|
424 | echo | |
425 |
|
425 | |||
426 | # :command.usage_args |
|
426 | # :command.usage_args | |
427 | printf "%s\n" "Arguments:" |
|
427 | printf "%s\n" "Arguments:" | |
428 |
|
428 | |||
429 | echo " SERVICES PARAMS..." |
|
429 | echo " SERVICES PARAMS..." | |
430 | printf " Additional arguments or flags for services command\n" |
|
430 | printf " Additional arguments or flags for services command\n" | |
431 | echo |
|
431 | echo | |
432 |
|
432 | |||
433 | fi |
|
433 | fi | |
434 | } |
|
434 | } | |
435 |
|
435 | |||
436 | # :command.usage |
|
436 | # :command.usage | |
437 | rcstack_stack_rhodecode_usage() { |
|
437 | rcstack_stack_rhodecode_usage() { | |
438 | if [[ -n $long_usage ]]; then |
|
438 | if [[ -n $long_usage ]]; then | |
439 | printf "rcstack stack rhodecode - run the router stack\n" |
|
439 | printf "rcstack stack rhodecode - run the router stack\n" | |
440 | echo |
|
440 | echo | |
441 |
|
441 | |||
442 | else |
|
442 | else | |
443 | printf "rcstack stack rhodecode - run the router stack\n" |
|
443 | printf "rcstack stack rhodecode - run the router stack\n" | |
444 | echo |
|
444 | echo | |
445 |
|
445 | |||
446 | fi |
|
446 | fi | |
447 |
|
447 | |||
448 | printf "%s\n" "Usage:" |
|
448 | printf "%s\n" "Usage:" | |
449 | printf " rcstack stack rhodecode [SERVICES PARAMS...]\n" |
|
449 | printf " rcstack stack rhodecode [SERVICES PARAMS...]\n" | |
450 | printf " rcstack stack rhodecode --help | -h\n" |
|
450 | printf " rcstack stack rhodecode --help | -h\n" | |
451 | echo |
|
451 | echo | |
452 |
|
452 | |||
453 | # :command.long_usage |
|
453 | # :command.long_usage | |
454 | if [[ -n $long_usage ]]; then |
|
454 | if [[ -n $long_usage ]]; then | |
455 | printf "%s\n" "Options:" |
|
455 | printf "%s\n" "Options:" | |
456 |
|
456 | |||
457 | # :command.usage_fixed_flags |
|
457 | # :command.usage_fixed_flags | |
458 | printf " %s\n" "--help, -h" |
|
458 | printf " %s\n" "--help, -h" | |
459 | printf " Show this help\n" |
|
459 | printf " Show this help\n" | |
460 | echo |
|
460 | echo | |
461 |
|
461 | |||
462 | # :command.usage_args |
|
462 | # :command.usage_args | |
463 | printf "%s\n" "Arguments:" |
|
463 | printf "%s\n" "Arguments:" | |
464 |
|
464 | |||
465 | echo " SERVICES PARAMS..." |
|
465 | echo " SERVICES PARAMS..." | |
466 | printf " Additional arguments or flags for services command\n" |
|
466 | printf " Additional arguments or flags for services command\n" | |
467 | echo |
|
467 | echo | |
468 |
|
468 | |||
469 | fi |
|
469 | fi | |
470 | } |
|
470 | } | |
471 |
|
471 | |||
472 | # :command.usage |
|
472 | # :command.usage | |
473 | rcstack_stack_all_usage() { |
|
473 | rcstack_stack_all_usage() { | |
474 | if [[ -n $long_usage ]]; then |
|
474 | if [[ -n $long_usage ]]; then | |
475 | printf "rcstack stack all - run all stacks\n" |
|
475 | printf "rcstack stack all - run all stacks\n" | |
476 | echo |
|
476 | echo | |
477 |
|
477 | |||
478 | else |
|
478 | else | |
479 | printf "rcstack stack all - run all stacks\n" |
|
479 | printf "rcstack stack all - run all stacks\n" | |
480 | echo |
|
480 | echo | |
481 |
|
481 | |||
482 | fi |
|
482 | fi | |
483 |
|
483 | |||
484 | printf "%s\n" "Usage:" |
|
484 | printf "%s\n" "Usage:" | |
485 | printf " rcstack stack all [SERVICES PARAMS...]\n" |
|
485 | printf " rcstack stack all [SERVICES PARAMS...]\n" | |
486 | printf " rcstack stack all --help | -h\n" |
|
486 | printf " rcstack stack all --help | -h\n" | |
487 | echo |
|
487 | echo | |
488 |
|
488 | |||
489 | # :command.long_usage |
|
489 | # :command.long_usage | |
490 | if [[ -n $long_usage ]]; then |
|
490 | if [[ -n $long_usage ]]; then | |
491 | printf "%s\n" "Options:" |
|
491 | printf "%s\n" "Options:" | |
492 |
|
492 | |||
493 | # :command.usage_fixed_flags |
|
493 | # :command.usage_fixed_flags | |
494 | printf " %s\n" "--help, -h" |
|
494 | printf " %s\n" "--help, -h" | |
495 | printf " Show this help\n" |
|
495 | printf " Show this help\n" | |
496 | echo |
|
496 | echo | |
497 |
|
497 | |||
498 | # :command.usage_args |
|
498 | # :command.usage_args | |
499 | printf "%s\n" "Arguments:" |
|
499 | printf "%s\n" "Arguments:" | |
500 |
|
500 | |||
501 | echo " SERVICES PARAMS..." |
|
501 | echo " SERVICES PARAMS..." | |
502 | printf " Additional arguments or flags for services command\n" |
|
502 | printf " Additional arguments or flags for services command\n" | |
503 | echo |
|
503 | echo | |
504 |
|
504 | |||
505 | fi |
|
505 | fi | |
506 | } |
|
506 | } | |
507 |
|
507 | |||
508 | # :command.usage |
|
508 | # :command.usage | |
509 | rcstack_stack_status_usage() { |
|
509 | rcstack_stack_status_usage() { | |
510 | if [[ -n $long_usage ]]; then |
|
510 | if [[ -n $long_usage ]]; then | |
511 | printf "rcstack stack-status - Show stack status\n" |
|
511 | printf "rcstack stack-status - Show stack status\n" | |
512 | echo |
|
512 | echo | |
513 |
|
513 | |||
514 | else |
|
514 | else | |
515 | printf "rcstack stack-status - Show stack status\n" |
|
515 | printf "rcstack stack-status - Show stack status\n" | |
516 | echo |
|
516 | echo | |
517 |
|
517 | |||
518 | fi |
|
518 | fi | |
519 |
|
519 | |||
520 | printf "Alias: status\n" |
|
520 | printf "Alias: status\n" | |
521 | echo |
|
521 | echo | |
522 |
|
522 | |||
523 | printf "%s\n" "Usage:" |
|
523 | printf "%s\n" "Usage:" | |
524 | printf " rcstack stack-status [OPTIONS]\n" |
|
524 | printf " rcstack stack-status [OPTIONS]\n" | |
525 | printf " rcstack stack-status --help | -h\n" |
|
525 | printf " rcstack stack-status --help | -h\n" | |
526 | echo |
|
526 | echo | |
527 |
|
527 | |||
528 | # :command.long_usage |
|
528 | # :command.long_usage | |
529 | if [[ -n $long_usage ]]; then |
|
529 | if [[ -n $long_usage ]]; then | |
530 | printf "%s\n" "Options:" |
|
530 | printf "%s\n" "Options:" | |
531 |
|
531 | |||
532 | # :command.usage_fixed_flags |
|
532 | # :command.usage_fixed_flags | |
533 | printf " %s\n" "--help, -h" |
|
533 | printf " %s\n" "--help, -h" | |
534 | printf " Show this help\n" |
|
534 | printf " Show this help\n" | |
535 | echo |
|
535 | echo | |
536 |
|
536 | |||
537 | # :command.usage_flags |
|
537 | # :command.usage_flags | |
538 | # :flag.usage |
|
538 | # :flag.usage | |
539 | printf " %s\n" "--detailed" |
|
539 | printf " %s\n" "--detailed" | |
540 | printf " Display a detailed format\n" |
|
540 | printf " Display a detailed format\n" | |
541 | echo |
|
541 | echo | |
542 |
|
542 | |||
543 | fi |
|
543 | fi | |
544 | } |
|
544 | } | |
545 |
|
545 | |||
546 | # :command.usage |
|
546 | # :command.usage | |
547 | rcstack_stack_upgrade_usage() { |
|
547 | rcstack_stack_upgrade_usage() { | |
548 | if [[ -n $long_usage ]]; then |
|
548 | if [[ -n $long_usage ]]; then | |
549 | printf "rcstack stack-upgrade - Upgrade a stack, run stack-upgrade -h for more details\n" |
|
549 | printf "rcstack stack-upgrade - Upgrade a stack, run stack-upgrade -h for more details\n" | |
550 | echo |
|
550 | echo | |
551 |
|
551 | |||
552 | else |
|
552 | else | |
553 | printf "rcstack stack-upgrade - Upgrade a stack, run stack-upgrade -h for more details\n" |
|
553 | printf "rcstack stack-upgrade - Upgrade a stack, run stack-upgrade -h for more details\n" | |
554 | echo |
|
554 | echo | |
555 |
|
555 | |||
556 | fi |
|
556 | fi | |
557 |
|
557 | |||
558 | printf "%s\n" "Usage:" |
|
558 | printf "%s\n" "Usage:" | |
559 | printf " rcstack stack-upgrade COMMAND\n" |
|
559 | printf " rcstack stack-upgrade COMMAND\n" | |
560 | printf " rcstack stack-upgrade [COMMAND] --help | -h\n" |
|
560 | printf " rcstack stack-upgrade [COMMAND] --help | -h\n" | |
561 | echo |
|
561 | echo | |
562 | # :command.usage_commands |
|
562 | # :command.usage_commands | |
563 | printf "%s\n" "Commands:" |
|
563 | printf "%s\n" "Commands:" | |
564 | printf " %s upgrade the router stack\n" "router " |
|
564 | printf " %s upgrade the router stack\n" "router " | |
565 | printf " %s run the router stack\n" "metrics " |
|
565 | printf " %s run the router stack\n" "metrics " | |
566 | printf " %s run the router stack\n" "services " |
|
566 | printf " %s run the router stack\n" "services " | |
567 | printf " %s run the router stack\n" "rhodecode" |
|
567 | printf " %s run the router stack\n" "rhodecode" | |
568 | echo |
|
568 | echo | |
569 |
|
569 | |||
570 | # :command.long_usage |
|
570 | # :command.long_usage | |
571 | if [[ -n $long_usage ]]; then |
|
571 | if [[ -n $long_usage ]]; then | |
572 | printf "%s\n" "Options:" |
|
572 | printf "%s\n" "Options:" | |
573 |
|
573 | |||
574 | # :command.usage_fixed_flags |
|
574 | # :command.usage_fixed_flags | |
575 | printf " %s\n" "--help, -h" |
|
575 | printf " %s\n" "--help, -h" | |
576 | printf " Show this help\n" |
|
576 | printf " Show this help\n" | |
577 | echo |
|
577 | echo | |
578 |
|
578 | |||
579 | # :command.usage_examples |
|
579 | # :command.usage_examples | |
580 | printf "%s\n" "Examples:" |
|
580 | printf "%s\n" "Examples:" | |
581 | 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" |
|
581 | 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" | |
582 | echo |
|
582 | echo | |
583 |
|
583 | |||
584 | fi |
|
584 | fi | |
585 | } |
|
585 | } | |
586 |
|
586 | |||
587 | # :command.usage |
|
587 | # :command.usage | |
588 | rcstack_stack_upgrade_router_usage() { |
|
588 | rcstack_stack_upgrade_router_usage() { | |
589 | if [[ -n $long_usage ]]; then |
|
589 | if [[ -n $long_usage ]]; then | |
590 | printf "rcstack stack-upgrade router - upgrade the router stack\n" |
|
590 | printf "rcstack stack-upgrade router - upgrade the router stack\n" | |
591 | echo |
|
591 | echo | |
592 |
|
592 | |||
593 | else |
|
593 | else | |
594 | printf "rcstack stack-upgrade router - upgrade the router stack\n" |
|
594 | printf "rcstack stack-upgrade router - upgrade the router stack\n" | |
595 | echo |
|
595 | echo | |
596 |
|
596 | |||
597 | fi |
|
597 | fi | |
598 |
|
598 | |||
599 | printf "%s\n" "Usage:" |
|
599 | printf "%s\n" "Usage:" | |
600 | printf " rcstack stack-upgrade router\n" |
|
600 | printf " rcstack stack-upgrade router\n" | |
601 | printf " rcstack stack-upgrade router --help | -h\n" |
|
601 | printf " rcstack stack-upgrade router --help | -h\n" | |
602 | echo |
|
602 | echo | |
603 |
|
603 | |||
604 | # :command.long_usage |
|
604 | # :command.long_usage | |
605 | if [[ -n $long_usage ]]; then |
|
605 | if [[ -n $long_usage ]]; then | |
606 | printf "%s\n" "Options:" |
|
606 | printf "%s\n" "Options:" | |
607 |
|
607 | |||
608 | # :command.usage_fixed_flags |
|
608 | # :command.usage_fixed_flags | |
609 | printf " %s\n" "--help, -h" |
|
609 | printf " %s\n" "--help, -h" | |
610 | printf " Show this help\n" |
|
610 | printf " Show this help\n" | |
611 | echo |
|
611 | echo | |
612 |
|
612 | |||
613 | fi |
|
613 | fi | |
614 | } |
|
614 | } | |
615 |
|
615 | |||
616 | # :command.usage |
|
616 | # :command.usage | |
617 | rcstack_stack_upgrade_metrics_usage() { |
|
617 | rcstack_stack_upgrade_metrics_usage() { | |
618 | if [[ -n $long_usage ]]; then |
|
618 | if [[ -n $long_usage ]]; then | |
619 | printf "rcstack stack-upgrade metrics - run the router stack\n" |
|
619 | printf "rcstack stack-upgrade metrics - run the router stack\n" | |
620 | echo |
|
620 | echo | |
621 |
|
621 | |||
622 | else |
|
622 | else | |
623 | printf "rcstack stack-upgrade metrics - run the router stack\n" |
|
623 | printf "rcstack stack-upgrade metrics - run the router stack\n" | |
624 | echo |
|
624 | echo | |
625 |
|
625 | |||
626 | fi |
|
626 | fi | |
627 |
|
627 | |||
628 | printf "%s\n" "Usage:" |
|
628 | printf "%s\n" "Usage:" | |
629 | printf " rcstack stack-upgrade metrics\n" |
|
629 | printf " rcstack stack-upgrade metrics\n" | |
630 | printf " rcstack stack-upgrade metrics --help | -h\n" |
|
630 | printf " rcstack stack-upgrade metrics --help | -h\n" | |
631 | echo |
|
631 | echo | |
632 |
|
632 | |||
633 | # :command.long_usage |
|
633 | # :command.long_usage | |
634 | if [[ -n $long_usage ]]; then |
|
634 | if [[ -n $long_usage ]]; then | |
635 | printf "%s\n" "Options:" |
|
635 | printf "%s\n" "Options:" | |
636 |
|
636 | |||
637 | # :command.usage_fixed_flags |
|
637 | # :command.usage_fixed_flags | |
638 | printf " %s\n" "--help, -h" |
|
638 | printf " %s\n" "--help, -h" | |
639 | printf " Show this help\n" |
|
639 | printf " Show this help\n" | |
640 | echo |
|
640 | echo | |
641 |
|
641 | |||
642 | fi |
|
642 | fi | |
643 | } |
|
643 | } | |
644 |
|
644 | |||
645 | # :command.usage |
|
645 | # :command.usage | |
646 | rcstack_stack_upgrade_services_usage() { |
|
646 | rcstack_stack_upgrade_services_usage() { | |
647 | if [[ -n $long_usage ]]; then |
|
647 | if [[ -n $long_usage ]]; then | |
648 | printf "rcstack stack-upgrade services - run the router stack\n" |
|
648 | printf "rcstack stack-upgrade services - run the router stack\n" | |
649 | echo |
|
649 | echo | |
650 |
|
650 | |||
651 | else |
|
651 | else | |
652 | printf "rcstack stack-upgrade services - run the router stack\n" |
|
652 | printf "rcstack stack-upgrade services - run the router stack\n" | |
653 | echo |
|
653 | echo | |
654 |
|
654 | |||
655 | fi |
|
655 | fi | |
656 |
|
656 | |||
657 | printf "%s\n" "Usage:" |
|
657 | printf "%s\n" "Usage:" | |
658 | printf " rcstack stack-upgrade services\n" |
|
658 | printf " rcstack stack-upgrade services\n" | |
659 | printf " rcstack stack-upgrade services --help | -h\n" |
|
659 | printf " rcstack stack-upgrade services --help | -h\n" | |
660 | echo |
|
660 | echo | |
661 |
|
661 | |||
662 | # :command.long_usage |
|
662 | # :command.long_usage | |
663 | if [[ -n $long_usage ]]; then |
|
663 | if [[ -n $long_usage ]]; then | |
664 | printf "%s\n" "Options:" |
|
664 | printf "%s\n" "Options:" | |
665 |
|
665 | |||
666 | # :command.usage_fixed_flags |
|
666 | # :command.usage_fixed_flags | |
667 | printf " %s\n" "--help, -h" |
|
667 | printf " %s\n" "--help, -h" | |
668 | printf " Show this help\n" |
|
668 | printf " Show this help\n" | |
669 | echo |
|
669 | echo | |
670 |
|
670 | |||
671 | fi |
|
671 | fi | |
672 | } |
|
672 | } | |
673 |
|
673 | |||
674 | # :command.usage |
|
674 | # :command.usage | |
675 | rcstack_stack_upgrade_rhodecode_usage() { |
|
675 | rcstack_stack_upgrade_rhodecode_usage() { | |
676 | if [[ -n $long_usage ]]; then |
|
676 | if [[ -n $long_usage ]]; then | |
677 | printf "rcstack stack-upgrade rhodecode - run the router stack\n" |
|
677 | printf "rcstack stack-upgrade rhodecode - run the router stack\n" | |
678 | echo |
|
678 | echo | |
679 |
|
679 | |||
680 | else |
|
680 | else | |
681 | printf "rcstack stack-upgrade rhodecode - run the router stack\n" |
|
681 | printf "rcstack stack-upgrade rhodecode - run the router stack\n" | |
682 | echo |
|
682 | echo | |
683 |
|
683 | |||
684 | fi |
|
684 | fi | |
685 |
|
685 | |||
686 | printf "%s\n" "Usage:" |
|
686 | printf "%s\n" "Usage:" | |
687 | printf " rcstack stack-upgrade rhodecode [OPTIONS]\n" |
|
687 | printf " rcstack stack-upgrade rhodecode [OPTIONS]\n" | |
688 | printf " rcstack stack-upgrade rhodecode --help | -h\n" |
|
688 | printf " rcstack stack-upgrade rhodecode --help | -h\n" | |
689 | echo |
|
689 | echo | |
690 |
|
690 | |||
691 | # :command.long_usage |
|
691 | # :command.long_usage | |
692 | if [[ -n $long_usage ]]; then |
|
692 | if [[ -n $long_usage ]]; then | |
693 | printf "%s\n" "Options:" |
|
693 | printf "%s\n" "Options:" | |
694 |
|
694 | |||
695 | # :command.usage_fixed_flags |
|
695 | # :command.usage_fixed_flags | |
696 | printf " %s\n" "--help, -h" |
|
696 | printf " %s\n" "--help, -h" | |
697 | printf " Show this help\n" |
|
697 | printf " Show this help\n" | |
698 | echo |
|
698 | echo | |
699 |
|
699 | |||
700 | # :command.usage_flags |
|
700 | # :command.usage_flags | |
701 | # :flag.usage |
|
701 | # :flag.usage | |
702 | printf " %s\n" "--restart-unhealthy" |
|
702 | printf " %s\n" "--restart-unhealthy" | |
703 | printf " just restart unhealthy containers\n" |
|
703 | printf " just restart unhealthy containers\n" | |
704 | echo |
|
704 | echo | |
705 |
|
705 | |||
706 | # :flag.usage |
|
706 | # :flag.usage | |
707 | printf " %s\n" "--stop-wait STOP_WAIT" |
|
707 | printf " %s\n" "--stop-wait STOP_WAIT" | |
708 | printf " Number of seconds to wait for stopping old containers, use low value to\n quickly restart and recycle containers\n" |
|
708 | printf " Number of seconds to wait for stopping old containers, use low value to\n quickly restart and recycle containers\n" | |
709 | printf " Default: 120\n" |
|
709 | printf " Default: 120\n" | |
710 | echo |
|
710 | echo | |
711 |
|
711 | |||
712 | fi |
|
712 | fi | |
713 | } |
|
713 | } | |
714 |
|
714 | |||
715 | # :command.usage |
|
715 | # :command.usage | |
716 | rcstack_cli_usage() { |
|
716 | rcstack_cli_usage() { | |
717 | if [[ -n $long_usage ]]; then |
|
717 | if [[ -n $long_usage ]]; then | |
718 | printf "rcstack cli - Various CLI tools, run cli -h for more details\n" |
|
718 | printf "rcstack cli - Various CLI tools, run cli -h for more details\n" | |
719 | echo |
|
719 | echo | |
720 |
|
720 | |||
721 | else |
|
721 | else | |
722 | printf "rcstack cli - Various CLI tools, run cli -h for more details\n" |
|
722 | printf "rcstack cli - Various CLI tools, run cli -h for more details\n" | |
723 | echo |
|
723 | echo | |
724 |
|
724 | |||
725 | fi |
|
725 | fi | |
726 |
|
726 | |||
727 | printf "%s\n" "Usage:" |
|
727 | printf "%s\n" "Usage:" | |
728 | printf " rcstack cli COMMAND\n" |
|
728 | printf " rcstack cli COMMAND\n" | |
729 | printf " rcstack cli [COMMAND] --help | -h\n" |
|
729 | printf " rcstack cli [COMMAND] --help | -h\n" | |
730 | echo |
|
730 | echo | |
731 | # :command.usage_commands |
|
731 | # :command.usage_commands | |
732 | printf "%s\n" "Commands:" |
|
732 | printf "%s\n" "Commands:" | |
733 | printf " %s print out stored docker image version\n" "image-info " |
|
733 | printf " %s print out stored docker image version\n" "image-info " | |
734 | printf " %s CLI for Redis\n" "redis " |
|
734 | printf " %s CLI for Redis\n" "redis " | |
735 | printf " %s CLI with Database connection\n" "db " |
|
735 | printf " %s CLI with Database connection\n" "db " | |
736 | printf " %s CLI to run db upgrade\n" "db-upgrade " |
|
736 | printf " %s CLI to run db upgrade\n" "db-upgrade " | |
737 | printf " %s CLI for repository storage. Exposes a basic image with mounted data and repositories volumes\n" "storage " |
|
737 | printf " %s CLI for repository storage. Exposes a basic image with mounted data and repositories volumes\n" "storage " | |
738 | printf " %s attach to running instance of RhodeCode, by default it attaches to rhodecode main web app\n" "attach " |
|
738 | printf " %s attach to running instance of RhodeCode, by default it attaches to rhodecode main web app\n" "attach " | |
739 | printf " %s reconfigure the vcsserver.ini file\n" "configure-vcsserver" |
|
739 | printf " %s reconfigure the vcsserver.ini file\n" "configure-vcsserver" | |
740 | printf " %s reconfigure the rhodecode.ini file\n" "configure-rhodecode" |
|
740 | printf " %s reconfigure the rhodecode.ini file\n" "configure-rhodecode" | |
741 | echo |
|
741 | echo | |
742 |
|
742 | |||
743 | # :command.long_usage |
|
743 | # :command.long_usage | |
744 | if [[ -n $long_usage ]]; then |
|
744 | if [[ -n $long_usage ]]; then | |
745 | printf "%s\n" "Options:" |
|
745 | printf "%s\n" "Options:" | |
746 |
|
746 | |||
747 | # :command.usage_fixed_flags |
|
747 | # :command.usage_fixed_flags | |
748 | printf " %s\n" "--help, -h" |
|
748 | printf " %s\n" "--help, -h" | |
749 | printf " Show this help\n" |
|
749 | printf " Show this help\n" | |
750 | echo |
|
750 | echo | |
751 |
|
751 | |||
752 | fi |
|
752 | fi | |
753 | } |
|
753 | } | |
754 |
|
754 | |||
755 | # :command.usage |
|
755 | # :command.usage | |
756 | rcstack_cli_image_info_usage() { |
|
756 | rcstack_cli_image_info_usage() { | |
757 | if [[ -n $long_usage ]]; then |
|
757 | if [[ -n $long_usage ]]; then | |
758 | printf "rcstack cli image-info - print out stored docker image version\n" |
|
758 | printf "rcstack cli image-info - print out stored docker image version\n" | |
759 | echo |
|
759 | echo | |
760 |
|
760 | |||
761 | else |
|
761 | else | |
762 | printf "rcstack cli image-info - print out stored docker image version\n" |
|
762 | printf "rcstack cli image-info - print out stored docker image version\n" | |
763 | echo |
|
763 | echo | |
764 |
|
764 | |||
765 | fi |
|
765 | fi | |
766 |
|
766 | |||
767 | printf "%s\n" "Usage:" |
|
767 | printf "%s\n" "Usage:" | |
768 | printf " rcstack cli image-info [OPTIONS]\n" |
|
768 | printf " rcstack cli image-info [OPTIONS]\n" | |
769 | printf " rcstack cli image-info --help | -h\n" |
|
769 | printf " rcstack cli image-info --help | -h\n" | |
770 | echo |
|
770 | echo | |
771 |
|
771 | |||
772 | # :command.long_usage |
|
772 | # :command.long_usage | |
773 | if [[ -n $long_usage ]]; then |
|
773 | if [[ -n $long_usage ]]; then | |
774 | printf "%s\n" "Options:" |
|
774 | printf "%s\n" "Options:" | |
775 |
|
775 | |||
776 | # :command.usage_fixed_flags |
|
776 | # :command.usage_fixed_flags | |
777 | printf " %s\n" "--help, -h" |
|
777 | printf " %s\n" "--help, -h" | |
778 | printf " Show this help\n" |
|
778 | printf " Show this help\n" | |
779 | echo |
|
779 | echo | |
780 |
|
780 | |||
781 | # :command.usage_flags |
|
781 | # :command.usage_flags | |
782 | # :flag.usage |
|
782 | # :flag.usage | |
783 | printf " %s\n" "--set-runtime SET_RUNTIME" |
|
783 | printf " %s\n" "--set-runtime SET_RUNTIME" | |
784 | printf " set version into .runtime.env\n" |
|
784 | printf " set version into .runtime.env\n" | |
785 | echo |
|
785 | echo | |
786 |
|
786 | |||
787 | fi |
|
787 | fi | |
788 | } |
|
788 | } | |
789 |
|
789 | |||
790 | # :command.usage |
|
790 | # :command.usage | |
791 | rcstack_cli_redis_usage() { |
|
791 | rcstack_cli_redis_usage() { | |
792 | if [[ -n $long_usage ]]; then |
|
792 | if [[ -n $long_usage ]]; then | |
793 | printf "rcstack cli redis - CLI for Redis\n" |
|
793 | printf "rcstack cli redis - CLI for Redis\n" | |
794 | echo |
|
794 | echo | |
795 |
|
795 | |||
796 | else |
|
796 | else | |
797 | printf "rcstack cli redis - CLI for Redis\n" |
|
797 | printf "rcstack cli redis - CLI for Redis\n" | |
798 | echo |
|
798 | echo | |
799 |
|
799 | |||
800 | fi |
|
800 | fi | |
801 |
|
801 | |||
802 | printf "%s\n" "Usage:" |
|
802 | printf "%s\n" "Usage:" | |
803 | printf " rcstack cli redis\n" |
|
803 | printf " rcstack cli redis\n" | |
804 | printf " rcstack cli redis --help | -h\n" |
|
804 | printf " rcstack cli redis --help | -h\n" | |
805 | echo |
|
805 | echo | |
806 |
|
806 | |||
807 | # :command.long_usage |
|
807 | # :command.long_usage | |
808 | if [[ -n $long_usage ]]; then |
|
808 | if [[ -n $long_usage ]]; then | |
809 | printf "%s\n" "Options:" |
|
809 | printf "%s\n" "Options:" | |
810 |
|
810 | |||
811 | # :command.usage_fixed_flags |
|
811 | # :command.usage_fixed_flags | |
812 | printf " %s\n" "--help, -h" |
|
812 | printf " %s\n" "--help, -h" | |
813 | printf " Show this help\n" |
|
813 | printf " Show this help\n" | |
814 | echo |
|
814 | echo | |
815 |
|
815 | |||
816 | fi |
|
816 | fi | |
817 | } |
|
817 | } | |
818 |
|
818 | |||
819 | # :command.usage |
|
819 | # :command.usage | |
820 | rcstack_cli_db_usage() { |
|
820 | rcstack_cli_db_usage() { | |
821 | if [[ -n $long_usage ]]; then |
|
821 | if [[ -n $long_usage ]]; then | |
822 | printf "rcstack cli db - CLI with Database connection\n" |
|
822 | printf "rcstack cli db - CLI with Database connection\n" | |
823 | echo |
|
823 | echo | |
824 |
|
824 | |||
825 | else |
|
825 | else | |
826 | printf "rcstack cli db - CLI with Database connection\n" |
|
826 | printf "rcstack cli db - CLI with Database connection\n" | |
827 | echo |
|
827 | echo | |
828 |
|
828 | |||
829 | fi |
|
829 | fi | |
830 |
|
830 | |||
831 | printf "%s\n" "Usage:" |
|
831 | printf "%s\n" "Usage:" | |
832 | printf " rcstack cli db\n" |
|
832 | printf " rcstack cli db\n" | |
833 | printf " rcstack cli db --help | -h\n" |
|
833 | printf " rcstack cli db --help | -h\n" | |
834 | echo |
|
834 | echo | |
835 |
|
835 | |||
836 | # :command.long_usage |
|
836 | # :command.long_usage | |
837 | if [[ -n $long_usage ]]; then |
|
837 | if [[ -n $long_usage ]]; then | |
838 | printf "%s\n" "Options:" |
|
838 | printf "%s\n" "Options:" | |
839 |
|
839 | |||
840 | # :command.usage_fixed_flags |
|
840 | # :command.usage_fixed_flags | |
841 | printf " %s\n" "--help, -h" |
|
841 | printf " %s\n" "--help, -h" | |
842 | printf " Show this help\n" |
|
842 | printf " Show this help\n" | |
843 | echo |
|
843 | echo | |
844 |
|
844 | |||
845 | # :command.usage_examples |
|
845 | # :command.usage_examples | |
846 | printf "%s\n" "Examples:" |
|
846 | printf "%s\n" "Examples:" | |
847 | printf " # restore backup\n - \i /var/rc-data-dump/your_dump.sql\n" |
|
847 | printf " # restore backup\n - \i /var/rc-data-dump/your_dump.sql\n" | |
848 | echo |
|
848 | echo | |
849 |
|
849 | |||
850 | fi |
|
850 | fi | |
851 | } |
|
851 | } | |
852 |
|
852 | |||
853 | # :command.usage |
|
853 | # :command.usage | |
854 | rcstack_cli_db_upgrade_usage() { |
|
854 | rcstack_cli_db_upgrade_usage() { | |
855 | if [[ -n $long_usage ]]; then |
|
855 | if [[ -n $long_usage ]]; then | |
856 | printf "rcstack cli db-upgrade - CLI to run db upgrade\n" |
|
856 | printf "rcstack cli db-upgrade - CLI to run db upgrade\n" | |
857 | echo |
|
857 | echo | |
858 |
|
858 | |||
859 | else |
|
859 | else | |
860 | printf "rcstack cli db-upgrade - CLI to run db upgrade\n" |
|
860 | printf "rcstack cli db-upgrade - CLI to run db upgrade\n" | |
861 | echo |
|
861 | echo | |
862 |
|
862 | |||
863 | fi |
|
863 | fi | |
864 |
|
864 | |||
865 | printf "%s\n" "Usage:" |
|
865 | printf "%s\n" "Usage:" | |
866 | printf " rcstack cli db-upgrade\n" |
|
866 | printf " rcstack cli db-upgrade\n" | |
867 | printf " rcstack cli db-upgrade --help | -h\n" |
|
867 | printf " rcstack cli db-upgrade --help | -h\n" | |
868 | echo |
|
868 | echo | |
869 |
|
869 | |||
870 | # :command.long_usage |
|
870 | # :command.long_usage | |
871 | if [[ -n $long_usage ]]; then |
|
871 | if [[ -n $long_usage ]]; then | |
872 | printf "%s\n" "Options:" |
|
872 | printf "%s\n" "Options:" | |
873 |
|
873 | |||
874 | # :command.usage_fixed_flags |
|
874 | # :command.usage_fixed_flags | |
875 | printf " %s\n" "--help, -h" |
|
875 | printf " %s\n" "--help, -h" | |
876 | printf " Show this help\n" |
|
876 | printf " Show this help\n" | |
877 | echo |
|
877 | echo | |
878 |
|
878 | |||
879 | fi |
|
879 | fi | |
880 | } |
|
880 | } | |
881 |
|
881 | |||
882 | # :command.usage |
|
882 | # :command.usage | |
883 | rcstack_cli_storage_usage() { |
|
883 | rcstack_cli_storage_usage() { | |
884 | if [[ -n $long_usage ]]; then |
|
884 | if [[ -n $long_usage ]]; then | |
885 | printf "rcstack cli storage - CLI for repository storage. Exposes a basic image with mounted data and repositories volumes\n" |
|
885 | printf "rcstack cli storage - CLI for repository storage. Exposes a basic image with mounted data and repositories volumes\n" | |
886 | echo |
|
886 | echo | |
887 |
|
887 | |||
888 | else |
|
888 | else | |
889 | printf "rcstack cli storage - CLI for repository storage. Exposes a basic image with mounted data and repositories volumes\n" |
|
889 | printf "rcstack cli storage - CLI for repository storage. Exposes a basic image with mounted data and repositories volumes\n" | |
890 | echo |
|
890 | echo | |
891 |
|
891 | |||
892 | fi |
|
892 | fi | |
893 |
|
893 | |||
894 | printf "%s\n" "Usage:" |
|
894 | printf "%s\n" "Usage:" | |
895 | printf " rcstack cli storage\n" |
|
895 | printf " rcstack cli storage\n" | |
896 | printf " rcstack cli storage --help | -h\n" |
|
896 | printf " rcstack cli storage --help | -h\n" | |
897 | echo |
|
897 | echo | |
898 |
|
898 | |||
899 | # :command.long_usage |
|
899 | # :command.long_usage | |
900 | if [[ -n $long_usage ]]; then |
|
900 | if [[ -n $long_usage ]]; then | |
901 | printf "%s\n" "Options:" |
|
901 | printf "%s\n" "Options:" | |
902 |
|
902 | |||
903 | # :command.usage_fixed_flags |
|
903 | # :command.usage_fixed_flags | |
904 | printf " %s\n" "--help, -h" |
|
904 | printf " %s\n" "--help, -h" | |
905 | printf " Show this help\n" |
|
905 | printf " Show this help\n" | |
906 | echo |
|
906 | echo | |
907 |
|
907 | |||
908 | fi |
|
908 | fi | |
909 | } |
|
909 | } | |
910 |
|
910 | |||
911 | # :command.usage |
|
911 | # :command.usage | |
912 | rcstack_cli_attach_usage() { |
|
912 | rcstack_cli_attach_usage() { | |
913 | if [[ -n $long_usage ]]; then |
|
913 | if [[ -n $long_usage ]]; then | |
914 | printf "rcstack cli attach - attach to running instance of RhodeCode, by default it attaches to rhodecode main web app\n" |
|
914 | printf "rcstack cli attach - attach to running instance of RhodeCode, by default it attaches to rhodecode main web app\n" | |
915 | echo |
|
915 | echo | |
916 |
|
916 | |||
917 | else |
|
917 | else | |
918 | printf "rcstack cli attach - attach to running instance of RhodeCode, by default it attaches to rhodecode main web app\n" |
|
918 | printf "rcstack cli attach - attach to running instance of RhodeCode, by default it attaches to rhodecode main web app\n" | |
919 | echo |
|
919 | echo | |
920 |
|
920 | |||
921 | fi |
|
921 | fi | |
922 |
|
922 | |||
923 | printf "%s\n" "Usage:" |
|
923 | printf "%s\n" "Usage:" | |
924 | printf " rcstack cli attach [OPTIONS]\n" |
|
924 | printf " rcstack cli attach [OPTIONS]\n" | |
925 | printf " rcstack cli attach --help | -h\n" |
|
925 | printf " rcstack cli attach --help | -h\n" | |
926 | echo |
|
926 | echo | |
927 |
|
927 | |||
928 | # :command.long_usage |
|
928 | # :command.long_usage | |
929 | if [[ -n $long_usage ]]; then |
|
929 | if [[ -n $long_usage ]]; then | |
930 | printf "%s\n" "Options:" |
|
930 | printf "%s\n" "Options:" | |
931 |
|
931 | |||
932 | # :command.usage_fixed_flags |
|
932 | # :command.usage_fixed_flags | |
933 | printf " %s\n" "--help, -h" |
|
933 | printf " %s\n" "--help, -h" | |
934 | printf " Show this help\n" |
|
934 | printf " Show this help\n" | |
935 | echo |
|
935 | echo | |
936 |
|
936 | |||
937 | # :command.usage_flags |
|
937 | # :command.usage_flags | |
938 | # :flag.usage |
|
938 | # :flag.usage | |
939 | printf " %s\n" "--instance-type INSTANCE_TYPE" |
|
939 | printf " %s\n" "--instance-type INSTANCE_TYPE" | |
940 | printf " type of instance to attach to\n" |
|
940 | printf " type of instance to attach to\n" | |
941 | printf " Default: rhodecode\n" |
|
941 | printf " Default: rhodecode\n" | |
942 | echo |
|
942 | echo | |
943 |
|
943 | |||
944 | # :command.usage_examples |
|
944 | # :command.usage_examples | |
945 | printf "%s\n" "Examples:" |
|
945 | printf "%s\n" "Examples:" | |
946 | 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" |
|
946 | 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" | |
947 | echo |
|
947 | echo | |
948 |
|
948 | |||
949 | fi |
|
949 | fi | |
950 | } |
|
950 | } | |
951 |
|
951 | |||
952 | # :command.usage |
|
952 | # :command.usage | |
953 | rcstack_cli_configure_vcsserver_usage() { |
|
953 | rcstack_cli_configure_vcsserver_usage() { | |
954 | if [[ -n $long_usage ]]; then |
|
954 | if [[ -n $long_usage ]]; then | |
955 | printf "rcstack cli configure-vcsserver - reconfigure the vcsserver.ini file\n" |
|
955 | printf "rcstack cli configure-vcsserver - reconfigure the vcsserver.ini file\n" | |
956 | echo |
|
956 | echo | |
957 |
|
957 | |||
958 | else |
|
958 | else | |
959 | printf "rcstack cli configure-vcsserver - reconfigure the vcsserver.ini file\n" |
|
959 | printf "rcstack cli configure-vcsserver - reconfigure the vcsserver.ini file\n" | |
960 | echo |
|
960 | echo | |
961 |
|
961 | |||
962 | fi |
|
962 | fi | |
963 |
|
963 | |||
964 | printf "%s\n" "Usage:" |
|
964 | printf "%s\n" "Usage:" | |
965 | printf " rcstack cli configure-vcsserver INI_PATH\n" |
|
965 | printf " rcstack cli configure-vcsserver INI_PATH\n" | |
966 | printf " rcstack cli configure-vcsserver --help | -h\n" |
|
966 | printf " rcstack cli configure-vcsserver --help | -h\n" | |
967 | echo |
|
967 | echo | |
968 |
|
968 | |||
969 | # :command.long_usage |
|
969 | # :command.long_usage | |
970 | if [[ -n $long_usage ]]; then |
|
970 | if [[ -n $long_usage ]]; then | |
971 | printf "%s\n" "Options:" |
|
971 | printf "%s\n" "Options:" | |
972 |
|
972 | |||
973 | # :command.usage_fixed_flags |
|
973 | # :command.usage_fixed_flags | |
974 | printf " %s\n" "--help, -h" |
|
974 | printf " %s\n" "--help, -h" | |
975 | printf " Show this help\n" |
|
975 | printf " Show this help\n" | |
976 | echo |
|
976 | echo | |
977 |
|
977 | |||
978 | # :command.usage_args |
|
978 | # :command.usage_args | |
979 | printf "%s\n" "Arguments:" |
|
979 | printf "%s\n" "Arguments:" | |
980 |
|
980 | |||
981 | # :argument.usage |
|
981 | # :argument.usage | |
982 | printf " %s\n" "INI_PATH" |
|
982 | printf " %s\n" "INI_PATH" | |
983 | printf " Path to vcsserver.ini to reconfigure\n" |
|
983 | printf " Path to vcsserver.ini to reconfigure\n" | |
984 | echo |
|
984 | echo | |
985 |
|
985 | |||
986 | # :command.usage_examples |
|
986 | # :command.usage_examples | |
987 | printf "%s\n" "Examples:" |
|
987 | printf "%s\n" "Examples:" | |
988 | printf " ./rcstack cli configure-vcs config/_shared/vcsserver.ini\n" |
|
988 | printf " ./rcstack cli configure-vcs config/_shared/vcsserver.ini\n" | |
989 | echo |
|
989 | echo | |
990 |
|
990 | |||
991 | fi |
|
991 | fi | |
992 | } |
|
992 | } | |
993 |
|
993 | |||
994 | # :command.usage |
|
994 | # :command.usage | |
995 | rcstack_cli_configure_rhodecode_usage() { |
|
995 | rcstack_cli_configure_rhodecode_usage() { | |
996 | if [[ -n $long_usage ]]; then |
|
996 | if [[ -n $long_usage ]]; then | |
997 | printf "rcstack cli configure-rhodecode - reconfigure the rhodecode.ini file\n" |
|
997 | printf "rcstack cli configure-rhodecode - reconfigure the rhodecode.ini file\n" | |
998 | echo |
|
998 | echo | |
999 |
|
999 | |||
1000 | else |
|
1000 | else | |
1001 | printf "rcstack cli configure-rhodecode - reconfigure the rhodecode.ini file\n" |
|
1001 | printf "rcstack cli configure-rhodecode - reconfigure the rhodecode.ini file\n" | |
1002 | echo |
|
1002 | echo | |
1003 |
|
1003 | |||
1004 | fi |
|
1004 | fi | |
1005 |
|
1005 | |||
1006 | printf "%s\n" "Usage:" |
|
1006 | printf "%s\n" "Usage:" | |
1007 | printf " rcstack cli configure-rhodecode INI_PATH\n" |
|
1007 | printf " rcstack cli configure-rhodecode INI_PATH\n" | |
1008 | printf " rcstack cli configure-rhodecode --help | -h\n" |
|
1008 | printf " rcstack cli configure-rhodecode --help | -h\n" | |
1009 | echo |
|
1009 | echo | |
1010 |
|
1010 | |||
1011 | # :command.long_usage |
|
1011 | # :command.long_usage | |
1012 | if [[ -n $long_usage ]]; then |
|
1012 | if [[ -n $long_usage ]]; then | |
1013 | printf "%s\n" "Options:" |
|
1013 | printf "%s\n" "Options:" | |
1014 |
|
1014 | |||
1015 | # :command.usage_fixed_flags |
|
1015 | # :command.usage_fixed_flags | |
1016 | printf " %s\n" "--help, -h" |
|
1016 | printf " %s\n" "--help, -h" | |
1017 | printf " Show this help\n" |
|
1017 | printf " Show this help\n" | |
1018 | echo |
|
1018 | echo | |
1019 |
|
1019 | |||
1020 | # :command.usage_args |
|
1020 | # :command.usage_args | |
1021 | printf "%s\n" "Arguments:" |
|
1021 | printf "%s\n" "Arguments:" | |
1022 |
|
1022 | |||
1023 | # :argument.usage |
|
1023 | # :argument.usage | |
1024 | printf " %s\n" "INI_PATH" |
|
1024 | printf " %s\n" "INI_PATH" | |
1025 | printf " Path to rhodecode.ini to reconfigure\n" |
|
1025 | printf " Path to rhodecode.ini to reconfigure\n" | |
1026 | echo |
|
1026 | echo | |
1027 |
|
1027 | |||
1028 | # :command.usage_examples |
|
1028 | # :command.usage_examples | |
1029 | printf "%s\n" "Examples:" |
|
1029 | printf "%s\n" "Examples:" | |
1030 | printf " ./rcstack cli configure-rhodecode config/_shared/rhodecode.ini\n" |
|
1030 | printf " ./rcstack cli configure-rhodecode config/_shared/rhodecode.ini\n" | |
1031 | echo |
|
1031 | echo | |
1032 |
|
1032 | |||
1033 | fi |
|
1033 | fi | |
1034 | } |
|
1034 | } | |
1035 |
|
1035 | |||
1036 | # :command.usage |
|
1036 | # :command.usage | |
1037 | rcstack_backup_db_usage() { |
|
1037 | rcstack_backup_db_usage() { | |
1038 | if [[ -n $long_usage ]]; then |
|
1038 | if [[ -n $long_usage ]]; then | |
1039 | printf "rcstack backup-db - Backup Database\n" |
|
1039 | printf "rcstack backup-db - Backup Database\n" | |
1040 | echo |
|
1040 | echo | |
1041 |
|
1041 | |||
1042 | else |
|
1042 | else | |
1043 | printf "rcstack backup-db - Backup Database\n" |
|
1043 | printf "rcstack backup-db - Backup Database\n" | |
1044 | echo |
|
1044 | echo | |
1045 |
|
1045 | |||
1046 | fi |
|
1046 | fi | |
1047 |
|
1047 | |||
1048 | printf "%s\n" "Usage:" |
|
1048 | printf "%s\n" "Usage:" | |
1049 | printf " rcstack backup-db\n" |
|
1049 | printf " rcstack backup-db\n" | |
1050 | printf " rcstack backup-db --help | -h\n" |
|
1050 | printf " rcstack backup-db --help | -h\n" | |
1051 | echo |
|
1051 | echo | |
1052 |
|
1052 | |||
1053 | # :command.long_usage |
|
1053 | # :command.long_usage | |
1054 | if [[ -n $long_usage ]]; then |
|
1054 | if [[ -n $long_usage ]]; then | |
1055 | printf "%s\n" "Options:" |
|
1055 | printf "%s\n" "Options:" | |
1056 |
|
1056 | |||
1057 | # :command.usage_fixed_flags |
|
1057 | # :command.usage_fixed_flags | |
1058 | printf " %s\n" "--help, -h" |
|
1058 | printf " %s\n" "--help, -h" | |
1059 | printf " Show this help\n" |
|
1059 | printf " Show this help\n" | |
1060 | echo |
|
1060 | echo | |
1061 |
|
1061 | |||
1062 | # :command.usage_examples |
|
1062 | # :command.usage_examples | |
1063 | printf "%s\n" "Examples:" |
|
1063 | printf "%s\n" "Examples:" | |
1064 | printf " # make backup gz compressed from container DB\n - ./rcstack backup-db\n \n # restore backup\n - gunzip your_dump.sql.gz\n - ./rcstack cli db\n - \i /var/rc-data-dump/your_dump.sql\n" |
|
1064 | printf " # make backup gz compressed from container DB\n - ./rcstack backup-db\n \n # restore backup\n - gunzip your_dump.sql.gz\n - ./rcstack cli db\n - \i /var/rc-data-dump/your_dump.sql\n" | |
1065 | echo |
|
1065 | echo | |
1066 |
|
1066 | |||
1067 | fi |
|
1067 | fi | |
1068 | } |
|
1068 | } | |
1069 |
|
1069 | |||
1070 | # :command.usage |
|
1070 | # :command.usage | |
1071 | rcstack_backup_data_usage() { |
|
1071 | rcstack_backup_data_usage() { | |
1072 | if [[ -n $long_usage ]]; then |
|
1072 | if [[ -n $long_usage ]]; then | |
1073 | printf "rcstack backup-data - Backup RhodeCode storage\n" |
|
1073 | printf "rcstack backup-data - Backup RhodeCode storage\n" | |
1074 | echo |
|
1074 | echo | |
1075 |
|
1075 | |||
1076 | else |
|
1076 | else | |
1077 | printf "rcstack backup-data - Backup RhodeCode storage\n" |
|
1077 | printf "rcstack backup-data - Backup RhodeCode storage\n" | |
1078 | echo |
|
1078 | echo | |
1079 |
|
1079 | |||
1080 | fi |
|
1080 | fi | |
1081 |
|
1081 | |||
1082 | printf "%s\n" "Usage:" |
|
1082 | printf "%s\n" "Usage:" | |
1083 | printf " rcstack backup-data\n" |
|
1083 | printf " rcstack backup-data\n" | |
1084 | printf " rcstack backup-data --help | -h\n" |
|
1084 | printf " rcstack backup-data --help | -h\n" | |
1085 | echo |
|
1085 | echo | |
1086 |
|
1086 | |||
1087 | # :command.long_usage |
|
1087 | # :command.long_usage | |
1088 | if [[ -n $long_usage ]]; then |
|
1088 | if [[ -n $long_usage ]]; then | |
1089 | printf "%s\n" "Options:" |
|
1089 | printf "%s\n" "Options:" | |
1090 |
|
1090 | |||
1091 | # :command.usage_fixed_flags |
|
1091 | # :command.usage_fixed_flags | |
1092 | printf " %s\n" "--help, -h" |
|
1092 | printf " %s\n" "--help, -h" | |
1093 | printf " Show this help\n" |
|
1093 | printf " Show this help\n" | |
1094 | echo |
|
1094 | echo | |
1095 |
|
1095 | |||
1096 | # :command.usage_examples |
|
1096 | # :command.usage_examples | |
1097 | printf "%s\n" "Examples:" |
|
1097 | printf "%s\n" "Examples:" | |
1098 | printf " # make backup gz compressed for rhodecode containers, and all volumes\n - ./rcstack backup-data\n" |
|
1098 | printf " # make backup gz compressed for rhodecode containers, and all volumes\n - ./rcstack backup-data\n" | |
1099 | echo |
|
1099 | echo | |
1100 |
|
1100 | |||
1101 | fi |
|
1101 | fi | |
1102 | } |
|
1102 | } | |
1103 |
|
1103 | |||
1104 | # :command.usage |
|
1104 | # :command.usage | |
1105 | rcstack_get_build_artifacts_usage() { |
|
1105 | rcstack_get_build_artifacts_usage() { | |
1106 | if [[ -n $long_usage ]]; then |
|
1106 | if [[ -n $long_usage ]]; then | |
1107 | printf "rcstack get-build-artifacts - Fetch Artifacts to run installer based build\n" |
|
1107 | printf "rcstack get-build-artifacts - Fetch Artifacts to run installer based build\n" | |
1108 | echo |
|
1108 | echo | |
1109 |
|
1109 | |||
1110 | else |
|
1110 | else | |
1111 | printf "rcstack get-build-artifacts - Fetch Artifacts to run installer based build\n" |
|
1111 | printf "rcstack get-build-artifacts - Fetch Artifacts to run installer based build\n" | |
1112 | echo |
|
1112 | echo | |
1113 |
|
1113 | |||
1114 | fi |
|
1114 | fi | |
1115 |
|
1115 | |||
1116 | printf "%s\n" "Usage:" |
|
1116 | printf "%s\n" "Usage:" | |
1117 | printf " rcstack get-build-artifacts [OPTIONS]\n" |
|
1117 | printf " rcstack get-build-artifacts [OPTIONS]\n" | |
1118 | printf " rcstack get-build-artifacts --help | -h\n" |
|
1118 | printf " rcstack get-build-artifacts --help | -h\n" | |
1119 | echo |
|
1119 | echo | |
1120 |
|
1120 | |||
1121 | # :command.long_usage |
|
1121 | # :command.long_usage | |
1122 | if [[ -n $long_usage ]]; then |
|
1122 | if [[ -n $long_usage ]]; then | |
1123 | printf "%s\n" "Options:" |
|
1123 | printf "%s\n" "Options:" | |
1124 |
|
1124 | |||
1125 | # :command.usage_fixed_flags |
|
1125 | # :command.usage_fixed_flags | |
1126 | printf " %s\n" "--help, -h" |
|
1126 | printf " %s\n" "--help, -h" | |
1127 | printf " Show this help\n" |
|
1127 | printf " Show this help\n" | |
1128 | echo |
|
1128 | echo | |
1129 |
|
1129 | |||
1130 | # :command.usage_flags |
|
1130 | # :command.usage_flags | |
1131 | # :flag.usage |
|
1131 | # :flag.usage | |
1132 | printf " %s\n" "--auth AUTH" |
|
1132 | printf " %s\n" "--auth AUTH" | |
1133 | printf " Specify custom auth for curl e.g -u admin:secret\n" |
|
1133 | printf " Specify custom auth for curl e.g -u admin:secret\n" | |
1134 | printf " Default: \n" |
|
1134 | printf " Default: \n" | |
1135 | echo |
|
1135 | echo | |
1136 |
|
1136 | |||
1137 | # :flag.usage |
|
1137 | # :flag.usage | |
1138 | printf " %s\n" "--installer-url INSTALLER_URL" |
|
1138 | printf " %s\n" "--installer-url INSTALLER_URL" | |
1139 | printf " Installer Download URL\n" |
|
1139 | printf " Installer Download URL\n" | |
1140 | printf " Default: https://dls.rhodecode.com/dls/N2E2ZTY1NzA3NjYxNDA2NTc1NjI3MTcyNzA2MjcxNzIyZTcwNjI3YQ==/rhodecode-control/latest-linux-ee\n" |
|
1140 | printf " Default: https://dls.rhodecode.com/dls/N2E2ZTY1NzA3NjYxNDA2NTc1NjI3MTcyNzA2MjcxNzIyZTcwNjI3YQ==/rhodecode-control/latest-linux-ee\n" | |
1141 | echo |
|
1141 | echo | |
1142 |
|
1142 | |||
1143 | # :flag.usage |
|
1143 | # :flag.usage | |
1144 | printf " %s\n" "--manifest-url MANIFEST_URL" |
|
1144 | printf " %s\n" "--manifest-url MANIFEST_URL" | |
1145 | printf " Manifest file url\n" |
|
1145 | printf " Manifest file url\n" | |
1146 | printf " Default: https://dls.rhodecode.com/linux/MANIFEST\n" |
|
1146 | printf " Default: https://dls.rhodecode.com/linux/MANIFEST\n" | |
1147 | echo |
|
1147 | echo | |
1148 |
|
1148 | |||
1149 | # :flag.usage |
|
1149 | # :flag.usage | |
1150 | printf " %s\n" "--version-name VERSION_NAME" |
|
1150 | printf " %s\n" "--version-name VERSION_NAME" | |
1151 | printf " Specify custom build ver e.g 4.27.0\n" |
|
1151 | printf " Specify custom build ver e.g 4.27.0\n" | |
1152 | printf " Default: $RC_CLI_VERSION_NAME\n" |
|
1152 | printf " Default: $RC_CLI_VERSION_NAME\n" | |
1153 | echo |
|
1153 | echo | |
1154 |
|
1154 | |||
1155 | fi |
|
1155 | fi | |
1156 | } |
|
1156 | } | |
1157 |
|
1157 | |||
1158 | # :command.usage |
|
1158 | # :command.usage | |
1159 | rcstack_build_installer_usage() { |
|
1159 | rcstack_build_installer_usage() { | |
1160 | if [[ -n $long_usage ]]; then |
|
1160 | if [[ -n $long_usage ]]; then | |
1161 | printf "rcstack build-installer - Build RhodeCode image from installer, ./rcstack get-build-artifacts initially\n" |
|
1161 | printf "rcstack build-installer - Build RhodeCode image from installer, ./rcstack get-build-artifacts initially\n" | |
1162 | echo |
|
1162 | echo | |
1163 |
|
1163 | |||
1164 | else |
|
1164 | else | |
1165 | printf "rcstack build-installer - Build RhodeCode image from installer, ./rcstack get-build-artifacts initially\n" |
|
1165 | printf "rcstack build-installer - Build RhodeCode image from installer, ./rcstack get-build-artifacts initially\n" | |
1166 | echo |
|
1166 | echo | |
1167 |
|
1167 | |||
1168 | fi |
|
1168 | fi | |
1169 |
|
1169 | |||
1170 | printf "%s\n" "Usage:" |
|
1170 | printf "%s\n" "Usage:" | |
1171 | printf " rcstack build-installer [OPTIONS]\n" |
|
1171 | printf " rcstack build-installer [OPTIONS]\n" | |
1172 | printf " rcstack build-installer --help | -h\n" |
|
1172 | printf " rcstack build-installer --help | -h\n" | |
1173 | echo |
|
1173 | echo | |
1174 |
|
1174 | |||
1175 | # :command.long_usage |
|
1175 | # :command.long_usage | |
1176 | if [[ -n $long_usage ]]; then |
|
1176 | if [[ -n $long_usage ]]; then | |
1177 | printf "%s\n" "Options:" |
|
1177 | printf "%s\n" "Options:" | |
1178 |
|
1178 | |||
1179 | # :command.usage_fixed_flags |
|
1179 | # :command.usage_fixed_flags | |
1180 | printf " %s\n" "--help, -h" |
|
1180 | printf " %s\n" "--help, -h" | |
1181 | printf " Show this help\n" |
|
1181 | printf " Show this help\n" | |
1182 | echo |
|
1182 | echo | |
1183 |
|
1183 | |||
1184 | # :command.usage_flags |
|
1184 | # :command.usage_flags | |
1185 | # :flag.usage |
|
1185 | # :flag.usage | |
1186 | printf " %s\n" "--version-name VERSION_NAME" |
|
1186 | printf " %s\n" "--version-name VERSION_NAME" | |
1187 | printf " Specify custom build ver e.g 4.27.0\n" |
|
1187 | printf " Specify custom build ver e.g 4.27.0\n" | |
1188 | printf " Default: $RC_CLI_VERSION_NAME\n" |
|
1188 | printf " Default: $RC_CLI_VERSION_NAME\n" | |
1189 | echo |
|
1189 | echo | |
1190 |
|
1190 | |||
1191 | fi |
|
1191 | fi | |
1192 | } |
|
1192 | } | |
1193 |
|
1193 | |||
1194 | # :command.usage |
|
1194 | # :command.usage | |
1195 | rcstack_get_build_source_usage() { |
|
1195 | rcstack_get_build_source_usage() { | |
1196 | if [[ -n $long_usage ]]; then |
|
1196 | if [[ -n $long_usage ]]; then | |
1197 | printf "rcstack get-build-source - Fetch RhodeCode sources, store in .source dir to run a source-based builds\n" |
|
1197 | printf "rcstack get-build-source - Fetch RhodeCode sources, store in .source dir to run a source-based builds\n" | |
1198 | echo |
|
1198 | echo | |
1199 |
|
1199 | |||
1200 | else |
|
1200 | else | |
1201 | printf "rcstack get-build-source - Fetch RhodeCode sources, store in .source dir to run a source-based builds\n" |
|
1201 | printf "rcstack get-build-source - Fetch RhodeCode sources, store in .source dir to run a source-based builds\n" | |
1202 | echo |
|
1202 | echo | |
1203 |
|
1203 | |||
1204 | fi |
|
1204 | fi | |
1205 |
|
1205 | |||
1206 | printf "%s\n" "Usage:" |
|
1206 | printf "%s\n" "Usage:" | |
1207 | printf " rcstack get-build-source [OPTIONS]\n" |
|
1207 | printf " rcstack get-build-source [OPTIONS]\n" | |
1208 | printf " rcstack get-build-source --help | -h\n" |
|
1208 | printf " rcstack get-build-source --help | -h\n" | |
1209 | echo |
|
1209 | echo | |
1210 |
|
1210 | |||
1211 | # :command.long_usage |
|
1211 | # :command.long_usage | |
1212 | if [[ -n $long_usage ]]; then |
|
1212 | if [[ -n $long_usage ]]; then | |
1213 | printf "%s\n" "Options:" |
|
1213 | printf "%s\n" "Options:" | |
1214 |
|
1214 | |||
1215 | # :command.usage_fixed_flags |
|
1215 | # :command.usage_fixed_flags | |
1216 | printf " %s\n" "--help, -h" |
|
1216 | printf " %s\n" "--help, -h" | |
1217 | printf " Show this help\n" |
|
1217 | printf " Show this help\n" | |
1218 | echo |
|
1218 | echo | |
1219 |
|
1219 | |||
1220 | # :command.usage_flags |
|
1220 | # :command.usage_flags | |
1221 | # :flag.usage |
|
1221 | # :flag.usage | |
1222 | printf " %s\n" "--revision REVISION" |
|
1222 | printf " %s\n" "--revision REVISION" | |
1223 | printf " revision to download\n" |
|
1223 | printf " revision to download\n" | |
1224 | printf " Default: default\n" |
|
1224 | printf " Default: default\n" | |
1225 | echo |
|
1225 | echo | |
1226 |
|
1226 | |||
1227 | # :flag.usage |
|
1227 | # :flag.usage | |
1228 | printf " %s\n" "--auth-token AUTH_TOKEN" |
|
1228 | printf " %s\n" "--auth-token AUTH_TOKEN" | |
1229 | printf " Specify AUTH TOKEN to obtain sources\n" |
|
1229 | printf " Specify AUTH TOKEN to obtain sources\n" | |
1230 | echo |
|
1230 | echo | |
1231 |
|
1231 | |||
1232 | # :flag.usage |
|
1232 | # :flag.usage | |
1233 | printf " %s\n" "--server-url SERVER_URL" |
|
1233 | printf " %s\n" "--server-url SERVER_URL" | |
1234 | printf " Specify RhodeCode server location where projects should be downloaded\n" |
|
1234 | printf " Specify RhodeCode server location where projects should be downloaded\n" | |
1235 | printf " Default: https://code.rhodecode.com\n" |
|
1235 | printf " Default: https://code.rhodecode.com\n" | |
1236 | echo |
|
1236 | echo | |
1237 |
|
1237 | |||
1238 | # :command.usage_examples |
|
1238 | # :command.usage_examples | |
1239 | printf "%s\n" "Examples:" |
|
1239 | printf "%s\n" "Examples:" | |
1240 | printf " ./rcstack get-sources $RC_CLI_VERSION_NAME\n" |
|
1240 | printf " ./rcstack get-sources $RC_CLI_VERSION_NAME\n" | |
1241 | printf " ./rcstack get-sources default --auth-token xyxyxyx --server-url\n https://secret.repo/\n" |
|
1241 | printf " ./rcstack get-sources default --auth-token xyxyxyx --server-url\n https://secret.repo/\n" | |
1242 | echo |
|
1242 | echo | |
1243 |
|
1243 | |||
1244 | fi |
|
1244 | fi | |
1245 | } |
|
1245 | } | |
1246 |
|
1246 | |||
1247 | # :command.usage |
|
1247 | # :command.usage | |
1248 | rcstack_build_source_usage() { |
|
1248 | rcstack_build_source_usage() { | |
1249 | if [[ -n $long_usage ]]; then |
|
1249 | if [[ -n $long_usage ]]; then | |
1250 | printf "rcstack build-source - Build RhodeCode image from source, requires ./rcstack get-build-source initially\n" |
|
1250 | printf "rcstack build-source - Build RhodeCode image from source, requires ./rcstack get-build-source initially\n" | |
1251 | echo |
|
1251 | echo | |
1252 |
|
1252 | |||
1253 | else |
|
1253 | else | |
1254 | printf "rcstack build-source - Build RhodeCode image from source, requires ./rcstack get-build-source initially\n" |
|
1254 | printf "rcstack build-source - Build RhodeCode image from source, requires ./rcstack get-build-source initially\n" | |
1255 | echo |
|
1255 | echo | |
1256 |
|
1256 | |||
1257 | fi |
|
1257 | fi | |
1258 |
|
1258 | |||
1259 | printf "%s\n" "Usage:" |
|
1259 | printf "%s\n" "Usage:" | |
1260 | printf " rcstack build-source [OPTIONS]\n" |
|
1260 | printf " rcstack build-source [OPTIONS]\n" | |
1261 | printf " rcstack build-source --help | -h\n" |
|
1261 | printf " rcstack build-source --help | -h\n" | |
1262 | echo |
|
1262 | echo | |
1263 |
|
1263 | |||
1264 | # :command.long_usage |
|
1264 | # :command.long_usage | |
1265 | if [[ -n $long_usage ]]; then |
|
1265 | if [[ -n $long_usage ]]; then | |
1266 | printf "%s\n" "Options:" |
|
1266 | printf "%s\n" "Options:" | |
1267 |
|
1267 | |||
1268 | # :command.usage_fixed_flags |
|
1268 | # :command.usage_fixed_flags | |
1269 | printf " %s\n" "--help, -h" |
|
1269 | printf " %s\n" "--help, -h" | |
1270 | printf " Show this help\n" |
|
1270 | printf " Show this help\n" | |
1271 | echo |
|
1271 | echo | |
1272 |
|
1272 | |||
1273 | # :command.usage_flags |
|
1273 | # :command.usage_flags | |
1274 | # :flag.usage |
|
1274 | # :flag.usage | |
1275 | printf " %s\n" "--version-name VERSION_NAME" |
|
1275 | printf " %s\n" "--version-name VERSION_NAME" | |
1276 | printf " Specify custom build ver e.g 4.27.0\n" |
|
1276 | printf " Specify custom build ver e.g 4.27.0\n" | |
1277 | printf " Default: $RC_CLI_VERSION_NAME\n" |
|
1277 | printf " Default: $RC_CLI_VERSION_NAME\n" | |
1278 | echo |
|
1278 | echo | |
1279 |
|
1279 | |||
1280 | # :flag.usage |
|
1280 | # :flag.usage | |
1281 | printf " %s\n" "--tag TAG (repeatable)" |
|
1281 | printf " %s\n" "--tag TAG (repeatable)" | |
1282 | printf " tag build image\n" |
|
1282 | printf " tag build image\n" | |
1283 | echo |
|
1283 | echo | |
1284 |
|
1284 | |||
1285 | # :command.usage_examples |
|
1285 | # :command.usage_examples | |
1286 | printf "%s\n" "Examples:" |
|
1286 | printf "%s\n" "Examples:" | |
1287 | printf " ./rcstack build-source --version-name 4.28.0.REL.2023.02.02.1\n" |
|
1287 | printf " ./rcstack build-source --version-name 4.28.0.REL.2023.02.02.1\n" | |
1288 | echo |
|
1288 | echo | |
1289 |
|
1289 | |||
1290 | fi |
|
1290 | fi | |
1291 | } |
|
1291 | } | |
1292 |
|
1292 | |||
1293 | # :command.usage |
|
1293 | # :command.usage | |
1294 | rcstack__completions_usage() { |
|
1294 | rcstack__completions_usage() { | |
1295 | if [[ -n $long_usage ]]; then |
|
1295 | if [[ -n $long_usage ]]; then | |
1296 | printf "rcstack _completions - Generate completions\n" |
|
1296 | printf "rcstack _completions - Generate completions\n" | |
1297 | echo |
|
1297 | echo | |
1298 |
|
1298 | |||
1299 | else |
|
1299 | else | |
1300 | printf "rcstack _completions - Generate completions\n" |
|
1300 | printf "rcstack _completions - Generate completions\n" | |
1301 | echo |
|
1301 | echo | |
1302 |
|
1302 | |||
1303 | fi |
|
1303 | fi | |
1304 |
|
1304 | |||
1305 | printf "%s\n" "Usage:" |
|
1305 | printf "%s\n" "Usage:" | |
1306 | printf " rcstack _completions\n" |
|
1306 | printf " rcstack _completions\n" | |
1307 | printf " rcstack _completions --help | -h\n" |
|
1307 | printf " rcstack _completions --help | -h\n" | |
1308 | echo |
|
1308 | echo | |
1309 |
|
1309 | |||
1310 | # :command.long_usage |
|
1310 | # :command.long_usage | |
1311 | if [[ -n $long_usage ]]; then |
|
1311 | if [[ -n $long_usage ]]; then | |
1312 | printf "%s\n" "Options:" |
|
1312 | printf "%s\n" "Options:" | |
1313 |
|
1313 | |||
1314 | # :command.usage_fixed_flags |
|
1314 | # :command.usage_fixed_flags | |
1315 | printf " %s\n" "--help, -h" |
|
1315 | printf " %s\n" "--help, -h" | |
1316 | printf " Show this help\n" |
|
1316 | printf " Show this help\n" | |
1317 | echo |
|
1317 | echo | |
1318 |
|
1318 | |||
1319 | fi |
|
1319 | fi | |
1320 | } |
|
1320 | } | |
1321 |
|
1321 | |||
1322 | # :command.normalize_input |
|
1322 | # :command.normalize_input | |
1323 | normalize_input() { |
|
1323 | normalize_input() { | |
1324 | local arg flags |
|
1324 | local arg flags | |
1325 |
|
1325 | |||
1326 | while [[ $# -gt 0 ]]; do |
|
1326 | while [[ $# -gt 0 ]]; do | |
1327 | arg="$1" |
|
1327 | arg="$1" | |
1328 | if [[ $arg =~ ^(--[a-zA-Z0-9_\-]+)=(.+)$ ]]; then |
|
1328 | if [[ $arg =~ ^(--[a-zA-Z0-9_\-]+)=(.+)$ ]]; then | |
1329 | input+=("${BASH_REMATCH[1]}") |
|
1329 | input+=("${BASH_REMATCH[1]}") | |
1330 | input+=("${BASH_REMATCH[2]}") |
|
1330 | input+=("${BASH_REMATCH[2]}") | |
1331 | elif [[ $arg =~ ^(-[a-zA-Z0-9])=(.+)$ ]]; then |
|
1331 | elif [[ $arg =~ ^(-[a-zA-Z0-9])=(.+)$ ]]; then | |
1332 | input+=("${BASH_REMATCH[1]}") |
|
1332 | input+=("${BASH_REMATCH[1]}") | |
1333 | input+=("${BASH_REMATCH[2]}") |
|
1333 | input+=("${BASH_REMATCH[2]}") | |
1334 | elif [[ $arg =~ ^-([a-zA-Z0-9][a-zA-Z0-9]+)$ ]]; then |
|
1334 | elif [[ $arg =~ ^-([a-zA-Z0-9][a-zA-Z0-9]+)$ ]]; then | |
1335 | flags="${BASH_REMATCH[1]}" |
|
1335 | flags="${BASH_REMATCH[1]}" | |
1336 | for ((i = 0; i < ${#flags}; i++)); do |
|
1336 | for ((i = 0; i < ${#flags}; i++)); do | |
1337 | input+=("-${flags:i:1}") |
|
1337 | input+=("-${flags:i:1}") | |
1338 | done |
|
1338 | done | |
1339 | else |
|
1339 | else | |
1340 | input+=("$arg") |
|
1340 | input+=("$arg") | |
1341 | fi |
|
1341 | fi | |
1342 |
|
1342 | |||
1343 | shift |
|
1343 | shift | |
1344 | done |
|
1344 | done | |
1345 | } |
|
1345 | } | |
1346 | # :command.inspect_args |
|
1346 | # :command.inspect_args | |
1347 | inspect_args() { |
|
1347 | inspect_args() { | |
1348 | readarray -t sorted_keys < <(printf '%s\n' "${!args[@]}" | sort) |
|
1348 | readarray -t sorted_keys < <(printf '%s\n' "${!args[@]}" | sort) | |
1349 | if ((${#args[@]})); then |
|
1349 | if ((${#args[@]})); then | |
1350 | echo args: |
|
1350 | echo args: | |
1351 | for k in "${sorted_keys[@]}"; do echo "- \${args[$k]} = ${args[$k]}"; done |
|
1351 | for k in "${sorted_keys[@]}"; do echo "- \${args[$k]} = ${args[$k]}"; done | |
1352 | else |
|
1352 | else | |
1353 | echo args: none |
|
1353 | echo args: none | |
1354 | fi |
|
1354 | fi | |
1355 |
|
1355 | |||
1356 | if ((${#other_args[@]})); then |
|
1356 | if ((${#other_args[@]})); then | |
1357 | echo |
|
1357 | echo | |
1358 | echo other_args: |
|
1358 | echo other_args: | |
1359 | echo "- \${other_args[*]} = ${other_args[*]}" |
|
1359 | echo "- \${other_args[*]} = ${other_args[*]}" | |
1360 | for i in "${!other_args[@]}"; do |
|
1360 | for i in "${!other_args[@]}"; do | |
1361 | echo "- \${other_args[$i]} = ${other_args[$i]}" |
|
1361 | echo "- \${other_args[$i]} = ${other_args[$i]}" | |
1362 | done |
|
1362 | done | |
1363 | fi |
|
1363 | fi | |
1364 | } |
|
1364 | } | |
1365 |
|
1365 | |||
1366 | # :command.user_lib |
|
1366 | # :command.user_lib | |
1367 | # src/lib/check_bootstrap.sh |
|
1367 | # src/lib/check_bootstrap.sh | |
1368 |
|
1368 | |||
1369 | check_bootstrap() { |
|
1369 | check_bootstrap() { | |
1370 | # Avoid destroying bootstrapping by simple start/stop |
|
1370 | # Avoid destroying bootstrapping by simple start/stop | |
1371 | for stage in $BOOTSTRAP_STAGES; do |
|
1371 | for stage in $BOOTSTRAP_STAGES; do | |
1372 |
|
1372 | |||
1373 | stage_name=$(echo $stage | cut -d ":" -f 1) |
|
1373 | stage_name=$(echo $stage | cut -d ":" -f 1) | |
1374 | stage_func=$(echo $stage | cut -d ":" -f 2) |
|
1374 | stage_func=$(echo $stage | cut -d ":" -f 2) | |
1375 | if ! config_has_key $stage_name ; then |
|
1375 | if ! config_has_key $stage_name ; then | |
1376 | echo "$(yellow WARNING:) bootstrap key $stage_name not found in config file $CONFIG_FILE!" |
|
1376 | echo "$(yellow WARNING:) bootstrap key $stage_name not found in config file $CONFIG_FILE!" | |
1377 | echo "$(yellow NOTICE:) Please run ./$RC_SCRIPT_NAME init first" |
|
1377 | echo "$(yellow NOTICE:) Please run ./$RC_SCRIPT_NAME init first" | |
1378 | exit |
|
1378 | exit | |
1379 | fi |
|
1379 | fi | |
1380 | done |
|
1380 | done | |
1381 |
|
1381 | |||
1382 | } |
|
1382 | } | |
1383 |
|
1383 | |||
1384 | # src/lib/colors.sh |
|
1384 | # src/lib/colors.sh | |
1385 | print_in_color() { |
|
1385 | print_in_color() { | |
1386 | local color="$1" |
|
1386 | local color="$1" | |
1387 | shift |
|
1387 | shift | |
1388 | if [[ -z ${NO_COLOR+x} ]]; then |
|
1388 | if [[ -z ${NO_COLOR+x} ]]; then | |
1389 | printf "$color%b\e[0m\n" "$*" |
|
1389 | printf "$color%b\e[0m\n" "$*" | |
1390 | else |
|
1390 | else | |
1391 | printf "%b\n" "$*" |
|
1391 | printf "%b\n" "$*" | |
1392 | fi |
|
1392 | fi | |
1393 | } |
|
1393 | } | |
1394 |
|
1394 | |||
1395 | red() { print_in_color "\e[31m" "$*"; } |
|
1395 | red() { print_in_color "\e[31m" "$*"; } | |
1396 | green() { print_in_color "\e[32m" "$*"; } |
|
1396 | green() { print_in_color "\e[32m" "$*"; } | |
1397 | yellow() { print_in_color "\e[33m" "$*"; } |
|
1397 | yellow() { print_in_color "\e[33m" "$*"; } | |
1398 | blue() { print_in_color "\e[34m" "$*"; } |
|
1398 | blue() { print_in_color "\e[34m" "$*"; } | |
1399 | magenta() { print_in_color "\e[35m" "$*"; } |
|
1399 | magenta() { print_in_color "\e[35m" "$*"; } | |
1400 | cyan() { print_in_color "\e[36m" "$*"; } |
|
1400 | cyan() { print_in_color "\e[36m" "$*"; } | |
1401 | bold() { print_in_color "\e[1m" "$*"; } |
|
1401 | bold() { print_in_color "\e[1m" "$*"; } | |
1402 | underlined() { print_in_color "\e[4m" "$*"; } |
|
1402 | underlined() { print_in_color "\e[4m" "$*"; } | |
1403 | red_bold() { print_in_color "\e[1;31m" "$*"; } |
|
1403 | red_bold() { print_in_color "\e[1;31m" "$*"; } | |
1404 | green_bold() { print_in_color "\e[1;32m" "$*"; } |
|
1404 | green_bold() { print_in_color "\e[1;32m" "$*"; } | |
1405 | yellow_bold() { print_in_color "\e[1;33m" "$*"; } |
|
1405 | yellow_bold() { print_in_color "\e[1;33m" "$*"; } | |
1406 | blue_bold() { print_in_color "\e[1;34m" "$*"; } |
|
1406 | blue_bold() { print_in_color "\e[1;34m" "$*"; } | |
1407 | magenta_bold() { print_in_color "\e[1;35m" "$*"; } |
|
1407 | magenta_bold() { print_in_color "\e[1;35m" "$*"; } | |
1408 | cyan_bold() { print_in_color "\e[1;36m" "$*"; } |
|
1408 | cyan_bold() { print_in_color "\e[1;36m" "$*"; } | |
1409 | red_underlined() { print_in_color "\e[4;31m" "$*"; } |
|
1409 | red_underlined() { print_in_color "\e[4;31m" "$*"; } | |
1410 | green_underlined() { print_in_color "\e[4;32m" "$*"; } |
|
1410 | green_underlined() { print_in_color "\e[4;32m" "$*"; } | |
1411 | yellow_underlined() { print_in_color "\e[4;33m" "$*"; } |
|
1411 | yellow_underlined() { print_in_color "\e[4;33m" "$*"; } | |
1412 | blue_underlined() { print_in_color "\e[4;34m" "$*"; } |
|
1412 | blue_underlined() { print_in_color "\e[4;34m" "$*"; } | |
1413 | magenta_underlined() { print_in_color "\e[4;35m" "$*"; } |
|
1413 | magenta_underlined() { print_in_color "\e[4;35m" "$*"; } | |
1414 | cyan_underlined() { print_in_color "\e[4;36m" "$*"; } |
|
1414 | cyan_underlined() { print_in_color "\e[4;36m" "$*"; } | |
1415 |
|
1415 | |||
1416 | # src/lib/config.sh |
|
1416 | # src/lib/config.sh | |
1417 | config_init() { |
|
1417 | config_init() { | |
1418 | CONFIG_FILE=${CONFIG_FILE:=config.ini} |
|
1418 | CONFIG_FILE=${CONFIG_FILE:=config.ini} | |
1419 | [[ -f "$CONFIG_FILE" ]] || touch "$CONFIG_FILE" |
|
1419 | [[ -f "$CONFIG_FILE" ]] || touch "$CONFIG_FILE" | |
1420 | } |
|
1420 | } | |
1421 |
|
1421 | |||
1422 | config_get() { |
|
1422 | config_get() { | |
1423 | local key=$1 |
|
1423 | local key=$1 | |
1424 | local regex="^$key *= *(.+)$" |
|
1424 | local regex="^$key *= *(.+)$" | |
1425 | local value="" |
|
1425 | local value="" | |
1426 |
|
1426 | |||
1427 | config_init |
|
1427 | config_init | |
1428 |
|
1428 | |||
1429 | while IFS= read -r line || [ -n "$line" ]; do |
|
1429 | while IFS= read -r line || [ -n "$line" ]; do | |
1430 | if [[ $line =~ $regex ]]; then |
|
1430 | if [[ $line =~ $regex ]]; then | |
1431 | value="${BASH_REMATCH[1]}" |
|
1431 | value="${BASH_REMATCH[1]}" | |
1432 | break |
|
1432 | break | |
1433 | fi |
|
1433 | fi | |
1434 | done <"$CONFIG_FILE" |
|
1434 | done <"$CONFIG_FILE" | |
1435 |
|
1435 | |||
1436 | echo "$value" |
|
1436 | echo "$value" | |
1437 | } |
|
1437 | } | |
1438 |
|
1438 | |||
1439 | config_set() { |
|
1439 | config_set() { | |
1440 | local key=$1 |
|
1440 | local key=$1 | |
1441 | shift |
|
1441 | shift | |
1442 | local value="$*" |
|
1442 | local value="$*" | |
1443 |
|
1443 | |||
1444 | config_init |
|
1444 | config_init | |
1445 |
|
1445 | |||
1446 | local regex="^($key) *= *.+$" |
|
1446 | local regex="^($key) *= *.+$" | |
1447 | local output="" |
|
1447 | local output="" | |
1448 | local found_key="" |
|
1448 | local found_key="" | |
1449 | local newline |
|
1449 | local newline | |
1450 |
|
1450 | |||
1451 | while IFS= read -r line || [ -n "$line" ]; do |
|
1451 | while IFS= read -r line || [ -n "$line" ]; do | |
1452 | newline=$line |
|
1452 | newline=$line | |
1453 | if [[ $line =~ $regex ]]; then |
|
1453 | if [[ $line =~ $regex ]]; then | |
1454 | found_key="${BASH_REMATCH[1]}" |
|
1454 | found_key="${BASH_REMATCH[1]}" | |
1455 | newline="$key = $value" |
|
1455 | newline="$key = $value" | |
1456 | output="$output$newline\n" |
|
1456 | output="$output$newline\n" | |
1457 | elif [[ $line ]]; then |
|
1457 | elif [[ $line ]]; then | |
1458 | output="$output$line\n" |
|
1458 | output="$output$line\n" | |
1459 | fi |
|
1459 | fi | |
1460 | done <"$CONFIG_FILE" |
|
1460 | done <"$CONFIG_FILE" | |
1461 |
|
1461 | |||
1462 | if [[ -z $found_key ]]; then |
|
1462 | if [[ -z $found_key ]]; then | |
1463 | output="$output$key = $value\n" |
|
1463 | output="$output$key = $value\n" | |
1464 | fi |
|
1464 | fi | |
1465 |
|
1465 | |||
1466 | printf "%b\n" "$output" >"$CONFIG_FILE" |
|
1466 | printf "%b\n" "$output" >"$CONFIG_FILE" | |
1467 | } |
|
1467 | } | |
1468 |
|
1468 | |||
1469 | config_del() { |
|
1469 | config_del() { | |
1470 | local key=$1 |
|
1470 | local key=$1 | |
1471 |
|
1471 | |||
1472 | local regex="^($key) *=" |
|
1472 | local regex="^($key) *=" | |
1473 | local output="" |
|
1473 | local output="" | |
1474 |
|
1474 | |||
1475 | config_init |
|
1475 | config_init | |
1476 |
|
1476 | |||
1477 | while IFS= read -r line || [ -n "$line" ]; do |
|
1477 | while IFS= read -r line || [ -n "$line" ]; do | |
1478 | if [[ $line ]] && [[ ! $line =~ $regex ]]; then |
|
1478 | if [[ $line ]] && [[ ! $line =~ $regex ]]; then | |
1479 | output="$output$line\n" |
|
1479 | output="$output$line\n" | |
1480 | fi |
|
1480 | fi | |
1481 | done <"$CONFIG_FILE" |
|
1481 | done <"$CONFIG_FILE" | |
1482 |
|
1482 | |||
1483 | printf "%b\n" "$output" >"$CONFIG_FILE" |
|
1483 | printf "%b\n" "$output" >"$CONFIG_FILE" | |
1484 | } |
|
1484 | } | |
1485 |
|
1485 | |||
1486 | config_show() { |
|
1486 | config_show() { | |
1487 | config_init |
|
1487 | config_init | |
1488 | cat "$CONFIG_FILE" |
|
1488 | cat "$CONFIG_FILE" | |
1489 | } |
|
1489 | } | |
1490 |
|
1490 | |||
1491 | config_keys() { |
|
1491 | config_keys() { | |
1492 | local regex="^([a-zA-Z0-9_\-\/\.]+) *=" |
|
1492 | local regex="^([a-zA-Z0-9_\-\/\.]+) *=" | |
1493 |
|
1493 | |||
1494 | config_init |
|
1494 | config_init | |
1495 |
|
1495 | |||
1496 | local keys=() |
|
1496 | local keys=() | |
1497 | local key |
|
1497 | local key | |
1498 |
|
1498 | |||
1499 | while IFS= read -r line || [ -n "$line" ]; do |
|
1499 | while IFS= read -r line || [ -n "$line" ]; do | |
1500 | if [[ $line =~ $regex ]]; then |
|
1500 | if [[ $line =~ $regex ]]; then | |
1501 | key="${BASH_REMATCH[1]}" |
|
1501 | key="${BASH_REMATCH[1]}" | |
1502 | keys+=("$key") |
|
1502 | keys+=("$key") | |
1503 | fi |
|
1503 | fi | |
1504 | done <"$CONFIG_FILE" |
|
1504 | done <"$CONFIG_FILE" | |
1505 | echo "${keys[@]}" |
|
1505 | echo "${keys[@]}" | |
1506 | } |
|
1506 | } | |
1507 |
|
1507 | |||
1508 | config_has_key() { |
|
1508 | config_has_key() { | |
1509 | [[ $(config_get "$1") ]] |
|
1509 | [[ $(config_get "$1") ]] | |
1510 | } |
|
1510 | } | |
1511 |
|
1511 | |||
1512 | # src/lib/dotenv.sh |
|
1512 | # src/lib/dotenv.sh | |
1513 |
|
1513 | |||
1514 | __dotenv= |
|
1514 | __dotenv= | |
1515 | __dotenv_file= |
|
1515 | __dotenv_file= | |
1516 | __dotenv_cmd=.env |
|
1516 | __dotenv_cmd=.env | |
1517 |
|
1517 | |||
1518 | .env() { |
|
1518 | .env() { | |
1519 | REPLY=() |
|
1519 | REPLY=() | |
1520 | [[ $__dotenv_file || ${1-} == -* ]] || .env.--file .env || return |
|
1520 | [[ $__dotenv_file || ${1-} == -* ]] || .env.--file .env || return | |
1521 | if declare -F -- ".env.${1-}" >/dev/null; then .env."$@"; return ; fi |
|
1521 | if declare -F -- ".env.${1-}" >/dev/null; then .env."$@"; return ; fi | |
1522 | .env --help >&2; return 64 |
|
1522 | .env --help >&2; return 64 | |
1523 | } |
|
1523 | } | |
1524 |
|
1524 | |||
1525 | .env.-f() { .env.--file "$@"; } |
|
1525 | .env.-f() { .env.--file "$@"; } | |
1526 |
|
1526 | |||
1527 | .env.get() { |
|
1527 | .env.get() { | |
1528 | .env::arg "get requires a key" "$@" && |
|
1528 | .env::arg "get requires a key" "$@" && | |
1529 | [[ "$__dotenv" =~ ^(.*(^|$'\n'))([ ]*)"$1="(.*)$ ]] && |
|
1529 | [[ "$__dotenv" =~ ^(.*(^|$'\n'))([ ]*)"$1="(.*)$ ]] && | |
1530 | REPLY=${BASH_REMATCH[4]%%$'\n'*} && REPLY=${REPLY%"${REPLY##*[![:space:]]}"} |
|
1530 | REPLY=${BASH_REMATCH[4]%%$'\n'*} && REPLY=${REPLY%"${REPLY##*[![:space:]]}"} | |
1531 | } |
|
1531 | } | |
1532 |
|
1532 | |||
1533 | .env.parse() { |
|
1533 | .env.parse() { | |
1534 | local line key |
|
1534 | local line key | |
1535 | while IFS= read -r line; do |
|
1535 | while IFS= read -r line; do | |
1536 | line=${line#"${line%%[![:space:]]*}"} # trim leading whitespace |
|
1536 | line=${line#"${line%%[![:space:]]*}"} # trim leading whitespace | |
1537 | line=${line%"${line##*[![:space:]]}"} # trim trailing whitespace |
|
1537 | line=${line%"${line##*[![:space:]]}"} # trim trailing whitespace | |
1538 | if [[ ! "$line" || "$line" == '#'* ]]; then continue ; fi |
|
1538 | if [[ ! "$line" || "$line" == '#'* ]]; then continue ; fi | |
1539 | if (($#)); then |
|
1539 | if (($#)); then | |
1540 | for key; do |
|
1540 | for key; do | |
1541 | if [[ $key == "${line%%=*}" ]]; then REPLY+=("$line"); break; |
|
1541 | if [[ $key == "${line%%=*}" ]]; then REPLY+=("$line"); break; | |
1542 | fi |
|
1542 | fi | |
1543 | done |
|
1543 | done | |
1544 | else |
|
1544 | else | |
1545 | REPLY+=("$line") |
|
1545 | REPLY+=("$line") | |
1546 | fi |
|
1546 | fi | |
1547 | done <<<"$__dotenv" |
|
1547 | done <<<"$__dotenv" | |
1548 | ((${#REPLY[@]})) |
|
1548 | ((${#REPLY[@]})) | |
1549 | } |
|
1549 | } | |
1550 |
|
1550 | |||
1551 | .env.export() { ! .env.parse "$@" || export "${REPLY[@]}"; } |
|
1551 | .env.export() { ! .env.parse "$@" || export "${REPLY[@]}"; } | |
1552 |
|
1552 | |||
1553 | .env.set() { |
|
1553 | .env.set() { | |
1554 | .env::file load || return ; local key saved=$__dotenv |
|
1554 | .env::file load || return ; local key saved=$__dotenv | |
1555 | while (($#)); do |
|
1555 | while (($#)); do | |
1556 | key=${1#+}; key=${key%%=*} |
|
1556 | key=${1#+}; key=${key%%=*} | |
1557 | if .env.get "$key"; then |
|
1557 | if .env.get "$key"; then | |
1558 | REPLY=() |
|
1558 | REPLY=() | |
1559 | if [[ $1 == +* ]]; then shift; continue # skip if already found |
|
1559 | if [[ $1 == +* ]]; then shift; continue # skip if already found | |
1560 | elif [[ $1 == *=* ]]; then |
|
1560 | elif [[ $1 == *=* ]]; then | |
1561 | __dotenv=${BASH_REMATCH[1]}${BASH_REMATCH[3]}$1$'\n'${BASH_REMATCH[4]#*$'\n'} |
|
1561 | __dotenv=${BASH_REMATCH[1]}${BASH_REMATCH[3]}$1$'\n'${BASH_REMATCH[4]#*$'\n'} | |
1562 | else |
|
1562 | else | |
1563 | __dotenv=${BASH_REMATCH[1]}${BASH_REMATCH[4]#*$'\n'} |
|
1563 | __dotenv=${BASH_REMATCH[1]}${BASH_REMATCH[4]#*$'\n'} | |
1564 | continue # delete all occurrences |
|
1564 | continue # delete all occurrences | |
1565 | fi |
|
1565 | fi | |
1566 | elif [[ $1 == *=* ]]; then |
|
1566 | elif [[ $1 == *=* ]]; then | |
1567 | __dotenv+="${1#+}"$'\n' |
|
1567 | __dotenv+="${1#+}"$'\n' | |
1568 | fi |
|
1568 | fi | |
1569 | shift |
|
1569 | shift | |
1570 | done |
|
1570 | done | |
1571 | [[ $__dotenv == "$saved" ]] || .env::file save |
|
1571 | [[ $__dotenv == "$saved" ]] || .env::file save | |
1572 | } |
|
1572 | } | |
1573 |
|
1573 | |||
1574 | .env.puts() { echo "${1-}">>"$__dotenv_file" && __dotenv+="$1"$'\n'; } |
|
1574 | .env.puts() { echo "${1-}">>"$__dotenv_file" && __dotenv+="$1"$'\n'; } | |
1575 |
|
1575 | |||
1576 | .env.generate() { |
|
1576 | .env.generate() { | |
1577 | .env::arg "key required for generate" "$@" || return |
|
1577 | .env::arg "key required for generate" "$@" || return | |
1578 | .env.get "$1" && return || REPLY=$("${@:2}") || return |
|
1578 | .env.get "$1" && return || REPLY=$("${@:2}") || return | |
1579 | .env::one "generate: ouptut of '${*:2}' has more than one line" "$REPLY" || return |
|
1579 | .env::one "generate: ouptut of '${*:2}' has more than one line" "$REPLY" || return | |
1580 | .env.puts "$1=$REPLY" |
|
1580 | .env.puts "$1=$REPLY" | |
1581 | } |
|
1581 | } | |
1582 |
|
1582 | |||
1583 | .env.--file() { |
|
1583 | .env.--file() { | |
1584 | .env::arg "filename required for --file" "$@" || return |
|
1584 | .env::arg "filename required for --file" "$@" || return | |
1585 | __dotenv_file=$1; .env::file load || return |
|
1585 | __dotenv_file=$1; .env::file load || return | |
1586 | (($#<2)) || .env "${@:2}" |
|
1586 | (($#<2)) || .env "${@:2}" | |
1587 | } |
|
1587 | } | |
1588 |
|
1588 | |||
1589 | .env::arg() { [[ "${2-}" ]] || { echo "$__dotenv_cmd: $1" >&2; return 64; }; } |
|
1589 | .env::arg() { [[ "${2-}" ]] || { echo "$__dotenv_cmd: $1" >&2; return 64; }; } | |
1590 |
|
1590 | |||
1591 | .env::one() { [[ "$2" != *$'\n'* ]] || .env::arg "$1"; } |
|
1591 | .env::one() { [[ "$2" != *$'\n'* ]] || .env::arg "$1"; } | |
1592 |
|
1592 | |||
1593 | .env::file() { |
|
1593 | .env::file() { | |
1594 | local REPLY=$__dotenv_file |
|
1594 | local REPLY=$__dotenv_file | |
1595 | case "$1" in |
|
1595 | case "$1" in | |
1596 | load) |
|
1596 | load) | |
1597 | __dotenv=; ! [[ -f "$REPLY" ]] || __dotenv="$(<"$REPLY")"$'\n' || return ;; |
|
1597 | __dotenv=; ! [[ -f "$REPLY" ]] || __dotenv="$(<"$REPLY")"$'\n' || return ;; | |
1598 | save) |
|
1598 | save) | |
1599 | if [[ -L "$REPLY" ]] && declare -F -- realpath.resolved >/dev/null; then |
|
1599 | if [[ -L "$REPLY" ]] && declare -F -- realpath.resolved >/dev/null; then | |
1600 | realpath.resolved "$REPLY" |
|
1600 | realpath.resolved "$REPLY" | |
1601 | fi |
|
1601 | fi | |
1602 | { [[ ! -f "$REPLY" ]] || cp -p "$REPLY" "$REPLY.bak"; } && |
|
1602 | { [[ ! -f "$REPLY" ]] || cp -p "$REPLY" "$REPLY.bak"; } && | |
1603 | printf %s "$__dotenv" >"$REPLY.bak" && mv "$REPLY.bak" "$REPLY" |
|
1603 | printf %s "$__dotenv" >"$REPLY.bak" && mv "$REPLY.bak" "$REPLY" | |
1604 | esac |
|
1604 | esac | |
1605 | } |
|
1605 | } | |
1606 | # |
|
1606 | # | |
1607 | #__dotenv() { |
|
1607 | #__dotenv() { | |
1608 | # set -eu |
|
1608 | # set -eu | |
1609 | # __dotenv_cmd=${0##*/} |
|
1609 | # __dotenv_cmd=${0##*/} | |
1610 | # .env.export() { .env.parse "$@" || return 0; printf 'export %q\n' "${REPLY[@]}"; REPLY=(); } |
|
1610 | # .env.export() { .env.parse "$@" || return 0; printf 'export %q\n' "${REPLY[@]}"; REPLY=(); } | |
1611 | # .env "$@" || return $? |
|
1611 | # .env "$@" || return $? | |
1612 | # ${REPLY[@]+printf '%s\n' "${REPLY[@]}"} |
|
1612 | # ${REPLY[@]+printf '%s\n' "${REPLY[@]}"} | |
1613 | #} |
|
1613 | #} | |
1614 | #if [[ $0 == "${BASH_SOURCE-}" ]]; then __dotenv "$@"; exit; fi |
|
1614 | #if [[ $0 == "${BASH_SOURCE-}" ]]; then __dotenv "$@"; exit; fi | |
1615 |
|
1615 | |||
1616 | # src/lib/get_docker_definitions.sh |
|
1616 | # src/lib/get_docker_definitions.sh | |
1617 |
|
1617 | |||
1618 | get_docker_definitions() { |
|
1618 | get_docker_definitions() { | |
1619 | SOURCE_DIR=$PWD |
|
1619 | SOURCE_DIR=$PWD | |
1620 | RHODECODE_DOCKER_HASH=$1 |
|
1620 | RHODECODE_DOCKER_HASH=$1 | |
1621 | DEBUG=$2 |
|
1621 | DEBUG=$2 | |
1622 |
|
1622 | |||
1623 | # download sources |
|
1623 | # download sources | |
1624 | echo "bootstrap_definitions: download rhodecode docker definitions from $SERVER_URL" |
|
1624 | echo "bootstrap_definitions: download rhodecode docker definitions from $SERVER_URL" | |
1625 | echo "" |
|
1625 | echo "" | |
1626 |
|
1626 | |||
1627 | if [ $DEBUG ]; then |
|
1627 | if [ $DEBUG ]; then | |
1628 | echo "bootstrap_definitions: downloading: $SERVER_URL/rhodecode-enterprise-docker/archive/$RHODECODE_DOCKER_HASH.tgz?with_hash=0" |
|
1628 | echo "bootstrap_definitions: downloading: $SERVER_URL/rhodecode-enterprise-docker/archive/$RHODECODE_DOCKER_HASH.tgz?with_hash=0" | |
1629 | curl --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-enterprise-docker/archive/$RHODECODE_DOCKER_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR |
|
1629 | curl --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-enterprise-docker/archive/$RHODECODE_DOCKER_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR | |
1630 |
|
1630 | |||
1631 | echo "bootstrap_definitions: running CP $SOURCE_DIR/*rhodecode-enterprise-docker-plain/* $SOURCE_DIR" |
|
1631 | echo "bootstrap_definitions: running CP $SOURCE_DIR/*rhodecode-enterprise-docker-plain/* $SOURCE_DIR" | |
1632 | cp -v -r -f --update --backup=numbered $SOURCE_DIR/*rhodecode-enterprise-docker-plain/* $SOURCE_DIR |
|
1632 | cp -v -r -f --update --backup=numbered $SOURCE_DIR/*rhodecode-enterprise-docker-plain/* $SOURCE_DIR | |
1633 |
|
1633 | |||
1634 | echo "bootstrap_definitions: removing $SOURCE_DIR/*rhodecode-enterprise-docker-plain" |
|
1634 | echo "bootstrap_definitions: removing $SOURCE_DIR/*rhodecode-enterprise-docker-plain" | |
1635 | rm -r $SOURCE_DIR/*rhodecode-enterprise-docker-plain |
|
1635 | rm -r $SOURCE_DIR/*rhodecode-enterprise-docker-plain | |
1636 | else |
|
1636 | else | |
1637 | curl -s --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-enterprise-docker/archive/$RHODECODE_DOCKER_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR |
|
1637 | curl -s --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-enterprise-docker/archive/$RHODECODE_DOCKER_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR | |
1638 | cp -r -f --update --backup=numbered $SOURCE_DIR/*rhodecode-enterprise-docker-plain/* $SOURCE_DIR |
|
1638 | cp -r -f --update --backup=numbered $SOURCE_DIR/*rhodecode-enterprise-docker-plain/* $SOURCE_DIR | |
1639 | rm -r $SOURCE_DIR/*rhodecode-enterprise-docker-plain |
|
1639 | rm -r $SOURCE_DIR/*rhodecode-enterprise-docker-plain | |
1640 | fi |
|
1640 | fi | |
1641 |
|
1641 | |||
1642 | echo "$(green bootstrap_definitions: docker definitions extracted to $SOURCE_DIR)" |
|
1642 | echo "$(green bootstrap_definitions: docker definitions extracted to $SOURCE_DIR)" | |
1643 |
|
1643 | |||
1644 | # cleanup |
|
1644 | # cleanup | |
1645 | find -nowarn -ignore_readdir_race $SOURCE_DIR -name "*.~*~" -delete |
|
1645 | find -nowarn -ignore_readdir_race "$SOURCE_DIR" -name "*.~*~" -delete | |
1646 | } |
|
1646 | } | |
1647 |
|
1647 | |||
1648 | # src/lib/reconfigure_ini.sh |
|
1648 | # src/lib/reconfigure_ini.sh | |
1649 | config_vcsserver_ini() { |
|
1649 | config_vcsserver_ini() { | |
1650 |
|
1650 | |||
1651 | #host/port |
|
1651 | #host/port | |
1652 | sed_replace '^#?host = .*' 'host = 0\.0\.0\.0' |
|
1652 | sed_replace '^#?host = .*' 'host = 0\.0\.0\.0' | |
1653 | sed_replace '^#?port = .*' 'port = 10010' |
|
1653 | sed_replace '^#?port = .*' 'port = 10010' | |
1654 |
|
1654 | |||
1655 | # workers adjustment |
|
1655 | # workers adjustment | |
1656 | sed_replace '^#?workers = .*' 'workers = 1' |
|
1656 | sed_replace '^#?workers = .*' 'workers = 1' | |
1657 | sed_replace '^#?memory_max_usage = .*' 'memory_max_usage = 2147483648' |
|
1657 | sed_replace '^#?memory_max_usage = .*' 'memory_max_usage = 2147483648' | |
1658 | sed_replace '^#?core\.binary_dir = .*' 'core.binary_dir = \/home\/rhodecode\/\.rccontrol\/vcsserver-1\/profile\/bin' |
|
1658 | sed_replace '^#?core\.binary_dir = .*' 'core.binary_dir = \/home\/rhodecode\/\.rccontrol\/vcsserver-1\/profile\/bin' | |
1659 |
|
1659 | |||
1660 | sed_replace '^#?rc_cache\.repo_object\.expiration_time = .*' 'rc_cache.repo_object.expiration_time = 2592000' |
|
1660 | sed_replace '^#?rc_cache\.repo_object\.expiration_time = .*' 'rc_cache.repo_object.expiration_time = 2592000' | |
1661 | sed_replace '^#?rc_cache\.repo_object\.backend = dogpile\.cache\.rc\.redis_msgpack' 'rc_cache.repo_object.backend = dogpile.cache.rc.redis_msgpack' |
|
1661 | sed_replace '^#?rc_cache\.repo_object\.backend = dogpile\.cache\.rc\.redis_msgpack' 'rc_cache.repo_object.backend = dogpile.cache.rc.redis_msgpack' | |
1662 |
|
1662 | |||
1663 | sed_replace '^#?rc_cache\.repo_object\.arguments\.socket_timeout = .*' 'rc_cache.repo_object.arguments.socket_timeout = 30' |
|
1663 | sed_replace '^#?rc_cache\.repo_object\.arguments\.socket_timeout = .*' 'rc_cache.repo_object.arguments.socket_timeout = 30' | |
1664 | sed_replace '^#?rc_cache\.repo_object\.arguments\.db = .*' 'rc_cache.repo_object.arguments.db = 5' |
|
1664 | sed_replace '^#?rc_cache\.repo_object\.arguments\.db = .*' 'rc_cache.repo_object.arguments.db = 5' | |
1665 | sed_replace '^#?rc_cache\.repo_object\.arguments\.port = .*' 'rc_cache.repo_object.arguments.port = 6379' |
|
1665 | sed_replace '^#?rc_cache\.repo_object\.arguments\.port = .*' 'rc_cache.repo_object.arguments.port = 6379' | |
1666 | sed_replace '^#?rc_cache\.repo_object\.arguments\.host = .*' 'rc_cache.repo_object.arguments.host = redis' |
|
1666 | sed_replace '^#?rc_cache\.repo_object\.arguments\.host = .*' 'rc_cache.repo_object.arguments.host = redis' | |
1667 | sed_replace '^#?rc_cache\.repo_object\.arguments\.redis_expiration_time = .*' 'rc_cache.repo_object.arguments.redis_expiration_time = 3592000' |
|
1667 | sed_replace '^#?rc_cache\.repo_object\.arguments\.redis_expiration_time = .*' 'rc_cache.repo_object.arguments.redis_expiration_time = 3592000' | |
1668 |
|
1668 | |||
1669 | sed_replace '^#?cache_dir = .*' 'cache_dir = \/var\/opt\/rhodecode_data' |
|
1669 | sed_replace '^#?cache_dir = .*' 'cache_dir = \/var\/opt\/rhodecode_data' | |
1670 | sed_replace '^#?formatter = .*' 'formatter = json' |
|
1670 | sed_replace '^#?formatter = .*' 'formatter = json' | |
1671 | } |
|
1671 | } | |
1672 |
|
1672 | |||
1673 | config_rhodecode_ini() { |
|
1673 | config_rhodecode_ini() { | |
1674 | #host/port |
|
1674 | #host/port | |
1675 | sed_replace '^#?host = .*' 'host = 0\.0\.0\.0' |
|
1675 | sed_replace '^#?host = .*' 'host = 0\.0\.0\.0' | |
1676 | sed_replace '^#?port = .*' 'port = 10020' |
|
1676 | sed_replace '^#?port = .*' 'port = 10020' | |
1677 |
|
1677 | |||
1678 | # workers adjustment |
|
1678 | # workers adjustment | |
1679 | sed_replace '^#?workers = .*' 'workers = 1' |
|
1679 | sed_replace '^#?workers = .*' 'workers = 1' | |
1680 | sed_replace '^#?memory_max_usage = .*' 'memory_max_usage = 2147483648' |
|
1680 | sed_replace '^#?memory_max_usage = .*' 'memory_max_usage = 2147483648' | |
1681 |
|
1681 | |||
1682 |
|
1682 | |||
1683 | sed_replace '^#?email_prefix = .*' 'email_prefix = [RhodeCode]' |
|
1683 | sed_replace '^#?email_prefix = .*' 'email_prefix = [RhodeCode]' | |
1684 | sed_replace '^#?app_email_from = .*' "app_email_from = rhodecode-noreply@$RC_HOSTNAME" |
|
1684 | sed_replace '^#?app_email_from = .*' "app_email_from = rhodecode-noreply@$RC_HOSTNAME" | |
1685 | sed_replace '^#?smtp_server = .*' 'smtp_server = localhost' |
|
1685 | sed_replace '^#?smtp_server = .*' 'smtp_server = localhost' | |
1686 |
|
1686 | |||
1687 | # set license_token |
|
1687 | # set license_token | |
1688 | sed_replace '^#?license_token =.*' "license_token = $RC_LICENSE_TOKEN" |
|
1688 | sed_replace '^#?license_token =.*' "license_token = $RC_LICENSE_TOKEN" | |
1689 |
|
1689 | |||
1690 | # enable celery |
|
1690 | # enable celery | |
1691 | sed_replace '^#?use_celery = .*', 'use_celery = true' |
|
1691 | sed_replace '^#?use_celery = .*', 'use_celery = true' | |
1692 |
|
1692 | |||
1693 | # set cache dir |
|
1693 | # set cache dir | |
1694 | sed_replace '^#?cache_dir = .*' 'cache_dir = \/var\/opt\/rhodecode_data' |
|
1694 | sed_replace '^#?cache_dir = .*' 'cache_dir = \/var\/opt\/rhodecode_data' | |
1695 |
|
1695 | |||
1696 | # cleanup rabbitmq example entry |
|
1696 | # cleanup rabbitmq example entry | |
1697 | sed_replace '^#celery\.broker_url = amqp.*' '' |
|
1697 | sed_replace '^#celery\.broker_url = amqp.*' '' | |
1698 | sed_replace '^#?celery\.broker_url = .*' 'celery\.broker_url = redis:\/\/redis:6379\/8' |
|
1698 | sed_replace '^#?celery\.broker_url = .*' 'celery\.broker_url = redis:\/\/redis:6379\/8' | |
1699 |
|
1699 | |||
1700 | # switch beaker sessions to Redis based |
|
1700 | # switch beaker sessions to Redis based | |
1701 | sed_replace '^#?beaker.session.type = file.*' '#beaker.session.type = file' |
|
1701 | sed_replace '^#?beaker.session.type = file.*' '#beaker.session.type = file' | |
1702 | sed_replace '^#?beaker.session.data_dir = .*' '#beaker.session.data_dir = \/tmp\/data\/sessions' |
|
1702 | sed_replace '^#?beaker.session.data_dir = .*' '#beaker.session.data_dir = \/tmp\/data\/sessions' | |
1703 |
|
1703 | |||
1704 | # enable redis db2 |
|
1704 | # enable redis db2 | |
1705 | sed_replace '^#?beaker\.session\.type = ext:redis' 'beaker.session.type = ext:redis' |
|
1705 | sed_replace '^#?beaker\.session\.type = ext:redis' 'beaker.session.type = ext:redis' | |
1706 | sed_replace '^#?beaker\.session\.url = redis:\/\/127.0.0.1:6379\/2' 'beaker.session.url = redis:\/\/redis:6379\/2' |
|
1706 | sed_replace '^#?beaker\.session\.url = redis:\/\/127.0.0.1:6379\/2' 'beaker.session.url = redis:\/\/redis:6379\/2' | |
1707 |
|
1707 | |||
1708 | # sed_replace '^#?beaker.session.type = ext:database.*' 'beaker.session.type = ext:database' |
|
1708 | # sed_replace '^#?beaker.session.type = ext:database.*' 'beaker.session.type = ext:database' | |
1709 | # sed_replace '^#?beaker.session.sa.url = postgresql.*' 'beaker.session.sa.url = postgresql://{{rhodecode_db_username}}:{{rhodecode_db_password}}@localhost/{{rhodecode_db_name}}' |
|
1709 | # sed_replace '^#?beaker.session.sa.url = postgresql.*' 'beaker.session.sa.url = postgresql://{{rhodecode_db_username}}:{{rhodecode_db_password}}@localhost/{{rhodecode_db_name}}' | |
1710 |
|
1710 | |||
1711 | # hooks reconfigure for auto-bind to host |
|
1711 | # hooks reconfigure for auto-bind to host | |
1712 | sed_replace '^#?vcs.hooks.host = .*' 'vcs.hooks.host = \*' |
|
1712 | sed_replace '^#?vcs.hooks.host = .*' 'vcs.hooks.host = \*' | |
1713 |
|
1713 | |||
1714 | # enable SVN |
|
1714 | # enable SVN | |
1715 | sed_replace '^#?svn.proxy.generate_config = .*' 'svn.proxy.generate_config = true' |
|
1715 | sed_replace '^#?svn.proxy.generate_config = .*' 'svn.proxy.generate_config = true' | |
1716 |
|
1716 | |||
1717 | # enable SSH |
|
1717 | # enable SSH | |
1718 | sed_replace '^#?ssh.generate_authorized_keyfile = .*' 'ssh.generate_authorized_keyfile = true' |
|
1718 | sed_replace '^#?ssh.generate_authorized_keyfile = .*' 'ssh.generate_authorized_keyfile = true' | |
1719 |
|
1719 | |||
1720 | # # the wrapper_cmd |
|
1720 | # # the wrapper_cmd | |
1721 | # sed_replace '^#?ssh.wrapper_cmd = .*' 'ssh.wrapper_cmd = /home/{{vm_account_name}}/dev-code/rhodecode-enterprise-ee/profile/bin/rc-ssh-wrapper' |
|
1721 | # sed_replace '^#?ssh.wrapper_cmd = .*' 'ssh.wrapper_cmd = /home/{{vm_account_name}}/dev-code/rhodecode-enterprise-ee/profile/bin/rc-ssh-wrapper' | |
1722 | # |
|
1722 | # | |
1723 |
|
1723 | |||
1724 | # '^#?api_access_controllers_whitelist = .*', 'api_access_controllers_whitelist = RepoFilesView:repo_archivefile, RepoFilesView:repo_file_raw' |
|
1724 | # '^#?api_access_controllers_whitelist = .*', 'api_access_controllers_whitelist = RepoFilesView:repo_archivefile, RepoFilesView:repo_file_raw' | |
1725 | # |
|
1725 | # | |
1726 | # |
|
1726 | # | |
1727 | # # set search to elasticsearch |
|
1727 | # # set search to elasticsearch | |
1728 | # # enabled modules for Whoosh we remove, we have duplicates there.. |
|
1728 | # # enabled modules for Whoosh we remove, we have duplicates there.. | |
1729 | # '^search.module = .*', '' |
|
1729 | # '^search.module = .*', '' | |
1730 | # '^search.location = .*', '' |
|
1730 | # '^search.location = .*', '' | |
1731 | # |
|
1731 | # | |
1732 | # '^#?search.module = .*', 'search.module = rc_elasticsearch' |
|
1732 | # '^#?search.module = .*', 'search.module = rc_elasticsearch' | |
1733 | # '^#?search.location = .*', 'search.location = http://localhost:9200' |
|
1733 | # '^#?search.location = .*', 'search.location = http://localhost:9200' | |
1734 | # '^#?search.es_version = .*', 'search.es_version = 6' |
|
1734 | # '^#?search.es_version = .*', 'search.es_version = 6' | |
1735 |
|
1735 | |||
1736 | # # enable Chat |
|
1736 | # # enable Chat | |
1737 | # '^#?chat.enabled = .*', 'chat.enabled = true' |
|
1737 | # '^#?chat.enabled = .*', 'chat.enabled = true' | |
1738 |
|
1738 | |||
1739 | # logging |
|
1739 | # logging | |
1740 | sed_replace '^#?formatter = .*' 'formatter = json' |
|
1740 | sed_replace '^#?formatter = .*' 'formatter = json' | |
1741 |
|
1741 | |||
1742 | } |
|
1742 | } | |
1743 |
|
1743 | |||
1744 | # src/lib/send_completions.sh |
|
1744 | # src/lib/send_completions.sh | |
1745 |
|
1745 | |||
1746 | # src/lib/utils.sh |
|
1746 | # src/lib/utils.sh | |
1747 | random_str() { |
|
1747 | random_str() { | |
1748 | len=$1 |
|
1748 | len=$1 | |
1749 | random_generate=$(echo $RANDOM | md5sum | head -c $len) |
|
1749 | random_generate=$(echo $RANDOM | md5sum | head -c $len) | |
1750 | echo $random_generate |
|
1750 | echo $random_generate | |
1751 | } |
|
1751 | } | |
1752 |
|
1752 | |||
1753 | # src/lib/validate_stack_exists.sh |
|
1753 | # src/lib/validate_stack_exists.sh | |
1754 |
|
1754 | |||
1755 | validate_stack_exists() { |
|
1755 | validate_stack_exists() { | |
1756 | err="" |
|
1756 | err="" | |
1757 | invalid="1" |
|
1757 | invalid="1" | |
1758 |
|
1758 | |||
1759 | for item in $VALID_SERVICES |
|
1759 | for item in $VALID_SERVICES | |
1760 | do |
|
1760 | do | |
1761 | if [ "$1" == "$item" ]; then |
|
1761 | if [ "$1" == "$item" ]; then | |
1762 | invalid="" |
|
1762 | invalid="" | |
1763 | break |
|
1763 | break | |
1764 | fi |
|
1764 | fi | |
1765 | done |
|
1765 | done | |
1766 |
|
1766 | |||
1767 | if [[ -n $invalid ]]; then |
|
1767 | if [[ -n $invalid ]]; then | |
1768 | err="command '$1' not in list of $VALID_SERVICES" |
|
1768 | err="command '$1' not in list of $VALID_SERVICES" | |
1769 | fi |
|
1769 | fi | |
1770 |
|
1770 | |||
1771 | echo $err |
|
1771 | echo $err | |
1772 | } |
|
1772 | } | |
1773 |
|
1773 | |||
1774 | # :command.command_functions |
|
1774 | # :command.command_functions | |
1775 | # :command.function |
|
1775 | # :command.function | |
1776 | rcstack_get_started_command() { |
|
1776 | rcstack_get_started_command() { | |
1777 | # src/get_started_command.sh |
|
1777 | # src/get_started_command.sh | |
1778 | get_started_full |
|
1778 | get_started_full | |
1779 | } |
|
1779 | } | |
1780 |
|
1780 | |||
1781 | # :command.function |
|
1781 | # :command.function | |
1782 | rcstack_init_command() { |
|
1782 | rcstack_init_command() { | |
1783 | # src/init_command.sh |
|
1783 | # src/init_command.sh | |
1784 | DEBUG=${args[--debug]} |
|
1784 | DEBUG=${args[--debug]} | |
1785 | force=${args[--force]} |
|
1785 | force=${args[--force]} | |
1786 | revision=${args[--revision]} |
|
1786 | revision=${args[--revision]} | |
1787 | install_docker=${args[--install-docker]} |
|
1787 | install_docker=${args[--install-docker]} | |
1788 |
|
1788 | |||
1789 | check_docker() { |
|
1789 | check_docker() { | |
1790 | (which docker || which docker.io) &>/dev/null |
|
1790 | (which docker || which docker.io) &>/dev/null | |
1791 | } |
|
1791 | } | |
1792 |
|
1792 | |||
1793 | bootstrap_docker_install() { |
|
1793 | bootstrap_docker_install() { | |
1794 | # systemctl enable docker on debian |
|
1794 | # systemctl enable docker on debian | |
1795 | echo "bootstrap_docker_install: trying to check and configure docker" |
|
1795 | echo "bootstrap_docker_install: trying to check and configure docker" | |
1796 | failMsg="Failed to find docker on your PATH" |
|
1796 | failMsg="Failed to find docker on your PATH" | |
1797 |
|
1797 | |||
1798 | if ! check_docker; then |
|
1798 | if ! check_docker; then | |
1799 |
|
1799 | |||
1800 | if [[ $install_docker == "n" ]]; then |
|
1800 | if [[ $install_docker == "n" ]]; then | |
1801 | echo "$(red $failMsg, exiting without docker install)" |
|
1801 | echo "$(red $failMsg, exiting without docker install)" | |
1802 | fi |
|
1802 | fi | |
1803 |
|
1803 | |||
1804 | echo "$(yellow $failMsg, trying docker install)" |
|
1804 | echo "$(yellow $failMsg, trying docker install)" | |
1805 |
|
1805 | |||
1806 | if [[ $install_docker == "y" ]]; then |
|
1806 | if [[ $install_docker == "y" ]]; then | |
1807 | echo "continuing with automated docker installation from https://get.docker.com/ " |
|
1807 | echo "continuing with automated docker installation from https://get.docker.com/ " | |
1808 | else |
|
1808 | else | |
1809 | read -p "Enter to install Docker directly from https://get.docker.com/ or Ctrl+C to exit and install it manually" |
|
1809 | read -p "Enter to install Docker directly from https://get.docker.com/ or Ctrl+C to exit and install it manually" | |
1810 | fi |
|
1810 | fi | |
1811 |
|
1811 | |||
1812 | curl https://get.docker.com/ | sh |
|
1812 | curl https://get.docker.com/ | sh | |
1813 |
|
1813 | |||
1814 | if ! check_docker; then |
|
1814 | if ! check_docker; then | |
1815 | echo "$failMsg" |
|
1815 | echo "$failMsg" | |
1816 | echo "Docker install failed. Quitting." |
|
1816 | echo "Docker install failed. Quitting." | |
1817 | exit 1 |
|
1817 | exit 1 | |
1818 | fi |
|
1818 | fi | |
1819 |
|
1819 | |||
1820 | docker --version |
|
1820 | docker --version | |
1821 |
|
1821 | |||
1822 | fi |
|
1822 | fi | |
1823 | } |
|
1823 | } | |
1824 |
|
1824 | |||
1825 | bootstrap_docker_commons() { |
|
1825 | bootstrap_docker_commons() { | |
1826 |
|
1826 | |||
1827 | echo 'bootstrap_docker_commons: running docker commands.' |
|
1827 | echo 'bootstrap_docker_commons: running docker commands.' | |
1828 |
|
1828 | |||
1829 | echo "bootstrap_docker_commons: creating volume 'rc_datavolume'" |
|
1829 | echo "bootstrap_docker_commons: creating volume 'rc_datavolume'" | |
1830 | docker volume create --label keep=1 --name=rc_datavolume |
|
1830 | docker volume create --label keep=1 --name=rc_datavolume | |
1831 | echo "bootstrap_docker_commons: done" |
|
1831 | echo "bootstrap_docker_commons: done" | |
1832 | echo "" |
|
1832 | echo "" | |
1833 |
|
1833 | |||
1834 | echo "bootstrap_docker_commons: creating volume 'rc_reposvolume'" |
|
1834 | echo "bootstrap_docker_commons: creating volume 'rc_reposvolume'" | |
1835 | docker volume create --label keep=1 --name=rc_reposvolume |
|
1835 | docker volume create --label keep=1 --name=rc_reposvolume | |
1836 | echo "bootstrap_docker_commons: done" |
|
1836 | echo "bootstrap_docker_commons: done" | |
1837 | echo "" |
|
1837 | echo "" | |
1838 |
|
1838 | |||
1839 | echo "bootstrap_docker_commons: creating network 'rhodecode_network'" |
|
1839 | echo "bootstrap_docker_commons: creating network 'rhodecode_network'" | |
1840 | docker network inspect rhodecode_network >/dev/null 2>&1 || docker network create rhodecode_network |
|
1840 | docker network inspect rhodecode_network >/dev/null 2>&1 || docker network create rhodecode_network | |
1841 | echo "bootstrap_docker_commons: done" |
|
1841 | echo "bootstrap_docker_commons: done" | |
1842 | echo "" |
|
1842 | echo "" | |
1843 |
|
1843 | |||
1844 | echo "bootstrap_docker_commons: creating loki logging" |
|
1844 | echo "bootstrap_docker_commons: creating loki logging" | |
1845 | loki_driver=$(docker plugin ls --format {{.Name}} --filter enabled=true | grep loki || echo "") |
|
1845 | loki_driver=$(docker plugin ls --format {{.Name}} --filter enabled=true | grep loki || echo "") | |
1846 | if [[ $loki_driver == "" ]]; then |
|
1846 | if [[ $loki_driver == "" ]]; then | |
1847 | docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions |
|
1847 | docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions | |
1848 | else |
|
1848 | else | |
1849 | echo "bootstrap_docker_commons: loki driver already exists" |
|
1849 | echo "bootstrap_docker_commons: loki driver already exists" | |
1850 | fi |
|
1850 | fi | |
1851 | } |
|
1851 | } | |
1852 |
|
1852 | |||
1853 | bootstrap_config() { |
|
1853 | bootstrap_config() { | |
1854 | shared_key=$(random_str 32) |
|
1854 | shared_key=$(random_str 32) | |
1855 | db_key=$(random_str 32) |
|
1855 | db_key=$(random_str 32) | |
1856 | license_token="$(random_str 4)"-"$(random_str 4)"-"$(random_str 4)"-"$(random_str 4)" |
|
1856 | license_token="$(random_str 4)"-"$(random_str 4)"-"$(random_str 4)"-"$(random_str 4)" | |
1857 |
|
1857 | |||
1858 | # TODO: change formatter to json for loki usage |
|
1858 | # TODO: change formatter to json for loki usage | |
1859 | log_formatter=generic |
|
1859 | log_formatter=generic | |
1860 |
|
1860 | |||
1861 | #TODO: ask for domain |
|
1861 | #TODO: ask for domain | |
1862 | base_domain=docker-dev |
|
1862 | base_domain=docker-dev | |
1863 |
|
1863 | |||
1864 | # TODO: config input |
|
1864 | # TODO: config input | |
1865 | # while [[ "$config_ok" == "n" ]] |
|
1865 | # while [[ "$config_ok" == "n" ]] | |
1866 | # do |
|
1866 | # do | |
1867 | # if [ ! -z "$hostname" ] |
|
1867 | # if [ ! -z "$hostname" ] | |
1868 | # then |
|
1868 | # then | |
1869 | # read -p "Enter a valid hostname for RhodeCode Stack? [$hostname]: " new_value |
|
1869 | # read -p "Enter a valid hostname for RhodeCode Stack? [$hostname]: " new_value | |
1870 | # if [ ! -z "$new_value" ] |
|
1870 | # if [ ! -z "$new_value" ] | |
1871 | # then |
|
1871 | # then | |
1872 | # hostname="$new_value" |
|
1872 | # hostname="$new_value" | |
1873 | # fi |
|
1873 | # fi | |
1874 | # if [[ $hostname =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]] |
|
1874 | # if [[ $hostname =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]] | |
1875 | # then |
|
1875 | # then | |
1876 | # echo |
|
1876 | # echo | |
1877 | # echo "$(red IP addresses are unsupported and will not work. Please provide a DNS hostname)" |
|
1877 | # echo "$(red IP addresses are unsupported and will not work. Please provide a DNS hostname)" | |
1878 | # echo |
|
1878 | # echo | |
1879 | # hostname="rc-docker.local" |
|
1879 | # hostname="rc-docker.local" | |
1880 | # fi |
|
1880 | # fi | |
1881 | # fi |
|
1881 | # fi | |
1882 |
|
1882 | |||
1883 | DB_USER='rhodecode' |
|
1883 | DB_USER='rhodecode' | |
1884 | DB_NAME='rhodecode' |
|
1884 | DB_NAME='rhodecode' | |
1885 |
|
1885 | |||
1886 | if [[ ! -f "$CONFIG_FILE" ]]; then |
|
1886 | if [[ ! -f "$CONFIG_FILE" ]]; then | |
1887 | echo "init new config at: $CONFIG_FILE" |
|
1887 | echo "init new config at: $CONFIG_FILE" | |
1888 | config_init |
|
1888 | config_init | |
1889 | else |
|
1889 | else | |
1890 | echo "re-using existing config at: $CONFIG_FILE" |
|
1890 | echo "re-using existing config at: $CONFIG_FILE" | |
1891 | fi |
|
1891 | fi | |
1892 |
|
1892 | |||
1893 | mkdir -p $PWD/.custom |
|
1893 | mkdir -p $PWD/.custom | |
1894 | BOOTSTRAP_TMPL=$PWD/templates/runtime.env.tmpl |
|
1894 | BOOTSTRAP_TMPL=$PWD/templates/runtime.env.tmpl | |
1895 | BOOTSTRAP_RUNTIME_ENV=$PWD/.custom/.runtime.env |
|
1895 | BOOTSTRAP_RUNTIME_ENV=$PWD/.custom/.runtime.env | |
1896 |
|
1896 | |||
1897 | # TODO: Pick version |
|
1897 | # TODO: Pick version | |
1898 | ver=0_edge |
|
1898 | ver=0_edge | |
1899 | INI_TARGET=$PWD/config/_shared |
|
1899 | INI_TARGET=$PWD/config/_shared | |
1900 | RHODECODE_INI_TMPL=$PWD/templates/ini/$ver/rhodecode.ini |
|
1900 | RHODECODE_INI_TMPL=$PWD/templates/ini/$ver/rhodecode.ini | |
1901 | VCSSERVER_INI_TMPL=$PWD/templates/ini/$ver/vcsserver.ini |
|
1901 | VCSSERVER_INI_TMPL=$PWD/templates/ini/$ver/vcsserver.ini | |
1902 |
|
1902 | |||
1903 | if [[ ! -f "$BOOTSTRAP_RUNTIME_ENV" ]]; then |
|
1903 | if [[ ! -f "$BOOTSTRAP_RUNTIME_ENV" ]]; then | |
1904 | echo "bootstrap_config: init runtime env config at: $BOOTSTRAP_RUNTIME_ENV" |
|
1904 | echo "bootstrap_config: init runtime env config at: $BOOTSTRAP_RUNTIME_ENV" | |
1905 |
|
1905 | |||
1906 | # Make runtime file |
|
1906 | # Make runtime file | |
1907 | echo "## BOOTSTRAP GENERATED" >> $BOOTSTRAP_RUNTIME_ENV |
|
1907 | echo "## BOOTSTRAP GENERATED" >> $BOOTSTRAP_RUNTIME_ENV | |
1908 | cat $BOOTSTRAP_TMPL >> $BOOTSTRAP_RUNTIME_ENV |
|
1908 | cat $BOOTSTRAP_TMPL >> $BOOTSTRAP_RUNTIME_ENV | |
1909 |
|
1909 | |||
1910 | # Make .ini files |
|
1910 | # Make .ini files | |
1911 | cp -v $RHODECODE_INI_TMPL $INI_TARGET |
|
1911 | cp -v $RHODECODE_INI_TMPL $INI_TARGET | |
1912 | cp -v $VCSSERVER_INI_TMPL $INI_TARGET |
|
1912 | cp -v $VCSSERVER_INI_TMPL $INI_TARGET | |
1913 |
|
1913 | |||
1914 | # init env generator with env file |
|
1914 | # init env generator with env file | |
1915 | .env --file $BOOTSTRAP_RUNTIME_ENV |
|
1915 | .env --file $BOOTSTRAP_RUNTIME_ENV | |
1916 |
|
1916 | |||
1917 | .env set DB_PASSWORD=$db_key |
|
1917 | .env set DB_PASSWORD=$db_key | |
1918 |
|
1918 | |||
1919 | .env set RC_ENCRYPTED_SECRET=$shared_key |
|
1919 | .env set RC_ENCRYPTED_SECRET=$shared_key | |
1920 | .env set RC_DB_URL="postgresql://$DB_USER:$db_key@database/$DB_NAME" |
|
1920 | .env set RC_DB_URL="postgresql://$DB_USER:$db_key@database/$DB_NAME" | |
1921 | .env set RC_SQLALCHEMY_DB1_URL="postgresql://$DB_USER:$db_key@database/$DB_NAME" |
|
1921 | .env set RC_SQLALCHEMY_DB1_URL="postgresql://$DB_USER:$db_key@database/$DB_NAME" | |
1922 |
|
1922 | |||
1923 | .env set RC_LICENSE_TOKEN=$license_token |
|
1923 | .env set RC_LICENSE_TOKEN=$license_token | |
1924 | .env set RC_HOSTNAME=$base_domain |
|
1924 | .env set RC_HOSTNAME=$base_domain | |
1925 | .env set RC_APP_BASE_URL=http://$base_domain |
|
1925 | .env set RC_APP_BASE_URL=http://$base_domain | |
1926 |
|
1926 | |||
1927 | .env puts '# Log formatter option' |
|
1927 | .env puts '# Log formatter option' | |
1928 | .env set RC_LOGGING_FORMATTER=$log_formatter |
|
1928 | .env set RC_LOGGING_FORMATTER=$log_formatter | |
1929 | .env set RC_USE_CELERY=true |
|
1929 | .env set RC_USE_CELERY=true | |
1930 |
|
1930 | |||
1931 | .env puts '# Channelstream config' |
|
1931 | .env puts '# Channelstream config' | |
1932 | .env set RC_CHANNELSTREAM_SERVER=channelstream:8000 |
|
1932 | .env set RC_CHANNELSTREAM_SERVER=channelstream:8000 | |
1933 | .env set RC_CHANNELSTREAM_WS_URL=ws:/$base_domain/_channelstream |
|
1933 | .env set RC_CHANNELSTREAM_WS_URL=ws:/$base_domain/_channelstream | |
1934 | .env set CHANNELSTREAM_ALLOW_POSTING_FROM=0.0.0.0 |
|
1934 | .env set CHANNELSTREAM_ALLOW_POSTING_FROM=0.0.0.0 | |
1935 |
|
1935 | |||
1936 | .env set CHANNELSTREAM_SECRET=$shared_key |
|
1936 | .env set CHANNELSTREAM_SECRET=$shared_key | |
1937 | .env set RC_CHANNELSTREAM_SECRET=$shared_key |
|
1937 | .env set RC_CHANNELSTREAM_SECRET=$shared_key | |
1938 |
|
1938 | |||
1939 | .env set CHANNELSTREAM_ADMIN_SECRET=$shared_key |
|
1939 | .env set CHANNELSTREAM_ADMIN_SECRET=$shared_key | |
1940 | .env set RC_CHANNELSTREAM_ADMIN_SECRET=$shared_key |
|
1940 | .env set RC_CHANNELSTREAM_ADMIN_SECRET=$shared_key | |
1941 |
|
1941 | |||
1942 | touch $BOOTSTRAP_RUNTIME_ENV |
|
1942 | touch $BOOTSTRAP_RUNTIME_ENV | |
1943 | else |
|
1943 | else | |
1944 | echo "bootstrap_config: $BOOTSTRAP_RUNTIME_ENV file exists, not adding any configuration..." |
|
1944 | echo "bootstrap_config: $BOOTSTRAP_RUNTIME_ENV file exists, not adding any configuration..." | |
1945 | fi |
|
1945 | fi | |
1946 | } |
|
1946 | } | |
1947 |
|
1947 | |||
1948 | bootstrap_definitions() { |
|
1948 | bootstrap_definitions() { | |
1949 |
|
1949 | |||
1950 | AUTH_TOKEN=${args[--auth-token]} |
|
1950 | AUTH_TOKEN=${args[--auth-token]} | |
1951 | SERVER_URL=${args[--server-url]} |
|
1951 | SERVER_URL=${args[--server-url]} | |
1952 |
|
1952 | |||
1953 | DEFINITIONS_EXIST="" |
|
1953 | DEFINITIONS_EXIST="" | |
1954 | CHECK_FILES="\ |
|
1954 | CHECK_FILES="\ | |
1955 | docker-compose-services.yaml \ |
|
1955 | docker-compose-services.yaml \ | |
1956 | docker-compose-apps.yaml \ |
|
1956 | docker-compose-apps.yaml \ | |
1957 | docker-compose-metrics.yaml \ |
|
1957 | docker-compose-metrics.yaml \ | |
1958 | docker-compose-router.yaml \ |
|
1958 | docker-compose-router.yaml \ | |
1959 | " |
|
1959 | " | |
1960 | for check_file in $CHECK_FILES; do |
|
1960 | for check_file in $CHECK_FILES; do | |
1961 | if [[ -f "$check_file" ]]; then |
|
1961 | if [[ -f "$check_file" ]]; then | |
1962 | DEFINITIONS_EXIST="1" |
|
1962 | DEFINITIONS_EXIST="1" | |
1963 | fi |
|
1963 | fi | |
1964 | done |
|
1964 | done | |
1965 |
|
1965 | |||
1966 | if [[ -n $DEFINITIONS_EXIST && ! $force ]]; then |
|
1966 | if [[ -n $DEFINITIONS_EXIST && ! $force ]]; then | |
1967 | echo "$(yellow bootstrap_definitions: skipping docker defs creation, existing files found. Use --force to create them anyway)" |
|
1967 | echo "$(yellow bootstrap_definitions: skipping docker defs creation, existing files found. Use --force to create them anyway)" | |
1968 | return |
|
1968 | return | |
1969 | fi |
|
1969 | fi | |
1970 |
|
1970 | |||
1971 | if [[ -n $DEFINITIONS_EXIST ]]; then |
|
1971 | if [[ -n $DEFINITIONS_EXIST ]]; then | |
1972 | echo "$(yellow docker definitions exists, are you sure to force re-create them?)" |
|
1972 | echo "$(yellow docker definitions exists, are you sure to force re-create them?)" | |
1973 | while true; do |
|
1973 | while true; do | |
1974 | read -p "Would you like to continue with overriding file? [yn] " yn |
|
1974 | read -p "Would you like to continue with overriding file? [yn] " yn | |
1975 | case $yn in |
|
1975 | case $yn in | |
1976 | [Yy]*) break ;; |
|
1976 | [Yy]*) break ;; | |
1977 | [Nn]*) exit ;; |
|
1977 | [Nn]*) exit ;; | |
1978 | *) echo "Please answer y or n." ;; |
|
1978 | *) echo "Please answer y or n." ;; | |
1979 | esac |
|
1979 | esac | |
1980 | done |
|
1980 | done | |
1981 | fi |
|
1981 | fi | |
1982 |
|
1982 | |||
1983 | get_docker_definitions $revision $DEBUG |
|
1983 | get_docker_definitions $revision $DEBUG | |
1984 | } |
|
1984 | } | |
1985 |
|
1985 | |||
1986 | bootstrap_overrides() { |
|
1986 | bootstrap_overrides() { | |
1987 | templates=$(find $PWD/templates/*.yaml -printf "%f\n") |
|
1987 | templates=$(find $PWD/templates/*.yaml -printf "%f\n") | |
1988 |
|
1988 | |||
1989 | target_dir=$PWD/.custom |
|
1989 | target_dir=$PWD/.custom | |
1990 |
|
1990 | |||
1991 | for o_file in $templates; do |
|
1991 | for o_file in $templates; do | |
1992 | target_file=$target_dir/$o_file |
|
1992 | target_file=$target_dir/$o_file | |
1993 | if [[ ! -f "$target_file" ]]; then |
|
1993 | if [[ ! -f "$target_file" ]]; then | |
1994 | echo "copy override file $o_file" |
|
1994 | echo "copy override file $o_file" | |
1995 | cp -v $PWD/templates/$o_file $target_file |
|
1995 | cp -v $PWD/templates/$o_file $target_file | |
1996 | else |
|
1996 | else | |
1997 | echo "file $target_file existing, skipping..." |
|
1997 | echo "file $target_file existing, skipping..." | |
1998 | fi |
|
1998 | fi | |
1999 | done |
|
1999 | done | |
2000 | mkdir -p $target_dir/traefik_custom |
|
2000 | mkdir -p $target_dir/traefik_custom | |
2001 | cp -r $PWD/config/traefik/* $target_dir/traefik_custom/ |
|
2001 | cp -r $PWD/config/traefik/* $target_dir/traefik_custom/ | |
2002 |
|
2002 | |||
2003 | echo "$(green bootstrap_overrides: overrides extracted to $target_dir)" |
|
2003 | echo "$(green bootstrap_overrides: overrides extracted to $target_dir)" | |
2004 | } |
|
2004 | } | |
2005 |
|
2005 | |||
2006 | cur_date=$(date '+%Y-%m-%d %H:%M:%S') |
|
2006 | cur_date=$(date '+%Y-%m-%d %H:%M:%S') | |
2007 |
|
2007 | |||
2008 | # Init the config ! |
|
2008 | # Init the config ! | |
2009 | if [[ ! -f "$CONFIG_FILE" ]]; then |
|
2009 | if [[ ! -f "$CONFIG_FILE" ]]; then | |
2010 | echo "config: init new config at: $CONFIG_FILE" |
|
2010 | echo "config: init new config at: $CONFIG_FILE" | |
2011 | config_init |
|
2011 | config_init | |
2012 | else |
|
2012 | else | |
2013 | echo "config: re-using present config at: $CONFIG_FILE" |
|
2013 | echo "config: re-using present config at: $CONFIG_FILE" | |
2014 | fi |
|
2014 | fi | |
2015 |
|
2015 | |||
2016 | for stage in $BOOTSTRAP_STAGES; do |
|
2016 | for stage in $BOOTSTRAP_STAGES; do | |
2017 |
|
2017 | |||
2018 | stage_name=$(echo $stage | cut -d ":" -f 1) |
|
2018 | stage_name=$(echo $stage | cut -d ":" -f 1) | |
2019 | stage_func=$(echo $stage | cut -d ":" -f 2) |
|
2019 | stage_func=$(echo $stage | cut -d ":" -f 2) | |
2020 |
|
2020 | |||
2021 | if ! config_has_key $stage_name ; then |
|
2021 | if ! config_has_key $stage_name ; then | |
2022 | echo "$(green \* bootstrap: \'$stage_name\' stage not found\; running now... )" |
|
2022 | echo "$(green \* bootstrap: \'$stage_name\' stage not found\; running now... )" | |
2023 | $stage_func |
|
2023 | $stage_func | |
2024 | config_set "$stage_name" $cur_date |
|
2024 | config_set "$stage_name" $cur_date | |
2025 | else |
|
2025 | else | |
2026 | if [ $force ]; then |
|
2026 | if [ $force ]; then | |
2027 | echo "$(green \* bootstrap: \'$stage_name\' is present!\; FORCE running now... )" |
|
2027 | echo "$(green \* bootstrap: \'$stage_name\' is present!\; FORCE running now... )" | |
2028 | $stage_func $force |
|
2028 | $stage_func $force | |
2029 | config_set "$stage_name" $cur_date |
|
2029 | config_set "$stage_name" $cur_date | |
2030 | else |
|
2030 | else | |
2031 | echo "$(yellow \* bootstrap: \'$stage_name\' already present, use --force to run it again)" |
|
2031 | echo "$(yellow \* bootstrap: \'$stage_name\' already present, use --force to run it again)" | |
2032 | fi |
|
2032 | fi | |
2033 | fi |
|
2033 | fi | |
2034 |
|
2034 | |||
2035 | done |
|
2035 | done | |
2036 |
|
2036 | |||
2037 | echo "~~~~ $(green Bootstrap completed) ~~~~" |
|
2037 | echo "~~~~ $(green Bootstrap completed) ~~~~" | |
2038 |
|
2038 | |||
2039 | get_started |
|
2039 | get_started | |
2040 |
|
2040 | |||
2041 | } |
|
2041 | } | |
2042 |
|
2042 | |||
2043 | # :command.function |
|
2043 | # :command.function | |
2044 | rcstack_self_update_command() { |
|
2044 | rcstack_self_update_command() { | |
2045 | # src/self_update_command.sh |
|
2045 | # src/self_update_command.sh | |
2046 | check_bootstrap |
|
2046 | check_bootstrap | |
2047 |
|
2047 | |||
2048 | DEBUG=${args[--debug]} |
|
2048 | DEBUG=${args[--debug]} | |
2049 | AUTH_TOKEN=${args[--auth-token]} |
|
2049 | AUTH_TOKEN=${args[--auth-token]} | |
2050 | SERVER_URL=${args[--server-url]} |
|
2050 | SERVER_URL=${args[--server-url]} | |
2051 | installer_revision=${args[--installer-revision]} |
|
2051 | installer_revision=${args[--installer-revision]} | |
2052 | revision=${args[--revision]} |
|
2052 | revision=${args[--revision]} | |
2053 |
|
2053 | |||
2054 | FETCH_FROM=$SERVER_URL/rhodecode-enterprise-docker/raw/$installer_revision/scripts/rcstack/rcstack |
|
2054 | FETCH_FROM=$SERVER_URL/rhodecode-enterprise-docker/raw/$installer_revision/scripts/rcstack/rcstack | |
2055 |
|
2055 | |||
2056 | FINAL_TARGET=$PWD/scripts/rcstack/rcstack |
|
2056 | FINAL_TARGET=$PWD/scripts/rcstack/rcstack | |
2057 |
|
2057 | |||
2058 | DL_TARGET=$PWD/scripts/rcstack/rcstack.tmp |
|
2058 | DL_TARGET=$PWD/scripts/rcstack/rcstack.tmp | |
2059 |
|
2059 | |||
2060 | #ensure we have this dir ! |
|
2060 | #ensure we have this dir ! | |
2061 | mkdir -p $PWD/scripts/rcstack |
|
2061 | mkdir -p $PWD/scripts/rcstack | |
2062 |
|
2062 | |||
2063 | .env --file $RUNTIME_ENV |
|
2063 | .env --file $RUNTIME_ENV | |
2064 | .env get RC_VERSION |
|
2064 | .env get RC_VERSION | |
2065 |
|
2065 | |||
2066 | ENV_VER=$REPLY |
|
2066 | ENV_VER=$REPLY | |
2067 |
|
2067 | |||
2068 | echo "$(green self-update: downloading new $RC_SCRIPT_NAME script from $FETCH_FROM)" |
|
2068 | echo "$(green self-update: downloading new $RC_SCRIPT_NAME script from $FETCH_FROM)" | |
2069 | if [[ $DEBUG ]]; then |
|
2069 | if [[ $DEBUG ]]; then | |
2070 | echo "running: curl --no-progress-meter --fail --header \"X-Rc-Auth-Token: $AUTH_TOKEN\" -o $DL_TARGET -L $FETCH_FROM" |
|
2070 | echo "running: curl --no-progress-meter --fail --header \"X-Rc-Auth-Token: $AUTH_TOKEN\" -o $DL_TARGET -L $FETCH_FROM" | |
2071 | fi |
|
2071 | fi | |
2072 |
|
2072 | |||
2073 |
curl --no-progress-meter --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -o $DL_TARGET |
|
2073 | curl -L --no-progress-meter --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -o $DL_TARGET $FETCH_FROM | |
2074 |
|
2074 | |||
2075 | chmod +x $DL_TARGET |
|
2075 | chmod +x $DL_TARGET | |
2076 |
|
2076 | |||
|
2077 | version_old=0 | |||
|
2078 | rc_version_old=0 | |||
|
2079 | ||||
|
2080 | # check if we have OLD file, in case we don't just set versions to 0 | |||
|
2081 | if [[ -f "$FINAL_TARGET" ]]; then | |||
2077 | version_old=$($FINAL_TARGET --version) |
|
2082 | version_old=$($FINAL_TARGET --version) | |
2078 | rc_version_old=$($FINAL_TARGET cli image-info) |
|
2083 | rc_version_old=$($FINAL_TARGET cli image-info) | |
|
2084 | fi | |||
2079 |
|
2085 | |||
2080 | version_dl=$($DL_TARGET --version) |
|
2086 | version_dl=$($DL_TARGET --version) | |
2081 | rc_version_dl=$($DL_TARGET cli image-info) |
|
2087 | rc_version_dl=$($DL_TARGET cli image-info) | |
2082 |
|
2088 | |||
2083 | echo "self-update: $RC_SCRIPT_NAME version downloaded: $version_dl" |
|
2089 | echo "self-update: $RC_SCRIPT_NAME version downloaded: $version_dl" | |
2084 |
|
2090 | |||
2085 | if [[ $DEBUG ]]; then |
|
2091 | if [[ $DEBUG ]]; then | |
2086 | echo "DEBUG: old-script ver: $version_old" |
|
2092 | echo "DEBUG: old-script ver: $version_old" | |
2087 | echo "DEBUG: new-script ver: $version_dl" |
|
2093 | echo "DEBUG: new-script ver: $version_dl" | |
2088 | echo "DEBUG: " |
|
2094 | echo "DEBUG: " | |
2089 | echo "DEBUG: .runtime.env set version $ENV_VER" |
|
2095 | echo "DEBUG: .runtime.env set version $ENV_VER" | |
2090 | echo "DEBUG: " |
|
2096 | echo "DEBUG: " | |
2091 | echo "DEBUG: old-script: RC VERSION: $rc_version_old" |
|
2097 | echo "DEBUG: old-script: RC VERSION: $rc_version_old" | |
2092 | echo "DEBUG: new-script: RC VERSION: $rc_version_dl" |
|
2098 | echo "DEBUG: new-script: RC VERSION: $rc_version_dl" | |
2093 | fi |
|
2099 | fi | |
2094 |
|
2100 | |||
2095 | if [[ $version_old == "$version_dl" ]]; then |
|
2101 | if [[ $version_old == "$version_dl" ]]; then | |
2096 | echo "$(yellow self-update: downloaded version is the same as current version $version_dl, exiting...)" |
|
2102 | echo "$(yellow self-update: downloaded version is the same as current version $version_dl, exiting...)" | |
2097 | exit |
|
2103 | exit | |
2098 | fi |
|
2104 | fi | |
2099 |
|
2105 | |||
2100 | if [[ $rc_version_old == "$rc_version_dl" ]]; then |
|
2106 | if [[ $rc_version_old == "$rc_version_dl" ]]; then | |
2101 | echo "$(yellow self-update: already set RC_VERSION=$rc_version_dl seems to be up-to date)" |
|
2107 | echo "$(yellow self-update: already set RC_VERSION=$rc_version_dl seems to be up-to date)" | |
2102 | else |
|
2108 | else | |
2103 | echo "$(green self-update: saving new RC_VERSION=$rc_version_dl to runtime.env file)" |
|
2109 | echo "$(green self-update: saving new RC_VERSION=$rc_version_dl to runtime.env file)" | |
2104 |
|
2110 | |||
2105 | echo "currently .runtime.env file uses image: $ENV_VER" |
|
2111 | echo "currently .runtime.env file uses image: $ENV_VER" | |
2106 | while true; do |
|
2112 | while true; do | |
2107 | read -p "self-update: Would you like to continue with setting RC_VERSION=$rc_version_dl into .runtime.env file? [yn] " yn |
|
2113 | read -p "self-update: Would you like to continue with setting RC_VERSION=$rc_version_dl into .runtime.env file? [yn] " yn | |
2108 | case $yn in |
|
2114 | case $yn in | |
2109 | [Yy]*) |
|
2115 | [Yy]*) | |
2110 | .env set RC_VERSION=$rc_version_dl |
|
2116 | .env set RC_VERSION=$rc_version_dl | |
2111 | echo "self-update: new version set into config" |
|
2117 | echo "self-update: new version set into config" | |
2112 | break ;; |
|
2118 | break ;; | |
2113 | [Nn]*) |
|
2119 | [Nn]*) | |
2114 | break ;; |
|
2120 | break ;; | |
2115 | *) echo "Please answer y or n." ;; |
|
2121 | *) echo "Please answer y or n." ;; | |
2116 | esac |
|
2122 | esac | |
2117 | done |
|
2123 | done | |
2118 |
|
2124 | |||
2119 | fi |
|
2125 | fi | |
2120 |
|
2126 | |||
2121 | echo "$(green self-update: updating $RC_SCRIPT_NAME script to new version: $version_dl)" |
|
2127 | echo "$(green self-update: updating $RC_SCRIPT_NAME script to new version: $version_dl)" | |
|
2128 | ||||
|
2129 | if [[ -f "$FINAL_TARGET" ]]; then | |||
2122 | rm $FINAL_TARGET && mv -v $DL_TARGET $FINAL_TARGET |
|
2130 | rm $FINAL_TARGET && mv -v $DL_TARGET $FINAL_TARGET | |
|
2131 | else | |||
|
2132 | mv -v $DL_TARGET $FINAL_TARGET | |||
|
2133 | fi | |||
2123 |
|
2134 | |||
2124 | get_docker_definitions $revision $DEBUG |
|
2135 | get_docker_definitions $revision $DEBUG | |
2125 |
|
2136 | |||
2126 | exit |
|
2137 | exit | |
2127 | } |
|
2138 | } | |
2128 |
|
2139 | |||
2129 | # :command.function |
|
2140 | # :command.function | |
2130 | rcstack_stack_router_command() { |
|
2141 | rcstack_stack_router_command() { | |
2131 | # src/stack_router_command.sh |
|
2142 | # src/stack_router_command.sh | |
2132 | check_bootstrap |
|
2143 | check_bootstrap | |
2133 |
|
2144 | |||
2134 | DEBUG=${args[--debug]} |
|
2145 | DEBUG=${args[--debug]} | |
2135 | ENV_FILE=${args[--env-file-path]} |
|
2146 | ENV_FILE=${args[--env-file-path]} | |
2136 |
|
2147 | |||
2137 | if [[ ! -f $RC_STACK_ROUTER_EXT ]]; then |
|
2148 | if [[ ! -f $RC_STACK_ROUTER_EXT ]]; then | |
2138 | RC_STACK_ROUTER_EXT="" |
|
2149 | RC_STACK_ROUTER_EXT="" | |
2139 | else |
|
2150 | else | |
2140 | RC_STACK_ROUTER_EXT="-f $RC_STACK_ROUTER_EXT" |
|
2151 | RC_STACK_ROUTER_EXT="-f $RC_STACK_ROUTER_EXT" | |
2141 | fi |
|
2152 | fi | |
2142 |
|
2153 | |||
2143 | CMD_ROUTER="\ |
|
2154 | CMD_ROUTER="\ | |
2144 | RC_ENV_FILE=$ENV_FILE docker compose \ |
|
2155 | RC_ENV_FILE=$ENV_FILE docker compose \ | |
2145 | --env-file $ENV_FILE \ |
|
2156 | --env-file $ENV_FILE \ | |
2146 | $ENV_EXPAND \ |
|
2157 | $ENV_EXPAND \ | |
2147 | -p rc_cluster_router \ |
|
2158 | -p rc_cluster_router \ | |
2148 | -f docker-compose-base.yaml \ |
|
2159 | -f docker-compose-base.yaml \ | |
2149 | -f docker-compose-router.yaml $RC_STACK_ROUTER_EXT" |
|
2160 | -f docker-compose-router.yaml $RC_STACK_ROUTER_EXT" | |
2150 |
|
2161 | |||
2151 | if [[ $DEBUG ]]; then |
|
2162 | if [[ $DEBUG ]]; then | |
2152 | echo "---" |
|
2163 | echo "---" | |
2153 | echo "stacks docker: $RC_STACK_ROUTER_EXT_LCL" |
|
2164 | echo "stacks docker: $RC_STACK_ROUTER_EXT_LCL" | |
2154 | echo "running command: ${CMD_ROUTER}" |
|
2165 | echo "running command: ${CMD_ROUTER}" | |
2155 | echo "ARGS: ${other_args[*]}" |
|
2166 | echo "ARGS: ${other_args[*]}" | |
2156 | echo "---" |
|
2167 | echo "---" | |
2157 | fi |
|
2168 | fi | |
2158 | eval "${CMD_ROUTER} ${other_args[*]}" |
|
2169 | eval "${CMD_ROUTER} ${other_args[*]}" | |
2159 |
|
2170 | |||
2160 | } |
|
2171 | } | |
2161 |
|
2172 | |||
2162 | # :command.function |
|
2173 | # :command.function | |
2163 | rcstack_stack_metrics_command() { |
|
2174 | rcstack_stack_metrics_command() { | |
2164 | # src/stack_metrics_command.sh |
|
2175 | # src/stack_metrics_command.sh | |
2165 | check_bootstrap |
|
2176 | check_bootstrap | |
2166 |
|
2177 | |||
2167 | DEBUG=${args[--debug]} |
|
2178 | DEBUG=${args[--debug]} | |
2168 | ENV_FILE=${args[--env-file-path]} |
|
2179 | ENV_FILE=${args[--env-file-path]} | |
2169 |
|
2180 | |||
2170 | if [[ ! -f $RC_STACK_METRICS_EXT ]]; then |
|
2181 | if [[ ! -f $RC_STACK_METRICS_EXT ]]; then | |
2171 | RC_STACK_METRICS_EXT_LCL="" |
|
2182 | RC_STACK_METRICS_EXT_LCL="" | |
2172 | else |
|
2183 | else | |
2173 | RC_STACK_METRICS_EXT_LCL="-f $RC_STACK_METRICS_EXT" |
|
2184 | RC_STACK_METRICS_EXT_LCL="-f $RC_STACK_METRICS_EXT" | |
2174 | fi |
|
2185 | fi | |
2175 |
|
2186 | |||
2176 | CMD_METRICS="\ |
|
2187 | CMD_METRICS="\ | |
2177 | RC_ENV_FILE=$ENV_FILE docker compose \ |
|
2188 | RC_ENV_FILE=$ENV_FILE docker compose \ | |
2178 | --env-file $ENV_FILE \ |
|
2189 | --env-file $ENV_FILE \ | |
2179 | $ENV_EXPAND \ |
|
2190 | $ENV_EXPAND \ | |
2180 | -p rc_cluster_metrics \ |
|
2191 | -p rc_cluster_metrics \ | |
2181 | -f docker-compose-base.yaml \ |
|
2192 | -f docker-compose-base.yaml \ | |
2182 | -f docker-compose-metrics.yaml $RC_STACK_METRICS_EXT_LCL" |
|
2193 | -f docker-compose-metrics.yaml $RC_STACK_METRICS_EXT_LCL" | |
2183 |
|
2194 | |||
2184 | if [[ $DEBUG ]]; then |
|
2195 | if [[ $DEBUG ]]; then | |
2185 | echo "---" |
|
2196 | echo "---" | |
2186 | echo "stacks docker: $RC_STACK_METRICS_EXT_LCL" |
|
2197 | echo "stacks docker: $RC_STACK_METRICS_EXT_LCL" | |
2187 | echo "running command: ${CMD_METRICS}" |
|
2198 | echo "running command: ${CMD_METRICS}" | |
2188 | echo "ARGS: ${other_args[*]}" |
|
2199 | echo "ARGS: ${other_args[*]}" | |
2189 | echo "---" |
|
2200 | echo "---" | |
2190 | fi |
|
2201 | fi | |
2191 | eval "${CMD_METRICS} ${other_args[*]}" |
|
2202 | eval "${CMD_METRICS} ${other_args[*]}" | |
2192 | } |
|
2203 | } | |
2193 |
|
2204 | |||
2194 | # :command.function |
|
2205 | # :command.function | |
2195 | rcstack_stack_services_command() { |
|
2206 | rcstack_stack_services_command() { | |
2196 | # src/stack_services_command.sh |
|
2207 | # src/stack_services_command.sh | |
2197 | check_bootstrap |
|
2208 | check_bootstrap | |
2198 |
|
2209 | |||
2199 | DEBUG=${args[--debug]} |
|
2210 | DEBUG=${args[--debug]} | |
2200 | ENV_FILE=${args[--env-file-path]} |
|
2211 | ENV_FILE=${args[--env-file-path]} | |
2201 |
|
2212 | |||
2202 | if [[ ! -f $RC_STACK_SERVICES_EXT ]]; then |
|
2213 | if [[ ! -f $RC_STACK_SERVICES_EXT ]]; then | |
2203 | RC_STACK_SERVICES_EXT_LCL="" |
|
2214 | RC_STACK_SERVICES_EXT_LCL="" | |
2204 | else |
|
2215 | else | |
2205 | RC_STACK_SERVICES_EXT_LCL="-f $RC_STACK_SERVICES_EXT" |
|
2216 | RC_STACK_SERVICES_EXT_LCL="-f $RC_STACK_SERVICES_EXT" | |
2206 | fi |
|
2217 | fi | |
2207 |
|
2218 | |||
2208 | RC_STACK_PROFILES="--profile database --profile redis --profile elasticsearch --profile channelstream" |
|
2219 | RC_STACK_PROFILES="--profile database --profile redis --profile elasticsearch --profile channelstream" | |
2209 |
|
2220 | |||
2210 | CMD_SERVICES="\ |
|
2221 | CMD_SERVICES="\ | |
2211 | RC_ENV_FILE=$ENV_FILE docker compose \ |
|
2222 | RC_ENV_FILE=$ENV_FILE docker compose \ | |
2212 | --env-file $ENV_FILE \ |
|
2223 | --env-file $ENV_FILE \ | |
2213 | $ENV_EXPAND \ |
|
2224 | $ENV_EXPAND \ | |
2214 | $RC_STACK_PROFILES \ |
|
2225 | $RC_STACK_PROFILES \ | |
2215 | -p rc_cluster_services \ |
|
2226 | -p rc_cluster_services \ | |
2216 | -f docker-compose-base.yaml \ |
|
2227 | -f docker-compose-base.yaml \ | |
2217 | -f docker-compose-services.yaml $RC_STACK_SERVICES_EXT_LCL" |
|
2228 | -f docker-compose-services.yaml $RC_STACK_SERVICES_EXT_LCL" | |
2218 |
|
2229 | |||
2219 | if [[ $DEBUG ]]; then |
|
2230 | if [[ $DEBUG ]]; then | |
2220 | echo "---" |
|
2231 | echo "---" | |
2221 | echo "stacks docker: $RC_STACK_SERVICES_EXT_LCL" |
|
2232 | echo "stacks docker: $RC_STACK_SERVICES_EXT_LCL" | |
2222 | echo "running command: ${CMD_SERVICES}" |
|
2233 | echo "running command: ${CMD_SERVICES}" | |
2223 | echo "ARGS: ${other_args[*]}" |
|
2234 | echo "ARGS: ${other_args[*]}" | |
2224 | echo "---" |
|
2235 | echo "---" | |
2225 | fi |
|
2236 | fi | |
2226 |
|
2237 | |||
2227 | eval "${CMD_SERVICES} ${other_args[*]}" |
|
2238 | eval "${CMD_SERVICES} ${other_args[*]}" | |
2228 | } |
|
2239 | } | |
2229 |
|
2240 | |||
2230 | # :command.function |
|
2241 | # :command.function | |
2231 | rcstack_stack_rhodecode_command() { |
|
2242 | rcstack_stack_rhodecode_command() { | |
2232 | # src/stack_rhodecode_command.sh |
|
2243 | # src/stack_rhodecode_command.sh | |
2233 | check_bootstrap |
|
2244 | check_bootstrap | |
2234 |
|
2245 | |||
2235 | DEBUG=${args[--debug]} |
|
2246 | DEBUG=${args[--debug]} | |
2236 | ENV_FILE=${args[--env-file-path]} |
|
2247 | ENV_FILE=${args[--env-file-path]} | |
2237 |
|
2248 | |||
2238 | if [[ ! -f $RC_STACK_RHODECODE_EXT ]]; then |
|
2249 | if [[ ! -f $RC_STACK_RHODECODE_EXT ]]; then | |
2239 | RC_STACK_RHODECODE_EXT_LCL="" |
|
2250 | RC_STACK_RHODECODE_EXT_LCL="" | |
2240 | else |
|
2251 | else | |
2241 | RC_STACK_RHODECODE_EXT_LCL="-f $RC_STACK_RHODECODE_EXT" |
|
2252 | RC_STACK_RHODECODE_EXT_LCL="-f $RC_STACK_RHODECODE_EXT" | |
2242 | fi |
|
2253 | fi | |
2243 |
|
2254 | |||
2244 | CMD_RHODECODE="\ |
|
2255 | CMD_RHODECODE="\ | |
2245 | RC_ENV_FILE=$ENV_FILE docker compose \ |
|
2256 | RC_ENV_FILE=$ENV_FILE docker compose \ | |
2246 | --env-file $ENV_FILE \ |
|
2257 | --env-file $ENV_FILE \ | |
2247 | $ENV_EXPAND \ |
|
2258 | $ENV_EXPAND \ | |
2248 | -p rc_cluster_apps \ |
|
2259 | -p rc_cluster_apps \ | |
2249 | -f docker-compose-base.yaml \ |
|
2260 | -f docker-compose-base.yaml \ | |
2250 | -f docker-compose-apps.yaml $RC_STACK_RHODECODE_EXT_LCL" |
|
2261 | -f docker-compose-apps.yaml $RC_STACK_RHODECODE_EXT_LCL" | |
2251 |
|
2262 | |||
2252 | CMD_RHODECODE_SOURCE="\ |
|
2263 | CMD_RHODECODE_SOURCE="\ | |
2253 | RC_ENV_FILE=$ENV_FILE docker compose \ |
|
2264 | RC_ENV_FILE=$ENV_FILE docker compose \ | |
2254 | --env-file $ENV_FILE \ |
|
2265 | --env-file $ENV_FILE \ | |
2255 | $ENV_EXPAND \ |
|
2266 | $ENV_EXPAND \ | |
2256 | -p rc_cluster_apps \ |
|
2267 | -p rc_cluster_apps \ | |
2257 | -f docker-compose-base.yaml \ |
|
2268 | -f docker-compose-base.yaml \ | |
2258 | -f docker-compose-apps.yaml \ |
|
2269 | -f docker-compose-apps.yaml \ | |
2259 | -f docker-compose-apps.source.yaml $RC_STACK_RHODECODE_EXT_LCL" |
|
2270 | -f docker-compose-apps.source.yaml $RC_STACK_RHODECODE_EXT_LCL" | |
2260 |
|
2271 | |||
2261 | if [[ $DEBUG ]]; then |
|
2272 | if [[ $DEBUG ]]; then | |
2262 | echo "---" |
|
2273 | echo "---" | |
2263 | echo "stacks docker: $RC_STACK_RHODECODE_EXT_LCL" |
|
2274 | echo "stacks docker: $RC_STACK_RHODECODE_EXT_LCL" | |
2264 | echo "running command: ${CMD_RHODECODE}" |
|
2275 | echo "running command: ${CMD_RHODECODE}" | |
2265 | echo "ARGS: ${other_args[*]}" |
|
2276 | echo "ARGS: ${other_args[*]}" | |
2266 | echo "---" |
|
2277 | echo "---" | |
2267 | fi |
|
2278 | fi | |
2268 | eval "${CMD_RHODECODE} ${other_args[*]}" |
|
2279 | eval "${CMD_RHODECODE} ${other_args[*]}" | |
2269 |
|
2280 | |||
2270 | } |
|
2281 | } | |
2271 |
|
2282 | |||
2272 | # :command.function |
|
2283 | # :command.function | |
2273 | rcstack_stack_all_command() { |
|
2284 | rcstack_stack_all_command() { | |
2274 | # src/stack_all_command.sh |
|
2285 | # src/stack_all_command.sh | |
2275 | check_bootstrap |
|
2286 | check_bootstrap | |
2276 |
|
2287 | |||
2277 | DEBUG=${args[--debug]} |
|
2288 | DEBUG=${args[--debug]} | |
2278 |
|
2289 | |||
2279 | stack_lst=$VALID_SERVICES |
|
2290 | stack_lst=$VALID_SERVICES | |
2280 |
|
2291 | |||
2281 | for stack in $stack_lst; do |
|
2292 | for stack in $stack_lst; do | |
2282 | ./$RC_SCRIPT_NAME stack $stack ${other_args[*]} |
|
2293 | ./$RC_SCRIPT_NAME stack $stack ${other_args[*]} | |
2283 | done |
|
2294 | done | |
2284 |
|
2295 | |||
2285 | } |
|
2296 | } | |
2286 |
|
2297 | |||
2287 | # :command.function |
|
2298 | # :command.function | |
2288 | rcstack_stack_status_command() { |
|
2299 | rcstack_stack_status_command() { | |
2289 | # src/stack_status_command.sh |
|
2300 | # src/stack_status_command.sh | |
2290 | check_bootstrap |
|
2301 | check_bootstrap | |
2291 | DEBUG=${args[--debug]} |
|
2302 | DEBUG=${args[--debug]} | |
2292 | DETAILED=${args[--detailed]} |
|
2303 | DETAILED=${args[--detailed]} | |
2293 |
|
2304 | |||
2294 | .env --file $RUNTIME_ENV |
|
2305 | .env --file $RUNTIME_ENV | |
2295 | .env get RC_APP_BASE_URL |
|
2306 | .env get RC_APP_BASE_URL | |
2296 | RC_APP_BASE_URL=$REPLY |
|
2307 | RC_APP_BASE_URL=$REPLY | |
2297 |
|
2308 | |||
2298 | if [[ $DEBUG ]]; then |
|
2309 | if [[ $DEBUG ]]; then | |
2299 | echo "---" |
|
2310 | echo "---" | |
2300 | ps_cmd=$(docker ps --filter=name=rc_cluster --format="{{.ID}}") |
|
2311 | ps_cmd=$(docker ps --filter=name=rc_cluster --format="{{.ID}}") | |
2301 |
|
2312 | |||
2302 | for service in $ps_cmd; do |
|
2313 | for service in $ps_cmd; do | |
2303 |
|
2314 | |||
2304 | servicename=`docker inspect --format '{{ .Name }}' $service` |
|
2315 | servicename=`docker inspect --format '{{ .Name }}' $service` | |
2305 | servicename=${servicename:1} |
|
2316 | servicename=${servicename:1} | |
2306 | echo $servicename |
|
2317 | echo $servicename | |
2307 | docker inspect $service --format='{{.State.Status}}: {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' |
|
2318 | docker inspect $service --format='{{.State.Status}}: {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' | |
2308 | echo "" |
|
2319 | echo "" | |
2309 |
|
2320 | |||
2310 | done |
|
2321 | done | |
2311 | echo "---" |
|
2322 | echo "---" | |
2312 | fi |
|
2323 | fi | |
2313 |
|
2324 | |||
2314 | echo "Running hostname: $RC_APP_BASE_URL" |
|
2325 | echo "Running hostname: $RC_APP_BASE_URL" | |
2315 | if [[ $DETAILED ]]; then |
|
2326 | if [[ $DETAILED ]]; then | |
2316 | ps_cmd=$(docker ps --filter=name=rc_cluster --format="{{.ID}}") |
|
2327 | ps_cmd=$(docker ps --filter=name=rc_cluster --format="{{.ID}}") | |
2317 |
|
2328 | |||
2318 | for service in $ps_cmd; do |
|
2329 | for service in $ps_cmd; do | |
2319 | servicename=`docker inspect --format '{{ .Name }}' $service` |
|
2330 | servicename=`docker inspect --format '{{ .Name }}' $service` | |
2320 | servicename=${servicename:1} |
|
2331 | servicename=${servicename:1} | |
2321 | printf "CONTAINER:\\t$servicename\n" |
|
2332 | printf "CONTAINER:\\t$servicename\n" | |
2322 | printf "LOGS:\\t\\tdocker logs --tail=100 $service\n" |
|
2333 | printf "LOGS:\\t\\tdocker logs --tail=100 $service\n" | |
2323 | docker ps --filter=name=$servicename --format="ID:\\t\\t{{.ID}}\nIMAGE:\\t\\t{{.Image}}\nSTATUS:\\t\\t{{.Status}}\nPORTS:\\t\\t{{.Ports}}\n" |
|
2334 | docker ps --filter=name=$servicename --format="ID:\\t\\t{{.ID}}\nIMAGE:\\t\\t{{.Image}}\nSTATUS:\\t\\t{{.Status}}\nPORTS:\\t\\t{{.Ports}}\n" | |
2324 | echo "" |
|
2335 | echo "" | |
2325 | done |
|
2336 | done | |
2326 | else |
|
2337 | else | |
2327 | 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 ) |
|
2338 | 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 ) | |
2328 | fi |
|
2339 | fi | |
2329 |
|
2340 | |||
2330 | } |
|
2341 | } | |
2331 |
|
2342 | |||
2332 | # :command.function |
|
2343 | # :command.function | |
2333 | rcstack_stack_upgrade_router_command() { |
|
2344 | rcstack_stack_upgrade_router_command() { | |
2334 | # src/stack_upgrade_router_command.sh |
|
2345 | # src/stack_upgrade_router_command.sh | |
2335 | echo "To upgrade this stack run this:" |
|
2346 | echo "To upgrade this stack run this:" | |
2336 | echo "./$RC_SCRIPT_NAME stack router up --force-recreate --build --detach" |
|
2347 | echo "./$RC_SCRIPT_NAME stack router up --force-recreate --build --detach" | |
2337 | echo "" |
|
2348 | echo "" | |
2338 | echo "NOTE: To reclaim space occupied by old images, run:" |
|
2349 | echo "NOTE: To reclaim space occupied by old images, run:" | |
2339 | echo "docker image prune -f" |
|
2350 | echo "docker image prune -f" | |
2340 |
|
2351 | |||
2341 | } |
|
2352 | } | |
2342 |
|
2353 | |||
2343 | # :command.function |
|
2354 | # :command.function | |
2344 | rcstack_stack_upgrade_metrics_command() { |
|
2355 | rcstack_stack_upgrade_metrics_command() { | |
2345 | # src/stack_upgrade_metrics_command.sh |
|
2356 | # src/stack_upgrade_metrics_command.sh | |
2346 | echo "To upgrade this stack run this:" |
|
2357 | echo "To upgrade this stack run this:" | |
2347 | echo "./$RC_SCRIPT_NAME stack metrics up --force-recreate --build --detach" |
|
2358 | echo "./$RC_SCRIPT_NAME stack metrics up --force-recreate --build --detach" | |
2348 | echo "" |
|
2359 | echo "" | |
2349 | echo "NOTE: To reclaim space occupied by old images, run:" |
|
2360 | echo "NOTE: To reclaim space occupied by old images, run:" | |
2350 | echo "docker image prune -f" |
|
2361 | echo "docker image prune -f" | |
2351 |
|
2362 | |||
2352 | } |
|
2363 | } | |
2353 |
|
2364 | |||
2354 | # :command.function |
|
2365 | # :command.function | |
2355 | rcstack_stack_upgrade_services_command() { |
|
2366 | rcstack_stack_upgrade_services_command() { | |
2356 | # src/stack_upgrade_services_command.sh |
|
2367 | # src/stack_upgrade_services_command.sh | |
2357 | echo "To upgrade this stack run this:" |
|
2368 | echo "To upgrade this stack run this:" | |
2358 | echo "./$RC_SCRIPT_NAME stack services up --force-recreate --build --detach" |
|
2369 | echo "./$RC_SCRIPT_NAME stack services up --force-recreate --build --detach" | |
2359 | echo "" |
|
2370 | echo "" | |
2360 | echo "NOTE: To reclaim space occupied by old images, run:" |
|
2371 | echo "NOTE: To reclaim space occupied by old images, run:" | |
2361 | echo "docker image prune -f" |
|
2372 | echo "docker image prune -f" | |
2362 |
|
2373 | |||
2363 | } |
|
2374 | } | |
2364 |
|
2375 | |||
2365 | # :command.function |
|
2376 | # :command.function | |
2366 | rcstack_stack_upgrade_rhodecode_command() { |
|
2377 | rcstack_stack_upgrade_rhodecode_command() { | |
2367 | # src/stack_upgrade_rhodecode_command.sh |
|
2378 | # src/stack_upgrade_rhodecode_command.sh | |
2368 | check_bootstrap |
|
2379 | check_bootstrap | |
2369 |
|
2380 | |||
2370 | restart_unhealthy=${args[--restart-unhealthy]} |
|
2381 | restart_unhealthy=${args[--restart-unhealthy]} | |
2371 | stop_wait=${args[--stop-wait]} |
|
2382 | stop_wait=${args[--stop-wait]} | |
2372 | docker_stop_wait=3600 |
|
2383 | docker_stop_wait=3600 | |
2373 |
|
2384 | |||
2374 | # search docker IDs for current service |
|
2385 | # search docker IDs for current service | |
2375 | .env --file $RUNTIME_ENV |
|
2386 | .env --file $RUNTIME_ENV | |
2376 |
|
2387 | |||
2377 | .env get RC_VERSION |
|
2388 | .env get RC_VERSION | |
2378 | RC_VERSION=$REPLY |
|
2389 | RC_VERSION=$REPLY | |
2379 |
|
2390 | |||
2380 | .env get RC_EDITION |
|
2391 | .env get RC_EDITION | |
2381 | RC_EDITION=$REPLY |
|
2392 | RC_EDITION=$REPLY | |
2382 |
|
2393 | |||
2383 | if [[ $restart_unhealthy ]]; then |
|
2394 | if [[ $restart_unhealthy ]]; then | |
2384 | unhealthy=$(docker ps --filter health=unhealthy --filter label=autoheal=true --format "{{.ID}}") |
|
2395 | unhealthy=$(docker ps --filter health=unhealthy --filter label=autoheal=true --format "{{.ID}}") | |
2385 |
|
2396 | |||
2386 | if [[ $unhealthy == "" ]]; then |
|
2397 | if [[ $unhealthy == "" ]]; then | |
2387 | echo "$(green no unhealthy containers found)" |
|
2398 | echo "$(green no unhealthy containers found)" | |
2388 | exit |
|
2399 | exit | |
2389 | fi |
|
2400 | fi | |
2390 |
|
2401 | |||
2391 | echo "$(yellow Found unhealthy containers $unhealthy)" |
|
2402 | echo "$(yellow Found unhealthy containers $unhealthy)" | |
2392 | for container in $unhealthy |
|
2403 | for container in $unhealthy | |
2393 | do |
|
2404 | do | |
2394 | docker stats --no-stream $container |
|
2405 | docker stats --no-stream $container | |
2395 | echo "unhealthy_log: restart $container" |
|
2406 | echo "unhealthy_log: restart $container" | |
2396 | docker restart --time=10 $container |
|
2407 | docker restart --time=10 $container | |
2397 | done |
|
2408 | done | |
2398 |
|
2409 | |||
2399 | exit |
|
2410 | exit | |
2400 | fi |
|
2411 | fi | |
2401 |
|
2412 | |||
2402 | echo "Pulling new image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION}" |
|
2413 | echo "Pulling new image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION}" | |
2403 | echo "WARNING: We are about to start downloading the RhodeCode base image" |
|
2414 | echo "WARNING: We are about to start downloading the RhodeCode base image" | |
2404 | echo "This process may take anywhere between a few minutes to an hour, depending on your network speed" |
|
2415 | echo "This process may take anywhere between a few minutes to an hour, depending on your network speed" | |
2405 | echo "running: docker pull -q rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION}" |
|
2416 | echo "running: docker pull -q rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION}" | |
2406 |
|
2417 | |||
2407 | eval "docker pull -q rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION}" |
|
2418 | eval "docker pull -q rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION}" | |
2408 |
|
2419 | |||
2409 | have_tty=1 |
|
2420 | have_tty=1 | |
2410 | # Set a dummy terminal type if none set |
|
2421 | # Set a dummy terminal type if none set | |
2411 | [[ -z "$TERM" ]] && export have_tty=0 |
|
2422 | [[ -z "$TERM" ]] && export have_tty=0 | |
2412 | [[ ! -t 1 ]] && export have_tty=0 |
|
2423 | [[ ! -t 1 ]] && export have_tty=0 | |
2413 |
|
2424 | |||
2414 | set_cursor() { |
|
2425 | set_cursor() { | |
2415 | if [[ $have_tty == 1 ]]; then |
|
2426 | if [[ $have_tty == 1 ]]; then | |
2416 | tput $1 |
|
2427 | tput $1 | |
2417 | fi |
|
2428 | fi | |
2418 | } |
|
2429 | } | |
2419 |
|
2430 | |||
2420 | stop_containers() { |
|
2431 | stop_containers() { | |
2421 | target_container=$1 |
|
2432 | target_container=$1 | |
2422 | docker_stop_wait=$2 |
|
2433 | docker_stop_wait=$2 | |
2423 | stop_wait=$3 |
|
2434 | stop_wait=$3 | |
2424 | target_containers_pat="rc_cluster_apps-$target_container-*" |
|
2435 | target_containers_pat="rc_cluster_apps-$target_container-*" | |
2425 |
|
2436 | |||
2426 | local docker_ids=$(docker ps --filter name="$target_containers_pat" -q) |
|
2437 | local docker_ids=$(docker ps --filter name="$target_containers_pat" -q) | |
2427 | # array with OLD containers |
|
2438 | # array with OLD containers | |
2428 | local old_docker_ids=($docker_ids) |
|
2439 | local old_docker_ids=($docker_ids) | |
2429 |
|
2440 | |||
2430 | scale=$(echo $docker_ids | wc -w) |
|
2441 | scale=$(echo $docker_ids | wc -w) | |
2431 | scale_2=$(($scale*2)) |
|
2442 | scale_2=$(($scale*2)) | |
2432 |
|
2443 | |||
2433 | echo "" |
|
2444 | echo "" | |
2434 | echo "Found $scale services for $target_container" |
|
2445 | echo "Found $scale services for $target_container" | |
2435 | echo "existing docker-ids:" "${old_docker_ids[@]}" |
|
2446 | echo "existing docker-ids:" "${old_docker_ids[@]}" | |
2436 | echo "" |
|
2447 | echo "" | |
2437 |
|
2448 | |||
2438 | echo "Scaling to 2x ($scale_2 total) containers for $target_container" |
|
2449 | echo "Scaling to 2x ($scale_2 total) containers for $target_container" | |
2439 | ./$RC_SCRIPT_NAME stack rhodecode up $target_container --no-recreate --detach --scale $target_container=$scale_2 |
|
2450 | ./$RC_SCRIPT_NAME stack rhodecode up $target_container --no-recreate --detach --scale $target_container=$scale_2 | |
2440 |
|
2451 | |||
2441 | # array with ALL new containers |
|
2452 | # array with ALL new containers | |
2442 | local scaled_docker_ids=($(docker ps --filter name="$target_containers_pat" -q)) |
|
2453 | local scaled_docker_ids=($(docker ps --filter name="$target_containers_pat" -q)) | |
2443 |
|
2454 | |||
2444 | # just NEW containers |
|
2455 | # just NEW containers | |
2445 | local new_docker_ids=($(echo "${old_docker_ids[@]}" "${scaled_docker_ids[@]}" | tr ' ' '\n' | sort | uniq -u)) |
|
2456 | local new_docker_ids=($(echo "${old_docker_ids[@]}" "${scaled_docker_ids[@]}" | tr ' ' '\n' | sort | uniq -u)) | |
2446 | local new_docker_ids_str="${new_docker_ids[@]}" |
|
2457 | local new_docker_ids_str="${new_docker_ids[@]}" | |
2447 |
|
2458 | |||
2448 | # echo "${old_docker_ids[@]}" |
|
2459 | # echo "${old_docker_ids[@]}" | |
2449 | # echo "${scaled_docker_ids[@]}" |
|
2460 | # echo "${scaled_docker_ids[@]}" | |
2450 | # echo "${new_docker_ids[@]}" |
|
2461 | # echo "${new_docker_ids[@]}" | |
2451 |
|
2462 | |||
2452 | echo "" |
|
2463 | echo "" | |
2453 | echo "Scaling completed, running $scale_2 services for upgrade purpose..." |
|
2464 | echo "Scaling completed, running $scale_2 services for upgrade purpose..." | |
2454 | echo "" |
|
2465 | echo "" | |
2455 | echo "Stopping $scale old $target_container containers..." |
|
2466 | echo "Stopping $scale old $target_container containers..." | |
2456 |
|
2467 | |||
2457 | spin='β Ύβ ½β »β β ―β ·' |
|
2468 | spin='β Ύβ ½β »β β ―β ·' | |
2458 | charwidth=1 |
|
2469 | charwidth=1 | |
2459 |
|
2470 | |||
2460 | # wait the required stop-wait time |
|
2471 | # wait the required stop-wait time | |
2461 | #HC: docker inspect --format='{{.Name}}: {{json .ContainerId .State.Health.Status}}' <container-id> |
|
2472 | #HC: docker inspect --format='{{.Name}}: {{json .ContainerId .State.Health.Status}}' <container-id> | |
2462 | local i=$(($stop_wait * 10)) |
|
2473 | local i=$(($stop_wait * 10)) | |
2463 | local status='' |
|
2474 | local status='' | |
2464 |
|
2475 | |||
2465 | # cursor invisible |
|
2476 | # cursor invisible | |
2466 | set_cursor civis |
|
2477 | set_cursor civis | |
2467 | while true |
|
2478 | while true | |
2468 | s=$((i / 10)) |
|
2479 | s=$((i / 10)) | |
2469 | do |
|
2480 | do | |
2470 | i=$(($i-1)) |
|
2481 | i=$(($i-1)) | |
2471 | if [[ $i -lt 1 ]]; then |
|
2482 | if [[ $i -lt 1 ]]; then | |
2472 | break |
|
2483 | break | |
2473 | fi |
|
2484 | fi | |
2474 |
|
2485 | |||
2475 | if [[ "$(($i % 10))" == 0 ]]; |
|
2486 | if [[ "$(($i % 10))" == 0 ]]; | |
2476 | then |
|
2487 | then | |
2477 | is_at_sec=1 |
|
2488 | is_at_sec=1 | |
2478 | else |
|
2489 | else | |
2479 | is_at_sec=0 |
|
2490 | is_at_sec=0 | |
2480 | fi |
|
2491 | fi | |
2481 |
|
2492 | |||
2482 | if [[ $is_at_sec == 1 ]]; then |
|
2493 | if [[ $is_at_sec == 1 ]]; then | |
2483 | new_docker_ids_status_cnt=$(docker inspect --format='{{.State.Health.Status}}' $new_docker_ids_str | grep -c "healthy" || echo "") |
|
2494 | new_docker_ids_status_cnt=$(docker inspect --format='{{.State.Health.Status}}' $new_docker_ids_str | grep -c "healthy" || echo "") | |
2484 | fi |
|
2495 | fi | |
2485 |
|
2496 | |||
2486 | if [[ $new_docker_ids_status_cnt -eq $scale ]]; then |
|
2497 | if [[ $new_docker_ids_status_cnt -eq $scale ]]; then | |
2487 | echo "All $target_container are in HEALTHY state; stopping old ones now" |
|
2498 | echo "All $target_container are in HEALTHY state; stopping old ones now" | |
2488 | echo "" |
|
2499 | echo "" | |
2489 | break |
|
2500 | break | |
2490 | fi |
|
2501 | fi | |
2491 |
|
2502 | |||
2492 | k=$(((k + $charwidth) % ${#spin})) |
|
2503 | k=$(((k + $charwidth) % ${#spin})) | |
2493 |
|
2504 | |||
2494 | if [[ $have_tty == 1 ]]; then |
|
2505 | if [[ $have_tty == 1 ]]; then | |
2495 | printf "%s sending stop signal to $scale old containers in $s seconds..." "${spin:$k:$charwidth}" |
|
2506 | printf "%s sending stop signal to $scale old containers in $s seconds..." "${spin:$k:$charwidth}" | |
2496 | printf "\r" |
|
2507 | printf "\r" | |
2497 | else |
|
2508 | else | |
2498 | if [[ $is_at_sec == 1 ]]; then |
|
2509 | if [[ $is_at_sec == 1 ]]; then | |
2499 | echo "sending stop signal to $scale old containers in $s seconds..." |
|
2510 | echo "sending stop signal to $scale old containers in $s seconds..." | |
2500 | fi |
|
2511 | fi | |
2501 | fi |
|
2512 | fi | |
2502 |
|
2513 | |||
2503 | sleep .1 |
|
2514 | sleep .1 | |
2504 | done |
|
2515 | done | |
2505 | set_cursor cnorm |
|
2516 | set_cursor cnorm | |
2506 |
|
2517 | |||
2507 | for container in $docker_ids |
|
2518 | for container in $docker_ids | |
2508 | do |
|
2519 | do | |
2509 | echo "now running container $container stop with --time $docker_stop_wait" |
|
2520 | echo "now running container $container stop with --time $docker_stop_wait" | |
2510 | docker stop --time $docker_stop_wait $container |
|
2521 | docker stop --time $docker_stop_wait $container | |
2511 | docker rm $container |
|
2522 | docker rm $container | |
2512 | echo "Stopped $container" |
|
2523 | echo "Stopped $container" | |
2513 | done |
|
2524 | done | |
2514 |
|
2525 | |||
2515 | } |
|
2526 | } | |
2516 |
|
2527 | |||
2517 | # VCSSERVER Containers |
|
2528 | # VCSSERVER Containers | |
2518 | stop_containers "vcsserver" $docker_stop_wait $stop_wait |
|
2529 | stop_containers "vcsserver" $docker_stop_wait $stop_wait | |
2519 |
|
2530 | |||
2520 | # RHODECODE Containers |
|
2531 | # RHODECODE Containers | |
2521 | stop_containers "rhodecode" $docker_stop_wait $stop_wait |
|
2532 | stop_containers "rhodecode" $docker_stop_wait $stop_wait | |
2522 |
|
2533 | |||
2523 | # SVN Containers |
|
2534 | # SVN Containers | |
2524 | stop_containers "svn" $docker_stop_wait $stop_wait |
|
2535 | stop_containers "svn" $docker_stop_wait $stop_wait | |
2525 |
|
2536 | |||
2526 | # SSHD Containers |
|
2537 | # SSHD Containers | |
2527 | stop_containers "sshd" $docker_stop_wait $stop_wait |
|
2538 | stop_containers "sshd" $docker_stop_wait $stop_wait | |
2528 |
|
2539 | |||
2529 | ./$RC_SCRIPT_NAME stack rhodecode up celery --force-recreate --build --detach |
|
2540 | ./$RC_SCRIPT_NAME stack rhodecode up celery --force-recreate --build --detach | |
2530 | ./$RC_SCRIPT_NAME stack rhodecode up celery-beat --force-recreate --build --detach |
|
2541 | ./$RC_SCRIPT_NAME stack rhodecode up celery-beat --force-recreate --build --detach | |
2531 |
|
2542 | |||
2532 | echo "Upgrade to rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION} completed" |
|
2543 | echo "Upgrade to rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION} completed" | |
2533 | exit |
|
2544 | exit | |
2534 |
|
2545 | |||
2535 | } |
|
2546 | } | |
2536 |
|
2547 | |||
2537 | # :command.function |
|
2548 | # :command.function | |
2538 | rcstack_cli_image_info_command() { |
|
2549 | rcstack_cli_image_info_command() { | |
2539 | # src/cli_image_info_command.sh |
|
2550 | # src/cli_image_info_command.sh | |
2540 | set_ver=${args[--set-runtime]} |
|
2551 | set_ver=${args[--set-runtime]} | |
2541 |
|
2552 | |||
2542 | echo $rc_image_ver |
|
2553 | echo $rc_image_ver | |
2543 |
|
2554 | |||
2544 | if [ ! -z "$set_ver" ]; then |
|
2555 | if [ ! -z "$set_ver" ]; then | |
2545 | echo "setting runtime version to $set_ver into $RUNTIME_ENV" |
|
2556 | echo "setting runtime version to $set_ver into $RUNTIME_ENV" | |
2546 | .env --file $RUNTIME_ENV |
|
2557 | .env --file $RUNTIME_ENV | |
2547 | .env set RC_VERSION=$set_ver |
|
2558 | .env set RC_VERSION=$set_ver | |
2548 | fi |
|
2559 | fi | |
2549 |
|
2560 | |||
2550 | } |
|
2561 | } | |
2551 |
|
2562 | |||
2552 | # :command.function |
|
2563 | # :command.function | |
2553 | rcstack_cli_redis_command() { |
|
2564 | rcstack_cli_redis_command() { | |
2554 | # src/cli_redis_command.sh |
|
2565 | # src/cli_redis_command.sh | |
2555 | check_bootstrap |
|
2566 | check_bootstrap | |
2556 |
|
2567 | |||
2557 | DEBUG=${args[--debug]} |
|
2568 | DEBUG=${args[--debug]} | |
2558 |
|
2569 | |||
2559 | target_container=rc_cluster_services-redis-1 |
|
2570 | target_container=rc_cluster_services-redis-1 | |
2560 | docker_id=$(docker ps --filter name=$target_container -q) |
|
2571 | docker_id=$(docker ps --filter name=$target_container -q) | |
2561 |
|
2572 | |||
2562 | if [[ $DEBUG ]]; then |
|
2573 | if [[ $DEBUG ]]; then | |
2563 | echo "container id: $docker_id, based on $target_container filter" |
|
2574 | echo "container id: $docker_id, based on $target_container filter" | |
2564 | docker ps |
|
2575 | docker ps | |
2565 | fi |
|
2576 | fi | |
2566 |
|
2577 | |||
2567 | if [ "$docker_id" == "" ]; then |
|
2578 | if [ "$docker_id" == "" ]; then | |
2568 | MSG="Cannot find container ID with name $target_container" |
|
2579 | MSG="Cannot find container ID with name $target_container" | |
2569 | echo "$(red $MSG)" |
|
2580 | echo "$(red $MSG)" | |
2570 | exit 1 |
|
2581 | exit 1 | |
2571 | fi |
|
2582 | fi | |
2572 |
|
2583 | |||
2573 | if [[ $DEBUG ]]; then |
|
2584 | if [[ $DEBUG ]]; then | |
2574 | echo "Running |docker exec --interactive --tty $docker_id $CMD|" |
|
2585 | echo "Running |docker exec --interactive --tty $docker_id $CMD|" | |
2575 | echo "docker exec --interactive --tty $docker_id /bin/bash -c 'redis-cli'" |
|
2586 | echo "docker exec --interactive --tty $docker_id /bin/bash -c 'redis-cli'" | |
2576 | fi |
|
2587 | fi | |
2577 |
|
2588 | |||
2578 | eval "docker exec --interactive --tty $docker_id /bin/bash -c 'redis-cli'" |
|
2589 | eval "docker exec --interactive --tty $docker_id /bin/bash -c 'redis-cli'" | |
2579 |
|
2590 | |||
2580 | } |
|
2591 | } | |
2581 |
|
2592 | |||
2582 | # :command.function |
|
2593 | # :command.function | |
2583 | rcstack_cli_db_command() { |
|
2594 | rcstack_cli_db_command() { | |
2584 | # src/cli_db_command.sh |
|
2595 | # src/cli_db_command.sh | |
2585 | check_bootstrap |
|
2596 | check_bootstrap | |
2586 |
|
2597 | |||
2587 | DEBUG=${args[--debug]} |
|
2598 | DEBUG=${args[--debug]} | |
2588 |
|
2599 | |||
2589 | target_container=rc_cluster_services-database-* |
|
2600 | target_container=rc_cluster_services-database-* | |
2590 | docker_id=$(docker ps --filter name=$target_container -q | head -n1) |
|
2601 | docker_id=$(docker ps --filter name=$target_container -q | head -n1) | |
2591 |
|
2602 | |||
2592 | if [[ $DEBUG ]]; then |
|
2603 | if [[ $DEBUG ]]; then | |
2593 | echo "container id: $docker_id, based on $target_container filter" |
|
2604 | echo "container id: $docker_id, based on $target_container filter" | |
2594 | docker ps |
|
2605 | docker ps | |
2595 | fi |
|
2606 | fi | |
2596 |
|
2607 | |||
2597 | if [ "$docker_id" == "" ]; then |
|
2608 | if [ "$docker_id" == "" ]; then | |
2598 | MSG="Cannot find container ID with name $target_container" |
|
2609 | MSG="Cannot find container ID with name $target_container" | |
2599 | echo "$(red $MSG)" |
|
2610 | echo "$(red $MSG)" | |
2600 | exit 1 |
|
2611 | exit 1 | |
2601 | fi |
|
2612 | fi | |
2602 |
|
2613 | |||
2603 | .env --file $RUNTIME_ENV |
|
2614 | .env --file $RUNTIME_ENV | |
2604 |
|
2615 | |||
2605 | .env get DB_PASSWORD |
|
2616 | .env get DB_PASSWORD | |
2606 | DB_PASSWORD=$REPLY |
|
2617 | DB_PASSWORD=$REPLY | |
2607 |
|
2618 | |||
2608 | .env get DB_NAME |
|
2619 | .env get DB_NAME | |
2609 | DB_NAME=$REPLY |
|
2620 | DB_NAME=$REPLY | |
2610 |
|
2621 | |||
2611 | .env get DB_USER |
|
2622 | .env get DB_USER | |
2612 | DB_USER=$REPLY |
|
2623 | DB_USER=$REPLY | |
2613 |
|
2624 | |||
2614 | if [[ $DEBUG ]]; then |
|
2625 | if [[ $DEBUG ]]; then | |
2615 | echo "Running |docker exec --env-file $RUNTIME_ENV --interactive --tty $docker_id $CMD|" |
|
2626 | echo "Running |docker exec --env-file $RUNTIME_ENV --interactive --tty $docker_id $CMD|" | |
2616 | echo "docker exec --interactive --tty $docker_id /bin/bash -c 'PGPASSWORD=$DB_PASSWORD psql --username=$DB_USER --dbname=$DB_NAME'" |
|
2627 | echo "docker exec --interactive --tty $docker_id /bin/bash -c 'PGPASSWORD=$DB_PASSWORD psql --username=$DB_USER --dbname=$DB_NAME'" | |
2617 | fi |
|
2628 | fi | |
2618 |
|
2629 | |||
2619 | echo |
|
2630 | echo | |
2620 | eval "docker exec --env-file $RUNTIME_ENV --interactive --tty $docker_id /bin/bash -c 'PGPASSWORD=$DB_PASSWORD psql --username=$DB_USER --dbname=$DB_NAME'" |
|
2631 | eval "docker exec --env-file $RUNTIME_ENV --interactive --tty $docker_id /bin/bash -c 'PGPASSWORD=$DB_PASSWORD psql --username=$DB_USER --dbname=$DB_NAME'" | |
2621 |
|
2632 | |||
2622 | } |
|
2633 | } | |
2623 |
|
2634 | |||
2624 | # :command.function |
|
2635 | # :command.function | |
2625 | rcstack_cli_db_upgrade_command() { |
|
2636 | rcstack_cli_db_upgrade_command() { | |
2626 | # src/cli_db_upgrade_command.sh |
|
2637 | # src/cli_db_upgrade_command.sh | |
2627 | check_bootstrap |
|
2638 | check_bootstrap | |
2628 |
|
2639 | |||
2629 | DEBUG=${args[--debug]} |
|
2640 | DEBUG=${args[--debug]} | |
2630 |
|
2641 | |||
2631 | target_container=rc_cluster_services-database-* |
|
2642 | target_container=rc_cluster_services-database-* | |
2632 | docker_id=$(docker ps --filter name=$target_container -q | head -n1) |
|
2643 | docker_id=$(docker ps --filter name=$target_container -q | head -n1) | |
2633 |
|
2644 | |||
2634 | if [[ $DEBUG ]]; then |
|
2645 | if [[ $DEBUG ]]; then | |
2635 | echo "container id: $docker_id, based on $target_container filter" |
|
2646 | echo "container id: $docker_id, based on $target_container filter" | |
2636 | docker ps |
|
2647 | docker ps | |
2637 | fi |
|
2648 | fi | |
2638 |
|
2649 | |||
2639 | if [ "$docker_id" == "" ]; then |
|
2650 | if [ "$docker_id" == "" ]; then | |
2640 | MSG="Cannot find container ID with name $target_container" |
|
2651 | MSG="Cannot find container ID with name $target_container" | |
2641 | echo "$(red $MSG)" |
|
2652 | echo "$(red $MSG)" | |
2642 | exit 1 |
|
2653 | exit 1 | |
2643 | fi |
|
2654 | fi | |
2644 |
|
2655 | |||
2645 | if [[ $DEBUG ]]; then |
|
2656 | if [[ $DEBUG ]]; then | |
2646 | echo "./$RC_SCRIPT_NAME stack rhodecode exec rhodecode /usr/local/bin/rhodecode_bin/bin/rc-upgrade-db /etc/rhodecode/conf/rhodecode.ini --force-yes" |
|
2657 | echo "./$RC_SCRIPT_NAME stack rhodecode exec rhodecode /usr/local/bin/rhodecode_bin/bin/rc-upgrade-db /etc/rhodecode/conf/rhodecode.ini --force-yes" | |
2647 | fi |
|
2658 | fi | |
2648 |
|
2659 | |||
2649 | ./$RC_SCRIPT_NAME stack rhodecode exec rhodecode /usr/local/bin/rhodecode_bin/bin/rc-upgrade-db /etc/rhodecode/conf/rhodecode.ini --force-yes |
|
2660 | ./$RC_SCRIPT_NAME stack rhodecode exec rhodecode /usr/local/bin/rhodecode_bin/bin/rc-upgrade-db /etc/rhodecode/conf/rhodecode.ini --force-yes | |
2650 | } |
|
2661 | } | |
2651 |
|
2662 | |||
2652 | # :command.function |
|
2663 | # :command.function | |
2653 | rcstack_cli_storage_command() { |
|
2664 | rcstack_cli_storage_command() { | |
2654 | # src/cli_storage_command.sh |
|
2665 | # src/cli_storage_command.sh | |
2655 | check_bootstrap |
|
2666 | check_bootstrap | |
2656 |
|
2667 | |||
2657 | DEBUG=${args[--debug]} |
|
2668 | DEBUG=${args[--debug]} | |
2658 | ENV_FILE=${args[--env-file-path]} |
|
2669 | ENV_FILE=${args[--env-file-path]} | |
2659 |
|
2670 | |||
2660 | if [[ $DEBUG ]]; then |
|
2671 | if [[ $DEBUG ]]; then | |
2661 | echo "rc_datavolume inspection..." |
|
2672 | echo "rc_datavolume inspection..." | |
2662 | docker volume inspect rc_datavolume |
|
2673 | docker volume inspect rc_datavolume | |
2663 |
|
2674 | |||
2664 | echo "rc_reposvolume inspection..." |
|
2675 | echo "rc_reposvolume inspection..." | |
2665 | docker volume inspect rc_reposvolume |
|
2676 | docker volume inspect rc_reposvolume | |
2666 | fi |
|
2677 | fi | |
2667 |
|
2678 | |||
2668 | # |
|
2679 | # | |
2669 | #if [[ $DEBUG ]]; then |
|
2680 | #if [[ $DEBUG ]]; then | |
2670 | # echo "image id: $image_id, based on $target_container filter" |
|
2681 | # echo "image id: $image_id, based on $target_container filter" | |
2671 | # docker image ls |
|
2682 | # docker image ls | |
2672 | # echo "---" |
|
2683 | # echo "---" | |
2673 | #fi |
|
2684 | #fi | |
2674 | # rename a volume |
|
2685 | # rename a volume | |
2675 | #docker volume create --name <new_volume> |
|
2686 | #docker volume create --name <new_volume> | |
2676 | #docker run --rm -it -v <old_volume>:/from -v <new_volume>:/to alpine ash -c "cd /from ; cp -av . /to" |
|
2687 | #docker run --rm -it -v <old_volume>:/from -v <new_volume>:/to alpine ash -c "cd /from ; cp -av . /to" | |
2677 | #docker volume rm <old_volume> |
|
2688 | #docker volume rm <old_volume> | |
2678 |
|
2689 | |||
2679 | printf "attaching rc_datavolume \t\tunder: /vol/datavolume\n" |
|
2690 | printf "attaching rc_datavolume \t\tunder: /vol/datavolume\n" | |
2680 | printf "attaching rc_reposvolume \t\tunder: /vol/repovolume\n" |
|
2691 | printf "attaching rc_reposvolume \t\tunder: /vol/repovolume\n" | |
2681 | printf "attaching \$PWD.custom/storage \t\tunder: /vol/backupvolume\n" |
|
2692 | printf "attaching \$PWD.custom/storage \t\tunder: /vol/backupvolume\n" | |
2682 |
|
2693 | |||
2683 | docker run --rm \ |
|
2694 | docker run --rm \ | |
2684 | -it \ |
|
2695 | -it \ | |
2685 | --volume $PWD/.custom/storage:/vol/backupvolume \ |
|
2696 | --volume $PWD/.custom/storage:/vol/backupvolume \ | |
2686 | --volume rc_datavolume:/vol/datavolume \ |
|
2697 | --volume rc_datavolume:/vol/datavolume \ | |
2687 | --volume rc_reposvolume:/vol/repovolume \ |
|
2698 | --volume rc_reposvolume:/vol/repovolume \ | |
2688 | --workdir="/vol" \ |
|
2699 | --workdir="/vol" \ | |
2689 | ubuntu:22.04 \ |
|
2700 | ubuntu:22.04 \ | |
2690 | /bin/bash |
|
2701 | /bin/bash | |
2691 |
|
2702 | |||
2692 | } |
|
2703 | } | |
2693 |
|
2704 | |||
2694 | # :command.function |
|
2705 | # :command.function | |
2695 | rcstack_cli_attach_command() { |
|
2706 | rcstack_cli_attach_command() { | |
2696 | # src/cli_attach_command.sh |
|
2707 | # src/cli_attach_command.sh | |
2697 | instance_type=${args[--instance-type]} |
|
2708 | instance_type=${args[--instance-type]} | |
2698 |
|
2709 | |||
2699 | match_name=rc_cluster_apps-$instance_type |
|
2710 | match_name=rc_cluster_apps-$instance_type | |
2700 | docker_id=$(docker ps --filter name=$match_name -q | head -n1) |
|
2711 | docker_id=$(docker ps --filter name=$match_name -q | head -n1) | |
2701 |
|
2712 | |||
2702 | if [[ $docker_id == "" ]]; then |
|
2713 | if [[ $docker_id == "" ]]; then | |
2703 | echo "$(yellow cannot find instance to attach by name *$match_name*)" |
|
2714 | echo "$(yellow cannot find instance to attach by name *$match_name*)" | |
2704 | exit 1 |
|
2715 | exit 1 | |
2705 | fi |
|
2716 | fi | |
2706 |
|
2717 | |||
2707 | docker exec -it --tty $docker_id bash |
|
2718 | docker exec -it --tty $docker_id bash | |
2708 |
|
2719 | |||
2709 | } |
|
2720 | } | |
2710 |
|
2721 | |||
2711 | # :command.function |
|
2722 | # :command.function | |
2712 | rcstack_cli_configure_vcsserver_command() { |
|
2723 | rcstack_cli_configure_vcsserver_command() { | |
2713 | # src/cli_configure_vcsserver_command.sh |
|
2724 | # src/cli_configure_vcsserver_command.sh | |
2714 | ini_path=${args[ini_path]} |
|
2725 | ini_path=${args[ini_path]} | |
2715 | DEBUG=${args[--debug]} |
|
2726 | DEBUG=${args[--debug]} | |
2716 |
|
2727 | |||
2717 | sed_replace() { |
|
2728 | sed_replace() { | |
2718 |
|
2729 | |||
2719 | if [[ $DEBUG ]]; then |
|
2730 | if [[ $DEBUG ]]; then | |
2720 | echo "pat1: $1" |
|
2731 | echo "pat1: $1" | |
2721 | echo "pat1: $2" |
|
2732 | echo "pat1: $2" | |
2722 | echo |
|
2733 | echo | |
2723 | echo "sed --in-place=.replaced -E \"s/$1/$2/\" $ini_path" |
|
2734 | echo "sed --in-place=.replaced -E \"s/$1/$2/\" $ini_path" | |
2724 | fi |
|
2735 | fi | |
2725 |
|
2736 | |||
2726 | sed --in-place=.replaced -E "s/$1/$2/" $ini_path |
|
2737 | sed --in-place=.replaced -E "s/$1/$2/" $ini_path | |
2727 | } |
|
2738 | } | |
2728 |
|
2739 | |||
2729 | config_vcsserver_ini |
|
2740 | config_vcsserver_ini | |
2730 |
|
2741 | |||
2731 | echo |
|
2742 | echo | |
2732 | echo "reconfigure of $ini_path completed" |
|
2743 | echo "reconfigure of $ini_path completed" | |
2733 |
|
2744 | |||
2734 | } |
|
2745 | } | |
2735 |
|
2746 | |||
2736 | # :command.function |
|
2747 | # :command.function | |
2737 | rcstack_cli_configure_rhodecode_command() { |
|
2748 | rcstack_cli_configure_rhodecode_command() { | |
2738 | # src/cli_configure_rhodecode_command.sh |
|
2749 | # src/cli_configure_rhodecode_command.sh | |
2739 | ini_path=${args[ini_path]} |
|
2750 | ini_path=${args[ini_path]} | |
2740 | DEBUG=${args[--debug]} |
|
2751 | DEBUG=${args[--debug]} | |
2741 |
|
2752 | |||
2742 | sed_replace() { |
|
2753 | sed_replace() { | |
2743 |
|
2754 | |||
2744 | if [[ $DEBUG ]]; then |
|
2755 | if [[ $DEBUG ]]; then | |
2745 | echo "pat1: $1" |
|
2756 | echo "pat1: $1" | |
2746 | echo "pat1: $2" |
|
2757 | echo "pat1: $2" | |
2747 | echo |
|
2758 | echo | |
2748 | echo "sed --in-place=.replaced -E \"s/$1/$2/\" $ini_path" |
|
2759 | echo "sed --in-place=.replaced -E \"s/$1/$2/\" $ini_path" | |
2749 | fi |
|
2760 | fi | |
2750 |
|
2761 | |||
2751 | sed --in-place=.replaced -E "s/$1/$2/" $ini_path |
|
2762 | sed --in-place=.replaced -E "s/$1/$2/" $ini_path | |
2752 | } |
|
2763 | } | |
2753 |
|
2764 | |||
2754 | # read generated secrets etc from our .env file |
|
2765 | # read generated secrets etc from our .env file | |
2755 | .env --file $RUNTIME_ENV |
|
2766 | .env --file $RUNTIME_ENV | |
2756 |
|
2767 | |||
2757 | .env get RC_LICENSE_TOKEN |
|
2768 | .env get RC_LICENSE_TOKEN | |
2758 | RC_LICENSE_TOKEN=$REPLY |
|
2769 | RC_LICENSE_TOKEN=$REPLY | |
2759 |
|
2770 | |||
2760 | .env get RC_HOSTNAME |
|
2771 | .env get RC_HOSTNAME | |
2761 | RC_HOSTNAME=$REPLY |
|
2772 | RC_HOSTNAME=$REPLY | |
2762 |
|
2773 | |||
2763 | config_rhodecode_ini |
|
2774 | config_rhodecode_ini | |
2764 |
|
2775 | |||
2765 | echo |
|
2776 | echo | |
2766 | echo "reconfigure of $ini_path completed" |
|
2777 | echo "reconfigure of $ini_path completed" | |
2767 | } |
|
2778 | } | |
2768 |
|
2779 | |||
2769 | # :command.function |
|
2780 | # :command.function | |
2770 | rcstack_backup_db_command() { |
|
2781 | rcstack_backup_db_command() { | |
2771 | # src/backup_db_command.sh |
|
2782 | # src/backup_db_command.sh | |
2772 | check_bootstrap |
|
2783 | check_bootstrap | |
2773 |
|
2784 | |||
2774 | DEBUG=${args[--debug]} |
|
2785 | DEBUG=${args[--debug]} | |
2775 | DESTINATION=${args[destination]} |
|
2786 | DESTINATION=${args[destination]} | |
2776 |
|
2787 | |||
2777 | backup_name=rc_db_dump-$(date +%Y-%m-%d).sql.gz |
|
2788 | backup_name=rc_db_dump-$(date +%Y-%m-%d).sql.gz | |
2778 | echo "creating backup: $backup_name" |
|
2789 | echo "creating backup: $backup_name" | |
2779 |
|
2790 | |||
2780 | target_container=rc_cluster_services-database-* |
|
2791 | target_container=rc_cluster_services-database-* | |
2781 | docker_id=$(docker ps --filter name=$target_container -q | head -n1) |
|
2792 | docker_id=$(docker ps --filter name=$target_container -q | head -n1) | |
2782 |
|
2793 | |||
2783 | if [[ $DEBUG ]]; then |
|
2794 | if [[ $DEBUG ]]; then | |
2784 | echo "container id: $docker_id, based on $target_container filter" |
|
2795 | echo "container id: $docker_id, based on $target_container filter" | |
2785 | docker ps |
|
2796 | docker ps | |
2786 | echo "---" |
|
2797 | echo "---" | |
2787 | fi |
|
2798 | fi | |
2788 |
|
2799 | |||
2789 | if [ "$docker_id" == "" ]; then |
|
2800 | if [ "$docker_id" == "" ]; then | |
2790 | MSG="Cannot find container ID with name $target_container" |
|
2801 | MSG="Cannot find container ID with name $target_container" | |
2791 | echo "$(red $MSG)" |
|
2802 | echo "$(red $MSG)" | |
2792 | exit 1 |
|
2803 | exit 1 | |
2793 | fi |
|
2804 | fi | |
2794 |
|
2805 | |||
2795 | .env --file $RUNTIME_ENV |
|
2806 | .env --file $RUNTIME_ENV | |
2796 |
|
2807 | |||
2797 | .env get DB_PASSWORD |
|
2808 | .env get DB_PASSWORD | |
2798 | DB_PASSWORD=$REPLY |
|
2809 | DB_PASSWORD=$REPLY | |
2799 |
|
2810 | |||
2800 | .env get DB_NAME |
|
2811 | .env get DB_NAME | |
2801 | DB_NAME=$REPLY |
|
2812 | DB_NAME=$REPLY | |
2802 |
|
2813 | |||
2803 | .env get DB_USER |
|
2814 | .env get DB_USER | |
2804 | DB_USER=$REPLY |
|
2815 | DB_USER=$REPLY | |
2805 |
|
2816 | |||
2806 | if [[ $DEBUG ]]; then |
|
2817 | if [[ $DEBUG ]]; then | |
2807 | echo "docker exec -e PGPASSWORD=$DB_PASSWORD $docker_id /bin/bash -c 'mkdir -p /var/rc-data-dump && pg_dump --inserts -U $DB_USER -h 127.0.0.1 --dbname=$DB_NAME | gzip > /var/rc-data-dump/$backup_name'" |
|
2818 | echo "docker exec -e PGPASSWORD=$DB_PASSWORD $docker_id /bin/bash -c 'mkdir -p /var/rc-data-dump && pg_dump --inserts -U $DB_USER -h 127.0.0.1 --dbname=$DB_NAME | gzip > /var/rc-data-dump/$backup_name'" | |
2808 | echo "dump placed in /var/rc-data-dump/$backup_name" |
|
2819 | echo "dump placed in /var/rc-data-dump/$backup_name" | |
2809 | echo "run docker cp $docker_id:/var/rc-data-dump/$backup_name $PWD to copy the file into your host machine" |
|
2820 | echo "run docker cp $docker_id:/var/rc-data-dump/$backup_name $PWD to copy the file into your host machine" | |
2810 | fi |
|
2821 | fi | |
2811 |
|
2822 | |||
2812 | set -euo pipefail |
|
2823 | set -euo pipefail | |
2813 |
|
2824 | |||
2814 | docker exec -e PGPASSWORD=$DB_PASSWORD $docker_id /bin/bash -c "pg_dump --inserts -U $DB_USER -h 127.0.0.1 --dbname=$DB_NAME | gzip > /var/rc-data-dump/$backup_name" |
|
2825 | docker exec -e PGPASSWORD=$DB_PASSWORD $docker_id /bin/bash -c "pg_dump --inserts -U $DB_USER -h 127.0.0.1 --dbname=$DB_NAME | gzip > /var/rc-data-dump/$backup_name" | |
2815 |
|
2826 | |||
2816 | echo "$(green Backup created in container volume under: /var/rc-data-dump/$backup_name !)" |
|
2827 | echo "$(green Backup created in container volume under: /var/rc-data-dump/$backup_name !)" | |
2817 | echo "to copy this file into your host machine run:" |
|
2828 | echo "to copy this file into your host machine run:" | |
2818 | echo "docker cp $docker_id:/var/rc-data-dump/$backup_name $PWD" |
|
2829 | echo "docker cp $docker_id:/var/rc-data-dump/$backup_name $PWD" | |
2819 |
|
2830 | |||
2820 | } |
|
2831 | } | |
2821 |
|
2832 | |||
2822 | # :command.function |
|
2833 | # :command.function | |
2823 | rcstack_backup_data_command() { |
|
2834 | rcstack_backup_data_command() { | |
2824 | # src/backup_data_command.sh |
|
2835 | # src/backup_data_command.sh | |
2825 | check_bootstrap |
|
2836 | check_bootstrap | |
2826 |
|
2837 | |||
2827 | DEBUG=${args[--debug]} |
|
2838 | DEBUG=${args[--debug]} | |
2828 | DESTINATION=${args[destination]} |
|
2839 | DESTINATION=${args[destination]} | |
2829 |
|
2840 | |||
2830 | backup_name=rc_data_dump-$(date +%Y-%m-%d).tar.gz |
|
2841 | backup_name=rc_data_dump-$(date +%Y-%m-%d).tar.gz | |
2831 | echo "creating backup: $backup_name" |
|
2842 | echo "creating backup: $backup_name" | |
2832 |
|
2843 | |||
2833 | target_container=rc_cluster_apps-rhodecode-* |
|
2844 | target_container=rc_cluster_apps-rhodecode-* | |
2834 | target_container=rc_cluster_apps-celery-* |
|
2845 | target_container=rc_cluster_apps-celery-* | |
2835 | docker_id=$(docker ps --filter name=$target_container -q | head -n1) |
|
2846 | docker_id=$(docker ps --filter name=$target_container -q | head -n1) | |
2836 |
|
2847 | |||
2837 | if [[ $DEBUG ]]; then |
|
2848 | if [[ $DEBUG ]]; then | |
2838 | echo "container id: $docker_id, based on $target_container filter" |
|
2849 | echo "container id: $docker_id, based on $target_container filter" | |
2839 | docker ps |
|
2850 | docker ps | |
2840 | echo "---" |
|
2851 | echo "---" | |
2841 | fi |
|
2852 | fi | |
2842 |
|
2853 | |||
2843 | if [ "$docker_id" == "" ]; then |
|
2854 | if [ "$docker_id" == "" ]; then | |
2844 | MSG="Cannot find container ID with name $target_container" |
|
2855 | MSG="Cannot find container ID with name $target_container" | |
2845 | echo "$(red $MSG)" |
|
2856 | echo "$(red $MSG)" | |
2846 | exit 1 |
|
2857 | exit 1 | |
2847 | fi |
|
2858 | fi | |
2848 |
|
2859 | |||
2849 | set -euo pipefail |
|
2860 | set -euo pipefail | |
2850 |
|
2861 | |||
2851 | echo "Following volumes will be backed-up:" |
|
2862 | echo "Following volumes will be backed-up:" | |
2852 |
|
2863 | |||
2853 | volumes=$(docker inspect --format "{{ range .Mounts }}{{ println .Destination }}{{ end }}" $docker_id) |
|
2864 | volumes=$(docker inspect --format "{{ range .Mounts }}{{ println .Destination }}{{ end }}" $docker_id) | |
2854 | destination_dir=/tmp |
|
2865 | destination_dir=/tmp | |
2855 | for vol in $volumes; do |
|
2866 | for vol in $volumes; do | |
2856 | echo "backup: $vol" |
|
2867 | echo "backup: $vol" | |
2857 | docker run --rm -v $destination_dir:/backup --volumes-from "$docker_id" debian:jessie tar -czvf /backup/$backup_name.tar.gz "$vol" |
|
2868 | docker run --rm -v $destination_dir:/backup --volumes-from "$docker_id" debian:jessie tar -czvf /backup/$backup_name.tar.gz "$vol" | |
2858 | done |
|
2869 | done | |
2859 |
|
2870 | |||
2860 | echo "$(green Backup created in $destination_dir: $backup_name !)" |
|
2871 | echo "$(green Backup created in $destination_dir: $backup_name !)" | |
2861 |
|
2872 | |||
2862 | #docker-volume-restore-compressed() { |
|
2873 | #docker-volume-restore-compressed() { | |
2863 | # destination_dir=$1 |
|
2874 | # destination_dir=$1 | |
2864 | # container=$2 |
|
2875 | # container=$2 | |
2865 | # |
|
2876 | # | |
2866 | # docker run --rm -v $destination_dir:/backup --volumes-from "$container" debian:jessie tar -xzvf /backup/backup.tar.gz "${@:3}" |
|
2877 | # docker run --rm -v $destination_dir:/backup --volumes-from "$container" debian:jessie tar -xzvf /backup/backup.tar.gz "${@:3}" | |
2867 | # echo "Double checking files..." |
|
2878 | # echo "Double checking files..." | |
2868 | # docker run --rm -v $destination_dir:/backup --volumes-from "$container" debian:jessie ls -lh "${@:2}" |
|
2879 | # docker run --rm -v $destination_dir:/backup --volumes-from "$container" debian:jessie ls -lh "${@:2}" | |
2869 | #} |
|
2880 | #} | |
2870 | } |
|
2881 | } | |
2871 |
|
2882 | |||
2872 | # :command.function |
|
2883 | # :command.function | |
2873 | rcstack_get_build_artifacts_command() { |
|
2884 | rcstack_get_build_artifacts_command() { | |
2874 | # src/get_build_artifacts_command.sh |
|
2885 | # src/get_build_artifacts_command.sh | |
2875 | check_bootstrap |
|
2886 | check_bootstrap | |
2876 |
|
2887 | |||
2877 | DEBUG=${args[--debug]} |
|
2888 | DEBUG=${args[--debug]} | |
2878 | AUTH=${args[--auth]} |
|
2889 | AUTH=${args[--auth]} | |
2879 | INSTALLER_URL=${args[--installer-url]} |
|
2890 | INSTALLER_URL=${args[--installer-url]} | |
2880 | MANIFEST_URL=${args[--manifest-url]} |
|
2891 | MANIFEST_URL=${args[--manifest-url]} | |
2881 | RC_VERSION=${args[--version-name]} |
|
2892 | RC_VERSION=${args[--version-name]} | |
2882 | VER=$RC_VERSION |
|
2893 | VER=$RC_VERSION | |
2883 |
|
2894 | |||
2884 | CACHE_DIR=$PWD/.cache |
|
2895 | CACHE_DIR=$PWD/.cache | |
2885 | VER_REGEX="$VER+x86_64" |
|
2896 | VER_REGEX="$VER+x86_64" | |
2886 |
|
2897 | |||
2887 | if [[ $VER == "" ]]; then |
|
2898 | if [[ $VER == "" ]]; then | |
2888 | msg="Version is empty, please set --version-name correctly" |
|
2899 | msg="Version is empty, please set --version-name correctly" | |
2889 | echo "$(red $msg)" |
|
2900 | echo "$(red $msg)" | |
2890 | exit 1 |
|
2901 | exit 1 | |
2891 | fi |
|
2902 | fi | |
2892 |
|
2903 | |||
2893 | echo "Downloading Artifacts for version: $VER" |
|
2904 | echo "Downloading Artifacts for version: $VER" | |
2894 | mkdir -p $CACHE_DIR |
|
2905 | mkdir -p $CACHE_DIR | |
2895 |
|
2906 | |||
2896 | echo "1/4 Checking available downloads from MANIFEST file" |
|
2907 | echo "1/4 Checking available downloads from MANIFEST file" | |
2897 |
|
2908 | |||
2898 | ARTS=$(curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" | cut -d ' ' -f 2) |
|
2909 | ARTS=$(curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" | cut -d ' ' -f 2) | |
2899 |
|
2910 | |||
2900 | if [[ $DEBUG ]]; then |
|
2911 | if [[ $DEBUG ]]; then | |
2901 | echo "DEBUG START" |
|
2912 | echo "DEBUG START" | |
2902 | curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" || echo "no regex match" |
|
2913 | curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" || echo "no regex match" | |
2903 | curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" | cut -d ' ' -f 2 |
|
2914 | curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" | cut -d ' ' -f 2 | |
2904 | echo "Found following artifacts:" |
|
2915 | echo "Found following artifacts:" | |
2905 | echo $ARTS |
|
2916 | echo $ARTS | |
2906 | echo "DEBUG END" |
|
2917 | echo "DEBUG END" | |
2907 | fi |
|
2918 | fi | |
2908 |
|
2919 | |||
2909 | if [[ $ARTS == "" ]]; then |
|
2920 | if [[ $ARTS == "" ]]; then | |
2910 | MSG="Failed to found any MANIFEST entries for version $VER make sure there exists release with that version or use --version to specify different version" |
|
2921 | MSG="Failed to found any MANIFEST entries for version $VER make sure there exists release with that version or use --version to specify different version" | |
2911 | echo "$(red $MSG)" |
|
2922 | echo "$(red $MSG)" | |
2912 | exit 1 |
|
2923 | exit 1 | |
2913 | fi |
|
2924 | fi | |
2914 |
|
2925 | |||
2915 | echo "2/4 Downloading locale-archive" |
|
2926 | echo "2/4 Downloading locale-archive" | |
2916 | curl -L https://dls.rhodecode.com/assets/locale-archive -J -O |
|
2927 | curl -L https://dls.rhodecode.com/assets/locale-archive -J -O | |
2917 | mv -v locale-archive "$CACHE_DIR" |
|
2928 | mv -v locale-archive "$CACHE_DIR" | |
2918 |
|
2929 | |||
2919 | # vcsserver/ce/ee |
|
2930 | # vcsserver/ce/ee | |
2920 | echo "3/4 Downloading installer artifacts" |
|
2931 | echo "3/4 Downloading installer artifacts" | |
2921 | for url in $ARTS; do |
|
2932 | for url in $ARTS; do | |
2922 | echo "Downloading $url with $AUTH" |
|
2933 | echo "Downloading $url with $AUTH" | |
2923 | curl $AUTH --fail-early -L ${url} -J -O |
|
2934 | curl $AUTH --fail-early -L ${url} -J -O | |
2924 | done |
|
2935 | done | |
2925 |
|
2936 | |||
2926 | #for url in $(curl -s $MANIFEST_URL | grep --ignore-case -E 'control.+\+x86_64' | cut -d ' ' -f 2); do |
|
2937 | #for url in $(curl -s $MANIFEST_URL | grep --ignore-case -E 'control.+\+x86_64' | cut -d ' ' -f 2); do | |
2927 | # echo "Downloading $url" |
|
2938 | # echo "Downloading $url" | |
2928 | # curl -L ${url} -J -O |
|
2939 | # curl -L ${url} -J -O | |
2929 | #done |
|
2940 | #done | |
2930 |
|
2941 | |||
2931 | echo "4/4 Downloading installer from $INSTALLER_URL" |
|
2942 | echo "4/4 Downloading installer from $INSTALLER_URL" | |
2932 | curl $AUTH -L $INSTALLER_URL -J -O |
|
2943 | curl $AUTH -L $INSTALLER_URL -J -O | |
2933 |
|
2944 | |||
2934 | INSTALLER=$(ls -Art RhodeCode-installer-* | tail -n 1) |
|
2945 | INSTALLER=$(ls -Art RhodeCode-installer-* | tail -n 1) | |
2935 | if [[ -n $INSTALLER ]]; then |
|
2946 | if [[ -n $INSTALLER ]]; then | |
2936 | chmod +x "${INSTALLER}" |
|
2947 | chmod +x "${INSTALLER}" | |
2937 | fi |
|
2948 | fi | |
2938 |
|
2949 | |||
2939 | echo "Copying artifacts into $CACHE_DIR" |
|
2950 | echo "Copying artifacts into $CACHE_DIR" | |
2940 |
|
2951 | |||
2941 | mv -v "${INSTALLER}" $CACHE_DIR |
|
2952 | mv -v "${INSTALLER}" $CACHE_DIR | |
2942 | mv -v *.bz2 $CACHE_DIR |
|
2953 | mv -v *.bz2 $CACHE_DIR | |
2943 | ls -lh $CACHE_DIR |
|
2954 | ls -lh $CACHE_DIR | |
2944 |
|
2955 | |||
2945 | } |
|
2956 | } | |
2946 |
|
2957 | |||
2947 | # :command.function |
|
2958 | # :command.function | |
2948 | rcstack_build_installer_command() { |
|
2959 | rcstack_build_installer_command() { | |
2949 | # src/build_installer_command.sh |
|
2960 | # src/build_installer_command.sh | |
2950 | check_bootstrap |
|
2961 | check_bootstrap | |
2951 |
|
2962 | |||
2952 | rc_version=${args[--version-name]} |
|
2963 | rc_version=${args[--version-name]} | |
2953 | export RC_VERSION=$rc_version |
|
2964 | export RC_VERSION=$rc_version | |
2954 | eval "echo INSTALLER BASED BUILDING${RC_VERSION}" |
|
2965 | eval "echo INSTALLER BASED BUILDING${RC_VERSION}" | |
2955 |
|
2966 | |||
2956 | RC_VERSION=$rc_version ./$RC_SCRIPT_NAME stack rhodecode build --progress plain rhodecode |
|
2967 | RC_VERSION=$rc_version ./$RC_SCRIPT_NAME stack rhodecode build --progress plain rhodecode | |
2957 |
|
2968 | |||
2958 | } |
|
2969 | } | |
2959 |
|
2970 | |||
2960 | # :command.function |
|
2971 | # :command.function | |
2961 | rcstack_get_build_source_command() { |
|
2972 | rcstack_get_build_source_command() { | |
2962 | # src/get_build_source_command.sh |
|
2973 | # src/get_build_source_command.sh | |
2963 |
|
2974 | |||
2964 | NO_INIT=${args[--no-init-check]} |
|
2975 | NO_INIT=${args[--no-init-check]} | |
2965 |
|
2976 | |||
2966 | if [[ ! $NO_INIT ]]; then |
|
2977 | if [[ ! $NO_INIT ]]; then | |
2967 | check_bootstrap |
|
2978 | check_bootstrap | |
2968 | fi |
|
2979 | fi | |
2969 |
|
2980 | |||
2970 | DEBUG=${args[--debug]} |
|
2981 | DEBUG=${args[--debug]} | |
2971 | AUTH_TOKEN=${args[--auth-token]} |
|
2982 | AUTH_TOKEN=${args[--auth-token]} | |
2972 | SERVER_URL=${args[--server-url]} |
|
2983 | SERVER_URL=${args[--server-url]} | |
2973 | revision=${args[--revision]} |
|
2984 | revision=${args[--revision]} | |
2974 |
|
2985 | |||
2975 | SOURCE_DIR=$PWD/.source |
|
2986 | SOURCE_DIR=$PWD/.source | |
2976 |
|
2987 | |||
2977 | RHODECODE_VCS_HASH=$revision |
|
2988 | RHODECODE_VCS_HASH=$revision | |
2978 | RHODECODE_CE_HASH=$revision |
|
2989 | RHODECODE_CE_HASH=$revision | |
2979 | RHODECODE_EE_HASH=$revision |
|
2990 | RHODECODE_EE_HASH=$revision | |
2980 |
|
2991 | |||
2981 | # download sources |
|
2992 | # download sources | |
2982 | echo "** download rhodecode source for build from $SERVER_URL using '$revision' hash **" |
|
2993 | echo "** download rhodecode source for build from $SERVER_URL using '$revision' hash **" | |
2983 | mkdir -p $SOURCE_DIR |
|
2994 | mkdir -p $SOURCE_DIR | |
2984 |
|
2995 | |||
2985 | echo "getting $SERVER_URL/rhodecode-vcsserver/archive/$RHODECODE_VCS_HASH.tgz" |
|
2996 | echo "getting $SERVER_URL/rhodecode-vcsserver/archive/$RHODECODE_VCS_HASH.tgz" | |
2986 | curl --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-vcsserver/archive/$RHODECODE_VCS_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR |
|
2997 | curl --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-vcsserver/archive/$RHODECODE_VCS_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR | |
2987 |
|
2998 | |||
2988 | echo "getting $SERVER_URL/rhodecode-enterprise-ce/archive/$RHODECODE_CE_HASH.tgz" |
|
2999 | echo "getting $SERVER_URL/rhodecode-enterprise-ce/archive/$RHODECODE_CE_HASH.tgz" | |
2989 | curl --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-enterprise-ce/archive/$RHODECODE_CE_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR |
|
3000 | curl --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-enterprise-ce/archive/$RHODECODE_CE_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR | |
2990 |
|
3001 | |||
2991 | echo "getting $SERVER_URL/rhodecode-enterprise-ee/archive/$RHODECODE_EE_HASH.tgz" |
|
3002 | echo "getting $SERVER_URL/rhodecode-enterprise-ee/archive/$RHODECODE_EE_HASH.tgz" | |
2992 | curl --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-enterprise-ee/archive/$RHODECODE_EE_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR |
|
3003 | curl --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-enterprise-ee/archive/$RHODECODE_EE_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR | |
2993 |
|
3004 | |||
2994 | rm -rf $SOURCE_DIR/rhodecode-vcsserver && \ |
|
3005 | rm -rf $SOURCE_DIR/rhodecode-vcsserver && \ | |
2995 | mv $SOURCE_DIR/*rhodecode-vcsserver-plain $SOURCE_DIR/rhodecode-vcsserver |
|
3006 | mv $SOURCE_DIR/*rhodecode-vcsserver-plain $SOURCE_DIR/rhodecode-vcsserver | |
2996 | rm -rf $SOURCE_DIR/rhodecode-vcsserver/.hg |
|
3007 | rm -rf $SOURCE_DIR/rhodecode-vcsserver/.hg | |
2997 |
|
3008 | |||
2998 | rm -rf $SOURCE_DIR/rhodecode-enterprise-ce && \ |
|
3009 | rm -rf $SOURCE_DIR/rhodecode-enterprise-ce && \ | |
2999 | mv $SOURCE_DIR/*rhodecode-enterprise-ce-plain $SOURCE_DIR/rhodecode-enterprise-ce |
|
3010 | mv $SOURCE_DIR/*rhodecode-enterprise-ce-plain $SOURCE_DIR/rhodecode-enterprise-ce | |
3000 | rm -rf $SOURCE_DIR/rhodecode-enterprise-ce/.hg |
|
3011 | rm -rf $SOURCE_DIR/rhodecode-enterprise-ce/.hg | |
3001 |
|
3012 | |||
3002 | rm -rf $SOURCE_DIR/rhodecode-enterprise-ee && \ |
|
3013 | rm -rf $SOURCE_DIR/rhodecode-enterprise-ee && \ | |
3003 | mv $SOURCE_DIR/*rhodecode-enterprise-ee-plain $SOURCE_DIR/rhodecode-enterprise-ee |
|
3014 | mv $SOURCE_DIR/*rhodecode-enterprise-ee-plain $SOURCE_DIR/rhodecode-enterprise-ee | |
3004 | rm -rf $SOURCE_DIR/rhodecode-enterprise-ee/.hg |
|
3015 | rm -rf $SOURCE_DIR/rhodecode-enterprise-ee/.hg | |
3005 |
|
3016 | |||
3006 | echo "downloading sources done to $SOURCE_DIR, directory now consists:" |
|
3017 | echo "downloading sources done to $SOURCE_DIR, directory now consists:" | |
3007 | ls -l $SOURCE_DIR |
|
3018 | ls -l $SOURCE_DIR | |
3008 |
|
3019 | |||
3009 | echo "" |
|
3020 | echo "" | |
3010 | date_formatted=$(date +%Y.%m.%d.1) |
|
3021 | date_formatted=$(date +%Y.%m.%d.1) | |
3011 | echo "to create source based build run:" |
|
3022 | echo "to create source based build run:" | |
3012 | echo " ./$RC_SCRIPT_NAME build-source --version-name 4.28.0.REL.$date_formatted --tag edge" |
|
3023 | echo " ./$RC_SCRIPT_NAME build-source --version-name 4.28.0.REL.$date_formatted --tag edge" | |
3013 |
|
3024 | |||
3014 | } |
|
3025 | } | |
3015 |
|
3026 | |||
3016 | # :command.function |
|
3027 | # :command.function | |
3017 | rcstack_build_source_command() { |
|
3028 | rcstack_build_source_command() { | |
3018 | # src/build_source_command.sh |
|
3029 | # src/build_source_command.sh | |
3019 | check_bootstrap |
|
3030 | check_bootstrap | |
3020 | .env --file $RUNTIME_ENV |
|
3031 | .env --file $RUNTIME_ENV | |
3021 |
|
3032 | |||
3022 | .env get RC_EDITION |
|
3033 | .env get RC_EDITION | |
3023 | rc_edition=$REPLY |
|
3034 | rc_edition=$REPLY | |
3024 |
|
3035 | |||
3025 | rc_version=${args[--version-name]} |
|
3036 | rc_version=${args[--version-name]} | |
3026 | eval "tags_data=(${args[--tag]})" |
|
3037 | eval "tags_data=(${args[--tag]})" | |
3027 |
|
3038 | |||
3028 | export RC_VERSION=$rc_version |
|
3039 | export RC_VERSION=$rc_version | |
3029 | export RC_EDITION=$rc_edition |
|
3040 | export RC_EDITION=$rc_edition | |
3030 | echo "build_source: SOURCE BASED BUILDING: $rc_version" |
|
3041 | echo "build_source: SOURCE BASED BUILDING: $rc_version" | |
3031 | echo "" |
|
3042 | echo "" | |
3032 |
|
3043 | |||
3033 | DOCKER_SCAN_SUGGEST=false RC_VERSION=$rc_version ./$RC_SCRIPT_NAME stack rhodecode -f docker-compose-apps.source.yaml build --progress plain rhodecode |
|
3044 | DOCKER_SCAN_SUGGEST=false RC_VERSION=$rc_version ./$RC_SCRIPT_NAME stack rhodecode -f docker-compose-apps.source.yaml build --progress plain rhodecode | |
3034 |
|
3045 | |||
3035 | for tag in "${tags_data[@]}"; do |
|
3046 | for tag in "${tags_data[@]}"; do | |
3036 | echo "build_source: creating tag:$tag" |
|
3047 | echo "build_source: creating tag:$tag" | |
3037 | docker tag rhodecode/rhodecode-$rc_edition:$rc_version rhodecode/rhodecode-$rc_edition:$tag |
|
3048 | docker tag rhodecode/rhodecode-$rc_edition:$rc_version rhodecode/rhodecode-$rc_edition:$tag | |
3038 | done |
|
3049 | done | |
3039 |
|
3050 | |||
3040 | echo "build_source: consider setting release version using" |
|
3051 | echo "build_source: consider setting release version using" | |
3041 | echo " ./$RC_SCRIPT_NAME cli image-info --set-runtime $rc_version" |
|
3052 | echo " ./$RC_SCRIPT_NAME cli image-info --set-runtime $rc_version" | |
3042 |
|
3053 | |||
3043 | echo "build_source: push this image using" |
|
3054 | echo "build_source: push this image using" | |
3044 | echo " docker push rhodecode/rhodecode-$rc_edition:$rc_version" |
|
3055 | echo " docker push rhodecode/rhodecode-$rc_edition:$rc_version" | |
3045 |
|
3056 | |||
3046 | } |
|
3057 | } | |
3047 |
|
3058 | |||
3048 | # :command.function |
|
3059 | # :command.function | |
3049 | rcstack__completions_command() { |
|
3060 | rcstack__completions_command() { | |
3050 | # src/_completions_command.sh |
|
3061 | # src/_completions_command.sh | |
3051 | send_completions |
|
3062 | send_completions | |
3052 | } |
|
3063 | } | |
3053 |
|
3064 | |||
3054 | # :command.parse_requirements |
|
3065 | # :command.parse_requirements | |
3055 | parse_requirements() { |
|
3066 | parse_requirements() { | |
3056 | # :command.fixed_flags_filter |
|
3067 | # :command.fixed_flags_filter | |
3057 | while [[ $# -gt 0 ]]; do |
|
3068 | while [[ $# -gt 0 ]]; do | |
3058 | case "${1:-}" in |
|
3069 | case "${1:-}" in | |
3059 | --version | -v) |
|
3070 | --version | -v) | |
3060 | version_command |
|
3071 | version_command | |
3061 | exit |
|
3072 | exit | |
3062 | ;; |
|
3073 | ;; | |
3063 |
|
3074 | |||
3064 | --help | -h) |
|
3075 | --help | -h) | |
3065 | long_usage=yes |
|
3076 | long_usage=yes | |
3066 | rcstack_usage |
|
3077 | rcstack_usage | |
3067 | exit |
|
3078 | exit | |
3068 | ;; |
|
3079 | ;; | |
3069 |
|
3080 | |||
3070 | # :flag.case |
|
3081 | # :flag.case | |
3071 | --debug) |
|
3082 | --debug) | |
3072 |
|
3083 | |||
3073 | # :flag.case_no_arg |
|
3084 | # :flag.case_no_arg | |
3074 | args['--debug']=1 |
|
3085 | args['--debug']=1 | |
3075 | shift |
|
3086 | shift | |
3076 | ;; |
|
3087 | ;; | |
3077 |
|
3088 | |||
3078 | # :flag.case |
|
3089 | # :flag.case | |
3079 | --no-init-check) |
|
3090 | --no-init-check) | |
3080 |
|
3091 | |||
3081 | # :flag.case_no_arg |
|
3092 | # :flag.case_no_arg | |
3082 | args['--no-init-check']=1 |
|
3093 | args['--no-init-check']=1 | |
3083 | shift |
|
3094 | shift | |
3084 | ;; |
|
3095 | ;; | |
3085 |
|
3096 | |||
3086 | *) |
|
3097 | *) | |
3087 | break |
|
3098 | break | |
3088 | ;; |
|
3099 | ;; | |
3089 |
|
3100 | |||
3090 | esac |
|
3101 | esac | |
3091 | done |
|
3102 | done | |
3092 |
|
3103 | |||
3093 | # :command.environment_variables_filter |
|
3104 | # :command.environment_variables_filter | |
3094 | # :command.environment_variables_default |
|
3105 | # :command.environment_variables_default | |
3095 | export RCC_CONFIG="${RCC_CONFIG:-.rcstack.ini}" |
|
3106 | export RCC_CONFIG="${RCC_CONFIG:-.rcstack.ini}" | |
3096 | export RC_STACK_ROUTER_EXT="${RC_STACK_ROUTER_EXT:-.custom/docker-compose-router.override.yaml}" |
|
3107 | export RC_STACK_ROUTER_EXT="${RC_STACK_ROUTER_EXT:-.custom/docker-compose-router.override.yaml}" | |
3097 | export RC_STACK_METRICS_EXT="${RC_STACK_METRICS_EXT:-.custom/docker-compose-metrics.override.yaml}" |
|
3108 | export RC_STACK_METRICS_EXT="${RC_STACK_METRICS_EXT:-.custom/docker-compose-metrics.override.yaml}" | |
3098 | export RC_STACK_SERVICES_EXT="${RC_STACK_SERVICES_EXT:-.custom/docker-compose-services.override.yaml}" |
|
3109 | export RC_STACK_SERVICES_EXT="${RC_STACK_SERVICES_EXT:-.custom/docker-compose-services.override.yaml}" | |
3099 | export RC_STACK_RHODECODE_EXT="${RC_STACK_RHODECODE_EXT:-.custom/docker-compose-apps.override.yaml}" |
|
3110 | export RC_STACK_RHODECODE_EXT="${RC_STACK_RHODECODE_EXT:-.custom/docker-compose-apps.override.yaml}" | |
3100 |
|
3111 | |||
3101 | # :command.command_filter |
|
3112 | # :command.command_filter | |
3102 | action=${1:-} |
|
3113 | action=${1:-} | |
3103 |
|
3114 | |||
3104 | case $action in |
|
3115 | case $action in | |
3105 | -*) ;; |
|
3116 | -*) ;; | |
3106 |
|
3117 | |||
3107 | get-started) |
|
3118 | get-started) | |
3108 | action="get-started" |
|
3119 | action="get-started" | |
3109 | shift |
|
3120 | shift | |
3110 | rcstack_get_started_parse_requirements "$@" |
|
3121 | rcstack_get_started_parse_requirements "$@" | |
3111 | shift $# |
|
3122 | shift $# | |
3112 | ;; |
|
3123 | ;; | |
3113 |
|
3124 | |||
3114 | init) |
|
3125 | init) | |
3115 | action="init" |
|
3126 | action="init" | |
3116 | shift |
|
3127 | shift | |
3117 | rcstack_init_parse_requirements "$@" |
|
3128 | rcstack_init_parse_requirements "$@" | |
3118 | shift $# |
|
3129 | shift $# | |
3119 | ;; |
|
3130 | ;; | |
3120 |
|
3131 | |||
3121 | self-update) |
|
3132 | self-update) | |
3122 | action="self-update" |
|
3133 | action="self-update" | |
3123 | shift |
|
3134 | shift | |
3124 | rcstack_self_update_parse_requirements "$@" |
|
3135 | rcstack_self_update_parse_requirements "$@" | |
3125 | shift $# |
|
3136 | shift $# | |
3126 | ;; |
|
3137 | ;; | |
3127 |
|
3138 | |||
3128 | stack) |
|
3139 | stack) | |
3129 | action="stack" |
|
3140 | action="stack" | |
3130 | shift |
|
3141 | shift | |
3131 | rcstack_stack_parse_requirements "$@" |
|
3142 | rcstack_stack_parse_requirements "$@" | |
3132 | shift $# |
|
3143 | shift $# | |
3133 | ;; |
|
3144 | ;; | |
3134 |
|
3145 | |||
3135 | stack-status | status) |
|
3146 | stack-status | status) | |
3136 | action="stack-status" |
|
3147 | action="stack-status" | |
3137 | shift |
|
3148 | shift | |
3138 | rcstack_stack_status_parse_requirements "$@" |
|
3149 | rcstack_stack_status_parse_requirements "$@" | |
3139 | shift $# |
|
3150 | shift $# | |
3140 | ;; |
|
3151 | ;; | |
3141 |
|
3152 | |||
3142 | stack-upgrade) |
|
3153 | stack-upgrade) | |
3143 | action="stack-upgrade" |
|
3154 | action="stack-upgrade" | |
3144 | shift |
|
3155 | shift | |
3145 | rcstack_stack_upgrade_parse_requirements "$@" |
|
3156 | rcstack_stack_upgrade_parse_requirements "$@" | |
3146 | shift $# |
|
3157 | shift $# | |
3147 | ;; |
|
3158 | ;; | |
3148 |
|
3159 | |||
3149 | cli) |
|
3160 | cli) | |
3150 | action="cli" |
|
3161 | action="cli" | |
3151 | shift |
|
3162 | shift | |
3152 | rcstack_cli_parse_requirements "$@" |
|
3163 | rcstack_cli_parse_requirements "$@" | |
3153 | shift $# |
|
3164 | shift $# | |
3154 | ;; |
|
3165 | ;; | |
3155 |
|
3166 | |||
3156 | backup-db) |
|
3167 | backup-db) | |
3157 | action="backup-db" |
|
3168 | action="backup-db" | |
3158 | shift |
|
3169 | shift | |
3159 | rcstack_backup_db_parse_requirements "$@" |
|
3170 | rcstack_backup_db_parse_requirements "$@" | |
3160 | shift $# |
|
3171 | shift $# | |
3161 | ;; |
|
3172 | ;; | |
3162 |
|
3173 | |||
3163 | backup-data) |
|
3174 | backup-data) | |
3164 | action="backup-data" |
|
3175 | action="backup-data" | |
3165 | shift |
|
3176 | shift | |
3166 | rcstack_backup_data_parse_requirements "$@" |
|
3177 | rcstack_backup_data_parse_requirements "$@" | |
3167 | shift $# |
|
3178 | shift $# | |
3168 | ;; |
|
3179 | ;; | |
3169 |
|
3180 | |||
3170 | get-build-artifacts) |
|
3181 | get-build-artifacts) | |
3171 | action="get-build-artifacts" |
|
3182 | action="get-build-artifacts" | |
3172 | shift |
|
3183 | shift | |
3173 | rcstack_get_build_artifacts_parse_requirements "$@" |
|
3184 | rcstack_get_build_artifacts_parse_requirements "$@" | |
3174 | shift $# |
|
3185 | shift $# | |
3175 | ;; |
|
3186 | ;; | |
3176 |
|
3187 | |||
3177 | build-installer) |
|
3188 | build-installer) | |
3178 | action="build-installer" |
|
3189 | action="build-installer" | |
3179 | shift |
|
3190 | shift | |
3180 | rcstack_build_installer_parse_requirements "$@" |
|
3191 | rcstack_build_installer_parse_requirements "$@" | |
3181 | shift $# |
|
3192 | shift $# | |
3182 | ;; |
|
3193 | ;; | |
3183 |
|
3194 | |||
3184 | get-build-source) |
|
3195 | get-build-source) | |
3185 | action="get-build-source" |
|
3196 | action="get-build-source" | |
3186 | shift |
|
3197 | shift | |
3187 | rcstack_get_build_source_parse_requirements "$@" |
|
3198 | rcstack_get_build_source_parse_requirements "$@" | |
3188 | shift $# |
|
3199 | shift $# | |
3189 | ;; |
|
3200 | ;; | |
3190 |
|
3201 | |||
3191 | build-source) |
|
3202 | build-source) | |
3192 | action="build-source" |
|
3203 | action="build-source" | |
3193 | shift |
|
3204 | shift | |
3194 | rcstack_build_source_parse_requirements "$@" |
|
3205 | rcstack_build_source_parse_requirements "$@" | |
3195 | shift $# |
|
3206 | shift $# | |
3196 | ;; |
|
3207 | ;; | |
3197 |
|
3208 | |||
3198 | _completions) |
|
3209 | _completions) | |
3199 | action="_completions" |
|
3210 | action="_completions" | |
3200 | shift |
|
3211 | shift | |
3201 | rcstack__completions_parse_requirements "$@" |
|
3212 | rcstack__completions_parse_requirements "$@" | |
3202 | shift $# |
|
3213 | shift $# | |
3203 | ;; |
|
3214 | ;; | |
3204 |
|
3215 | |||
3205 | # :command.command_fallback |
|
3216 | # :command.command_fallback | |
3206 | "") |
|
3217 | "") | |
3207 | rcstack_usage >&2 |
|
3218 | rcstack_usage >&2 | |
3208 | exit 1 |
|
3219 | exit 1 | |
3209 | ;; |
|
3220 | ;; | |
3210 |
|
3221 | |||
3211 | *) |
|
3222 | *) | |
3212 | printf "invalid command: %s\n" "$action" >&2 |
|
3223 | printf "invalid command: %s\n" "$action" >&2 | |
3213 | exit 1 |
|
3224 | exit 1 | |
3214 | ;; |
|
3225 | ;; | |
3215 |
|
3226 | |||
3216 | esac |
|
3227 | esac | |
3217 |
|
3228 | |||
3218 | # :command.parse_requirements_while |
|
3229 | # :command.parse_requirements_while | |
3219 | while [[ $# -gt 0 ]]; do |
|
3230 | while [[ $# -gt 0 ]]; do | |
3220 | key="$1" |
|
3231 | key="$1" | |
3221 | case "$key" in |
|
3232 | case "$key" in | |
3222 |
|
3233 | |||
3223 | -?*) |
|
3234 | -?*) | |
3224 | printf "invalid option: %s\n" "$key" >&2 |
|
3235 | printf "invalid option: %s\n" "$key" >&2 | |
3225 | exit 1 |
|
3236 | exit 1 | |
3226 | ;; |
|
3237 | ;; | |
3227 |
|
3238 | |||
3228 | *) |
|
3239 | *) | |
3229 | # :command.parse_requirements_case |
|
3240 | # :command.parse_requirements_case | |
3230 | # :command.parse_requirements_case_simple |
|
3241 | # :command.parse_requirements_case_simple | |
3231 | printf "invalid argument: %s\n" "$key" >&2 |
|
3242 | printf "invalid argument: %s\n" "$key" >&2 | |
3232 | exit 1 |
|
3243 | exit 1 | |
3233 |
|
3244 | |||
3234 | ;; |
|
3245 | ;; | |
3235 |
|
3246 | |||
3236 | esac |
|
3247 | esac | |
3237 | done |
|
3248 | done | |
3238 |
|
3249 | |||
3239 | } |
|
3250 | } | |
3240 |
|
3251 | |||
3241 | # :command.parse_requirements |
|
3252 | # :command.parse_requirements | |
3242 | rcstack_get_started_parse_requirements() { |
|
3253 | rcstack_get_started_parse_requirements() { | |
3243 | # :command.fixed_flags_filter |
|
3254 | # :command.fixed_flags_filter | |
3244 | while [[ $# -gt 0 ]]; do |
|
3255 | while [[ $# -gt 0 ]]; do | |
3245 | case "${1:-}" in |
|
3256 | case "${1:-}" in | |
3246 | --help | -h) |
|
3257 | --help | -h) | |
3247 | long_usage=yes |
|
3258 | long_usage=yes | |
3248 | rcstack_get_started_usage |
|
3259 | rcstack_get_started_usage | |
3249 | exit |
|
3260 | exit | |
3250 | ;; |
|
3261 | ;; | |
3251 |
|
3262 | |||
3252 | *) |
|
3263 | *) | |
3253 | break |
|
3264 | break | |
3254 | ;; |
|
3265 | ;; | |
3255 |
|
3266 | |||
3256 | esac |
|
3267 | esac | |
3257 | done |
|
3268 | done | |
3258 |
|
3269 | |||
3259 | # :command.command_filter |
|
3270 | # :command.command_filter | |
3260 | action="get-started" |
|
3271 | action="get-started" | |
3261 |
|
3272 | |||
3262 | # :command.parse_requirements_while |
|
3273 | # :command.parse_requirements_while | |
3263 | while [[ $# -gt 0 ]]; do |
|
3274 | while [[ $# -gt 0 ]]; do | |
3264 | key="$1" |
|
3275 | key="$1" | |
3265 | case "$key" in |
|
3276 | case "$key" in | |
3266 |
|
3277 | |||
3267 | -?*) |
|
3278 | -?*) | |
3268 | printf "invalid option: %s\n" "$key" >&2 |
|
3279 | printf "invalid option: %s\n" "$key" >&2 | |
3269 | exit 1 |
|
3280 | exit 1 | |
3270 | ;; |
|
3281 | ;; | |
3271 |
|
3282 | |||
3272 | *) |
|
3283 | *) | |
3273 | # :command.parse_requirements_case |
|
3284 | # :command.parse_requirements_case | |
3274 | # :command.parse_requirements_case_simple |
|
3285 | # :command.parse_requirements_case_simple | |
3275 | printf "invalid argument: %s\n" "$key" >&2 |
|
3286 | printf "invalid argument: %s\n" "$key" >&2 | |
3276 | exit 1 |
|
3287 | exit 1 | |
3277 |
|
3288 | |||
3278 | ;; |
|
3289 | ;; | |
3279 |
|
3290 | |||
3280 | esac |
|
3291 | esac | |
3281 | done |
|
3292 | done | |
3282 |
|
3293 | |||
3283 | } |
|
3294 | } | |
3284 |
|
3295 | |||
3285 | # :command.parse_requirements |
|
3296 | # :command.parse_requirements | |
3286 | rcstack_init_parse_requirements() { |
|
3297 | rcstack_init_parse_requirements() { | |
3287 | # :command.fixed_flags_filter |
|
3298 | # :command.fixed_flags_filter | |
3288 | while [[ $# -gt 0 ]]; do |
|
3299 | while [[ $# -gt 0 ]]; do | |
3289 | case "${1:-}" in |
|
3300 | case "${1:-}" in | |
3290 | --help | -h) |
|
3301 | --help | -h) | |
3291 | long_usage=yes |
|
3302 | long_usage=yes | |
3292 | rcstack_init_usage |
|
3303 | rcstack_init_usage | |
3293 | exit |
|
3304 | exit | |
3294 | ;; |
|
3305 | ;; | |
3295 |
|
3306 | |||
3296 | *) |
|
3307 | *) | |
3297 | break |
|
3308 | break | |
3298 | ;; |
|
3309 | ;; | |
3299 |
|
3310 | |||
3300 | esac |
|
3311 | esac | |
3301 | done |
|
3312 | done | |
3302 |
|
3313 | |||
3303 | # :command.dependencies_filter |
|
3314 | # :command.dependencies_filter | |
3304 | if ! command -v curl >/dev/null 2>&1; then |
|
3315 | if ! command -v curl >/dev/null 2>&1; then | |
3305 | printf "missing dependency: curl\n" >&2 |
|
3316 | printf "missing dependency: curl\n" >&2 | |
3306 | exit 1 |
|
3317 | exit 1 | |
3307 | fi |
|
3318 | fi | |
3308 |
|
3319 | |||
3309 | if ! command -v tar >/dev/null 2>&1; then |
|
3320 | if ! command -v tar >/dev/null 2>&1; then | |
3310 | printf "missing dependency: tar\n" >&2 |
|
3321 | printf "missing dependency: tar\n" >&2 | |
3311 | exit 1 |
|
3322 | exit 1 | |
3312 | fi |
|
3323 | fi | |
3313 |
|
3324 | |||
3314 | if ! command -v md5sum >/dev/null 2>&1; then |
|
3325 | if ! command -v md5sum >/dev/null 2>&1; then | |
3315 | printf "missing dependency: md5sum\n" >&2 |
|
3326 | printf "missing dependency: md5sum\n" >&2 | |
3316 | exit 1 |
|
3327 | exit 1 | |
3317 | fi |
|
3328 | fi | |
3318 |
|
3329 | |||
3319 | if ! command -v find >/dev/null 2>&1; then |
|
3330 | if ! command -v find >/dev/null 2>&1; then | |
3320 | printf "missing dependency: find\n" >&2 |
|
3331 | printf "missing dependency: find\n" >&2 | |
3321 | exit 1 |
|
3332 | exit 1 | |
3322 | fi |
|
3333 | fi | |
3323 |
|
3334 | |||
3324 | # :command.command_filter |
|
3335 | # :command.command_filter | |
3325 | action="init" |
|
3336 | action="init" | |
3326 |
|
3337 | |||
3327 | # :command.parse_requirements_while |
|
3338 | # :command.parse_requirements_while | |
3328 | while [[ $# -gt 0 ]]; do |
|
3339 | while [[ $# -gt 0 ]]; do | |
3329 | key="$1" |
|
3340 | key="$1" | |
3330 | case "$key" in |
|
3341 | case "$key" in | |
3331 | # :flag.case |
|
3342 | # :flag.case | |
3332 | --force | -f) |
|
3343 | --force | -f) | |
3333 |
|
3344 | |||
3334 | # :flag.case_no_arg |
|
3345 | # :flag.case_no_arg | |
3335 | args['--force']=1 |
|
3346 | args['--force']=1 | |
3336 | shift |
|
3347 | shift | |
3337 | ;; |
|
3348 | ;; | |
3338 |
|
3349 | |||
3339 | # :flag.case |
|
3350 | # :flag.case | |
3340 | --auth-token) |
|
3351 | --auth-token) | |
3341 |
|
3352 | |||
3342 | # :flag.case_arg |
|
3353 | # :flag.case_arg | |
3343 | if [[ -n ${2+x} ]]; then |
|
3354 | if [[ -n ${2+x} ]]; then | |
3344 |
|
3355 | |||
3345 | args['--auth-token']="$2" |
|
3356 | args['--auth-token']="$2" | |
3346 | shift |
|
3357 | shift | |
3347 | shift |
|
3358 | shift | |
3348 | else |
|
3359 | else | |
3349 | printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2 |
|
3360 | printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2 | |
3350 | exit 1 |
|
3361 | exit 1 | |
3351 | fi |
|
3362 | fi | |
3352 | ;; |
|
3363 | ;; | |
3353 |
|
3364 | |||
3354 | # :flag.case |
|
3365 | # :flag.case | |
3355 | --server-url) |
|
3366 | --server-url) | |
3356 |
|
3367 | |||
3357 | # :flag.case_arg |
|
3368 | # :flag.case_arg | |
3358 | if [[ -n ${2+x} ]]; then |
|
3369 | if [[ -n ${2+x} ]]; then | |
3359 |
|
3370 | |||
3360 | args['--server-url']="$2" |
|
3371 | args['--server-url']="$2" | |
3361 | shift |
|
3372 | shift | |
3362 | shift |
|
3373 | shift | |
3363 | else |
|
3374 | else | |
3364 | printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2 |
|
3375 | printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2 | |
3365 | exit 1 |
|
3376 | exit 1 | |
3366 | fi |
|
3377 | fi | |
3367 | ;; |
|
3378 | ;; | |
3368 |
|
3379 | |||
3369 | # :flag.case |
|
3380 | # :flag.case | |
3370 | --revision) |
|
3381 | --revision) | |
3371 |
|
3382 | |||
3372 | # :flag.case_arg |
|
3383 | # :flag.case_arg | |
3373 | if [[ -n ${2+x} ]]; then |
|
3384 | if [[ -n ${2+x} ]]; then | |
3374 |
|
3385 | |||
3375 | args['--revision']="$2" |
|
3386 | args['--revision']="$2" | |
3376 | shift |
|
3387 | shift | |
3377 | shift |
|
3388 | shift | |
3378 | else |
|
3389 | else | |
3379 | printf "%s\n" "--revision requires an argument: --revision REVISION" >&2 |
|
3390 | printf "%s\n" "--revision requires an argument: --revision REVISION" >&2 | |
3380 | exit 1 |
|
3391 | exit 1 | |
3381 | fi |
|
3392 | fi | |
3382 | ;; |
|
3393 | ;; | |
3383 |
|
3394 | |||
3384 | # :flag.case |
|
3395 | # :flag.case | |
3385 | --install-docker) |
|
3396 | --install-docker) | |
3386 |
|
3397 | |||
3387 | # :flag.case_arg |
|
3398 | # :flag.case_arg | |
3388 | if [[ -n ${2+x} ]]; then |
|
3399 | if [[ -n ${2+x} ]]; then | |
3389 |
|
3400 | |||
3390 | args['--install-docker']="$2" |
|
3401 | args['--install-docker']="$2" | |
3391 | shift |
|
3402 | shift | |
3392 | shift |
|
3403 | shift | |
3393 | else |
|
3404 | else | |
3394 | printf "%s\n" "--install-docker requires an argument: --install-docker INSTALL_DOCKER" >&2 |
|
3405 | printf "%s\n" "--install-docker requires an argument: --install-docker INSTALL_DOCKER" >&2 | |
3395 | exit 1 |
|
3406 | exit 1 | |
3396 | fi |
|
3407 | fi | |
3397 | ;; |
|
3408 | ;; | |
3398 |
|
3409 | |||
3399 | -?*) |
|
3410 | -?*) | |
3400 | printf "invalid option: %s\n" "$key" >&2 |
|
3411 | printf "invalid option: %s\n" "$key" >&2 | |
3401 | exit 1 |
|
3412 | exit 1 | |
3402 | ;; |
|
3413 | ;; | |
3403 |
|
3414 | |||
3404 | *) |
|
3415 | *) | |
3405 | # :command.parse_requirements_case |
|
3416 | # :command.parse_requirements_case | |
3406 | # :command.parse_requirements_case_simple |
|
3417 | # :command.parse_requirements_case_simple | |
3407 | printf "invalid argument: %s\n" "$key" >&2 |
|
3418 | printf "invalid argument: %s\n" "$key" >&2 | |
3408 | exit 1 |
|
3419 | exit 1 | |
3409 |
|
3420 | |||
3410 | ;; |
|
3421 | ;; | |
3411 |
|
3422 | |||
3412 | esac |
|
3423 | esac | |
3413 | done |
|
3424 | done | |
3414 |
|
3425 | |||
3415 | # :command.default_assignments |
|
3426 | # :command.default_assignments | |
3416 | [[ -n ${args['--server-url']:-} ]] || args['--server-url']="https://code.rhodecode.com" |
|
3427 | [[ -n ${args['--server-url']:-} ]] || args['--server-url']="https://code.rhodecode.com" | |
3417 | [[ -n ${args['--revision']:-} ]] || args['--revision']="master" |
|
3428 | [[ -n ${args['--revision']:-} ]] || args['--revision']="master" | |
3418 |
|
3429 | |||
3419 | } |
|
3430 | } | |
3420 |
|
3431 | |||
3421 | # :command.parse_requirements |
|
3432 | # :command.parse_requirements | |
3422 | rcstack_self_update_parse_requirements() { |
|
3433 | rcstack_self_update_parse_requirements() { | |
3423 | # :command.fixed_flags_filter |
|
3434 | # :command.fixed_flags_filter | |
3424 | while [[ $# -gt 0 ]]; do |
|
3435 | while [[ $# -gt 0 ]]; do | |
3425 | case "${1:-}" in |
|
3436 | case "${1:-}" in | |
3426 | --help | -h) |
|
3437 | --help | -h) | |
3427 | long_usage=yes |
|
3438 | long_usage=yes | |
3428 | rcstack_self_update_usage |
|
3439 | rcstack_self_update_usage | |
3429 | exit |
|
3440 | exit | |
3430 | ;; |
|
3441 | ;; | |
3431 |
|
3442 | |||
3432 | *) |
|
3443 | *) | |
3433 | break |
|
3444 | break | |
3434 | ;; |
|
3445 | ;; | |
3435 |
|
3446 | |||
3436 | esac |
|
3447 | esac | |
3437 | done |
|
3448 | done | |
3438 |
|
3449 | |||
3439 | # :command.dependencies_filter |
|
3450 | # :command.dependencies_filter | |
3440 | if ! command -v curl >/dev/null 2>&1; then |
|
3451 | if ! command -v curl >/dev/null 2>&1; then | |
3441 | printf "missing dependency: curl\n" >&2 |
|
3452 | printf "missing dependency: curl\n" >&2 | |
3442 | exit 1 |
|
3453 | exit 1 | |
3443 | fi |
|
3454 | fi | |
3444 |
|
3455 | |||
3445 | if ! command -v tar >/dev/null 2>&1; then |
|
3456 | if ! command -v tar >/dev/null 2>&1; then | |
3446 | printf "missing dependency: tar\n" >&2 |
|
3457 | printf "missing dependency: tar\n" >&2 | |
3447 | exit 1 |
|
3458 | exit 1 | |
3448 | fi |
|
3459 | fi | |
3449 |
|
3460 | |||
3450 | # :command.command_filter |
|
3461 | # :command.command_filter | |
3451 | action="self-update" |
|
3462 | action="self-update" | |
3452 |
|
3463 | |||
3453 | # :command.parse_requirements_while |
|
3464 | # :command.parse_requirements_while | |
3454 | while [[ $# -gt 0 ]]; do |
|
3465 | while [[ $# -gt 0 ]]; do | |
3455 | key="$1" |
|
3466 | key="$1" | |
3456 | case "$key" in |
|
3467 | case "$key" in | |
3457 | # :flag.case |
|
3468 | # :flag.case | |
3458 | --installer-revision) |
|
3469 | --installer-revision) | |
3459 |
|
3470 | |||
3460 | # :flag.case_arg |
|
3471 | # :flag.case_arg | |
3461 | if [[ -n ${2+x} ]]; then |
|
3472 | if [[ -n ${2+x} ]]; then | |
3462 |
|
3473 | |||
3463 | args['--installer-revision']="$2" |
|
3474 | args['--installer-revision']="$2" | |
3464 | shift |
|
3475 | shift | |
3465 | shift |
|
3476 | shift | |
3466 | else |
|
3477 | else | |
3467 | printf "%s\n" "--installer-revision requires an argument: --installer-revision INSTALLER_REVISION" >&2 |
|
3478 | printf "%s\n" "--installer-revision requires an argument: --installer-revision INSTALLER_REVISION" >&2 | |
3468 | exit 1 |
|
3479 | exit 1 | |
3469 | fi |
|
3480 | fi | |
3470 | ;; |
|
3481 | ;; | |
3471 |
|
3482 | |||
3472 | # :flag.case |
|
3483 | # :flag.case | |
3473 | --revision) |
|
3484 | --revision) | |
3474 |
|
3485 | |||
3475 | # :flag.case_arg |
|
3486 | # :flag.case_arg | |
3476 | if [[ -n ${2+x} ]]; then |
|
3487 | if [[ -n ${2+x} ]]; then | |
3477 |
|
3488 | |||
3478 | args['--revision']="$2" |
|
3489 | args['--revision']="$2" | |
3479 | shift |
|
3490 | shift | |
3480 | shift |
|
3491 | shift | |
3481 | else |
|
3492 | else | |
3482 | printf "%s\n" "--revision requires an argument: --revision REVISION" >&2 |
|
3493 | printf "%s\n" "--revision requires an argument: --revision REVISION" >&2 | |
3483 | exit 1 |
|
3494 | exit 1 | |
3484 | fi |
|
3495 | fi | |
3485 | ;; |
|
3496 | ;; | |
3486 |
|
3497 | |||
3487 | # :flag.case |
|
3498 | # :flag.case | |
3488 | --auth-token) |
|
3499 | --auth-token) | |
3489 |
|
3500 | |||
3490 | # :flag.case_arg |
|
3501 | # :flag.case_arg | |
3491 | if [[ -n ${2+x} ]]; then |
|
3502 | if [[ -n ${2+x} ]]; then | |
3492 |
|
3503 | |||
3493 | args['--auth-token']="$2" |
|
3504 | args['--auth-token']="$2" | |
3494 | shift |
|
3505 | shift | |
3495 | shift |
|
3506 | shift | |
3496 | else |
|
3507 | else | |
3497 | printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2 |
|
3508 | printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2 | |
3498 | exit 1 |
|
3509 | exit 1 | |
3499 | fi |
|
3510 | fi | |
3500 | ;; |
|
3511 | ;; | |
3501 |
|
3512 | |||
3502 | # :flag.case |
|
3513 | # :flag.case | |
3503 | --server-url) |
|
3514 | --server-url) | |
3504 |
|
3515 | |||
3505 | # :flag.case_arg |
|
3516 | # :flag.case_arg | |
3506 | if [[ -n ${2+x} ]]; then |
|
3517 | if [[ -n ${2+x} ]]; then | |
3507 |
|
3518 | |||
3508 | args['--server-url']="$2" |
|
3519 | args['--server-url']="$2" | |
3509 | shift |
|
3520 | shift | |
3510 | shift |
|
3521 | shift | |
3511 | else |
|
3522 | else | |
3512 | printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2 |
|
3523 | printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2 | |
3513 | exit 1 |
|
3524 | exit 1 | |
3514 | fi |
|
3525 | fi | |
3515 | ;; |
|
3526 | ;; | |
3516 |
|
3527 | |||
3517 | -?*) |
|
3528 | -?*) | |
3518 | printf "invalid option: %s\n" "$key" >&2 |
|
3529 | printf "invalid option: %s\n" "$key" >&2 | |
3519 | exit 1 |
|
3530 | exit 1 | |
3520 | ;; |
|
3531 | ;; | |
3521 |
|
3532 | |||
3522 | *) |
|
3533 | *) | |
3523 | # :command.parse_requirements_case |
|
3534 | # :command.parse_requirements_case | |
3524 | # :command.parse_requirements_case_simple |
|
3535 | # :command.parse_requirements_case_simple | |
3525 | printf "invalid argument: %s\n" "$key" >&2 |
|
3536 | printf "invalid argument: %s\n" "$key" >&2 | |
3526 | exit 1 |
|
3537 | exit 1 | |
3527 |
|
3538 | |||
3528 | ;; |
|
3539 | ;; | |
3529 |
|
3540 | |||
3530 | esac |
|
3541 | esac | |
3531 | done |
|
3542 | done | |
3532 |
|
3543 | |||
3533 | # :command.default_assignments |
|
3544 | # :command.default_assignments | |
3534 | [[ -n ${args['--installer-revision']:-} ]] || args['--installer-revision']="master" |
|
3545 | [[ -n ${args['--installer-revision']:-} ]] || args['--installer-revision']="master" | |
3535 | [[ -n ${args['--revision']:-} ]] || args['--revision']="master" |
|
3546 | [[ -n ${args['--revision']:-} ]] || args['--revision']="master" | |
3536 | [[ -n ${args['--server-url']:-} ]] || args['--server-url']="https://code.rhodecode.com" |
|
3547 | [[ -n ${args['--server-url']:-} ]] || args['--server-url']="https://code.rhodecode.com" | |
3537 |
|
3548 | |||
3538 | } |
|
3549 | } | |
3539 |
|
3550 | |||
3540 | # :command.parse_requirements |
|
3551 | # :command.parse_requirements | |
3541 | rcstack_stack_parse_requirements() { |
|
3552 | rcstack_stack_parse_requirements() { | |
3542 | # :command.fixed_flags_filter |
|
3553 | # :command.fixed_flags_filter | |
3543 | while [[ $# -gt 0 ]]; do |
|
3554 | while [[ $# -gt 0 ]]; do | |
3544 | case "${1:-}" in |
|
3555 | case "${1:-}" in | |
3545 | --help | -h) |
|
3556 | --help | -h) | |
3546 | long_usage=yes |
|
3557 | long_usage=yes | |
3547 | rcstack_stack_usage |
|
3558 | rcstack_stack_usage | |
3548 | exit |
|
3559 | exit | |
3549 | ;; |
|
3560 | ;; | |
3550 |
|
3561 | |||
3551 | # :flag.case |
|
3562 | # :flag.case | |
3552 | --env-file-path) |
|
3563 | --env-file-path) | |
3553 |
|
3564 | |||
3554 | # :flag.case_arg |
|
3565 | # :flag.case_arg | |
3555 | if [[ -n ${2+x} ]]; then |
|
3566 | if [[ -n ${2+x} ]]; then | |
3556 |
|
3567 | |||
3557 | args['--env-file-path']="$2" |
|
3568 | args['--env-file-path']="$2" | |
3558 | shift |
|
3569 | shift | |
3559 | shift |
|
3570 | shift | |
3560 | else |
|
3571 | else | |
3561 | printf "%s\n" "--env-file-path requires an argument: --env-file-path ENV_FILE_PATH" >&2 |
|
3572 | printf "%s\n" "--env-file-path requires an argument: --env-file-path ENV_FILE_PATH" >&2 | |
3562 | exit 1 |
|
3573 | exit 1 | |
3563 | fi |
|
3574 | fi | |
3564 | ;; |
|
3575 | ;; | |
3565 |
|
3576 | |||
3566 | *) |
|
3577 | *) | |
3567 | break |
|
3578 | break | |
3568 | ;; |
|
3579 | ;; | |
3569 |
|
3580 | |||
3570 | esac |
|
3581 | esac | |
3571 | done |
|
3582 | done | |
3572 |
|
3583 | |||
3573 | # :command.command_filter |
|
3584 | # :command.command_filter | |
3574 | action=${1:-} |
|
3585 | action=${1:-} | |
3575 |
|
3586 | |||
3576 | case $action in |
|
3587 | case $action in | |
3577 | -*) ;; |
|
3588 | -*) ;; | |
3578 |
|
3589 | |||
3579 | router) |
|
3590 | router) | |
3580 | action="router" |
|
3591 | action="router" | |
3581 | shift |
|
3592 | shift | |
3582 | rcstack_stack_router_parse_requirements "$@" |
|
3593 | rcstack_stack_router_parse_requirements "$@" | |
3583 | shift $# |
|
3594 | shift $# | |
3584 | ;; |
|
3595 | ;; | |
3585 |
|
3596 | |||
3586 | metrics) |
|
3597 | metrics) | |
3587 | action="metrics" |
|
3598 | action="metrics" | |
3588 | shift |
|
3599 | shift | |
3589 | rcstack_stack_metrics_parse_requirements "$@" |
|
3600 | rcstack_stack_metrics_parse_requirements "$@" | |
3590 | shift $# |
|
3601 | shift $# | |
3591 | ;; |
|
3602 | ;; | |
3592 |
|
3603 | |||
3593 | services) |
|
3604 | services) | |
3594 | action="services" |
|
3605 | action="services" | |
3595 | shift |
|
3606 | shift | |
3596 | rcstack_stack_services_parse_requirements "$@" |
|
3607 | rcstack_stack_services_parse_requirements "$@" | |
3597 | shift $# |
|
3608 | shift $# | |
3598 | ;; |
|
3609 | ;; | |
3599 |
|
3610 | |||
3600 | rhodecode) |
|
3611 | rhodecode) | |
3601 | action="rhodecode" |
|
3612 | action="rhodecode" | |
3602 | shift |
|
3613 | shift | |
3603 | rcstack_stack_rhodecode_parse_requirements "$@" |
|
3614 | rcstack_stack_rhodecode_parse_requirements "$@" | |
3604 | shift $# |
|
3615 | shift $# | |
3605 | ;; |
|
3616 | ;; | |
3606 |
|
3617 | |||
3607 | all) |
|
3618 | all) | |
3608 | action="all" |
|
3619 | action="all" | |
3609 | shift |
|
3620 | shift | |
3610 | rcstack_stack_all_parse_requirements "$@" |
|
3621 | rcstack_stack_all_parse_requirements "$@" | |
3611 | shift $# |
|
3622 | shift $# | |
3612 | ;; |
|
3623 | ;; | |
3613 |
|
3624 | |||
3614 | # :command.command_fallback |
|
3625 | # :command.command_fallback | |
3615 | "") |
|
3626 | "") | |
3616 | rcstack_stack_usage >&2 |
|
3627 | rcstack_stack_usage >&2 | |
3617 | exit 1 |
|
3628 | exit 1 | |
3618 | ;; |
|
3629 | ;; | |
3619 |
|
3630 | |||
3620 | *) |
|
3631 | *) | |
3621 | printf "invalid command: %s\n" "$action" >&2 |
|
3632 | printf "invalid command: %s\n" "$action" >&2 | |
3622 | exit 1 |
|
3633 | exit 1 | |
3623 | ;; |
|
3634 | ;; | |
3624 |
|
3635 | |||
3625 | esac |
|
3636 | esac | |
3626 |
|
3637 | |||
3627 | # :command.parse_requirements_while |
|
3638 | # :command.parse_requirements_while | |
3628 | while [[ $# -gt 0 ]]; do |
|
3639 | while [[ $# -gt 0 ]]; do | |
3629 | key="$1" |
|
3640 | key="$1" | |
3630 | case "$key" in |
|
3641 | case "$key" in | |
3631 |
|
3642 | |||
3632 | -?*) |
|
3643 | -?*) | |
3633 | printf "invalid option: %s\n" "$key" >&2 |
|
3644 | printf "invalid option: %s\n" "$key" >&2 | |
3634 | exit 1 |
|
3645 | exit 1 | |
3635 | ;; |
|
3646 | ;; | |
3636 |
|
3647 | |||
3637 | *) |
|
3648 | *) | |
3638 | # :command.parse_requirements_case |
|
3649 | # :command.parse_requirements_case | |
3639 | # :command.parse_requirements_case_simple |
|
3650 | # :command.parse_requirements_case_simple | |
3640 | printf "invalid argument: %s\n" "$key" >&2 |
|
3651 | printf "invalid argument: %s\n" "$key" >&2 | |
3641 | exit 1 |
|
3652 | exit 1 | |
3642 |
|
3653 | |||
3643 | ;; |
|
3654 | ;; | |
3644 |
|
3655 | |||
3645 | esac |
|
3656 | esac | |
3646 | done |
|
3657 | done | |
3647 |
|
3658 | |||
3648 | # :command.default_assignments |
|
3659 | # :command.default_assignments | |
3649 | [[ -n ${args['--env-file-path']:-} ]] || args['--env-file-path']="$PWD/.custom/.runtime.env" |
|
3660 | [[ -n ${args['--env-file-path']:-} ]] || args['--env-file-path']="$PWD/.custom/.runtime.env" | |
3650 |
|
3661 | |||
3651 | } |
|
3662 | } | |
3652 |
|
3663 | |||
3653 | # :command.parse_requirements |
|
3664 | # :command.parse_requirements | |
3654 | rcstack_stack_router_parse_requirements() { |
|
3665 | rcstack_stack_router_parse_requirements() { | |
3655 | # :command.fixed_flags_filter |
|
3666 | # :command.fixed_flags_filter | |
3656 | while [[ $# -gt 0 ]]; do |
|
3667 | while [[ $# -gt 0 ]]; do | |
3657 | case "${1:-}" in |
|
3668 | case "${1:-}" in | |
3658 | --help | -h) |
|
3669 | --help | -h) | |
3659 | long_usage=yes |
|
3670 | long_usage=yes | |
3660 | rcstack_stack_router_usage |
|
3671 | rcstack_stack_router_usage | |
3661 | exit |
|
3672 | exit | |
3662 | ;; |
|
3673 | ;; | |
3663 |
|
3674 | |||
3664 | *) |
|
3675 | *) | |
3665 | break |
|
3676 | break | |
3666 | ;; |
|
3677 | ;; | |
3667 |
|
3678 | |||
3668 | esac |
|
3679 | esac | |
3669 | done |
|
3680 | done | |
3670 |
|
3681 | |||
3671 | # :command.command_filter |
|
3682 | # :command.command_filter | |
3672 | action="stack router" |
|
3683 | action="stack router" | |
3673 |
|
3684 | |||
3674 | # :command.parse_requirements_while |
|
3685 | # :command.parse_requirements_while | |
3675 | while [[ $# -gt 0 ]]; do |
|
3686 | while [[ $# -gt 0 ]]; do | |
3676 | key="$1" |
|
3687 | key="$1" | |
3677 | case "$key" in |
|
3688 | case "$key" in | |
3678 |
|
3689 | |||
3679 | --) |
|
3690 | --) | |
3680 | shift |
|
3691 | shift | |
3681 | other_args+=("$@") |
|
3692 | other_args+=("$@") | |
3682 | break |
|
3693 | break | |
3683 | ;; |
|
3694 | ;; | |
3684 |
|
3695 | |||
3685 | -?*) |
|
3696 | -?*) | |
3686 | other_args+=("$1") |
|
3697 | other_args+=("$1") | |
3687 | shift |
|
3698 | shift | |
3688 | ;; |
|
3699 | ;; | |
3689 |
|
3700 | |||
3690 | *) |
|
3701 | *) | |
3691 | # :command.parse_requirements_case |
|
3702 | # :command.parse_requirements_case | |
3692 | # :command.parse_requirements_case_catch_all |
|
3703 | # :command.parse_requirements_case_catch_all | |
3693 | other_args+=("$1") |
|
3704 | other_args+=("$1") | |
3694 | shift |
|
3705 | shift | |
3695 |
|
3706 | |||
3696 | ;; |
|
3707 | ;; | |
3697 |
|
3708 | |||
3698 | esac |
|
3709 | esac | |
3699 | done |
|
3710 | done | |
3700 |
|
3711 | |||
3701 | } |
|
3712 | } | |
3702 |
|
3713 | |||
3703 | # :command.parse_requirements |
|
3714 | # :command.parse_requirements | |
3704 | rcstack_stack_metrics_parse_requirements() { |
|
3715 | rcstack_stack_metrics_parse_requirements() { | |
3705 | # :command.fixed_flags_filter |
|
3716 | # :command.fixed_flags_filter | |
3706 | while [[ $# -gt 0 ]]; do |
|
3717 | while [[ $# -gt 0 ]]; do | |
3707 | case "${1:-}" in |
|
3718 | case "${1:-}" in | |
3708 | --help | -h) |
|
3719 | --help | -h) | |
3709 | long_usage=yes |
|
3720 | long_usage=yes | |
3710 | rcstack_stack_metrics_usage |
|
3721 | rcstack_stack_metrics_usage | |
3711 | exit |
|
3722 | exit | |
3712 | ;; |
|
3723 | ;; | |
3713 |
|
3724 | |||
3714 | *) |
|
3725 | *) | |
3715 | break |
|
3726 | break | |
3716 | ;; |
|
3727 | ;; | |
3717 |
|
3728 | |||
3718 | esac |
|
3729 | esac | |
3719 | done |
|
3730 | done | |
3720 |
|
3731 | |||
3721 | # :command.command_filter |
|
3732 | # :command.command_filter | |
3722 | action="stack metrics" |
|
3733 | action="stack metrics" | |
3723 |
|
3734 | |||
3724 | # :command.parse_requirements_while |
|
3735 | # :command.parse_requirements_while | |
3725 | while [[ $# -gt 0 ]]; do |
|
3736 | while [[ $# -gt 0 ]]; do | |
3726 | key="$1" |
|
3737 | key="$1" | |
3727 | case "$key" in |
|
3738 | case "$key" in | |
3728 |
|
3739 | |||
3729 | --) |
|
3740 | --) | |
3730 | shift |
|
3741 | shift | |
3731 | other_args+=("$@") |
|
3742 | other_args+=("$@") | |
3732 | break |
|
3743 | break | |
3733 | ;; |
|
3744 | ;; | |
3734 |
|
3745 | |||
3735 | -?*) |
|
3746 | -?*) | |
3736 | other_args+=("$1") |
|
3747 | other_args+=("$1") | |
3737 | shift |
|
3748 | shift | |
3738 | ;; |
|
3749 | ;; | |
3739 |
|
3750 | |||
3740 | *) |
|
3751 | *) | |
3741 | # :command.parse_requirements_case |
|
3752 | # :command.parse_requirements_case | |
3742 | # :command.parse_requirements_case_catch_all |
|
3753 | # :command.parse_requirements_case_catch_all | |
3743 | other_args+=("$1") |
|
3754 | other_args+=("$1") | |
3744 | shift |
|
3755 | shift | |
3745 |
|
3756 | |||
3746 | ;; |
|
3757 | ;; | |
3747 |
|
3758 | |||
3748 | esac |
|
3759 | esac | |
3749 | done |
|
3760 | done | |
3750 |
|
3761 | |||
3751 | } |
|
3762 | } | |
3752 |
|
3763 | |||
3753 | # :command.parse_requirements |
|
3764 | # :command.parse_requirements | |
3754 | rcstack_stack_services_parse_requirements() { |
|
3765 | rcstack_stack_services_parse_requirements() { | |
3755 | # :command.fixed_flags_filter |
|
3766 | # :command.fixed_flags_filter | |
3756 | while [[ $# -gt 0 ]]; do |
|
3767 | while [[ $# -gt 0 ]]; do | |
3757 | case "${1:-}" in |
|
3768 | case "${1:-}" in | |
3758 | --help | -h) |
|
3769 | --help | -h) | |
3759 | long_usage=yes |
|
3770 | long_usage=yes | |
3760 | rcstack_stack_services_usage |
|
3771 | rcstack_stack_services_usage | |
3761 | exit |
|
3772 | exit | |
3762 | ;; |
|
3773 | ;; | |
3763 |
|
3774 | |||
3764 | *) |
|
3775 | *) | |
3765 | break |
|
3776 | break | |
3766 | ;; |
|
3777 | ;; | |
3767 |
|
3778 | |||
3768 | esac |
|
3779 | esac | |
3769 | done |
|
3780 | done | |
3770 |
|
3781 | |||
3771 | # :command.command_filter |
|
3782 | # :command.command_filter | |
3772 | action="stack services" |
|
3783 | action="stack services" | |
3773 |
|
3784 | |||
3774 | # :command.parse_requirements_while |
|
3785 | # :command.parse_requirements_while | |
3775 | while [[ $# -gt 0 ]]; do |
|
3786 | while [[ $# -gt 0 ]]; do | |
3776 | key="$1" |
|
3787 | key="$1" | |
3777 | case "$key" in |
|
3788 | case "$key" in | |
3778 |
|
3789 | |||
3779 | --) |
|
3790 | --) | |
3780 | shift |
|
3791 | shift | |
3781 | other_args+=("$@") |
|
3792 | other_args+=("$@") | |
3782 | break |
|
3793 | break | |
3783 | ;; |
|
3794 | ;; | |
3784 |
|
3795 | |||
3785 | -?*) |
|
3796 | -?*) | |
3786 | other_args+=("$1") |
|
3797 | other_args+=("$1") | |
3787 | shift |
|
3798 | shift | |
3788 | ;; |
|
3799 | ;; | |
3789 |
|
3800 | |||
3790 | *) |
|
3801 | *) | |
3791 | # :command.parse_requirements_case |
|
3802 | # :command.parse_requirements_case | |
3792 | # :command.parse_requirements_case_catch_all |
|
3803 | # :command.parse_requirements_case_catch_all | |
3793 | other_args+=("$1") |
|
3804 | other_args+=("$1") | |
3794 | shift |
|
3805 | shift | |
3795 |
|
3806 | |||
3796 | ;; |
|
3807 | ;; | |
3797 |
|
3808 | |||
3798 | esac |
|
3809 | esac | |
3799 | done |
|
3810 | done | |
3800 |
|
3811 | |||
3801 | } |
|
3812 | } | |
3802 |
|
3813 | |||
3803 | # :command.parse_requirements |
|
3814 | # :command.parse_requirements | |
3804 | rcstack_stack_rhodecode_parse_requirements() { |
|
3815 | rcstack_stack_rhodecode_parse_requirements() { | |
3805 | # :command.fixed_flags_filter |
|
3816 | # :command.fixed_flags_filter | |
3806 | while [[ $# -gt 0 ]]; do |
|
3817 | while [[ $# -gt 0 ]]; do | |
3807 | case "${1:-}" in |
|
3818 | case "${1:-}" in | |
3808 | --help | -h) |
|
3819 | --help | -h) | |
3809 | long_usage=yes |
|
3820 | long_usage=yes | |
3810 | rcstack_stack_rhodecode_usage |
|
3821 | rcstack_stack_rhodecode_usage | |
3811 | exit |
|
3822 | exit | |
3812 | ;; |
|
3823 | ;; | |
3813 |
|
3824 | |||
3814 | *) |
|
3825 | *) | |
3815 | break |
|
3826 | break | |
3816 | ;; |
|
3827 | ;; | |
3817 |
|
3828 | |||
3818 | esac |
|
3829 | esac | |
3819 | done |
|
3830 | done | |
3820 |
|
3831 | |||
3821 | # :command.command_filter |
|
3832 | # :command.command_filter | |
3822 | action="stack rhodecode" |
|
3833 | action="stack rhodecode" | |
3823 |
|
3834 | |||
3824 | # :command.parse_requirements_while |
|
3835 | # :command.parse_requirements_while | |
3825 | while [[ $# -gt 0 ]]; do |
|
3836 | while [[ $# -gt 0 ]]; do | |
3826 | key="$1" |
|
3837 | key="$1" | |
3827 | case "$key" in |
|
3838 | case "$key" in | |
3828 |
|
3839 | |||
3829 | --) |
|
3840 | --) | |
3830 | shift |
|
3841 | shift | |
3831 | other_args+=("$@") |
|
3842 | other_args+=("$@") | |
3832 | break |
|
3843 | break | |
3833 | ;; |
|
3844 | ;; | |
3834 |
|
3845 | |||
3835 | -?*) |
|
3846 | -?*) | |
3836 | other_args+=("$1") |
|
3847 | other_args+=("$1") | |
3837 | shift |
|
3848 | shift | |
3838 | ;; |
|
3849 | ;; | |
3839 |
|
3850 | |||
3840 | *) |
|
3851 | *) | |
3841 | # :command.parse_requirements_case |
|
3852 | # :command.parse_requirements_case | |
3842 | # :command.parse_requirements_case_catch_all |
|
3853 | # :command.parse_requirements_case_catch_all | |
3843 | other_args+=("$1") |
|
3854 | other_args+=("$1") | |
3844 | shift |
|
3855 | shift | |
3845 |
|
3856 | |||
3846 | ;; |
|
3857 | ;; | |
3847 |
|
3858 | |||
3848 | esac |
|
3859 | esac | |
3849 | done |
|
3860 | done | |
3850 |
|
3861 | |||
3851 | } |
|
3862 | } | |
3852 |
|
3863 | |||
3853 | # :command.parse_requirements |
|
3864 | # :command.parse_requirements | |
3854 | rcstack_stack_all_parse_requirements() { |
|
3865 | rcstack_stack_all_parse_requirements() { | |
3855 | # :command.fixed_flags_filter |
|
3866 | # :command.fixed_flags_filter | |
3856 | while [[ $# -gt 0 ]]; do |
|
3867 | while [[ $# -gt 0 ]]; do | |
3857 | case "${1:-}" in |
|
3868 | case "${1:-}" in | |
3858 | --help | -h) |
|
3869 | --help | -h) | |
3859 | long_usage=yes |
|
3870 | long_usage=yes | |
3860 | rcstack_stack_all_usage |
|
3871 | rcstack_stack_all_usage | |
3861 | exit |
|
3872 | exit | |
3862 | ;; |
|
3873 | ;; | |
3863 |
|
3874 | |||
3864 | *) |
|
3875 | *) | |
3865 | break |
|
3876 | break | |
3866 | ;; |
|
3877 | ;; | |
3867 |
|
3878 | |||
3868 | esac |
|
3879 | esac | |
3869 | done |
|
3880 | done | |
3870 |
|
3881 | |||
3871 | # :command.command_filter |
|
3882 | # :command.command_filter | |
3872 | action="stack all" |
|
3883 | action="stack all" | |
3873 |
|
3884 | |||
3874 | # :command.parse_requirements_while |
|
3885 | # :command.parse_requirements_while | |
3875 | while [[ $# -gt 0 ]]; do |
|
3886 | while [[ $# -gt 0 ]]; do | |
3876 | key="$1" |
|
3887 | key="$1" | |
3877 | case "$key" in |
|
3888 | case "$key" in | |
3878 |
|
3889 | |||
3879 | --) |
|
3890 | --) | |
3880 | shift |
|
3891 | shift | |
3881 | other_args+=("$@") |
|
3892 | other_args+=("$@") | |
3882 | break |
|
3893 | break | |
3883 | ;; |
|
3894 | ;; | |
3884 |
|
3895 | |||
3885 | -?*) |
|
3896 | -?*) | |
3886 | other_args+=("$1") |
|
3897 | other_args+=("$1") | |
3887 | shift |
|
3898 | shift | |
3888 | ;; |
|
3899 | ;; | |
3889 |
|
3900 | |||
3890 | *) |
|
3901 | *) | |
3891 | # :command.parse_requirements_case |
|
3902 | # :command.parse_requirements_case | |
3892 | # :command.parse_requirements_case_catch_all |
|
3903 | # :command.parse_requirements_case_catch_all | |
3893 | other_args+=("$1") |
|
3904 | other_args+=("$1") | |
3894 | shift |
|
3905 | shift | |
3895 |
|
3906 | |||
3896 | ;; |
|
3907 | ;; | |
3897 |
|
3908 | |||
3898 | esac |
|
3909 | esac | |
3899 | done |
|
3910 | done | |
3900 |
|
3911 | |||
3901 | } |
|
3912 | } | |
3902 |
|
3913 | |||
3903 | # :command.parse_requirements |
|
3914 | # :command.parse_requirements | |
3904 | rcstack_stack_status_parse_requirements() { |
|
3915 | rcstack_stack_status_parse_requirements() { | |
3905 | # :command.fixed_flags_filter |
|
3916 | # :command.fixed_flags_filter | |
3906 | while [[ $# -gt 0 ]]; do |
|
3917 | while [[ $# -gt 0 ]]; do | |
3907 | case "${1:-}" in |
|
3918 | case "${1:-}" in | |
3908 | --help | -h) |
|
3919 | --help | -h) | |
3909 | long_usage=yes |
|
3920 | long_usage=yes | |
3910 | rcstack_stack_status_usage |
|
3921 | rcstack_stack_status_usage | |
3911 | exit |
|
3922 | exit | |
3912 | ;; |
|
3923 | ;; | |
3913 |
|
3924 | |||
3914 | *) |
|
3925 | *) | |
3915 | break |
|
3926 | break | |
3916 | ;; |
|
3927 | ;; | |
3917 |
|
3928 | |||
3918 | esac |
|
3929 | esac | |
3919 | done |
|
3930 | done | |
3920 |
|
3931 | |||
3921 | # :command.command_filter |
|
3932 | # :command.command_filter | |
3922 | action="stack-status" |
|
3933 | action="stack-status" | |
3923 |
|
3934 | |||
3924 | # :command.parse_requirements_while |
|
3935 | # :command.parse_requirements_while | |
3925 | while [[ $# -gt 0 ]]; do |
|
3936 | while [[ $# -gt 0 ]]; do | |
3926 | key="$1" |
|
3937 | key="$1" | |
3927 | case "$key" in |
|
3938 | case "$key" in | |
3928 | # :flag.case |
|
3939 | # :flag.case | |
3929 | --detailed) |
|
3940 | --detailed) | |
3930 |
|
3941 | |||
3931 | # :flag.case_no_arg |
|
3942 | # :flag.case_no_arg | |
3932 | args['--detailed']=1 |
|
3943 | args['--detailed']=1 | |
3933 | shift |
|
3944 | shift | |
3934 | ;; |
|
3945 | ;; | |
3935 |
|
3946 | |||
3936 | -?*) |
|
3947 | -?*) | |
3937 | printf "invalid option: %s\n" "$key" >&2 |
|
3948 | printf "invalid option: %s\n" "$key" >&2 | |
3938 | exit 1 |
|
3949 | exit 1 | |
3939 | ;; |
|
3950 | ;; | |
3940 |
|
3951 | |||
3941 | *) |
|
3952 | *) | |
3942 | # :command.parse_requirements_case |
|
3953 | # :command.parse_requirements_case | |
3943 | # :command.parse_requirements_case_simple |
|
3954 | # :command.parse_requirements_case_simple | |
3944 | printf "invalid argument: %s\n" "$key" >&2 |
|
3955 | printf "invalid argument: %s\n" "$key" >&2 | |
3945 | exit 1 |
|
3956 | exit 1 | |
3946 |
|
3957 | |||
3947 | ;; |
|
3958 | ;; | |
3948 |
|
3959 | |||
3949 | esac |
|
3960 | esac | |
3950 | done |
|
3961 | done | |
3951 |
|
3962 | |||
3952 | } |
|
3963 | } | |
3953 |
|
3964 | |||
3954 | # :command.parse_requirements |
|
3965 | # :command.parse_requirements | |
3955 | rcstack_stack_upgrade_parse_requirements() { |
|
3966 | rcstack_stack_upgrade_parse_requirements() { | |
3956 | # :command.fixed_flags_filter |
|
3967 | # :command.fixed_flags_filter | |
3957 | while [[ $# -gt 0 ]]; do |
|
3968 | while [[ $# -gt 0 ]]; do | |
3958 | case "${1:-}" in |
|
3969 | case "${1:-}" in | |
3959 | --help | -h) |
|
3970 | --help | -h) | |
3960 | long_usage=yes |
|
3971 | long_usage=yes | |
3961 | rcstack_stack_upgrade_usage |
|
3972 | rcstack_stack_upgrade_usage | |
3962 | exit |
|
3973 | exit | |
3963 | ;; |
|
3974 | ;; | |
3964 |
|
3975 | |||
3965 | *) |
|
3976 | *) | |
3966 | break |
|
3977 | break | |
3967 | ;; |
|
3978 | ;; | |
3968 |
|
3979 | |||
3969 | esac |
|
3980 | esac | |
3970 | done |
|
3981 | done | |
3971 |
|
3982 | |||
3972 | # :command.command_filter |
|
3983 | # :command.command_filter | |
3973 | action=${1:-} |
|
3984 | action=${1:-} | |
3974 |
|
3985 | |||
3975 | case $action in |
|
3986 | case $action in | |
3976 | -*) ;; |
|
3987 | -*) ;; | |
3977 |
|
3988 | |||
3978 | router) |
|
3989 | router) | |
3979 | action="router" |
|
3990 | action="router" | |
3980 | shift |
|
3991 | shift | |
3981 | rcstack_stack_upgrade_router_parse_requirements "$@" |
|
3992 | rcstack_stack_upgrade_router_parse_requirements "$@" | |
3982 | shift $# |
|
3993 | shift $# | |
3983 | ;; |
|
3994 | ;; | |
3984 |
|
3995 | |||
3985 | metrics) |
|
3996 | metrics) | |
3986 | action="metrics" |
|
3997 | action="metrics" | |
3987 | shift |
|
3998 | shift | |
3988 | rcstack_stack_upgrade_metrics_parse_requirements "$@" |
|
3999 | rcstack_stack_upgrade_metrics_parse_requirements "$@" | |
3989 | shift $# |
|
4000 | shift $# | |
3990 | ;; |
|
4001 | ;; | |
3991 |
|
4002 | |||
3992 | services) |
|
4003 | services) | |
3993 | action="services" |
|
4004 | action="services" | |
3994 | shift |
|
4005 | shift | |
3995 | rcstack_stack_upgrade_services_parse_requirements "$@" |
|
4006 | rcstack_stack_upgrade_services_parse_requirements "$@" | |
3996 | shift $# |
|
4007 | shift $# | |
3997 | ;; |
|
4008 | ;; | |
3998 |
|
4009 | |||
3999 | rhodecode) |
|
4010 | rhodecode) | |
4000 | action="rhodecode" |
|
4011 | action="rhodecode" | |
4001 | shift |
|
4012 | shift | |
4002 | rcstack_stack_upgrade_rhodecode_parse_requirements "$@" |
|
4013 | rcstack_stack_upgrade_rhodecode_parse_requirements "$@" | |
4003 | shift $# |
|
4014 | shift $# | |
4004 | ;; |
|
4015 | ;; | |
4005 |
|
4016 | |||
4006 | # :command.command_fallback |
|
4017 | # :command.command_fallback | |
4007 | "") |
|
4018 | "") | |
4008 | rcstack_stack_upgrade_usage >&2 |
|
4019 | rcstack_stack_upgrade_usage >&2 | |
4009 | exit 1 |
|
4020 | exit 1 | |
4010 | ;; |
|
4021 | ;; | |
4011 |
|
4022 | |||
4012 | *) |
|
4023 | *) | |
4013 | printf "invalid command: %s\n" "$action" >&2 |
|
4024 | printf "invalid command: %s\n" "$action" >&2 | |
4014 | exit 1 |
|
4025 | exit 1 | |
4015 | ;; |
|
4026 | ;; | |
4016 |
|
4027 | |||
4017 | esac |
|
4028 | esac | |
4018 |
|
4029 | |||
4019 | # :command.parse_requirements_while |
|
4030 | # :command.parse_requirements_while | |
4020 | while [[ $# -gt 0 ]]; do |
|
4031 | while [[ $# -gt 0 ]]; do | |
4021 | key="$1" |
|
4032 | key="$1" | |
4022 | case "$key" in |
|
4033 | case "$key" in | |
4023 |
|
4034 | |||
4024 | -?*) |
|
4035 | -?*) | |
4025 | printf "invalid option: %s\n" "$key" >&2 |
|
4036 | printf "invalid option: %s\n" "$key" >&2 | |
4026 | exit 1 |
|
4037 | exit 1 | |
4027 | ;; |
|
4038 | ;; | |
4028 |
|
4039 | |||
4029 | *) |
|
4040 | *) | |
4030 | # :command.parse_requirements_case |
|
4041 | # :command.parse_requirements_case | |
4031 | # :command.parse_requirements_case_simple |
|
4042 | # :command.parse_requirements_case_simple | |
4032 | printf "invalid argument: %s\n" "$key" >&2 |
|
4043 | printf "invalid argument: %s\n" "$key" >&2 | |
4033 | exit 1 |
|
4044 | exit 1 | |
4034 |
|
4045 | |||
4035 | ;; |
|
4046 | ;; | |
4036 |
|
4047 | |||
4037 | esac |
|
4048 | esac | |
4038 | done |
|
4049 | done | |
4039 |
|
4050 | |||
4040 | } |
|
4051 | } | |
4041 |
|
4052 | |||
4042 | # :command.parse_requirements |
|
4053 | # :command.parse_requirements | |
4043 | rcstack_stack_upgrade_router_parse_requirements() { |
|
4054 | rcstack_stack_upgrade_router_parse_requirements() { | |
4044 | # :command.fixed_flags_filter |
|
4055 | # :command.fixed_flags_filter | |
4045 | while [[ $# -gt 0 ]]; do |
|
4056 | while [[ $# -gt 0 ]]; do | |
4046 | case "${1:-}" in |
|
4057 | case "${1:-}" in | |
4047 | --help | -h) |
|
4058 | --help | -h) | |
4048 | long_usage=yes |
|
4059 | long_usage=yes | |
4049 | rcstack_stack_upgrade_router_usage |
|
4060 | rcstack_stack_upgrade_router_usage | |
4050 | exit |
|
4061 | exit | |
4051 | ;; |
|
4062 | ;; | |
4052 |
|
4063 | |||
4053 | *) |
|
4064 | *) | |
4054 | break |
|
4065 | break | |
4055 | ;; |
|
4066 | ;; | |
4056 |
|
4067 | |||
4057 | esac |
|
4068 | esac | |
4058 | done |
|
4069 | done | |
4059 |
|
4070 | |||
4060 | # :command.command_filter |
|
4071 | # :command.command_filter | |
4061 | action="stack-upgrade router" |
|
4072 | action="stack-upgrade router" | |
4062 |
|
4073 | |||
4063 | # :command.parse_requirements_while |
|
4074 | # :command.parse_requirements_while | |
4064 | while [[ $# -gt 0 ]]; do |
|
4075 | while [[ $# -gt 0 ]]; do | |
4065 | key="$1" |
|
4076 | key="$1" | |
4066 | case "$key" in |
|
4077 | case "$key" in | |
4067 |
|
4078 | |||
4068 | -?*) |
|
4079 | -?*) | |
4069 | printf "invalid option: %s\n" "$key" >&2 |
|
4080 | printf "invalid option: %s\n" "$key" >&2 | |
4070 | exit 1 |
|
4081 | exit 1 | |
4071 | ;; |
|
4082 | ;; | |
4072 |
|
4083 | |||
4073 | *) |
|
4084 | *) | |
4074 | # :command.parse_requirements_case |
|
4085 | # :command.parse_requirements_case | |
4075 | # :command.parse_requirements_case_simple |
|
4086 | # :command.parse_requirements_case_simple | |
4076 | printf "invalid argument: %s\n" "$key" >&2 |
|
4087 | printf "invalid argument: %s\n" "$key" >&2 | |
4077 | exit 1 |
|
4088 | exit 1 | |
4078 |
|
4089 | |||
4079 | ;; |
|
4090 | ;; | |
4080 |
|
4091 | |||
4081 | esac |
|
4092 | esac | |
4082 | done |
|
4093 | done | |
4083 |
|
4094 | |||
4084 | } |
|
4095 | } | |
4085 |
|
4096 | |||
4086 | # :command.parse_requirements |
|
4097 | # :command.parse_requirements | |
4087 | rcstack_stack_upgrade_metrics_parse_requirements() { |
|
4098 | rcstack_stack_upgrade_metrics_parse_requirements() { | |
4088 | # :command.fixed_flags_filter |
|
4099 | # :command.fixed_flags_filter | |
4089 | while [[ $# -gt 0 ]]; do |
|
4100 | while [[ $# -gt 0 ]]; do | |
4090 | case "${1:-}" in |
|
4101 | case "${1:-}" in | |
4091 | --help | -h) |
|
4102 | --help | -h) | |
4092 | long_usage=yes |
|
4103 | long_usage=yes | |
4093 | rcstack_stack_upgrade_metrics_usage |
|
4104 | rcstack_stack_upgrade_metrics_usage | |
4094 | exit |
|
4105 | exit | |
4095 | ;; |
|
4106 | ;; | |
4096 |
|
4107 | |||
4097 | *) |
|
4108 | *) | |
4098 | break |
|
4109 | break | |
4099 | ;; |
|
4110 | ;; | |
4100 |
|
4111 | |||
4101 | esac |
|
4112 | esac | |
4102 | done |
|
4113 | done | |
4103 |
|
4114 | |||
4104 | # :command.command_filter |
|
4115 | # :command.command_filter | |
4105 | action="stack-upgrade metrics" |
|
4116 | action="stack-upgrade metrics" | |
4106 |
|
4117 | |||
4107 | # :command.parse_requirements_while |
|
4118 | # :command.parse_requirements_while | |
4108 | while [[ $# -gt 0 ]]; do |
|
4119 | while [[ $# -gt 0 ]]; do | |
4109 | key="$1" |
|
4120 | key="$1" | |
4110 | case "$key" in |
|
4121 | case "$key" in | |
4111 |
|
4122 | |||
4112 | -?*) |
|
4123 | -?*) | |
4113 | printf "invalid option: %s\n" "$key" >&2 |
|
4124 | printf "invalid option: %s\n" "$key" >&2 | |
4114 | exit 1 |
|
4125 | exit 1 | |
4115 | ;; |
|
4126 | ;; | |
4116 |
|
4127 | |||
4117 | *) |
|
4128 | *) | |
4118 | # :command.parse_requirements_case |
|
4129 | # :command.parse_requirements_case | |
4119 | # :command.parse_requirements_case_simple |
|
4130 | # :command.parse_requirements_case_simple | |
4120 | printf "invalid argument: %s\n" "$key" >&2 |
|
4131 | printf "invalid argument: %s\n" "$key" >&2 | |
4121 | exit 1 |
|
4132 | exit 1 | |
4122 |
|
4133 | |||
4123 | ;; |
|
4134 | ;; | |
4124 |
|
4135 | |||
4125 | esac |
|
4136 | esac | |
4126 | done |
|
4137 | done | |
4127 |
|
4138 | |||
4128 | } |
|
4139 | } | |
4129 |
|
4140 | |||
4130 | # :command.parse_requirements |
|
4141 | # :command.parse_requirements | |
4131 | rcstack_stack_upgrade_services_parse_requirements() { |
|
4142 | rcstack_stack_upgrade_services_parse_requirements() { | |
4132 | # :command.fixed_flags_filter |
|
4143 | # :command.fixed_flags_filter | |
4133 | while [[ $# -gt 0 ]]; do |
|
4144 | while [[ $# -gt 0 ]]; do | |
4134 | case "${1:-}" in |
|
4145 | case "${1:-}" in | |
4135 | --help | -h) |
|
4146 | --help | -h) | |
4136 | long_usage=yes |
|
4147 | long_usage=yes | |
4137 | rcstack_stack_upgrade_services_usage |
|
4148 | rcstack_stack_upgrade_services_usage | |
4138 | exit |
|
4149 | exit | |
4139 | ;; |
|
4150 | ;; | |
4140 |
|
4151 | |||
4141 | *) |
|
4152 | *) | |
4142 | break |
|
4153 | break | |
4143 | ;; |
|
4154 | ;; | |
4144 |
|
4155 | |||
4145 | esac |
|
4156 | esac | |
4146 | done |
|
4157 | done | |
4147 |
|
4158 | |||
4148 | # :command.command_filter |
|
4159 | # :command.command_filter | |
4149 | action="stack-upgrade services" |
|
4160 | action="stack-upgrade services" | |
4150 |
|
4161 | |||
4151 | # :command.parse_requirements_while |
|
4162 | # :command.parse_requirements_while | |
4152 | while [[ $# -gt 0 ]]; do |
|
4163 | while [[ $# -gt 0 ]]; do | |
4153 | key="$1" |
|
4164 | key="$1" | |
4154 | case "$key" in |
|
4165 | case "$key" in | |
4155 |
|
4166 | |||
4156 | -?*) |
|
4167 | -?*) | |
4157 | printf "invalid option: %s\n" "$key" >&2 |
|
4168 | printf "invalid option: %s\n" "$key" >&2 | |
4158 | exit 1 |
|
4169 | exit 1 | |
4159 | ;; |
|
4170 | ;; | |
4160 |
|
4171 | |||
4161 | *) |
|
4172 | *) | |
4162 | # :command.parse_requirements_case |
|
4173 | # :command.parse_requirements_case | |
4163 | # :command.parse_requirements_case_simple |
|
4174 | # :command.parse_requirements_case_simple | |
4164 | printf "invalid argument: %s\n" "$key" >&2 |
|
4175 | printf "invalid argument: %s\n" "$key" >&2 | |
4165 | exit 1 |
|
4176 | exit 1 | |
4166 |
|
4177 | |||
4167 | ;; |
|
4178 | ;; | |
4168 |
|
4179 | |||
4169 | esac |
|
4180 | esac | |
4170 | done |
|
4181 | done | |
4171 |
|
4182 | |||
4172 | } |
|
4183 | } | |
4173 |
|
4184 | |||
4174 | # :command.parse_requirements |
|
4185 | # :command.parse_requirements | |
4175 | rcstack_stack_upgrade_rhodecode_parse_requirements() { |
|
4186 | rcstack_stack_upgrade_rhodecode_parse_requirements() { | |
4176 | # :command.fixed_flags_filter |
|
4187 | # :command.fixed_flags_filter | |
4177 | while [[ $# -gt 0 ]]; do |
|
4188 | while [[ $# -gt 0 ]]; do | |
4178 | case "${1:-}" in |
|
4189 | case "${1:-}" in | |
4179 | --help | -h) |
|
4190 | --help | -h) | |
4180 | long_usage=yes |
|
4191 | long_usage=yes | |
4181 | rcstack_stack_upgrade_rhodecode_usage |
|
4192 | rcstack_stack_upgrade_rhodecode_usage | |
4182 | exit |
|
4193 | exit | |
4183 | ;; |
|
4194 | ;; | |
4184 |
|
4195 | |||
4185 | *) |
|
4196 | *) | |
4186 | break |
|
4197 | break | |
4187 | ;; |
|
4198 | ;; | |
4188 |
|
4199 | |||
4189 | esac |
|
4200 | esac | |
4190 | done |
|
4201 | done | |
4191 |
|
4202 | |||
4192 | # :command.command_filter |
|
4203 | # :command.command_filter | |
4193 | action="stack-upgrade rhodecode" |
|
4204 | action="stack-upgrade rhodecode" | |
4194 |
|
4205 | |||
4195 | # :command.parse_requirements_while |
|
4206 | # :command.parse_requirements_while | |
4196 | while [[ $# -gt 0 ]]; do |
|
4207 | while [[ $# -gt 0 ]]; do | |
4197 | key="$1" |
|
4208 | key="$1" | |
4198 | case "$key" in |
|
4209 | case "$key" in | |
4199 | # :flag.case |
|
4210 | # :flag.case | |
4200 | --restart-unhealthy) |
|
4211 | --restart-unhealthy) | |
4201 |
|
4212 | |||
4202 | # :flag.case_no_arg |
|
4213 | # :flag.case_no_arg | |
4203 | args['--restart-unhealthy']=1 |
|
4214 | args['--restart-unhealthy']=1 | |
4204 | shift |
|
4215 | shift | |
4205 | ;; |
|
4216 | ;; | |
4206 |
|
4217 | |||
4207 | # :flag.case |
|
4218 | # :flag.case | |
4208 | --stop-wait) |
|
4219 | --stop-wait) | |
4209 |
|
4220 | |||
4210 | # :flag.case_arg |
|
4221 | # :flag.case_arg | |
4211 | if [[ -n ${2+x} ]]; then |
|
4222 | if [[ -n ${2+x} ]]; then | |
4212 |
|
4223 | |||
4213 | args['--stop-wait']="$2" |
|
4224 | args['--stop-wait']="$2" | |
4214 | shift |
|
4225 | shift | |
4215 | shift |
|
4226 | shift | |
4216 | else |
|
4227 | else | |
4217 | printf "%s\n" "--stop-wait requires an argument: --stop-wait STOP_WAIT" >&2 |
|
4228 | printf "%s\n" "--stop-wait requires an argument: --stop-wait STOP_WAIT" >&2 | |
4218 | exit 1 |
|
4229 | exit 1 | |
4219 | fi |
|
4230 | fi | |
4220 | ;; |
|
4231 | ;; | |
4221 |
|
4232 | |||
4222 | -?*) |
|
4233 | -?*) | |
4223 | printf "invalid option: %s\n" "$key" >&2 |
|
4234 | printf "invalid option: %s\n" "$key" >&2 | |
4224 | exit 1 |
|
4235 | exit 1 | |
4225 | ;; |
|
4236 | ;; | |
4226 |
|
4237 | |||
4227 | *) |
|
4238 | *) | |
4228 | # :command.parse_requirements_case |
|
4239 | # :command.parse_requirements_case | |
4229 | # :command.parse_requirements_case_simple |
|
4240 | # :command.parse_requirements_case_simple | |
4230 | printf "invalid argument: %s\n" "$key" >&2 |
|
4241 | printf "invalid argument: %s\n" "$key" >&2 | |
4231 | exit 1 |
|
4242 | exit 1 | |
4232 |
|
4243 | |||
4233 | ;; |
|
4244 | ;; | |
4234 |
|
4245 | |||
4235 | esac |
|
4246 | esac | |
4236 | done |
|
4247 | done | |
4237 |
|
4248 | |||
4238 | # :command.default_assignments |
|
4249 | # :command.default_assignments | |
4239 | [[ -n ${args['--stop-wait']:-} ]] || args['--stop-wait']="120" |
|
4250 | [[ -n ${args['--stop-wait']:-} ]] || args['--stop-wait']="120" | |
4240 |
|
4251 | |||
4241 | } |
|
4252 | } | |
4242 |
|
4253 | |||
4243 | # :command.parse_requirements |
|
4254 | # :command.parse_requirements | |
4244 | rcstack_cli_parse_requirements() { |
|
4255 | rcstack_cli_parse_requirements() { | |
4245 | # :command.fixed_flags_filter |
|
4256 | # :command.fixed_flags_filter | |
4246 | while [[ $# -gt 0 ]]; do |
|
4257 | while [[ $# -gt 0 ]]; do | |
4247 | case "${1:-}" in |
|
4258 | case "${1:-}" in | |
4248 | --help | -h) |
|
4259 | --help | -h) | |
4249 | long_usage=yes |
|
4260 | long_usage=yes | |
4250 | rcstack_cli_usage |
|
4261 | rcstack_cli_usage | |
4251 | exit |
|
4262 | exit | |
4252 | ;; |
|
4263 | ;; | |
4253 |
|
4264 | |||
4254 | *) |
|
4265 | *) | |
4255 | break |
|
4266 | break | |
4256 | ;; |
|
4267 | ;; | |
4257 |
|
4268 | |||
4258 | esac |
|
4269 | esac | |
4259 | done |
|
4270 | done | |
4260 |
|
4271 | |||
4261 | # :command.command_filter |
|
4272 | # :command.command_filter | |
4262 | action=${1:-} |
|
4273 | action=${1:-} | |
4263 |
|
4274 | |||
4264 | case $action in |
|
4275 | case $action in | |
4265 | -*) ;; |
|
4276 | -*) ;; | |
4266 |
|
4277 | |||
4267 | image-info) |
|
4278 | image-info) | |
4268 | action="image-info" |
|
4279 | action="image-info" | |
4269 | shift |
|
4280 | shift | |
4270 | rcstack_cli_image_info_parse_requirements "$@" |
|
4281 | rcstack_cli_image_info_parse_requirements "$@" | |
4271 | shift $# |
|
4282 | shift $# | |
4272 | ;; |
|
4283 | ;; | |
4273 |
|
4284 | |||
4274 | redis) |
|
4285 | redis) | |
4275 | action="redis" |
|
4286 | action="redis" | |
4276 | shift |
|
4287 | shift | |
4277 | rcstack_cli_redis_parse_requirements "$@" |
|
4288 | rcstack_cli_redis_parse_requirements "$@" | |
4278 | shift $# |
|
4289 | shift $# | |
4279 | ;; |
|
4290 | ;; | |
4280 |
|
4291 | |||
4281 | db) |
|
4292 | db) | |
4282 | action="db" |
|
4293 | action="db" | |
4283 | shift |
|
4294 | shift | |
4284 | rcstack_cli_db_parse_requirements "$@" |
|
4295 | rcstack_cli_db_parse_requirements "$@" | |
4285 | shift $# |
|
4296 | shift $# | |
4286 | ;; |
|
4297 | ;; | |
4287 |
|
4298 | |||
4288 | db-upgrade) |
|
4299 | db-upgrade) | |
4289 | action="db-upgrade" |
|
4300 | action="db-upgrade" | |
4290 | shift |
|
4301 | shift | |
4291 | rcstack_cli_db_upgrade_parse_requirements "$@" |
|
4302 | rcstack_cli_db_upgrade_parse_requirements "$@" | |
4292 | shift $# |
|
4303 | shift $# | |
4293 | ;; |
|
4304 | ;; | |
4294 |
|
4305 | |||
4295 | storage) |
|
4306 | storage) | |
4296 | action="storage" |
|
4307 | action="storage" | |
4297 | shift |
|
4308 | shift | |
4298 | rcstack_cli_storage_parse_requirements "$@" |
|
4309 | rcstack_cli_storage_parse_requirements "$@" | |
4299 | shift $# |
|
4310 | shift $# | |
4300 | ;; |
|
4311 | ;; | |
4301 |
|
4312 | |||
4302 | attach) |
|
4313 | attach) | |
4303 | action="attach" |
|
4314 | action="attach" | |
4304 | shift |
|
4315 | shift | |
4305 | rcstack_cli_attach_parse_requirements "$@" |
|
4316 | rcstack_cli_attach_parse_requirements "$@" | |
4306 | shift $# |
|
4317 | shift $# | |
4307 | ;; |
|
4318 | ;; | |
4308 |
|
4319 | |||
4309 | configure-vcsserver) |
|
4320 | configure-vcsserver) | |
4310 | action="configure-vcsserver" |
|
4321 | action="configure-vcsserver" | |
4311 | shift |
|
4322 | shift | |
4312 | rcstack_cli_configure_vcsserver_parse_requirements "$@" |
|
4323 | rcstack_cli_configure_vcsserver_parse_requirements "$@" | |
4313 | shift $# |
|
4324 | shift $# | |
4314 | ;; |
|
4325 | ;; | |
4315 |
|
4326 | |||
4316 | configure-rhodecode) |
|
4327 | configure-rhodecode) | |
4317 | action="configure-rhodecode" |
|
4328 | action="configure-rhodecode" | |
4318 | shift |
|
4329 | shift | |
4319 | rcstack_cli_configure_rhodecode_parse_requirements "$@" |
|
4330 | rcstack_cli_configure_rhodecode_parse_requirements "$@" | |
4320 | shift $# |
|
4331 | shift $# | |
4321 | ;; |
|
4332 | ;; | |
4322 |
|
4333 | |||
4323 | # :command.command_fallback |
|
4334 | # :command.command_fallback | |
4324 | "") |
|
4335 | "") | |
4325 | rcstack_cli_usage >&2 |
|
4336 | rcstack_cli_usage >&2 | |
4326 | exit 1 |
|
4337 | exit 1 | |
4327 | ;; |
|
4338 | ;; | |
4328 |
|
4339 | |||
4329 | *) |
|
4340 | *) | |
4330 | printf "invalid command: %s\n" "$action" >&2 |
|
4341 | printf "invalid command: %s\n" "$action" >&2 | |
4331 | exit 1 |
|
4342 | exit 1 | |
4332 | ;; |
|
4343 | ;; | |
4333 |
|
4344 | |||
4334 | esac |
|
4345 | esac | |
4335 |
|
4346 | |||
4336 | # :command.parse_requirements_while |
|
4347 | # :command.parse_requirements_while | |
4337 | while [[ $# -gt 0 ]]; do |
|
4348 | while [[ $# -gt 0 ]]; do | |
4338 | key="$1" |
|
4349 | key="$1" | |
4339 | case "$key" in |
|
4350 | case "$key" in | |
4340 |
|
4351 | |||
4341 | -?*) |
|
4352 | -?*) | |
4342 | printf "invalid option: %s\n" "$key" >&2 |
|
4353 | printf "invalid option: %s\n" "$key" >&2 | |
4343 | exit 1 |
|
4354 | exit 1 | |
4344 | ;; |
|
4355 | ;; | |
4345 |
|
4356 | |||
4346 | *) |
|
4357 | *) | |
4347 | # :command.parse_requirements_case |
|
4358 | # :command.parse_requirements_case | |
4348 | # :command.parse_requirements_case_simple |
|
4359 | # :command.parse_requirements_case_simple | |
4349 | printf "invalid argument: %s\n" "$key" >&2 |
|
4360 | printf "invalid argument: %s\n" "$key" >&2 | |
4350 | exit 1 |
|
4361 | exit 1 | |
4351 |
|
4362 | |||
4352 | ;; |
|
4363 | ;; | |
4353 |
|
4364 | |||
4354 | esac |
|
4365 | esac | |
4355 | done |
|
4366 | done | |
4356 |
|
4367 | |||
4357 | } |
|
4368 | } | |
4358 |
|
4369 | |||
4359 | # :command.parse_requirements |
|
4370 | # :command.parse_requirements | |
4360 | rcstack_cli_image_info_parse_requirements() { |
|
4371 | rcstack_cli_image_info_parse_requirements() { | |
4361 | # :command.fixed_flags_filter |
|
4372 | # :command.fixed_flags_filter | |
4362 | while [[ $# -gt 0 ]]; do |
|
4373 | while [[ $# -gt 0 ]]; do | |
4363 | case "${1:-}" in |
|
4374 | case "${1:-}" in | |
4364 | --help | -h) |
|
4375 | --help | -h) | |
4365 | long_usage=yes |
|
4376 | long_usage=yes | |
4366 | rcstack_cli_image_info_usage |
|
4377 | rcstack_cli_image_info_usage | |
4367 | exit |
|
4378 | exit | |
4368 | ;; |
|
4379 | ;; | |
4369 |
|
4380 | |||
4370 | *) |
|
4381 | *) | |
4371 | break |
|
4382 | break | |
4372 | ;; |
|
4383 | ;; | |
4373 |
|
4384 | |||
4374 | esac |
|
4385 | esac | |
4375 | done |
|
4386 | done | |
4376 |
|
4387 | |||
4377 | # :command.command_filter |
|
4388 | # :command.command_filter | |
4378 | action="cli image-info" |
|
4389 | action="cli image-info" | |
4379 |
|
4390 | |||
4380 | # :command.parse_requirements_while |
|
4391 | # :command.parse_requirements_while | |
4381 | while [[ $# -gt 0 ]]; do |
|
4392 | while [[ $# -gt 0 ]]; do | |
4382 | key="$1" |
|
4393 | key="$1" | |
4383 | case "$key" in |
|
4394 | case "$key" in | |
4384 | # :flag.case |
|
4395 | # :flag.case | |
4385 | --set-runtime) |
|
4396 | --set-runtime) | |
4386 |
|
4397 | |||
4387 | # :flag.case_arg |
|
4398 | # :flag.case_arg | |
4388 | if [[ -n ${2+x} ]]; then |
|
4399 | if [[ -n ${2+x} ]]; then | |
4389 |
|
4400 | |||
4390 | args['--set-runtime']="$2" |
|
4401 | args['--set-runtime']="$2" | |
4391 | shift |
|
4402 | shift | |
4392 | shift |
|
4403 | shift | |
4393 | else |
|
4404 | else | |
4394 | printf "%s\n" "--set-runtime requires an argument: --set-runtime SET_RUNTIME" >&2 |
|
4405 | printf "%s\n" "--set-runtime requires an argument: --set-runtime SET_RUNTIME" >&2 | |
4395 | exit 1 |
|
4406 | exit 1 | |
4396 | fi |
|
4407 | fi | |
4397 | ;; |
|
4408 | ;; | |
4398 |
|
4409 | |||
4399 | -?*) |
|
4410 | -?*) | |
4400 | printf "invalid option: %s\n" "$key" >&2 |
|
4411 | printf "invalid option: %s\n" "$key" >&2 | |
4401 | exit 1 |
|
4412 | exit 1 | |
4402 | ;; |
|
4413 | ;; | |
4403 |
|
4414 | |||
4404 | *) |
|
4415 | *) | |
4405 | # :command.parse_requirements_case |
|
4416 | # :command.parse_requirements_case | |
4406 | # :command.parse_requirements_case_simple |
|
4417 | # :command.parse_requirements_case_simple | |
4407 | printf "invalid argument: %s\n" "$key" >&2 |
|
4418 | printf "invalid argument: %s\n" "$key" >&2 | |
4408 | exit 1 |
|
4419 | exit 1 | |
4409 |
|
4420 | |||
4410 | ;; |
|
4421 | ;; | |
4411 |
|
4422 | |||
4412 | esac |
|
4423 | esac | |
4413 | done |
|
4424 | done | |
4414 |
|
4425 | |||
4415 | } |
|
4426 | } | |
4416 |
|
4427 | |||
4417 | # :command.parse_requirements |
|
4428 | # :command.parse_requirements | |
4418 | rcstack_cli_redis_parse_requirements() { |
|
4429 | rcstack_cli_redis_parse_requirements() { | |
4419 | # :command.fixed_flags_filter |
|
4430 | # :command.fixed_flags_filter | |
4420 | while [[ $# -gt 0 ]]; do |
|
4431 | while [[ $# -gt 0 ]]; do | |
4421 | case "${1:-}" in |
|
4432 | case "${1:-}" in | |
4422 | --help | -h) |
|
4433 | --help | -h) | |
4423 | long_usage=yes |
|
4434 | long_usage=yes | |
4424 | rcstack_cli_redis_usage |
|
4435 | rcstack_cli_redis_usage | |
4425 | exit |
|
4436 | exit | |
4426 | ;; |
|
4437 | ;; | |
4427 |
|
4438 | |||
4428 | *) |
|
4439 | *) | |
4429 | break |
|
4440 | break | |
4430 | ;; |
|
4441 | ;; | |
4431 |
|
4442 | |||
4432 | esac |
|
4443 | esac | |
4433 | done |
|
4444 | done | |
4434 |
|
4445 | |||
4435 | # :command.command_filter |
|
4446 | # :command.command_filter | |
4436 | action="cli redis" |
|
4447 | action="cli redis" | |
4437 |
|
4448 | |||
4438 | # :command.parse_requirements_while |
|
4449 | # :command.parse_requirements_while | |
4439 | while [[ $# -gt 0 ]]; do |
|
4450 | while [[ $# -gt 0 ]]; do | |
4440 | key="$1" |
|
4451 | key="$1" | |
4441 | case "$key" in |
|
4452 | case "$key" in | |
4442 |
|
4453 | |||
4443 | -?*) |
|
4454 | -?*) | |
4444 | printf "invalid option: %s\n" "$key" >&2 |
|
4455 | printf "invalid option: %s\n" "$key" >&2 | |
4445 | exit 1 |
|
4456 | exit 1 | |
4446 | ;; |
|
4457 | ;; | |
4447 |
|
4458 | |||
4448 | *) |
|
4459 | *) | |
4449 | # :command.parse_requirements_case |
|
4460 | # :command.parse_requirements_case | |
4450 | # :command.parse_requirements_case_simple |
|
4461 | # :command.parse_requirements_case_simple | |
4451 | printf "invalid argument: %s\n" "$key" >&2 |
|
4462 | printf "invalid argument: %s\n" "$key" >&2 | |
4452 | exit 1 |
|
4463 | exit 1 | |
4453 |
|
4464 | |||
4454 | ;; |
|
4465 | ;; | |
4455 |
|
4466 | |||
4456 | esac |
|
4467 | esac | |
4457 | done |
|
4468 | done | |
4458 |
|
4469 | |||
4459 | } |
|
4470 | } | |
4460 |
|
4471 | |||
4461 | # :command.parse_requirements |
|
4472 | # :command.parse_requirements | |
4462 | rcstack_cli_db_parse_requirements() { |
|
4473 | rcstack_cli_db_parse_requirements() { | |
4463 | # :command.fixed_flags_filter |
|
4474 | # :command.fixed_flags_filter | |
4464 | while [[ $# -gt 0 ]]; do |
|
4475 | while [[ $# -gt 0 ]]; do | |
4465 | case "${1:-}" in |
|
4476 | case "${1:-}" in | |
4466 | --help | -h) |
|
4477 | --help | -h) | |
4467 | long_usage=yes |
|
4478 | long_usage=yes | |
4468 | rcstack_cli_db_usage |
|
4479 | rcstack_cli_db_usage | |
4469 | exit |
|
4480 | exit | |
4470 | ;; |
|
4481 | ;; | |
4471 |
|
4482 | |||
4472 | *) |
|
4483 | *) | |
4473 | break |
|
4484 | break | |
4474 | ;; |
|
4485 | ;; | |
4475 |
|
4486 | |||
4476 | esac |
|
4487 | esac | |
4477 | done |
|
4488 | done | |
4478 |
|
4489 | |||
4479 | # :command.command_filter |
|
4490 | # :command.command_filter | |
4480 | action="cli db" |
|
4491 | action="cli db" | |
4481 |
|
4492 | |||
4482 | # :command.parse_requirements_while |
|
4493 | # :command.parse_requirements_while | |
4483 | while [[ $# -gt 0 ]]; do |
|
4494 | while [[ $# -gt 0 ]]; do | |
4484 | key="$1" |
|
4495 | key="$1" | |
4485 | case "$key" in |
|
4496 | case "$key" in | |
4486 |
|
4497 | |||
4487 | -?*) |
|
4498 | -?*) | |
4488 | printf "invalid option: %s\n" "$key" >&2 |
|
4499 | printf "invalid option: %s\n" "$key" >&2 | |
4489 | exit 1 |
|
4500 | exit 1 | |
4490 | ;; |
|
4501 | ;; | |
4491 |
|
4502 | |||
4492 | *) |
|
4503 | *) | |
4493 | # :command.parse_requirements_case |
|
4504 | # :command.parse_requirements_case | |
4494 | # :command.parse_requirements_case_simple |
|
4505 | # :command.parse_requirements_case_simple | |
4495 | printf "invalid argument: %s\n" "$key" >&2 |
|
4506 | printf "invalid argument: %s\n" "$key" >&2 | |
4496 | exit 1 |
|
4507 | exit 1 | |
4497 |
|
4508 | |||
4498 | ;; |
|
4509 | ;; | |
4499 |
|
4510 | |||
4500 | esac |
|
4511 | esac | |
4501 | done |
|
4512 | done | |
4502 |
|
4513 | |||
4503 | } |
|
4514 | } | |
4504 |
|
4515 | |||
4505 | # :command.parse_requirements |
|
4516 | # :command.parse_requirements | |
4506 | rcstack_cli_db_upgrade_parse_requirements() { |
|
4517 | rcstack_cli_db_upgrade_parse_requirements() { | |
4507 | # :command.fixed_flags_filter |
|
4518 | # :command.fixed_flags_filter | |
4508 | while [[ $# -gt 0 ]]; do |
|
4519 | while [[ $# -gt 0 ]]; do | |
4509 | case "${1:-}" in |
|
4520 | case "${1:-}" in | |
4510 | --help | -h) |
|
4521 | --help | -h) | |
4511 | long_usage=yes |
|
4522 | long_usage=yes | |
4512 | rcstack_cli_db_upgrade_usage |
|
4523 | rcstack_cli_db_upgrade_usage | |
4513 | exit |
|
4524 | exit | |
4514 | ;; |
|
4525 | ;; | |
4515 |
|
4526 | |||
4516 | *) |
|
4527 | *) | |
4517 | break |
|
4528 | break | |
4518 | ;; |
|
4529 | ;; | |
4519 |
|
4530 | |||
4520 | esac |
|
4531 | esac | |
4521 | done |
|
4532 | done | |
4522 |
|
4533 | |||
4523 | # :command.command_filter |
|
4534 | # :command.command_filter | |
4524 | action="cli db-upgrade" |
|
4535 | action="cli db-upgrade" | |
4525 |
|
4536 | |||
4526 | # :command.parse_requirements_while |
|
4537 | # :command.parse_requirements_while | |
4527 | while [[ $# -gt 0 ]]; do |
|
4538 | while [[ $# -gt 0 ]]; do | |
4528 | key="$1" |
|
4539 | key="$1" | |
4529 | case "$key" in |
|
4540 | case "$key" in | |
4530 |
|
4541 | |||
4531 | -?*) |
|
4542 | -?*) | |
4532 | printf "invalid option: %s\n" "$key" >&2 |
|
4543 | printf "invalid option: %s\n" "$key" >&2 | |
4533 | exit 1 |
|
4544 | exit 1 | |
4534 | ;; |
|
4545 | ;; | |
4535 |
|
4546 | |||
4536 | *) |
|
4547 | *) | |
4537 | # :command.parse_requirements_case |
|
4548 | # :command.parse_requirements_case | |
4538 | # :command.parse_requirements_case_simple |
|
4549 | # :command.parse_requirements_case_simple | |
4539 | printf "invalid argument: %s\n" "$key" >&2 |
|
4550 | printf "invalid argument: %s\n" "$key" >&2 | |
4540 | exit 1 |
|
4551 | exit 1 | |
4541 |
|
4552 | |||
4542 | ;; |
|
4553 | ;; | |
4543 |
|
4554 | |||
4544 | esac |
|
4555 | esac | |
4545 | done |
|
4556 | done | |
4546 |
|
4557 | |||
4547 | } |
|
4558 | } | |
4548 |
|
4559 | |||
4549 | # :command.parse_requirements |
|
4560 | # :command.parse_requirements | |
4550 | rcstack_cli_storage_parse_requirements() { |
|
4561 | rcstack_cli_storage_parse_requirements() { | |
4551 | # :command.fixed_flags_filter |
|
4562 | # :command.fixed_flags_filter | |
4552 | while [[ $# -gt 0 ]]; do |
|
4563 | while [[ $# -gt 0 ]]; do | |
4553 | case "${1:-}" in |
|
4564 | case "${1:-}" in | |
4554 | --help | -h) |
|
4565 | --help | -h) | |
4555 | long_usage=yes |
|
4566 | long_usage=yes | |
4556 | rcstack_cli_storage_usage |
|
4567 | rcstack_cli_storage_usage | |
4557 | exit |
|
4568 | exit | |
4558 | ;; |
|
4569 | ;; | |
4559 |
|
4570 | |||
4560 | *) |
|
4571 | *) | |
4561 | break |
|
4572 | break | |
4562 | ;; |
|
4573 | ;; | |
4563 |
|
4574 | |||
4564 | esac |
|
4575 | esac | |
4565 | done |
|
4576 | done | |
4566 |
|
4577 | |||
4567 | # :command.command_filter |
|
4578 | # :command.command_filter | |
4568 | action="cli storage" |
|
4579 | action="cli storage" | |
4569 |
|
4580 | |||
4570 | # :command.parse_requirements_while |
|
4581 | # :command.parse_requirements_while | |
4571 | while [[ $# -gt 0 ]]; do |
|
4582 | while [[ $# -gt 0 ]]; do | |
4572 | key="$1" |
|
4583 | key="$1" | |
4573 | case "$key" in |
|
4584 | case "$key" in | |
4574 |
|
4585 | |||
4575 | -?*) |
|
4586 | -?*) | |
4576 | printf "invalid option: %s\n" "$key" >&2 |
|
4587 | printf "invalid option: %s\n" "$key" >&2 | |
4577 | exit 1 |
|
4588 | exit 1 | |
4578 | ;; |
|
4589 | ;; | |
4579 |
|
4590 | |||
4580 | *) |
|
4591 | *) | |
4581 | # :command.parse_requirements_case |
|
4592 | # :command.parse_requirements_case | |
4582 | # :command.parse_requirements_case_simple |
|
4593 | # :command.parse_requirements_case_simple | |
4583 | printf "invalid argument: %s\n" "$key" >&2 |
|
4594 | printf "invalid argument: %s\n" "$key" >&2 | |
4584 | exit 1 |
|
4595 | exit 1 | |
4585 |
|
4596 | |||
4586 | ;; |
|
4597 | ;; | |
4587 |
|
4598 | |||
4588 | esac |
|
4599 | esac | |
4589 | done |
|
4600 | done | |
4590 |
|
4601 | |||
4591 | } |
|
4602 | } | |
4592 |
|
4603 | |||
4593 | # :command.parse_requirements |
|
4604 | # :command.parse_requirements | |
4594 | rcstack_cli_attach_parse_requirements() { |
|
4605 | rcstack_cli_attach_parse_requirements() { | |
4595 | # :command.fixed_flags_filter |
|
4606 | # :command.fixed_flags_filter | |
4596 | while [[ $# -gt 0 ]]; do |
|
4607 | while [[ $# -gt 0 ]]; do | |
4597 | case "${1:-}" in |
|
4608 | case "${1:-}" in | |
4598 | --help | -h) |
|
4609 | --help | -h) | |
4599 | long_usage=yes |
|
4610 | long_usage=yes | |
4600 | rcstack_cli_attach_usage |
|
4611 | rcstack_cli_attach_usage | |
4601 | exit |
|
4612 | exit | |
4602 | ;; |
|
4613 | ;; | |
4603 |
|
4614 | |||
4604 | *) |
|
4615 | *) | |
4605 | break |
|
4616 | break | |
4606 | ;; |
|
4617 | ;; | |
4607 |
|
4618 | |||
4608 | esac |
|
4619 | esac | |
4609 | done |
|
4620 | done | |
4610 |
|
4621 | |||
4611 | # :command.command_filter |
|
4622 | # :command.command_filter | |
4612 | action="cli attach" |
|
4623 | action="cli attach" | |
4613 |
|
4624 | |||
4614 | # :command.parse_requirements_while |
|
4625 | # :command.parse_requirements_while | |
4615 | while [[ $# -gt 0 ]]; do |
|
4626 | while [[ $# -gt 0 ]]; do | |
4616 | key="$1" |
|
4627 | key="$1" | |
4617 | case "$key" in |
|
4628 | case "$key" in | |
4618 | # :flag.case |
|
4629 | # :flag.case | |
4619 | --instance-type) |
|
4630 | --instance-type) | |
4620 |
|
4631 | |||
4621 | # :flag.case_arg |
|
4632 | # :flag.case_arg | |
4622 | if [[ -n ${2+x} ]]; then |
|
4633 | if [[ -n ${2+x} ]]; then | |
4623 |
|
4634 | |||
4624 | args['--instance-type']="$2" |
|
4635 | args['--instance-type']="$2" | |
4625 | shift |
|
4636 | shift | |
4626 | shift |
|
4637 | shift | |
4627 | else |
|
4638 | else | |
4628 | printf "%s\n" "--instance-type requires an argument: --instance-type INSTANCE_TYPE" >&2 |
|
4639 | printf "%s\n" "--instance-type requires an argument: --instance-type INSTANCE_TYPE" >&2 | |
4629 | exit 1 |
|
4640 | exit 1 | |
4630 | fi |
|
4641 | fi | |
4631 | ;; |
|
4642 | ;; | |
4632 |
|
4643 | |||
4633 | -?*) |
|
4644 | -?*) | |
4634 | printf "invalid option: %s\n" "$key" >&2 |
|
4645 | printf "invalid option: %s\n" "$key" >&2 | |
4635 | exit 1 |
|
4646 | exit 1 | |
4636 | ;; |
|
4647 | ;; | |
4637 |
|
4648 | |||
4638 | *) |
|
4649 | *) | |
4639 | # :command.parse_requirements_case |
|
4650 | # :command.parse_requirements_case | |
4640 | # :command.parse_requirements_case_simple |
|
4651 | # :command.parse_requirements_case_simple | |
4641 | printf "invalid argument: %s\n" "$key" >&2 |
|
4652 | printf "invalid argument: %s\n" "$key" >&2 | |
4642 | exit 1 |
|
4653 | exit 1 | |
4643 |
|
4654 | |||
4644 | ;; |
|
4655 | ;; | |
4645 |
|
4656 | |||
4646 | esac |
|
4657 | esac | |
4647 | done |
|
4658 | done | |
4648 |
|
4659 | |||
4649 | # :command.default_assignments |
|
4660 | # :command.default_assignments | |
4650 | [[ -n ${args['--instance-type']:-} ]] || args['--instance-type']="rhodecode" |
|
4661 | [[ -n ${args['--instance-type']:-} ]] || args['--instance-type']="rhodecode" | |
4651 |
|
4662 | |||
4652 | } |
|
4663 | } | |
4653 |
|
4664 | |||
4654 | # :command.parse_requirements |
|
4665 | # :command.parse_requirements | |
4655 | rcstack_cli_configure_vcsserver_parse_requirements() { |
|
4666 | rcstack_cli_configure_vcsserver_parse_requirements() { | |
4656 | # :command.fixed_flags_filter |
|
4667 | # :command.fixed_flags_filter | |
4657 | while [[ $# -gt 0 ]]; do |
|
4668 | while [[ $# -gt 0 ]]; do | |
4658 | case "${1:-}" in |
|
4669 | case "${1:-}" in | |
4659 | --help | -h) |
|
4670 | --help | -h) | |
4660 | long_usage=yes |
|
4671 | long_usage=yes | |
4661 | rcstack_cli_configure_vcsserver_usage |
|
4672 | rcstack_cli_configure_vcsserver_usage | |
4662 | exit |
|
4673 | exit | |
4663 | ;; |
|
4674 | ;; | |
4664 |
|
4675 | |||
4665 | *) |
|
4676 | *) | |
4666 | break |
|
4677 | break | |
4667 | ;; |
|
4678 | ;; | |
4668 |
|
4679 | |||
4669 | esac |
|
4680 | esac | |
4670 | done |
|
4681 | done | |
4671 |
|
4682 | |||
4672 | # :command.command_filter |
|
4683 | # :command.command_filter | |
4673 | action="cli configure-vcsserver" |
|
4684 | action="cli configure-vcsserver" | |
4674 |
|
4685 | |||
4675 | # :command.parse_requirements_while |
|
4686 | # :command.parse_requirements_while | |
4676 | while [[ $# -gt 0 ]]; do |
|
4687 | while [[ $# -gt 0 ]]; do | |
4677 | key="$1" |
|
4688 | key="$1" | |
4678 | case "$key" in |
|
4689 | case "$key" in | |
4679 |
|
4690 | |||
4680 | -?*) |
|
4691 | -?*) | |
4681 | printf "invalid option: %s\n" "$key" >&2 |
|
4692 | printf "invalid option: %s\n" "$key" >&2 | |
4682 | exit 1 |
|
4693 | exit 1 | |
4683 | ;; |
|
4694 | ;; | |
4684 |
|
4695 | |||
4685 | *) |
|
4696 | *) | |
4686 | # :command.parse_requirements_case |
|
4697 | # :command.parse_requirements_case | |
4687 | # :command.parse_requirements_case_simple |
|
4698 | # :command.parse_requirements_case_simple | |
4688 | if [[ -z ${args['ini_path']+x} ]]; then |
|
4699 | if [[ -z ${args['ini_path']+x} ]]; then | |
4689 | # :argument.validations |
|
4700 | # :argument.validations | |
4690 | if [[ -n $(validate_file_exists "$1") ]]; then |
|
4701 | if [[ -n $(validate_file_exists "$1") ]]; then | |
4691 | printf "validation error in %s:\n%s\n" "INI_PATH" "$(validate_file_exists "$1")" >&2 |
|
4702 | printf "validation error in %s:\n%s\n" "INI_PATH" "$(validate_file_exists "$1")" >&2 | |
4692 | exit 1 |
|
4703 | exit 1 | |
4693 | fi |
|
4704 | fi | |
4694 |
|
4705 | |||
4695 | args['ini_path']=$1 |
|
4706 | args['ini_path']=$1 | |
4696 | shift |
|
4707 | shift | |
4697 | else |
|
4708 | else | |
4698 | printf "invalid argument: %s\n" "$key" >&2 |
|
4709 | printf "invalid argument: %s\n" "$key" >&2 | |
4699 | exit 1 |
|
4710 | exit 1 | |
4700 | fi |
|
4711 | fi | |
4701 |
|
4712 | |||
4702 | ;; |
|
4713 | ;; | |
4703 |
|
4714 | |||
4704 | esac |
|
4715 | esac | |
4705 | done |
|
4716 | done | |
4706 |
|
4717 | |||
4707 | # :command.required_args_filter |
|
4718 | # :command.required_args_filter | |
4708 | if [[ -z ${args['ini_path']+x} ]]; then |
|
4719 | if [[ -z ${args['ini_path']+x} ]]; then | |
4709 | printf "missing required argument: INI_PATH\nusage: rcstack cli configure-vcsserver INI_PATH\n" >&2 |
|
4720 | printf "missing required argument: INI_PATH\nusage: rcstack cli configure-vcsserver INI_PATH\n" >&2 | |
4710 | exit 1 |
|
4721 | exit 1 | |
4711 | fi |
|
4722 | fi | |
4712 |
|
4723 | |||
4713 | } |
|
4724 | } | |
4714 |
|
4725 | |||
4715 | # :command.parse_requirements |
|
4726 | # :command.parse_requirements | |
4716 | rcstack_cli_configure_rhodecode_parse_requirements() { |
|
4727 | rcstack_cli_configure_rhodecode_parse_requirements() { | |
4717 | # :command.fixed_flags_filter |
|
4728 | # :command.fixed_flags_filter | |
4718 | while [[ $# -gt 0 ]]; do |
|
4729 | while [[ $# -gt 0 ]]; do | |
4719 | case "${1:-}" in |
|
4730 | case "${1:-}" in | |
4720 | --help | -h) |
|
4731 | --help | -h) | |
4721 | long_usage=yes |
|
4732 | long_usage=yes | |
4722 | rcstack_cli_configure_rhodecode_usage |
|
4733 | rcstack_cli_configure_rhodecode_usage | |
4723 | exit |
|
4734 | exit | |
4724 | ;; |
|
4735 | ;; | |
4725 |
|
4736 | |||
4726 | *) |
|
4737 | *) | |
4727 | break |
|
4738 | break | |
4728 | ;; |
|
4739 | ;; | |
4729 |
|
4740 | |||
4730 | esac |
|
4741 | esac | |
4731 | done |
|
4742 | done | |
4732 |
|
4743 | |||
4733 | # :command.command_filter |
|
4744 | # :command.command_filter | |
4734 | action="cli configure-rhodecode" |
|
4745 | action="cli configure-rhodecode" | |
4735 |
|
4746 | |||
4736 | # :command.parse_requirements_while |
|
4747 | # :command.parse_requirements_while | |
4737 | while [[ $# -gt 0 ]]; do |
|
4748 | while [[ $# -gt 0 ]]; do | |
4738 | key="$1" |
|
4749 | key="$1" | |
4739 | case "$key" in |
|
4750 | case "$key" in | |
4740 |
|
4751 | |||
4741 | -?*) |
|
4752 | -?*) | |
4742 | printf "invalid option: %s\n" "$key" >&2 |
|
4753 | printf "invalid option: %s\n" "$key" >&2 | |
4743 | exit 1 |
|
4754 | exit 1 | |
4744 | ;; |
|
4755 | ;; | |
4745 |
|
4756 | |||
4746 | *) |
|
4757 | *) | |
4747 | # :command.parse_requirements_case |
|
4758 | # :command.parse_requirements_case | |
4748 | # :command.parse_requirements_case_simple |
|
4759 | # :command.parse_requirements_case_simple | |
4749 | if [[ -z ${args['ini_path']+x} ]]; then |
|
4760 | if [[ -z ${args['ini_path']+x} ]]; then | |
4750 | # :argument.validations |
|
4761 | # :argument.validations | |
4751 | if [[ -n $(validate_file_exists "$1") ]]; then |
|
4762 | if [[ -n $(validate_file_exists "$1") ]]; then | |
4752 | printf "validation error in %s:\n%s\n" "INI_PATH" "$(validate_file_exists "$1")" >&2 |
|
4763 | printf "validation error in %s:\n%s\n" "INI_PATH" "$(validate_file_exists "$1")" >&2 | |
4753 | exit 1 |
|
4764 | exit 1 | |
4754 | fi |
|
4765 | fi | |
4755 |
|
4766 | |||
4756 | args['ini_path']=$1 |
|
4767 | args['ini_path']=$1 | |
4757 | shift |
|
4768 | shift | |
4758 | else |
|
4769 | else | |
4759 | printf "invalid argument: %s\n" "$key" >&2 |
|
4770 | printf "invalid argument: %s\n" "$key" >&2 | |
4760 | exit 1 |
|
4771 | exit 1 | |
4761 | fi |
|
4772 | fi | |
4762 |
|
4773 | |||
4763 | ;; |
|
4774 | ;; | |
4764 |
|
4775 | |||
4765 | esac |
|
4776 | esac | |
4766 | done |
|
4777 | done | |
4767 |
|
4778 | |||
4768 | # :command.required_args_filter |
|
4779 | # :command.required_args_filter | |
4769 | if [[ -z ${args['ini_path']+x} ]]; then |
|
4780 | if [[ -z ${args['ini_path']+x} ]]; then | |
4770 | printf "missing required argument: INI_PATH\nusage: rcstack cli configure-rhodecode INI_PATH\n" >&2 |
|
4781 | printf "missing required argument: INI_PATH\nusage: rcstack cli configure-rhodecode INI_PATH\n" >&2 | |
4771 | exit 1 |
|
4782 | exit 1 | |
4772 | fi |
|
4783 | fi | |
4773 |
|
4784 | |||
4774 | } |
|
4785 | } | |
4775 |
|
4786 | |||
4776 | # :command.parse_requirements |
|
4787 | # :command.parse_requirements | |
4777 | rcstack_backup_db_parse_requirements() { |
|
4788 | rcstack_backup_db_parse_requirements() { | |
4778 | # :command.fixed_flags_filter |
|
4789 | # :command.fixed_flags_filter | |
4779 | while [[ $# -gt 0 ]]; do |
|
4790 | while [[ $# -gt 0 ]]; do | |
4780 | case "${1:-}" in |
|
4791 | case "${1:-}" in | |
4781 | --help | -h) |
|
4792 | --help | -h) | |
4782 | long_usage=yes |
|
4793 | long_usage=yes | |
4783 | rcstack_backup_db_usage |
|
4794 | rcstack_backup_db_usage | |
4784 | exit |
|
4795 | exit | |
4785 | ;; |
|
4796 | ;; | |
4786 |
|
4797 | |||
4787 | *) |
|
4798 | *) | |
4788 | break |
|
4799 | break | |
4789 | ;; |
|
4800 | ;; | |
4790 |
|
4801 | |||
4791 | esac |
|
4802 | esac | |
4792 | done |
|
4803 | done | |
4793 |
|
4804 | |||
4794 | # :command.dependencies_filter |
|
4805 | # :command.dependencies_filter | |
4795 | if ! command -v tar >/dev/null 2>&1; then |
|
4806 | if ! command -v tar >/dev/null 2>&1; then | |
4796 | printf "missing dependency: tar\n" >&2 |
|
4807 | printf "missing dependency: tar\n" >&2 | |
4797 | exit 1 |
|
4808 | exit 1 | |
4798 | fi |
|
4809 | fi | |
4799 |
|
4810 | |||
4800 | if ! command -v gzip >/dev/null 2>&1; then |
|
4811 | if ! command -v gzip >/dev/null 2>&1; then | |
4801 | printf "missing dependency: gzip\n" >&2 |
|
4812 | printf "missing dependency: gzip\n" >&2 | |
4802 | exit 1 |
|
4813 | exit 1 | |
4803 | fi |
|
4814 | fi | |
4804 |
|
4815 | |||
4805 | # :command.command_filter |
|
4816 | # :command.command_filter | |
4806 | action="backup-db" |
|
4817 | action="backup-db" | |
4807 |
|
4818 | |||
4808 | # :command.parse_requirements_while |
|
4819 | # :command.parse_requirements_while | |
4809 | while [[ $# -gt 0 ]]; do |
|
4820 | while [[ $# -gt 0 ]]; do | |
4810 | key="$1" |
|
4821 | key="$1" | |
4811 | case "$key" in |
|
4822 | case "$key" in | |
4812 |
|
4823 | |||
4813 | -?*) |
|
4824 | -?*) | |
4814 | printf "invalid option: %s\n" "$key" >&2 |
|
4825 | printf "invalid option: %s\n" "$key" >&2 | |
4815 | exit 1 |
|
4826 | exit 1 | |
4816 | ;; |
|
4827 | ;; | |
4817 |
|
4828 | |||
4818 | *) |
|
4829 | *) | |
4819 | # :command.parse_requirements_case |
|
4830 | # :command.parse_requirements_case | |
4820 | # :command.parse_requirements_case_simple |
|
4831 | # :command.parse_requirements_case_simple | |
4821 | printf "invalid argument: %s\n" "$key" >&2 |
|
4832 | printf "invalid argument: %s\n" "$key" >&2 | |
4822 | exit 1 |
|
4833 | exit 1 | |
4823 |
|
4834 | |||
4824 | ;; |
|
4835 | ;; | |
4825 |
|
4836 | |||
4826 | esac |
|
4837 | esac | |
4827 | done |
|
4838 | done | |
4828 |
|
4839 | |||
4829 | } |
|
4840 | } | |
4830 |
|
4841 | |||
4831 | # :command.parse_requirements |
|
4842 | # :command.parse_requirements | |
4832 | rcstack_backup_data_parse_requirements() { |
|
4843 | rcstack_backup_data_parse_requirements() { | |
4833 | # :command.fixed_flags_filter |
|
4844 | # :command.fixed_flags_filter | |
4834 | while [[ $# -gt 0 ]]; do |
|
4845 | while [[ $# -gt 0 ]]; do | |
4835 | case "${1:-}" in |
|
4846 | case "${1:-}" in | |
4836 | --help | -h) |
|
4847 | --help | -h) | |
4837 | long_usage=yes |
|
4848 | long_usage=yes | |
4838 | rcstack_backup_data_usage |
|
4849 | rcstack_backup_data_usage | |
4839 | exit |
|
4850 | exit | |
4840 | ;; |
|
4851 | ;; | |
4841 |
|
4852 | |||
4842 | *) |
|
4853 | *) | |
4843 | break |
|
4854 | break | |
4844 | ;; |
|
4855 | ;; | |
4845 |
|
4856 | |||
4846 | esac |
|
4857 | esac | |
4847 | done |
|
4858 | done | |
4848 |
|
4859 | |||
4849 | # :command.dependencies_filter |
|
4860 | # :command.dependencies_filter | |
4850 | if ! command -v tar >/dev/null 2>&1; then |
|
4861 | if ! command -v tar >/dev/null 2>&1; then | |
4851 | printf "missing dependency: tar\n" >&2 |
|
4862 | printf "missing dependency: tar\n" >&2 | |
4852 | exit 1 |
|
4863 | exit 1 | |
4853 | fi |
|
4864 | fi | |
4854 |
|
4865 | |||
4855 | if ! command -v gzip >/dev/null 2>&1; then |
|
4866 | if ! command -v gzip >/dev/null 2>&1; then | |
4856 | printf "missing dependency: gzip\n" >&2 |
|
4867 | printf "missing dependency: gzip\n" >&2 | |
4857 | exit 1 |
|
4868 | exit 1 | |
4858 | fi |
|
4869 | fi | |
4859 |
|
4870 | |||
4860 | # :command.command_filter |
|
4871 | # :command.command_filter | |
4861 | action="backup-data" |
|
4872 | action="backup-data" | |
4862 |
|
4873 | |||
4863 | # :command.parse_requirements_while |
|
4874 | # :command.parse_requirements_while | |
4864 | while [[ $# -gt 0 ]]; do |
|
4875 | while [[ $# -gt 0 ]]; do | |
4865 | key="$1" |
|
4876 | key="$1" | |
4866 | case "$key" in |
|
4877 | case "$key" in | |
4867 |
|
4878 | |||
4868 | -?*) |
|
4879 | -?*) | |
4869 | printf "invalid option: %s\n" "$key" >&2 |
|
4880 | printf "invalid option: %s\n" "$key" >&2 | |
4870 | exit 1 |
|
4881 | exit 1 | |
4871 | ;; |
|
4882 | ;; | |
4872 |
|
4883 | |||
4873 | *) |
|
4884 | *) | |
4874 | # :command.parse_requirements_case |
|
4885 | # :command.parse_requirements_case | |
4875 | # :command.parse_requirements_case_simple |
|
4886 | # :command.parse_requirements_case_simple | |
4876 | printf "invalid argument: %s\n" "$key" >&2 |
|
4887 | printf "invalid argument: %s\n" "$key" >&2 | |
4877 | exit 1 |
|
4888 | exit 1 | |
4878 |
|
4889 | |||
4879 | ;; |
|
4890 | ;; | |
4880 |
|
4891 | |||
4881 | esac |
|
4892 | esac | |
4882 | done |
|
4893 | done | |
4883 |
|
4894 | |||
4884 | } |
|
4895 | } | |
4885 |
|
4896 | |||
4886 | # :command.parse_requirements |
|
4897 | # :command.parse_requirements | |
4887 | rcstack_get_build_artifacts_parse_requirements() { |
|
4898 | rcstack_get_build_artifacts_parse_requirements() { | |
4888 | # :command.fixed_flags_filter |
|
4899 | # :command.fixed_flags_filter | |
4889 | while [[ $# -gt 0 ]]; do |
|
4900 | while [[ $# -gt 0 ]]; do | |
4890 | case "${1:-}" in |
|
4901 | case "${1:-}" in | |
4891 | --help | -h) |
|
4902 | --help | -h) | |
4892 | long_usage=yes |
|
4903 | long_usage=yes | |
4893 | rcstack_get_build_artifacts_usage |
|
4904 | rcstack_get_build_artifacts_usage | |
4894 | exit |
|
4905 | exit | |
4895 | ;; |
|
4906 | ;; | |
4896 |
|
4907 | |||
4897 | *) |
|
4908 | *) | |
4898 | break |
|
4909 | break | |
4899 | ;; |
|
4910 | ;; | |
4900 |
|
4911 | |||
4901 | esac |
|
4912 | esac | |
4902 | done |
|
4913 | done | |
4903 |
|
4914 | |||
4904 | # :command.command_filter |
|
4915 | # :command.command_filter | |
4905 | action="get-build-artifacts" |
|
4916 | action="get-build-artifacts" | |
4906 |
|
4917 | |||
4907 | # :command.parse_requirements_while |
|
4918 | # :command.parse_requirements_while | |
4908 | while [[ $# -gt 0 ]]; do |
|
4919 | while [[ $# -gt 0 ]]; do | |
4909 | key="$1" |
|
4920 | key="$1" | |
4910 | case "$key" in |
|
4921 | case "$key" in | |
4911 | # :flag.case |
|
4922 | # :flag.case | |
4912 | --auth) |
|
4923 | --auth) | |
4913 |
|
4924 | |||
4914 | # :flag.case_arg |
|
4925 | # :flag.case_arg | |
4915 | if [[ -n ${2+x} ]]; then |
|
4926 | if [[ -n ${2+x} ]]; then | |
4916 |
|
4927 | |||
4917 | args['--auth']="$2" |
|
4928 | args['--auth']="$2" | |
4918 | shift |
|
4929 | shift | |
4919 | shift |
|
4930 | shift | |
4920 | else |
|
4931 | else | |
4921 | printf "%s\n" "--auth requires an argument: --auth AUTH" >&2 |
|
4932 | printf "%s\n" "--auth requires an argument: --auth AUTH" >&2 | |
4922 | exit 1 |
|
4933 | exit 1 | |
4923 | fi |
|
4934 | fi | |
4924 | ;; |
|
4935 | ;; | |
4925 |
|
4936 | |||
4926 | # :flag.case |
|
4937 | # :flag.case | |
4927 | --installer-url) |
|
4938 | --installer-url) | |
4928 |
|
4939 | |||
4929 | # :flag.case_arg |
|
4940 | # :flag.case_arg | |
4930 | if [[ -n ${2+x} ]]; then |
|
4941 | if [[ -n ${2+x} ]]; then | |
4931 |
|
4942 | |||
4932 | args['--installer-url']="$2" |
|
4943 | args['--installer-url']="$2" | |
4933 | shift |
|
4944 | shift | |
4934 | shift |
|
4945 | shift | |
4935 | else |
|
4946 | else | |
4936 | printf "%s\n" "--installer-url requires an argument: --installer-url INSTALLER_URL" >&2 |
|
4947 | printf "%s\n" "--installer-url requires an argument: --installer-url INSTALLER_URL" >&2 | |
4937 | exit 1 |
|
4948 | exit 1 | |
4938 | fi |
|
4949 | fi | |
4939 | ;; |
|
4950 | ;; | |
4940 |
|
4951 | |||
4941 | # :flag.case |
|
4952 | # :flag.case | |
4942 | --manifest-url) |
|
4953 | --manifest-url) | |
4943 |
|
4954 | |||
4944 | # :flag.case_arg |
|
4955 | # :flag.case_arg | |
4945 | if [[ -n ${2+x} ]]; then |
|
4956 | if [[ -n ${2+x} ]]; then | |
4946 |
|
4957 | |||
4947 | args['--manifest-url']="$2" |
|
4958 | args['--manifest-url']="$2" | |
4948 | shift |
|
4959 | shift | |
4949 | shift |
|
4960 | shift | |
4950 | else |
|
4961 | else | |
4951 | printf "%s\n" "--manifest-url requires an argument: --manifest-url MANIFEST_URL" >&2 |
|
4962 | printf "%s\n" "--manifest-url requires an argument: --manifest-url MANIFEST_URL" >&2 | |
4952 | exit 1 |
|
4963 | exit 1 | |
4953 | fi |
|
4964 | fi | |
4954 | ;; |
|
4965 | ;; | |
4955 |
|
4966 | |||
4956 | # :flag.case |
|
4967 | # :flag.case | |
4957 | --version-name) |
|
4968 | --version-name) | |
4958 |
|
4969 | |||
4959 | # :flag.case_arg |
|
4970 | # :flag.case_arg | |
4960 | if [[ -n ${2+x} ]]; then |
|
4971 | if [[ -n ${2+x} ]]; then | |
4961 |
|
4972 | |||
4962 | args['--version-name']="$2" |
|
4973 | args['--version-name']="$2" | |
4963 | shift |
|
4974 | shift | |
4964 | shift |
|
4975 | shift | |
4965 | else |
|
4976 | else | |
4966 | printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2 |
|
4977 | printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2 | |
4967 | exit 1 |
|
4978 | exit 1 | |
4968 | fi |
|
4979 | fi | |
4969 | ;; |
|
4980 | ;; | |
4970 |
|
4981 | |||
4971 | -?*) |
|
4982 | -?*) | |
4972 | printf "invalid option: %s\n" "$key" >&2 |
|
4983 | printf "invalid option: %s\n" "$key" >&2 | |
4973 | exit 1 |
|
4984 | exit 1 | |
4974 | ;; |
|
4985 | ;; | |
4975 |
|
4986 | |||
4976 | *) |
|
4987 | *) | |
4977 | # :command.parse_requirements_case |
|
4988 | # :command.parse_requirements_case | |
4978 | # :command.parse_requirements_case_simple |
|
4989 | # :command.parse_requirements_case_simple | |
4979 | printf "invalid argument: %s\n" "$key" >&2 |
|
4990 | printf "invalid argument: %s\n" "$key" >&2 | |
4980 | exit 1 |
|
4991 | exit 1 | |
4981 |
|
4992 | |||
4982 | ;; |
|
4993 | ;; | |
4983 |
|
4994 | |||
4984 | esac |
|
4995 | esac | |
4985 | done |
|
4996 | done | |
4986 |
|
4997 | |||
4987 | # :command.default_assignments |
|
4998 | # :command.default_assignments | |
4988 | [[ -n ${args['--auth']:-} ]] || args['--auth']="" |
|
4999 | [[ -n ${args['--auth']:-} ]] || args['--auth']="" | |
4989 | [[ -n ${args['--installer-url']:-} ]] || args['--installer-url']="https://dls.rhodecode.com/dls/N2E2ZTY1NzA3NjYxNDA2NTc1NjI3MTcyNzA2MjcxNzIyZTcwNjI3YQ==/rhodecode-control/latest-linux-ee" |
|
5000 | [[ -n ${args['--installer-url']:-} ]] || args['--installer-url']="https://dls.rhodecode.com/dls/N2E2ZTY1NzA3NjYxNDA2NTc1NjI3MTcyNzA2MjcxNzIyZTcwNjI3YQ==/rhodecode-control/latest-linux-ee" | |
4990 | [[ -n ${args['--manifest-url']:-} ]] || args['--manifest-url']="https://dls.rhodecode.com/linux/MANIFEST" |
|
5001 | [[ -n ${args['--manifest-url']:-} ]] || args['--manifest-url']="https://dls.rhodecode.com/linux/MANIFEST" | |
4991 | [[ -n ${args['--version-name']:-} ]] || args['--version-name']="$RC_CLI_VERSION_NAME" |
|
5002 | [[ -n ${args['--version-name']:-} ]] || args['--version-name']="$RC_CLI_VERSION_NAME" | |
4992 |
|
5003 | |||
4993 | } |
|
5004 | } | |
4994 |
|
5005 | |||
4995 | # :command.parse_requirements |
|
5006 | # :command.parse_requirements | |
4996 | rcstack_build_installer_parse_requirements() { |
|
5007 | rcstack_build_installer_parse_requirements() { | |
4997 | # :command.fixed_flags_filter |
|
5008 | # :command.fixed_flags_filter | |
4998 | while [[ $# -gt 0 ]]; do |
|
5009 | while [[ $# -gt 0 ]]; do | |
4999 | case "${1:-}" in |
|
5010 | case "${1:-}" in | |
5000 | --help | -h) |
|
5011 | --help | -h) | |
5001 | long_usage=yes |
|
5012 | long_usage=yes | |
5002 | rcstack_build_installer_usage |
|
5013 | rcstack_build_installer_usage | |
5003 | exit |
|
5014 | exit | |
5004 | ;; |
|
5015 | ;; | |
5005 |
|
5016 | |||
5006 | *) |
|
5017 | *) | |
5007 | break |
|
5018 | break | |
5008 | ;; |
|
5019 | ;; | |
5009 |
|
5020 | |||
5010 | esac |
|
5021 | esac | |
5011 | done |
|
5022 | done | |
5012 |
|
5023 | |||
5013 | # :command.command_filter |
|
5024 | # :command.command_filter | |
5014 | action="build-installer" |
|
5025 | action="build-installer" | |
5015 |
|
5026 | |||
5016 | # :command.parse_requirements_while |
|
5027 | # :command.parse_requirements_while | |
5017 | while [[ $# -gt 0 ]]; do |
|
5028 | while [[ $# -gt 0 ]]; do | |
5018 | key="$1" |
|
5029 | key="$1" | |
5019 | case "$key" in |
|
5030 | case "$key" in | |
5020 | # :flag.case |
|
5031 | # :flag.case | |
5021 | --version-name) |
|
5032 | --version-name) | |
5022 |
|
5033 | |||
5023 | # :flag.case_arg |
|
5034 | # :flag.case_arg | |
5024 | if [[ -n ${2+x} ]]; then |
|
5035 | if [[ -n ${2+x} ]]; then | |
5025 |
|
5036 | |||
5026 | args['--version-name']="$2" |
|
5037 | args['--version-name']="$2" | |
5027 | shift |
|
5038 | shift | |
5028 | shift |
|
5039 | shift | |
5029 | else |
|
5040 | else | |
5030 | printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2 |
|
5041 | printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2 | |
5031 | exit 1 |
|
5042 | exit 1 | |
5032 | fi |
|
5043 | fi | |
5033 | ;; |
|
5044 | ;; | |
5034 |
|
5045 | |||
5035 | -?*) |
|
5046 | -?*) | |
5036 | printf "invalid option: %s\n" "$key" >&2 |
|
5047 | printf "invalid option: %s\n" "$key" >&2 | |
5037 | exit 1 |
|
5048 | exit 1 | |
5038 | ;; |
|
5049 | ;; | |
5039 |
|
5050 | |||
5040 | *) |
|
5051 | *) | |
5041 | # :command.parse_requirements_case |
|
5052 | # :command.parse_requirements_case | |
5042 | # :command.parse_requirements_case_simple |
|
5053 | # :command.parse_requirements_case_simple | |
5043 | printf "invalid argument: %s\n" "$key" >&2 |
|
5054 | printf "invalid argument: %s\n" "$key" >&2 | |
5044 | exit 1 |
|
5055 | exit 1 | |
5045 |
|
5056 | |||
5046 | ;; |
|
5057 | ;; | |
5047 |
|
5058 | |||
5048 | esac |
|
5059 | esac | |
5049 | done |
|
5060 | done | |
5050 |
|
5061 | |||
5051 | # :command.default_assignments |
|
5062 | # :command.default_assignments | |
5052 | [[ -n ${args['--version-name']:-} ]] || args['--version-name']="$RC_CLI_VERSION_NAME" |
|
5063 | [[ -n ${args['--version-name']:-} ]] || args['--version-name']="$RC_CLI_VERSION_NAME" | |
5053 |
|
5064 | |||
5054 | } |
|
5065 | } | |
5055 |
|
5066 | |||
5056 | # :command.parse_requirements |
|
5067 | # :command.parse_requirements | |
5057 | rcstack_get_build_source_parse_requirements() { |
|
5068 | rcstack_get_build_source_parse_requirements() { | |
5058 | # :command.fixed_flags_filter |
|
5069 | # :command.fixed_flags_filter | |
5059 | while [[ $# -gt 0 ]]; do |
|
5070 | while [[ $# -gt 0 ]]; do | |
5060 | case "${1:-}" in |
|
5071 | case "${1:-}" in | |
5061 | --help | -h) |
|
5072 | --help | -h) | |
5062 | long_usage=yes |
|
5073 | long_usage=yes | |
5063 | rcstack_get_build_source_usage |
|
5074 | rcstack_get_build_source_usage | |
5064 | exit |
|
5075 | exit | |
5065 | ;; |
|
5076 | ;; | |
5066 |
|
5077 | |||
5067 | *) |
|
5078 | *) | |
5068 | break |
|
5079 | break | |
5069 | ;; |
|
5080 | ;; | |
5070 |
|
5081 | |||
5071 | esac |
|
5082 | esac | |
5072 | done |
|
5083 | done | |
5073 |
|
5084 | |||
5074 | # :command.dependencies_filter |
|
5085 | # :command.dependencies_filter | |
5075 | if ! command -v curl >/dev/null 2>&1; then |
|
5086 | if ! command -v curl >/dev/null 2>&1; then | |
5076 | printf "missing dependency: curl\n" >&2 |
|
5087 | printf "missing dependency: curl\n" >&2 | |
5077 | exit 1 |
|
5088 | exit 1 | |
5078 | fi |
|
5089 | fi | |
5079 |
|
5090 | |||
5080 | if ! command -v tar >/dev/null 2>&1; then |
|
5091 | if ! command -v tar >/dev/null 2>&1; then | |
5081 | printf "missing dependency: tar\n" >&2 |
|
5092 | printf "missing dependency: tar\n" >&2 | |
5082 | exit 1 |
|
5093 | exit 1 | |
5083 | fi |
|
5094 | fi | |
5084 |
|
5095 | |||
5085 | # :command.command_filter |
|
5096 | # :command.command_filter | |
5086 | action="get-build-source" |
|
5097 | action="get-build-source" | |
5087 |
|
5098 | |||
5088 | # :command.parse_requirements_while |
|
5099 | # :command.parse_requirements_while | |
5089 | while [[ $# -gt 0 ]]; do |
|
5100 | while [[ $# -gt 0 ]]; do | |
5090 | key="$1" |
|
5101 | key="$1" | |
5091 | case "$key" in |
|
5102 | case "$key" in | |
5092 | # :flag.case |
|
5103 | # :flag.case | |
5093 | --revision) |
|
5104 | --revision) | |
5094 |
|
5105 | |||
5095 | # :flag.case_arg |
|
5106 | # :flag.case_arg | |
5096 | if [[ -n ${2+x} ]]; then |
|
5107 | if [[ -n ${2+x} ]]; then | |
5097 |
|
5108 | |||
5098 | args['--revision']="$2" |
|
5109 | args['--revision']="$2" | |
5099 | shift |
|
5110 | shift | |
5100 | shift |
|
5111 | shift | |
5101 | else |
|
5112 | else | |
5102 | printf "%s\n" "--revision requires an argument: --revision REVISION" >&2 |
|
5113 | printf "%s\n" "--revision requires an argument: --revision REVISION" >&2 | |
5103 | exit 1 |
|
5114 | exit 1 | |
5104 | fi |
|
5115 | fi | |
5105 | ;; |
|
5116 | ;; | |
5106 |
|
5117 | |||
5107 | # :flag.case |
|
5118 | # :flag.case | |
5108 | --auth-token) |
|
5119 | --auth-token) | |
5109 |
|
5120 | |||
5110 | # :flag.case_arg |
|
5121 | # :flag.case_arg | |
5111 | if [[ -n ${2+x} ]]; then |
|
5122 | if [[ -n ${2+x} ]]; then | |
5112 |
|
5123 | |||
5113 | args['--auth-token']="$2" |
|
5124 | args['--auth-token']="$2" | |
5114 | shift |
|
5125 | shift | |
5115 | shift |
|
5126 | shift | |
5116 | else |
|
5127 | else | |
5117 | printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2 |
|
5128 | printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2 | |
5118 | exit 1 |
|
5129 | exit 1 | |
5119 | fi |
|
5130 | fi | |
5120 | ;; |
|
5131 | ;; | |
5121 |
|
5132 | |||
5122 | # :flag.case |
|
5133 | # :flag.case | |
5123 | --server-url) |
|
5134 | --server-url) | |
5124 |
|
5135 | |||
5125 | # :flag.case_arg |
|
5136 | # :flag.case_arg | |
5126 | if [[ -n ${2+x} ]]; then |
|
5137 | if [[ -n ${2+x} ]]; then | |
5127 |
|
5138 | |||
5128 | args['--server-url']="$2" |
|
5139 | args['--server-url']="$2" | |
5129 | shift |
|
5140 | shift | |
5130 | shift |
|
5141 | shift | |
5131 | else |
|
5142 | else | |
5132 | printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2 |
|
5143 | printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2 | |
5133 | exit 1 |
|
5144 | exit 1 | |
5134 | fi |
|
5145 | fi | |
5135 | ;; |
|
5146 | ;; | |
5136 |
|
5147 | |||
5137 | -?*) |
|
5148 | -?*) | |
5138 | printf "invalid option: %s\n" "$key" >&2 |
|
5149 | printf "invalid option: %s\n" "$key" >&2 | |
5139 | exit 1 |
|
5150 | exit 1 | |
5140 | ;; |
|
5151 | ;; | |
5141 |
|
5152 | |||
5142 | *) |
|
5153 | *) | |
5143 | # :command.parse_requirements_case |
|
5154 | # :command.parse_requirements_case | |
5144 | # :command.parse_requirements_case_simple |
|
5155 | # :command.parse_requirements_case_simple | |
5145 | printf "invalid argument: %s\n" "$key" >&2 |
|
5156 | printf "invalid argument: %s\n" "$key" >&2 | |
5146 | exit 1 |
|
5157 | exit 1 | |
5147 |
|
5158 | |||
5148 | ;; |
|
5159 | ;; | |
5149 |
|
5160 | |||
5150 | esac |
|
5161 | esac | |
5151 | done |
|
5162 | done | |
5152 |
|
5163 | |||
5153 | # :command.default_assignments |
|
5164 | # :command.default_assignments | |
5154 | [[ -n ${args['--revision']:-} ]] || args['--revision']="default" |
|
5165 | [[ -n ${args['--revision']:-} ]] || args['--revision']="default" | |
5155 | [[ -n ${args['--server-url']:-} ]] || args['--server-url']="https://code.rhodecode.com" |
|
5166 | [[ -n ${args['--server-url']:-} ]] || args['--server-url']="https://code.rhodecode.com" | |
5156 |
|
5167 | |||
5157 | } |
|
5168 | } | |
5158 |
|
5169 | |||
5159 | # :command.parse_requirements |
|
5170 | # :command.parse_requirements | |
5160 | rcstack_build_source_parse_requirements() { |
|
5171 | rcstack_build_source_parse_requirements() { | |
5161 | # :command.fixed_flags_filter |
|
5172 | # :command.fixed_flags_filter | |
5162 | while [[ $# -gt 0 ]]; do |
|
5173 | while [[ $# -gt 0 ]]; do | |
5163 | case "${1:-}" in |
|
5174 | case "${1:-}" in | |
5164 | --help | -h) |
|
5175 | --help | -h) | |
5165 | long_usage=yes |
|
5176 | long_usage=yes | |
5166 | rcstack_build_source_usage |
|
5177 | rcstack_build_source_usage | |
5167 | exit |
|
5178 | exit | |
5168 | ;; |
|
5179 | ;; | |
5169 |
|
5180 | |||
5170 | *) |
|
5181 | *) | |
5171 | break |
|
5182 | break | |
5172 | ;; |
|
5183 | ;; | |
5173 |
|
5184 | |||
5174 | esac |
|
5185 | esac | |
5175 | done |
|
5186 | done | |
5176 |
|
5187 | |||
5177 | # :command.command_filter |
|
5188 | # :command.command_filter | |
5178 | action="build-source" |
|
5189 | action="build-source" | |
5179 |
|
5190 | |||
5180 | # :command.parse_requirements_while |
|
5191 | # :command.parse_requirements_while | |
5181 | while [[ $# -gt 0 ]]; do |
|
5192 | while [[ $# -gt 0 ]]; do | |
5182 | key="$1" |
|
5193 | key="$1" | |
5183 | case "$key" in |
|
5194 | case "$key" in | |
5184 | # :flag.case |
|
5195 | # :flag.case | |
5185 | --version-name) |
|
5196 | --version-name) | |
5186 |
|
5197 | |||
5187 | # :flag.case_arg |
|
5198 | # :flag.case_arg | |
5188 | if [[ -n ${2+x} ]]; then |
|
5199 | if [[ -n ${2+x} ]]; then | |
5189 |
|
5200 | |||
5190 | args['--version-name']="$2" |
|
5201 | args['--version-name']="$2" | |
5191 | shift |
|
5202 | shift | |
5192 | shift |
|
5203 | shift | |
5193 | else |
|
5204 | else | |
5194 | printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2 |
|
5205 | printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2 | |
5195 | exit 1 |
|
5206 | exit 1 | |
5196 | fi |
|
5207 | fi | |
5197 | ;; |
|
5208 | ;; | |
5198 |
|
5209 | |||
5199 | # :flag.case |
|
5210 | # :flag.case | |
5200 | --tag) |
|
5211 | --tag) | |
5201 |
|
5212 | |||
5202 | # :flag.case_arg |
|
5213 | # :flag.case_arg | |
5203 | if [[ -n ${2+x} ]]; then |
|
5214 | if [[ -n ${2+x} ]]; then | |
5204 |
|
5215 | |||
5205 | if [[ -z ${args['--tag']+x} ]]; then |
|
5216 | if [[ -z ${args['--tag']+x} ]]; then | |
5206 | args['--tag']="\"$2\"" |
|
5217 | args['--tag']="\"$2\"" | |
5207 | else |
|
5218 | else | |
5208 | args['--tag']="${args[--tag]} \"$2\"" |
|
5219 | args['--tag']="${args[--tag]} \"$2\"" | |
5209 | fi |
|
5220 | fi | |
5210 | shift |
|
5221 | shift | |
5211 | shift |
|
5222 | shift | |
5212 | else |
|
5223 | else | |
5213 | printf "%s\n" "--tag requires an argument: --tag TAG" >&2 |
|
5224 | printf "%s\n" "--tag requires an argument: --tag TAG" >&2 | |
5214 | exit 1 |
|
5225 | exit 1 | |
5215 | fi |
|
5226 | fi | |
5216 | ;; |
|
5227 | ;; | |
5217 |
|
5228 | |||
5218 | -?*) |
|
5229 | -?*) | |
5219 | printf "invalid option: %s\n" "$key" >&2 |
|
5230 | printf "invalid option: %s\n" "$key" >&2 | |
5220 | exit 1 |
|
5231 | exit 1 | |
5221 | ;; |
|
5232 | ;; | |
5222 |
|
5233 | |||
5223 | *) |
|
5234 | *) | |
5224 | # :command.parse_requirements_case |
|
5235 | # :command.parse_requirements_case | |
5225 | # :command.parse_requirements_case_simple |
|
5236 | # :command.parse_requirements_case_simple | |
5226 | printf "invalid argument: %s\n" "$key" >&2 |
|
5237 | printf "invalid argument: %s\n" "$key" >&2 | |
5227 | exit 1 |
|
5238 | exit 1 | |
5228 |
|
5239 | |||
5229 | ;; |
|
5240 | ;; | |
5230 |
|
5241 | |||
5231 | esac |
|
5242 | esac | |
5232 | done |
|
5243 | done | |
5233 |
|
5244 | |||
5234 | # :command.default_assignments |
|
5245 | # :command.default_assignments | |
5235 | [[ -n ${args['--version-name']:-} ]] || args['--version-name']="$RC_CLI_VERSION_NAME" |
|
5246 | [[ -n ${args['--version-name']:-} ]] || args['--version-name']="$RC_CLI_VERSION_NAME" | |
5236 |
|
5247 | |||
5237 | } |
|
5248 | } | |
5238 |
|
5249 | |||
5239 | # :command.parse_requirements |
|
5250 | # :command.parse_requirements | |
5240 | rcstack__completions_parse_requirements() { |
|
5251 | rcstack__completions_parse_requirements() { | |
5241 | # :command.fixed_flags_filter |
|
5252 | # :command.fixed_flags_filter | |
5242 | while [[ $# -gt 0 ]]; do |
|
5253 | while [[ $# -gt 0 ]]; do | |
5243 | case "${1:-}" in |
|
5254 | case "${1:-}" in | |
5244 | --help | -h) |
|
5255 | --help | -h) | |
5245 | long_usage=yes |
|
5256 | long_usage=yes | |
5246 | rcstack__completions_usage |
|
5257 | rcstack__completions_usage | |
5247 | exit |
|
5258 | exit | |
5248 | ;; |
|
5259 | ;; | |
5249 |
|
5260 | |||
5250 | *) |
|
5261 | *) | |
5251 | break |
|
5262 | break | |
5252 | ;; |
|
5263 | ;; | |
5253 |
|
5264 | |||
5254 | esac |
|
5265 | esac | |
5255 | done |
|
5266 | done | |
5256 |
|
5267 | |||
5257 | # :command.command_filter |
|
5268 | # :command.command_filter | |
5258 | action="_completions" |
|
5269 | action="_completions" | |
5259 |
|
5270 | |||
5260 | # :command.parse_requirements_while |
|
5271 | # :command.parse_requirements_while | |
5261 | while [[ $# -gt 0 ]]; do |
|
5272 | while [[ $# -gt 0 ]]; do | |
5262 | key="$1" |
|
5273 | key="$1" | |
5263 | case "$key" in |
|
5274 | case "$key" in | |
5264 |
|
5275 | |||
5265 | -?*) |
|
5276 | -?*) | |
5266 | printf "invalid option: %s\n" "$key" >&2 |
|
5277 | printf "invalid option: %s\n" "$key" >&2 | |
5267 | exit 1 |
|
5278 | exit 1 | |
5268 | ;; |
|
5279 | ;; | |
5269 |
|
5280 | |||
5270 | *) |
|
5281 | *) | |
5271 | # :command.parse_requirements_case |
|
5282 | # :command.parse_requirements_case | |
5272 | # :command.parse_requirements_case_simple |
|
5283 | # :command.parse_requirements_case_simple | |
5273 | printf "invalid argument: %s\n" "$key" >&2 |
|
5284 | printf "invalid argument: %s\n" "$key" >&2 | |
5274 | exit 1 |
|
5285 | exit 1 | |
5275 |
|
5286 | |||
5276 | ;; |
|
5287 | ;; | |
5277 |
|
5288 | |||
5278 | esac |
|
5289 | esac | |
5279 | done |
|
5290 | done | |
5280 |
|
5291 | |||
5281 | } |
|
5292 | } | |
5282 |
|
5293 | |||
5283 | # :command.initialize |
|
5294 | # :command.initialize | |
5284 | initialize() { |
|
5295 | initialize() { | |
5285 | version="4.28.0.REL.2023.40" |
|
5296 | version="4.28.0.REL.2023.40" | |
5286 | long_usage='' |
|
5297 | long_usage='' | |
5287 | set -e |
|
5298 | set -e | |
5288 |
|
5299 | |||
5289 | # :command.environment_variables_default |
|
5300 | # :command.environment_variables_default | |
5290 | export RCC_CONFIG="${RCC_CONFIG:-.rcstack.ini}" |
|
5301 | export RCC_CONFIG="${RCC_CONFIG:-.rcstack.ini}" | |
5291 | export RC_STACK_ROUTER_EXT="${RC_STACK_ROUTER_EXT:-.custom/docker-compose-router.override.yaml}" |
|
5302 | export RC_STACK_ROUTER_EXT="${RC_STACK_ROUTER_EXT:-.custom/docker-compose-router.override.yaml}" | |
5292 | export RC_STACK_METRICS_EXT="${RC_STACK_METRICS_EXT:-.custom/docker-compose-metrics.override.yaml}" |
|
5303 | export RC_STACK_METRICS_EXT="${RC_STACK_METRICS_EXT:-.custom/docker-compose-metrics.override.yaml}" | |
5293 | export RC_STACK_SERVICES_EXT="${RC_STACK_SERVICES_EXT:-.custom/docker-compose-services.override.yaml}" |
|
5304 | export RC_STACK_SERVICES_EXT="${RC_STACK_SERVICES_EXT:-.custom/docker-compose-services.override.yaml}" | |
5294 | export RC_STACK_RHODECODE_EXT="${RC_STACK_RHODECODE_EXT:-.custom/docker-compose-apps.override.yaml}" |
|
5305 | export RC_STACK_RHODECODE_EXT="${RC_STACK_RHODECODE_EXT:-.custom/docker-compose-apps.override.yaml}" | |
5295 |
|
5306 | |||
5296 | # src/initialize.sh |
|
5307 | # src/initialize.sh | |
5297 | rc_image_ver=4.28.0.REL.2023.01.23.2 |
|
5308 | rc_image_ver=4.28.0.REL.2023.01.23.2 | |
5298 |
|
5309 | |||
5299 | RC_STACK_ROUTER_VER=v1 |
|
5310 | RC_STACK_ROUTER_VER=v1 | |
5300 | RC_STACK_SERVICES_VER=v1 |
|
5311 | RC_STACK_SERVICES_VER=v1 | |
5301 | RC_STACK_RHODECODE_VER=v1 |
|
5312 | RC_STACK_RHODECODE_VER=v1 | |
5302 | RC_STACK_METRICS_VER=v1 |
|
5313 | RC_STACK_METRICS_VER=v1 | |
5303 |
|
5314 | |||
5304 | RC_SCRIPT_NAME=rcstack |
|
5315 | RC_SCRIPT_NAME=rcstack | |
5305 | # bootstrap file is a config file at the same time |
|
5316 | # bootstrap file is a config file at the same time | |
5306 | CONFIG_FILE=${RCC_CONFIG:=.rcstack.ini} |
|
5317 | CONFIG_FILE=${RCC_CONFIG:=.rcstack.ini} | |
5307 |
|
5318 | |||
5308 | # runtime env file |
|
5319 | # runtime env file | |
5309 | RUNTIME_ENV=$PWD/.custom/.runtime.env |
|
5320 | RUNTIME_ENV=$PWD/.custom/.runtime.env | |
5310 |
|
5321 | |||
5311 | # STACK_LIST |
|
5322 | # STACK_LIST | |
5312 | VALID_SERVICES="router metrics services rhodecode" |
|
5323 | VALID_SERVICES="router metrics services rhodecode" | |
5313 | DOCKER_DEFS_WORK_DIR="docker_defs" |
|
5324 | DOCKER_DEFS_WORK_DIR="docker_defs" | |
5314 |
|
5325 | |||
5315 | # stage key, saved in .rcstack.ini : stage func to execute |
|
5326 | # stage key, saved in .rcstack.ini : stage func to execute | |
5316 | BOOTSTRAP_STAGES="\ |
|
5327 | BOOTSTRAP_STAGES="\ | |
5317 | bootstrap_v1_docker_install:bootstrap_docker_install \ |
|
5328 | bootstrap_v1_docker_install:bootstrap_docker_install \ | |
5318 | bootstrap_v1_docker_commons:bootstrap_docker_commons \ |
|
5329 | bootstrap_v1_docker_commons:bootstrap_docker_commons \ | |
5319 | bootstrap_v1_definitions:bootstrap_definitions \ |
|
5330 | bootstrap_v1_definitions:bootstrap_definitions \ | |
5320 | bootstrap_v1_config:bootstrap_config \ |
|
5331 | bootstrap_v1_config:bootstrap_config \ | |
5321 | bootstrap_v1_overrides:bootstrap_overrides \ |
|
5332 | bootstrap_v1_overrides:bootstrap_overrides \ | |
5322 | " |
|
5333 | " | |
5323 |
|
5334 | |||
5324 | #echo "1 ----" |
|
5335 | #echo "1 ----" | |
5325 | #echo $RC_STACK_SERVICES_EXT |
|
5336 | #echo $RC_STACK_SERVICES_EXT | |
5326 | #echo $RC_STACK_METRICS_EXT |
|
5337 | #echo $RC_STACK_METRICS_EXT | |
5327 | #echo "1 -----" |
|
5338 | #echo "1 -----" | |
5328 |
|
5339 | |||
5329 | #echo '2 ----' |
|
5340 | #echo '2 ----' | |
5330 | #grep -v -e '^#' "$ENV_FILE" | xargs -I {} echo \'{}\' |
|
5341 | #grep -v -e '^#' "$ENV_FILE" | xargs -I {} echo \'{}\' | |
5331 | #echo '2 ----' |
|
5342 | #echo '2 ----' | |
5332 |
|
5343 | |||
5333 | #expose env vars from ./rcstack config |
|
5344 | #expose env vars from ./rcstack config | |
5334 | #if [[ -f $ENV_FILE ]]; then |
|
5345 | #if [[ -f $ENV_FILE ]]; then | |
5335 | # eval $(grep -v -e '^#' "$ENV_FILE" | xargs -I {} echo export \'{}\') |
|
5346 | # eval $(grep -v -e '^#' "$ENV_FILE" | xargs -I {} echo export \'{}\') | |
5336 | #fi |
|
5347 | #fi | |
5337 |
|
5348 | |||
5338 | #ENV_EXPAND="" |
|
5349 | #ENV_EXPAND="" | |
5339 | #for k in $(config_keys); do |
|
5350 | #for k in $(config_keys); do | |
5340 | # k_upper=${k^^} |
|
5351 | # k_upper=${k^^} | |
5341 | # env_entry="-e $k_upper='$(config_get "$k")' " |
|
5352 | # env_entry="-e $k_upper='$(config_get "$k")' " | |
5342 | # ENV_EXPAND+=$env_entry; |
|
5353 | # ENV_EXPAND+=$env_entry; | |
5343 | # #echo $env_expand |
|
5354 | # #echo $env_expand | |
5344 | #done |
|
5355 | #done | |
5345 |
|
5356 | |||
5346 | # |
|
5357 | # | |
5347 | #echo "3 ----" |
|
5358 | #echo "3 ----" | |
5348 | #echo $RC_STACK_SERVICES_EXT |
|
5359 | #echo $RC_STACK_SERVICES_EXT | |
5349 | #echo $RC_STACK_METRICS_EXT |
|
5360 | #echo $RC_STACK_METRICS_EXT | |
5350 | #echo $RC_STACK_RHODECODE_EXT |
|
5361 | #echo $RC_STACK_RHODECODE_EXT | |
5351 | #echo "3 -----" |
|
5362 | #echo "3 -----" | |
5352 |
|
5363 | |||
5353 | #env | grep RC_ |
|
5364 | #env | grep RC_ | |
5354 |
|
5365 | |||
5355 | docker_ping_host() { |
|
5366 | docker_ping_host() { | |
5356 | PING_HOST="$1" |
|
5367 | PING_HOST="$1" | |
5357 | docker run --network rhodecode_network --rm alpine ping "$PING_HOST" |
|
5368 | docker run --network rhodecode_network --rm alpine ping "$PING_HOST" | |
5358 | } |
|
5369 | } | |
5359 |
|
5370 | |||
5360 | get_started() { |
|
5371 | get_started() { | |
5361 | echo "" |
|
5372 | echo "" | |
5362 | echo "To start using RhodeCode run the following stacks using './$RC_SCRIPT_NAME stack [STACK_NAME]'" |
|
5373 | echo "To start using RhodeCode run the following stacks using './$RC_SCRIPT_NAME stack [STACK_NAME]'" | |
5363 | echo "Check './$RC_SCRIPT_NAME stack --help' for more examples and options" |
|
5374 | echo "Check './$RC_SCRIPT_NAME stack --help' for more examples and options" | |
5364 | echo "$(green_bold IMPORTANT): init command generates some secrets/config inside $RUNTIME_ENV file." |
|
5375 | echo "$(green_bold IMPORTANT): init command generates some secrets/config inside $RUNTIME_ENV file." | |
5365 | echo "Check and adjust those settings if needed" |
|
5376 | echo "Check and adjust those settings if needed" | |
5366 | echo "" |
|
5377 | echo "" | |
5367 | echo "$(green_bold 1\) router [Mandatory]): run the edge router to control stack traffic / domain access and optionally SSL termination" |
|
5378 | echo "$(green_bold 1\) router [Mandatory]): run the edge router to control stack traffic / domain access and optionally SSL termination" | |
5368 | echo "IMPORTANT: router binds to some common ports 80, 443, SSH (9022), Loki (3100) if those are not available, please adjust them" |
|
5379 | echo "IMPORTANT: router binds to some common ports 80, 443, SSH (9022), Loki (3100) if those are not available, please adjust them" | |
5369 | echo "To configure this stack before running check: $RC_STACK_ROUTER_EXT" |
|
5380 | echo "To configure this stack before running check: $RC_STACK_ROUTER_EXT" | |
5370 |
|
5381 | |||
5371 | echo "./$RC_SCRIPT_NAME stack router up --detach" |
|
5382 | echo "./$RC_SCRIPT_NAME stack router up --detach" | |
5372 | echo "" |
|
5383 | echo "" | |
5373 | echo "$(green_bold 2\) services [Mandatory]): run the services, like database, redis, channelstream etc..." |
|
5384 | echo "$(green_bold 2\) services [Mandatory]): run the services, like database, redis, channelstream etc..." | |
5374 | echo "IMPORTANT: if you like to run your own database, or redis please adjust before running" |
|
5385 | echo "IMPORTANT: if you like to run your own database, or redis please adjust before running" | |
5375 | echo "To configure this stack before running check: $RC_STACK_SERVICES_EXT" |
|
5386 | echo "To configure this stack before running check: $RC_STACK_SERVICES_EXT" | |
5376 | echo "./$RC_SCRIPT_NAME stack services up --detach" |
|
5387 | echo "./$RC_SCRIPT_NAME stack services up --detach" | |
5377 | echo "" |
|
5388 | echo "" | |
5378 | echo "$(green_bold 3\) rhodecode [Mandatory]): run the rhodecode app stack" |
|
5389 | echo "$(green_bold 3\) rhodecode [Mandatory]): run the rhodecode app stack" | |
5379 | echo "To configure this stack before running check: $RC_STACK_RHODECODE_EXT" |
|
5390 | echo "To configure this stack before running check: $RC_STACK_RHODECODE_EXT" | |
5380 | echo "./$RC_SCRIPT_NAME stack rhodecode up --detach" |
|
5391 | echo "./$RC_SCRIPT_NAME stack rhodecode up --detach" | |
5381 | echo "" |
|
5392 | echo "" | |
5382 | echo "$(yellow_bold 4\) metrics [Optional]): run the monitoring stack, this includes grafana/prometheus logging/metrics system" |
|
5393 | echo "$(yellow_bold 4\) metrics [Optional]): run the monitoring stack, this includes grafana/prometheus logging/metrics system" | |
5383 | echo "To configure this stack before running check: $RC_STACK_METRICS_EXT" |
|
5394 | echo "To configure this stack before running check: $RC_STACK_METRICS_EXT" | |
5384 | echo "./$RC_SCRIPT_NAME stack metrics up --detach" |
|
5395 | echo "./$RC_SCRIPT_NAME stack metrics up --detach" | |
5385 | echo "" |
|
5396 | echo "" | |
5386 | echo "$(bold [Status]): check services run status, ports etc.." |
|
5397 | echo "$(bold [Status]): check services run status, ports etc.." | |
5387 | echo "./$RC_SCRIPT_NAME status" |
|
5398 | echo "./$RC_SCRIPT_NAME status" | |
5388 | echo "" |
|
5399 | echo "" | |
5389 | echo "$(bold [Logs]): check service logs" |
|
5400 | echo "$(bold [Logs]): check service logs" | |
5390 | echo "./$RC_SCRIPT_NAME stack [STACK_NAME] logs" |
|
5401 | echo "./$RC_SCRIPT_NAME stack [STACK_NAME] logs" | |
5391 | } |
|
5402 | } | |
5392 |
|
5403 | |||
5393 | get_started_full() { |
|
5404 | get_started_full() { | |
5394 | echo "$(blue_bold [~~~~ GET STARTED ~~~~~])" |
|
5405 | echo "$(blue_bold [~~~~ GET STARTED ~~~~~])" | |
5395 | echo "./$RC_SCRIPT_NAME is a CLI based installer/manager for RhodeCode Cluster Stack" |
|
5406 | echo "./$RC_SCRIPT_NAME is a CLI based installer/manager for RhodeCode Cluster Stack" | |
5396 | echo "./$RC_SCRIPT_NAME -h is your friend, in case of doubt, check examples and usage options with -h / --help flag" |
|
5407 | echo "./$RC_SCRIPT_NAME -h is your friend, in case of doubt, check examples and usage options with -h / --help flag" | |
5397 | echo "" |
|
5408 | echo "" | |
5398 | echo "$(yellow_bold [First time run])" |
|
5409 | echo "$(yellow_bold [First time run])" | |
5399 | echo "run './$RC_SCRIPT_NAME init' to setup docker and download required installer files." |
|
5410 | echo "run './$RC_SCRIPT_NAME init' to setup docker and download required installer files." | |
5400 | echo "./$RC_SCRIPT_NAME can install Docker for you, or install it manually before running init command" |
|
5411 | echo "./$RC_SCRIPT_NAME can install Docker for you, or install it manually before running init command" | |
5401 |
|
5412 | |||
5402 | get_started |
|
5413 | get_started | |
5403 | } |
|
5414 | } | |
5404 |
|
5415 | |||
5405 | } |
|
5416 | } | |
5406 |
|
5417 | |||
5407 | # :command.run |
|
5418 | # :command.run | |
5408 | run() { |
|
5419 | run() { | |
5409 | declare -A args=() |
|
5420 | declare -A args=() | |
5410 | declare -a other_args=() |
|
5421 | declare -a other_args=() | |
5411 | declare -a input=() |
|
5422 | declare -a input=() | |
5412 | normalize_input "$@" |
|
5423 | normalize_input "$@" | |
5413 | parse_requirements "${input[@]}" |
|
5424 | parse_requirements "${input[@]}" | |
5414 |
|
5425 | |||
5415 | case "$action" in |
|
5426 | case "$action" in | |
5416 | "get-started") |
|
5427 | "get-started") | |
5417 | if [[ ${args['--help']:-} ]]; then |
|
5428 | if [[ ${args['--help']:-} ]]; then | |
5418 | long_usage=yes |
|
5429 | long_usage=yes | |
5419 | rcstack_get_started_usage |
|
5430 | rcstack_get_started_usage | |
5420 | else |
|
5431 | else | |
5421 | rcstack_get_started_command |
|
5432 | rcstack_get_started_command | |
5422 | fi |
|
5433 | fi | |
5423 | ;; |
|
5434 | ;; | |
5424 |
|
5435 | |||
5425 | "init") |
|
5436 | "init") | |
5426 | if [[ ${args['--help']:-} ]]; then |
|
5437 | if [[ ${args['--help']:-} ]]; then | |
5427 | long_usage=yes |
|
5438 | long_usage=yes | |
5428 | rcstack_init_usage |
|
5439 | rcstack_init_usage | |
5429 | else |
|
5440 | else | |
5430 | rcstack_init_command |
|
5441 | rcstack_init_command | |
5431 | fi |
|
5442 | fi | |
5432 | ;; |
|
5443 | ;; | |
5433 |
|
5444 | |||
5434 | "self-update") |
|
5445 | "self-update") | |
5435 | if [[ ${args['--help']:-} ]]; then |
|
5446 | if [[ ${args['--help']:-} ]]; then | |
5436 | long_usage=yes |
|
5447 | long_usage=yes | |
5437 | rcstack_self_update_usage |
|
5448 | rcstack_self_update_usage | |
5438 | else |
|
5449 | else | |
5439 | rcstack_self_update_command |
|
5450 | rcstack_self_update_command | |
5440 | fi |
|
5451 | fi | |
5441 | ;; |
|
5452 | ;; | |
5442 |
|
5453 | |||
5443 | "stack") |
|
5454 | "stack") | |
5444 | if [[ ${args['--help']:-} ]]; then |
|
5455 | if [[ ${args['--help']:-} ]]; then | |
5445 | long_usage=yes |
|
5456 | long_usage=yes | |
5446 | rcstack_stack_usage |
|
5457 | rcstack_stack_usage | |
5447 | else |
|
5458 | else | |
5448 | rcstack_stack_command |
|
5459 | rcstack_stack_command | |
5449 | fi |
|
5460 | fi | |
5450 | ;; |
|
5461 | ;; | |
5451 |
|
5462 | |||
5452 | "stack router") |
|
5463 | "stack router") | |
5453 | if [[ ${args['--help']:-} ]]; then |
|
5464 | if [[ ${args['--help']:-} ]]; then | |
5454 | long_usage=yes |
|
5465 | long_usage=yes | |
5455 | rcstack_stack_router_usage |
|
5466 | rcstack_stack_router_usage | |
5456 | else |
|
5467 | else | |
5457 | rcstack_stack_router_command |
|
5468 | rcstack_stack_router_command | |
5458 | fi |
|
5469 | fi | |
5459 | ;; |
|
5470 | ;; | |
5460 |
|
5471 | |||
5461 | "stack metrics") |
|
5472 | "stack metrics") | |
5462 | if [[ ${args['--help']:-} ]]; then |
|
5473 | if [[ ${args['--help']:-} ]]; then | |
5463 | long_usage=yes |
|
5474 | long_usage=yes | |
5464 | rcstack_stack_metrics_usage |
|
5475 | rcstack_stack_metrics_usage | |
5465 | else |
|
5476 | else | |
5466 | rcstack_stack_metrics_command |
|
5477 | rcstack_stack_metrics_command | |
5467 | fi |
|
5478 | fi | |
5468 | ;; |
|
5479 | ;; | |
5469 |
|
5480 | |||
5470 | "stack services") |
|
5481 | "stack services") | |
5471 | if [[ ${args['--help']:-} ]]; then |
|
5482 | if [[ ${args['--help']:-} ]]; then | |
5472 | long_usage=yes |
|
5483 | long_usage=yes | |
5473 | rcstack_stack_services_usage |
|
5484 | rcstack_stack_services_usage | |
5474 | else |
|
5485 | else | |
5475 | rcstack_stack_services_command |
|
5486 | rcstack_stack_services_command | |
5476 | fi |
|
5487 | fi | |
5477 | ;; |
|
5488 | ;; | |
5478 |
|
5489 | |||
5479 | "stack rhodecode") |
|
5490 | "stack rhodecode") | |
5480 | if [[ ${args['--help']:-} ]]; then |
|
5491 | if [[ ${args['--help']:-} ]]; then | |
5481 | long_usage=yes |
|
5492 | long_usage=yes | |
5482 | rcstack_stack_rhodecode_usage |
|
5493 | rcstack_stack_rhodecode_usage | |
5483 | else |
|
5494 | else | |
5484 | rcstack_stack_rhodecode_command |
|
5495 | rcstack_stack_rhodecode_command | |
5485 | fi |
|
5496 | fi | |
5486 | ;; |
|
5497 | ;; | |
5487 |
|
5498 | |||
5488 | "stack all") |
|
5499 | "stack all") | |
5489 | if [[ ${args['--help']:-} ]]; then |
|
5500 | if [[ ${args['--help']:-} ]]; then | |
5490 | long_usage=yes |
|
5501 | long_usage=yes | |
5491 | rcstack_stack_all_usage |
|
5502 | rcstack_stack_all_usage | |
5492 | else |
|
5503 | else | |
5493 | rcstack_stack_all_command |
|
5504 | rcstack_stack_all_command | |
5494 | fi |
|
5505 | fi | |
5495 | ;; |
|
5506 | ;; | |
5496 |
|
5507 | |||
5497 | "stack-status") |
|
5508 | "stack-status") | |
5498 | if [[ ${args['--help']:-} ]]; then |
|
5509 | if [[ ${args['--help']:-} ]]; then | |
5499 | long_usage=yes |
|
5510 | long_usage=yes | |
5500 | rcstack_stack_status_usage |
|
5511 | rcstack_stack_status_usage | |
5501 | else |
|
5512 | else | |
5502 | rcstack_stack_status_command |
|
5513 | rcstack_stack_status_command | |
5503 | fi |
|
5514 | fi | |
5504 | ;; |
|
5515 | ;; | |
5505 |
|
5516 | |||
5506 | "stack-upgrade") |
|
5517 | "stack-upgrade") | |
5507 | if [[ ${args['--help']:-} ]]; then |
|
5518 | if [[ ${args['--help']:-} ]]; then | |
5508 | long_usage=yes |
|
5519 | long_usage=yes | |
5509 | rcstack_stack_upgrade_usage |
|
5520 | rcstack_stack_upgrade_usage | |
5510 | else |
|
5521 | else | |
5511 | rcstack_stack_upgrade_command |
|
5522 | rcstack_stack_upgrade_command | |
5512 | fi |
|
5523 | fi | |
5513 | ;; |
|
5524 | ;; | |
5514 |
|
5525 | |||
5515 | "stack-upgrade router") |
|
5526 | "stack-upgrade router") | |
5516 | if [[ ${args['--help']:-} ]]; then |
|
5527 | if [[ ${args['--help']:-} ]]; then | |
5517 | long_usage=yes |
|
5528 | long_usage=yes | |
5518 | rcstack_stack_upgrade_router_usage |
|
5529 | rcstack_stack_upgrade_router_usage | |
5519 | else |
|
5530 | else | |
5520 | rcstack_stack_upgrade_router_command |
|
5531 | rcstack_stack_upgrade_router_command | |
5521 | fi |
|
5532 | fi | |
5522 | ;; |
|
5533 | ;; | |
5523 |
|
5534 | |||
5524 | "stack-upgrade metrics") |
|
5535 | "stack-upgrade metrics") | |
5525 | if [[ ${args['--help']:-} ]]; then |
|
5536 | if [[ ${args['--help']:-} ]]; then | |
5526 | long_usage=yes |
|
5537 | long_usage=yes | |
5527 | rcstack_stack_upgrade_metrics_usage |
|
5538 | rcstack_stack_upgrade_metrics_usage | |
5528 | else |
|
5539 | else | |
5529 | rcstack_stack_upgrade_metrics_command |
|
5540 | rcstack_stack_upgrade_metrics_command | |
5530 | fi |
|
5541 | fi | |
5531 | ;; |
|
5542 | ;; | |
5532 |
|
5543 | |||
5533 | "stack-upgrade services") |
|
5544 | "stack-upgrade services") | |
5534 | if [[ ${args['--help']:-} ]]; then |
|
5545 | if [[ ${args['--help']:-} ]]; then | |
5535 | long_usage=yes |
|
5546 | long_usage=yes | |
5536 | rcstack_stack_upgrade_services_usage |
|
5547 | rcstack_stack_upgrade_services_usage | |
5537 | else |
|
5548 | else | |
5538 | rcstack_stack_upgrade_services_command |
|
5549 | rcstack_stack_upgrade_services_command | |
5539 | fi |
|
5550 | fi | |
5540 | ;; |
|
5551 | ;; | |
5541 |
|
5552 | |||
5542 | "stack-upgrade rhodecode") |
|
5553 | "stack-upgrade rhodecode") | |
5543 | if [[ ${args['--help']:-} ]]; then |
|
5554 | if [[ ${args['--help']:-} ]]; then | |
5544 | long_usage=yes |
|
5555 | long_usage=yes | |
5545 | rcstack_stack_upgrade_rhodecode_usage |
|
5556 | rcstack_stack_upgrade_rhodecode_usage | |
5546 | else |
|
5557 | else | |
5547 | rcstack_stack_upgrade_rhodecode_command |
|
5558 | rcstack_stack_upgrade_rhodecode_command | |
5548 | fi |
|
5559 | fi | |
5549 | ;; |
|
5560 | ;; | |
5550 |
|
5561 | |||
5551 | "cli") |
|
5562 | "cli") | |
5552 | if [[ ${args['--help']:-} ]]; then |
|
5563 | if [[ ${args['--help']:-} ]]; then | |
5553 | long_usage=yes |
|
5564 | long_usage=yes | |
5554 | rcstack_cli_usage |
|
5565 | rcstack_cli_usage | |
5555 | else |
|
5566 | else | |
5556 | rcstack_cli_command |
|
5567 | rcstack_cli_command | |
5557 | fi |
|
5568 | fi | |
5558 | ;; |
|
5569 | ;; | |
5559 |
|
5570 | |||
5560 | "cli image-info") |
|
5571 | "cli image-info") | |
5561 | if [[ ${args['--help']:-} ]]; then |
|
5572 | if [[ ${args['--help']:-} ]]; then | |
5562 | long_usage=yes |
|
5573 | long_usage=yes | |
5563 | rcstack_cli_image_info_usage |
|
5574 | rcstack_cli_image_info_usage | |
5564 | else |
|
5575 | else | |
5565 | rcstack_cli_image_info_command |
|
5576 | rcstack_cli_image_info_command | |
5566 | fi |
|
5577 | fi | |
5567 | ;; |
|
5578 | ;; | |
5568 |
|
5579 | |||
5569 | "cli redis") |
|
5580 | "cli redis") | |
5570 | if [[ ${args['--help']:-} ]]; then |
|
5581 | if [[ ${args['--help']:-} ]]; then | |
5571 | long_usage=yes |
|
5582 | long_usage=yes | |
5572 | rcstack_cli_redis_usage |
|
5583 | rcstack_cli_redis_usage | |
5573 | else |
|
5584 | else | |
5574 | rcstack_cli_redis_command |
|
5585 | rcstack_cli_redis_command | |
5575 | fi |
|
5586 | fi | |
5576 | ;; |
|
5587 | ;; | |
5577 |
|
5588 | |||
5578 | "cli db") |
|
5589 | "cli db") | |
5579 | if [[ ${args['--help']:-} ]]; then |
|
5590 | if [[ ${args['--help']:-} ]]; then | |
5580 | long_usage=yes |
|
5591 | long_usage=yes | |
5581 | rcstack_cli_db_usage |
|
5592 | rcstack_cli_db_usage | |
5582 | else |
|
5593 | else | |
5583 | rcstack_cli_db_command |
|
5594 | rcstack_cli_db_command | |
5584 | fi |
|
5595 | fi | |
5585 | ;; |
|
5596 | ;; | |
5586 |
|
5597 | |||
5587 | "cli db-upgrade") |
|
5598 | "cli db-upgrade") | |
5588 | if [[ ${args['--help']:-} ]]; then |
|
5599 | if [[ ${args['--help']:-} ]]; then | |
5589 | long_usage=yes |
|
5600 | long_usage=yes | |
5590 | rcstack_cli_db_upgrade_usage |
|
5601 | rcstack_cli_db_upgrade_usage | |
5591 | else |
|
5602 | else | |
5592 | rcstack_cli_db_upgrade_command |
|
5603 | rcstack_cli_db_upgrade_command | |
5593 | fi |
|
5604 | fi | |
5594 | ;; |
|
5605 | ;; | |
5595 |
|
5606 | |||
5596 | "cli storage") |
|
5607 | "cli storage") | |
5597 | if [[ ${args['--help']:-} ]]; then |
|
5608 | if [[ ${args['--help']:-} ]]; then | |
5598 | long_usage=yes |
|
5609 | long_usage=yes | |
5599 | rcstack_cli_storage_usage |
|
5610 | rcstack_cli_storage_usage | |
5600 | else |
|
5611 | else | |
5601 | rcstack_cli_storage_command |
|
5612 | rcstack_cli_storage_command | |
5602 | fi |
|
5613 | fi | |
5603 | ;; |
|
5614 | ;; | |
5604 |
|
5615 | |||
5605 | "cli attach") |
|
5616 | "cli attach") | |
5606 | if [[ ${args['--help']:-} ]]; then |
|
5617 | if [[ ${args['--help']:-} ]]; then | |
5607 | long_usage=yes |
|
5618 | long_usage=yes | |
5608 | rcstack_cli_attach_usage |
|
5619 | rcstack_cli_attach_usage | |
5609 | else |
|
5620 | else | |
5610 | rcstack_cli_attach_command |
|
5621 | rcstack_cli_attach_command | |
5611 | fi |
|
5622 | fi | |
5612 | ;; |
|
5623 | ;; | |
5613 |
|
5624 | |||
5614 | "cli configure-vcsserver") |
|
5625 | "cli configure-vcsserver") | |
5615 | if [[ ${args['--help']:-} ]]; then |
|
5626 | if [[ ${args['--help']:-} ]]; then | |
5616 | long_usage=yes |
|
5627 | long_usage=yes | |
5617 | rcstack_cli_configure_vcsserver_usage |
|
5628 | rcstack_cli_configure_vcsserver_usage | |
5618 | else |
|
5629 | else | |
5619 | rcstack_cli_configure_vcsserver_command |
|
5630 | rcstack_cli_configure_vcsserver_command | |
5620 | fi |
|
5631 | fi | |
5621 | ;; |
|
5632 | ;; | |
5622 |
|
5633 | |||
5623 | "cli configure-rhodecode") |
|
5634 | "cli configure-rhodecode") | |
5624 | if [[ ${args['--help']:-} ]]; then |
|
5635 | if [[ ${args['--help']:-} ]]; then | |
5625 | long_usage=yes |
|
5636 | long_usage=yes | |
5626 | rcstack_cli_configure_rhodecode_usage |
|
5637 | rcstack_cli_configure_rhodecode_usage | |
5627 | else |
|
5638 | else | |
5628 | rcstack_cli_configure_rhodecode_command |
|
5639 | rcstack_cli_configure_rhodecode_command | |
5629 | fi |
|
5640 | fi | |
5630 | ;; |
|
5641 | ;; | |
5631 |
|
5642 | |||
5632 | "backup-db") |
|
5643 | "backup-db") | |
5633 | if [[ ${args['--help']:-} ]]; then |
|
5644 | if [[ ${args['--help']:-} ]]; then | |
5634 | long_usage=yes |
|
5645 | long_usage=yes | |
5635 | rcstack_backup_db_usage |
|
5646 | rcstack_backup_db_usage | |
5636 | else |
|
5647 | else | |
5637 | rcstack_backup_db_command |
|
5648 | rcstack_backup_db_command | |
5638 | fi |
|
5649 | fi | |
5639 | ;; |
|
5650 | ;; | |
5640 |
|
5651 | |||
5641 | "backup-data") |
|
5652 | "backup-data") | |
5642 | if [[ ${args['--help']:-} ]]; then |
|
5653 | if [[ ${args['--help']:-} ]]; then | |
5643 | long_usage=yes |
|
5654 | long_usage=yes | |
5644 | rcstack_backup_data_usage |
|
5655 | rcstack_backup_data_usage | |
5645 | else |
|
5656 | else | |
5646 | rcstack_backup_data_command |
|
5657 | rcstack_backup_data_command | |
5647 | fi |
|
5658 | fi | |
5648 | ;; |
|
5659 | ;; | |
5649 |
|
5660 | |||
5650 | "get-build-artifacts") |
|
5661 | "get-build-artifacts") | |
5651 | if [[ ${args['--help']:-} ]]; then |
|
5662 | if [[ ${args['--help']:-} ]]; then | |
5652 | long_usage=yes |
|
5663 | long_usage=yes | |
5653 | rcstack_get_build_artifacts_usage |
|
5664 | rcstack_get_build_artifacts_usage | |
5654 | else |
|
5665 | else | |
5655 | rcstack_get_build_artifacts_command |
|
5666 | rcstack_get_build_artifacts_command | |
5656 | fi |
|
5667 | fi | |
5657 | ;; |
|
5668 | ;; | |
5658 |
|
5669 | |||
5659 | "build-installer") |
|
5670 | "build-installer") | |
5660 | if [[ ${args['--help']:-} ]]; then |
|
5671 | if [[ ${args['--help']:-} ]]; then | |
5661 | long_usage=yes |
|
5672 | long_usage=yes | |
5662 | rcstack_build_installer_usage |
|
5673 | rcstack_build_installer_usage | |
5663 | else |
|
5674 | else | |
5664 | rcstack_build_installer_command |
|
5675 | rcstack_build_installer_command | |
5665 | fi |
|
5676 | fi | |
5666 | ;; |
|
5677 | ;; | |
5667 |
|
5678 | |||
5668 | "get-build-source") |
|
5679 | "get-build-source") | |
5669 | if [[ ${args['--help']:-} ]]; then |
|
5680 | if [[ ${args['--help']:-} ]]; then | |
5670 | long_usage=yes |
|
5681 | long_usage=yes | |
5671 | rcstack_get_build_source_usage |
|
5682 | rcstack_get_build_source_usage | |
5672 | else |
|
5683 | else | |
5673 | rcstack_get_build_source_command |
|
5684 | rcstack_get_build_source_command | |
5674 | fi |
|
5685 | fi | |
5675 | ;; |
|
5686 | ;; | |
5676 |
|
5687 | |||
5677 | "build-source") |
|
5688 | "build-source") | |
5678 | if [[ ${args['--help']:-} ]]; then |
|
5689 | if [[ ${args['--help']:-} ]]; then | |
5679 | long_usage=yes |
|
5690 | long_usage=yes | |
5680 | rcstack_build_source_usage |
|
5691 | rcstack_build_source_usage | |
5681 | else |
|
5692 | else | |
5682 | rcstack_build_source_command |
|
5693 | rcstack_build_source_command | |
5683 | fi |
|
5694 | fi | |
5684 | ;; |
|
5695 | ;; | |
5685 |
|
5696 | |||
5686 | "_completions") |
|
5697 | "_completions") | |
5687 | if [[ ${args['--help']:-} ]]; then |
|
5698 | if [[ ${args['--help']:-} ]]; then | |
5688 | long_usage=yes |
|
5699 | long_usage=yes | |
5689 | rcstack__completions_usage |
|
5700 | rcstack__completions_usage | |
5690 | else |
|
5701 | else | |
5691 | rcstack__completions_command |
|
5702 | rcstack__completions_command | |
5692 | fi |
|
5703 | fi | |
5693 | ;; |
|
5704 | ;; | |
5694 |
|
5705 | |||
5695 | esac |
|
5706 | esac | |
5696 | } |
|
5707 | } | |
5697 |
|
5708 | |||
5698 | initialize |
|
5709 | initialize | |
5699 | run "$@" |
|
5710 | run "$@" |
General Comments 0
You need to be logged in to leave comments.
Login now