##// END OF EJS Templates
readme: fixed rendering
super-admin -
Show More
@@ -1,396 +1,397 b''
1 1 # RhodeCode Cluster
2 2
3 3 RhodeCode Cluster is a multi-node highly-scalable setup to run
4 4 RhodeCode, Edge Router(Traefik + SSL) and Metrics Stack (Prometheus, Loki, Grafana) and
5 5 all its additional components in single environment using Docker.
6 6
7 7 Using a docker-compose this setup creates following services for RhodeCode:
8 8
9 9 Edge-Router:
10 10
11 11 - Traefik, Edge Router, SSL termination etc
12 12
13 13 Core Services:
14 14
15 15 - Database (defaults to PostgreSQL)
16 16 - Redis, acts as cache and queue exchange
17 17 - ChannelStream - live websocket communications
18 18 - Nginx (static/channelstream) proxy serving RhodeCode static files and channelstream communication
19 19 - Elasticsearch (full text search backend)
20 20
21 21 RhodeCode
22 22
23 23 - RhodeCode CE/EE
24 24 - VCSServer for GIT/SVN/HG support
25 25 - SSH Server for cloning over SSH
26 26 - SVN webserver for HTTP support over SVN
27 27 - Celery workers for asynchronous tasks
28 28 - Celery beat for automation tasks
29 29
30 30 Metrics
31 31
32 32 - Loki, logs aggregation
33 33 - Grafana, metrics Dashboard
34 34 - Prometheus, metrics time-series
35 35 - Statsd-exporter - statsd to Prometheus bridge
36 36 - Node-exporter - machine stats and usage
37 37 - Promtail - log scraping
38 38
39 39 ##rccontrol for Linux, new docker based installer
40 40
41 41 To get started with RhodeCode get the new shell installer called rccontrol
42 42
43 ```shell
44 mkdir docker-rhodecode && cd docker-rhodecode
45 curl -o rccontrol https://code.rhodecode.com/rhodecode-enterprise-docker/raw/master/scripts/rccontrol/rccontrol && chmod +x rccontrol
46 ./rccontrol get-started
47 ```
43 ```
44 mkdir docker-rhodecode && cd docker-rhodecode
45 curl -o rccontrol https://code.rhodecode.com/rhodecode-enterprise-docker/raw/master/scripts/rccontrol/rccontrol && chmod +x rccontrol
46 ./rccontrol get-started
47 ```
48 48
49 49 ## Pre requisites
50 50
51 51 To Run this stack Docker engine and Docker Compose needs to be installed on the host machine.
52 52 Please run `./rccontrol init` to install docker using the installer, or
53 53 visit docker site and install docker (min version 20.10) and docker compose:
54 54
55 55 - https://docs.docker.com/engine/install/
56 56 - https://docs.docker.com/compose/install/
57 57
58 58 rccontrol installer can install docker on linux machine, but if manual installation is
59 59 required it's also possible by si ply installing docker before
60 60
61 61
62 62
63 63 # Quick install tutorial
64 64
65 65 Those are step-by-step installation/run steps.
66 66
67 67 create configurations / docker definitions:
68 68
69 69 ./rccontrol init
70 70
71 71 At this point a custom file under .custom/.runtime.env was created. Adjust it if required.
72 72
73 73 Start Traefik router that would handle all incoming traffic, load balance. A valid domain needs to be present in
74 74 .custom/.runtime.env to access the RhodeCOde
75 75
76 76 ./rccontrol stack router up --detach
77 77
78 78 Start the database and bootstrap it
79 79
80 80 ./rcontrol stack database up --detach
81 81
82 82 Start other services required
83 83
84 84 ./rccontrol stack services up --detach
85 85
86 86 Start RhodeCode stack
87 87
88 88 ./rccontrol stack rhodecode up --detach
89 89
90 90 Check stack status
91 91
92 ./rccontrol status --simple
92 ./rccontrol status
93 93
94 94 Output should look similar like this:
95 95
96 96 ---
97 CONTAINER ID IMAGE STATUS NAMES PORTS
98 ef54fc528e3a traefik:v2.9.5 Up 19 hours rc_cluster_router-traefik-1 0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp, 0.0.0.0:9022->9022/tcp, :::9022->9022/tcp
99 f3ea0539e8b0 rhodecode/rhodecode-ee:4.28.0 Up About a minute (healthy) rc_cluster_apps-rhodecode-1 0.0.0.0:10020->10020/tcp, :::10020->10020/tcp
100 2be52ba58ffe rhodecode/rhodecode-ee:4.28.0 Up About a minute (healthy) rc_cluster_apps-vcsserver-1
101 7cd730ad3263 rhodecode/rhodecode-ee:4.28.0 Up About a minute rc_cluster_apps-celery-1
102 dfa231342c87 rhodecode/rhodecode-ee:4.28.0 Up About a minute rc_cluster_apps-celery-beat-1
103 d3d76ce2de96 rhodecode/rhodecode-ee:4.28.0 Up About a minute rc_cluster_apps-sshd-1
104 daaac329414b rhodecode/rhodecode-ee:4.28.0 Up About a minute (healthy) rc_cluster_apps-svn-1
105 7b8504fb9acb nginx:1.23.2 Up About a minute (healthy) rc_cluster_services-nginx-1 80/tcp
106 7279c25feb6b elasticsearch:6.8.23 Up About a minute (healthy) rc_cluster_services-elasticsearch-1 9200/tcp, 9300/tcp
107 19fb93587493 redis:7.0.5 Up About a minute (healthy) rc_cluster_services-redis-1 6379/tcp
108 fb77fb6496c6 channelstream/channelstream:0.7.1 Up About a minute (healthy) rc_cluster_services-channelstream-1 8000/tcp
109 cb6c5c022f5b postgres:14.6 Up About a minute (healthy) rc_cluster_services-database-1 5432/tcp
97 CONTAINER ID IMAGE STATUS NAMES PORTS
98 ef54fc528e3a traefik:v2.9.5 Up 2 hours rc_cluster_router-traefik-1 0.0.0.0:80->80/tcp, :::80->80/tcp
99 f3ea0539e8b0 rhodecode/rhodecode-ee:4.28.0 Up 2 hours (healthy) rc_cluster_apps-rhodecode-1 0.0.0.0:10020->10020/tcp, :::10020->10020/tcp
100 2be52ba58ffe rhodecode/rhodecode-ee:4.28.0 Up 2 hours (healthy) rc_cluster_apps-vcsserver-1
101 7cd730ad3263 rhodecode/rhodecode-ee:4.28.0 Up 2 hours (healthy) rc_cluster_apps-celery-1
102 dfa231342c87 rhodecode/rhodecode-ee:4.28.0 Up 2 hours (healthy) rc_cluster_apps-celery-beat-1
103 d3d76ce2de96 rhodecode/rhodecode-ee:4.28.0 Up 2 hours (healthy) rc_cluster_apps-sshd-1
104 daaac329414b rhodecode/rhodecode-ee:4.28.0 Up 2 hours (healthy) rc_cluster_apps-svn-1
105 7b8504fb9acb nginx:1.23.2 Up 2 hours (healthy) rc_cluster_services-nginx-1 80/tcp
106 7279c25feb6b elasticsearch:6.8.23 Up 2 hours (healthy) rc_cluster_services-elasticsearch-1 9200/tcp, 9300/tcp
107 19fb93587493 redis:7.0.5 Up 2 hours (healthy) rc_cluster_services-redis-1 6379/tcp
108 fb77fb6496c6 channelstream/channelstream:0.7.1 Up 2 hours (healthy) rc_cluster_services-channelstream-1 8000/tcp
109 cb6c5c022f5b postgres:14.6 Up 2 hours (healthy) rc_cluster_services-database-1 5432/tcp
110 110
111 111 # Standalone cluster build from installer
112 112
113 113 If you;d like to build your own custom image here's a quick how to.:
114 114 Follow these steps to build and run the RhodeCode Cluster via Docker-compose.
115 115
116 116 1) Run:
117 117
118 118 ./rccontrol init
119 119
120 120 2) Run artifacts fetch like installer and certain needed build binaries:
121 121
122 122 Start by fetching required installer binaries. This is required to create both
123 123 simple build and full compose setup.
124 124 Please use the `--version-name VERSION_NAME` flag to adjust RhodeCode version if needed.
125 125 (e.g. --version-name "4.24.1")
126 126
127 ```shell
127 ```
128 128 ./rccontrol get-build-artifacts
129 129 ```
130 130
131 131 This will download required installer files and put them into the `.cache` directory.
132 132 This directory should look similar to that after downloads have finish:
133 133
134 ```shell
134 ```
135 135 drwxr-xr-x 8 rcdev rcdev 256B Feb 8 13:35 .
136 136 drwxr-xr-x 14 rcdev rcdev 448B Feb 8 10:40 ..
137 137 -rw-r--r-- 1 rcdev rcdev 0B Feb 8 20:44 .dirkeep
138 138 -rwxr-xr-x 1 rcdev rcdev 241M Feb 8 13:35 RhodeCode-installer-linux-build20210208_0800
139 139 -rw-r--r-- 1 rcdev rcdev 156M Feb 8 13:35 RhodeCodeCommunity-4.24.1+x86_64-linux_build20210208_0800.tar.bz2
140 140 -rw-r--r-- 1 rcdev rcdev 171M Feb 8 13:35 RhodeCodeEnterprise-4.24.1+x86_64-linux_build20210208_0800.tar.bz2
141 141 -rw-r--r-- 1 rcdev rcdev 145M Feb 8 13:35 RhodeCodeVCSServer-4.24.1+x86_64-linux_build20210208_0800.tar.bz2
142 142 -rw-r--r-- 1 rcdev rcdev 109M Feb 8 13:35 locale-archive
143 143 ```
144 144
145 145
146 146 3) Create the build
147 147
148 148 ./rccontrol build
149 149
150 150 # Standalone cluster build from source code
151 151
152 152 There's an option to build the latest release from the source code as a docker installation.
153 153 If you;d like to build your own custom image based on the source code here's a quick how to.:
154 154 Follow these steps to build and run the RhodeCode Cluster via Docker-compose.
155 155
156 156 1) Run init to setup needed docker env and files:
157 157
158 158 ./rccontrol init
159 159
160 160 2) Run artifacts fetch like installer and certain needed build binaries:
161 161
162 162 Start by fetching required installer binaries.
163 163 Only local-archive is required to be present, installer is disregarded for source build
164 164
165 ```shell
165 ```
166 166 ./rccontrol get-build-artifacts
167 167 ```
168 168
169 169 This will download required installer files and put them into the `.cache` directory.
170 170 This directory should look similar to that after downloads have finish:
171 171
172 ```shell
172 ```
173 173 drwxr-xr-x 8 rcdev rcdev 256B Feb 8 13:35 .
174 174 drwxr-xr-x 14 rcdev rcdev 448B Feb 8 10:40 ..
175 175 -rw-r--r-- 1 rcdev rcdev 0B Feb 8 20:44 .dirkeep
176 176 -rwxr-xr-x 1 rcdev rcdev 241M Feb 8 13:35 RhodeCode-installer-linux-build20210208_0800
177 177 -rw-r--r-- 1 rcdev rcdev 156M Feb 8 13:35 RhodeCodeCommunity-4.24.1+x86_64-linux_build20210208_0800.tar.bz2
178 178 -rw-r--r-- 1 rcdev rcdev 171M Feb 8 13:35 RhodeCodeEnterprise-4.24.1+x86_64-linux_build20210208_0800.tar.bz2
179 179 -rw-r--r-- 1 rcdev rcdev 145M Feb 8 13:35 RhodeCodeVCSServer-4.24.1+x86_64-linux_build20210208_0800.tar.bz2
180 180 -rw-r--r-- 1 rcdev rcdev 109M Feb 8 13:35 locale-archive
181 181 ```
182 182
183 183 3) get source code needed to create a build
184 184
185 185 This step will create source code copies into the `.source/` path. So it will look like this:
186 ```shell
186
187 ```
187 188 -rw-r--r-- 1 docker docker 0 Nov 25 12:27 .dirkeep
188 189 drwxr-xr-x 1 docker docker 1184 Nov 25 12:27 rhodecode-enterprise-ce
189 190 drwxr-xr-x 1 docker docker 1120 Nov 25 12:27 rhodecode-enterprise-ee
190 191 drwxr-xr-x 1 docker docker 800 Nov 25 12:27 rhodecode-vcsserver
191 192 ```
192 193
193 194 If you have the 3 required projects source code already, this step can be omitted, and the
194 195 sources can be copied to the `.source/` directory. note: symlinks don't work.
195 196
196 197 - https://code.rhodecode.com/rhodecode-vcsserver
197 198 - https://code.rhodecode.com/rhodecode-enterprise-ce
198 199 - https://code.rhodecode.com/rhodecode-enterprise-ee (assuming access is granted to this)
199 200
200 201 Run this to fetch the sources
201 202
202 ```shell
203 ```
203 204 ./rccontrol get-build-source --revision=default --auth-token=xxxx --server-url=https://code.rhodecode.com/sources
204 205 ```
205 206
206 207
207 208 4) Create the build
208 209
209 ```shell
210 ```
210 211 ./rccontrol build-source --version-name 4.28.0.REL.2022.12.12
211 212 ```
212 213
213 214 # Operation
214 215
215 216 ## Data structure
216 217
217 218 There are 4 volumes defined:
218 219
219 220
220 221 - `/etc/rhodecode/conf`
221 222
222 223 Shared volume used for configuration files for rhodecode, vcsserver and supervisord, and some cache data
223 224
224 225 - `/var/opt/rhodecode_repo_store`
225 226
226 227 Used for main repository storage where repositories would be stored
227 228
228 229 - `/var/opt/rhodecode_data`
229 230
230 231 Data dir for rhodecode cache/lock files, or user sessions (for file backend)
231 232
232 233 - `/var/log/rhodecode`
233 234
234 235 Used to store all logs from RhodeCode
235 236
236 237 ## Set License for EE version
237 238
238 239 In order to install EE edition a license file is required to be present.
239 240 It can contain your current license, or when empty license can be applied via Web interface.
240 241
241 242 To apply it during build phase save your raw license data into a file
242 243
243 244 `config/rhodecode_enterprise.license`
244 245
245 246 If this file is present build phase will read it and license will be applied at creation.
246 247 This file can also be empty and license can be applied via a WEB interface after first login.
247 248
248 249 ## Run Docker compose build:
249 250
250 251 *This will build RhodeCode based on downloaded installer packages.*
251 252
252 253 To create a full stack we need to run the database container, so it's ready to
253 254 build the docker image.
254 255
255 256 _Disk space problems?_
256 257
257 ```shell
258 ```
258 259 docker system df
259 260 docker builder prune -f
260 261 # optionally
261 262 docker image prune -a
262 263 ```
263 264
264 265 ### Creating & building images
265 266
266 267 1) start with running the required database for the build stage in the background.
267 268
268 ```shell
269 ```
269 270 docker-compose up --detach database
270 271 ```
271 272
272 273 This will start our postgres database, and expose it to the network.
273 274 Postgres DB is configured to output logs into a file `/var/log/rhodecode/postgres`
274 275
275 276 2) We can now run the full installation. Database needs to be running for the next build command.
276 277 This will build the rhodecode base image used for rhodecode, vcsserver, celery, ssh, svn
277 278 Then it will build all other components required.
278 279
279 ```shell
280 ```
280 281 docker-compose build rhodecode
281 282 docker-compose build
282 283 ```
283 284
284 285 4) Once we build all required containers, we can run the whole stack using `docker-compose up`
285 286
286 ```shell
287 ```
287 288 docker-compose up
288 289 ```
289 290
290 291 If running locally you can access Running RhodeCode via Nginx under:
291 292 http://localhost:8888
292 293
293 294 localhost can be changed to the server IP where docker is running.
294 295
295 296
296 297 In case for bigger setups docker-compose can scale more rhodecode/vcsserver workers:
297 298
298 ```shell
299 ```
299 300 docker-compose up --scale vcsserver=3 rhodecode=3
300 301 ```
301 302
302 303 Logging is pushed to stdout from all services.
303 304
304 305
305 306 ### Upgrade procedure:
306 307
307 308 - run ./rccontrol self-update
308 309 - run ./rccontrol stack-upgrade to get upgrade instructions
309 310
310 311
311 312 With this done, you can now proceed with every step of normal source installation (Creating & building images), but instead of using
312 313 just `docker-compose` command it needs to be replaced with `docker-compose -f docker-compose.yaml -f docker-compose.source.yaml`
313 314
314 315 For example to override the installer build with the source `rhodecode` based image, and also setting proper version, run:
315 316
316 ```shell
317 ```
317 318 RC_VERSION="4.28.0.SRC.2022.12.12.1" docker-compose -f docker-compose-apps.yaml -f docker-compose.source.yaml build --no-cache --progress=plain rhodecode
318 319 ```
319 320
320 321 NOTE THAT it's recommended to keep rc_version and source_Ver the same
321 322
322 323 ## Simple community build
323 324
324 325 Build docker RhodeCode `Community` without any dependencies (redis, external db) using
325 326 simple sqlite database and file based caches.
326 327 This is a fully running instance good for small use with 3-5 users.
327 328
328 ```shell
329 ```
329 330 docker build -t rhodecode/rhodecode-ce:4.23.2 -f rhodecode.dockerfile \
330 331 -e RHODECODE_TYPE=Community \
331 332 -e RHODECODE_VERSION=4.23.2 \
332 333 -e RHODECODE_DB=sqlite \
333 334 -e RHODECODE_USER_NAME=admin \
334 335 -e RHODECODE_USER_PASS=secret4 \
335 336 -e RHODECODE_USER_EMAIL=support@rhodecode.com \
336 337 .
337 338 ```
338 339
339 340 note: for debugging better to add `--progress plain` into the build command to obtain all the output from the build.
340 341 To Build against existing running Postgres or MySQL you can specify:
341 342
342 343 --build-arg RHODECODE_DB=postgresql://postgres:secret@database/rhodecode
343 344 --build-arg RHODECODE_DB=mysql://root:secret@localhost/rhodecode?charset=utf8
344 345
345 346
346 347 To copy over the data into volumes use such command:
347 ```shell
348 ```
348 349 docker run -v logvolume:/data --name data_vol busybox true
349 350 docker cp . data_vol:/data
350 351 docker rm data_vol
351 352 ```
352 353
353 354 Run the container, mounting the required volumes. By default the application would be
354 355 available at http://localhost:10020, and default login is (unless specified differently in the build command)
355 356
356 357 ```
357 358 user: admin
358 359 password: secret4
359 360 ```
360 361
361 362 We've not built our image using specific version. It's time to run it:
362 363 We specify the run.ini by selecting config option we have locally
363 364
364 ```shell
365 ```
365 366 docker run \
366 367 --name rhodecode-container \
367 368 --publish 10020:10020 \
368 369 --restart unless-stopped \
369 370 --volume $PWD/config:/etc/rhodecode/conf \
370 371 --volume $PWD/config/rhodecode.ini:/etc/rhodecode/conf_build/rhodecode.ini \
371 372 --volume $PWD/logs:/var/log/rhodecode \
372 373 'rhodecode/rhodecode-ee:4.23.2'
373 374 ```
374 375
375 376 Enter container
376 377
377 ```shell
378 ```
378 379 docker exec -it rhodecode-container /bin/bash
379 380 ```
380 381
381 382 Enter interactive shell
382 383
383 ```shell
384 ```
384 385 docker exec -it rhodecode-container /usr/local/bin/rhodecode_bin/bin/rc-ishell /etc/rhodecode/conf/rhodecode.ini
385 386 ```
386 387
387 388 Run Database migrations
388 ```shell
389 ```
389 390 docker exec -it rhodecode-container /usr/local/bin/rhodecode_bin/bin/rc-upgrade-db /etc/rhodecode/conf/rhodecode.ini --force-yes
390 391 ```
391 392
392 393
393 394
394 395 ### Registry for docker swarm
395 396
396 397 docker run -d -p 5000:5000 --restart always --name registry registry:2 No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now