##// END OF EJS Templates
rcstack: use dl server
super-admin -
Show More

The requested changes are too big and content was truncated. Show full diff

@@ -1,393 +1,393 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 ##rcstack for Linux, new docker based installer
40 40
41 41 To get started with RhodeCode get the new shell installer called rcstack
42 42
43 43 ```
44 44 mkdir docker-rhodecode && cd docker-rhodecode
45 curl -s -o rcstack https://code.rhodecode.com/rhodecode-enterprise-docker/raw/master/scripts/rcstack/rcstack && chmod +x rcstack
45 curl -L -s -o rcstack https://dls.rhodecode.com/get/master && chmod +x rcstack
46 46 ./rcstack get-started
47 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 `./rcstack 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 ./rcstack init can install docker on linux machine, but if manual installation is
59 59 required it's also possible by simply 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 ./rcstack 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 ./rcstack 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 ./rcstack stack services up --detach
85 85
86 86 Start RhodeCode stack
87 87
88 88 ./rcstack stack rhodecode up --detach
89 89
90 90 Check stack status
91 91
92 92 ./rcstack status
93 93
94 94 Output should look similar like this:
95 95
96 96 ---
97 97 CONTAINER ID IMAGE STATUS NAMES PORTS
98 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 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 100 2be52ba58ffe rhodecode/rhodecode-ee:4.28.0 Up 2 hours (healthy) rc_cluster_apps-vcsserver-1
101 101 7cd730ad3263 rhodecode/rhodecode-ee:4.28.0 Up 2 hours (healthy) rc_cluster_apps-celery-1
102 102 dfa231342c87 rhodecode/rhodecode-ee:4.28.0 Up 2 hours (healthy) rc_cluster_apps-celery-beat-1
103 103 d3d76ce2de96 rhodecode/rhodecode-ee:4.28.0 Up 2 hours (healthy) rc_cluster_apps-sshd-1
104 104 daaac329414b rhodecode/rhodecode-ee:4.28.0 Up 2 hours (healthy) rc_cluster_apps-svn-1
105 105 7b8504fb9acb nginx:1.23.2 Up 2 hours (healthy) rc_cluster_services-nginx-1 80/tcp
106 106 7279c25feb6b elasticsearch:6.8.23 Up 2 hours (healthy) rc_cluster_services-elasticsearch-1 9200/tcp, 9300/tcp
107 107 19fb93587493 redis:7.0.5 Up 2 hours (healthy) rc_cluster_services-redis-1 6379/tcp
108 108 fb77fb6496c6 channelstream/channelstream:0.7.1 Up 2 hours (healthy) rc_cluster_services-channelstream-1 8000/tcp
109 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 ./rcstack 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 127 ```
128 128 ./rcstack 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 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 ./rcstack build-installer
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 ./rcstack 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 165 ```
166 166 ./rcstack 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 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 186
187 187 ```
188 188 -rw-r--r-- 1 docker docker 0 Nov 25 12:27 .dirkeep
189 189 drwxr-xr-x 1 docker docker 1184 Nov 25 12:27 rhodecode-enterprise-ce
190 190 drwxr-xr-x 1 docker docker 1120 Nov 25 12:27 rhodecode-enterprise-ee
191 191 drwxr-xr-x 1 docker docker 800 Nov 25 12:27 rhodecode-vcsserver
192 192 ```
193 193
194 194 If you have the 3 required projects source code already, this step can be omitted, and the
195 195 sources can be copied to the `.source/` directory. note: symlinks don't work.
196 196
197 197 - https://code.rhodecode.com/rhodecode-vcsserver
198 198 - https://code.rhodecode.com/rhodecode-enterprise-ce
199 199 - https://code.rhodecode.com/rhodecode-enterprise-ee (assuming access is granted to this)
200 200
201 201 Run this to fetch the sources
202 202
203 203 ```
204 204 ./rcstack get-build-source --revision=default --auth-token=xxxx --server-url=https://code.rhodecode.com/sources
205 205 ```
206 206
207 207
208 208 4) Create the build
209 209
210 210 ```
211 211 ./rcstack build-source --version-name 4.28.0.REL.2022.12.12
212 212 ```
213 213
214 214 # Operation
215 215
216 216 ## Data structure
217 217
218 218 There are 4 volumes defined:
219 219
220 220
221 221 - `/etc/rhodecode/conf`
222 222
223 223 Shared volume used for configuration files for rhodecode, vcsserver and supervisord, and some cache data
224 224
225 225 - `/var/opt/rhodecode_repo_store`
226 226
227 227 Used for main repository storage where repositories would be stored
228 228
229 229 - `/var/opt/rhodecode_data`
230 230
231 231 Data dir for rhodecode cache/lock files, or user sessions (for file backend)
232 232
233 233
234 234 ## Set License for EE version
235 235
236 236 In order to install EE edition a license file is required to be present.
237 237 It can contain your current license, or when empty license can be applied via Web interface.
238 238
239 239 To apply it during build phase save your raw license data into a file
240 240
241 241 `config/rhodecode_enterprise.license`
242 242
243 243 If this file is present build phase will read it and license will be applied at creation.
244 244 This file can also be empty and license can be applied via a WEB interface after first login.
245 245
246 246 ## Run Docker compose build:
247 247
248 248 *This will build RhodeCode based on downloaded installer packages.*
249 249
250 250 To create a full stack we need to run the database container, so it's ready to
251 251 build the docker image.
252 252
253 253 _Disk space problems?_
254 254
255 255 ```
256 256 docker system df
257 257 docker builder prune -f
258 258 # optionally
259 259 docker image prune -a
260 260 ```
261 261
262 262 ### Creating & building images
263 263
264 264 1) start with running the required database for the build stage in the background.
265 265
266 266 ```
267 267 docker-compose up --detach database
268 268 ```
269 269
270 270 This will start our postgres database, and expose it to the network.
271 271 Postgres DB is configured to output logs into a stdout
272 272
273 273 2) We can now run the full installation. Database needs to be running for the next build command.
274 274 This will build the rhodecode base image used for rhodecode, vcsserver, celery, ssh, svn
275 275 Then it will build all other components required.
276 276
277 277 ```
278 278 docker-compose build rhodecode
279 279 docker-compose build
280 280 ```
281 281
282 282 4) Once we build all required containers, we can run the whole stack using `docker-compose up`
283 283
284 284 ```
285 285 docker-compose up
286 286 ```
287 287
288 288 If running locally you can access Running RhodeCode via Nginx under:
289 289 http://localhost:8888
290 290
291 291 localhost can be changed to the server IP where docker is running.
292 292
293 293
294 294 In case for bigger setups docker-compose can scale more rhodecode/vcsserver workers:
295 295
296 296 ```
297 297 docker-compose up --scale vcsserver=3 rhodecode=3
298 298 ```
299 299
300 300 Logging is pushed to stdout from all services.
301 301
302 302
303 303 ### Upgrade procedure:
304 304
305 305 - run ./rcstack self-update
306 306 - run ./rcstack stack-upgrade to get upgrade instructions
307 307
308 308
309 309 With this done, you can now proceed with every step of normal source installation (Creating & building images), but instead of using
310 310 just `docker-compose` command it needs to be replaced with `docker-compose -f docker-compose.yaml -f docker-compose.source.yaml`
311 311
312 312 For example to override the installer build with the source `rhodecode` based image, and also setting proper version, run:
313 313
314 314 ```
315 315 RC_VERSION="4.28.0.SRC.2022.12.12.1" docker-compose -f docker-compose-apps.yaml -f docker-compose.source.yaml build --no-cache --progress=plain rhodecode
316 316 ```
317 317
318 318 NOTE THAT it's recommended to keep rc_version and source_Ver the same
319 319
320 320 ## Simple community build
321 321
322 322 Build docker RhodeCode `Community` without any dependencies (redis, external db) using
323 323 simple sqlite database and file based caches.
324 324 This is a fully running instance good for small use with 3-5 users.
325 325
326 326 ```
327 327 docker build -t rhodecode/rhodecode-ce:4.23.2 -f rhodecode.dockerfile \
328 328 -e RHODECODE_TYPE=Community \
329 329 -e RHODECODE_VERSION=4.23.2 \
330 330 -e RHODECODE_DB=sqlite \
331 331 -e RHODECODE_USER_NAME=admin \
332 332 -e RHODECODE_USER_PASS=secret4 \
333 333 -e RHODECODE_USER_EMAIL=support@rhodecode.com \
334 334 .
335 335 ```
336 336
337 337 note: for debugging better to add `--progress plain` into the build command to obtain all the output from the build.
338 338 To Build against existing running Postgres or MySQL you can specify:
339 339
340 340 --build-arg RHODECODE_DB=postgresql://postgres:secret@database/rhodecode
341 341 --build-arg RHODECODE_DB=mysql://root:secret@localhost/rhodecode?charset=utf8
342 342
343 343
344 344 To copy over the data into volumes use such command:
345 345 ```
346 346 docker run -v logvolume:/data --name data_vol busybox true
347 347 docker cp . data_vol:/data
348 348 docker rm data_vol
349 349 ```
350 350
351 351 Run the container, mounting the required volumes. By default the application would be
352 352 available at http://localhost:10020, and default login is (unless specified differently in the build command)
353 353
354 354 ```
355 355 user: admin
356 356 password: secret4
357 357 ```
358 358
359 359 We've not built our image using specific version. It's time to run it:
360 360 We specify the run.ini by selecting config option we have locally
361 361
362 362 ```
363 363 docker run \
364 364 --name rhodecode-container \
365 365 --publish 10020:10020 \
366 366 --restart unless-stopped \
367 367 --volume $PWD/config:/etc/rhodecode/conf \
368 368 --volume $PWD/config/rhodecode.ini:/etc/rhodecode/conf_build/rhodecode.ini \
369 369 'rhodecode/rhodecode-ee:4.23.2'
370 370 ```
371 371
372 372 Enter container
373 373
374 374 ```
375 375 docker exec -it rhodecode-container /bin/bash
376 376 ```
377 377
378 378 Enter interactive shell
379 379
380 380 ```
381 381 docker exec -it rhodecode-container /usr/local/bin/rhodecode_bin/bin/rc-ishell /etc/rhodecode/conf/rhodecode.ini
382 382 ```
383 383
384 384 Run Database migrations
385 385 ```
386 386 docker exec -it rhodecode-container /usr/local/bin/rhodecode_bin/bin/rc-upgrade-db /etc/rhodecode/conf/rhodecode.ini --force-yes
387 387 ```
388 388
389 389
390 390
391 391 ### Registry for docker swarm
392 392
393 393 docker run -d -p 5000:5000 --restart always --name registry registry:2 No newline at end of file
1 NO CONTENT: modified file
The requested commit or file is too big and content was truncated. Show full diff
General Comments 0
You need to be logged in to leave comments. Login now