Show More
@@ -0,0 +1,12 b'' | |||||
|
1 | Put any custom overrides and compose files here. | |||
|
2 | ||||
|
3 | e.g | |||
|
4 | ||||
|
5 | - docker-compose-services.override.yaml | |||
|
6 | - docker-compose-router.override.yaml | |||
|
7 | - docker-compose-metrics.override.yaml | |||
|
8 | - docker-compose-apps.override.yaml | |||
|
9 | ||||
|
10 | Passing variables to containers | |||
|
11 | ||||
|
12 | .runtime.env No newline at end of file |
@@ -0,0 +1,31 b'' | |||||
|
1 | version: '3.9' | |||
|
2 | ||||
|
3 | services: | |||
|
4 | ||||
|
5 | rhodecode: | |||
|
6 | ports: | |||
|
7 | - "10020:10020" | |||
|
8 | environment: | |||
|
9 | DB_UPGRADE: 0 # run the DB upgrade | |||
|
10 | SETUP_APP: 0 # run the application default settings setup, can be turned off after initial run | |||
|
11 | ||||
|
12 | deploy: | |||
|
13 | replicas: 1 | |||
|
14 | ||||
|
15 | vcsserver: | |||
|
16 | environment: | |||
|
17 | {} | |||
|
18 | deploy: | |||
|
19 | replicas: 1 | |||
|
20 | ||||
|
21 | sshd: | |||
|
22 | {} | |||
|
23 | ||||
|
24 | svn: | |||
|
25 | {} | |||
|
26 | ||||
|
27 | celery-beat: | |||
|
28 | {} | |||
|
29 | ||||
|
30 | celery: | |||
|
31 | {} |
@@ -0,0 +1,31 b'' | |||||
|
1 | version: '3.9' | |||
|
2 | ||||
|
3 | services: | |||
|
4 | ||||
|
5 | promtail: | |||
|
6 | {} | |||
|
7 | ||||
|
8 | loki: | |||
|
9 | labels: | |||
|
10 | - "traefik.enable=false" | |||
|
11 | # - "traefik.http.services.loki.loadbalancer.server.port=3100" | |||
|
12 | # - "traefik.http.services.loki.loadbalancer.server.port=9095" | |||
|
13 | ||||
|
14 | prometheus: | |||
|
15 | {} | |||
|
16 | ||||
|
17 | node-exporter: | |||
|
18 | {} | |||
|
19 | ||||
|
20 | statsd-exporter: | |||
|
21 | {} | |||
|
22 | ||||
|
23 | grafana: | |||
|
24 | ||||
|
25 | labels: | |||
|
26 | # SSL + proxy prefix | |||
|
27 | - "traefik.http.routers.grafana-rt.service=grafana-ssl" | |||
|
28 | - "traefik.http.routers.grafana-rt.entrypoints=https" | |||
|
29 | - "traefik.http.routers.grafana-rt.rule=Host(`your-domain.com`) && PathPrefix(`/_grafana`)" | |||
|
30 | - "traefik.http.routers.grafana-rt.tls=true" | |||
|
31 | - "traefik.http.services.grafana-ssl.loadbalancer.server.port=3000" No newline at end of file |
@@ -0,0 +1,43 b'' | |||||
|
1 | version: '3.9' | |||
|
2 | ||||
|
3 | ## docker network create -d overlay lb-net | |||
|
4 | services: | |||
|
5 | ||||
|
6 | traefik: | |||
|
7 | ||||
|
8 | volumes: | |||
|
9 | # So that Traefik can listen to the Docker events | |||
|
10 | - /var/run/docker.sock:/var/run/docker.sock | |||
|
11 | # custom traefik config, enable SSL etc.. | |||
|
12 | - $PWD/.custom/traefik_custom:/etc/traefik | |||
|
13 | ||||
|
14 | portainer: | |||
|
15 | # Run with COMPOSE_PROFILES=portainer | |||
|
16 | # to access portainer set HEADER `X-Docker-Host=portainer` | |||
|
17 | image: portainer/portainer-ce:latest | |||
|
18 | restart: always | |||
|
19 | volumes: | |||
|
20 | - portainer_data:/data | |||
|
21 | - /var/run/docker.sock:/var/run/docker.sock | |||
|
22 | deploy: | |||
|
23 | mode: replicated | |||
|
24 | replicas: 1 | |||
|
25 | placement: | |||
|
26 | constraints: | |||
|
27 | # limit swarm deploy to MANAGER only | |||
|
28 | - node.role == manager | |||
|
29 | ||||
|
30 | networks: | |||
|
31 | - rhodecode_network | |||
|
32 | labels: | |||
|
33 | - "traefik.enable=true" | |||
|
34 | - "traefik.http.routers.portainer.entrypoints=https" | |||
|
35 | - "traefik.http.routers.portainer.rule=Headers(`X-Docker-Host`, `portainer`)" | |||
|
36 | - "traefik.http.services.portainer.loadbalancer.server.port=9000" | |||
|
37 | ||||
|
38 | profiles: | |||
|
39 | ["portainer"] | |||
|
40 | ||||
|
41 | volumes: | |||
|
42 | portainer_data: | |||
|
43 | external: true No newline at end of file |
@@ -0,0 +1,24 b'' | |||||
|
1 | version: '3.9' | |||
|
2 | ## This is a final override file for services stack | |||
|
3 | ## Add your own customizations | |||
|
4 | ||||
|
5 | ## docker network create -d overlay lb-net | |||
|
6 | services: | |||
|
7 | ||||
|
8 | database: | |||
|
9 | {} | |||
|
10 | ||||
|
11 | database-mysql: | |||
|
12 | {} | |||
|
13 | ||||
|
14 | redis: | |||
|
15 | {} | |||
|
16 | ||||
|
17 | elasticsearch: | |||
|
18 | {} | |||
|
19 | ||||
|
20 | nginx: | |||
|
21 | {} | |||
|
22 | ||||
|
23 | channelstream: | |||
|
24 | {} No newline at end of file |
@@ -1,56 +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 | |||
5 | # Version to deploy and run |
|
5 | # Version to deploy and run | |
6 | ## VERSION_INFO |
|
6 | ## VERSION_INFO | |
7 | RC_VERSION="4.28.0.REL20221120_SOURCE" |
|
7 | RC_VERSION="4.28.0.REL20221120_SOURCE" | |
8 | #RC_CLI_VERSION_NAME="4.27.0" |
|
8 | #RC_CLI_VERSION_NAME="4.27.0" | |
9 |
|
9 | |||
10 | # ce, or ee |
|
10 | # ce, or ee | |
11 | RC_EDITION=ee |
|
11 | RC_EDITION=ee | |
12 |
RC_IMAGE_CE="rhodecode/rhodecode- |
|
12 | RC_IMAGE_CE="rhodecode/rhodecode-ce:$RC_VERSION" | |
13 |
RC_IMAGE_EE="rhodecode/rhodecode- |
|
13 | RC_IMAGE_EE="rhodecode/rhodecode-ee:$RC_VERSION" | |
14 |
|
14 | |||
15 | # Database bootstrap/access credentials |
|
15 | # Database bootstrap/access credentials | |
16 | DB_NAME=rhodecode |
|
16 | DB_NAME=rhodecode | |
17 | DB_USER=rhodecode |
|
17 | DB_USER=rhodecode | |
18 |
|
18 | |||
19 | # Bootstrap container with specific password |
|
19 | # Bootstrap container with specific password | |
20 | # This password will be used to generate new account and password for the database |
|
20 | # This password will be used to generate new account and password for the database | |
21 | DB_PASSWORD=[GENERATED_AT_BOOTSTRAP] |
|
21 | DB_PASSWORD=[GENERATED_AT_BOOTSTRAP] | |
22 |
|
22 | |||
23 | # set limit of redis in-memory cache before keys get evicted using LRU cache |
|
23 | # set limit of redis in-memory cache before keys get evicted using LRU cache | |
24 | RC_REDIS_MAXMEMORY=1024mb |
|
24 | RC_REDIS_MAXMEMORY=1024mb | |
25 |
|
25 | |||
26 | # set the size of ramdisk used for locking files |
|
26 | # set the size of ramdisk used for locking files | |
27 | RC_DATA_RAMDISK_SIZE=1G |
|
27 | RC_DATA_RAMDISK_SIZE=1G | |
28 |
|
28 | |||
29 | # base url for running app, this is used for traefik hasname matching, so accessing this host will redirect |
|
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 |
|
30 | # traffic to the running instance | |
31 | # replace this with your name of host. e.g http://yourdomain.com or https://rc.company.local |
|
31 | # replace this with your name of host. e.g http://yourdomain.com or https://rc.company.local | |
32 | RHODECODE_HOSTNAME=docker-dev |
|
32 | RHODECODE_HOSTNAME=docker-dev | |
33 |
|
33 | |||
34 |
|
34 | |||
35 | # user/password for first admin user created for access |
|
35 | # user/password for first admin user created for access | |
36 | # this is a bootstrap super-admin account to access the web interface |
|
36 | # this is a bootstrap super-admin account to access the web interface | |
37 | RHODECODE_USER_EMAIL=admin@server-com |
|
37 | RHODECODE_USER_EMAIL=admin@server-com | |
38 | RHODECODE_USER_NAME=admin |
|
38 | RHODECODE_USER_NAME=admin | |
39 | RHODECODE_USER_PASS=secret4 |
|
39 | RHODECODE_USER_PASS=secret4 | |
40 |
|
40 | |||
41 |
|
41 | |||
42 |
|
42 | |||
43 |
|
43 | |||
44 | # HTTP and HTTPS ports for running app |
|
44 | # HTTP and HTTPS ports for running app | |
45 | RC_HTTP_PORT=8888 |
|
45 | RC_HTTP_PORT=8888 | |
46 |
|
46 | |||
47 | # SSH Port exposed, increased security is to not used default 22 |
|
47 | # SSH Port exposed, increased security is to not used default 22 | |
48 | RC_SSH_PORT=3022 |
|
48 | RC_SSH_PORT=3022 | |
49 |
|
49 | |||
50 |
|
50 | |||
51 | ## RHODECODE RUNTIME VARS |
|
51 | ## RHODECODE RUNTIME VARS | |
52 |
|
52 | |||
53 | ## 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 | |
54 | GIT_DEFAULT_BRANCH_NAME=master |
|
54 | GIT_DEFAULT_BRANCH_NAME=master | |
55 |
|
55 | |||
56 |
|
56 |
@@ -1,23 +1,23 b'' | |||||
1 | # CACHE FILES |
|
1 | # CACHE FILES | |
2 | .cache/RhodeCode-installer* |
|
2 | .cache/RhodeCode-installer* | |
3 | .cache/*.tar.bz2 |
|
3 | .cache/*.tar.bz2 | |
4 | .cache/locale-archive |
|
4 | .cache/locale-archive | |
5 |
|
5 | |||
6 | # Source code downloaded |
|
6 | # Source code downloaded | |
7 | .source/* |
|
7 | .source/* | |
8 |
|
8 | |||
9 | # Custom / override wont be tracked |
|
9 | # Custom / override wont be tracked, except README file | |
10 | .custom/* |
|
10 | .custom/* | |
|
11 | !.custom/README.md | |||
11 |
|
12 | |||
12 | # LOGS |
|
13 | # LOGS | |
13 | logs/*.log |
|
14 | logs/*.log | |
14 | logs/nginx/*.log |
|
15 | logs/nginx/*.log | |
15 | logs/svn/*.log |
|
16 | logs/svn/*.log | |
16 | logs/apps/*.log |
|
17 | logs/apps/*.log | |
17 | logs/postgres/*.log |
|
18 | logs/postgres/*.log | |
18 |
|
19 | |||
19 | .idea |
|
20 | .idea | |
20 | config/_shared/.rcmetadata.json |
|
21 | config/_shared/.rcmetadata.json | |
21 |
|
22 | |||
22 | .rccontrol-bootstrap |
|
|||
23 | .rccontrol.ini No newline at end of file |
|
23 | .rccontrol.ini |
@@ -1,135 +1,144 b'' | |||||
1 | # read more here http://tautt.com/best-nginx-configuration-for-security/ |
|
1 | # read more here http://tautt.com/best-nginx-configuration-for-security/ | |
2 |
|
2 | |||
3 | # config to don't allow the browser to render the page inside an frame or iframe |
|
3 | # config to don't allow the browser to render the page inside an frame or iframe | |
4 | # and avoid clickjacking http://en.wikipedia.org/wiki/Clickjacking |
|
4 | # and avoid clickjacking http://en.wikipedia.org/wiki/Clickjacking | |
5 | # if you need to allow [i]frames, you can use SAMEORIGIN or even set an uri with ALLOW-FROM uri |
|
5 | # if you need to allow [i]frames, you can use SAMEORIGIN or even set an uri with ALLOW-FROM uri | |
6 | # https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options |
|
6 | # https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options | |
7 | #add_header X-Frame-Options SAMEORIGIN; |
|
7 | #add_header X-Frame-Options SAMEORIGIN; | |
8 |
|
8 | |||
9 | # when serving user-supplied content, include a X-Content-Type-Options: nosniff header along with the Content-Type: header, |
|
9 | # when serving user-supplied content, include a X-Content-Type-Options: nosniff header along with the Content-Type: header, | |
10 | # to disable content-type sniffing on some browsers. |
|
10 | # to disable content-type sniffing on some browsers. | |
11 | # https://www.owasp.org/index.php/List_of_useful_HTTP_headers |
|
11 | # https://www.owasp.org/index.php/List_of_useful_HTTP_headers | |
12 | # currently suppoorted in IE > 8 http://blogs.msdn.com/b/ie/archive/2008/09/02/ie8-security-part-vi-beta-2-update.aspx |
|
12 | # currently suppoorted in IE > 8 http://blogs.msdn.com/b/ie/archive/2008/09/02/ie8-security-part-vi-beta-2-update.aspx | |
13 | # http://msdn.microsoft.com/en-us/library/ie/gg622941(v=vs.85).aspx |
|
13 | # http://msdn.microsoft.com/en-us/library/ie/gg622941(v=vs.85).aspx | |
14 | # 'soon' on Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=471020 |
|
14 | # 'soon' on Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=471020 | |
15 | #add_header X-Content-Type-Options nosniff; |
|
15 | #add_header X-Content-Type-Options nosniff; | |
16 |
|
16 | |||
17 | # This header enables the Cross-site scripting (XSS) filter built into most recent web browsers. |
|
17 | # This header enables the Cross-site scripting (XSS) filter built into most recent web browsers. | |
18 | # It's usually enabled by default anyway, so the role of this header is to re-enable the filter for |
|
18 | # It's usually enabled by default anyway, so the role of this header is to re-enable the filter for | |
19 | # this particular website if it was disabled by the user. |
|
19 | # this particular website if it was disabled by the user. | |
20 | # https://www.owasp.org/index.php/List_of_useful_HTTP_headers |
|
20 | # https://www.owasp.org/index.php/List_of_useful_HTTP_headers | |
21 | #add_header X-XSS-Protection "1; mode=block"; |
|
21 | #add_header X-XSS-Protection "1; mode=block"; | |
22 |
|
22 | |||
23 | # with Content Security Policy (CSP) enabled(and a browser that supports it(http://caniuse.com/#feat=contentsecuritypolicy), |
|
23 | # with Content Security Policy (CSP) enabled(and a browser that supports it(http://caniuse.com/#feat=contentsecuritypolicy), | |
24 | # you can tell the browser that it can only download content from the domains you explicitly allow |
|
24 | # you can tell the browser that it can only download content from the domains you explicitly allow | |
25 | # http://www.html5rocks.com/en/tutorials/security/content-security-policy/ |
|
25 | # http://www.html5rocks.com/en/tutorials/security/content-security-policy/ | |
26 | # https://www.owasp.org/index.php/Content_Security_Policy |
|
26 | # https://www.owasp.org/index.php/Content_Security_Policy | |
27 | # I need to change our application code so we can increase security by disabling 'unsafe-inline' 'unsafe-eval' |
|
27 | # I need to change our application code so we can increase security by disabling 'unsafe-inline' 'unsafe-eval' | |
28 | # directives for css and js(if you have inline css or js, you will need to keep it too). |
|
28 | # directives for css and js(if you have inline css or js, you will need to keep it too). | |
29 | # more: http://www.html5rocks.com/en/tutorials/security/content-security-policy/#inline-code-considered-harmful |
|
29 | # more: http://www.html5rocks.com/en/tutorials/security/content-security-policy/#inline-code-considered-harmful | |
30 | #add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://ssl.google-analytics.com https://assets.zendesk.com https://connect.facebook.net; img-src 'self' https://ssl.google-analytics.com https://s-static.ak.facebook.com https://assets.zendesk.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://assets.zendesk.com; font-src 'self' https://themes.googleusercontent.com; frame-src https://assets.zendesk.com https://www.facebook.com https://s-static.ak.facebook.com https://tautt.zendesk.com; object-src 'none'"; |
|
30 | #add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://ssl.google-analytics.com https://assets.zendesk.com https://connect.facebook.net; img-src 'self' https://ssl.google-analytics.com https://s-static.ak.facebook.com https://assets.zendesk.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://assets.zendesk.com; font-src 'self' https://themes.googleusercontent.com; frame-src https://assets.zendesk.com https://www.facebook.com https://s-static.ak.facebook.com https://tautt.zendesk.com; object-src 'none'"; | |
31 |
|
31 | |||
32 | ## rate limiter for certain pages to prevent brute force attacks |
|
32 | ## rate limiter for certain pages to prevent brute force attacks | |
33 | limit_req_zone $binary_remote_addr zone=http_req_limit:10m rate=1r/s; |
|
33 | limit_req_zone $binary_remote_addr zone=http_req_limit:10m rate=1r/s; | |
34 |
|
34 | |||
35 | ## custom log format |
|
35 | ## custom log format | |
36 | log_format http_log_custom '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" $request_time $upstream_response_time $pipe'; |
|
36 | log_format http_log_custom '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" $request_time $upstream_response_time $pipe'; | |
37 |
|
37 | |||
38 | log_format json_log_custom escape=json |
|
38 | log_format json_log_custom escape=json | |
39 | '{' |
|
39 | '{' | |
40 | '"source":"nginx",' |
|
40 | '"source":"nginx",' | |
41 | '"remote_user":"$remote_user",' |
|
41 | '"remote_user":"$remote_user",' | |
42 | '"time_local":"$time_local",' |
|
42 | '"time_local":"$time_local",' | |
43 | '"remote_addr":"$remote_addr",' |
|
43 | '"remote_addr":"$remote_addr",' | |
|
44 | '"host":"$host",' | |||
44 | '"proxy_x_forwarded_for":"$proxy_add_x_forwarded_for",' |
|
45 | '"proxy_x_forwarded_for":"$proxy_add_x_forwarded_for",' | |
45 | '"request":"$request",' |
|
46 | '"request":"$request",' | |
46 | '"status": "$status",' |
|
47 | '"status": "$status",' | |
47 | '"request_method": "$request_method",' |
|
48 | '"request_method": "$request_method",' | |
48 | '"body_bytes_sent":"$body_bytes_sent",' |
|
49 | '"body_bytes_sent":"$body_bytes_sent",' | |
49 | '"request_time":"$request_time",' |
|
50 | '"request_time":"$request_time",' | |
50 | '"upstream_response_time":"$upstream_response_time",' |
|
51 | '"upstream_response_time":"$upstream_response_time",' | |
51 | '"http_referrer":"$http_referer",' |
|
52 | '"http_referrer":"$http_referer",' | |
|
53 | '"http_scheme":"$scheme",' | |||
52 | '"http_user_agent":"$http_user_agent"' |
|
54 | '"http_user_agent":"$http_user_agent"' | |
53 | '}'; |
|
55 | '}'; | |
54 |
|
56 | |||
55 |
|
57 | |||
56 | server { |
|
58 | server { | |
57 | listen 80 default; |
|
59 | listen 80 default; | |
58 | # ensure we get the proper Docker DNS resolver for load balancing. |
|
60 | # ensure we get the proper Docker DNS resolver for load balancing. | |
59 | resolver 127.0.0.11 ipv6=off; |
|
61 | resolver 127.0.0.11 ipv6=off valid=10s; | |
60 | server_name localhost 127.0.0.1; |
|
62 | server_name localhost 127.0.0.1; | |
61 | access_log /dev/stdout json_log_custom; |
|
63 | access_log /dev/stdout json_log_custom; | |
62 | error_log /dev/stdout; |
|
64 | error_log /dev/stdout; | |
63 |
|
65 | |||
64 | # uncomment to redirect http traffic to https (not applicable in Docker setup) |
|
66 | # uncomment to redirect http traffic to https (not applicable in Docker setup) | |
65 | #return 301 https://$host$request_uri; |
|
67 | #return 301 https://$host$request_uri; | |
66 |
|
68 | |||
67 | client_body_buffer_size 128k; |
|
69 | client_body_buffer_size 128k; | |
68 | # maximum number and size of buffers for large headers to read from client request |
|
70 | # maximum number and size of buffers for large headers to read from client request | |
69 | large_client_header_buffers 16 256k; |
|
71 | large_client_header_buffers 16 256k; | |
70 |
|
72 | |||
|
73 | location /_health { | |||
|
74 | add_header 'Content-Type' 'application/json'; | |||
|
75 | return 200 '{"status":"UP"}'; | |||
|
76 | } | |||
|
77 | ||||
71 | ## serve static files by nginx, recommended |
|
78 | ## serve static files by nginx, recommended | |
72 | location /_static/rhodecode { |
|
79 | location /_static/rhodecode { | |
73 | gzip on; |
|
80 | gzip on; | |
74 | gzip_min_length 500; |
|
81 | gzip_min_length 500; | |
75 | gzip_proxied any; |
|
82 | gzip_proxied any; | |
76 | gzip_comp_level 4; |
|
83 | gzip_comp_level 4; | |
77 | gzip_types text/css text/javascript text/xml text/plain text/x-component application/javascript application/json application/xml application/rss+xml font/truetype font/opentype application/vnd.ms-fontobject image/svg+xml; |
|
84 | gzip_types text/css text/javascript text/xml text/plain text/x-component application/javascript application/json application/xml application/rss+xml font/truetype font/opentype application/vnd.ms-fontobject image/svg+xml; | |
78 | gzip_vary on; |
|
85 | gzip_vary on; | |
79 | gzip_disable "msie6"; |
|
86 | gzip_disable "msie6"; | |
80 | expires 60d; |
|
87 | expires 60d; | |
81 |
|
88 | |||
82 | alias /var/opt/rhodecode_data/static; |
|
89 | alias /var/opt/rhodecode_data/static; | |
83 | } |
|
90 | } | |
84 |
|
91 | |||
85 | ## channelstream location handler, if channelstream live chat and notifications |
|
92 | ## channelstream location handler, if channelstream live chat and notifications | |
86 | ## are enable this will proxy the requests to channelstream websocket server |
|
93 | ## are enable this will proxy the requests to channelstream websocket server | |
|
94 | set $upstream_channelstream channelstream:8000; | |||
87 | location /_channelstream { |
|
95 | location /_channelstream { | |
88 | rewrite /_channelstream/(.*) /$1 break; |
|
96 | rewrite /_channelstream/(.*) /$1 break; | |
89 | gzip off; |
|
97 | gzip off; | |
90 | tcp_nodelay off; |
|
98 | tcp_nodelay off; | |
91 |
|
99 | |||
92 | proxy_connect_timeout 10; |
|
100 | proxy_connect_timeout 10; | |
93 | proxy_send_timeout 10m; |
|
101 | proxy_send_timeout 10m; | |
94 | proxy_read_timeout 10m; |
|
102 | proxy_read_timeout 10m; | |
95 |
|
103 | |||
96 | proxy_set_header Host $host; |
|
104 | proxy_set_header Host $host; | |
97 |
proxy_set_header |
|
105 | proxy_set_header Referer $http_referer; | |
98 | proxy_set_header X-Url-Scheme $scheme; |
|
106 | proxy_set_header X-Url-Scheme $scheme; | |
99 |
proxy_set_header X- |
|
107 | proxy_set_header X-Real-IP $remote_addr; | |
100 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|
108 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
|
109 | proxy_set_header X-Forwarded-Proto $scheme; | |||
101 |
|
110 | |||
102 | proxy_http_version 1.1; |
|
111 | proxy_http_version 1.1; | |
103 | proxy_set_header Upgrade $http_upgrade; |
|
112 | proxy_set_header Upgrade $http_upgrade; | |
104 | proxy_set_header Connection "upgrade"; |
|
113 | proxy_set_header Connection "upgrade"; | |
105 |
|
114 | |||
106 | set $upstream_channelstream http://channelstream:8000; |
|
115 | proxy_pass http://$upstream_channelstream; | |
107 |
proxy_ |
|
116 | proxy_redirect http://$upstream_channelstream/ /_channelstream; | |
108 | } |
|
117 | } | |
109 |
|
118 | |||
110 | # ## rate limit this endpoint to prevent login page brute-force attacks |
|
119 | # ## rate limit this endpoint to prevent login page brute-force attacks | |
111 | # location /_admin/login { |
|
120 | # location /_admin/login { | |
112 | # limit_req zone=http_req_limit burst=10 nodelay; |
|
121 | # limit_req zone=http_req_limit burst=10 nodelay; | |
113 | # try_files $uri @rhodecode_http; |
|
122 | # try_files $uri @rhodecode_http; | |
114 | # } |
|
123 | # } | |
115 |
|
124 | |||
116 | location / { |
|
125 | # location / { | |
117 | include /etc/nginx/proxy.conf; |
|
126 | # include /etc/nginx/proxy.conf; | |
118 | try_files $uri @rhodecode_http; |
|
127 | # try_files $uri @rhodecode_http; | |
119 | } |
|
128 | # } | |
120 |
|
129 | # | ||
121 | location @rhodecode_http { |
|
130 | # set $upstream http://rhodecode:10020; | |
122 | set $upstream http://rhodecode:10020; |
|
131 | # location @rhodecode_http { | |
123 | include /etc/nginx/proxy.conf; |
|
132 | # include /etc/nginx/proxy.conf; | |
124 | proxy_pass $upstream; |
|
133 | # proxy_pass $upstream; | |
125 | } |
|
134 | # } | |
126 |
|
135 | |||
127 | ## Custom 502 error page. |
|
136 | ## Custom 502 error page. | |
128 | ## Will be displayed while RhodeCode server is turned off |
|
137 | ## Will be displayed while RhodeCode server is turned off | |
129 | error_page 502 /502.html; |
|
138 | error_page 502 /502.html; | |
130 | location = /502.html { |
|
139 | location = /502.html { | |
131 | root /var/opt/rhodecode_data/static; |
|
140 | root /var/opt/rhodecode_data/static; | |
132 | internal; |
|
141 | internal; | |
133 | } |
|
142 | } | |
134 |
|
143 | |||
135 | } |
|
144 | } |
@@ -1,36 +1,36 b'' | |||||
1 | proxy_redirect off; |
|
1 | proxy_redirect off; | |
2 | proxy_set_header Host $http_host; |
|
2 | proxy_set_header Host $http_host; | |
3 |
|
3 | |||
4 | ## If you use HTTPS make sure you disable gzip compression |
|
4 | ## If you use HTTPS make sure you disable gzip compression | |
5 | ## to be safe against BREACH attack. |
|
5 | ## to be safe against BREACH attack. | |
6 | gzip off; |
|
6 | gzip off; | |
7 |
|
7 | |||
8 | # Don't buffer requests in NGINX stream them using chunked-encoding |
|
8 | # Don't buffer requests in NGINX stream them using chunked-encoding | |
9 | proxy_buffering off; |
|
9 | proxy_buffering off; | |
10 |
|
10 | |||
11 | ## This is also required for later GIT to use streaming. |
|
11 | ## This is also required for later GIT to use streaming. | |
12 | ## Works only for Nginx 1.7.11 and newer |
|
12 | ## Works only for Nginx 1.7.11 and newer | |
13 | proxy_request_buffering off; |
|
13 | proxy_request_buffering off; | |
14 | proxy_http_version 1.1; |
|
14 | proxy_http_version 1.1; | |
15 |
|
15 | |||
16 | ## Set this to a larger number if you experience timeouts |
|
16 | ## Set this to a larger number if you experience timeouts | |
17 | ## or 413 Request Entity Too Large, 10GB is enough for most cases |
|
17 | ## or 413 Request Entity Too Large, 10GB is enough for most cases | |
18 | client_max_body_size 10240m; |
|
18 | client_max_body_size 10240m; | |
19 |
|
19 | |||
20 | ## needed for container auth |
|
20 | ## needed for container auth | |
21 | # proxy_set_header REMOTE_USER $remote_user; |
|
21 | # proxy_set_header REMOTE_USER $remote_user; | |
22 | # proxy_set_header X-Forwarded-User $remote_user; |
|
22 | # proxy_set_header X-Forwarded-User $remote_user; | |
23 |
|
23 | |||
24 | proxy_set_header X-Url-Scheme $scheme; |
|
24 | proxy_set_header X-Url-Scheme $scheme; | |
25 | proxy_set_header X-Host $http_host; |
|
25 | proxy_set_header X-Host $http_host; | |
26 | proxy_set_header X-Real-IP $remote_addr; |
|
26 | proxy_set_header X-Real-IP $remote_addr; | |
27 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|
27 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
28 | proxy_set_header Proxy-host $proxy_host; |
|
28 | proxy_set_header Proxy-host $proxy_host; | |
29 |
|
29 | |||
30 |
proxy_connect_timeout |
|
30 | proxy_connect_timeout 21600; | |
31 |
proxy_send_timeout |
|
31 | proxy_send_timeout 21600; | |
32 |
proxy_read_timeout |
|
32 | proxy_read_timeout 21600; | |
33 | proxy_buffers 8 32k; |
|
33 | proxy_buffers 8 32k; | |
34 |
|
34 | |||
35 | add_header X-Frame-Options SAMEORIGIN; |
|
35 | add_header X-Frame-Options SAMEORIGIN; | |
36 | add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;"; |
|
36 | add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;"; |
@@ -1,42 +1,42 b'' | |||||
1 | ## Static configuration, needs traefik reload |
|
1 | ## Static configuration, needs traefik reload | |
2 |
|
2 | |||
3 | entryPoints: |
|
3 | entryPoints: | |
4 | http: |
|
4 | http: | |
5 | address: ":80" |
|
5 | address: ":80" | |
6 |
|
6 | |||
7 | https: |
|
7 | https: | |
8 | address: ":443" |
|
8 | address: ":443" | |
9 |
|
9 | |||
10 |
|
|
10 | ssh: | |
11 |
|
|
11 | address: ":${RC_SSH_PORT:?must-specify-ssh-port}" | |
12 |
|
12 | |||
13 | traefik: |
|
13 | traefik: | |
14 | address: ":7000" |
|
14 | address: ":7000" | |
15 |
|
15 | |||
16 | api: |
|
16 | api: | |
17 | dashboard: false |
|
17 | dashboard: false | |
18 | insecure: false # change to true to expose dashboard |
|
18 | insecure: false # change to true to expose dashboard | |
19 |
|
19 | |||
20 | accessLog: {} |
|
20 | accessLog: {} | |
21 |
|
21 | |||
22 | log: |
|
22 | log: | |
23 | # DEBUG / INFO |
|
23 | # DEBUG / INFO | |
24 | level: INFO |
|
24 | level: INFO | |
25 |
|
25 | |||
26 | metrics: |
|
26 | metrics: | |
27 | prometheus: {} |
|
27 | prometheus: {} | |
28 |
|
28 | |||
29 |
|
29 | |||
30 | providers: |
|
30 | providers: | |
31 | docker: |
|
31 | docker: | |
32 | exposedByDefault: false |
|
32 | exposedByDefault: false | |
33 | swarmMode: false |
|
33 | swarmMode: false | |
34 |
|
34 | |||
35 | file: |
|
35 | file: | |
36 | filename: "/etc/traefik/traefik_dynamic.yaml" |
|
36 | filename: "/etc/traefik/traefik_dynamic.yaml" | |
37 | watch: true |
|
37 | watch: true | |
38 |
|
38 | |||
39 |
|
39 | |||
40 | serversTransport: |
|
40 | serversTransport: | |
41 | #this disables SSL certificate verification for legacy own cert services like NextCloud etc |
|
41 | #this disables SSL certificate verification for legacy own cert services like NextCloud etc | |
42 | insecureSkipVerify: true |
|
42 | insecureSkipVerify: true |
@@ -1,312 +1,314 b'' | |||||
1 | version: '3.9' |
|
1 | version: '3.9' | |
2 |
|
2 | |||
3 | x-logging: &custom-logging |
|
3 | x-logging: &custom-logging | |
4 | # docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions |
|
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... |
|
5 | # NOTE: loki logging driver ONLY works for host type networks... | |
6 | driver: loki |
|
6 | driver: loki | |
7 | options: |
|
7 | options: | |
8 | loki-url: "http://127.0.0.1:3100/loki/api/v1/push" |
|
8 | loki-url: "http://127.0.0.1:3100/loki/api/v1/push" | |
9 | #loki-url: "http://loki:3100/loki/api/v1/push" |
|
9 | #loki-url: "http://loki:3100/loki/api/v1/push" | |
10 | loki-retries: "5" |
|
10 | loki-retries: "5" | |
11 | loki-timeout: "1s" |
|
11 | loki-timeout: "1s" | |
12 | loki-max-backoff: "800ms" |
|
12 | loki-max-backoff: "800ms" | |
13 |
|
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 |
|
14 | |||
22 | services: |
|
15 | services: | |
23 |
|
16 | |||
24 | rhodecode: |
|
17 | rhodecode: | |
25 | networks: |
|
18 | networks: | |
26 | - rhodecode_network |
|
19 | - rhodecode_network | |
27 | image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION:?specify-RC_VERSION-env-var} |
|
20 | image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION:?specify-RC_VERSION-env-var} | |
28 | env_file: |
|
21 | env_file: | |
29 | - .custom/.runtime.env |
|
22 | - .custom/.runtime.env | |
30 | stdin_open: true |
|
23 | stdin_open: true | |
31 | tty: true |
|
24 | tty: true | |
32 | restart: always |
|
25 | restart: always | |
33 | command: [ |
|
26 | command: [ | |
34 | "/usr/local/bin/rhodecode_bin/bin/gunicorn", |
|
27 | "/usr/local/bin/rhodecode_bin/bin/gunicorn", | |
35 | "--name=gunicorn-rhodecode-1", |
|
28 | "--name=gunicorn-rhodecode-1", | |
36 | "--error-logfile=-", |
|
29 | "--error-logfile=-", | |
37 | "--paster=/etc/rhodecode/conf/rhodecode.optimized.ini", |
|
30 | "--paster=/etc/rhodecode/conf/rhodecode.optimized.ini", | |
38 | "--config=/etc/rhodecode/conf/gunicorn_conf.py" |
|
31 | "--config=/etc/rhodecode/conf/gunicorn_conf_rc.py" | |
39 | ] |
|
32 | ] | |
|
33 | deploy: | |||
|
34 | # override this in .custom/docker-compose-apps.override.yaml to scale up | |||
|
35 | replicas: 1 | |||
40 |
|
36 | |||
41 | # ports: |
|
37 | # ports: | |
42 | # - "127.0.0.1::10020" |
|
38 | # - "127.0.0.1::10020" | |
43 |
|
39 | |||
44 | build: |
|
40 | build: | |
45 | context: . |
|
41 | context: . | |
46 | dockerfile: service/rhodecode/rhodecode.dockerfile |
|
42 | dockerfile: service/rhodecode/rhodecode.dockerfile | |
47 | args: |
|
43 | args: | |
48 | TZ: ${TZ} |
|
44 | TZ: ${TZ} | |
49 | RHODECODE_VERSION: ${RC_VERSION:?specify-RC_VERSION-env-var} |
|
45 | 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} |
|
46 | RHODECODE_DB: postgresql://rhodecode:${DB_PASSWORD:?must-specify-db-password}@database/${DB_NAME:?must-specify-db-name} | |
51 | RHODECODE_USER_NAME: ${RHODECODE_USER_NAME} |
|
47 | RHODECODE_USER_NAME: ${RHODECODE_USER_NAME} | |
52 | RHODECODE_USER_PASS: ${RHODECODE_USER_PASS} |
|
48 | RHODECODE_USER_PASS: ${RHODECODE_USER_PASS} | |
53 | RHODECODE_USER_EMAIL: ${RHODECODE_USER_EMAIL} |
|
49 | RHODECODE_USER_EMAIL: ${RHODECODE_USER_EMAIL} | |
54 |
|
50 | |||
55 | environment: |
|
51 | environment: | |
56 | RC_APP_TYPE: rhodecode_http |
|
52 | RC_APP_TYPE: rhodecode_http | |
57 | RC_APP_PROC: 1 |
|
53 | RC_APP_PROC: 1 | |
58 | SSL_CERT_FILE: "/etc/rhodecode/conf/ca-bundle.crt" |
|
54 | SSL_CERT_FILE: "/etc/rhodecode/conf/ca-bundle.crt" | |
59 | REQUESTS_CA_BUNDLE: "/etc/rhodecode/conf/ca-bundle.crt" |
|
55 | REQUESTS_CA_BUNDLE: "/etc/rhodecode/conf/ca-bundle.crt" | |
60 | GIT_SSL_CAINFO: "/etc/rhodecode/conf/ca-bundle.crt" |
|
56 | GIT_SSL_CAINFO: "/etc/rhodecode/conf/ca-bundle.crt" | |
61 | GEVENT_RESOLVER: "ares" |
|
57 | GEVENT_RESOLVER: "ares" | |
62 |
|
58 | |||
63 | DB_UPGRADE: 1 # run the DB upgrade |
|
59 | DB_UPGRADE: 1 # run the DB upgrade | |
64 | SETUP_APP: 1 # run the application default settings setup, can be turned off after initial run |
|
60 | 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 |
|
61 | #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 |
|
62 | #FORCE_RC_SETUP_APP: 1 # force running setup scripts for configuration/license application | |
67 | MAIN_INI_PATH: /etc/rhodecode/conf/rhodecode.optimized.ini |
|
63 | MAIN_INI_PATH: /etc/rhodecode/conf/rhodecode.optimized.ini | |
68 |
|
64 | |||
69 | # SVN Specific |
|
65 | # SVN Specific | |
70 | MOD_DAV_SVN_PORT: 8090 |
|
66 | MOD_DAV_SVN_PORT: 8090 | |
71 | APACHE_LOG_DIR: /var/log/rhodecode/svn |
|
67 | APACHE_LOG_DIR: /var/log/rhodecode/svn | |
72 | MOD_DAV_SVN_CONF_FILE: /etc/rhodecode/conf/svn/mod_dav_svn.conf |
|
68 | MOD_DAV_SVN_CONF_FILE: /etc/rhodecode/conf/svn/mod_dav_svn.conf | |
73 |
|
69 | |||
74 | healthcheck: |
|
70 | healthcheck: | |
75 | test: [ "CMD", "curl", "-A", "RhodeCode-Healthcheck", "-s", "-o", "/dev/null", "-w", "'%{http_code}'", "http://127.0.0.1:10020/_admin/ops/ping" ] |
|
71 | 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 |
|
72 | timeout: 30s | |
77 | interval: 60s |
|
73 | interval: 60s | |
78 | retries: 10 |
|
74 | retries: 10 | |
79 |
|
75 | |||
80 | # depends_on: |
|
76 | # depends_on: | |
81 | # - database |
|
77 | # - database | |
82 | # - redis |
|
78 | # - redis | |
83 | # - channelstream |
|
79 | # - channelstream | |
84 |
|
80 | |||
85 | volumes: |
|
81 | volumes: | |
86 | - confvolume:/etc/rhodecode/conf |
|
82 | - confvolume:/etc/rhodecode/conf | |
87 | - logvolume:/var/log/rhodecode |
|
83 | - logvolume:/var/log/rhodecode | |
88 |
- r |
|
84 | - rc_reposvolume:/var/opt/rhodecode_repo_store | |
89 | - rc_datavolume:/var/opt/rhodecode_data |
|
85 | - rc_datavolume:/var/opt/rhodecode_data | |
90 |
|
86 | |||
91 | tmpfs: |
|
87 | tmpfs: | |
92 | - /data_ramdisk:size=${RC_DATA_RAMDISK_SIZE:?specify-RC_DATA_RAMDISK_SIZE-env-var} |
|
88 | - /data_ramdisk:size=${RC_DATA_RAMDISK_SIZE:?specify-RC_DATA_RAMDISK_SIZE-env-var} | |
93 |
|
89 | |||
94 | logging: |
|
90 | logging: | |
95 | *custom-logging |
|
91 | *custom-logging | |
96 |
|
92 | |||
97 | labels: |
|
93 | labels: | |
98 |
- "traefik.enable= |
|
94 | - "traefik.enable=true" | |
|
95 | - "traefik.http.routers.rhodecode.entrypoints=http" | |||
|
96 | - "traefik.http.routers.rhodecode.rule=Host(`${RHODECODE_HOSTNAME:?must-specify-rhodecode-hostname}`)" | |||
|
97 | - "traefik.http.services.rhodecode.loadbalancer.server.port=10020" | |||
99 |
|
98 | |||
100 | vcsserver: |
|
99 | vcsserver: | |
101 | networks: |
|
100 | networks: | |
102 | - rhodecode_network |
|
101 | - rhodecode_network | |
103 | image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION:?specify-RC_VERSION-env-var} |
|
102 | image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION:?specify-RC_VERSION-env-var} | |
104 | env_file: |
|
103 | env_file: | |
105 | - .custom/.runtime.env |
|
104 | - .custom/.runtime.env | |
106 | stdin_open: true |
|
105 | stdin_open: true | |
107 | tty: true |
|
106 | tty: true | |
108 | restart: always |
|
107 | restart: always | |
109 | command: [ |
|
108 | command: [ | |
110 | "/home/rhodecode/.rccontrol/vcsserver-1/profile/bin/gunicorn", |
|
109 | "/home/rhodecode/.rccontrol/vcsserver-1/profile/bin/gunicorn", | |
111 | "--name=gunicorn-vcsserver-1", |
|
110 | "--name=gunicorn-vcsserver-1", | |
112 | "--error-logfile=-", |
|
111 | "--error-logfile=-", | |
113 | "--paster=/etc/rhodecode/conf/vcsserver.optimized.ini", |
|
112 | "--paster=/etc/rhodecode/conf/vcsserver.optimized.ini", | |
114 | "--config=/etc/rhodecode/conf/gunicorn_conf_vcs.py" |
|
113 | "--config=/etc/rhodecode/conf/gunicorn_conf_vcs.py" | |
115 | ] |
|
114 | ] | |
|
115 | deploy: | |||
|
116 | # override this in .custom/docker-compose-apps.override.yaml to scale up | |||
|
117 | replicas: 1 | |||
116 |
|
118 | |||
117 | # ports: |
|
119 | # ports: | |
118 | # - "127.0.0.1::10010" |
|
120 | # - "127.0.0.1::10010" | |
119 |
|
121 | |||
120 | healthcheck: |
|
122 | healthcheck: | |
121 | test: [ "CMD", "curl", "-A", "RhodeCode-Healthcheck", "-s", "-o", "/dev/null", "-w", "'%{http_code}'", "http://127.0.0.1:10010/status" ] |
|
123 | test: [ "CMD", "curl", "-A", "RhodeCode-Healthcheck", "-s", "-o", "/dev/null", "-w", "'%{http_code}'", "http://127.0.0.1:10010/status" ] | |
122 | timeout: 30s |
|
124 | timeout: 30s | |
123 | interval: 60s |
|
125 | interval: 60s | |
124 | retries: 10 |
|
126 | retries: 10 | |
125 |
|
127 | |||
126 | environment: |
|
128 | environment: | |
127 | RC_APP_TYPE: rhodecode_vcsserver |
|
129 | RC_APP_TYPE: rhodecode_vcsserver | |
128 | RC_APP_PROC: 1 |
|
130 | RC_APP_PROC: 1 | |
129 | MAIN_INI_PATH: /etc/rhodecode/conf/vcsserver.optimized.ini |
|
131 | MAIN_INI_PATH: /etc/rhodecode/conf/vcsserver.optimized.ini | |
130 | SSL_CERT_FILE: "/etc/rhodecode/conf/ca-bundle.crt" |
|
132 | SSL_CERT_FILE: "/etc/rhodecode/conf/ca-bundle.crt" | |
131 | REQUESTS_CA_BUNDLE: "/etc/rhodecode/conf/ca-bundle.crt" |
|
133 | REQUESTS_CA_BUNDLE: "/etc/rhodecode/conf/ca-bundle.crt" | |
132 | GIT_SSL_CAINFO: "/etc/rhodecode/conf/ca-bundle.crt" |
|
134 | GIT_SSL_CAINFO: "/etc/rhodecode/conf/ca-bundle.crt" | |
133 |
|
135 | |||
134 | # depends_on: |
|
136 | # depends_on: | |
135 | # - redis |
|
137 | # - redis | |
136 |
|
138 | |||
137 | volumes: |
|
139 | volumes: | |
138 | - confvolume:/etc/rhodecode/conf |
|
140 | - confvolume:/etc/rhodecode/conf | |
139 | - logvolume:/var/log/rhodecode |
|
141 | - logvolume:/var/log/rhodecode | |
140 |
- r |
|
142 | - rc_reposvolume:/var/opt/rhodecode_repo_store | |
141 | - rc_datavolume:/var/opt/rhodecode_data |
|
143 | - rc_datavolume:/var/opt/rhodecode_data | |
142 |
|
144 | |||
143 | logging: |
|
145 | logging: | |
144 | *custom-logging |
|
146 | *custom-logging | |
145 |
|
147 | |||
146 | celery: |
|
148 | celery: | |
147 | networks: |
|
149 | networks: | |
148 | - rhodecode_network |
|
150 | - rhodecode_network | |
149 | image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION:?specify-RC_VERSION-env-var} |
|
151 | image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION:?specify-RC_VERSION-env-var} | |
150 | env_file: |
|
152 | env_file: | |
151 | - .custom/.runtime.env |
|
153 | - .custom/.runtime.env | |
152 | stdin_open: true |
|
154 | stdin_open: true | |
153 | tty: true |
|
155 | tty: true | |
154 | restart: always |
|
156 | restart: always | |
155 | command: [ |
|
157 | command: [ | |
156 | "/usr/local/bin/rhodecode_bin/bin/celery", |
|
158 | "/usr/local/bin/rhodecode_bin/bin/celery", | |
157 | "worker", |
|
159 | "worker", | |
158 | "--task-events", |
|
160 | "--task-events", | |
159 | "--autoscale=10,2", |
|
161 | "--autoscale=10,2", | |
160 | "--no-color", |
|
162 | "--no-color", | |
161 | "--app=rhodecode.lib.celerylib.loader", |
|
163 | "--app=rhodecode.lib.celerylib.loader", | |
162 | "--loglevel=DEBUG", |
|
164 | "--loglevel=DEBUG", | |
163 | "--ini=/etc/rhodecode/conf/rhodecode.optimized.ini" |
|
165 | "--ini=/etc/rhodecode/conf/rhodecode.optimized.ini" | |
164 | ] |
|
166 | ] | |
165 |
|
167 | |||
166 | environment: |
|
168 | environment: | |
167 | RC_APP_TYPE: rhodecode_celery |
|
169 | RC_APP_TYPE: rhodecode_celery | |
168 | RC_APP_PROC: 1 |
|
170 | RC_APP_PROC: 1 | |
169 | MAIN_INI_PATH: /etc/rhodecode/conf/rhodecode.optimized.ini |
|
171 | MAIN_INI_PATH: /etc/rhodecode/conf/rhodecode.optimized.ini | |
170 | SSL_CERT_FILE: "/etc/rhodecode/conf/ca-bundle.crt" |
|
172 | SSL_CERT_FILE: "/etc/rhodecode/conf/ca-bundle.crt" | |
171 | REQUESTS_CA_BUNDLE: "/etc/rhodecode/conf/ca-bundle.crt" |
|
173 | REQUESTS_CA_BUNDLE: "/etc/rhodecode/conf/ca-bundle.crt" | |
172 | GIT_SSL_CAINFO: "/etc/rhodecode/conf/ca-bundle.crt" |
|
174 | GIT_SSL_CAINFO: "/etc/rhodecode/conf/ca-bundle.crt" | |
173 |
|
175 | |||
174 | # depends_on: |
|
176 | # depends_on: | |
175 | # - database |
|
177 | # - database | |
176 | # - redis |
|
178 | # - redis | |
177 |
|
179 | |||
178 | volumes: |
|
180 | volumes: | |
179 | - confvolume:/etc/rhodecode/conf |
|
181 | - confvolume:/etc/rhodecode/conf | |
180 | - logvolume:/var/log/rhodecode |
|
182 | - logvolume:/var/log/rhodecode | |
181 |
- r |
|
183 | - rc_reposvolume:/var/opt/rhodecode_repo_store | |
182 | - rc_datavolume:/var/opt/rhodecode_data |
|
184 | - rc_datavolume:/var/opt/rhodecode_data | |
183 |
|
185 | |||
184 | logging: |
|
186 | logging: | |
185 | *custom-logging |
|
187 | *custom-logging | |
186 |
|
188 | |||
187 | labels: |
|
189 | labels: | |
188 | - "traefik.enable=false" |
|
190 | - "traefik.enable=false" | |
189 |
|
191 | |||
190 | celery-beat: |
|
192 | celery-beat: | |
191 | # This service is not scalable |
|
193 | # This service is not scalable | |
192 | networks: |
|
194 | networks: | |
193 | - rhodecode_network |
|
195 | - rhodecode_network | |
194 | image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION:?specify-RC_VERSION-env-var} |
|
196 | image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION:?specify-RC_VERSION-env-var} | |
195 | env_file: |
|
197 | env_file: | |
196 | - .custom/.runtime.env |
|
198 | - .custom/.runtime.env | |
197 | stdin_open: true |
|
199 | stdin_open: true | |
198 | tty: true |
|
200 | tty: true | |
199 | restart: always |
|
201 | restart: always | |
200 | command: [ |
|
202 | command: [ | |
201 | "/usr/local/bin/rhodecode_bin/bin/celery", |
|
203 | "/usr/local/bin/rhodecode_bin/bin/celery", | |
202 | "beat", |
|
204 | "beat", | |
203 | "--no-color", |
|
205 | "--no-color", | |
204 | "--app=rhodecode.lib.celerylib.loader", |
|
206 | "--app=rhodecode.lib.celerylib.loader", | |
205 | "--scheduler=rhodecode.lib.celerylib.scheduler.RcScheduler", |
|
207 | "--scheduler=rhodecode.lib.celerylib.scheduler.RcScheduler", | |
206 | "--loglevel=DEBUG", |
|
208 | "--loglevel=DEBUG", | |
207 | "--ini=/etc/rhodecode/conf/rhodecode.optimized.ini" |
|
209 | "--ini=/etc/rhodecode/conf/rhodecode.optimized.ini" | |
208 | ] |
|
210 | ] | |
209 |
|
211 | |||
210 | environment: |
|
212 | environment: | |
211 | RC_APP_TYPE: rhodecode_beat |
|
213 | RC_APP_TYPE: rhodecode_beat | |
212 | RC_APP_PROC: 1 |
|
214 | RC_APP_PROC: 1 | |
213 | MAIN_INI_PATH: /etc/rhodecode/conf/rhodecode.optimized.ini |
|
215 | MAIN_INI_PATH: /etc/rhodecode/conf/rhodecode.optimized.ini | |
214 | SSL_CERT_FILE: "/etc/rhodecode/conf/ca-bundle.crt" |
|
216 | SSL_CERT_FILE: "/etc/rhodecode/conf/ca-bundle.crt" | |
215 | REQUESTS_CA_BUNDLE: "/etc/rhodecode/conf/ca-bundle.crt" |
|
217 | REQUESTS_CA_BUNDLE: "/etc/rhodecode/conf/ca-bundle.crt" | |
216 | GIT_SSL_CAINFO: "/etc/rhodecode/conf/ca-bundle.crt" |
|
218 | GIT_SSL_CAINFO: "/etc/rhodecode/conf/ca-bundle.crt" | |
217 |
|
219 | |||
218 | # depends_on: |
|
220 | # depends_on: | |
219 | # - database |
|
221 | # - database | |
220 | # - redis |
|
222 | # - redis | |
221 |
|
223 | |||
222 | volumes: |
|
224 | volumes: | |
223 | - confvolume:/etc/rhodecode/conf |
|
225 | - confvolume:/etc/rhodecode/conf | |
224 | - logvolume:/var/log/rhodecode |
|
226 | - logvolume:/var/log/rhodecode | |
225 |
- r |
|
227 | - rc_reposvolume:/var/opt/rhodecode_repo_store | |
226 | - rc_datavolume:/var/opt/rhodecode_data |
|
228 | - rc_datavolume:/var/opt/rhodecode_data | |
227 |
|
229 | |||
228 | logging: |
|
230 | logging: | |
229 | *custom-logging |
|
231 | *custom-logging | |
230 |
|
232 | |||
231 | labels: |
|
233 | labels: | |
232 | - "traefik.enable=false" |
|
234 | - "traefik.enable=false" | |
233 |
|
235 | |||
234 | svn: |
|
236 | svn: | |
235 | networks: |
|
237 | networks: | |
236 | - rhodecode_network |
|
238 | - rhodecode_network | |
237 | image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION:?specify-RC_VERSION-env-var} |
|
239 | image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION:?specify-RC_VERSION-env-var} | |
238 | env_file: |
|
240 | env_file: | |
239 | - .custom/.runtime.env |
|
241 | - .custom/.runtime.env | |
240 |
|
242 | |||
241 | # build: |
|
243 | # build: | |
242 | # context: . |
|
244 | # context: . | |
243 | # dockerfile: service/svn/rhodecode_svn.dockerfile |
|
245 | # dockerfile: service/svn/rhodecode_svn.dockerfile | |
244 | # args: |
|
246 | # args: | |
245 | # APACHE_VER: 1.3 |
|
247 | # APACHE_VER: 1.3 | |
246 |
|
248 | |||
247 | stdin_open: true |
|
249 | stdin_open: true | |
248 | tty: true |
|
250 | tty: true | |
249 | restart: always |
|
251 | restart: always | |
250 | command: ["apachectl", "-D", "FOREGROUND"] |
|
252 | command: ["apachectl", "-D", "FOREGROUND"] | |
251 |
|
253 | |||
252 | environment: |
|
254 | environment: | |
253 | RC_APP_TYPE: rhodecode_svn |
|
255 | RC_APP_TYPE: rhodecode_svn | |
254 |
|
256 | |||
255 | # SVN Specific |
|
257 | # SVN Specific | |
256 | MOD_DAV_SVN_PORT: 8090 |
|
258 | MOD_DAV_SVN_PORT: 8090 | |
257 | APACHE_LOG_DIR: /var/log/rhodecode/svn |
|
259 | APACHE_LOG_DIR: /var/log/rhodecode/svn | |
258 | MOD_DAV_SVN_CONF_FILE: /etc/rhodecode/conf/svn/mod_dav_svn.conf |
|
260 | MOD_DAV_SVN_CONF_FILE: /etc/rhodecode/conf/svn/mod_dav_svn.conf | |
259 |
|
261 | |||
260 | # ports: |
|
262 | # ports: | |
261 | # - "127.0.0.1::8090" |
|
263 | # - "127.0.0.1::8090" | |
262 |
|
264 | |||
263 | healthcheck: |
|
265 | healthcheck: | |
264 | test: [ "CMD", "curl", "-A", "RhodeCode-Healthcheck", "-s", "-o", "/dev/null", "-w", "'%{http_code}'", "http://127.0.0.1:8090/_server_status" ] |
|
266 | test: [ "CMD", "curl", "-A", "RhodeCode-Healthcheck", "-s", "-o", "/dev/null", "-w", "'%{http_code}'", "http://127.0.0.1:8090/_server_status" ] | |
265 | timeout: 30s |
|
267 | timeout: 30s | |
266 | interval: 60s |
|
268 | interval: 60s | |
267 | retries: 10 |
|
269 | retries: 10 | |
268 |
|
270 | |||
269 | volumes: |
|
271 | volumes: | |
270 | - confvolume:/etc/rhodecode/conf |
|
272 | - confvolume:/etc/rhodecode/conf | |
271 | - logvolume:/var/log/rhodecode |
|
273 | - logvolume:/var/log/rhodecode | |
272 |
- r |
|
274 | - rc_reposvolume:/var/opt/rhodecode_repo_store | |
273 |
|
275 | |||
274 | logging: |
|
276 | logging: | |
275 | *custom-logging |
|
277 | *custom-logging | |
276 |
|
278 | |||
277 | sshd: |
|
279 | sshd: | |
278 | networks: |
|
280 | networks: | |
279 | - rhodecode_network |
|
281 | - rhodecode_network | |
280 | image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION:?specify-RC_VERSION-env-var} |
|
282 | image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION:?specify-RC_VERSION-env-var} | |
281 | env_file: |
|
283 | env_file: | |
282 | - .custom/.runtime.env |
|
284 | - .custom/.runtime.env | |
283 |
|
285 | |||
284 | stdin_open: true |
|
286 | stdin_open: true | |
285 | tty: true |
|
287 | tty: true | |
286 | restart: always |
|
288 | restart: always | |
287 | command: ["/usr/sbin/sshd", "-f", "/etc/rhodecode/sshd_config", "-D", "-e"] |
|
289 | command: ["/usr/sbin/sshd", "-f", "/etc/rhodecode/sshd_config", "-D", "-e"] | |
288 |
|
290 | |||
289 | environment: |
|
291 | environment: | |
290 | RC_APP_TYPE: rhodecode_sshd |
|
292 | RC_APP_TYPE: rhodecode_sshd | |
291 | SSH_BOOTSTRAP: 1 |
|
293 | SSH_BOOTSTRAP: 1 | |
292 |
|
294 | |||
293 | # ports: |
|
295 | # ports: | |
294 | # # set from .env file |
|
296 | # # set from .env file | |
295 | # - "${RC_SSH_PORT:?must-specify-ssh-port}:22" |
|
297 | # - "${RC_SSH_PORT:?must-specify-ssh-port}:22" | |
296 |
|
298 | |||
297 | volumes: |
|
299 | volumes: | |
298 | - confvolume:/etc/rhodecode/conf |
|
300 | - confvolume:/etc/rhodecode/conf | |
299 | - logvolume:/var/log/rhodecode |
|
301 | - logvolume:/var/log/rhodecode | |
300 |
- r |
|
302 | - rc_reposvolume:/var/opt/rhodecode_repo_store | |
301 | - rc_datavolume:/var/opt/rhodecode_data |
|
303 | - rc_datavolume:/var/opt/rhodecode_data | |
302 |
|
304 | |||
303 | logging: |
|
305 | logging: | |
304 | *custom-logging |
|
306 | *custom-logging | |
305 |
|
307 | |||
306 | labels: |
|
308 | labels: | |
307 | - "traefik.enable=true" |
|
309 | - "traefik.enable=true" | |
308 | - "traefik.http.routers.sshd.entrypoints=ssh" |
|
310 | - "traefik.http.routers.sshd.entrypoints=ssh" | |
309 | - "traefik.http.routers.sshd.rule=Host(`*`)" |
|
311 | - "traefik.http.routers.sshd.rule=Host(`*`)" | |
310 | - "traefik.http.services.sshd.loadbalancer.server.port=${RC_SSH_PORT:?must-specify-ssh-port}" |
|
312 | - "traefik.http.services.sshd.loadbalancer.server.port=${RC_SSH_PORT:?must-specify-ssh-port}" | |
311 |
|
313 | |||
312 |
|
314 |
@@ -1,46 +1,51 b'' | |||||
1 | version: '3.9' |
|
1 | version: '3.9' | |
2 |
|
2 | |||
3 | ## Shared base stuff for all compose files in stack |
|
3 | ## Shared base stuff for all compose files in stack | |
4 |
|
4 | |||
5 | x-logging: &custom-logging |
|
5 | x-logging: &custom-logging | |
6 | # docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions |
|
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... |
|
7 | # NOTE: loki logging driver ONLY works for host type networks... | |
8 | driver: loki |
|
8 | driver: loki | |
9 | options: |
|
9 | options: | |
10 | loki-url: "http://127.0.0.1:3100/loki/api/v1/push" |
|
10 | loki-url: "http://127.0.0.1:3100/loki/api/v1/push" | |
11 | #loki-url: "http://loki:3100/loki/api/v1/push" |
|
11 | #loki-url: "http://loki:3100/loki/api/v1/push" | |
12 | loki-retries: "5" |
|
12 | loki-retries: "5" | |
13 | loki-timeout: "1s" |
|
13 | loki-timeout: "1s" | |
14 | loki-max-backoff: "800ms" |
|
14 | loki-max-backoff: "800ms" | |
15 |
|
15 | |||
16 | volumes: |
|
16 | volumes: | |
17 | # shared logvolume |
|
17 | # shared logvolume | |
18 | logvolume: |
|
18 | logvolume: | |
19 | driver: local |
|
19 | driver: local | |
20 | driver_opts: |
|
20 | driver_opts: | |
21 | type: none |
|
21 | type: none | |
22 | o: bind |
|
22 | o: bind | |
23 | device: $PWD/logs |
|
23 | device: $PWD/logs | |
24 |
|
24 | |||
25 | # bind-mount with configs |
|
25 | # bind-mount with configs | |
26 | confvolume: |
|
26 | confvolume: | |
27 | driver: local |
|
27 | driver: local | |
28 | driver_opts: |
|
28 | driver_opts: | |
29 | type: none |
|
29 | type: none | |
30 | o: bind |
|
30 | o: bind | |
31 | device: $PWD/config/_shared |
|
31 | device: $PWD/config/_shared | |
32 |
|
32 | |||
33 | # SHARED volume for rhodecode caches, archive caches, nginx static, |
|
33 | # SHARED volume for rhodecode caches, archive caches, nginx static, | |
34 | # must be run via: docker volume create --name=rc_datavolume |
|
34 | # must be run via: docker volume create --name=rc_datavolume | |
35 | rc_datavolume: |
|
35 | rc_datavolume: | |
36 | external: true |
|
36 | external: true | |
37 |
|
37 | |||
|
38 | # volume for RhodeCode repo-store, it's where the repositories will be stored | |||
|
39 | # must be run via: docker volume create --name=rc_reposvolume | |||
|
40 | rc_reposvolume: | |||
|
41 | external: true | |||
|
42 | ||||
38 | networks: |
|
43 | networks: | |
39 |
|
44 | |||
40 | # SHARED network for all containers |
|
45 | # SHARED network for all containers | |
41 | # must be run via: docker network create --name=rhodecode_network |
|
46 | # must be run via: docker network create --name=rhodecode_network | |
42 | rhodecode_network: |
|
47 | rhodecode_network: | |
43 | name: rhodecode_network |
|
48 | name: rhodecode_network | |
44 | driver: bridge |
|
49 | driver: bridge | |
45 | external: true |
|
50 | external: true | |
46 |
|
51 |
@@ -1,128 +1,124 b'' | |||||
1 | version: '3.9' |
|
1 | version: '3.9' | |
2 |
|
2 | |||
3 | volumes: |
|
3 | volumes: | |
4 |
|
4 | |||
5 | prometheus_data: |
|
5 | prometheus_data: | |
6 | labels: |
|
6 | labels: | |
7 | "keep": 1 |
|
7 | "keep": 1 | |
8 |
|
8 | |||
9 | grafana_data: |
|
9 | grafana_data: | |
10 | labels: |
|
10 | labels: | |
11 | "keep": 1 |
|
11 | "keep": 1 | |
12 |
|
12 | |||
13 | services: |
|
13 | services: | |
14 |
|
14 | |||
15 | statsd-exporter: |
|
15 | statsd-exporter: | |
16 | image: prom/statsd-exporter:v0.22.8 |
|
16 | image: prom/statsd-exporter:v0.22.8 | |
17 | restart: always |
|
17 | restart: always | |
18 | command: [ |
|
18 | command: [ | |
19 | '--statsd.mapping-config=/etc/statsd/statsd.yaml', |
|
19 | '--statsd.mapping-config=/etc/statsd/statsd.yaml', | |
20 | '--statsd.listen-udp=:9125', |
|
20 | '--statsd.listen-udp=:9125', | |
21 | '--web.listen-address=:9102' |
|
21 | '--web.listen-address=:9102' | |
22 | ] |
|
22 | ] | |
23 | networks: |
|
23 | networks: | |
24 | - rhodecode_network |
|
24 | - rhodecode_network | |
25 | # ports: |
|
25 | # ports: | |
26 | # - "9125:9125/udp" |
|
26 | # - "9125:9125/udp" | |
27 | # - "9102:9102" |
|
27 | # - "9102:9102" | |
28 |
|
28 | |||
29 | volumes: |
|
29 | volumes: | |
30 | - ./config/statsd-exporter:/etc/statsd |
|
30 | - ./config/statsd-exporter:/etc/statsd | |
31 | labels: |
|
31 | labels: | |
32 | - "traefik.enable=false" |
|
32 | - "traefik.enable=false" | |
33 | - "traefik.http.services.statsd-exporter.loadbalancer.server.port=9125" |
|
33 | - "traefik.http.services.statsd-exporter.loadbalancer.server.port=9125" | |
34 | - "traefik.http.services.statsd-exporter.loadbalancer.server.port=9102" |
|
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 | |
38 | command: |
|
38 | command: | |
39 | - "--path.procfs=/host/proc" |
|
39 | - "--path.procfs=/host/proc" | |
40 | - "--path.rootfs=/rootfs" |
|
40 | - "--path.rootfs=/rootfs" | |
41 | - "--path.sysfs=/host/sys" |
|
41 | - "--path.sysfs=/host/sys" | |
42 | - "--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)" |
|
42 | - "--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)" | |
43 | - "--collector.systemd" |
|
43 | - "--collector.systemd" | |
44 | - "--collector.processes" |
|
44 | - "--collector.processes" | |
45 | networks: |
|
45 | networks: | |
46 | - rhodecode_network |
|
46 | - rhodecode_network | |
47 | pid: host |
|
47 | pid: host | |
48 | restart: always |
|
48 | restart: always | |
49 | # ports: |
|
49 | # ports: | |
50 | # - "9100:9100" |
|
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: |
|
55 | labels: | |
56 | - "traefik.enable=false" |
|
56 | - "traefik.enable=false" | |
57 | - "traefik.http.services.node-exporter.loadbalancer.server.port=9100" |
|
57 | - "traefik.http.services.node-exporter.loadbalancer.server.port=9100" | |
58 |
|
58 | |||
59 | prometheus: |
|
59 | prometheus: | |
60 | image: prom/prometheus:v2.40.2 |
|
60 | image: prom/prometheus:v2.40.2 | |
61 | restart: always |
|
61 | restart: always | |
62 | command: |
|
62 | command: | |
63 | - "--config.file=/etc/prometheus/prometheus.yml" |
|
63 | - "--config.file=/etc/prometheus/prometheus.yml" | |
64 | - "--storage.tsdb.path=/prometheus" |
|
64 | - "--storage.tsdb.path=/prometheus" | |
65 | - "--web.console.libraries=/etc/prometheus/console_libraries" |
|
65 | - "--web.console.libraries=/etc/prometheus/console_libraries" | |
66 | - "--web.console.templates=/etc/prometheus/consoles" |
|
66 | - "--web.console.templates=/etc/prometheus/consoles" | |
67 | - "--storage.tsdb.retention.time=24h" |
|
67 | - "--storage.tsdb.retention.time=24h" | |
68 | - "--web.enable-lifecycle" |
|
68 | - "--web.enable-lifecycle" | |
69 | # ports: |
|
69 | # ports: | |
70 | # - "9090:9090" |
|
70 | # - "9090:9090" | |
71 | networks: |
|
71 | networks: | |
72 | - rhodecode_network |
|
72 | - rhodecode_network | |
73 | volumes: |
|
73 | volumes: | |
74 | - ./config/prometheus:/etc/prometheus |
|
74 | - ./config/prometheus:/etc/prometheus | |
75 | - prometheus_data:/prometheus |
|
75 | - prometheus_data:/prometheus | |
76 | labels: |
|
76 | labels: | |
77 | - "traefik.enable=false" |
|
77 | - "traefik.enable=false" | |
78 | - "traefik.http.services.prometheus.loadbalancer.server.port=9090" |
|
78 | - "traefik.http.services.prometheus.loadbalancer.server.port=9090" | |
79 |
|
79 | |||
80 | grafana: |
|
80 | grafana: | |
81 | image: grafana/grafana:9.2.5 |
|
81 | image: grafana/grafana:9.2.5 | |
82 | restart: always |
|
82 | restart: always | |
83 | # ports: |
|
83 | # ports: | |
84 | # - "3000:3000" |
|
84 | # - "3000:3000" | |
85 | volumes: |
|
85 | volumes: | |
86 | - grafana_data:/var/lib/grafana |
|
86 | - grafana_data:/var/lib/grafana | |
87 | - ./config/grafana:/etc/grafana |
|
87 | - ./config/grafana:/etc/grafana | |
88 | networks: |
|
88 | networks: | |
89 | - rhodecode_network |
|
89 | - rhodecode_network | |
90 | labels: |
|
90 | labels: | |
91 | - "traefik.enable=true" |
|
91 | - "traefik.enable=true" | |
92 | - "traefik.http.routers.grafana.entrypoints=http" |
|
92 | - "traefik.http.routers.grafana.entrypoints=http" | |
93 | - "traefik.http.routers.grafana.rule=PathPrefix(`/_grafana`)" |
|
93 | - "traefik.http.routers.grafana.rule=PathPrefix(`/_grafana`)" | |
94 | - "traefik.http.routers.grafana.service=grafana-http" |
|
94 | - "traefik.http.routers.grafana.service=grafana-http" | |
95 | - "traefik.http.services.grafana-http.loadbalancer.server.port=3000" |
|
95 | - "traefik.http.services.grafana-http.loadbalancer.server.port=3000" | |
96 |
|
96 | |||
97 | loki: |
|
97 | loki: | |
98 | image: grafana/loki:2.7.0 |
|
98 | image: grafana/loki:2.7.0 | |
99 | restart: always |
|
99 | restart: always | |
100 | # ports: |
|
100 | # ports: | |
101 | # - "3100:3100" |
|
101 | # - "3100:3100" | |
102 | # - "9095:9095" |
|
102 | # - "9095:9095" | |
103 | command: [ |
|
103 | command: [ | |
104 | "-config.file=/etc/loki/loki-config.yaml" |
|
104 | "-config.file=/etc/loki/loki-config.yaml" | |
105 | ] |
|
105 | ] | |
106 | networks: |
|
106 | networks: | |
107 | - rhodecode_network |
|
107 | - rhodecode_network | |
108 | volumes: |
|
108 | volumes: | |
109 | - ./config/loki:/etc/loki |
|
109 | - ./config/loki:/etc/loki | |
110 |
|
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 |
|
111 | |||
116 | promtail: |
|
112 | promtail: | |
117 | image: grafana/promtail:latest |
|
113 | image: grafana/promtail:latest | |
118 | command: [ |
|
114 | command: [ | |
119 | "-config.file=/etc/promtail/promtail-config.yaml" |
|
115 | "-config.file=/etc/promtail/promtail-config.yaml" | |
120 | ] |
|
116 | ] | |
121 | networks: |
|
117 | networks: | |
122 | - rhodecode_network |
|
118 | - rhodecode_network | |
123 | volumes: |
|
119 | volumes: | |
124 | - /var/log:/var/log |
|
120 | - /var/log:/var/log | |
125 | - logvolume:/var/log_volume |
|
121 | - logvolume:/var/log_volume | |
126 | - ./config/promtail:/etc/promtail |
|
122 | - ./config/promtail:/etc/promtail | |
127 | labels: |
|
123 | labels: | |
128 | - "traefik.enable=false" |
|
124 | - "traefik.enable=false" |
@@ -1,78 +1,47 b'' | |||||
1 | version: '3.9' |
|
1 | version: '3.9' | |
2 |
|
2 | |||
3 | x-logging: &custom-logging |
|
3 | x-logging: &custom-logging | |
4 | # docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions |
|
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... |
|
5 | # NOTE: loki logging driver ONLY works for host type networks... | |
6 | driver: loki |
|
6 | driver: loki | |
7 | options: |
|
7 | options: | |
8 | loki-url: "http://127.0.0.1:3100/loki/api/v1/push" |
|
8 | loki-url: "http://127.0.0.1:3100/loki/api/v1/push" | |
9 | #loki-url: "http://loki:3100/loki/api/v1/push" |
|
9 | #loki-url: "http://loki:3100/loki/api/v1/push" | |
10 | loki-retries: "5" |
|
10 | loki-retries: "5" | |
11 | loki-timeout: "1s" |
|
11 | loki-timeout: "1s" | |
12 | loki-max-backoff: "800ms" |
|
12 | loki-max-backoff: "800ms" | |
13 |
|
13 | |||
14 | ## docker network create -d overlay lb-net |
|
14 | ## docker network create -d overlay lb-net | |
15 | services: |
|
15 | services: | |
16 |
|
16 | |||
17 | traefik: |
|
17 | traefik: | |
18 |
|
18 | |||
19 | image: traefik:v2.9.5 |
|
19 | image: traefik:v2.9.5 | |
20 |
|
20 | |||
21 | ports: |
|
21 | ports: | |
22 | # The HTTP port, exposed as http entrypoint |
|
22 | # The HTTP port, exposed as http entrypoint | |
23 | - "80:80" |
|
23 | - "80:80" | |
24 | # The HTTPS port, exposed as https entrypoint |
|
24 | # The HTTPS port, exposed as https entrypoint | |
25 | - "443:443" |
|
25 | - "443:443" | |
26 | # The SSH port |
|
26 | # The SSH port | |
27 | - "${RC_SSH_PORT}:${RC_SSH_PORT}" |
|
27 | - "${RC_SSH_PORT}:${RC_SSH_PORT}" | |
28 | # The Web UI (enabled by --api.insecure=true) |
|
28 | # The Web UI (enabled by --api.insecure=true) | |
29 | # uncomment to expose dashboard at port :7000 |
|
29 | # uncomment to expose dashboard at port :7000 | |
30 | #- "7000:7000" |
|
30 | #- "7000:7000" | |
31 | volumes: |
|
31 | volumes: | |
32 | # So that Traefik can listen to the Docker events |
|
32 | # So that Traefik can listen to the Docker events | |
33 | - /var/run/docker.sock:/var/run/docker.sock |
|
33 | - /var/run/docker.sock:/var/run/docker.sock | |
34 | - ./config/traefik:/etc/traefik |
|
34 | - ./config/traefik:/etc/traefik | |
35 | deploy: |
|
35 | deploy: | |
36 | placement: |
|
36 | placement: | |
37 | constraints: |
|
37 | constraints: | |
38 | # limit swarm deploy to MANAGER only |
|
38 | # limit swarm deploy to MANAGER only | |
39 | - node.role == manager |
|
39 | - node.role == manager | |
40 | networks: |
|
40 | networks: | |
41 | - rhodecode_network |
|
41 | - rhodecode_network | |
42 |
|
42 | |||
43 | labels: |
|
43 | labels: | |
44 | - "traefik.enable=true" |
|
44 | - "traefik.enable=true" | |
45 |
|
45 | |||
46 | logging: |
|
46 | logging: | |
47 | *custom-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 |
|
@@ -1,240 +1,240 b'' | |||||
1 | version: '3.9' |
|
1 | version: '3.9' | |
2 |
|
2 | |||
3 | x-logging: &custom-logging |
|
3 | x-logging: &custom-logging | |
4 | # docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions |
|
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... |
|
5 | # NOTE: loki logging driver ONLY works for host type networks... | |
6 | driver: loki |
|
6 | driver: loki | |
7 | options: |
|
7 | options: | |
8 | loki-url: "http://127.0.0.1:3100/loki/api/v1/push" |
|
8 | loki-url: "http://127.0.0.1:3100/loki/api/v1/push" | |
9 | #loki-url: "http://loki:3100/loki/api/v1/push" |
|
9 | #loki-url: "http://loki:3100/loki/api/v1/push" | |
10 | loki-retries: "5" |
|
10 | loki-retries: "5" | |
11 | loki-timeout: "1s" |
|
11 | loki-timeout: "1s" | |
12 | loki-max-backoff: "800ms" |
|
12 | loki-max-backoff: "800ms" | |
13 |
|
13 | |||
14 | volumes: |
|
14 | volumes: | |
15 |
|
15 | |||
16 | # volume for redis data store |
|
16 | # volume for redis data store | |
17 | redis_data: |
|
17 | redis_data: | |
18 | labels: |
|
18 | labels: | |
19 | "keep": 1 |
|
19 | "keep": 1 | |
20 |
|
20 | |||
21 | # volume for Postgres db store |
|
21 | # volume for Postgres db store | |
22 |
|
22 | |||
23 | # volume for Postgres Data |
|
23 | # volume for Postgres Data | |
24 | pg_data: |
|
24 | pg_data: | |
25 | labels: |
|
25 | labels: | |
26 | "keep": 1 |
|
26 | "keep": 1 | |
27 |
|
27 | |||
28 | # volume for rhodecode elasticsearch |
|
28 | # volume for rhodecode elasticsearch | |
29 | es_data: |
|
29 | es_data: | |
30 | labels: |
|
30 | labels: | |
31 | "keep": 1 |
|
31 | "keep": 1 | |
32 |
|
32 | |||
33 |
|
33 | |||
34 | services: |
|
34 | services: | |
35 |
|
35 | |||
36 | channelstream: |
|
36 | channelstream: | |
37 | networks: |
|
37 | networks: | |
38 | - rhodecode_network |
|
38 | - rhodecode_network | |
39 | image: channelstream/channelstream:0.7.1 |
|
39 | image: channelstream/channelstream:0.7.1 | |
40 |
|
40 | |||
41 | restart: always |
|
41 | restart: always | |
42 |
|
42 | |||
43 | # ports: |
|
43 | # ports: | |
44 | # - "127.0.0.1:9800:9800" |
|
44 | # - "127.0.0.1:9800:9800" | |
45 |
|
45 | |||
46 | command: ["channelstream", "-i", "/etc/rhodecode/conf/channelstream.ini"] |
|
46 | command: ["channelstream"] | |
47 |
|
47 | |||
48 |
env |
|
48 | env_file: | |
49 | CHANNELSTREAM_ALLOW_POSTING_FROM: 0.0.0.0 |
|
49 | - .custom/.runtime.env | |
50 |
|
50 | |||
51 | healthcheck: |
|
51 | healthcheck: | |
52 | test: [ "CMD", "curl", "-s", "-o", "/dev/null", "-w", "'%{http_code}'", "http://channelstream:8000/admin/sign_in" ] |
|
52 | test: [ "CMD", "curl", "-s", "-o", "/dev/null", "-w", "'%{http_code}'", "http://channelstream:8000/admin/sign_in" ] | |
53 | timeout: 5s |
|
53 | timeout: 5s | |
54 | interval: 60s |
|
54 | interval: 60s | |
55 | retries: 10 |
|
55 | retries: 10 | |
56 |
|
56 | |||
57 | volumes: |
|
57 | volumes: | |
58 | - confvolume:/etc/rhodecode/conf |
|
58 | - confvolume:/etc/rhodecode/conf | |
59 | - logvolume:/var/log/rhodecode |
|
59 | - logvolume:/var/log/rhodecode | |
60 |
|
60 | |||
61 | logging: |
|
61 | logging: | |
62 | *custom-logging |
|
62 | *custom-logging | |
63 |
|
63 | |||
64 | labels: |
|
64 | labels: | |
65 | - "traefik.enable=false" |
|
65 | - "traefik.enable=false" | |
66 | #- "traefik.http.routers.channelstream.entrypoints=http" |
|
66 | #- "traefik.http.routers.channelstream.entrypoints=http" | |
67 | #- "traefik.http.services.channelstream.loadbalancer.server.port=9800" |
|
67 | #- "traefik.http.services.channelstream.loadbalancer.server.port=9800" | |
68 |
|
68 | |||
69 | profiles: |
|
69 | profiles: | |
70 | ["channelstream"] |
|
70 | ["channelstream"] | |
71 |
|
71 | |||
72 | nginx: |
|
72 | nginx: | |
73 | networks: |
|
73 | networks: | |
74 | - rhodecode_network |
|
74 | - rhodecode_network | |
75 | image: library/nginx:1.23.2 |
|
75 | image: library/nginx:1.23.2 | |
76 |
|
76 | |||
77 | restart: always |
|
77 | restart: always | |
78 |
|
78 | |||
79 | environment: |
|
79 | environment: | |
80 | NGINX_ENTRYPOINT_QUIET_LOGS: 1 |
|
80 | NGINX_ENTRYPOINT_QUIET_LOGS: 1 | |
81 |
|
81 | |||
82 | healthcheck: |
|
82 | healthcheck: | |
83 | # change port 80 to 443 when only using SSL |
|
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/_ |
|
84 | test: [ "CMD", "curl", "-A", "RhodeCode-Healthcheck", "-s", "-o", "/dev/null", "-w", "'%{http_code}'", "http://127.0.0.1:80/_health" ] | |
85 | timeout: 30s |
|
85 | timeout: 30s | |
86 | interval: 60s |
|
86 | interval: 60s | |
87 | retries: 10 |
|
87 | retries: 10 | |
88 |
|
88 | |||
89 | # depends_on: |
|
89 | # depends_on: | |
90 | # - channelstream |
|
90 | # - channelstream | |
91 |
|
91 | |||
92 | volumes: |
|
92 | volumes: | |
93 | - ./config/nginx/nginx.conf:/etc/nginx/nginx.conf:ro |
|
93 | - ./config/nginx/nginx.conf:/etc/nginx/nginx.conf:ro | |
94 | - ./config/nginx/http.conf:/etc/nginx/http.conf:ro |
|
94 | - ./config/nginx/http.conf:/etc/nginx/http.conf:ro | |
95 | - ./config/nginx/proxy.conf:/etc/nginx/proxy.conf:ro |
|
95 | - ./config/nginx/proxy.conf:/etc/nginx/proxy.conf:ro | |
96 | - logvolume:/var/log/rhodecode |
|
96 | - logvolume:/var/log/rhodecode | |
97 | - rc_datavolume:/var/opt/rhodecode_data |
|
97 | - rc_datavolume:/var/opt/rhodecode_data | |
98 |
|
98 | |||
99 | logging: |
|
99 | logging: | |
100 | *custom-logging |
|
100 | *custom-logging | |
101 |
|
101 | |||
102 | labels: |
|
102 | labels: | |
103 | - "traefik.enable=true" |
|
103 | - "traefik.enable=true" | |
104 | - "traefik.http.routers.nginx.entrypoints=http" |
|
104 | - "traefik.http.routers.nginx.entrypoints=http" | |
|
105 | - "traefik.http.routers.nginx.rule=Host(`${RHODECODE_HOSTNAME:?must-specify-rhodecode-hostname}`) && ( PathPrefix(`/_health`) || PathPrefix(`/_channelstream`) || PathPrefix(`/_static/rhodecode`) )" | |||
105 | - "traefik.http.services.nginx.loadbalancer.server.port=80" |
|
106 | - "traefik.http.services.nginx.loadbalancer.server.port=80" | |
106 | - "traefik.http.routers.nginx.rule=Host(`${RHODECODE_HOSTNAME:?must-specify-rhodecode-hostname}`)" |
|
|||
107 |
|
107 | |||
108 | elasticsearch: |
|
108 | elasticsearch: | |
109 | networks: |
|
109 | networks: | |
110 | - rhodecode_network |
|
110 | - rhodecode_network | |
111 | image: elasticsearch:6.8.23 |
|
111 | image: elasticsearch:6.8.23 | |
112 |
|
112 | |||
113 | environment: |
|
113 | environment: | |
114 | - cluster.name=elasticsearch-cluster |
|
114 | - cluster.name=elasticsearch-cluster | |
115 | - network.host=0.0.0.0 |
|
115 | - network.host=0.0.0.0 | |
116 | - bootstrap.memory_lock=true |
|
116 | - bootstrap.memory_lock=true | |
117 | - discovery.type=single-node |
|
117 | - discovery.type=single-node | |
118 | - "ES_JAVA_OPTS=-Xms512m -Xmx512m" |
|
118 | - "ES_JAVA_OPTS=-Xms512m -Xmx512m" | |
119 | healthcheck: |
|
119 | healthcheck: | |
120 | # change port 80 to 443 when only using SSL |
|
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" ] |
|
121 | test: [ "CMD", "curl", "-A", "RhodeCode-Healthcheck", "-s", "-o", "/dev/null", "-w", "'%{http_code}'", "elasticsearch:9200/_cat/health" ] | |
122 | timeout: 30s |
|
122 | timeout: 30s | |
123 | interval: 60s |
|
123 | interval: 60s | |
124 | retries: 10 |
|
124 | retries: 10 | |
125 |
|
125 | |||
126 | ulimits: |
|
126 | ulimits: | |
127 | memlock: |
|
127 | memlock: | |
128 | soft: -1 |
|
128 | soft: -1 | |
129 | hard: -1 |
|
129 | hard: -1 | |
130 |
|
130 | |||
131 | volumes: |
|
131 | volumes: | |
132 | - es_data:/usr/share/elasticsearch/data |
|
132 | - es_data:/usr/share/elasticsearch/data | |
133 |
|
133 | |||
134 | logging: |
|
134 | logging: | |
135 | *custom-logging |
|
135 | *custom-logging | |
136 |
|
136 | |||
137 | profiles: |
|
137 | profiles: | |
138 | ["elasticsearch"] |
|
138 | ["elasticsearch"] | |
139 |
|
139 | |||
140 | redis: |
|
140 | redis: | |
141 | networks: |
|
141 | networks: | |
142 | - rhodecode_network |
|
142 | - rhodecode_network | |
143 | image: library/redis:7.0.5 |
|
143 | image: library/redis:7.0.5 | |
144 |
|
144 | |||
145 | restart: always |
|
145 | restart: always | |
146 | command: |
|
146 | command: | |
147 | - "redis-server" |
|
147 | - "redis-server" | |
148 | - "/etc/redis/redis.conf" |
|
148 | - "/etc/redis/redis.conf" | |
149 | - "--maxmemory-policy allkeys-lru" |
|
149 | - "--maxmemory-policy allkeys-lru" | |
150 | - "--maxmemory ${RC_REDIS_MAXMEMORY}" |
|
150 | - "--maxmemory ${RC_REDIS_MAXMEMORY}" | |
151 |
|
151 | |||
152 | # ports: |
|
152 | # ports: | |
153 | # - "127.0.0.1::6379" |
|
153 | # - "127.0.0.1::6379" | |
154 |
|
154 | |||
155 | healthcheck: |
|
155 | healthcheck: | |
156 | test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ] |
|
156 | test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ] | |
157 | interval: 60s |
|
157 | interval: 60s | |
158 |
|
158 | |||
159 | volumes: |
|
159 | volumes: | |
160 | - ./config/redis/redis.conf:/etc/redis/redis.conf:ro |
|
160 | - ./config/redis/redis.conf:/etc/redis/redis.conf:ro | |
161 | - logvolume:/var/log/rhodecode |
|
161 | - logvolume:/var/log/rhodecode | |
162 | - redis_data:/data |
|
162 | - redis_data:/data | |
163 |
|
163 | |||
164 | profiles: |
|
164 | profiles: | |
165 | ["redis"] |
|
165 | ["redis"] | |
166 |
|
166 | |||
167 | logging: |
|
167 | logging: | |
168 | *custom-logging |
|
168 | *custom-logging | |
169 |
|
169 | |||
170 | database: |
|
170 | database: | |
171 | networks: |
|
171 | networks: | |
172 | - rhodecode_network |
|
172 | - rhodecode_network | |
173 | image: library/postgres:14.6 |
|
173 | image: library/postgres:14.6 | |
174 |
|
174 | |||
175 | environment: |
|
175 | environment: | |
176 | POSTGRES_DB: ${DB_NAME:?must-specify-db-name} |
|
176 | POSTGRES_DB: ${DB_NAME:?must-specify-db-name} | |
177 | POSTGRES_USER: ${DB_USER:?must-specify-db-user} |
|
177 | POSTGRES_USER: ${DB_USER:?must-specify-db-user} | |
178 | PGUSER: ${DB_USER:?must-specify-db-user} |
|
178 | PGUSER: ${DB_USER:?must-specify-db-user} | |
179 | POSTGRES_PASSWORD: ${DB_PASSWORD:?must-specify-db-password} |
|
179 | POSTGRES_PASSWORD: ${DB_PASSWORD:?must-specify-db-password} | |
180 | POSTGRES_HOST_AUTH_METHOD: md5 |
|
180 | POSTGRES_HOST_AUTH_METHOD: md5 | |
181 | POSTGRES_INITDB_ARGS: "--auth-host=md5 --auth-local=md5" |
|
181 | POSTGRES_INITDB_ARGS: "--auth-host=md5 --auth-local=md5" | |
182 |
|
182 | |||
183 | restart: unless-stopped |
|
183 | restart: unless-stopped | |
184 | command: |
|
184 | command: | |
185 | - "postgres" |
|
185 | - "postgres" | |
186 | - "-c" |
|
186 | - "-c" | |
187 | - "log_statement=ddl" |
|
187 | - "log_statement=ddl" | |
188 | - "-c" |
|
188 | - "-c" | |
189 | - "config_file=/etc/conf.d/pg_customized.conf" |
|
189 | - "config_file=/etc/conf.d/pg_customized.conf" | |
190 |
|
190 | |||
191 | # ports: |
|
191 | # ports: | |
192 | # - "127.0.0.1::5432" |
|
192 | # - "127.0.0.1::5432" | |
193 |
|
193 | |||
194 | healthcheck: |
|
194 | healthcheck: | |
195 | test: ["CMD-SHELL", "pg_isready", '-U', "$DB_USER"] |
|
195 | test: ["CMD-SHELL", "pg_isready", '-U', "$DB_USER"] | |
196 | interval: 10s |
|
196 | interval: 10s | |
197 | timeout: 5s |
|
197 | timeout: 5s | |
198 | retries: 5 |
|
198 | retries: 5 | |
199 |
|
199 | |||
200 | volumes: |
|
200 | volumes: | |
201 | - $PWD/config/database/pg_customized.conf:/etc/conf.d/pg_customized.conf:ro |
|
201 | - $PWD/config/database/pg_customized.conf:/etc/conf.d/pg_customized.conf:ro | |
202 | # db dumps reverse mount |
|
202 | # db dumps reverse mount | |
203 | - $PWD/.custom/db_dump:/var/rc-data-dump |
|
203 | - $PWD/.custom/db_dump:/var/rc-data-dump | |
204 | # save the pg_data volume |
|
204 | # save the pg_data volume | |
205 | - pg_data:/var/lib/postgresql/data |
|
205 | - pg_data:/var/lib/postgresql/data | |
206 | - logvolume:/var/log/rhodecode |
|
206 | - logvolume:/var/log/rhodecode | |
207 |
|
207 | |||
208 | profiles: |
|
208 | profiles: | |
209 | ["postgres"] |
|
209 | ["postgres"] | |
210 |
|
210 | |||
211 | logging: |
|
211 | logging: | |
212 | *custom-logging |
|
212 | *custom-logging | |
213 |
|
213 | |||
214 | database-mysql: |
|
214 | database-mysql: | |
215 | networks: |
|
215 | networks: | |
216 | - rhodecode_network |
|
216 | - rhodecode_network | |
217 | image: library/mysql:8.0.31 |
|
217 | image: library/mysql:8.0.31 | |
218 |
|
218 | |||
219 | environment: |
|
219 | environment: | |
220 | MYSQL_DATABASE: ${DB_NAME:?must-specify-db-name} |
|
220 | MYSQL_DATABASE: ${DB_NAME:?must-specify-db-name} | |
221 | MYSQL_USER: ${DB_USER:?must-specify-db-user} |
|
221 | MYSQL_USER: ${DB_USER:?must-specify-db-user} | |
222 | MYSQL_PASSWORD: ${DB_PASSWORD:?must-specify-db-password} |
|
222 | MYSQL_PASSWORD: ${DB_PASSWORD:?must-specify-db-password} | |
223 | MYSQL_ROOT_PASSWORD: ${DB_PASSWORD:?must-specify-db-password} |
|
223 | MYSQL_ROOT_PASSWORD: ${DB_PASSWORD:?must-specify-db-password} | |
224 |
|
224 | |||
225 | restart: unless-stopped |
|
225 | restart: unless-stopped | |
226 |
|
226 | |||
227 | # ports: |
|
227 | # ports: | |
228 | # - "127.0.0.1::3306" |
|
228 | # - "127.0.0.1::3306" | |
229 |
|
229 | |||
230 | volumes: |
|
230 | volumes: | |
231 | - ./config/database/mysql_customized.conf:/etc/mysql/conf.d/config-file.cnf:ro |
|
231 | - ./config/database/mysql_customized.conf:/etc/mysql/conf.d/config-file.cnf:ro | |
232 | # save the mysql_data volume |
|
232 | # save the mysql_data volume | |
233 | - $PWD/mysql_dir:/var/lib/mysql |
|
233 | - $PWD/mysql_dir:/var/lib/mysql | |
234 | - logvolume:/var/log/rhodecode |
|
234 | - logvolume:/var/log/rhodecode | |
235 |
|
235 | |||
236 | profiles: |
|
236 | profiles: | |
237 | ["mysql"] |
|
237 | ["mysql"] | |
238 |
|
238 | |||
239 | logging: |
|
239 | logging: | |
240 | *custom-logging |
|
240 | *custom-logging |
This diff has been collapsed as it changes many lines, (1544 lines changed) Show them Hide them | |||||
@@ -1,2889 +1,3663 b'' | |||||
1 | #!/usr/bin/env bash |
|
1 | #!/usr/bin/env bash | |
2 | # This script was generated by bashly 0.8.10 (https://bashly.dannyb.co) |
|
2 | # This script was generated by bashly 0.8.10 (https://bashly.dannyb.co) | |
3 | # Modifying it manually is not recommended |
|
3 | # Modifying it manually is not recommended | |
4 |
|
4 | |||
5 | # :wrapper.bash3_bouncer |
|
5 | # :wrapper.bash3_bouncer | |
6 | if [[ "${BASH_VERSINFO:-0}" -lt 4 ]]; then |
|
6 | if [[ "${BASH_VERSINFO:-0}" -lt 4 ]]; then | |
7 | printf "bash version 4 or higher is required\n" >&2 |
|
7 | printf "bash version 4 or higher is required\n" >&2 | |
8 | exit 1 |
|
8 | exit 1 | |
9 | fi |
|
9 | fi | |
10 |
|
10 | |||
11 | # :command.master_script |
|
11 | # :command.master_script | |
12 |
|
12 | |||
13 | # :command.version_command |
|
13 | # :command.version_command | |
14 | version_command() { |
|
14 | version_command() { | |
15 | echo "$version" |
|
15 | echo "$version" | |
16 | } |
|
16 | } | |
17 |
|
17 | |||
18 | # :command.usage |
|
18 | # :command.usage | |
19 | rccontrol_usage() { |
|
19 | rccontrol_usage() { | |
20 | if [[ -n $long_usage ]]; then |
|
20 | if [[ -n $long_usage ]]; then | |
21 | printf "rccontrol - RhodeCode Control - CLI for manaing RhodeCode Cluster Stack\n" |
|
21 | printf "rccontrol - RhodeCode Control - CLI for manaing RhodeCode Cluster Stack\n" | |
22 | echo |
|
22 | echo | |
23 |
|
23 | |||
24 | else |
|
24 | else | |
25 | printf "rccontrol - RhodeCode Control - CLI for manaing RhodeCode Cluster Stack\n" |
|
25 | printf "rccontrol - RhodeCode Control - CLI for manaing RhodeCode Cluster Stack\n" | |
26 | echo |
|
26 | echo | |
27 |
|
27 | |||
28 | fi |
|
28 | fi | |
29 |
|
29 | |||
30 | printf "Usage:\n" |
|
30 | printf "Usage:\n" | |
31 | printf " rccontrol [OPTIONS] COMMAND\n" |
|
31 | printf " rccontrol [OPTIONS] COMMAND\n" | |
32 | printf " rccontrol [COMMAND] --help | -h\n" |
|
32 | printf " rccontrol [COMMAND] --help | -h\n" | |
33 | printf " rccontrol --version | -v\n" |
|
33 | printf " rccontrol --version | -v\n" | |
34 | echo |
|
34 | echo | |
35 | # :command.usage_commands |
|
35 | # :command.usage_commands | |
36 | printf "Commands:\n" |
|
36 | printf "Commands:\n" | |
37 | echo " self-update update rccontrol and it's docker definitions" |
|
37 | echo " self-update update rccontrol and it's docker definitions" | |
38 | echo " bootstrap Bootstrap this machine, check docker version and install rhodecode-network" |
|
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 |
|
39 | echo | |
43 | printf "Build Commands:\n" |
|
40 | printf "Build Commands:\n" | |
44 | echo " get-build-artifacts Fetch Artifacts to run installer based build" |
|
41 | echo " get-build-artifacts Fetch Artifacts to run installer based build" | |
45 | echo " build Build RhodeCode image from installer" |
|
42 | 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" |
|
43 | 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" |
|
44 | echo " build-source Build RhodeCode image from source, requires upgrade-source initially" | |
48 | echo |
|
45 | echo | |
|
46 | printf "Stack Commands:\n" | |||
|
47 | echo " stack run one of available cluster stacks, use -h for more details" | |||
|
48 | echo " stack-status Show stack status" | |||
|
49 | echo " stack-upgrade upgrade ALL stack status" | |||
|
50 | echo | |||
49 | printf "CLI Commands:\n" |
|
51 | printf "CLI Commands:\n" | |
50 |
echo " cli |
|
52 | echo " cli run various CLI tools" | |
51 | echo " cli-db CLI" |
|
|||
52 | echo " cli-db-upgrade CLI" |
|
|||
53 | echo |
|
53 | echo | |
54 | printf "Backup Commands:\n" |
|
54 | printf "Backup Commands:\n" | |
55 | echo " backup-db CLI" |
|
55 | echo " backup-db CLI" | |
56 | echo " backup-data CLI" |
|
56 | echo " backup-data CLI" | |
57 | echo |
|
57 | echo | |
58 |
|
58 | |||
59 | # :command.long_usage |
|
59 | # :command.long_usage | |
60 | if [[ -n $long_usage ]]; then |
|
60 | if [[ -n $long_usage ]]; then | |
61 | printf "Options:\n" |
|
61 | printf "Options:\n" | |
62 |
|
62 | |||
63 | # :command.usage_fixed_flags |
|
63 | # :command.usage_fixed_flags | |
64 | echo " --help, -h" |
|
64 | echo " --help, -h" | |
65 | printf " Show this help\n" |
|
65 | printf " Show this help\n" | |
66 | echo |
|
66 | echo | |
67 | echo " --version, -v" |
|
67 | echo " --version, -v" | |
68 | printf " Show version number\n" |
|
68 | printf " Show version number\n" | |
69 | echo |
|
69 | echo | |
70 |
|
70 | |||
71 | # :command.usage_flags |
|
71 | # :command.usage_flags | |
72 | # :flag.usage |
|
72 | # :flag.usage | |
73 | echo " --debug" |
|
73 | echo " --debug" | |
74 | printf " Enable debug and detailed output\n" |
|
74 | printf " Enable debug and detailed output\n" | |
75 | echo |
|
75 | echo | |
76 |
|
76 | |||
77 | # :command.usage_environment_variables |
|
77 | # :command.usage_environment_variables | |
78 | printf "Environment Variables:\n" |
|
78 | printf "Environment Variables:\n" | |
79 |
|
79 | |||
80 | # :environment_variable.usage |
|
80 | # :environment_variable.usage | |
81 | echo " AUTH_TOKEN" |
|
81 | echo " AUTH_TOKEN" | |
82 | printf " Set your RhodeCode AUTH Token\n" |
|
82 | printf " Set your RhodeCode AUTH Token\n" | |
83 | echo |
|
83 | echo | |
84 |
|
84 | |||
85 | # :environment_variable.usage |
|
85 | # :environment_variable.usage | |
86 | echo " RC_CLI_VERSION_NAME" |
|
86 | echo " RC_CLI_VERSION_NAME" | |
87 | printf " default version to build and install\n" |
|
87 | printf " default version to build and install\n" | |
88 | printf " Default: 4.27.0\n" |
|
88 | printf " Default: 4.27.0\n" | |
89 | echo |
|
89 | echo | |
90 |
|
90 | |||
91 | # :environment_variable.usage |
|
91 | # :environment_variable.usage | |
92 | echo " RC_STACK_ROUTER_EXT" |
|
92 | echo " RC_STACK_ROUTER_EXT" | |
93 | printf "\n" |
|
93 | printf "\n" | |
94 | printf " Default: .custom/docker-compose-router.override.yaml\n" |
|
94 | printf " Default: .custom/docker-compose-router.override.yaml\n" | |
95 | echo |
|
95 | echo | |
96 |
|
96 | |||
97 | # :environment_variable.usage |
|
97 | # :environment_variable.usage | |
98 | echo " RC_STACK_METRICS_EXT" |
|
98 | echo " RC_STACK_METRICS_EXT" | |
99 | printf "\n" |
|
99 | printf "\n" | |
100 | printf " Default: .custom/docker-compose-metrics.override.yaml\n" |
|
100 | printf " Default: .custom/docker-compose-metrics.override.yaml\n" | |
101 | echo |
|
101 | echo | |
102 |
|
102 | |||
103 | # :environment_variable.usage |
|
103 | # :environment_variable.usage | |
104 | echo " RC_STACK_SERVICES_EXT" |
|
104 | echo " RC_STACK_SERVICES_EXT" | |
105 | printf "\n" |
|
105 | printf "\n" | |
106 | printf " Default: .custom/docker-compose-services.override.yaml\n" |
|
106 | printf " Default: .custom/docker-compose-services.override.yaml\n" | |
107 | echo |
|
107 | echo | |
108 |
|
108 | |||
109 | # :environment_variable.usage |
|
109 | # :environment_variable.usage | |
110 | echo " RC_STACK_RHODECODE_EXT" |
|
110 | echo " RC_STACK_RHODECODE_EXT" | |
111 | printf "\n" |
|
111 | printf "\n" | |
112 | printf " Default: .custom/docker-compose-apps.override.yaml\n" |
|
112 | printf " Default: .custom/docker-compose-apps.override.yaml\n" | |
113 | echo |
|
113 | echo | |
114 |
|
114 | |||
115 | # :command.footer |
|
115 | # :command.footer | |
116 | printf "RhodeCode Inc 2022\n\n" |
|
116 | printf "RhodeCode Inc 2022\n\n" | |
117 | echo |
|
117 | echo | |
118 |
|
118 | |||
119 | fi |
|
119 | fi | |
120 | } |
|
120 | } | |
121 |
|
121 | |||
122 | # :command.usage |
|
122 | # :command.usage | |
123 | rccontrol_self_update_usage() { |
|
123 | rccontrol_self_update_usage() { | |
124 | if [[ -n $long_usage ]]; then |
|
124 | if [[ -n $long_usage ]]; then | |
125 | printf "rccontrol self-update - update rccontrol and it's docker definitions\n" |
|
125 | printf "rccontrol self-update - update rccontrol and it's docker definitions\n" | |
126 | echo |
|
126 | echo | |
127 |
|
127 | |||
128 | else |
|
128 | else | |
129 | printf "rccontrol self-update - update rccontrol and it's docker definitions\n" |
|
129 | printf "rccontrol self-update - update rccontrol and it's docker definitions\n" | |
130 | echo |
|
130 | echo | |
131 |
|
131 | |||
132 | fi |
|
132 | fi | |
133 |
|
133 | |||
134 | printf "Usage:\n" |
|
134 | printf "Usage:\n" | |
135 | printf " rccontrol self-update [OPTIONS]\n" |
|
135 | printf " rccontrol self-update [OPTIONS]\n" | |
136 | printf " rccontrol self-update --help | -h\n" |
|
136 | printf " rccontrol self-update --help | -h\n" | |
137 | echo |
|
137 | echo | |
138 |
|
138 | |||
139 | # :command.long_usage |
|
139 | # :command.long_usage | |
140 | if [[ -n $long_usage ]]; then |
|
140 | if [[ -n $long_usage ]]; then | |
141 | printf "Options:\n" |
|
141 | printf "Options:\n" | |
142 |
|
142 | |||
143 | # :command.usage_fixed_flags |
|
143 | # :command.usage_fixed_flags | |
144 | echo " --help, -h" |
|
144 | echo " --help, -h" | |
145 | printf " Show this help\n" |
|
145 | printf " Show this help\n" | |
146 | echo |
|
146 | echo | |
147 |
|
147 | |||
148 | # :command.usage_flags |
|
148 | # :command.usage_flags | |
149 | # :flag.usage |
|
149 | # :flag.usage | |
150 | echo " --auth-token AUTH_TOKEN" |
|
150 | echo " --auth-token AUTH_TOKEN" | |
151 | printf " Optionally specify AUTH TOKEN to obtain sources\n" |
|
151 | printf " Optionally specify AUTH TOKEN to obtain sources\n" | |
152 | echo |
|
152 | echo | |
153 |
|
153 | |||
154 | # :flag.usage |
|
154 | # :flag.usage | |
155 | echo " --server-url SERVER_URL" |
|
155 | echo " --server-url SERVER_URL" | |
156 | printf " Specify RhodeCode server location where projects should be downloaded\n" |
|
156 | printf " Specify RhodeCode server location where projects should be downloaded\n" | |
157 | printf " Default: https://code.rhodecode.com\n" |
|
157 | printf " Default: https://code.rhodecode.com\n" | |
158 | echo |
|
158 | echo | |
159 |
|
159 | |||
160 | fi |
|
160 | fi | |
161 | } |
|
161 | } | |
162 |
|
162 | |||
163 | # :command.usage |
|
163 | # :command.usage | |
164 | rccontrol_bootstrap_usage() { |
|
164 | rccontrol_bootstrap_usage() { | |
165 | if [[ -n $long_usage ]]; then |
|
165 | if [[ -n $long_usage ]]; then | |
166 | printf "rccontrol bootstrap - Bootstrap this machine, check docker version and install rhodecode-network\n" |
|
166 | printf "rccontrol bootstrap - Bootstrap this machine, check docker version and install rhodecode-network\n" | |
167 | echo |
|
167 | echo | |
168 |
|
168 | |||
169 | else |
|
169 | else | |
170 | printf "rccontrol bootstrap - Bootstrap this machine, check docker version and install rhodecode-network\n" |
|
170 | printf "rccontrol bootstrap - Bootstrap this machine, check docker version and install rhodecode-network\n" | |
171 | echo |
|
171 | echo | |
172 |
|
172 | |||
173 | fi |
|
173 | fi | |
174 |
|
174 | |||
175 |
printf "Alias: in |
|
175 | printf "Alias: init\n" | |
176 | echo |
|
176 | echo | |
177 |
|
177 | |||
178 | printf "Usage:\n" |
|
178 | printf "Usage:\n" | |
179 | printf " rccontrol bootstrap [OPTIONS]\n" |
|
179 | printf " rccontrol bootstrap [OPTIONS]\n" | |
180 | printf " rccontrol bootstrap --help | -h\n" |
|
180 | printf " rccontrol bootstrap --help | -h\n" | |
181 | echo |
|
181 | echo | |
182 |
|
182 | |||
183 | # :command.long_usage |
|
183 | # :command.long_usage | |
184 | if [[ -n $long_usage ]]; then |
|
184 | if [[ -n $long_usage ]]; then | |
185 | printf "Options:\n" |
|
185 | printf "Options:\n" | |
186 |
|
186 | |||
187 | # :command.usage_fixed_flags |
|
187 | # :command.usage_fixed_flags | |
188 | echo " --help, -h" |
|
188 | echo " --help, -h" | |
189 | printf " Show this help\n" |
|
189 | printf " Show this help\n" | |
190 | echo |
|
190 | echo | |
191 |
|
191 | |||
192 | # :command.usage_flags |
|
192 | # :command.usage_flags | |
193 | # :flag.usage |
|
193 | # :flag.usage | |
194 | echo " --force, -f" |
|
194 | echo " --force, -f" | |
195 | printf " Overwrite existing files\n" |
|
195 | printf " Overwrite existing files\n" | |
196 | echo |
|
196 | echo | |
197 |
|
197 | |||
198 | # :flag.usage |
|
198 | # :flag.usage | |
199 | echo " --auth-token AUTH_TOKEN" |
|
199 | echo " --auth-token AUTH_TOKEN" | |
200 | printf " Optionally specify AUTH TOKEN to obtain sources\n" |
|
200 | printf " Optionally specify AUTH TOKEN to obtain sources\n" | |
201 | echo |
|
201 | echo | |
202 |
|
202 | |||
203 | # :flag.usage |
|
203 | # :flag.usage | |
204 | echo " --server-url SERVER_URL" |
|
204 | echo " --server-url SERVER_URL" | |
205 | printf " Specify RhodeCode server location where projects should be downloaded\n" |
|
205 | printf " Specify RhodeCode server location where projects should be downloaded\n" | |
206 | printf " Default: https://code.rhodecode.com\n" |
|
206 | printf " Default: https://code.rhodecode.com\n" | |
207 | echo |
|
207 | echo | |
208 |
|
208 | |||
209 | # :command.usage_examples |
|
209 | # :command.usage_examples | |
210 | printf "Examples:\n" |
|
210 | printf "Examples:\n" | |
211 | printf " rccontrol3 bootstrap\n" |
|
211 | printf " rccontrol3 bootstrap\n" | |
212 | printf " rccontrol3 bootstrap --force\n" |
|
212 | printf " rccontrol3 bootstrap --force\n" | |
213 | echo |
|
213 | echo | |
214 |
|
214 | |||
215 | fi |
|
215 | fi | |
216 | } |
|
216 | } | |
217 |
|
217 | |||
218 | # :command.usage |
|
218 | # :command.usage | |
219 | rccontrol_get_build_artifacts_usage() { |
|
219 | rccontrol_get_build_artifacts_usage() { | |
220 | if [[ -n $long_usage ]]; then |
|
220 | if [[ -n $long_usage ]]; then | |
221 | printf "rccontrol get-build-artifacts - Fetch Artifacts to run installer based build\n" |
|
221 | printf "rccontrol get-build-artifacts - Fetch Artifacts to run installer based build\n" | |
222 | echo |
|
222 | echo | |
223 |
|
223 | |||
224 | else |
|
224 | else | |
225 | printf "rccontrol get-build-artifacts - Fetch Artifacts to run installer based build\n" |
|
225 | printf "rccontrol get-build-artifacts - Fetch Artifacts to run installer based build\n" | |
226 | echo |
|
226 | echo | |
227 |
|
227 | |||
228 | fi |
|
228 | fi | |
229 |
|
229 | |||
230 | printf "Usage:\n" |
|
230 | printf "Usage:\n" | |
231 | printf " rccontrol get-build-artifacts [OPTIONS]\n" |
|
231 | printf " rccontrol get-build-artifacts [OPTIONS]\n" | |
232 | printf " rccontrol get-build-artifacts --help | -h\n" |
|
232 | printf " rccontrol get-build-artifacts --help | -h\n" | |
233 | echo |
|
233 | echo | |
234 |
|
234 | |||
235 | # :command.long_usage |
|
235 | # :command.long_usage | |
236 | if [[ -n $long_usage ]]; then |
|
236 | if [[ -n $long_usage ]]; then | |
237 | printf "Options:\n" |
|
237 | printf "Options:\n" | |
238 |
|
238 | |||
239 | # :command.usage_fixed_flags |
|
239 | # :command.usage_fixed_flags | |
240 | echo " --help, -h" |
|
240 | echo " --help, -h" | |
241 | printf " Show this help\n" |
|
241 | printf " Show this help\n" | |
242 | echo |
|
242 | echo | |
243 |
|
243 | |||
244 | # :command.usage_flags |
|
244 | # :command.usage_flags | |
245 | # :flag.usage |
|
245 | # :flag.usage | |
246 | echo " --auth AUTH" |
|
246 | echo " --auth AUTH" | |
247 | printf " Specify custom auth for curl e.g -u admin:secret\n" |
|
247 | printf " Specify custom auth for curl e.g -u admin:secret\n" | |
248 | printf " Default: \n" |
|
248 | printf " Default: \n" | |
249 | echo |
|
249 | echo | |
250 |
|
250 | |||
251 | # :flag.usage |
|
251 | # :flag.usage | |
252 | echo " --installer-url INSTALLER_URL" |
|
252 | echo " --installer-url INSTALLER_URL" | |
253 | printf " Installer Download URL\n" |
|
253 | printf " Installer Download URL\n" | |
254 | printf " Default: https://dls.rhodecode.com/dls/N2E2ZTY1NzA3NjYxNDA2NTc1NjI3MTcyNzA2MjcxNzIyZTcwNjI3YQ==/rhodecode-control/latest-linux-ee\n" |
|
254 | printf " Default: https://dls.rhodecode.com/dls/N2E2ZTY1NzA3NjYxNDA2NTc1NjI3MTcyNzA2MjcxNzIyZTcwNjI3YQ==/rhodecode-control/latest-linux-ee\n" | |
255 | echo |
|
255 | echo | |
256 |
|
256 | |||
257 | # :flag.usage |
|
257 | # :flag.usage | |
258 | echo " --manifest-url MANIFEST_URL" |
|
258 | echo " --manifest-url MANIFEST_URL" | |
259 | printf " Manifest file url\n" |
|
259 | printf " Manifest file url\n" | |
260 | printf " Default: https://dls.rhodecode.com/linux/MANIFEST\n" |
|
260 | printf " Default: https://dls.rhodecode.com/linux/MANIFEST\n" | |
261 | echo |
|
261 | echo | |
262 |
|
262 | |||
263 | # :flag.usage |
|
263 | # :flag.usage | |
264 | echo " --version-name VERSION_NAME" |
|
264 | echo " --version-name VERSION_NAME" | |
265 | printf " Specify custom build ver e.g $RC_CLI_VERSION_NAME\n" |
|
265 | printf " Specify custom build ver e.g $RC_CLI_VERSION_NAME\n" | |
266 | printf " Default: $RC_CLI_VERSION_NAME\n" |
|
266 | printf " Default: $RC_CLI_VERSION_NAME\n" | |
267 | echo |
|
267 | echo | |
268 |
|
268 | |||
269 | fi |
|
269 | fi | |
270 | } |
|
270 | } | |
271 |
|
271 | |||
272 | # :command.usage |
|
272 | # :command.usage | |
273 | rccontrol_build_usage() { |
|
273 | rccontrol_build_usage() { | |
274 | if [[ -n $long_usage ]]; then |
|
274 | if [[ -n $long_usage ]]; then | |
275 | printf "rccontrol build - Build RhodeCode image from installer\n" |
|
275 | printf "rccontrol build - Build RhodeCode image from installer\n" | |
276 | echo |
|
276 | echo | |
277 |
|
277 | |||
278 | else |
|
278 | else | |
279 | printf "rccontrol build - Build RhodeCode image from installer\n" |
|
279 | printf "rccontrol build - Build RhodeCode image from installer\n" | |
280 | echo |
|
280 | echo | |
281 |
|
281 | |||
282 | fi |
|
282 | fi | |
283 |
|
283 | |||
284 | printf "Usage:\n" |
|
284 | printf "Usage:\n" | |
285 | printf " rccontrol build [OPTIONS]\n" |
|
285 | printf " rccontrol build [OPTIONS]\n" | |
286 | printf " rccontrol build --help | -h\n" |
|
286 | printf " rccontrol build --help | -h\n" | |
287 | echo |
|
287 | echo | |
288 |
|
288 | |||
289 | # :command.long_usage |
|
289 | # :command.long_usage | |
290 | if [[ -n $long_usage ]]; then |
|
290 | if [[ -n $long_usage ]]; then | |
291 | printf "Options:\n" |
|
291 | printf "Options:\n" | |
292 |
|
292 | |||
293 | # :command.usage_fixed_flags |
|
293 | # :command.usage_fixed_flags | |
294 | echo " --help, -h" |
|
294 | echo " --help, -h" | |
295 | printf " Show this help\n" |
|
295 | printf " Show this help\n" | |
296 | echo |
|
296 | echo | |
297 |
|
297 | |||
298 | # :command.usage_flags |
|
298 | # :command.usage_flags | |
299 | # :flag.usage |
|
299 | # :flag.usage | |
300 | echo " --version-name VERSION_NAME" |
|
300 | echo " --version-name VERSION_NAME" | |
301 | printf " Specify custom build ver e.g $RC_CLI_VERSION_NAME\n" |
|
301 | printf " Specify custom build ver e.g $RC_CLI_VERSION_NAME\n" | |
302 | printf " Default: $RC_CLI_VERSION_NAME\n" |
|
302 | printf " Default: $RC_CLI_VERSION_NAME\n" | |
303 | echo |
|
303 | echo | |
304 |
|
304 | |||
305 | fi |
|
305 | fi | |
306 | } |
|
306 | } | |
307 |
|
307 | |||
308 | # :command.usage |
|
308 | # :command.usage | |
309 | rccontrol_get_build_source_usage() { |
|
309 | rccontrol_get_build_source_usage() { | |
310 | if [[ -n $long_usage ]]; then |
|
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" |
|
311 | printf "rccontrol get-build-source - Fetch RhodeCode sources, store in .source dir to run a source-based builds\n" | |
312 | echo |
|
312 | echo | |
313 |
|
313 | |||
314 | else |
|
314 | else | |
315 | printf "rccontrol get-build-source - Fetch RhodeCode sources, store in .source dir to run a source-based builds\n" |
|
315 | printf "rccontrol get-build-source - Fetch RhodeCode sources, store in .source dir to run a source-based builds\n" | |
316 | echo |
|
316 | echo | |
317 |
|
317 | |||
318 | fi |
|
318 | fi | |
319 |
|
319 | |||
320 | printf "Usage:\n" |
|
320 | printf "Usage:\n" | |
321 |
printf " rccontrol get-build-source |
|
321 | printf " rccontrol get-build-source [OPTIONS]\n" | |
322 | printf " rccontrol get-build-source --help | -h\n" |
|
322 | printf " rccontrol get-build-source --help | -h\n" | |
323 | echo |
|
323 | echo | |
324 |
|
324 | |||
325 | # :command.long_usage |
|
325 | # :command.long_usage | |
326 | if [[ -n $long_usage ]]; then |
|
326 | if [[ -n $long_usage ]]; then | |
327 | printf "Options:\n" |
|
327 | printf "Options:\n" | |
328 |
|
328 | |||
329 | # :command.usage_fixed_flags |
|
329 | # :command.usage_fixed_flags | |
330 | echo " --help, -h" |
|
330 | echo " --help, -h" | |
331 | printf " Show this help\n" |
|
331 | printf " Show this help\n" | |
332 | echo |
|
332 | echo | |
333 |
|
333 | |||
334 | # :command.usage_flags |
|
334 | # :command.usage_flags | |
335 | # :flag.usage |
|
335 | # :flag.usage | |
|
336 | echo " --revision REVISION" | |||
|
337 | printf " revision to download\n" | |||
|
338 | printf " Default: default\n" | |||
|
339 | echo | |||
|
340 | ||||
|
341 | # :flag.usage | |||
336 | echo " --auth-token AUTH_TOKEN" |
|
342 | echo " --auth-token AUTH_TOKEN" | |
337 | printf " Specify AUTH TOKEN to obtain sources\n" |
|
343 | printf " Specify AUTH TOKEN to obtain sources\n" | |
338 | echo |
|
344 | echo | |
339 |
|
345 | |||
340 | # :flag.usage |
|
346 | # :flag.usage | |
341 | echo " --server-url SERVER_URL" |
|
347 | echo " --server-url SERVER_URL" | |
342 | printf " Specify RhodeCode server location where projects should be downloaded\n" |
|
348 | printf " Specify RhodeCode server location where projects should be downloaded\n" | |
343 | printf " Default: https://code.rhodecode.com\n" |
|
349 | printf " Default: https://code.rhodecode.com\n" | |
344 | echo |
|
350 | echo | |
345 |
|
351 | |||
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 |
|
352 | # :command.usage_examples | |
355 | printf "Examples:\n" |
|
353 | printf "Examples:\n" | |
356 | printf " rccontrol3 get-sources $RC_CLI_VERSION_NAME\n" |
|
354 | 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" |
|
355 | printf " rccontrol3 get-sources default --auth-token xyxyxyx --server-url\n https://secret.repo/\n" | |
358 | echo |
|
356 | echo | |
359 |
|
357 | |||
360 | fi |
|
358 | fi | |
361 | } |
|
359 | } | |
362 |
|
360 | |||
363 | # :command.usage |
|
361 | # :command.usage | |
364 | rccontrol_build_source_usage() { |
|
362 | rccontrol_build_source_usage() { | |
365 | if [[ -n $long_usage ]]; then |
|
363 | if [[ -n $long_usage ]]; then | |
366 | printf "rccontrol build-source - Build RhodeCode image from source, requires upgrade-source initially\n" |
|
364 | printf "rccontrol build-source - Build RhodeCode image from source, requires upgrade-source initially\n" | |
367 | echo |
|
365 | echo | |
368 |
|
366 | |||
369 | else |
|
367 | else | |
370 | printf "rccontrol build-source - Build RhodeCode image from source, requires upgrade-source initially\n" |
|
368 | printf "rccontrol build-source - Build RhodeCode image from source, requires upgrade-source initially\n" | |
371 | echo |
|
369 | echo | |
372 |
|
370 | |||
373 | fi |
|
371 | fi | |
374 |
|
372 | |||
375 | printf "Usage:\n" |
|
373 | printf "Usage:\n" | |
376 | printf " rccontrol build-source [OPTIONS]\n" |
|
374 | printf " rccontrol build-source [OPTIONS]\n" | |
377 | printf " rccontrol build-source --help | -h\n" |
|
375 | printf " rccontrol build-source --help | -h\n" | |
378 | echo |
|
376 | echo | |
379 |
|
377 | |||
380 | # :command.long_usage |
|
378 | # :command.long_usage | |
381 | if [[ -n $long_usage ]]; then |
|
379 | if [[ -n $long_usage ]]; then | |
382 | printf "Options:\n" |
|
380 | printf "Options:\n" | |
383 |
|
381 | |||
384 | # :command.usage_fixed_flags |
|
382 | # :command.usage_fixed_flags | |
385 | echo " --help, -h" |
|
383 | echo " --help, -h" | |
386 | printf " Show this help\n" |
|
384 | printf " Show this help\n" | |
387 | echo |
|
385 | echo | |
388 |
|
386 | |||
389 | # :command.usage_flags |
|
387 | # :command.usage_flags | |
390 | # :flag.usage |
|
388 | # :flag.usage | |
391 | echo " --version-name VERSION_NAME" |
|
389 | echo " --version-name VERSION_NAME" | |
392 | printf " Specify custom build ver e.g $RC_CLI_VERSION_NAME\n" |
|
390 | printf " Specify custom build ver e.g $RC_CLI_VERSION_NAME\n" | |
393 | printf " Default: $RC_CLI_VERSION_NAME\n" |
|
391 | printf " Default: $RC_CLI_VERSION_NAME\n" | |
394 | echo |
|
392 | echo | |
395 |
|
393 | |||
396 | # :command.usage_examples |
|
394 | # :command.usage_examples | |
397 | printf "Examples:\n" |
|
395 | printf "Examples:\n" | |
398 | printf " build foo\n" |
|
396 | printf " build foo\n" | |
399 | echo |
|
397 | echo | |
400 |
|
398 | |||
401 | fi |
|
399 | fi | |
402 | } |
|
400 | } | |
403 |
|
401 | |||
404 | # :command.usage |
|
402 | # :command.usage | |
405 | rccontrol_stack_usage() { |
|
403 | rccontrol_stack_usage() { | |
406 | if [[ -n $long_usage ]]; then |
|
404 | if [[ -n $long_usage ]]; then | |
407 | printf "rccontrol stack - run one of available cluster stacks, use -h for more details\n" |
|
405 | printf "rccontrol stack - run one of available cluster stacks, use -h for more details\n" | |
408 | echo |
|
406 | echo | |
409 |
|
407 | |||
410 | else |
|
408 | else | |
411 | printf "rccontrol stack - run one of available cluster stacks, use -h for more details\n" |
|
409 | printf "rccontrol stack - run one of available cluster stacks, use -h for more details\n" | |
412 | echo |
|
410 | echo | |
413 |
|
411 | |||
414 | fi |
|
412 | fi | |
415 |
|
413 | |||
416 | printf "Usage:\n" |
|
414 | printf "Usage:\n" | |
417 |
printf " rccontrol stack |
|
415 | printf " rccontrol stack COMMAND\n" | |
418 | printf " rccontrol stack --help | -h\n" |
|
416 | printf " rccontrol stack [COMMAND] --help | -h\n" | |
|
417 | echo | |||
|
418 | # :command.usage_commands | |||
|
419 | printf "Commands:\n" | |||
|
420 | echo " router run the router stack" | |||
|
421 | echo " metrics run the router stack" | |||
|
422 | echo " services run the router stack" | |||
|
423 | echo " rhodecode run the router stack" | |||
|
424 | echo " all run all stacks" | |||
|
425 | echo | |||
|
426 | ||||
|
427 | # :command.long_usage | |||
|
428 | if [[ -n $long_usage ]]; then | |||
|
429 | printf "Options:\n" | |||
|
430 | ||||
|
431 | # :command.usage_fixed_flags | |||
|
432 | echo " --help, -h" | |||
|
433 | printf " Show this help\n" | |||
|
434 | echo | |||
|
435 | ||||
|
436 | # :command.usage_examples | |||
|
437 | printf "Examples:\n" | |||
|
438 | 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" | |||
|
439 | echo | |||
|
440 | ||||
|
441 | fi | |||
|
442 | } | |||
|
443 | ||||
|
444 | # :command.usage | |||
|
445 | rccontrol_stack_router_usage() { | |||
|
446 | if [[ -n $long_usage ]]; then | |||
|
447 | printf "rccontrol stack router - run the router stack\n" | |||
|
448 | echo | |||
|
449 | ||||
|
450 | else | |||
|
451 | printf "rccontrol stack router - run the router stack\n" | |||
|
452 | echo | |||
|
453 | ||||
|
454 | fi | |||
|
455 | ||||
|
456 | printf "Usage:\n" | |||
|
457 | printf " rccontrol stack router [SERVICES PARAMS...]\n" | |||
|
458 | printf " rccontrol stack router --help | -h\n" | |||
|
459 | echo | |||
|
460 | ||||
|
461 | # :command.long_usage | |||
|
462 | if [[ -n $long_usage ]]; then | |||
|
463 | printf "Options:\n" | |||
|
464 | ||||
|
465 | # :command.usage_fixed_flags | |||
|
466 | echo " --help, -h" | |||
|
467 | printf " Show this help\n" | |||
|
468 | echo | |||
|
469 | ||||
|
470 | # :command.usage_args | |||
|
471 | printf "Arguments:\n" | |||
|
472 | ||||
|
473 | echo " SERVICES PARAMS..." | |||
|
474 | printf " Additional arguments or flags for services command\n" | |||
|
475 | echo | |||
|
476 | ||||
|
477 | fi | |||
|
478 | } | |||
|
479 | ||||
|
480 | # :command.usage | |||
|
481 | rccontrol_stack_metrics_usage() { | |||
|
482 | if [[ -n $long_usage ]]; then | |||
|
483 | printf "rccontrol stack metrics - run the router stack\n" | |||
|
484 | echo | |||
|
485 | ||||
|
486 | else | |||
|
487 | printf "rccontrol stack metrics - run the router stack\n" | |||
|
488 | echo | |||
|
489 | ||||
|
490 | fi | |||
|
491 | ||||
|
492 | printf "Usage:\n" | |||
|
493 | printf " rccontrol stack metrics [SERVICES PARAMS...]\n" | |||
|
494 | printf " rccontrol stack metrics --help | -h\n" | |||
419 | echo |
|
495 | echo | |
420 |
|
496 | |||
421 | # :command.long_usage |
|
497 | # :command.long_usage | |
422 | if [[ -n $long_usage ]]; then |
|
498 | if [[ -n $long_usage ]]; then | |
423 | printf "Options:\n" |
|
499 | printf "Options:\n" | |
424 |
|
500 | |||
425 | # :command.usage_fixed_flags |
|
501 | # :command.usage_fixed_flags | |
426 | echo " --help, -h" |
|
502 | echo " --help, -h" | |
427 | printf " Show this help\n" |
|
503 | printf " Show this help\n" | |
428 | echo |
|
504 | echo | |
429 |
|
505 | |||
430 | # :command.usage_args |
|
506 | # :command.usage_args | |
431 | printf "Arguments:\n" |
|
507 | printf "Arguments:\n" | |
432 |
|
508 | |||
433 | # :argument.usage |
|
509 | echo " SERVICES PARAMS..." | |
434 | echo " NAME" |
|
510 | printf " Additional arguments or flags for services command\n" | |
435 | printf " Stack name\n" |
|
511 | echo | |
436 | printf " Allowed: router, metrics, services, rhodecode\n" |
|
512 | ||
|
513 | fi | |||
|
514 | } | |||
|
515 | ||||
|
516 | # :command.usage | |||
|
517 | rccontrol_stack_services_usage() { | |||
|
518 | if [[ -n $long_usage ]]; then | |||
|
519 | printf "rccontrol stack services - run the router stack\n" | |||
|
520 | echo | |||
|
521 | ||||
|
522 | else | |||
|
523 | printf "rccontrol stack services - run the router stack\n" | |||
|
524 | echo | |||
|
525 | ||||
|
526 | fi | |||
|
527 | ||||
|
528 | printf "Usage:\n" | |||
|
529 | printf " rccontrol stack services [SERVICES PARAMS...]\n" | |||
|
530 | printf " rccontrol stack services --help | -h\n" | |||
|
531 | echo | |||
|
532 | ||||
|
533 | # :command.long_usage | |||
|
534 | if [[ -n $long_usage ]]; then | |||
|
535 | printf "Options:\n" | |||
|
536 | ||||
|
537 | # :command.usage_fixed_flags | |||
|
538 | echo " --help, -h" | |||
|
539 | printf " Show this help\n" | |||
437 | echo |
|
540 | echo | |
438 |
|
541 | |||
|
542 | # :command.usage_args | |||
|
543 | printf "Arguments:\n" | |||
|
544 | ||||
439 | echo " SERVICES PARAMS..." |
|
545 | echo " SERVICES PARAMS..." | |
440 | printf " Additional arguments or flags for services command\n" |
|
546 | printf " Additional arguments or flags for services command\n" | |
441 | echo |
|
547 | echo | |
442 |
|
548 | |||
443 | # :command.usage_examples |
|
549 | fi | |
444 | printf "Examples:\n" |
|
550 | } | |
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" |
|
551 | ||
|
552 | # :command.usage | |||
|
553 | rccontrol_stack_rhodecode_usage() { | |||
|
554 | if [[ -n $long_usage ]]; then | |||
|
555 | printf "rccontrol stack rhodecode - run the router stack\n" | |||
|
556 | echo | |||
|
557 | ||||
|
558 | else | |||
|
559 | printf "rccontrol stack rhodecode - run the router stack\n" | |||
|
560 | echo | |||
|
561 | ||||
|
562 | fi | |||
|
563 | ||||
|
564 | printf "Usage:\n" | |||
|
565 | printf " rccontrol stack rhodecode [SERVICES PARAMS...]\n" | |||
|
566 | printf " rccontrol stack rhodecode --help | -h\n" | |||
|
567 | echo | |||
|
568 | ||||
|
569 | # :command.long_usage | |||
|
570 | if [[ -n $long_usage ]]; then | |||
|
571 | printf "Options:\n" | |||
|
572 | ||||
|
573 | # :command.usage_fixed_flags | |||
|
574 | echo " --help, -h" | |||
|
575 | printf " Show this help\n" | |||
|
576 | echo | |||
|
577 | ||||
|
578 | # :command.usage_args | |||
|
579 | printf "Arguments:\n" | |||
|
580 | ||||
|
581 | echo " SERVICES PARAMS..." | |||
|
582 | printf " Additional arguments or flags for services command\n" | |||
|
583 | echo | |||
|
584 | ||||
|
585 | fi | |||
|
586 | } | |||
|
587 | ||||
|
588 | # :command.usage | |||
|
589 | rccontrol_stack_all_usage() { | |||
|
590 | if [[ -n $long_usage ]]; then | |||
|
591 | printf "rccontrol stack all - run all stacks\n" | |||
|
592 | echo | |||
|
593 | ||||
|
594 | else | |||
|
595 | printf "rccontrol stack all - run all stacks\n" | |||
|
596 | echo | |||
|
597 | ||||
|
598 | fi | |||
|
599 | ||||
|
600 | printf "Usage:\n" | |||
|
601 | printf " rccontrol stack all [SERVICES PARAMS...]\n" | |||
|
602 | printf " rccontrol stack all --help | -h\n" | |||
|
603 | echo | |||
|
604 | ||||
|
605 | # :command.long_usage | |||
|
606 | if [[ -n $long_usage ]]; then | |||
|
607 | printf "Options:\n" | |||
|
608 | ||||
|
609 | # :command.usage_fixed_flags | |||
|
610 | echo " --help, -h" | |||
|
611 | printf " Show this help\n" | |||
|
612 | echo | |||
|
613 | ||||
|
614 | # :command.usage_args | |||
|
615 | printf "Arguments:\n" | |||
|
616 | ||||
|
617 | echo " SERVICES PARAMS..." | |||
|
618 | printf " Additional arguments or flags for services command\n" | |||
446 | echo |
|
619 | echo | |
447 |
|
620 | |||
448 | fi |
|
621 | fi | |
449 | } |
|
622 | } | |
450 |
|
623 | |||
451 | # :command.usage |
|
624 | # :command.usage | |
452 | rccontrol_stack_status_usage() { |
|
625 | rccontrol_stack_status_usage() { | |
453 | if [[ -n $long_usage ]]; then |
|
626 | if [[ -n $long_usage ]]; then | |
454 |
printf "rccontrol stack-status - |
|
627 | printf "rccontrol stack-status - Show stack status\n" | |
455 | echo |
|
628 | echo | |
456 |
|
629 | |||
457 | else |
|
630 | else | |
458 |
printf "rccontrol stack-status - |
|
631 | printf "rccontrol stack-status - Show stack status\n" | |
459 | echo |
|
632 | echo | |
460 |
|
633 | |||
461 | fi |
|
634 | fi | |
462 |
|
635 | |||
463 | printf "Alias: status\n" |
|
636 | printf "Alias: status\n" | |
464 | echo |
|
637 | echo | |
465 |
|
638 | |||
466 | printf "Usage:\n" |
|
639 | printf "Usage:\n" | |
467 | printf " rccontrol stack-status\n" |
|
640 | printf " rccontrol stack-status\n" | |
468 | printf " rccontrol stack-status --help | -h\n" |
|
641 | printf " rccontrol stack-status --help | -h\n" | |
469 | echo |
|
642 | echo | |
470 |
|
643 | |||
471 | # :command.long_usage |
|
644 | # :command.long_usage | |
472 | if [[ -n $long_usage ]]; then |
|
645 | if [[ -n $long_usage ]]; then | |
473 | printf "Options:\n" |
|
646 | printf "Options:\n" | |
474 |
|
647 | |||
475 | # :command.usage_fixed_flags |
|
648 | # :command.usage_fixed_flags | |
476 | echo " --help, -h" |
|
649 | echo " --help, -h" | |
477 | printf " Show this help\n" |
|
650 | printf " Show this help\n" | |
478 | echo |
|
651 | echo | |
479 |
|
652 | |||
480 | fi |
|
653 | fi | |
481 | } |
|
654 | } | |
482 |
|
655 | |||
483 | # :command.usage |
|
656 | # :command.usage | |
484 | rccontrol_stack_upgrade_usage() { |
|
657 | rccontrol_stack_upgrade_usage() { | |
485 | if [[ -n $long_usage ]]; then |
|
658 | if [[ -n $long_usage ]]; then | |
486 | printf "rccontrol stack-upgrade - upgrade ALL stack status\n" |
|
659 | printf "rccontrol stack-upgrade - upgrade ALL stack status\n" | |
487 | echo |
|
660 | echo | |
488 |
|
661 | |||
489 | else |
|
662 | else | |
490 | printf "rccontrol stack-upgrade - upgrade ALL stack status\n" |
|
663 | printf "rccontrol stack-upgrade - upgrade ALL stack status\n" | |
491 | echo |
|
664 | echo | |
492 |
|
665 | |||
493 | fi |
|
666 | fi | |
494 |
|
667 | |||
495 | printf "Usage:\n" |
|
668 | printf "Usage:\n" | |
496 | printf " rccontrol stack-upgrade\n" |
|
669 | printf " rccontrol stack-upgrade\n" | |
497 | printf " rccontrol stack-upgrade --help | -h\n" |
|
670 | printf " rccontrol stack-upgrade --help | -h\n" | |
498 | echo |
|
671 | echo | |
499 |
|
672 | |||
500 | # :command.long_usage |
|
673 | # :command.long_usage | |
501 | if [[ -n $long_usage ]]; then |
|
674 | if [[ -n $long_usage ]]; then | |
502 | printf "Options:\n" |
|
675 | printf "Options:\n" | |
503 |
|
676 | |||
504 | # :command.usage_fixed_flags |
|
677 | # :command.usage_fixed_flags | |
505 | echo " --help, -h" |
|
678 | echo " --help, -h" | |
506 | printf " Show this help\n" |
|
679 | printf " Show this help\n" | |
507 | echo |
|
680 | echo | |
508 |
|
681 | |||
509 | fi |
|
682 | fi | |
510 | } |
|
683 | } | |
511 |
|
684 | |||
512 | # :command.usage |
|
685 | # :command.usage | |
|
686 | rccontrol_cli_usage() { | |||
|
687 | if [[ -n $long_usage ]]; then | |||
|
688 | printf "rccontrol cli - run various CLI tools\n" | |||
|
689 | echo | |||
|
690 | ||||
|
691 | else | |||
|
692 | printf "rccontrol cli - run various CLI tools\n" | |||
|
693 | echo | |||
|
694 | ||||
|
695 | fi | |||
|
696 | ||||
|
697 | printf "Usage:\n" | |||
|
698 | printf " rccontrol cli COMMAND\n" | |||
|
699 | printf " rccontrol cli [COMMAND] --help | -h\n" | |||
|
700 | echo | |||
|
701 | # :command.usage_commands | |||
|
702 | printf "Commands:\n" | |||
|
703 | echo " redis CLI for Redis" | |||
|
704 | echo " db CLI with Database connection" | |||
|
705 | echo " db-upgrade CLI to run db upgrade" | |||
|
706 | echo " storage CLI for repository storage" | |||
|
707 | echo | |||
|
708 | ||||
|
709 | # :command.long_usage | |||
|
710 | if [[ -n $long_usage ]]; then | |||
|
711 | printf "Options:\n" | |||
|
712 | ||||
|
713 | # :command.usage_fixed_flags | |||
|
714 | echo " --help, -h" | |||
|
715 | printf " Show this help\n" | |||
|
716 | echo | |||
|
717 | ||||
|
718 | fi | |||
|
719 | } | |||
|
720 | ||||
|
721 | # :command.usage | |||
513 | rccontrol_cli_redis_usage() { |
|
722 | rccontrol_cli_redis_usage() { | |
514 | if [[ -n $long_usage ]]; then |
|
723 | if [[ -n $long_usage ]]; then | |
515 |
printf "rccontrol cli |
|
724 | printf "rccontrol cli redis - CLI for Redis\n" | |
516 | echo |
|
725 | echo | |
517 |
|
726 | |||
518 | else |
|
727 | else | |
519 |
printf "rccontrol cli |
|
728 | printf "rccontrol cli redis - CLI for Redis\n" | |
520 | echo |
|
729 | echo | |
521 |
|
730 | |||
522 | fi |
|
731 | fi | |
523 |
|
732 | |||
524 | printf "Usage:\n" |
|
733 | printf "Usage:\n" | |
525 |
printf " rccontrol cli |
|
734 | printf " rccontrol cli redis\n" | |
526 |
printf " rccontrol cli |
|
735 | printf " rccontrol cli redis --help | -h\n" | |
527 | echo |
|
736 | echo | |
528 |
|
737 | |||
529 | # :command.long_usage |
|
738 | # :command.long_usage | |
530 | if [[ -n $long_usage ]]; then |
|
739 | if [[ -n $long_usage ]]; then | |
531 | printf "Options:\n" |
|
740 | printf "Options:\n" | |
532 |
|
741 | |||
533 | # :command.usage_fixed_flags |
|
742 | # :command.usage_fixed_flags | |
534 | echo " --help, -h" |
|
743 | echo " --help, -h" | |
535 | printf " Show this help\n" |
|
744 | printf " Show this help\n" | |
536 | echo |
|
745 | echo | |
537 |
|
746 | |||
538 | fi |
|
747 | fi | |
539 | } |
|
748 | } | |
540 |
|
749 | |||
541 | # :command.usage |
|
750 | # :command.usage | |
542 | rccontrol_cli_db_usage() { |
|
751 | rccontrol_cli_db_usage() { | |
543 | if [[ -n $long_usage ]]; then |
|
752 | if [[ -n $long_usage ]]; then | |
544 |
printf "rccontrol cli |
|
753 | printf "rccontrol cli db - CLI with Database connection\n" | |
545 | echo |
|
754 | echo | |
546 |
|
755 | |||
547 | else |
|
756 | else | |
548 |
printf "rccontrol cli |
|
757 | printf "rccontrol cli db - CLI with Database connection\n" | |
549 | echo |
|
758 | echo | |
550 |
|
759 | |||
551 | fi |
|
760 | fi | |
552 |
|
761 | |||
553 | printf "Usage:\n" |
|
762 | printf "Usage:\n" | |
554 |
printf " rccontrol cli |
|
763 | printf " rccontrol cli db\n" | |
555 |
printf " rccontrol cli |
|
764 | printf " rccontrol cli db --help | -h\n" | |
556 | echo |
|
765 | echo | |
557 |
|
766 | |||
558 | # :command.long_usage |
|
767 | # :command.long_usage | |
559 | if [[ -n $long_usage ]]; then |
|
768 | if [[ -n $long_usage ]]; then | |
560 | printf "Options:\n" |
|
769 | printf "Options:\n" | |
561 |
|
770 | |||
562 | # :command.usage_fixed_flags |
|
771 | # :command.usage_fixed_flags | |
563 | echo " --help, -h" |
|
772 | echo " --help, -h" | |
564 | printf " Show this help\n" |
|
773 | printf " Show this help\n" | |
565 | echo |
|
774 | echo | |
566 |
|
775 | |||
567 | fi |
|
776 | fi | |
568 | } |
|
777 | } | |
569 |
|
778 | |||
570 | # :command.usage |
|
779 | # :command.usage | |
571 | rccontrol_cli_db_upgrade_usage() { |
|
780 | rccontrol_cli_db_upgrade_usage() { | |
572 | if [[ -n $long_usage ]]; then |
|
781 | if [[ -n $long_usage ]]; then | |
573 |
printf "rccontrol cli |
|
782 | printf "rccontrol cli db-upgrade - CLI to run db upgrade\n" | |
|
783 | echo | |||
|
784 | ||||
|
785 | else | |||
|
786 | printf "rccontrol cli db-upgrade - CLI to run db upgrade\n" | |||
|
787 | echo | |||
|
788 | ||||
|
789 | fi | |||
|
790 | ||||
|
791 | printf "Usage:\n" | |||
|
792 | printf " rccontrol cli db-upgrade\n" | |||
|
793 | printf " rccontrol cli db-upgrade --help | -h\n" | |||
|
794 | echo | |||
|
795 | ||||
|
796 | # :command.long_usage | |||
|
797 | if [[ -n $long_usage ]]; then | |||
|
798 | printf "Options:\n" | |||
|
799 | ||||
|
800 | # :command.usage_fixed_flags | |||
|
801 | echo " --help, -h" | |||
|
802 | printf " Show this help\n" | |||
|
803 | echo | |||
|
804 | ||||
|
805 | fi | |||
|
806 | } | |||
|
807 | ||||
|
808 | # :command.usage | |||
|
809 | rccontrol_cli_storage_usage() { | |||
|
810 | if [[ -n $long_usage ]]; then | |||
|
811 | printf "rccontrol cli storage - CLI for repository storage\n" | |||
574 | echo |
|
812 | echo | |
575 |
|
813 | |||
576 | else |
|
814 | else | |
577 |
printf "rccontrol cli |
|
815 | printf "rccontrol cli storage - CLI for repository storage\n" | |
578 | echo |
|
816 | echo | |
579 |
|
817 | |||
580 | fi |
|
818 | fi | |
581 |
|
819 | |||
582 | printf "Usage:\n" |
|
820 | printf "Usage:\n" | |
583 |
printf " rccontrol cli |
|
821 | printf " rccontrol cli storage\n" | |
584 |
printf " rccontrol cli |
|
822 | printf " rccontrol cli storage --help | -h\n" | |
585 | echo |
|
823 | echo | |
586 |
|
824 | |||
587 | # :command.long_usage |
|
825 | # :command.long_usage | |
588 | if [[ -n $long_usage ]]; then |
|
826 | if [[ -n $long_usage ]]; then | |
589 | printf "Options:\n" |
|
827 | printf "Options:\n" | |
590 |
|
828 | |||
591 | # :command.usage_fixed_flags |
|
829 | # :command.usage_fixed_flags | |
592 | echo " --help, -h" |
|
830 | echo " --help, -h" | |
593 | printf " Show this help\n" |
|
831 | printf " Show this help\n" | |
594 | echo |
|
832 | echo | |
595 |
|
833 | |||
596 | fi |
|
834 | fi | |
597 | } |
|
835 | } | |
598 |
|
836 | |||
599 | # :command.usage |
|
837 | # :command.usage | |
600 | rccontrol__completions_usage() { |
|
838 | rccontrol__completions_usage() { | |
601 | if [[ -n $long_usage ]]; then |
|
839 | if [[ -n $long_usage ]]; then | |
602 | printf "rccontrol _completions - Generate completions, eval "$(./rccontrol _completions)"\n" |
|
840 | printf "rccontrol _completions - Generate completions, eval "$(./rccontrol _completions)"\n" | |
603 | echo |
|
841 | echo | |
604 |
|
842 | |||
605 | else |
|
843 | else | |
606 | printf "rccontrol _completions - Generate completions, eval "$(./rccontrol _completions)"\n" |
|
844 | printf "rccontrol _completions - Generate completions, eval "$(./rccontrol _completions)"\n" | |
607 | echo |
|
845 | echo | |
608 |
|
846 | |||
609 | fi |
|
847 | fi | |
610 |
|
848 | |||
611 | printf "Usage:\n" |
|
849 | printf "Usage:\n" | |
612 | printf " rccontrol _completions\n" |
|
850 | printf " rccontrol _completions\n" | |
613 | printf " rccontrol _completions --help | -h\n" |
|
851 | printf " rccontrol _completions --help | -h\n" | |
614 | echo |
|
852 | echo | |
615 |
|
853 | |||
616 | # :command.long_usage |
|
854 | # :command.long_usage | |
617 | if [[ -n $long_usage ]]; then |
|
855 | if [[ -n $long_usage ]]; then | |
618 | printf "Options:\n" |
|
856 | printf "Options:\n" | |
619 |
|
857 | |||
620 | # :command.usage_fixed_flags |
|
858 | # :command.usage_fixed_flags | |
621 | echo " --help, -h" |
|
859 | echo " --help, -h" | |
622 | printf " Show this help\n" |
|
860 | printf " Show this help\n" | |
623 | echo |
|
861 | echo | |
624 |
|
862 | |||
625 | fi |
|
863 | fi | |
626 | } |
|
864 | } | |
627 |
|
865 | |||
628 | # :command.usage |
|
866 | # :command.usage | |
629 | rccontrol_backup_db_usage() { |
|
867 | rccontrol_backup_db_usage() { | |
630 | if [[ -n $long_usage ]]; then |
|
868 | if [[ -n $long_usage ]]; then | |
631 | printf "rccontrol backup-db - CLI\n" |
|
869 | printf "rccontrol backup-db - CLI\n" | |
632 | echo |
|
870 | echo | |
633 |
|
871 | |||
634 | else |
|
872 | else | |
635 | printf "rccontrol backup-db - CLI\n" |
|
873 | printf "rccontrol backup-db - CLI\n" | |
636 | echo |
|
874 | echo | |
637 |
|
875 | |||
638 | fi |
|
876 | fi | |
639 |
|
877 | |||
640 | printf "Usage:\n" |
|
878 | printf "Usage:\n" | |
641 | printf " rccontrol backup-db\n" |
|
879 | printf " rccontrol backup-db\n" | |
642 | printf " rccontrol backup-db --help | -h\n" |
|
880 | printf " rccontrol backup-db --help | -h\n" | |
643 | echo |
|
881 | echo | |
644 |
|
882 | |||
645 | # :command.long_usage |
|
883 | # :command.long_usage | |
646 | if [[ -n $long_usage ]]; then |
|
884 | if [[ -n $long_usage ]]; then | |
647 | printf "Options:\n" |
|
885 | printf "Options:\n" | |
648 |
|
886 | |||
649 | # :command.usage_fixed_flags |
|
887 | # :command.usage_fixed_flags | |
650 | echo " --help, -h" |
|
888 | echo " --help, -h" | |
651 | printf " Show this help\n" |
|
889 | printf " Show this help\n" | |
652 | echo |
|
890 | echo | |
653 |
|
891 | |||
654 | # :command.usage_examples |
|
892 | # :command.usage_examples | |
655 | printf "Examples:\n" |
|
893 | printf "Examples:\n" | |
656 | printf " ./rccontrol backup-db\n" |
|
894 | printf " ./rccontrol backup-db\n" | |
657 | echo |
|
895 | echo | |
658 |
|
896 | |||
659 | fi |
|
897 | fi | |
660 | } |
|
898 | } | |
661 |
|
899 | |||
662 | # :command.usage |
|
900 | # :command.usage | |
663 | rccontrol_backup_data_usage() { |
|
901 | rccontrol_backup_data_usage() { | |
664 | if [[ -n $long_usage ]]; then |
|
902 | if [[ -n $long_usage ]]; then | |
665 | printf "rccontrol backup-data - CLI\n" |
|
903 | printf "rccontrol backup-data - CLI\n" | |
666 | echo |
|
904 | echo | |
667 |
|
905 | |||
668 | else |
|
906 | else | |
669 | printf "rccontrol backup-data - CLI\n" |
|
907 | printf "rccontrol backup-data - CLI\n" | |
670 | echo |
|
908 | echo | |
671 |
|
909 | |||
672 | fi |
|
910 | fi | |
673 |
|
911 | |||
674 | printf "Usage:\n" |
|
912 | printf "Usage:\n" | |
675 | printf " rccontrol backup-data\n" |
|
913 | printf " rccontrol backup-data\n" | |
676 | printf " rccontrol backup-data --help | -h\n" |
|
914 | printf " rccontrol backup-data --help | -h\n" | |
677 | echo |
|
915 | echo | |
678 |
|
916 | |||
679 | # :command.long_usage |
|
917 | # :command.long_usage | |
680 | if [[ -n $long_usage ]]; then |
|
918 | if [[ -n $long_usage ]]; then | |
681 | printf "Options:\n" |
|
919 | printf "Options:\n" | |
682 |
|
920 | |||
683 | # :command.usage_fixed_flags |
|
921 | # :command.usage_fixed_flags | |
684 | echo " --help, -h" |
|
922 | echo " --help, -h" | |
685 | printf " Show this help\n" |
|
923 | printf " Show this help\n" | |
686 | echo |
|
924 | echo | |
687 |
|
925 | |||
688 | fi |
|
926 | fi | |
689 | } |
|
927 | } | |
690 |
|
928 | |||
691 | # :command.normalize_input |
|
929 | # :command.normalize_input | |
692 | normalize_input() { |
|
930 | normalize_input() { | |
693 | local arg flags |
|
931 | local arg flags | |
694 |
|
932 | |||
695 | while [[ $# -gt 0 ]]; do |
|
933 | while [[ $# -gt 0 ]]; do | |
696 | arg="$1" |
|
934 | arg="$1" | |
697 | if [[ $arg =~ ^(--[a-zA-Z0-9_\-]+)=(.+)$ ]]; then |
|
935 | if [[ $arg =~ ^(--[a-zA-Z0-9_\-]+)=(.+)$ ]]; then | |
698 | input+=("${BASH_REMATCH[1]}") |
|
936 | input+=("${BASH_REMATCH[1]}") | |
699 | input+=("${BASH_REMATCH[2]}") |
|
937 | input+=("${BASH_REMATCH[2]}") | |
700 | elif [[ $arg =~ ^(-[a-zA-Z0-9])=(.+)$ ]]; then |
|
938 | elif [[ $arg =~ ^(-[a-zA-Z0-9])=(.+)$ ]]; then | |
701 | input+=("${BASH_REMATCH[1]}") |
|
939 | input+=("${BASH_REMATCH[1]}") | |
702 | input+=("${BASH_REMATCH[2]}") |
|
940 | input+=("${BASH_REMATCH[2]}") | |
703 | elif [[ $arg =~ ^-([a-zA-Z0-9][a-zA-Z0-9]+)$ ]]; then |
|
941 | elif [[ $arg =~ ^-([a-zA-Z0-9][a-zA-Z0-9]+)$ ]]; then | |
704 | flags="${BASH_REMATCH[1]}" |
|
942 | flags="${BASH_REMATCH[1]}" | |
705 | for (( i=0 ; i < ${#flags} ; i++ )); do |
|
943 | for (( i=0 ; i < ${#flags} ; i++ )); do | |
706 | input+=("-${flags:i:1}") |
|
944 | input+=("-${flags:i:1}") | |
707 | done |
|
945 | done | |
708 | else |
|
946 | else | |
709 | input+=("$arg") |
|
947 | input+=("$arg") | |
710 | fi |
|
948 | fi | |
711 |
|
949 | |||
712 | shift |
|
950 | shift | |
713 | done |
|
951 | done | |
714 | } |
|
952 | } | |
715 | # :command.inspect_args |
|
953 | # :command.inspect_args | |
716 | inspect_args() { |
|
954 | inspect_args() { | |
717 | readarray -t sorted_keys < <(printf '%s\n' "${!args[@]}" | sort) |
|
955 | readarray -t sorted_keys < <(printf '%s\n' "${!args[@]}" | sort) | |
718 | if (( ${#args[@]} )); then |
|
956 | if (( ${#args[@]} )); then | |
719 | echo args: |
|
957 | echo args: | |
720 | for k in "${sorted_keys[@]}"; do echo "- \${args[$k]} = ${args[$k]}"; done |
|
958 | for k in "${sorted_keys[@]}"; do echo "- \${args[$k]} = ${args[$k]}"; done | |
721 | else |
|
959 | else | |
722 | echo args: none |
|
960 | echo args: none | |
723 | fi |
|
961 | fi | |
724 |
|
962 | |||
725 | if (( ${#other_args[@]} )); then |
|
963 | if (( ${#other_args[@]} )); then | |
726 | echo |
|
964 | echo | |
727 | echo other_args: |
|
965 | echo other_args: | |
728 | echo "- \${other_args[*]} = ${other_args[*]}" |
|
966 | echo "- \${other_args[*]} = ${other_args[*]}" | |
729 | for i in "${!other_args[@]}"; do |
|
967 | for i in "${!other_args[@]}"; do | |
730 | echo "- \${other_args[$i]} = ${other_args[$i]}" |
|
968 | echo "- \${other_args[$i]} = ${other_args[$i]}" | |
731 | done |
|
969 | done | |
732 | fi |
|
970 | fi | |
733 | } |
|
971 | } | |
734 |
|
972 | |||
735 | # :command.user_lib |
|
973 | # :command.user_lib | |
|
974 | # src/lib/check_bootstrap.sh | |||
|
975 | ||||
|
976 | check_bootstrap() { | |||
|
977 | # Avoid destroying bootstrapping by simple start/stop | |||
|
978 | for stage in $BOOTSTRAP_STAGES; do | |||
|
979 | ||||
|
980 | stage_name=$(echo $stage | cut -d ":" -f 1) | |||
|
981 | stage_func=$(echo $stage | cut -d ":" -f 2) | |||
|
982 | if ! config_has_key $stage_name ; then | |||
|
983 | echo "$(yellow WARNING:) bootstrap key $stage_name not found in config file $CONFIG_FILE!" | |||
|
984 | echo "$(yellow NOTICE:) Please run ./rccontrol bootstrap first" | |||
|
985 | exit | |||
|
986 | fi | |||
|
987 | done | |||
|
988 | ||||
|
989 | } | |||
|
990 | ||||
736 | # src/lib/colors.sh |
|
991 | # src/lib/colors.sh | |
737 | print_in_color() { |
|
992 | print_in_color() { | |
738 | local color="$1" |
|
993 | local color="$1" | |
739 | shift |
|
994 | shift | |
740 | if [[ -z ${NO_COLOR+x} ]]; then |
|
995 | if [[ -z ${NO_COLOR+x} ]]; then | |
741 | printf "$color%b\e[0m\n" "$*"; |
|
996 | printf "$color%b\e[0m\n" "$*"; | |
742 | else |
|
997 | else | |
743 | printf "%b\n" "$*"; |
|
998 | printf "%b\n" "$*"; | |
744 | fi |
|
999 | fi | |
745 | } |
|
1000 | } | |
746 |
|
1001 | |||
747 | red() { print_in_color "\e[31m" "$*"; } |
|
1002 | red() { print_in_color "\e[31m" "$*"; } | |
748 | green() { print_in_color "\e[32m" "$*"; } |
|
1003 | green() { print_in_color "\e[32m" "$*"; } | |
749 | yellow() { print_in_color "\e[33m" "$*"; } |
|
1004 | yellow() { print_in_color "\e[33m" "$*"; } | |
750 | blue() { print_in_color "\e[34m" "$*"; } |
|
1005 | blue() { print_in_color "\e[34m" "$*"; } | |
751 | magenta() { print_in_color "\e[35m" "$*"; } |
|
1006 | magenta() { print_in_color "\e[35m" "$*"; } | |
752 | cyan() { print_in_color "\e[36m" "$*"; } |
|
1007 | cyan() { print_in_color "\e[36m" "$*"; } | |
753 | bold() { print_in_color "\e[1m" "$*"; } |
|
1008 | bold() { print_in_color "\e[1m" "$*"; } | |
754 | underlined() { print_in_color "\e[4m" "$*"; } |
|
1009 | underlined() { print_in_color "\e[4m" "$*"; } | |
755 | red_bold() { print_in_color "\e[1;31m" "$*"; } |
|
1010 | red_bold() { print_in_color "\e[1;31m" "$*"; } | |
756 | green_bold() { print_in_color "\e[1;32m" "$*"; } |
|
1011 | green_bold() { print_in_color "\e[1;32m" "$*"; } | |
757 | yellow_bold() { print_in_color "\e[1;33m" "$*"; } |
|
1012 | yellow_bold() { print_in_color "\e[1;33m" "$*"; } | |
758 | blue_bold() { print_in_color "\e[1;34m" "$*"; } |
|
1013 | blue_bold() { print_in_color "\e[1;34m" "$*"; } | |
759 | magenta_bold() { print_in_color "\e[1;35m" "$*"; } |
|
1014 | magenta_bold() { print_in_color "\e[1;35m" "$*"; } | |
760 | cyan_bold() { print_in_color "\e[1;36m" "$*"; } |
|
1015 | cyan_bold() { print_in_color "\e[1;36m" "$*"; } | |
761 | red_underlined() { print_in_color "\e[4;31m" "$*"; } |
|
1016 | red_underlined() { print_in_color "\e[4;31m" "$*"; } | |
762 | green_underlined() { print_in_color "\e[4;32m" "$*"; } |
|
1017 | green_underlined() { print_in_color "\e[4;32m" "$*"; } | |
763 | yellow_underlined() { print_in_color "\e[4;33m" "$*"; } |
|
1018 | yellow_underlined() { print_in_color "\e[4;33m" "$*"; } | |
764 | blue_underlined() { print_in_color "\e[4;34m" "$*"; } |
|
1019 | blue_underlined() { print_in_color "\e[4;34m" "$*"; } | |
765 | magenta_underlined() { print_in_color "\e[4;35m" "$*"; } |
|
1020 | magenta_underlined() { print_in_color "\e[4;35m" "$*"; } | |
766 | cyan_underlined() { print_in_color "\e[4;36m" "$*"; } |
|
1021 | cyan_underlined() { print_in_color "\e[4;36m" "$*"; } | |
767 |
|
1022 | |||
768 | # src/lib/config.sh |
|
1023 | # src/lib/config.sh | |
769 | config_init() { |
|
1024 | config_init() { | |
770 | CONFIG_FILE=${CONFIG_FILE:=config.ini} |
|
1025 | CONFIG_FILE=${CONFIG_FILE:=config.ini} | |
771 | [[ -f "$CONFIG_FILE" ]] || touch "$CONFIG_FILE" |
|
1026 | [[ -f "$CONFIG_FILE" ]] || touch "$CONFIG_FILE" | |
772 | } |
|
1027 | } | |
773 |
|
1028 | |||
774 | config_get() { |
|
1029 | config_get() { | |
775 | local key=$1 |
|
1030 | local key=$1 | |
776 | local regex="^$key *= *(.+)$" |
|
1031 | local regex="^$key *= *(.+)$" | |
777 | local value="" |
|
1032 | local value="" | |
778 |
|
1033 | |||
779 | config_init |
|
1034 | config_init | |
780 |
|
1035 | |||
781 | while IFS= read -r line || [ -n "$line" ]; do |
|
1036 | while IFS= read -r line || [ -n "$line" ]; do | |
782 | if [[ $line =~ $regex ]]; then |
|
1037 | if [[ $line =~ $regex ]]; then | |
783 | value="${BASH_REMATCH[1]}" |
|
1038 | value="${BASH_REMATCH[1]}" | |
784 | break |
|
1039 | break | |
785 | fi |
|
1040 | fi | |
786 | done < "$CONFIG_FILE" |
|
1041 | done < "$CONFIG_FILE" | |
787 |
|
1042 | |||
788 | echo "$value" |
|
1043 | echo "$value" | |
789 | } |
|
1044 | } | |
790 |
|
1045 | |||
791 | config_set() { |
|
1046 | config_set() { | |
792 | local key=$1 |
|
1047 | local key=$1 | |
793 | shift |
|
1048 | shift | |
794 | local value="$*" |
|
1049 | local value="$*" | |
795 |
|
1050 | |||
796 | config_init |
|
1051 | config_init | |
797 |
|
1052 | |||
798 | local regex="^($key) *= *.+$" |
|
1053 | local regex="^($key) *= *.+$" | |
799 | local output="" |
|
1054 | local output="" | |
800 | local found_key="" |
|
1055 | local found_key="" | |
801 | local newline |
|
1056 | local newline | |
802 |
|
1057 | |||
803 | while IFS= read -r line || [ -n "$line" ]; do |
|
1058 | while IFS= read -r line || [ -n "$line" ]; do | |
804 | newline=$line |
|
1059 | newline=$line | |
805 | if [[ $line =~ $regex ]]; then |
|
1060 | if [[ $line =~ $regex ]]; then | |
806 | found_key="${BASH_REMATCH[1]}" |
|
1061 | found_key="${BASH_REMATCH[1]}" | |
807 | newline="$key = $value" |
|
1062 | newline="$key = $value" | |
808 | output="$output$newline\n" |
|
1063 | output="$output$newline\n" | |
809 | elif [[ $line ]]; then |
|
1064 | elif [[ $line ]]; then | |
810 | output="$output$line\n" |
|
1065 | output="$output$line\n" | |
811 | fi |
|
1066 | fi | |
812 | done < "$CONFIG_FILE" |
|
1067 | done < "$CONFIG_FILE" | |
813 |
|
1068 | |||
814 | if [[ -z $found_key ]]; then |
|
1069 | if [[ -z $found_key ]]; then | |
815 | output="$output$key = $value\n" |
|
1070 | output="$output$key = $value\n" | |
816 | fi |
|
1071 | fi | |
817 |
|
1072 | |||
818 | printf "%b\n" "$output" > "$CONFIG_FILE" |
|
1073 | printf "%b\n" "$output" > "$CONFIG_FILE" | |
819 | } |
|
1074 | } | |
820 |
|
1075 | |||
821 | config_del() { |
|
1076 | config_del() { | |
822 | local key=$1 |
|
1077 | local key=$1 | |
823 |
|
1078 | |||
824 | local regex="^($key) *=" |
|
1079 | local regex="^($key) *=" | |
825 | local output="" |
|
1080 | local output="" | |
826 |
|
1081 | |||
827 | config_init |
|
1082 | config_init | |
828 |
|
1083 | |||
829 | while IFS= read -r line || [ -n "$line" ]; do |
|
1084 | while IFS= read -r line || [ -n "$line" ]; do | |
830 | if [[ $line ]] && [[ ! $line =~ $regex ]]; then |
|
1085 | if [[ $line ]] && [[ ! $line =~ $regex ]]; then | |
831 | output="$output$line\n" |
|
1086 | output="$output$line\n" | |
832 | fi |
|
1087 | fi | |
833 | done < "$CONFIG_FILE" |
|
1088 | done < "$CONFIG_FILE" | |
834 |
|
1089 | |||
835 | printf "%b\n" "$output" > "$CONFIG_FILE" |
|
1090 | printf "%b\n" "$output" > "$CONFIG_FILE" | |
836 | } |
|
1091 | } | |
837 |
|
1092 | |||
838 | config_show() { |
|
1093 | config_show() { | |
839 | config_init |
|
1094 | config_init | |
840 | cat "$CONFIG_FILE" |
|
1095 | cat "$CONFIG_FILE" | |
841 | } |
|
1096 | } | |
842 |
|
1097 | |||
843 | config_keys() { |
|
1098 | config_keys() { | |
844 | local regex="^([a-zA-Z0-9_\-\/\.]+) *=" |
|
1099 | local regex="^([a-zA-Z0-9_\-\/\.]+) *=" | |
845 |
|
1100 | |||
846 | config_init |
|
1101 | config_init | |
847 |
|
1102 | |||
848 | local keys=() |
|
1103 | local keys=() | |
849 | local key |
|
1104 | local key | |
850 |
|
1105 | |||
851 | while IFS= read -r line || [ -n "$line" ]; do |
|
1106 | while IFS= read -r line || [ -n "$line" ]; do | |
852 | if [[ $line =~ $regex ]]; then |
|
1107 | if [[ $line =~ $regex ]]; then | |
853 | key="${BASH_REMATCH[1]}" |
|
1108 | key="${BASH_REMATCH[1]}" | |
854 | keys+=("$key") |
|
1109 | keys+=("$key") | |
855 | fi |
|
1110 | fi | |
856 | done < "$CONFIG_FILE" |
|
1111 | done < "$CONFIG_FILE" | |
857 | echo "${keys[@]}" |
|
1112 | echo "${keys[@]}" | |
858 | } |
|
1113 | } | |
859 |
|
1114 | |||
860 | config_has_key() { |
|
1115 | config_has_key() { | |
861 | [[ $(config_get "$1") ]] |
|
1116 | [[ $(config_get "$1") ]] | |
862 | } |
|
1117 | } | |
863 |
|
1118 | |||
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 |
|
1119 | # src/lib/send_completions.sh | |
881 | send_completions() { |
|
1120 | send_completions() { | |
882 | echo $'# rccontrol3 completion -*- shell-script -*-' |
|
1121 | echo $'# rccontrol3 completion -*- shell-script -*-' | |
883 | echo $'' |
|
1122 | echo $'' | |
884 | echo $'# This bash completions script was generated by' |
|
1123 | echo $'# This bash completions script was generated by' | |
885 | echo $'# completely (https://github.com/dannyben/completely)' |
|
1124 | echo $'# completely (https://github.com/dannyben/completely)' | |
886 | echo $'# Modifying it manually is not recommended' |
|
1125 | echo $'# Modifying it manually is not recommended' | |
887 | echo $'' |
|
1126 | echo $'' | |
888 | echo $'_rccontrol3_completions_filter() {' |
|
1127 | echo $'_rccontrol3_completions_filter() {' | |
889 | echo $' local words="$1"' |
|
1128 | echo $' local words="$1"' | |
890 | echo $' local cur=${COMP_WORDS[COMP_CWORD]}' |
|
1129 | echo $' local cur=${COMP_WORDS[COMP_CWORD]}' | |
891 | echo $' local result=()' |
|
1130 | echo $' local result=()' | |
892 | echo $'' |
|
1131 | echo $'' | |
893 | echo $' if [[ "${cur:0:1}" == "-" ]]; then' |
|
1132 | echo $' if [[ "${cur:0:1}" == "-" ]]; then' | |
894 | echo $' echo "$words"' |
|
1133 | echo $' echo "$words"' | |
895 | echo $' ' |
|
1134 | echo $' ' | |
896 | echo $' else' |
|
1135 | echo $' else' | |
897 | echo $' for word in $words; do' |
|
1136 | echo $' for word in $words; do' | |
898 | echo $' [[ "${word:0:1}" != "-" ]] && result+=("$word")' |
|
1137 | echo $' [[ "${word:0:1}" != "-" ]] && result+=("$word")' | |
899 | echo $' done' |
|
1138 | echo $' done' | |
900 | echo $'' |
|
1139 | echo $'' | |
901 | echo $' echo "${result[*]}"' |
|
1140 | echo $' echo "${result[*]}"' | |
902 | echo $'' |
|
1141 | echo $'' | |
903 | echo $' fi' |
|
1142 | echo $' fi' | |
904 | echo $'}' |
|
1143 | echo $'}' | |
905 | echo $'' |
|
1144 | echo $'' | |
906 | echo $'_rccontrol3_completions() {' |
|
1145 | echo $'_rccontrol3_completions() {' | |
907 | echo $' local cur=${COMP_WORDS[COMP_CWORD]}' |
|
1146 | echo $' local cur=${COMP_WORDS[COMP_CWORD]}' | |
908 | echo $' local compwords=("${COMP_WORDS[@]:1:$COMP_CWORD-1}")' |
|
1147 | echo $' local compwords=("${COMP_WORDS[@]:1:$COMP_CWORD-1}")' | |
909 | echo $' local compline="${compwords[*]}"' |
|
1148 | echo $' local compline="${compwords[*]}"' | |
910 | echo $'' |
|
1149 | echo $'' | |
911 | echo $' case "$compline" in' |
|
1150 | echo $' case "$compline" in' | |
912 | echo $' \'upgrade-source\'*)' |
|
1151 | echo $' \'upgrade-source\'*)' | |
913 | echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_rccontrol3_completions_filter "--auth-token --help --server-url -h")" -- "$cur" )' |
|
1152 | echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_rccontrol3_completions_filter "--auth-token --help --server-url -h")" -- "$cur" )' | |
914 | echo $' ;;' |
|
1153 | echo $' ;;' | |
915 | echo $'' |
|
1154 | echo $'' | |
916 | echo $' \'build-source\'*)' |
|
1155 | echo $' \'build-source\'*)' | |
917 | echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_rccontrol3_completions_filter "--help --version-name -h")" -- "$cur" )' |
|
1156 | echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_rccontrol3_completions_filter "--help --version-name -h")" -- "$cur" )' | |
918 | echo $' ;;' |
|
1157 | echo $' ;;' | |
919 | echo $'' |
|
1158 | echo $'' | |
920 | echo $' \'self-update\'*)' |
|
1159 | echo $' \'self-update\'*)' | |
921 | echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_rccontrol3_completions_filter "--auth-token --help --server-url -h")" -- "$cur" )' |
|
1160 | echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_rccontrol3_completions_filter "--auth-token --help --server-url -h")" -- "$cur" )' | |
922 | echo $' ;;' |
|
1161 | echo $' ;;' | |
923 | echo $'' |
|
1162 | echo $'' | |
924 | echo $' \'bootstrap\'*)' |
|
1163 | 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" )' |
|
1164 | echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_rccontrol3_completions_filter "--auth-token --force --help --server-url -f -h")" -- "$cur" )' | |
926 | echo $' ;;' |
|
1165 | echo $' ;;' | |
927 | echo $'' |
|
1166 | echo $'' | |
928 | echo $' \'build\'*)' |
|
1167 | echo $' \'build\'*)' | |
929 | echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_rccontrol3_completions_filter "--help --version-name -h")" -- "$cur" )' |
|
1168 | echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_rccontrol3_completions_filter "--help --version-name -h")" -- "$cur" )' | |
930 | echo $' ;;' |
|
1169 | echo $' ;;' | |
931 | echo $'' |
|
1170 | echo $'' | |
932 | echo $' \'stack\'*)' |
|
1171 | echo $' \'stack\'*)' | |
933 | echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_rccontrol3_completions_filter "--help -h metrics rhodecode router services")" -- "$cur" )' |
|
1172 | echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_rccontrol3_completions_filter "--help -h metrics rhodecode router services")" -- "$cur" )' | |
934 | echo $' ;;' |
|
1173 | echo $' ;;' | |
935 | echo $'' |
|
1174 | echo $'' | |
936 | echo $' *)' |
|
1175 | 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" )' |
|
1176 | 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 $' ;;' |
|
1177 | echo $' ;;' | |
939 | echo $'' |
|
1178 | echo $'' | |
940 | echo $' esac' |
|
1179 | echo $' esac' | |
941 | echo $'} &&' |
|
1180 | echo $'} &&' | |
942 | echo $'complete -F _rccontrol3_completions rccontrol3' |
|
1181 | echo $'complete -F _rccontrol3_completions rccontrol3' | |
943 | echo $'' |
|
1182 | echo $'' | |
944 | echo $'# ex: filetype=sh' |
|
1183 | echo $'# ex: filetype=sh' | |
945 | } |
|
1184 | } | |
946 |
|
1185 | |||
947 | # src/lib/validate_stack_exists.sh |
|
1186 | # src/lib/validate_stack_exists.sh | |
948 |
|
1187 | |||
949 | validate_stack_exists() { |
|
1188 | validate_stack_exists() { | |
950 | err="" |
|
1189 | err="" | |
951 | invalid="1" |
|
1190 | invalid="1" | |
952 |
|
1191 | |||
953 | for item in $VALID_SERVICES |
|
1192 | for item in $VALID_SERVICES | |
954 | do |
|
1193 | do | |
955 | if [ "$1" == "$item" ]; then |
|
1194 | if [ "$1" == "$item" ]; then | |
956 | invalid="" |
|
1195 | invalid="" | |
957 | break |
|
1196 | break | |
958 | fi |
|
1197 | fi | |
959 | done |
|
1198 | done | |
960 |
|
1199 | |||
961 | if [[ -n $invalid ]]; then |
|
1200 | if [[ -n $invalid ]]; then | |
962 | err="command '$1' not in list of $VALID_SERVICES" |
|
1201 | err="command '$1' not in list of $VALID_SERVICES" | |
963 | fi |
|
1202 | fi | |
964 |
|
1203 | |||
965 | echo $err |
|
1204 | echo $err | |
966 | } |
|
1205 | } | |
967 |
|
1206 | |||
968 | # :command.command_functions |
|
1207 | # :command.command_functions | |
969 | # :command.function |
|
1208 | # :command.function | |
970 | rccontrol_self_update_command() { |
|
1209 | rccontrol_self_update_command() { | |
971 | # src/self_update_command.sh |
|
1210 | # src/self_update_command.sh | |
972 | check_bootstrap |
|
1211 | check_bootstrap | |
973 |
|
1212 | |||
974 | echo "# this file is located in 'src/self_update_command.sh'" |
|
1213 | echo "# this file is located in 'src/self_update_command.sh'" | |
975 | echo "# code for 'rccontrol3 self-update' goes here" |
|
1214 | echo "# code for 'rccontrol3 self-update' goes here" | |
976 | echo "# you can edit it freely and regenerate (it will not be overwritten)" |
|
1215 | echo "# you can edit it freely and regenerate (it will not be overwritten)" | |
977 | inspect_args |
|
1216 | inspect_args | |
978 |
|
1217 | |||
979 | } |
|
1218 | } | |
980 |
|
1219 | |||
981 | # :command.function |
|
1220 | # :command.function | |
982 | rccontrol_bootstrap_command() { |
|
1221 | rccontrol_bootstrap_command() { | |
983 | # src/bootstrap_command.sh |
|
1222 | # src/bootstrap_command.sh | |
984 | DEBUG=${args[--debug]} |
|
1223 | DEBUG=${args[--debug]} | |
985 | force=${args[--force]} |
|
1224 | force=${args[--force]} | |
986 |
|
1225 | |||
987 | check_bash_version() { |
|
1226 | check_bash_version() { | |
988 |
|
||||
989 | if [ ! "${BASH_VERSINFO:-0}" -ge 4 ]; then |
|
1227 | if [ ! "${BASH_VERSINFO:-0}" -ge 4 ]; then | |
990 | echo "$(red Bash version 4 or greater is required, please update your bash version!)" |
|
1228 | echo "$(red Bash version 4 or greater is required, please update your bash version!)" | |
991 | exit |
|
1229 | exit | |
992 | fi |
|
1230 | fi | |
993 | } |
|
1231 | } | |
994 |
|
1232 | |||
995 | check_docker() { |
|
1233 | check_docker() { | |
996 | (which docker || which docker.io) &>/dev/null |
|
1234 | (which docker || which docker.io) &>/dev/null | |
997 | } |
|
1235 | } | |
998 |
|
1236 | |||
999 | check_and_install_docker() { |
|
1237 | bootstrap_docker_install() { | |
1000 | failMsg="Failed to find docker on your PATH" |
|
1238 | failMsg="Failed to find docker on your PATH" | |
1001 |
|
1239 | |||
1002 | if ! check_docker; then |
|
1240 | if ! check_docker; then | |
1003 | echo "$failMsg" |
|
1241 | echo "$failMsg" | |
1004 | read -p "Enter to install Docker directly from https://get.docker.com/ or Ctrl+C to exit" |
|
1242 | read -p "Enter to install Docker directly from https://get.docker.com/ or Ctrl+C to exit" | |
1005 | curl https://get.docker.com/ | sh |
|
1243 | curl https://get.docker.com/ | sh | |
1006 |
|
1244 | |||
1007 | if ! check_docker; then |
|
1245 | if ! check_docker; then | |
1008 | echo "$failMsg" |
|
1246 | echo "$failMsg" | |
1009 | echo "Docker install failed. Quitting." |
|
1247 | echo "Docker install failed. Quitting." | |
1010 | exit |
|
1248 | exit | |
1011 | fi |
|
1249 | fi | |
1012 | fi |
|
1250 | fi | |
1013 | } |
|
1251 | } | |
1014 |
|
1252 | |||
1015 | docker_bootstrap() { |
|
1253 | bootstrap_docker_commons() { | |
1016 | check_and_install_docker |
|
1254 | ||
1017 | echo 'Docker: Running bootstrap.' |
|
1255 | echo 'Docker: Running bootstrap.' | |
1018 |
|
1256 | |||
1019 |
echo "Docker: creating |
|
1257 | echo "Docker: creating volume 'rc_datavolume'" | |
1020 | docker volume create --name=rc_datavolume |
|
1258 | docker volume create --label keep=1 --name=rc_datavolume | |
|
1259 | echo "Docker: done" | |||
|
1260 | echo "" | |||
|
1261 | ||||
|
1262 | echo "Docker: creating volume 'rc_reposvolume'" | |||
|
1263 | docker volume create --label keep=1 --name=rc_reposvolume | |||
1021 | echo "Docker: done" |
|
1264 | echo "Docker: done" | |
1022 | echo "" |
|
1265 | echo "" | |
1023 |
|
1266 | |||
1024 | echo "Docker: creating network 'rhodecode_network'" |
|
1267 | echo "Docker: creating network 'rhodecode_network'" | |
1025 | docker network inspect rhodecode_network >/dev/null 2>&1 || docker network create rhodecode_network |
|
1268 | docker network inspect rhodecode_network >/dev/null 2>&1 || docker network create rhodecode_network | |
1026 | echo "Docker: done" |
|
1269 | echo "Docker: done" | |
1027 | echo "" |
|
1270 | echo "" | |
1028 |
|
1271 | |||
1029 | echo "Docker: creating loki logging" |
|
1272 | echo "Docker: creating loki logging" | |
1030 | loki_driver=$(docker plugin ls --format {{.Name}} --filter enabled=true | grep loki || echo "") |
|
1273 | loki_driver=$(docker plugin ls --format {{.Name}} --filter enabled=true | grep loki || echo "") | |
1031 | if [[ $loki_driver == "" ]]; then |
|
1274 | if [[ $loki_driver == "" ]]; then | |
1032 | docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions |
|
1275 | docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions | |
1033 | else |
|
1276 | else | |
1034 | echo "Docker: loki driver already exists" |
|
1277 | echo "Docker: loki driver already exists" | |
1035 | fi |
|
1278 | fi | |
1036 | } |
|
1279 | } | |
1037 |
|
1280 | |||
1038 |
|
|
1281 | bootstrap_config() { | |
1039 |
|
1282 | shared_key=$(echo $RANDOM | md5sum | head -c 32) | ||
1040 | SOURCE_DIR=$PWD |
|
1283 | ||
1041 | RHODECODE_DOCKER_HASH='master' |
|
1284 | if [[ ! -f "$CONFIG_FILE" ]]; then | |
1042 |
|
1285 | echo "init config at: $CONFIG_FILE" | ||
1043 | AUTH_TOKEN=${args[--auth-token]} |
|
1286 | config_init | |
1044 | SERVER_URL=${args[--server-url]} |
|
1287 | else | |
|
1288 | echo "re-using config at: $CONFIG_FILE" | |||
|
1289 | fi | |||
|
1290 | ||||
|
1291 | if ! config_has_key "rc_encrypted_secret" ; then | |||
|
1292 | config_set "rc_encrypted_secret" $shared_key | |||
|
1293 | fi | |||
|
1294 | ||||
|
1295 | if ! config_has_key "rc_db_url" ; then | |||
|
1296 | key=$(echo $RANDOM | md5sum | head -c 32) | |||
|
1297 | config_set "rc_db_url" "postgresql://$DB_USER:$key@database/$DB_NAME" | |||
|
1298 | fi | |||
|
1299 | ||||
|
1300 | if ! config_has_key "rc_license_token" ; then | |||
|
1301 | config_set "rc_license_token" abra-cada-bra1-rce4 | |||
|
1302 | fi | |||
|
1303 | ||||
|
1304 | if ! config_has_key "rc_base_url" ; then | |||
|
1305 | config_set "rc_base_url" http://docker-dev | |||
|
1306 | fi | |||
|
1307 | ||||
|
1308 | if ! config_has_key "rc_log_formatter" ; then | |||
|
1309 | # json is another option | |||
|
1310 | config_set "rc_log_formatter" generic | |||
|
1311 | fi | |||
|
1312 | ||||
|
1313 | if ! config_has_key "rc_use_celery" ; then | |||
|
1314 | config_set "rc_use_celery" true | |||
|
1315 | fi | |||
|
1316 | ||||
|
1317 | if ! config_has_key "channelstream_secret" ; then | |||
|
1318 | config_set "channelstream_secret" $shared_key | |||
|
1319 | fi | |||
|
1320 | ||||
|
1321 | if ! config_has_key "channelstream_admin_secret" ; then | |||
|
1322 | config_set "channelstream_admin_secret" $shared_key | |||
|
1323 | fi | |||
|
1324 | ||||
|
1325 | if ! config_has_key "channelstream_allow_posting_from" ; then | |||
|
1326 | config_set "channelstream_allow_posting_from" 0.0.0.0 | |||
|
1327 | fi | |||
|
1328 | ||||
|
1329 | if ! config_has_key "rc_channelstream_ws_url" ; then | |||
|
1330 | config_set "rc_channelstream_ws_url" ws:/docker-dev/_channelstream | |||
|
1331 | fi | |||
|
1332 | ||||
|
1333 | mkdir -p $PWD/.custom | |||
|
1334 | BOOTSTRAP_RUNTIME_ENV=$PWD/.custom/.runtime.env | |||
|
1335 | if [[ ! -f "$BOOTSTRAP_RUNTIME_ENV" ]]; then | |||
|
1336 | echo "init runtime env config at: $BOOTSTRAP_RUNTIME_ENV" | |||
|
1337 | touch BOOTSTRAP_RUNTIME_ENV | |||
|
1338 | ||||
|
1339 | #ENV_EXPAND="" | |||
|
1340 | for k in $(config_keys); do | |||
|
1341 | k_upper=${k^^} | |||
|
1342 | echo "$k_upper='$(config_get "$k")'" >> $BOOTSTRAP_RUNTIME_ENV | |||
|
1343 | done | |||
|
1344 | ||||
|
1345 | fi | |||
|
1346 | } | |||
|
1347 | ||||
|
1348 | bootstrap_definitions() { | |||
|
1349 | ||||
|
1350 | SOURCE_DIR=$PWD | |||
|
1351 | RHODECODE_DOCKER_HASH='master' | |||
|
1352 | ||||
|
1353 | AUTH_TOKEN=${args[--auth-token]} | |||
|
1354 | SERVER_URL=${args[--server-url]} | |||
1045 |
|
1355 | |||
1046 | DEFINITIONS_EXIST="" |
|
1356 | DEFINITIONS_EXIST="" | |
1047 | CHECK_FILES="rccontrol .env docker-compose-services.yaml docker-compose-apps.yaml" |
|
1357 | CHECK_FILES="\ | |
|
1358 | .env \ | |||
|
1359 | docker-compose-services.yaml \ | |||
|
1360 | docker-compose-apps.yaml \ | |||
|
1361 | docker-compose-metrics.yaml \ | |||
|
1362 | docker-compose-router.yaml \ | |||
|
1363 | " | |||
1048 | for check_file in $CHECK_FILES; do |
|
1364 | for check_file in $CHECK_FILES; do | |
1049 | if [[ -f "$check_file" ]]; then |
|
1365 | if [[ -f "$check_file" ]]; then | |
1050 | DEFINITIONS_EXIST="1" |
|
1366 | DEFINITIONS_EXIST="1" | |
1051 | fi |
|
1367 | fi | |
1052 | done |
|
1368 | done | |
1053 |
|
1369 | |||
1054 | if [[ -n $DEFINITIONS_EXIST && ! $force ]]; then |
|
1370 | if [[ -n $DEFINITIONS_EXIST && ! $force ]]; then | |
1055 | echo "$(yellow skipping docker defs creation, existing files found. Use --force to create them anyway)" |
|
1371 | echo "$(yellow skipping docker defs creation, existing files found. Use --force to create them anyway)" | |
1056 | return |
|
1372 | return | |
1057 | fi |
|
1373 | fi | |
1058 |
|
1374 | |||
1059 | if [[ -n $DEFINITIONS_EXIST ]]; then |
|
1375 | if [[ -n $DEFINITIONS_EXIST ]]; then | |
1060 | echo "$(yellow docker definitions exists, are you sure to force re-create them?)" |
|
1376 | echo "$(yellow docker definitions exists, are you sure to force re-create them?)" | |
1061 | while true; do |
|
1377 | while true; do | |
1062 | read -p "Would you like to continue with overriding file? [yn] " yn |
|
1378 | read -p "Would you like to continue with overriding file? [yn] " yn | |
1063 | case $yn in |
|
1379 | case $yn in | |
1064 | [Yy]*) return 2 ;; |
|
1380 | [Yy]*) return 2 ;; | |
1065 | [Nn]*) exit ;; |
|
1381 | [Nn]*) exit ;; | |
1066 | *) echo "Please answer y or n." ;; |
|
1382 | *) echo "Please answer y or n." ;; | |
1067 | esac |
|
1383 | esac | |
1068 | done |
|
1384 | done | |
1069 | fi |
|
1385 | fi | |
1070 |
|
1386 | |||
1071 | exit |
|
|||
1072 |
|
||||
1073 | # download sources |
|
1387 | # download sources | |
1074 | echo "Files: download rhodecode docker definitions from $SERVER_URL" |
|
1388 | echo "Files: download rhodecode docker definitions from $SERVER_URL" | |
1075 | echo "" |
|
1389 | echo "" | |
1076 |
|
1390 | |||
1077 | if [ $DEBUG ]; then |
|
1391 | if [ $DEBUG ]; then | |
1078 | echo "downloading: $SERVER_URL/rhodecode-enterprise-docker/archive/$RHODECODE_DOCKER_HASH.tgz?with_hash=0" |
|
1392 | 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 |
|
1393 | 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 |
|
1394 | |||
1081 | echo "running CP $SOURCE_DIR/*rhodecode-enterprise-docker-plain/* $SOURCE_DIR" |
|
1395 | 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 |
|
1396 | cp -v -r -f --update --backup=numbered $SOURCE_DIR/*rhodecode-enterprise-docker-plain/* $SOURCE_DIR | |
1083 |
|
1397 | |||
1084 | echo "removing $SOURCE_DIR/*rhodecode-enterprise-docker-plain" |
|
1398 | echo "removing $SOURCE_DIR/*rhodecode-enterprise-docker-plain" | |
1085 | rm -r $SOURCE_DIR/*rhodecode-enterprise-docker-plain |
|
1399 | rm -r $SOURCE_DIR/*rhodecode-enterprise-docker-plain | |
1086 | else |
|
1400 | 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 |
|
1401 | 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 |
|
1402 | |||
1089 | cp -r -f --update --backup=numbered $SOURCE_DIR/*rhodecode-enterprise-docker-plain/* $SOURCE_DIR |
|
1403 | cp -r -f --update --backup=numbered $SOURCE_DIR/*rhodecode-enterprise-docker-plain/* $SOURCE_DIR | |
1090 |
|
1404 | |||
1091 | rm -r $SOURCE_DIR/*rhodecode-enterprise-docker-plain |
|
1405 | rm -r $SOURCE_DIR/*rhodecode-enterprise-docker-plain | |
1092 | fi |
|
1406 | fi | |
1093 |
|
1407 | |||
1094 | echo "$(green_bold DONE: docker definitions extracted to $SOURCE_DIR)" |
|
1408 | echo "$(green_bold DONE: docker definitions extracted to $SOURCE_DIR)" | |
1095 | } |
|
1409 | } | |
1096 |
|
1410 | |||
1097 |
|
|
1411 | bootstrap_overrides() { | |
|
1412 | templates=$(find $PWD/templates/*.yaml -printf "%f\n") | |||
1098 |
|
1413 | |||
1099 | if [[ ! -f "$CONFIG_FILE" ]]; then |
|
1414 | target_dir=$PWD/.custom/ | |
1100 | echo "init config at: $CONFIG_FILE" |
|
1415 | for o_file in $templates; do | |
1101 | config_init |
|
1416 | target_file=$target_dir/$o_file | |
|
1417 | if [[ ! -f "$target_file" ]]; then | |||
|
1418 | echo "copy override file $o_file" | |||
|
1419 | cp -v $PWD/templates/$o_file $target_file | |||
1102 | else |
|
1420 | else | |
1103 | echo "re-using config at: $CONFIG_FILE" |
|
1421 | echo "file $target_file existing, skipping..." | |
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 |
|
1422 | 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 |
|
|
1423 | done | |
1143 |
|
1424 | echo "$(green_bold DONE: overrides extracted to $target_dir)" | ||
1144 | fi |
|
|||
1145 | } |
|
1425 | } | |
1146 |
|
1426 | |||
1147 | cur_date=$(date '+%Y-%m-%d %H:%M:%S') |
|
1427 | cur_date=$(date '+%Y-%m-%d %H:%M:%S') | |
1148 |
|
1428 | |||
1149 | check_bash_version |
|
1429 | check_bash_version | |
1150 |
|
1430 | |||
1151 | if [[ ! -e $BOOTSTRAP_FILE ]]; then |
|
1431 | # Init the config ! | |
1152 | echo "initial bootstrap file $BOOTSTRAP_FILE not found !" |
|
1432 | if [[ ! -f "$CONFIG_FILE" ]]; then | |
|
1433 | echo "config: init new config at: $CONFIG_FILE" | |||
|
1434 | config_init | |||
|
1435 | else | |||
|
1436 | echo "config: re-using present config at: $CONFIG_FILE" | |||
|
1437 | fi | |||
1153 |
|
1438 | |||
1154 | docker_bootstrap |
|
1439 | for stage in $BOOTSTRAP_STAGES; do | |
1155 | definitions_bootstrap |
|
|||
1156 | config_bootstrap |
|
|||
1157 |
|
1440 | |||
1158 | echo "$cur_date" > "$BOOTSTRAP_FILE" |
|
1441 | stage_name=$(echo $stage | cut -d ":" -f 1) | |
|
1442 | stage_func=$(echo $stage | cut -d ":" -f 2) | |||
1159 |
|
1443 | |||
|
1444 | if ! config_has_key $stage_name ; then | |||
|
1445 | echo "$(green \* bootstrap: \'$stage_name\' stage not found\; running now... )" | |||
|
1446 | $stage_func | |||
|
1447 | config_set "$stage_name" $cur_date | |||
1160 | else |
|
1448 | else | |
1161 | if [ $force ]; then |
|
1449 | if [ $force ]; then | |
|
1450 | echo "$(green \* bootstrap: \'$stage_name\' is present!\; FORCE running now... )" | |||
|
1451 | $stage_func $force | |||
|
1452 | config_set "$stage_name" $cur_date | |||
|
1453 | else | |||
|
1454 | echo "$(yellow \* bootstrap: \'$stage_name\' already present, use --force to run it again)" | |||
|
1455 | fi | |||
|
1456 | fi | |||
1162 |
|
1457 | |||
1163 | docker_bootstrap $force |
|
1458 | done | |
1164 | definitions_bootstrap $force ## TODO: remove old |
|
|||
1165 | config_bootstrap $force |
|
|||
1166 |
|
||||
1167 | echo "$cur_date" > "$BOOTSTRAP_FILE" |
|
|||
1168 |
|
1459 | |||
1169 |
|
|
1460 | exit | |
1170 | fi |
|
|||
1171 |
|
||||
1172 | echo "bootstrap file $BOOTSTRAP_FILE was found add --force to force bootstrap" |
|
|||
1173 | fi |
|
|||
1174 |
|
1461 | |||
1175 | get_started |
|
1462 | get_started | |
1176 | } |
|
1463 | } | |
1177 |
|
1464 | |||
1178 | # :command.function |
|
1465 | # :command.function | |
1179 | rccontrol_get_build_artifacts_command() { |
|
1466 | rccontrol_get_build_artifacts_command() { | |
1180 | # src/get_build_artifacts_command.sh |
|
1467 | # src/get_build_artifacts_command.sh | |
1181 | check_bootstrap |
|
1468 | check_bootstrap | |
1182 |
|
1469 | |||
1183 | DEBUG=${args[--debug]} |
|
1470 | DEBUG=${args[--debug]} | |
1184 | AUTH=${args[--auth]} |
|
1471 | AUTH=${args[--auth]} | |
1185 | INSTALLER_URL=${args[--installer-url]} |
|
1472 | INSTALLER_URL=${args[--installer-url]} | |
1186 | MANIFEST_URL=${args[--manifest-url]} |
|
1473 | MANIFEST_URL=${args[--manifest-url]} | |
1187 | RC_VERSION=${args[--version-name]} |
|
1474 | RC_VERSION=${args[--version-name]} | |
1188 | VER=$RC_VERSION |
|
1475 | VER=$RC_VERSION | |
1189 |
|
1476 | |||
1190 | CACHE_DIR=$PWD/.cache |
|
1477 | CACHE_DIR=$PWD/.cache | |
1191 | VER_REGEX="$VER+x86_64" |
|
1478 | VER_REGEX="$VER+x86_64" | |
1192 |
|
1479 | |||
1193 | echo "Downloading Artifacts for version: $VER" |
|
1480 | echo "Downloading Artifacts for version: $VER" | |
1194 |
|
1481 | |||
1195 | echo "1/4 Checking available downloads from MANIFEST file" |
|
1482 | echo "1/4 Checking available downloads from MANIFEST file" | |
1196 |
|
1483 | |||
1197 | ARTS=$(curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" | cut -d ' ' -f 2) |
|
1484 | ARTS=$(curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" | cut -d ' ' -f 2) | |
1198 |
|
1485 | |||
1199 | if [[ $DEBUG ]]; then |
|
1486 | if [[ $DEBUG ]]; then | |
1200 | echo "DEBUG START" |
|
1487 | echo "DEBUG START" | |
1201 | curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" || echo "no regex match" |
|
1488 | 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 |
|
1489 | curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" | cut -d ' ' -f 2 | |
1203 | echo "Found following artifacts:" |
|
1490 | echo "Found following artifacts:" | |
1204 | echo $ARTS |
|
1491 | echo $ARTS | |
1205 | echo "DEBUG END" |
|
1492 | echo "DEBUG END" | |
1206 | fi |
|
1493 | fi | |
1207 |
|
1494 | |||
1208 | if [[ $ARTS == "" ]]; then |
|
1495 | 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" |
|
1496 | 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)" |
|
1497 | echo "$(red $MSG)" | |
1211 | exit |
|
1498 | exit | |
1212 | fi |
|
1499 | fi | |
1213 |
|
1500 | |||
1214 | echo "2/4 Downloading locale-archive" |
|
1501 | echo "2/4 Downloading locale-archive" | |
1215 | curl -L https://dls.rhodecode.com/assets/locale-archive -J -O |
|
1502 | curl -L https://dls.rhodecode.com/assets/locale-archive -J -O | |
1216 | mv -v locale-archive "$CACHE_DIR" |
|
1503 | mv -v locale-archive "$CACHE_DIR" | |
1217 |
|
1504 | |||
1218 | # vcsserver/ce/ee |
|
1505 | # vcsserver/ce/ee | |
1219 | echo "3/4 Downloading installer artifacts" |
|
1506 | echo "3/4 Downloading installer artifacts" | |
1220 | for url in $ARTS; do |
|
1507 | for url in $ARTS; do | |
1221 | echo "Downloading $url with $AUTH" |
|
1508 | echo "Downloading $url with $AUTH" | |
1222 | curl $AUTH --fail-early -L ${url} -J -O |
|
1509 | curl $AUTH --fail-early -L ${url} -J -O | |
1223 | done |
|
1510 | done | |
1224 |
|
1511 | |||
1225 | #for url in $(curl -s $MANIFEST_URL | grep --ignore-case -E 'control.+\+x86_64' | cut -d ' ' -f 2); do |
|
1512 | #for url in $(curl -s $MANIFEST_URL | grep --ignore-case -E 'control.+\+x86_64' | cut -d ' ' -f 2); do | |
1226 | # echo "Downloading $url" |
|
1513 | # echo "Downloading $url" | |
1227 | # curl -L ${url} -J -O |
|
1514 | # curl -L ${url} -J -O | |
1228 | #done |
|
1515 | #done | |
1229 |
|
1516 | |||
1230 | echo "4/4 Downloading installer from $INSTALLER_URL" |
|
1517 | echo "4/4 Downloading installer from $INSTALLER_URL" | |
1231 | curl $AUTH -L $INSTALLER_URL -J -O |
|
1518 | curl $AUTH -L $INSTALLER_URL -J -O | |
1232 |
|
1519 | |||
1233 | INSTALLER=$(ls -Art RhodeCode-installer-* | tail -n 1) |
|
1520 | INSTALLER=$(ls -Art RhodeCode-installer-* | tail -n 1) | |
1234 | if [[ -n $INSTALLER ]]; then |
|
1521 | if [[ -n $INSTALLER ]]; then | |
1235 | chmod +x "${INSTALLER}" |
|
1522 | chmod +x "${INSTALLER}" | |
1236 | fi |
|
1523 | fi | |
1237 |
|
1524 | |||
1238 | echo "Copying artifacts into $CACHE_DIR" |
|
1525 | echo "Copying artifacts into $CACHE_DIR" | |
1239 |
|
1526 | |||
1240 | mv -v "${INSTALLER}" $CACHE_DIR |
|
1527 | mv -v "${INSTALLER}" $CACHE_DIR | |
1241 | mv -v *.bz2 $CACHE_DIR |
|
1528 | mv -v *.bz2 $CACHE_DIR | |
1242 | ls -lh $CACHE_DIR |
|
1529 | ls -lh $CACHE_DIR | |
1243 |
|
1530 | |||
1244 | } |
|
1531 | } | |
1245 |
|
1532 | |||
1246 | # :command.function |
|
1533 | # :command.function | |
1247 | rccontrol_build_command() { |
|
1534 | rccontrol_build_command() { | |
1248 | # src/build_command.sh |
|
1535 | # src/build_command.sh | |
1249 | check_bootstrap |
|
1536 | check_bootstrap | |
1250 |
|
1537 | |||
1251 | rc_version=${args[--version-name]} |
|
1538 | rc_version=${args[--version-name]} | |
1252 | export RC_VERSION=$rc_version |
|
1539 | export RC_VERSION=$rc_version | |
1253 | eval "echo INSTALLER BASED BUILDING${RC_VERSION}" |
|
1540 | eval "echo INSTALLER BASED BUILDING${RC_VERSION}" | |
1254 |
|
1541 | |||
1255 | RC_VERSION=$rc_version ./rccontrol stack rhodecode build --progress plain rhodecode |
|
1542 | RC_VERSION=$rc_version ./rccontrol stack rhodecode build --progress plain rhodecode | |
1256 |
|
1543 | |||
1257 | } |
|
1544 | } | |
1258 |
|
1545 | |||
1259 | # :command.function |
|
1546 | # :command.function | |
1260 | rccontrol_get_build_source_command() { |
|
1547 | rccontrol_get_build_source_command() { | |
1261 | # src/get_build_source_command.sh |
|
1548 | # src/get_build_source_command.sh | |
1262 | check_bootstrap |
|
1549 | check_bootstrap | |
1263 |
|
1550 | |||
1264 | AUTH_TOKEN=${args[--auth-token]} |
|
1551 | AUTH_TOKEN=${args[--auth-token]} | |
1265 | SERVER_URL=${args[--server-url]} |
|
1552 | SERVER_URL=${args[--server-url]} | |
1266 | revision=${args[revision]} |
|
1553 | revision=${args[--revision]} | |
1267 |
|
1554 | |||
1268 | SOURCE_DIR=$PWD/.source |
|
1555 | SOURCE_DIR=$PWD/.source | |
1269 |
|
1556 | |||
1270 | RHODECODE_VCS_HASH=$revision |
|
1557 | RHODECODE_VCS_HASH=$revision | |
1271 | RHODECODE_CE_HASH=$revision |
|
1558 | RHODECODE_CE_HASH=$revision | |
1272 | RHODECODE_EE_HASH=$revision |
|
1559 | RHODECODE_EE_HASH=$revision | |
1273 |
|
1560 | |||
1274 | # download sources |
|
1561 | # download sources | |
1275 | echo "** download rhodecode source for build from $SERVER_URL **" |
|
1562 | echo "** download rhodecode source for build from $SERVER_URL **" | |
1276 |
|
1563 | |||
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 |
|
1564 | 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 |
|
1565 | 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... |
|
1566 | #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 |
|
1567 | 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 |
|
1568 | |||
1282 | rm -rf $SOURCE_DIR/rhodecode-vcsserver && mv $SOURCE_DIR/*rhodecode-vcsserver-plain $SOURCE_DIR/rhodecode-vcsserver |
|
1569 | rm -rf $SOURCE_DIR/rhodecode-vcsserver && \ | |
1283 |
|
|
1570 | mv $SOURCE_DIR/*rhodecode-vcsserver-plain $SOURCE_DIR/rhodecode-vcsserver | |
1284 | rm -rf $SOURCE_DIR/rhodecode-enterprise-ee && cp -r $SOURCE_DIR/*rhodecode-enterprise-ee-plain $SOURCE_DIR/rhodecode-enterprise-ee |
|
1571 | ||
|
1572 | rm -rf $SOURCE_DIR/rhodecode-enterprise-ce && \ | |||
|
1573 | mv $SOURCE_DIR/*rhodecode-enterprise-ce-plain $SOURCE_DIR/rhodecode-enterprise-ce | |||
|
1574 | ||||
|
1575 | rm -rf $SOURCE_DIR/rhodecode-enterprise-ee && \ | |||
|
1576 | mv $SOURCE_DIR/*rhodecode-enterprise-ee-plain $SOURCE_DIR/rhodecode-enterprise-ee | |||
1285 |
|
1577 | |||
1286 | echo "downloading sources done to $SOURCE_DIR" |
|
1578 | echo "downloading sources done to $SOURCE_DIR" | |
|
1579 | ls -l $SOURCE_DIR | |||
1287 |
|
1580 | |||
1288 | } |
|
1581 | } | |
1289 |
|
1582 | |||
1290 | # :command.function |
|
1583 | # :command.function | |
1291 | rccontrol_build_source_command() { |
|
1584 | rccontrol_build_source_command() { | |
1292 | # src/build_source_command.sh |
|
1585 | # src/build_source_command.sh | |
1293 | check_bootstrap |
|
1586 | check_bootstrap | |
1294 |
|
1587 | |||
1295 | rc_version=${args[--version-name]} |
|
1588 | rc_version=${args[--version-name]} | |
1296 | export RC_VERSION=$rc_version |
|
1589 | export RC_VERSION=$rc_version | |
1297 | eval "echo SOURCE BASED BUILDING${RC_VERSION}" |
|
1590 | eval "echo SOURCE BASED BUILDING${RC_VERSION}" | |
1298 |
|
1591 | |||
1299 | RC_VERSION=$rc_version ./rccontrol stack rhodecode -f docker-compose-apps.source.yaml build --progress plain rhodecode |
|
1592 | RC_VERSION=$rc_version ./rccontrol stack rhodecode -f docker-compose-apps.source.yaml build --progress plain rhodecode | |
1300 |
|
1593 | |||
1301 | } |
|
1594 | } | |
1302 |
|
1595 | |||
1303 | # :command.function |
|
1596 | # :command.function | |
1304 | rccontrol_stack_command() { |
|
1597 | rccontrol_stack_router_command() { | |
1305 | # src/stack_command.sh |
|
1598 | # src/stack_router_command.sh | |
1306 | check_bootstrap |
|
1599 | check_bootstrap | |
1307 |
|
1600 | |||
1308 | DEBUG=${args[--debug]} |
|
1601 | DEBUG=${args[--debug]} | |
1309 | service_name=${args[name]} |
|
|||
1310 |
|
1602 | |||
1311 | if [[ ! -f $RC_STACK_ROUTER_EXT ]]; then |
|
1603 | if [[ ! -f $RC_STACK_ROUTER_EXT ]]; then | |
1312 | RC_STACK_ROUTER_EXT="" |
|
1604 | RC_STACK_ROUTER_EXT="" | |
1313 | else |
|
1605 | else | |
1314 | RC_STACK_ROUTER_EXT="-f $RC_STACK_ROUTER_EXT" |
|
1606 | RC_STACK_ROUTER_EXT="-f $RC_STACK_ROUTER_EXT" | |
1315 | fi |
|
1607 | fi | |
1316 |
|
1608 | |||
1317 | CMD_ROUTER="\ |
|
1609 | CMD_ROUTER="\ | |
1318 | docker compose \ |
|
1610 | docker compose \ | |
1319 | --env-file $ENV_FILE \ |
|
1611 | --env-file $ENV_FILE \ | |
1320 | $ENV_EXPAND \ |
|
1612 | $ENV_EXPAND \ | |
1321 | -p rc_cluster_router \ |
|
1613 | -p rc_cluster_router \ | |
1322 | -f docker-compose-base.yaml \ |
|
1614 | -f docker-compose-base.yaml \ | |
1323 | -f docker-compose-router.yaml $RC_STACK_ROUTER_EXT" |
|
1615 | -f docker-compose-router.yaml $RC_STACK_ROUTER_EXT" | |
1324 |
|
1616 | |||
|
1617 | if [[ $DEBUG ]]; then | |||
|
1618 | echo "---" | |||
|
1619 | echo "stacks docker: $RC_STACK_ROUTER_EXT_LCL" | |||
|
1620 | echo "running command: ${CMD_ROUTER}" | |||
|
1621 | echo "ARGS: ${other_args[*]}" | |||
|
1622 | echo "---" | |||
|
1623 | fi | |||
|
1624 | eval "${CMD_ROUTER} ${other_args[*]}" | |||
|
1625 | ||||
|
1626 | } | |||
|
1627 | ||||
|
1628 | # :command.function | |||
|
1629 | rccontrol_stack_metrics_command() { | |||
|
1630 | # src/stack_metrics_command.sh | |||
|
1631 | check_bootstrap | |||
|
1632 | ||||
|
1633 | DEBUG=${args[--debug]} | |||
|
1634 | ||||
|
1635 | if [[ ! -f $RC_STACK_METRICS_EXT ]]; then | |||
|
1636 | RC_STACK_METRICS_EXT_LCL="" | |||
|
1637 | else | |||
|
1638 | RC_STACK_METRICS_EXT_LCL="-f $RC_STACK_METRICS_EXT" | |||
|
1639 | fi | |||
|
1640 | ||||
|
1641 | CMD_METRICS="\ | |||
|
1642 | docker compose \ | |||
|
1643 | --env-file $ENV_FILE \ | |||
|
1644 | $ENV_EXPAND \ | |||
|
1645 | -p rc_cluster_metrics \ | |||
|
1646 | -f docker-compose-base.yaml \ | |||
|
1647 | -f docker-compose-metrics.yaml $RC_STACK_METRICS_EXT_LCL" | |||
|
1648 | ||||
|
1649 | if [[ $DEBUG ]]; then | |||
|
1650 | echo "---" | |||
|
1651 | echo "stacks docker: $RC_STACK_METRICS_EXT_LCL" | |||
|
1652 | echo "running command: ${CMD_METRICS}" | |||
|
1653 | echo "ARGS: ${other_args[*]}" | |||
|
1654 | echo "---" | |||
|
1655 | fi | |||
|
1656 | eval "${CMD_METRICS} ${other_args[*]}" | |||
|
1657 | } | |||
|
1658 | ||||
|
1659 | # :command.function | |||
|
1660 | rccontrol_stack_services_command() { | |||
|
1661 | # src/stack_services_command.sh | |||
|
1662 | check_bootstrap | |||
|
1663 | ||||
|
1664 | DEBUG=${args[--debug]} | |||
|
1665 | ||||
1325 | if [[ ! -f $RC_STACK_SERVICES_EXT ]]; then |
|
1666 | if [[ ! -f $RC_STACK_SERVICES_EXT ]]; then | |
1326 | RC_STACK_SERVICES_EXT_LCL="" |
|
1667 | RC_STACK_SERVICES_EXT_LCL="" | |
1327 | else |
|
1668 | else | |
1328 | RC_STACK_SERVICES_EXT_LCL="-f $RC_STACK_SERVICES_EXT" |
|
1669 | RC_STACK_SERVICES_EXT_LCL="-f $RC_STACK_SERVICES_EXT" | |
1329 | fi |
|
1670 | fi | |
1330 |
|
1671 | |||
1331 | RC_STACK_PROFILES="--profile postgres --profile redis --profile elasticsearch --profile channelstream" |
|
1672 | RC_STACK_PROFILES="--profile postgres --profile redis --profile elasticsearch --profile channelstream" | |
1332 |
|
1673 | |||
1333 | CMD_SERVICES="\ |
|
1674 | CMD_SERVICES="\ | |
1334 | docker compose \ |
|
1675 | docker compose \ | |
1335 | --env-file $ENV_FILE \ |
|
1676 | --env-file $ENV_FILE \ | |
1336 | $ENV_EXPAND \ |
|
1677 | $ENV_EXPAND \ | |
1337 | $RC_STACK_PROFILES \ |
|
1678 | $RC_STACK_PROFILES \ | |
1338 | -p rc_cluster_services \ |
|
1679 | -p rc_cluster_services \ | |
1339 | -f docker-compose-base.yaml \ |
|
1680 | -f docker-compose-base.yaml \ | |
1340 | -f docker-compose-services.yaml $RC_STACK_SERVICES_EXT_LCL" |
|
1681 | -f docker-compose-services.yaml $RC_STACK_SERVICES_EXT_LCL" | |
1341 |
|
1682 | |||
1342 | if [[ ! -f $RC_STACK_METRICS_EXT ]]; then |
|
1683 | if [[ $DEBUG ]]; then | |
1343 | RC_STACK_METRICS_EXT_LCL="" |
|
1684 | echo "---" | |
1344 | else |
|
1685 | echo "stacks docker: $RC_STACK_SERVICES_EXT_LCL" | |
1345 | RC_STACK_METRICS_EXT_LCL="-f $RC_STACK_METRICS_EXT" |
|
1686 | echo "running command: ${CMD_SERVICES}" | |
|
1687 | echo "ARGS: ${other_args[*]}" | |||
|
1688 | echo "---" | |||
1346 | fi |
|
1689 | fi | |
1347 |
|
1690 | |||
1348 | CMD_METRICS="\ |
|
1691 | eval "${CMD_SERVICES} ${other_args[*]}" | |
1349 | docker compose \ |
|
1692 | } | |
1350 | --env-file $ENV_FILE \ |
|
1693 | ||
1351 | $ENV_EXPAND \ |
|
1694 | # :command.function | |
1352 | -p rc_cluster_metrics \ |
|
1695 | rccontrol_stack_rhodecode_command() { | |
1353 | -f docker-compose-base.yaml \ |
|
1696 | # src/stack_rhodecode_command.sh | |
1354 | -f docker-compose-metrics.yaml $RC_STACK_METRICS_EXT_LCL" |
|
1697 | check_bootstrap | |
|
1698 | ||||
|
1699 | DEBUG=${args[--debug]} | |||
1355 |
|
1700 | |||
1356 | if [[ ! -f $RC_STACK_RHODECODE_EXT ]]; then |
|
1701 | if [[ ! -f $RC_STACK_RHODECODE_EXT ]]; then | |
1357 | RC_STACK_RHODECODE_EXT_LCL="" |
|
1702 | RC_STACK_RHODECODE_EXT_LCL="" | |
1358 | else |
|
1703 | else | |
1359 | RC_STACK_RHODECODE_EXT_LCL="-f $RC_STACK_RHODECODE_EXT" |
|
1704 | RC_STACK_RHODECODE_EXT_LCL="-f $RC_STACK_RHODECODE_EXT" | |
1360 | fi |
|
1705 | fi | |
1361 |
|
1706 | |||
1362 | CMD_RHODECODE="\ |
|
1707 | CMD_RHODECODE="\ | |
1363 | docker compose \ |
|
1708 | docker compose \ | |
1364 | --env-file $ENV_FILE \ |
|
1709 | --env-file $ENV_FILE \ | |
1365 | $ENV_EXPAND \ |
|
1710 | $ENV_EXPAND \ | |
1366 | -p rc_cluster_apps \ |
|
1711 | -p rc_cluster_apps \ | |
1367 | -f docker-compose-base.yaml \ |
|
1712 | -f docker-compose-base.yaml \ | |
1368 | -f docker-compose-apps.yaml $RC_STACK_RHODECODE_EXT_LCL" |
|
1713 | -f docker-compose-apps.yaml $RC_STACK_RHODECODE_EXT_LCL" | |
1369 |
|
1714 | |||
1370 | CMD_RHODECODE_SOURCE="\ |
|
1715 | CMD_RHODECODE_SOURCE="\ | |
1371 | docker compose \ |
|
1716 | docker compose \ | |
1372 | --env-file $ENV_FILE \ |
|
1717 | --env-file $ENV_FILE \ | |
1373 | $ENV_EXPAND \ |
|
1718 | $ENV_EXPAND \ | |
1374 | -p rc_cluster_apps \ |
|
1719 | -p rc_cluster_apps \ | |
1375 | -f docker-compose-base.yaml \ |
|
1720 | -f docker-compose-base.yaml \ | |
1376 | -f docker-compose-apps.yaml \ |
|
1721 | -f docker-compose-apps.yaml \ | |
1377 | -f docker-compose-apps.source.yaml $RC_STACK_RHODECODE_EXT_LCL" |
|
1722 | -f docker-compose-apps.source.yaml $RC_STACK_RHODECODE_EXT_LCL" | |
1378 |
|
1723 | |||
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 |
|
|
1724 | if [[ $DEBUG ]]; then | |
1417 |
|
|
1725 | echo "---" | |
1418 |
|
|
1726 | echo "stacks docker: $RC_STACK_RHODECODE_EXT_LCL" | |
1419 |
|
|
1727 | echo "running command: ${CMD_RHODECODE}" | |
1420 |
|
|
1728 | echo "ARGS: ${other_args[*]}" | |
1421 |
|
|
1729 | echo "---" | |
1422 | fi |
|
1730 | fi | |
1423 |
|
|
1731 | eval "${CMD_RHODECODE} ${other_args[*]}" | |
1424 | exit |
|
1732 | ||
1425 | ;; |
|
1733 | } | |
1426 | esac |
|
1734 | ||
|
1735 | # :command.function | |||
|
1736 | rccontrol_stack_all_command() { | |||
|
1737 | # src/stack_all_command.sh | |||
|
1738 | check_bootstrap | |||
|
1739 | ||||
|
1740 | DEBUG=${args[--debug]} | |||
|
1741 | ||||
|
1742 | stack_lst=$VALID_SERVICES | |||
|
1743 | ||||
|
1744 | for stack in $stack_lst; do | |||
|
1745 | ./rccontrol stack $stack ${other_args[*]} | |||
|
1746 | done | |||
1427 |
|
1747 | |||
1428 | } |
|
1748 | } | |
1429 |
|
1749 | |||
1430 | # :command.function |
|
1750 | # :command.function | |
1431 | rccontrol_stack_status_command() { |
|
1751 | rccontrol_stack_status_command() { | |
1432 | # src/stack_status_command.sh |
|
1752 | # src/stack_status_command.sh | |
1433 | check_bootstrap |
|
1753 | check_bootstrap | |
1434 | DEBUG=${args[--debug]} |
|
1754 | DEBUG=${args[--debug]} | |
1435 | if [[ $DEBUG ]]; then |
|
1755 | if [[ $DEBUG ]]; then | |
1436 | echo "---" |
|
1756 | echo "---" | |
1437 |
|
1757 | |||
1438 | ps_cmd=$(docker ps --filter=name=rc_cluster --format="{{.ID}}") |
|
1758 | ps_cmd=$(docker ps --filter=name=rc_cluster --format="{{.ID}}") | |
1439 |
|
1759 | |||
1440 | for service in $ps_cmd; do |
|
1760 | for service in $ps_cmd; do | |
1441 |
|
1761 | |||
1442 | servicename=`docker inspect --format '{{ .Name }}' $service` |
|
1762 | servicename=`docker inspect --format '{{ .Name }}' $service` | |
1443 | servicename=${servicename:1} |
|
1763 | servicename=${servicename:1} | |
1444 | echo $servicename |
|
1764 | echo $servicename | |
1445 | docker inspect $service --format='{{.State.Status}}: {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' |
|
1765 | docker inspect $service --format='{{.State.Status}}: {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' | |
1446 | echo "" |
|
1766 | echo "" | |
1447 |
|
1767 | |||
1448 | done |
|
1768 | done | |
1449 | fi |
|
1769 | fi | |
1450 | echo "---" |
|
1770 | echo "---" | |
1451 | docker ps --filter=name=rc_cluster --format="table {{.ID}}\\t{{.Image}}\\t{{.Status}}\\t{{.Names}}\\t{{.Ports}}" |
|
1771 | docker ps --filter=name=rc_cluster --format="table {{.ID}}\\t{{.Image}}\\t{{.Status}}\\t{{.Names}}\\t{{.Ports}}" | |
1452 | } |
|
1772 | } | |
1453 |
|
1773 | |||
1454 | # :command.function |
|
1774 | # :command.function | |
1455 | rccontrol_stack_upgrade_command() { |
|
1775 | rccontrol_stack_upgrade_command() { | |
1456 | # src/stack_upgrade_command.sh |
|
1776 | # src/stack_upgrade_command.sh | |
1457 | check_bootstrap |
|
1777 | check_bootstrap | |
1458 |
|
1778 | |||
1459 | echo "# this file is located in 'src/stack_upgrade_command.sh'" |
|
1779 | echo "# this file is located in 'src/stack_upgrade_command.sh'" | |
1460 | echo "# code for 'rccontrol stack-upgrade' goes here" |
|
1780 | echo "# code for 'rccontrol stack-upgrade' goes here" | |
1461 | echo "# you can edit it freely and regenerate (it will not be overwritten)" |
|
1781 | echo "# you can edit it freely and regenerate (it will not be overwritten)" | |
1462 | inspect_args |
|
1782 | inspect_args | |
1463 |
|
1783 | |||
1464 | } |
|
1784 | } | |
1465 |
|
1785 | |||
1466 | # :command.function |
|
1786 | # :command.function | |
1467 | rccontrol_cli_redis_command() { |
|
1787 | rccontrol_cli_redis_command() { | |
1468 | # src/cli_redis_command.sh |
|
1788 | # src/cli_redis_command.sh | |
1469 | check_bootstrap |
|
1789 | check_bootstrap | |
1470 |
|
1790 | |||
1471 | DEBUG=${args[--debug]} |
|
1791 | DEBUG=${args[--debug]} | |
1472 |
|
1792 | |||
1473 | target_container=rc_cluster_services-redis-1 |
|
1793 | target_container=rc_cluster_services-redis-1 | |
1474 | docker_id=$(docker ps --filter name=$target_container -q) |
|
1794 | docker_id=$(docker ps --filter name=$target_container -q) | |
1475 |
|
1795 | |||
1476 | if [[ $DEBUG ]]; then |
|
1796 | if [[ $DEBUG ]]; then | |
1477 | echo "container id: $docker_id, based on $target_container filter" |
|
1797 | echo "container id: $docker_id, based on $target_container filter" | |
1478 | docker ps |
|
1798 | docker ps | |
1479 | fi |
|
1799 | fi | |
1480 |
|
1800 | |||
1481 | if [ "$docker_id" == "" ]; then |
|
1801 | if [ "$docker_id" == "" ]; then | |
1482 | MSG="Cannot find container ID with name $target_container" |
|
1802 | MSG="Cannot find container ID with name $target_container" | |
1483 | echo "$(red $MSG)" |
|
1803 | echo "$(red $MSG)" | |
1484 | exit |
|
1804 | exit | |
1485 | fi |
|
1805 | fi | |
1486 |
|
1806 | |||
1487 | if [[ $DEBUG ]]; then |
|
1807 | if [[ $DEBUG ]]; then | |
1488 | echo "Running |docker exec --interactive --tty $docker_id $CMD|" |
|
1808 | echo "Running |docker exec --interactive --tty $docker_id $CMD|" | |
1489 | echo "docker exec --interactive --tty $docker_id /bin/bash -c 'redis-cli'" |
|
1809 | echo "docker exec --interactive --tty $docker_id /bin/bash -c 'redis-cli'" | |
1490 | fi |
|
1810 | fi | |
1491 |
|
1811 | |||
1492 | eval "docker exec --interactive --tty $docker_id /bin/bash -c 'redis-cli'" |
|
1812 | eval "docker exec --interactive --tty $docker_id /bin/bash -c 'redis-cli'" | |
1493 |
|
1813 | |||
1494 | } |
|
1814 | } | |
1495 |
|
1815 | |||
1496 | # :command.function |
|
1816 | # :command.function | |
1497 | rccontrol_cli_db_command() { |
|
1817 | rccontrol_cli_db_command() { | |
1498 | # src/cli_db_command.sh |
|
1818 | # src/cli_db_command.sh | |
1499 | check_bootstrap |
|
1819 | check_bootstrap | |
1500 |
|
1820 | |||
1501 | DEBUG=${args[--debug]} |
|
1821 | DEBUG=${args[--debug]} | |
1502 |
|
1822 | |||
1503 | target_container=rc_cluster_services-database-1 |
|
1823 | target_container=rc_cluster_services-database-1 | |
1504 | docker_id=$(docker ps --filter name=$target_container -q) |
|
1824 | docker_id=$(docker ps --filter name=$target_container -q) | |
1505 |
|
1825 | |||
1506 | if [[ $DEBUG ]]; then |
|
1826 | if [[ $DEBUG ]]; then | |
1507 | echo "container id: $docker_id, based on $target_container filter" |
|
1827 | echo "container id: $docker_id, based on $target_container filter" | |
1508 | docker ps |
|
1828 | docker ps | |
1509 | fi |
|
1829 | fi | |
1510 |
|
1830 | |||
1511 | if [ "$docker_id" == "" ]; then |
|
1831 | if [ "$docker_id" == "" ]; then | |
1512 | MSG="Cannot find container ID with name $target_container" |
|
1832 | MSG="Cannot find container ID with name $target_container" | |
1513 | echo "$(red $MSG)" |
|
1833 | echo "$(red $MSG)" | |
1514 | exit |
|
1834 | exit | |
1515 | fi |
|
1835 | fi | |
1516 |
|
1836 | |||
1517 | if [[ $DEBUG ]]; then |
|
1837 | if [[ $DEBUG ]]; then | |
1518 | echo "Running |docker exec --interactive --tty $docker_id $CMD|" |
|
1838 | 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'" |
|
1839 | echo "docker exec --interactive --tty $docker_id /bin/bash -c 'PGPASSWORD=$DB_PASSWORD psql --username=$DB_USER --dbname=$DB_NAME'" | |
1520 | fi |
|
1840 | fi | |
1521 |
|
1841 | |||
1522 | eval "docker exec --interactive --tty $docker_id /bin/bash -c 'PGPASSWORD=$DB_PASSWORD psql --username=$DB_USER --dbname=$DB_NAME'" |
|
1842 | eval "docker exec --interactive --tty $docker_id /bin/bash -c 'PGPASSWORD=$DB_PASSWORD psql --username=$DB_USER --dbname=$DB_NAME'" | |
1523 |
|
1843 | |||
1524 | } |
|
1844 | } | |
1525 |
|
1845 | |||
1526 | # :command.function |
|
1846 | # :command.function | |
1527 | rccontrol_cli_db_upgrade_command() { |
|
1847 | rccontrol_cli_db_upgrade_command() { | |
1528 | # src/cli_db_upgrade_command.sh |
|
1848 | # src/cli_db_upgrade_command.sh | |
1529 | check_bootstrap |
|
1849 | check_bootstrap | |
1530 |
|
1850 | |||
1531 | DEBUG=${args[--debug]} |
|
1851 | DEBUG=${args[--debug]} | |
1532 |
|
1852 | |||
1533 | target_container=rc_cluster_apps-rhodecode-1 |
|
1853 | target_container=rc_cluster_apps-rhodecode-1 | |
1534 | docker_id=$(docker ps --filter name=$target_container -q) |
|
1854 | docker_id=$(docker ps --filter name=$target_container -q) | |
1535 |
|
1855 | |||
1536 | if [[ $DEBUG ]]; then |
|
1856 | if [[ $DEBUG ]]; then | |
1537 | echo "container id: $docker_id, based on $target_container filter" |
|
1857 | echo "container id: $docker_id, based on $target_container filter" | |
1538 | docker ps |
|
1858 | docker ps | |
1539 | fi |
|
1859 | fi | |
1540 |
|
1860 | |||
1541 | if [ "$docker_id" == "" ]; then |
|
1861 | if [ "$docker_id" == "" ]; then | |
1542 | MSG="Cannot find container ID with name $target_container" |
|
1862 | MSG="Cannot find container ID with name $target_container" | |
1543 | echo "$(red $MSG)" |
|
1863 | echo "$(red $MSG)" | |
1544 | exit |
|
1864 | exit | |
1545 | fi |
|
1865 | fi | |
1546 |
|
1866 | |||
1547 | if [[ $DEBUG ]]; then |
|
1867 | 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" |
|
1868 | 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 |
|
1869 | fi | |
1550 |
|
1870 | |||
1551 | ./rccontrol stack rhodecode exec rhodecode /usr/local/bin/rhodecode_bin/bin/rc-upgrade-db /etc/rhodecode/conf/rhodecode.optimized.ini --force-yes |
|
1871 | ./rccontrol stack rhodecode exec rhodecode /usr/local/bin/rhodecode_bin/bin/rc-upgrade-db /etc/rhodecode/conf/rhodecode.optimized.ini --force-yes | |
1552 | } |
|
1872 | } | |
1553 |
|
1873 | |||
1554 | # :command.function |
|
1874 | # :command.function | |
1555 |
rccontrol_ |
|
1875 | rccontrol_cli_storage_command() { | |
1556 |
# src/ |
|
1876 | # src/cli_storage_command.sh | |
1557 | send_completions |
|
|||
1558 | } |
|
|||
1559 |
|
||||
1560 | # :command.function |
|
|||
1561 | rccontrol_backup_db_command() { |
|
|||
1562 | # src/backup_db_command.sh |
|
|||
1563 | check_bootstrap |
|
1877 | check_bootstrap | |
1564 |
|
1878 | |||
1565 | DEBUG=${args[--debug]} |
|
1879 | DEBUG=${args[--debug]} | |
1566 | DESTINATION=${args[destination]} |
|
|||
1567 |
|
1880 | |||
1568 | target_container=rc_cluster_services-database-1 |
|
1881 | source $ENV_FILE | |
|
1882 | target_container=$RC_IMAGE_EE | |||
1569 |
|
1883 | |||
1570 | docker_id=$(docker ps --filter name=$target_container -q) |
|
1884 | image_id=$(docker image ls $RC_IMAGE_EE -q) | |
1571 | backup_name=rc_db_dump-$(date +%Y-%m-%d).tar.gz |
|
|||
1572 |
|
1885 | |||
1573 | echo "creating backup $backup_name" |
|
1886 | echo "Attaching storage from $target_container" | |
1574 |
|
1887 | |||
1575 | if [[ $DEBUG ]]; then |
|
1888 | if [[ $DEBUG ]]; then | |
1576 |
echo " |
|
1889 | echo "image id: $image_id, based on $target_container filter" | |
1577 |
docker |
|
1890 | docker image ls | |
1578 | echo "---" |
|
1891 | echo "---" | |
1579 | fi |
|
1892 | fi | |
1580 |
|
1893 | |||
1581 | #image_id=$(docker inspect "$docker_id" --format {{.Image}} | cut -c 8-) |
|
1894 | if [[ $DEBUG ]]; then | |
|
1895 | echo "rc_datavolume inspection..." | |||
|
1896 | docker volume inspect rc_datavolume | |||
|
1897 | ||||
|
1898 | echo "rhodecode_repos inspection..." | |||
|
1899 | docker volume inspect rhodecode_repos | |||
|
1900 | fi | |||
|
1901 | ||||
|
1902 | # | |||
|
1903 | #if [[ $DEBUG ]]; then | |||
|
1904 | # echo "image id: $image_id, based on $target_container filter" | |||
|
1905 | # docker image ls | |||
|
1906 | # echo "---" | |||
|
1907 | #fi | |||
|
1908 | ||||
|
1909 | docker run --rm \ | |||
|
1910 | -it \ | |||
|
1911 | --volume $PWD/.custom/storage:/vol/backupvolume \ | |||
|
1912 | --volume rc_datavolume:/vol/datavolume \ | |||
|
1913 | --volume rc_reposvolume:/vol/repovolume \ | |||
|
1914 | --workdir="/vol" \ | |||
|
1915 | debian:jessie \ | |||
|
1916 | /bin/bash | |||
|
1917 | ||||
|
1918 | } | |||
|
1919 | ||||
|
1920 | # :command.function | |||
|
1921 | rccontrol__completions_command() { | |||
|
1922 | # src/_completions_command.sh | |||
|
1923 | send_completions | |||
|
1924 | } | |||
|
1925 | ||||
|
1926 | # :command.function | |||
|
1927 | rccontrol_backup_db_command() { | |||
|
1928 | # src/backup_db_command.sh | |||
|
1929 | check_bootstrap | |||
|
1930 | ||||
|
1931 | DEBUG=${args[--debug]} | |||
|
1932 | DESTINATION=${args[destination]} | |||
|
1933 | ||||
|
1934 | target_container=rc_cluster_services-database-1 | |||
|
1935 | ||||
|
1936 | docker_id=$(docker ps --filter name=$target_container -q) | |||
|
1937 | backup_name=rc_db_dump-$(date +%Y-%m-%d).sql.gz | |||
|
1938 | ||||
|
1939 | echo "creating backup $backup_name" | |||
|
1940 | ||||
|
1941 | if [[ $DEBUG ]]; then | |||
|
1942 | echo "container id: $docker_id, based on $target_container filter" | |||
|
1943 | docker ps | |||
|
1944 | echo "---" | |||
|
1945 | fi | |||
|
1946 | ||||
|
1947 | #image_id=$(docker inspect "$docker_id" --format {{.Image}} | cut -c 8-) | |||
1582 | # |
|
1948 | # | |
1583 | #if [[ $DEBUG ]]; then |
|
1949 | #if [[ $DEBUG ]]; then | |
1584 | # echo "image id: $image_id, based on $target_container filter" |
|
1950 | # echo "image id: $image_id, based on $target_container filter" | |
1585 | # docker image ls |
|
1951 | # docker image ls | |
1586 | # echo "---" |
|
1952 | # echo "---" | |
1587 | #fi |
|
1953 | #fi | |
1588 |
|
1954 | |||
1589 | if [ "$docker_id" == "" ]; then |
|
1955 | if [ "$docker_id" == "" ]; then | |
1590 | MSG="Cannot find container ID with name $target_container" |
|
1956 | MSG="Cannot find container ID with name $target_container" | |
1591 | echo "$(red $MSG)" |
|
1957 | echo "$(red $MSG)" | |
1592 | exit |
|
1958 | exit | |
1593 | fi |
|
1959 | fi | |
1594 |
|
1960 | |||
1595 | #if [ "image_id" == "" ]; then |
|
1961 | #if [ "image_id" == "" ]; then | |
1596 | # MSG="Cannot find image ID with name $target_container" |
|
1962 | # MSG="Cannot find image ID with name $target_container" | |
1597 | # echo "$(red $MSG)" |
|
1963 | # echo "$(red $MSG)" | |
1598 | # exit |
|
1964 | # exit | |
1599 | #fi |
|
1965 | #fi | |
|
1966 | # docker exec -i your-db-container psql -U your-db-user -d your-db-name gunzip < your_dump.sql.gz | | |||
1600 |
|
1967 | |||
1601 | if [[ $DEBUG ]]; then |
|
1968 | 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'" |
|
1969 | echo "docker exec -e PGPASSWORD=$DB_PASSWORD $docker_id /bin/bash -c 'mkdir -p /var/rc-data-dump && pg_dump --inserts -U $DB_USER -h 127.0.0.1 --dbname=$DB_NAME | gzip > /var/rc-data-dump/$backup_name'" | |
|
1970 | echo "dump placed in /var/rc-data-dump/$backup_name" | |||
|
1971 | echo "run docker cp $docker_id:/var/rc-data-dump/$backup_name $PWD to copy the file into your host machine" | |||
1603 | fi |
|
1972 | fi | |
1604 |
|
1973 | |||
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'" |
|
1974 | 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 !)" |
|
1975 | echo "$(green Backup created in /var/rc-data-dump/ mount !)" | |
1607 |
|
1976 | |||
1608 | } |
|
1977 | } | |
1609 |
|
1978 | |||
1610 | # :command.function |
|
1979 | # :command.function | |
1611 | rccontrol_backup_data_command() { |
|
1980 | rccontrol_backup_data_command() { | |
1612 | # src/backup_data_command.sh |
|
1981 | # src/backup_data_command.sh | |
1613 | echo "# this file is located in 'src/backup_data_command.sh'" |
|
1982 | echo "# this file is located in 'src/backup_data_command.sh'" | |
1614 | echo "# code for 'rccontrol backup-data' goes here" |
|
1983 | echo "# code for 'rccontrol backup-data' goes here" | |
1615 | echo "# you can edit it freely and regenerate (it will not be overwritten)" |
|
1984 | echo "# you can edit it freely and regenerate (it will not be overwritten)" | |
1616 | inspect_args |
|
1985 | inspect_args | |
1617 |
|
1986 | |||
1618 | } |
|
1987 | } | |
1619 |
|
1988 | |||
1620 | # :command.parse_requirements |
|
1989 | # :command.parse_requirements | |
1621 | parse_requirements() { |
|
1990 | parse_requirements() { | |
1622 | # :command.fixed_flags_filter |
|
1991 | # :command.fixed_flags_filter | |
1623 | case "${1:-}" in |
|
1992 | case "${1:-}" in | |
1624 | --version | -v ) |
|
1993 | --version | -v ) | |
1625 | version_command |
|
1994 | version_command | |
1626 | exit |
|
1995 | exit | |
1627 | ;; |
|
1996 | ;; | |
1628 |
|
1997 | |||
1629 | --help | -h ) |
|
1998 | --help | -h ) | |
1630 | long_usage=yes |
|
1999 | long_usage=yes | |
1631 | rccontrol_usage |
|
2000 | rccontrol_usage | |
1632 | exit |
|
2001 | exit | |
1633 | ;; |
|
2002 | ;; | |
1634 |
|
2003 | |||
1635 | # :flag.case |
|
2004 | # :flag.case | |
1636 | --debug ) |
|
2005 | --debug ) | |
1637 |
|
2006 | |||
1638 | # :flag.case_no_arg |
|
2007 | # :flag.case_no_arg | |
1639 | args[--debug]=1 |
|
2008 | args[--debug]=1 | |
1640 | shift |
|
2009 | shift | |
1641 | ;; |
|
2010 | ;; | |
1642 |
|
2011 | |||
1643 | esac |
|
2012 | esac | |
1644 |
|
2013 | |||
1645 | # :command.environment_variables_filter |
|
2014 | # :command.environment_variables_filter | |
1646 | # :command.environment_variables_default |
|
2015 | # :command.environment_variables_default | |
1647 | export RC_CLI_VERSION_NAME="${RC_CLI_VERSION_NAME:-4.27.0}" |
|
2016 | 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}" |
|
2017 | 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}" |
|
2018 | 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}" |
|
2019 | 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}" |
|
2020 | export RC_STACK_RHODECODE_EXT="${RC_STACK_RHODECODE_EXT:-.custom/docker-compose-apps.override.yaml}" | |
1652 |
|
2021 | |||
1653 | # :command.command_filter |
|
2022 | # :command.command_filter | |
1654 | action=${1:-} |
|
2023 | action=${1:-} | |
1655 |
|
2024 | |||
1656 | case $action in |
|
2025 | case $action in | |
1657 | -* ) |
|
2026 | -* ) | |
1658 | ;; |
|
2027 | ;; | |
1659 |
|
2028 | |||
1660 | self-update ) |
|
2029 | self-update ) | |
1661 | action="self-update" |
|
2030 | action="self-update" | |
1662 | shift |
|
2031 | shift | |
1663 | rccontrol_self_update_parse_requirements "$@" |
|
2032 | rccontrol_self_update_parse_requirements "$@" | |
1664 | shift $# |
|
2033 | shift $# | |
1665 | ;; |
|
2034 | ;; | |
1666 |
|
2035 | |||
1667 |
bootstrap | in |
|
2036 | bootstrap | init ) | |
1668 | action="bootstrap" |
|
2037 | action="bootstrap" | |
1669 | shift |
|
2038 | shift | |
1670 | rccontrol_bootstrap_parse_requirements "$@" |
|
2039 | rccontrol_bootstrap_parse_requirements "$@" | |
1671 | shift $# |
|
2040 | shift $# | |
1672 | ;; |
|
2041 | ;; | |
1673 |
|
2042 | |||
1674 | get-build-artifacts ) |
|
2043 | get-build-artifacts ) | |
1675 | action="get-build-artifacts" |
|
2044 | action="get-build-artifacts" | |
1676 | shift |
|
2045 | shift | |
1677 | rccontrol_get_build_artifacts_parse_requirements "$@" |
|
2046 | rccontrol_get_build_artifacts_parse_requirements "$@" | |
1678 | shift $# |
|
2047 | shift $# | |
1679 | ;; |
|
2048 | ;; | |
1680 |
|
2049 | |||
1681 | build ) |
|
2050 | build ) | |
1682 | action="build" |
|
2051 | action="build" | |
1683 | shift |
|
2052 | shift | |
1684 | rccontrol_build_parse_requirements "$@" |
|
2053 | rccontrol_build_parse_requirements "$@" | |
1685 | shift $# |
|
2054 | shift $# | |
1686 | ;; |
|
2055 | ;; | |
1687 |
|
2056 | |||
1688 | get-build-source ) |
|
2057 | get-build-source ) | |
1689 | action="get-build-source" |
|
2058 | action="get-build-source" | |
1690 | shift |
|
2059 | shift | |
1691 | rccontrol_get_build_source_parse_requirements "$@" |
|
2060 | rccontrol_get_build_source_parse_requirements "$@" | |
1692 | shift $# |
|
2061 | shift $# | |
1693 | ;; |
|
2062 | ;; | |
1694 |
|
2063 | |||
1695 | build-source ) |
|
2064 | build-source ) | |
1696 | action="build-source" |
|
2065 | action="build-source" | |
1697 | shift |
|
2066 | shift | |
1698 | rccontrol_build_source_parse_requirements "$@" |
|
2067 | rccontrol_build_source_parse_requirements "$@" | |
1699 | shift $# |
|
2068 | shift $# | |
1700 | ;; |
|
2069 | ;; | |
1701 |
|
2070 | |||
1702 | stack ) |
|
2071 | stack ) | |
1703 | action="stack" |
|
2072 | action="stack" | |
1704 | shift |
|
2073 | shift | |
1705 | rccontrol_stack_parse_requirements "$@" |
|
2074 | rccontrol_stack_parse_requirements "$@" | |
1706 | shift $# |
|
2075 | shift $# | |
1707 | ;; |
|
2076 | ;; | |
1708 |
|
2077 | |||
1709 | stack-status | status ) |
|
2078 | stack-status | status ) | |
1710 | action="stack-status" |
|
2079 | action="stack-status" | |
1711 | shift |
|
2080 | shift | |
1712 | rccontrol_stack_status_parse_requirements "$@" |
|
2081 | rccontrol_stack_status_parse_requirements "$@" | |
1713 | shift $# |
|
2082 | shift $# | |
1714 | ;; |
|
2083 | ;; | |
1715 |
|
2084 | |||
1716 | stack-upgrade ) |
|
2085 | stack-upgrade ) | |
1717 | action="stack-upgrade" |
|
2086 | action="stack-upgrade" | |
1718 | shift |
|
2087 | shift | |
1719 | rccontrol_stack_upgrade_parse_requirements "$@" |
|
2088 | rccontrol_stack_upgrade_parse_requirements "$@" | |
1720 | shift $# |
|
2089 | shift $# | |
1721 | ;; |
|
2090 | ;; | |
1722 |
|
2091 | |||
1723 |
cli |
|
2092 | cli ) | |
1724 |
action="cli |
|
2093 | action="cli" | |
1725 | shift |
|
2094 | shift | |
1726 |
rccontrol_cli_ |
|
2095 | rccontrol_cli_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 $# |
|
2096 | shift $# | |
1742 | ;; |
|
2097 | ;; | |
1743 |
|
2098 | |||
1744 | _completions ) |
|
2099 | _completions ) | |
1745 | action="_completions" |
|
2100 | action="_completions" | |
1746 | shift |
|
2101 | shift | |
1747 | rccontrol__completions_parse_requirements "$@" |
|
2102 | rccontrol__completions_parse_requirements "$@" | |
1748 | shift $# |
|
2103 | shift $# | |
1749 | ;; |
|
2104 | ;; | |
1750 |
|
2105 | |||
1751 | backup-db ) |
|
2106 | backup-db ) | |
1752 | action="backup-db" |
|
2107 | action="backup-db" | |
1753 | shift |
|
2108 | shift | |
1754 | rccontrol_backup_db_parse_requirements "$@" |
|
2109 | rccontrol_backup_db_parse_requirements "$@" | |
1755 | shift $# |
|
2110 | shift $# | |
1756 | ;; |
|
2111 | ;; | |
1757 |
|
2112 | |||
1758 | backup-data ) |
|
2113 | backup-data ) | |
1759 | action="backup-data" |
|
2114 | action="backup-data" | |
1760 | shift |
|
2115 | shift | |
1761 | rccontrol_backup_data_parse_requirements "$@" |
|
2116 | rccontrol_backup_data_parse_requirements "$@" | |
1762 | shift $# |
|
2117 | shift $# | |
1763 | ;; |
|
2118 | ;; | |
1764 |
|
2119 | |||
1765 | # :command.command_fallback |
|
2120 | # :command.command_fallback | |
1766 | "" ) |
|
2121 | "" ) | |
1767 | rccontrol_usage >&2 |
|
2122 | rccontrol_usage >&2 | |
1768 | exit 1 |
|
2123 | exit 1 | |
1769 | ;; |
|
2124 | ;; | |
1770 |
|
2125 | |||
1771 | * ) |
|
2126 | * ) | |
1772 | printf "invalid command: %s\n" "$action" >&2 |
|
2127 | printf "invalid command: %s\n" "$action" >&2 | |
1773 | exit 1 |
|
2128 | exit 1 | |
1774 | ;; |
|
2129 | ;; | |
1775 |
|
2130 | |||
1776 | esac |
|
2131 | esac | |
1777 |
|
2132 | |||
1778 | # :command.parse_requirements_while |
|
2133 | # :command.parse_requirements_while | |
1779 | while [[ $# -gt 0 ]]; do |
|
2134 | while [[ $# -gt 0 ]]; do | |
1780 | key="$1" |
|
2135 | key="$1" | |
1781 | case "$key" in |
|
2136 | case "$key" in | |
1782 |
|
2137 | |||
1783 | -?* ) |
|
2138 | -?* ) | |
1784 | printf "invalid option: %s\n" "$key" >&2 |
|
2139 | printf "invalid option: %s\n" "$key" >&2 | |
1785 | exit 1 |
|
2140 | exit 1 | |
1786 | ;; |
|
2141 | ;; | |
1787 |
|
2142 | |||
1788 | * ) |
|
2143 | * ) | |
1789 | # :command.parse_requirements_case |
|
2144 | # :command.parse_requirements_case | |
1790 | # :command.parse_requirements_case_simple |
|
2145 | # :command.parse_requirements_case_simple | |
1791 | printf "invalid argument: %s\n" "$key" >&2 |
|
2146 | printf "invalid argument: %s\n" "$key" >&2 | |
1792 | exit 1 |
|
2147 | exit 1 | |
1793 |
|
2148 | |||
1794 | ;; |
|
2149 | ;; | |
1795 |
|
2150 | |||
1796 | esac |
|
2151 | esac | |
1797 | done |
|
2152 | done | |
1798 |
|
2153 | |||
1799 | } |
|
2154 | } | |
1800 |
|
2155 | |||
1801 | # :command.parse_requirements |
|
2156 | # :command.parse_requirements | |
1802 | rccontrol_self_update_parse_requirements() { |
|
2157 | rccontrol_self_update_parse_requirements() { | |
1803 | # :command.fixed_flags_filter |
|
2158 | # :command.fixed_flags_filter | |
1804 | case "${1:-}" in |
|
2159 | case "${1:-}" in | |
1805 | --help | -h ) |
|
2160 | --help | -h ) | |
1806 | long_usage=yes |
|
2161 | long_usage=yes | |
1807 | rccontrol_self_update_usage |
|
2162 | rccontrol_self_update_usage | |
1808 | exit |
|
2163 | exit | |
1809 | ;; |
|
2164 | ;; | |
1810 |
|
2165 | |||
1811 | esac |
|
2166 | esac | |
1812 |
|
2167 | |||
1813 | # :command.dependencies_filter |
|
2168 | # :command.dependencies_filter | |
1814 | if ! [[ -x "$(command -v curl)" ]]; then |
|
2169 | if ! [[ -x "$(command -v curl)" ]]; then | |
1815 | printf "missing dependency: curl\n" >&2 |
|
2170 | printf "missing dependency: curl\n" >&2 | |
1816 | exit 1 |
|
2171 | exit 1 | |
1817 | fi |
|
2172 | fi | |
1818 | if ! [[ -x "$(command -v tar)" ]]; then |
|
2173 | if ! [[ -x "$(command -v tar)" ]]; then | |
1819 | printf "missing dependency: tar\n" >&2 |
|
2174 | printf "missing dependency: tar\n" >&2 | |
1820 | exit 1 |
|
2175 | exit 1 | |
1821 | fi |
|
2176 | fi | |
1822 |
|
2177 | |||
1823 | # :command.command_filter |
|
2178 | # :command.command_filter | |
1824 | action="self-update" |
|
2179 | action="self-update" | |
1825 |
|
2180 | |||
1826 | # :command.parse_requirements_while |
|
2181 | # :command.parse_requirements_while | |
1827 | while [[ $# -gt 0 ]]; do |
|
2182 | while [[ $# -gt 0 ]]; do | |
1828 | key="$1" |
|
2183 | key="$1" | |
1829 | case "$key" in |
|
2184 | case "$key" in | |
1830 | # :flag.case |
|
2185 | # :flag.case | |
1831 | --auth-token ) |
|
2186 | --auth-token ) | |
1832 |
|
2187 | |||
1833 | # :flag.case_arg |
|
2188 | # :flag.case_arg | |
1834 | if [[ -n ${2+x} ]]; then |
|
2189 | if [[ -n ${2+x} ]]; then | |
1835 |
|
2190 | |||
1836 | args[--auth-token]="$2" |
|
2191 | args[--auth-token]="$2" | |
1837 | shift |
|
2192 | shift | |
1838 | shift |
|
2193 | shift | |
1839 | else |
|
2194 | else | |
1840 | printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2 |
|
2195 | printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2 | |
1841 | exit 1 |
|
2196 | exit 1 | |
1842 | fi |
|
2197 | fi | |
1843 | ;; |
|
2198 | ;; | |
1844 |
|
2199 | |||
1845 | # :flag.case |
|
2200 | # :flag.case | |
1846 | --server-url ) |
|
2201 | --server-url ) | |
1847 |
|
2202 | |||
1848 | # :flag.case_arg |
|
2203 | # :flag.case_arg | |
1849 | if [[ -n ${2+x} ]]; then |
|
2204 | if [[ -n ${2+x} ]]; then | |
1850 |
|
2205 | |||
1851 | args[--server-url]="$2" |
|
2206 | args[--server-url]="$2" | |
1852 | shift |
|
2207 | shift | |
1853 | shift |
|
2208 | shift | |
1854 | else |
|
2209 | else | |
1855 | printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2 |
|
2210 | printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2 | |
1856 | exit 1 |
|
2211 | exit 1 | |
1857 | fi |
|
2212 | fi | |
1858 | ;; |
|
2213 | ;; | |
1859 |
|
2214 | |||
1860 | -?* ) |
|
2215 | -?* ) | |
1861 | printf "invalid option: %s\n" "$key" >&2 |
|
2216 | printf "invalid option: %s\n" "$key" >&2 | |
1862 | exit 1 |
|
2217 | exit 1 | |
1863 | ;; |
|
2218 | ;; | |
1864 |
|
2219 | |||
1865 | * ) |
|
2220 | * ) | |
1866 | # :command.parse_requirements_case |
|
2221 | # :command.parse_requirements_case | |
1867 | # :command.parse_requirements_case_simple |
|
2222 | # :command.parse_requirements_case_simple | |
1868 | printf "invalid argument: %s\n" "$key" >&2 |
|
2223 | printf "invalid argument: %s\n" "$key" >&2 | |
1869 | exit 1 |
|
2224 | exit 1 | |
1870 |
|
2225 | |||
1871 | ;; |
|
2226 | ;; | |
1872 |
|
2227 | |||
1873 | esac |
|
2228 | esac | |
1874 | done |
|
2229 | done | |
1875 |
|
2230 | |||
1876 | # :command.default_assignments |
|
2231 | # :command.default_assignments | |
1877 | [[ -n ${args[--server-url]:-} ]] || args[--server-url]="https://code.rhodecode.com" |
|
2232 | [[ -n ${args[--server-url]:-} ]] || args[--server-url]="https://code.rhodecode.com" | |
1878 |
|
2233 | |||
1879 | } |
|
2234 | } | |
1880 |
|
2235 | |||
1881 | # :command.parse_requirements |
|
2236 | # :command.parse_requirements | |
1882 | rccontrol_bootstrap_parse_requirements() { |
|
2237 | rccontrol_bootstrap_parse_requirements() { | |
1883 | # :command.fixed_flags_filter |
|
2238 | # :command.fixed_flags_filter | |
1884 | case "${1:-}" in |
|
2239 | case "${1:-}" in | |
1885 | --help | -h ) |
|
2240 | --help | -h ) | |
1886 | long_usage=yes |
|
2241 | long_usage=yes | |
1887 | rccontrol_bootstrap_usage |
|
2242 | rccontrol_bootstrap_usage | |
1888 | exit |
|
2243 | exit | |
1889 | ;; |
|
2244 | ;; | |
1890 |
|
2245 | |||
1891 | esac |
|
2246 | esac | |
1892 |
|
2247 | |||
1893 | # :command.dependencies_filter |
|
2248 | # :command.dependencies_filter | |
1894 | if ! [[ -x "$(command -v curl)" ]]; then |
|
2249 | if ! [[ -x "$(command -v curl)" ]]; then | |
1895 | printf "missing dependency: curl\n" >&2 |
|
2250 | printf "missing dependency: curl\n" >&2 | |
1896 | exit 1 |
|
2251 | exit 1 | |
1897 | fi |
|
2252 | fi | |
1898 | if ! [[ -x "$(command -v tar)" ]]; then |
|
2253 | if ! [[ -x "$(command -v tar)" ]]; then | |
1899 | printf "missing dependency: tar\n" >&2 |
|
2254 | printf "missing dependency: tar\n" >&2 | |
1900 | exit 1 |
|
2255 | exit 1 | |
1901 | fi |
|
2256 | fi | |
1902 | if ! [[ -x "$(command -v md5sum)" ]]; then |
|
2257 | if ! [[ -x "$(command -v md5sum)" ]]; then | |
1903 | printf "missing dependency: md5sum\n" >&2 |
|
2258 | printf "missing dependency: md5sum\n" >&2 | |
1904 | exit 1 |
|
2259 | exit 1 | |
1905 | fi |
|
2260 | fi | |
1906 |
|
2261 | |||
1907 | # :command.command_filter |
|
2262 | # :command.command_filter | |
1908 | action="bootstrap" |
|
2263 | action="bootstrap" | |
1909 |
|
2264 | |||
1910 | # :command.parse_requirements_while |
|
2265 | # :command.parse_requirements_while | |
1911 | while [[ $# -gt 0 ]]; do |
|
2266 | while [[ $# -gt 0 ]]; do | |
1912 | key="$1" |
|
2267 | key="$1" | |
1913 | case "$key" in |
|
2268 | case "$key" in | |
1914 | # :flag.case |
|
2269 | # :flag.case | |
1915 | --force | -f ) |
|
2270 | --force | -f ) | |
1916 |
|
2271 | |||
1917 | # :flag.case_no_arg |
|
2272 | # :flag.case_no_arg | |
1918 | args[--force]=1 |
|
2273 | args[--force]=1 | |
1919 | shift |
|
2274 | shift | |
1920 | ;; |
|
2275 | ;; | |
1921 |
|
2276 | |||
1922 | # :flag.case |
|
2277 | # :flag.case | |
1923 | --auth-token ) |
|
2278 | --auth-token ) | |
1924 |
|
2279 | |||
1925 | # :flag.case_arg |
|
2280 | # :flag.case_arg | |
1926 | if [[ -n ${2+x} ]]; then |
|
2281 | if [[ -n ${2+x} ]]; then | |
1927 |
|
2282 | |||
1928 | args[--auth-token]="$2" |
|
2283 | args[--auth-token]="$2" | |
1929 | shift |
|
2284 | shift | |
1930 | shift |
|
2285 | shift | |
1931 | else |
|
2286 | else | |
1932 | printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2 |
|
2287 | printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2 | |
1933 | exit 1 |
|
2288 | exit 1 | |
1934 | fi |
|
2289 | fi | |
1935 | ;; |
|
2290 | ;; | |
1936 |
|
2291 | |||
1937 | # :flag.case |
|
2292 | # :flag.case | |
1938 | --server-url ) |
|
2293 | --server-url ) | |
1939 |
|
2294 | |||
1940 | # :flag.case_arg |
|
2295 | # :flag.case_arg | |
1941 | if [[ -n ${2+x} ]]; then |
|
2296 | if [[ -n ${2+x} ]]; then | |
1942 |
|
2297 | |||
1943 | args[--server-url]="$2" |
|
2298 | args[--server-url]="$2" | |
1944 | shift |
|
2299 | shift | |
1945 | shift |
|
2300 | shift | |
1946 | else |
|
2301 | else | |
1947 | printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2 |
|
2302 | printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2 | |
1948 | exit 1 |
|
2303 | exit 1 | |
1949 | fi |
|
2304 | fi | |
1950 | ;; |
|
2305 | ;; | |
1951 |
|
2306 | |||
1952 | -?* ) |
|
2307 | -?* ) | |
1953 | printf "invalid option: %s\n" "$key" >&2 |
|
2308 | printf "invalid option: %s\n" "$key" >&2 | |
1954 | exit 1 |
|
2309 | exit 1 | |
1955 | ;; |
|
2310 | ;; | |
1956 |
|
2311 | |||
1957 | * ) |
|
2312 | * ) | |
1958 | # :command.parse_requirements_case |
|
2313 | # :command.parse_requirements_case | |
1959 | # :command.parse_requirements_case_simple |
|
2314 | # :command.parse_requirements_case_simple | |
1960 | printf "invalid argument: %s\n" "$key" >&2 |
|
2315 | printf "invalid argument: %s\n" "$key" >&2 | |
1961 | exit 1 |
|
2316 | exit 1 | |
1962 |
|
2317 | |||
1963 | ;; |
|
2318 | ;; | |
1964 |
|
2319 | |||
1965 | esac |
|
2320 | esac | |
1966 | done |
|
2321 | done | |
1967 |
|
2322 | |||
1968 | # :command.default_assignments |
|
2323 | # :command.default_assignments | |
1969 | [[ -n ${args[--server-url]:-} ]] || args[--server-url]="https://code.rhodecode.com" |
|
2324 | [[ -n ${args[--server-url]:-} ]] || args[--server-url]="https://code.rhodecode.com" | |
1970 |
|
2325 | |||
1971 | } |
|
2326 | } | |
1972 |
|
2327 | |||
1973 | # :command.parse_requirements |
|
2328 | # :command.parse_requirements | |
1974 | rccontrol_get_build_artifacts_parse_requirements() { |
|
2329 | rccontrol_get_build_artifacts_parse_requirements() { | |
1975 | # :command.fixed_flags_filter |
|
2330 | # :command.fixed_flags_filter | |
1976 | case "${1:-}" in |
|
2331 | case "${1:-}" in | |
1977 | --help | -h ) |
|
2332 | --help | -h ) | |
1978 | long_usage=yes |
|
2333 | long_usage=yes | |
1979 | rccontrol_get_build_artifacts_usage |
|
2334 | rccontrol_get_build_artifacts_usage | |
1980 | exit |
|
2335 | exit | |
1981 | ;; |
|
2336 | ;; | |
1982 |
|
2337 | |||
1983 | esac |
|
2338 | esac | |
1984 |
|
2339 | |||
1985 | # :command.command_filter |
|
2340 | # :command.command_filter | |
1986 | action="get-build-artifacts" |
|
2341 | action="get-build-artifacts" | |
1987 |
|
2342 | |||
1988 | # :command.parse_requirements_while |
|
2343 | # :command.parse_requirements_while | |
1989 | while [[ $# -gt 0 ]]; do |
|
2344 | while [[ $# -gt 0 ]]; do | |
1990 | key="$1" |
|
2345 | key="$1" | |
1991 | case "$key" in |
|
2346 | case "$key" in | |
1992 | # :flag.case |
|
2347 | # :flag.case | |
1993 | --auth ) |
|
2348 | --auth ) | |
1994 |
|
2349 | |||
1995 | # :flag.case_arg |
|
2350 | # :flag.case_arg | |
1996 | if [[ -n ${2+x} ]]; then |
|
2351 | if [[ -n ${2+x} ]]; then | |
1997 |
|
2352 | |||
1998 | args[--auth]="$2" |
|
2353 | args[--auth]="$2" | |
1999 | shift |
|
2354 | shift | |
2000 | shift |
|
2355 | shift | |
2001 | else |
|
2356 | else | |
2002 | printf "%s\n" "--auth requires an argument: --auth AUTH" >&2 |
|
2357 | printf "%s\n" "--auth requires an argument: --auth AUTH" >&2 | |
2003 | exit 1 |
|
2358 | exit 1 | |
2004 | fi |
|
2359 | fi | |
2005 | ;; |
|
2360 | ;; | |
2006 |
|
2361 | |||
2007 | # :flag.case |
|
2362 | # :flag.case | |
2008 | --installer-url ) |
|
2363 | --installer-url ) | |
2009 |
|
2364 | |||
2010 | # :flag.case_arg |
|
2365 | # :flag.case_arg | |
2011 | if [[ -n ${2+x} ]]; then |
|
2366 | if [[ -n ${2+x} ]]; then | |
2012 |
|
2367 | |||
2013 | args[--installer-url]="$2" |
|
2368 | args[--installer-url]="$2" | |
2014 | shift |
|
2369 | shift | |
2015 | shift |
|
2370 | shift | |
2016 | else |
|
2371 | else | |
2017 | printf "%s\n" "--installer-url requires an argument: --installer-url INSTALLER_URL" >&2 |
|
2372 | printf "%s\n" "--installer-url requires an argument: --installer-url INSTALLER_URL" >&2 | |
2018 | exit 1 |
|
2373 | exit 1 | |
2019 | fi |
|
2374 | fi | |
2020 | ;; |
|
2375 | ;; | |
2021 |
|
2376 | |||
2022 | # :flag.case |
|
2377 | # :flag.case | |
2023 | --manifest-url ) |
|
2378 | --manifest-url ) | |
2024 |
|
2379 | |||
2025 | # :flag.case_arg |
|
2380 | # :flag.case_arg | |
2026 | if [[ -n ${2+x} ]]; then |
|
2381 | if [[ -n ${2+x} ]]; then | |
2027 |
|
2382 | |||
2028 | args[--manifest-url]="$2" |
|
2383 | args[--manifest-url]="$2" | |
2029 | shift |
|
2384 | shift | |
2030 | shift |
|
2385 | shift | |
2031 | else |
|
2386 | else | |
2032 | printf "%s\n" "--manifest-url requires an argument: --manifest-url MANIFEST_URL" >&2 |
|
2387 | printf "%s\n" "--manifest-url requires an argument: --manifest-url MANIFEST_URL" >&2 | |
2033 | exit 1 |
|
2388 | exit 1 | |
2034 | fi |
|
2389 | fi | |
2035 | ;; |
|
2390 | ;; | |
2036 |
|
2391 | |||
2037 | # :flag.case |
|
2392 | # :flag.case | |
2038 | --version-name ) |
|
2393 | --version-name ) | |
2039 |
|
2394 | |||
2040 | # :flag.case_arg |
|
2395 | # :flag.case_arg | |
2041 | if [[ -n ${2+x} ]]; then |
|
2396 | if [[ -n ${2+x} ]]; then | |
2042 |
|
2397 | |||
2043 | args[--version-name]="$2" |
|
2398 | args[--version-name]="$2" | |
2044 | shift |
|
2399 | shift | |
2045 | shift |
|
2400 | shift | |
2046 | else |
|
2401 | else | |
2047 | printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2 |
|
2402 | printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2 | |
2048 | exit 1 |
|
2403 | exit 1 | |
2049 | fi |
|
2404 | fi | |
2050 | ;; |
|
2405 | ;; | |
2051 |
|
2406 | |||
2052 | -?* ) |
|
2407 | -?* ) | |
2053 | printf "invalid option: %s\n" "$key" >&2 |
|
2408 | printf "invalid option: %s\n" "$key" >&2 | |
2054 | exit 1 |
|
2409 | exit 1 | |
|
2410 | ;; | |||
|
2411 | ||||
|
2412 | * ) | |||
|
2413 | # :command.parse_requirements_case | |||
|
2414 | # :command.parse_requirements_case_simple | |||
|
2415 | printf "invalid argument: %s\n" "$key" >&2 | |||
|
2416 | exit 1 | |||
|
2417 | ||||
|
2418 | ;; | |||
|
2419 | ||||
|
2420 | esac | |||
|
2421 | done | |||
|
2422 | ||||
|
2423 | # :command.default_assignments | |||
|
2424 | [[ -n ${args[--auth]:-} ]] || args[--auth]="" | |||
|
2425 | [[ -n ${args[--installer-url]:-} ]] || args[--installer-url]="https://dls.rhodecode.com/dls/N2E2ZTY1NzA3NjYxNDA2NTc1NjI3MTcyNzA2MjcxNzIyZTcwNjI3YQ==/rhodecode-control/latest-linux-ee" | |||
|
2426 | [[ -n ${args[--manifest-url]:-} ]] || args[--manifest-url]="https://dls.rhodecode.com/linux/MANIFEST" | |||
|
2427 | [[ -n ${args[--version-name]:-} ]] || args[--version-name]="$RC_CLI_VERSION_NAME" | |||
|
2428 | ||||
|
2429 | } | |||
|
2430 | ||||
|
2431 | # :command.parse_requirements | |||
|
2432 | rccontrol_build_parse_requirements() { | |||
|
2433 | # :command.fixed_flags_filter | |||
|
2434 | case "${1:-}" in | |||
|
2435 | --help | -h ) | |||
|
2436 | long_usage=yes | |||
|
2437 | rccontrol_build_usage | |||
|
2438 | exit | |||
|
2439 | ;; | |||
|
2440 | ||||
|
2441 | esac | |||
|
2442 | ||||
|
2443 | # :command.command_filter | |||
|
2444 | action="build" | |||
|
2445 | ||||
|
2446 | # :command.parse_requirements_while | |||
|
2447 | while [[ $# -gt 0 ]]; do | |||
|
2448 | key="$1" | |||
|
2449 | case "$key" in | |||
|
2450 | # :flag.case | |||
|
2451 | --version-name ) | |||
|
2452 | ||||
|
2453 | # :flag.case_arg | |||
|
2454 | if [[ -n ${2+x} ]]; then | |||
|
2455 | ||||
|
2456 | args[--version-name]="$2" | |||
|
2457 | shift | |||
|
2458 | shift | |||
|
2459 | else | |||
|
2460 | printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2 | |||
|
2461 | exit 1 | |||
|
2462 | fi | |||
|
2463 | ;; | |||
|
2464 | ||||
|
2465 | -?* ) | |||
|
2466 | printf "invalid option: %s\n" "$key" >&2 | |||
|
2467 | exit 1 | |||
|
2468 | ;; | |||
|
2469 | ||||
|
2470 | * ) | |||
|
2471 | # :command.parse_requirements_case | |||
|
2472 | # :command.parse_requirements_case_simple | |||
|
2473 | printf "invalid argument: %s\n" "$key" >&2 | |||
|
2474 | exit 1 | |||
|
2475 | ||||
|
2476 | ;; | |||
|
2477 | ||||
|
2478 | esac | |||
|
2479 | done | |||
|
2480 | ||||
|
2481 | # :command.default_assignments | |||
|
2482 | [[ -n ${args[--version-name]:-} ]] || args[--version-name]="$RC_CLI_VERSION_NAME" | |||
|
2483 | ||||
|
2484 | } | |||
|
2485 | ||||
|
2486 | # :command.parse_requirements | |||
|
2487 | rccontrol_get_build_source_parse_requirements() { | |||
|
2488 | # :command.fixed_flags_filter | |||
|
2489 | case "${1:-}" in | |||
|
2490 | --help | -h ) | |||
|
2491 | long_usage=yes | |||
|
2492 | rccontrol_get_build_source_usage | |||
|
2493 | exit | |||
|
2494 | ;; | |||
|
2495 | ||||
|
2496 | esac | |||
|
2497 | ||||
|
2498 | # :command.dependencies_filter | |||
|
2499 | if ! [[ -x "$(command -v curl)" ]]; then | |||
|
2500 | printf "missing dependency: curl\n" >&2 | |||
|
2501 | exit 1 | |||
|
2502 | fi | |||
|
2503 | if ! [[ -x "$(command -v tar)" ]]; then | |||
|
2504 | printf "missing dependency: tar\n" >&2 | |||
|
2505 | exit 1 | |||
|
2506 | fi | |||
|
2507 | ||||
|
2508 | # :command.command_filter | |||
|
2509 | action="get-build-source" | |||
|
2510 | ||||
|
2511 | # :command.parse_requirements_while | |||
|
2512 | while [[ $# -gt 0 ]]; do | |||
|
2513 | key="$1" | |||
|
2514 | case "$key" in | |||
|
2515 | # :flag.case | |||
|
2516 | --revision ) | |||
|
2517 | ||||
|
2518 | # :flag.case_arg | |||
|
2519 | if [[ -n ${2+x} ]]; then | |||
|
2520 | ||||
|
2521 | args[--revision]="$2" | |||
|
2522 | shift | |||
|
2523 | shift | |||
|
2524 | else | |||
|
2525 | printf "%s\n" "--revision requires an argument: --revision REVISION" >&2 | |||
|
2526 | exit 1 | |||
|
2527 | fi | |||
|
2528 | ;; | |||
|
2529 | ||||
|
2530 | # :flag.case | |||
|
2531 | --auth-token ) | |||
|
2532 | ||||
|
2533 | # :flag.case_arg | |||
|
2534 | if [[ -n ${2+x} ]]; then | |||
|
2535 | ||||
|
2536 | args[--auth-token]="$2" | |||
|
2537 | shift | |||
|
2538 | shift | |||
|
2539 | else | |||
|
2540 | printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2 | |||
|
2541 | exit 1 | |||
|
2542 | fi | |||
|
2543 | ;; | |||
|
2544 | ||||
|
2545 | # :flag.case | |||
|
2546 | --server-url ) | |||
|
2547 | ||||
|
2548 | # :flag.case_arg | |||
|
2549 | if [[ -n ${2+x} ]]; then | |||
|
2550 | ||||
|
2551 | args[--server-url]="$2" | |||
|
2552 | shift | |||
|
2553 | shift | |||
|
2554 | else | |||
|
2555 | printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2 | |||
|
2556 | exit 1 | |||
|
2557 | fi | |||
|
2558 | ;; | |||
|
2559 | ||||
|
2560 | -?* ) | |||
|
2561 | printf "invalid option: %s\n" "$key" >&2 | |||
|
2562 | exit 1 | |||
|
2563 | ;; | |||
|
2564 | ||||
|
2565 | * ) | |||
|
2566 | # :command.parse_requirements_case | |||
|
2567 | # :command.parse_requirements_case_simple | |||
|
2568 | printf "invalid argument: %s\n" "$key" >&2 | |||
|
2569 | exit 1 | |||
|
2570 | ||||
|
2571 | ;; | |||
|
2572 | ||||
|
2573 | esac | |||
|
2574 | done | |||
|
2575 | ||||
|
2576 | # :command.default_assignments | |||
|
2577 | [[ -n ${args[--revision]:-} ]] || args[--revision]="default" | |||
|
2578 | [[ -n ${args[--server-url]:-} ]] || args[--server-url]="https://code.rhodecode.com" | |||
|
2579 | ||||
|
2580 | } | |||
|
2581 | ||||
|
2582 | # :command.parse_requirements | |||
|
2583 | rccontrol_build_source_parse_requirements() { | |||
|
2584 | # :command.fixed_flags_filter | |||
|
2585 | case "${1:-}" in | |||
|
2586 | --help | -h ) | |||
|
2587 | long_usage=yes | |||
|
2588 | rccontrol_build_source_usage | |||
|
2589 | exit | |||
|
2590 | ;; | |||
|
2591 | ||||
|
2592 | esac | |||
|
2593 | ||||
|
2594 | # :command.command_filter | |||
|
2595 | action="build-source" | |||
|
2596 | ||||
|
2597 | # :command.parse_requirements_while | |||
|
2598 | while [[ $# -gt 0 ]]; do | |||
|
2599 | key="$1" | |||
|
2600 | case "$key" in | |||
|
2601 | # :flag.case | |||
|
2602 | --version-name ) | |||
|
2603 | ||||
|
2604 | # :flag.case_arg | |||
|
2605 | if [[ -n ${2+x} ]]; then | |||
|
2606 | ||||
|
2607 | args[--version-name]="$2" | |||
|
2608 | shift | |||
|
2609 | shift | |||
|
2610 | else | |||
|
2611 | printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2 | |||
|
2612 | exit 1 | |||
|
2613 | fi | |||
|
2614 | ;; | |||
|
2615 | ||||
|
2616 | -?* ) | |||
|
2617 | printf "invalid option: %s\n" "$key" >&2 | |||
|
2618 | exit 1 | |||
|
2619 | ;; | |||
|
2620 | ||||
|
2621 | * ) | |||
|
2622 | # :command.parse_requirements_case | |||
|
2623 | # :command.parse_requirements_case_simple | |||
|
2624 | printf "invalid argument: %s\n" "$key" >&2 | |||
|
2625 | exit 1 | |||
|
2626 | ||||
|
2627 | ;; | |||
|
2628 | ||||
|
2629 | esac | |||
|
2630 | done | |||
|
2631 | ||||
|
2632 | # :command.default_assignments | |||
|
2633 | [[ -n ${args[--version-name]:-} ]] || args[--version-name]="$RC_CLI_VERSION_NAME" | |||
|
2634 | ||||
|
2635 | } | |||
|
2636 | ||||
|
2637 | # :command.parse_requirements | |||
|
2638 | rccontrol_stack_parse_requirements() { | |||
|
2639 | # :command.fixed_flags_filter | |||
|
2640 | case "${1:-}" in | |||
|
2641 | --help | -h ) | |||
|
2642 | long_usage=yes | |||
|
2643 | rccontrol_stack_usage | |||
|
2644 | exit | |||
|
2645 | ;; | |||
|
2646 | ||||
|
2647 | esac | |||
|
2648 | ||||
|
2649 | # :command.command_filter | |||
|
2650 | action=${1:-} | |||
|
2651 | ||||
|
2652 | case $action in | |||
|
2653 | -* ) | |||
|
2654 | ;; | |||
|
2655 | ||||
|
2656 | router ) | |||
|
2657 | action="router" | |||
|
2658 | shift | |||
|
2659 | rccontrol_stack_router_parse_requirements "$@" | |||
|
2660 | shift $# | |||
|
2661 | ;; | |||
|
2662 | ||||
|
2663 | metrics ) | |||
|
2664 | action="metrics" | |||
|
2665 | shift | |||
|
2666 | rccontrol_stack_metrics_parse_requirements "$@" | |||
|
2667 | shift $# | |||
|
2668 | ;; | |||
|
2669 | ||||
|
2670 | services ) | |||
|
2671 | action="services" | |||
|
2672 | shift | |||
|
2673 | rccontrol_stack_services_parse_requirements "$@" | |||
|
2674 | shift $# | |||
|
2675 | ;; | |||
|
2676 | ||||
|
2677 | rhodecode ) | |||
|
2678 | action="rhodecode" | |||
|
2679 | shift | |||
|
2680 | rccontrol_stack_rhodecode_parse_requirements "$@" | |||
|
2681 | shift $# | |||
|
2682 | ;; | |||
|
2683 | ||||
|
2684 | all ) | |||
|
2685 | action="all" | |||
|
2686 | shift | |||
|
2687 | rccontrol_stack_all_parse_requirements "$@" | |||
|
2688 | shift $# | |||
|
2689 | ;; | |||
|
2690 | ||||
|
2691 | # :command.command_fallback | |||
|
2692 | "" ) | |||
|
2693 | rccontrol_stack_usage >&2 | |||
|
2694 | exit 1 | |||
|
2695 | ;; | |||
|
2696 | ||||
|
2697 | * ) | |||
|
2698 | printf "invalid command: %s\n" "$action" >&2 | |||
|
2699 | exit 1 | |||
|
2700 | ;; | |||
|
2701 | ||||
|
2702 | esac | |||
|
2703 | ||||
|
2704 | # :command.parse_requirements_while | |||
|
2705 | while [[ $# -gt 0 ]]; do | |||
|
2706 | key="$1" | |||
|
2707 | case "$key" in | |||
|
2708 | ||||
|
2709 | -?* ) | |||
|
2710 | printf "invalid option: %s\n" "$key" >&2 | |||
|
2711 | exit 1 | |||
|
2712 | ;; | |||
|
2713 | ||||
|
2714 | * ) | |||
|
2715 | # :command.parse_requirements_case | |||
|
2716 | # :command.parse_requirements_case_simple | |||
|
2717 | printf "invalid argument: %s\n" "$key" >&2 | |||
|
2718 | exit 1 | |||
|
2719 | ||||
|
2720 | ;; | |||
|
2721 | ||||
|
2722 | esac | |||
|
2723 | done | |||
|
2724 | ||||
|
2725 | } | |||
|
2726 | ||||
|
2727 | # :command.parse_requirements | |||
|
2728 | rccontrol_stack_router_parse_requirements() { | |||
|
2729 | # :command.fixed_flags_filter | |||
|
2730 | case "${1:-}" in | |||
|
2731 | --help | -h ) | |||
|
2732 | long_usage=yes | |||
|
2733 | rccontrol_stack_router_usage | |||
|
2734 | exit | |||
|
2735 | ;; | |||
|
2736 | ||||
|
2737 | esac | |||
|
2738 | ||||
|
2739 | # :command.command_filter | |||
|
2740 | action="stack router" | |||
|
2741 | ||||
|
2742 | # :command.parse_requirements_while | |||
|
2743 | while [[ $# -gt 0 ]]; do | |||
|
2744 | key="$1" | |||
|
2745 | case "$key" in | |||
|
2746 | ||||
|
2747 | -?* ) | |||
|
2748 | other_args+=("$1") | |||
|
2749 | shift | |||
|
2750 | ;; | |||
|
2751 | ||||
|
2752 | * ) | |||
|
2753 | # :command.parse_requirements_case | |||
|
2754 | # :command.parse_requirements_case_catch_all | |||
|
2755 | other_args+=("$1") | |||
|
2756 | shift | |||
|
2757 | ||||
|
2758 | ;; | |||
|
2759 | ||||
|
2760 | esac | |||
|
2761 | done | |||
|
2762 | ||||
|
2763 | } | |||
|
2764 | ||||
|
2765 | # :command.parse_requirements | |||
|
2766 | rccontrol_stack_metrics_parse_requirements() { | |||
|
2767 | # :command.fixed_flags_filter | |||
|
2768 | case "${1:-}" in | |||
|
2769 | --help | -h ) | |||
|
2770 | long_usage=yes | |||
|
2771 | rccontrol_stack_metrics_usage | |||
|
2772 | exit | |||
|
2773 | ;; | |||
|
2774 | ||||
|
2775 | esac | |||
|
2776 | ||||
|
2777 | # :command.command_filter | |||
|
2778 | action="stack metrics" | |||
|
2779 | ||||
|
2780 | # :command.parse_requirements_while | |||
|
2781 | while [[ $# -gt 0 ]]; do | |||
|
2782 | key="$1" | |||
|
2783 | case "$key" in | |||
|
2784 | ||||
|
2785 | -?* ) | |||
|
2786 | other_args+=("$1") | |||
|
2787 | shift | |||
|
2788 | ;; | |||
|
2789 | ||||
|
2790 | * ) | |||
|
2791 | # :command.parse_requirements_case | |||
|
2792 | # :command.parse_requirements_case_catch_all | |||
|
2793 | other_args+=("$1") | |||
|
2794 | shift | |||
|
2795 | ||||
|
2796 | ;; | |||
|
2797 | ||||
|
2798 | esac | |||
|
2799 | done | |||
|
2800 | ||||
|
2801 | } | |||
|
2802 | ||||
|
2803 | # :command.parse_requirements | |||
|
2804 | rccontrol_stack_services_parse_requirements() { | |||
|
2805 | # :command.fixed_flags_filter | |||
|
2806 | case "${1:-}" in | |||
|
2807 | --help | -h ) | |||
|
2808 | long_usage=yes | |||
|
2809 | rccontrol_stack_services_usage | |||
|
2810 | exit | |||
|
2811 | ;; | |||
|
2812 | ||||
|
2813 | esac | |||
|
2814 | ||||
|
2815 | # :command.command_filter | |||
|
2816 | action="stack services" | |||
|
2817 | ||||
|
2818 | # :command.parse_requirements_while | |||
|
2819 | while [[ $# -gt 0 ]]; do | |||
|
2820 | key="$1" | |||
|
2821 | case "$key" in | |||
|
2822 | ||||
|
2823 | -?* ) | |||
|
2824 | other_args+=("$1") | |||
|
2825 | shift | |||
2055 | ;; |
|
2826 | ;; | |
2056 |
|
2827 | |||
2057 | * ) |
|
2828 | * ) | |
2058 | # :command.parse_requirements_case |
|
2829 | # :command.parse_requirements_case | |
2059 |
# :command.parse_requirements_case_ |
|
2830 | # :command.parse_requirements_case_catch_all | |
2060 | printf "invalid argument: %s\n" "$key" >&2 |
|
2831 | other_args+=("$1") | |
2061 |
|
|
2832 | shift | |
2062 |
|
2833 | |||
2063 | ;; |
|
2834 | ;; | |
2064 |
|
2835 | |||
2065 | esac |
|
2836 | esac | |
2066 | done |
|
2837 | done | |
2067 |
|
2838 | |||
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 | } |
|
2839 | } | |
2075 |
|
2840 | |||
2076 | # :command.parse_requirements |
|
2841 | # :command.parse_requirements | |
2077 |
rccontrol_ |
|
2842 | rccontrol_stack_rhodecode_parse_requirements() { | |
2078 | # :command.fixed_flags_filter |
|
2843 | # :command.fixed_flags_filter | |
2079 | case "${1:-}" in |
|
2844 | case "${1:-}" in | |
2080 | --help | -h ) |
|
2845 | --help | -h ) | |
2081 | long_usage=yes |
|
2846 | long_usage=yes | |
2082 |
rccontrol_ |
|
2847 | rccontrol_stack_rhodecode_usage | |
2083 | exit |
|
2848 | exit | |
2084 | ;; |
|
2849 | ;; | |
2085 |
|
2850 | |||
2086 | esac |
|
2851 | esac | |
2087 |
|
2852 | |||
2088 | # :command.command_filter |
|
2853 | # :command.command_filter | |
2089 | action="build" |
|
2854 | action="stack rhodecode" | |
2090 |
|
2855 | |||
2091 | # :command.parse_requirements_while |
|
2856 | # :command.parse_requirements_while | |
2092 | while [[ $# -gt 0 ]]; do |
|
2857 | while [[ $# -gt 0 ]]; do | |
2093 | key="$1" |
|
2858 | key="$1" | |
2094 | case "$key" in |
|
2859 | 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 |
|
2860 | |||
2110 | -?* ) |
|
2861 | -?* ) | |
2111 | printf "invalid option: %s\n" "$key" >&2 |
|
2862 | other_args+=("$1") | |
2112 |
|
|
2863 | shift | |
2113 | ;; |
|
2864 | ;; | |
2114 |
|
2865 | |||
2115 | * ) |
|
2866 | * ) | |
2116 | # :command.parse_requirements_case |
|
2867 | # :command.parse_requirements_case | |
2117 |
# :command.parse_requirements_case_ |
|
2868 | # :command.parse_requirements_case_catch_all | |
2118 | printf "invalid argument: %s\n" "$key" >&2 |
|
2869 | other_args+=("$1") | |
2119 |
|
|
2870 | shift | |
2120 |
|
2871 | |||
2121 | ;; |
|
2872 | ;; | |
2122 |
|
2873 | |||
2123 | esac |
|
2874 | esac | |
2124 | done |
|
2875 | done | |
2125 |
|
2876 | |||
2126 | # :command.default_assignments |
|
|||
2127 | [[ -n ${args[--version-name]:-} ]] || args[--version-name]="$RC_CLI_VERSION_NAME" |
|
|||
2128 |
|
||||
2129 | } |
|
2877 | } | |
2130 |
|
2878 | |||
2131 | # :command.parse_requirements |
|
2879 | # :command.parse_requirements | |
2132 |
rccontrol_ |
|
2880 | rccontrol_stack_all_parse_requirements() { | |
2133 | # :command.fixed_flags_filter |
|
2881 | # :command.fixed_flags_filter | |
2134 | case "${1:-}" in |
|
2882 | case "${1:-}" in | |
2135 | --help | -h ) |
|
2883 | --help | -h ) | |
2136 | long_usage=yes |
|
2884 | long_usage=yes | |
2137 |
rccontrol_ |
|
2885 | rccontrol_stack_all_usage | |
2138 | exit |
|
2886 | exit | |
2139 | ;; |
|
2887 | ;; | |
2140 |
|
2888 | |||
2141 | esac |
|
2889 | esac | |
2142 |
|
2890 | |||
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 |
|
2891 | # :command.command_filter | |
2154 | action="get-build-source" |
|
2892 | action="stack all" | |
2155 |
|
2893 | |||
2156 | # :command.parse_requirements_while |
|
2894 | # :command.parse_requirements_while | |
2157 | while [[ $# -gt 0 ]]; do |
|
2895 | while [[ $# -gt 0 ]]; do | |
2158 | key="$1" |
|
2896 | key="$1" | |
2159 | case "$key" in |
|
2897 | 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 |
|
2898 | |||
2190 | -?* ) |
|
2899 | -?* ) | |
2191 | printf "invalid option: %s\n" "$key" >&2 |
|
2900 | other_args+=("$1") | |
2192 |
|
|
2901 | shift | |
2193 | ;; |
|
2902 | ;; | |
2194 |
|
2903 | |||
2195 | * ) |
|
2904 | * ) | |
2196 | # :command.parse_requirements_case |
|
2905 | # :command.parse_requirements_case | |
2197 |
# :command.parse_requirements_case_ |
|
2906 | # :command.parse_requirements_case_catch_all | |
2198 | if [[ -z ${args[revision]+x} ]]; then |
|
2907 | other_args+=("$1") | |
2199 |
|
||||
2200 | args[revision]=$1 |
|
|||
2201 |
|
|
2908 | shift | |
2202 | else |
|
|||
2203 | printf "invalid argument: %s\n" "$key" >&2 |
|
|||
2204 | exit 1 |
|
|||
2205 | fi |
|
|||
2206 |
|
2909 | |||
2207 | ;; |
|
2910 | ;; | |
2208 |
|
2911 | |||
2209 | esac |
|
2912 | esac | |
2210 | done |
|
2913 | done | |
2211 |
|
2914 | |||
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 | } |
|
2915 | } | |
2222 |
|
2916 | |||
2223 | # :command.parse_requirements |
|
2917 | # :command.parse_requirements | |
2224 |
rccontrol_ |
|
2918 | rccontrol_stack_status_parse_requirements() { | |
2225 | # :command.fixed_flags_filter |
|
2919 | # :command.fixed_flags_filter | |
2226 | case "${1:-}" in |
|
2920 | case "${1:-}" in | |
2227 | --help | -h ) |
|
2921 | --help | -h ) | |
2228 | long_usage=yes |
|
2922 | long_usage=yes | |
2229 |
rccontrol_ |
|
2923 | rccontrol_stack_status_usage | |
2230 | exit |
|
2924 | exit | |
2231 | ;; |
|
2925 | ;; | |
2232 |
|
2926 | |||
2233 | esac |
|
2927 | esac | |
2234 |
|
2928 | |||
2235 | # :command.command_filter |
|
2929 | # :command.command_filter | |
2236 |
action=" |
|
2930 | action="stack-status" | |
2237 |
|
2931 | |||
2238 | # :command.parse_requirements_while |
|
2932 | # :command.parse_requirements_while | |
2239 | while [[ $# -gt 0 ]]; do |
|
2933 | while [[ $# -gt 0 ]]; do | |
2240 | key="$1" |
|
2934 | key="$1" | |
2241 | case "$key" in |
|
2935 | 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 |
|
2936 | |||
2257 | -?* ) |
|
2937 | -?* ) | |
2258 | printf "invalid option: %s\n" "$key" >&2 |
|
2938 | printf "invalid option: %s\n" "$key" >&2 | |
2259 | exit 1 |
|
2939 | exit 1 | |
2260 | ;; |
|
2940 | ;; | |
2261 |
|
2941 | |||
2262 | * ) |
|
2942 | * ) | |
2263 | # :command.parse_requirements_case |
|
2943 | # :command.parse_requirements_case | |
2264 | # :command.parse_requirements_case_simple |
|
2944 | # :command.parse_requirements_case_simple | |
2265 | printf "invalid argument: %s\n" "$key" >&2 |
|
2945 | printf "invalid argument: %s\n" "$key" >&2 | |
2266 | exit 1 |
|
2946 | exit 1 | |
2267 |
|
2947 | |||
2268 | ;; |
|
2948 | ;; | |
2269 |
|
2949 | |||
2270 | esac |
|
2950 | esac | |
2271 | done |
|
2951 | done | |
2272 |
|
2952 | |||
2273 | # :command.default_assignments |
|
|||
2274 | [[ -n ${args[--version-name]:-} ]] || args[--version-name]="$RC_CLI_VERSION_NAME" |
|
|||
2275 |
|
||||
2276 | } |
|
2953 | } | |
2277 |
|
2954 | |||
2278 | # :command.parse_requirements |
|
2955 | # :command.parse_requirements | |
2279 | rccontrol_stack_parse_requirements() { |
|
2956 | rccontrol_stack_upgrade_parse_requirements() { | |
2280 | # :command.fixed_flags_filter |
|
2957 | # :command.fixed_flags_filter | |
2281 | case "${1:-}" in |
|
2958 | case "${1:-}" in | |
2282 | --help | -h ) |
|
2959 | --help | -h ) | |
2283 | long_usage=yes |
|
2960 | long_usage=yes | |
2284 | rccontrol_stack_usage |
|
2961 | rccontrol_stack_upgrade_usage | |
2285 | exit |
|
2962 | exit | |
2286 | ;; |
|
2963 | ;; | |
2287 |
|
2964 | |||
2288 | esac |
|
2965 | esac | |
2289 |
|
2966 | |||
2290 | # :command.command_filter |
|
2967 | # :command.command_filter | |
2291 | action="stack" |
|
2968 | action="stack-upgrade" | |
2292 |
|
2969 | |||
2293 | # :command.parse_requirements_while |
|
2970 | # :command.parse_requirements_while | |
2294 | while [[ $# -gt 0 ]]; do |
|
2971 | while [[ $# -gt 0 ]]; do | |
2295 | key="$1" |
|
2972 | key="$1" | |
2296 | case "$key" in |
|
2973 | case "$key" in | |
2297 |
|
2974 | |||
2298 | -?* ) |
|
2975 | -?* ) | |
2299 | other_args+=("$1") |
|
2976 | printf "invalid option: %s\n" "$key" >&2 | |
2300 |
|
|
2977 | exit 1 | |
2301 | ;; |
|
2978 | ;; | |
2302 |
|
2979 | |||
2303 | * ) |
|
2980 | * ) | |
2304 | # :command.parse_requirements_case |
|
2981 | # :command.parse_requirements_case | |
2305 |
# :command.parse_requirements_case_ |
|
2982 | # :command.parse_requirements_case_simple | |
2306 | if [[ -z ${args[name]+x} ]]; then |
|
2983 | printf "invalid argument: %s\n" "$key" >&2 | |
2307 |
|
2984 | exit 1 | ||
2308 | args[name]=$1 |
|
|||
2309 | shift |
|
|||
2310 | else |
|
|||
2311 | other_args+=("$1") |
|
|||
2312 | shift |
|
|||
2313 | fi |
|
|||
2314 |
|
2985 | |||
2315 | ;; |
|
2986 | ;; | |
2316 |
|
2987 | |||
2317 | esac |
|
2988 | esac | |
2318 | done |
|
2989 | done | |
2319 |
|
2990 | |||
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 | } |
|
2991 | } | |
2333 |
|
2992 | |||
2334 | # :command.parse_requirements |
|
2993 | # :command.parse_requirements | |
2335 |
rccontrol_ |
|
2994 | rccontrol_cli_parse_requirements() { | |
2336 | # :command.fixed_flags_filter |
|
2995 | # :command.fixed_flags_filter | |
2337 | case "${1:-}" in |
|
2996 | case "${1:-}" in | |
2338 | --help | -h ) |
|
2997 | --help | -h ) | |
2339 | long_usage=yes |
|
2998 | long_usage=yes | |
2340 |
rccontrol_ |
|
2999 | rccontrol_cli_usage | |
2341 | exit |
|
3000 | exit | |
2342 | ;; |
|
3001 | ;; | |
2343 |
|
3002 | |||
2344 | esac |
|
3003 | esac | |
2345 |
|
3004 | |||
2346 | # :command.command_filter |
|
3005 | # :command.command_filter | |
2347 | action="stack-status" |
|
3006 | action=${1:-} | |
|
3007 | ||||
|
3008 | case $action in | |||
|
3009 | -* ) | |||
|
3010 | ;; | |||
|
3011 | ||||
|
3012 | redis ) | |||
|
3013 | action="redis" | |||
|
3014 | shift | |||
|
3015 | rccontrol_cli_redis_parse_requirements "$@" | |||
|
3016 | shift $# | |||
|
3017 | ;; | |||
|
3018 | ||||
|
3019 | db ) | |||
|
3020 | action="db" | |||
|
3021 | shift | |||
|
3022 | rccontrol_cli_db_parse_requirements "$@" | |||
|
3023 | shift $# | |||
|
3024 | ;; | |||
|
3025 | ||||
|
3026 | db-upgrade ) | |||
|
3027 | action="db-upgrade" | |||
|
3028 | shift | |||
|
3029 | rccontrol_cli_db_upgrade_parse_requirements "$@" | |||
|
3030 | shift $# | |||
|
3031 | ;; | |||
|
3032 | ||||
|
3033 | storage ) | |||
|
3034 | action="storage" | |||
|
3035 | shift | |||
|
3036 | rccontrol_cli_storage_parse_requirements "$@" | |||
|
3037 | shift $# | |||
|
3038 | ;; | |||
|
3039 | ||||
|
3040 | # :command.command_fallback | |||
|
3041 | "" ) | |||
|
3042 | rccontrol_cli_usage >&2 | |||
|
3043 | exit 1 | |||
|
3044 | ;; | |||
|
3045 | ||||
|
3046 | * ) | |||
|
3047 | printf "invalid command: %s\n" "$action" >&2 | |||
|
3048 | exit 1 | |||
|
3049 | ;; | |||
|
3050 | ||||
|
3051 | esac | |||
2348 |
|
3052 | |||
2349 | # :command.parse_requirements_while |
|
3053 | # :command.parse_requirements_while | |
2350 | while [[ $# -gt 0 ]]; do |
|
3054 | while [[ $# -gt 0 ]]; do | |
2351 | key="$1" |
|
3055 | key="$1" | |
2352 | case "$key" in |
|
3056 | case "$key" in | |
2353 |
|
3057 | |||
2354 | -?* ) |
|
3058 | -?* ) | |
2355 | printf "invalid option: %s\n" "$key" >&2 |
|
3059 | printf "invalid option: %s\n" "$key" >&2 | |
2356 | exit 1 |
|
3060 | exit 1 | |
2357 | ;; |
|
3061 | ;; | |
2358 |
|
3062 | |||
2359 | * ) |
|
3063 | * ) | |
2360 | # :command.parse_requirements_case |
|
3064 | # :command.parse_requirements_case | |
2361 | # :command.parse_requirements_case_simple |
|
3065 | # :command.parse_requirements_case_simple | |
2362 | printf "invalid argument: %s\n" "$key" >&2 |
|
3066 | printf "invalid argument: %s\n" "$key" >&2 | |
2363 | exit 1 |
|
3067 | exit 1 | |
2364 |
|
3068 | |||
2365 | ;; |
|
3069 | ;; | |
2366 |
|
3070 | |||
2367 | esac |
|
3071 | esac | |
2368 | done |
|
3072 | done | |
2369 |
|
3073 | |||
2370 | } |
|
3074 | } | |
2371 |
|
3075 | |||
2372 | # :command.parse_requirements |
|
3076 | # :command.parse_requirements | |
2373 |
rccontrol_ |
|
3077 | rccontrol_cli_redis_parse_requirements() { | |
2374 | # :command.fixed_flags_filter |
|
3078 | # :command.fixed_flags_filter | |
2375 | case "${1:-}" in |
|
3079 | case "${1:-}" in | |
2376 | --help | -h ) |
|
3080 | --help | -h ) | |
2377 | long_usage=yes |
|
3081 | long_usage=yes | |
2378 |
rccontrol_ |
|
3082 | rccontrol_cli_redis_usage | |
2379 | exit |
|
3083 | exit | |
2380 | ;; |
|
3084 | ;; | |
2381 |
|
3085 | |||
2382 | esac |
|
3086 | esac | |
2383 |
|
3087 | |||
2384 | # :command.command_filter |
|
3088 | # :command.command_filter | |
2385 | action="stack-upgrade" |
|
3089 | action="cli redis" | |
2386 |
|
3090 | |||
2387 | # :command.parse_requirements_while |
|
3091 | # :command.parse_requirements_while | |
2388 | while [[ $# -gt 0 ]]; do |
|
3092 | while [[ $# -gt 0 ]]; do | |
2389 | key="$1" |
|
3093 | key="$1" | |
2390 | case "$key" in |
|
3094 | case "$key" in | |
2391 |
|
3095 | |||
2392 | -?* ) |
|
3096 | -?* ) | |
2393 | printf "invalid option: %s\n" "$key" >&2 |
|
3097 | printf "invalid option: %s\n" "$key" >&2 | |
2394 | exit 1 |
|
3098 | exit 1 | |
2395 | ;; |
|
3099 | ;; | |
2396 |
|
3100 | |||
2397 | * ) |
|
3101 | * ) | |
2398 | # :command.parse_requirements_case |
|
3102 | # :command.parse_requirements_case | |
2399 | # :command.parse_requirements_case_simple |
|
3103 | # :command.parse_requirements_case_simple | |
2400 | printf "invalid argument: %s\n" "$key" >&2 |
|
3104 | printf "invalid argument: %s\n" "$key" >&2 | |
2401 | exit 1 |
|
3105 | exit 1 | |
2402 |
|
3106 | |||
2403 | ;; |
|
3107 | ;; | |
2404 |
|
3108 | |||
2405 | esac |
|
3109 | esac | |
2406 | done |
|
3110 | done | |
2407 |
|
3111 | |||
2408 | } |
|
3112 | } | |
2409 |
|
3113 | |||
2410 | # :command.parse_requirements |
|
3114 | # :command.parse_requirements | |
2411 |
rccontrol_cli_ |
|
3115 | rccontrol_cli_db_parse_requirements() { | |
2412 | # :command.fixed_flags_filter |
|
3116 | # :command.fixed_flags_filter | |
2413 | case "${1:-}" in |
|
3117 | case "${1:-}" in | |
2414 | --help | -h ) |
|
3118 | --help | -h ) | |
2415 | long_usage=yes |
|
3119 | long_usage=yes | |
2416 |
rccontrol_cli_ |
|
3120 | rccontrol_cli_db_usage | |
2417 | exit |
|
3121 | exit | |
2418 | ;; |
|
3122 | ;; | |
2419 |
|
3123 | |||
2420 | esac |
|
3124 | esac | |
2421 |
|
3125 | |||
2422 | # :command.command_filter |
|
3126 | # :command.command_filter | |
2423 |
action="cli |
|
3127 | action="cli db" | |
2424 |
|
3128 | |||
2425 | # :command.parse_requirements_while |
|
3129 | # :command.parse_requirements_while | |
2426 | while [[ $# -gt 0 ]]; do |
|
3130 | while [[ $# -gt 0 ]]; do | |
2427 | key="$1" |
|
3131 | key="$1" | |
2428 | case "$key" in |
|
3132 | case "$key" in | |
2429 |
|
3133 | |||
2430 | -?* ) |
|
3134 | -?* ) | |
2431 | printf "invalid option: %s\n" "$key" >&2 |
|
3135 | printf "invalid option: %s\n" "$key" >&2 | |
2432 | exit 1 |
|
3136 | exit 1 | |
2433 | ;; |
|
3137 | ;; | |
2434 |
|
3138 | |||
2435 | * ) |
|
3139 | * ) | |
2436 | # :command.parse_requirements_case |
|
3140 | # :command.parse_requirements_case | |
2437 | # :command.parse_requirements_case_simple |
|
3141 | # :command.parse_requirements_case_simple | |
2438 | printf "invalid argument: %s\n" "$key" >&2 |
|
3142 | printf "invalid argument: %s\n" "$key" >&2 | |
2439 | exit 1 |
|
3143 | exit 1 | |
2440 |
|
3144 | |||
2441 | ;; |
|
3145 | ;; | |
2442 |
|
3146 | |||
2443 | esac |
|
3147 | esac | |
2444 | done |
|
3148 | done | |
2445 |
|
3149 | |||
2446 | } |
|
3150 | } | |
2447 |
|
3151 | |||
2448 | # :command.parse_requirements |
|
3152 | # :command.parse_requirements | |
2449 | rccontrol_cli_db_parse_requirements() { |
|
3153 | rccontrol_cli_db_upgrade_parse_requirements() { | |
2450 | # :command.fixed_flags_filter |
|
3154 | # :command.fixed_flags_filter | |
2451 | case "${1:-}" in |
|
3155 | case "${1:-}" in | |
2452 | --help | -h ) |
|
3156 | --help | -h ) | |
2453 | long_usage=yes |
|
3157 | long_usage=yes | |
2454 | rccontrol_cli_db_usage |
|
3158 | rccontrol_cli_db_upgrade_usage | |
2455 | exit |
|
3159 | exit | |
2456 | ;; |
|
3160 | ;; | |
2457 |
|
3161 | |||
2458 | esac |
|
3162 | esac | |
2459 |
|
3163 | |||
2460 | # :command.command_filter |
|
3164 | # :command.command_filter | |
2461 |
action="cli |
|
3165 | action="cli db-upgrade" | |
2462 |
|
3166 | |||
2463 | # :command.parse_requirements_while |
|
3167 | # :command.parse_requirements_while | |
2464 | while [[ $# -gt 0 ]]; do |
|
3168 | while [[ $# -gt 0 ]]; do | |
2465 | key="$1" |
|
3169 | key="$1" | |
2466 | case "$key" in |
|
3170 | case "$key" in | |
2467 |
|
3171 | |||
2468 | -?* ) |
|
3172 | -?* ) | |
2469 | printf "invalid option: %s\n" "$key" >&2 |
|
3173 | printf "invalid option: %s\n" "$key" >&2 | |
2470 | exit 1 |
|
3174 | exit 1 | |
2471 | ;; |
|
3175 | ;; | |
2472 |
|
3176 | |||
2473 | * ) |
|
3177 | * ) | |
2474 | # :command.parse_requirements_case |
|
3178 | # :command.parse_requirements_case | |
2475 | # :command.parse_requirements_case_simple |
|
3179 | # :command.parse_requirements_case_simple | |
2476 | printf "invalid argument: %s\n" "$key" >&2 |
|
3180 | printf "invalid argument: %s\n" "$key" >&2 | |
2477 | exit 1 |
|
3181 | exit 1 | |
2478 |
|
3182 | |||
2479 | ;; |
|
3183 | ;; | |
2480 |
|
3184 | |||
2481 | esac |
|
3185 | esac | |
2482 | done |
|
3186 | done | |
2483 |
|
3187 | |||
2484 | } |
|
3188 | } | |
2485 |
|
3189 | |||
2486 | # :command.parse_requirements |
|
3190 | # :command.parse_requirements | |
2487 |
rccontrol_cli_ |
|
3191 | rccontrol_cli_storage_parse_requirements() { | |
2488 | # :command.fixed_flags_filter |
|
3192 | # :command.fixed_flags_filter | |
2489 | case "${1:-}" in |
|
3193 | case "${1:-}" in | |
2490 | --help | -h ) |
|
3194 | --help | -h ) | |
2491 | long_usage=yes |
|
3195 | long_usage=yes | |
2492 |
rccontrol_cli_ |
|
3196 | rccontrol_cli_storage_usage | |
2493 | exit |
|
3197 | exit | |
2494 | ;; |
|
3198 | ;; | |
2495 |
|
3199 | |||
2496 | esac |
|
3200 | esac | |
2497 |
|
3201 | |||
2498 | # :command.command_filter |
|
3202 | # :command.command_filter | |
2499 |
action="cli |
|
3203 | action="cli storage" | |
2500 |
|
3204 | |||
2501 | # :command.parse_requirements_while |
|
3205 | # :command.parse_requirements_while | |
2502 | while [[ $# -gt 0 ]]; do |
|
3206 | while [[ $# -gt 0 ]]; do | |
2503 | key="$1" |
|
3207 | key="$1" | |
2504 | case "$key" in |
|
3208 | case "$key" in | |
2505 |
|
3209 | |||
2506 | -?* ) |
|
3210 | -?* ) | |
2507 | printf "invalid option: %s\n" "$key" >&2 |
|
3211 | printf "invalid option: %s\n" "$key" >&2 | |
2508 | exit 1 |
|
3212 | exit 1 | |
2509 | ;; |
|
3213 | ;; | |
2510 |
|
3214 | |||
2511 | * ) |
|
3215 | * ) | |
2512 | # :command.parse_requirements_case |
|
3216 | # :command.parse_requirements_case | |
2513 | # :command.parse_requirements_case_simple |
|
3217 | # :command.parse_requirements_case_simple | |
2514 | printf "invalid argument: %s\n" "$key" >&2 |
|
3218 | printf "invalid argument: %s\n" "$key" >&2 | |
2515 | exit 1 |
|
3219 | exit 1 | |
2516 |
|
3220 | |||
2517 | ;; |
|
3221 | ;; | |
2518 |
|
3222 | |||
2519 | esac |
|
3223 | esac | |
2520 | done |
|
3224 | done | |
2521 |
|
3225 | |||
2522 | } |
|
3226 | } | |
2523 |
|
3227 | |||
2524 | # :command.parse_requirements |
|
3228 | # :command.parse_requirements | |
2525 | rccontrol__completions_parse_requirements() { |
|
3229 | rccontrol__completions_parse_requirements() { | |
2526 | # :command.fixed_flags_filter |
|
3230 | # :command.fixed_flags_filter | |
2527 | case "${1:-}" in |
|
3231 | case "${1:-}" in | |
2528 | --help | -h ) |
|
3232 | --help | -h ) | |
2529 | long_usage=yes |
|
3233 | long_usage=yes | |
2530 | rccontrol__completions_usage |
|
3234 | rccontrol__completions_usage | |
2531 | exit |
|
3235 | exit | |
2532 | ;; |
|
3236 | ;; | |
2533 |
|
3237 | |||
2534 | esac |
|
3238 | esac | |
2535 |
|
3239 | |||
2536 | # :command.command_filter |
|
3240 | # :command.command_filter | |
2537 | action="_completions" |
|
3241 | action="_completions" | |
2538 |
|
3242 | |||
2539 | # :command.parse_requirements_while |
|
3243 | # :command.parse_requirements_while | |
2540 | while [[ $# -gt 0 ]]; do |
|
3244 | while [[ $# -gt 0 ]]; do | |
2541 | key="$1" |
|
3245 | key="$1" | |
2542 | case "$key" in |
|
3246 | case "$key" in | |
2543 |
|
3247 | |||
2544 | -?* ) |
|
3248 | -?* ) | |
2545 | printf "invalid option: %s\n" "$key" >&2 |
|
3249 | printf "invalid option: %s\n" "$key" >&2 | |
2546 | exit 1 |
|
3250 | exit 1 | |
2547 | ;; |
|
3251 | ;; | |
2548 |
|
3252 | |||
2549 | * ) |
|
3253 | * ) | |
2550 | # :command.parse_requirements_case |
|
3254 | # :command.parse_requirements_case | |
2551 | # :command.parse_requirements_case_simple |
|
3255 | # :command.parse_requirements_case_simple | |
2552 | printf "invalid argument: %s\n" "$key" >&2 |
|
3256 | printf "invalid argument: %s\n" "$key" >&2 | |
2553 | exit 1 |
|
3257 | exit 1 | |
2554 |
|
3258 | |||
2555 | ;; |
|
3259 | ;; | |
2556 |
|
3260 | |||
2557 | esac |
|
3261 | esac | |
2558 | done |
|
3262 | done | |
2559 |
|
3263 | |||
2560 | } |
|
3264 | } | |
2561 |
|
3265 | |||
2562 | # :command.parse_requirements |
|
3266 | # :command.parse_requirements | |
2563 | rccontrol_backup_db_parse_requirements() { |
|
3267 | rccontrol_backup_db_parse_requirements() { | |
2564 | # :command.fixed_flags_filter |
|
3268 | # :command.fixed_flags_filter | |
2565 | case "${1:-}" in |
|
3269 | case "${1:-}" in | |
2566 | --help | -h ) |
|
3270 | --help | -h ) | |
2567 | long_usage=yes |
|
3271 | long_usage=yes | |
2568 | rccontrol_backup_db_usage |
|
3272 | rccontrol_backup_db_usage | |
2569 | exit |
|
3273 | exit | |
2570 | ;; |
|
3274 | ;; | |
2571 |
|
3275 | |||
2572 | esac |
|
3276 | esac | |
2573 |
|
3277 | |||
2574 | # :command.dependencies_filter |
|
3278 | # :command.dependencies_filter | |
2575 | if ! [[ -x "$(command -v tar)" ]]; then |
|
3279 | if ! [[ -x "$(command -v tar)" ]]; then | |
2576 | printf "missing dependency: tar\n" >&2 |
|
3280 | printf "missing dependency: tar\n" >&2 | |
2577 | exit 1 |
|
3281 | exit 1 | |
2578 | fi |
|
3282 | fi | |
2579 | if ! [[ -x "$(command -v gzip)" ]]; then |
|
3283 | if ! [[ -x "$(command -v gzip)" ]]; then | |
2580 | printf "missing dependency: gzip\n" >&2 |
|
3284 | printf "missing dependency: gzip\n" >&2 | |
2581 | exit 1 |
|
3285 | exit 1 | |
2582 | fi |
|
3286 | fi | |
2583 |
|
3287 | |||
2584 | # :command.command_filter |
|
3288 | # :command.command_filter | |
2585 | action="backup-db" |
|
3289 | action="backup-db" | |
2586 |
|
3290 | |||
2587 | # :command.parse_requirements_while |
|
3291 | # :command.parse_requirements_while | |
2588 | while [[ $# -gt 0 ]]; do |
|
3292 | while [[ $# -gt 0 ]]; do | |
2589 | key="$1" |
|
3293 | key="$1" | |
2590 | case "$key" in |
|
3294 | case "$key" in | |
2591 |
|
3295 | |||
2592 | -?* ) |
|
3296 | -?* ) | |
2593 | printf "invalid option: %s\n" "$key" >&2 |
|
3297 | printf "invalid option: %s\n" "$key" >&2 | |
2594 | exit 1 |
|
3298 | exit 1 | |
2595 | ;; |
|
3299 | ;; | |
2596 |
|
3300 | |||
2597 | * ) |
|
3301 | * ) | |
2598 | # :command.parse_requirements_case |
|
3302 | # :command.parse_requirements_case | |
2599 | # :command.parse_requirements_case_simple |
|
3303 | # :command.parse_requirements_case_simple | |
2600 | printf "invalid argument: %s\n" "$key" >&2 |
|
3304 | printf "invalid argument: %s\n" "$key" >&2 | |
2601 | exit 1 |
|
3305 | exit 1 | |
2602 |
|
3306 | |||
2603 | ;; |
|
3307 | ;; | |
2604 |
|
3308 | |||
2605 | esac |
|
3309 | esac | |
2606 | done |
|
3310 | done | |
2607 |
|
3311 | |||
2608 | } |
|
3312 | } | |
2609 |
|
3313 | |||
2610 | # :command.parse_requirements |
|
3314 | # :command.parse_requirements | |
2611 | rccontrol_backup_data_parse_requirements() { |
|
3315 | rccontrol_backup_data_parse_requirements() { | |
2612 | # :command.fixed_flags_filter |
|
3316 | # :command.fixed_flags_filter | |
2613 | case "${1:-}" in |
|
3317 | case "${1:-}" in | |
2614 | --help | -h ) |
|
3318 | --help | -h ) | |
2615 | long_usage=yes |
|
3319 | long_usage=yes | |
2616 | rccontrol_backup_data_usage |
|
3320 | rccontrol_backup_data_usage | |
2617 | exit |
|
3321 | exit | |
2618 | ;; |
|
3322 | ;; | |
2619 |
|
3323 | |||
2620 | esac |
|
3324 | esac | |
2621 |
|
3325 | |||
2622 | # :command.dependencies_filter |
|
3326 | # :command.dependencies_filter | |
2623 | if ! [[ -x "$(command -v tar)" ]]; then |
|
3327 | if ! [[ -x "$(command -v tar)" ]]; then | |
2624 | printf "missing dependency: tar\n" >&2 |
|
3328 | printf "missing dependency: tar\n" >&2 | |
2625 | exit 1 |
|
3329 | exit 1 | |
2626 | fi |
|
3330 | fi | |
2627 |
|
3331 | |||
2628 | # :command.command_filter |
|
3332 | # :command.command_filter | |
2629 | action="backup-data" |
|
3333 | action="backup-data" | |
2630 |
|
3334 | |||
2631 | # :command.parse_requirements_while |
|
3335 | # :command.parse_requirements_while | |
2632 | while [[ $# -gt 0 ]]; do |
|
3336 | while [[ $# -gt 0 ]]; do | |
2633 | key="$1" |
|
3337 | key="$1" | |
2634 | case "$key" in |
|
3338 | case "$key" in | |
2635 |
|
3339 | |||
2636 | -?* ) |
|
3340 | -?* ) | |
2637 | printf "invalid option: %s\n" "$key" >&2 |
|
3341 | printf "invalid option: %s\n" "$key" >&2 | |
2638 | exit 1 |
|
3342 | exit 1 | |
2639 | ;; |
|
3343 | ;; | |
2640 |
|
3344 | |||
2641 | * ) |
|
3345 | * ) | |
2642 | # :command.parse_requirements_case |
|
3346 | # :command.parse_requirements_case | |
2643 | # :command.parse_requirements_case_simple |
|
3347 | # :command.parse_requirements_case_simple | |
2644 | printf "invalid argument: %s\n" "$key" >&2 |
|
3348 | printf "invalid argument: %s\n" "$key" >&2 | |
2645 | exit 1 |
|
3349 | exit 1 | |
2646 |
|
3350 | |||
2647 | ;; |
|
3351 | ;; | |
2648 |
|
3352 | |||
2649 | esac |
|
3353 | esac | |
2650 | done |
|
3354 | done | |
2651 |
|
3355 | |||
2652 | } |
|
3356 | } | |
2653 |
|
3357 | |||
2654 | # :command.initialize |
|
3358 | # :command.initialize | |
2655 | initialize() { |
|
3359 | initialize() { | |
2656 | version="4.28.0.REL20221101" |
|
3360 | version="4.28.0.REL20221101" | |
2657 | long_usage='' |
|
3361 | long_usage='' | |
2658 | set -e |
|
3362 | set -e | |
2659 |
|
3363 | |||
2660 | # :command.environment_variables_default |
|
3364 | # :command.environment_variables_default | |
2661 | export RC_CLI_VERSION_NAME="${RC_CLI_VERSION_NAME:-4.27.0}" |
|
3365 | 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}" |
|
3366 | 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}" |
|
3367 | 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}" |
|
3368 | 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}" |
|
3369 | export RC_STACK_RHODECODE_EXT="${RC_STACK_RHODECODE_EXT:-.custom/docker-compose-apps.override.yaml}" | |
2666 |
|
3370 | |||
2667 | # src/initialize.sh |
|
3371 | # src/initialize.sh | |
2668 |
|
3372 | |||
2669 | ENV_FILE=$PWD/.env |
|
3373 | ENV_FILE=$PWD/.env | |
2670 |
|
3374 | |||
2671 | # bootstrap file is a config file at the same time |
|
3375 | # bootstrap file is a config file at the same time | |
2672 | BOOTSTRAP_FILE='.rccontrol-bootstrap' |
|
|||
2673 | CONFIG_FILE='.rccontrol.ini' |
|
3376 | CONFIG_FILE='.rccontrol.ini' | |
2674 |
|
3377 | |||
|
3378 | # STACK_LIST | |||
2675 | VALID_SERVICES="router metrics services rhodecode" |
|
3379 | VALID_SERVICES="router metrics services rhodecode" | |
2676 | DOCKER_DEFS_WORK_DIR="docker_defs" |
|
3380 | DOCKER_DEFS_WORK_DIR="docker_defs" | |
2677 |
|
3381 | |||
|
3382 | # stage key, saved in .rccontrol.ini : stage func to execute | |||
|
3383 | BOOTSTRAP_STAGES="\ | |||
|
3384 | bootstrap_docker_install:bootstrap_docker_install \ | |||
|
3385 | bootstrap_docker_commons:bootstrap_docker_commons \ | |||
|
3386 | bootstrap_config:bootstrap_config \ | |||
|
3387 | bootstrap_definitions:bootstrap_definitions \ | |||
|
3388 | bootstrap_overrides:bootstrap_overrides \ | |||
|
3389 | " | |||
|
3390 | ||||
2678 | #echo "1 ----" |
|
3391 | #echo "1 ----" | |
2679 | #echo $RC_STACK_SERVICES_EXT |
|
3392 | #echo $RC_STACK_SERVICES_EXT | |
2680 | #echo $RC_STACK_METRICS_EXT |
|
3393 | #echo $RC_STACK_METRICS_EXT | |
2681 | #echo "1 -----" |
|
3394 | #echo "1 -----" | |
2682 |
|
3395 | |||
2683 | #echo '2 ----' |
|
3396 | #echo '2 ----' | |
2684 | #grep -v -e '^#' "$ENV_FILE" | xargs -I {} echo \'{}\' |
|
3397 | #grep -v -e '^#' "$ENV_FILE" | xargs -I {} echo \'{}\' | |
2685 | #echo '2 ----' |
|
3398 | #echo '2 ----' | |
2686 |
|
3399 | |||
2687 | #expose env vars from rccontrol donfig |
|
3400 | #expose env vars from rccontrol donfig | |
2688 | #if [[ -f $ENV_FILE ]]; then |
|
3401 | #if [[ -f $ENV_FILE ]]; then | |
2689 | # eval $(grep -v -e '^#' "$ENV_FILE" | xargs -I {} echo export \'{}\') |
|
3402 | # eval $(grep -v -e '^#' "$ENV_FILE" | xargs -I {} echo export \'{}\') | |
2690 | #fi |
|
3403 | #fi | |
2691 |
|
3404 | |||
2692 | #ENV_EXPAND="" |
|
3405 | #ENV_EXPAND="" | |
2693 | #for k in $(config_keys); do |
|
3406 | #for k in $(config_keys); do | |
2694 | # k_upper=${k^^} |
|
3407 | # k_upper=${k^^} | |
2695 | # env_entry="-e $k_upper='$(config_get "$k")' " |
|
3408 | # env_entry="-e $k_upper='$(config_get "$k")' " | |
2696 | # ENV_EXPAND+=$env_entry; |
|
3409 | # ENV_EXPAND+=$env_entry; | |
2697 | # #echo $env_expand |
|
3410 | # #echo $env_expand | |
2698 | #done |
|
3411 | #done | |
2699 |
|
3412 | |||
2700 | # |
|
3413 | # | |
2701 | #echo "3 ----" |
|
3414 | #echo "3 ----" | |
2702 | #echo $RC_STACK_SERVICES_EXT |
|
3415 | #echo $RC_STACK_SERVICES_EXT | |
2703 | #echo $RC_STACK_METRICS_EXT |
|
3416 | #echo $RC_STACK_METRICS_EXT | |
2704 | #echo $RC_STACK_RHODECODE_EXT |
|
3417 | #echo $RC_STACK_RHODECODE_EXT | |
2705 | #echo "3 -----" |
|
3418 | #echo "3 -----" | |
2706 |
|
3419 | |||
2707 | #env | grep RC_ |
|
3420 | #env | grep RC_ | |
2708 |
|
3421 | |||
|
3422 | docker_ping_host() { | |||
|
3423 | PING_HOST="$1" | |||
|
3424 | docker run --network rhodecode_network --rm alpine ping "$PING_HOST" | |||
|
3425 | } | |||
|
3426 | ||||
2709 | # backup files from a docker volume into /tmp/backup.tar.gz |
|
3427 | # backup files from a docker volume into /tmp/backup.tar.gz | |
2710 | docker-volume-backup-compressed() { |
|
3428 | docker-volume-backup-compressed() { | |
2711 | docker run --rm -v /tmp:/backup --volumes-from "$1" debian:jessie tar -czvf /backup/backup.tar.gz "${@:2}" |
|
3429 | docker run --rm -v /tmp:/backup --volumes-from "$1" debian:jessie tar -czvf /backup/backup.tar.gz "${@:2}" | |
2712 | } |
|
3430 | } | |
2713 |
|
3431 | |||
2714 | # restore files from /tmp/backup.tar.gz into a docker volume |
|
3432 | # restore files from /tmp/backup.tar.gz into a docker volume | |
2715 | docker-volume-restore-compressed() { |
|
3433 | docker-volume-restore-compressed() { | |
2716 | docker run --rm -v /tmp:/backup --volumes-from "$1" debian:jessie tar -xzvf /backup/backup.tar.gz "${@:2}" |
|
3434 | docker run --rm -v /tmp:/backup --volumes-from "$1" debian:jessie tar -xzvf /backup/backup.tar.gz "${@:2}" | |
2717 | echo "Double checking files..." |
|
3435 | echo "Double checking files..." | |
2718 | docker run --rm -v /tmp:/backup --volumes-from "$1" debian:jessie ls -lh "${@:2}" |
|
3436 | docker run --rm -v /tmp:/backup --volumes-from "$1" debian:jessie ls -lh "${@:2}" | |
2719 | } |
|
3437 | } | |
2720 |
|
3438 | |||
2721 | # backup files from a docker volume into /tmp/backup.tar |
|
3439 | # backup files from a docker volume into /tmp/backup.tar | |
2722 | docker-volume-backup() { |
|
3440 | docker-volume-backup() { | |
2723 | docker run --rm -v /tmp:/backup --volumes-from "$1" busybox tar -cvf /backup/backup.tar "${@:2}" |
|
3441 | docker run --rm -v /tmp:/backup --volumes-from "$1" busybox tar -cvf /backup/backup.tar "${@:2}" | |
2724 | } |
|
3442 | } | |
2725 |
|
3443 | |||
2726 | # restore files from /tmp/backup.tar into a docker volume |
|
3444 | # restore files from /tmp/backup.tar into a docker volume | |
2727 | docker-volume-restore() { |
|
3445 | docker-volume-restore() { | |
2728 | docker run --rm -v /tmp:/backup --volumes-from "$1" busybox tar -xvf /backup/backup.tar "${@:2}" |
|
3446 | docker run --rm -v /tmp:/backup --volumes-from "$1" busybox tar -xvf /backup/backup.tar "${@:2}" | |
2729 | echo "Double checking files..." |
|
3447 | echo "Double checking files..." | |
2730 | docker run --rm -v /tmp:/backup --volumes-from "$1" busybox ls -lh "${@:2}" |
|
3448 | docker run --rm -v /tmp:/backup --volumes-from "$1" busybox ls -lh "${@:2}" | |
2731 | } |
|
3449 | } | |
2732 |
|
3450 | |||
2733 | get_started() { |
|
3451 | get_started() { | |
2734 | echo "" |
|
3452 | echo "" | |
2735 | echo "~~~~ $(green Bootstrap completed) ~~~~" |
|
3453 | echo "~~~~ $(green Bootstrap completed) ~~~~" | |
2736 | echo "To start using RhodeCode run the following stacks using ./rccontrol stack [STACK_NAME]" |
|
3454 | echo "To start using RhodeCode run the following stacks using ./rccontrol stack [STACK_NAME]" | |
2737 | echo "" |
|
3455 | echo "" | |
2738 | echo "$(yellow_bold [Optional]): run the edge router to control domain and SSL" |
|
3456 | echo "$(yellow_bold [Optional]): run the edge router to control domain and SSL" | |
2739 | echo "./rccontrol stack router up --detach" |
|
3457 | echo "./rccontrol stack router up --detach" | |
2740 | echo "" |
|
3458 | echo "" | |
2741 | echo "$(green_bold [Mandatory]): run the services, like database, redis, channelstream etc..." |
|
3459 | echo "$(green_bold [Mandatory]): run the services, like database, redis, channelstream etc..." | |
2742 | echo "./rccontrol stack services up --detach" |
|
3460 | echo "./rccontrol stack services up --detach" | |
2743 | echo "" |
|
3461 | echo "" | |
2744 | echo "$(green_bold [Mandatory]): run the rhodecode app stack" |
|
3462 | echo "$(green_bold [Mandatory]): run the rhodecode app stack" | |
2745 | echo "./rccontrol stack rhodecode up --detach" |
|
3463 | echo "./rccontrol stack rhodecode up --detach" | |
2746 | echo "" |
|
3464 | echo "" | |
2747 | echo "$(yellow_bold [Optional]): run the monitoring stack, this includes grafana/promethues logging/metrics system" |
|
3465 | echo "$(yellow_bold [Optional]): run the monitoring stack, this includes grafana/promethues logging/metrics system" | |
2748 | echo "./rccontrol stack metrics up --detach" |
|
3466 | echo "./rccontrol stack metrics up --detach" | |
2749 | echo "" |
|
3467 | echo "" | |
2750 | echo "check services status/ports" |
|
3468 | echo "check services status/ports" | |
2751 | echo "./rccontrol status" |
|
3469 | echo "./rccontrol status" | |
2752 | } |
|
3470 | } | |
2753 | } |
|
3471 | } | |
2754 |
|
3472 | |||
2755 | # :command.run |
|
3473 | # :command.run | |
2756 | run() { |
|
3474 | run() { | |
2757 | declare -A args=() |
|
3475 | declare -A args=() | |
2758 | declare -a other_args=() |
|
3476 | declare -a other_args=() | |
2759 | declare -a input=() |
|
3477 | declare -a input=() | |
2760 | normalize_input "$@" |
|
3478 | normalize_input "$@" | |
2761 | parse_requirements "${input[@]}" |
|
3479 | parse_requirements "${input[@]}" | |
2762 |
|
3480 | |||
2763 | if [[ $action == "self-update" ]]; then |
|
3481 | if [[ $action == "self-update" ]]; then | |
2764 | if [[ ${args[--help]:-} ]]; then |
|
3482 | if [[ ${args[--help]:-} ]]; then | |
2765 | long_usage=yes |
|
3483 | long_usage=yes | |
2766 | rccontrol_self_update_usage |
|
3484 | rccontrol_self_update_usage | |
2767 | else |
|
3485 | else | |
2768 | rccontrol_self_update_command |
|
3486 | rccontrol_self_update_command | |
2769 | fi |
|
3487 | fi | |
2770 |
|
3488 | |||
2771 | elif [[ $action == "bootstrap" ]]; then |
|
3489 | elif [[ $action == "bootstrap" ]]; then | |
2772 | if [[ ${args[--help]:-} ]]; then |
|
3490 | if [[ ${args[--help]:-} ]]; then | |
2773 | long_usage=yes |
|
3491 | long_usage=yes | |
2774 | rccontrol_bootstrap_usage |
|
3492 | rccontrol_bootstrap_usage | |
2775 | else |
|
3493 | else | |
2776 | rccontrol_bootstrap_command |
|
3494 | rccontrol_bootstrap_command | |
2777 | fi |
|
3495 | fi | |
2778 |
|
3496 | |||
2779 | elif [[ $action == "get-build-artifacts" ]]; then |
|
3497 | elif [[ $action == "get-build-artifacts" ]]; then | |
2780 | if [[ ${args[--help]:-} ]]; then |
|
3498 | if [[ ${args[--help]:-} ]]; then | |
2781 | long_usage=yes |
|
3499 | long_usage=yes | |
2782 | rccontrol_get_build_artifacts_usage |
|
3500 | rccontrol_get_build_artifacts_usage | |
2783 | else |
|
3501 | else | |
2784 | rccontrol_get_build_artifacts_command |
|
3502 | rccontrol_get_build_artifacts_command | |
2785 | fi |
|
3503 | fi | |
2786 |
|
3504 | |||
2787 | elif [[ $action == "build" ]]; then |
|
3505 | elif [[ $action == "build" ]]; then | |
2788 | if [[ ${args[--help]:-} ]]; then |
|
3506 | if [[ ${args[--help]:-} ]]; then | |
2789 | long_usage=yes |
|
3507 | long_usage=yes | |
2790 | rccontrol_build_usage |
|
3508 | rccontrol_build_usage | |
2791 | else |
|
3509 | else | |
2792 | rccontrol_build_command |
|
3510 | rccontrol_build_command | |
2793 | fi |
|
3511 | fi | |
2794 |
|
3512 | |||
2795 | elif [[ $action == "get-build-source" ]]; then |
|
3513 | elif [[ $action == "get-build-source" ]]; then | |
2796 | if [[ ${args[--help]:-} ]]; then |
|
3514 | if [[ ${args[--help]:-} ]]; then | |
2797 | long_usage=yes |
|
3515 | long_usage=yes | |
2798 | rccontrol_get_build_source_usage |
|
3516 | rccontrol_get_build_source_usage | |
2799 | else |
|
3517 | else | |
2800 | rccontrol_get_build_source_command |
|
3518 | rccontrol_get_build_source_command | |
2801 | fi |
|
3519 | fi | |
2802 |
|
3520 | |||
2803 | elif [[ $action == "build-source" ]]; then |
|
3521 | elif [[ $action == "build-source" ]]; then | |
2804 | if [[ ${args[--help]:-} ]]; then |
|
3522 | if [[ ${args[--help]:-} ]]; then | |
2805 | long_usage=yes |
|
3523 | long_usage=yes | |
2806 | rccontrol_build_source_usage |
|
3524 | rccontrol_build_source_usage | |
2807 | else |
|
3525 | else | |
2808 | rccontrol_build_source_command |
|
3526 | rccontrol_build_source_command | |
2809 | fi |
|
3527 | fi | |
2810 |
|
3528 | |||
2811 | elif [[ $action == "stack" ]]; then |
|
3529 | elif [[ $action == "stack" ]]; then | |
2812 | if [[ ${args[--help]:-} ]]; then |
|
3530 | if [[ ${args[--help]:-} ]]; then | |
2813 | long_usage=yes |
|
3531 | long_usage=yes | |
2814 | rccontrol_stack_usage |
|
3532 | rccontrol_stack_usage | |
2815 | else |
|
3533 | else | |
2816 | rccontrol_stack_command |
|
3534 | rccontrol_stack_command | |
2817 | fi |
|
3535 | fi | |
2818 |
|
3536 | |||
|
3537 | elif [[ $action == "stack router" ]]; then | |||
|
3538 | if [[ ${args[--help]:-} ]]; then | |||
|
3539 | long_usage=yes | |||
|
3540 | rccontrol_stack_router_usage | |||
|
3541 | else | |||
|
3542 | rccontrol_stack_router_command | |||
|
3543 | fi | |||
|
3544 | ||||
|
3545 | elif [[ $action == "stack metrics" ]]; then | |||
|
3546 | if [[ ${args[--help]:-} ]]; then | |||
|
3547 | long_usage=yes | |||
|
3548 | rccontrol_stack_metrics_usage | |||
|
3549 | else | |||
|
3550 | rccontrol_stack_metrics_command | |||
|
3551 | fi | |||
|
3552 | ||||
|
3553 | elif [[ $action == "stack services" ]]; then | |||
|
3554 | if [[ ${args[--help]:-} ]]; then | |||
|
3555 | long_usage=yes | |||
|
3556 | rccontrol_stack_services_usage | |||
|
3557 | else | |||
|
3558 | rccontrol_stack_services_command | |||
|
3559 | fi | |||
|
3560 | ||||
|
3561 | elif [[ $action == "stack rhodecode" ]]; then | |||
|
3562 | if [[ ${args[--help]:-} ]]; then | |||
|
3563 | long_usage=yes | |||
|
3564 | rccontrol_stack_rhodecode_usage | |||
|
3565 | else | |||
|
3566 | rccontrol_stack_rhodecode_command | |||
|
3567 | fi | |||
|
3568 | ||||
|
3569 | elif [[ $action == "stack all" ]]; then | |||
|
3570 | if [[ ${args[--help]:-} ]]; then | |||
|
3571 | long_usage=yes | |||
|
3572 | rccontrol_stack_all_usage | |||
|
3573 | else | |||
|
3574 | rccontrol_stack_all_command | |||
|
3575 | fi | |||
|
3576 | ||||
2819 | elif [[ $action == "stack-status" ]]; then |
|
3577 | elif [[ $action == "stack-status" ]]; then | |
2820 | if [[ ${args[--help]:-} ]]; then |
|
3578 | if [[ ${args[--help]:-} ]]; then | |
2821 | long_usage=yes |
|
3579 | long_usage=yes | |
2822 | rccontrol_stack_status_usage |
|
3580 | rccontrol_stack_status_usage | |
2823 | else |
|
3581 | else | |
2824 | rccontrol_stack_status_command |
|
3582 | rccontrol_stack_status_command | |
2825 | fi |
|
3583 | fi | |
2826 |
|
3584 | |||
2827 | elif [[ $action == "stack-upgrade" ]]; then |
|
3585 | elif [[ $action == "stack-upgrade" ]]; then | |
2828 | if [[ ${args[--help]:-} ]]; then |
|
3586 | if [[ ${args[--help]:-} ]]; then | |
2829 | long_usage=yes |
|
3587 | long_usage=yes | |
2830 | rccontrol_stack_upgrade_usage |
|
3588 | rccontrol_stack_upgrade_usage | |
2831 | else |
|
3589 | else | |
2832 | rccontrol_stack_upgrade_command |
|
3590 | rccontrol_stack_upgrade_command | |
2833 | fi |
|
3591 | fi | |
2834 |
|
3592 | |||
2835 |
elif [[ $action == "cli |
|
3593 | elif [[ $action == "cli" ]]; then | |
|
3594 | if [[ ${args[--help]:-} ]]; then | |||
|
3595 | long_usage=yes | |||
|
3596 | rccontrol_cli_usage | |||
|
3597 | else | |||
|
3598 | rccontrol_cli_command | |||
|
3599 | fi | |||
|
3600 | ||||
|
3601 | elif [[ $action == "cli redis" ]]; then | |||
2836 | if [[ ${args[--help]:-} ]]; then |
|
3602 | if [[ ${args[--help]:-} ]]; then | |
2837 | long_usage=yes |
|
3603 | long_usage=yes | |
2838 | rccontrol_cli_redis_usage |
|
3604 | rccontrol_cli_redis_usage | |
2839 | else |
|
3605 | else | |
2840 | rccontrol_cli_redis_command |
|
3606 | rccontrol_cli_redis_command | |
2841 | fi |
|
3607 | fi | |
2842 |
|
3608 | |||
2843 |
elif [[ $action == "cli |
|
3609 | elif [[ $action == "cli db" ]]; then | |
2844 | if [[ ${args[--help]:-} ]]; then |
|
3610 | if [[ ${args[--help]:-} ]]; then | |
2845 | long_usage=yes |
|
3611 | long_usage=yes | |
2846 | rccontrol_cli_db_usage |
|
3612 | rccontrol_cli_db_usage | |
2847 | else |
|
3613 | else | |
2848 | rccontrol_cli_db_command |
|
3614 | rccontrol_cli_db_command | |
2849 | fi |
|
3615 | fi | |
2850 |
|
3616 | |||
2851 |
elif [[ $action == "cli |
|
3617 | elif [[ $action == "cli db-upgrade" ]]; then | |
2852 | if [[ ${args[--help]:-} ]]; then |
|
3618 | if [[ ${args[--help]:-} ]]; then | |
2853 | long_usage=yes |
|
3619 | long_usage=yes | |
2854 | rccontrol_cli_db_upgrade_usage |
|
3620 | rccontrol_cli_db_upgrade_usage | |
2855 | else |
|
3621 | else | |
2856 | rccontrol_cli_db_upgrade_command |
|
3622 | rccontrol_cli_db_upgrade_command | |
2857 | fi |
|
3623 | fi | |
2858 |
|
3624 | |||
|
3625 | elif [[ $action == "cli storage" ]]; then | |||
|
3626 | if [[ ${args[--help]:-} ]]; then | |||
|
3627 | long_usage=yes | |||
|
3628 | rccontrol_cli_storage_usage | |||
|
3629 | else | |||
|
3630 | rccontrol_cli_storage_command | |||
|
3631 | fi | |||
|
3632 | ||||
2859 | elif [[ $action == "_completions" ]]; then |
|
3633 | elif [[ $action == "_completions" ]]; then | |
2860 | if [[ ${args[--help]:-} ]]; then |
|
3634 | if [[ ${args[--help]:-} ]]; then | |
2861 | long_usage=yes |
|
3635 | long_usage=yes | |
2862 | rccontrol__completions_usage |
|
3636 | rccontrol__completions_usage | |
2863 | else |
|
3637 | else | |
2864 | rccontrol__completions_command |
|
3638 | rccontrol__completions_command | |
2865 | fi |
|
3639 | fi | |
2866 |
|
3640 | |||
2867 | elif [[ $action == "backup-db" ]]; then |
|
3641 | elif [[ $action == "backup-db" ]]; then | |
2868 | if [[ ${args[--help]:-} ]]; then |
|
3642 | if [[ ${args[--help]:-} ]]; then | |
2869 | long_usage=yes |
|
3643 | long_usage=yes | |
2870 | rccontrol_backup_db_usage |
|
3644 | rccontrol_backup_db_usage | |
2871 | else |
|
3645 | else | |
2872 | rccontrol_backup_db_command |
|
3646 | rccontrol_backup_db_command | |
2873 | fi |
|
3647 | fi | |
2874 |
|
3648 | |||
2875 | elif [[ $action == "backup-data" ]]; then |
|
3649 | elif [[ $action == "backup-data" ]]; then | |
2876 | if [[ ${args[--help]:-} ]]; then |
|
3650 | if [[ ${args[--help]:-} ]]; then | |
2877 | long_usage=yes |
|
3651 | long_usage=yes | |
2878 | rccontrol_backup_data_usage |
|
3652 | rccontrol_backup_data_usage | |
2879 | else |
|
3653 | else | |
2880 | rccontrol_backup_data_command |
|
3654 | rccontrol_backup_data_command | |
2881 | fi |
|
3655 | fi | |
2882 |
|
3656 | |||
2883 | elif [[ $action == "root" ]]; then |
|
3657 | elif [[ $action == "root" ]]; then | |
2884 | root_command |
|
3658 | root_command | |
2885 | fi |
|
3659 | fi | |
2886 | } |
|
3660 | } | |
2887 |
|
3661 | |||
2888 | initialize |
|
3662 | initialize | |
2889 | run "$@" |
|
3663 | run "$@" |
@@ -1,283 +1,283 b'' | |||||
1 | FROM ubuntu:22.04 |
|
1 | FROM ubuntu:22.04 | |
2 | # Using 22.04 LTS Release |
|
2 | # Using 22.04 LTS Release | |
3 | MAINTAINER RhodeCode Inc. <support@rhodecode.com> |
|
3 | MAINTAINER RhodeCode Inc. <support@rhodecode.com> | |
4 |
|
4 | |||
5 | ARG TZ="UTC" |
|
5 | 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.28.0 |
|
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= |
|
14 | ARG RHODECODE_USER_EMAIL=admin@server.local | |
15 |
|
15 | |||
16 | # nix ver/channels |
|
16 | # nix ver/channels | |
17 | ARG DEV_NIX_VERSION=2.0.4 |
|
17 | ARG DEV_NIX_VERSION=2.0.4 | |
18 | ARG DEV_NIX_CHANNEL=nixos-18.03 |
|
18 | ARG DEV_NIX_CHANNEL=nixos-18.03 | |
19 |
|
19 | |||
20 | # env are runtime |
|
20 | # env are runtime | |
21 | ENV \ |
|
21 | ENV \ | |
22 | TZ=${TZ} \ |
|
22 | TZ=${TZ} \ | |
23 | LOCALE_TYPE=${LOCALE_TYPE} \ |
|
23 | LOCALE_TYPE=${LOCALE_TYPE} \ | |
24 | \ |
|
24 | \ | |
25 | ## Define type we build, and the instance we'll create |
|
25 | ## Define type we build, and the instance we'll create | |
26 | RHODECODE_TYPE=${RHODECODE_TYPE} \ |
|
26 | RHODECODE_TYPE=${RHODECODE_TYPE} \ | |
27 | RC_TYPE_ID=enterprise-1 \ |
|
27 | RC_TYPE_ID=enterprise-1 \ | |
28 | \ |
|
28 | \ | |
29 | ## SETUP ARGS FOR INSTALLATION ## |
|
29 | ## SETUP ARGS FOR INSTALLATION ## | |
30 | ## set version we build on, get from .env or set default ver |
|
30 | ## set version we build on, get from .env or set default ver | |
31 | RHODECODE_VERSION=${RHODECODE_VERSION} \ |
|
31 | RHODECODE_VERSION=${RHODECODE_VERSION} \ | |
32 | \ |
|
32 | \ | |
33 | ## set DB, default sqlite |
|
33 | ## set DB, default sqlite | |
34 | RHODECODE_DB=${RHODECODE_DB} \ |
|
34 | RHODECODE_DB=${RHODECODE_DB} \ | |
35 | \ |
|
35 | \ | |
36 | ## set app bootstrap required data |
|
36 | ## set app bootstrap required data | |
37 | RHODECODE_USER_NAME=${RHODECODE_USER_NAME} \ |
|
37 | RHODECODE_USER_NAME=${RHODECODE_USER_NAME} \ | |
38 | RHODECODE_USER_PASS=${RHODECODE_USER_PASS} \ |
|
38 | RHODECODE_USER_PASS=${RHODECODE_USER_PASS} \ | |
39 | RHODECODE_USER_EMAIL=${RHODECODE_USER_EMAIL} \ |
|
39 | RHODECODE_USER_EMAIL=${RHODECODE_USER_EMAIL} \ | |
40 | \ |
|
40 | \ | |
41 | RC_USER=rhodecode \ |
|
41 | RC_USER=rhodecode \ | |
42 | \ |
|
42 | \ | |
43 | # SVN CONFIG |
|
43 | # SVN CONFIG | |
44 | MOD_DAV_SVN_CONF_FILE=/etc/rhodecode/conf/svn/mod_dav_svn.conf \ |
|
44 | MOD_DAV_SVN_CONF_FILE=/etc/rhodecode/conf/svn/mod_dav_svn.conf \ | |
45 | MOD_DAV_SVN_PORT=8090 \ |
|
45 | MOD_DAV_SVN_PORT=8090 \ | |
46 | \ |
|
46 | \ | |
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 | SHARED_CONF_DIR=/etc/rhodecode/conf \ | |
51 | BUILD_CONF=/etc/rhodecode/conf_build \ |
|
51 | BUILD_CONF=/etc/rhodecode/conf_build \ | |
52 | BUILD_BIN_DIR=/usr/local/bin/rhodecode_bin \ |
|
52 | BUILD_BIN_DIR=/usr/local/bin/rhodecode_bin \ | |
53 | RHODECODE_DATA_DIR=/var/opt/rhodecode_data \ |
|
53 | RHODECODE_DATA_DIR=/var/opt/rhodecode_data \ | |
54 | RHODECODE_REPO_DIR=/var/opt/rhodecode_repo_store \ |
|
54 | RHODECODE_REPO_DIR=/var/opt/rhodecode_repo_store \ | |
55 | RHODECODE_HTTP_PORT=10020 \ |
|
55 | RHODECODE_HTTP_PORT=10020 \ | |
56 | RHODECODE_VCS_PORT=10010 \ |
|
56 | RHODECODE_VCS_PORT=10010 \ | |
57 | RHODECODE_HOST=0.0.0.0 \ |
|
57 | RHODECODE_HOST=0.0.0.0 \ | |
58 | RHODECODE_VCS_HOST=127.0.0.1 |
|
58 | RHODECODE_VCS_HOST=127.0.0.1 | |
59 |
|
59 | |||
60 | ENV \ |
|
60 | ENV \ | |
61 | RCCONTROL=/home/$RC_USER/.rccontrol-profile/bin/rccontrol \ |
|
61 | RCCONTROL=/home/$RC_USER/.rccontrol-profile/bin/rccontrol \ | |
62 | SUPERVISOR_CONF=/home/$RC_USER/.rccontrol/supervisor/supervisord.ini \ |
|
62 | SUPERVISOR_CONF=/home/$RC_USER/.rccontrol/supervisor/supervisord.ini \ | |
63 | # make application scripts visible |
|
63 | # make application scripts visible | |
64 | PATH=$PATH:/home/$RC_USER/.rccontrol-profile/bin |
|
64 | PATH=$PATH:/home/$RC_USER/.rccontrol-profile/bin | |
65 |
|
65 | |||
66 | ENV SVN_LOCALE_DEPS apache2 apache2-utils libapache2-mod-svn |
|
66 | ENV SVN_LOCALE_DEPS apache2 apache2-utils libapache2-mod-svn | |
67 | ENV SSH_LOCALE_DEPS openssh-server |
|
67 | ENV SSH_LOCALE_DEPS openssh-server | |
68 | ENV PYTHON_DEPS python2 |
|
68 | ENV PYTHON_DEPS python2 | |
69 | ENV EXTRA_DEPS "" |
|
69 | ENV EXTRA_DEPS "" | |
70 |
|
70 | |||
71 | RUN \ |
|
71 | RUN \ | |
72 | echo "** install base packages **" && \ |
|
72 | echo "** install base packages **" && \ | |
73 | set -eux; \ |
|
73 | set -eux; \ | |
74 | \ |
|
74 | \ | |
75 | savedAptMark="$(apt-mark showmanual)"; \ |
|
75 | savedAptMark="$(apt-mark showmanual)"; \ | |
76 | apt-get update; \ |
|
76 | apt-get update; \ | |
77 | DEBIAN_FRONTEND="noninteractive" \ |
|
77 | DEBIAN_FRONTEND="noninteractive" \ | |
78 | apt-get install -y --no-install-recommends \ |
|
78 | apt-get install -y --no-install-recommends \ | |
79 | tini \ |
|
79 | tini \ | |
80 | bash \ |
|
80 | bash \ | |
81 | binutils \ |
|
81 | binutils \ | |
82 | tzdata \ |
|
82 | tzdata \ | |
83 | locales \ |
|
83 | locales \ | |
84 | openssl \ |
|
84 | openssl \ | |
85 | curl \ |
|
85 | curl \ | |
86 | sudo \ |
|
86 | sudo \ | |
87 | gosu \ |
|
87 | gosu \ | |
88 | bzip2 \ |
|
88 | bzip2 \ | |
89 | ca-certificates \ |
|
89 | ca-certificates \ | |
90 | $PYTHON_DEPS \ |
|
90 | $PYTHON_DEPS \ | |
91 | $SSH_LOCALE_DEPS \ |
|
91 | $SSH_LOCALE_DEPS \ | |
92 | $SVN_LOCALE_DEPS \ |
|
92 | $SVN_LOCALE_DEPS \ | |
93 | $EXTRA_DEPS \ |
|
93 | $EXTRA_DEPS \ | |
94 | ; \ |
|
94 | ; \ | |
95 | rm -rf /var/lib/apt/lists/*; |
|
95 | rm -rf /var/lib/apt/lists/*; | |
96 |
|
96 | |||
97 | RUN \ |
|
97 | RUN \ | |
98 | echo "** Configure the python executable for py2/3 compat **" && \ |
|
98 | echo "** Configure the python executable for py2/3 compat **" && \ | |
99 | IS_PY=$(which python3 || which python2) && \ |
|
99 | IS_PY=$(which python3 || which python2) && \ | |
100 | if [ -n $IS_PY ] ; then ln -s $IS_PY /usr/bin/python ; fi |
|
100 | if [ -n $IS_PY ] ; then ln -s $IS_PY /usr/bin/python ; fi | |
101 |
|
101 | |||
102 | RUN \ |
|
102 | RUN \ | |
103 | echo "** Configure the locales **" && \ |
|
103 | echo "** Configure the locales **" && \ | |
104 | sed -i "s/^# ${LOCALE_TYPE}/${LOCALE_TYPE}/g" /etc/locale.gen && \ |
|
104 | sed -i "s/^# ${LOCALE_TYPE}/${LOCALE_TYPE}/g" /etc/locale.gen && \ | |
105 | locale-gen |
|
105 | locale-gen | |
106 |
|
106 | |||
107 | # locale-archive is a fix for old nix glibc2.26 locales available |
|
107 | # locale-archive is a fix for old nix glibc2.26 locales available | |
108 | ENV \ |
|
108 | ENV \ | |
109 | LOCALE_ARCHIVE=/var/opt/locale-archive \ |
|
109 | LOCALE_ARCHIVE=/var/opt/locale-archive \ | |
110 | LANG=${LOCALE_TYPE} \ |
|
110 | LANG=${LOCALE_TYPE} \ | |
111 | LANGUAGE=${LOCALE_TYPE} \ |
|
111 | LANGUAGE=${LOCALE_TYPE} \ | |
112 | LC_ALL=${LOCALE_TYPE} |
|
112 | LC_ALL=${LOCALE_TYPE} | |
113 |
|
113 | |||
114 | # configure the system user |
|
114 | # configure the system user | |
115 | # explicitly set uid/gid to guarantee that it won't change in the future |
|
115 | # explicitly set uid/gid to guarantee that it won't change in the future | |
116 | # the values 999:999 are identical to the current user/group id assigned |
|
116 | # the values 999:999 are identical to the current user/group id assigned | |
117 | RUN \ |
|
117 | RUN \ | |
118 | echo "** Create system user $RC_USER **" && \ |
|
118 | echo "** Create system user $RC_USER **" && \ | |
119 | groupadd --system --gid 999 $RC_USER && \ |
|
119 | groupadd --system --gid 999 $RC_USER && \ | |
120 | 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 && \ | |
121 | usermod -G $RC_USER $RC_USER |
|
121 | usermod -G $RC_USER $RC_USER | |
122 |
|
122 | |||
123 | RUN \ |
|
123 | RUN \ | |
124 | echo "** Create nix-build user $NIX_BLD_USER **" && \ |
|
124 | echo "** Create nix-build user $NIX_BLD_USER **" && \ | |
125 | groupadd --system --gid 1099 $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 && \ |
|
126 | useradd --system --gid $NIX_BLD_USER --uid 1099 --shell /bin/bash $NIX_BLD_USER && \ | |
127 | usermod -G $NIX_BLD_USER $NIX_BLD_USER |
|
127 | usermod -G $NIX_BLD_USER $NIX_BLD_USER | |
128 |
|
128 | |||
129 | RUN \ |
|
129 | RUN \ | |
130 | echo "** disable nix sandboxing **" && \ |
|
130 | echo "** disable nix sandboxing **" && \ | |
131 | mkdir /etc/nix && echo 'sandbox = false' > /etc/nix/nix.conf |
|
131 | mkdir /etc/nix && echo 'sandbox = false' > /etc/nix/nix.conf | |
132 |
|
132 | |||
133 |
|
133 | |||
134 | # set the defult bash shell |
|
134 | # set the defult bash shell | |
135 | SHELL ["/bin/bash", "-c"] |
|
135 | SHELL ["/bin/bash", "-c"] | |
136 |
|
136 | |||
137 | # Fix and set a timezone |
|
137 | # Fix and set a timezone | |
138 | RUN \ |
|
138 | RUN \ | |
139 | echo "** configure the timezone **" && \ |
|
139 | echo "** configure the timezone **" && \ | |
140 | rm /etc/localtime && cp /usr/share/zoneinfo/$TZ /etc/localtime && \ |
|
140 | rm /etc/localtime && cp /usr/share/zoneinfo/$TZ /etc/localtime && \ | |
141 | echo $TZ > /etc/timezone |
|
141 | echo $TZ > /etc/timezone | |
142 |
|
142 | |||
143 |
|
143 | |||
144 | RUN \ |
|
144 | RUN \ | |
145 | echo "** prepare rhodecode store and cache **" && \ |
|
145 | echo "** prepare rhodecode store and cache **" && \ | |
146 | install -d -m 0700 -o $RC_USER -g $RC_USER /nix && \ |
|
146 | install -d -m 0700 -o $RC_USER -g $RC_USER /nix && \ | |
147 | 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 && \ | |
148 | install -d -m 0755 -o $RC_USER -g $RC_USER /usr/local/bin/rhodecode_bin && \ |
|
148 | install -d -m 0755 -o $RC_USER -g $RC_USER /usr/local/bin/rhodecode_bin && \ | |
149 | 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 && \ | |
150 | 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 && \ | |
151 | 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 && \ |
|
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 && \ |
|
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 && \ |
|
154 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/rhodecode-enterprise-ee && \ | |
155 | 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/ && \ | |
156 | 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 && \ | |
157 | 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 && \ | |
158 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/.rccontrol/bootstrap && \ |
|
158 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/.rccontrol/bootstrap && \ | |
159 | install -d -m 0700 -o $RC_USER -g $RC_USER /home/$RC_USER/.ssh && \ |
|
159 | install -d -m 0700 -o $RC_USER -g $RC_USER /home/$RC_USER/.ssh && \ | |
160 | install -d -m 0700 -o $RC_USER -g $RC_USER /home/$RC_USER/.rhoderc |
|
160 | install -d -m 0700 -o $RC_USER -g $RC_USER /home/$RC_USER/.rhoderc | |
161 |
|
161 | |||
162 | # expose our custom sshd config |
|
162 | # expose our custom sshd config | |
163 | COPY service/sshd/sshd_config $SSHD_CONF_FILE |
|
163 | COPY service/sshd/sshd_config $SSHD_CONF_FILE | |
164 |
|
164 | |||
165 | # Apache SVN setup |
|
165 | # Apache SVN setup | |
166 | RUN \ |
|
166 | RUN \ | |
167 | echo "**** Apache config cleanup ****" && \ |
|
167 | echo "**** Apache config cleanup ****" && \ | |
168 | rm -f /etc/apache2/conf.d/info.conf \ |
|
168 | rm -f /etc/apache2/conf.d/info.conf \ | |
169 | /etc/apache2/conf.d/mpm.conf \ |
|
169 | /etc/apache2/conf.d/mpm.conf \ | |
170 | /etc/apache2/conf.d/userdir.conf && \ |
|
170 | /etc/apache2/conf.d/userdir.conf && \ | |
171 | rm -f /etc/apache2/sites-enabled/* && \ |
|
171 | rm -f /etc/apache2/sites-enabled/* && \ | |
172 | rm -f /etc/apache2/sites-available/* |
|
172 | rm -f /etc/apache2/sites-available/* | |
173 |
|
173 | |||
174 | # custom SVN virtualhost |
|
174 | # custom SVN virtualhost | |
175 | COPY service/svn/virtualhost.conf /etc/apache2/sites-enabled/ |
|
175 | COPY service/svn/virtualhost.conf /etc/apache2/sites-enabled/ | |
176 |
|
176 | |||
177 | RUN \ |
|
177 | RUN \ | |
178 | echo "**** Apache config ****" && \ |
|
178 | echo "**** Apache config ****" && \ | |
179 | echo $(strings /usr/lib/apache2/modules/mod_dav_svn.so | grep 'Powered by') > /var/opt/dav.version && \ |
|
179 | echo $(strings /usr/lib/apache2/modules/mod_dav_svn.so | grep 'Powered by') > /var/opt/dav.version && \ | |
180 | mkdir -p /run/apache2 && \ |
|
180 | mkdir -p /run/apache2 && \ | |
181 | mkdir -p /var/opt/www && \ |
|
181 | mkdir -p /var/opt/www && \ | |
182 | echo "unset HOME" > /etc/apache2/envvars && \ |
|
182 | echo "unset HOME" > /etc/apache2/envvars && \ | |
183 | echo "export APACHE_RUN_USER=${RC_USER}" >> /etc/apache2/envvars && \ |
|
183 | echo "export APACHE_RUN_USER=${RC_USER}" >> /etc/apache2/envvars && \ | |
184 | echo "export APACHE_PID_FILE=/var/run/apache2/apache2.pid" >> /etc/apache2/envvars && \ |
|
184 | echo "export APACHE_PID_FILE=/var/run/apache2/apache2.pid" >> /etc/apache2/envvars && \ | |
185 | echo "export APACHE_RUN_DIR=/var/run/apache2" >> /etc/apache2/envvars && \ |
|
185 | echo "export APACHE_RUN_DIR=/var/run/apache2" >> /etc/apache2/envvars && \ | |
186 | echo "export APACHE_LOCK_DIR=/var/lock/apache2" >> /etc/apache2/envvars && \ |
|
186 | echo "export APACHE_LOCK_DIR=/var/lock/apache2" >> /etc/apache2/envvars && \ | |
187 | echo "export APACHE_RUN_USER=${RC_USER}" >> /etc/apache2/envvars && \ |
|
187 | echo "export APACHE_RUN_USER=${RC_USER}" >> /etc/apache2/envvars && \ | |
188 | echo "export APACHE_RUN_GROUP=${RC_USER}" >> /etc/apache2/envvars && \ |
|
188 | echo "export APACHE_RUN_GROUP=${RC_USER}" >> /etc/apache2/envvars && \ | |
189 | sed -i "s/Listen 80/Listen ${MOD_DAV_SVN_PORT}/g" /etc/apache2/ports.conf |
|
189 | sed -i "s/Listen 80/Listen ${MOD_DAV_SVN_PORT}/g" /etc/apache2/ports.conf | |
190 |
|
190 | |||
191 |
|
191 | |||
192 | # Copy artifacts |
|
192 | # Copy artifacts | |
193 |
|
193 | |||
194 | 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/ | |
195 | COPY --chown=$RC_USER:$RC_USER config/_shared/rhodecode_enterprise.license /home/$RC_USER/.rccontrol/bootstrap/ |
|
195 | COPY --chown=$RC_USER:$RC_USER config/_shared/rhodecode_enterprise.license /home/$RC_USER/.rccontrol/bootstrap/ | |
196 | 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/ | |
197 |
|
197 | |||
198 | RUN \ |
|
198 | RUN \ | |
199 | echo "**** locale-archive path ****" && \ |
|
199 | echo "**** locale-archive path ****" && \ | |
200 | mv -v /home/$RC_USER/.rccontrol/cache/locale-archive /var/opt/locale-archive |
|
200 | mv -v /home/$RC_USER/.rccontrol/cache/locale-archive /var/opt/locale-archive | |
201 |
|
201 | |||
202 | # change to non-root user for RUN commands |
|
202 | # change to non-root user for RUN commands | |
203 | USER $RC_USER |
|
203 | USER $RC_USER | |
204 | WORKDIR /home/$RC_USER |
|
204 | WORKDIR /home/$RC_USER | |
205 |
|
205 | |||
206 | RUN \ |
|
206 | RUN \ | |
207 | echo "** install rhodecode control **" && \ |
|
207 | echo "** install rhodecode control **" && \ | |
208 | cd /home/$RC_USER/.rccontrol/cache && \ |
|
208 | cd /home/$RC_USER/.rccontrol/cache && \ | |
209 | INSTALLER=$(ls -Art /home/$RC_USER/.rccontrol/cache/RhodeCode-installer-* | tail -n 1) && \ |
|
209 | INSTALLER=$(ls -Art /home/$RC_USER/.rccontrol/cache/RhodeCode-installer-* | tail -n 1) && \ | |
210 | chmod +x ${INSTALLER} && \ |
|
210 | chmod +x ${INSTALLER} && \ | |
211 | ${INSTALLER} --accept-license && \ |
|
211 | ${INSTALLER} --accept-license && \ | |
212 | ${RCCONTROL} self-init && \ |
|
212 | ${RCCONTROL} self-init && \ | |
213 | 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/ && \ | |
214 | echo "Done installing rhodecode control" |
|
214 | echo "Done installing rhodecode control" | |
215 |
|
215 | |||
216 | RUN \ |
|
216 | RUN \ | |
217 | echo "** install vcsserver ${RHODECODE_VERSION} **" && \ |
|
217 | echo "** install vcsserver ${RHODECODE_VERSION} **" && \ | |
218 | ${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 \ | |
219 | '{"host":"'"$RHODECODE_VCS_HOST"'", "port":"'"$RHODECODE_VCS_PORT"'"}' && \ |
|
219 | '{"host":"'"$RHODECODE_VCS_HOST"'", "port":"'"$RHODECODE_VCS_PORT"'"}' && \ | |
220 | VCSSERVER_PATH=/home/$RC_USER/.rccontrol/vcsserver-1 && \ |
|
220 | VCSSERVER_PATH=/home/$RC_USER/.rccontrol/vcsserver-1 && \ | |
221 | rm -rf $BUILD_BIN_DIR/vcs_bin && \ |
|
221 | rm -rf $BUILD_BIN_DIR/vcs_bin && \ | |
222 | ln -s ${VCSSERVER_PATH}/profile/bin $BUILD_BIN_DIR/vcs_bin && \ |
|
222 | ln -s ${VCSSERVER_PATH}/profile/bin $BUILD_BIN_DIR/vcs_bin && \ | |
223 | cp -v ${VCSSERVER_PATH}/vcsserver.ini $BUILD_CONF/vcsserver.ini && \ |
|
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 && \ |
|
224 | cp -v ${VCSSERVER_PATH}/gunicorn_conf.py $BUILD_CONF/gunicorn_conf_vcs.py && \ | |
225 | echo "Done installing vcsserver" |
|
225 | echo "Done installing vcsserver" | |
226 |
|
226 | |||
227 | RUN \ |
|
227 | RUN \ | |
228 | echo "** install rhodecode ${RHODECODE_TYPE} ${RHODECODE_VERSION} **" && \ |
|
228 | echo "** install rhodecode ${RHODECODE_TYPE} ${RHODECODE_VERSION} **" && \ | |
229 | RHODECODE_DB_INIT=sqlite && \ |
|
229 | RHODECODE_DB_INIT=sqlite && \ | |
230 | ${RCCONTROL} install ${RHODECODE_TYPE} --version ${RHODECODE_VERSION} --start-at-boot=yes --accept-license --offline \ |
|
230 | ${RCCONTROL} install ${RHODECODE_TYPE} --version ${RHODECODE_VERSION} --start-at-boot=yes --accept-license --offline \ | |
231 | '{"host":"'"$RHODECODE_HOST"'", "port":"'"$RHODECODE_HTTP_PORT"'", "username":"'"$RHODECODE_USER_NAME"'", "password":"'"$RHODECODE_USER_PASS"'", "email":"'"$RHODECODE_USER_EMAIL"'", "repo_dir":"'"$RHODECODE_REPO_DIR"'", "database": "'"$RHODECODE_DB_INIT"'", "skip_existing_db": "1"}' && \ |
|
231 | '{"host":"'"$RHODECODE_HOST"'", "port":"'"$RHODECODE_HTTP_PORT"'", "username":"'"$RHODECODE_USER_NAME"'", "password":"'"$RHODECODE_USER_PASS"'", "email":"'"$RHODECODE_USER_EMAIL"'", "repo_dir":"'"$RHODECODE_REPO_DIR"'", "database": "'"$RHODECODE_DB_INIT"'", "skip_existing_db": "1"}' && \ | |
232 | RHODECODE_PATH=/home/$RC_USER/.rccontrol/${RC_TYPE_ID} && \ |
|
232 | RHODECODE_PATH=/home/$RC_USER/.rccontrol/${RC_TYPE_ID} && \ | |
233 | rm -rf $BUILD_BIN_DIR/bin && ln -s ${RHODECODE_PATH}/profile/bin $BUILD_BIN_DIR/ && \ |
|
233 | rm -rf $BUILD_BIN_DIR/bin && ln -s ${RHODECODE_PATH}/profile/bin $BUILD_BIN_DIR/ && \ | |
234 | cp -v ${RHODECODE_PATH}/rhodecode.ini $BUILD_CONF/rhodecode.ini && \ |
|
234 | cp -v ${RHODECODE_PATH}/rhodecode.ini $BUILD_CONF/rhodecode.ini && \ | |
235 | cp -v ${RHODECODE_PATH}/gunicorn_conf.py $BUILD_CONF/gunicorn_conf.py && \ |
|
235 | cp -v ${RHODECODE_PATH}/gunicorn_conf.py $BUILD_CONF/gunicorn_conf_rc.py && \ | |
236 | 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 && \ | |
237 | 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/ && \ | |
238 | rm ${RHODECODE_PATH}/rhodecode.db && \ |
|
238 | rm ${RHODECODE_PATH}/rhodecode.db && \ | |
239 | echo "Done installing rhodecode" |
|
239 | echo "Done installing rhodecode" | |
240 |
|
240 | |||
241 |
|
241 | |||
242 | RUN \ |
|
242 | RUN \ | |
243 | echo "** configure supervisord **" && \ |
|
243 | echo "** configure supervisord **" && \ | |
244 | cp -v ${SUPERVISOR_CONF} $BUILD_CONF/ && \ |
|
244 | cp -v ${SUPERVISOR_CONF} $BUILD_CONF/ && \ | |
245 | 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 && \ | |
246 | echo "Done installing supervisord" |
|
246 | echo "Done installing supervisord" | |
247 |
|
247 | |||
248 | USER root |
|
248 | USER root | |
249 |
|
249 | |||
250 | RUN \ |
|
250 | RUN \ | |
251 | echo "**** cleanup ****" && \ |
|
251 | echo "**** cleanup ****" && \ | |
252 | apt-get remove -y $PYTHON_DEPS && \ |
|
252 | apt-get remove -y $PYTHON_DEPS && \ | |
253 | apt-get autoclean -y && \ |
|
253 | apt-get autoclean -y && \ | |
254 | rm -f /tmp/* && \ |
|
254 | rm -f /tmp/* && \ | |
255 | rm -rf /var/lib/apt/lists/* && \ |
|
255 | rm -rf /var/lib/apt/lists/* && \ | |
256 | rm -rf /var/cache/apk/* && \ |
|
256 | rm -rf /var/cache/apk/* && \ | |
257 | rm -f /home/$RC_USER/.rccontrol/cache/RhodeCode-installer-* && \ |
|
257 | rm -f /home/$RC_USER/.rccontrol/cache/RhodeCode-installer-* && \ | |
258 | rm -f /home/$RC_USER/.rccontrol/cache/*.bz2 && \ |
|
258 | rm -f /home/$RC_USER/.rccontrol/cache/*.bz2 && \ | |
259 | rm -f ${SUPERVISOR_CONF} && \ |
|
259 | rm -f ${SUPERVISOR_CONF} && \ | |
260 | echo "Done cleanup" |
|
260 | echo "Done cleanup" | |
261 |
|
261 | |||
262 |
|
262 | |||
263 | # copy entrypoints |
|
263 | # copy entrypoints | |
264 | COPY entrypoints.d/entrypoint.sh /opt/entrypoints.d/entrypoint.sh |
|
264 | COPY entrypoints.d/entrypoint.sh /opt/entrypoints.d/entrypoint.sh | |
265 |
|
265 | |||
266 | RUN chmod +x /opt/entrypoints.d/entrypoint.sh |
|
266 | RUN chmod +x /opt/entrypoints.d/entrypoint.sh | |
267 |
|
267 | |||
268 | # config volume |
|
268 | # config volume | |
269 | VOLUME /etc/rhodecode/conf |
|
269 | VOLUME /etc/rhodecode/conf | |
270 |
|
270 | |||
271 | # repo store volume |
|
271 | # repo store volume | |
272 | VOLUME /var/opt/rhodecode_repo_store |
|
272 | VOLUME /var/opt/rhodecode_repo_store | |
273 |
|
273 | |||
274 | # data volume |
|
274 | # data volume | |
275 | VOLUME /var/opt/rhodecode_data |
|
275 | VOLUME /var/opt/rhodecode_data | |
276 |
|
276 | |||
277 | # logs volume |
|
277 | # logs volume | |
278 | VOLUME /var/log/rhodecode |
|
278 | VOLUME /var/log/rhodecode | |
279 |
|
279 | |||
280 | ENTRYPOINT ["/opt/entrypoints.d/entrypoint.sh"] |
|
280 | ENTRYPOINT ["/opt/entrypoints.d/entrypoint.sh"] | |
281 |
|
281 | |||
282 | # compose can override this |
|
282 | # compose can override this | |
283 | CMD [ "$BUILD_BIN_DIR/bin/gunicorn", "--error-logfile=-", "--paster=/etc/rhodecode/conf_build/run.ini", "--config=/etc/rhodecode/conf_build/gunicorn_conf.py" ] |
|
283 | CMD [ "$BUILD_BIN_DIR/bin/gunicorn", "--error-logfile=-", "--paster=/etc/rhodecode/conf_build/run.ini", "--config=/etc/rhodecode/conf_build/gunicorn_conf_rc.py" ] |
@@ -1,324 +1,327 b'' | |||||
1 | FROM ubuntu:22.04 |
|
1 | FROM ubuntu:22.04 | |
2 | # Using 22.04 LTS Release |
|
2 | # Using 22.04 LTS Release | |
3 | MAINTAINER RhodeCode Inc. <support@rhodecode.com> |
|
3 | MAINTAINER RhodeCode Inc. <support@rhodecode.com> | |
4 |
|
4 | |||
5 | ARG TZ="UTC" |
|
5 | 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.28.0 |
|
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= |
|
14 | ARG RHODECODE_USER_EMAIL=admin@server.local | |
15 |
|
15 | |||
16 | # nix ver/channels |
|
16 | # nix ver/channels | |
17 | ARG DEV_NIX_VERSION=2.0.4 |
|
17 | ARG DEV_NIX_VERSION=2.0.4 | |
18 | ARG DEV_NIX_CHANNEL=nixos-18.03 |
|
18 | ARG DEV_NIX_CHANNEL=nixos-18.03 | |
19 |
|
19 | |||
20 | # env are runtime |
|
20 | # env are runtime | |
21 | ENV \ |
|
21 | ENV \ | |
22 | TZ=${TZ} \ |
|
22 | TZ=${TZ} \ | |
23 | LOCALE_TYPE=${LOCALE_TYPE} \ |
|
23 | LOCALE_TYPE=${LOCALE_TYPE} \ | |
24 | \ |
|
24 | \ | |
25 | ## Define type we build, and the instance we'll create |
|
25 | ## Define type we build, and the instance we'll create | |
26 | RHODECODE_TYPE=${RHODECODE_TYPE} \ |
|
26 | RHODECODE_TYPE=${RHODECODE_TYPE} \ | |
27 | RC_TYPE_ID=enterprise-1 \ |
|
27 | RC_TYPE_ID=enterprise-1 \ | |
28 | \ |
|
28 | \ | |
29 | ## SETUP ARGS FOR INSTALLATION ## |
|
29 | ## SETUP ARGS FOR INSTALLATION ## | |
30 | ## set version we build on, get from .env or set default ver |
|
30 | ## set version we build on, get from .env or set default ver | |
31 | RHODECODE_VERSION=${RHODECODE_VERSION} \ |
|
31 | RHODECODE_VERSION=${RHODECODE_VERSION} \ | |
32 | \ |
|
32 | \ | |
33 | ## set DB, default sqlite |
|
33 | ## set DB, default sqlite | |
34 | RHODECODE_DB=${RHODECODE_DB} \ |
|
34 | RHODECODE_DB=${RHODECODE_DB} \ | |
35 | \ |
|
35 | \ | |
36 | ## set app bootstrap required data |
|
36 | ## set app bootstrap required data | |
37 | RHODECODE_USER_NAME=${RHODECODE_USER_NAME} \ |
|
37 | RHODECODE_USER_NAME=${RHODECODE_USER_NAME} \ | |
38 | RHODECODE_USER_PASS=${RHODECODE_USER_PASS} \ |
|
38 | RHODECODE_USER_PASS=${RHODECODE_USER_PASS} \ | |
39 | RHODECODE_USER_EMAIL=${RHODECODE_USER_EMAIL} \ |
|
39 | RHODECODE_USER_EMAIL=${RHODECODE_USER_EMAIL} \ | |
40 | \ |
|
40 | \ | |
41 | RC_USER=rhodecode \ |
|
41 | RC_USER=rhodecode \ | |
42 | \ |
|
42 | \ | |
43 | # SVN CONFIG |
|
43 | # SVN CONFIG | |
44 | MOD_DAV_SVN_CONF_FILE=/etc/rhodecode/conf/svn/mod_dav_svn.conf \ |
|
44 | MOD_DAV_SVN_CONF_FILE=/etc/rhodecode/conf/svn/mod_dav_svn.conf \ | |
45 | MOD_DAV_SVN_PORT=8090 \ |
|
45 | MOD_DAV_SVN_PORT=8090 \ | |
46 | \ |
|
46 | \ | |
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 | SHARED_CONF_DIR=/etc/rhodecode/conf \ | |
51 | BUILD_CONF=/etc/rhodecode/conf_build \ |
|
51 | BUILD_CONF=/etc/rhodecode/conf_build \ | |
52 | BUILD_BIN_DIR=/usr/local/bin/rhodecode_bin \ |
|
52 | BUILD_BIN_DIR=/usr/local/bin/rhodecode_bin \ | |
53 | RHODECODE_DATA_DIR=/var/opt/rhodecode_data \ |
|
53 | RHODECODE_DATA_DIR=/var/opt/rhodecode_data \ | |
54 | RHODECODE_REPO_DIR=/var/opt/rhodecode_repo_store \ |
|
54 | RHODECODE_REPO_DIR=/var/opt/rhodecode_repo_store \ | |
55 | RHODECODE_HTTP_PORT=10020 \ |
|
55 | RHODECODE_HTTP_PORT=10020 \ | |
56 | RHODECODE_VCS_PORT=10010 \ |
|
56 | RHODECODE_VCS_PORT=10010 \ | |
57 | RHODECODE_HOST=0.0.0.0 \ |
|
57 | RHODECODE_HOST=0.0.0.0 \ | |
58 | RHODECODE_VCS_HOST=127.0.0.1 |
|
58 | RHODECODE_VCS_HOST=127.0.0.1 | |
59 |
|
59 | |||
60 | ENV \ |
|
60 | ENV \ | |
61 | RCCONTROL=/home/$RC_USER/.rccontrol-profile/bin/rccontrol \ |
|
61 | RCCONTROL=/home/$RC_USER/.rccontrol-profile/bin/rccontrol \ | |
62 | SUPERVISOR_CONF=/home/$RC_USER/.rccontrol/supervisor/supervisord.ini \ |
|
62 | SUPERVISOR_CONF=/home/$RC_USER/.rccontrol/supervisor/supervisord.ini \ | |
63 | # make application scripts visible |
|
63 | # make application scripts visible | |
64 | PATH=$PATH:/home/$RC_USER/.rccontrol-profile/bin |
|
64 | PATH=$PATH:/home/$RC_USER/.rccontrol-profile/bin | |
65 |
|
65 | |||
66 | ENV SVN_LOCALE_DEPS apache2 apache2-utils libapache2-mod-svn |
|
66 | ENV SVN_LOCALE_DEPS apache2 apache2-utils libapache2-mod-svn | |
67 | ENV SSH_LOCALE_DEPS openssh-server |
|
67 | ENV SSH_LOCALE_DEPS openssh-server | |
68 | ENV PYTHON_DEPS python2 |
|
68 | ENV PYTHON_DEPS python2 | |
69 |
ENV EXTRA_DEPS |
|
69 | ENV EXTRA_DEPS "" | |
70 |
|
70 | |||
71 | ENV \ |
|
71 | ENV \ | |
72 | 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 \ | |
73 | NIX_BLD_USER=nixbld \ |
|
73 | NIX_BLD_USER=nixbld \ | |
74 | NIX_PATH=/nix/var/nix/profiles/per-user/$RC_USER/channels \ |
|
74 | NIX_PATH=/nix/var/nix/profiles/per-user/$RC_USER/channels \ | |
75 | NIX_SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt |
|
75 | NIX_SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt | |
76 |
|
76 | |||
77 |
|
77 | |||
78 | RUN \ |
|
78 | RUN \ | |
79 | echo "** install base packages **" && \ |
|
79 | echo "** install base packages **" && \ | |
80 | set -eux; \ |
|
80 | set -eux; \ | |
81 | \ |
|
81 | \ | |
82 | savedAptMark="$(apt-mark showmanual)"; \ |
|
82 | savedAptMark="$(apt-mark showmanual)"; \ | |
83 | apt-get update; \ |
|
83 | apt-get update; \ | |
84 | DEBIAN_FRONTEND="noninteractive" \ |
|
84 | DEBIAN_FRONTEND="noninteractive" \ | |
85 | apt-get install -y --no-install-recommends \ |
|
85 | apt-get install -y --no-install-recommends \ | |
86 | tini \ |
|
86 | tini \ | |
87 | bash \ |
|
87 | bash \ | |
88 | binutils \ |
|
88 | binutils \ | |
89 | tzdata \ |
|
89 | tzdata \ | |
90 | locales \ |
|
90 | locales \ | |
91 | openssl \ |
|
91 | openssl \ | |
92 | curl \ |
|
92 | curl \ | |
93 | sudo \ |
|
93 | sudo \ | |
94 | gosu \ |
|
94 | gosu \ | |
95 | bzip2 \ |
|
95 | bzip2 \ | |
96 | ca-certificates \ |
|
96 | ca-certificates \ | |
97 | $PYTHON_DEPS \ |
|
97 | $PYTHON_DEPS \ | |
98 | $SSH_LOCALE_DEPS \ |
|
98 | $SSH_LOCALE_DEPS \ | |
99 | $SVN_LOCALE_DEPS \ |
|
99 | $SVN_LOCALE_DEPS \ | |
100 | $EXTRA_DEPS \ |
|
100 | $EXTRA_DEPS \ | |
101 | ; \ |
|
101 | ; \ | |
102 | rm -rf /var/lib/apt/lists/*; |
|
102 | rm -rf /var/lib/apt/lists/*; | |
103 |
|
103 | |||
104 | RUN \ |
|
104 | RUN \ | |
105 | echo "** Configure the python executable for py2/3 compat **" && \ |
|
105 | echo "** Configure the python executable for py2/3 compat **" && \ | |
106 | IS_PY=$(which python3 || which python2) && \ |
|
106 | IS_PY=$(which python3 || which python2) && \ | |
107 | if [ -n $IS_PY ] ; then ln -s $IS_PY /usr/bin/python ; fi |
|
107 | if [ -n $IS_PY ] ; then ln -s $IS_PY /usr/bin/python ; fi | |
108 |
|
108 | |||
109 | RUN \ |
|
109 | RUN \ | |
110 | echo "** Configure the locales **" && \ |
|
110 | echo "** Configure the locales **" && \ | |
111 | sed -i "s/^# ${LOCALE_TYPE}/${LOCALE_TYPE}/g" /etc/locale.gen && \ |
|
111 | sed -i "s/^# ${LOCALE_TYPE}/${LOCALE_TYPE}/g" /etc/locale.gen && \ | |
112 | locale-gen |
|
112 | locale-gen | |
113 |
|
113 | |||
114 | # locale-archive is a fix for old nix glibc2.26 locales available |
|
114 | # locale-archive is a fix for old nix glibc2.26 locales available | |
115 | ENV \ |
|
115 | ENV \ | |
116 | LOCALE_ARCHIVE=/var/opt/locale-archive \ |
|
116 | LOCALE_ARCHIVE=/var/opt/locale-archive \ | |
117 | LANG=${LOCALE_TYPE} \ |
|
117 | LANG=${LOCALE_TYPE} \ | |
118 | LANGUAGE=${LOCALE_TYPE} \ |
|
118 | LANGUAGE=${LOCALE_TYPE} \ | |
119 | LC_ALL=${LOCALE_TYPE} |
|
119 | LC_ALL=${LOCALE_TYPE} | |
120 |
|
120 | |||
121 | # configure the system user |
|
121 | # configure the system user | |
122 | # explicitly set uid/gid to guarantee that it won't change in the future |
|
122 | # explicitly set uid/gid to guarantee that it won't change in the future | |
123 | # the values 999:999 are identical to the current user/group id assigned |
|
123 | # the values 999:999 are identical to the current user/group id assigned | |
124 | RUN \ |
|
124 | RUN \ | |
125 | echo "** Create system user $RC_USER **" && \ |
|
125 | echo "** Create system user $RC_USER **" && \ | |
126 | groupadd --system --gid 999 $RC_USER && \ |
|
126 | groupadd --system --gid 999 $RC_USER && \ | |
127 | useradd --system --gid $RC_USER --uid 999 --shell /bin/bash $RC_USER && \ |
|
127 | useradd --system --gid $RC_USER --uid 999 --shell /bin/bash $RC_USER && \ | |
128 | usermod -G $RC_USER $RC_USER |
|
128 | usermod -G $RC_USER $RC_USER | |
129 |
|
129 | |||
130 | RUN \ |
|
130 | RUN \ | |
131 | echo "** Create nix-build user $NIX_BLD_USER **" && \ |
|
131 | echo "** Create nix-build user $NIX_BLD_USER **" && \ | |
132 | groupadd --system --gid 1099 $NIX_BLD_USER && \ |
|
132 | groupadd --system --gid 1099 $NIX_BLD_USER && \ | |
133 | useradd --system --gid $NIX_BLD_USER --uid 1099 --shell /bin/bash $NIX_BLD_USER && \ |
|
133 | useradd --system --gid $NIX_BLD_USER --uid 1099 --shell /bin/bash $NIX_BLD_USER && \ | |
134 | usermod -G $NIX_BLD_USER $NIX_BLD_USER |
|
134 | usermod -G $NIX_BLD_USER $NIX_BLD_USER | |
135 |
|
135 | |||
136 | RUN \ |
|
136 | RUN \ | |
137 | echo "** disable nix sandboxing **" && \ |
|
137 | echo "** disable nix sandboxing **" && \ | |
138 | mkdir /etc/nix && echo 'sandbox = false' > /etc/nix/nix.conf |
|
138 | mkdir /etc/nix && echo 'sandbox = false' > /etc/nix/nix.conf | |
139 |
|
139 | |||
140 |
|
140 | |||
141 | # set the defult bash shell |
|
141 | # set the defult bash shell | |
142 | SHELL ["/bin/bash", "-c"] |
|
142 | SHELL ["/bin/bash", "-c"] | |
143 |
|
143 | |||
144 | # Fix and set a timezone |
|
144 | # Fix and set a timezone | |
145 | RUN \ |
|
145 | RUN \ | |
146 | echo "** configure the timezone **" && \ |
|
146 | echo "** configure the timezone **" && \ | |
147 | rm /etc/localtime && cp /usr/share/zoneinfo/$TZ /etc/localtime && \ |
|
147 | rm /etc/localtime && cp /usr/share/zoneinfo/$TZ /etc/localtime && \ | |
148 | echo $TZ > /etc/timezone |
|
148 | echo $TZ > /etc/timezone | |
149 |
|
149 | |||
150 |
|
150 | |||
151 | RUN \ |
|
151 | RUN \ | |
152 | echo "** prepare rhodecode store and cache **" && \ |
|
152 | echo "** prepare rhodecode store and cache **" && \ | |
153 | install -d -m 0700 -o $RC_USER -g $RC_USER /nix && \ |
|
153 | install -d -m 0700 -o $RC_USER -g $RC_USER /nix && \ | |
154 | install -d -m 0755 -o $RC_USER -g $RC_USER /opt/rhodecode && \ |
|
154 | install -d -m 0755 -o $RC_USER -g $RC_USER /opt/rhodecode && \ | |
155 | install -d -m 0755 -o $RC_USER -g $RC_USER /usr/local/bin/rhodecode_bin && \ |
|
155 | install -d -m 0755 -o $RC_USER -g $RC_USER /usr/local/bin/rhodecode_bin && \ | |
156 | install -d -m 0755 -o $RC_USER -g $RC_USER $RHODECODE_REPO_DIR && \ |
|
156 | install -d -m 0755 -o $RC_USER -g $RC_USER $RHODECODE_REPO_DIR && \ | |
157 | install -d -m 0755 -o $RC_USER -g $RC_USER $RHODECODE_DATA_DIR && \ |
|
157 | install -d -m 0755 -o $RC_USER -g $RC_USER $RHODECODE_DATA_DIR && \ | |
158 | 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 && \ | |
159 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/rhodecode-vcsserver && \ |
|
159 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/rhodecode-vcsserver && \ | |
160 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/rhodecode-enterprise-ce && \ |
|
160 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/rhodecode-enterprise-ce && \ | |
161 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/rhodecode-enterprise-ee && \ |
|
161 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/rhodecode-enterprise-ee && \ | |
162 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/ && \ |
|
162 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/ && \ | |
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 && \ | |
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/cache && \ | |
165 | 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 && \ | |
166 | 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 |
|
167 | install -d -m 0700 -o $RC_USER -g $RC_USER /home/$RC_USER/.rhoderc | |
168 |
|
168 | |||
169 | # expose our custom sshd config |
|
169 | # expose our custom sshd config | |
170 | COPY service/sshd/sshd_config $SSHD_CONF_FILE |
|
170 | COPY service/sshd/sshd_config $SSHD_CONF_FILE | |
171 |
|
171 | |||
172 | # Apache SVN setup |
|
172 | # Apache SVN setup | |
173 | RUN \ |
|
173 | RUN \ | |
174 | echo "**** Apache config cleanup ****" && \ |
|
174 | echo "**** Apache config cleanup ****" && \ | |
175 | rm -f /etc/apache2/conf.d/info.conf \ |
|
175 | rm -f /etc/apache2/conf.d/info.conf \ | |
176 | /etc/apache2/conf.d/mpm.conf \ |
|
176 | /etc/apache2/conf.d/mpm.conf \ | |
177 | /etc/apache2/conf.d/userdir.conf && \ |
|
177 | /etc/apache2/conf.d/userdir.conf && \ | |
178 | rm -f /etc/apache2/sites-enabled/* && \ |
|
178 | rm -f /etc/apache2/sites-enabled/* && \ | |
179 | rm -f /etc/apache2/sites-available/* |
|
179 | rm -f /etc/apache2/sites-available/* | |
180 |
|
180 | |||
181 | # custom SVN virtualhost |
|
181 | # custom SVN virtualhost | |
182 | COPY service/svn/virtualhost.conf /etc/apache2/sites-enabled/ |
|
182 | COPY service/svn/virtualhost.conf /etc/apache2/sites-enabled/ | |
183 |
|
183 | |||
184 | RUN \ |
|
184 | RUN \ | |
185 | echo "**** Apache config ****" && \ |
|
185 | echo "**** Apache config ****" && \ | |
186 | echo $(strings /usr/lib/apache2/modules/mod_dav_svn.so | grep 'Powered by') > /var/opt/dav.version && \ |
|
186 | echo $(strings /usr/lib/apache2/modules/mod_dav_svn.so | grep 'Powered by') > /var/opt/dav.version && \ | |
187 | mkdir -p /run/apache2 && \ |
|
187 | mkdir -p /run/apache2 && \ | |
188 | mkdir -p /var/opt/www && \ |
|
188 | mkdir -p /var/opt/www && \ | |
189 | echo "unset HOME" > /etc/apache2/envvars && \ |
|
189 | echo "unset HOME" > /etc/apache2/envvars && \ | |
190 | echo "export APACHE_RUN_USER=${RC_USER}" >> /etc/apache2/envvars && \ |
|
190 | echo "export APACHE_RUN_USER=${RC_USER}" >> /etc/apache2/envvars && \ | |
191 | echo "export APACHE_PID_FILE=/var/run/apache2/apache2.pid" >> /etc/apache2/envvars && \ |
|
191 | echo "export APACHE_PID_FILE=/var/run/apache2/apache2.pid" >> /etc/apache2/envvars && \ | |
192 | echo "export APACHE_RUN_DIR=/var/run/apache2" >> /etc/apache2/envvars && \ |
|
192 | echo "export APACHE_RUN_DIR=/var/run/apache2" >> /etc/apache2/envvars && \ | |
193 | echo "export APACHE_LOCK_DIR=/var/lock/apache2" >> /etc/apache2/envvars && \ |
|
193 | echo "export APACHE_LOCK_DIR=/var/lock/apache2" >> /etc/apache2/envvars && \ | |
194 | echo "export APACHE_RUN_USER=${RC_USER}" >> /etc/apache2/envvars && \ |
|
194 | echo "export APACHE_RUN_USER=${RC_USER}" >> /etc/apache2/envvars && \ | |
195 | echo "export APACHE_RUN_GROUP=${RC_USER}" >> /etc/apache2/envvars && \ |
|
195 | echo "export APACHE_RUN_GROUP=${RC_USER}" >> /etc/apache2/envvars && \ | |
196 | sed -i "s/Listen 80/Listen ${MOD_DAV_SVN_PORT}/g" /etc/apache2/ports.conf |
|
196 | sed -i "s/Listen 80/Listen ${MOD_DAV_SVN_PORT}/g" /etc/apache2/ports.conf | |
197 |
|
197 | |||
198 |
|
198 | |||
199 | # Copy artifacts |
|
199 | # Copy artifacts | |
200 |
|
200 | |||
201 | 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/ | |
202 | COPY --chown=$RC_USER:$RC_USER config/_shared/rhodecode_enterprise.license /home/$RC_USER/.rccontrol/bootstrap/ |
|
202 | COPY --chown=$RC_USER:$RC_USER config/_shared/rhodecode_enterprise.license /home/$RC_USER/.rccontrol/bootstrap/ | |
203 | 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/ | |
204 |
|
204 | |||
|
205 | RUN \ | |||
|
206 | echo "**** locale-archive path ****" && \ | |||
|
207 | mv -v /home/$RC_USER/.rccontrol/cache/locale-archive /var/opt/locale-archive | |||
|
208 | ||||
205 | COPY --chown=$RC_USER:$RC_USER .source/ /home/$RC_USER/ |
|
209 | COPY --chown=$RC_USER:$RC_USER .source/ /home/$RC_USER/ | |
206 | RUN \ |
|
210 | RUN \ | |
207 | echo "** prepare rhodecode dirs **" && \ |
|
211 | echo "** prepare rhodecode dirs **" && \ | |
208 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/.rccontrol/vcsserver-1 && \ |
|
212 | 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 && \ |
|
213 | 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 && \ |
|
214 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/.rccontrol/enterprise-1 && \ | |
211 |
|
215 | echo "Done rhodecode dirs" | ||
212 | RUN \ |
|
|||
213 | echo "**** locale-archive path ****" && \ |
|
|||
214 | mv -v /home/$RC_USER/.rccontrol/cache/locale-archive /var/opt/locale-archive |
|
|||
215 |
|
216 | |||
216 | # change to non-root user for RUN commands |
|
217 | # change to non-root user for RUN commands | |
217 | USER $RC_USER |
|
218 | USER $RC_USER | |
218 | WORKDIR /home/$RC_USER |
|
219 | WORKDIR /home/$RC_USER | |
219 |
|
220 | |||
220 |
|
221 | |||
221 | RUN \ |
|
222 | RUN \ | |
222 | echo "** download and install nix ** from $DEV_NIX_VERSION/install" && \ |
|
223 | echo "** download and install nix ** from $DEV_NIX_VERSION/install" && \ | |
223 | curl -L https://releases.nixos.org/nix/nix-$DEV_NIX_VERSION/install | USER=$RC_USER /bin/bash |
|
224 | curl -L https://releases.nixos.org/nix/nix-$DEV_NIX_VERSION/install | USER=$RC_USER /bin/bash && \ | |
|
225 | echo "Done nix install" | |||
224 |
|
226 | |||
225 | RUN \ |
|
227 | RUN \ | |
226 | echo "** update nix package database and set channel to $DEV_NIX_CHANNEL **" && \ |
|
228 | echo "** update nix package database and set channel to $DEV_NIX_CHANNEL **" && \ | |
227 | . /home/rhodecode/.nix-profile/etc/profile.d/nix.sh && \ |
|
229 | . /home/rhodecode/.nix-profile/etc/profile.d/nix.sh && \ | |
228 | nix-channel --add https://channels.nixos.org/$DEV_NIX_CHANNEL nixpkgs && \ |
|
230 | nix-channel --add https://channels.nixos.org/$DEV_NIX_CHANNEL nixpkgs && \ | |
229 | nix-channel --update |
|
231 | nix-channel --update && \ | |
|
232 | echo "done nix package updates" | |||
230 |
|
233 | |||
231 |
|
234 | |||
232 | RUN \ |
|
235 | RUN \ | |
233 | echo "** save nix config **" && \ |
|
236 | echo "** save nix config **" && \ | |
234 | touch /home/$RC_USER/.rhoderc && \ |
|
237 | touch /home/$RC_USER/.rhoderc && \ | |
235 | mkdir -p /home/$RC_USER/.nixpkgs && touch /home/$RC_USER/.nixpkgs/config.nix && \ |
|
238 | mkdir -p /home/$RC_USER/.nixpkgs && touch /home/$RC_USER/.nixpkgs/config.nix && \ | |
236 | printf '{\n rc = {\n sources = {\n rhodecode-vcsserver = "/home/'$RC_USER'/rhodecode-vcsserver";\n rhodecode-enterprise-ce = "/home/'$RC_USER'/rhodecode-enterprise-ce";\n rhodecode-enterprise-ee = "/home/'$RC_USER'/rhodecode-enterprise-ee";\n };\n };\n}\n' > /home/$RC_USER/.nixpkgs/config.nix |
|
239 | printf '{\n rc = {\n sources = {\n rhodecode-vcsserver = "/home/'$RC_USER'/rhodecode-vcsserver";\n rhodecode-enterprise-ce = "/home/'$RC_USER'/rhodecode-enterprise-ce";\n rhodecode-enterprise-ee = "/home/'$RC_USER'/rhodecode-enterprise-ee";\n };\n };\n}\n' > /home/$RC_USER/.nixpkgs/config.nix | |
237 |
|
240 | |||
238 |
|
241 | |||
239 | RUN \ |
|
242 | RUN \ | |
240 | echo "** install rhodecode control **" && \ |
|
243 | echo "** install rhodecode control **" && \ | |
241 | # cd /home/$RC_USER/.rccontrol/cache && \ |
|
244 | # cd /home/$RC_USER/.rccontrol/cache && \ | |
242 | # INSTALLER=$(ls -Art /home/$RC_USER/.rccontrol/cache/RhodeCode-installer-* | tail -n 1) && \ |
|
245 | # INSTALLER=$(ls -Art /home/$RC_USER/.rccontrol/cache/RhodeCode-installer-* | tail -n 1) && \ | |
243 | # chmod +x ${INSTALLER} && \ |
|
246 | # chmod +x ${INSTALLER} && \ | |
244 | # ${INSTALLER} --accept-license && \ |
|
247 | # ${INSTALLER} --accept-license && \ | |
245 | # ${RCCONTROL} self-init && \ |
|
248 | # ${RCCONTROL} self-init && \ | |
246 | # cp -v /home/$RC_USER/.rccontrol-profile/etc/ca-bundle.crt $BUILD_CONF/ && \ |
|
249 | # cp -v /home/$RC_USER/.rccontrol-profile/etc/ca-bundle.crt $BUILD_CONF/ && \ | |
247 | echo "Done installing rhodecode control" |
|
250 | echo "Done installing rhodecode control" | |
248 |
|
251 | |||
249 | RUN \ |
|
252 | RUN \ | |
250 | echo "** install vcsserver ${RHODECODE_VERSION} **" && \ |
|
253 | echo "** install vcsserver ${RHODECODE_VERSION} **" && \ | |
251 | . /home/rhodecode/.nix-profile/etc/profile.d/nix.sh && \ |
|
254 | . /home/rhodecode/.nix-profile/etc/profile.d/nix.sh && \ | |
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 && \ |
|
255 | 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 && \ | |
253 | nix-shell --command 'echo COMMAND FROM NIX-SHELL TEST' rhodecode-vcsserver/default.nix && \ |
|
256 | nix-shell --command 'echo COMMAND FROM NIX-SHELL TEST' rhodecode-vcsserver/default.nix && \ | |
254 | VCSSERVER_PATH=/home/$RC_USER/rhodecode-vcsserver && \ |
|
257 | VCSSERVER_PATH=/home/$RC_USER/rhodecode-vcsserver && \ | |
255 | rm -rf $BUILD_BIN_DIR/vcs_bin && \ |
|
258 | rm -rf $BUILD_BIN_DIR/vcs_bin && \ | |
256 | cp -rv --preserve=links /home/$RC_USER/.rccontrol/vcsserver-1/profile/bin $BUILD_BIN_DIR/vcs_bin && \ |
|
259 | 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 && \ |
|
260 | 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 && \ |
|
261 | cp -v ${VCSSERVER_PATH}/configs/gunicorn_config.py $BUILD_CONF/gunicorn_conf_vcs.py && \ | |
259 | echo "Done installing vcsserver" |
|
262 | echo "Done installing vcsserver" | |
260 |
|
263 | |||
261 | RUN \ |
|
264 | RUN \ | |
262 | echo "** install build Community ${RHODECODE_VERSION} **" && \ |
|
265 | echo "** install build Community ${RHODECODE_VERSION} **" && \ | |
263 | . /home/rhodecode/.nix-profile/etc/profile.d/nix.sh && \ |
|
266 | . /home/rhodecode/.nix-profile/etc/profile.d/nix.sh && \ | |
264 | echo "done" |
|
267 | echo "done" | |
265 |
|
268 | |||
266 | RUN \ |
|
269 | RUN \ | |
267 | echo "** install rhodecode ${RHODECODE_VERSION} **" && \ |
|
270 | echo "** install rhodecode ${RHODECODE_VERSION} **" && \ | |
268 | . /home/rhodecode/.nix-profile/etc/profile.d/nix.sh && \ |
|
271 | . /home/rhodecode/.nix-profile/etc/profile.d/nix.sh && \ | |
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 && \ |
|
272 | 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 && \ | |
270 | nix-shell --command 'echo ok' rhodecode-enterprise-ee/default.nix && \ |
|
273 | nix-shell --command 'echo ok' rhodecode-enterprise-ee/default.nix && \ | |
271 | RHODECODE_PATH=/home/$RC_USER/rhodecode-enterprise-ee && \ |
|
274 | RHODECODE_PATH=/home/$RC_USER/rhodecode-enterprise-ee && \ | |
272 | rm -rf $BUILD_BIN_DIR/bin && \ |
|
275 | rm -rf $BUILD_BIN_DIR/bin && \ | |
273 | cp -rv --preserve=links /home/$RC_USER/.rccontrol/enterprise-1/profile/bin $BUILD_BIN_DIR/ && \ |
|
276 | cp -rv --preserve=links /home/$RC_USER/.rccontrol/enterprise-1/profile/bin $BUILD_BIN_DIR/ && \ | |
274 | cp -v ${RHODECODE_PATH}/configs/production.ini $BUILD_CONF/rhodecode.ini && \ |
|
277 | cp -v ${RHODECODE_PATH}/configs/production.ini $BUILD_CONF/rhodecode.ini && \ | |
275 | cp -v ${RHODECODE_PATH}/configs/gunicorn_config.py $BUILD_CONF/gunicorn_conf.py && \ |
|
278 | cp -v ${RHODECODE_PATH}/configs/gunicorn_config.py $BUILD_CONF/gunicorn_conf_rc.py && \ | |
276 | mkdir -p $RHODECODE_DATA_DIR/static && cp -r /home/$RC_USER/.rccontrol/enterprise-1/profile/etc/static/* $RHODECODE_DATA_DIR/static/ && \ |
|
279 | 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" |
|
280 | echo "Done installing rhodecode" | |
278 |
|
281 | |||
279 |
|
282 | |||
280 | RUN \ |
|
283 | RUN \ | |
281 | echo "** configure supervisord **" && \ |
|
284 | echo "** configure supervisord **" && \ | |
282 | #cp -v ${SUPERVISOR_CONF} $BUILD_CONF/ && \ |
|
285 | #cp -v ${SUPERVISOR_CONF} $BUILD_CONF/ && \ | |
283 | #sed -i "s/self_managed_supervisor = False/self_managed_supervisor = True/g" /home/$RC_USER/.rccontrol.ini && \ |
|
286 | #sed -i "s/self_managed_supervisor = False/self_managed_supervisor = True/g" /home/$RC_USER/.rccontrol.ini && \ | |
284 | echo "Done installing supervisord" |
|
287 | echo "Done installing supervisord" | |
285 |
|
288 | |||
286 | USER root |
|
289 | USER root | |
287 |
|
290 | |||
288 | RUN \ |
|
291 | RUN \ | |
289 | echo "**** cleanup ****" && \ |
|
292 | echo "**** cleanup ****" && \ | |
290 | apt-get remove -y $PYTHON_DEPS && \ |
|
293 | apt-get remove -y $PYTHON_DEPS && \ | |
291 | apt-get autoclean -y && \ |
|
294 | apt-get autoclean -y && \ | |
292 | rm -f /tmp/* && \ |
|
295 | rm -f /tmp/* && \ | |
293 | rm -f /home/$RC_USER/.rccontrol/cache/RhodeCode-installer-* && \ |
|
296 | rm -f /home/$RC_USER/.rccontrol/cache/RhodeCode-installer-* && \ | |
294 | rm -f /home/$RC_USER/.rccontrol/cache/*.bz2 && \ |
|
297 | rm -f /home/$RC_USER/.rccontrol/cache/*.bz2 && \ | |
295 | rm -rf /var/lib/apt/lists/* && \ |
|
298 | rm -rf /var/lib/apt/lists/* && \ | |
296 | rm -rf /var/cache/apk/* && \ |
|
299 | rm -rf /var/cache/apk/* && \ | |
297 | rm -f ${SUPERVISOR_CONF} && \ |
|
300 | rm -f ${SUPERVISOR_CONF} && \ | |
298 | rm -rf /home/$RC_USER/rhodecode-vcsserver && \ |
|
301 | rm -rf /home/$RC_USER/rhodecode-vcsserver && \ | |
299 | rm -rf /home/$RC_USER/rhodecode-enterprise-ce && \ |
|
302 | rm -rf /home/$RC_USER/rhodecode-enterprise-ce && \ | |
300 | rm -rf /home/$RC_USER/rhodecode-enterprise-ee && \ |
|
303 | rm -rf /home/$RC_USER/rhodecode-enterprise-ee && \ | |
301 | echo "Done cleanup" |
|
304 | echo "Done cleanup" | |
302 |
|
305 | |||
303 |
|
306 | |||
304 | # copy entrypoints |
|
307 | # copy entrypoints | |
305 | COPY entrypoints.d/entrypoint.sh /opt/entrypoints.d/entrypoint.sh |
|
308 | COPY entrypoints.d/entrypoint.sh /opt/entrypoints.d/entrypoint.sh | |
306 |
|
309 | |||
307 | RUN chmod +x /opt/entrypoints.d/entrypoint.sh |
|
310 | RUN chmod +x /opt/entrypoints.d/entrypoint.sh | |
308 |
|
311 | |||
309 | # config volume |
|
312 | # config volume | |
310 | VOLUME /etc/rhodecode/conf |
|
313 | VOLUME /etc/rhodecode/conf | |
311 |
|
314 | |||
312 | # repo store volume |
|
315 | # repo store volume | |
313 | VOLUME /var/opt/rhodecode_repo_store |
|
316 | VOLUME /var/opt/rhodecode_repo_store | |
314 |
|
317 | |||
315 | # data volume |
|
318 | # data volume | |
316 | VOLUME /var/opt/rhodecode_data |
|
319 | VOLUME /var/opt/rhodecode_data | |
317 |
|
320 | |||
318 | # logs volume |
|
321 | # logs volume | |
319 | VOLUME /var/log/rhodecode |
|
322 | VOLUME /var/log/rhodecode | |
320 |
|
323 | |||
321 | ENTRYPOINT ["/opt/entrypoints.d/entrypoint.sh"] |
|
324 | ENTRYPOINT ["/opt/entrypoints.d/entrypoint.sh"] | |
322 |
|
325 | |||
323 | # compose can override this |
|
326 | # compose can override this | |
324 | CMD [ "$BUILD_BIN_DIR/bin/gunicorn", "--error-logfile=-", "--paster=/etc/rhodecode/conf_build/run.ini", "--config=/etc/rhodecode/conf_build/gunicorn_conf.py" ] |
|
327 | CMD [ "$BUILD_BIN_DIR/bin/gunicorn", "--error-logfile=-", "--paster=/etc/rhodecode/conf_build/run.ini", "--config=/etc/rhodecode/conf_build/gunicorn_conf_rc.py" ] |
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