##// END OF EJS Templates
fix(docs): fixed error in docs syntax
super-admin -
Show More
@@ -1,331 +1,332 b''
1 1 .. _migration-to-rcstack:
2 2
3 3 =============================
4 4 Migration to Docker & Rcstack
5 5 =============================
6 6
7 7
8 8 Migrate old pre 4.28.0 installer based releases
9 9 -----------------------------------------------
10 10
11 11
12 12 1. Decide on components use
13 13 +++++++++++++++++++++++++++
14 14
15 15 By default, RhodeCode stack uses Redis and Postgres.
16 16 We recommend using those in Docker as things like
17 17 backup/restore are much easier, and possible to run by our installer
18 18
19 19 If you plan to use your own redis or DB, disable those services in
20 20 :file:`.custom/docker-compose-services.override.yaml` by setting ``replicas: 0``
21 21
22 22 see: :ref:`configuration-of-components`
23 23
24 24 Select your DB type by commenting postgres or mysql db in :file:`.custom/docker-compose-services.override.yaml`
25 25 For Sqlite, disable both DB types.
26 26
27 27 .. note::
28 28
29 29 Selecting your own Redis, DB etc would require pointing to those instance inside .ini config files. By default
30 30 rcstack is configured to talk to docker based addresses of those services.
31 31
32 32
33 33 2. bootstrap the environment for rcstack
34 34 ++++++++++++++++++++++++++++++++++++++++
35 35
36 36 .. code-block::
37 37
38 38 ./rcstack init
39 39
40 40
41 41 During the install/configure phase pick corresponding edition (ce/ee)
42 42 transfer your license-token, and domain used in previous setup.
43 43
44 44
45 45 Then ensure 4.28.0 version is set for proper migration
46 46
47 47 .. code-block::
48 48
49 49 ./rcstack cli set-runtime-image 4.28.0
50 50
51 51
52 52 3. Copy over your old configuration into new shared config dir
53 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
54 54
55 55 The init command will generate a docker optimized configurations, those by default have
56 56 all services configured to be run against docker stack. Few options should be copied from old
57 57 .ini config files for best backward compatibility and smooth migration.
58 58
59 59 The new .ini files are located in the :file:`config/_shared/` directory.
60 60 This is located in directory where rcstack is installed.
61 61
62 62 Assumes installation is inside a directory :file:`/home/rcdev/.rccontrol/enterprise-1`
63 63
64 64 .. code-block::
65 65
66 66 cp /home/rcdev/.rccontrol/enterprise-1/rhodecode.ini /root/docker-rhodecode/config/_shared/rhodecode_old.ini
67 67 cp /home/rcdev/.rccontrol/vcsserver-1/vcsserver.ini /root/docker-rhodecode/config/_shared/vcsserver_old.ini
68 68
69 69 Then compare the new files e.g :file:`rhodecode.ini` with :file:`rhodecode_old.ini` and adjust accordingly,
70 70 most important items for review are:
71 71
72 72 - location of storages paths (those should be left Dockerized)
73 73 - redis/db connection urls (depends on choice of services, either Docker urls, or external urls)
74 74 - app_instance_uuid = COPY_OLD_VALUE
75 75 - rhodecode.encrypted_values.secret = COPY_OLD_VALUE
76 76 - beaker.session.secret = COPY_OLD_VALUE
77 77 - email configuration
78 78
79 79
80 80 For example, if you leave on your *own* redis instance then no adjustment is needed, if you decide to use
81 81 docker based redis, here's an example change you need to make:
82 82
83 83 .. code-block:: ini
84 84
85 85 #rc_cache.cache_perms.arguments.host = localhost # this was commented out
86 86 # new options is change to connect to docker redis instance, hostname is just the name of compose service (redis)
87 87 rc_cache.cache_perms.arguments.host = redis
88 88 rc_cache.cache_perms.arguments.port = 6379
89 89 rc_cache.cache_perms.arguments.db = 0
90 90 rc_cache.cache_perms.arguments.socket_timeout = 30
91 91
92 92
93 93 4. launch services stack
94 94 ++++++++++++++++++++++++
95 95
96 96 Launch the service stack with Database and all required services
97 97
98 98 .. code-block:: bash
99 99
100 100 ./rcstack stack services up -d
101 101
102 102 Check the status of service stack by checking the status command
103 103
104 104 .. code-block:: bash
105 105
106 106 ./rcstack status
107 107
108 108 Running hostname: https://code.rhodecode.com
109 109 CONTAINER ID NAMES IMAGE STATUS PORTS
110 110 5746f723d892 rc_cluster_services-channelstream-1 channelstream/channelstream:0.7.1 Up About a minute (healthy) 8000/tcp
111 111 bef9599eef0c rc_cluster_services-database-1 postgres:14.9 Up About a minute (healthy) 5432/tcp
112 112 addf574b6f1c rc_cluster_services-elasticsearch-1 elasticsearch:6.8.23 Up About a minute (healthy) 9200/tcp, 9300/tcp
113 113 9f89816cc6dc rc_cluster_services-nginx-errors-1 nginx:1.25.2 Up About a minute 80/tcp
114 114 1c8e90e8ab7d rc_cluster_services-nginx-statics-1 nginx:1.25.2 Up About a minute (health) 80/tcp
115 115 fcb8378cd506 rc_cluster_services-redis-1 redis:7.0.12 Up About a minute (healthy) 6379/tcp
116 116
117 117
118 118
119 119 5. make a db dump
120 120 +++++++++++++++++
121 121
122 122 .. note::
123 123
124 124 Run this only if docker-based DB is selected. Skip otherwise
125 125
126 126 create a backup of your existing database, so it can be migrated to docker instance.
127 127 Place the backup file into :file:`.custom/db_dump`
128 128
129 129
130 130 .. code-block:: bash
131 131
132 132 # For MySQL DBs
133 133 $ mysqldump -u <uname> -p <pass> rhodecode_db_name > .custom/db_dump/mysql-db-backup.sql
134 134
135 135 # For PostgreSQL DBs
136 136 $ PGPASSWORD=<pass> pg_dump --inserts -U <uname> -h localhost rhodecode_db_name > .custom/db_dump/postgresql-db-backup.sql
137 137
138 138 # For SQLite
139 139 $ sqlite3 rhodecode.db β€˜.dump’ > .custom/db_dump/sqlite-db-backup.sql
140 140
141 141
142 142
143 143 6. restore db
144 144 +++++++++++++
145 145
146 146
147 147 .. note::
148 148
149 149 Run this only if docker-based DB is selected. Skip otherwise
150 150
151 151 Cleanup previous db created by init script, and re-create it.
152 152 Restore the database into docker container running DB.
153 153 Run the ./rcstack cli db command:
154 154
155 155 .. code-block:: bash
156 156
157 157 ./rcstack cli db
158 158
159 159 attaching pg_data under: /var/lib/postgresql/data
160 160 attaching $PWD/.custom/db_dump under: /var/rc-data-dump
161 161
162 162 restore dump:
163 163 \i /var/rc-data-dump/your_dump.sql
164 164
165 165 psql (14.9 (Debian 14.9-1.pgdg120+1))
166 166 Type "help" for help.
167 167
168 168 rhodecode=# \connect template1
169 169 template1=# drop database rhodecode;
170 170 template1=# create database rhodecode;
171 171 template1=# \connect rhodecode
172 172 rhodecode=# \i /var/rc-data-dump/postgresql-db-backup.sql
173 173
174 174
175 175 This will restore the previously stored DB dump into new dockerized DB.
176 176
177 177
178 178 7. move data into docker storage
179 179 ++++++++++++++++++++++++++++++++
180 180
181 181 Step one is to move the required components to the :file:`.custom/storage` directory inside the docker
182 182 compose stack. This directory is mounted later on so data can be copied over into docker storage engine volumes.
183 183
184 184 .. note::
185 185
186 186 The tarball cache can be omitted since RhodeCode uses a new system which is not compatible with older release
187 187
188 188 .. note::
189 189
190 190 The path for artifacts can be found inside the **old** .ini file and DB
191 191
192 192 .. code-block:: ini
193 193
194 194 #artifacts, %(here)s is current location of old .ini file
195 195 file_store.storage_path = %(here)s/data/file_store
196 196
197 197
198 198 7.1. Copy artifacts into docker shared dir
199 199
200 200 .. code-block:: bash
201 201
202 202 mv -v .rccontrol/enterprise-1/data/file_store .custom/storage/
203 203
204 204
205 205 7.2. Copy gists into docker shared dir
206 206
207 207 .. code-block:: bash
208 208
209 209 mv -v /home/rhodecode/repos/.gist .custom/storage/repos/.gist
210 210
211 211
212 212 7.3. Copy repositories into docker shared dir
213 213
214 214 .. code-block:: bash
215 215
216 216 mv -v /home/rhodecode/repos .custom/storage/
217 217
218 218
219 219 Once that is done, we can now move from the host directory into docker storage engine volumes.
220 220
221 221 .. code-block:: bash
222 222
223 223 ./rcstack cli storage
224 224
225 225 attaching rc_datavolume under: /vol/datavolume
226 226 attaching rc_reposvolume under: /vol/repovolume
227 227 attaching $PWD/.custom/storage under: /vol/backupvolume
228 228
229 229 root@a27697d13f44:/vol#
230 230
231 231 7.4. Move artifacts
232 232
233 233 .. code-block:: bash
234 234
235 235 root@a27697d13f44:/vol# mv /vol/backupvolume/repos/* /vol/repovolume/
236 236
237 237 7.5. Move gists
238 238
239 239 .. code-block:: bash
240 240
241 241 root@a27697d13f44:/vol# mv /vol/backupvolume/repos/* /vol/repovolume/
242 242
243 243 7.6. Move repositories
244 244
245 245 .. code-block:: bash
246 246
247 247 root@a27697d13f44:/vol# mv /vol/backupvolume/repos/* /vol/repovolume/
248 248
249 249 7.7 Make sure proper permissions are set on the storage files, group/user is 999
250 250
251 251 .. code-block:: bash
252 252
253 253 root@a27697d13f44:/vol# chown -R 999:999 /vol/repovolume
254 254
255 255
256 256 8. Ensure other old services are stopped
257 257 ++++++++++++++++++++++++++++++++++++++++
258 258
259 259 At this point we're going to run the whole stack, because the router binds to some of the common
260 260 ports, we need to make sure old db/nginx are stopped before we proceed.
261 261
262 262 It's also important to stop running RhodeCode services.
263 263
264 264 This is where a first downtime of previously ran setup would occur.
265 265
266 266
267 267
268 268 9. Start complete stack
269 269 +++++++++++++++++++++++
270 270
271 271 .. code-block:: bash
272 272
273 273 ./rcstack stack all up -d
274 274
275 275
276 276
277 277 10. Fix DB paths
278 278 ++++++++++++++++
279 279
280 280 Docker internally changed the paths used before, he're a way to change it using ishell. But this can
281 281 be also adjusted in the UI
282 282
283 283 .. code-block:: bash
284 284
285 285 ./rcstack cli ishell
286 286
287 287
288 288 .. code-block:: python
289 289
290 290 ui1 = RhodeCodeUi.query().filter(RhodeCodeUi.ui_key=='usercache').scalar()
291 291 ui2 = RhodeCodeUi.query().filter(RhodeCodeUi.ui_key=='store_location').scalar()
292 292 ui3 = RhodeCodeUi.query().filter(RhodeCodeUi.ui_key=='/').scalar()
293 293
294 294 ui1.ui_value = '/var/opt/rhodecode_repo_store/.cache/lfs_store'
295 295 ui2.ui_value = '/var/opt/rhodecode_repo_store/.cache/largefiles'
296 296 ui3.ui_value = '/var/opt/rhodecode_repo_store'
297 297
298 298 Session().add(ui1);Session().commit()
299 299 Session().add(ui2);Session().commit()
300 300 Session().add(ui3);Session().commit()
301 301
302 302
303 303 11. Adjust SVN Proxy
304 304 ++++++++++++++++++++
305 305
306 306 .. note::
307 307
308 308 This is only required for pre 5.1 migration, if you're migrating from 4.X to 5.1+ this step can be omitted.
309 309
310 Go to the VCS config from the :menuselection:`Admin --> Settings --> VCS
310
311 Go to the VCS config from the :menuselection:`Admin --> Settings --> VCS`
311 312
312 313 - Select Proxy subversion HTTP requests checkbox
313 314 - Enter http://svn:8090 into Subversion HTTP Server URL
314 315 - Click the Generate Apache Config button.
315 316
316 317
317 318 12. Run full remap & rescan
318 319 +++++++++++++++++++++++++++
319 320
320 321 From RhodeCode web-interface, the last step is to run a full remap & rescan action.
321 322
322 323 1. From the RhodeCode Web interface, open
323 324 :menuselection:`Admin --> Settings --> Remap and rescan`
324 325 2. Select :guilabel:`Invalidate cache for all repositories` to ensure we cleanup old caches from previous installs
325 326 3. Click :guilabel:`Rescan Repositories` action
326 327
327 328
328 329 SSL Certificates
329 330 ^^^^^^^^^^^^^^^^
330 331
331 332 - see: :ref:`configuration-of-ssl-certificates` No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now