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 | 1 | #COMPOSE_PROJECT_NAME=rc_cluster |
|
2 | 2 | TZ="UTC" |
|
3 | 3 | |
|
4 | 4 | |
|
5 | 5 | # Version to deploy and run |
|
6 | 6 | ## VERSION_INFO |
|
7 | 7 | RC_VERSION="4.28.0.REL20221120_SOURCE" |
|
8 | 8 | #RC_CLI_VERSION_NAME="4.27.0" |
|
9 | 9 | |
|
10 | 10 | # ce, or ee |
|
11 | 11 | RC_EDITION=ee |
|
12 |
RC_IMAGE_CE="rhodecode/rhodecode- |
|
|
13 |
RC_IMAGE_EE="rhodecode/rhodecode- |
|
|
12 | RC_IMAGE_CE="rhodecode/rhodecode-ce:$RC_VERSION" | |
|
13 | RC_IMAGE_EE="rhodecode/rhodecode-ee:$RC_VERSION" | |
|
14 | 14 | |
|
15 | 15 | # Database bootstrap/access credentials |
|
16 | 16 | DB_NAME=rhodecode |
|
17 | 17 | DB_USER=rhodecode |
|
18 | 18 | |
|
19 | 19 | # Bootstrap container with specific password |
|
20 | 20 | # This password will be used to generate new account and password for the database |
|
21 | 21 | DB_PASSWORD=[GENERATED_AT_BOOTSTRAP] |
|
22 | 22 | |
|
23 | 23 | # set limit of redis in-memory cache before keys get evicted using LRU cache |
|
24 | 24 | RC_REDIS_MAXMEMORY=1024mb |
|
25 | 25 | |
|
26 | 26 | # set the size of ramdisk used for locking files |
|
27 | 27 | RC_DATA_RAMDISK_SIZE=1G |
|
28 | 28 | |
|
29 | 29 | # base url for running app, this is used for traefik hasname matching, so accessing this host will redirect |
|
30 | 30 | # traffic to the running instance |
|
31 | 31 | # replace this with your name of host. e.g http://yourdomain.com or https://rc.company.local |
|
32 | 32 | RHODECODE_HOSTNAME=docker-dev |
|
33 | 33 | |
|
34 | 34 | |
|
35 | 35 | # user/password for first admin user created for access |
|
36 | 36 | # this is a bootstrap super-admin account to access the web interface |
|
37 | 37 | RHODECODE_USER_EMAIL=admin@server-com |
|
38 | 38 | RHODECODE_USER_NAME=admin |
|
39 | 39 | RHODECODE_USER_PASS=secret4 |
|
40 | 40 | |
|
41 | 41 | |
|
42 | 42 | |
|
43 | 43 | |
|
44 | 44 | # HTTP and HTTPS ports for running app |
|
45 | 45 | RC_HTTP_PORT=8888 |
|
46 | 46 | |
|
47 | 47 | # SSH Port exposed, increased security is to not used default 22 |
|
48 | 48 | RC_SSH_PORT=3022 |
|
49 | 49 | |
|
50 | 50 | |
|
51 | 51 | ## RHODECODE RUNTIME VARS |
|
52 | 52 | |
|
53 | 53 | ## New since 4.27.0, default GIT branch name can be changed |
|
54 | 54 | GIT_DEFAULT_BRANCH_NAME=master |
|
55 | 55 | |
|
56 | 56 |
@@ -1,23 +1,23 b'' | |||
|
1 | 1 | # CACHE FILES |
|
2 | 2 | .cache/RhodeCode-installer* |
|
3 | 3 | .cache/*.tar.bz2 |
|
4 | 4 | .cache/locale-archive |
|
5 | 5 | |
|
6 | 6 | # Source code downloaded |
|
7 | 7 | .source/* |
|
8 | 8 | |
|
9 | # Custom / override wont be tracked | |
|
9 | # Custom / override wont be tracked, except README file | |
|
10 | 10 | .custom/* |
|
11 | !.custom/README.md | |
|
11 | 12 | |
|
12 | 13 | # LOGS |
|
13 | 14 | logs/*.log |
|
14 | 15 | logs/nginx/*.log |
|
15 | 16 | logs/svn/*.log |
|
16 | 17 | logs/apps/*.log |
|
17 | 18 | logs/postgres/*.log |
|
18 | 19 | |
|
19 | 20 | .idea |
|
20 | 21 | config/_shared/.rcmetadata.json |
|
21 | 22 | |
|
22 | .rccontrol-bootstrap | |
|
23 | 23 | .rccontrol.ini No newline at end of file |
@@ -1,135 +1,144 b'' | |||
|
1 | 1 | # read more here http://tautt.com/best-nginx-configuration-for-security/ |
|
2 | 2 | |
|
3 | 3 | # config to don't allow the browser to render the page inside an frame or iframe |
|
4 | 4 | # and avoid clickjacking http://en.wikipedia.org/wiki/Clickjacking |
|
5 | 5 | # if you need to allow [i]frames, you can use SAMEORIGIN or even set an uri with ALLOW-FROM uri |
|
6 | 6 | # https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options |
|
7 | 7 | #add_header X-Frame-Options SAMEORIGIN; |
|
8 | 8 | |
|
9 | 9 | # when serving user-supplied content, include a X-Content-Type-Options: nosniff header along with the Content-Type: header, |
|
10 | 10 | # to disable content-type sniffing on some browsers. |
|
11 | 11 | # https://www.owasp.org/index.php/List_of_useful_HTTP_headers |
|
12 | 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 | 13 | # http://msdn.microsoft.com/en-us/library/ie/gg622941(v=vs.85).aspx |
|
14 | 14 | # 'soon' on Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=471020 |
|
15 | 15 | #add_header X-Content-Type-Options nosniff; |
|
16 | 16 | |
|
17 | 17 | # This header enables the Cross-site scripting (XSS) filter built into most recent web browsers. |
|
18 | 18 | # It's usually enabled by default anyway, so the role of this header is to re-enable the filter for |
|
19 | 19 | # this particular website if it was disabled by the user. |
|
20 | 20 | # https://www.owasp.org/index.php/List_of_useful_HTTP_headers |
|
21 | 21 | #add_header X-XSS-Protection "1; mode=block"; |
|
22 | 22 | |
|
23 | 23 | # with Content Security Policy (CSP) enabled(and a browser that supports it(http://caniuse.com/#feat=contentsecuritypolicy), |
|
24 | 24 | # you can tell the browser that it can only download content from the domains you explicitly allow |
|
25 | 25 | # http://www.html5rocks.com/en/tutorials/security/content-security-policy/ |
|
26 | 26 | # https://www.owasp.org/index.php/Content_Security_Policy |
|
27 | 27 | # I need to change our application code so we can increase security by disabling 'unsafe-inline' 'unsafe-eval' |
|
28 | 28 | # directives for css and js(if you have inline css or js, you will need to keep it too). |
|
29 | 29 | # more: http://www.html5rocks.com/en/tutorials/security/content-security-policy/#inline-code-considered-harmful |
|
30 | 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 | 32 | ## rate limiter for certain pages to prevent brute force attacks |
|
33 | 33 | limit_req_zone $binary_remote_addr zone=http_req_limit:10m rate=1r/s; |
|
34 | 34 | |
|
35 | 35 | ## custom log format |
|
36 | 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 | 38 | log_format json_log_custom escape=json |
|
39 | 39 | '{' |
|
40 | 40 | '"source":"nginx",' |
|
41 | 41 | '"remote_user":"$remote_user",' |
|
42 | 42 | '"time_local":"$time_local",' |
|
43 | 43 | '"remote_addr":"$remote_addr",' |
|
44 | '"host":"$host",' | |
|
44 | 45 | '"proxy_x_forwarded_for":"$proxy_add_x_forwarded_for",' |
|
45 | 46 | '"request":"$request",' |
|
46 | 47 | '"status": "$status",' |
|
47 | 48 | '"request_method": "$request_method",' |
|
48 | 49 | '"body_bytes_sent":"$body_bytes_sent",' |
|
49 | 50 | '"request_time":"$request_time",' |
|
50 | 51 | '"upstream_response_time":"$upstream_response_time",' |
|
51 | 52 | '"http_referrer":"$http_referer",' |
|
53 | '"http_scheme":"$scheme",' | |
|
52 | 54 | '"http_user_agent":"$http_user_agent"' |
|
53 | 55 | '}'; |
|
54 | 56 | |
|
55 | 57 | |
|
56 | 58 | server { |
|
57 | 59 | listen 80 default; |
|
58 | 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 | 62 | server_name localhost 127.0.0.1; |
|
61 | 63 | access_log /dev/stdout json_log_custom; |
|
62 | 64 | error_log /dev/stdout; |
|
63 | 65 | |
|
64 | 66 | # uncomment to redirect http traffic to https (not applicable in Docker setup) |
|
65 | 67 | #return 301 https://$host$request_uri; |
|
66 | 68 | |
|
67 | 69 | client_body_buffer_size 128k; |
|
68 | 70 | # maximum number and size of buffers for large headers to read from client request |
|
69 | 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 | 78 | ## serve static files by nginx, recommended |
|
72 | 79 | location /_static/rhodecode { |
|
73 | 80 | gzip on; |
|
74 | 81 | gzip_min_length 500; |
|
75 | 82 | gzip_proxied any; |
|
76 | 83 | gzip_comp_level 4; |
|
77 | 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 | 85 | gzip_vary on; |
|
79 | 86 | gzip_disable "msie6"; |
|
80 | 87 | expires 60d; |
|
81 | 88 | |
|
82 | 89 | alias /var/opt/rhodecode_data/static; |
|
83 | 90 | } |
|
84 | 91 | |
|
85 | 92 | ## channelstream location handler, if channelstream live chat and notifications |
|
86 | 93 | ## are enable this will proxy the requests to channelstream websocket server |
|
94 | set $upstream_channelstream channelstream:8000; | |
|
87 | 95 | location /_channelstream { |
|
88 | 96 | rewrite /_channelstream/(.*) /$1 break; |
|
89 | 97 | gzip off; |
|
90 | 98 | tcp_nodelay off; |
|
91 | 99 | |
|
92 | 100 | proxy_connect_timeout 10; |
|
93 | 101 | proxy_send_timeout 10m; |
|
94 | 102 | proxy_read_timeout 10m; |
|
95 | 103 | |
|
96 | 104 | proxy_set_header Host $host; |
|
97 |
proxy_set_header |
|
|
105 | proxy_set_header Referer $http_referer; | |
|
98 | 106 | proxy_set_header X-Url-Scheme $scheme; |
|
99 |
proxy_set_header X- |
|
|
107 | proxy_set_header X-Real-IP $remote_addr; | |
|
100 | 108 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|
109 | proxy_set_header X-Forwarded-Proto $scheme; | |
|
101 | 110 | |
|
102 | 111 | proxy_http_version 1.1; |
|
103 | 112 | proxy_set_header Upgrade $http_upgrade; |
|
104 | 113 | proxy_set_header Connection "upgrade"; |
|
105 | 114 | |
|
106 | set $upstream_channelstream http://channelstream:8000; | |
|
107 |
proxy_ |
|
|
115 | proxy_pass http://$upstream_channelstream; | |
|
116 | proxy_redirect http://$upstream_channelstream/ /_channelstream; | |
|
108 | 117 | } |
|
109 | 118 | |
|
110 | 119 | # ## rate limit this endpoint to prevent login page brute-force attacks |
|
111 | 120 | # location /_admin/login { |
|
112 | 121 | # limit_req zone=http_req_limit burst=10 nodelay; |
|
113 | 122 | # try_files $uri @rhodecode_http; |
|
114 | 123 | # } |
|
115 | 124 | |
|
116 | location / { | |
|
117 | include /etc/nginx/proxy.conf; | |
|
118 | try_files $uri @rhodecode_http; | |
|
119 | } | |
|
120 | ||
|
121 | location @rhodecode_http { | |
|
122 | set $upstream http://rhodecode:10020; | |
|
123 | include /etc/nginx/proxy.conf; | |
|
124 | proxy_pass $upstream; | |
|
125 | } | |
|
125 | # location / { | |
|
126 | # include /etc/nginx/proxy.conf; | |
|
127 | # try_files $uri @rhodecode_http; | |
|
128 | # } | |
|
129 | # | |
|
130 | # set $upstream http://rhodecode:10020; | |
|
131 | # location @rhodecode_http { | |
|
132 | # include /etc/nginx/proxy.conf; | |
|
133 | # proxy_pass $upstream; | |
|
134 | # } | |
|
126 | 135 | |
|
127 | 136 | ## Custom 502 error page. |
|
128 | 137 | ## Will be displayed while RhodeCode server is turned off |
|
129 | 138 | error_page 502 /502.html; |
|
130 | 139 | location = /502.html { |
|
131 | 140 | root /var/opt/rhodecode_data/static; |
|
132 | 141 | internal; |
|
133 | 142 | } |
|
134 | 143 | |
|
135 | 144 | } |
@@ -1,36 +1,36 b'' | |||
|
1 | 1 | proxy_redirect off; |
|
2 | 2 | proxy_set_header Host $http_host; |
|
3 | 3 | |
|
4 | 4 | ## If you use HTTPS make sure you disable gzip compression |
|
5 | 5 | ## to be safe against BREACH attack. |
|
6 | 6 | gzip off; |
|
7 | 7 | |
|
8 | 8 | # Don't buffer requests in NGINX stream them using chunked-encoding |
|
9 | 9 | proxy_buffering off; |
|
10 | 10 | |
|
11 | 11 | ## This is also required for later GIT to use streaming. |
|
12 | 12 | ## Works only for Nginx 1.7.11 and newer |
|
13 | 13 | proxy_request_buffering off; |
|
14 | 14 | proxy_http_version 1.1; |
|
15 | 15 | |
|
16 | 16 | ## Set this to a larger number if you experience timeouts |
|
17 | 17 | ## or 413 Request Entity Too Large, 10GB is enough for most cases |
|
18 | 18 | client_max_body_size 10240m; |
|
19 | 19 | |
|
20 | 20 | ## needed for container auth |
|
21 | 21 | # proxy_set_header REMOTE_USER $remote_user; |
|
22 | 22 | # proxy_set_header X-Forwarded-User $remote_user; |
|
23 | 23 | |
|
24 | 24 | proxy_set_header X-Url-Scheme $scheme; |
|
25 | 25 | proxy_set_header X-Host $http_host; |
|
26 | 26 | proxy_set_header X-Real-IP $remote_addr; |
|
27 | 27 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|
28 | 28 | proxy_set_header Proxy-host $proxy_host; |
|
29 | 29 | |
|
30 |
proxy_connect_timeout |
|
|
31 |
proxy_send_timeout |
|
|
32 |
proxy_read_timeout |
|
|
30 | proxy_connect_timeout 21600; | |
|
31 | proxy_send_timeout 21600; | |
|
32 | proxy_read_timeout 21600; | |
|
33 | 33 | proxy_buffers 8 32k; |
|
34 | 34 | |
|
35 | 35 | add_header X-Frame-Options SAMEORIGIN; |
|
36 | 36 | add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;"; |
@@ -1,42 +1,42 b'' | |||
|
1 | 1 | ## Static configuration, needs traefik reload |
|
2 | 2 | |
|
3 | 3 | entryPoints: |
|
4 | 4 | http: |
|
5 | 5 | address: ":80" |
|
6 | 6 | |
|
7 | 7 | https: |
|
8 | 8 | address: ":443" |
|
9 | 9 | |
|
10 |
|
|
|
11 |
|
|
|
10 | ssh: | |
|
11 | address: ":${RC_SSH_PORT:?must-specify-ssh-port}" | |
|
12 | 12 | |
|
13 | 13 | traefik: |
|
14 | 14 | address: ":7000" |
|
15 | 15 | |
|
16 | 16 | api: |
|
17 | 17 | dashboard: false |
|
18 | 18 | insecure: false # change to true to expose dashboard |
|
19 | 19 | |
|
20 | 20 | accessLog: {} |
|
21 | 21 | |
|
22 | 22 | log: |
|
23 | 23 | # DEBUG / INFO |
|
24 | 24 | level: INFO |
|
25 | 25 | |
|
26 | 26 | metrics: |
|
27 | 27 | prometheus: {} |
|
28 | 28 | |
|
29 | 29 | |
|
30 | 30 | providers: |
|
31 | 31 | docker: |
|
32 | 32 | exposedByDefault: false |
|
33 | 33 | swarmMode: false |
|
34 | 34 | |
|
35 | 35 | file: |
|
36 | 36 | filename: "/etc/traefik/traefik_dynamic.yaml" |
|
37 | 37 | watch: true |
|
38 | 38 | |
|
39 | 39 | |
|
40 | 40 | serversTransport: |
|
41 | 41 | #this disables SSL certificate verification for legacy own cert services like NextCloud etc |
|
42 | 42 | insecureSkipVerify: true |
@@ -1,312 +1,314 b'' | |||
|
1 | 1 | version: '3.9' |
|
2 | 2 | |
|
3 | 3 | x-logging: &custom-logging |
|
4 | 4 | # docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions |
|
5 | 5 | # NOTE: loki logging driver ONLY works for host type networks... |
|
6 | 6 | driver: loki |
|
7 | 7 | options: |
|
8 | 8 | loki-url: "http://127.0.0.1:3100/loki/api/v1/push" |
|
9 | 9 | #loki-url: "http://loki:3100/loki/api/v1/push" |
|
10 | 10 | loki-retries: "5" |
|
11 | 11 | loki-timeout: "1s" |
|
12 | 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 | 15 | services: |
|
23 | 16 | |
|
24 | 17 | rhodecode: |
|
25 | 18 | networks: |
|
26 | 19 | - rhodecode_network |
|
27 | 20 | image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION:?specify-RC_VERSION-env-var} |
|
28 | 21 | env_file: |
|
29 | 22 | - .custom/.runtime.env |
|
30 | 23 | stdin_open: true |
|
31 | 24 | tty: true |
|
32 | 25 | restart: always |
|
33 | 26 | command: [ |
|
34 | 27 | "/usr/local/bin/rhodecode_bin/bin/gunicorn", |
|
35 | 28 | "--name=gunicorn-rhodecode-1", |
|
36 | 29 | "--error-logfile=-", |
|
37 | 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 | 37 | # ports: |
|
42 | 38 | # - "127.0.0.1::10020" |
|
43 | 39 | |
|
44 | 40 | build: |
|
45 | 41 | context: . |
|
46 | 42 | dockerfile: service/rhodecode/rhodecode.dockerfile |
|
47 | 43 | args: |
|
48 | 44 | TZ: ${TZ} |
|
49 | 45 | RHODECODE_VERSION: ${RC_VERSION:?specify-RC_VERSION-env-var} |
|
50 | 46 | RHODECODE_DB: postgresql://rhodecode:${DB_PASSWORD:?must-specify-db-password}@database/${DB_NAME:?must-specify-db-name} |
|
51 | 47 | RHODECODE_USER_NAME: ${RHODECODE_USER_NAME} |
|
52 | 48 | RHODECODE_USER_PASS: ${RHODECODE_USER_PASS} |
|
53 | 49 | RHODECODE_USER_EMAIL: ${RHODECODE_USER_EMAIL} |
|
54 | 50 | |
|
55 | 51 | environment: |
|
56 | 52 | RC_APP_TYPE: rhodecode_http |
|
57 | 53 | RC_APP_PROC: 1 |
|
58 | 54 | SSL_CERT_FILE: "/etc/rhodecode/conf/ca-bundle.crt" |
|
59 | 55 | REQUESTS_CA_BUNDLE: "/etc/rhodecode/conf/ca-bundle.crt" |
|
60 | 56 | GIT_SSL_CAINFO: "/etc/rhodecode/conf/ca-bundle.crt" |
|
61 | 57 | GEVENT_RESOLVER: "ares" |
|
62 | 58 | |
|
63 | 59 | DB_UPGRADE: 1 # run the DB upgrade |
|
64 | 60 | SETUP_APP: 1 # run the application default settings setup, can be turned off after initial run |
|
65 | 61 | #FORCE_DB_INIT_FILE: 1 # force the database init, warning: destroys old DB |
|
66 | 62 | #FORCE_RC_SETUP_APP: 1 # force running setup scripts for configuration/license application |
|
67 | 63 | MAIN_INI_PATH: /etc/rhodecode/conf/rhodecode.optimized.ini |
|
68 | 64 | |
|
69 | 65 | # SVN Specific |
|
70 | 66 | MOD_DAV_SVN_PORT: 8090 |
|
71 | 67 | APACHE_LOG_DIR: /var/log/rhodecode/svn |
|
72 | 68 | MOD_DAV_SVN_CONF_FILE: /etc/rhodecode/conf/svn/mod_dav_svn.conf |
|
73 | 69 | |
|
74 | 70 | healthcheck: |
|
75 | 71 | test: [ "CMD", "curl", "-A", "RhodeCode-Healthcheck", "-s", "-o", "/dev/null", "-w", "'%{http_code}'", "http://127.0.0.1:10020/_admin/ops/ping" ] |
|
76 | 72 | timeout: 30s |
|
77 | 73 | interval: 60s |
|
78 | 74 | retries: 10 |
|
79 | 75 | |
|
80 | 76 | # depends_on: |
|
81 | 77 | # - database |
|
82 | 78 | # - redis |
|
83 | 79 | # - channelstream |
|
84 | 80 | |
|
85 | 81 | volumes: |
|
86 | 82 | - confvolume:/etc/rhodecode/conf |
|
87 | 83 | - logvolume:/var/log/rhodecode |
|
88 |
- r |
|
|
84 | - rc_reposvolume:/var/opt/rhodecode_repo_store | |
|
89 | 85 | - rc_datavolume:/var/opt/rhodecode_data |
|
90 | 86 | |
|
91 | 87 | tmpfs: |
|
92 | 88 | - /data_ramdisk:size=${RC_DATA_RAMDISK_SIZE:?specify-RC_DATA_RAMDISK_SIZE-env-var} |
|
93 | 89 | |
|
94 | 90 | logging: |
|
95 | 91 | *custom-logging |
|
96 | 92 | |
|
97 | 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 | 99 | vcsserver: |
|
101 | 100 | networks: |
|
102 | 101 | - rhodecode_network |
|
103 | 102 | image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION:?specify-RC_VERSION-env-var} |
|
104 | 103 | env_file: |
|
105 | 104 | - .custom/.runtime.env |
|
106 | 105 | stdin_open: true |
|
107 | 106 | tty: true |
|
108 | 107 | restart: always |
|
109 | 108 | command: [ |
|
110 | 109 | "/home/rhodecode/.rccontrol/vcsserver-1/profile/bin/gunicorn", |
|
111 | 110 | "--name=gunicorn-vcsserver-1", |
|
112 | 111 | "--error-logfile=-", |
|
113 | 112 | "--paster=/etc/rhodecode/conf/vcsserver.optimized.ini", |
|
114 | 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 | 119 | # ports: |
|
118 | 120 | # - "127.0.0.1::10010" |
|
119 | 121 | |
|
120 | 122 | healthcheck: |
|
121 | 123 | test: [ "CMD", "curl", "-A", "RhodeCode-Healthcheck", "-s", "-o", "/dev/null", "-w", "'%{http_code}'", "http://127.0.0.1:10010/status" ] |
|
122 | 124 | timeout: 30s |
|
123 | 125 | interval: 60s |
|
124 | 126 | retries: 10 |
|
125 | 127 | |
|
126 | 128 | environment: |
|
127 | 129 | RC_APP_TYPE: rhodecode_vcsserver |
|
128 | 130 | RC_APP_PROC: 1 |
|
129 | 131 | MAIN_INI_PATH: /etc/rhodecode/conf/vcsserver.optimized.ini |
|
130 | 132 | SSL_CERT_FILE: "/etc/rhodecode/conf/ca-bundle.crt" |
|
131 | 133 | REQUESTS_CA_BUNDLE: "/etc/rhodecode/conf/ca-bundle.crt" |
|
132 | 134 | GIT_SSL_CAINFO: "/etc/rhodecode/conf/ca-bundle.crt" |
|
133 | 135 | |
|
134 | 136 | # depends_on: |
|
135 | 137 | # - redis |
|
136 | 138 | |
|
137 | 139 | volumes: |
|
138 | 140 | - confvolume:/etc/rhodecode/conf |
|
139 | 141 | - logvolume:/var/log/rhodecode |
|
140 |
- r |
|
|
142 | - rc_reposvolume:/var/opt/rhodecode_repo_store | |
|
141 | 143 | - rc_datavolume:/var/opt/rhodecode_data |
|
142 | 144 | |
|
143 | 145 | logging: |
|
144 | 146 | *custom-logging |
|
145 | 147 | |
|
146 | 148 | celery: |
|
147 | 149 | networks: |
|
148 | 150 | - rhodecode_network |
|
149 | 151 | image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION:?specify-RC_VERSION-env-var} |
|
150 | 152 | env_file: |
|
151 | 153 | - .custom/.runtime.env |
|
152 | 154 | stdin_open: true |
|
153 | 155 | tty: true |
|
154 | 156 | restart: always |
|
155 | 157 | command: [ |
|
156 | 158 | "/usr/local/bin/rhodecode_bin/bin/celery", |
|
157 | 159 | "worker", |
|
158 | 160 | "--task-events", |
|
159 | 161 | "--autoscale=10,2", |
|
160 | 162 | "--no-color", |
|
161 | 163 | "--app=rhodecode.lib.celerylib.loader", |
|
162 | 164 | "--loglevel=DEBUG", |
|
163 | 165 | "--ini=/etc/rhodecode/conf/rhodecode.optimized.ini" |
|
164 | 166 | ] |
|
165 | 167 | |
|
166 | 168 | environment: |
|
167 | 169 | RC_APP_TYPE: rhodecode_celery |
|
168 | 170 | RC_APP_PROC: 1 |
|
169 | 171 | MAIN_INI_PATH: /etc/rhodecode/conf/rhodecode.optimized.ini |
|
170 | 172 | SSL_CERT_FILE: "/etc/rhodecode/conf/ca-bundle.crt" |
|
171 | 173 | REQUESTS_CA_BUNDLE: "/etc/rhodecode/conf/ca-bundle.crt" |
|
172 | 174 | GIT_SSL_CAINFO: "/etc/rhodecode/conf/ca-bundle.crt" |
|
173 | 175 | |
|
174 | 176 | # depends_on: |
|
175 | 177 | # - database |
|
176 | 178 | # - redis |
|
177 | 179 | |
|
178 | 180 | volumes: |
|
179 | 181 | - confvolume:/etc/rhodecode/conf |
|
180 | 182 | - logvolume:/var/log/rhodecode |
|
181 |
- r |
|
|
183 | - rc_reposvolume:/var/opt/rhodecode_repo_store | |
|
182 | 184 | - rc_datavolume:/var/opt/rhodecode_data |
|
183 | 185 | |
|
184 | 186 | logging: |
|
185 | 187 | *custom-logging |
|
186 | 188 | |
|
187 | 189 | labels: |
|
188 | 190 | - "traefik.enable=false" |
|
189 | 191 | |
|
190 | 192 | celery-beat: |
|
191 | 193 | # This service is not scalable |
|
192 | 194 | networks: |
|
193 | 195 | - rhodecode_network |
|
194 | 196 | image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION:?specify-RC_VERSION-env-var} |
|
195 | 197 | env_file: |
|
196 | 198 | - .custom/.runtime.env |
|
197 | 199 | stdin_open: true |
|
198 | 200 | tty: true |
|
199 | 201 | restart: always |
|
200 | 202 | command: [ |
|
201 | 203 | "/usr/local/bin/rhodecode_bin/bin/celery", |
|
202 | 204 | "beat", |
|
203 | 205 | "--no-color", |
|
204 | 206 | "--app=rhodecode.lib.celerylib.loader", |
|
205 | 207 | "--scheduler=rhodecode.lib.celerylib.scheduler.RcScheduler", |
|
206 | 208 | "--loglevel=DEBUG", |
|
207 | 209 | "--ini=/etc/rhodecode/conf/rhodecode.optimized.ini" |
|
208 | 210 | ] |
|
209 | 211 | |
|
210 | 212 | environment: |
|
211 | 213 | RC_APP_TYPE: rhodecode_beat |
|
212 | 214 | RC_APP_PROC: 1 |
|
213 | 215 | MAIN_INI_PATH: /etc/rhodecode/conf/rhodecode.optimized.ini |
|
214 | 216 | SSL_CERT_FILE: "/etc/rhodecode/conf/ca-bundle.crt" |
|
215 | 217 | REQUESTS_CA_BUNDLE: "/etc/rhodecode/conf/ca-bundle.crt" |
|
216 | 218 | GIT_SSL_CAINFO: "/etc/rhodecode/conf/ca-bundle.crt" |
|
217 | 219 | |
|
218 | 220 | # depends_on: |
|
219 | 221 | # - database |
|
220 | 222 | # - redis |
|
221 | 223 | |
|
222 | 224 | volumes: |
|
223 | 225 | - confvolume:/etc/rhodecode/conf |
|
224 | 226 | - logvolume:/var/log/rhodecode |
|
225 |
- r |
|
|
227 | - rc_reposvolume:/var/opt/rhodecode_repo_store | |
|
226 | 228 | - rc_datavolume:/var/opt/rhodecode_data |
|
227 | 229 | |
|
228 | 230 | logging: |
|
229 | 231 | *custom-logging |
|
230 | 232 | |
|
231 | 233 | labels: |
|
232 | 234 | - "traefik.enable=false" |
|
233 | 235 | |
|
234 | 236 | svn: |
|
235 | 237 | networks: |
|
236 | 238 | - rhodecode_network |
|
237 | 239 | image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION:?specify-RC_VERSION-env-var} |
|
238 | 240 | env_file: |
|
239 | 241 | - .custom/.runtime.env |
|
240 | 242 | |
|
241 | 243 | # build: |
|
242 | 244 | # context: . |
|
243 | 245 | # dockerfile: service/svn/rhodecode_svn.dockerfile |
|
244 | 246 | # args: |
|
245 | 247 | # APACHE_VER: 1.3 |
|
246 | 248 | |
|
247 | 249 | stdin_open: true |
|
248 | 250 | tty: true |
|
249 | 251 | restart: always |
|
250 | 252 | command: ["apachectl", "-D", "FOREGROUND"] |
|
251 | 253 | |
|
252 | 254 | environment: |
|
253 | 255 | RC_APP_TYPE: rhodecode_svn |
|
254 | 256 | |
|
255 | 257 | # SVN Specific |
|
256 | 258 | MOD_DAV_SVN_PORT: 8090 |
|
257 | 259 | APACHE_LOG_DIR: /var/log/rhodecode/svn |
|
258 | 260 | MOD_DAV_SVN_CONF_FILE: /etc/rhodecode/conf/svn/mod_dav_svn.conf |
|
259 | 261 | |
|
260 | 262 | # ports: |
|
261 | 263 | # - "127.0.0.1::8090" |
|
262 | 264 | |
|
263 | 265 | healthcheck: |
|
264 | 266 | test: [ "CMD", "curl", "-A", "RhodeCode-Healthcheck", "-s", "-o", "/dev/null", "-w", "'%{http_code}'", "http://127.0.0.1:8090/_server_status" ] |
|
265 | 267 | timeout: 30s |
|
266 | 268 | interval: 60s |
|
267 | 269 | retries: 10 |
|
268 | 270 | |
|
269 | 271 | volumes: |
|
270 | 272 | - confvolume:/etc/rhodecode/conf |
|
271 | 273 | - logvolume:/var/log/rhodecode |
|
272 |
- r |
|
|
274 | - rc_reposvolume:/var/opt/rhodecode_repo_store | |
|
273 | 275 | |
|
274 | 276 | logging: |
|
275 | 277 | *custom-logging |
|
276 | 278 | |
|
277 | 279 | sshd: |
|
278 | 280 | networks: |
|
279 | 281 | - rhodecode_network |
|
280 | 282 | image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION:?specify-RC_VERSION-env-var} |
|
281 | 283 | env_file: |
|
282 | 284 | - .custom/.runtime.env |
|
283 | 285 | |
|
284 | 286 | stdin_open: true |
|
285 | 287 | tty: true |
|
286 | 288 | restart: always |
|
287 | 289 | command: ["/usr/sbin/sshd", "-f", "/etc/rhodecode/sshd_config", "-D", "-e"] |
|
288 | 290 | |
|
289 | 291 | environment: |
|
290 | 292 | RC_APP_TYPE: rhodecode_sshd |
|
291 | 293 | SSH_BOOTSTRAP: 1 |
|
292 | 294 | |
|
293 | 295 | # ports: |
|
294 | 296 | # # set from .env file |
|
295 | 297 | # - "${RC_SSH_PORT:?must-specify-ssh-port}:22" |
|
296 | 298 | |
|
297 | 299 | volumes: |
|
298 | 300 | - confvolume:/etc/rhodecode/conf |
|
299 | 301 | - logvolume:/var/log/rhodecode |
|
300 |
- r |
|
|
302 | - rc_reposvolume:/var/opt/rhodecode_repo_store | |
|
301 | 303 | - rc_datavolume:/var/opt/rhodecode_data |
|
302 | 304 | |
|
303 | 305 | logging: |
|
304 | 306 | *custom-logging |
|
305 | 307 | |
|
306 | 308 | labels: |
|
307 | 309 | - "traefik.enable=true" |
|
308 | 310 | - "traefik.http.routers.sshd.entrypoints=ssh" |
|
309 | 311 | - "traefik.http.routers.sshd.rule=Host(`*`)" |
|
310 | 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 | 1 | version: '3.9' |
|
2 | 2 | |
|
3 | 3 | ## Shared base stuff for all compose files in stack |
|
4 | 4 | |
|
5 | 5 | x-logging: &custom-logging |
|
6 | 6 | # docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions |
|
7 | 7 | # NOTE: loki logging driver ONLY works for host type networks... |
|
8 | 8 | driver: loki |
|
9 | 9 | options: |
|
10 | 10 | loki-url: "http://127.0.0.1:3100/loki/api/v1/push" |
|
11 | 11 | #loki-url: "http://loki:3100/loki/api/v1/push" |
|
12 | 12 | loki-retries: "5" |
|
13 | 13 | loki-timeout: "1s" |
|
14 | 14 | loki-max-backoff: "800ms" |
|
15 | 15 | |
|
16 | 16 | volumes: |
|
17 | 17 | # shared logvolume |
|
18 | 18 | logvolume: |
|
19 | 19 | driver: local |
|
20 | 20 | driver_opts: |
|
21 | 21 | type: none |
|
22 | 22 | o: bind |
|
23 | 23 | device: $PWD/logs |
|
24 | 24 | |
|
25 | 25 | # bind-mount with configs |
|
26 | 26 | confvolume: |
|
27 | 27 | driver: local |
|
28 | 28 | driver_opts: |
|
29 | 29 | type: none |
|
30 | 30 | o: bind |
|
31 | 31 | device: $PWD/config/_shared |
|
32 | 32 | |
|
33 | 33 | # SHARED volume for rhodecode caches, archive caches, nginx static, |
|
34 | 34 | # must be run via: docker volume create --name=rc_datavolume |
|
35 | 35 | rc_datavolume: |
|
36 | 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 | 43 | networks: |
|
39 | 44 | |
|
40 | 45 | # SHARED network for all containers |
|
41 | 46 | # must be run via: docker network create --name=rhodecode_network |
|
42 | 47 | rhodecode_network: |
|
43 | 48 | name: rhodecode_network |
|
44 | 49 | driver: bridge |
|
45 | 50 | external: true |
|
46 | 51 |
@@ -1,128 +1,124 b'' | |||
|
1 | 1 | version: '3.9' |
|
2 | 2 | |
|
3 | 3 | volumes: |
|
4 | 4 | |
|
5 | 5 | prometheus_data: |
|
6 | 6 | labels: |
|
7 | 7 | "keep": 1 |
|
8 | 8 | |
|
9 | 9 | grafana_data: |
|
10 | 10 | labels: |
|
11 | 11 | "keep": 1 |
|
12 | 12 | |
|
13 | 13 | services: |
|
14 | 14 | |
|
15 | 15 | statsd-exporter: |
|
16 | 16 | image: prom/statsd-exporter:v0.22.8 |
|
17 | 17 | restart: always |
|
18 | 18 | command: [ |
|
19 | 19 | '--statsd.mapping-config=/etc/statsd/statsd.yaml', |
|
20 | 20 | '--statsd.listen-udp=:9125', |
|
21 | 21 | '--web.listen-address=:9102' |
|
22 | 22 | ] |
|
23 | 23 | networks: |
|
24 | 24 | - rhodecode_network |
|
25 | 25 | # ports: |
|
26 | 26 | # - "9125:9125/udp" |
|
27 | 27 | # - "9102:9102" |
|
28 | 28 | |
|
29 | 29 | volumes: |
|
30 | 30 | - ./config/statsd-exporter:/etc/statsd |
|
31 | 31 | labels: |
|
32 | 32 | - "traefik.enable=false" |
|
33 | 33 | - "traefik.http.services.statsd-exporter.loadbalancer.server.port=9125" |
|
34 | 34 | - "traefik.http.services.statsd-exporter.loadbalancer.server.port=9102" |
|
35 | 35 | |
|
36 | 36 | node-exporter: |
|
37 | 37 | image: prom/node-exporter:v1.4.0 |
|
38 | 38 | command: |
|
39 | 39 | - "--path.procfs=/host/proc" |
|
40 | 40 | - "--path.rootfs=/rootfs" |
|
41 | 41 | - "--path.sysfs=/host/sys" |
|
42 | 42 | - "--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)" |
|
43 | 43 | - "--collector.systemd" |
|
44 | 44 | - "--collector.processes" |
|
45 | 45 | networks: |
|
46 | 46 | - rhodecode_network |
|
47 | 47 | pid: host |
|
48 | 48 | restart: always |
|
49 | 49 | # ports: |
|
50 | 50 | # - "9100:9100" |
|
51 | 51 | volumes: |
|
52 | 52 | - "/proc:/host/proc:ro" |
|
53 | 53 | - "/sys:/host/sys:ro" |
|
54 | 54 | - "/:/rootfs:ro" |
|
55 | 55 | labels: |
|
56 | 56 | - "traefik.enable=false" |
|
57 | 57 | - "traefik.http.services.node-exporter.loadbalancer.server.port=9100" |
|
58 | 58 | |
|
59 | 59 | prometheus: |
|
60 | 60 | image: prom/prometheus:v2.40.2 |
|
61 | 61 | restart: always |
|
62 | 62 | command: |
|
63 | 63 | - "--config.file=/etc/prometheus/prometheus.yml" |
|
64 | 64 | - "--storage.tsdb.path=/prometheus" |
|
65 | 65 | - "--web.console.libraries=/etc/prometheus/console_libraries" |
|
66 | 66 | - "--web.console.templates=/etc/prometheus/consoles" |
|
67 | 67 | - "--storage.tsdb.retention.time=24h" |
|
68 | 68 | - "--web.enable-lifecycle" |
|
69 | 69 | # ports: |
|
70 | 70 | # - "9090:9090" |
|
71 | 71 | networks: |
|
72 | 72 | - rhodecode_network |
|
73 | 73 | volumes: |
|
74 | 74 | - ./config/prometheus:/etc/prometheus |
|
75 | 75 | - prometheus_data:/prometheus |
|
76 | 76 | labels: |
|
77 | 77 | - "traefik.enable=false" |
|
78 | 78 | - "traefik.http.services.prometheus.loadbalancer.server.port=9090" |
|
79 | 79 | |
|
80 | 80 | grafana: |
|
81 | 81 | image: grafana/grafana:9.2.5 |
|
82 | 82 | restart: always |
|
83 | 83 | # ports: |
|
84 | 84 | # - "3000:3000" |
|
85 | 85 | volumes: |
|
86 | 86 | - grafana_data:/var/lib/grafana |
|
87 | 87 | - ./config/grafana:/etc/grafana |
|
88 | 88 | networks: |
|
89 | 89 | - rhodecode_network |
|
90 | 90 | labels: |
|
91 | 91 | - "traefik.enable=true" |
|
92 | 92 | - "traefik.http.routers.grafana.entrypoints=http" |
|
93 | 93 | - "traefik.http.routers.grafana.rule=PathPrefix(`/_grafana`)" |
|
94 | 94 | - "traefik.http.routers.grafana.service=grafana-http" |
|
95 | 95 | - "traefik.http.services.grafana-http.loadbalancer.server.port=3000" |
|
96 | 96 | |
|
97 | 97 | loki: |
|
98 | 98 | image: grafana/loki:2.7.0 |
|
99 | 99 | restart: always |
|
100 | 100 | # ports: |
|
101 | 101 | # - "3100:3100" |
|
102 | 102 | # - "9095:9095" |
|
103 | 103 | command: [ |
|
104 | 104 | "-config.file=/etc/loki/loki-config.yaml" |
|
105 | 105 | ] |
|
106 | 106 | networks: |
|
107 | 107 | - rhodecode_network |
|
108 | 108 | volumes: |
|
109 | 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 | 112 | promtail: |
|
117 | 113 | image: grafana/promtail:latest |
|
118 | 114 | command: [ |
|
119 | 115 | "-config.file=/etc/promtail/promtail-config.yaml" |
|
120 | 116 | ] |
|
121 | 117 | networks: |
|
122 | 118 | - rhodecode_network |
|
123 | 119 | volumes: |
|
124 | 120 | - /var/log:/var/log |
|
125 | 121 | - logvolume:/var/log_volume |
|
126 | 122 | - ./config/promtail:/etc/promtail |
|
127 | 123 | labels: |
|
128 | 124 | - "traefik.enable=false" |
@@ -1,78 +1,47 b'' | |||
|
1 | 1 | version: '3.9' |
|
2 | 2 | |
|
3 | 3 | x-logging: &custom-logging |
|
4 | 4 | # docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions |
|
5 | 5 | # NOTE: loki logging driver ONLY works for host type networks... |
|
6 | 6 | driver: loki |
|
7 | 7 | options: |
|
8 | 8 | loki-url: "http://127.0.0.1:3100/loki/api/v1/push" |
|
9 | 9 | #loki-url: "http://loki:3100/loki/api/v1/push" |
|
10 | 10 | loki-retries: "5" |
|
11 | 11 | loki-timeout: "1s" |
|
12 | 12 | loki-max-backoff: "800ms" |
|
13 | 13 | |
|
14 | 14 | ## docker network create -d overlay lb-net |
|
15 | 15 | services: |
|
16 | 16 | |
|
17 | 17 | traefik: |
|
18 | 18 | |
|
19 | 19 | image: traefik:v2.9.5 |
|
20 | 20 | |
|
21 | 21 | ports: |
|
22 | 22 | # The HTTP port, exposed as http entrypoint |
|
23 | 23 | - "80:80" |
|
24 | 24 | # The HTTPS port, exposed as https entrypoint |
|
25 | 25 | - "443:443" |
|
26 | 26 | # The SSH port |
|
27 | 27 | - "${RC_SSH_PORT}:${RC_SSH_PORT}" |
|
28 | 28 | # The Web UI (enabled by --api.insecure=true) |
|
29 | 29 | # uncomment to expose dashboard at port :7000 |
|
30 | 30 | #- "7000:7000" |
|
31 | 31 | volumes: |
|
32 | 32 | # So that Traefik can listen to the Docker events |
|
33 | 33 | - /var/run/docker.sock:/var/run/docker.sock |
|
34 | 34 | - ./config/traefik:/etc/traefik |
|
35 | 35 | deploy: |
|
36 | 36 | placement: |
|
37 | 37 | constraints: |
|
38 | 38 | # limit swarm deploy to MANAGER only |
|
39 | 39 | - node.role == manager |
|
40 | 40 | networks: |
|
41 | 41 | - rhodecode_network |
|
42 | 42 | |
|
43 | 43 | labels: |
|
44 | 44 | - "traefik.enable=true" |
|
45 | 45 | |
|
46 | 46 | logging: |
|
47 | 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 | 1 | version: '3.9' |
|
2 | 2 | |
|
3 | 3 | x-logging: &custom-logging |
|
4 | 4 | # docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions |
|
5 | 5 | # NOTE: loki logging driver ONLY works for host type networks... |
|
6 | 6 | driver: loki |
|
7 | 7 | options: |
|
8 | 8 | loki-url: "http://127.0.0.1:3100/loki/api/v1/push" |
|
9 | 9 | #loki-url: "http://loki:3100/loki/api/v1/push" |
|
10 | 10 | loki-retries: "5" |
|
11 | 11 | loki-timeout: "1s" |
|
12 | 12 | loki-max-backoff: "800ms" |
|
13 | 13 | |
|
14 | 14 | volumes: |
|
15 | 15 | |
|
16 | 16 | # volume for redis data store |
|
17 | 17 | redis_data: |
|
18 | 18 | labels: |
|
19 | 19 | "keep": 1 |
|
20 | 20 | |
|
21 | 21 | # volume for Postgres db store |
|
22 | 22 | |
|
23 | 23 | # volume for Postgres Data |
|
24 | 24 | pg_data: |
|
25 | 25 | labels: |
|
26 | 26 | "keep": 1 |
|
27 | 27 | |
|
28 | 28 | # volume for rhodecode elasticsearch |
|
29 | 29 | es_data: |
|
30 | 30 | labels: |
|
31 | 31 | "keep": 1 |
|
32 | 32 | |
|
33 | 33 | |
|
34 | 34 | services: |
|
35 | 35 | |
|
36 | 36 | channelstream: |
|
37 | 37 | networks: |
|
38 | 38 | - rhodecode_network |
|
39 | 39 | image: channelstream/channelstream:0.7.1 |
|
40 | 40 | |
|
41 | 41 | restart: always |
|
42 | 42 | |
|
43 | 43 | # ports: |
|
44 | 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 |
|
|
49 | CHANNELSTREAM_ALLOW_POSTING_FROM: 0.0.0.0 | |
|
48 | env_file: | |
|
49 | - .custom/.runtime.env | |
|
50 | 50 | |
|
51 | 51 | healthcheck: |
|
52 | 52 | test: [ "CMD", "curl", "-s", "-o", "/dev/null", "-w", "'%{http_code}'", "http://channelstream:8000/admin/sign_in" ] |
|
53 | 53 | timeout: 5s |
|
54 | 54 | interval: 60s |
|
55 | 55 | retries: 10 |
|
56 | 56 | |
|
57 | 57 | volumes: |
|
58 | 58 | - confvolume:/etc/rhodecode/conf |
|
59 | 59 | - logvolume:/var/log/rhodecode |
|
60 | 60 | |
|
61 | 61 | logging: |
|
62 | 62 | *custom-logging |
|
63 | 63 | |
|
64 | 64 | labels: |
|
65 | 65 | - "traefik.enable=false" |
|
66 | 66 | #- "traefik.http.routers.channelstream.entrypoints=http" |
|
67 | 67 | #- "traefik.http.services.channelstream.loadbalancer.server.port=9800" |
|
68 | 68 | |
|
69 | 69 | profiles: |
|
70 | 70 | ["channelstream"] |
|
71 | 71 | |
|
72 | 72 | nginx: |
|
73 | 73 | networks: |
|
74 | 74 | - rhodecode_network |
|
75 | 75 | image: library/nginx:1.23.2 |
|
76 | 76 | |
|
77 | 77 | restart: always |
|
78 | 78 | |
|
79 | 79 | environment: |
|
80 | 80 | NGINX_ENTRYPOINT_QUIET_LOGS: 1 |
|
81 | 81 | |
|
82 | 82 | healthcheck: |
|
83 | 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 | 85 | timeout: 30s |
|
86 | 86 | interval: 60s |
|
87 | 87 | retries: 10 |
|
88 | 88 | |
|
89 | 89 | # depends_on: |
|
90 | 90 | # - channelstream |
|
91 | 91 | |
|
92 | 92 | volumes: |
|
93 | 93 | - ./config/nginx/nginx.conf:/etc/nginx/nginx.conf:ro |
|
94 | 94 | - ./config/nginx/http.conf:/etc/nginx/http.conf:ro |
|
95 | 95 | - ./config/nginx/proxy.conf:/etc/nginx/proxy.conf:ro |
|
96 | 96 | - logvolume:/var/log/rhodecode |
|
97 | 97 | - rc_datavolume:/var/opt/rhodecode_data |
|
98 | 98 | |
|
99 | 99 | logging: |
|
100 | 100 | *custom-logging |
|
101 | 101 | |
|
102 | 102 | labels: |
|
103 | 103 | - "traefik.enable=true" |
|
104 | 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 | 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 | 108 | elasticsearch: |
|
109 | 109 | networks: |
|
110 | 110 | - rhodecode_network |
|
111 | 111 | image: elasticsearch:6.8.23 |
|
112 | 112 | |
|
113 | 113 | environment: |
|
114 | 114 | - cluster.name=elasticsearch-cluster |
|
115 | 115 | - network.host=0.0.0.0 |
|
116 | 116 | - bootstrap.memory_lock=true |
|
117 | 117 | - discovery.type=single-node |
|
118 | 118 | - "ES_JAVA_OPTS=-Xms512m -Xmx512m" |
|
119 | 119 | healthcheck: |
|
120 | 120 | # change port 80 to 443 when only using SSL |
|
121 | 121 | test: [ "CMD", "curl", "-A", "RhodeCode-Healthcheck", "-s", "-o", "/dev/null", "-w", "'%{http_code}'", "elasticsearch:9200/_cat/health" ] |
|
122 | 122 | timeout: 30s |
|
123 | 123 | interval: 60s |
|
124 | 124 | retries: 10 |
|
125 | 125 | |
|
126 | 126 | ulimits: |
|
127 | 127 | memlock: |
|
128 | 128 | soft: -1 |
|
129 | 129 | hard: -1 |
|
130 | 130 | |
|
131 | 131 | volumes: |
|
132 | 132 | - es_data:/usr/share/elasticsearch/data |
|
133 | 133 | |
|
134 | 134 | logging: |
|
135 | 135 | *custom-logging |
|
136 | 136 | |
|
137 | 137 | profiles: |
|
138 | 138 | ["elasticsearch"] |
|
139 | 139 | |
|
140 | 140 | redis: |
|
141 | 141 | networks: |
|
142 | 142 | - rhodecode_network |
|
143 | 143 | image: library/redis:7.0.5 |
|
144 | 144 | |
|
145 | 145 | restart: always |
|
146 | 146 | command: |
|
147 | 147 | - "redis-server" |
|
148 | 148 | - "/etc/redis/redis.conf" |
|
149 | 149 | - "--maxmemory-policy allkeys-lru" |
|
150 | 150 | - "--maxmemory ${RC_REDIS_MAXMEMORY}" |
|
151 | 151 | |
|
152 | 152 | # ports: |
|
153 | 153 | # - "127.0.0.1::6379" |
|
154 | 154 | |
|
155 | 155 | healthcheck: |
|
156 | 156 | test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ] |
|
157 | 157 | interval: 60s |
|
158 | 158 | |
|
159 | 159 | volumes: |
|
160 | 160 | - ./config/redis/redis.conf:/etc/redis/redis.conf:ro |
|
161 | 161 | - logvolume:/var/log/rhodecode |
|
162 | 162 | - redis_data:/data |
|
163 | 163 | |
|
164 | 164 | profiles: |
|
165 | 165 | ["redis"] |
|
166 | 166 | |
|
167 | 167 | logging: |
|
168 | 168 | *custom-logging |
|
169 | 169 | |
|
170 | 170 | database: |
|
171 | 171 | networks: |
|
172 | 172 | - rhodecode_network |
|
173 | 173 | image: library/postgres:14.6 |
|
174 | 174 | |
|
175 | 175 | environment: |
|
176 | 176 | POSTGRES_DB: ${DB_NAME:?must-specify-db-name} |
|
177 | 177 | POSTGRES_USER: ${DB_USER:?must-specify-db-user} |
|
178 | 178 | PGUSER: ${DB_USER:?must-specify-db-user} |
|
179 | 179 | POSTGRES_PASSWORD: ${DB_PASSWORD:?must-specify-db-password} |
|
180 | 180 | POSTGRES_HOST_AUTH_METHOD: md5 |
|
181 | 181 | POSTGRES_INITDB_ARGS: "--auth-host=md5 --auth-local=md5" |
|
182 | 182 | |
|
183 | 183 | restart: unless-stopped |
|
184 | 184 | command: |
|
185 | 185 | - "postgres" |
|
186 | 186 | - "-c" |
|
187 | 187 | - "log_statement=ddl" |
|
188 | 188 | - "-c" |
|
189 | 189 | - "config_file=/etc/conf.d/pg_customized.conf" |
|
190 | 190 | |
|
191 | 191 | # ports: |
|
192 | 192 | # - "127.0.0.1::5432" |
|
193 | 193 | |
|
194 | 194 | healthcheck: |
|
195 | 195 | test: ["CMD-SHELL", "pg_isready", '-U', "$DB_USER"] |
|
196 | 196 | interval: 10s |
|
197 | 197 | timeout: 5s |
|
198 | 198 | retries: 5 |
|
199 | 199 | |
|
200 | 200 | volumes: |
|
201 | 201 | - $PWD/config/database/pg_customized.conf:/etc/conf.d/pg_customized.conf:ro |
|
202 | 202 | # db dumps reverse mount |
|
203 | 203 | - $PWD/.custom/db_dump:/var/rc-data-dump |
|
204 | 204 | # save the pg_data volume |
|
205 | 205 | - pg_data:/var/lib/postgresql/data |
|
206 | 206 | - logvolume:/var/log/rhodecode |
|
207 | 207 | |
|
208 | 208 | profiles: |
|
209 | 209 | ["postgres"] |
|
210 | 210 | |
|
211 | 211 | logging: |
|
212 | 212 | *custom-logging |
|
213 | 213 | |
|
214 | 214 | database-mysql: |
|
215 | 215 | networks: |
|
216 | 216 | - rhodecode_network |
|
217 | 217 | image: library/mysql:8.0.31 |
|
218 | 218 | |
|
219 | 219 | environment: |
|
220 | 220 | MYSQL_DATABASE: ${DB_NAME:?must-specify-db-name} |
|
221 | 221 | MYSQL_USER: ${DB_USER:?must-specify-db-user} |
|
222 | 222 | MYSQL_PASSWORD: ${DB_PASSWORD:?must-specify-db-password} |
|
223 | 223 | MYSQL_ROOT_PASSWORD: ${DB_PASSWORD:?must-specify-db-password} |
|
224 | 224 | |
|
225 | 225 | restart: unless-stopped |
|
226 | 226 | |
|
227 | 227 | # ports: |
|
228 | 228 | # - "127.0.0.1::3306" |
|
229 | 229 | |
|
230 | 230 | volumes: |
|
231 | 231 | - ./config/database/mysql_customized.conf:/etc/mysql/conf.d/config-file.cnf:ro |
|
232 | 232 | # save the mysql_data volume |
|
233 | 233 | - $PWD/mysql_dir:/var/lib/mysql |
|
234 | 234 | - logvolume:/var/log/rhodecode |
|
235 | 235 | |
|
236 | 236 | profiles: |
|
237 | 237 | ["mysql"] |
|
238 | 238 | |
|
239 | 239 | logging: |
|
240 | 240 | *custom-logging |
This diff has been collapsed as it changes many lines, (1306 lines changed) Show them Hide them | |||
@@ -1,2889 +1,3663 b'' | |||
|
1 | 1 | #!/usr/bin/env bash |
|
2 | 2 | # This script was generated by bashly 0.8.10 (https://bashly.dannyb.co) |
|
3 | 3 | # Modifying it manually is not recommended |
|
4 | 4 | |
|
5 | 5 | # :wrapper.bash3_bouncer |
|
6 | 6 | if [[ "${BASH_VERSINFO:-0}" -lt 4 ]]; then |
|
7 | 7 | printf "bash version 4 or higher is required\n" >&2 |
|
8 | 8 | exit 1 |
|
9 | 9 | fi |
|
10 | 10 | |
|
11 | 11 | # :command.master_script |
|
12 | 12 | |
|
13 | 13 | # :command.version_command |
|
14 | 14 | version_command() { |
|
15 | 15 | echo "$version" |
|
16 | 16 | } |
|
17 | 17 | |
|
18 | 18 | # :command.usage |
|
19 | 19 | rccontrol_usage() { |
|
20 | 20 | if [[ -n $long_usage ]]; then |
|
21 | 21 | printf "rccontrol - RhodeCode Control - CLI for manaing RhodeCode Cluster Stack\n" |
|
22 | 22 | echo |
|
23 | 23 | |
|
24 | 24 | else |
|
25 | 25 | printf "rccontrol - RhodeCode Control - CLI for manaing RhodeCode Cluster Stack\n" |
|
26 | 26 | echo |
|
27 | 27 | |
|
28 | 28 | fi |
|
29 | 29 | |
|
30 | 30 | printf "Usage:\n" |
|
31 | 31 | printf " rccontrol [OPTIONS] COMMAND\n" |
|
32 | 32 | printf " rccontrol [COMMAND] --help | -h\n" |
|
33 | 33 | printf " rccontrol --version | -v\n" |
|
34 | 34 | echo |
|
35 | 35 | # :command.usage_commands |
|
36 | 36 | printf "Commands:\n" |
|
37 | 37 | echo " self-update update rccontrol and it's docker definitions" |
|
38 | 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 | 39 | echo |
|
43 | 40 | printf "Build Commands:\n" |
|
44 | 41 | echo " get-build-artifacts Fetch Artifacts to run installer based build" |
|
45 | 42 | echo " build Build RhodeCode image from installer" |
|
46 | 43 | echo " get-build-source Fetch RhodeCode sources, store in .source dir to run a source-based builds" |
|
47 | 44 | echo " build-source Build RhodeCode image from source, requires upgrade-source initially" |
|
48 | 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 | 51 | printf "CLI Commands:\n" |
|
50 |
echo " cli |
|
|
51 | echo " cli-db CLI" | |
|
52 | echo " cli-db-upgrade CLI" | |
|
52 | echo " cli run various CLI tools" | |
|
53 | 53 | echo |
|
54 | 54 | printf "Backup Commands:\n" |
|
55 | 55 | echo " backup-db CLI" |
|
56 | 56 | echo " backup-data CLI" |
|
57 | 57 | echo |
|
58 | 58 | |
|
59 | 59 | # :command.long_usage |
|
60 | 60 | if [[ -n $long_usage ]]; then |
|
61 | 61 | printf "Options:\n" |
|
62 | 62 | |
|
63 | 63 | # :command.usage_fixed_flags |
|
64 | 64 | echo " --help, -h" |
|
65 | 65 | printf " Show this help\n" |
|
66 | 66 | echo |
|
67 | 67 | echo " --version, -v" |
|
68 | 68 | printf " Show version number\n" |
|
69 | 69 | echo |
|
70 | 70 | |
|
71 | 71 | # :command.usage_flags |
|
72 | 72 | # :flag.usage |
|
73 | 73 | echo " --debug" |
|
74 | 74 | printf " Enable debug and detailed output\n" |
|
75 | 75 | echo |
|
76 | 76 | |
|
77 | 77 | # :command.usage_environment_variables |
|
78 | 78 | printf "Environment Variables:\n" |
|
79 | 79 | |
|
80 | 80 | # :environment_variable.usage |
|
81 | 81 | echo " AUTH_TOKEN" |
|
82 | 82 | printf " Set your RhodeCode AUTH Token\n" |
|
83 | 83 | echo |
|
84 | 84 | |
|
85 | 85 | # :environment_variable.usage |
|
86 | 86 | echo " RC_CLI_VERSION_NAME" |
|
87 | 87 | printf " default version to build and install\n" |
|
88 | 88 | printf " Default: 4.27.0\n" |
|
89 | 89 | echo |
|
90 | 90 | |
|
91 | 91 | # :environment_variable.usage |
|
92 | 92 | echo " RC_STACK_ROUTER_EXT" |
|
93 | 93 | printf "\n" |
|
94 | 94 | printf " Default: .custom/docker-compose-router.override.yaml\n" |
|
95 | 95 | echo |
|
96 | 96 | |
|
97 | 97 | # :environment_variable.usage |
|
98 | 98 | echo " RC_STACK_METRICS_EXT" |
|
99 | 99 | printf "\n" |
|
100 | 100 | printf " Default: .custom/docker-compose-metrics.override.yaml\n" |
|
101 | 101 | echo |
|
102 | 102 | |
|
103 | 103 | # :environment_variable.usage |
|
104 | 104 | echo " RC_STACK_SERVICES_EXT" |
|
105 | 105 | printf "\n" |
|
106 | 106 | printf " Default: .custom/docker-compose-services.override.yaml\n" |
|
107 | 107 | echo |
|
108 | 108 | |
|
109 | 109 | # :environment_variable.usage |
|
110 | 110 | echo " RC_STACK_RHODECODE_EXT" |
|
111 | 111 | printf "\n" |
|
112 | 112 | printf " Default: .custom/docker-compose-apps.override.yaml\n" |
|
113 | 113 | echo |
|
114 | 114 | |
|
115 | 115 | # :command.footer |
|
116 | 116 | printf "RhodeCode Inc 2022\n\n" |
|
117 | 117 | echo |
|
118 | 118 | |
|
119 | 119 | fi |
|
120 | 120 | } |
|
121 | 121 | |
|
122 | 122 | # :command.usage |
|
123 | 123 | rccontrol_self_update_usage() { |
|
124 | 124 | if [[ -n $long_usage ]]; then |
|
125 | 125 | printf "rccontrol self-update - update rccontrol and it's docker definitions\n" |
|
126 | 126 | echo |
|
127 | 127 | |
|
128 | 128 | else |
|
129 | 129 | printf "rccontrol self-update - update rccontrol and it's docker definitions\n" |
|
130 | 130 | echo |
|
131 | 131 | |
|
132 | 132 | fi |
|
133 | 133 | |
|
134 | 134 | printf "Usage:\n" |
|
135 | 135 | printf " rccontrol self-update [OPTIONS]\n" |
|
136 | 136 | printf " rccontrol self-update --help | -h\n" |
|
137 | 137 | echo |
|
138 | 138 | |
|
139 | 139 | # :command.long_usage |
|
140 | 140 | if [[ -n $long_usage ]]; then |
|
141 | 141 | printf "Options:\n" |
|
142 | 142 | |
|
143 | 143 | # :command.usage_fixed_flags |
|
144 | 144 | echo " --help, -h" |
|
145 | 145 | printf " Show this help\n" |
|
146 | 146 | echo |
|
147 | 147 | |
|
148 | 148 | # :command.usage_flags |
|
149 | 149 | # :flag.usage |
|
150 | 150 | echo " --auth-token AUTH_TOKEN" |
|
151 | 151 | printf " Optionally specify AUTH TOKEN to obtain sources\n" |
|
152 | 152 | echo |
|
153 | 153 | |
|
154 | 154 | # :flag.usage |
|
155 | 155 | echo " --server-url SERVER_URL" |
|
156 | 156 | printf " Specify RhodeCode server location where projects should be downloaded\n" |
|
157 | 157 | printf " Default: https://code.rhodecode.com\n" |
|
158 | 158 | echo |
|
159 | 159 | |
|
160 | 160 | fi |
|
161 | 161 | } |
|
162 | 162 | |
|
163 | 163 | # :command.usage |
|
164 | 164 | rccontrol_bootstrap_usage() { |
|
165 | 165 | if [[ -n $long_usage ]]; then |
|
166 | 166 | printf "rccontrol bootstrap - Bootstrap this machine, check docker version and install rhodecode-network\n" |
|
167 | 167 | echo |
|
168 | 168 | |
|
169 | 169 | else |
|
170 | 170 | printf "rccontrol bootstrap - Bootstrap this machine, check docker version and install rhodecode-network\n" |
|
171 | 171 | echo |
|
172 | 172 | |
|
173 | 173 | fi |
|
174 | 174 | |
|
175 |
printf "Alias: in |
|
|
175 | printf "Alias: init\n" | |
|
176 | 176 | echo |
|
177 | 177 | |
|
178 | 178 | printf "Usage:\n" |
|
179 | 179 | printf " rccontrol bootstrap [OPTIONS]\n" |
|
180 | 180 | printf " rccontrol bootstrap --help | -h\n" |
|
181 | 181 | echo |
|
182 | 182 | |
|
183 | 183 | # :command.long_usage |
|
184 | 184 | if [[ -n $long_usage ]]; then |
|
185 | 185 | printf "Options:\n" |
|
186 | 186 | |
|
187 | 187 | # :command.usage_fixed_flags |
|
188 | 188 | echo " --help, -h" |
|
189 | 189 | printf " Show this help\n" |
|
190 | 190 | echo |
|
191 | 191 | |
|
192 | 192 | # :command.usage_flags |
|
193 | 193 | # :flag.usage |
|
194 | 194 | echo " --force, -f" |
|
195 | 195 | printf " Overwrite existing files\n" |
|
196 | 196 | echo |
|
197 | 197 | |
|
198 | 198 | # :flag.usage |
|
199 | 199 | echo " --auth-token AUTH_TOKEN" |
|
200 | 200 | printf " Optionally specify AUTH TOKEN to obtain sources\n" |
|
201 | 201 | echo |
|
202 | 202 | |
|
203 | 203 | # :flag.usage |
|
204 | 204 | echo " --server-url SERVER_URL" |
|
205 | 205 | printf " Specify RhodeCode server location where projects should be downloaded\n" |
|
206 | 206 | printf " Default: https://code.rhodecode.com\n" |
|
207 | 207 | echo |
|
208 | 208 | |
|
209 | 209 | # :command.usage_examples |
|
210 | 210 | printf "Examples:\n" |
|
211 | 211 | printf " rccontrol3 bootstrap\n" |
|
212 | 212 | printf " rccontrol3 bootstrap --force\n" |
|
213 | 213 | echo |
|
214 | 214 | |
|
215 | 215 | fi |
|
216 | 216 | } |
|
217 | 217 | |
|
218 | 218 | # :command.usage |
|
219 | 219 | rccontrol_get_build_artifacts_usage() { |
|
220 | 220 | if [[ -n $long_usage ]]; then |
|
221 | 221 | printf "rccontrol get-build-artifacts - Fetch Artifacts to run installer based build\n" |
|
222 | 222 | echo |
|
223 | 223 | |
|
224 | 224 | else |
|
225 | 225 | printf "rccontrol get-build-artifacts - Fetch Artifacts to run installer based build\n" |
|
226 | 226 | echo |
|
227 | 227 | |
|
228 | 228 | fi |
|
229 | 229 | |
|
230 | 230 | printf "Usage:\n" |
|
231 | 231 | printf " rccontrol get-build-artifacts [OPTIONS]\n" |
|
232 | 232 | printf " rccontrol get-build-artifacts --help | -h\n" |
|
233 | 233 | echo |
|
234 | 234 | |
|
235 | 235 | # :command.long_usage |
|
236 | 236 | if [[ -n $long_usage ]]; then |
|
237 | 237 | printf "Options:\n" |
|
238 | 238 | |
|
239 | 239 | # :command.usage_fixed_flags |
|
240 | 240 | echo " --help, -h" |
|
241 | 241 | printf " Show this help\n" |
|
242 | 242 | echo |
|
243 | 243 | |
|
244 | 244 | # :command.usage_flags |
|
245 | 245 | # :flag.usage |
|
246 | 246 | echo " --auth AUTH" |
|
247 | 247 | printf " Specify custom auth for curl e.g -u admin:secret\n" |
|
248 | 248 | printf " Default: \n" |
|
249 | 249 | echo |
|
250 | 250 | |
|
251 | 251 | # :flag.usage |
|
252 | 252 | echo " --installer-url INSTALLER_URL" |
|
253 | 253 | printf " Installer Download URL\n" |
|
254 | 254 | printf " Default: https://dls.rhodecode.com/dls/N2E2ZTY1NzA3NjYxNDA2NTc1NjI3MTcyNzA2MjcxNzIyZTcwNjI3YQ==/rhodecode-control/latest-linux-ee\n" |
|
255 | 255 | echo |
|
256 | 256 | |
|
257 | 257 | # :flag.usage |
|
258 | 258 | echo " --manifest-url MANIFEST_URL" |
|
259 | 259 | printf " Manifest file url\n" |
|
260 | 260 | printf " Default: https://dls.rhodecode.com/linux/MANIFEST\n" |
|
261 | 261 | echo |
|
262 | 262 | |
|
263 | 263 | # :flag.usage |
|
264 | 264 | echo " --version-name VERSION_NAME" |
|
265 | 265 | printf " Specify custom build ver e.g $RC_CLI_VERSION_NAME\n" |
|
266 | 266 | printf " Default: $RC_CLI_VERSION_NAME\n" |
|
267 | 267 | echo |
|
268 | 268 | |
|
269 | 269 | fi |
|
270 | 270 | } |
|
271 | 271 | |
|
272 | 272 | # :command.usage |
|
273 | 273 | rccontrol_build_usage() { |
|
274 | 274 | if [[ -n $long_usage ]]; then |
|
275 | 275 | printf "rccontrol build - Build RhodeCode image from installer\n" |
|
276 | 276 | echo |
|
277 | 277 | |
|
278 | 278 | else |
|
279 | 279 | printf "rccontrol build - Build RhodeCode image from installer\n" |
|
280 | 280 | echo |
|
281 | 281 | |
|
282 | 282 | fi |
|
283 | 283 | |
|
284 | 284 | printf "Usage:\n" |
|
285 | 285 | printf " rccontrol build [OPTIONS]\n" |
|
286 | 286 | printf " rccontrol build --help | -h\n" |
|
287 | 287 | echo |
|
288 | 288 | |
|
289 | 289 | # :command.long_usage |
|
290 | 290 | if [[ -n $long_usage ]]; then |
|
291 | 291 | printf "Options:\n" |
|
292 | 292 | |
|
293 | 293 | # :command.usage_fixed_flags |
|
294 | 294 | echo " --help, -h" |
|
295 | 295 | printf " Show this help\n" |
|
296 | 296 | echo |
|
297 | 297 | |
|
298 | 298 | # :command.usage_flags |
|
299 | 299 | # :flag.usage |
|
300 | 300 | echo " --version-name VERSION_NAME" |
|
301 | 301 | printf " Specify custom build ver e.g $RC_CLI_VERSION_NAME\n" |
|
302 | 302 | printf " Default: $RC_CLI_VERSION_NAME\n" |
|
303 | 303 | echo |
|
304 | 304 | |
|
305 | 305 | fi |
|
306 | 306 | } |
|
307 | 307 | |
|
308 | 308 | # :command.usage |
|
309 | 309 | rccontrol_get_build_source_usage() { |
|
310 | 310 | if [[ -n $long_usage ]]; then |
|
311 | 311 | printf "rccontrol get-build-source - Fetch RhodeCode sources, store in .source dir to run a source-based builds\n" |
|
312 | 312 | echo |
|
313 | 313 | |
|
314 | 314 | else |
|
315 | 315 | printf "rccontrol get-build-source - Fetch RhodeCode sources, store in .source dir to run a source-based builds\n" |
|
316 | 316 | echo |
|
317 | 317 | |
|
318 | 318 | fi |
|
319 | 319 | |
|
320 | 320 | printf "Usage:\n" |
|
321 |
printf " rccontrol get-build-source |
|
|
321 | printf " rccontrol get-build-source [OPTIONS]\n" | |
|
322 | 322 | printf " rccontrol get-build-source --help | -h\n" |
|
323 | 323 | echo |
|
324 | 324 | |
|
325 | 325 | # :command.long_usage |
|
326 | 326 | if [[ -n $long_usage ]]; then |
|
327 | 327 | printf "Options:\n" |
|
328 | 328 | |
|
329 | 329 | # :command.usage_fixed_flags |
|
330 | 330 | echo " --help, -h" |
|
331 | 331 | printf " Show this help\n" |
|
332 | 332 | echo |
|
333 | 333 | |
|
334 | 334 | # :command.usage_flags |
|
335 | 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 | 342 | echo " --auth-token AUTH_TOKEN" |
|
337 | 343 | printf " Specify AUTH TOKEN to obtain sources\n" |
|
338 | 344 | echo |
|
339 | 345 | |
|
340 | 346 | # :flag.usage |
|
341 | 347 | echo " --server-url SERVER_URL" |
|
342 | 348 | printf " Specify RhodeCode server location where projects should be downloaded\n" |
|
343 | 349 | printf " Default: https://code.rhodecode.com\n" |
|
344 | 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 | 352 | # :command.usage_examples |
|
355 | 353 | printf "Examples:\n" |
|
356 | 354 | printf " rccontrol3 get-sources $RC_CLI_VERSION_NAME\n" |
|
357 | 355 | printf " rccontrol3 get-sources default --auth-token xyxyxyx --server-url\n https://secret.repo/\n" |
|
358 | 356 | echo |
|
359 | 357 | |
|
360 | 358 | fi |
|
361 | 359 | } |
|
362 | 360 | |
|
363 | 361 | # :command.usage |
|
364 | 362 | rccontrol_build_source_usage() { |
|
365 | 363 | if [[ -n $long_usage ]]; then |
|
366 | 364 | printf "rccontrol build-source - Build RhodeCode image from source, requires upgrade-source initially\n" |
|
367 | 365 | echo |
|
368 | 366 | |
|
369 | 367 | else |
|
370 | 368 | printf "rccontrol build-source - Build RhodeCode image from source, requires upgrade-source initially\n" |
|
371 | 369 | echo |
|
372 | 370 | |
|
373 | 371 | fi |
|
374 | 372 | |
|
375 | 373 | printf "Usage:\n" |
|
376 | 374 | printf " rccontrol build-source [OPTIONS]\n" |
|
377 | 375 | printf " rccontrol build-source --help | -h\n" |
|
378 | 376 | echo |
|
379 | 377 | |
|
380 | 378 | # :command.long_usage |
|
381 | 379 | if [[ -n $long_usage ]]; then |
|
382 | 380 | printf "Options:\n" |
|
383 | 381 | |
|
384 | 382 | # :command.usage_fixed_flags |
|
385 | 383 | echo " --help, -h" |
|
386 | 384 | printf " Show this help\n" |
|
387 | 385 | echo |
|
388 | 386 | |
|
389 | 387 | # :command.usage_flags |
|
390 | 388 | # :flag.usage |
|
391 | 389 | echo " --version-name VERSION_NAME" |
|
392 | 390 | printf " Specify custom build ver e.g $RC_CLI_VERSION_NAME\n" |
|
393 | 391 | printf " Default: $RC_CLI_VERSION_NAME\n" |
|
394 | 392 | echo |
|
395 | 393 | |
|
396 | 394 | # :command.usage_examples |
|
397 | 395 | printf "Examples:\n" |
|
398 | 396 | printf " build foo\n" |
|
399 | 397 | echo |
|
400 | 398 | |
|
401 | 399 | fi |
|
402 | 400 | } |
|
403 | 401 | |
|
404 | 402 | # :command.usage |
|
405 | 403 | rccontrol_stack_usage() { |
|
406 | 404 | if [[ -n $long_usage ]]; then |
|
407 | 405 | printf "rccontrol stack - run one of available cluster stacks, use -h for more details\n" |
|
408 | 406 | echo |
|
409 | 407 | |
|
410 | 408 | else |
|
411 | 409 | printf "rccontrol stack - run one of available cluster stacks, use -h for more details\n" |
|
412 | 410 | echo |
|
413 | 411 | |
|
414 | 412 | fi |
|
415 | 413 | |
|
416 | 414 | printf "Usage:\n" |
|
417 |
printf " rccontrol stack |
|
|
418 | printf " rccontrol stack --help | -h\n" | |
|
415 | printf " rccontrol stack COMMAND\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 | 495 | echo |
|
420 | 496 | |
|
421 | 497 | # :command.long_usage |
|
422 | 498 | if [[ -n $long_usage ]]; then |
|
423 | 499 | printf "Options:\n" |
|
424 | 500 | |
|
425 | 501 | # :command.usage_fixed_flags |
|
426 | 502 | echo " --help, -h" |
|
427 | 503 | printf " Show this help\n" |
|
428 | 504 | echo |
|
429 | 505 | |
|
430 | 506 | # :command.usage_args |
|
431 | 507 | printf "Arguments:\n" |
|
432 | 508 | |
|
433 | # :argument.usage | |
|
434 | echo " NAME" | |
|
435 | printf " Stack name\n" | |
|
436 | printf " Allowed: router, metrics, services, rhodecode\n" | |
|
509 | echo " SERVICES PARAMS..." | |
|
510 | printf " Additional arguments or flags for services command\n" | |
|
511 | echo | |
|
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 | 540 | echo |
|
438 | 541 | |
|
542 | # :command.usage_args | |
|
543 | printf "Arguments:\n" | |
|
544 | ||
|
439 | 545 | echo " SERVICES PARAMS..." |
|
440 | 546 | printf " Additional arguments or flags for services command\n" |
|
441 | 547 | echo |
|
442 | 548 | |
|
443 | # :command.usage_examples | |
|
444 | printf "Examples:\n" | |
|
445 | printf " - ./rccontrol3 stack router up # run router stack with output to\n console\n - ./rccontrol3 stack router up --detach # run router stack detached\n - ./rccontrol3 stack router down # stop whole router stack\n - ./rccontrol3 stack router ps # check status of router stack\n - ./rccontrol3 stack router -f docker-overrides.yaml up -d # run router stack\n with your overrides\n" | |
|
549 | fi | |
|
550 | } | |
|
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 | 619 | echo |
|
447 | 620 | |
|
448 | 621 | fi |
|
449 | 622 | } |
|
450 | 623 | |
|
451 | 624 | # :command.usage |
|
452 | 625 | rccontrol_stack_status_usage() { |
|
453 | 626 | if [[ -n $long_usage ]]; then |
|
454 |
printf "rccontrol stack-status - |
|
|
627 | printf "rccontrol stack-status - Show stack status\n" | |
|
455 | 628 | echo |
|
456 | 629 | |
|
457 | 630 | else |
|
458 |
printf "rccontrol stack-status - |
|
|
631 | printf "rccontrol stack-status - Show stack status\n" | |
|
459 | 632 | echo |
|
460 | 633 | |
|
461 | 634 | fi |
|
462 | 635 | |
|
463 | 636 | printf "Alias: status\n" |
|
464 | 637 | echo |
|
465 | 638 | |
|
466 | 639 | printf "Usage:\n" |
|
467 | 640 | printf " rccontrol stack-status\n" |
|
468 | 641 | printf " rccontrol stack-status --help | -h\n" |
|
469 | 642 | echo |
|
470 | 643 | |
|
471 | 644 | # :command.long_usage |
|
472 | 645 | if [[ -n $long_usage ]]; then |
|
473 | 646 | printf "Options:\n" |
|
474 | 647 | |
|
475 | 648 | # :command.usage_fixed_flags |
|
476 | 649 | echo " --help, -h" |
|
477 | 650 | printf " Show this help\n" |
|
478 | 651 | echo |
|
479 | 652 | |
|
480 | 653 | fi |
|
481 | 654 | } |
|
482 | 655 | |
|
483 | 656 | # :command.usage |
|
484 | 657 | rccontrol_stack_upgrade_usage() { |
|
485 | 658 | if [[ -n $long_usage ]]; then |
|
486 | 659 | printf "rccontrol stack-upgrade - upgrade ALL stack status\n" |
|
487 | 660 | echo |
|
488 | 661 | |
|
489 | 662 | else |
|
490 | 663 | printf "rccontrol stack-upgrade - upgrade ALL stack status\n" |
|
491 | 664 | echo |
|
492 | 665 | |
|
493 | 666 | fi |
|
494 | 667 | |
|
495 | 668 | printf "Usage:\n" |
|
496 | 669 | printf " rccontrol stack-upgrade\n" |
|
497 | 670 | printf " rccontrol stack-upgrade --help | -h\n" |
|
498 | 671 | echo |
|
499 | 672 | |
|
500 | 673 | # :command.long_usage |
|
501 | 674 | if [[ -n $long_usage ]]; then |
|
502 | 675 | printf "Options:\n" |
|
503 | 676 | |
|
504 | 677 | # :command.usage_fixed_flags |
|
505 | 678 | echo " --help, -h" |
|
506 | 679 | printf " Show this help\n" |
|
507 | 680 | echo |
|
508 | 681 | |
|
509 | 682 | fi |
|
510 | 683 | } |
|
511 | 684 | |
|
512 | 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 | 722 | rccontrol_cli_redis_usage() { |
|
514 | 723 | if [[ -n $long_usage ]]; then |
|
515 |
printf "rccontrol cli |
|
|
724 | printf "rccontrol cli redis - CLI for Redis\n" | |
|
516 | 725 | echo |
|
517 | 726 | |
|
518 | 727 | else |
|
519 |
printf "rccontrol cli |
|
|
728 | printf "rccontrol cli redis - CLI for Redis\n" | |
|
520 | 729 | echo |
|
521 | 730 | |
|
522 | 731 | fi |
|
523 | 732 | |
|
524 | 733 | printf "Usage:\n" |
|
525 |
printf " rccontrol cli |
|
|
526 |
printf " rccontrol cli |
|
|
734 | printf " rccontrol cli redis\n" | |
|
735 | printf " rccontrol cli redis --help | -h\n" | |
|
527 | 736 | echo |
|
528 | 737 | |
|
529 | 738 | # :command.long_usage |
|
530 | 739 | if [[ -n $long_usage ]]; then |
|
531 | 740 | printf "Options:\n" |
|
532 | 741 | |
|
533 | 742 | # :command.usage_fixed_flags |
|
534 | 743 | echo " --help, -h" |
|
535 | 744 | printf " Show this help\n" |
|
536 | 745 | echo |
|
537 | 746 | |
|
538 | 747 | fi |
|
539 | 748 | } |
|
540 | 749 | |
|
541 | 750 | # :command.usage |
|
542 | 751 | rccontrol_cli_db_usage() { |
|
543 | 752 | if [[ -n $long_usage ]]; then |
|
544 |
printf "rccontrol cli |
|
|
753 | printf "rccontrol cli db - CLI with Database connection\n" | |
|
545 | 754 | echo |
|
546 | 755 | |
|
547 | 756 | else |
|
548 |
printf "rccontrol cli |
|
|
757 | printf "rccontrol cli db - CLI with Database connection\n" | |
|
549 | 758 | echo |
|
550 | 759 | |
|
551 | 760 | fi |
|
552 | 761 | |
|
553 | 762 | printf "Usage:\n" |
|
554 |
printf " rccontrol cli |
|
|
555 |
printf " rccontrol cli |
|
|
763 | printf " rccontrol cli db\n" | |
|
764 | printf " rccontrol cli db --help | -h\n" | |
|
556 | 765 | echo |
|
557 | 766 | |
|
558 | 767 | # :command.long_usage |
|
559 | 768 | if [[ -n $long_usage ]]; then |
|
560 | 769 | printf "Options:\n" |
|
561 | 770 | |
|
562 | 771 | # :command.usage_fixed_flags |
|
563 | 772 | echo " --help, -h" |
|
564 | 773 | printf " Show this help\n" |
|
565 | 774 | echo |
|
566 | 775 | |
|
567 | 776 | fi |
|
568 | 777 | } |
|
569 | 778 | |
|
570 | 779 | # :command.usage |
|
571 | 780 | rccontrol_cli_db_upgrade_usage() { |
|
572 | 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 | 812 | echo |
|
575 | 813 | |
|
576 | 814 | else |
|
577 |
printf "rccontrol cli |
|
|
815 | printf "rccontrol cli storage - CLI for repository storage\n" | |
|
578 | 816 | echo |
|
579 | 817 | |
|
580 | 818 | fi |
|
581 | 819 | |
|
582 | 820 | printf "Usage:\n" |
|
583 |
printf " rccontrol cli |
|
|
584 |
printf " rccontrol cli |
|
|
821 | printf " rccontrol cli storage\n" | |
|
822 | printf " rccontrol cli storage --help | -h\n" | |
|
585 | 823 | echo |
|
586 | 824 | |
|
587 | 825 | # :command.long_usage |
|
588 | 826 | if [[ -n $long_usage ]]; then |
|
589 | 827 | printf "Options:\n" |
|
590 | 828 | |
|
591 | 829 | # :command.usage_fixed_flags |
|
592 | 830 | echo " --help, -h" |
|
593 | 831 | printf " Show this help\n" |
|
594 | 832 | echo |
|
595 | 833 | |
|
596 | 834 | fi |
|
597 | 835 | } |
|
598 | 836 | |
|
599 | 837 | # :command.usage |
|
600 | 838 | rccontrol__completions_usage() { |
|
601 | 839 | if [[ -n $long_usage ]]; then |
|
602 | 840 | printf "rccontrol _completions - Generate completions, eval "$(./rccontrol _completions)"\n" |
|
603 | 841 | echo |
|
604 | 842 | |
|
605 | 843 | else |
|
606 | 844 | printf "rccontrol _completions - Generate completions, eval "$(./rccontrol _completions)"\n" |
|
607 | 845 | echo |
|
608 | 846 | |
|
609 | 847 | fi |
|
610 | 848 | |
|
611 | 849 | printf "Usage:\n" |
|
612 | 850 | printf " rccontrol _completions\n" |
|
613 | 851 | printf " rccontrol _completions --help | -h\n" |
|
614 | 852 | echo |
|
615 | 853 | |
|
616 | 854 | # :command.long_usage |
|
617 | 855 | if [[ -n $long_usage ]]; then |
|
618 | 856 | printf "Options:\n" |
|
619 | 857 | |
|
620 | 858 | # :command.usage_fixed_flags |
|
621 | 859 | echo " --help, -h" |
|
622 | 860 | printf " Show this help\n" |
|
623 | 861 | echo |
|
624 | 862 | |
|
625 | 863 | fi |
|
626 | 864 | } |
|
627 | 865 | |
|
628 | 866 | # :command.usage |
|
629 | 867 | rccontrol_backup_db_usage() { |
|
630 | 868 | if [[ -n $long_usage ]]; then |
|
631 | 869 | printf "rccontrol backup-db - CLI\n" |
|
632 | 870 | echo |
|
633 | 871 | |
|
634 | 872 | else |
|
635 | 873 | printf "rccontrol backup-db - CLI\n" |
|
636 | 874 | echo |
|
637 | 875 | |
|
638 | 876 | fi |
|
639 | 877 | |
|
640 | 878 | printf "Usage:\n" |
|
641 | 879 | printf " rccontrol backup-db\n" |
|
642 | 880 | printf " rccontrol backup-db --help | -h\n" |
|
643 | 881 | echo |
|
644 | 882 | |
|
645 | 883 | # :command.long_usage |
|
646 | 884 | if [[ -n $long_usage ]]; then |
|
647 | 885 | printf "Options:\n" |
|
648 | 886 | |
|
649 | 887 | # :command.usage_fixed_flags |
|
650 | 888 | echo " --help, -h" |
|
651 | 889 | printf " Show this help\n" |
|
652 | 890 | echo |
|
653 | 891 | |
|
654 | 892 | # :command.usage_examples |
|
655 | 893 | printf "Examples:\n" |
|
656 | 894 | printf " ./rccontrol backup-db\n" |
|
657 | 895 | echo |
|
658 | 896 | |
|
659 | 897 | fi |
|
660 | 898 | } |
|
661 | 899 | |
|
662 | 900 | # :command.usage |
|
663 | 901 | rccontrol_backup_data_usage() { |
|
664 | 902 | if [[ -n $long_usage ]]; then |
|
665 | 903 | printf "rccontrol backup-data - CLI\n" |
|
666 | 904 | echo |
|
667 | 905 | |
|
668 | 906 | else |
|
669 | 907 | printf "rccontrol backup-data - CLI\n" |
|
670 | 908 | echo |
|
671 | 909 | |
|
672 | 910 | fi |
|
673 | 911 | |
|
674 | 912 | printf "Usage:\n" |
|
675 | 913 | printf " rccontrol backup-data\n" |
|
676 | 914 | printf " rccontrol backup-data --help | -h\n" |
|
677 | 915 | echo |
|
678 | 916 | |
|
679 | 917 | # :command.long_usage |
|
680 | 918 | if [[ -n $long_usage ]]; then |
|
681 | 919 | printf "Options:\n" |
|
682 | 920 | |
|
683 | 921 | # :command.usage_fixed_flags |
|
684 | 922 | echo " --help, -h" |
|
685 | 923 | printf " Show this help\n" |
|
686 | 924 | echo |
|
687 | 925 | |
|
688 | 926 | fi |
|
689 | 927 | } |
|
690 | 928 | |
|
691 | 929 | # :command.normalize_input |
|
692 | 930 | normalize_input() { |
|
693 | 931 | local arg flags |
|
694 | 932 | |
|
695 | 933 | while [[ $# -gt 0 ]]; do |
|
696 | 934 | arg="$1" |
|
697 | 935 | if [[ $arg =~ ^(--[a-zA-Z0-9_\-]+)=(.+)$ ]]; then |
|
698 | 936 | input+=("${BASH_REMATCH[1]}") |
|
699 | 937 | input+=("${BASH_REMATCH[2]}") |
|
700 | 938 | elif [[ $arg =~ ^(-[a-zA-Z0-9])=(.+)$ ]]; then |
|
701 | 939 | input+=("${BASH_REMATCH[1]}") |
|
702 | 940 | input+=("${BASH_REMATCH[2]}") |
|
703 | 941 | elif [[ $arg =~ ^-([a-zA-Z0-9][a-zA-Z0-9]+)$ ]]; then |
|
704 | 942 | flags="${BASH_REMATCH[1]}" |
|
705 | 943 | for (( i=0 ; i < ${#flags} ; i++ )); do |
|
706 | 944 | input+=("-${flags:i:1}") |
|
707 | 945 | done |
|
708 | 946 | else |
|
709 | 947 | input+=("$arg") |
|
710 | 948 | fi |
|
711 | 949 | |
|
712 | 950 | shift |
|
713 | 951 | done |
|
714 | 952 | } |
|
715 | 953 | # :command.inspect_args |
|
716 | 954 | inspect_args() { |
|
717 | 955 | readarray -t sorted_keys < <(printf '%s\n' "${!args[@]}" | sort) |
|
718 | 956 | if (( ${#args[@]} )); then |
|
719 | 957 | echo args: |
|
720 | 958 | for k in "${sorted_keys[@]}"; do echo "- \${args[$k]} = ${args[$k]}"; done |
|
721 | 959 | else |
|
722 | 960 | echo args: none |
|
723 | 961 | fi |
|
724 | 962 | |
|
725 | 963 | if (( ${#other_args[@]} )); then |
|
726 | 964 | echo |
|
727 | 965 | echo other_args: |
|
728 | 966 | echo "- \${other_args[*]} = ${other_args[*]}" |
|
729 | 967 | for i in "${!other_args[@]}"; do |
|
730 | 968 | echo "- \${other_args[$i]} = ${other_args[$i]}" |
|
731 | 969 | done |
|
732 | 970 | fi |
|
733 | 971 | } |
|
734 | 972 | |
|
735 | 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 | 991 | # src/lib/colors.sh |
|
737 | 992 | print_in_color() { |
|
738 | 993 | local color="$1" |
|
739 | 994 | shift |
|
740 | 995 | if [[ -z ${NO_COLOR+x} ]]; then |
|
741 | 996 | printf "$color%b\e[0m\n" "$*"; |
|
742 | 997 | else |
|
743 | 998 | printf "%b\n" "$*"; |
|
744 | 999 | fi |
|
745 | 1000 | } |
|
746 | 1001 | |
|
747 | 1002 | red() { print_in_color "\e[31m" "$*"; } |
|
748 | 1003 | green() { print_in_color "\e[32m" "$*"; } |
|
749 | 1004 | yellow() { print_in_color "\e[33m" "$*"; } |
|
750 | 1005 | blue() { print_in_color "\e[34m" "$*"; } |
|
751 | 1006 | magenta() { print_in_color "\e[35m" "$*"; } |
|
752 | 1007 | cyan() { print_in_color "\e[36m" "$*"; } |
|
753 | 1008 | bold() { print_in_color "\e[1m" "$*"; } |
|
754 | 1009 | underlined() { print_in_color "\e[4m" "$*"; } |
|
755 | 1010 | red_bold() { print_in_color "\e[1;31m" "$*"; } |
|
756 | 1011 | green_bold() { print_in_color "\e[1;32m" "$*"; } |
|
757 | 1012 | yellow_bold() { print_in_color "\e[1;33m" "$*"; } |
|
758 | 1013 | blue_bold() { print_in_color "\e[1;34m" "$*"; } |
|
759 | 1014 | magenta_bold() { print_in_color "\e[1;35m" "$*"; } |
|
760 | 1015 | cyan_bold() { print_in_color "\e[1;36m" "$*"; } |
|
761 | 1016 | red_underlined() { print_in_color "\e[4;31m" "$*"; } |
|
762 | 1017 | green_underlined() { print_in_color "\e[4;32m" "$*"; } |
|
763 | 1018 | yellow_underlined() { print_in_color "\e[4;33m" "$*"; } |
|
764 | 1019 | blue_underlined() { print_in_color "\e[4;34m" "$*"; } |
|
765 | 1020 | magenta_underlined() { print_in_color "\e[4;35m" "$*"; } |
|
766 | 1021 | cyan_underlined() { print_in_color "\e[4;36m" "$*"; } |
|
767 | 1022 | |
|
768 | 1023 | # src/lib/config.sh |
|
769 | 1024 | config_init() { |
|
770 | 1025 | CONFIG_FILE=${CONFIG_FILE:=config.ini} |
|
771 | 1026 | [[ -f "$CONFIG_FILE" ]] || touch "$CONFIG_FILE" |
|
772 | 1027 | } |
|
773 | 1028 | |
|
774 | 1029 | config_get() { |
|
775 | 1030 | local key=$1 |
|
776 | 1031 | local regex="^$key *= *(.+)$" |
|
777 | 1032 | local value="" |
|
778 | 1033 | |
|
779 | 1034 | config_init |
|
780 | 1035 | |
|
781 | 1036 | while IFS= read -r line || [ -n "$line" ]; do |
|
782 | 1037 | if [[ $line =~ $regex ]]; then |
|
783 | 1038 | value="${BASH_REMATCH[1]}" |
|
784 | 1039 | break |
|
785 | 1040 | fi |
|
786 | 1041 | done < "$CONFIG_FILE" |
|
787 | 1042 | |
|
788 | 1043 | echo "$value" |
|
789 | 1044 | } |
|
790 | 1045 | |
|
791 | 1046 | config_set() { |
|
792 | 1047 | local key=$1 |
|
793 | 1048 | shift |
|
794 | 1049 | local value="$*" |
|
795 | 1050 | |
|
796 | 1051 | config_init |
|
797 | 1052 | |
|
798 | 1053 | local regex="^($key) *= *.+$" |
|
799 | 1054 | local output="" |
|
800 | 1055 | local found_key="" |
|
801 | 1056 | local newline |
|
802 | 1057 | |
|
803 | 1058 | while IFS= read -r line || [ -n "$line" ]; do |
|
804 | 1059 | newline=$line |
|
805 | 1060 | if [[ $line =~ $regex ]]; then |
|
806 | 1061 | found_key="${BASH_REMATCH[1]}" |
|
807 | 1062 | newline="$key = $value" |
|
808 | 1063 | output="$output$newline\n" |
|
809 | 1064 | elif [[ $line ]]; then |
|
810 | 1065 | output="$output$line\n" |
|
811 | 1066 | fi |
|
812 | 1067 | done < "$CONFIG_FILE" |
|
813 | 1068 | |
|
814 | 1069 | if [[ -z $found_key ]]; then |
|
815 | 1070 | output="$output$key = $value\n" |
|
816 | 1071 | fi |
|
817 | 1072 | |
|
818 | 1073 | printf "%b\n" "$output" > "$CONFIG_FILE" |
|
819 | 1074 | } |
|
820 | 1075 | |
|
821 | 1076 | config_del() { |
|
822 | 1077 | local key=$1 |
|
823 | 1078 | |
|
824 | 1079 | local regex="^($key) *=" |
|
825 | 1080 | local output="" |
|
826 | 1081 | |
|
827 | 1082 | config_init |
|
828 | 1083 | |
|
829 | 1084 | while IFS= read -r line || [ -n "$line" ]; do |
|
830 | 1085 | if [[ $line ]] && [[ ! $line =~ $regex ]]; then |
|
831 | 1086 | output="$output$line\n" |
|
832 | 1087 | fi |
|
833 | 1088 | done < "$CONFIG_FILE" |
|
834 | 1089 | |
|
835 | 1090 | printf "%b\n" "$output" > "$CONFIG_FILE" |
|
836 | 1091 | } |
|
837 | 1092 | |
|
838 | 1093 | config_show() { |
|
839 | 1094 | config_init |
|
840 | 1095 | cat "$CONFIG_FILE" |
|
841 | 1096 | } |
|
842 | 1097 | |
|
843 | 1098 | config_keys() { |
|
844 | 1099 | local regex="^([a-zA-Z0-9_\-\/\.]+) *=" |
|
845 | 1100 | |
|
846 | 1101 | config_init |
|
847 | 1102 | |
|
848 | 1103 | local keys=() |
|
849 | 1104 | local key |
|
850 | 1105 | |
|
851 | 1106 | while IFS= read -r line || [ -n "$line" ]; do |
|
852 | 1107 | if [[ $line =~ $regex ]]; then |
|
853 | 1108 | key="${BASH_REMATCH[1]}" |
|
854 | 1109 | keys+=("$key") |
|
855 | 1110 | fi |
|
856 | 1111 | done < "$CONFIG_FILE" |
|
857 | 1112 | echo "${keys[@]}" |
|
858 | 1113 | } |
|
859 | 1114 | |
|
860 | 1115 | config_has_key() { |
|
861 | 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 | 1119 | # src/lib/send_completions.sh |
|
881 | 1120 | send_completions() { |
|
882 | 1121 | echo $'# rccontrol3 completion -*- shell-script -*-' |
|
883 | 1122 | echo $'' |
|
884 | 1123 | echo $'# This bash completions script was generated by' |
|
885 | 1124 | echo $'# completely (https://github.com/dannyben/completely)' |
|
886 | 1125 | echo $'# Modifying it manually is not recommended' |
|
887 | 1126 | echo $'' |
|
888 | 1127 | echo $'_rccontrol3_completions_filter() {' |
|
889 | 1128 | echo $' local words="$1"' |
|
890 | 1129 | echo $' local cur=${COMP_WORDS[COMP_CWORD]}' |
|
891 | 1130 | echo $' local result=()' |
|
892 | 1131 | echo $'' |
|
893 | 1132 | echo $' if [[ "${cur:0:1}" == "-" ]]; then' |
|
894 | 1133 | echo $' echo "$words"' |
|
895 | 1134 | echo $' ' |
|
896 | 1135 | echo $' else' |
|
897 | 1136 | echo $' for word in $words; do' |
|
898 | 1137 | echo $' [[ "${word:0:1}" != "-" ]] && result+=("$word")' |
|
899 | 1138 | echo $' done' |
|
900 | 1139 | echo $'' |
|
901 | 1140 | echo $' echo "${result[*]}"' |
|
902 | 1141 | echo $'' |
|
903 | 1142 | echo $' fi' |
|
904 | 1143 | echo $'}' |
|
905 | 1144 | echo $'' |
|
906 | 1145 | echo $'_rccontrol3_completions() {' |
|
907 | 1146 | echo $' local cur=${COMP_WORDS[COMP_CWORD]}' |
|
908 | 1147 | echo $' local compwords=("${COMP_WORDS[@]:1:$COMP_CWORD-1}")' |
|
909 | 1148 | echo $' local compline="${compwords[*]}"' |
|
910 | 1149 | echo $'' |
|
911 | 1150 | echo $' case "$compline" in' |
|
912 | 1151 | echo $' \'upgrade-source\'*)' |
|
913 | 1152 | echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_rccontrol3_completions_filter "--auth-token --help --server-url -h")" -- "$cur" )' |
|
914 | 1153 | echo $' ;;' |
|
915 | 1154 | echo $'' |
|
916 | 1155 | echo $' \'build-source\'*)' |
|
917 | 1156 | echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_rccontrol3_completions_filter "--help --version-name -h")" -- "$cur" )' |
|
918 | 1157 | echo $' ;;' |
|
919 | 1158 | echo $'' |
|
920 | 1159 | echo $' \'self-update\'*)' |
|
921 | 1160 | echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_rccontrol3_completions_filter "--auth-token --help --server-url -h")" -- "$cur" )' |
|
922 | 1161 | echo $' ;;' |
|
923 | 1162 | echo $'' |
|
924 | 1163 | echo $' \'bootstrap\'*)' |
|
925 | 1164 | echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_rccontrol3_completions_filter "--auth-token --force --help --server-url -f -h")" -- "$cur" )' |
|
926 | 1165 | echo $' ;;' |
|
927 | 1166 | echo $'' |
|
928 | 1167 | echo $' \'build\'*)' |
|
929 | 1168 | echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_rccontrol3_completions_filter "--help --version-name -h")" -- "$cur" )' |
|
930 | 1169 | echo $' ;;' |
|
931 | 1170 | echo $'' |
|
932 | 1171 | echo $' \'stack\'*)' |
|
933 | 1172 | echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_rccontrol3_completions_filter "--help -h metrics rhodecode router services")" -- "$cur" )' |
|
934 | 1173 | echo $' ;;' |
|
935 | 1174 | echo $'' |
|
936 | 1175 | echo $' *)' |
|
937 | 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 | 1177 | echo $' ;;' |
|
939 | 1178 | echo $'' |
|
940 | 1179 | echo $' esac' |
|
941 | 1180 | echo $'} &&' |
|
942 | 1181 | echo $'complete -F _rccontrol3_completions rccontrol3' |
|
943 | 1182 | echo $'' |
|
944 | 1183 | echo $'# ex: filetype=sh' |
|
945 | 1184 | } |
|
946 | 1185 | |
|
947 | 1186 | # src/lib/validate_stack_exists.sh |
|
948 | 1187 | |
|
949 | 1188 | validate_stack_exists() { |
|
950 | 1189 | err="" |
|
951 | 1190 | invalid="1" |
|
952 | 1191 | |
|
953 | 1192 | for item in $VALID_SERVICES |
|
954 | 1193 | do |
|
955 | 1194 | if [ "$1" == "$item" ]; then |
|
956 | 1195 | invalid="" |
|
957 | 1196 | break |
|
958 | 1197 | fi |
|
959 | 1198 | done |
|
960 | 1199 | |
|
961 | 1200 | if [[ -n $invalid ]]; then |
|
962 | 1201 | err="command '$1' not in list of $VALID_SERVICES" |
|
963 | 1202 | fi |
|
964 | 1203 | |
|
965 | 1204 | echo $err |
|
966 | 1205 | } |
|
967 | 1206 | |
|
968 | 1207 | # :command.command_functions |
|
969 | 1208 | # :command.function |
|
970 | 1209 | rccontrol_self_update_command() { |
|
971 | 1210 | # src/self_update_command.sh |
|
972 | 1211 | check_bootstrap |
|
973 | 1212 | |
|
974 | 1213 | echo "# this file is located in 'src/self_update_command.sh'" |
|
975 | 1214 | echo "# code for 'rccontrol3 self-update' goes here" |
|
976 | 1215 | echo "# you can edit it freely and regenerate (it will not be overwritten)" |
|
977 | 1216 | inspect_args |
|
978 | 1217 | |
|
979 | 1218 | } |
|
980 | 1219 | |
|
981 | 1220 | # :command.function |
|
982 | 1221 | rccontrol_bootstrap_command() { |
|
983 | 1222 | # src/bootstrap_command.sh |
|
984 | 1223 | DEBUG=${args[--debug]} |
|
985 | 1224 | force=${args[--force]} |
|
986 | 1225 | |
|
987 | 1226 | check_bash_version() { |
|
988 | ||
|
989 | 1227 | if [ ! "${BASH_VERSINFO:-0}" -ge 4 ]; then |
|
990 | 1228 | echo "$(red Bash version 4 or greater is required, please update your bash version!)" |
|
991 | 1229 | exit |
|
992 | 1230 | fi |
|
993 | 1231 | } |
|
994 | 1232 | |
|
995 | 1233 | check_docker() { |
|
996 | 1234 | (which docker || which docker.io) &>/dev/null |
|
997 | 1235 | } |
|
998 | 1236 | |
|
999 | check_and_install_docker() { | |
|
1237 | bootstrap_docker_install() { | |
|
1000 | 1238 | failMsg="Failed to find docker on your PATH" |
|
1001 | 1239 | |
|
1002 | 1240 | if ! check_docker; then |
|
1003 | 1241 | echo "$failMsg" |
|
1004 | 1242 | read -p "Enter to install Docker directly from https://get.docker.com/ or Ctrl+C to exit" |
|
1005 | 1243 | curl https://get.docker.com/ | sh |
|
1006 | 1244 | |
|
1007 | 1245 | if ! check_docker; then |
|
1008 | 1246 | echo "$failMsg" |
|
1009 | 1247 | echo "Docker install failed. Quitting." |
|
1010 | 1248 | exit |
|
1011 | 1249 | fi |
|
1012 | 1250 | fi |
|
1013 | 1251 | } |
|
1014 | 1252 | |
|
1015 | docker_bootstrap() { | |
|
1016 | check_and_install_docker | |
|
1253 | bootstrap_docker_commons() { | |
|
1254 | ||
|
1017 | 1255 | echo 'Docker: Running bootstrap.' |
|
1018 | 1256 | |
|
1019 |
echo "Docker: creating |
|
|
1020 | docker volume create --name=rc_datavolume | |
|
1257 | echo "Docker: creating volume '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 | 1264 | echo "Docker: done" |
|
1022 | 1265 | echo "" |
|
1023 | 1266 | |
|
1024 | 1267 | echo "Docker: creating network 'rhodecode_network'" |
|
1025 | 1268 | docker network inspect rhodecode_network >/dev/null 2>&1 || docker network create rhodecode_network |
|
1026 | 1269 | echo "Docker: done" |
|
1027 | 1270 | echo "" |
|
1028 | 1271 | |
|
1029 | 1272 | echo "Docker: creating loki logging" |
|
1030 | 1273 | loki_driver=$(docker plugin ls --format {{.Name}} --filter enabled=true | grep loki || echo "") |
|
1031 | 1274 | if [[ $loki_driver == "" ]]; then |
|
1032 | 1275 | docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions |
|
1033 | 1276 | else |
|
1034 | 1277 | echo "Docker: loki driver already exists" |
|
1035 | 1278 | fi |
|
1036 | 1279 | } |
|
1037 | 1280 | |
|
1038 |
|
|
|
1281 | bootstrap_config() { | |
|
1282 | shared_key=$(echo $RANDOM | md5sum | head -c 32) | |
|
1039 | 1283 | |
|
1040 | SOURCE_DIR=$PWD | |
|
1041 | RHODECODE_DOCKER_HASH='master' | |
|
1284 | if [[ ! -f "$CONFIG_FILE" ]]; then | |
|
1285 | echo "init config at: $CONFIG_FILE" | |
|
1286 | config_init | |
|
1287 | else | |
|
1288 | echo "re-using config at: $CONFIG_FILE" | |
|
1289 | fi | |
|
1042 | 1290 | |
|
1043 | AUTH_TOKEN=${args[--auth-token]} | |
|
1044 | SERVER_URL=${args[--server-url]} | |
|
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 | 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 | 1364 | for check_file in $CHECK_FILES; do |
|
1049 | 1365 | if [[ -f "$check_file" ]]; then |
|
1050 | 1366 | DEFINITIONS_EXIST="1" |
|
1051 | 1367 | fi |
|
1052 | 1368 | done |
|
1053 | 1369 | |
|
1054 | 1370 | if [[ -n $DEFINITIONS_EXIST && ! $force ]]; then |
|
1055 | 1371 | echo "$(yellow skipping docker defs creation, existing files found. Use --force to create them anyway)" |
|
1056 | 1372 | return |
|
1057 | 1373 | fi |
|
1058 | 1374 | |
|
1059 | 1375 | if [[ -n $DEFINITIONS_EXIST ]]; then |
|
1060 | 1376 | echo "$(yellow docker definitions exists, are you sure to force re-create them?)" |
|
1061 | 1377 | while true; do |
|
1062 | 1378 | read -p "Would you like to continue with overriding file? [yn] " yn |
|
1063 | 1379 | case $yn in |
|
1064 | 1380 | [Yy]*) return 2 ;; |
|
1065 | 1381 | [Nn]*) exit ;; |
|
1066 | 1382 | *) echo "Please answer y or n." ;; |
|
1067 | 1383 | esac |
|
1068 | 1384 | done |
|
1069 | 1385 | fi |
|
1070 | 1386 | |
|
1071 | exit | |
|
1072 | ||
|
1073 | 1387 | # download sources |
|
1074 | 1388 | echo "Files: download rhodecode docker definitions from $SERVER_URL" |
|
1075 | 1389 | echo "" |
|
1076 | 1390 | |
|
1077 | 1391 | if [ $DEBUG ]; then |
|
1078 | 1392 | echo "downloading: $SERVER_URL/rhodecode-enterprise-docker/archive/$RHODECODE_DOCKER_HASH.tgz?with_hash=0" |
|
1079 | 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 | 1395 | echo "running CP $SOURCE_DIR/*rhodecode-enterprise-docker-plain/* $SOURCE_DIR" |
|
1082 | 1396 | cp -v -r -f --update --backup=numbered $SOURCE_DIR/*rhodecode-enterprise-docker-plain/* $SOURCE_DIR |
|
1083 | 1397 | |
|
1084 | 1398 | echo "removing $SOURCE_DIR/*rhodecode-enterprise-docker-plain" |
|
1085 | 1399 | rm -r $SOURCE_DIR/*rhodecode-enterprise-docker-plain |
|
1086 | 1400 | else |
|
1087 | 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 | 1403 | cp -r -f --update --backup=numbered $SOURCE_DIR/*rhodecode-enterprise-docker-plain/* $SOURCE_DIR |
|
1090 | 1404 | |
|
1091 | 1405 | rm -r $SOURCE_DIR/*rhodecode-enterprise-docker-plain |
|
1092 | 1406 | fi |
|
1093 | 1407 | |
|
1094 | 1408 | echo "$(green_bold DONE: docker definitions extracted to $SOURCE_DIR)" |
|
1095 | 1409 | } |
|
1096 | 1410 | |
|
1097 |
|
|
|
1098 | ||
|
1099 | if [[ ! -f "$CONFIG_FILE" ]]; then | |
|
1100 | echo "init config at: $CONFIG_FILE" | |
|
1101 | config_init | |
|
1102 | else | |
|
1103 | echo "re-using config at: $CONFIG_FILE" | |
|
1104 | fi | |
|
1105 | ||
|
1106 | if ! config_has_key "rc_encrypted_secret" ; then | |
|
1107 | key=$(echo $RANDOM | md5sum | head -c 32) | |
|
1108 | config_set "rc_encrypted_secret" $key | |
|
1109 | fi | |
|
1110 | ||
|
1111 | if ! config_has_key "rc_db_url" ; then | |
|
1112 | key=$(echo $RANDOM | md5sum | head -c 32) | |
|
1113 | config_set "rc_db_url" "postgresql://$DB_USER:$key@database/$DB_NAME" | |
|
1114 | fi | |
|
1115 | ||
|
1116 | if ! config_has_key "rc_license_token" ; then | |
|
1117 | config_set "rc_license_token" abra-cada-bra1-rce4 | |
|
1118 | fi | |
|
1119 | ||
|
1120 | if ! config_has_key "rc_base_url" ; then | |
|
1121 | config_set "rc_base_url" http://docker-dev | |
|
1122 | fi | |
|
1123 | ||
|
1124 | if ! config_has_key "rc_log_formatter" ; then | |
|
1125 | # json is another option | |
|
1126 | config_set "rc_log_formatter" generic | |
|
1127 | fi | |
|
1128 | ||
|
1129 | if ! config_has_key "rc_use_celery" ; then | |
|
1130 | config_set "rc_use_celery" true | |
|
1131 | fi | |
|
1132 | ||
|
1133 | BOOTSTRAP_RUNTIME_ENV=$PWD/.custom/.runtime.env | |
|
1134 | if [[ ! -f "$BOOTSTRAP_RUNTIME_ENV" ]]; then | |
|
1135 | echo "init runtime env config at: $BOOTSTRAP_RUNTIME_ENV" | |
|
1136 | touch BOOTSTRAP_RUNTIME_ENV | |
|
1137 | ||
|
1138 | #ENV_EXPAND="" | |
|
1139 | for k in $(config_keys); do | |
|
1140 | k_upper=${k^^} | |
|
1141 | echo "$k_upper='$(config_get "$k")'" >> $BOOTSTRAP_RUNTIME_ENV | |
|
1142 | done | |
|
1411 | bootstrap_overrides() { | |
|
1412 | templates=$(find $PWD/templates/*.yaml -printf "%f\n") | |
|
1143 | 1413 | |
|
1144 | fi | |
|
1414 | target_dir=$PWD/.custom/ | |
|
1415 | for o_file in $templates; do | |
|
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 | |
|
1420 | else | |
|
1421 | echo "file $target_file existing, skipping..." | |
|
1422 | fi | |
|
1423 | done | |
|
1424 | echo "$(green_bold DONE: overrides extracted to $target_dir)" | |
|
1145 | 1425 | } |
|
1146 | 1426 | |
|
1147 | 1427 | cur_date=$(date '+%Y-%m-%d %H:%M:%S') |
|
1148 | 1428 | |
|
1149 | 1429 | check_bash_version |
|
1150 | 1430 | |
|
1151 | if [[ ! -e $BOOTSTRAP_FILE ]]; then | |
|
1152 | echo "initial bootstrap file $BOOTSTRAP_FILE not found !" | |
|
1153 | ||
|
1154 | docker_bootstrap | |
|
1155 | definitions_bootstrap | |
|
1156 | config_bootstrap | |
|
1157 | ||
|
1158 | echo "$cur_date" > "$BOOTSTRAP_FILE" | |
|
1159 | ||
|
1431 | # Init the config ! | |
|
1432 | if [[ ! -f "$CONFIG_FILE" ]]; then | |
|
1433 | echo "config: init new config at: $CONFIG_FILE" | |
|
1434 | config_init | |
|
1160 | 1435 | else |
|
1161 | if [ $force ]; then | |
|
1436 | echo "config: re-using present config at: $CONFIG_FILE" | |
|
1437 | fi | |
|
1162 | 1438 | |
|
1163 | docker_bootstrap $force | |
|
1164 | definitions_bootstrap $force ## TODO: remove old | |
|
1165 | config_bootstrap $force | |
|
1439 | for stage in $BOOTSTRAP_STAGES; do | |
|
1166 | 1440 | |
|
1167 | echo "$cur_date" > "$BOOTSTRAP_FILE" | |
|
1441 | stage_name=$(echo $stage | cut -d ":" -f 1) | |
|
1442 | stage_func=$(echo $stage | cut -d ":" -f 2) | |
|
1168 | 1443 | |
|
1169 | exit | |
|
1170 | fi | |
|
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 | |
|
1448 | else | |
|
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 | |
|
1171 | 1457 | |
|
1172 | echo "bootstrap file $BOOTSTRAP_FILE was found add --force to force bootstrap" | |
|
1173 | fi | |
|
1458 | done | |
|
1459 | ||
|
1460 | exit | |
|
1174 | 1461 | |
|
1175 | 1462 | get_started |
|
1176 | 1463 | } |
|
1177 | 1464 | |
|
1178 | 1465 | # :command.function |
|
1179 | 1466 | rccontrol_get_build_artifacts_command() { |
|
1180 | 1467 | # src/get_build_artifacts_command.sh |
|
1181 | 1468 | check_bootstrap |
|
1182 | 1469 | |
|
1183 | 1470 | DEBUG=${args[--debug]} |
|
1184 | 1471 | AUTH=${args[--auth]} |
|
1185 | 1472 | INSTALLER_URL=${args[--installer-url]} |
|
1186 | 1473 | MANIFEST_URL=${args[--manifest-url]} |
|
1187 | 1474 | RC_VERSION=${args[--version-name]} |
|
1188 | 1475 | VER=$RC_VERSION |
|
1189 | 1476 | |
|
1190 | 1477 | CACHE_DIR=$PWD/.cache |
|
1191 | 1478 | VER_REGEX="$VER+x86_64" |
|
1192 | 1479 | |
|
1193 | 1480 | echo "Downloading Artifacts for version: $VER" |
|
1194 | 1481 | |
|
1195 | 1482 | echo "1/4 Checking available downloads from MANIFEST file" |
|
1196 | 1483 | |
|
1197 | 1484 | ARTS=$(curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" | cut -d ' ' -f 2) |
|
1198 | 1485 | |
|
1199 | 1486 | if [[ $DEBUG ]]; then |
|
1200 | 1487 | echo "DEBUG START" |
|
1201 | 1488 | curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" || echo "no regex match" |
|
1202 | 1489 | curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" | cut -d ' ' -f 2 |
|
1203 | 1490 | echo "Found following artifacts:" |
|
1204 | 1491 | echo $ARTS |
|
1205 | 1492 | echo "DEBUG END" |
|
1206 | 1493 | fi |
|
1207 | 1494 | |
|
1208 | 1495 | if [[ $ARTS == "" ]]; then |
|
1209 | 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 | 1497 | echo "$(red $MSG)" |
|
1211 | 1498 | exit |
|
1212 | 1499 | fi |
|
1213 | 1500 | |
|
1214 | 1501 | echo "2/4 Downloading locale-archive" |
|
1215 | 1502 | curl -L https://dls.rhodecode.com/assets/locale-archive -J -O |
|
1216 | 1503 | mv -v locale-archive "$CACHE_DIR" |
|
1217 | 1504 | |
|
1218 | 1505 | # vcsserver/ce/ee |
|
1219 | 1506 | echo "3/4 Downloading installer artifacts" |
|
1220 | 1507 | for url in $ARTS; do |
|
1221 | 1508 | echo "Downloading $url with $AUTH" |
|
1222 | 1509 | curl $AUTH --fail-early -L ${url} -J -O |
|
1223 | 1510 | done |
|
1224 | 1511 | |
|
1225 | 1512 | #for url in $(curl -s $MANIFEST_URL | grep --ignore-case -E 'control.+\+x86_64' | cut -d ' ' -f 2); do |
|
1226 | 1513 | # echo "Downloading $url" |
|
1227 | 1514 | # curl -L ${url} -J -O |
|
1228 | 1515 | #done |
|
1229 | 1516 | |
|
1230 | 1517 | echo "4/4 Downloading installer from $INSTALLER_URL" |
|
1231 | 1518 | curl $AUTH -L $INSTALLER_URL -J -O |
|
1232 | 1519 | |
|
1233 | 1520 | INSTALLER=$(ls -Art RhodeCode-installer-* | tail -n 1) |
|
1234 | 1521 | if [[ -n $INSTALLER ]]; then |
|
1235 | 1522 | chmod +x "${INSTALLER}" |
|
1236 | 1523 | fi |
|
1237 | 1524 | |
|
1238 | 1525 | echo "Copying artifacts into $CACHE_DIR" |
|
1239 | 1526 | |
|
1240 | 1527 | mv -v "${INSTALLER}" $CACHE_DIR |
|
1241 | 1528 | mv -v *.bz2 $CACHE_DIR |
|
1242 | 1529 | ls -lh $CACHE_DIR |
|
1243 | 1530 | |
|
1244 | 1531 | } |
|
1245 | 1532 | |
|
1246 | 1533 | # :command.function |
|
1247 | 1534 | rccontrol_build_command() { |
|
1248 | 1535 | # src/build_command.sh |
|
1249 | 1536 | check_bootstrap |
|
1250 | 1537 | |
|
1251 | 1538 | rc_version=${args[--version-name]} |
|
1252 | 1539 | export RC_VERSION=$rc_version |
|
1253 | 1540 | eval "echo INSTALLER BASED BUILDING${RC_VERSION}" |
|
1254 | 1541 | |
|
1255 | 1542 | RC_VERSION=$rc_version ./rccontrol stack rhodecode build --progress plain rhodecode |
|
1256 | 1543 | |
|
1257 | 1544 | } |
|
1258 | 1545 | |
|
1259 | 1546 | # :command.function |
|
1260 | 1547 | rccontrol_get_build_source_command() { |
|
1261 | 1548 | # src/get_build_source_command.sh |
|
1262 | 1549 | check_bootstrap |
|
1263 | 1550 | |
|
1264 | 1551 | AUTH_TOKEN=${args[--auth-token]} |
|
1265 | 1552 | SERVER_URL=${args[--server-url]} |
|
1266 | revision=${args[revision]} | |
|
1553 | revision=${args[--revision]} | |
|
1267 | 1554 | |
|
1268 | 1555 | SOURCE_DIR=$PWD/.source |
|
1269 | 1556 | |
|
1270 | 1557 | RHODECODE_VCS_HASH=$revision |
|
1271 | 1558 | RHODECODE_CE_HASH=$revision |
|
1272 | 1559 | RHODECODE_EE_HASH=$revision |
|
1273 | 1560 | |
|
1274 | 1561 | # download sources |
|
1275 | 1562 | echo "** download rhodecode source for build from $SERVER_URL **" |
|
1276 | 1563 | |
|
1277 | 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 | 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 | 1566 | #TODO: fix just CE build... |
|
1280 | 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 | |
|
1283 |
|
|
|
1284 | rm -rf $SOURCE_DIR/rhodecode-enterprise-ee && cp -r $SOURCE_DIR/*rhodecode-enterprise-ee-plain $SOURCE_DIR/rhodecode-enterprise-ee | |
|
1569 | rm -rf $SOURCE_DIR/rhodecode-vcsserver && \ | |
|
1570 | mv $SOURCE_DIR/*rhodecode-vcsserver-plain $SOURCE_DIR/rhodecode-vcsserver | |
|
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 | 1578 | echo "downloading sources done to $SOURCE_DIR" |
|
1579 | ls -l $SOURCE_DIR | |
|
1287 | 1580 | |
|
1288 | 1581 | } |
|
1289 | 1582 | |
|
1290 | 1583 | # :command.function |
|
1291 | 1584 | rccontrol_build_source_command() { |
|
1292 | 1585 | # src/build_source_command.sh |
|
1293 | 1586 | check_bootstrap |
|
1294 | 1587 | |
|
1295 | 1588 | rc_version=${args[--version-name]} |
|
1296 | 1589 | export RC_VERSION=$rc_version |
|
1297 | 1590 | eval "echo SOURCE BASED BUILDING${RC_VERSION}" |
|
1298 | 1591 | |
|
1299 | 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 | 1596 | # :command.function |
|
1304 | rccontrol_stack_command() { | |
|
1305 | # src/stack_command.sh | |
|
1597 | rccontrol_stack_router_command() { | |
|
1598 | # src/stack_router_command.sh | |
|
1306 | 1599 | check_bootstrap |
|
1307 | 1600 | |
|
1308 | 1601 | DEBUG=${args[--debug]} |
|
1309 | service_name=${args[name]} | |
|
1310 | 1602 | |
|
1311 | 1603 | if [[ ! -f $RC_STACK_ROUTER_EXT ]]; then |
|
1312 | 1604 | RC_STACK_ROUTER_EXT="" |
|
1313 | 1605 | else |
|
1314 | 1606 | RC_STACK_ROUTER_EXT="-f $RC_STACK_ROUTER_EXT" |
|
1315 | 1607 | fi |
|
1316 | 1608 | |
|
1317 | 1609 | CMD_ROUTER="\ |
|
1318 | 1610 | docker compose \ |
|
1319 | 1611 | --env-file $ENV_FILE \ |
|
1320 | 1612 | $ENV_EXPAND \ |
|
1321 | 1613 | -p rc_cluster_router \ |
|
1322 | 1614 | -f docker-compose-base.yaml \ |
|
1323 | 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 | 1666 | if [[ ! -f $RC_STACK_SERVICES_EXT ]]; then |
|
1326 | 1667 | RC_STACK_SERVICES_EXT_LCL="" |
|
1327 | 1668 | else |
|
1328 | 1669 | RC_STACK_SERVICES_EXT_LCL="-f $RC_STACK_SERVICES_EXT" |
|
1329 | 1670 | fi |
|
1330 | 1671 | |
|
1331 | 1672 | RC_STACK_PROFILES="--profile postgres --profile redis --profile elasticsearch --profile channelstream" |
|
1332 | 1673 | |
|
1333 | 1674 | CMD_SERVICES="\ |
|
1334 | 1675 | docker compose \ |
|
1335 | 1676 | --env-file $ENV_FILE \ |
|
1336 | 1677 | $ENV_EXPAND \ |
|
1337 | 1678 | $RC_STACK_PROFILES \ |
|
1338 | 1679 | -p rc_cluster_services \ |
|
1339 | 1680 | -f docker-compose-base.yaml \ |
|
1340 | 1681 | -f docker-compose-services.yaml $RC_STACK_SERVICES_EXT_LCL" |
|
1341 | 1682 | |
|
1342 | if [[ ! -f $RC_STACK_METRICS_EXT ]]; then | |
|
1343 | RC_STACK_METRICS_EXT_LCL="" | |
|
1344 | else | |
|
1345 | RC_STACK_METRICS_EXT_LCL="-f $RC_STACK_METRICS_EXT" | |
|
1683 | if [[ $DEBUG ]]; then | |
|
1684 | echo "---" | |
|
1685 | echo "stacks docker: $RC_STACK_SERVICES_EXT_LCL" | |
|
1686 | echo "running command: ${CMD_SERVICES}" | |
|
1687 | echo "ARGS: ${other_args[*]}" | |
|
1688 | echo "---" | |
|
1346 | 1689 | fi |
|
1347 | 1690 | |
|
1348 | CMD_METRICS="\ | |
|
1349 | docker compose \ | |
|
1350 | --env-file $ENV_FILE \ | |
|
1351 | $ENV_EXPAND \ | |
|
1352 | -p rc_cluster_metrics \ | |
|
1353 | -f docker-compose-base.yaml \ | |
|
1354 | -f docker-compose-metrics.yaml $RC_STACK_METRICS_EXT_LCL" | |
|
1691 | eval "${CMD_SERVICES} ${other_args[*]}" | |
|
1692 | } | |
|
1693 | ||
|
1694 | # :command.function | |
|
1695 | rccontrol_stack_rhodecode_command() { | |
|
1696 | # src/stack_rhodecode_command.sh | |
|
1697 | check_bootstrap | |
|
1698 | ||
|
1699 | DEBUG=${args[--debug]} | |
|
1355 | 1700 | |
|
1356 | 1701 | if [[ ! -f $RC_STACK_RHODECODE_EXT ]]; then |
|
1357 | 1702 | RC_STACK_RHODECODE_EXT_LCL="" |
|
1358 | 1703 | else |
|
1359 | 1704 | RC_STACK_RHODECODE_EXT_LCL="-f $RC_STACK_RHODECODE_EXT" |
|
1360 | 1705 | fi |
|
1361 | 1706 | |
|
1362 | 1707 | CMD_RHODECODE="\ |
|
1363 | 1708 | docker compose \ |
|
1364 | 1709 | --env-file $ENV_FILE \ |
|
1365 | 1710 | $ENV_EXPAND \ |
|
1366 | 1711 | -p rc_cluster_apps \ |
|
1367 | 1712 | -f docker-compose-base.yaml \ |
|
1368 | 1713 | -f docker-compose-apps.yaml $RC_STACK_RHODECODE_EXT_LCL" |
|
1369 | 1714 | |
|
1370 | 1715 | CMD_RHODECODE_SOURCE="\ |
|
1371 | 1716 | docker compose \ |
|
1372 | 1717 | --env-file $ENV_FILE \ |
|
1373 | 1718 | $ENV_EXPAND \ |
|
1374 | 1719 | -p rc_cluster_apps \ |
|
1375 | 1720 | -f docker-compose-base.yaml \ |
|
1376 | 1721 | -f docker-compose-apps.yaml \ |
|
1377 | 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 | if [[ $DEBUG ]]; then | |
|
1417 | echo "---" | |
|
1418 | echo "stacks docker: $RC_STACK_RHODECODE_EXT_LCL" | |
|
1419 | echo "running command: ${CMD_RHODECODE}" | |
|
1420 | echo "ARGS: ${other_args[*]}" | |
|
1421 | echo "---" | |
|
1422 | fi | |
|
1423 | eval "${CMD_RHODECODE} ${other_args[*]}" | |
|
1424 | exit | |
|
1425 | ;; | |
|
1426 | esac | |
|
1724 | if [[ $DEBUG ]]; then | |
|
1725 | echo "---" | |
|
1726 | echo "stacks docker: $RC_STACK_RHODECODE_EXT_LCL" | |
|
1727 | echo "running command: ${CMD_RHODECODE}" | |
|
1728 | echo "ARGS: ${other_args[*]}" | |
|
1729 | echo "---" | |
|
1730 | fi | |
|
1731 | eval "${CMD_RHODECODE} ${other_args[*]}" | |
|
1732 | ||
|
1733 | } | |
|
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 | 1750 | # :command.function |
|
1431 | 1751 | rccontrol_stack_status_command() { |
|
1432 | 1752 | # src/stack_status_command.sh |
|
1433 | 1753 | check_bootstrap |
|
1434 | 1754 | DEBUG=${args[--debug]} |
|
1435 | 1755 | if [[ $DEBUG ]]; then |
|
1436 | 1756 | echo "---" |
|
1437 | 1757 | |
|
1438 | 1758 | ps_cmd=$(docker ps --filter=name=rc_cluster --format="{{.ID}}") |
|
1439 | 1759 | |
|
1440 | 1760 | for service in $ps_cmd; do |
|
1441 | 1761 | |
|
1442 | 1762 | servicename=`docker inspect --format '{{ .Name }}' $service` |
|
1443 | 1763 | servicename=${servicename:1} |
|
1444 | 1764 | echo $servicename |
|
1445 | 1765 | docker inspect $service --format='{{.State.Status}}: {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' |
|
1446 | 1766 | echo "" |
|
1447 | 1767 | |
|
1448 | 1768 | done |
|
1449 | 1769 | fi |
|
1450 | 1770 | echo "---" |
|
1451 | 1771 | docker ps --filter=name=rc_cluster --format="table {{.ID}}\\t{{.Image}}\\t{{.Status}}\\t{{.Names}}\\t{{.Ports}}" |
|
1452 | 1772 | } |
|
1453 | 1773 | |
|
1454 | 1774 | # :command.function |
|
1455 | 1775 | rccontrol_stack_upgrade_command() { |
|
1456 | 1776 | # src/stack_upgrade_command.sh |
|
1457 | 1777 | check_bootstrap |
|
1458 | 1778 | |
|
1459 | 1779 | echo "# this file is located in 'src/stack_upgrade_command.sh'" |
|
1460 | 1780 | echo "# code for 'rccontrol stack-upgrade' goes here" |
|
1461 | 1781 | echo "# you can edit it freely and regenerate (it will not be overwritten)" |
|
1462 | 1782 | inspect_args |
|
1463 | 1783 | |
|
1464 | 1784 | } |
|
1465 | 1785 | |
|
1466 | 1786 | # :command.function |
|
1467 | 1787 | rccontrol_cli_redis_command() { |
|
1468 | 1788 | # src/cli_redis_command.sh |
|
1469 | 1789 | check_bootstrap |
|
1470 | 1790 | |
|
1471 | 1791 | DEBUG=${args[--debug]} |
|
1472 | 1792 | |
|
1473 | 1793 | target_container=rc_cluster_services-redis-1 |
|
1474 | 1794 | docker_id=$(docker ps --filter name=$target_container -q) |
|
1475 | 1795 | |
|
1476 | 1796 | if [[ $DEBUG ]]; then |
|
1477 | 1797 | echo "container id: $docker_id, based on $target_container filter" |
|
1478 | 1798 | docker ps |
|
1479 | 1799 | fi |
|
1480 | 1800 | |
|
1481 | 1801 | if [ "$docker_id" == "" ]; then |
|
1482 | 1802 | MSG="Cannot find container ID with name $target_container" |
|
1483 | 1803 | echo "$(red $MSG)" |
|
1484 | 1804 | exit |
|
1485 | 1805 | fi |
|
1486 | 1806 | |
|
1487 | 1807 | if [[ $DEBUG ]]; then |
|
1488 | 1808 | echo "Running |docker exec --interactive --tty $docker_id $CMD|" |
|
1489 | 1809 | echo "docker exec --interactive --tty $docker_id /bin/bash -c 'redis-cli'" |
|
1490 | 1810 | fi |
|
1491 | 1811 | |
|
1492 | 1812 | eval "docker exec --interactive --tty $docker_id /bin/bash -c 'redis-cli'" |
|
1493 | 1813 | |
|
1494 | 1814 | } |
|
1495 | 1815 | |
|
1496 | 1816 | # :command.function |
|
1497 | 1817 | rccontrol_cli_db_command() { |
|
1498 | 1818 | # src/cli_db_command.sh |
|
1499 | 1819 | check_bootstrap |
|
1500 | 1820 | |
|
1501 | 1821 | DEBUG=${args[--debug]} |
|
1502 | 1822 | |
|
1503 | 1823 | target_container=rc_cluster_services-database-1 |
|
1504 | 1824 | docker_id=$(docker ps --filter name=$target_container -q) |
|
1505 | 1825 | |
|
1506 | 1826 | if [[ $DEBUG ]]; then |
|
1507 | 1827 | echo "container id: $docker_id, based on $target_container filter" |
|
1508 | 1828 | docker ps |
|
1509 | 1829 | fi |
|
1510 | 1830 | |
|
1511 | 1831 | if [ "$docker_id" == "" ]; then |
|
1512 | 1832 | MSG="Cannot find container ID with name $target_container" |
|
1513 | 1833 | echo "$(red $MSG)" |
|
1514 | 1834 | exit |
|
1515 | 1835 | fi |
|
1516 | 1836 | |
|
1517 | 1837 | if [[ $DEBUG ]]; then |
|
1518 | 1838 | echo "Running |docker exec --interactive --tty $docker_id $CMD|" |
|
1519 | 1839 | echo "docker exec --interactive --tty $docker_id /bin/bash -c 'PGPASSWORD=$DB_PASSWORD psql --username=$DB_USER --dbname=$DB_NAME'" |
|
1520 | 1840 | fi |
|
1521 | 1841 | |
|
1522 | 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 | 1846 | # :command.function |
|
1527 | 1847 | rccontrol_cli_db_upgrade_command() { |
|
1528 | 1848 | # src/cli_db_upgrade_command.sh |
|
1529 | 1849 | check_bootstrap |
|
1530 | 1850 | |
|
1531 | 1851 | DEBUG=${args[--debug]} |
|
1532 | 1852 | |
|
1533 | 1853 | target_container=rc_cluster_apps-rhodecode-1 |
|
1534 | 1854 | docker_id=$(docker ps --filter name=$target_container -q) |
|
1535 | 1855 | |
|
1536 | 1856 | if [[ $DEBUG ]]; then |
|
1537 | 1857 | echo "container id: $docker_id, based on $target_container filter" |
|
1538 | 1858 | docker ps |
|
1539 | 1859 | fi |
|
1540 | 1860 | |
|
1541 | 1861 | if [ "$docker_id" == "" ]; then |
|
1542 | 1862 | MSG="Cannot find container ID with name $target_container" |
|
1543 | 1863 | echo "$(red $MSG)" |
|
1544 | 1864 | exit |
|
1545 | 1865 | fi |
|
1546 | 1866 | |
|
1547 | 1867 | if [[ $DEBUG ]]; then |
|
1548 | 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 | 1869 | fi |
|
1550 | 1870 | |
|
1551 | 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 | 1874 | # :command.function |
|
1875 | rccontrol_cli_storage_command() { | |
|
1876 | # src/cli_storage_command.sh | |
|
1877 | check_bootstrap | |
|
1878 | ||
|
1879 | DEBUG=${args[--debug]} | |
|
1880 | ||
|
1881 | source $ENV_FILE | |
|
1882 | target_container=$RC_IMAGE_EE | |
|
1883 | ||
|
1884 | image_id=$(docker image ls $RC_IMAGE_EE -q) | |
|
1885 | ||
|
1886 | echo "Attaching storage from $target_container" | |
|
1887 | ||
|
1888 | if [[ $DEBUG ]]; then | |
|
1889 | echo "image id: $image_id, based on $target_container filter" | |
|
1890 | docker image ls | |
|
1891 | echo "---" | |
|
1892 | fi | |
|
1893 | ||
|
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 | |
|
1555 | 1921 | rccontrol__completions_command() { |
|
1556 | 1922 | # src/_completions_command.sh |
|
1557 | 1923 | send_completions |
|
1558 | 1924 | } |
|
1559 | 1925 | |
|
1560 | 1926 | # :command.function |
|
1561 | 1927 | rccontrol_backup_db_command() { |
|
1562 | 1928 | # src/backup_db_command.sh |
|
1563 | 1929 | check_bootstrap |
|
1564 | 1930 | |
|
1565 | 1931 | DEBUG=${args[--debug]} |
|
1566 | 1932 | DESTINATION=${args[destination]} |
|
1567 | 1933 | |
|
1568 | 1934 | target_container=rc_cluster_services-database-1 |
|
1569 | 1935 | |
|
1570 | 1936 | docker_id=$(docker ps --filter name=$target_container -q) |
|
1571 |
backup_name=rc_db_dump-$(date +%Y-%m-%d). |
|
|
1937 | backup_name=rc_db_dump-$(date +%Y-%m-%d).sql.gz | |
|
1572 | 1938 | |
|
1573 | 1939 | echo "creating backup $backup_name" |
|
1574 | 1940 | |
|
1575 | 1941 | if [[ $DEBUG ]]; then |
|
1576 | 1942 | echo "container id: $docker_id, based on $target_container filter" |
|
1577 | 1943 | docker ps |
|
1578 | 1944 | echo "---" |
|
1579 | 1945 | fi |
|
1580 | 1946 | |
|
1581 | 1947 | #image_id=$(docker inspect "$docker_id" --format {{.Image}} | cut -c 8-) |
|
1582 | 1948 | # |
|
1583 | 1949 | #if [[ $DEBUG ]]; then |
|
1584 | 1950 | # echo "image id: $image_id, based on $target_container filter" |
|
1585 | 1951 | # docker image ls |
|
1586 | 1952 | # echo "---" |
|
1587 | 1953 | #fi |
|
1588 | 1954 | |
|
1589 | 1955 | if [ "$docker_id" == "" ]; then |
|
1590 | 1956 | MSG="Cannot find container ID with name $target_container" |
|
1591 | 1957 | echo "$(red $MSG)" |
|
1592 | 1958 | exit |
|
1593 | 1959 | fi |
|
1594 | 1960 | |
|
1595 | 1961 | #if [ "image_id" == "" ]; then |
|
1596 | 1962 | # MSG="Cannot find image ID with name $target_container" |
|
1597 | 1963 | # echo "$(red $MSG)" |
|
1598 | 1964 | # exit |
|
1599 | 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 | 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 | 1972 | fi |
|
1604 | 1973 | |
|
1605 | 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 | 1975 | echo "$(green Backup created in /var/rc-data-dump/ mount !)" |
|
1607 | 1976 | |
|
1608 | 1977 | } |
|
1609 | 1978 | |
|
1610 | 1979 | # :command.function |
|
1611 | 1980 | rccontrol_backup_data_command() { |
|
1612 | 1981 | # src/backup_data_command.sh |
|
1613 | 1982 | echo "# this file is located in 'src/backup_data_command.sh'" |
|
1614 | 1983 | echo "# code for 'rccontrol backup-data' goes here" |
|
1615 | 1984 | echo "# you can edit it freely and regenerate (it will not be overwritten)" |
|
1616 | 1985 | inspect_args |
|
1617 | 1986 | |
|
1618 | 1987 | } |
|
1619 | 1988 | |
|
1620 | 1989 | # :command.parse_requirements |
|
1621 | 1990 | parse_requirements() { |
|
1622 | 1991 | # :command.fixed_flags_filter |
|
1623 | 1992 | case "${1:-}" in |
|
1624 | 1993 | --version | -v ) |
|
1625 | 1994 | version_command |
|
1626 | 1995 | exit |
|
1627 | 1996 | ;; |
|
1628 | 1997 | |
|
1629 | 1998 | --help | -h ) |
|
1630 | 1999 | long_usage=yes |
|
1631 | 2000 | rccontrol_usage |
|
1632 | 2001 | exit |
|
1633 | 2002 | ;; |
|
1634 | 2003 | |
|
1635 | 2004 | # :flag.case |
|
1636 | 2005 | --debug ) |
|
1637 | 2006 | |
|
1638 | 2007 | # :flag.case_no_arg |
|
1639 | 2008 | args[--debug]=1 |
|
1640 | 2009 | shift |
|
1641 | 2010 | ;; |
|
1642 | 2011 | |
|
1643 | 2012 | esac |
|
1644 | 2013 | |
|
1645 | 2014 | # :command.environment_variables_filter |
|
1646 | 2015 | # :command.environment_variables_default |
|
1647 | 2016 | export RC_CLI_VERSION_NAME="${RC_CLI_VERSION_NAME:-4.27.0}" |
|
1648 | 2017 | export RC_STACK_ROUTER_EXT="${RC_STACK_ROUTER_EXT:-.custom/docker-compose-router.override.yaml}" |
|
1649 | 2018 | export RC_STACK_METRICS_EXT="${RC_STACK_METRICS_EXT:-.custom/docker-compose-metrics.override.yaml}" |
|
1650 | 2019 | export RC_STACK_SERVICES_EXT="${RC_STACK_SERVICES_EXT:-.custom/docker-compose-services.override.yaml}" |
|
1651 | 2020 | export RC_STACK_RHODECODE_EXT="${RC_STACK_RHODECODE_EXT:-.custom/docker-compose-apps.override.yaml}" |
|
1652 | 2021 | |
|
1653 | 2022 | # :command.command_filter |
|
1654 | 2023 | action=${1:-} |
|
1655 | 2024 | |
|
1656 | 2025 | case $action in |
|
1657 | 2026 | -* ) |
|
1658 | 2027 | ;; |
|
1659 | 2028 | |
|
1660 | 2029 | self-update ) |
|
1661 | 2030 | action="self-update" |
|
1662 | 2031 | shift |
|
1663 | 2032 | rccontrol_self_update_parse_requirements "$@" |
|
1664 | 2033 | shift $# |
|
1665 | 2034 | ;; |
|
1666 | 2035 | |
|
1667 |
bootstrap | in |
|
|
2036 | bootstrap | init ) | |
|
1668 | 2037 | action="bootstrap" |
|
1669 | 2038 | shift |
|
1670 | 2039 | rccontrol_bootstrap_parse_requirements "$@" |
|
1671 | 2040 | shift $# |
|
1672 | 2041 | ;; |
|
1673 | 2042 | |
|
1674 | 2043 | get-build-artifacts ) |
|
1675 | 2044 | action="get-build-artifacts" |
|
1676 | 2045 | shift |
|
1677 | 2046 | rccontrol_get_build_artifacts_parse_requirements "$@" |
|
1678 | 2047 | shift $# |
|
1679 | 2048 | ;; |
|
1680 | 2049 | |
|
1681 | 2050 | build ) |
|
1682 | 2051 | action="build" |
|
1683 | 2052 | shift |
|
1684 | 2053 | rccontrol_build_parse_requirements "$@" |
|
1685 | 2054 | shift $# |
|
1686 | 2055 | ;; |
|
1687 | 2056 | |
|
1688 | 2057 | get-build-source ) |
|
1689 | 2058 | action="get-build-source" |
|
1690 | 2059 | shift |
|
1691 | 2060 | rccontrol_get_build_source_parse_requirements "$@" |
|
1692 | 2061 | shift $# |
|
1693 | 2062 | ;; |
|
1694 | 2063 | |
|
1695 | 2064 | build-source ) |
|
1696 | 2065 | action="build-source" |
|
1697 | 2066 | shift |
|
1698 | 2067 | rccontrol_build_source_parse_requirements "$@" |
|
1699 | 2068 | shift $# |
|
1700 | 2069 | ;; |
|
1701 | 2070 | |
|
1702 | 2071 | stack ) |
|
1703 | 2072 | action="stack" |
|
1704 | 2073 | shift |
|
1705 | 2074 | rccontrol_stack_parse_requirements "$@" |
|
1706 | 2075 | shift $# |
|
1707 | 2076 | ;; |
|
1708 | 2077 | |
|
1709 | 2078 | stack-status | status ) |
|
1710 | 2079 | action="stack-status" |
|
1711 | 2080 | shift |
|
1712 | 2081 | rccontrol_stack_status_parse_requirements "$@" |
|
1713 | 2082 | shift $# |
|
1714 | 2083 | ;; |
|
1715 | 2084 | |
|
1716 | 2085 | stack-upgrade ) |
|
1717 | 2086 | action="stack-upgrade" |
|
1718 | 2087 | shift |
|
1719 | 2088 | rccontrol_stack_upgrade_parse_requirements "$@" |
|
1720 | 2089 | shift $# |
|
1721 | 2090 | ;; |
|
1722 | 2091 | |
|
1723 |
cli |
|
|
1724 |
action="cli |
|
|
1725 | shift | |
|
1726 | rccontrol_cli_redis_parse_requirements "$@" | |
|
1727 | shift $# | |
|
1728 | ;; | |
|
1729 | ||
|
1730 | cli-db ) | |
|
1731 | action="cli-db" | |
|
1732 | shift | |
|
1733 | rccontrol_cli_db_parse_requirements "$@" | |
|
1734 | shift $# | |
|
1735 | ;; | |
|
1736 | ||
|
1737 | cli-db-upgrade ) | |
|
1738 | action="cli-db-upgrade" | |
|
2092 | cli ) | |
|
2093 | action="cli" | |
|
1739 | 2094 | shift |
|
1740 |
rccontrol_cli_ |
|
|
2095 | rccontrol_cli_parse_requirements "$@" | |
|
1741 | 2096 | shift $# |
|
1742 | 2097 | ;; |
|
1743 | 2098 | |
|
1744 | 2099 | _completions ) |
|
1745 | 2100 | action="_completions" |
|
1746 | 2101 | shift |
|
1747 | 2102 | rccontrol__completions_parse_requirements "$@" |
|
1748 | 2103 | shift $# |
|
1749 | 2104 | ;; |
|
1750 | 2105 | |
|
1751 | 2106 | backup-db ) |
|
1752 | 2107 | action="backup-db" |
|
1753 | 2108 | shift |
|
1754 | 2109 | rccontrol_backup_db_parse_requirements "$@" |
|
1755 | 2110 | shift $# |
|
1756 | 2111 | ;; |
|
1757 | 2112 | |
|
1758 | 2113 | backup-data ) |
|
1759 | 2114 | action="backup-data" |
|
1760 | 2115 | shift |
|
1761 | 2116 | rccontrol_backup_data_parse_requirements "$@" |
|
1762 | 2117 | shift $# |
|
1763 | 2118 | ;; |
|
1764 | 2119 | |
|
1765 | 2120 | # :command.command_fallback |
|
1766 | 2121 | "" ) |
|
1767 | 2122 | rccontrol_usage >&2 |
|
1768 | 2123 | exit 1 |
|
1769 | 2124 | ;; |
|
1770 | 2125 | |
|
1771 | 2126 | * ) |
|
1772 | 2127 | printf "invalid command: %s\n" "$action" >&2 |
|
1773 | 2128 | exit 1 |
|
1774 | 2129 | ;; |
|
1775 | 2130 | |
|
1776 | 2131 | esac |
|
1777 | 2132 | |
|
1778 | 2133 | # :command.parse_requirements_while |
|
1779 | 2134 | while [[ $# -gt 0 ]]; do |
|
1780 | 2135 | key="$1" |
|
1781 | 2136 | case "$key" in |
|
1782 | 2137 | |
|
1783 | 2138 | -?* ) |
|
1784 | 2139 | printf "invalid option: %s\n" "$key" >&2 |
|
1785 | 2140 | exit 1 |
|
1786 | 2141 | ;; |
|
1787 | 2142 | |
|
1788 | 2143 | * ) |
|
1789 | 2144 | # :command.parse_requirements_case |
|
1790 | 2145 | # :command.parse_requirements_case_simple |
|
1791 | 2146 | printf "invalid argument: %s\n" "$key" >&2 |
|
1792 | 2147 | exit 1 |
|
1793 | 2148 | |
|
1794 | 2149 | ;; |
|
1795 | 2150 | |
|
1796 | 2151 | esac |
|
1797 | 2152 | done |
|
1798 | 2153 | |
|
1799 | 2154 | } |
|
1800 | 2155 | |
|
1801 | 2156 | # :command.parse_requirements |
|
1802 | 2157 | rccontrol_self_update_parse_requirements() { |
|
1803 | 2158 | # :command.fixed_flags_filter |
|
1804 | 2159 | case "${1:-}" in |
|
1805 | 2160 | --help | -h ) |
|
1806 | 2161 | long_usage=yes |
|
1807 | 2162 | rccontrol_self_update_usage |
|
1808 | 2163 | exit |
|
1809 | 2164 | ;; |
|
1810 | 2165 | |
|
1811 | 2166 | esac |
|
1812 | 2167 | |
|
1813 | 2168 | # :command.dependencies_filter |
|
1814 | 2169 | if ! [[ -x "$(command -v curl)" ]]; then |
|
1815 | 2170 | printf "missing dependency: curl\n" >&2 |
|
1816 | 2171 | exit 1 |
|
1817 | 2172 | fi |
|
1818 | 2173 | if ! [[ -x "$(command -v tar)" ]]; then |
|
1819 | 2174 | printf "missing dependency: tar\n" >&2 |
|
1820 | 2175 | exit 1 |
|
1821 | 2176 | fi |
|
1822 | 2177 | |
|
1823 | 2178 | # :command.command_filter |
|
1824 | 2179 | action="self-update" |
|
1825 | 2180 | |
|
1826 | 2181 | # :command.parse_requirements_while |
|
1827 | 2182 | while [[ $# -gt 0 ]]; do |
|
1828 | 2183 | key="$1" |
|
1829 | 2184 | case "$key" in |
|
1830 | 2185 | # :flag.case |
|
1831 | 2186 | --auth-token ) |
|
1832 | 2187 | |
|
1833 | 2188 | # :flag.case_arg |
|
1834 | 2189 | if [[ -n ${2+x} ]]; then |
|
1835 | 2190 | |
|
1836 | 2191 | args[--auth-token]="$2" |
|
1837 | 2192 | shift |
|
1838 | 2193 | shift |
|
1839 | 2194 | else |
|
1840 | 2195 | printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2 |
|
1841 | 2196 | exit 1 |
|
1842 | 2197 | fi |
|
1843 | 2198 | ;; |
|
1844 | 2199 | |
|
1845 | 2200 | # :flag.case |
|
1846 | 2201 | --server-url ) |
|
1847 | 2202 | |
|
1848 | 2203 | # :flag.case_arg |
|
1849 | 2204 | if [[ -n ${2+x} ]]; then |
|
1850 | 2205 | |
|
1851 | 2206 | args[--server-url]="$2" |
|
1852 | 2207 | shift |
|
1853 | 2208 | shift |
|
1854 | 2209 | else |
|
1855 | 2210 | printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2 |
|
1856 | 2211 | exit 1 |
|
1857 | 2212 | fi |
|
1858 | 2213 | ;; |
|
1859 | 2214 | |
|
1860 | 2215 | -?* ) |
|
1861 | 2216 | printf "invalid option: %s\n" "$key" >&2 |
|
1862 | 2217 | exit 1 |
|
1863 | 2218 | ;; |
|
1864 | 2219 | |
|
1865 | 2220 | * ) |
|
1866 | 2221 | # :command.parse_requirements_case |
|
1867 | 2222 | # :command.parse_requirements_case_simple |
|
1868 | 2223 | printf "invalid argument: %s\n" "$key" >&2 |
|
1869 | 2224 | exit 1 |
|
1870 | 2225 | |
|
1871 | 2226 | ;; |
|
1872 | 2227 | |
|
1873 | 2228 | esac |
|
1874 | 2229 | done |
|
1875 | 2230 | |
|
1876 | 2231 | # :command.default_assignments |
|
1877 | 2232 | [[ -n ${args[--server-url]:-} ]] || args[--server-url]="https://code.rhodecode.com" |
|
1878 | 2233 | |
|
1879 | 2234 | } |
|
1880 | 2235 | |
|
1881 | 2236 | # :command.parse_requirements |
|
1882 | 2237 | rccontrol_bootstrap_parse_requirements() { |
|
1883 | 2238 | # :command.fixed_flags_filter |
|
1884 | 2239 | case "${1:-}" in |
|
1885 | 2240 | --help | -h ) |
|
1886 | 2241 | long_usage=yes |
|
1887 | 2242 | rccontrol_bootstrap_usage |
|
1888 | 2243 | exit |
|
1889 | 2244 | ;; |
|
1890 | 2245 | |
|
1891 | 2246 | esac |
|
1892 | 2247 | |
|
1893 | 2248 | # :command.dependencies_filter |
|
1894 | 2249 | if ! [[ -x "$(command -v curl)" ]]; then |
|
1895 | 2250 | printf "missing dependency: curl\n" >&2 |
|
1896 | 2251 | exit 1 |
|
1897 | 2252 | fi |
|
1898 | 2253 | if ! [[ -x "$(command -v tar)" ]]; then |
|
1899 | 2254 | printf "missing dependency: tar\n" >&2 |
|
1900 | 2255 | exit 1 |
|
1901 | 2256 | fi |
|
1902 | 2257 | if ! [[ -x "$(command -v md5sum)" ]]; then |
|
1903 | 2258 | printf "missing dependency: md5sum\n" >&2 |
|
1904 | 2259 | exit 1 |
|
1905 | 2260 | fi |
|
1906 | 2261 | |
|
1907 | 2262 | # :command.command_filter |
|
1908 | 2263 | action="bootstrap" |
|
1909 | 2264 | |
|
1910 | 2265 | # :command.parse_requirements_while |
|
1911 | 2266 | while [[ $# -gt 0 ]]; do |
|
1912 | 2267 | key="$1" |
|
1913 | 2268 | case "$key" in |
|
1914 | 2269 | # :flag.case |
|
1915 | 2270 | --force | -f ) |
|
1916 | 2271 | |
|
1917 | 2272 | # :flag.case_no_arg |
|
1918 | 2273 | args[--force]=1 |
|
1919 | 2274 | shift |
|
1920 | 2275 | ;; |
|
1921 | 2276 | |
|
1922 | 2277 | # :flag.case |
|
1923 | 2278 | --auth-token ) |
|
1924 | 2279 | |
|
1925 | 2280 | # :flag.case_arg |
|
1926 | 2281 | if [[ -n ${2+x} ]]; then |
|
1927 | 2282 | |
|
1928 | 2283 | args[--auth-token]="$2" |
|
1929 | 2284 | shift |
|
1930 | 2285 | shift |
|
1931 | 2286 | else |
|
1932 | 2287 | printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2 |
|
1933 | 2288 | exit 1 |
|
1934 | 2289 | fi |
|
1935 | 2290 | ;; |
|
1936 | 2291 | |
|
1937 | 2292 | # :flag.case |
|
1938 | 2293 | --server-url ) |
|
1939 | 2294 | |
|
1940 | 2295 | # :flag.case_arg |
|
1941 | 2296 | if [[ -n ${2+x} ]]; then |
|
1942 | 2297 | |
|
1943 | 2298 | args[--server-url]="$2" |
|
1944 | 2299 | shift |
|
1945 | 2300 | shift |
|
1946 | 2301 | else |
|
1947 | 2302 | printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2 |
|
1948 | 2303 | exit 1 |
|
1949 | 2304 | fi |
|
1950 | 2305 | ;; |
|
1951 | 2306 | |
|
1952 | 2307 | -?* ) |
|
1953 | 2308 | printf "invalid option: %s\n" "$key" >&2 |
|
1954 | 2309 | exit 1 |
|
1955 | 2310 | ;; |
|
1956 | 2311 | |
|
1957 | 2312 | * ) |
|
1958 | 2313 | # :command.parse_requirements_case |
|
1959 | 2314 | # :command.parse_requirements_case_simple |
|
1960 | 2315 | printf "invalid argument: %s\n" "$key" >&2 |
|
1961 | 2316 | exit 1 |
|
1962 | 2317 | |
|
1963 | 2318 | ;; |
|
1964 | 2319 | |
|
1965 | 2320 | esac |
|
1966 | 2321 | done |
|
1967 | 2322 | |
|
1968 | 2323 | # :command.default_assignments |
|
1969 | 2324 | [[ -n ${args[--server-url]:-} ]] || args[--server-url]="https://code.rhodecode.com" |
|
1970 | 2325 | |
|
1971 | 2326 | } |
|
1972 | 2327 | |
|
1973 | 2328 | # :command.parse_requirements |
|
1974 | 2329 | rccontrol_get_build_artifacts_parse_requirements() { |
|
1975 | 2330 | # :command.fixed_flags_filter |
|
1976 | 2331 | case "${1:-}" in |
|
1977 | 2332 | --help | -h ) |
|
1978 | 2333 | long_usage=yes |
|
1979 | 2334 | rccontrol_get_build_artifacts_usage |
|
1980 | 2335 | exit |
|
1981 | 2336 | ;; |
|
1982 | 2337 | |
|
1983 | 2338 | esac |
|
1984 | 2339 | |
|
1985 | 2340 | # :command.command_filter |
|
1986 | 2341 | action="get-build-artifacts" |
|
1987 | 2342 | |
|
1988 | 2343 | # :command.parse_requirements_while |
|
1989 | 2344 | while [[ $# -gt 0 ]]; do |
|
1990 | 2345 | key="$1" |
|
1991 | 2346 | case "$key" in |
|
1992 | 2347 | # :flag.case |
|
1993 | 2348 | --auth ) |
|
1994 | 2349 | |
|
1995 | 2350 | # :flag.case_arg |
|
1996 | 2351 | if [[ -n ${2+x} ]]; then |
|
1997 | 2352 | |
|
1998 | 2353 | args[--auth]="$2" |
|
1999 | 2354 | shift |
|
2000 | 2355 | shift |
|
2001 | 2356 | else |
|
2002 | 2357 | printf "%s\n" "--auth requires an argument: --auth AUTH" >&2 |
|
2003 | 2358 | exit 1 |
|
2004 | 2359 | fi |
|
2005 | 2360 | ;; |
|
2006 | 2361 | |
|
2007 | 2362 | # :flag.case |
|
2008 | 2363 | --installer-url ) |
|
2009 | 2364 | |
|
2010 | 2365 | # :flag.case_arg |
|
2011 | 2366 | if [[ -n ${2+x} ]]; then |
|
2012 | 2367 | |
|
2013 | 2368 | args[--installer-url]="$2" |
|
2014 | 2369 | shift |
|
2015 | 2370 | shift |
|
2016 | 2371 | else |
|
2017 | 2372 | printf "%s\n" "--installer-url requires an argument: --installer-url INSTALLER_URL" >&2 |
|
2018 | 2373 | exit 1 |
|
2019 | 2374 | fi |
|
2020 | 2375 | ;; |
|
2021 | 2376 | |
|
2022 | 2377 | # :flag.case |
|
2023 | 2378 | --manifest-url ) |
|
2024 | 2379 | |
|
2025 | 2380 | # :flag.case_arg |
|
2026 | 2381 | if [[ -n ${2+x} ]]; then |
|
2027 | 2382 | |
|
2028 | 2383 | args[--manifest-url]="$2" |
|
2029 | 2384 | shift |
|
2030 | 2385 | shift |
|
2031 | 2386 | else |
|
2032 | 2387 | printf "%s\n" "--manifest-url requires an argument: --manifest-url MANIFEST_URL" >&2 |
|
2033 | 2388 | exit 1 |
|
2034 | 2389 | fi |
|
2035 | 2390 | ;; |
|
2036 | 2391 | |
|
2037 | 2392 | # :flag.case |
|
2038 | 2393 | --version-name ) |
|
2039 | 2394 | |
|
2040 | 2395 | # :flag.case_arg |
|
2041 | 2396 | if [[ -n ${2+x} ]]; then |
|
2042 | 2397 | |
|
2043 | 2398 | args[--version-name]="$2" |
|
2044 | 2399 | shift |
|
2045 | 2400 | shift |
|
2046 | 2401 | else |
|
2047 | 2402 | printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2 |
|
2048 | 2403 | exit 1 |
|
2049 | 2404 | fi |
|
2050 | 2405 | ;; |
|
2051 | 2406 | |
|
2052 | 2407 | -?* ) |
|
2053 | 2408 | printf "invalid option: %s\n" "$key" >&2 |
|
2054 | 2409 | exit 1 |
|
2055 | 2410 | ;; |
|
2056 | 2411 | |
|
2057 | 2412 | * ) |
|
2058 | 2413 | # :command.parse_requirements_case |
|
2059 | 2414 | # :command.parse_requirements_case_simple |
|
2060 | 2415 | printf "invalid argument: %s\n" "$key" >&2 |
|
2061 | 2416 | exit 1 |
|
2062 | 2417 | |
|
2063 | 2418 | ;; |
|
2064 | 2419 | |
|
2065 | 2420 | esac |
|
2066 | 2421 | done |
|
2067 | 2422 | |
|
2068 | 2423 | # :command.default_assignments |
|
2069 | 2424 | [[ -n ${args[--auth]:-} ]] || args[--auth]="" |
|
2070 | 2425 | [[ -n ${args[--installer-url]:-} ]] || args[--installer-url]="https://dls.rhodecode.com/dls/N2E2ZTY1NzA3NjYxNDA2NTc1NjI3MTcyNzA2MjcxNzIyZTcwNjI3YQ==/rhodecode-control/latest-linux-ee" |
|
2071 | 2426 | [[ -n ${args[--manifest-url]:-} ]] || args[--manifest-url]="https://dls.rhodecode.com/linux/MANIFEST" |
|
2072 | 2427 | [[ -n ${args[--version-name]:-} ]] || args[--version-name]="$RC_CLI_VERSION_NAME" |
|
2073 | 2428 | |
|
2074 | 2429 | } |
|
2075 | 2430 | |
|
2076 | 2431 | # :command.parse_requirements |
|
2077 | 2432 | rccontrol_build_parse_requirements() { |
|
2078 | 2433 | # :command.fixed_flags_filter |
|
2079 | 2434 | case "${1:-}" in |
|
2080 | 2435 | --help | -h ) |
|
2081 | 2436 | long_usage=yes |
|
2082 | 2437 | rccontrol_build_usage |
|
2083 | 2438 | exit |
|
2084 | 2439 | ;; |
|
2085 | 2440 | |
|
2086 | 2441 | esac |
|
2087 | 2442 | |
|
2088 | 2443 | # :command.command_filter |
|
2089 | 2444 | action="build" |
|
2090 | 2445 | |
|
2091 | 2446 | # :command.parse_requirements_while |
|
2092 | 2447 | while [[ $# -gt 0 ]]; do |
|
2093 | 2448 | key="$1" |
|
2094 | 2449 | case "$key" in |
|
2095 | 2450 | # :flag.case |
|
2096 | 2451 | --version-name ) |
|
2097 | 2452 | |
|
2098 | 2453 | # :flag.case_arg |
|
2099 | 2454 | if [[ -n ${2+x} ]]; then |
|
2100 | 2455 | |
|
2101 | 2456 | args[--version-name]="$2" |
|
2102 | 2457 | shift |
|
2103 | 2458 | shift |
|
2104 | 2459 | else |
|
2105 | 2460 | printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2 |
|
2106 | 2461 | exit 1 |
|
2107 | 2462 | fi |
|
2108 | 2463 | ;; |
|
2109 | 2464 | |
|
2110 | 2465 | -?* ) |
|
2111 | 2466 | printf "invalid option: %s\n" "$key" >&2 |
|
2112 | 2467 | exit 1 |
|
2113 | 2468 | ;; |
|
2114 | 2469 | |
|
2115 | 2470 | * ) |
|
2116 | 2471 | # :command.parse_requirements_case |
|
2117 | 2472 | # :command.parse_requirements_case_simple |
|
2118 | 2473 | printf "invalid argument: %s\n" "$key" >&2 |
|
2119 | 2474 | exit 1 |
|
2120 | 2475 | |
|
2121 | 2476 | ;; |
|
2122 | 2477 | |
|
2123 | 2478 | esac |
|
2124 | 2479 | done |
|
2125 | 2480 | |
|
2126 | 2481 | # :command.default_assignments |
|
2127 | 2482 | [[ -n ${args[--version-name]:-} ]] || args[--version-name]="$RC_CLI_VERSION_NAME" |
|
2128 | 2483 | |
|
2129 | 2484 | } |
|
2130 | 2485 | |
|
2131 | 2486 | # :command.parse_requirements |
|
2132 | 2487 | rccontrol_get_build_source_parse_requirements() { |
|
2133 | 2488 | # :command.fixed_flags_filter |
|
2134 | 2489 | case "${1:-}" in |
|
2135 | 2490 | --help | -h ) |
|
2136 | 2491 | long_usage=yes |
|
2137 | 2492 | rccontrol_get_build_source_usage |
|
2138 | 2493 | exit |
|
2139 | 2494 | ;; |
|
2140 | 2495 | |
|
2141 | 2496 | esac |
|
2142 | 2497 | |
|
2143 | 2498 | # :command.dependencies_filter |
|
2144 | 2499 | if ! [[ -x "$(command -v curl)" ]]; then |
|
2145 | 2500 | printf "missing dependency: curl\n" >&2 |
|
2146 | 2501 | exit 1 |
|
2147 | 2502 | fi |
|
2148 | 2503 | if ! [[ -x "$(command -v tar)" ]]; then |
|
2149 | 2504 | printf "missing dependency: tar\n" >&2 |
|
2150 | 2505 | exit 1 |
|
2151 | 2506 | fi |
|
2152 | 2507 | |
|
2153 | 2508 | # :command.command_filter |
|
2154 | 2509 | action="get-build-source" |
|
2155 | 2510 | |
|
2156 | 2511 | # :command.parse_requirements_while |
|
2157 | 2512 | while [[ $# -gt 0 ]]; do |
|
2158 | 2513 | key="$1" |
|
2159 | 2514 | case "$key" in |
|
2160 | 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 | |
|
2161 | 2531 | --auth-token ) |
|
2162 | 2532 | |
|
2163 | 2533 | # :flag.case_arg |
|
2164 | 2534 | if [[ -n ${2+x} ]]; then |
|
2165 | 2535 | |
|
2166 | 2536 | args[--auth-token]="$2" |
|
2167 | 2537 | shift |
|
2168 | 2538 | shift |
|
2169 | 2539 | else |
|
2170 | 2540 | printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2 |
|
2171 | 2541 | exit 1 |
|
2172 | 2542 | fi |
|
2173 | 2543 | ;; |
|
2174 | 2544 | |
|
2175 | 2545 | # :flag.case |
|
2176 | 2546 | --server-url ) |
|
2177 | 2547 | |
|
2178 | 2548 | # :flag.case_arg |
|
2179 | 2549 | if [[ -n ${2+x} ]]; then |
|
2180 | 2550 | |
|
2181 | 2551 | args[--server-url]="$2" |
|
2182 | 2552 | shift |
|
2183 | 2553 | shift |
|
2184 | 2554 | else |
|
2185 | 2555 | printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2 |
|
2186 | 2556 | exit 1 |
|
2187 | 2557 | fi |
|
2188 | 2558 | ;; |
|
2189 | 2559 | |
|
2190 | 2560 | -?* ) |
|
2191 | 2561 | printf "invalid option: %s\n" "$key" >&2 |
|
2192 | 2562 | exit 1 |
|
2193 | 2563 | ;; |
|
2194 | 2564 | |
|
2195 | 2565 | * ) |
|
2196 | 2566 | # :command.parse_requirements_case |
|
2197 | 2567 | # :command.parse_requirements_case_simple |
|
2198 | if [[ -z ${args[revision]+x} ]]; then | |
|
2199 | ||
|
2200 | args[revision]=$1 | |
|
2201 | shift | |
|
2202 | else | |
|
2203 | printf "invalid argument: %s\n" "$key" >&2 | |
|
2204 | exit 1 | |
|
2205 | fi | |
|
2568 | printf "invalid argument: %s\n" "$key" >&2 | |
|
2569 | exit 1 | |
|
2206 | 2570 | |
|
2207 | 2571 | ;; |
|
2208 | 2572 | |
|
2209 | 2573 | esac |
|
2210 | 2574 | done |
|
2211 | 2575 | |
|
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 | 2576 | # :command.default_assignments |
|
2577 | [[ -n ${args[--revision]:-} ]] || args[--revision]="default" | |
|
2219 | 2578 | [[ -n ${args[--server-url]:-} ]] || args[--server-url]="https://code.rhodecode.com" |
|
2220 | 2579 | |
|
2221 | 2580 | } |
|
2222 | 2581 | |
|
2223 | 2582 | # :command.parse_requirements |
|
2224 | 2583 | rccontrol_build_source_parse_requirements() { |
|
2225 | 2584 | # :command.fixed_flags_filter |
|
2226 | 2585 | case "${1:-}" in |
|
2227 | 2586 | --help | -h ) |
|
2228 | 2587 | long_usage=yes |
|
2229 | 2588 | rccontrol_build_source_usage |
|
2230 | 2589 | exit |
|
2231 | 2590 | ;; |
|
2232 | 2591 | |
|
2233 | 2592 | esac |
|
2234 | 2593 | |
|
2235 | 2594 | # :command.command_filter |
|
2236 | 2595 | action="build-source" |
|
2237 | 2596 | |
|
2238 | 2597 | # :command.parse_requirements_while |
|
2239 | 2598 | while [[ $# -gt 0 ]]; do |
|
2240 | 2599 | key="$1" |
|
2241 | 2600 | case "$key" in |
|
2242 | 2601 | # :flag.case |
|
2243 | 2602 | --version-name ) |
|
2244 | 2603 | |
|
2245 | 2604 | # :flag.case_arg |
|
2246 | 2605 | if [[ -n ${2+x} ]]; then |
|
2247 | 2606 | |
|
2248 | 2607 | args[--version-name]="$2" |
|
2249 | 2608 | shift |
|
2250 | 2609 | shift |
|
2251 | 2610 | else |
|
2252 | 2611 | printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2 |
|
2253 | 2612 | exit 1 |
|
2254 | 2613 | fi |
|
2255 | 2614 | ;; |
|
2256 | 2615 | |
|
2257 | 2616 | -?* ) |
|
2258 | 2617 | printf "invalid option: %s\n" "$key" >&2 |
|
2259 | 2618 | exit 1 |
|
2260 | 2619 | ;; |
|
2261 | 2620 | |
|
2262 | 2621 | * ) |
|
2263 | 2622 | # :command.parse_requirements_case |
|
2264 | 2623 | # :command.parse_requirements_case_simple |
|
2265 | 2624 | printf "invalid argument: %s\n" "$key" >&2 |
|
2266 | 2625 | exit 1 |
|
2267 | 2626 | |
|
2268 | 2627 | ;; |
|
2269 | 2628 | |
|
2270 | 2629 | esac |
|
2271 | 2630 | done |
|
2272 | 2631 | |
|
2273 | 2632 | # :command.default_assignments |
|
2274 | 2633 | [[ -n ${args[--version-name]:-} ]] || args[--version-name]="$RC_CLI_VERSION_NAME" |
|
2275 | 2634 | |
|
2276 | 2635 | } |
|
2277 | 2636 | |
|
2278 | 2637 | # :command.parse_requirements |
|
2279 | 2638 | rccontrol_stack_parse_requirements() { |
|
2280 | 2639 | # :command.fixed_flags_filter |
|
2281 | 2640 | case "${1:-}" in |
|
2282 | 2641 | --help | -h ) |
|
2283 | 2642 | long_usage=yes |
|
2284 | 2643 | rccontrol_stack_usage |
|
2285 | 2644 | exit |
|
2286 | 2645 | ;; |
|
2287 | 2646 | |
|
2288 | 2647 | esac |
|
2289 | 2648 | |
|
2290 | 2649 | # :command.command_filter |
|
2291 | action="stack" | |
|
2650 | action=${1:-} | |
|
2292 | 2651 | |
|
2293 | # :command.parse_requirements_while | |
|
2294 | while [[ $# -gt 0 ]]; do | |
|
2295 | key="$1" | |
|
2296 | case "$key" in | |
|
2652 | case $action in | |
|
2653 | -* ) | |
|
2654 | ;; | |
|
2297 | 2655 | |
|
2298 | -?* ) | |
|
2299 | other_args+=("$1") | |
|
2300 |
|
|
|
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 | |
|
2301 | 2750 | ;; |
|
2302 | 2751 | |
|
2303 | 2752 | * ) |
|
2304 | 2753 | # :command.parse_requirements_case |
|
2305 | 2754 | # :command.parse_requirements_case_catch_all |
|
2306 | if [[ -z ${args[name]+x} ]]; then | |
|
2755 | other_args+=("$1") | |
|
2756 | shift | |
|
2307 | 2757 | |
|
2308 | args[name]=$1 | |
|
2309 | shift | |
|
2310 |
|
|
|
2311 | other_args+=("$1") | |
|
2312 | shift | |
|
2313 | fi | |
|
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 | |
|
2314 | 2795 | |
|
2315 | 2796 | ;; |
|
2316 | 2797 | |
|
2317 | 2798 | esac |
|
2318 | 2799 | done |
|
2319 | 2800 | |
|
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 | |
|
2801 | } | |
|
2325 | 2802 | |
|
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 | |
|
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 | |
|
2826 | ;; | |
|
2827 | ||
|
2828 | * ) | |
|
2829 | # :command.parse_requirements_case | |
|
2830 | # :command.parse_requirements_case_catch_all | |
|
2831 | other_args+=("$1") | |
|
2832 | shift | |
|
2833 | ||
|
2834 | ;; | |
|
2835 | ||
|
2836 | esac | |
|
2837 | done | |
|
2838 | ||
|
2839 | } | |
|
2840 | ||
|
2841 | # :command.parse_requirements | |
|
2842 | rccontrol_stack_rhodecode_parse_requirements() { | |
|
2843 | # :command.fixed_flags_filter | |
|
2844 | case "${1:-}" in | |
|
2845 | --help | -h ) | |
|
2846 | long_usage=yes | |
|
2847 | rccontrol_stack_rhodecode_usage | |
|
2848 | exit | |
|
2849 | ;; | |
|
2850 | ||
|
2851 | esac | |
|
2852 | ||
|
2853 | # :command.command_filter | |
|
2854 | action="stack rhodecode" | |
|
2855 | ||
|
2856 | # :command.parse_requirements_while | |
|
2857 | while [[ $# -gt 0 ]]; do | |
|
2858 | key="$1" | |
|
2859 | case "$key" in | |
|
2860 | ||
|
2861 | -?* ) | |
|
2862 | other_args+=("$1") | |
|
2863 | shift | |
|
2864 | ;; | |
|
2865 | ||
|
2866 | * ) | |
|
2867 | # :command.parse_requirements_case | |
|
2868 | # :command.parse_requirements_case_catch_all | |
|
2869 | other_args+=("$1") | |
|
2870 | shift | |
|
2871 | ||
|
2872 | ;; | |
|
2873 | ||
|
2874 | esac | |
|
2875 | done | |
|
2876 | ||
|
2877 | } | |
|
2878 | ||
|
2879 | # :command.parse_requirements | |
|
2880 | rccontrol_stack_all_parse_requirements() { | |
|
2881 | # :command.fixed_flags_filter | |
|
2882 | case "${1:-}" in | |
|
2883 | --help | -h ) | |
|
2884 | long_usage=yes | |
|
2885 | rccontrol_stack_all_usage | |
|
2886 | exit | |
|
2887 | ;; | |
|
2888 | ||
|
2889 | esac | |
|
2890 | ||
|
2891 | # :command.command_filter | |
|
2892 | action="stack all" | |
|
2893 | ||
|
2894 | # :command.parse_requirements_while | |
|
2895 | while [[ $# -gt 0 ]]; do | |
|
2896 | key="$1" | |
|
2897 | case "$key" in | |
|
2898 | ||
|
2899 | -?* ) | |
|
2900 | other_args+=("$1") | |
|
2901 | shift | |
|
2902 | ;; | |
|
2903 | ||
|
2904 | * ) | |
|
2905 | # :command.parse_requirements_case | |
|
2906 | # :command.parse_requirements_case_catch_all | |
|
2907 | other_args+=("$1") | |
|
2908 | shift | |
|
2909 | ||
|
2910 | ;; | |
|
2911 | ||
|
2912 | esac | |
|
2913 | done | |
|
2331 | 2914 | |
|
2332 | 2915 | } |
|
2333 | 2916 | |
|
2334 | 2917 | # :command.parse_requirements |
|
2335 | 2918 | rccontrol_stack_status_parse_requirements() { |
|
2336 | 2919 | # :command.fixed_flags_filter |
|
2337 | 2920 | case "${1:-}" in |
|
2338 | 2921 | --help | -h ) |
|
2339 | 2922 | long_usage=yes |
|
2340 | 2923 | rccontrol_stack_status_usage |
|
2341 | 2924 | exit |
|
2342 | 2925 | ;; |
|
2343 | 2926 | |
|
2344 | 2927 | esac |
|
2345 | 2928 | |
|
2346 | 2929 | # :command.command_filter |
|
2347 | 2930 | action="stack-status" |
|
2348 | 2931 | |
|
2349 | 2932 | # :command.parse_requirements_while |
|
2350 | 2933 | while [[ $# -gt 0 ]]; do |
|
2351 | 2934 | key="$1" |
|
2352 | 2935 | case "$key" in |
|
2353 | 2936 | |
|
2354 | 2937 | -?* ) |
|
2355 | 2938 | printf "invalid option: %s\n" "$key" >&2 |
|
2356 | 2939 | exit 1 |
|
2357 | 2940 | ;; |
|
2358 | 2941 | |
|
2359 | 2942 | * ) |
|
2360 | 2943 | # :command.parse_requirements_case |
|
2361 | 2944 | # :command.parse_requirements_case_simple |
|
2362 | 2945 | printf "invalid argument: %s\n" "$key" >&2 |
|
2363 | 2946 | exit 1 |
|
2364 | 2947 | |
|
2365 | 2948 | ;; |
|
2366 | 2949 | |
|
2367 | 2950 | esac |
|
2368 | 2951 | done |
|
2369 | 2952 | |
|
2370 | 2953 | } |
|
2371 | 2954 | |
|
2372 | 2955 | # :command.parse_requirements |
|
2373 | 2956 | rccontrol_stack_upgrade_parse_requirements() { |
|
2374 | 2957 | # :command.fixed_flags_filter |
|
2375 | 2958 | case "${1:-}" in |
|
2376 | 2959 | --help | -h ) |
|
2377 | 2960 | long_usage=yes |
|
2378 | 2961 | rccontrol_stack_upgrade_usage |
|
2379 | 2962 | exit |
|
2380 | 2963 | ;; |
|
2381 | 2964 | |
|
2382 | 2965 | esac |
|
2383 | 2966 | |
|
2384 | 2967 | # :command.command_filter |
|
2385 | 2968 | action="stack-upgrade" |
|
2386 | 2969 | |
|
2387 | 2970 | # :command.parse_requirements_while |
|
2388 | 2971 | while [[ $# -gt 0 ]]; do |
|
2389 | 2972 | key="$1" |
|
2390 | 2973 | case "$key" in |
|
2391 | 2974 | |
|
2392 | 2975 | -?* ) |
|
2393 | 2976 | printf "invalid option: %s\n" "$key" >&2 |
|
2394 | 2977 | exit 1 |
|
2395 | 2978 | ;; |
|
2396 | 2979 | |
|
2397 | 2980 | * ) |
|
2398 | 2981 | # :command.parse_requirements_case |
|
2399 | 2982 | # :command.parse_requirements_case_simple |
|
2400 | 2983 | printf "invalid argument: %s\n" "$key" >&2 |
|
2401 | 2984 | exit 1 |
|
2402 | 2985 | |
|
2403 | 2986 | ;; |
|
2404 | 2987 | |
|
2405 | 2988 | esac |
|
2406 | 2989 | done |
|
2407 | 2990 | |
|
2408 | 2991 | } |
|
2409 | 2992 | |
|
2410 | 2993 | # :command.parse_requirements |
|
2994 | rccontrol_cli_parse_requirements() { | |
|
2995 | # :command.fixed_flags_filter | |
|
2996 | case "${1:-}" in | |
|
2997 | --help | -h ) | |
|
2998 | long_usage=yes | |
|
2999 | rccontrol_cli_usage | |
|
3000 | exit | |
|
3001 | ;; | |
|
3002 | ||
|
3003 | esac | |
|
3004 | ||
|
3005 | # :command.command_filter | |
|
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 | |
|
3052 | ||
|
3053 | # :command.parse_requirements_while | |
|
3054 | while [[ $# -gt 0 ]]; do | |
|
3055 | key="$1" | |
|
3056 | case "$key" in | |
|
3057 | ||
|
3058 | -?* ) | |
|
3059 | printf "invalid option: %s\n" "$key" >&2 | |
|
3060 | exit 1 | |
|
3061 | ;; | |
|
3062 | ||
|
3063 | * ) | |
|
3064 | # :command.parse_requirements_case | |
|
3065 | # :command.parse_requirements_case_simple | |
|
3066 | printf "invalid argument: %s\n" "$key" >&2 | |
|
3067 | exit 1 | |
|
3068 | ||
|
3069 | ;; | |
|
3070 | ||
|
3071 | esac | |
|
3072 | done | |
|
3073 | ||
|
3074 | } | |
|
3075 | ||
|
3076 | # :command.parse_requirements | |
|
2411 | 3077 | rccontrol_cli_redis_parse_requirements() { |
|
2412 | 3078 | # :command.fixed_flags_filter |
|
2413 | 3079 | case "${1:-}" in |
|
2414 | 3080 | --help | -h ) |
|
2415 | 3081 | long_usage=yes |
|
2416 | 3082 | rccontrol_cli_redis_usage |
|
2417 | 3083 | exit |
|
2418 | 3084 | ;; |
|
2419 | 3085 | |
|
2420 | 3086 | esac |
|
2421 | 3087 | |
|
2422 | 3088 | # :command.command_filter |
|
2423 |
action="cli |
|
|
3089 | action="cli redis" | |
|
2424 | 3090 | |
|
2425 | 3091 | # :command.parse_requirements_while |
|
2426 | 3092 | while [[ $# -gt 0 ]]; do |
|
2427 | 3093 | key="$1" |
|
2428 | 3094 | case "$key" in |
|
2429 | 3095 | |
|
2430 | 3096 | -?* ) |
|
2431 | 3097 | printf "invalid option: %s\n" "$key" >&2 |
|
2432 | 3098 | exit 1 |
|
2433 | 3099 | ;; |
|
2434 | 3100 | |
|
2435 | 3101 | * ) |
|
2436 | 3102 | # :command.parse_requirements_case |
|
2437 | 3103 | # :command.parse_requirements_case_simple |
|
2438 | 3104 | printf "invalid argument: %s\n" "$key" >&2 |
|
2439 | 3105 | exit 1 |
|
2440 | 3106 | |
|
2441 | 3107 | ;; |
|
2442 | 3108 | |
|
2443 | 3109 | esac |
|
2444 | 3110 | done |
|
2445 | 3111 | |
|
2446 | 3112 | } |
|
2447 | 3113 | |
|
2448 | 3114 | # :command.parse_requirements |
|
2449 | 3115 | rccontrol_cli_db_parse_requirements() { |
|
2450 | 3116 | # :command.fixed_flags_filter |
|
2451 | 3117 | case "${1:-}" in |
|
2452 | 3118 | --help | -h ) |
|
2453 | 3119 | long_usage=yes |
|
2454 | 3120 | rccontrol_cli_db_usage |
|
2455 | 3121 | exit |
|
2456 | 3122 | ;; |
|
2457 | 3123 | |
|
2458 | 3124 | esac |
|
2459 | 3125 | |
|
2460 | 3126 | # :command.command_filter |
|
2461 |
action="cli |
|
|
3127 | action="cli db" | |
|
2462 | 3128 | |
|
2463 | 3129 | # :command.parse_requirements_while |
|
2464 | 3130 | while [[ $# -gt 0 ]]; do |
|
2465 | 3131 | key="$1" |
|
2466 | 3132 | case "$key" in |
|
2467 | 3133 | |
|
2468 | 3134 | -?* ) |
|
2469 | 3135 | printf "invalid option: %s\n" "$key" >&2 |
|
2470 | 3136 | exit 1 |
|
2471 | 3137 | ;; |
|
2472 | 3138 | |
|
2473 | 3139 | * ) |
|
2474 | 3140 | # :command.parse_requirements_case |
|
2475 | 3141 | # :command.parse_requirements_case_simple |
|
2476 | 3142 | printf "invalid argument: %s\n" "$key" >&2 |
|
2477 | 3143 | exit 1 |
|
2478 | 3144 | |
|
2479 | 3145 | ;; |
|
2480 | 3146 | |
|
2481 | 3147 | esac |
|
2482 | 3148 | done |
|
2483 | 3149 | |
|
2484 | 3150 | } |
|
2485 | 3151 | |
|
2486 | 3152 | # :command.parse_requirements |
|
2487 | 3153 | rccontrol_cli_db_upgrade_parse_requirements() { |
|
2488 | 3154 | # :command.fixed_flags_filter |
|
2489 | 3155 | case "${1:-}" in |
|
2490 | 3156 | --help | -h ) |
|
2491 | 3157 | long_usage=yes |
|
2492 | 3158 | rccontrol_cli_db_upgrade_usage |
|
2493 | 3159 | exit |
|
2494 | 3160 | ;; |
|
2495 | 3161 | |
|
2496 | 3162 | esac |
|
2497 | 3163 | |
|
2498 | 3164 | # :command.command_filter |
|
2499 |
action="cli |
|
|
3165 | action="cli db-upgrade" | |
|
3166 | ||
|
3167 | # :command.parse_requirements_while | |
|
3168 | while [[ $# -gt 0 ]]; do | |
|
3169 | key="$1" | |
|
3170 | case "$key" in | |
|
3171 | ||
|
3172 | -?* ) | |
|
3173 | printf "invalid option: %s\n" "$key" >&2 | |
|
3174 | exit 1 | |
|
3175 | ;; | |
|
3176 | ||
|
3177 | * ) | |
|
3178 | # :command.parse_requirements_case | |
|
3179 | # :command.parse_requirements_case_simple | |
|
3180 | printf "invalid argument: %s\n" "$key" >&2 | |
|
3181 | exit 1 | |
|
3182 | ||
|
3183 | ;; | |
|
3184 | ||
|
3185 | esac | |
|
3186 | done | |
|
3187 | ||
|
3188 | } | |
|
3189 | ||
|
3190 | # :command.parse_requirements | |
|
3191 | rccontrol_cli_storage_parse_requirements() { | |
|
3192 | # :command.fixed_flags_filter | |
|
3193 | case "${1:-}" in | |
|
3194 | --help | -h ) | |
|
3195 | long_usage=yes | |
|
3196 | rccontrol_cli_storage_usage | |
|
3197 | exit | |
|
3198 | ;; | |
|
3199 | ||
|
3200 | esac | |
|
3201 | ||
|
3202 | # :command.command_filter | |
|
3203 | action="cli storage" | |
|
2500 | 3204 | |
|
2501 | 3205 | # :command.parse_requirements_while |
|
2502 | 3206 | while [[ $# -gt 0 ]]; do |
|
2503 | 3207 | key="$1" |
|
2504 | 3208 | case "$key" in |
|
2505 | 3209 | |
|
2506 | 3210 | -?* ) |
|
2507 | 3211 | printf "invalid option: %s\n" "$key" >&2 |
|
2508 | 3212 | exit 1 |
|
2509 | 3213 | ;; |
|
2510 | 3214 | |
|
2511 | 3215 | * ) |
|
2512 | 3216 | # :command.parse_requirements_case |
|
2513 | 3217 | # :command.parse_requirements_case_simple |
|
2514 | 3218 | printf "invalid argument: %s\n" "$key" >&2 |
|
2515 | 3219 | exit 1 |
|
2516 | 3220 | |
|
2517 | 3221 | ;; |
|
2518 | 3222 | |
|
2519 | 3223 | esac |
|
2520 | 3224 | done |
|
2521 | 3225 | |
|
2522 | 3226 | } |
|
2523 | 3227 | |
|
2524 | 3228 | # :command.parse_requirements |
|
2525 | 3229 | rccontrol__completions_parse_requirements() { |
|
2526 | 3230 | # :command.fixed_flags_filter |
|
2527 | 3231 | case "${1:-}" in |
|
2528 | 3232 | --help | -h ) |
|
2529 | 3233 | long_usage=yes |
|
2530 | 3234 | rccontrol__completions_usage |
|
2531 | 3235 | exit |
|
2532 | 3236 | ;; |
|
2533 | 3237 | |
|
2534 | 3238 | esac |
|
2535 | 3239 | |
|
2536 | 3240 | # :command.command_filter |
|
2537 | 3241 | action="_completions" |
|
2538 | 3242 | |
|
2539 | 3243 | # :command.parse_requirements_while |
|
2540 | 3244 | while [[ $# -gt 0 ]]; do |
|
2541 | 3245 | key="$1" |
|
2542 | 3246 | case "$key" in |
|
2543 | 3247 | |
|
2544 | 3248 | -?* ) |
|
2545 | 3249 | printf "invalid option: %s\n" "$key" >&2 |
|
2546 | 3250 | exit 1 |
|
2547 | 3251 | ;; |
|
2548 | 3252 | |
|
2549 | 3253 | * ) |
|
2550 | 3254 | # :command.parse_requirements_case |
|
2551 | 3255 | # :command.parse_requirements_case_simple |
|
2552 | 3256 | printf "invalid argument: %s\n" "$key" >&2 |
|
2553 | 3257 | exit 1 |
|
2554 | 3258 | |
|
2555 | 3259 | ;; |
|
2556 | 3260 | |
|
2557 | 3261 | esac |
|
2558 | 3262 | done |
|
2559 | 3263 | |
|
2560 | 3264 | } |
|
2561 | 3265 | |
|
2562 | 3266 | # :command.parse_requirements |
|
2563 | 3267 | rccontrol_backup_db_parse_requirements() { |
|
2564 | 3268 | # :command.fixed_flags_filter |
|
2565 | 3269 | case "${1:-}" in |
|
2566 | 3270 | --help | -h ) |
|
2567 | 3271 | long_usage=yes |
|
2568 | 3272 | rccontrol_backup_db_usage |
|
2569 | 3273 | exit |
|
2570 | 3274 | ;; |
|
2571 | 3275 | |
|
2572 | 3276 | esac |
|
2573 | 3277 | |
|
2574 | 3278 | # :command.dependencies_filter |
|
2575 | 3279 | if ! [[ -x "$(command -v tar)" ]]; then |
|
2576 | 3280 | printf "missing dependency: tar\n" >&2 |
|
2577 | 3281 | exit 1 |
|
2578 | 3282 | fi |
|
2579 | 3283 | if ! [[ -x "$(command -v gzip)" ]]; then |
|
2580 | 3284 | printf "missing dependency: gzip\n" >&2 |
|
2581 | 3285 | exit 1 |
|
2582 | 3286 | fi |
|
2583 | 3287 | |
|
2584 | 3288 | # :command.command_filter |
|
2585 | 3289 | action="backup-db" |
|
2586 | 3290 | |
|
2587 | 3291 | # :command.parse_requirements_while |
|
2588 | 3292 | while [[ $# -gt 0 ]]; do |
|
2589 | 3293 | key="$1" |
|
2590 | 3294 | case "$key" in |
|
2591 | 3295 | |
|
2592 | 3296 | -?* ) |
|
2593 | 3297 | printf "invalid option: %s\n" "$key" >&2 |
|
2594 | 3298 | exit 1 |
|
2595 | 3299 | ;; |
|
2596 | 3300 | |
|
2597 | 3301 | * ) |
|
2598 | 3302 | # :command.parse_requirements_case |
|
2599 | 3303 | # :command.parse_requirements_case_simple |
|
2600 | 3304 | printf "invalid argument: %s\n" "$key" >&2 |
|
2601 | 3305 | exit 1 |
|
2602 | 3306 | |
|
2603 | 3307 | ;; |
|
2604 | 3308 | |
|
2605 | 3309 | esac |
|
2606 | 3310 | done |
|
2607 | 3311 | |
|
2608 | 3312 | } |
|
2609 | 3313 | |
|
2610 | 3314 | # :command.parse_requirements |
|
2611 | 3315 | rccontrol_backup_data_parse_requirements() { |
|
2612 | 3316 | # :command.fixed_flags_filter |
|
2613 | 3317 | case "${1:-}" in |
|
2614 | 3318 | --help | -h ) |
|
2615 | 3319 | long_usage=yes |
|
2616 | 3320 | rccontrol_backup_data_usage |
|
2617 | 3321 | exit |
|
2618 | 3322 | ;; |
|
2619 | 3323 | |
|
2620 | 3324 | esac |
|
2621 | 3325 | |
|
2622 | 3326 | # :command.dependencies_filter |
|
2623 | 3327 | if ! [[ -x "$(command -v tar)" ]]; then |
|
2624 | 3328 | printf "missing dependency: tar\n" >&2 |
|
2625 | 3329 | exit 1 |
|
2626 | 3330 | fi |
|
2627 | 3331 | |
|
2628 | 3332 | # :command.command_filter |
|
2629 | 3333 | action="backup-data" |
|
2630 | 3334 | |
|
2631 | 3335 | # :command.parse_requirements_while |
|
2632 | 3336 | while [[ $# -gt 0 ]]; do |
|
2633 | 3337 | key="$1" |
|
2634 | 3338 | case "$key" in |
|
2635 | 3339 | |
|
2636 | 3340 | -?* ) |
|
2637 | 3341 | printf "invalid option: %s\n" "$key" >&2 |
|
2638 | 3342 | exit 1 |
|
2639 | 3343 | ;; |
|
2640 | 3344 | |
|
2641 | 3345 | * ) |
|
2642 | 3346 | # :command.parse_requirements_case |
|
2643 | 3347 | # :command.parse_requirements_case_simple |
|
2644 | 3348 | printf "invalid argument: %s\n" "$key" >&2 |
|
2645 | 3349 | exit 1 |
|
2646 | 3350 | |
|
2647 | 3351 | ;; |
|
2648 | 3352 | |
|
2649 | 3353 | esac |
|
2650 | 3354 | done |
|
2651 | 3355 | |
|
2652 | 3356 | } |
|
2653 | 3357 | |
|
2654 | 3358 | # :command.initialize |
|
2655 | 3359 | initialize() { |
|
2656 | 3360 | version="4.28.0.REL20221101" |
|
2657 | 3361 | long_usage='' |
|
2658 | 3362 | set -e |
|
2659 | 3363 | |
|
2660 | 3364 | # :command.environment_variables_default |
|
2661 | 3365 | export RC_CLI_VERSION_NAME="${RC_CLI_VERSION_NAME:-4.27.0}" |
|
2662 | 3366 | export RC_STACK_ROUTER_EXT="${RC_STACK_ROUTER_EXT:-.custom/docker-compose-router.override.yaml}" |
|
2663 | 3367 | export RC_STACK_METRICS_EXT="${RC_STACK_METRICS_EXT:-.custom/docker-compose-metrics.override.yaml}" |
|
2664 | 3368 | export RC_STACK_SERVICES_EXT="${RC_STACK_SERVICES_EXT:-.custom/docker-compose-services.override.yaml}" |
|
2665 | 3369 | export RC_STACK_RHODECODE_EXT="${RC_STACK_RHODECODE_EXT:-.custom/docker-compose-apps.override.yaml}" |
|
2666 | 3370 | |
|
2667 | 3371 | # src/initialize.sh |
|
2668 | 3372 | |
|
2669 | 3373 | ENV_FILE=$PWD/.env |
|
2670 | 3374 | |
|
2671 | 3375 | # bootstrap file is a config file at the same time |
|
2672 | BOOTSTRAP_FILE='.rccontrol-bootstrap' | |
|
2673 | 3376 | CONFIG_FILE='.rccontrol.ini' |
|
2674 | 3377 | |
|
3378 | # STACK_LIST | |
|
2675 | 3379 | VALID_SERVICES="router metrics services rhodecode" |
|
2676 | 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 | 3391 | #echo "1 ----" |
|
2679 | 3392 | #echo $RC_STACK_SERVICES_EXT |
|
2680 | 3393 | #echo $RC_STACK_METRICS_EXT |
|
2681 | 3394 | #echo "1 -----" |
|
2682 | 3395 | |
|
2683 | 3396 | #echo '2 ----' |
|
2684 | 3397 | #grep -v -e '^#' "$ENV_FILE" | xargs -I {} echo \'{}\' |
|
2685 | 3398 | #echo '2 ----' |
|
2686 | 3399 | |
|
2687 | 3400 | #expose env vars from rccontrol donfig |
|
2688 | 3401 | #if [[ -f $ENV_FILE ]]; then |
|
2689 | 3402 | # eval $(grep -v -e '^#' "$ENV_FILE" | xargs -I {} echo export \'{}\') |
|
2690 | 3403 | #fi |
|
2691 | 3404 | |
|
2692 | 3405 | #ENV_EXPAND="" |
|
2693 | 3406 | #for k in $(config_keys); do |
|
2694 | 3407 | # k_upper=${k^^} |
|
2695 | 3408 | # env_entry="-e $k_upper='$(config_get "$k")' " |
|
2696 | 3409 | # ENV_EXPAND+=$env_entry; |
|
2697 | 3410 | # #echo $env_expand |
|
2698 | 3411 | #done |
|
2699 | 3412 | |
|
2700 | 3413 | # |
|
2701 | 3414 | #echo "3 ----" |
|
2702 | 3415 | #echo $RC_STACK_SERVICES_EXT |
|
2703 | 3416 | #echo $RC_STACK_METRICS_EXT |
|
2704 | 3417 | #echo $RC_STACK_RHODECODE_EXT |
|
2705 | 3418 | #echo "3 -----" |
|
2706 | 3419 | |
|
2707 | 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 | 3427 | # backup files from a docker volume into /tmp/backup.tar.gz |
|
2710 | 3428 | docker-volume-backup-compressed() { |
|
2711 | 3429 | docker run --rm -v /tmp:/backup --volumes-from "$1" debian:jessie tar -czvf /backup/backup.tar.gz "${@:2}" |
|
2712 | 3430 | } |
|
2713 | 3431 | |
|
2714 | 3432 | # restore files from /tmp/backup.tar.gz into a docker volume |
|
2715 | 3433 | docker-volume-restore-compressed() { |
|
2716 | 3434 | docker run --rm -v /tmp:/backup --volumes-from "$1" debian:jessie tar -xzvf /backup/backup.tar.gz "${@:2}" |
|
2717 | 3435 | echo "Double checking files..." |
|
2718 | 3436 | docker run --rm -v /tmp:/backup --volumes-from "$1" debian:jessie ls -lh "${@:2}" |
|
2719 | 3437 | } |
|
2720 | 3438 | |
|
2721 | 3439 | # backup files from a docker volume into /tmp/backup.tar |
|
2722 | 3440 | docker-volume-backup() { |
|
2723 | 3441 | docker run --rm -v /tmp:/backup --volumes-from "$1" busybox tar -cvf /backup/backup.tar "${@:2}" |
|
2724 | 3442 | } |
|
2725 | 3443 | |
|
2726 | 3444 | # restore files from /tmp/backup.tar into a docker volume |
|
2727 | 3445 | docker-volume-restore() { |
|
2728 | 3446 | docker run --rm -v /tmp:/backup --volumes-from "$1" busybox tar -xvf /backup/backup.tar "${@:2}" |
|
2729 | 3447 | echo "Double checking files..." |
|
2730 | 3448 | docker run --rm -v /tmp:/backup --volumes-from "$1" busybox ls -lh "${@:2}" |
|
2731 | 3449 | } |
|
2732 | 3450 | |
|
2733 | 3451 | get_started() { |
|
2734 | 3452 | echo "" |
|
2735 | 3453 | echo "~~~~ $(green Bootstrap completed) ~~~~" |
|
2736 | 3454 | echo "To start using RhodeCode run the following stacks using ./rccontrol stack [STACK_NAME]" |
|
2737 | 3455 | echo "" |
|
2738 | 3456 | echo "$(yellow_bold [Optional]): run the edge router to control domain and SSL" |
|
2739 | 3457 | echo "./rccontrol stack router up --detach" |
|
2740 | 3458 | echo "" |
|
2741 | 3459 | echo "$(green_bold [Mandatory]): run the services, like database, redis, channelstream etc..." |
|
2742 | 3460 | echo "./rccontrol stack services up --detach" |
|
2743 | 3461 | echo "" |
|
2744 | 3462 | echo "$(green_bold [Mandatory]): run the rhodecode app stack" |
|
2745 | 3463 | echo "./rccontrol stack rhodecode up --detach" |
|
2746 | 3464 | echo "" |
|
2747 | 3465 | echo "$(yellow_bold [Optional]): run the monitoring stack, this includes grafana/promethues logging/metrics system" |
|
2748 | 3466 | echo "./rccontrol stack metrics up --detach" |
|
2749 | 3467 | echo "" |
|
2750 | 3468 | echo "check services status/ports" |
|
2751 | 3469 | echo "./rccontrol status" |
|
2752 | 3470 | } |
|
2753 | 3471 | } |
|
2754 | 3472 | |
|
2755 | 3473 | # :command.run |
|
2756 | 3474 | run() { |
|
2757 | 3475 | declare -A args=() |
|
2758 | 3476 | declare -a other_args=() |
|
2759 | 3477 | declare -a input=() |
|
2760 | 3478 | normalize_input "$@" |
|
2761 | 3479 | parse_requirements "${input[@]}" |
|
2762 | 3480 | |
|
2763 | 3481 | if [[ $action == "self-update" ]]; then |
|
2764 | 3482 | if [[ ${args[--help]:-} ]]; then |
|
2765 | 3483 | long_usage=yes |
|
2766 | 3484 | rccontrol_self_update_usage |
|
2767 | 3485 | else |
|
2768 | 3486 | rccontrol_self_update_command |
|
2769 | 3487 | fi |
|
2770 | 3488 | |
|
2771 | 3489 | elif [[ $action == "bootstrap" ]]; then |
|
2772 | 3490 | if [[ ${args[--help]:-} ]]; then |
|
2773 | 3491 | long_usage=yes |
|
2774 | 3492 | rccontrol_bootstrap_usage |
|
2775 | 3493 | else |
|
2776 | 3494 | rccontrol_bootstrap_command |
|
2777 | 3495 | fi |
|
2778 | 3496 | |
|
2779 | 3497 | elif [[ $action == "get-build-artifacts" ]]; then |
|
2780 | 3498 | if [[ ${args[--help]:-} ]]; then |
|
2781 | 3499 | long_usage=yes |
|
2782 | 3500 | rccontrol_get_build_artifacts_usage |
|
2783 | 3501 | else |
|
2784 | 3502 | rccontrol_get_build_artifacts_command |
|
2785 | 3503 | fi |
|
2786 | 3504 | |
|
2787 | 3505 | elif [[ $action == "build" ]]; then |
|
2788 | 3506 | if [[ ${args[--help]:-} ]]; then |
|
2789 | 3507 | long_usage=yes |
|
2790 | 3508 | rccontrol_build_usage |
|
2791 | 3509 | else |
|
2792 | 3510 | rccontrol_build_command |
|
2793 | 3511 | fi |
|
2794 | 3512 | |
|
2795 | 3513 | elif [[ $action == "get-build-source" ]]; then |
|
2796 | 3514 | if [[ ${args[--help]:-} ]]; then |
|
2797 | 3515 | long_usage=yes |
|
2798 | 3516 | rccontrol_get_build_source_usage |
|
2799 | 3517 | else |
|
2800 | 3518 | rccontrol_get_build_source_command |
|
2801 | 3519 | fi |
|
2802 | 3520 | |
|
2803 | 3521 | elif [[ $action == "build-source" ]]; then |
|
2804 | 3522 | if [[ ${args[--help]:-} ]]; then |
|
2805 | 3523 | long_usage=yes |
|
2806 | 3524 | rccontrol_build_source_usage |
|
2807 | 3525 | else |
|
2808 | 3526 | rccontrol_build_source_command |
|
2809 | 3527 | fi |
|
2810 | 3528 | |
|
2811 | 3529 | elif [[ $action == "stack" ]]; then |
|
2812 | 3530 | if [[ ${args[--help]:-} ]]; then |
|
2813 | 3531 | long_usage=yes |
|
2814 | 3532 | rccontrol_stack_usage |
|
2815 | 3533 | else |
|
2816 | 3534 | rccontrol_stack_command |
|
2817 | 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 | 3577 | elif [[ $action == "stack-status" ]]; then |
|
2820 | 3578 | if [[ ${args[--help]:-} ]]; then |
|
2821 | 3579 | long_usage=yes |
|
2822 | 3580 | rccontrol_stack_status_usage |
|
2823 | 3581 | else |
|
2824 | 3582 | rccontrol_stack_status_command |
|
2825 | 3583 | fi |
|
2826 | 3584 | |
|
2827 | 3585 | elif [[ $action == "stack-upgrade" ]]; then |
|
2828 | 3586 | if [[ ${args[--help]:-} ]]; then |
|
2829 | 3587 | long_usage=yes |
|
2830 | 3588 | rccontrol_stack_upgrade_usage |
|
2831 | 3589 | else |
|
2832 | 3590 | rccontrol_stack_upgrade_command |
|
2833 | 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 | 3602 | if [[ ${args[--help]:-} ]]; then |
|
2837 | 3603 | long_usage=yes |
|
2838 | 3604 | rccontrol_cli_redis_usage |
|
2839 | 3605 | else |
|
2840 | 3606 | rccontrol_cli_redis_command |
|
2841 | 3607 | fi |
|
2842 | 3608 | |
|
2843 |
elif [[ $action == "cli |
|
|
3609 | elif [[ $action == "cli db" ]]; then | |
|
2844 | 3610 | if [[ ${args[--help]:-} ]]; then |
|
2845 | 3611 | long_usage=yes |
|
2846 | 3612 | rccontrol_cli_db_usage |
|
2847 | 3613 | else |
|
2848 | 3614 | rccontrol_cli_db_command |
|
2849 | 3615 | fi |
|
2850 | 3616 | |
|
2851 |
elif [[ $action == "cli |
|
|
3617 | elif [[ $action == "cli db-upgrade" ]]; then | |
|
2852 | 3618 | if [[ ${args[--help]:-} ]]; then |
|
2853 | 3619 | long_usage=yes |
|
2854 | 3620 | rccontrol_cli_db_upgrade_usage |
|
2855 | 3621 | else |
|
2856 | 3622 | rccontrol_cli_db_upgrade_command |
|
2857 | 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 | 3633 | elif [[ $action == "_completions" ]]; then |
|
2860 | 3634 | if [[ ${args[--help]:-} ]]; then |
|
2861 | 3635 | long_usage=yes |
|
2862 | 3636 | rccontrol__completions_usage |
|
2863 | 3637 | else |
|
2864 | 3638 | rccontrol__completions_command |
|
2865 | 3639 | fi |
|
2866 | 3640 | |
|
2867 | 3641 | elif [[ $action == "backup-db" ]]; then |
|
2868 | 3642 | if [[ ${args[--help]:-} ]]; then |
|
2869 | 3643 | long_usage=yes |
|
2870 | 3644 | rccontrol_backup_db_usage |
|
2871 | 3645 | else |
|
2872 | 3646 | rccontrol_backup_db_command |
|
2873 | 3647 | fi |
|
2874 | 3648 | |
|
2875 | 3649 | elif [[ $action == "backup-data" ]]; then |
|
2876 | 3650 | if [[ ${args[--help]:-} ]]; then |
|
2877 | 3651 | long_usage=yes |
|
2878 | 3652 | rccontrol_backup_data_usage |
|
2879 | 3653 | else |
|
2880 | 3654 | rccontrol_backup_data_command |
|
2881 | 3655 | fi |
|
2882 | 3656 | |
|
2883 | 3657 | elif [[ $action == "root" ]]; then |
|
2884 | 3658 | root_command |
|
2885 | 3659 | fi |
|
2886 | 3660 | } |
|
2887 | 3661 | |
|
2888 | 3662 | initialize |
|
2889 | 3663 | run "$@" |
@@ -1,283 +1,283 b'' | |||
|
1 | 1 | FROM ubuntu:22.04 |
|
2 | 2 | # Using 22.04 LTS Release |
|
3 | 3 | MAINTAINER RhodeCode Inc. <support@rhodecode.com> |
|
4 | 4 | |
|
5 | 5 | ARG TZ="UTC" |
|
6 | 6 | ARG LOCALE_TYPE=en_US.UTF-8 |
|
7 | 7 | ARG RHODECODE_TYPE=Enterprise |
|
8 | 8 | # binary-install |
|
9 | 9 | ARG RHODECODE_VERSION=4.28.0 |
|
10 | 10 | |
|
11 | 11 | ARG RHODECODE_DB=sqlite |
|
12 | 12 | ARG RHODECODE_USER_NAME=admin |
|
13 | 13 | ARG RHODECODE_USER_PASS=secret4 |
|
14 |
ARG RHODECODE_USER_EMAIL= |
|
|
14 | ARG RHODECODE_USER_EMAIL=admin@server.local | |
|
15 | 15 | |
|
16 | 16 | # nix ver/channels |
|
17 | 17 | ARG DEV_NIX_VERSION=2.0.4 |
|
18 | 18 | ARG DEV_NIX_CHANNEL=nixos-18.03 |
|
19 | 19 | |
|
20 | 20 | # env are runtime |
|
21 | 21 | ENV \ |
|
22 | 22 | TZ=${TZ} \ |
|
23 | 23 | LOCALE_TYPE=${LOCALE_TYPE} \ |
|
24 | 24 | \ |
|
25 | 25 | ## Define type we build, and the instance we'll create |
|
26 | 26 | RHODECODE_TYPE=${RHODECODE_TYPE} \ |
|
27 | 27 | RC_TYPE_ID=enterprise-1 \ |
|
28 | 28 | \ |
|
29 | 29 | ## SETUP ARGS FOR INSTALLATION ## |
|
30 | 30 | ## set version we build on, get from .env or set default ver |
|
31 | 31 | RHODECODE_VERSION=${RHODECODE_VERSION} \ |
|
32 | 32 | \ |
|
33 | 33 | ## set DB, default sqlite |
|
34 | 34 | RHODECODE_DB=${RHODECODE_DB} \ |
|
35 | 35 | \ |
|
36 | 36 | ## set app bootstrap required data |
|
37 | 37 | RHODECODE_USER_NAME=${RHODECODE_USER_NAME} \ |
|
38 | 38 | RHODECODE_USER_PASS=${RHODECODE_USER_PASS} \ |
|
39 | 39 | RHODECODE_USER_EMAIL=${RHODECODE_USER_EMAIL} \ |
|
40 | 40 | \ |
|
41 | 41 | RC_USER=rhodecode \ |
|
42 | 42 | \ |
|
43 | 43 | # SVN CONFIG |
|
44 | 44 | MOD_DAV_SVN_CONF_FILE=/etc/rhodecode/conf/svn/mod_dav_svn.conf \ |
|
45 | 45 | MOD_DAV_SVN_PORT=8090 \ |
|
46 | 46 | \ |
|
47 | 47 | # SSHD CONFIG |
|
48 | 48 | SSHD_CONF_FILE=/etc/rhodecode/sshd_config \ |
|
49 | 49 | \ |
|
50 | 50 | SHARED_CONF_DIR=/etc/rhodecode/conf \ |
|
51 | 51 | BUILD_CONF=/etc/rhodecode/conf_build \ |
|
52 | 52 | BUILD_BIN_DIR=/usr/local/bin/rhodecode_bin \ |
|
53 | 53 | RHODECODE_DATA_DIR=/var/opt/rhodecode_data \ |
|
54 | 54 | RHODECODE_REPO_DIR=/var/opt/rhodecode_repo_store \ |
|
55 | 55 | RHODECODE_HTTP_PORT=10020 \ |
|
56 | 56 | RHODECODE_VCS_PORT=10010 \ |
|
57 | 57 | RHODECODE_HOST=0.0.0.0 \ |
|
58 | 58 | RHODECODE_VCS_HOST=127.0.0.1 |
|
59 | 59 | |
|
60 | 60 | ENV \ |
|
61 | 61 | RCCONTROL=/home/$RC_USER/.rccontrol-profile/bin/rccontrol \ |
|
62 | 62 | SUPERVISOR_CONF=/home/$RC_USER/.rccontrol/supervisor/supervisord.ini \ |
|
63 | 63 | # make application scripts visible |
|
64 | 64 | PATH=$PATH:/home/$RC_USER/.rccontrol-profile/bin |
|
65 | 65 | |
|
66 | 66 | ENV SVN_LOCALE_DEPS apache2 apache2-utils libapache2-mod-svn |
|
67 | 67 | ENV SSH_LOCALE_DEPS openssh-server |
|
68 | 68 | ENV PYTHON_DEPS python2 |
|
69 | 69 | ENV EXTRA_DEPS "" |
|
70 | 70 | |
|
71 | 71 | RUN \ |
|
72 | 72 | echo "** install base packages **" && \ |
|
73 | 73 | set -eux; \ |
|
74 | 74 | \ |
|
75 | 75 | savedAptMark="$(apt-mark showmanual)"; \ |
|
76 | 76 | apt-get update; \ |
|
77 | 77 | DEBIAN_FRONTEND="noninteractive" \ |
|
78 | 78 | apt-get install -y --no-install-recommends \ |
|
79 | 79 | tini \ |
|
80 | 80 | bash \ |
|
81 | 81 | binutils \ |
|
82 | 82 | tzdata \ |
|
83 | 83 | locales \ |
|
84 | 84 | openssl \ |
|
85 | 85 | curl \ |
|
86 | 86 | sudo \ |
|
87 | 87 | gosu \ |
|
88 | 88 | bzip2 \ |
|
89 | 89 | ca-certificates \ |
|
90 | 90 | $PYTHON_DEPS \ |
|
91 | 91 | $SSH_LOCALE_DEPS \ |
|
92 | 92 | $SVN_LOCALE_DEPS \ |
|
93 | 93 | $EXTRA_DEPS \ |
|
94 | 94 | ; \ |
|
95 | 95 | rm -rf /var/lib/apt/lists/*; |
|
96 | 96 | |
|
97 | 97 | RUN \ |
|
98 | 98 | echo "** Configure the python executable for py2/3 compat **" && \ |
|
99 | 99 | IS_PY=$(which python3 || which python2) && \ |
|
100 | 100 | if [ -n $IS_PY ] ; then ln -s $IS_PY /usr/bin/python ; fi |
|
101 | 101 | |
|
102 | 102 | RUN \ |
|
103 | 103 | echo "** Configure the locales **" && \ |
|
104 | 104 | sed -i "s/^# ${LOCALE_TYPE}/${LOCALE_TYPE}/g" /etc/locale.gen && \ |
|
105 | 105 | locale-gen |
|
106 | 106 | |
|
107 | 107 | # locale-archive is a fix for old nix glibc2.26 locales available |
|
108 | 108 | ENV \ |
|
109 | 109 | LOCALE_ARCHIVE=/var/opt/locale-archive \ |
|
110 | 110 | LANG=${LOCALE_TYPE} \ |
|
111 | 111 | LANGUAGE=${LOCALE_TYPE} \ |
|
112 | 112 | LC_ALL=${LOCALE_TYPE} |
|
113 | 113 | |
|
114 | 114 | # configure the system user |
|
115 | 115 | # explicitly set uid/gid to guarantee that it won't change in the future |
|
116 | 116 | # the values 999:999 are identical to the current user/group id assigned |
|
117 | 117 | RUN \ |
|
118 | 118 | echo "** Create system user $RC_USER **" && \ |
|
119 | 119 | groupadd --system --gid 999 $RC_USER && \ |
|
120 | 120 | useradd --system --gid $RC_USER --uid 999 --shell /bin/bash $RC_USER && \ |
|
121 | 121 | usermod -G $RC_USER $RC_USER |
|
122 | 122 | |
|
123 | 123 | RUN \ |
|
124 | 124 | echo "** Create nix-build user $NIX_BLD_USER **" && \ |
|
125 | 125 | groupadd --system --gid 1099 $NIX_BLD_USER && \ |
|
126 | 126 | useradd --system --gid $NIX_BLD_USER --uid 1099 --shell /bin/bash $NIX_BLD_USER && \ |
|
127 | 127 | usermod -G $NIX_BLD_USER $NIX_BLD_USER |
|
128 | 128 | |
|
129 | 129 | RUN \ |
|
130 | 130 | echo "** disable nix sandboxing **" && \ |
|
131 | 131 | mkdir /etc/nix && echo 'sandbox = false' > /etc/nix/nix.conf |
|
132 | 132 | |
|
133 | 133 | |
|
134 | 134 | # set the defult bash shell |
|
135 | 135 | SHELL ["/bin/bash", "-c"] |
|
136 | 136 | |
|
137 | 137 | # Fix and set a timezone |
|
138 | 138 | RUN \ |
|
139 | 139 | echo "** configure the timezone **" && \ |
|
140 | 140 | rm /etc/localtime && cp /usr/share/zoneinfo/$TZ /etc/localtime && \ |
|
141 | 141 | echo $TZ > /etc/timezone |
|
142 | 142 | |
|
143 | 143 | |
|
144 | 144 | RUN \ |
|
145 | 145 | echo "** prepare rhodecode store and cache **" && \ |
|
146 | 146 | install -d -m 0700 -o $RC_USER -g $RC_USER /nix && \ |
|
147 | 147 | install -d -m 0755 -o $RC_USER -g $RC_USER /opt/rhodecode && \ |
|
148 | 148 | install -d -m 0755 -o $RC_USER -g $RC_USER /usr/local/bin/rhodecode_bin && \ |
|
149 | 149 | install -d -m 0755 -o $RC_USER -g $RC_USER $RHODECODE_REPO_DIR && \ |
|
150 | 150 | install -d -m 0755 -o $RC_USER -g $RC_USER $RHODECODE_DATA_DIR && \ |
|
151 | 151 | install -d -m 0755 -o $RC_USER -g $RC_USER $BUILD_CONF && \ |
|
152 | 152 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/rhodecode-vcsserver && \ |
|
153 | 153 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/rhodecode-enterprise-ce && \ |
|
154 | 154 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/rhodecode-enterprise-ee && \ |
|
155 | 155 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/ && \ |
|
156 | 156 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/.rccontrol && \ |
|
157 | 157 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/.rccontrol/cache && \ |
|
158 | 158 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/.rccontrol/bootstrap && \ |
|
159 | 159 | install -d -m 0700 -o $RC_USER -g $RC_USER /home/$RC_USER/.ssh && \ |
|
160 | 160 | install -d -m 0700 -o $RC_USER -g $RC_USER /home/$RC_USER/.rhoderc |
|
161 | 161 | |
|
162 | 162 | # expose our custom sshd config |
|
163 | 163 | COPY service/sshd/sshd_config $SSHD_CONF_FILE |
|
164 | 164 | |
|
165 | 165 | # Apache SVN setup |
|
166 | 166 | RUN \ |
|
167 | 167 | echo "**** Apache config cleanup ****" && \ |
|
168 | 168 | rm -f /etc/apache2/conf.d/info.conf \ |
|
169 | 169 | /etc/apache2/conf.d/mpm.conf \ |
|
170 | 170 | /etc/apache2/conf.d/userdir.conf && \ |
|
171 | 171 | rm -f /etc/apache2/sites-enabled/* && \ |
|
172 | 172 | rm -f /etc/apache2/sites-available/* |
|
173 | 173 | |
|
174 | 174 | # custom SVN virtualhost |
|
175 | 175 | COPY service/svn/virtualhost.conf /etc/apache2/sites-enabled/ |
|
176 | 176 | |
|
177 | 177 | RUN \ |
|
178 | 178 | echo "**** Apache config ****" && \ |
|
179 | 179 | echo $(strings /usr/lib/apache2/modules/mod_dav_svn.so | grep 'Powered by') > /var/opt/dav.version && \ |
|
180 | 180 | mkdir -p /run/apache2 && \ |
|
181 | 181 | mkdir -p /var/opt/www && \ |
|
182 | 182 | echo "unset HOME" > /etc/apache2/envvars && \ |
|
183 | 183 | echo "export APACHE_RUN_USER=${RC_USER}" >> /etc/apache2/envvars && \ |
|
184 | 184 | echo "export APACHE_PID_FILE=/var/run/apache2/apache2.pid" >> /etc/apache2/envvars && \ |
|
185 | 185 | echo "export APACHE_RUN_DIR=/var/run/apache2" >> /etc/apache2/envvars && \ |
|
186 | 186 | echo "export APACHE_LOCK_DIR=/var/lock/apache2" >> /etc/apache2/envvars && \ |
|
187 | 187 | echo "export APACHE_RUN_USER=${RC_USER}" >> /etc/apache2/envvars && \ |
|
188 | 188 | echo "export APACHE_RUN_GROUP=${RC_USER}" >> /etc/apache2/envvars && \ |
|
189 | 189 | sed -i "s/Listen 80/Listen ${MOD_DAV_SVN_PORT}/g" /etc/apache2/ports.conf |
|
190 | 190 | |
|
191 | 191 | |
|
192 | 192 | # Copy artifacts |
|
193 | 193 | |
|
194 | 194 | COPY --chown=$RC_USER:$RC_USER .cache/* /home/$RC_USER/.rccontrol/cache/ |
|
195 | 195 | COPY --chown=$RC_USER:$RC_USER config/_shared/rhodecode_enterprise.license /home/$RC_USER/.rccontrol/bootstrap/ |
|
196 | 196 | COPY --chown=$RC_USER:$RC_USER service/rhodecode/bootstrap/* /home/$RC_USER/.rccontrol/bootstrap/ |
|
197 | 197 | |
|
198 | 198 | RUN \ |
|
199 | 199 | echo "**** locale-archive path ****" && \ |
|
200 | 200 | mv -v /home/$RC_USER/.rccontrol/cache/locale-archive /var/opt/locale-archive |
|
201 | 201 | |
|
202 | 202 | # change to non-root user for RUN commands |
|
203 | 203 | USER $RC_USER |
|
204 | 204 | WORKDIR /home/$RC_USER |
|
205 | 205 | |
|
206 | 206 | RUN \ |
|
207 | 207 | echo "** install rhodecode control **" && \ |
|
208 | 208 | cd /home/$RC_USER/.rccontrol/cache && \ |
|
209 | 209 | INSTALLER=$(ls -Art /home/$RC_USER/.rccontrol/cache/RhodeCode-installer-* | tail -n 1) && \ |
|
210 | 210 | chmod +x ${INSTALLER} && \ |
|
211 | 211 | ${INSTALLER} --accept-license && \ |
|
212 | 212 | ${RCCONTROL} self-init && \ |
|
213 | 213 | cp -v /home/$RC_USER/.rccontrol-profile/etc/ca-bundle.crt $BUILD_CONF/ && \ |
|
214 | 214 | echo "Done installing rhodecode control" |
|
215 | 215 | |
|
216 | 216 | RUN \ |
|
217 | 217 | echo "** install vcsserver ${RHODECODE_VERSION} **" && \ |
|
218 | 218 | ${RCCONTROL} install VCSServer --version ${RHODECODE_VERSION} --start-at-boot=yes --accept-license --offline \ |
|
219 | 219 | '{"host":"'"$RHODECODE_VCS_HOST"'", "port":"'"$RHODECODE_VCS_PORT"'"}' && \ |
|
220 | 220 | VCSSERVER_PATH=/home/$RC_USER/.rccontrol/vcsserver-1 && \ |
|
221 | 221 | rm -rf $BUILD_BIN_DIR/vcs_bin && \ |
|
222 | 222 | ln -s ${VCSSERVER_PATH}/profile/bin $BUILD_BIN_DIR/vcs_bin && \ |
|
223 | 223 | cp -v ${VCSSERVER_PATH}/vcsserver.ini $BUILD_CONF/vcsserver.ini && \ |
|
224 | 224 | cp -v ${VCSSERVER_PATH}/gunicorn_conf.py $BUILD_CONF/gunicorn_conf_vcs.py && \ |
|
225 | 225 | echo "Done installing vcsserver" |
|
226 | 226 | |
|
227 | 227 | RUN \ |
|
228 | 228 | echo "** install rhodecode ${RHODECODE_TYPE} ${RHODECODE_VERSION} **" && \ |
|
229 | 229 | RHODECODE_DB_INIT=sqlite && \ |
|
230 | 230 | ${RCCONTROL} install ${RHODECODE_TYPE} --version ${RHODECODE_VERSION} --start-at-boot=yes --accept-license --offline \ |
|
231 | 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 | 232 | RHODECODE_PATH=/home/$RC_USER/.rccontrol/${RC_TYPE_ID} && \ |
|
233 | 233 | rm -rf $BUILD_BIN_DIR/bin && ln -s ${RHODECODE_PATH}/profile/bin $BUILD_BIN_DIR/ && \ |
|
234 | 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 | 236 | cp -v ${RHODECODE_PATH}/search_mapping.ini $BUILD_CONF/search_mapping.ini && \ |
|
237 | 237 | mkdir -p $RHODECODE_DATA_DIR/static && cp -r ${RHODECODE_PATH}/public/* $RHODECODE_DATA_DIR/static/ && \ |
|
238 | 238 | rm ${RHODECODE_PATH}/rhodecode.db && \ |
|
239 | 239 | echo "Done installing rhodecode" |
|
240 | 240 | |
|
241 | 241 | |
|
242 | 242 | RUN \ |
|
243 | 243 | echo "** configure supervisord **" && \ |
|
244 | 244 | cp -v ${SUPERVISOR_CONF} $BUILD_CONF/ && \ |
|
245 | 245 | sed -i "s/self_managed_supervisor = False/self_managed_supervisor = True/g" /home/$RC_USER/.rccontrol.ini && \ |
|
246 | 246 | echo "Done installing supervisord" |
|
247 | 247 | |
|
248 | 248 | USER root |
|
249 | 249 | |
|
250 | 250 | RUN \ |
|
251 | 251 | echo "**** cleanup ****" && \ |
|
252 | 252 | apt-get remove -y $PYTHON_DEPS && \ |
|
253 | 253 | apt-get autoclean -y && \ |
|
254 | 254 | rm -f /tmp/* && \ |
|
255 | 255 | rm -rf /var/lib/apt/lists/* && \ |
|
256 | 256 | rm -rf /var/cache/apk/* && \ |
|
257 | 257 | rm -f /home/$RC_USER/.rccontrol/cache/RhodeCode-installer-* && \ |
|
258 | 258 | rm -f /home/$RC_USER/.rccontrol/cache/*.bz2 && \ |
|
259 | 259 | rm -f ${SUPERVISOR_CONF} && \ |
|
260 | 260 | echo "Done cleanup" |
|
261 | 261 | |
|
262 | 262 | |
|
263 | 263 | # copy entrypoints |
|
264 | 264 | COPY entrypoints.d/entrypoint.sh /opt/entrypoints.d/entrypoint.sh |
|
265 | 265 | |
|
266 | 266 | RUN chmod +x /opt/entrypoints.d/entrypoint.sh |
|
267 | 267 | |
|
268 | 268 | # config volume |
|
269 | 269 | VOLUME /etc/rhodecode/conf |
|
270 | 270 | |
|
271 | 271 | # repo store volume |
|
272 | 272 | VOLUME /var/opt/rhodecode_repo_store |
|
273 | 273 | |
|
274 | 274 | # data volume |
|
275 | 275 | VOLUME /var/opt/rhodecode_data |
|
276 | 276 | |
|
277 | 277 | # logs volume |
|
278 | 278 | VOLUME /var/log/rhodecode |
|
279 | 279 | |
|
280 | 280 | ENTRYPOINT ["/opt/entrypoints.d/entrypoint.sh"] |
|
281 | 281 | |
|
282 | 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 | 1 | FROM ubuntu:22.04 |
|
2 | 2 | # Using 22.04 LTS Release |
|
3 | 3 | MAINTAINER RhodeCode Inc. <support@rhodecode.com> |
|
4 | 4 | |
|
5 | 5 | ARG TZ="UTC" |
|
6 | 6 | ARG LOCALE_TYPE=en_US.UTF-8 |
|
7 | 7 | ARG RHODECODE_TYPE=Enterprise |
|
8 | 8 | # source-install |
|
9 | 9 | ARG RHODECODE_VERSION=4.28.0 |
|
10 | 10 | |
|
11 | 11 | ARG RHODECODE_DB=sqlite |
|
12 | 12 | ARG RHODECODE_USER_NAME=admin |
|
13 | 13 | ARG RHODECODE_USER_PASS=secret4 |
|
14 |
ARG RHODECODE_USER_EMAIL= |
|
|
14 | ARG RHODECODE_USER_EMAIL=admin@server.local | |
|
15 | 15 | |
|
16 | 16 | # nix ver/channels |
|
17 | 17 | ARG DEV_NIX_VERSION=2.0.4 |
|
18 | 18 | ARG DEV_NIX_CHANNEL=nixos-18.03 |
|
19 | 19 | |
|
20 | 20 | # env are runtime |
|
21 | 21 | ENV \ |
|
22 | 22 | TZ=${TZ} \ |
|
23 | 23 | LOCALE_TYPE=${LOCALE_TYPE} \ |
|
24 | 24 | \ |
|
25 | 25 | ## Define type we build, and the instance we'll create |
|
26 | 26 | RHODECODE_TYPE=${RHODECODE_TYPE} \ |
|
27 | 27 | RC_TYPE_ID=enterprise-1 \ |
|
28 | 28 | \ |
|
29 | 29 | ## SETUP ARGS FOR INSTALLATION ## |
|
30 | 30 | ## set version we build on, get from .env or set default ver |
|
31 | 31 | RHODECODE_VERSION=${RHODECODE_VERSION} \ |
|
32 | 32 | \ |
|
33 | 33 | ## set DB, default sqlite |
|
34 | 34 | RHODECODE_DB=${RHODECODE_DB} \ |
|
35 | 35 | \ |
|
36 | 36 | ## set app bootstrap required data |
|
37 | 37 | RHODECODE_USER_NAME=${RHODECODE_USER_NAME} \ |
|
38 | 38 | RHODECODE_USER_PASS=${RHODECODE_USER_PASS} \ |
|
39 | 39 | RHODECODE_USER_EMAIL=${RHODECODE_USER_EMAIL} \ |
|
40 | 40 | \ |
|
41 | 41 | RC_USER=rhodecode \ |
|
42 | 42 | \ |
|
43 | 43 | # SVN CONFIG |
|
44 | 44 | MOD_DAV_SVN_CONF_FILE=/etc/rhodecode/conf/svn/mod_dav_svn.conf \ |
|
45 | 45 | MOD_DAV_SVN_PORT=8090 \ |
|
46 | 46 | \ |
|
47 | 47 | # SSHD CONFIG |
|
48 | 48 | SSHD_CONF_FILE=/etc/rhodecode/sshd_config \ |
|
49 | 49 | \ |
|
50 | 50 | SHARED_CONF_DIR=/etc/rhodecode/conf \ |
|
51 | 51 | BUILD_CONF=/etc/rhodecode/conf_build \ |
|
52 | 52 | BUILD_BIN_DIR=/usr/local/bin/rhodecode_bin \ |
|
53 | 53 | RHODECODE_DATA_DIR=/var/opt/rhodecode_data \ |
|
54 | 54 | RHODECODE_REPO_DIR=/var/opt/rhodecode_repo_store \ |
|
55 | 55 | RHODECODE_HTTP_PORT=10020 \ |
|
56 | 56 | RHODECODE_VCS_PORT=10010 \ |
|
57 | 57 | RHODECODE_HOST=0.0.0.0 \ |
|
58 | 58 | RHODECODE_VCS_HOST=127.0.0.1 |
|
59 | 59 | |
|
60 | 60 | ENV \ |
|
61 | 61 | RCCONTROL=/home/$RC_USER/.rccontrol-profile/bin/rccontrol \ |
|
62 | 62 | SUPERVISOR_CONF=/home/$RC_USER/.rccontrol/supervisor/supervisord.ini \ |
|
63 | 63 | # make application scripts visible |
|
64 | 64 | PATH=$PATH:/home/$RC_USER/.rccontrol-profile/bin |
|
65 | 65 | |
|
66 | 66 | ENV SVN_LOCALE_DEPS apache2 apache2-utils libapache2-mod-svn |
|
67 | 67 | ENV SSH_LOCALE_DEPS openssh-server |
|
68 | 68 | ENV PYTHON_DEPS python2 |
|
69 |
ENV EXTRA_DEPS |
|
|
69 | ENV EXTRA_DEPS "" | |
|
70 | 70 | |
|
71 | 71 | ENV \ |
|
72 | 72 | PATH=$PATH:/nix/var/nix/profiles/per-user/$RC_USER/profile/bin:/home/$RC_USER/rhodecode-enterprise-ee/profile/bin \ |
|
73 | 73 | NIX_BLD_USER=nixbld \ |
|
74 | 74 | NIX_PATH=/nix/var/nix/profiles/per-user/$RC_USER/channels \ |
|
75 | 75 | NIX_SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt |
|
76 | 76 | |
|
77 | 77 | |
|
78 | 78 | RUN \ |
|
79 | 79 | echo "** install base packages **" && \ |
|
80 | 80 | set -eux; \ |
|
81 | 81 | \ |
|
82 | 82 | savedAptMark="$(apt-mark showmanual)"; \ |
|
83 | 83 | apt-get update; \ |
|
84 | 84 | DEBIAN_FRONTEND="noninteractive" \ |
|
85 | 85 | apt-get install -y --no-install-recommends \ |
|
86 | 86 | tini \ |
|
87 | 87 | bash \ |
|
88 | 88 | binutils \ |
|
89 | 89 | tzdata \ |
|
90 | 90 | locales \ |
|
91 | 91 | openssl \ |
|
92 | 92 | curl \ |
|
93 | 93 | sudo \ |
|
94 | 94 | gosu \ |
|
95 | 95 | bzip2 \ |
|
96 | 96 | ca-certificates \ |
|
97 | 97 | $PYTHON_DEPS \ |
|
98 | 98 | $SSH_LOCALE_DEPS \ |
|
99 | 99 | $SVN_LOCALE_DEPS \ |
|
100 | 100 | $EXTRA_DEPS \ |
|
101 | 101 | ; \ |
|
102 | 102 | rm -rf /var/lib/apt/lists/*; |
|
103 | 103 | |
|
104 | 104 | RUN \ |
|
105 | 105 | echo "** Configure the python executable for py2/3 compat **" && \ |
|
106 | 106 | IS_PY=$(which python3 || which python2) && \ |
|
107 | 107 | if [ -n $IS_PY ] ; then ln -s $IS_PY /usr/bin/python ; fi |
|
108 | 108 | |
|
109 | 109 | RUN \ |
|
110 | 110 | echo "** Configure the locales **" && \ |
|
111 | 111 | sed -i "s/^# ${LOCALE_TYPE}/${LOCALE_TYPE}/g" /etc/locale.gen && \ |
|
112 | 112 | locale-gen |
|
113 | 113 | |
|
114 | 114 | # locale-archive is a fix for old nix glibc2.26 locales available |
|
115 | 115 | ENV \ |
|
116 | 116 | LOCALE_ARCHIVE=/var/opt/locale-archive \ |
|
117 | 117 | LANG=${LOCALE_TYPE} \ |
|
118 | 118 | LANGUAGE=${LOCALE_TYPE} \ |
|
119 | 119 | LC_ALL=${LOCALE_TYPE} |
|
120 | 120 | |
|
121 | 121 | # configure the system user |
|
122 | 122 | # explicitly set uid/gid to guarantee that it won't change in the future |
|
123 | 123 | # the values 999:999 are identical to the current user/group id assigned |
|
124 | 124 | RUN \ |
|
125 | 125 | echo "** Create system user $RC_USER **" && \ |
|
126 | 126 | groupadd --system --gid 999 $RC_USER && \ |
|
127 | 127 | useradd --system --gid $RC_USER --uid 999 --shell /bin/bash $RC_USER && \ |
|
128 | 128 | usermod -G $RC_USER $RC_USER |
|
129 | 129 | |
|
130 | 130 | RUN \ |
|
131 | 131 | echo "** Create nix-build user $NIX_BLD_USER **" && \ |
|
132 | 132 | groupadd --system --gid 1099 $NIX_BLD_USER && \ |
|
133 | 133 | useradd --system --gid $NIX_BLD_USER --uid 1099 --shell /bin/bash $NIX_BLD_USER && \ |
|
134 | 134 | usermod -G $NIX_BLD_USER $NIX_BLD_USER |
|
135 | 135 | |
|
136 | 136 | RUN \ |
|
137 | 137 | echo "** disable nix sandboxing **" && \ |
|
138 | 138 | mkdir /etc/nix && echo 'sandbox = false' > /etc/nix/nix.conf |
|
139 | 139 | |
|
140 | 140 | |
|
141 | 141 | # set the defult bash shell |
|
142 | 142 | SHELL ["/bin/bash", "-c"] |
|
143 | 143 | |
|
144 | 144 | # Fix and set a timezone |
|
145 | 145 | RUN \ |
|
146 | 146 | echo "** configure the timezone **" && \ |
|
147 | 147 | rm /etc/localtime && cp /usr/share/zoneinfo/$TZ /etc/localtime && \ |
|
148 | 148 | echo $TZ > /etc/timezone |
|
149 | 149 | |
|
150 | 150 | |
|
151 | 151 | RUN \ |
|
152 | 152 | echo "** prepare rhodecode store and cache **" && \ |
|
153 | 153 | install -d -m 0700 -o $RC_USER -g $RC_USER /nix && \ |
|
154 | 154 | install -d -m 0755 -o $RC_USER -g $RC_USER /opt/rhodecode && \ |
|
155 | 155 | install -d -m 0755 -o $RC_USER -g $RC_USER /usr/local/bin/rhodecode_bin && \ |
|
156 | 156 | install -d -m 0755 -o $RC_USER -g $RC_USER $RHODECODE_REPO_DIR && \ |
|
157 | 157 | install -d -m 0755 -o $RC_USER -g $RC_USER $RHODECODE_DATA_DIR && \ |
|
158 | 158 | install -d -m 0755 -o $RC_USER -g $RC_USER $BUILD_CONF && \ |
|
159 | 159 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/rhodecode-vcsserver && \ |
|
160 | 160 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/rhodecode-enterprise-ce && \ |
|
161 | 161 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/rhodecode-enterprise-ee && \ |
|
162 | 162 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/ && \ |
|
163 | 163 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/.rccontrol && \ |
|
164 | 164 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/.rccontrol/cache && \ |
|
165 | 165 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/.rccontrol/bootstrap && \ |
|
166 | 166 | install -d -m 0700 -o $RC_USER -g $RC_USER /home/$RC_USER/.ssh && \ |
|
167 | 167 | install -d -m 0700 -o $RC_USER -g $RC_USER /home/$RC_USER/.rhoderc |
|
168 | 168 | |
|
169 | 169 | # expose our custom sshd config |
|
170 | 170 | COPY service/sshd/sshd_config $SSHD_CONF_FILE |
|
171 | 171 | |
|
172 | 172 | # Apache SVN setup |
|
173 | 173 | RUN \ |
|
174 | 174 | echo "**** Apache config cleanup ****" && \ |
|
175 | 175 | rm -f /etc/apache2/conf.d/info.conf \ |
|
176 | 176 | /etc/apache2/conf.d/mpm.conf \ |
|
177 | 177 | /etc/apache2/conf.d/userdir.conf && \ |
|
178 | 178 | rm -f /etc/apache2/sites-enabled/* && \ |
|
179 | 179 | rm -f /etc/apache2/sites-available/* |
|
180 | 180 | |
|
181 | 181 | # custom SVN virtualhost |
|
182 | 182 | COPY service/svn/virtualhost.conf /etc/apache2/sites-enabled/ |
|
183 | 183 | |
|
184 | 184 | RUN \ |
|
185 | 185 | echo "**** Apache config ****" && \ |
|
186 | 186 | echo $(strings /usr/lib/apache2/modules/mod_dav_svn.so | grep 'Powered by') > /var/opt/dav.version && \ |
|
187 | 187 | mkdir -p /run/apache2 && \ |
|
188 | 188 | mkdir -p /var/opt/www && \ |
|
189 | 189 | echo "unset HOME" > /etc/apache2/envvars && \ |
|
190 | 190 | echo "export APACHE_RUN_USER=${RC_USER}" >> /etc/apache2/envvars && \ |
|
191 | 191 | echo "export APACHE_PID_FILE=/var/run/apache2/apache2.pid" >> /etc/apache2/envvars && \ |
|
192 | 192 | echo "export APACHE_RUN_DIR=/var/run/apache2" >> /etc/apache2/envvars && \ |
|
193 | 193 | echo "export APACHE_LOCK_DIR=/var/lock/apache2" >> /etc/apache2/envvars && \ |
|
194 | 194 | echo "export APACHE_RUN_USER=${RC_USER}" >> /etc/apache2/envvars && \ |
|
195 | 195 | echo "export APACHE_RUN_GROUP=${RC_USER}" >> /etc/apache2/envvars && \ |
|
196 | 196 | sed -i "s/Listen 80/Listen ${MOD_DAV_SVN_PORT}/g" /etc/apache2/ports.conf |
|
197 | 197 | |
|
198 | 198 | |
|
199 | 199 | # Copy artifacts |
|
200 | 200 | |
|
201 | 201 | COPY --chown=$RC_USER:$RC_USER .cache/* /home/$RC_USER/.rccontrol/cache/ |
|
202 | 202 | COPY --chown=$RC_USER:$RC_USER config/_shared/rhodecode_enterprise.license /home/$RC_USER/.rccontrol/bootstrap/ |
|
203 | 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 | 209 | COPY --chown=$RC_USER:$RC_USER .source/ /home/$RC_USER/ |
|
206 | 210 | RUN \ |
|
207 | 211 | echo "** prepare rhodecode dirs **" && \ |
|
208 | 212 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/.rccontrol/vcsserver-1 && \ |
|
209 | 213 | install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/.rccontrol/community-1 && \ |
|
210 | 214 |
install -d -m 0755 -o $RC_USER -g $RC_USER /home/$RC_USER/.rccontrol/enterprise-1 && \ |
|
211 | ||
|
212 | RUN \ | |
|
213 | echo "**** locale-archive path ****" && \ | |
|
214 | mv -v /home/$RC_USER/.rccontrol/cache/locale-archive /var/opt/locale-archive | |
|
215 | echo "Done rhodecode dirs" | |
|
215 | 216 | |
|
216 | 217 | # change to non-root user for RUN commands |
|
217 | 218 | USER $RC_USER |
|
218 | 219 | WORKDIR /home/$RC_USER |
|
219 | 220 | |
|
220 | 221 | |
|
221 | 222 | RUN \ |
|
222 | 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 | 227 | RUN \ |
|
226 | 228 | echo "** update nix package database and set channel to $DEV_NIX_CHANNEL **" && \ |
|
227 | 229 | . /home/rhodecode/.nix-profile/etc/profile.d/nix.sh && \ |
|
228 | 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 | 235 | RUN \ |
|
233 | 236 | echo "** save nix config **" && \ |
|
234 | 237 | touch /home/$RC_USER/.rhoderc && \ |
|
235 | 238 | mkdir -p /home/$RC_USER/.nixpkgs && touch /home/$RC_USER/.nixpkgs/config.nix && \ |
|
236 | 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 | 242 | RUN \ |
|
240 | 243 | echo "** install rhodecode control **" && \ |
|
241 | 244 | # cd /home/$RC_USER/.rccontrol/cache && \ |
|
242 | 245 | # INSTALLER=$(ls -Art /home/$RC_USER/.rccontrol/cache/RhodeCode-installer-* | tail -n 1) && \ |
|
243 | 246 | # chmod +x ${INSTALLER} && \ |
|
244 | 247 | # ${INSTALLER} --accept-license && \ |
|
245 | 248 | # ${RCCONTROL} self-init && \ |
|
246 | 249 | # cp -v /home/$RC_USER/.rccontrol-profile/etc/ca-bundle.crt $BUILD_CONF/ && \ |
|
247 | 250 | echo "Done installing rhodecode control" |
|
248 | 251 | |
|
249 | 252 | RUN \ |
|
250 | 253 | echo "** install vcsserver ${RHODECODE_VERSION} **" && \ |
|
251 | 254 | . /home/rhodecode/.nix-profile/etc/profile.d/nix.sh && \ |
|
252 | 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 | 256 | nix-shell --command 'echo COMMAND FROM NIX-SHELL TEST' rhodecode-vcsserver/default.nix && \ |
|
254 | 257 | VCSSERVER_PATH=/home/$RC_USER/rhodecode-vcsserver && \ |
|
255 | 258 | rm -rf $BUILD_BIN_DIR/vcs_bin && \ |
|
256 | 259 | cp -rv --preserve=links /home/$RC_USER/.rccontrol/vcsserver-1/profile/bin $BUILD_BIN_DIR/vcs_bin && \ |
|
257 | 260 | cp -v ${VCSSERVER_PATH}/configs/production.ini $BUILD_CONF/vcsserver.ini && \ |
|
258 | 261 | cp -v ${VCSSERVER_PATH}/configs/gunicorn_config.py $BUILD_CONF/gunicorn_conf_vcs.py && \ |
|
259 | 262 | echo "Done installing vcsserver" |
|
260 | 263 | |
|
261 | 264 | RUN \ |
|
262 | 265 | echo "** install build Community ${RHODECODE_VERSION} **" && \ |
|
263 | 266 | . /home/rhodecode/.nix-profile/etc/profile.d/nix.sh && \ |
|
264 | 267 | echo "done" |
|
265 | 268 | |
|
266 | 269 | RUN \ |
|
267 | 270 | echo "** install rhodecode ${RHODECODE_VERSION} **" && \ |
|
268 | 271 | . /home/rhodecode/.nix-profile/etc/profile.d/nix.sh && \ |
|
269 | 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 | 273 | nix-shell --command 'echo ok' rhodecode-enterprise-ee/default.nix && \ |
|
271 | 274 | RHODECODE_PATH=/home/$RC_USER/rhodecode-enterprise-ee && \ |
|
272 | 275 | rm -rf $BUILD_BIN_DIR/bin && \ |
|
273 | 276 | cp -rv --preserve=links /home/$RC_USER/.rccontrol/enterprise-1/profile/bin $BUILD_BIN_DIR/ && \ |
|
274 | 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 | 279 | mkdir -p $RHODECODE_DATA_DIR/static && cp -r /home/$RC_USER/.rccontrol/enterprise-1/profile/etc/static/* $RHODECODE_DATA_DIR/static/ && \ |
|
277 | 280 | echo "Done installing rhodecode" |
|
278 | 281 | |
|
279 | 282 | |
|
280 | 283 | RUN \ |
|
281 | 284 | echo "** configure supervisord **" && \ |
|
282 | 285 | #cp -v ${SUPERVISOR_CONF} $BUILD_CONF/ && \ |
|
283 | 286 | #sed -i "s/self_managed_supervisor = False/self_managed_supervisor = True/g" /home/$RC_USER/.rccontrol.ini && \ |
|
284 | 287 | echo "Done installing supervisord" |
|
285 | 288 | |
|
286 | 289 | USER root |
|
287 | 290 | |
|
288 | 291 | RUN \ |
|
289 | 292 | echo "**** cleanup ****" && \ |
|
290 | 293 | apt-get remove -y $PYTHON_DEPS && \ |
|
291 | 294 | apt-get autoclean -y && \ |
|
292 | 295 | rm -f /tmp/* && \ |
|
293 | 296 | rm -f /home/$RC_USER/.rccontrol/cache/RhodeCode-installer-* && \ |
|
294 | 297 | rm -f /home/$RC_USER/.rccontrol/cache/*.bz2 && \ |
|
295 | 298 | rm -rf /var/lib/apt/lists/* && \ |
|
296 | 299 | rm -rf /var/cache/apk/* && \ |
|
297 | 300 | rm -f ${SUPERVISOR_CONF} && \ |
|
298 | 301 | rm -rf /home/$RC_USER/rhodecode-vcsserver && \ |
|
299 | 302 | rm -rf /home/$RC_USER/rhodecode-enterprise-ce && \ |
|
300 | 303 | rm -rf /home/$RC_USER/rhodecode-enterprise-ee && \ |
|
301 | 304 | echo "Done cleanup" |
|
302 | 305 | |
|
303 | 306 | |
|
304 | 307 | # copy entrypoints |
|
305 | 308 | COPY entrypoints.d/entrypoint.sh /opt/entrypoints.d/entrypoint.sh |
|
306 | 309 | |
|
307 | 310 | RUN chmod +x /opt/entrypoints.d/entrypoint.sh |
|
308 | 311 | |
|
309 | 312 | # config volume |
|
310 | 313 | VOLUME /etc/rhodecode/conf |
|
311 | 314 | |
|
312 | 315 | # repo store volume |
|
313 | 316 | VOLUME /var/opt/rhodecode_repo_store |
|
314 | 317 | |
|
315 | 318 | # data volume |
|
316 | 319 | VOLUME /var/opt/rhodecode_data |
|
317 | 320 | |
|
318 | 321 | # logs volume |
|
319 | 322 | VOLUME /var/log/rhodecode |
|
320 | 323 | |
|
321 | 324 | ENTRYPOINT ["/opt/entrypoints.d/entrypoint.sh"] |
|
322 | 325 | |
|
323 | 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 |
General Comments 0
You need to be logged in to leave comments.
Login now