Show More
@@ -0,0 +1,19 b'' | |||||
|
1 | [security] | |||
|
2 | admin_user=admin | |||
|
3 | admin_password=admin | |||
|
4 | ||||
|
5 | [users] | |||
|
6 | allow_sign_up=false | |||
|
7 | ||||
|
8 | [smtp] | |||
|
9 | enabled=true | |||
|
10 | host= | |||
|
11 | user= | |||
|
12 | password= | |||
|
13 | from_address=alerting-grafana@grafana.localhost | |||
|
14 | from_name=[Grafana] Alerting | |||
|
15 | ||||
|
16 | # subpath /_grafana | |||
|
17 | [server] | |||
|
18 | serve_from_sub_path=true | |||
|
19 | root_url=%(protocol)s://%(domain)s:%(http_port)s/_grafana/ |
1 | NO CONTENT: new file 100644 |
|
NO CONTENT: new file 100644 |
@@ -0,0 +1,3 b'' | |||||
|
1 | Store your certificate files here. | |||
|
2 | your-domain.crt | |||
|
3 | your-domain.key No newline at end of file |
@@ -0,0 +1,42 b'' | |||||
|
1 | ## Static configuration, needs traefik reload | |||
|
2 | ||||
|
3 | entryPoints: | |||
|
4 | http: | |||
|
5 | address: ":80" | |||
|
6 | ||||
|
7 | https: | |||
|
8 | address: ":443" | |||
|
9 | ||||
|
10 | # ssh: | |||
|
11 | # address: ":${RC_SSH_PORT:?must-specify-ssh-port}" | |||
|
12 | ||||
|
13 | traefik: | |||
|
14 | address: ":7000" | |||
|
15 | ||||
|
16 | api: | |||
|
17 | dashboard: false | |||
|
18 | insecure: false # change to true to expose dashboard | |||
|
19 | ||||
|
20 | accessLog: {} | |||
|
21 | ||||
|
22 | log: | |||
|
23 | # DEBUG / INFO | |||
|
24 | level: INFO | |||
|
25 | ||||
|
26 | metrics: | |||
|
27 | prometheus: {} | |||
|
28 | ||||
|
29 | ||||
|
30 | providers: | |||
|
31 | docker: | |||
|
32 | exposedByDefault: false | |||
|
33 | swarmMode: false | |||
|
34 | ||||
|
35 | file: | |||
|
36 | filename: "/etc/traefik/traefik_dynamic.yaml" | |||
|
37 | watch: true | |||
|
38 | ||||
|
39 | ||||
|
40 | serversTransport: | |||
|
41 | #this disables SSL certificate verification for legacy own cert services like NextCloud etc | |||
|
42 | insecureSkipVerify: true |
@@ -0,0 +1,24 b'' | |||||
|
1 | ||||
|
2 | ## Setting up the middleware for redirect to https ## | |||
|
3 | http: | |||
|
4 | ||||
|
5 | middlewares: | |||
|
6 | ||||
|
7 | https-redirect: | |||
|
8 | redirectScheme: | |||
|
9 | scheme: https | |||
|
10 | # permanent: true | |||
|
11 | ||||
|
12 | middlewares-rate-limit: | |||
|
13 | rateLimit: | |||
|
14 | average: 100 | |||
|
15 | burst: 50 | |||
|
16 | ||||
|
17 | # Dynamic configuration for standard file based SSL cert | |||
|
18 | # create a custom copy of the traefik into .custom/ and remount this | |||
|
19 | # to enable custom certificates | |||
|
20 | #tls: | |||
|
21 | # certificates: | |||
|
22 | # # first certificate | |||
|
23 | # - certFile: /etc/traefik/certs/rhodecode-com.cert | |||
|
24 | # keyFile: /etc/traefik/certs/rhodecode-com.key |
@@ -0,0 +1,312 b'' | |||||
|
1 | version: '3.9' | |||
|
2 | ||||
|
3 | x-logging: &custom-logging | |||
|
4 | # docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions | |||
|
5 | # NOTE: loki logging driver ONLY works for host type networks... | |||
|
6 | driver: loki | |||
|
7 | options: | |||
|
8 | loki-url: "http://127.0.0.1:3100/loki/api/v1/push" | |||
|
9 | #loki-url: "http://loki:3100/loki/api/v1/push" | |||
|
10 | loki-retries: "5" | |||
|
11 | loki-timeout: "1s" | |||
|
12 | loki-max-backoff: "800ms" | |||
|
13 | ||||
|
14 | volumes: | |||
|
15 | ||||
|
16 | # volume for RhodeCode repo-store, it's where the repositories will be stored | |||
|
17 | rhodecode_repos: | |||
|
18 | labels: | |||
|
19 | "keep": 1 | |||
|
20 | ||||
|
21 | ||||
|
22 | services: | |||
|
23 | ||||
|
24 | rhodecode: | |||
|
25 | networks: | |||
|
26 | - rhodecode_network | |||
|
27 | image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION:?specify-RC_VERSION-env-var} | |||
|
28 | env_file: | |||
|
29 | - .custom/.runtime.env | |||
|
30 | stdin_open: true | |||
|
31 | tty: true | |||
|
32 | restart: always | |||
|
33 | command: [ | |||
|
34 | "/usr/local/bin/rhodecode_bin/bin/gunicorn", | |||
|
35 | "--name=gunicorn-rhodecode-1", | |||
|
36 | "--error-logfile=-", | |||
|
37 | "--paster=/etc/rhodecode/conf/rhodecode.optimized.ini", | |||
|
38 | "--config=/etc/rhodecode/conf/gunicorn_conf.py" | |||
|
39 | ] | |||
|
40 | ||||
|
41 | # ports: | |||
|
42 | # - "127.0.0.1::10020" | |||
|
43 | ||||
|
44 | build: | |||
|
45 | context: . | |||
|
46 | dockerfile: service/rhodecode/rhodecode.dockerfile | |||
|
47 | args: | |||
|
48 | TZ: ${TZ} | |||
|
49 | RHODECODE_VERSION: ${RC_VERSION:?specify-RC_VERSION-env-var} | |||
|
50 | RHODECODE_DB: postgresql://rhodecode:${DB_PASSWORD:?must-specify-db-password}@database/${DB_NAME:?must-specify-db-name} | |||
|
51 | RHODECODE_USER_NAME: ${RHODECODE_USER_NAME} | |||
|
52 | RHODECODE_USER_PASS: ${RHODECODE_USER_PASS} | |||
|
53 | RHODECODE_USER_EMAIL: ${RHODECODE_USER_EMAIL} | |||
|
54 | ||||
|
55 | environment: | |||
|
56 | RC_APP_TYPE: rhodecode_http | |||
|
57 | RC_APP_PROC: 1 | |||
|
58 | SSL_CERT_FILE: "/etc/rhodecode/conf/ca-bundle.crt" | |||
|
59 | REQUESTS_CA_BUNDLE: "/etc/rhodecode/conf/ca-bundle.crt" | |||
|
60 | GIT_SSL_CAINFO: "/etc/rhodecode/conf/ca-bundle.crt" | |||
|
61 | GEVENT_RESOLVER: "ares" | |||
|
62 | ||||
|
63 | DB_UPGRADE: 1 # run the DB upgrade | |||
|
64 | SETUP_APP: 1 # run the application default settings setup, can be turned off after initial run | |||
|
65 | #FORCE_DB_INIT_FILE: 1 # force the database init, warning: destroys old DB | |||
|
66 | #FORCE_RC_SETUP_APP: 1 # force running setup scripts for configuration/license application | |||
|
67 | MAIN_INI_PATH: /etc/rhodecode/conf/rhodecode.optimized.ini | |||
|
68 | ||||
|
69 | # SVN Specific | |||
|
70 | MOD_DAV_SVN_PORT: 8090 | |||
|
71 | APACHE_LOG_DIR: /var/log/rhodecode/svn | |||
|
72 | MOD_DAV_SVN_CONF_FILE: /etc/rhodecode/conf/svn/mod_dav_svn.conf | |||
|
73 | ||||
|
74 | healthcheck: | |||
|
75 | test: [ "CMD", "curl", "-A", "RhodeCode-Healthcheck", "-s", "-o", "/dev/null", "-w", "'%{http_code}'", "http://127.0.0.1:10020/_admin/ops/ping" ] | |||
|
76 | timeout: 30s | |||
|
77 | interval: 60s | |||
|
78 | retries: 10 | |||
|
79 | ||||
|
80 | # depends_on: | |||
|
81 | # - database | |||
|
82 | # - redis | |||
|
83 | # - channelstream | |||
|
84 | ||||
|
85 | volumes: | |||
|
86 | - confvolume:/etc/rhodecode/conf | |||
|
87 | - logvolume:/var/log/rhodecode | |||
|
88 | - rhodecode_repos:/var/opt/rhodecode_repo_store | |||
|
89 | - rc_datavolume:/var/opt/rhodecode_data | |||
|
90 | ||||
|
91 | tmpfs: | |||
|
92 | - /data_ramdisk:size=${RC_DATA_RAMDISK_SIZE:?specify-RC_DATA_RAMDISK_SIZE-env-var} | |||
|
93 | ||||
|
94 | logging: | |||
|
95 | *custom-logging | |||
|
96 | ||||
|
97 | labels: | |||
|
98 | - "traefik.enable=false" | |||
|
99 | ||||
|
100 | vcsserver: | |||
|
101 | networks: | |||
|
102 | - rhodecode_network | |||
|
103 | image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION:?specify-RC_VERSION-env-var} | |||
|
104 | env_file: | |||
|
105 | - .custom/.runtime.env | |||
|
106 | stdin_open: true | |||
|
107 | tty: true | |||
|
108 | restart: always | |||
|
109 | command: [ | |||
|
110 | "/home/rhodecode/.rccontrol/vcsserver-1/profile/bin/gunicorn", | |||
|
111 | "--name=gunicorn-vcsserver-1", | |||
|
112 | "--error-logfile=-", | |||
|
113 | "--paster=/etc/rhodecode/conf/vcsserver.optimized.ini", | |||
|
114 | "--config=/etc/rhodecode/conf/gunicorn_conf_vcs.py" | |||
|
115 | ] | |||
|
116 | ||||
|
117 | # ports: | |||
|
118 | # - "127.0.0.1::10010" | |||
|
119 | ||||
|
120 | healthcheck: | |||
|
121 | test: [ "CMD", "curl", "-A", "RhodeCode-Healthcheck", "-s", "-o", "/dev/null", "-w", "'%{http_code}'", "http://127.0.0.1:10010/status" ] | |||
|
122 | timeout: 30s | |||
|
123 | interval: 60s | |||
|
124 | retries: 10 | |||
|
125 | ||||
|
126 | environment: | |||
|
127 | RC_APP_TYPE: rhodecode_vcsserver | |||
|
128 | RC_APP_PROC: 1 | |||
|
129 | MAIN_INI_PATH: /etc/rhodecode/conf/vcsserver.optimized.ini | |||
|
130 | SSL_CERT_FILE: "/etc/rhodecode/conf/ca-bundle.crt" | |||
|
131 | REQUESTS_CA_BUNDLE: "/etc/rhodecode/conf/ca-bundle.crt" | |||
|
132 | GIT_SSL_CAINFO: "/etc/rhodecode/conf/ca-bundle.crt" | |||
|
133 | ||||
|
134 | # depends_on: | |||
|
135 | # - redis | |||
|
136 | ||||
|
137 | volumes: | |||
|
138 | - confvolume:/etc/rhodecode/conf | |||
|
139 | - logvolume:/var/log/rhodecode | |||
|
140 | - rhodecode_repos:/var/opt/rhodecode_repo_store | |||
|
141 | - rc_datavolume:/var/opt/rhodecode_data | |||
|
142 | ||||
|
143 | logging: | |||
|
144 | *custom-logging | |||
|
145 | ||||
|
146 | celery: | |||
|
147 | networks: | |||
|
148 | - rhodecode_network | |||
|
149 | image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION:?specify-RC_VERSION-env-var} | |||
|
150 | env_file: | |||
|
151 | - .custom/.runtime.env | |||
|
152 | stdin_open: true | |||
|
153 | tty: true | |||
|
154 | restart: always | |||
|
155 | command: [ | |||
|
156 | "/usr/local/bin/rhodecode_bin/bin/celery", | |||
|
157 | "worker", | |||
|
158 | "--task-events", | |||
|
159 | "--autoscale=10,2", | |||
|
160 | "--no-color", | |||
|
161 | "--app=rhodecode.lib.celerylib.loader", | |||
|
162 | "--loglevel=DEBUG", | |||
|
163 | "--ini=/etc/rhodecode/conf/rhodecode.optimized.ini" | |||
|
164 | ] | |||
|
165 | ||||
|
166 | environment: | |||
|
167 | RC_APP_TYPE: rhodecode_celery | |||
|
168 | RC_APP_PROC: 1 | |||
|
169 | MAIN_INI_PATH: /etc/rhodecode/conf/rhodecode.optimized.ini | |||
|
170 | SSL_CERT_FILE: "/etc/rhodecode/conf/ca-bundle.crt" | |||
|
171 | REQUESTS_CA_BUNDLE: "/etc/rhodecode/conf/ca-bundle.crt" | |||
|
172 | GIT_SSL_CAINFO: "/etc/rhodecode/conf/ca-bundle.crt" | |||
|
173 | ||||
|
174 | # depends_on: | |||
|
175 | # - database | |||
|
176 | # - redis | |||
|
177 | ||||
|
178 | volumes: | |||
|
179 | - confvolume:/etc/rhodecode/conf | |||
|
180 | - logvolume:/var/log/rhodecode | |||
|
181 | - rhodecode_repos:/var/opt/rhodecode_repo_store | |||
|
182 | - rc_datavolume:/var/opt/rhodecode_data | |||
|
183 | ||||
|
184 | logging: | |||
|
185 | *custom-logging | |||
|
186 | ||||
|
187 | labels: | |||
|
188 | - "traefik.enable=false" | |||
|
189 | ||||
|
190 | celery-beat: | |||
|
191 | # This service is not scalable | |||
|
192 | networks: | |||
|
193 | - rhodecode_network | |||
|
194 | image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION:?specify-RC_VERSION-env-var} | |||
|
195 | env_file: | |||
|
196 | - .custom/.runtime.env | |||
|
197 | stdin_open: true | |||
|
198 | tty: true | |||
|
199 | restart: always | |||
|
200 | command: [ | |||
|
201 | "/usr/local/bin/rhodecode_bin/bin/celery", | |||
|
202 | "beat", | |||
|
203 | "--no-color", | |||
|
204 | "--app=rhodecode.lib.celerylib.loader", | |||
|
205 | "--scheduler=rhodecode.lib.celerylib.scheduler.RcScheduler", | |||
|
206 | "--loglevel=DEBUG", | |||
|
207 | "--ini=/etc/rhodecode/conf/rhodecode.optimized.ini" | |||
|
208 | ] | |||
|
209 | ||||
|
210 | environment: | |||
|
211 | RC_APP_TYPE: rhodecode_beat | |||
|
212 | RC_APP_PROC: 1 | |||
|
213 | MAIN_INI_PATH: /etc/rhodecode/conf/rhodecode.optimized.ini | |||
|
214 | SSL_CERT_FILE: "/etc/rhodecode/conf/ca-bundle.crt" | |||
|
215 | REQUESTS_CA_BUNDLE: "/etc/rhodecode/conf/ca-bundle.crt" | |||
|
216 | GIT_SSL_CAINFO: "/etc/rhodecode/conf/ca-bundle.crt" | |||
|
217 | ||||
|
218 | # depends_on: | |||
|
219 | # - database | |||
|
220 | # - redis | |||
|
221 | ||||
|
222 | volumes: | |||
|
223 | - confvolume:/etc/rhodecode/conf | |||
|
224 | - logvolume:/var/log/rhodecode | |||
|
225 | - rhodecode_repos:/var/opt/rhodecode_repo_store | |||
|
226 | - rc_datavolume:/var/opt/rhodecode_data | |||
|
227 | ||||
|
228 | logging: | |||
|
229 | *custom-logging | |||
|
230 | ||||
|
231 | labels: | |||
|
232 | - "traefik.enable=false" | |||
|
233 | ||||
|
234 | svn: | |||
|
235 | networks: | |||
|
236 | - rhodecode_network | |||
|
237 | image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION:?specify-RC_VERSION-env-var} | |||
|
238 | env_file: | |||
|
239 | - .custom/.runtime.env | |||
|
240 | ||||
|
241 | # build: | |||
|
242 | # context: . | |||
|
243 | # dockerfile: service/svn/rhodecode_svn.dockerfile | |||
|
244 | # args: | |||
|
245 | # APACHE_VER: 1.3 | |||
|
246 | ||||
|
247 | stdin_open: true | |||
|
248 | tty: true | |||
|
249 | restart: always | |||
|
250 | command: ["apachectl", "-D", "FOREGROUND"] | |||
|
251 | ||||
|
252 | environment: | |||
|
253 | RC_APP_TYPE: rhodecode_svn | |||
|
254 | ||||
|
255 | # SVN Specific | |||
|
256 | MOD_DAV_SVN_PORT: 8090 | |||
|
257 | APACHE_LOG_DIR: /var/log/rhodecode/svn | |||
|
258 | MOD_DAV_SVN_CONF_FILE: /etc/rhodecode/conf/svn/mod_dav_svn.conf | |||
|
259 | ||||
|
260 | # ports: | |||
|
261 | # - "127.0.0.1::8090" | |||
|
262 | ||||
|
263 | healthcheck: | |||
|
264 | test: [ "CMD", "curl", "-A", "RhodeCode-Healthcheck", "-s", "-o", "/dev/null", "-w", "'%{http_code}'", "http://127.0.0.1:8090/_server_status" ] | |||
|
265 | timeout: 30s | |||
|
266 | interval: 60s | |||
|
267 | retries: 10 | |||
|
268 | ||||
|
269 | volumes: | |||
|
270 | - confvolume:/etc/rhodecode/conf | |||
|
271 | - logvolume:/var/log/rhodecode | |||
|
272 | - rhodecode_repos:/var/opt/rhodecode_repo_store | |||
|
273 | ||||
|
274 | logging: | |||
|
275 | *custom-logging | |||
|
276 | ||||
|
277 | sshd: | |||
|
278 | networks: | |||
|
279 | - rhodecode_network | |||
|
280 | image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION:?specify-RC_VERSION-env-var} | |||
|
281 | env_file: | |||
|
282 | - .custom/.runtime.env | |||
|
283 | ||||
|
284 | stdin_open: true | |||
|
285 | tty: true | |||
|
286 | restart: always | |||
|
287 | command: ["/usr/sbin/sshd", "-f", "/etc/rhodecode/sshd_config", "-D", "-e"] | |||
|
288 | ||||
|
289 | environment: | |||
|
290 | RC_APP_TYPE: rhodecode_sshd | |||
|
291 | SSH_BOOTSTRAP: 1 | |||
|
292 | ||||
|
293 | # ports: | |||
|
294 | # # set from .env file | |||
|
295 | # - "${RC_SSH_PORT:?must-specify-ssh-port}:22" | |||
|
296 | ||||
|
297 | volumes: | |||
|
298 | - confvolume:/etc/rhodecode/conf | |||
|
299 | - logvolume:/var/log/rhodecode | |||
|
300 | - rhodecode_repos:/var/opt/rhodecode_repo_store | |||
|
301 | - rc_datavolume:/var/opt/rhodecode_data | |||
|
302 | ||||
|
303 | logging: | |||
|
304 | *custom-logging | |||
|
305 | ||||
|
306 | labels: | |||
|
307 | - "traefik.enable=true" | |||
|
308 | - "traefik.http.routers.sshd.entrypoints=ssh" | |||
|
309 | - "traefik.http.routers.sshd.rule=Host(`*`)" | |||
|
310 | - "traefik.http.services.sshd.loadbalancer.server.port=${RC_SSH_PORT:?must-specify-ssh-port}" | |||
|
311 | ||||
|
312 |
@@ -0,0 +1,46 b'' | |||||
|
1 | version: '3.9' | |||
|
2 | ||||
|
3 | ## Shared base stuff for all compose files in stack | |||
|
4 | ||||
|
5 | x-logging: &custom-logging | |||
|
6 | # docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions | |||
|
7 | # NOTE: loki logging driver ONLY works for host type networks... | |||
|
8 | driver: loki | |||
|
9 | options: | |||
|
10 | loki-url: "http://127.0.0.1:3100/loki/api/v1/push" | |||
|
11 | #loki-url: "http://loki:3100/loki/api/v1/push" | |||
|
12 | loki-retries: "5" | |||
|
13 | loki-timeout: "1s" | |||
|
14 | loki-max-backoff: "800ms" | |||
|
15 | ||||
|
16 | volumes: | |||
|
17 | # shared logvolume | |||
|
18 | logvolume: | |||
|
19 | driver: local | |||
|
20 | driver_opts: | |||
|
21 | type: none | |||
|
22 | o: bind | |||
|
23 | device: $PWD/logs | |||
|
24 | ||||
|
25 | # bind-mount with configs | |||
|
26 | confvolume: | |||
|
27 | driver: local | |||
|
28 | driver_opts: | |||
|
29 | type: none | |||
|
30 | o: bind | |||
|
31 | device: $PWD/config/_shared | |||
|
32 | ||||
|
33 | # SHARED volume for rhodecode caches, archive caches, nginx static, | |||
|
34 | # must be run via: docker volume create --name=rc_datavolume | |||
|
35 | rc_datavolume: | |||
|
36 | external: true | |||
|
37 | ||||
|
38 | networks: | |||
|
39 | ||||
|
40 | # SHARED network for all containers | |||
|
41 | # must be run via: docker network create --name=rhodecode_network | |||
|
42 | rhodecode_network: | |||
|
43 | name: rhodecode_network | |||
|
44 | driver: bridge | |||
|
45 | external: true | |||
|
46 |
@@ -0,0 +1,78 b'' | |||||
|
1 | version: '3.9' | |||
|
2 | ||||
|
3 | x-logging: &custom-logging | |||
|
4 | # docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions | |||
|
5 | # NOTE: loki logging driver ONLY works for host type networks... | |||
|
6 | driver: loki | |||
|
7 | options: | |||
|
8 | loki-url: "http://127.0.0.1:3100/loki/api/v1/push" | |||
|
9 | #loki-url: "http://loki:3100/loki/api/v1/push" | |||
|
10 | loki-retries: "5" | |||
|
11 | loki-timeout: "1s" | |||
|
12 | loki-max-backoff: "800ms" | |||
|
13 | ||||
|
14 | ## docker network create -d overlay lb-net | |||
|
15 | services: | |||
|
16 | ||||
|
17 | traefik: | |||
|
18 | ||||
|
19 | image: traefik:v2.9.5 | |||
|
20 | ||||
|
21 | ports: | |||
|
22 | # The HTTP port, exposed as http entrypoint | |||
|
23 | - "80:80" | |||
|
24 | # The HTTPS port, exposed as https entrypoint | |||
|
25 | - "443:443" | |||
|
26 | # The SSH port | |||
|
27 | - "${RC_SSH_PORT}:${RC_SSH_PORT}" | |||
|
28 | # The Web UI (enabled by --api.insecure=true) | |||
|
29 | # uncomment to expose dashboard at port :7000 | |||
|
30 | #- "7000:7000" | |||
|
31 | volumes: | |||
|
32 | # So that Traefik can listen to the Docker events | |||
|
33 | - /var/run/docker.sock:/var/run/docker.sock | |||
|
34 | - ./config/traefik:/etc/traefik | |||
|
35 | deploy: | |||
|
36 | placement: | |||
|
37 | constraints: | |||
|
38 | # limit swarm deploy to MANAGER only | |||
|
39 | - node.role == manager | |||
|
40 | networks: | |||
|
41 | - rhodecode_network | |||
|
42 | ||||
|
43 | labels: | |||
|
44 | - "traefik.enable=true" | |||
|
45 | ||||
|
46 | logging: | |||
|
47 | *custom-logging | |||
|
48 | ||||
|
49 | portainer: | |||
|
50 | # Run with COMPOSE_PROFILES=portainer | |||
|
51 | # to access portainer set HEADER `X-Docker-Host=portainer` | |||
|
52 | image: portainer/portainer-ce:latest | |||
|
53 | restart: always | |||
|
54 | volumes: | |||
|
55 | - portainer_data:/data | |||
|
56 | - /var/run/docker.sock:/var/run/docker.sock | |||
|
57 | deploy: | |||
|
58 | mode: replicated | |||
|
59 | replicas: 1 | |||
|
60 | placement: | |||
|
61 | constraints: | |||
|
62 | # limit swarm deploy to MANAGER only | |||
|
63 | - node.role == manager | |||
|
64 | ||||
|
65 | networks: | |||
|
66 | - rhodecode_network | |||
|
67 | labels: | |||
|
68 | - "traefik.enable=true" | |||
|
69 | - "traefik.http.services.portainer.loadbalancer.server.port=9000" | |||
|
70 | - "traefik.http.routers.portainer.entrypoints=https" | |||
|
71 | - "traefik.http.routers.portainer.rule=Headers(`X-Docker-Host`, `portainer`)" | |||
|
72 | ||||
|
73 | profiles: | |||
|
74 | ["portainer"] | |||
|
75 | ||||
|
76 | volumes: | |||
|
77 | portainer_data: | |||
|
78 | external: true No newline at end of file |
@@ -0,0 +1,240 b'' | |||||
|
1 | version: '3.9' | |||
|
2 | ||||
|
3 | x-logging: &custom-logging | |||
|
4 | # docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions | |||
|
5 | # NOTE: loki logging driver ONLY works for host type networks... | |||
|
6 | driver: loki | |||
|
7 | options: | |||
|
8 | loki-url: "http://127.0.0.1:3100/loki/api/v1/push" | |||
|
9 | #loki-url: "http://loki:3100/loki/api/v1/push" | |||
|
10 | loki-retries: "5" | |||
|
11 | loki-timeout: "1s" | |||
|
12 | loki-max-backoff: "800ms" | |||
|
13 | ||||
|
14 | volumes: | |||
|
15 | ||||
|
16 | # volume for redis data store | |||
|
17 | redis_data: | |||
|
18 | labels: | |||
|
19 | "keep": 1 | |||
|
20 | ||||
|
21 | # volume for Postgres db store | |||
|
22 | ||||
|
23 | # volume for Postgres Data | |||
|
24 | pg_data: | |||
|
25 | labels: | |||
|
26 | "keep": 1 | |||
|
27 | ||||
|
28 | # volume for rhodecode elasticsearch | |||
|
29 | es_data: | |||
|
30 | labels: | |||
|
31 | "keep": 1 | |||
|
32 | ||||
|
33 | ||||
|
34 | services: | |||
|
35 | ||||
|
36 | channelstream: | |||
|
37 | networks: | |||
|
38 | - rhodecode_network | |||
|
39 | image: channelstream/channelstream:0.7.1 | |||
|
40 | ||||
|
41 | restart: always | |||
|
42 | ||||
|
43 | # ports: | |||
|
44 | # - "127.0.0.1:9800:9800" | |||
|
45 | ||||
|
46 | command: ["channelstream", "-i", "/etc/rhodecode/conf/channelstream.ini"] | |||
|
47 | ||||
|
48 | environment: | |||
|
49 | CHANNELSTREAM_ALLOW_POSTING_FROM: 0.0.0.0 | |||
|
50 | ||||
|
51 | healthcheck: | |||
|
52 | test: [ "CMD", "curl", "-s", "-o", "/dev/null", "-w", "'%{http_code}'", "http://channelstream:8000/admin/sign_in" ] | |||
|
53 | timeout: 5s | |||
|
54 | interval: 60s | |||
|
55 | retries: 10 | |||
|
56 | ||||
|
57 | volumes: | |||
|
58 | - confvolume:/etc/rhodecode/conf | |||
|
59 | - logvolume:/var/log/rhodecode | |||
|
60 | ||||
|
61 | logging: | |||
|
62 | *custom-logging | |||
|
63 | ||||
|
64 | labels: | |||
|
65 | - "traefik.enable=false" | |||
|
66 | #- "traefik.http.routers.channelstream.entrypoints=http" | |||
|
67 | #- "traefik.http.services.channelstream.loadbalancer.server.port=9800" | |||
|
68 | ||||
|
69 | profiles: | |||
|
70 | ["channelstream"] | |||
|
71 | ||||
|
72 | nginx: | |||
|
73 | networks: | |||
|
74 | - rhodecode_network | |||
|
75 | image: library/nginx:1.23.2 | |||
|
76 | ||||
|
77 | restart: always | |||
|
78 | ||||
|
79 | environment: | |||
|
80 | NGINX_ENTRYPOINT_QUIET_LOGS: 1 | |||
|
81 | ||||
|
82 | healthcheck: | |||
|
83 | # change port 80 to 443 when only using SSL | |||
|
84 | test: [ "CMD", "curl", "-A", "RhodeCode-Healthcheck", "-s", "-o", "/dev/null", "-w", "'%{http_code}'", "http://127.0.0.1:80/_admin/ops/ping" ] | |||
|
85 | timeout: 30s | |||
|
86 | interval: 60s | |||
|
87 | retries: 10 | |||
|
88 | ||||
|
89 | # depends_on: | |||
|
90 | # - channelstream | |||
|
91 | ||||
|
92 | volumes: | |||
|
93 | - ./config/nginx/nginx.conf:/etc/nginx/nginx.conf:ro | |||
|
94 | - ./config/nginx/http.conf:/etc/nginx/http.conf:ro | |||
|
95 | - ./config/nginx/proxy.conf:/etc/nginx/proxy.conf:ro | |||
|
96 | - logvolume:/var/log/rhodecode | |||
|
97 | - rc_datavolume:/var/opt/rhodecode_data | |||
|
98 | ||||
|
99 | logging: | |||
|
100 | *custom-logging | |||
|
101 | ||||
|
102 | labels: | |||
|
103 | - "traefik.enable=true" | |||
|
104 | - "traefik.http.routers.nginx.entrypoints=http" | |||
|
105 | - "traefik.http.services.nginx.loadbalancer.server.port=80" | |||
|
106 | - "traefik.http.routers.nginx.rule=Host(`${RHODECODE_HOSTNAME:?must-specify-rhodecode-hostname}`)" | |||
|
107 | ||||
|
108 | elasticsearch: | |||
|
109 | networks: | |||
|
110 | - rhodecode_network | |||
|
111 | image: elasticsearch:6.8.23 | |||
|
112 | ||||
|
113 | environment: | |||
|
114 | - cluster.name=elasticsearch-cluster | |||
|
115 | - network.host=0.0.0.0 | |||
|
116 | - bootstrap.memory_lock=true | |||
|
117 | - discovery.type=single-node | |||
|
118 | - "ES_JAVA_OPTS=-Xms512m -Xmx512m" | |||
|
119 | healthcheck: | |||
|
120 | # change port 80 to 443 when only using SSL | |||
|
121 | test: [ "CMD", "curl", "-A", "RhodeCode-Healthcheck", "-s", "-o", "/dev/null", "-w", "'%{http_code}'", "elasticsearch:9200/_cat/health" ] | |||
|
122 | timeout: 30s | |||
|
123 | interval: 60s | |||
|
124 | retries: 10 | |||
|
125 | ||||
|
126 | ulimits: | |||
|
127 | memlock: | |||
|
128 | soft: -1 | |||
|
129 | hard: -1 | |||
|
130 | ||||
|
131 | volumes: | |||
|
132 | - es_data:/usr/share/elasticsearch/data | |||
|
133 | ||||
|
134 | logging: | |||
|
135 | *custom-logging | |||
|
136 | ||||
|
137 | profiles: | |||
|
138 | ["elasticsearch"] | |||
|
139 | ||||
|
140 | redis: | |||
|
141 | networks: | |||
|
142 | - rhodecode_network | |||
|
143 | image: library/redis:7.0.5 | |||
|
144 | ||||
|
145 | restart: always | |||
|
146 | command: | |||
|
147 | - "redis-server" | |||
|
148 | - "/etc/redis/redis.conf" | |||
|
149 | - "--maxmemory-policy allkeys-lru" | |||
|
150 | - "--maxmemory ${RC_REDIS_MAXMEMORY}" | |||
|
151 | ||||
|
152 | # ports: | |||
|
153 | # - "127.0.0.1::6379" | |||
|
154 | ||||
|
155 | healthcheck: | |||
|
156 | test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ] | |||
|
157 | interval: 60s | |||
|
158 | ||||
|
159 | volumes: | |||
|
160 | - ./config/redis/redis.conf:/etc/redis/redis.conf:ro | |||
|
161 | - logvolume:/var/log/rhodecode | |||
|
162 | - redis_data:/data | |||
|
163 | ||||
|
164 | profiles: | |||
|
165 | ["redis"] | |||
|
166 | ||||
|
167 | logging: | |||
|
168 | *custom-logging | |||
|
169 | ||||
|
170 | database: | |||
|
171 | networks: | |||
|
172 | - rhodecode_network | |||
|
173 | image: library/postgres:14.6 | |||
|
174 | ||||
|
175 | environment: | |||
|
176 | POSTGRES_DB: ${DB_NAME:?must-specify-db-name} | |||
|
177 | POSTGRES_USER: ${DB_USER:?must-specify-db-user} | |||
|
178 | PGUSER: ${DB_USER:?must-specify-db-user} | |||
|
179 | POSTGRES_PASSWORD: ${DB_PASSWORD:?must-specify-db-password} | |||
|
180 | POSTGRES_HOST_AUTH_METHOD: md5 | |||
|
181 | POSTGRES_INITDB_ARGS: "--auth-host=md5 --auth-local=md5" | |||
|
182 | ||||
|
183 | restart: unless-stopped | |||
|
184 | command: | |||
|
185 | - "postgres" | |||
|
186 | - "-c" | |||
|
187 | - "log_statement=ddl" | |||
|
188 | - "-c" | |||
|
189 | - "config_file=/etc/conf.d/pg_customized.conf" | |||
|
190 | ||||
|
191 | # ports: | |||
|
192 | # - "127.0.0.1::5432" | |||
|
193 | ||||
|
194 | healthcheck: | |||
|
195 | test: ["CMD-SHELL", "pg_isready", '-U', "$DB_USER"] | |||
|
196 | interval: 10s | |||
|
197 | timeout: 5s | |||
|
198 | retries: 5 | |||
|
199 | ||||
|
200 | volumes: | |||
|
201 | - $PWD/config/database/pg_customized.conf:/etc/conf.d/pg_customized.conf:ro | |||
|
202 | # db dumps reverse mount | |||
|
203 | - $PWD/.custom/db_dump:/var/rc-data-dump | |||
|
204 | # save the pg_data volume | |||
|
205 | - pg_data:/var/lib/postgresql/data | |||
|
206 | - logvolume:/var/log/rhodecode | |||
|
207 | ||||
|
208 | profiles: | |||
|
209 | ["postgres"] | |||
|
210 | ||||
|
211 | logging: | |||
|
212 | *custom-logging | |||
|
213 | ||||
|
214 | database-mysql: | |||
|
215 | networks: | |||
|
216 | - rhodecode_network | |||
|
217 | image: library/mysql:8.0.31 | |||
|
218 | ||||
|
219 | environment: | |||
|
220 | MYSQL_DATABASE: ${DB_NAME:?must-specify-db-name} | |||
|
221 | MYSQL_USER: ${DB_USER:?must-specify-db-user} | |||
|
222 | MYSQL_PASSWORD: ${DB_PASSWORD:?must-specify-db-password} | |||
|
223 | MYSQL_ROOT_PASSWORD: ${DB_PASSWORD:?must-specify-db-password} | |||
|
224 | ||||
|
225 | restart: unless-stopped | |||
|
226 | ||||
|
227 | # ports: | |||
|
228 | # - "127.0.0.1::3306" | |||
|
229 | ||||
|
230 | volumes: | |||
|
231 | - ./config/database/mysql_customized.conf:/etc/mysql/conf.d/config-file.cnf:ro | |||
|
232 | # save the mysql_data volume | |||
|
233 | - $PWD/mysql_dir:/var/lib/mysql | |||
|
234 | - logvolume:/var/log/rhodecode | |||
|
235 | ||||
|
236 | profiles: | |||
|
237 | ["mysql"] | |||
|
238 | ||||
|
239 | logging: | |||
|
240 | *custom-logging |
@@ -0,0 +1,1 b'' | |||||
|
1 | scripts/rccontrol/rccontrol No newline at end of file |
This diff has been collapsed as it changes many lines, (2889 lines changed) Show them Hide them | |||||
@@ -0,0 +1,2889 b'' | |||||
|
1 | #!/usr/bin/env bash | |||
|
2 | # This script was generated by bashly 0.8.10 (https://bashly.dannyb.co) | |||
|
3 | # Modifying it manually is not recommended | |||
|
4 | ||||
|
5 | # :wrapper.bash3_bouncer | |||
|
6 | if [[ "${BASH_VERSINFO:-0}" -lt 4 ]]; then | |||
|
7 | printf "bash version 4 or higher is required\n" >&2 | |||
|
8 | exit 1 | |||
|
9 | fi | |||
|
10 | ||||
|
11 | # :command.master_script | |||
|
12 | ||||
|
13 | # :command.version_command | |||
|
14 | version_command() { | |||
|
15 | echo "$version" | |||
|
16 | } | |||
|
17 | ||||
|
18 | # :command.usage | |||
|
19 | rccontrol_usage() { | |||
|
20 | if [[ -n $long_usage ]]; then | |||
|
21 | printf "rccontrol - RhodeCode Control - CLI for manaing RhodeCode Cluster Stack\n" | |||
|
22 | echo | |||
|
23 | ||||
|
24 | else | |||
|
25 | printf "rccontrol - RhodeCode Control - CLI for manaing RhodeCode Cluster Stack\n" | |||
|
26 | echo | |||
|
27 | ||||
|
28 | fi | |||
|
29 | ||||
|
30 | printf "Usage:\n" | |||
|
31 | printf " rccontrol [OPTIONS] COMMAND\n" | |||
|
32 | printf " rccontrol [COMMAND] --help | -h\n" | |||
|
33 | printf " rccontrol --version | -v\n" | |||
|
34 | echo | |||
|
35 | # :command.usage_commands | |||
|
36 | printf "Commands:\n" | |||
|
37 | echo " self-update update rccontrol and it's docker definitions" | |||
|
38 | echo " bootstrap Bootstrap this machine, check docker version and install rhodecode-network" | |||
|
39 | echo " stack run one of available cluster stacks, use -h for more details" | |||
|
40 | echo " stack-status show stack status" | |||
|
41 | echo " stack-upgrade upgrade ALL stack status" | |||
|
42 | echo | |||
|
43 | printf "Build Commands:\n" | |||
|
44 | echo " get-build-artifacts Fetch Artifacts to run installer based build" | |||
|
45 | echo " build Build RhodeCode image from installer" | |||
|
46 | echo " get-build-source Fetch RhodeCode sources, store in .source dir to run a source-based builds" | |||
|
47 | echo " build-source Build RhodeCode image from source, requires upgrade-source initially" | |||
|
48 | echo | |||
|
49 | printf "CLI Commands:\n" | |||
|
50 | echo " cli-redis CLI" | |||
|
51 | echo " cli-db CLI" | |||
|
52 | echo " cli-db-upgrade CLI" | |||
|
53 | echo | |||
|
54 | printf "Backup Commands:\n" | |||
|
55 | echo " backup-db CLI" | |||
|
56 | echo " backup-data CLI" | |||
|
57 | echo | |||
|
58 | ||||
|
59 | # :command.long_usage | |||
|
60 | if [[ -n $long_usage ]]; then | |||
|
61 | printf "Options:\n" | |||
|
62 | ||||
|
63 | # :command.usage_fixed_flags | |||
|
64 | echo " --help, -h" | |||
|
65 | printf " Show this help\n" | |||
|
66 | echo | |||
|
67 | echo " --version, -v" | |||
|
68 | printf " Show version number\n" | |||
|
69 | echo | |||
|
70 | ||||
|
71 | # :command.usage_flags | |||
|
72 | # :flag.usage | |||
|
73 | echo " --debug" | |||
|
74 | printf " Enable debug and detailed output\n" | |||
|
75 | echo | |||
|
76 | ||||
|
77 | # :command.usage_environment_variables | |||
|
78 | printf "Environment Variables:\n" | |||
|
79 | ||||
|
80 | # :environment_variable.usage | |||
|
81 | echo " AUTH_TOKEN" | |||
|
82 | printf " Set your RhodeCode AUTH Token\n" | |||
|
83 | echo | |||
|
84 | ||||
|
85 | # :environment_variable.usage | |||
|
86 | echo " RC_CLI_VERSION_NAME" | |||
|
87 | printf " default version to build and install\n" | |||
|
88 | printf " Default: 4.27.0\n" | |||
|
89 | echo | |||
|
90 | ||||
|
91 | # :environment_variable.usage | |||
|
92 | echo " RC_STACK_ROUTER_EXT" | |||
|
93 | printf "\n" | |||
|
94 | printf " Default: .custom/docker-compose-router.override.yaml\n" | |||
|
95 | echo | |||
|
96 | ||||
|
97 | # :environment_variable.usage | |||
|
98 | echo " RC_STACK_METRICS_EXT" | |||
|
99 | printf "\n" | |||
|
100 | printf " Default: .custom/docker-compose-metrics.override.yaml\n" | |||
|
101 | echo | |||
|
102 | ||||
|
103 | # :environment_variable.usage | |||
|
104 | echo " RC_STACK_SERVICES_EXT" | |||
|
105 | printf "\n" | |||
|
106 | printf " Default: .custom/docker-compose-services.override.yaml\n" | |||
|
107 | echo | |||
|
108 | ||||
|
109 | # :environment_variable.usage | |||
|
110 | echo " RC_STACK_RHODECODE_EXT" | |||
|
111 | printf "\n" | |||
|
112 | printf " Default: .custom/docker-compose-apps.override.yaml\n" | |||
|
113 | echo | |||
|
114 | ||||
|
115 | # :command.footer | |||
|
116 | printf "RhodeCode Inc 2022\n\n" | |||
|
117 | echo | |||
|
118 | ||||
|
119 | fi | |||
|
120 | } | |||
|
121 | ||||
|
122 | # :command.usage | |||
|
123 | rccontrol_self_update_usage() { | |||
|
124 | if [[ -n $long_usage ]]; then | |||
|
125 | printf "rccontrol self-update - update rccontrol and it's docker definitions\n" | |||
|
126 | echo | |||
|
127 | ||||
|
128 | else | |||
|
129 | printf "rccontrol self-update - update rccontrol and it's docker definitions\n" | |||
|
130 | echo | |||
|
131 | ||||
|
132 | fi | |||
|
133 | ||||
|
134 | printf "Usage:\n" | |||
|
135 | printf " rccontrol self-update [OPTIONS]\n" | |||
|
136 | printf " rccontrol self-update --help | -h\n" | |||
|
137 | echo | |||
|
138 | ||||
|
139 | # :command.long_usage | |||
|
140 | if [[ -n $long_usage ]]; then | |||
|
141 | printf "Options:\n" | |||
|
142 | ||||
|
143 | # :command.usage_fixed_flags | |||
|
144 | echo " --help, -h" | |||
|
145 | printf " Show this help\n" | |||
|
146 | echo | |||
|
147 | ||||
|
148 | # :command.usage_flags | |||
|
149 | # :flag.usage | |||
|
150 | echo " --auth-token AUTH_TOKEN" | |||
|
151 | printf " Optionally specify AUTH TOKEN to obtain sources\n" | |||
|
152 | echo | |||
|
153 | ||||
|
154 | # :flag.usage | |||
|
155 | echo " --server-url SERVER_URL" | |||
|
156 | printf " Specify RhodeCode server location where projects should be downloaded\n" | |||
|
157 | printf " Default: https://code.rhodecode.com\n" | |||
|
158 | echo | |||
|
159 | ||||
|
160 | fi | |||
|
161 | } | |||
|
162 | ||||
|
163 | # :command.usage | |||
|
164 | rccontrol_bootstrap_usage() { | |||
|
165 | if [[ -n $long_usage ]]; then | |||
|
166 | printf "rccontrol bootstrap - Bootstrap this machine, check docker version and install rhodecode-network\n" | |||
|
167 | echo | |||
|
168 | ||||
|
169 | else | |||
|
170 | printf "rccontrol bootstrap - Bootstrap this machine, check docker version and install rhodecode-network\n" | |||
|
171 | echo | |||
|
172 | ||||
|
173 | fi | |||
|
174 | ||||
|
175 | printf "Alias: install\n" | |||
|
176 | echo | |||
|
177 | ||||
|
178 | printf "Usage:\n" | |||
|
179 | printf " rccontrol bootstrap [OPTIONS]\n" | |||
|
180 | printf " rccontrol bootstrap --help | -h\n" | |||
|
181 | echo | |||
|
182 | ||||
|
183 | # :command.long_usage | |||
|
184 | if [[ -n $long_usage ]]; then | |||
|
185 | printf "Options:\n" | |||
|
186 | ||||
|
187 | # :command.usage_fixed_flags | |||
|
188 | echo " --help, -h" | |||
|
189 | printf " Show this help\n" | |||
|
190 | echo | |||
|
191 | ||||
|
192 | # :command.usage_flags | |||
|
193 | # :flag.usage | |||
|
194 | echo " --force, -f" | |||
|
195 | printf " Overwrite existing files\n" | |||
|
196 | echo | |||
|
197 | ||||
|
198 | # :flag.usage | |||
|
199 | echo " --auth-token AUTH_TOKEN" | |||
|
200 | printf " Optionally specify AUTH TOKEN to obtain sources\n" | |||
|
201 | echo | |||
|
202 | ||||
|
203 | # :flag.usage | |||
|
204 | echo " --server-url SERVER_URL" | |||
|
205 | printf " Specify RhodeCode server location where projects should be downloaded\n" | |||
|
206 | printf " Default: https://code.rhodecode.com\n" | |||
|
207 | echo | |||
|
208 | ||||
|
209 | # :command.usage_examples | |||
|
210 | printf "Examples:\n" | |||
|
211 | printf " rccontrol3 bootstrap\n" | |||
|
212 | printf " rccontrol3 bootstrap --force\n" | |||
|
213 | echo | |||
|
214 | ||||
|
215 | fi | |||
|
216 | } | |||
|
217 | ||||
|
218 | # :command.usage | |||
|
219 | rccontrol_get_build_artifacts_usage() { | |||
|
220 | if [[ -n $long_usage ]]; then | |||
|
221 | printf "rccontrol get-build-artifacts - Fetch Artifacts to run installer based build\n" | |||
|
222 | echo | |||
|
223 | ||||
|
224 | else | |||
|
225 | printf "rccontrol get-build-artifacts - Fetch Artifacts to run installer based build\n" | |||
|
226 | echo | |||
|
227 | ||||
|
228 | fi | |||
|
229 | ||||
|
230 | printf "Usage:\n" | |||
|
231 | printf " rccontrol get-build-artifacts [OPTIONS]\n" | |||
|
232 | printf " rccontrol get-build-artifacts --help | -h\n" | |||
|
233 | echo | |||
|
234 | ||||
|
235 | # :command.long_usage | |||
|
236 | if [[ -n $long_usage ]]; then | |||
|
237 | printf "Options:\n" | |||
|
238 | ||||
|
239 | # :command.usage_fixed_flags | |||
|
240 | echo " --help, -h" | |||
|
241 | printf " Show this help\n" | |||
|
242 | echo | |||
|
243 | ||||
|
244 | # :command.usage_flags | |||
|
245 | # :flag.usage | |||
|
246 | echo " --auth AUTH" | |||
|
247 | printf " Specify custom auth for curl e.g -u admin:secret\n" | |||
|
248 | printf " Default: \n" | |||
|
249 | echo | |||
|
250 | ||||
|
251 | # :flag.usage | |||
|
252 | echo " --installer-url INSTALLER_URL" | |||
|
253 | printf " Installer Download URL\n" | |||
|
254 | printf " Default: https://dls.rhodecode.com/dls/N2E2ZTY1NzA3NjYxNDA2NTc1NjI3MTcyNzA2MjcxNzIyZTcwNjI3YQ==/rhodecode-control/latest-linux-ee\n" | |||
|
255 | echo | |||
|
256 | ||||
|
257 | # :flag.usage | |||
|
258 | echo " --manifest-url MANIFEST_URL" | |||
|
259 | printf " Manifest file url\n" | |||
|
260 | printf " Default: https://dls.rhodecode.com/linux/MANIFEST\n" | |||
|
261 | echo | |||
|
262 | ||||
|
263 | # :flag.usage | |||
|
264 | echo " --version-name VERSION_NAME" | |||
|
265 | printf " Specify custom build ver e.g $RC_CLI_VERSION_NAME\n" | |||
|
266 | printf " Default: $RC_CLI_VERSION_NAME\n" | |||
|
267 | echo | |||
|
268 | ||||
|
269 | fi | |||
|
270 | } | |||
|
271 | ||||
|
272 | # :command.usage | |||
|
273 | rccontrol_build_usage() { | |||
|
274 | if [[ -n $long_usage ]]; then | |||
|
275 | printf "rccontrol build - Build RhodeCode image from installer\n" | |||
|
276 | echo | |||
|
277 | ||||
|
278 | else | |||
|
279 | printf "rccontrol build - Build RhodeCode image from installer\n" | |||
|
280 | echo | |||
|
281 | ||||
|
282 | fi | |||
|
283 | ||||
|
284 | printf "Usage:\n" | |||
|
285 | printf " rccontrol build [OPTIONS]\n" | |||
|
286 | printf " rccontrol build --help | -h\n" | |||
|
287 | echo | |||
|
288 | ||||
|
289 | # :command.long_usage | |||
|
290 | if [[ -n $long_usage ]]; then | |||
|
291 | printf "Options:\n" | |||
|
292 | ||||
|
293 | # :command.usage_fixed_flags | |||
|
294 | echo " --help, -h" | |||
|
295 | printf " Show this help\n" | |||
|
296 | echo | |||
|
297 | ||||
|
298 | # :command.usage_flags | |||
|
299 | # :flag.usage | |||
|
300 | echo " --version-name VERSION_NAME" | |||
|
301 | printf " Specify custom build ver e.g $RC_CLI_VERSION_NAME\n" | |||
|
302 | printf " Default: $RC_CLI_VERSION_NAME\n" | |||
|
303 | echo | |||
|
304 | ||||
|
305 | fi | |||
|
306 | } | |||
|
307 | ||||
|
308 | # :command.usage | |||
|
309 | rccontrol_get_build_source_usage() { | |||
|
310 | if [[ -n $long_usage ]]; then | |||
|
311 | printf "rccontrol get-build-source - Fetch RhodeCode sources, store in .source dir to run a source-based builds\n" | |||
|
312 | echo | |||
|
313 | ||||
|
314 | else | |||
|
315 | printf "rccontrol get-build-source - Fetch RhodeCode sources, store in .source dir to run a source-based builds\n" | |||
|
316 | echo | |||
|
317 | ||||
|
318 | fi | |||
|
319 | ||||
|
320 | printf "Usage:\n" | |||
|
321 | printf " rccontrol get-build-source REVISION [OPTIONS]\n" | |||
|
322 | printf " rccontrol get-build-source --help | -h\n" | |||
|
323 | echo | |||
|
324 | ||||
|
325 | # :command.long_usage | |||
|
326 | if [[ -n $long_usage ]]; then | |||
|
327 | printf "Options:\n" | |||
|
328 | ||||
|
329 | # :command.usage_fixed_flags | |||
|
330 | echo " --help, -h" | |||
|
331 | printf " Show this help\n" | |||
|
332 | echo | |||
|
333 | ||||
|
334 | # :command.usage_flags | |||
|
335 | # :flag.usage | |||
|
336 | echo " --auth-token AUTH_TOKEN" | |||
|
337 | printf " Specify AUTH TOKEN to obtain sources\n" | |||
|
338 | echo | |||
|
339 | ||||
|
340 | # :flag.usage | |||
|
341 | echo " --server-url SERVER_URL" | |||
|
342 | printf " Specify RhodeCode server location where projects should be downloaded\n" | |||
|
343 | printf " Default: https://code.rhodecode.com\n" | |||
|
344 | echo | |||
|
345 | ||||
|
346 | # :command.usage_args | |||
|
347 | printf "Arguments:\n" | |||
|
348 | ||||
|
349 | # :argument.usage | |||
|
350 | echo " REVISION" | |||
|
351 | printf " revision to download\n" | |||
|
352 | echo | |||
|
353 | ||||
|
354 | # :command.usage_examples | |||
|
355 | printf "Examples:\n" | |||
|
356 | printf " rccontrol3 get-sources $RC_CLI_VERSION_NAME\n" | |||
|
357 | printf " rccontrol3 get-sources default --auth-token xyxyxyx --server-url\n https://secret.repo/\n" | |||
|
358 | echo | |||
|
359 | ||||
|
360 | fi | |||
|
361 | } | |||
|
362 | ||||
|
363 | # :command.usage | |||
|
364 | rccontrol_build_source_usage() { | |||
|
365 | if [[ -n $long_usage ]]; then | |||
|
366 | printf "rccontrol build-source - Build RhodeCode image from source, requires upgrade-source initially\n" | |||
|
367 | echo | |||
|
368 | ||||
|
369 | else | |||
|
370 | printf "rccontrol build-source - Build RhodeCode image from source, requires upgrade-source initially\n" | |||
|
371 | echo | |||
|
372 | ||||
|
373 | fi | |||
|
374 | ||||
|
375 | printf "Usage:\n" | |||
|
376 | printf " rccontrol build-source [OPTIONS]\n" | |||
|
377 | printf " rccontrol build-source --help | -h\n" | |||
|
378 | echo | |||
|
379 | ||||
|
380 | # :command.long_usage | |||
|
381 | if [[ -n $long_usage ]]; then | |||
|
382 | printf "Options:\n" | |||
|
383 | ||||
|
384 | # :command.usage_fixed_flags | |||
|
385 | echo " --help, -h" | |||
|
386 | printf " Show this help\n" | |||
|
387 | echo | |||
|
388 | ||||
|
389 | # :command.usage_flags | |||
|
390 | # :flag.usage | |||
|
391 | echo " --version-name VERSION_NAME" | |||
|
392 | printf " Specify custom build ver e.g $RC_CLI_VERSION_NAME\n" | |||
|
393 | printf " Default: $RC_CLI_VERSION_NAME\n" | |||
|
394 | echo | |||
|
395 | ||||
|
396 | # :command.usage_examples | |||
|
397 | printf "Examples:\n" | |||
|
398 | printf " build foo\n" | |||
|
399 | echo | |||
|
400 | ||||
|
401 | fi | |||
|
402 | } | |||
|
403 | ||||
|
404 | # :command.usage | |||
|
405 | rccontrol_stack_usage() { | |||
|
406 | if [[ -n $long_usage ]]; then | |||
|
407 | printf "rccontrol stack - run one of available cluster stacks, use -h for more details\n" | |||
|
408 | echo | |||
|
409 | ||||
|
410 | else | |||
|
411 | printf "rccontrol stack - run one of available cluster stacks, use -h for more details\n" | |||
|
412 | echo | |||
|
413 | ||||
|
414 | fi | |||
|
415 | ||||
|
416 | printf "Usage:\n" | |||
|
417 | printf " rccontrol stack NAME [SERVICES PARAMS...]\n" | |||
|
418 | printf " rccontrol stack --help | -h\n" | |||
|
419 | echo | |||
|
420 | ||||
|
421 | # :command.long_usage | |||
|
422 | if [[ -n $long_usage ]]; then | |||
|
423 | printf "Options:\n" | |||
|
424 | ||||
|
425 | # :command.usage_fixed_flags | |||
|
426 | echo " --help, -h" | |||
|
427 | printf " Show this help\n" | |||
|
428 | echo | |||
|
429 | ||||
|
430 | # :command.usage_args | |||
|
431 | printf "Arguments:\n" | |||
|
432 | ||||
|
433 | # :argument.usage | |||
|
434 | echo " NAME" | |||
|
435 | printf " Stack name\n" | |||
|
436 | printf " Allowed: router, metrics, services, rhodecode\n" | |||
|
437 | echo | |||
|
438 | ||||
|
439 | echo " SERVICES PARAMS..." | |||
|
440 | printf " Additional arguments or flags for services command\n" | |||
|
441 | echo | |||
|
442 | ||||
|
443 | # :command.usage_examples | |||
|
444 | printf "Examples:\n" | |||
|
445 | printf " - ./rccontrol3 stack router up # run router stack with output to\n console\n - ./rccontrol3 stack router up --detach # run router stack detached\n - ./rccontrol3 stack router down # stop whole router stack\n - ./rccontrol3 stack router ps # check status of router stack\n - ./rccontrol3 stack router -f docker-overrides.yaml up -d # run router stack\n with your overrides\n" | |||
|
446 | echo | |||
|
447 | ||||
|
448 | fi | |||
|
449 | } | |||
|
450 | ||||
|
451 | # :command.usage | |||
|
452 | rccontrol_stack_status_usage() { | |||
|
453 | if [[ -n $long_usage ]]; then | |||
|
454 | printf "rccontrol stack-status - show stack status\n" | |||
|
455 | echo | |||
|
456 | ||||
|
457 | else | |||
|
458 | printf "rccontrol stack-status - show stack status\n" | |||
|
459 | echo | |||
|
460 | ||||
|
461 | fi | |||
|
462 | ||||
|
463 | printf "Alias: status\n" | |||
|
464 | echo | |||
|
465 | ||||
|
466 | printf "Usage:\n" | |||
|
467 | printf " rccontrol stack-status\n" | |||
|
468 | printf " rccontrol stack-status --help | -h\n" | |||
|
469 | echo | |||
|
470 | ||||
|
471 | # :command.long_usage | |||
|
472 | if [[ -n $long_usage ]]; then | |||
|
473 | printf "Options:\n" | |||
|
474 | ||||
|
475 | # :command.usage_fixed_flags | |||
|
476 | echo " --help, -h" | |||
|
477 | printf " Show this help\n" | |||
|
478 | echo | |||
|
479 | ||||
|
480 | fi | |||
|
481 | } | |||
|
482 | ||||
|
483 | # :command.usage | |||
|
484 | rccontrol_stack_upgrade_usage() { | |||
|
485 | if [[ -n $long_usage ]]; then | |||
|
486 | printf "rccontrol stack-upgrade - upgrade ALL stack status\n" | |||
|
487 | echo | |||
|
488 | ||||
|
489 | else | |||
|
490 | printf "rccontrol stack-upgrade - upgrade ALL stack status\n" | |||
|
491 | echo | |||
|
492 | ||||
|
493 | fi | |||
|
494 | ||||
|
495 | printf "Usage:\n" | |||
|
496 | printf " rccontrol stack-upgrade\n" | |||
|
497 | printf " rccontrol stack-upgrade --help | -h\n" | |||
|
498 | echo | |||
|
499 | ||||
|
500 | # :command.long_usage | |||
|
501 | if [[ -n $long_usage ]]; then | |||
|
502 | printf "Options:\n" | |||
|
503 | ||||
|
504 | # :command.usage_fixed_flags | |||
|
505 | echo " --help, -h" | |||
|
506 | printf " Show this help\n" | |||
|
507 | echo | |||
|
508 | ||||
|
509 | fi | |||
|
510 | } | |||
|
511 | ||||
|
512 | # :command.usage | |||
|
513 | rccontrol_cli_redis_usage() { | |||
|
514 | if [[ -n $long_usage ]]; then | |||
|
515 | printf "rccontrol cli-redis - CLI\n" | |||
|
516 | echo | |||
|
517 | ||||
|
518 | else | |||
|
519 | printf "rccontrol cli-redis - CLI\n" | |||
|
520 | echo | |||
|
521 | ||||
|
522 | fi | |||
|
523 | ||||
|
524 | printf "Usage:\n" | |||
|
525 | printf " rccontrol cli-redis\n" | |||
|
526 | printf " rccontrol cli-redis --help | -h\n" | |||
|
527 | echo | |||
|
528 | ||||
|
529 | # :command.long_usage | |||
|
530 | if [[ -n $long_usage ]]; then | |||
|
531 | printf "Options:\n" | |||
|
532 | ||||
|
533 | # :command.usage_fixed_flags | |||
|
534 | echo " --help, -h" | |||
|
535 | printf " Show this help\n" | |||
|
536 | echo | |||
|
537 | ||||
|
538 | fi | |||
|
539 | } | |||
|
540 | ||||
|
541 | # :command.usage | |||
|
542 | rccontrol_cli_db_usage() { | |||
|
543 | if [[ -n $long_usage ]]; then | |||
|
544 | printf "rccontrol cli-db - CLI\n" | |||
|
545 | echo | |||
|
546 | ||||
|
547 | else | |||
|
548 | printf "rccontrol cli-db - CLI\n" | |||
|
549 | echo | |||
|
550 | ||||
|
551 | fi | |||
|
552 | ||||
|
553 | printf "Usage:\n" | |||
|
554 | printf " rccontrol cli-db\n" | |||
|
555 | printf " rccontrol cli-db --help | -h\n" | |||
|
556 | echo | |||
|
557 | ||||
|
558 | # :command.long_usage | |||
|
559 | if [[ -n $long_usage ]]; then | |||
|
560 | printf "Options:\n" | |||
|
561 | ||||
|
562 | # :command.usage_fixed_flags | |||
|
563 | echo " --help, -h" | |||
|
564 | printf " Show this help\n" | |||
|
565 | echo | |||
|
566 | ||||
|
567 | fi | |||
|
568 | } | |||
|
569 | ||||
|
570 | # :command.usage | |||
|
571 | rccontrol_cli_db_upgrade_usage() { | |||
|
572 | if [[ -n $long_usage ]]; then | |||
|
573 | printf "rccontrol cli-db-upgrade - CLI\n" | |||
|
574 | echo | |||
|
575 | ||||
|
576 | else | |||
|
577 | printf "rccontrol cli-db-upgrade - CLI\n" | |||
|
578 | echo | |||
|
579 | ||||
|
580 | fi | |||
|
581 | ||||
|
582 | printf "Usage:\n" | |||
|
583 | printf " rccontrol cli-db-upgrade\n" | |||
|
584 | printf " rccontrol cli-db-upgrade --help | -h\n" | |||
|
585 | echo | |||
|
586 | ||||
|
587 | # :command.long_usage | |||
|
588 | if [[ -n $long_usage ]]; then | |||
|
589 | printf "Options:\n" | |||
|
590 | ||||
|
591 | # :command.usage_fixed_flags | |||
|
592 | echo " --help, -h" | |||
|
593 | printf " Show this help\n" | |||
|
594 | echo | |||
|
595 | ||||
|
596 | fi | |||
|
597 | } | |||
|
598 | ||||
|
599 | # :command.usage | |||
|
600 | rccontrol__completions_usage() { | |||
|
601 | if [[ -n $long_usage ]]; then | |||
|
602 | printf "rccontrol _completions - Generate completions, eval "$(./rccontrol _completions)"\n" | |||
|
603 | echo | |||
|
604 | ||||
|
605 | else | |||
|
606 | printf "rccontrol _completions - Generate completions, eval "$(./rccontrol _completions)"\n" | |||
|
607 | echo | |||
|
608 | ||||
|
609 | fi | |||
|
610 | ||||
|
611 | printf "Usage:\n" | |||
|
612 | printf " rccontrol _completions\n" | |||
|
613 | printf " rccontrol _completions --help | -h\n" | |||
|
614 | echo | |||
|
615 | ||||
|
616 | # :command.long_usage | |||
|
617 | if [[ -n $long_usage ]]; then | |||
|
618 | printf "Options:\n" | |||
|
619 | ||||
|
620 | # :command.usage_fixed_flags | |||
|
621 | echo " --help, -h" | |||
|
622 | printf " Show this help\n" | |||
|
623 | echo | |||
|
624 | ||||
|
625 | fi | |||
|
626 | } | |||
|
627 | ||||
|
628 | # :command.usage | |||
|
629 | rccontrol_backup_db_usage() { | |||
|
630 | if [[ -n $long_usage ]]; then | |||
|
631 | printf "rccontrol backup-db - CLI\n" | |||
|
632 | echo | |||
|
633 | ||||
|
634 | else | |||
|
635 | printf "rccontrol backup-db - CLI\n" | |||
|
636 | echo | |||
|
637 | ||||
|
638 | fi | |||
|
639 | ||||
|
640 | printf "Usage:\n" | |||
|
641 | printf " rccontrol backup-db\n" | |||
|
642 | printf " rccontrol backup-db --help | -h\n" | |||
|
643 | echo | |||
|
644 | ||||
|
645 | # :command.long_usage | |||
|
646 | if [[ -n $long_usage ]]; then | |||
|
647 | printf "Options:\n" | |||
|
648 | ||||
|
649 | # :command.usage_fixed_flags | |||
|
650 | echo " --help, -h" | |||
|
651 | printf " Show this help\n" | |||
|
652 | echo | |||
|
653 | ||||
|
654 | # :command.usage_examples | |||
|
655 | printf "Examples:\n" | |||
|
656 | printf " ./rccontrol backup-db\n" | |||
|
657 | echo | |||
|
658 | ||||
|
659 | fi | |||
|
660 | } | |||
|
661 | ||||
|
662 | # :command.usage | |||
|
663 | rccontrol_backup_data_usage() { | |||
|
664 | if [[ -n $long_usage ]]; then | |||
|
665 | printf "rccontrol backup-data - CLI\n" | |||
|
666 | echo | |||
|
667 | ||||
|
668 | else | |||
|
669 | printf "rccontrol backup-data - CLI\n" | |||
|
670 | echo | |||
|
671 | ||||
|
672 | fi | |||
|
673 | ||||
|
674 | printf "Usage:\n" | |||
|
675 | printf " rccontrol backup-data\n" | |||
|
676 | printf " rccontrol backup-data --help | -h\n" | |||
|
677 | echo | |||
|
678 | ||||
|
679 | # :command.long_usage | |||
|
680 | if [[ -n $long_usage ]]; then | |||
|
681 | printf "Options:\n" | |||
|
682 | ||||
|
683 | # :command.usage_fixed_flags | |||
|
684 | echo " --help, -h" | |||
|
685 | printf " Show this help\n" | |||
|
686 | echo | |||
|
687 | ||||
|
688 | fi | |||
|
689 | } | |||
|
690 | ||||
|
691 | # :command.normalize_input | |||
|
692 | normalize_input() { | |||
|
693 | local arg flags | |||
|
694 | ||||
|
695 | while [[ $# -gt 0 ]]; do | |||
|
696 | arg="$1" | |||
|
697 | if [[ $arg =~ ^(--[a-zA-Z0-9_\-]+)=(.+)$ ]]; then | |||
|
698 | input+=("${BASH_REMATCH[1]}") | |||
|
699 | input+=("${BASH_REMATCH[2]}") | |||
|
700 | elif [[ $arg =~ ^(-[a-zA-Z0-9])=(.+)$ ]]; then | |||
|
701 | input+=("${BASH_REMATCH[1]}") | |||
|
702 | input+=("${BASH_REMATCH[2]}") | |||
|
703 | elif [[ $arg =~ ^-([a-zA-Z0-9][a-zA-Z0-9]+)$ ]]; then | |||
|
704 | flags="${BASH_REMATCH[1]}" | |||
|
705 | for (( i=0 ; i < ${#flags} ; i++ )); do | |||
|
706 | input+=("-${flags:i:1}") | |||
|
707 | done | |||
|
708 | else | |||
|
709 | input+=("$arg") | |||
|
710 | fi | |||
|
711 | ||||
|
712 | shift | |||
|
713 | done | |||
|
714 | } | |||
|
715 | # :command.inspect_args | |||
|
716 | inspect_args() { | |||
|
717 | readarray -t sorted_keys < <(printf '%s\n' "${!args[@]}" | sort) | |||
|
718 | if (( ${#args[@]} )); then | |||
|
719 | echo args: | |||
|
720 | for k in "${sorted_keys[@]}"; do echo "- \${args[$k]} = ${args[$k]}"; done | |||
|
721 | else | |||
|
722 | echo args: none | |||
|
723 | fi | |||
|
724 | ||||
|
725 | if (( ${#other_args[@]} )); then | |||
|
726 | echo | |||
|
727 | echo other_args: | |||
|
728 | echo "- \${other_args[*]} = ${other_args[*]}" | |||
|
729 | for i in "${!other_args[@]}"; do | |||
|
730 | echo "- \${other_args[$i]} = ${other_args[$i]}" | |||
|
731 | done | |||
|
732 | fi | |||
|
733 | } | |||
|
734 | ||||
|
735 | # :command.user_lib | |||
|
736 | # src/lib/colors.sh | |||
|
737 | print_in_color() { | |||
|
738 | local color="$1" | |||
|
739 | shift | |||
|
740 | if [[ -z ${NO_COLOR+x} ]]; then | |||
|
741 | printf "$color%b\e[0m\n" "$*"; | |||
|
742 | else | |||
|
743 | printf "%b\n" "$*"; | |||
|
744 | fi | |||
|
745 | } | |||
|
746 | ||||
|
747 | red() { print_in_color "\e[31m" "$*"; } | |||
|
748 | green() { print_in_color "\e[32m" "$*"; } | |||
|
749 | yellow() { print_in_color "\e[33m" "$*"; } | |||
|
750 | blue() { print_in_color "\e[34m" "$*"; } | |||
|
751 | magenta() { print_in_color "\e[35m" "$*"; } | |||
|
752 | cyan() { print_in_color "\e[36m" "$*"; } | |||
|
753 | bold() { print_in_color "\e[1m" "$*"; } | |||
|
754 | underlined() { print_in_color "\e[4m" "$*"; } | |||
|
755 | red_bold() { print_in_color "\e[1;31m" "$*"; } | |||
|
756 | green_bold() { print_in_color "\e[1;32m" "$*"; } | |||
|
757 | yellow_bold() { print_in_color "\e[1;33m" "$*"; } | |||
|
758 | blue_bold() { print_in_color "\e[1;34m" "$*"; } | |||
|
759 | magenta_bold() { print_in_color "\e[1;35m" "$*"; } | |||
|
760 | cyan_bold() { print_in_color "\e[1;36m" "$*"; } | |||
|
761 | red_underlined() { print_in_color "\e[4;31m" "$*"; } | |||
|
762 | green_underlined() { print_in_color "\e[4;32m" "$*"; } | |||
|
763 | yellow_underlined() { print_in_color "\e[4;33m" "$*"; } | |||
|
764 | blue_underlined() { print_in_color "\e[4;34m" "$*"; } | |||
|
765 | magenta_underlined() { print_in_color "\e[4;35m" "$*"; } | |||
|
766 | cyan_underlined() { print_in_color "\e[4;36m" "$*"; } | |||
|
767 | ||||
|
768 | # src/lib/config.sh | |||
|
769 | config_init() { | |||
|
770 | CONFIG_FILE=${CONFIG_FILE:=config.ini} | |||
|
771 | [[ -f "$CONFIG_FILE" ]] || touch "$CONFIG_FILE" | |||
|
772 | } | |||
|
773 | ||||
|
774 | config_get() { | |||
|
775 | local key=$1 | |||
|
776 | local regex="^$key *= *(.+)$" | |||
|
777 | local value="" | |||
|
778 | ||||
|
779 | config_init | |||
|
780 | ||||
|
781 | while IFS= read -r line || [ -n "$line" ]; do | |||
|
782 | if [[ $line =~ $regex ]]; then | |||
|
783 | value="${BASH_REMATCH[1]}" | |||
|
784 | break | |||
|
785 | fi | |||
|
786 | done < "$CONFIG_FILE" | |||
|
787 | ||||
|
788 | echo "$value" | |||
|
789 | } | |||
|
790 | ||||
|
791 | config_set() { | |||
|
792 | local key=$1 | |||
|
793 | shift | |||
|
794 | local value="$*" | |||
|
795 | ||||
|
796 | config_init | |||
|
797 | ||||
|
798 | local regex="^($key) *= *.+$" | |||
|
799 | local output="" | |||
|
800 | local found_key="" | |||
|
801 | local newline | |||
|
802 | ||||
|
803 | while IFS= read -r line || [ -n "$line" ]; do | |||
|
804 | newline=$line | |||
|
805 | if [[ $line =~ $regex ]]; then | |||
|
806 | found_key="${BASH_REMATCH[1]}" | |||
|
807 | newline="$key = $value" | |||
|
808 | output="$output$newline\n" | |||
|
809 | elif [[ $line ]]; then | |||
|
810 | output="$output$line\n" | |||
|
811 | fi | |||
|
812 | done < "$CONFIG_FILE" | |||
|
813 | ||||
|
814 | if [[ -z $found_key ]]; then | |||
|
815 | output="$output$key = $value\n" | |||
|
816 | fi | |||
|
817 | ||||
|
818 | printf "%b\n" "$output" > "$CONFIG_FILE" | |||
|
819 | } | |||
|
820 | ||||
|
821 | config_del() { | |||
|
822 | local key=$1 | |||
|
823 | ||||
|
824 | local regex="^($key) *=" | |||
|
825 | local output="" | |||
|
826 | ||||
|
827 | config_init | |||
|
828 | ||||
|
829 | while IFS= read -r line || [ -n "$line" ]; do | |||
|
830 | if [[ $line ]] && [[ ! $line =~ $regex ]]; then | |||
|
831 | output="$output$line\n" | |||
|
832 | fi | |||
|
833 | done < "$CONFIG_FILE" | |||
|
834 | ||||
|
835 | printf "%b\n" "$output" > "$CONFIG_FILE" | |||
|
836 | } | |||
|
837 | ||||
|
838 | config_show() { | |||
|
839 | config_init | |||
|
840 | cat "$CONFIG_FILE" | |||
|
841 | } | |||
|
842 | ||||
|
843 | config_keys() { | |||
|
844 | local regex="^([a-zA-Z0-9_\-\/\.]+) *=" | |||
|
845 | ||||
|
846 | config_init | |||
|
847 | ||||
|
848 | local keys=() | |||
|
849 | local key | |||
|
850 | ||||
|
851 | while IFS= read -r line || [ -n "$line" ]; do | |||
|
852 | if [[ $line =~ $regex ]]; then | |||
|
853 | key="${BASH_REMATCH[1]}" | |||
|
854 | keys+=("$key") | |||
|
855 | fi | |||
|
856 | done < "$CONFIG_FILE" | |||
|
857 | echo "${keys[@]}" | |||
|
858 | } | |||
|
859 | ||||
|
860 | config_has_key() { | |||
|
861 | [[ $(config_get "$1") ]] | |||
|
862 | } | |||
|
863 | ||||
|
864 | # src/lib/sample_function.sh | |||
|
865 | ||||
|
866 | docker_ping_host() { | |||
|
867 | PING_HOST="$1" | |||
|
868 | docker run --network rhodecode_network --rm alpine ping "$PING_HOST" | |||
|
869 | } | |||
|
870 | ||||
|
871 | check_bootstrap() { | |||
|
872 | # Avoid destroying bootstrapping by simple start/stop | |||
|
873 | if [[ ! -e $BOOTSTRAP_FILE ]]; then | |||
|
874 | echo "$(yellow WARNING:) initial bootstrap file $BOOTSTRAP_FILE not found !" | |||
|
875 | echo "$(yellow NOTICE:) Please run ./rccontrol bootstrap first" | |||
|
876 | exit | |||
|
877 | fi | |||
|
878 | } | |||
|
879 | ||||
|
880 | # src/lib/send_completions.sh | |||
|
881 | send_completions() { | |||
|
882 | echo $'# rccontrol3 completion -*- shell-script -*-' | |||
|
883 | echo $'' | |||
|
884 | echo $'# This bash completions script was generated by' | |||
|
885 | echo $'# completely (https://github.com/dannyben/completely)' | |||
|
886 | echo $'# Modifying it manually is not recommended' | |||
|
887 | echo $'' | |||
|
888 | echo $'_rccontrol3_completions_filter() {' | |||
|
889 | echo $' local words="$1"' | |||
|
890 | echo $' local cur=${COMP_WORDS[COMP_CWORD]}' | |||
|
891 | echo $' local result=()' | |||
|
892 | echo $'' | |||
|
893 | echo $' if [[ "${cur:0:1}" == "-" ]]; then' | |||
|
894 | echo $' echo "$words"' | |||
|
895 | echo $' ' | |||
|
896 | echo $' else' | |||
|
897 | echo $' for word in $words; do' | |||
|
898 | echo $' [[ "${word:0:1}" != "-" ]] && result+=("$word")' | |||
|
899 | echo $' done' | |||
|
900 | echo $'' | |||
|
901 | echo $' echo "${result[*]}"' | |||
|
902 | echo $'' | |||
|
903 | echo $' fi' | |||
|
904 | echo $'}' | |||
|
905 | echo $'' | |||
|
906 | echo $'_rccontrol3_completions() {' | |||
|
907 | echo $' local cur=${COMP_WORDS[COMP_CWORD]}' | |||
|
908 | echo $' local compwords=("${COMP_WORDS[@]:1:$COMP_CWORD-1}")' | |||
|
909 | echo $' local compline="${compwords[*]}"' | |||
|
910 | echo $'' | |||
|
911 | echo $' case "$compline" in' | |||
|
912 | echo $' \'upgrade-source\'*)' | |||
|
913 | echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_rccontrol3_completions_filter "--auth-token --help --server-url -h")" -- "$cur" )' | |||
|
914 | echo $' ;;' | |||
|
915 | echo $'' | |||
|
916 | echo $' \'build-source\'*)' | |||
|
917 | echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_rccontrol3_completions_filter "--help --version-name -h")" -- "$cur" )' | |||
|
918 | echo $' ;;' | |||
|
919 | echo $'' | |||
|
920 | echo $' \'self-update\'*)' | |||
|
921 | echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_rccontrol3_completions_filter "--auth-token --help --server-url -h")" -- "$cur" )' | |||
|
922 | echo $' ;;' | |||
|
923 | echo $'' | |||
|
924 | echo $' \'bootstrap\'*)' | |||
|
925 | echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_rccontrol3_completions_filter "--auth-token --force --help --server-url -f -h")" -- "$cur" )' | |||
|
926 | echo $' ;;' | |||
|
927 | echo $'' | |||
|
928 | echo $' \'build\'*)' | |||
|
929 | echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_rccontrol3_completions_filter "--help --version-name -h")" -- "$cur" )' | |||
|
930 | echo $' ;;' | |||
|
931 | echo $'' | |||
|
932 | echo $' \'stack\'*)' | |||
|
933 | echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_rccontrol3_completions_filter "--help -h metrics rhodecode router services")" -- "$cur" )' | |||
|
934 | echo $' ;;' | |||
|
935 | echo $'' | |||
|
936 | echo $' *)' | |||
|
937 | echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_rccontrol3_completions_filter "--help --version -h -v bootstrap build build-source self-update stack upgrade-source")" -- "$cur" )' | |||
|
938 | echo $' ;;' | |||
|
939 | echo $'' | |||
|
940 | echo $' esac' | |||
|
941 | echo $'} &&' | |||
|
942 | echo $'complete -F _rccontrol3_completions rccontrol3' | |||
|
943 | echo $'' | |||
|
944 | echo $'# ex: filetype=sh' | |||
|
945 | } | |||
|
946 | ||||
|
947 | # src/lib/validate_stack_exists.sh | |||
|
948 | ||||
|
949 | validate_stack_exists() { | |||
|
950 | err="" | |||
|
951 | invalid="1" | |||
|
952 | ||||
|
953 | for item in $VALID_SERVICES | |||
|
954 | do | |||
|
955 | if [ "$1" == "$item" ]; then | |||
|
956 | invalid="" | |||
|
957 | break | |||
|
958 | fi | |||
|
959 | done | |||
|
960 | ||||
|
961 | if [[ -n $invalid ]]; then | |||
|
962 | err="command '$1' not in list of $VALID_SERVICES" | |||
|
963 | fi | |||
|
964 | ||||
|
965 | echo $err | |||
|
966 | } | |||
|
967 | ||||
|
968 | # :command.command_functions | |||
|
969 | # :command.function | |||
|
970 | rccontrol_self_update_command() { | |||
|
971 | # src/self_update_command.sh | |||
|
972 | check_bootstrap | |||
|
973 | ||||
|
974 | echo "# this file is located in 'src/self_update_command.sh'" | |||
|
975 | echo "# code for 'rccontrol3 self-update' goes here" | |||
|
976 | echo "# you can edit it freely and regenerate (it will not be overwritten)" | |||
|
977 | inspect_args | |||
|
978 | ||||
|
979 | } | |||
|
980 | ||||
|
981 | # :command.function | |||
|
982 | rccontrol_bootstrap_command() { | |||
|
983 | # src/bootstrap_command.sh | |||
|
984 | DEBUG=${args[--debug]} | |||
|
985 | force=${args[--force]} | |||
|
986 | ||||
|
987 | check_bash_version() { | |||
|
988 | ||||
|
989 | if [ ! "${BASH_VERSINFO:-0}" -ge 4 ]; then | |||
|
990 | echo "$(red Bash version 4 or greater is required, please update your bash version!)" | |||
|
991 | exit | |||
|
992 | fi | |||
|
993 | } | |||
|
994 | ||||
|
995 | check_docker() { | |||
|
996 | (which docker || which docker.io) &>/dev/null | |||
|
997 | } | |||
|
998 | ||||
|
999 | check_and_install_docker() { | |||
|
1000 | failMsg="Failed to find docker on your PATH" | |||
|
1001 | ||||
|
1002 | if ! check_docker; then | |||
|
1003 | echo "$failMsg" | |||
|
1004 | read -p "Enter to install Docker directly from https://get.docker.com/ or Ctrl+C to exit" | |||
|
1005 | curl https://get.docker.com/ | sh | |||
|
1006 | ||||
|
1007 | if ! check_docker; then | |||
|
1008 | echo "$failMsg" | |||
|
1009 | echo "Docker install failed. Quitting." | |||
|
1010 | exit | |||
|
1011 | fi | |||
|
1012 | fi | |||
|
1013 | } | |||
|
1014 | ||||
|
1015 | docker_bootstrap() { | |||
|
1016 | check_and_install_docker | |||
|
1017 | echo 'Docker: Running bootstrap.' | |||
|
1018 | ||||
|
1019 | echo "Docker: creating network 'rc_datavolume'" | |||
|
1020 | docker volume create --name=rc_datavolume | |||
|
1021 | echo "Docker: done" | |||
|
1022 | echo "" | |||
|
1023 | ||||
|
1024 | echo "Docker: creating network 'rhodecode_network'" | |||
|
1025 | docker network inspect rhodecode_network >/dev/null 2>&1 || docker network create rhodecode_network | |||
|
1026 | echo "Docker: done" | |||
|
1027 | echo "" | |||
|
1028 | ||||
|
1029 | echo "Docker: creating loki logging" | |||
|
1030 | loki_driver=$(docker plugin ls --format {{.Name}} --filter enabled=true | grep loki || echo "") | |||
|
1031 | if [[ $loki_driver == "" ]]; then | |||
|
1032 | docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions | |||
|
1033 | else | |||
|
1034 | echo "Docker: loki driver already exists" | |||
|
1035 | fi | |||
|
1036 | } | |||
|
1037 | ||||
|
1038 | definitions_bootstrap() { | |||
|
1039 | ||||
|
1040 | SOURCE_DIR=$PWD | |||
|
1041 | RHODECODE_DOCKER_HASH='master' | |||
|
1042 | ||||
|
1043 | AUTH_TOKEN=${args[--auth-token]} | |||
|
1044 | SERVER_URL=${args[--server-url]} | |||
|
1045 | ||||
|
1046 | DEFINITIONS_EXIST="" | |||
|
1047 | CHECK_FILES="rccontrol .env docker-compose-services.yaml docker-compose-apps.yaml" | |||
|
1048 | for check_file in $CHECK_FILES; do | |||
|
1049 | if [[ -f "$check_file" ]]; then | |||
|
1050 | DEFINITIONS_EXIST="1" | |||
|
1051 | fi | |||
|
1052 | done | |||
|
1053 | ||||
|
1054 | if [[ -n $DEFINITIONS_EXIST && ! $force ]]; then | |||
|
1055 | echo "$(yellow skipping docker defs creation, existing files found. Use --force to create them anyway)" | |||
|
1056 | return | |||
|
1057 | fi | |||
|
1058 | ||||
|
1059 | if [[ -n $DEFINITIONS_EXIST ]]; then | |||
|
1060 | echo "$(yellow docker definitions exists, are you sure to force re-create them?)" | |||
|
1061 | while true; do | |||
|
1062 | read -p "Would you like to continue with overriding file? [yn] " yn | |||
|
1063 | case $yn in | |||
|
1064 | [Yy]*) return 2 ;; | |||
|
1065 | [Nn]*) exit ;; | |||
|
1066 | *) echo "Please answer y or n." ;; | |||
|
1067 | esac | |||
|
1068 | done | |||
|
1069 | fi | |||
|
1070 | ||||
|
1071 | exit | |||
|
1072 | ||||
|
1073 | # download sources | |||
|
1074 | echo "Files: download rhodecode docker definitions from $SERVER_URL" | |||
|
1075 | echo "" | |||
|
1076 | ||||
|
1077 | if [ $DEBUG ]; then | |||
|
1078 | echo "downloading: $SERVER_URL/rhodecode-enterprise-docker/archive/$RHODECODE_DOCKER_HASH.tgz?with_hash=0" | |||
|
1079 | 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 | |||
|
1080 | ||||
|
1081 | echo "running CP $SOURCE_DIR/*rhodecode-enterprise-docker-plain/* $SOURCE_DIR" | |||
|
1082 | cp -v -r -f --update --backup=numbered $SOURCE_DIR/*rhodecode-enterprise-docker-plain/* $SOURCE_DIR | |||
|
1083 | ||||
|
1084 | echo "removing $SOURCE_DIR/*rhodecode-enterprise-docker-plain" | |||
|
1085 | rm -r $SOURCE_DIR/*rhodecode-enterprise-docker-plain | |||
|
1086 | else | |||
|
1087 | 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 | |||
|
1088 | ||||
|
1089 | cp -r -f --update --backup=numbered $SOURCE_DIR/*rhodecode-enterprise-docker-plain/* $SOURCE_DIR | |||
|
1090 | ||||
|
1091 | rm -r $SOURCE_DIR/*rhodecode-enterprise-docker-plain | |||
|
1092 | fi | |||
|
1093 | ||||
|
1094 | echo "$(green_bold DONE: docker definitions extracted to $SOURCE_DIR)" | |||
|
1095 | } | |||
|
1096 | ||||
|
1097 | config_bootstrap() { | |||
|
1098 | ||||
|
1099 | if [[ ! -f "$CONFIG_FILE" ]]; then | |||
|
1100 | echo "init config at: $CONFIG_FILE" | |||
|
1101 | config_init | |||
|
1102 | else | |||
|
1103 | echo "re-using config at: $CONFIG_FILE" | |||
|
1104 | fi | |||
|
1105 | ||||
|
1106 | if ! config_has_key "rc_encrypted_secret" ; then | |||
|
1107 | key=$(echo $RANDOM | md5sum | head -c 32) | |||
|
1108 | config_set "rc_encrypted_secret" $key | |||
|
1109 | fi | |||
|
1110 | ||||
|
1111 | if ! config_has_key "rc_db_url" ; then | |||
|
1112 | key=$(echo $RANDOM | md5sum | head -c 32) | |||
|
1113 | config_set "rc_db_url" "postgresql://$DB_USER:$key@database/$DB_NAME" | |||
|
1114 | fi | |||
|
1115 | ||||
|
1116 | if ! config_has_key "rc_license_token" ; then | |||
|
1117 | config_set "rc_license_token" abra-cada-bra1-rce4 | |||
|
1118 | fi | |||
|
1119 | ||||
|
1120 | if ! config_has_key "rc_base_url" ; then | |||
|
1121 | config_set "rc_base_url" http://docker-dev | |||
|
1122 | fi | |||
|
1123 | ||||
|
1124 | if ! config_has_key "rc_log_formatter" ; then | |||
|
1125 | # json is another option | |||
|
1126 | config_set "rc_log_formatter" generic | |||
|
1127 | fi | |||
|
1128 | ||||
|
1129 | if ! config_has_key "rc_use_celery" ; then | |||
|
1130 | config_set "rc_use_celery" true | |||
|
1131 | fi | |||
|
1132 | ||||
|
1133 | BOOTSTRAP_RUNTIME_ENV=$PWD/.custom/.runtime.env | |||
|
1134 | if [[ ! -f "$BOOTSTRAP_RUNTIME_ENV" ]]; then | |||
|
1135 | echo "init runtime env config at: $BOOTSTRAP_RUNTIME_ENV" | |||
|
1136 | touch BOOTSTRAP_RUNTIME_ENV | |||
|
1137 | ||||
|
1138 | #ENV_EXPAND="" | |||
|
1139 | for k in $(config_keys); do | |||
|
1140 | k_upper=${k^^} | |||
|
1141 | echo "$k_upper='$(config_get "$k")'" >> $BOOTSTRAP_RUNTIME_ENV | |||
|
1142 | done | |||
|
1143 | ||||
|
1144 | fi | |||
|
1145 | } | |||
|
1146 | ||||
|
1147 | cur_date=$(date '+%Y-%m-%d %H:%M:%S') | |||
|
1148 | ||||
|
1149 | check_bash_version | |||
|
1150 | ||||
|
1151 | if [[ ! -e $BOOTSTRAP_FILE ]]; then | |||
|
1152 | echo "initial bootstrap file $BOOTSTRAP_FILE not found !" | |||
|
1153 | ||||
|
1154 | docker_bootstrap | |||
|
1155 | definitions_bootstrap | |||
|
1156 | config_bootstrap | |||
|
1157 | ||||
|
1158 | echo "$cur_date" > "$BOOTSTRAP_FILE" | |||
|
1159 | ||||
|
1160 | else | |||
|
1161 | if [ $force ]; then | |||
|
1162 | ||||
|
1163 | docker_bootstrap $force | |||
|
1164 | definitions_bootstrap $force ## TODO: remove old | |||
|
1165 | config_bootstrap $force | |||
|
1166 | ||||
|
1167 | echo "$cur_date" > "$BOOTSTRAP_FILE" | |||
|
1168 | ||||
|
1169 | exit | |||
|
1170 | fi | |||
|
1171 | ||||
|
1172 | echo "bootstrap file $BOOTSTRAP_FILE was found add --force to force bootstrap" | |||
|
1173 | fi | |||
|
1174 | ||||
|
1175 | get_started | |||
|
1176 | } | |||
|
1177 | ||||
|
1178 | # :command.function | |||
|
1179 | rccontrol_get_build_artifacts_command() { | |||
|
1180 | # src/get_build_artifacts_command.sh | |||
|
1181 | check_bootstrap | |||
|
1182 | ||||
|
1183 | DEBUG=${args[--debug]} | |||
|
1184 | AUTH=${args[--auth]} | |||
|
1185 | INSTALLER_URL=${args[--installer-url]} | |||
|
1186 | MANIFEST_URL=${args[--manifest-url]} | |||
|
1187 | RC_VERSION=${args[--version-name]} | |||
|
1188 | VER=$RC_VERSION | |||
|
1189 | ||||
|
1190 | CACHE_DIR=$PWD/.cache | |||
|
1191 | VER_REGEX="$VER+x86_64" | |||
|
1192 | ||||
|
1193 | echo "Downloading Artifacts for version: $VER" | |||
|
1194 | ||||
|
1195 | echo "1/4 Checking available downloads from MANIFEST file" | |||
|
1196 | ||||
|
1197 | ARTS=$(curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" | cut -d ' ' -f 2) | |||
|
1198 | ||||
|
1199 | if [[ $DEBUG ]]; then | |||
|
1200 | echo "DEBUG START" | |||
|
1201 | curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" || echo "no regex match" | |||
|
1202 | curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" | cut -d ' ' -f 2 | |||
|
1203 | echo "Found following artifacts:" | |||
|
1204 | echo $ARTS | |||
|
1205 | echo "DEBUG END" | |||
|
1206 | fi | |||
|
1207 | ||||
|
1208 | if [[ $ARTS == "" ]]; then | |||
|
1209 | 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" | |||
|
1210 | echo "$(red $MSG)" | |||
|
1211 | exit | |||
|
1212 | fi | |||
|
1213 | ||||
|
1214 | echo "2/4 Downloading locale-archive" | |||
|
1215 | curl -L https://dls.rhodecode.com/assets/locale-archive -J -O | |||
|
1216 | mv -v locale-archive "$CACHE_DIR" | |||
|
1217 | ||||
|
1218 | # vcsserver/ce/ee | |||
|
1219 | echo "3/4 Downloading installer artifacts" | |||
|
1220 | for url in $ARTS; do | |||
|
1221 | echo "Downloading $url with $AUTH" | |||
|
1222 | curl $AUTH --fail-early -L ${url} -J -O | |||
|
1223 | done | |||
|
1224 | ||||
|
1225 | #for url in $(curl -s $MANIFEST_URL | grep --ignore-case -E 'control.+\+x86_64' | cut -d ' ' -f 2); do | |||
|
1226 | # echo "Downloading $url" | |||
|
1227 | # curl -L ${url} -J -O | |||
|
1228 | #done | |||
|
1229 | ||||
|
1230 | echo "4/4 Downloading installer from $INSTALLER_URL" | |||
|
1231 | curl $AUTH -L $INSTALLER_URL -J -O | |||
|
1232 | ||||
|
1233 | INSTALLER=$(ls -Art RhodeCode-installer-* | tail -n 1) | |||
|
1234 | if [[ -n $INSTALLER ]]; then | |||
|
1235 | chmod +x "${INSTALLER}" | |||
|
1236 | fi | |||
|
1237 | ||||
|
1238 | echo "Copying artifacts into $CACHE_DIR" | |||
|
1239 | ||||
|
1240 | mv -v "${INSTALLER}" $CACHE_DIR | |||
|
1241 | mv -v *.bz2 $CACHE_DIR | |||
|
1242 | ls -lh $CACHE_DIR | |||
|
1243 | ||||
|
1244 | } | |||
|
1245 | ||||
|
1246 | # :command.function | |||
|
1247 | rccontrol_build_command() { | |||
|
1248 | # src/build_command.sh | |||
|
1249 | check_bootstrap | |||
|
1250 | ||||
|
1251 | rc_version=${args[--version-name]} | |||
|
1252 | export RC_VERSION=$rc_version | |||
|
1253 | eval "echo INSTALLER BASED BUILDING${RC_VERSION}" | |||
|
1254 | ||||
|
1255 | RC_VERSION=$rc_version ./rccontrol stack rhodecode build --progress plain rhodecode | |||
|
1256 | ||||
|
1257 | } | |||
|
1258 | ||||
|
1259 | # :command.function | |||
|
1260 | rccontrol_get_build_source_command() { | |||
|
1261 | # src/get_build_source_command.sh | |||
|
1262 | check_bootstrap | |||
|
1263 | ||||
|
1264 | AUTH_TOKEN=${args[--auth-token]} | |||
|
1265 | SERVER_URL=${args[--server-url]} | |||
|
1266 | revision=${args[revision]} | |||
|
1267 | ||||
|
1268 | SOURCE_DIR=$PWD/.source | |||
|
1269 | ||||
|
1270 | RHODECODE_VCS_HASH=$revision | |||
|
1271 | RHODECODE_CE_HASH=$revision | |||
|
1272 | RHODECODE_EE_HASH=$revision | |||
|
1273 | ||||
|
1274 | # download sources | |||
|
1275 | echo "** download rhodecode source for build from $SERVER_URL **" | |||
|
1276 | ||||
|
1277 | curl --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 | |||
|
1278 | curl --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 | |||
|
1279 | #TODO: fix just CE build... | |||
|
1280 | curl --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 | |||
|
1281 | ||||
|
1282 | rm -rf $SOURCE_DIR/rhodecode-vcsserver && mv $SOURCE_DIR/*rhodecode-vcsserver-plain $SOURCE_DIR/rhodecode-vcsserver | |||
|
1283 | rm -rf $SOURCE_DIR/rhodecode-enterprise-ce && mv $SOURCE_DIR/*rhodecode-enterprise-ce-plain $SOURCE_DIR/rhodecode-enterprise-ce | |||
|
1284 | rm -rf $SOURCE_DIR/rhodecode-enterprise-ee && cp -r $SOURCE_DIR/*rhodecode-enterprise-ee-plain $SOURCE_DIR/rhodecode-enterprise-ee | |||
|
1285 | ||||
|
1286 | echo "downloading sources done to $SOURCE_DIR" | |||
|
1287 | ||||
|
1288 | } | |||
|
1289 | ||||
|
1290 | # :command.function | |||
|
1291 | rccontrol_build_source_command() { | |||
|
1292 | # src/build_source_command.sh | |||
|
1293 | check_bootstrap | |||
|
1294 | ||||
|
1295 | rc_version=${args[--version-name]} | |||
|
1296 | export RC_VERSION=$rc_version | |||
|
1297 | eval "echo SOURCE BASED BUILDING${RC_VERSION}" | |||
|
1298 | ||||
|
1299 | RC_VERSION=$rc_version ./rccontrol stack rhodecode -f docker-compose-apps.source.yaml build --progress plain rhodecode | |||
|
1300 | ||||
|
1301 | } | |||
|
1302 | ||||
|
1303 | # :command.function | |||
|
1304 | rccontrol_stack_command() { | |||
|
1305 | # src/stack_command.sh | |||
|
1306 | check_bootstrap | |||
|
1307 | ||||
|
1308 | DEBUG=${args[--debug]} | |||
|
1309 | service_name=${args[name]} | |||
|
1310 | ||||
|
1311 | if [[ ! -f $RC_STACK_ROUTER_EXT ]]; then | |||
|
1312 | RC_STACK_ROUTER_EXT="" | |||
|
1313 | else | |||
|
1314 | RC_STACK_ROUTER_EXT="-f $RC_STACK_ROUTER_EXT" | |||
|
1315 | fi | |||
|
1316 | ||||
|
1317 | CMD_ROUTER="\ | |||
|
1318 | docker compose \ | |||
|
1319 | --env-file $ENV_FILE \ | |||
|
1320 | $ENV_EXPAND \ | |||
|
1321 | -p rc_cluster_router \ | |||
|
1322 | -f docker-compose-base.yaml \ | |||
|
1323 | -f docker-compose-router.yaml $RC_STACK_ROUTER_EXT" | |||
|
1324 | ||||
|
1325 | if [[ ! -f $RC_STACK_SERVICES_EXT ]]; then | |||
|
1326 | RC_STACK_SERVICES_EXT_LCL="" | |||
|
1327 | else | |||
|
1328 | RC_STACK_SERVICES_EXT_LCL="-f $RC_STACK_SERVICES_EXT" | |||
|
1329 | fi | |||
|
1330 | ||||
|
1331 | RC_STACK_PROFILES="--profile postgres --profile redis --profile elasticsearch --profile channelstream" | |||
|
1332 | ||||
|
1333 | CMD_SERVICES="\ | |||
|
1334 | docker compose \ | |||
|
1335 | --env-file $ENV_FILE \ | |||
|
1336 | $ENV_EXPAND \ | |||
|
1337 | $RC_STACK_PROFILES \ | |||
|
1338 | -p rc_cluster_services \ | |||
|
1339 | -f docker-compose-base.yaml \ | |||
|
1340 | -f docker-compose-services.yaml $RC_STACK_SERVICES_EXT_LCL" | |||
|
1341 | ||||
|
1342 | if [[ ! -f $RC_STACK_METRICS_EXT ]]; then | |||
|
1343 | RC_STACK_METRICS_EXT_LCL="" | |||
|
1344 | else | |||
|
1345 | RC_STACK_METRICS_EXT_LCL="-f $RC_STACK_METRICS_EXT" | |||
|
1346 | fi | |||
|
1347 | ||||
|
1348 | CMD_METRICS="\ | |||
|
1349 | docker compose \ | |||
|
1350 | --env-file $ENV_FILE \ | |||
|
1351 | $ENV_EXPAND \ | |||
|
1352 | -p rc_cluster_metrics \ | |||
|
1353 | -f docker-compose-base.yaml \ | |||
|
1354 | -f docker-compose-metrics.yaml $RC_STACK_METRICS_EXT_LCL" | |||
|
1355 | ||||
|
1356 | if [[ ! -f $RC_STACK_RHODECODE_EXT ]]; then | |||
|
1357 | RC_STACK_RHODECODE_EXT_LCL="" | |||
|
1358 | else | |||
|
1359 | RC_STACK_RHODECODE_EXT_LCL="-f $RC_STACK_RHODECODE_EXT" | |||
|
1360 | fi | |||
|
1361 | ||||
|
1362 | CMD_RHODECODE="\ | |||
|
1363 | docker compose \ | |||
|
1364 | --env-file $ENV_FILE \ | |||
|
1365 | $ENV_EXPAND \ | |||
|
1366 | -p rc_cluster_apps \ | |||
|
1367 | -f docker-compose-base.yaml \ | |||
|
1368 | -f docker-compose-apps.yaml $RC_STACK_RHODECODE_EXT_LCL" | |||
|
1369 | ||||
|
1370 | CMD_RHODECODE_SOURCE="\ | |||
|
1371 | docker compose \ | |||
|
1372 | --env-file $ENV_FILE \ | |||
|
1373 | $ENV_EXPAND \ | |||
|
1374 | -p rc_cluster_apps \ | |||
|
1375 | -f docker-compose-base.yaml \ | |||
|
1376 | -f docker-compose-apps.yaml \ | |||
|
1377 | -f docker-compose-apps.source.yaml $RC_STACK_RHODECODE_EXT_LCL" | |||
|
1378 | ||||
|
1379 | case $service_name in | |||
|
1380 | ||||
|
1381 | services ) | |||
|
1382 | if [[ $DEBUG ]]; then | |||
|
1383 | echo "---" | |||
|
1384 | echo "stacks docker: $RC_STACK_SERVICES_EXT_LCL" | |||
|
1385 | echo "running command: ${CMD_SERVICES}" | |||
|
1386 | echo "ARGS: ${other_args[*]}" | |||
|
1387 | echo "---" | |||
|
1388 | fi | |||
|
1389 | ||||
|
1390 | eval "${CMD_SERVICES} ${other_args[*]}" | |||
|
1391 | exit | |||
|
1392 | ;; | |||
|
1393 | router ) | |||
|
1394 | if [[ $DEBUG ]]; then | |||
|
1395 | echo "---" | |||
|
1396 | echo "stacks docker: $RC_STACK_ROUTER_EXT_LCL" | |||
|
1397 | echo "running command: ${CMD_ROUTER}" | |||
|
1398 | echo "ARGS: ${other_args[*]}" | |||
|
1399 | echo "---" | |||
|
1400 | fi | |||
|
1401 | eval "${CMD_ROUTER} ${other_args[*]}" | |||
|
1402 | exit | |||
|
1403 | ;; | |||
|
1404 | metrics ) | |||
|
1405 | if [[ $DEBUG ]]; then | |||
|
1406 | echo "---" | |||
|
1407 | echo "stacks docker: $RC_STACK_METRICS_EXT_LCL" | |||
|
1408 | echo "running command: ${CMD_METRICS}" | |||
|
1409 | echo "ARGS: ${other_args[*]}" | |||
|
1410 | echo "---" | |||
|
1411 | fi | |||
|
1412 | eval "${CMD_METRICS} ${other_args[*]}" | |||
|
1413 | exit | |||
|
1414 | ;; | |||
|
1415 | rhodecode ) | |||
|
1416 | if [[ $DEBUG ]]; then | |||
|
1417 | echo "---" | |||
|
1418 | echo "stacks docker: $RC_STACK_RHODECODE_EXT_LCL" | |||
|
1419 | echo "running command: ${CMD_RHODECODE}" | |||
|
1420 | echo "ARGS: ${other_args[*]}" | |||
|
1421 | echo "---" | |||
|
1422 | fi | |||
|
1423 | eval "${CMD_RHODECODE} ${other_args[*]}" | |||
|
1424 | exit | |||
|
1425 | ;; | |||
|
1426 | esac | |||
|
1427 | ||||
|
1428 | } | |||
|
1429 | ||||
|
1430 | # :command.function | |||
|
1431 | rccontrol_stack_status_command() { | |||
|
1432 | # src/stack_status_command.sh | |||
|
1433 | check_bootstrap | |||
|
1434 | DEBUG=${args[--debug]} | |||
|
1435 | if [[ $DEBUG ]]; then | |||
|
1436 | echo "---" | |||
|
1437 | ||||
|
1438 | ps_cmd=$(docker ps --filter=name=rc_cluster --format="{{.ID}}") | |||
|
1439 | ||||
|
1440 | for service in $ps_cmd; do | |||
|
1441 | ||||
|
1442 | servicename=`docker inspect --format '{{ .Name }}' $service` | |||
|
1443 | servicename=${servicename:1} | |||
|
1444 | echo $servicename | |||
|
1445 | docker inspect $service --format='{{.State.Status}}: {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' | |||
|
1446 | echo "" | |||
|
1447 | ||||
|
1448 | done | |||
|
1449 | fi | |||
|
1450 | echo "---" | |||
|
1451 | docker ps --filter=name=rc_cluster --format="table {{.ID}}\\t{{.Image}}\\t{{.Status}}\\t{{.Names}}\\t{{.Ports}}" | |||
|
1452 | } | |||
|
1453 | ||||
|
1454 | # :command.function | |||
|
1455 | rccontrol_stack_upgrade_command() { | |||
|
1456 | # src/stack_upgrade_command.sh | |||
|
1457 | check_bootstrap | |||
|
1458 | ||||
|
1459 | echo "# this file is located in 'src/stack_upgrade_command.sh'" | |||
|
1460 | echo "# code for 'rccontrol stack-upgrade' goes here" | |||
|
1461 | echo "# you can edit it freely and regenerate (it will not be overwritten)" | |||
|
1462 | inspect_args | |||
|
1463 | ||||
|
1464 | } | |||
|
1465 | ||||
|
1466 | # :command.function | |||
|
1467 | rccontrol_cli_redis_command() { | |||
|
1468 | # src/cli_redis_command.sh | |||
|
1469 | check_bootstrap | |||
|
1470 | ||||
|
1471 | DEBUG=${args[--debug]} | |||
|
1472 | ||||
|
1473 | target_container=rc_cluster_services-redis-1 | |||
|
1474 | docker_id=$(docker ps --filter name=$target_container -q) | |||
|
1475 | ||||
|
1476 | if [[ $DEBUG ]]; then | |||
|
1477 | echo "container id: $docker_id, based on $target_container filter" | |||
|
1478 | docker ps | |||
|
1479 | fi | |||
|
1480 | ||||
|
1481 | if [ "$docker_id" == "" ]; then | |||
|
1482 | MSG="Cannot find container ID with name $target_container" | |||
|
1483 | echo "$(red $MSG)" | |||
|
1484 | exit | |||
|
1485 | fi | |||
|
1486 | ||||
|
1487 | if [[ $DEBUG ]]; then | |||
|
1488 | echo "Running |docker exec --interactive --tty $docker_id $CMD|" | |||
|
1489 | echo "docker exec --interactive --tty $docker_id /bin/bash -c 'redis-cli'" | |||
|
1490 | fi | |||
|
1491 | ||||
|
1492 | eval "docker exec --interactive --tty $docker_id /bin/bash -c 'redis-cli'" | |||
|
1493 | ||||
|
1494 | } | |||
|
1495 | ||||
|
1496 | # :command.function | |||
|
1497 | rccontrol_cli_db_command() { | |||
|
1498 | # src/cli_db_command.sh | |||
|
1499 | check_bootstrap | |||
|
1500 | ||||
|
1501 | DEBUG=${args[--debug]} | |||
|
1502 | ||||
|
1503 | target_container=rc_cluster_services-database-1 | |||
|
1504 | docker_id=$(docker ps --filter name=$target_container -q) | |||
|
1505 | ||||
|
1506 | if [[ $DEBUG ]]; then | |||
|
1507 | echo "container id: $docker_id, based on $target_container filter" | |||
|
1508 | docker ps | |||
|
1509 | fi | |||
|
1510 | ||||
|
1511 | if [ "$docker_id" == "" ]; then | |||
|
1512 | MSG="Cannot find container ID with name $target_container" | |||
|
1513 | echo "$(red $MSG)" | |||
|
1514 | exit | |||
|
1515 | fi | |||
|
1516 | ||||
|
1517 | if [[ $DEBUG ]]; then | |||
|
1518 | echo "Running |docker exec --interactive --tty $docker_id $CMD|" | |||
|
1519 | echo "docker exec --interactive --tty $docker_id /bin/bash -c 'PGPASSWORD=$DB_PASSWORD psql --username=$DB_USER --dbname=$DB_NAME'" | |||
|
1520 | fi | |||
|
1521 | ||||
|
1522 | eval "docker exec --interactive --tty $docker_id /bin/bash -c 'PGPASSWORD=$DB_PASSWORD psql --username=$DB_USER --dbname=$DB_NAME'" | |||
|
1523 | ||||
|
1524 | } | |||
|
1525 | ||||
|
1526 | # :command.function | |||
|
1527 | rccontrol_cli_db_upgrade_command() { | |||
|
1528 | # src/cli_db_upgrade_command.sh | |||
|
1529 | check_bootstrap | |||
|
1530 | ||||
|
1531 | DEBUG=${args[--debug]} | |||
|
1532 | ||||
|
1533 | target_container=rc_cluster_apps-rhodecode-1 | |||
|
1534 | docker_id=$(docker ps --filter name=$target_container -q) | |||
|
1535 | ||||
|
1536 | if [[ $DEBUG ]]; then | |||
|
1537 | echo "container id: $docker_id, based on $target_container filter" | |||
|
1538 | docker ps | |||
|
1539 | fi | |||
|
1540 | ||||
|
1541 | if [ "$docker_id" == "" ]; then | |||
|
1542 | MSG="Cannot find container ID with name $target_container" | |||
|
1543 | echo "$(red $MSG)" | |||
|
1544 | exit | |||
|
1545 | fi | |||
|
1546 | ||||
|
1547 | if [[ $DEBUG ]]; then | |||
|
1548 | echo "./rccontrol stack rhodecode exec rhodecode /usr/local/bin/rhodecode_bin/bin/rc-upgrade-db /etc/rhodecode/conf/rhodecode.optimized.ini --force-yes" | |||
|
1549 | fi | |||
|
1550 | ||||
|
1551 | ./rccontrol stack rhodecode exec rhodecode /usr/local/bin/rhodecode_bin/bin/rc-upgrade-db /etc/rhodecode/conf/rhodecode.optimized.ini --force-yes | |||
|
1552 | } | |||
|
1553 | ||||
|
1554 | # :command.function | |||
|
1555 | rccontrol__completions_command() { | |||
|
1556 | # src/_completions_command.sh | |||
|
1557 | send_completions | |||
|
1558 | } | |||
|
1559 | ||||
|
1560 | # :command.function | |||
|
1561 | rccontrol_backup_db_command() { | |||
|
1562 | # src/backup_db_command.sh | |||
|
1563 | check_bootstrap | |||
|
1564 | ||||
|
1565 | DEBUG=${args[--debug]} | |||
|
1566 | DESTINATION=${args[destination]} | |||
|
1567 | ||||
|
1568 | target_container=rc_cluster_services-database-1 | |||
|
1569 | ||||
|
1570 | docker_id=$(docker ps --filter name=$target_container -q) | |||
|
1571 | backup_name=rc_db_dump-$(date +%Y-%m-%d).tar.gz | |||
|
1572 | ||||
|
1573 | echo "creating backup $backup_name" | |||
|
1574 | ||||
|
1575 | if [[ $DEBUG ]]; then | |||
|
1576 | echo "container id: $docker_id, based on $target_container filter" | |||
|
1577 | docker ps | |||
|
1578 | echo "---" | |||
|
1579 | fi | |||
|
1580 | ||||
|
1581 | #image_id=$(docker inspect "$docker_id" --format {{.Image}} | cut -c 8-) | |||
|
1582 | # | |||
|
1583 | #if [[ $DEBUG ]]; then | |||
|
1584 | # echo "image id: $image_id, based on $target_container filter" | |||
|
1585 | # docker image ls | |||
|
1586 | # echo "---" | |||
|
1587 | #fi | |||
|
1588 | ||||
|
1589 | if [ "$docker_id" == "" ]; then | |||
|
1590 | MSG="Cannot find container ID with name $target_container" | |||
|
1591 | echo "$(red $MSG)" | |||
|
1592 | exit | |||
|
1593 | fi | |||
|
1594 | ||||
|
1595 | #if [ "image_id" == "" ]; then | |||
|
1596 | # MSG="Cannot find image ID with name $target_container" | |||
|
1597 | # echo "$(red $MSG)" | |||
|
1598 | # exit | |||
|
1599 | #fi | |||
|
1600 | ||||
|
1601 | if [[ $DEBUG ]]; then | |||
|
1602 | echo "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'" | |||
|
1603 | fi | |||
|
1604 | ||||
|
1605 | eval "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'" | |||
|
1606 | echo "$(green Backup created in /var/rc-data-dump/ mount !)" | |||
|
1607 | ||||
|
1608 | } | |||
|
1609 | ||||
|
1610 | # :command.function | |||
|
1611 | rccontrol_backup_data_command() { | |||
|
1612 | # src/backup_data_command.sh | |||
|
1613 | echo "# this file is located in 'src/backup_data_command.sh'" | |||
|
1614 | echo "# code for 'rccontrol backup-data' goes here" | |||
|
1615 | echo "# you can edit it freely and regenerate (it will not be overwritten)" | |||
|
1616 | inspect_args | |||
|
1617 | ||||
|
1618 | } | |||
|
1619 | ||||
|
1620 | # :command.parse_requirements | |||
|
1621 | parse_requirements() { | |||
|
1622 | # :command.fixed_flags_filter | |||
|
1623 | case "${1:-}" in | |||
|
1624 | --version | -v ) | |||
|
1625 | version_command | |||
|
1626 | exit | |||
|
1627 | ;; | |||
|
1628 | ||||
|
1629 | --help | -h ) | |||
|
1630 | long_usage=yes | |||
|
1631 | rccontrol_usage | |||
|
1632 | exit | |||
|
1633 | ;; | |||
|
1634 | ||||
|
1635 | # :flag.case | |||
|
1636 | --debug ) | |||
|
1637 | ||||
|
1638 | # :flag.case_no_arg | |||
|
1639 | args[--debug]=1 | |||
|
1640 | shift | |||
|
1641 | ;; | |||
|
1642 | ||||
|
1643 | esac | |||
|
1644 | ||||
|
1645 | # :command.environment_variables_filter | |||
|
1646 | # :command.environment_variables_default | |||
|
1647 | export RC_CLI_VERSION_NAME="${RC_CLI_VERSION_NAME:-4.27.0}" | |||
|
1648 | export RC_STACK_ROUTER_EXT="${RC_STACK_ROUTER_EXT:-.custom/docker-compose-router.override.yaml}" | |||
|
1649 | export RC_STACK_METRICS_EXT="${RC_STACK_METRICS_EXT:-.custom/docker-compose-metrics.override.yaml}" | |||
|
1650 | export RC_STACK_SERVICES_EXT="${RC_STACK_SERVICES_EXT:-.custom/docker-compose-services.override.yaml}" | |||
|
1651 | export RC_STACK_RHODECODE_EXT="${RC_STACK_RHODECODE_EXT:-.custom/docker-compose-apps.override.yaml}" | |||
|
1652 | ||||
|
1653 | # :command.command_filter | |||
|
1654 | action=${1:-} | |||
|
1655 | ||||
|
1656 | case $action in | |||
|
1657 | -* ) | |||
|
1658 | ;; | |||
|
1659 | ||||
|
1660 | self-update ) | |||
|
1661 | action="self-update" | |||
|
1662 | shift | |||
|
1663 | rccontrol_self_update_parse_requirements "$@" | |||
|
1664 | shift $# | |||
|
1665 | ;; | |||
|
1666 | ||||
|
1667 | bootstrap | install ) | |||
|
1668 | action="bootstrap" | |||
|
1669 | shift | |||
|
1670 | rccontrol_bootstrap_parse_requirements "$@" | |||
|
1671 | shift $# | |||
|
1672 | ;; | |||
|
1673 | ||||
|
1674 | get-build-artifacts ) | |||
|
1675 | action="get-build-artifacts" | |||
|
1676 | shift | |||
|
1677 | rccontrol_get_build_artifacts_parse_requirements "$@" | |||
|
1678 | shift $# | |||
|
1679 | ;; | |||
|
1680 | ||||
|
1681 | build ) | |||
|
1682 | action="build" | |||
|
1683 | shift | |||
|
1684 | rccontrol_build_parse_requirements "$@" | |||
|
1685 | shift $# | |||
|
1686 | ;; | |||
|
1687 | ||||
|
1688 | get-build-source ) | |||
|
1689 | action="get-build-source" | |||
|
1690 | shift | |||
|
1691 | rccontrol_get_build_source_parse_requirements "$@" | |||
|
1692 | shift $# | |||
|
1693 | ;; | |||
|
1694 | ||||
|
1695 | build-source ) | |||
|
1696 | action="build-source" | |||
|
1697 | shift | |||
|
1698 | rccontrol_build_source_parse_requirements "$@" | |||
|
1699 | shift $# | |||
|
1700 | ;; | |||
|
1701 | ||||
|
1702 | stack ) | |||
|
1703 | action="stack" | |||
|
1704 | shift | |||
|
1705 | rccontrol_stack_parse_requirements "$@" | |||
|
1706 | shift $# | |||
|
1707 | ;; | |||
|
1708 | ||||
|
1709 | stack-status | status ) | |||
|
1710 | action="stack-status" | |||
|
1711 | shift | |||
|
1712 | rccontrol_stack_status_parse_requirements "$@" | |||
|
1713 | shift $# | |||
|
1714 | ;; | |||
|
1715 | ||||
|
1716 | stack-upgrade ) | |||
|
1717 | action="stack-upgrade" | |||
|
1718 | shift | |||
|
1719 | rccontrol_stack_upgrade_parse_requirements "$@" | |||
|
1720 | shift $# | |||
|
1721 | ;; | |||
|
1722 | ||||
|
1723 | cli-redis ) | |||
|
1724 | action="cli-redis" | |||
|
1725 | shift | |||
|
1726 | rccontrol_cli_redis_parse_requirements "$@" | |||
|
1727 | shift $# | |||
|
1728 | ;; | |||
|
1729 | ||||
|
1730 | cli-db ) | |||
|
1731 | action="cli-db" | |||
|
1732 | shift | |||
|
1733 | rccontrol_cli_db_parse_requirements "$@" | |||
|
1734 | shift $# | |||
|
1735 | ;; | |||
|
1736 | ||||
|
1737 | cli-db-upgrade ) | |||
|
1738 | action="cli-db-upgrade" | |||
|
1739 | shift | |||
|
1740 | rccontrol_cli_db_upgrade_parse_requirements "$@" | |||
|
1741 | shift $# | |||
|
1742 | ;; | |||
|
1743 | ||||
|
1744 | _completions ) | |||
|
1745 | action="_completions" | |||
|
1746 | shift | |||
|
1747 | rccontrol__completions_parse_requirements "$@" | |||
|
1748 | shift $# | |||
|
1749 | ;; | |||
|
1750 | ||||
|
1751 | backup-db ) | |||
|
1752 | action="backup-db" | |||
|
1753 | shift | |||
|
1754 | rccontrol_backup_db_parse_requirements "$@" | |||
|
1755 | shift $# | |||
|
1756 | ;; | |||
|
1757 | ||||
|
1758 | backup-data ) | |||
|
1759 | action="backup-data" | |||
|
1760 | shift | |||
|
1761 | rccontrol_backup_data_parse_requirements "$@" | |||
|
1762 | shift $# | |||
|
1763 | ;; | |||
|
1764 | ||||
|
1765 | # :command.command_fallback | |||
|
1766 | "" ) | |||
|
1767 | rccontrol_usage >&2 | |||
|
1768 | exit 1 | |||
|
1769 | ;; | |||
|
1770 | ||||
|
1771 | * ) | |||
|
1772 | printf "invalid command: %s\n" "$action" >&2 | |||
|
1773 | exit 1 | |||
|
1774 | ;; | |||
|
1775 | ||||
|
1776 | esac | |||
|
1777 | ||||
|
1778 | # :command.parse_requirements_while | |||
|
1779 | while [[ $# -gt 0 ]]; do | |||
|
1780 | key="$1" | |||
|
1781 | case "$key" in | |||
|
1782 | ||||
|
1783 | -?* ) | |||
|
1784 | printf "invalid option: %s\n" "$key" >&2 | |||
|
1785 | exit 1 | |||
|
1786 | ;; | |||
|
1787 | ||||
|
1788 | * ) | |||
|
1789 | # :command.parse_requirements_case | |||
|
1790 | # :command.parse_requirements_case_simple | |||
|
1791 | printf "invalid argument: %s\n" "$key" >&2 | |||
|
1792 | exit 1 | |||
|
1793 | ||||
|
1794 | ;; | |||
|
1795 | ||||
|
1796 | esac | |||
|
1797 | done | |||
|
1798 | ||||
|
1799 | } | |||
|
1800 | ||||
|
1801 | # :command.parse_requirements | |||
|
1802 | rccontrol_self_update_parse_requirements() { | |||
|
1803 | # :command.fixed_flags_filter | |||
|
1804 | case "${1:-}" in | |||
|
1805 | --help | -h ) | |||
|
1806 | long_usage=yes | |||
|
1807 | rccontrol_self_update_usage | |||
|
1808 | exit | |||
|
1809 | ;; | |||
|
1810 | ||||
|
1811 | esac | |||
|
1812 | ||||
|
1813 | # :command.dependencies_filter | |||
|
1814 | if ! [[ -x "$(command -v curl)" ]]; then | |||
|
1815 | printf "missing dependency: curl\n" >&2 | |||
|
1816 | exit 1 | |||
|
1817 | fi | |||
|
1818 | if ! [[ -x "$(command -v tar)" ]]; then | |||
|
1819 | printf "missing dependency: tar\n" >&2 | |||
|
1820 | exit 1 | |||
|
1821 | fi | |||
|
1822 | ||||
|
1823 | # :command.command_filter | |||
|
1824 | action="self-update" | |||
|
1825 | ||||
|
1826 | # :command.parse_requirements_while | |||
|
1827 | while [[ $# -gt 0 ]]; do | |||
|
1828 | key="$1" | |||
|
1829 | case "$key" in | |||
|
1830 | # :flag.case | |||
|
1831 | --auth-token ) | |||
|
1832 | ||||
|
1833 | # :flag.case_arg | |||
|
1834 | if [[ -n ${2+x} ]]; then | |||
|
1835 | ||||
|
1836 | args[--auth-token]="$2" | |||
|
1837 | shift | |||
|
1838 | shift | |||
|
1839 | else | |||
|
1840 | printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2 | |||
|
1841 | exit 1 | |||
|
1842 | fi | |||
|
1843 | ;; | |||
|
1844 | ||||
|
1845 | # :flag.case | |||
|
1846 | --server-url ) | |||
|
1847 | ||||
|
1848 | # :flag.case_arg | |||
|
1849 | if [[ -n ${2+x} ]]; then | |||
|
1850 | ||||
|
1851 | args[--server-url]="$2" | |||
|
1852 | shift | |||
|
1853 | shift | |||
|
1854 | else | |||
|
1855 | printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2 | |||
|
1856 | exit 1 | |||
|
1857 | fi | |||
|
1858 | ;; | |||
|
1859 | ||||
|
1860 | -?* ) | |||
|
1861 | printf "invalid option: %s\n" "$key" >&2 | |||
|
1862 | exit 1 | |||
|
1863 | ;; | |||
|
1864 | ||||
|
1865 | * ) | |||
|
1866 | # :command.parse_requirements_case | |||
|
1867 | # :command.parse_requirements_case_simple | |||
|
1868 | printf "invalid argument: %s\n" "$key" >&2 | |||
|
1869 | exit 1 | |||
|
1870 | ||||
|
1871 | ;; | |||
|
1872 | ||||
|
1873 | esac | |||
|
1874 | done | |||
|
1875 | ||||
|
1876 | # :command.default_assignments | |||
|
1877 | [[ -n ${args[--server-url]:-} ]] || args[--server-url]="https://code.rhodecode.com" | |||
|
1878 | ||||
|
1879 | } | |||
|
1880 | ||||
|
1881 | # :command.parse_requirements | |||
|
1882 | rccontrol_bootstrap_parse_requirements() { | |||
|
1883 | # :command.fixed_flags_filter | |||
|
1884 | case "${1:-}" in | |||
|
1885 | --help | -h ) | |||
|
1886 | long_usage=yes | |||
|
1887 | rccontrol_bootstrap_usage | |||
|
1888 | exit | |||
|
1889 | ;; | |||
|
1890 | ||||
|
1891 | esac | |||
|
1892 | ||||
|
1893 | # :command.dependencies_filter | |||
|
1894 | if ! [[ -x "$(command -v curl)" ]]; then | |||
|
1895 | printf "missing dependency: curl\n" >&2 | |||
|
1896 | exit 1 | |||
|
1897 | fi | |||
|
1898 | if ! [[ -x "$(command -v tar)" ]]; then | |||
|
1899 | printf "missing dependency: tar\n" >&2 | |||
|
1900 | exit 1 | |||
|
1901 | fi | |||
|
1902 | if ! [[ -x "$(command -v md5sum)" ]]; then | |||
|
1903 | printf "missing dependency: md5sum\n" >&2 | |||
|
1904 | exit 1 | |||
|
1905 | fi | |||
|
1906 | ||||
|
1907 | # :command.command_filter | |||
|
1908 | action="bootstrap" | |||
|
1909 | ||||
|
1910 | # :command.parse_requirements_while | |||
|
1911 | while [[ $# -gt 0 ]]; do | |||
|
1912 | key="$1" | |||
|
1913 | case "$key" in | |||
|
1914 | # :flag.case | |||
|
1915 | --force | -f ) | |||
|
1916 | ||||
|
1917 | # :flag.case_no_arg | |||
|
1918 | args[--force]=1 | |||
|
1919 | shift | |||
|
1920 | ;; | |||
|
1921 | ||||
|
1922 | # :flag.case | |||
|
1923 | --auth-token ) | |||
|
1924 | ||||
|
1925 | # :flag.case_arg | |||
|
1926 | if [[ -n ${2+x} ]]; then | |||
|
1927 | ||||
|
1928 | args[--auth-token]="$2" | |||
|
1929 | shift | |||
|
1930 | shift | |||
|
1931 | else | |||
|
1932 | printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2 | |||
|
1933 | exit 1 | |||
|
1934 | fi | |||
|
1935 | ;; | |||
|
1936 | ||||
|
1937 | # :flag.case | |||
|
1938 | --server-url ) | |||
|
1939 | ||||
|
1940 | # :flag.case_arg | |||
|
1941 | if [[ -n ${2+x} ]]; then | |||
|
1942 | ||||
|
1943 | args[--server-url]="$2" | |||
|
1944 | shift | |||
|
1945 | shift | |||
|
1946 | else | |||
|
1947 | printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2 | |||
|
1948 | exit 1 | |||
|
1949 | fi | |||
|
1950 | ;; | |||
|
1951 | ||||
|
1952 | -?* ) | |||
|
1953 | printf "invalid option: %s\n" "$key" >&2 | |||
|
1954 | exit 1 | |||
|
1955 | ;; | |||
|
1956 | ||||
|
1957 | * ) | |||
|
1958 | # :command.parse_requirements_case | |||
|
1959 | # :command.parse_requirements_case_simple | |||
|
1960 | printf "invalid argument: %s\n" "$key" >&2 | |||
|
1961 | exit 1 | |||
|
1962 | ||||
|
1963 | ;; | |||
|
1964 | ||||
|
1965 | esac | |||
|
1966 | done | |||
|
1967 | ||||
|
1968 | # :command.default_assignments | |||
|
1969 | [[ -n ${args[--server-url]:-} ]] || args[--server-url]="https://code.rhodecode.com" | |||
|
1970 | ||||
|
1971 | } | |||
|
1972 | ||||
|
1973 | # :command.parse_requirements | |||
|
1974 | rccontrol_get_build_artifacts_parse_requirements() { | |||
|
1975 | # :command.fixed_flags_filter | |||
|
1976 | case "${1:-}" in | |||
|
1977 | --help | -h ) | |||
|
1978 | long_usage=yes | |||
|
1979 | rccontrol_get_build_artifacts_usage | |||
|
1980 | exit | |||
|
1981 | ;; | |||
|
1982 | ||||
|
1983 | esac | |||
|
1984 | ||||
|
1985 | # :command.command_filter | |||
|
1986 | action="get-build-artifacts" | |||
|
1987 | ||||
|
1988 | # :command.parse_requirements_while | |||
|
1989 | while [[ $# -gt 0 ]]; do | |||
|
1990 | key="$1" | |||
|
1991 | case "$key" in | |||
|
1992 | # :flag.case | |||
|
1993 | --auth ) | |||
|
1994 | ||||
|
1995 | # :flag.case_arg | |||
|
1996 | if [[ -n ${2+x} ]]; then | |||
|
1997 | ||||
|
1998 | args[--auth]="$2" | |||
|
1999 | shift | |||
|
2000 | shift | |||
|
2001 | else | |||
|
2002 | printf "%s\n" "--auth requires an argument: --auth AUTH" >&2 | |||
|
2003 | exit 1 | |||
|
2004 | fi | |||
|
2005 | ;; | |||
|
2006 | ||||
|
2007 | # :flag.case | |||
|
2008 | --installer-url ) | |||
|
2009 | ||||
|
2010 | # :flag.case_arg | |||
|
2011 | if [[ -n ${2+x} ]]; then | |||
|
2012 | ||||
|
2013 | args[--installer-url]="$2" | |||
|
2014 | shift | |||
|
2015 | shift | |||
|
2016 | else | |||
|
2017 | printf "%s\n" "--installer-url requires an argument: --installer-url INSTALLER_URL" >&2 | |||
|
2018 | exit 1 | |||
|
2019 | fi | |||
|
2020 | ;; | |||
|
2021 | ||||
|
2022 | # :flag.case | |||
|
2023 | --manifest-url ) | |||
|
2024 | ||||
|
2025 | # :flag.case_arg | |||
|
2026 | if [[ -n ${2+x} ]]; then | |||
|
2027 | ||||
|
2028 | args[--manifest-url]="$2" | |||
|
2029 | shift | |||
|
2030 | shift | |||
|
2031 | else | |||
|
2032 | printf "%s\n" "--manifest-url requires an argument: --manifest-url MANIFEST_URL" >&2 | |||
|
2033 | exit 1 | |||
|
2034 | fi | |||
|
2035 | ;; | |||
|
2036 | ||||
|
2037 | # :flag.case | |||
|
2038 | --version-name ) | |||
|
2039 | ||||
|
2040 | # :flag.case_arg | |||
|
2041 | if [[ -n ${2+x} ]]; then | |||
|
2042 | ||||
|
2043 | args[--version-name]="$2" | |||
|
2044 | shift | |||
|
2045 | shift | |||
|
2046 | else | |||
|
2047 | printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2 | |||
|
2048 | exit 1 | |||
|
2049 | fi | |||
|
2050 | ;; | |||
|
2051 | ||||
|
2052 | -?* ) | |||
|
2053 | printf "invalid option: %s\n" "$key" >&2 | |||
|
2054 | exit 1 | |||
|
2055 | ;; | |||
|
2056 | ||||
|
2057 | * ) | |||
|
2058 | # :command.parse_requirements_case | |||
|
2059 | # :command.parse_requirements_case_simple | |||
|
2060 | printf "invalid argument: %s\n" "$key" >&2 | |||
|
2061 | exit 1 | |||
|
2062 | ||||
|
2063 | ;; | |||
|
2064 | ||||
|
2065 | esac | |||
|
2066 | done | |||
|
2067 | ||||
|
2068 | # :command.default_assignments | |||
|
2069 | [[ -n ${args[--auth]:-} ]] || args[--auth]="" | |||
|
2070 | [[ -n ${args[--installer-url]:-} ]] || args[--installer-url]="https://dls.rhodecode.com/dls/N2E2ZTY1NzA3NjYxNDA2NTc1NjI3MTcyNzA2MjcxNzIyZTcwNjI3YQ==/rhodecode-control/latest-linux-ee" | |||
|
2071 | [[ -n ${args[--manifest-url]:-} ]] || args[--manifest-url]="https://dls.rhodecode.com/linux/MANIFEST" | |||
|
2072 | [[ -n ${args[--version-name]:-} ]] || args[--version-name]="$RC_CLI_VERSION_NAME" | |||
|
2073 | ||||
|
2074 | } | |||
|
2075 | ||||
|
2076 | # :command.parse_requirements | |||
|
2077 | rccontrol_build_parse_requirements() { | |||
|
2078 | # :command.fixed_flags_filter | |||
|
2079 | case "${1:-}" in | |||
|
2080 | --help | -h ) | |||
|
2081 | long_usage=yes | |||
|
2082 | rccontrol_build_usage | |||
|
2083 | exit | |||
|
2084 | ;; | |||
|
2085 | ||||
|
2086 | esac | |||
|
2087 | ||||
|
2088 | # :command.command_filter | |||
|
2089 | action="build" | |||
|
2090 | ||||
|
2091 | # :command.parse_requirements_while | |||
|
2092 | while [[ $# -gt 0 ]]; do | |||
|
2093 | key="$1" | |||
|
2094 | case "$key" in | |||
|
2095 | # :flag.case | |||
|
2096 | --version-name ) | |||
|
2097 | ||||
|
2098 | # :flag.case_arg | |||
|
2099 | if [[ -n ${2+x} ]]; then | |||
|
2100 | ||||
|
2101 | args[--version-name]="$2" | |||
|
2102 | shift | |||
|
2103 | shift | |||
|
2104 | else | |||
|
2105 | printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2 | |||
|
2106 | exit 1 | |||
|
2107 | fi | |||
|
2108 | ;; | |||
|
2109 | ||||
|
2110 | -?* ) | |||
|
2111 | printf "invalid option: %s\n" "$key" >&2 | |||
|
2112 | exit 1 | |||
|
2113 | ;; | |||
|
2114 | ||||
|
2115 | * ) | |||
|
2116 | # :command.parse_requirements_case | |||
|
2117 | # :command.parse_requirements_case_simple | |||
|
2118 | printf "invalid argument: %s\n" "$key" >&2 | |||
|
2119 | exit 1 | |||
|
2120 | ||||
|
2121 | ;; | |||
|
2122 | ||||
|
2123 | esac | |||
|
2124 | done | |||
|
2125 | ||||
|
2126 | # :command.default_assignments | |||
|
2127 | [[ -n ${args[--version-name]:-} ]] || args[--version-name]="$RC_CLI_VERSION_NAME" | |||
|
2128 | ||||
|
2129 | } | |||
|
2130 | ||||
|
2131 | # :command.parse_requirements | |||
|
2132 | rccontrol_get_build_source_parse_requirements() { | |||
|
2133 | # :command.fixed_flags_filter | |||
|
2134 | case "${1:-}" in | |||
|
2135 | --help | -h ) | |||
|
2136 | long_usage=yes | |||
|
2137 | rccontrol_get_build_source_usage | |||
|
2138 | exit | |||
|
2139 | ;; | |||
|
2140 | ||||
|
2141 | esac | |||
|
2142 | ||||
|
2143 | # :command.dependencies_filter | |||
|
2144 | if ! [[ -x "$(command -v curl)" ]]; then | |||
|
2145 | printf "missing dependency: curl\n" >&2 | |||
|
2146 | exit 1 | |||
|
2147 | fi | |||
|
2148 | if ! [[ -x "$(command -v tar)" ]]; then | |||
|
2149 | printf "missing dependency: tar\n" >&2 | |||
|
2150 | exit 1 | |||
|
2151 | fi | |||
|
2152 | ||||
|
2153 | # :command.command_filter | |||
|
2154 | action="get-build-source" | |||
|
2155 | ||||
|
2156 | # :command.parse_requirements_while | |||
|
2157 | while [[ $# -gt 0 ]]; do | |||
|
2158 | key="$1" | |||
|
2159 | case "$key" in | |||
|
2160 | # :flag.case | |||
|
2161 | --auth-token ) | |||
|
2162 | ||||
|
2163 | # :flag.case_arg | |||
|
2164 | if [[ -n ${2+x} ]]; then | |||
|
2165 | ||||
|
2166 | args[--auth-token]="$2" | |||
|
2167 | shift | |||
|
2168 | shift | |||
|
2169 | else | |||
|
2170 | printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2 | |||
|
2171 | exit 1 | |||
|
2172 | fi | |||
|
2173 | ;; | |||
|
2174 | ||||
|
2175 | # :flag.case | |||
|
2176 | --server-url ) | |||
|
2177 | ||||
|
2178 | # :flag.case_arg | |||
|
2179 | if [[ -n ${2+x} ]]; then | |||
|
2180 | ||||
|
2181 | args[--server-url]="$2" | |||
|
2182 | shift | |||
|
2183 | shift | |||
|
2184 | else | |||
|
2185 | printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2 | |||
|
2186 | exit 1 | |||
|
2187 | fi | |||
|
2188 | ;; | |||
|
2189 | ||||
|
2190 | -?* ) | |||
|
2191 | printf "invalid option: %s\n" "$key" >&2 | |||
|
2192 | exit 1 | |||
|
2193 | ;; | |||
|
2194 | ||||
|
2195 | * ) | |||
|
2196 | # :command.parse_requirements_case | |||
|
2197 | # :command.parse_requirements_case_simple | |||
|
2198 | if [[ -z ${args[revision]+x} ]]; then | |||
|
2199 | ||||
|
2200 | args[revision]=$1 | |||
|
2201 | shift | |||
|
2202 | else | |||
|
2203 | printf "invalid argument: %s\n" "$key" >&2 | |||
|
2204 | exit 1 | |||
|
2205 | fi | |||
|
2206 | ||||
|
2207 | ;; | |||
|
2208 | ||||
|
2209 | esac | |||
|
2210 | done | |||
|
2211 | ||||
|
2212 | # :command.required_args_filter | |||
|
2213 | if [[ -z ${args[revision]+x} ]]; then | |||
|
2214 | printf "missing required argument: REVISION\nusage: rccontrol get-build-source REVISION [OPTIONS]\n" >&2 | |||
|
2215 | exit 1 | |||
|
2216 | fi | |||
|
2217 | ||||
|
2218 | # :command.default_assignments | |||
|
2219 | [[ -n ${args[--server-url]:-} ]] || args[--server-url]="https://code.rhodecode.com" | |||
|
2220 | ||||
|
2221 | } | |||
|
2222 | ||||
|
2223 | # :command.parse_requirements | |||
|
2224 | rccontrol_build_source_parse_requirements() { | |||
|
2225 | # :command.fixed_flags_filter | |||
|
2226 | case "${1:-}" in | |||
|
2227 | --help | -h ) | |||
|
2228 | long_usage=yes | |||
|
2229 | rccontrol_build_source_usage | |||
|
2230 | exit | |||
|
2231 | ;; | |||
|
2232 | ||||
|
2233 | esac | |||
|
2234 | ||||
|
2235 | # :command.command_filter | |||
|
2236 | action="build-source" | |||
|
2237 | ||||
|
2238 | # :command.parse_requirements_while | |||
|
2239 | while [[ $# -gt 0 ]]; do | |||
|
2240 | key="$1" | |||
|
2241 | case "$key" in | |||
|
2242 | # :flag.case | |||
|
2243 | --version-name ) | |||
|
2244 | ||||
|
2245 | # :flag.case_arg | |||
|
2246 | if [[ -n ${2+x} ]]; then | |||
|
2247 | ||||
|
2248 | args[--version-name]="$2" | |||
|
2249 | shift | |||
|
2250 | shift | |||
|
2251 | else | |||
|
2252 | printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2 | |||
|
2253 | exit 1 | |||
|
2254 | fi | |||
|
2255 | ;; | |||
|
2256 | ||||
|
2257 | -?* ) | |||
|
2258 | printf "invalid option: %s\n" "$key" >&2 | |||
|
2259 | exit 1 | |||
|
2260 | ;; | |||
|
2261 | ||||
|
2262 | * ) | |||
|
2263 | # :command.parse_requirements_case | |||
|
2264 | # :command.parse_requirements_case_simple | |||
|
2265 | printf "invalid argument: %s\n" "$key" >&2 | |||
|
2266 | exit 1 | |||
|
2267 | ||||
|
2268 | ;; | |||
|
2269 | ||||
|
2270 | esac | |||
|
2271 | done | |||
|
2272 | ||||
|
2273 | # :command.default_assignments | |||
|
2274 | [[ -n ${args[--version-name]:-} ]] || args[--version-name]="$RC_CLI_VERSION_NAME" | |||
|
2275 | ||||
|
2276 | } | |||
|
2277 | ||||
|
2278 | # :command.parse_requirements | |||
|
2279 | rccontrol_stack_parse_requirements() { | |||
|
2280 | # :command.fixed_flags_filter | |||
|
2281 | case "${1:-}" in | |||
|
2282 | --help | -h ) | |||
|
2283 | long_usage=yes | |||
|
2284 | rccontrol_stack_usage | |||
|
2285 | exit | |||
|
2286 | ;; | |||
|
2287 | ||||
|
2288 | esac | |||
|
2289 | ||||
|
2290 | # :command.command_filter | |||
|
2291 | action="stack" | |||
|
2292 | ||||
|
2293 | # :command.parse_requirements_while | |||
|
2294 | while [[ $# -gt 0 ]]; do | |||
|
2295 | key="$1" | |||
|
2296 | case "$key" in | |||
|
2297 | ||||
|
2298 | -?* ) | |||
|
2299 | other_args+=("$1") | |||
|
2300 | shift | |||
|
2301 | ;; | |||
|
2302 | ||||
|
2303 | * ) | |||
|
2304 | # :command.parse_requirements_case | |||
|
2305 | # :command.parse_requirements_case_catch_all | |||
|
2306 | if [[ -z ${args[name]+x} ]]; then | |||
|
2307 | ||||
|
2308 | args[name]=$1 | |||
|
2309 | shift | |||
|
2310 | else | |||
|
2311 | other_args+=("$1") | |||
|
2312 | shift | |||
|
2313 | fi | |||
|
2314 | ||||
|
2315 | ;; | |||
|
2316 | ||||
|
2317 | esac | |||
|
2318 | done | |||
|
2319 | ||||
|
2320 | # :command.required_args_filter | |||
|
2321 | if [[ -z ${args[name]+x} ]]; then | |||
|
2322 | printf "missing required argument: NAME\nusage: rccontrol stack NAME [SERVICES PARAMS...]\n" >&2 | |||
|
2323 | exit 1 | |||
|
2324 | fi | |||
|
2325 | ||||
|
2326 | # :command.whitelist_filter | |||
|
2327 | if [[ ! ${args[name]} =~ ^(router|metrics|services|rhodecode)$ ]]; then | |||
|
2328 | printf "%s\n" "name must be one of: router, metrics, services, rhodecode" >&2 | |||
|
2329 | exit 1 | |||
|
2330 | fi | |||
|
2331 | ||||
|
2332 | } | |||
|
2333 | ||||
|
2334 | # :command.parse_requirements | |||
|
2335 | rccontrol_stack_status_parse_requirements() { | |||
|
2336 | # :command.fixed_flags_filter | |||
|
2337 | case "${1:-}" in | |||
|
2338 | --help | -h ) | |||
|
2339 | long_usage=yes | |||
|
2340 | rccontrol_stack_status_usage | |||
|
2341 | exit | |||
|
2342 | ;; | |||
|
2343 | ||||
|
2344 | esac | |||
|
2345 | ||||
|
2346 | # :command.command_filter | |||
|
2347 | action="stack-status" | |||
|
2348 | ||||
|
2349 | # :command.parse_requirements_while | |||
|
2350 | while [[ $# -gt 0 ]]; do | |||
|
2351 | key="$1" | |||
|
2352 | case "$key" in | |||
|
2353 | ||||
|
2354 | -?* ) | |||
|
2355 | printf "invalid option: %s\n" "$key" >&2 | |||
|
2356 | exit 1 | |||
|
2357 | ;; | |||
|
2358 | ||||
|
2359 | * ) | |||
|
2360 | # :command.parse_requirements_case | |||
|
2361 | # :command.parse_requirements_case_simple | |||
|
2362 | printf "invalid argument: %s\n" "$key" >&2 | |||
|
2363 | exit 1 | |||
|
2364 | ||||
|
2365 | ;; | |||
|
2366 | ||||
|
2367 | esac | |||
|
2368 | done | |||
|
2369 | ||||
|
2370 | } | |||
|
2371 | ||||
|
2372 | # :command.parse_requirements | |||
|
2373 | rccontrol_stack_upgrade_parse_requirements() { | |||
|
2374 | # :command.fixed_flags_filter | |||
|
2375 | case "${1:-}" in | |||
|
2376 | --help | -h ) | |||
|
2377 | long_usage=yes | |||
|
2378 | rccontrol_stack_upgrade_usage | |||
|
2379 | exit | |||
|
2380 | ;; | |||
|
2381 | ||||
|
2382 | esac | |||
|
2383 | ||||
|
2384 | # :command.command_filter | |||
|
2385 | action="stack-upgrade" | |||
|
2386 | ||||
|
2387 | # :command.parse_requirements_while | |||
|
2388 | while [[ $# -gt 0 ]]; do | |||
|
2389 | key="$1" | |||
|
2390 | case "$key" in | |||
|
2391 | ||||
|
2392 | -?* ) | |||
|
2393 | printf "invalid option: %s\n" "$key" >&2 | |||
|
2394 | exit 1 | |||
|
2395 | ;; | |||
|
2396 | ||||
|
2397 | * ) | |||
|
2398 | # :command.parse_requirements_case | |||
|
2399 | # :command.parse_requirements_case_simple | |||
|
2400 | printf "invalid argument: %s\n" "$key" >&2 | |||
|
2401 | exit 1 | |||
|
2402 | ||||
|
2403 | ;; | |||
|
2404 | ||||
|
2405 | esac | |||
|
2406 | done | |||
|
2407 | ||||
|
2408 | } | |||
|
2409 | ||||
|
2410 | # :command.parse_requirements | |||
|
2411 | rccontrol_cli_redis_parse_requirements() { | |||
|
2412 | # :command.fixed_flags_filter | |||
|
2413 | case "${1:-}" in | |||
|
2414 | --help | -h ) | |||
|
2415 | long_usage=yes | |||
|
2416 | rccontrol_cli_redis_usage | |||
|
2417 | exit | |||
|
2418 | ;; | |||
|
2419 | ||||
|
2420 | esac | |||
|
2421 | ||||
|
2422 | # :command.command_filter | |||
|
2423 | action="cli-redis" | |||
|
2424 | ||||
|
2425 | # :command.parse_requirements_while | |||
|
2426 | while [[ $# -gt 0 ]]; do | |||
|
2427 | key="$1" | |||
|
2428 | case "$key" in | |||
|
2429 | ||||
|
2430 | -?* ) | |||
|
2431 | printf "invalid option: %s\n" "$key" >&2 | |||
|
2432 | exit 1 | |||
|
2433 | ;; | |||
|
2434 | ||||
|
2435 | * ) | |||
|
2436 | # :command.parse_requirements_case | |||
|
2437 | # :command.parse_requirements_case_simple | |||
|
2438 | printf "invalid argument: %s\n" "$key" >&2 | |||
|
2439 | exit 1 | |||
|
2440 | ||||
|
2441 | ;; | |||
|
2442 | ||||
|
2443 | esac | |||
|
2444 | done | |||
|
2445 | ||||
|
2446 | } | |||
|
2447 | ||||
|
2448 | # :command.parse_requirements | |||
|
2449 | rccontrol_cli_db_parse_requirements() { | |||
|
2450 | # :command.fixed_flags_filter | |||
|
2451 | case "${1:-}" in | |||
|
2452 | --help | -h ) | |||
|
2453 | long_usage=yes | |||
|
2454 | rccontrol_cli_db_usage | |||
|
2455 | exit | |||
|
2456 | ;; | |||
|
2457 | ||||
|
2458 | esac | |||
|
2459 | ||||
|
2460 | # :command.command_filter | |||
|
2461 | action="cli-db" | |||
|
2462 | ||||
|
2463 | # :command.parse_requirements_while | |||
|
2464 | while [[ $# -gt 0 ]]; do | |||
|
2465 | key="$1" | |||
|
2466 | case "$key" in | |||
|
2467 | ||||
|
2468 | -?* ) | |||
|
2469 | printf "invalid option: %s\n" "$key" >&2 | |||
|
2470 | exit 1 | |||
|
2471 | ;; | |||
|
2472 | ||||
|
2473 | * ) | |||
|
2474 | # :command.parse_requirements_case | |||
|
2475 | # :command.parse_requirements_case_simple | |||
|
2476 | printf "invalid argument: %s\n" "$key" >&2 | |||
|
2477 | exit 1 | |||
|
2478 | ||||
|
2479 | ;; | |||
|
2480 | ||||
|
2481 | esac | |||
|
2482 | done | |||
|
2483 | ||||
|
2484 | } | |||
|
2485 | ||||
|
2486 | # :command.parse_requirements | |||
|
2487 | rccontrol_cli_db_upgrade_parse_requirements() { | |||
|
2488 | # :command.fixed_flags_filter | |||
|
2489 | case "${1:-}" in | |||
|
2490 | --help | -h ) | |||
|
2491 | long_usage=yes | |||
|
2492 | rccontrol_cli_db_upgrade_usage | |||
|
2493 | exit | |||
|
2494 | ;; | |||
|
2495 | ||||
|
2496 | esac | |||
|
2497 | ||||
|
2498 | # :command.command_filter | |||
|
2499 | action="cli-db-upgrade" | |||
|
2500 | ||||
|
2501 | # :command.parse_requirements_while | |||
|
2502 | while [[ $# -gt 0 ]]; do | |||
|
2503 | key="$1" | |||
|
2504 | case "$key" in | |||
|
2505 | ||||
|
2506 | -?* ) | |||
|
2507 | printf "invalid option: %s\n" "$key" >&2 | |||
|
2508 | exit 1 | |||
|
2509 | ;; | |||
|
2510 | ||||
|
2511 | * ) | |||
|
2512 | # :command.parse_requirements_case | |||
|
2513 | # :command.parse_requirements_case_simple | |||
|
2514 | printf "invalid argument: %s\n" "$key" >&2 | |||
|
2515 | exit 1 | |||
|
2516 | ||||
|
2517 | ;; | |||
|
2518 | ||||
|
2519 | esac | |||
|
2520 | done | |||
|
2521 | ||||
|
2522 | } | |||
|
2523 | ||||
|
2524 | # :command.parse_requirements | |||
|
2525 | rccontrol__completions_parse_requirements() { | |||
|
2526 | # :command.fixed_flags_filter | |||
|
2527 | case "${1:-}" in | |||
|
2528 | --help | -h ) | |||
|
2529 | long_usage=yes | |||
|
2530 | rccontrol__completions_usage | |||
|
2531 | exit | |||
|
2532 | ;; | |||
|
2533 | ||||
|
2534 | esac | |||
|
2535 | ||||
|
2536 | # :command.command_filter | |||
|
2537 | action="_completions" | |||
|
2538 | ||||
|
2539 | # :command.parse_requirements_while | |||
|
2540 | while [[ $# -gt 0 ]]; do | |||
|
2541 | key="$1" | |||
|
2542 | case "$key" in | |||
|
2543 | ||||
|
2544 | -?* ) | |||
|
2545 | printf "invalid option: %s\n" "$key" >&2 | |||
|
2546 | exit 1 | |||
|
2547 | ;; | |||
|
2548 | ||||
|
2549 | * ) | |||
|
2550 | # :command.parse_requirements_case | |||
|
2551 | # :command.parse_requirements_case_simple | |||
|
2552 | printf "invalid argument: %s\n" "$key" >&2 | |||
|
2553 | exit 1 | |||
|
2554 | ||||
|
2555 | ;; | |||
|
2556 | ||||
|
2557 | esac | |||
|
2558 | done | |||
|
2559 | ||||
|
2560 | } | |||
|
2561 | ||||
|
2562 | # :command.parse_requirements | |||
|
2563 | rccontrol_backup_db_parse_requirements() { | |||
|
2564 | # :command.fixed_flags_filter | |||
|
2565 | case "${1:-}" in | |||
|
2566 | --help | -h ) | |||
|
2567 | long_usage=yes | |||
|
2568 | rccontrol_backup_db_usage | |||
|
2569 | exit | |||
|
2570 | ;; | |||
|
2571 | ||||
|
2572 | esac | |||
|
2573 | ||||
|
2574 | # :command.dependencies_filter | |||
|
2575 | if ! [[ -x "$(command -v tar)" ]]; then | |||
|
2576 | printf "missing dependency: tar\n" >&2 | |||
|
2577 | exit 1 | |||
|
2578 | fi | |||
|
2579 | if ! [[ -x "$(command -v gzip)" ]]; then | |||
|
2580 | printf "missing dependency: gzip\n" >&2 | |||
|
2581 | exit 1 | |||
|
2582 | fi | |||
|
2583 | ||||
|
2584 | # :command.command_filter | |||
|
2585 | action="backup-db" | |||
|
2586 | ||||
|
2587 | # :command.parse_requirements_while | |||
|
2588 | while [[ $# -gt 0 ]]; do | |||
|
2589 | key="$1" | |||
|
2590 | case "$key" in | |||
|
2591 | ||||
|
2592 | -?* ) | |||
|
2593 | printf "invalid option: %s\n" "$key" >&2 | |||
|
2594 | exit 1 | |||
|
2595 | ;; | |||
|
2596 | ||||
|
2597 | * ) | |||
|
2598 | # :command.parse_requirements_case | |||
|
2599 | # :command.parse_requirements_case_simple | |||
|
2600 | printf "invalid argument: %s\n" "$key" >&2 | |||
|
2601 | exit 1 | |||
|
2602 | ||||
|
2603 | ;; | |||
|
2604 | ||||
|
2605 | esac | |||
|
2606 | done | |||
|
2607 | ||||
|
2608 | } | |||
|
2609 | ||||
|
2610 | # :command.parse_requirements | |||
|
2611 | rccontrol_backup_data_parse_requirements() { | |||
|
2612 | # :command.fixed_flags_filter | |||
|
2613 | case "${1:-}" in | |||
|
2614 | --help | -h ) | |||
|
2615 | long_usage=yes | |||
|
2616 | rccontrol_backup_data_usage | |||
|
2617 | exit | |||
|
2618 | ;; | |||
|
2619 | ||||
|
2620 | esac | |||
|
2621 | ||||
|
2622 | # :command.dependencies_filter | |||
|
2623 | if ! [[ -x "$(command -v tar)" ]]; then | |||
|
2624 | printf "missing dependency: tar\n" >&2 | |||
|
2625 | exit 1 | |||
|
2626 | fi | |||
|
2627 | ||||
|
2628 | # :command.command_filter | |||
|
2629 | action="backup-data" | |||
|
2630 | ||||
|
2631 | # :command.parse_requirements_while | |||
|
2632 | while [[ $# -gt 0 ]]; do | |||
|
2633 | key="$1" | |||
|
2634 | case "$key" in | |||
|
2635 | ||||
|
2636 | -?* ) | |||
|
2637 | printf "invalid option: %s\n" "$key" >&2 | |||
|
2638 | exit 1 | |||
|
2639 | ;; | |||
|
2640 | ||||
|
2641 | * ) | |||
|
2642 | # :command.parse_requirements_case | |||
|
2643 | # :command.parse_requirements_case_simple | |||
|
2644 | printf "invalid argument: %s\n" "$key" >&2 | |||
|
2645 | exit 1 | |||
|
2646 | ||||
|
2647 | ;; | |||
|
2648 | ||||
|
2649 | esac | |||
|
2650 | done | |||
|
2651 | ||||
|
2652 | } | |||
|
2653 | ||||
|
2654 | # :command.initialize | |||
|
2655 | initialize() { | |||
|
2656 | version="4.28.0.REL20221101" | |||
|
2657 | long_usage='' | |||
|
2658 | set -e | |||
|
2659 | ||||
|
2660 | # :command.environment_variables_default | |||
|
2661 | export RC_CLI_VERSION_NAME="${RC_CLI_VERSION_NAME:-4.27.0}" | |||
|
2662 | export RC_STACK_ROUTER_EXT="${RC_STACK_ROUTER_EXT:-.custom/docker-compose-router.override.yaml}" | |||
|
2663 | export RC_STACK_METRICS_EXT="${RC_STACK_METRICS_EXT:-.custom/docker-compose-metrics.override.yaml}" | |||
|
2664 | export RC_STACK_SERVICES_EXT="${RC_STACK_SERVICES_EXT:-.custom/docker-compose-services.override.yaml}" | |||
|
2665 | export RC_STACK_RHODECODE_EXT="${RC_STACK_RHODECODE_EXT:-.custom/docker-compose-apps.override.yaml}" | |||
|
2666 | ||||
|
2667 | # src/initialize.sh | |||
|
2668 | ||||
|
2669 | ENV_FILE=$PWD/.env | |||
|
2670 | ||||
|
2671 | # bootstrap file is a config file at the same time | |||
|
2672 | BOOTSTRAP_FILE='.rccontrol-bootstrap' | |||
|
2673 | CONFIG_FILE='.rccontrol.ini' | |||
|
2674 | ||||
|
2675 | VALID_SERVICES="router metrics services rhodecode" | |||
|
2676 | DOCKER_DEFS_WORK_DIR="docker_defs" | |||
|
2677 | ||||
|
2678 | #echo "1 ----" | |||
|
2679 | #echo $RC_STACK_SERVICES_EXT | |||
|
2680 | #echo $RC_STACK_METRICS_EXT | |||
|
2681 | #echo "1 -----" | |||
|
2682 | ||||
|
2683 | #echo '2 ----' | |||
|
2684 | #grep -v -e '^#' "$ENV_FILE" | xargs -I {} echo \'{}\' | |||
|
2685 | #echo '2 ----' | |||
|
2686 | ||||
|
2687 | #expose env vars from rccontrol donfig | |||
|
2688 | #if [[ -f $ENV_FILE ]]; then | |||
|
2689 | # eval $(grep -v -e '^#' "$ENV_FILE" | xargs -I {} echo export \'{}\') | |||
|
2690 | #fi | |||
|
2691 | ||||
|
2692 | #ENV_EXPAND="" | |||
|
2693 | #for k in $(config_keys); do | |||
|
2694 | # k_upper=${k^^} | |||
|
2695 | # env_entry="-e $k_upper='$(config_get "$k")' " | |||
|
2696 | # ENV_EXPAND+=$env_entry; | |||
|
2697 | # #echo $env_expand | |||
|
2698 | #done | |||
|
2699 | ||||
|
2700 | # | |||
|
2701 | #echo "3 ----" | |||
|
2702 | #echo $RC_STACK_SERVICES_EXT | |||
|
2703 | #echo $RC_STACK_METRICS_EXT | |||
|
2704 | #echo $RC_STACK_RHODECODE_EXT | |||
|
2705 | #echo "3 -----" | |||
|
2706 | ||||
|
2707 | #env | grep RC_ | |||
|
2708 | ||||
|
2709 | # backup files from a docker volume into /tmp/backup.tar.gz | |||
|
2710 | docker-volume-backup-compressed() { | |||
|
2711 | docker run --rm -v /tmp:/backup --volumes-from "$1" debian:jessie tar -czvf /backup/backup.tar.gz "${@:2}" | |||
|
2712 | } | |||
|
2713 | ||||
|
2714 | # restore files from /tmp/backup.tar.gz into a docker volume | |||
|
2715 | docker-volume-restore-compressed() { | |||
|
2716 | docker run --rm -v /tmp:/backup --volumes-from "$1" debian:jessie tar -xzvf /backup/backup.tar.gz "${@:2}" | |||
|
2717 | echo "Double checking files..." | |||
|
2718 | docker run --rm -v /tmp:/backup --volumes-from "$1" debian:jessie ls -lh "${@:2}" | |||
|
2719 | } | |||
|
2720 | ||||
|
2721 | # backup files from a docker volume into /tmp/backup.tar | |||
|
2722 | docker-volume-backup() { | |||
|
2723 | docker run --rm -v /tmp:/backup --volumes-from "$1" busybox tar -cvf /backup/backup.tar "${@:2}" | |||
|
2724 | } | |||
|
2725 | ||||
|
2726 | # restore files from /tmp/backup.tar into a docker volume | |||
|
2727 | docker-volume-restore() { | |||
|
2728 | docker run --rm -v /tmp:/backup --volumes-from "$1" busybox tar -xvf /backup/backup.tar "${@:2}" | |||
|
2729 | echo "Double checking files..." | |||
|
2730 | docker run --rm -v /tmp:/backup --volumes-from "$1" busybox ls -lh "${@:2}" | |||
|
2731 | } | |||
|
2732 | ||||
|
2733 | get_started() { | |||
|
2734 | echo "" | |||
|
2735 | echo "~~~~ $(green Bootstrap completed) ~~~~" | |||
|
2736 | echo "To start using RhodeCode run the following stacks using ./rccontrol stack [STACK_NAME]" | |||
|
2737 | echo "" | |||
|
2738 | echo "$(yellow_bold [Optional]): run the edge router to control domain and SSL" | |||
|
2739 | echo "./rccontrol stack router up --detach" | |||
|
2740 | echo "" | |||
|
2741 | echo "$(green_bold [Mandatory]): run the services, like database, redis, channelstream etc..." | |||
|
2742 | echo "./rccontrol stack services up --detach" | |||
|
2743 | echo "" | |||
|
2744 | echo "$(green_bold [Mandatory]): run the rhodecode app stack" | |||
|
2745 | echo "./rccontrol stack rhodecode up --detach" | |||
|
2746 | echo "" | |||
|
2747 | echo "$(yellow_bold [Optional]): run the monitoring stack, this includes grafana/promethues logging/metrics system" | |||
|
2748 | echo "./rccontrol stack metrics up --detach" | |||
|
2749 | echo "" | |||
|
2750 | echo "check services status/ports" | |||
|
2751 | echo "./rccontrol status" | |||
|
2752 | } | |||
|
2753 | } | |||
|
2754 | ||||
|
2755 | # :command.run | |||
|
2756 | run() { | |||
|
2757 | declare -A args=() | |||
|
2758 | declare -a other_args=() | |||
|
2759 | declare -a input=() | |||
|
2760 | normalize_input "$@" | |||
|
2761 | parse_requirements "${input[@]}" | |||
|
2762 | ||||
|
2763 | if [[ $action == "self-update" ]]; then | |||
|
2764 | if [[ ${args[--help]:-} ]]; then | |||
|
2765 | long_usage=yes | |||
|
2766 | rccontrol_self_update_usage | |||
|
2767 | else | |||
|
2768 | rccontrol_self_update_command | |||
|
2769 | fi | |||
|
2770 | ||||
|
2771 | elif [[ $action == "bootstrap" ]]; then | |||
|
2772 | if [[ ${args[--help]:-} ]]; then | |||
|
2773 | long_usage=yes | |||
|
2774 | rccontrol_bootstrap_usage | |||
|
2775 | else | |||
|
2776 | rccontrol_bootstrap_command | |||
|
2777 | fi | |||
|
2778 | ||||
|
2779 | elif [[ $action == "get-build-artifacts" ]]; then | |||
|
2780 | if [[ ${args[--help]:-} ]]; then | |||
|
2781 | long_usage=yes | |||
|
2782 | rccontrol_get_build_artifacts_usage | |||
|
2783 | else | |||
|
2784 | rccontrol_get_build_artifacts_command | |||
|
2785 | fi | |||
|
2786 | ||||
|
2787 | elif [[ $action == "build" ]]; then | |||
|
2788 | if [[ ${args[--help]:-} ]]; then | |||
|
2789 | long_usage=yes | |||
|
2790 | rccontrol_build_usage | |||
|
2791 | else | |||
|
2792 | rccontrol_build_command | |||
|
2793 | fi | |||
|
2794 | ||||
|
2795 | elif [[ $action == "get-build-source" ]]; then | |||
|
2796 | if [[ ${args[--help]:-} ]]; then | |||
|
2797 | long_usage=yes | |||
|
2798 | rccontrol_get_build_source_usage | |||
|
2799 | else | |||
|
2800 | rccontrol_get_build_source_command | |||
|
2801 | fi | |||
|
2802 | ||||
|
2803 | elif [[ $action == "build-source" ]]; then | |||
|
2804 | if [[ ${args[--help]:-} ]]; then | |||
|
2805 | long_usage=yes | |||
|
2806 | rccontrol_build_source_usage | |||
|
2807 | else | |||
|
2808 | rccontrol_build_source_command | |||
|
2809 | fi | |||
|
2810 | ||||
|
2811 | elif [[ $action == "stack" ]]; then | |||
|
2812 | if [[ ${args[--help]:-} ]]; then | |||
|
2813 | long_usage=yes | |||
|
2814 | rccontrol_stack_usage | |||
|
2815 | else | |||
|
2816 | rccontrol_stack_command | |||
|
2817 | fi | |||
|
2818 | ||||
|
2819 | elif [[ $action == "stack-status" ]]; then | |||
|
2820 | if [[ ${args[--help]:-} ]]; then | |||
|
2821 | long_usage=yes | |||
|
2822 | rccontrol_stack_status_usage | |||
|
2823 | else | |||
|
2824 | rccontrol_stack_status_command | |||
|
2825 | fi | |||
|
2826 | ||||
|
2827 | elif [[ $action == "stack-upgrade" ]]; then | |||
|
2828 | if [[ ${args[--help]:-} ]]; then | |||
|
2829 | long_usage=yes | |||
|
2830 | rccontrol_stack_upgrade_usage | |||
|
2831 | else | |||
|
2832 | rccontrol_stack_upgrade_command | |||
|
2833 | fi | |||
|
2834 | ||||
|
2835 | elif [[ $action == "cli-redis" ]]; then | |||
|
2836 | if [[ ${args[--help]:-} ]]; then | |||
|
2837 | long_usage=yes | |||
|
2838 | rccontrol_cli_redis_usage | |||
|
2839 | else | |||
|
2840 | rccontrol_cli_redis_command | |||
|
2841 | fi | |||
|
2842 | ||||
|
2843 | elif [[ $action == "cli-db" ]]; then | |||
|
2844 | if [[ ${args[--help]:-} ]]; then | |||
|
2845 | long_usage=yes | |||
|
2846 | rccontrol_cli_db_usage | |||
|
2847 | else | |||
|
2848 | rccontrol_cli_db_command | |||
|
2849 | fi | |||
|
2850 | ||||
|
2851 | elif [[ $action == "cli-db-upgrade" ]]; then | |||
|
2852 | if [[ ${args[--help]:-} ]]; then | |||
|
2853 | long_usage=yes | |||
|
2854 | rccontrol_cli_db_upgrade_usage | |||
|
2855 | else | |||
|
2856 | rccontrol_cli_db_upgrade_command | |||
|
2857 | fi | |||
|
2858 | ||||
|
2859 | elif [[ $action == "_completions" ]]; then | |||
|
2860 | if [[ ${args[--help]:-} ]]; then | |||
|
2861 | long_usage=yes | |||
|
2862 | rccontrol__completions_usage | |||
|
2863 | else | |||
|
2864 | rccontrol__completions_command | |||
|
2865 | fi | |||
|
2866 | ||||
|
2867 | elif [[ $action == "backup-db" ]]; then | |||
|
2868 | if [[ ${args[--help]:-} ]]; then | |||
|
2869 | long_usage=yes | |||
|
2870 | rccontrol_backup_db_usage | |||
|
2871 | else | |||
|
2872 | rccontrol_backup_db_command | |||
|
2873 | fi | |||
|
2874 | ||||
|
2875 | elif [[ $action == "backup-data" ]]; then | |||
|
2876 | if [[ ${args[--help]:-} ]]; then | |||
|
2877 | long_usage=yes | |||
|
2878 | rccontrol_backup_data_usage | |||
|
2879 | else | |||
|
2880 | rccontrol_backup_data_command | |||
|
2881 | fi | |||
|
2882 | ||||
|
2883 | elif [[ $action == "root" ]]; then | |||
|
2884 | root_command | |||
|
2885 | fi | |||
|
2886 | } | |||
|
2887 | ||||
|
2888 | initialize | |||
|
2889 | run "$@" |
@@ -1,31 +1,56 b'' | |||||
1 | COMPOSE_PROJECT_NAME=rc_cluster |
|
1 | #COMPOSE_PROJECT_NAME=rc_cluster | |
2 | TZ="UTC" |
|
2 | TZ="UTC" | |
3 |
|
3 | |||
|
4 | ||||
4 | # Version to deploy and run |
|
5 | # Version to deploy and run | |
5 | RC_VERSION="4.28.0" |
|
6 | ## VERSION_INFO | |
|
7 | RC_VERSION="4.28.0.REL20221120_SOURCE" | |||
|
8 | #RC_CLI_VERSION_NAME="4.27.0" | |||
|
9 | ||||
|
10 | # ce, or ee | |||
|
11 | RC_EDITION=ee | |||
|
12 | RC_IMAGE_CE="rhodecode/rhodecode-ee:$RC_VERSION" | |||
|
13 | RC_IMAGE_EE="rhodecode/rhodecode-ce:$RC_VERSION" | |||
6 |
|
14 | |||
7 | # Database access credentials |
|
15 | # Database bootstrap/access credentials | |
8 | DB_NAME=rhodecode |
|
16 | DB_NAME=rhodecode | |
9 | DB_USER=rhodecode |
|
17 | DB_USER=rhodecode | |
10 | DB_PASSWORD=hUc1adS7oDd6Oj3in3 |
|
|||
11 |
|
18 | |||
12 | # base url for running app |
|
19 | # Bootstrap container with specific password | |
13 | RHODECODE_BASE_URL=http://localhost:8888 |
|
20 | # This password will be used to generate new account and password for the database | |
|
21 | DB_PASSWORD=[GENERATED_AT_BOOTSTRAP] | |||
14 |
|
22 | |||
15 | # HTTP and HTTPS ports for running app |
|
23 | # set limit of redis in-memory cache before keys get evicted using LRU cache | |
16 | RC_HTTP_PORT=8888 |
|
24 | RC_REDIS_MAXMEMORY=1024mb | |
17 | RC_HTTPS_PORT=8443 |
|
25 | ||
|
26 | # set the size of ramdisk used for locking files | |||
|
27 | RC_DATA_RAMDISK_SIZE=1G | |||
|
28 | ||||
|
29 | # base url for running app, this is used for traefik hasname matching, so accessing this host will redirect | |||
|
30 | # traffic to the running instance | |||
|
31 | # replace this with your name of host. e.g http://yourdomain.com or https://rc.company.local | |||
|
32 | RHODECODE_HOSTNAME=docker-dev | |||
18 |
|
33 | |||
19 | # SSH Port exposed, increased security is to not used default 22 |
|
|||
20 | RC_SSH_PORT=9022 |
|
|||
21 |
|
34 | |||
22 | # user/password for first admin user created for access |
|
35 | # user/password for first admin user created for access | |
23 | RHODECODE_USER_EMAIL=admin@rhodecode.com |
|
36 | # this is a bootstrap super-admin account to access the web interface | |
|
37 | RHODECODE_USER_EMAIL=admin@server-com | |||
24 | RHODECODE_USER_NAME=admin |
|
38 | RHODECODE_USER_NAME=admin | |
25 | RHODECODE_USER_PASS=secret4 |
|
39 | RHODECODE_USER_PASS=secret4 | |
26 |
|
40 | |||
|
41 | ||||
|
42 | ||||
|
43 | ||||
|
44 | # HTTP and HTTPS ports for running app | |||
|
45 | RC_HTTP_PORT=8888 | |||
|
46 | ||||
|
47 | # SSH Port exposed, increased security is to not used default 22 | |||
|
48 | RC_SSH_PORT=3022 | |||
|
49 | ||||
|
50 | ||||
|
51 | ## RHODECODE RUNTIME VARS | |||
|
52 | ||||
27 | ## New since 4.27.0, default GIT branch name can be changed |
|
53 | ## New since 4.27.0, default GIT branch name can be changed | |
28 | GIT_DEFAULT_BRANCH_NAME=master |
|
54 | GIT_DEFAULT_BRANCH_NAME=master | |
29 |
|
55 | |||
30 | ## Source build version for image |
|
56 | ||
31 | SOURCE_VER=4.28.0.REL1 |
|
@@ -3,6 +3,12 b'' | |||||
3 | .cache/*.tar.bz2 |
|
3 | .cache/*.tar.bz2 | |
4 | .cache/locale-archive |
|
4 | .cache/locale-archive | |
5 |
|
5 | |||
|
6 | # Source code downloaded | |||
|
7 | .source/* | |||
|
8 | ||||
|
9 | # Custom / override wont be tracked | |||
|
10 | .custom/* | |||
|
11 | ||||
6 | # LOGS |
|
12 | # LOGS | |
7 | logs/*.log |
|
13 | logs/*.log | |
8 | logs/nginx/*.log |
|
14 | logs/nginx/*.log | |
@@ -13,9 +19,5 b' logs/postgres/*.log' | |||||
13 | .idea |
|
19 | .idea | |
14 | config/_shared/.rcmetadata.json |
|
20 | config/_shared/.rcmetadata.json | |
15 |
|
21 | |||
16 | .source/* |
|
22 | .rccontrol-bootstrap | |
17 | scripts/download-artifacts-secret.sh |
|
23 | .rccontrol.ini No newline at end of file | |
18 |
|
||||
19 | scripts/download-source-secret.sh |
|
|||
20 |
|
||||
21 | .rccontrol-bootstrap No newline at end of file |
|
@@ -1,28 +1,45 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 | all its additional components in single environment using Docker. |
|
5 | all its additional components in single environment using Docker. | |
5 |
|
6 | |||
6 | Using a docker-compose this setup creates following services for RhodeCode: |
|
7 | Using a docker-compose this setup creates following services for RhodeCode: | |
7 |
|
8 | |||
8 | - Nginx HTTP Server for load balancing and reverse proxy |
|
9 | Edge-Router: | |
9 | - RhodeCode HTTP |
|
10 | - Traefik, Edge Router, SSL termination etc | |
10 | - VCSServer for GIT/SVN/HG support |
|
11 | ||
11 | - SSH Server for cloning over SSH |
|
12 | Core Services: | |
12 | - SVN webserver for HTTP support over SVN |
|
13 | - Database (defaults to PostgreSQL) | |
13 | - Celery workers for asynchronous tasks |
|
14 | - Redis, acts as cache and queue exchange | |
14 | - Celery beat for automation tasks |
|
15 | - ChannelStream - live websocket communications | |
15 | - Redis Database for caching |
|
16 | - Nginx (static/channelstream) proxy serving RhodeCode APPS and channelstream communication | |
16 | - Postgres database for persistent storage |
|
17 | - Elasticsearch (full text search backend) | |
17 | - Channelstream websocket server for live components |
|
18 | ||
|
19 | RhodeCode | |||
|
20 | - RhodeCode CE/EE | |||
|
21 | - VCSServer for GIT/SVN/HG support | |||
|
22 | - SSH Server for cloning over SSH | |||
|
23 | - SVN webserver for HTTP support over SVN | |||
|
24 | - Celery workers for asynchronous tasks | |||
|
25 | - Celery beat for automation tasks | |||
|
26 | ||||
|
27 | Metrics | |||
|
28 | - Loki, logs aggregation | |||
|
29 | - Grafana, Metrics Dashboard | |||
|
30 | - Promethues, Metrics time-series | |||
|
31 | - statsd-exporter - statsd to promethues bridge | |||
|
32 | - node-exporter - machine stats | |||
|
33 | - promtail - log scraping | |||
18 |
|
34 | |||
19 |
|
35 | |||
20 | ## Pre requisites |
|
36 | ## Pre requisites | |
21 |
|
37 | |||
|
38 | To Run this stack Docker engine and Docker Compose needs to be installed on the host machine. | |||
22 | Visit docker site and install docker (min version 20.10) and docker compose: |
|
39 | Visit docker site and install docker (min version 20.10) and docker compose: | |
23 |
|
40 | |||
24 |
- https://docs.docker.com/engine/install/ |
|
41 | - https://docs.docker.com/engine/install/ | |
25 | - https://docs.docker.com/compose/install/ |
|
42 | - https://docs.docker.com/compose/install/ | |
26 |
|
43 | |||
27 | The instructions below outline installation of the current stable release (v1.29.2) of Compose. |
|
44 | The instructions below outline installation of the current stable release (v1.29.2) of Compose. | |
28 |
|
45 | |||
@@ -33,19 +50,19 b' There are 4 volumes defined:' | |||||
33 |
|
50 | |||
34 | - `/etc/rhodecode/conf` |
|
51 | - `/etc/rhodecode/conf` | |
35 |
|
52 | |||
36 |
|
|
53 | Shared volume used for configuration files for rhodecode, vcsserver and supervisord, and some cache data | |
37 |
|
54 | |||
38 | - `/var/opt/rhodecode_repo_store` |
|
55 | - `/var/opt/rhodecode_repo_store` | |
39 |
|
56 | |||
40 |
|
|
57 | Used for main repository storage where repositories would be stored | |
41 |
|
58 | |||
42 | - `/var/opt/rhodecode_data` |
|
59 | - `/var/opt/rhodecode_data` | |
43 |
|
60 | |||
44 |
|
|
61 | Data dir for rhodecode cache/lock files, or user sessions (for file backend) | |
45 |
|
62 | |||
46 | - `/var/log/rhodecode` |
|
63 | - `/var/log/rhodecode` | |
47 |
|
64 | |||
48 |
|
|
65 | Used to store all logs from RhodeCode | |
49 |
|
66 | |||
50 |
|
67 | |||
51 | ## Setup/Build options |
|
68 | ## Setup/Build options | |
@@ -54,7 +71,8 b' There are 3 options to run the docker stack.' | |||||
54 |
|
71 | |||
55 | - [Standalone cluster build from installer](#standalone-cluster-build-from-installer) |
|
72 | - [Standalone cluster build from installer](#standalone-cluster-build-from-installer) | |
56 | - [Standalone cluster build from source](#standalone-cluster-build-from-source) |
|
73 | - [Standalone cluster build from source](#standalone-cluster-build-from-source) | |
57 |
- [dev enviroment setup](# |
|
74 | - [dev environment setup](#dev-env-build) | |
|
75 | ||||
58 |
|
76 | |||
59 |
|
77 | |||
60 | # Standalone cluster build from installer |
|
78 | # Standalone cluster build from installer | |
@@ -91,10 +109,12 b' drwxr-xr-x 14 rcdev rcdev 448B Feb 8 10:40 ..' | |||||
91 |
|
109 | |||
92 | ## Set License for EE version |
|
110 | ## Set License for EE version | |
93 |
|
111 | |||
94 |
In order to install EE edition a |
|
112 | In order to install EE edition a license file is required to be present. | |
|
113 | It can contain your current license, or when empty license can be applied via Web interface. | |||
|
114 | ||||
95 | To apply it during build phase save your raw license data into a file |
|
115 | To apply it during build phase save your raw license data into a file | |
96 |
|
116 | |||
97 |
`config/ |
|
117 | `config/rhodecode_enterprise.license` | |
98 |
|
118 | |||
99 | If this file is present build phase will read it and license will be applied at creation. |
|
119 | If this file is present build phase will read it and license will be applied at creation. | |
100 | This file can also be empty and license can be applied via a WEB interface after first login. |
|
120 | This file can also be empty and license can be applied via a WEB interface after first login. | |
@@ -111,7 +131,10 b' _Disk space problems?_' | |||||
111 | ```shell |
|
131 | ```shell | |
112 | docker system df |
|
132 | docker system df | |
113 | docker builder prune |
|
133 | docker builder prune | |
|
134 | # optionally | |||
|
135 | docker image prune -a | |||
114 | ``` |
|
136 | ``` | |
|
137 | ### Creating & building images | |||
115 |
|
138 | |||
116 | 1) start with running the required database for the build stage in the background. |
|
139 | 1) start with running the required database for the build stage in the background. | |
117 |
|
140 | |||
@@ -120,15 +143,18 b' docker builder prune' | |||||
120 | ``` |
|
143 | ``` | |
121 |
|
144 | |||
122 | This will start our postgres database, and expose it to the network. |
|
145 | This will start our postgres database, and expose it to the network. | |
|
146 | Postgres DB is configured to output logs into a file `/var/log/rhodecode/postgres` | |||
123 |
|
147 | |||
124 | 2) We can now run the full installation. Database needs to be running for the next build command. |
|
148 | 2) We can now run the full installation. Database needs to be running for the next build command. | |
125 |
|
149 | This will build the rhodecode base image used for rhodecode, vcsserver, celery, ssh, svn | ||
|
150 | Then it will build all other components required. | |||
|
151 | ||||
126 | ```shell |
|
152 | ```shell | |
127 | docker-compose build rhodecode |
|
153 | docker-compose build rhodecode | |
128 | docker-compose build |
|
154 | docker-compose build | |
129 | ``` |
|
155 | ``` | |
130 |
|
156 | |||
131 |
|
|
157 | 4) Once we build all required containers, we can run the whole stack using `docker-compose up` | |
132 |
|
158 | |||
133 | ```shell |
|
159 | ```shell | |
134 | docker-compose up |
|
160 | docker-compose up | |
@@ -146,21 +172,31 b' In case for bigger setups docker-compose can scale more rhodecode/vcsserver work' | |||||
146 | docker-compose up --scale vcsserver=3 rhodecode=3 |
|
172 | docker-compose up --scale vcsserver=3 rhodecode=3 | |
147 | ``` |
|
173 | ``` | |
148 |
|
174 | |||
|
175 | Logging is pushed to stdout from all services. | |||
|
176 | ||||
149 |
|
177 | |||
150 | Upgrade: |
|
178 | ### Upgrade procedure: | |
151 |
|
179 | |||
152 | - pull the latest rhodecode-docker repo |
|
180 | - pull the latest rhodecode-docker repo | |
153 | - check .env file for correct update version |
|
181 | - check .env file for correct update version | |
154 | - re-build rhodecode |
|
182 | - re-build rhodecode | |
155 | - docker-compose build rhodecode |
|
183 | - docker-compose build rhodecode | |
|
184 | - docker-compose build | |||
156 | - docker-compose stop |
|
185 | - docker-compose stop | |
157 | - docker-compose up |
|
186 | - docker-compose up | |
158 |
|
187 | |||
159 | # Standalone cluster build from source |
|
188 | # Standalone cluster build from source | |
160 |
|
189 | |||
161 |
There's an option to build the latest |
|
190 | There's an option to build the latest release from the source code as a docker installation. | |
|
191 | ||||
|
192 | If you have the 3 required projects source code already, the next step can be omitted, and the | |||
|
193 | sources can be copied to the `.source/` directory. note: symlinks don't work. | |||
162 |
|
194 | |||
163 | Download the source: |
|
195 | - https://code.rhodecode.com/rhodecode-vcsserver | |
|
196 | - https://code.rhodecode.com/rhodecode-enterprise-ce | |||
|
197 | - https://code.rhodecode.com/rhodecode-enterprise-ee (assuming access is granted to this) | |||
|
198 | ||||
|
199 | Download the source using bootstrap script: | |||
164 |
|
200 | |||
165 | ```shell |
|
201 | ```shell | |
166 | cd .boostrap/ && ./download-source.sh && cd ../ |
|
202 | cd .boostrap/ && ./download-source.sh && cd ../ | |
@@ -174,20 +210,16 b' drwxr-xr-x 1 docker docker 1120 Nov 25 12:27 rhodecode-enterprise-ee' | |||||
174 | drwxr-xr-x 1 docker docker 800 Nov 25 12:27 rhodecode-vcsserver |
|
210 | drwxr-xr-x 1 docker docker 800 Nov 25 12:27 rhodecode-vcsserver | |
175 | ``` |
|
211 | ``` | |
176 |
|
212 | |||
177 | If you have the source already, this step can be omitted, and the |
|
213 | With this done, you can now proceed with every step of normal source installation (Creating & building images), but instead of using | |
178 | sources can be linked or copied to this directory |
|
214 | just `docker-compose` command it needs to be replaced with `docker-compose -f docker-compose.yaml -f docker-compose.source.yaml` | |
179 |
|
||||
180 |
|
215 | |||
181 | Build the source based image |
|
216 | For example to override the installer build with the source `rhodecode` based image, and also setting proper version, run: | |
182 |
|
217 | |||
183 | ```shell |
|
218 | ```shell | |
184 | docker-compose -f docker-compose.yaml -f docker-compose.source.yaml build --no-cache --progress=plain rhodecode |
|
219 | RC_VERSION="4.27.0.REL202221020" docker-compose -f docker-compose-apps.yaml -f docker-compose.source.yaml build --no-cache --progress=plain rhodecode | |
185 | ``` |
|
220 | ``` | |
186 |
|
221 | |||
187 | to create a source install override and build based on the downloaded sources. |
|
222 | NOTE THAT it's recommended to keep rc_version and source_Ver the same | |
188 |
|
||||
189 |
|
||||
190 | Logging is pushed to stdout from all services. |
|
|||
191 |
|
223 | |||
192 | ## Simple build |
|
224 | ## Simple build | |
193 |
|
225 | |||
@@ -196,7 +228,7 b' simple sqlite database and file based caches.' | |||||
196 | This is a fully running instance good for small use with 3-5 users. |
|
228 | This is a fully running instance good for small use with 3-5 users. | |
197 |
|
229 | |||
198 | ```shell |
|
230 | ```shell | |
199 | docker build -t rhodecode:4.23.2 -f rhodecode.dockerfile \ |
|
231 | docker build -t rhodecode/rhodecode-ce:4.23.2 -f rhodecode.dockerfile \ | |
200 | -e RHODECODE_TYPE=Community \ |
|
232 | -e RHODECODE_TYPE=Community \ | |
201 | -e RHODECODE_VERSION=4.23.2 \ |
|
233 | -e RHODECODE_VERSION=4.23.2 \ | |
202 | -e RHODECODE_DB=sqlite \ |
|
234 | -e RHODECODE_DB=sqlite \ | |
@@ -229,6 +261,7 b' password: secret4' | |||||
229 | ``` |
|
261 | ``` | |
230 |
|
262 | |||
231 | We've not built our image using specific version. It's time to run it: |
|
263 | We've not built our image using specific version. It's time to run it: | |
|
264 | We specify the run.ini by selecting config option we have locally | |||
232 |
|
265 | |||
233 | ```shell |
|
266 | ```shell | |
234 | docker run \ |
|
267 | docker run \ | |
@@ -236,8 +269,9 b' docker run \\' | |||||
236 | --publish 10020:10020 \ |
|
269 | --publish 10020:10020 \ | |
237 | --restart unless-stopped \ |
|
270 | --restart unless-stopped \ | |
238 | --volume $PWD/config:/etc/rhodecode/conf \ |
|
271 | --volume $PWD/config:/etc/rhodecode/conf \ | |
|
272 | --volume $PWD/config/rhodecode.optimized.ini:/etc/rhodecode/conf_build/run.ini \ | |||
239 | --volume $PWD/logs:/var/log/rhodecode \ |
|
273 | --volume $PWD/logs:/var/log/rhodecode \ | |
240 | 'rhodecode:4.23.2' |
|
274 | 'rhodecode/rhodecode-ee:4.23.2' | |
241 | ``` |
|
275 | ``` | |
242 |
|
276 | |||
243 | Enter container |
|
277 | Enter container | |
@@ -249,10 +283,16 b' docker exec -it rhodecode-container /bin/bash' | |||||
249 | Enter interactive shell |
|
283 | Enter interactive shell | |
250 |
|
284 | |||
251 | ```shell |
|
285 | ```shell | |
252 |
docker exec -it rhodecode-container / |
|
286 | docker exec -it rhodecode-container /usr/local/bin/rhodecode_bin/bin/rc-ishell /etc/rhodecode/conf/rhodecode.ini | |
253 | ``` |
|
287 | ``` | |
254 |
|
288 | |||
255 | Run Database migrations |
|
289 | Run Database migrations | |
256 | ```shell |
|
290 | ```shell | |
257 |
docker exec -it rhodecode-container / |
|
291 | docker exec -it rhodecode-container /usr/local/bin/rhodecode_bin/bin/rc-upgrade-db /etc/rhodecode/conf/rhodecode.ini --force-yes | |
258 | ``` No newline at end of file |
|
292 | ``` | |
|
293 | ||||
|
294 | ||||
|
295 | ||||
|
296 | ### Registry for docker swarm | |||
|
297 | ||||
|
298 | docker run -d -p 5000:5000 --restart always --name registry registry:2 No newline at end of file |
1 | NO CONTENT: file renamed from config/compose/rhodecode_enterprise.license to config/_shared/rhodecode_enterprise.license |
|
NO CONTENT: file renamed from config/compose/rhodecode_enterprise.license to config/_shared/rhodecode_enterprise.license |
1 | NO CONTENT: file renamed from service/database/mysql_customized.conf to config/database/mysql_customized.conf |
|
NO CONTENT: file renamed from service/database/mysql_customized.conf to config/database/mysql_customized.conf |
@@ -1,3 +1,4 b'' | |||||
|
1 | ## docker run -i --rm postgres cat /usr/share/postgresql/postgresql.conf.sample > my-postgres.conf | |||
1 | # ----------------------------- |
|
2 | # ----------------------------- | |
2 | # PostgreSQL configuration file |
|
3 | # PostgreSQL configuration file | |
3 | # ----------------------------- |
|
4 | # ----------------------------- | |
@@ -93,7 +94,8 b" listen_addresses = '*'" | |||||
93 | # - Authentication - |
|
94 | # - Authentication - | |
94 |
|
95 | |||
95 | #authentication_timeout = 1min # 1s-600s |
|
96 | #authentication_timeout = 1min # 1s-600s | |
96 | #password_encryption = scram-sha-256 # scram-sha-256 or md5 |
|
97 | #note; Rhodecode needs to use old md5 for backward compat | |
|
98 | password_encryption = md5 # scram-sha-256 or md5 | |||
97 | #db_user_namespace = off |
|
99 | #db_user_namespace = off | |
98 |
|
100 | |||
99 | # GSSAPI using Kerberos |
|
101 | # GSSAPI using Kerberos | |
@@ -436,21 +438,21 b" log_destination = 'stderr'\t\t# Valid values are combinations of" | |||||
436 | # requires logging_collector to be on. |
|
438 | # requires logging_collector to be on. | |
437 |
|
439 | |||
438 | # This is used when logging to stderr: |
|
440 | # This is used when logging to stderr: | |
439 | logging_collector = on # Enable capturing of stderr and csvlog |
|
441 | #logging_collector = on # Enable capturing of stderr and csvlog | |
440 | # into log files. Required to be on for |
|
442 | # into log files. Required to be on for | |
441 | # csvlogs. |
|
443 | # csvlogs. | |
442 | # (change requires restart) |
|
444 | # (change requires restart) | |
443 |
|
445 | |||
444 | # These are only used if logging_collector is on: |
|
446 | # These are only used if logging_collector is on: | |
445 | log_directory = '/var/log/rhodecode/postgres' # directory where log files are written, |
|
447 | #log_directory = '/var/log/rhodecode/postgres' # directory where log files are written, | |
446 | # can be absolute or relative to PGDATA |
|
448 | # can be absolute or relative to PGDATA | |
447 | log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name pattern, |
|
449 | #log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name pattern, | |
448 | # can include strftime() escapes |
|
450 | # can include strftime() escapes | |
449 | #log_file_mode = 0600 # creation mode for log files, |
|
451 | #log_file_mode = 0600 # creation mode for log files, | |
450 | # begin with 0 to use octal notation |
|
452 | # begin with 0 to use octal notation | |
451 | #log_rotation_age = 1d # Automatic rotation of logfiles will |
|
453 | #log_rotation_age = 1d # Automatic rotation of logfiles will | |
452 | # happen after that time. 0 disables. |
|
454 | # happen after that time. 0 disables. | |
453 | log_rotation_size = 512MB # Automatic rotation of logfiles will |
|
455 | #log_rotation_size = 512MB # Automatic rotation of logfiles will | |
454 | # happen after that much log output. |
|
456 | # happen after that much log output. | |
455 | # 0 disables. |
|
457 | # 0 disables. | |
456 | #log_truncate_on_rotation = off # If on, an existing log file with the |
|
458 | #log_truncate_on_rotation = off # If on, an existing log file with the | |
@@ -534,7 +536,7 b' log_min_duration_statement = 1000\t# -1 is disabled, 0 logs all statements' | |||||
534 | # actions running at least this number |
|
536 | # actions running at least this number | |
535 | # of milliseconds. |
|
537 | # of milliseconds. | |
536 | #log_checkpoints = off |
|
538 | #log_checkpoints = off | |
537 |
|
|
539 | log_connections = off | |
538 | #log_disconnections = off |
|
540 | #log_disconnections = off | |
539 | #log_duration = off |
|
541 | #log_duration = off | |
540 | #log_error_verbosity = default # terse, default, or verbose messages |
|
542 | #log_error_verbosity = default # terse, default, or verbose messages |
@@ -58,10 +58,10 b' server {' | |||||
58 | # ensure we get the proper Docker DNS resolver for load balancing. |
|
58 | # ensure we get the proper Docker DNS resolver for load balancing. | |
59 | resolver 127.0.0.11 ipv6=off; |
|
59 | resolver 127.0.0.11 ipv6=off; | |
60 | server_name localhost 127.0.0.1; |
|
60 | server_name localhost 127.0.0.1; | |
61 |
access_log / |
|
61 | access_log /dev/stdout json_log_custom; | |
62 | error_log /var/log/rhodecode/nginx/rhodecode.http.error.log; |
|
62 | error_log /dev/stdout; | |
63 |
|
63 | |||
64 | # uncomment to redirect http traffic to https |
|
64 | # uncomment to redirect http traffic to https (not applicable in Docker setup) | |
65 | #return 301 https://$host$request_uri; |
|
65 | #return 301 https://$host$request_uri; | |
66 |
|
66 | |||
67 | client_body_buffer_size 128k; |
|
67 | client_body_buffer_size 128k; | |
@@ -103,30 +103,33 b' server {' | |||||
103 | proxy_set_header Upgrade $http_upgrade; |
|
103 | proxy_set_header Upgrade $http_upgrade; | |
104 | proxy_set_header Connection "upgrade"; |
|
104 | proxy_set_header Connection "upgrade"; | |
105 |
|
105 | |||
106 |
|
|
106 | set $upstream_channelstream http://channelstream:8000; | |
|
107 | proxy_pass $upstream_channelstream; | |||
107 | } |
|
108 | } | |
108 |
|
109 | |||
109 | ## rate limit this endpoint to prevent login page brute-force attacks |
|
110 | # ## rate limit this endpoint to prevent login page brute-force attacks | |
110 | location /_admin/login { |
|
111 | # location /_admin/login { | |
111 | limit_req zone=http_req_limit burst=10 nodelay; |
|
112 | # limit_req zone=http_req_limit burst=10 nodelay; | |
112 | try_files $uri @rhodecode_http; |
|
113 | # try_files $uri @rhodecode_http; | |
113 | } |
|
114 | # } | |
114 |
|
115 | |||
115 | location / { |
|
116 | location / { | |
116 |
include |
|
117 | include /etc/nginx/proxy.conf; | |
117 | try_files $uri @rhodecode_http; |
|
118 | try_files $uri @rhodecode_http; | |
118 | } |
|
119 | } | |
119 |
|
120 | |||
120 | location @rhodecode_http { |
|
121 | location @rhodecode_http { | |
121 | include /etc/nginx/proxy.conf; |
|
122 | set $upstream http://rhodecode:10020; | |
122 | proxy_pass http://rhodecode:10020; |
|
123 | include /etc/nginx/proxy.conf; | |
|
124 | proxy_pass $upstream; | |||
123 | } |
|
125 | } | |
124 |
|
126 | |||
125 | ## Custom 502 error page. |
|
127 | ## Custom 502 error page. | |
126 | ## Will be displayed while RhodeCode server is turned off |
|
128 | ## Will be displayed while RhodeCode server is turned off | |
127 | error_page 502 /502.html; |
|
129 | error_page 502 /502.html; | |
128 | location = /502.html { |
|
130 | location = /502.html { | |
129 | root /var/opt/static; |
|
131 | root /var/opt/rhodecode_data/static; | |
|
132 | internal; | |||
130 | } |
|
133 | } | |
131 |
|
134 | |||
132 | } |
|
135 | } |
@@ -2,7 +2,7 b' user root;' | |||||
2 | worker_processes 2; |
|
2 | worker_processes 2; | |
3 |
|
3 | |||
4 | pid /var/run/nginx.pid; |
|
4 | pid /var/run/nginx.pid; | |
5 | error_log /var/log/rhodecode/nginx/default.error.log warn; |
|
5 | error_log /dev/stdout info; | |
6 |
|
6 | |||
7 | events { |
|
7 | events { | |
8 | worker_connections 1024; |
|
8 | worker_connections 1024; | |
@@ -12,13 +12,14 b' events {' | |||||
12 | http { |
|
12 | http { | |
13 | include /etc/nginx/mime.types; |
|
13 | include /etc/nginx/mime.types; | |
14 | default_type application/octet-stream; |
|
14 | default_type application/octet-stream; | |
|
15 | server_tokens off; | |||
15 |
|
16 | |||
16 | log_format main '$remote_addr - $remote_user [$time_local] ' |
|
17 | log_format main '$remote_addr - $remote_user [$time_local] ' | |
17 | '"$request" $status $body_bytes_sent ' |
|
18 | '"$request" $status $body_bytes_sent ' | |
18 | '"$http_referer" "$http_user_agent" ' |
|
19 | '"$http_referer" "$http_user_agent" ' | |
19 | '$request_time $upstream_response_time $pipe'; |
|
20 | '$request_time $upstream_response_time $pipe'; | |
20 |
|
21 | |||
21 | access_log /var/log/rhodecode/nginx/default.access.log main; |
|
22 | access_log /dev/stdout main; | |
22 |
|
23 | |||
23 | sendfile on; |
|
24 | sendfile on; | |
24 | tcp_nopush on; |
|
25 | tcp_nopush on; | |
@@ -26,5 +27,5 b' http {' | |||||
26 | keepalive_timeout 65; |
|
27 | keepalive_timeout 65; | |
27 | types_hash_max_size 2048; |
|
28 | types_hash_max_size 2048; | |
28 |
|
29 | |||
29 |
include /etc/nginx/ |
|
30 | include /etc/nginx/http.conf; | |
30 | } |
|
31 | } |
1 | NO CONTENT: file renamed from service/nginx/proxy.conf to config/nginx/proxy.conf |
|
NO CONTENT: file renamed from service/nginx/proxy.conf to config/nginx/proxy.conf |
@@ -15,3 +15,9 b' scrape_configs:' | |||||
15 | metrics_path: "/metrics" |
|
15 | metrics_path: "/metrics" | |
16 | static_configs: |
|
16 | static_configs: | |
17 | - targets: ["node-exporter:9100"] |
|
17 | - targets: ["node-exporter:9100"] | |
|
18 | ||||
|
19 | # scrape traefik node | |||
|
20 | - job_name: traefik_metrics | |||
|
21 | metrics_path: "/metrics" | |||
|
22 | static_configs: | |||
|
23 | - targets: ["traefik:7000"] |
@@ -13,26 +13,26 b' clients:' | |||||
13 | ## Definition to what to scrape |
|
13 | ## Definition to what to scrape | |
14 | scrape_configs: |
|
14 | scrape_configs: | |
15 |
|
15 | |||
16 | - job_name: scraping_nginx |
|
16 | #- job_name: scraping_nginx | |
17 | static_configs: |
|
17 | # static_configs: | |
18 | - targets: |
|
18 | # - targets: | |
19 | - localhost |
|
19 | # - localhost | |
20 | labels: |
|
20 | # labels: | |
21 | __path__: /var/log_volume/nginx/rhodecode* |
|
21 | # __path__: /var/log_volume/nginx/rhodecode* | |
22 | job: nginx |
|
22 | # job: nginx | |
23 |
|
23 | # | ||
24 | - job_name: scraping_vcsserver |
|
24 | #- job_name: scraping_vcsserver | |
25 | static_configs: |
|
25 | # static_configs: | |
26 | - targets: |
|
26 | # - targets: | |
27 | - localhost |
|
27 | # - localhost | |
28 | labels: |
|
28 | # labels: | |
29 | __path__: /var/log_volume/apps/rhodecode* |
|
29 | # __path__: /var/log_volume/apps/rhodecode* | |
30 | job: rhodecode |
|
30 | # job: rhodecode | |
31 |
|
31 | # | ||
32 | - job_name: scraping_rhodecode |
|
32 | #- job_name: scraping_rhodecode | |
33 | static_configs: |
|
33 | # static_configs: | |
34 | - targets: |
|
34 | # - targets: | |
35 | - localhost |
|
35 | # - localhost | |
36 | labels: |
|
36 | # labels: | |
37 | __path__: /var/log_volume/apps/vcsserver* |
|
37 | # __path__: /var/log_volume/apps/vcsserver* | |
38 | job: vcsserver No newline at end of file |
|
38 | # job: vcsserver No newline at end of file |
@@ -280,7 +280,7 b' databases 16' | |||||
280 | # |
|
280 | # | |
281 | # However it is possible to force the pre-4.0 behavior and always show a |
|
281 | # However it is possible to force the pre-4.0 behavior and always show a | |
282 | # ASCII art logo in startup logs by setting the following option to yes. |
|
282 | # ASCII art logo in startup logs by setting the following option to yes. | |
283 |
always-show-logo |
|
283 | always-show-logo no | |
284 |
|
284 | |||
285 | ################################ SNAPSHOTTING ################################ |
|
285 | ################################ SNAPSHOTTING ################################ | |
286 | # |
|
286 | # | |
@@ -362,7 +362,7 b' rdb-del-sync-files no' | |||||
362 | # The Append Only File will also be created inside this directory. |
|
362 | # The Append Only File will also be created inside this directory. | |
363 | # |
|
363 | # | |
364 | # Note that you must specify a directory here, not a file name. |
|
364 | # Note that you must specify a directory here, not a file name. | |
365 | dir /var/opt/rhodecode_data/ |
|
365 | dir /data | |
366 |
|
366 | |||
367 | ################################# REPLICATION ################################# |
|
367 | ################################# REPLICATION ################################# | |
368 |
|
368 | |||
@@ -857,7 +857,7 b' acllog-max-len 128' | |||||
857 | # limit for maxmemory so that there is some free RAM on the system for replica |
|
857 | # limit for maxmemory so that there is some free RAM on the system for replica | |
858 | # output buffers (but this is not needed if the policy is 'noeviction'). |
|
858 | # output buffers (but this is not needed if the policy is 'noeviction'). | |
859 | # |
|
859 | # | |
860 | maxmemory 8192mb |
|
860 | #maxmemory 8192mb | |
861 |
|
861 | |||
862 | # MAXMEMORY POLICY: how Redis will select what to remove when maxmemory |
|
862 | # MAXMEMORY POLICY: how Redis will select what to remove when maxmemory | |
863 | # is reached. You can select one from the following behaviors: |
|
863 | # is reached. You can select one from the following behaviors: | |
@@ -888,7 +888,7 b' maxmemory 8192mb' | |||||
888 | # |
|
888 | # | |
889 | # The default is: |
|
889 | # The default is: | |
890 | # |
|
890 | # | |
891 | maxmemory-policy volatile-lru |
|
891 | #maxmemory-policy volatile-lru | |
892 |
|
892 | |||
893 | # LRU, LFU and minimal TTL algorithms are not precise algorithms but approximated |
|
893 | # LRU, LFU and minimal TTL algorithms are not precise algorithms but approximated | |
894 | # algorithms (in order to save memory), so you can tune it for speed or |
|
894 | # algorithms (in order to save memory), so you can tune it for speed or | |
@@ -899,7 +899,7 b' maxmemory-policy volatile-lru' | |||||
899 | # The default of 5 produces good enough results. 10 Approximates very closely |
|
899 | # The default of 5 produces good enough results. 10 Approximates very closely | |
900 | # true LRU but costs more CPU. 3 is faster but not very accurate. |
|
900 | # true LRU but costs more CPU. 3 is faster but not very accurate. | |
901 | # |
|
901 | # | |
902 |
maxmemory-samples |
|
902 | maxmemory-samples 10 | |
903 |
|
903 | |||
904 | # Starting from Redis 5, by default a replica will ignore its maxmemory setting |
|
904 | # Starting from Redis 5, by default a replica will ignore its maxmemory setting | |
905 | # (unless it is promoted to master after a failover or manually). It means |
|
905 | # (unless it is promoted to master after a failover or manually). It means |
@@ -13,7 +13,7 b' services:' | |||||
13 | - nixstore:/opt/nix/store |
|
13 | - nixstore:/opt/nix/store | |
14 |
|
14 | |||
15 | ports: |
|
15 | ports: | |
16 |
- " |
|
16 | - "10020:10020" | |
17 |
|
17 | |||
18 | vcsserver: |
|
18 | vcsserver: | |
19 | volumes: |
|
19 | volumes: | |
@@ -30,7 +30,7 b' services:' | |||||
30 | - /media/psf/Home/workspace/rhodecode-enterprise-ee:/home/rhodecode/rhodecode-enterprise-ee:delegated |
|
30 | - /media/psf/Home/workspace/rhodecode-enterprise-ee:/home/rhodecode/rhodecode-enterprise-ee:delegated | |
31 | - nixstore:/opt/nix/store |
|
31 | - nixstore:/opt/nix/store | |
32 |
|
32 | |||
33 | beat: |
|
33 | celery-beat: | |
34 | volumes: |
|
34 | volumes: | |
35 | - /media/psf/Home/workspace/rhodecode-vcsserver:/home/rhodecode/rhodecode-vcsserver:delegated |
|
35 | - /media/psf/Home/workspace/rhodecode-vcsserver:/home/rhodecode/rhodecode-vcsserver:delegated | |
36 | - /media/psf/Home/workspace/rhodecode-enterprise-ce:/home/rhodecode/rhodecode-enterprise-ce:delegated |
|
36 | - /media/psf/Home/workspace/rhodecode-enterprise-ce:/home/rhodecode/rhodecode-enterprise-ce:delegated | |
@@ -50,7 +50,3 b' services:' | |||||
50 | - /media/psf/Home/workspace/rhodecode-enterprise-ce:/home/rhodecode/rhodecode-enterprise-ce:delegated |
|
50 | - /media/psf/Home/workspace/rhodecode-enterprise-ce:/home/rhodecode/rhodecode-enterprise-ce:delegated | |
51 | - /media/psf/Home/workspace/rhodecode-enterprise-ee:/home/rhodecode/rhodecode-enterprise-ee:delegated |
|
51 | - /media/psf/Home/workspace/rhodecode-enterprise-ee:/home/rhodecode/rhodecode-enterprise-ee:delegated | |
52 | - nixstore:/opt/nix/store |
|
52 | - nixstore:/opt/nix/store | |
53 |
|
||||
54 | database: |
|
|||
55 | volumes: |
|
|||
56 | - /tmp:/usr-tmp |
|
@@ -10,42 +10,26 b' services:' | |||||
10 | DB_UPGRADE: 0 # run the DB upgrade |
|
10 | DB_UPGRADE: 0 # run the DB upgrade | |
11 |
|
11 | |||
12 | volumes: |
|
12 | volumes: | |
13 | - bashhistory:/home/rhodecode |
|
13 | - bashhistory:/home/rhodecode/.bash_history_docker | |
14 |
|
14 | |||
15 | build: |
|
15 | build: | |
16 | context: . |
|
16 | context: . | |
17 | dockerfile: service/rhodecode/rhodecode_source.dockerfile |
|
17 | dockerfile: service/rhodecode/rhodecode_source.dockerfile | |
18 |
|
18 | |||
19 |
image: rhodecode/ |
|
19 | image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION:?specify-RC_VERSION-env-var}_SOURCE | |
20 |
|
||||
21 | command: [ |
|
|||
22 | "/home/rhodecode/rhodecode-enterprise-ee/result/bin/gunicorn", |
|
|||
23 | "--name=gunicorn-rhodecode-1", |
|
|||
24 | "--error-logfile=-", |
|
|||
25 | "--paster=/etc/rhodecode/conf/compose/rhodecode.optimized.ini", |
|
|||
26 | "--config=/etc/rhodecode/conf/gunicorn_conf.py" |
|
|||
27 | ] |
|
|||
28 |
|
20 | |||
29 | vcsserver: |
|
21 | vcsserver: | |
30 | environment: |
|
22 | environment: | |
31 | HISTFILE: /home/rhodecode/.bash_history_docker |
|
23 | HISTFILE: /home/rhodecode/.bash_history_docker | |
32 |
|
24 | |||
33 | volumes: |
|
25 | volumes: | |
34 | - bashhistory:/home/rhodecode |
|
26 | - bashhistory:/home/rhodecode/.bash_history_docker | |
35 |
|
27 | |||
36 | build: |
|
28 | build: | |
37 | context: . |
|
29 | context: . | |
38 | dockerfile: service/rhodecode/rhodecode_source.dockerfile |
|
30 | dockerfile: service/rhodecode/rhodecode_source.dockerfile | |
39 |
|
31 | |||
40 |
image: rhodecode/ |
|
32 | image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION:?specify-RC_VERSION-env-var}_SOURCE | |
41 |
|
||||
42 | command: [ |
|
|||
43 | "/home/rhodecode/rhodecode-vcsserver/result/bin/gunicorn", |
|
|||
44 | "--name=gunicorn-vcsserver-1", |
|
|||
45 | "--error-logfile=-", |
|
|||
46 | "--paster=/etc/rhodecode/conf/compose/vcsserver.optimized.ini", |
|
|||
47 | "--config=/etc/rhodecode/conf/gunicorn_conf.py" |
|
|||
48 | ] |
|
|||
49 |
|
33 | |||
50 | celery: |
|
34 | celery: | |
51 |
|
35 | |||
@@ -53,15 +37,15 b' services:' | |||||
53 | context: . |
|
37 | context: . | |
54 | dockerfile: service/rhodecode/rhodecode_source.dockerfile |
|
38 | dockerfile: service/rhodecode/rhodecode_source.dockerfile | |
55 |
|
39 | |||
56 |
image: rhodecode/ |
|
40 | image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION:?specify-RC_VERSION-env-var}_SOURCE | |
57 |
|
41 | |||
58 | beat: |
|
42 | celery-beat: | |
59 |
|
43 | |||
60 | build: |
|
44 | build: | |
61 | context: . |
|
45 | context: . | |
62 | dockerfile: service/rhodecode/rhodecode_source.dockerfile |
|
46 | dockerfile: service/rhodecode/rhodecode_source.dockerfile | |
63 |
|
47 | |||
64 |
image: rhodecode/ |
|
48 | image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION:?specify-RC_VERSION-env-var}_SOURCE | |
65 |
|
49 | |||
66 | svn: |
|
50 | svn: | |
67 |
|
51 | |||
@@ -69,7 +53,7 b' services:' | |||||
69 | context: . |
|
53 | context: . | |
70 | dockerfile: service/rhodecode/rhodecode_source.dockerfile |
|
54 | dockerfile: service/rhodecode/rhodecode_source.dockerfile | |
71 |
|
55 | |||
72 |
image: rhodecode/ |
|
56 | image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION:?specify-RC_VERSION-env-var}_SOURCE | |
73 |
|
57 | |||
74 | sshd: |
|
58 | sshd: | |
75 |
|
59 | |||
@@ -77,4 +61,4 b' services:' | |||||
77 | context: . |
|
61 | context: . | |
78 | dockerfile: service/rhodecode/rhodecode_source.dockerfile |
|
62 | dockerfile: service/rhodecode/rhodecode_source.dockerfile | |
79 |
|
63 | |||
80 |
image: rhodecode/ |
|
64 | image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION:?specify-RC_VERSION-env-var}_SOURCE No newline at end of file |
@@ -1,25 +1,20 b'' | |||||
1 | version: '3.9' |
|
1 | version: '3.9' | |
2 |
|
2 | |||
3 | volumes: |
|
3 | volumes: | |
4 | prometheus_data: {} |
|
|||
5 | grafana_data: {} |
|
|||
6 | logvolume: |
|
|||
7 | driver: local |
|
|||
8 | driver_opts: |
|
|||
9 | type: none |
|
|||
10 | o: bind |
|
|||
11 | device: $PWD/logs |
|
|||
12 |
|
4 | |||
13 | networks: |
|
5 | prometheus_data: | |
14 | rhodecode_network: |
|
6 | labels: | |
15 | name: rhodecode_network |
|
7 | "keep": 1 | |
16 |
|
8 | |||
|
9 | grafana_data: | |||
|
10 | labels: | |||
|
11 | "keep": 1 | |||
17 |
|
12 | |||
18 | services: |
|
13 | services: | |
19 |
|
14 | |||
20 | statsd-exporter: |
|
15 | statsd-exporter: | |
21 | image: prom/statsd-exporter:v0.22.8 |
|
16 | image: prom/statsd-exporter:v0.22.8 | |
22 |
restart: |
|
17 | restart: always | |
23 | command: [ |
|
18 | command: [ | |
24 | '--statsd.mapping-config=/etc/statsd/statsd.yaml', |
|
19 | '--statsd.mapping-config=/etc/statsd/statsd.yaml', | |
25 | '--statsd.listen-udp=:9125', |
|
20 | '--statsd.listen-udp=:9125', | |
@@ -27,11 +22,16 b' services:' | |||||
27 | ] |
|
22 | ] | |
28 | networks: |
|
23 | networks: | |
29 | - rhodecode_network |
|
24 | - rhodecode_network | |
30 | ports: |
|
25 | # ports: | |
31 |
- " |
|
26 | # - "9125:9125/udp" | |
32 |
- " |
|
27 | # - "9102:9102" | |
|
28 | ||||
33 | volumes: |
|
29 | volumes: | |
34 | - ./config/statsd-exporter:/etc/statsd |
|
30 | - ./config/statsd-exporter:/etc/statsd | |
|
31 | labels: | |||
|
32 | - "traefik.enable=false" | |||
|
33 | - "traefik.http.services.statsd-exporter.loadbalancer.server.port=9125" | |||
|
34 | - "traefik.http.services.statsd-exporter.loadbalancer.server.port=9102" | |||
35 |
|
35 | |||
36 | node-exporter: |
|
36 | node-exporter: | |
37 | image: prom/node-exporter:v1.4.0 |
|
37 | image: prom/node-exporter:v1.4.0 | |
@@ -45,17 +45,20 b' services:' | |||||
45 | networks: |
|
45 | networks: | |
46 | - rhodecode_network |
|
46 | - rhodecode_network | |
47 | pid: host |
|
47 | pid: host | |
48 |
restart: |
|
48 | restart: always | |
49 | ports: |
|
49 | # ports: | |
50 |
- " |
|
50 | # - "9100:9100" | |
51 | volumes: |
|
51 | volumes: | |
52 | - "/proc:/host/proc:ro" |
|
52 | - "/proc:/host/proc:ro" | |
53 | - "/sys:/host/sys:ro" |
|
53 | - "/sys:/host/sys:ro" | |
54 | - "/:/rootfs:ro" |
|
54 | - "/:/rootfs:ro" | |
|
55 | labels: | |||
|
56 | - "traefik.enable=false" | |||
|
57 | - "traefik.http.services.node-exporter.loadbalancer.server.port=9100" | |||
55 |
|
58 | |||
56 | prometheus: |
|
59 | prometheus: | |
57 |
image: prom/prometheus:v2. |
|
60 | image: prom/prometheus:v2.40.2 | |
58 |
restart: |
|
61 | restart: always | |
59 | command: |
|
62 | command: | |
60 | - "--config.file=/etc/prometheus/prometheus.yml" |
|
63 | - "--config.file=/etc/prometheus/prometheus.yml" | |
61 | - "--storage.tsdb.path=/prometheus" |
|
64 | - "--storage.tsdb.path=/prometheus" | |
@@ -63,32 +66,40 b' services:' | |||||
63 | - "--web.console.templates=/etc/prometheus/consoles" |
|
66 | - "--web.console.templates=/etc/prometheus/consoles" | |
64 | - "--storage.tsdb.retention.time=24h" |
|
67 | - "--storage.tsdb.retention.time=24h" | |
65 | - "--web.enable-lifecycle" |
|
68 | - "--web.enable-lifecycle" | |
66 | ports: |
|
69 | # ports: | |
67 |
- " |
|
70 | # - "9090:9090" | |
68 | networks: |
|
71 | networks: | |
69 | - rhodecode_network |
|
72 | - rhodecode_network | |
70 | volumes: |
|
73 | volumes: | |
71 | - ./config/prometheus:/etc/prometheus |
|
74 | - ./config/prometheus:/etc/prometheus | |
72 | - prometheus_data:/prometheus |
|
75 | - prometheus_data:/prometheus | |
|
76 | labels: | |||
|
77 | - "traefik.enable=false" | |||
|
78 | - "traefik.http.services.prometheus.loadbalancer.server.port=9090" | |||
73 |
|
79 | |||
74 | grafana: |
|
80 | grafana: | |
75 |
image: grafana/grafana:9.2. |
|
81 | image: grafana/grafana:9.2.5 | |
76 |
restart: |
|
82 | restart: always | |
77 | env_file: |
|
83 | # ports: | |
78 | - ./config/grafana/grafana.env |
|
84 | # - "3000:3000" | |
79 | ports: |
|
|||
80 | - "4000:3000" |
|
|||
81 | volumes: |
|
85 | volumes: | |
82 | - grafana_data:/var/lib/grafana |
|
86 | - grafana_data:/var/lib/grafana | |
|
87 | - ./config/grafana:/etc/grafana | |||
83 | networks: |
|
88 | networks: | |
84 | - rhodecode_network |
|
89 | - rhodecode_network | |
|
90 | labels: | |||
|
91 | - "traefik.enable=true" | |||
|
92 | - "traefik.http.routers.grafana.entrypoints=http" | |||
|
93 | - "traefik.http.routers.grafana.rule=PathPrefix(`/_grafana`)" | |||
|
94 | - "traefik.http.routers.grafana.service=grafana-http" | |||
|
95 | - "traefik.http.services.grafana-http.loadbalancer.server.port=3000" | |||
85 |
|
96 | |||
86 | loki: |
|
97 | loki: | |
87 |
image: grafana/loki:2. |
|
98 | image: grafana/loki:2.7.0 | |
88 |
restart: |
|
99 | restart: always | |
89 | ports: |
|
100 | # ports: | |
90 |
- " |
|
101 | # - "3100:3100" | |
91 |
- " |
|
102 | # - "9095:9095" | |
92 | command: [ |
|
103 | command: [ | |
93 | "-config.file=/etc/loki/loki-config.yaml" |
|
104 | "-config.file=/etc/loki/loki-config.yaml" | |
94 | ] |
|
105 | ] | |
@@ -97,6 +108,11 b' services:' | |||||
97 | volumes: |
|
108 | volumes: | |
98 | - ./config/loki:/etc/loki |
|
109 | - ./config/loki:/etc/loki | |
99 |
|
110 | |||
|
111 | labels: | |||
|
112 | - "traefik.enable=false" | |||
|
113 | - "traefik.http.services.loki.loadbalancer.server.port=3100" | |||
|
114 | - "traefik.http.services.loki.loadbalancer.server.port=9095" | |||
|
115 | ||||
100 | promtail: |
|
116 | promtail: | |
101 | image: grafana/promtail:latest |
|
117 | image: grafana/promtail:latest | |
102 | command: [ |
|
118 | command: [ | |
@@ -108,3 +124,5 b' services:' | |||||
108 | - /var/log:/var/log |
|
124 | - /var/log:/var/log | |
109 | - logvolume:/var/log_volume |
|
125 | - logvolume:/var/log_volume | |
110 | - ./config/promtail:/etc/promtail |
|
126 | - ./config/promtail:/etc/promtail | |
|
127 | labels: | |||
|
128 | - "traefik.enable=false" |
@@ -15,13 +15,13 b' function config_copy() {' | |||||
15 |
|
15 | |||
16 | function db_upgrade() { |
|
16 | function db_upgrade() { | |
17 | echo 'ENTRYPOINT: Upgrading database.' |
|
17 | echo 'ENTRYPOINT: Upgrading database.' | |
18 |
/ |
|
18 | /usr/local/bin/rhodecode_bin/bin/rc-upgrade-db $MAIN_INI_PATH --force-yes | |
19 | } |
|
19 | } | |
20 |
|
20 | |||
21 | function db_init() { |
|
21 | function db_init() { | |
22 |
|
22 | |||
23 | gosu $RC_USER \ |
|
23 | gosu $RC_USER \ | |
24 | /home/$RC_USER/.rccontrol/$RC_TYPE_ID/profile/bin/rc-setup-app \ |
|
24 | /usr/local/bin/rhodecode_bin/bin/rc-setup-app \ | |
25 | $MAIN_INI_PATH \ |
|
25 | $MAIN_INI_PATH \ | |
26 | --force-yes \ |
|
26 | --force-yes \ | |
27 | --skip-existing-db \ |
|
27 | --skip-existing-db \ | |
@@ -36,7 +36,7 b' function rhodecode_setup() {' | |||||
36 | fname=${f##*/} |
|
36 | fname=${f##*/} | |
37 |
|
37 | |||
38 | echo "Running script $fname on $RC_TYPE_ID" |
|
38 | echo "Running script $fname on $RC_TYPE_ID" | |
39 |
gosu $RC_USER / |
|
39 | gosu $RC_USER /usr/local/bin/rhodecode_bin/bin/rc-ishell $MAIN_INI_PATH <<< "%run $f" | |
40 |
|
40 | |||
41 | done |
|
41 | done | |
42 | } |
|
42 | } | |
@@ -131,6 +131,7 b' if [[ $RC_APP_TYPE = "rhodecode_http" ]]; then' | |||||
131 |
|
131 | |||
132 | if [ "$DB_UPGRADE" = 1 ]; then |
|
132 | if [ "$DB_UPGRADE" = 1 ]; then | |
133 | # run DB migrate |
|
133 | # run DB migrate | |
|
134 | echo "Found DB_UPGRADE flag, running DB upgrade" | |||
134 |
|
|
135 | db_upgrade | |
135 | fi |
|
136 | fi | |
136 |
|
137 |
@@ -6,13 +6,17 b' ARG TZ="UTC"' | |||||
6 | ARG LOCALE_TYPE=en_US.UTF-8 |
|
6 | ARG LOCALE_TYPE=en_US.UTF-8 | |
7 | ARG RHODECODE_TYPE=Enterprise |
|
7 | ARG RHODECODE_TYPE=Enterprise | |
8 | # binary-install |
|
8 | # binary-install | |
9 |
ARG RHODECODE_VERSION=4.2 |
|
9 | ARG RHODECODE_VERSION=4.28.0 | |
10 |
|
10 | |||
11 | ARG RHODECODE_DB=sqlite |
|
11 | ARG RHODECODE_DB=sqlite | |
12 | ARG RHODECODE_USER_NAME=admin |
|
12 | ARG RHODECODE_USER_NAME=admin | |
13 | ARG RHODECODE_USER_PASS=secret4 |
|
13 | ARG RHODECODE_USER_PASS=secret4 | |
14 | ARG RHODECODE_USER_EMAIL=support@rhodecode.com |
|
14 | ARG RHODECODE_USER_EMAIL=support@rhodecode.com | |
15 |
|
15 | |||
|
16 | # nix ver/channels | |||
|
17 | ARG DEV_NIX_VERSION=2.0.4 | |||
|
18 | ARG DEV_NIX_CHANNEL=nixos-18.03 | |||
|
19 | ||||
16 | # env are runtime |
|
20 | # env are runtime | |
17 | ENV \ |
|
21 | ENV \ | |
18 | TZ=${TZ} \ |
|
22 | TZ=${TZ} \ | |
@@ -43,8 +47,9 b' ENV \\' | |||||
43 | # SSHD CONFIG |
|
47 | # SSHD CONFIG | |
44 | SSHD_CONF_FILE=/etc/rhodecode/sshd_config \ |
|
48 | SSHD_CONF_FILE=/etc/rhodecode/sshd_config \ | |
45 | \ |
|
49 | \ | |
|
50 | SHARED_CONF_DIR=/etc/rhodecode/conf \ | |||
46 | BUILD_CONF=/etc/rhodecode/conf_build \ |
|
51 | BUILD_CONF=/etc/rhodecode/conf_build \ | |
47 |
BUILD_BIN_DIR=/ |
|
52 | BUILD_BIN_DIR=/usr/local/bin/rhodecode_bin \ | |
48 | RHODECODE_DATA_DIR=/var/opt/rhodecode_data \ |
|
53 | RHODECODE_DATA_DIR=/var/opt/rhodecode_data \ | |
49 | RHODECODE_REPO_DIR=/var/opt/rhodecode_repo_store \ |
|
54 | RHODECODE_REPO_DIR=/var/opt/rhodecode_repo_store \ | |
50 | RHODECODE_HTTP_PORT=10020 \ |
|
55 | RHODECODE_HTTP_PORT=10020 \ | |
@@ -91,8 +96,8 b' set -eux; \\' | |||||
91 |
|
96 | |||
92 | RUN \ |
|
97 | RUN \ | |
93 | echo "** Configure the python executable for py2/3 compat **" && \ |
|
98 | echo "** Configure the python executable for py2/3 compat **" && \ | |
94 | ISPY=$(which python3 || which python2) && \ |
|
99 | IS_PY=$(which python3 || which python2) && \ | |
95 | if [ -n $ISPY ] ; then ln -s $ISPY /usr/bin/python ; fi |
|
100 | if [ -n $IS_PY ] ; then ln -s $IS_PY /usr/bin/python ; fi | |
96 |
|
101 | |||
97 | RUN \ |
|
102 | RUN \ | |
98 | echo "** Configure the locales **" && \ |
|
103 | echo "** Configure the locales **" && \ | |
@@ -115,6 +120,17 b' echo "** Create system user $RC_USER **" && \\' | |||||
115 | useradd --system --gid $RC_USER --uid 999 --shell /bin/bash $RC_USER && \ |
|
120 | useradd --system --gid $RC_USER --uid 999 --shell /bin/bash $RC_USER && \ | |
116 | usermod -G $RC_USER $RC_USER |
|
121 | usermod -G $RC_USER $RC_USER | |
117 |
|
122 | |||
|
123 | RUN \ | |||
|
124 | echo "** Create nix-build user $NIX_BLD_USER **" && \ | |||
|
125 | groupadd --system --gid 1099 $NIX_BLD_USER && \ | |||
|
126 | useradd --system --gid $NIX_BLD_USER --uid 1099 --shell /bin/bash $NIX_BLD_USER && \ | |||
|
127 | usermod -G $NIX_BLD_USER $NIX_BLD_USER | |||
|
128 | ||||
|
129 | RUN \ | |||
|
130 | echo "** disable nix sandboxing **" && \ | |||
|
131 | mkdir /etc/nix && echo 'sandbox = false' > /etc/nix/nix.conf | |||
|
132 | ||||
|
133 | ||||
118 | # set the defult bash shell |
|
134 | # set the defult bash shell | |
119 | SHELL ["/bin/bash", "-c"] |
|
135 | SHELL ["/bin/bash", "-c"] | |
120 |
|
136 | |||
@@ -129,10 +145,13 b' RUN \\' | |||||
129 | echo "** prepare rhodecode store and cache **" && \ |
|
145 | echo "** prepare rhodecode store and cache **" && \ | |
130 | install -d -m 0700 -o $RC_USER -g $RC_USER /nix && \ |
|
146 | install -d -m 0700 -o $RC_USER -g $RC_USER /nix && \ | |
131 | install -d -m 0755 -o $RC_USER -g $RC_USER /opt/rhodecode && \ |
|
147 | install -d -m 0755 -o $RC_USER -g $RC_USER /opt/rhodecode && \ | |
132 |
install -d -m 0755 -o $RC_USER -g $RC_USER / |
|
148 | install -d -m 0755 -o $RC_USER -g $RC_USER /usr/local/bin/rhodecode_bin && \ | |
133 | install -d -m 0755 -o $RC_USER -g $RC_USER $RHODECODE_REPO_DIR && \ |
|
149 | install -d -m 0755 -o $RC_USER -g $RC_USER $RHODECODE_REPO_DIR && \ | |
134 | install -d -m 0755 -o $RC_USER -g $RC_USER $RHODECODE_DATA_DIR && \ |
|
150 | install -d -m 0755 -o $RC_USER -g $RC_USER $RHODECODE_DATA_DIR && \ | |
135 | install -d -m 0755 -o $RC_USER -g $RC_USER $BUILD_CONF && \ |
|
151 | install -d -m 0755 -o $RC_USER -g $RC_USER $BUILD_CONF && \ | |
|
152 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/rhodecode-vcsserver && \ | |||
|
153 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/rhodecode-enterprise-ce && \ | |||
|
154 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/rhodecode-enterprise-ee && \ | |||
136 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/ && \ |
|
155 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/ && \ | |
137 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/.rccontrol && \ |
|
156 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/.rccontrol && \ | |
138 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/.rccontrol/cache && \ |
|
157 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/.rccontrol/cache && \ | |
@@ -173,7 +192,7 b' echo "**** Apache config ****" && \\' | |||||
173 | # Copy artifacts |
|
192 | # Copy artifacts | |
174 |
|
193 | |||
175 | COPY --chown=$RC_USER:$RC_USER .cache/* /home/$RC_USER/.rccontrol/cache/ |
|
194 | COPY --chown=$RC_USER:$RC_USER .cache/* /home/$RC_USER/.rccontrol/cache/ | |
176 |
COPY --chown=$RC_USER:$RC_USER config/ |
|
195 | COPY --chown=$RC_USER:$RC_USER config/_shared/rhodecode_enterprise.license /home/$RC_USER/.rccontrol/bootstrap/ | |
177 | COPY --chown=$RC_USER:$RC_USER service/rhodecode/bootstrap/* /home/$RC_USER/.rccontrol/bootstrap/ |
|
196 | COPY --chown=$RC_USER:$RC_USER service/rhodecode/bootstrap/* /home/$RC_USER/.rccontrol/bootstrap/ | |
178 |
|
197 | |||
179 | RUN \ |
|
198 | RUN \ | |
@@ -192,15 +211,18 b' echo "** install rhodecode control **" && \\' | |||||
192 | ${INSTALLER} --accept-license && \ |
|
211 | ${INSTALLER} --accept-license && \ | |
193 | ${RCCONTROL} self-init && \ |
|
212 | ${RCCONTROL} self-init && \ | |
194 | cp -v /home/$RC_USER/.rccontrol-profile/etc/ca-bundle.crt $BUILD_CONF/ && \ |
|
213 | cp -v /home/$RC_USER/.rccontrol-profile/etc/ca-bundle.crt $BUILD_CONF/ && \ | |
195 | echo "Done" |
|
214 | echo "Done installing rhodecode control" | |
196 |
|
215 | |||
197 | RUN \ |
|
216 | RUN \ | |
198 | echo "** install vcsserver ${RHODECODE_VERSION} **" && \ |
|
217 | echo "** install vcsserver ${RHODECODE_VERSION} **" && \ | |
199 | ${RCCONTROL} install VCSServer --version ${RHODECODE_VERSION} --start-at-boot=yes --accept-license --offline \ |
|
218 | ${RCCONTROL} install VCSServer --version ${RHODECODE_VERSION} --start-at-boot=yes --accept-license --offline \ | |
200 | '{"host":"'"$RHODECODE_VCS_HOST"'", "port":"'"$RHODECODE_VCS_PORT"'"}' && \ |
|
219 | '{"host":"'"$RHODECODE_VCS_HOST"'", "port":"'"$RHODECODE_VCS_PORT"'"}' && \ | |
201 | VCSSERVER_PATH=/home/$RC_USER/.rccontrol/vcsserver-1 && \ |
|
220 | VCSSERVER_PATH=/home/$RC_USER/.rccontrol/vcsserver-1 && \ | |
202 | rm -rf $BUILD_BIN_DIR/vcs_bin && ln -s ${VCSSERVER_PATH}/profile/bin $BUILD_BIN_DIR/vcs_bin && \ |
|
221 | rm -rf $BUILD_BIN_DIR/vcs_bin && \ | |
203 |
|
|
222 | ln -s ${VCSSERVER_PATH}/profile/bin $BUILD_BIN_DIR/vcs_bin && \ | |
|
223 | cp -v ${VCSSERVER_PATH}/vcsserver.ini $BUILD_CONF/vcsserver.ini && \ | |||
|
224 | cp -v ${VCSSERVER_PATH}/gunicorn_conf.py $BUILD_CONF/gunicorn_conf_vcs.py && \ | |||
|
225 | echo "Done installing vcsserver" | |||
204 |
|
226 | |||
205 | RUN \ |
|
227 | RUN \ | |
206 | echo "** install rhodecode ${RHODECODE_TYPE} ${RHODECODE_VERSION} **" && \ |
|
228 | echo "** install rhodecode ${RHODECODE_TYPE} ${RHODECODE_VERSION} **" && \ | |
@@ -213,31 +235,34 b' echo "** install rhodecode ${RHODECODE_TYPE} ${RHODECODE_VERSION} **" && \\' | |||||
213 | cp -v ${RHODECODE_PATH}/gunicorn_conf.py $BUILD_CONF/gunicorn_conf.py && \ |
|
235 | cp -v ${RHODECODE_PATH}/gunicorn_conf.py $BUILD_CONF/gunicorn_conf.py && \ | |
214 | cp -v ${RHODECODE_PATH}/search_mapping.ini $BUILD_CONF/search_mapping.ini && \ |
|
236 | cp -v ${RHODECODE_PATH}/search_mapping.ini $BUILD_CONF/search_mapping.ini && \ | |
215 | mkdir -p $RHODECODE_DATA_DIR/static && cp -r ${RHODECODE_PATH}/public/* $RHODECODE_DATA_DIR/static/ && \ |
|
237 | mkdir -p $RHODECODE_DATA_DIR/static && cp -r ${RHODECODE_PATH}/public/* $RHODECODE_DATA_DIR/static/ && \ | |
216 | rm ${RHODECODE_PATH}/rhodecode.db |
|
238 | rm ${RHODECODE_PATH}/rhodecode.db && \ | |
|
239 | echo "Done installing rhodecode" | |||
217 |
|
240 | |||
218 |
|
241 | |||
219 | RUN \ |
|
242 | RUN \ | |
220 | echo "** configure supervisord **" && \ |
|
243 | echo "** configure supervisord **" && \ | |
221 | cp -v ${SUPERVISOR_CONF} $BUILD_CONF/ && \ |
|
244 | cp -v ${SUPERVISOR_CONF} $BUILD_CONF/ && \ | |
222 | sed -i "s/self_managed_supervisor = False/self_managed_supervisor = True/g" /home/$RC_USER/.rccontrol.ini && \ |
|
245 | sed -i "s/self_managed_supervisor = False/self_managed_supervisor = True/g" /home/$RC_USER/.rccontrol.ini && \ | |
223 | echo "done" |
|
246 | echo "Done installing supervisord" | |
224 |
|
247 | |||
225 | USER root |
|
248 | USER root | |
226 |
|
249 | |||
227 |
|
||||
228 | RUN \ |
|
250 | RUN \ | |
229 | echo "**** cleanup ****" && \ |
|
251 | echo "**** cleanup ****" && \ | |
230 | apt-get remove -y $PYTHON_DEPS && \ |
|
252 | apt-get remove -y $PYTHON_DEPS && \ | |
231 | apt-get autoclean -y && \ |
|
253 | apt-get autoclean -y && \ | |
232 | rm -f /tmp/* && \ |
|
254 | rm -f /tmp/* && \ | |
|
255 | rm -rf /var/lib/apt/lists/* && \ | |||
|
256 | rm -rf /var/cache/apk/* && \ | |||
233 | rm -f /home/$RC_USER/.rccontrol/cache/RhodeCode-installer-* && \ |
|
257 | rm -f /home/$RC_USER/.rccontrol/cache/RhodeCode-installer-* && \ | |
234 | rm -f /home/$RC_USER/.rccontrol/cache/*.bz2 && \ |
|
258 | rm -f /home/$RC_USER/.rccontrol/cache/*.bz2 && \ | |
235 | rm -rf /var/lib/apt/lists/* \ |
|
259 | rm -f ${SUPERVISOR_CONF} && \ | |
236 | rm -rf /var/cache/apk/* \ |
|
260 | echo "Done cleanup" | |
237 | rm ${SUPERVISOR_CONF} |
|
261 | ||
238 |
|
262 | |||
239 | # copy entrypoints |
|
263 | # copy entrypoints | |
240 | COPY entrypoints.d/entrypoint.sh /opt/entrypoints.d/entrypoint.sh |
|
264 | COPY entrypoints.d/entrypoint.sh /opt/entrypoints.d/entrypoint.sh | |
|
265 | ||||
241 | RUN chmod +x /opt/entrypoints.d/entrypoint.sh |
|
266 | RUN chmod +x /opt/entrypoints.d/entrypoint.sh | |
242 |
|
267 | |||
243 | # config volume |
|
268 | # config volume | |
@@ -255,4 +280,4 b' VOLUME /var/log/rhodecode' | |||||
255 | ENTRYPOINT ["/opt/entrypoints.d/entrypoint.sh"] |
|
280 | ENTRYPOINT ["/opt/entrypoints.d/entrypoint.sh"] | |
256 |
|
281 | |||
257 | # compose can override this |
|
282 | # compose can override this | |
258 | CMD ["supervisord", "--nodaemon", "-c", "/etc/rhodecode/conf/supervisord.ini"] |
|
283 | CMD [ "$BUILD_BIN_DIR/bin/gunicorn", "--error-logfile=-", "--paster=/etc/rhodecode/conf_build/run.ini", "--config=/etc/rhodecode/conf_build/gunicorn_conf.py" ] |
@@ -6,7 +6,7 b' ARG TZ="UTC"' | |||||
6 | ARG LOCALE_TYPE=en_US.UTF-8 |
|
6 | ARG LOCALE_TYPE=en_US.UTF-8 | |
7 | ARG RHODECODE_TYPE=Enterprise |
|
7 | ARG RHODECODE_TYPE=Enterprise | |
8 | # source-install |
|
8 | # source-install | |
9 |
ARG RHODECODE_VERSION=4.2 |
|
9 | ARG RHODECODE_VERSION=4.28.0 | |
10 |
|
10 | |||
11 | ARG RHODECODE_DB=sqlite |
|
11 | ARG RHODECODE_DB=sqlite | |
12 | ARG RHODECODE_USER_NAME=admin |
|
12 | ARG RHODECODE_USER_NAME=admin | |
@@ -47,8 +47,9 b' ENV \\' | |||||
47 | # SSHD CONFIG |
|
47 | # SSHD CONFIG | |
48 | SSHD_CONF_FILE=/etc/rhodecode/sshd_config \ |
|
48 | SSHD_CONF_FILE=/etc/rhodecode/sshd_config \ | |
49 | \ |
|
49 | \ | |
|
50 | SHARED_CONF_DIR=/etc/rhodecode/conf \ | |||
50 | BUILD_CONF=/etc/rhodecode/conf_build \ |
|
51 | BUILD_CONF=/etc/rhodecode/conf_build \ | |
51 |
BUILD_BIN_DIR=/ |
|
52 | BUILD_BIN_DIR=/usr/local/bin/rhodecode_bin \ | |
52 | RHODECODE_DATA_DIR=/var/opt/rhodecode_data \ |
|
53 | RHODECODE_DATA_DIR=/var/opt/rhodecode_data \ | |
53 | RHODECODE_REPO_DIR=/var/opt/rhodecode_repo_store \ |
|
54 | RHODECODE_REPO_DIR=/var/opt/rhodecode_repo_store \ | |
54 | RHODECODE_HTTP_PORT=10020 \ |
|
55 | RHODECODE_HTTP_PORT=10020 \ | |
@@ -65,7 +66,7 b' ENV \\' | |||||
65 | ENV SVN_LOCALE_DEPS apache2 apache2-utils libapache2-mod-svn |
|
66 | ENV SVN_LOCALE_DEPS apache2 apache2-utils libapache2-mod-svn | |
66 | ENV SSH_LOCALE_DEPS openssh-server |
|
67 | ENV SSH_LOCALE_DEPS openssh-server | |
67 | ENV PYTHON_DEPS python2 |
|
68 | ENV PYTHON_DEPS python2 | |
68 |
ENV EXTRA_DEPS |
|
69 | ENV EXTRA_DEPS "" | |
69 |
|
70 | |||
70 | ENV \ |
|
71 | ENV \ | |
71 | PATH=$PATH:/nix/var/nix/profiles/per-user/$RC_USER/profile/bin:/home/$RC_USER/rhodecode-enterprise-ee/profile/bin \ |
|
72 | PATH=$PATH:/nix/var/nix/profiles/per-user/$RC_USER/profile/bin:/home/$RC_USER/rhodecode-enterprise-ee/profile/bin \ | |
@@ -102,8 +103,8 b' set -eux; \\' | |||||
102 |
|
103 | |||
103 | RUN \ |
|
104 | RUN \ | |
104 | echo "** Configure the python executable for py2/3 compat **" && \ |
|
105 | echo "** Configure the python executable for py2/3 compat **" && \ | |
105 | ISPY=$(which python3 || which python2) && \ |
|
106 | IS_PY=$(which python3 || which python2) && \ | |
106 | if [ -n $ISPY ] ; then ln -s $ISPY /usr/bin/python ; fi |
|
107 | if [ -n $IS_PY ] ; then ln -s $IS_PY /usr/bin/python ; fi | |
107 |
|
108 | |||
108 | RUN \ |
|
109 | RUN \ | |
109 | echo "** Configure the locales **" && \ |
|
110 | echo "** Configure the locales **" && \ | |
@@ -151,7 +152,7 b' RUN \\' | |||||
151 | echo "** prepare rhodecode store and cache **" && \ |
|
152 | echo "** prepare rhodecode store and cache **" && \ | |
152 | install -d -m 0700 -o $RC_USER -g $RC_USER /nix && \ |
|
153 | install -d -m 0700 -o $RC_USER -g $RC_USER /nix && \ | |
153 | install -d -m 0755 -o $RC_USER -g $RC_USER /opt/rhodecode && \ |
|
154 | install -d -m 0755 -o $RC_USER -g $RC_USER /opt/rhodecode && \ | |
154 |
install -d -m 0755 -o $RC_USER -g $RC_USER / |
|
155 | install -d -m 0755 -o $RC_USER -g $RC_USER /usr/local/bin/rhodecode_bin && \ | |
155 | install -d -m 0755 -o $RC_USER -g $RC_USER $RHODECODE_REPO_DIR && \ |
|
156 | install -d -m 0755 -o $RC_USER -g $RC_USER $RHODECODE_REPO_DIR && \ | |
156 | install -d -m 0755 -o $RC_USER -g $RC_USER $RHODECODE_DATA_DIR && \ |
|
157 | install -d -m 0755 -o $RC_USER -g $RC_USER $RHODECODE_DATA_DIR && \ | |
157 | install -d -m 0755 -o $RC_USER -g $RC_USER $BUILD_CONF && \ |
|
158 | install -d -m 0755 -o $RC_USER -g $RC_USER $BUILD_CONF && \ | |
@@ -162,7 +163,8 b' echo "** prepare rhodecode store and cache **" && \\' | |||||
162 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/.rccontrol && \ |
|
163 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/.rccontrol && \ | |
163 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/.rccontrol/cache && \ |
|
164 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/.rccontrol/cache && \ | |
164 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/.rccontrol/bootstrap && \ |
|
165 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/.rccontrol/bootstrap && \ | |
165 | install -d -m 0700 -o $RC_USER -g $RC_USER /home/$RC_USER/.ssh |
|
166 | install -d -m 0700 -o $RC_USER -g $RC_USER /home/$RC_USER/.ssh && \ | |
|
167 | install -d -m 0700 -o $RC_USER -g $RC_USER /home/$RC_USER/.rhoderc | |||
166 |
|
168 | |||
167 | # expose our custom sshd config |
|
169 | # expose our custom sshd config | |
168 | COPY service/sshd/sshd_config $SSHD_CONF_FILE |
|
170 | COPY service/sshd/sshd_config $SSHD_CONF_FILE | |
@@ -195,11 +197,18 b' echo "**** Apache config ****" && \\' | |||||
195 |
|
197 | |||
196 |
|
198 | |||
197 | # Copy artifacts |
|
199 | # Copy artifacts | |
198 | COPY --chown=$RC_USER:$RC_USER .source/ /home/$RC_USER/ |
|
200 | ||
199 | COPY --chown=$RC_USER:$RC_USER .cache/* /home/$RC_USER/.rccontrol/cache/ |
|
201 | COPY --chown=$RC_USER:$RC_USER .cache/* /home/$RC_USER/.rccontrol/cache/ | |
200 |
COPY --chown=$RC_USER:$RC_USER config/ |
|
202 | COPY --chown=$RC_USER:$RC_USER config/_shared/rhodecode_enterprise.license /home/$RC_USER/.rccontrol/bootstrap/ | |
201 | COPY --chown=$RC_USER:$RC_USER service/rhodecode/bootstrap/* /home/$RC_USER/.rccontrol/bootstrap/ |
|
203 | COPY --chown=$RC_USER:$RC_USER service/rhodecode/bootstrap/* /home/$RC_USER/.rccontrol/bootstrap/ | |
202 |
|
204 | |||
|
205 | COPY --chown=$RC_USER:$RC_USER .source/ /home/$RC_USER/ | |||
|
206 | RUN \ | |||
|
207 | echo "** prepare rhodecode dirs **" && \ | |||
|
208 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/.rccontrol/vcsserver-1 && \ | |||
|
209 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/.rccontrol/community-1 && \ | |||
|
210 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/.rccontrol/enterprise-1 && \ | |||
|
211 | ||||
203 | RUN \ |
|
212 | RUN \ | |
204 | echo "**** locale-archive path ****" && \ |
|
213 | echo "**** locale-archive path ****" && \ | |
205 | mv -v /home/$RC_USER/.rccontrol/cache/locale-archive /var/opt/locale-archive |
|
214 | mv -v /home/$RC_USER/.rccontrol/cache/locale-archive /var/opt/locale-archive | |
@@ -235,16 +244,19 b' echo "** install rhodecode control **" && \\' | |||||
235 | # ${INSTALLER} --accept-license && \ |
|
244 | # ${INSTALLER} --accept-license && \ | |
236 | # ${RCCONTROL} self-init && \ |
|
245 | # ${RCCONTROL} self-init && \ | |
237 | # cp -v /home/$RC_USER/.rccontrol-profile/etc/ca-bundle.crt $BUILD_CONF/ && \ |
|
246 | # cp -v /home/$RC_USER/.rccontrol-profile/etc/ca-bundle.crt $BUILD_CONF/ && \ | |
238 | echo "Done" |
|
247 | echo "Done installing rhodecode control" | |
239 |
|
248 | |||
240 | RUN \ |
|
249 | RUN \ | |
241 |
echo "** install |
|
250 | echo "** install vcsserver ${RHODECODE_VERSION} **" && \ | |
242 | . /home/rhodecode/.nix-profile/etc/profile.d/nix.sh && \ |
|
251 | . /home/rhodecode/.nix-profile/etc/profile.d/nix.sh && \ | |
243 |
nix-build --show-trace --cores 0 --max-jobs 4 --no-build-output --out-link |
|
252 | nix-build --show-trace --cores 0 --max-jobs 4 --no-build-output --out-link /home/$RC_USER/.rccontrol/vcsserver-1/profile rhodecode-vcsserver/default.nix && \ | |
244 |
nix-shell --command 'echo |
|
253 | nix-shell --command 'echo COMMAND FROM NIX-SHELL TEST' rhodecode-vcsserver/default.nix && \ | |
245 | VCSSERVER_PATH=/home/$RC_USER/rhodecode-vcsserver && \ |
|
254 | VCSSERVER_PATH=/home/$RC_USER/rhodecode-vcsserver && \ | |
246 | rm -rf $BUILD_BIN_DIR/vcs_bin && ln -s ${VCSSERVER_PATH}/result/bin $BUILD_BIN_DIR/vcs_bin && \ |
|
255 | rm -rf $BUILD_BIN_DIR/vcs_bin && \ | |
247 | cp -v ${VCSSERVER_PATH}/configs/production.ini $BUILD_CONF/vcsserver.ini |
|
256 | cp -rv --preserve=links /home/$RC_USER/.rccontrol/vcsserver-1/profile/bin $BUILD_BIN_DIR/vcs_bin && \ | |
|
257 | cp -v ${VCSSERVER_PATH}/configs/production.ini $BUILD_CONF/vcsserver.ini && \ | |||
|
258 | cp -v ${VCSSERVER_PATH}/configs/gunicorn_config.py $BUILD_CONF/gunicorn_conf_vcs.py && \ | |||
|
259 | echo "Done installing vcsserver" | |||
248 |
|
260 | |||
249 | RUN \ |
|
261 | RUN \ | |
250 | echo "** install build Community ${RHODECODE_VERSION} **" && \ |
|
262 | echo "** install build Community ${RHODECODE_VERSION} **" && \ | |
@@ -252,26 +264,27 b' echo "** install build Community ${RHODECODE_VERSION} **" && \\' | |||||
252 | echo "done" |
|
264 | echo "done" | |
253 |
|
265 | |||
254 | RUN \ |
|
266 | RUN \ | |
255 |
echo "** install |
|
267 | echo "** install rhodecode ${RHODECODE_VERSION} **" && \ | |
256 | . /home/rhodecode/.nix-profile/etc/profile.d/nix.sh && \ |
|
268 | . /home/rhodecode/.nix-profile/etc/profile.d/nix.sh && \ | |
257 |
nix-build --show-trace --cores 0 --max-jobs 4 --no-build-output --out-link |
|
269 | nix-build --show-trace --cores 0 --max-jobs 4 --no-build-output --out-link /home/$RC_USER/.rccontrol/enterprise-1/profile rhodecode-enterprise-ee/default.nix && \ | |
258 | nix-shell --command 'echo ok' rhodecode-enterprise-ee/default.nix && \ |
|
270 | nix-shell --command 'echo ok' rhodecode-enterprise-ee/default.nix && \ | |
259 | RHODECODE_PATH=/home/$RC_USER/rhodecode-enterprise-ee && \ |
|
271 | RHODECODE_PATH=/home/$RC_USER/rhodecode-enterprise-ee && \ | |
260 | rm -rf $BUILD_BIN_DIR/bin && ln -s ${RHODECODE_PATH}/result/bin $BUILD_BIN_DIR/ && \ |
|
272 | rm -rf $BUILD_BIN_DIR/bin && \ | |
|
273 | cp -rv --preserve=links /home/$RC_USER/.rccontrol/enterprise-1/profile/bin $BUILD_BIN_DIR/ && \ | |||
261 | cp -v ${RHODECODE_PATH}/configs/production.ini $BUILD_CONF/rhodecode.ini && \ |
|
274 | cp -v ${RHODECODE_PATH}/configs/production.ini $BUILD_CONF/rhodecode.ini && \ | |
262 | cp -v ${RHODECODE_PATH}/configs/gunicorn_config.py $BUILD_CONF/gunicorn_conf.py && \ |
|
275 | cp -v ${RHODECODE_PATH}/configs/gunicorn_config.py $BUILD_CONF/gunicorn_conf.py && \ | |
263 |
mkdir -p $RHODECODE_DATA_DIR/static && cp -r |
|
276 | mkdir -p $RHODECODE_DATA_DIR/static && cp -r /home/$RC_USER/.rccontrol/enterprise-1/profile/etc/static/* $RHODECODE_DATA_DIR/static/ && \ | |
|
277 | echo "Done installing rhodecode" | |||
264 |
|
278 | |||
265 |
|
279 | |||
266 | RUN \ |
|
280 | RUN \ | |
267 | echo "** configure supervisord **" && \ |
|
281 | echo "** configure supervisord **" && \ | |
268 | #cp -v ${SUPERVISOR_CONF} $BUILD_CONF/ && \ |
|
282 | #cp -v ${SUPERVISOR_CONF} $BUILD_CONF/ && \ | |
269 | #sed -i "s/self_managed_supervisor = False/self_managed_supervisor = True/g" /home/$RC_USER/.rccontrol.ini && \ |
|
283 | #sed -i "s/self_managed_supervisor = False/self_managed_supervisor = True/g" /home/$RC_USER/.rccontrol.ini && \ | |
270 | echo "done" |
|
284 | echo "Done installing supervisord" | |
271 |
|
285 | |||
272 | USER root |
|
286 | USER root | |
273 |
|
287 | |||
274 |
|
||||
275 | RUN \ |
|
288 | RUN \ | |
276 | echo "**** cleanup ****" && \ |
|
289 | echo "**** cleanup ****" && \ | |
277 | apt-get remove -y $PYTHON_DEPS && \ |
|
290 | apt-get remove -y $PYTHON_DEPS && \ | |
@@ -279,12 +292,18 b' echo "**** cleanup ****" && \\' | |||||
279 | rm -f /tmp/* && \ |
|
292 | rm -f /tmp/* && \ | |
280 | rm -f /home/$RC_USER/.rccontrol/cache/RhodeCode-installer-* && \ |
|
293 | rm -f /home/$RC_USER/.rccontrol/cache/RhodeCode-installer-* && \ | |
281 | rm -f /home/$RC_USER/.rccontrol/cache/*.bz2 && \ |
|
294 | rm -f /home/$RC_USER/.rccontrol/cache/*.bz2 && \ | |
282 | rm -rf /var/lib/apt/lists/* \ |
|
295 | rm -rf /var/lib/apt/lists/* && \ | |
283 | rm -rf /var/cache/apk/* \ |
|
296 | rm -rf /var/cache/apk/* && \ | |
284 | rm ${SUPERVISOR_CONF} |
|
297 | rm -f ${SUPERVISOR_CONF} && \ | |
|
298 | rm -rf /home/$RC_USER/rhodecode-vcsserver && \ | |||
|
299 | rm -rf /home/$RC_USER/rhodecode-enterprise-ce && \ | |||
|
300 | rm -rf /home/$RC_USER/rhodecode-enterprise-ee && \ | |||
|
301 | echo "Done cleanup" | |||
|
302 | ||||
285 |
|
303 | |||
286 | # copy entrypoints |
|
304 | # copy entrypoints | |
287 | COPY entrypoints.d/entrypoint.sh /opt/entrypoints.d/entrypoint.sh |
|
305 | COPY entrypoints.d/entrypoint.sh /opt/entrypoints.d/entrypoint.sh | |
|
306 | ||||
288 | RUN chmod +x /opt/entrypoints.d/entrypoint.sh |
|
307 | RUN chmod +x /opt/entrypoints.d/entrypoint.sh | |
289 |
|
308 | |||
290 | # config volume |
|
309 | # config volume | |
@@ -302,4 +321,4 b' VOLUME /var/log/rhodecode' | |||||
302 | ENTRYPOINT ["/opt/entrypoints.d/entrypoint.sh"] |
|
321 | ENTRYPOINT ["/opt/entrypoints.d/entrypoint.sh"] | |
303 |
|
322 | |||
304 | # compose can override this |
|
323 | # compose can override this | |
305 | CMD ["supervisord", "--nodaemon", "-c", "/etc/rhodecode/conf/supervisord.ini"] |
|
324 | CMD [ "$BUILD_BIN_DIR/bin/gunicorn", "--error-logfile=-", "--paster=/etc/rhodecode/conf_build/run.ini", "--config=/etc/rhodecode/conf_build/gunicorn_conf.py" ] |
@@ -1,4 +1,5 b'' | |||||
1 | FROM debian:buster |
|
1 | FROM ubuntu:22.04 | |
|
2 | # Using 22.04 LTS Release | |||
2 | MAINTAINER RhodeCode Inc. <support@rhodecode.com> |
|
3 | MAINTAINER RhodeCode Inc. <support@rhodecode.com> | |
3 |
|
4 | |||
4 | # env are runtime/build |
|
5 | # env are runtime/build |
@@ -5,20 +5,36 b' MAINTAINER RhodeCode Inc. <support@rhodecode.com>' | |||||
5 |
|
5 | |||
6 | ENV \ |
|
6 | ENV \ | |
7 | RC_USER=rhodecode \ |
|
7 | RC_USER=rhodecode \ | |
8 | MOD_DAV_SVN_CONF_FILE=/etc/rhodecode/conf/svn/mod_dav_svn.conf |
|
8 | # SVN CONFIG | |
|
9 | MOD_DAV_SVN_CONF_FILE=/etc/rhodecode/conf/svn/mod_dav_svn.conf \ | |||
|
10 | MOD_DAV_SVN_PORT=8090 | |||
|
11 | ||||
|
12 | ENV SVN_LOCALE_DEPS apache2 apache2-utils libapache2-mod-svn subversion | |||
|
13 | #apache2-webdav | |||
9 |
|
14 | |||
10 | RUN \ |
|
15 | RUN \ | |
11 |
echo "** install base |
|
16 | echo "** install svn base packages **" && \ | |
12 | apt-get update && \ |
|
17 | set -eux; \ | |
13 | apt-get install --no-cache \ |
|
18 | \ | |
14 | tini \ |
|
19 | savedAptMark="$(apt-mark showmanual)"; \ | |
15 | bash \ |
|
20 | apt-get update; \ | |
16 | curl \ |
|
21 | DEBIAN_FRONTEND="noninteractive" \ | |
17 | apache2 \ |
|
22 | apt-get install -y --no-install-recommends \ | |
18 | apache2-utils \ |
|
23 | tini \ | |
19 | apache2-webdav \ |
|
24 | bash \ | |
20 | mod_dav_svn \ |
|
25 | binutils \ | |
21 | subversion |
|
26 | tzdata \ | |
|
27 | locales \ | |||
|
28 | openssl \ | |||
|
29 | curl \ | |||
|
30 | sudo \ | |||
|
31 | gosu \ | |||
|
32 | bzip2 \ | |||
|
33 | ca-certificates \ | |||
|
34 | $SVN_LOCALE_DEPS \ | |||
|
35 | ; \ | |||
|
36 | rm -rf /var/lib/apt/lists/*; | |||
|
37 | ||||
22 |
|
38 | |||
23 | # configure the system user |
|
39 | # configure the system user | |
24 | # explicitly set uid/gid to guarantee that it won't change in the future |
|
40 | # explicitly set uid/gid to guarantee that it won't change in the future | |
@@ -26,47 +42,58 b' echo "** install base svn packages **" && \\' | |||||
26 | RUN \ |
|
42 | RUN \ | |
27 | echo "** Create system user $RC_USER **" && \ |
|
43 | echo "** Create system user $RC_USER **" && \ | |
28 | groupadd --system --gid 999 $RC_USER && \ |
|
44 | groupadd --system --gid 999 $RC_USER && \ | |
29 | useradd --system --gid $RC_USER --uid 999 --shell /bin/bash $RC_USER |
|
45 | useradd --system --gid $RC_USER --uid 999 --shell /bin/bash $RC_USER && \ | |
|
46 | usermod -G $RC_USER $RC_USER | |||
|
47 | ||||
|
48 | # Apache SVN setup | |||
|
49 | RUN \ | |||
|
50 | echo "**** Apache config cleanup ****" && \ | |||
|
51 | rm -f /etc/apache2/conf.d/info.conf \ | |||
|
52 | /etc/apache2/conf.d/mpm.conf \ | |||
|
53 | /etc/apache2/conf.d/userdir.conf && \ | |||
|
54 | rm -f /etc/apache2/sites-enabled/* && \ | |||
|
55 | rm -f /etc/apache2/sites-available/* | |||
30 |
|
56 | |||
|
57 | # custom SVN virtualhost | |||
|
58 | COPY service/svn/virtualhost.conf /etc/apache2/sites-enabled/ | |||
|
59 | ||||
|
60 | RUN \ | |||
|
61 | echo "**** Apache config ****" && \ | |||
|
62 | echo $(strings /usr/lib/apache2/modules/mod_dav_svn.so | grep 'Powered by') > /var/opt/dav.version && \ | |||
|
63 | mkdir -p /run/apache2 && \ | |||
|
64 | mkdir -p /var/opt/www && \ | |||
|
65 | echo "unset HOME" > /etc/apache2/envvars && \ | |||
|
66 | echo "export APACHE_RUN_USER=${RC_USER}" >> /etc/apache2/envvars && \ | |||
|
67 | echo "export APACHE_PID_FILE=/var/run/apache2/apache2.pid" >> /etc/apache2/envvars && \ | |||
|
68 | echo "export APACHE_RUN_DIR=/var/run/apache2" >> /etc/apache2/envvars && \ | |||
|
69 | echo "export APACHE_LOCK_DIR=/var/lock/apache2" >> /etc/apache2/envvars && \ | |||
|
70 | echo "export APACHE_RUN_USER=${RC_USER}" >> /etc/apache2/envvars && \ | |||
|
71 | echo "export APACHE_RUN_GROUP=${RC_USER}" >> /etc/apache2/envvars && \ | |||
|
72 | sed -i "s/Listen 80/Listen ${MOD_DAV_SVN_PORT}/g" /etc/apache2/ports.conf | |||
|
73 | ||||
|
74 | USER root | |||
31 |
|
75 | |||
32 | RUN \ |
|
76 | RUN \ | |
33 | echo "**** cleanup ****" && \ |
|
77 | echo "**** cleanup ****" && \ | |
34 |
apt-get |
|
78 | apt-get autoclean -y && \ | |
35 | rm -f /tmp/* && \ |
|
79 | rm -f /tmp/* && \ | |
36 | rm -rf /var/lib/apt/lists/* \ |
|
80 | rm -rf /var/lib/apt/lists/* \ | |
37 | rm -rf /var/cache/apk/* |
|
81 | rm -rf /var/cache/apk/* | |
38 |
|
82 | |||
39 | RUN \ |
|
|||
40 | echo "**** Apache config cleanup ****" && \ |
|
|||
41 | rm -f /etc/apache2/conf.d/info.conf \ |
|
|||
42 | /etc/apache2/conf.d/mpm.conf \ |
|
|||
43 | /etc/apache2/conf.d/userdir.conf |
|
|||
44 |
|
||||
45 |
|
||||
46 | COPY svn/virtualhost.conf /etc/apache2/conf.d/ |
|
|||
47 |
|
83 | |||
48 | # copy entrypoints |
|
84 | # copy entrypoints | |
49 | COPY entrypoints.d/svn-entrypoint.sh /opt/entrypoints.d/svn-entrypoint.sh |
|
85 | COPY entrypoints.d/svn-entrypoint.sh /opt/entrypoints.d/svn-entrypoint.sh | |
50 | RUN chmod +x /opt/entrypoints.d/svn-entrypoint.sh |
|
86 | RUN chmod +x /opt/entrypoints.d/svn-entrypoint.sh | |
51 |
|
87 | |||
52 | RUN \ |
|
88 | # config volume | |
53 | echo $(strings /usr/lib/apache2/mod_dav_svn.so | grep 'Powered by') > /var/opt/dav.version && \ |
|
89 | VOLUME /etc/rhodecode/conf | |
54 | mkdir -p /run/apache2 && \ |
|
|||
55 | mkdir -p /var/opt/www && \ |
|
|||
56 | echo "export APACHE_RUN_USER=${RC_USER}" > /etc/apache2/envvars && \ |
|
|||
57 | echo "export APACHE_RUN_GROUP=${RC_USER}" >> /etc/apache2/envvars && \ |
|
|||
58 | sed -i "s/User apache/User ${RC_USER}/g" /etc/apache2/httpd.conf && \ |
|
|||
59 | sed -i "s/Group apache/Group ${RC_USER}/g" /etc/apache2/httpd.conf |
|
|||
60 |
|
90 | |||
61 | # repo store volume |
|
91 | # repo store volume | |
62 | VOLUME /var/opt/rhodecode_repo_store |
|
92 | VOLUME /var/opt/rhodecode_repo_store | |
63 |
|
93 | |||
64 | # config volume |
|
|||
65 | VOLUME /etc/rhodecode/conf |
|
|||
66 |
|
||||
67 | # logs volume |
|
94 | # logs volume | |
68 | VOLUME /var/log/rhodecode |
|
95 | VOLUME /var/log/rhodecode | |
69 |
|
96 | |||
70 | ENTRYPOINT ["/opt/entrypoints.d/svn-entrypoint.sh"] |
|
97 | ENTRYPOINT ["/opt/entrypoints.d/svn-entrypoint.sh"] | |
71 |
|
98 | |||
72 |
CMD ["apachectl", "-D", "FOREGROUND"] |
|
99 | CMD ["apachectl", "-D", "FOREGROUND"] No newline at end of file |
@@ -2,11 +2,22 b' LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so' | |||||
2 | LoadModule authn_anon_module /usr/lib/apache2/modules/mod_authn_anon.so |
|
2 | LoadModule authn_anon_module /usr/lib/apache2/modules/mod_authn_anon.so | |
3 | LoadModule dav_svn_module /usr/lib/apache2/modules/mod_dav_svn.so |
|
3 | LoadModule dav_svn_module /usr/lib/apache2/modules/mod_dav_svn.so | |
4 |
|
4 | |||
|
5 | ErrorLogFormat "{ \"time\":\"%{%Y-%m-%d}tT%{%T}t.%{msec_frac}tZ\", \"function\" : \"[%-m:%l]\" , \"process\" : \"[pid %P:tid %T]\" , \"message\" : \"%M\" ,\ \"referer\"\ : \"%{Referer}i\" }" | |||
|
6 | LogFormat "{ \"time\":\"%{%Y-%m-%d}tT%{%T}t.%{msec_frac}tZ\", \"process\":\"%D\", \"filename\":\"%f\", \"remoteIP\":\"%a\", \"host\":\"%V\", \"request\":\"%U\", \"query\":\"%q\", \"method\":\"%m\", \"status\":\"%>s\", \"userAgent\":\"%{User-agent}i\", \"referer\":\"%{Referer}i\" }" combined | |||
|
7 | ||||
|
8 | ErrorLog /dev/stderr | |||
|
9 | CustomLog /dev/stdout combined | |||
|
10 | ||||
|
11 | ||||
5 | <VirtualHost *:${MOD_DAV_SVN_PORT}> |
|
12 | <VirtualHost *:${MOD_DAV_SVN_PORT}> | |
6 | ServerAdmin admin@localhost |
|
13 | ServerAdmin admin@localhost | |
7 | DocumentRoot /var/opt/www |
|
14 | DocumentRoot /var/opt/www | |
8 | ErrorLog ${APACHE_LOG_DIR}/svn_error.log |
|
15 | ||
9 | CustomLog ${APACHE_LOG_DIR}/svn_access.log combined |
|
16 | ErrorLogFormat "{ \"time\":\"%{%Y-%m-%d}tT%{%T}t.%{msec_frac}tZ\", \"function\" : \"[%-m:%l]\" , \"process\" : \"[pid %P:tid %T]\" , \"message\" : \"%M\" ,\ \"referer\"\ : \"%{Referer}i\" }" | |
|
17 | LogFormat "{ \"time\":\"%{%Y-%m-%d}tT%{%T}t.%{msec_frac}tZ\", \"process\":\"%D\", \"filename\":\"%f\", \"remoteIP\":\"%a\", \"host\":\"%V\", \"request\":\"%U\", \"query\":\"%q\", \"method\":\"%m\", \"status\":\"%>s\", \"userAgent\":\"%{User-agent}i\", \"referer\":\"%{Referer}i\" }" combined | |||
|
18 | ||||
|
19 | ErrorLog /dev/stderr | |||
|
20 | CustomLog /dev/stdout combined | |||
10 | LogLevel info |
|
21 | LogLevel info | |
11 |
|
22 | |||
12 | <Location /_server_status> |
|
23 | <Location /_server_status> |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed | ||
This diff has been collapsed as it changes many lines, (746 lines changed) Show them Hide them |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now