Upgrading to a new version
Actualizar a una versión nueva
A new version is a new pair of images. When the new application starts, it changes the database by itself to the form that version needs. This chapter gives the safe order and explains what those changes do.
Una versión nueva es un par nuevo de imágenes. Cuando la aplicación nueva arranca, cambia sola la base de datos a la forma que esa versión necesita. Este capítulo da el orden seguro y explica qué hacen esos cambios.
What the migrations do
Qué hacen las migraciones
Each version of the application carries a numbered list of changes to the database, called migrations. At every start-up, before answering anything, the application:
Cada versión de la aplicación trae una lista numerada de cambios a la base de datos, llamados migraciones. En cada arranque, antes de contestar nada, la aplicación:
- Compares the migrations it carries with the ones the database has already applied. Each applied migration is remembered with a fingerprint of its content.
- Checks that none of the applied ones has changed.
- Applies, in order, the ones the database does not have yet.
- Starts answering only when all of that ended well.
- Compara las migraciones que trae con las que la base ya tiene aplicadas. Cada migración aplicada queda recordada con una huella de su contenido.
- Controla que ninguna de las aplicadas haya cambiado.
- Aplica, en orden, las que la base todavía no tiene.
- Empieza a contestar recién cuando todo eso terminó bien.
- Migrations only go forward. There is no automatic way back: going back means restoring the copy.
- Never edit, rename or delete a migration file, and never change the database by hand in a way a migration would. Either one makes the next start-up fail.
- You do not run anything by hand. There is no separate upgrade command.
- Las migraciones solo avanzan. No hay vuelta atrás automática: volver atrás es restaurar la copia.
- Nunca edites, renombres ni borres un archivo de migración, y nunca cambies la base a mano de una forma que haría una migración. Cualquiera de las dos cosas hace fallar el arranque siguiente.
- No corrés nada a mano. No existe un comando de actualización aparte.
Upgrade, step by step
Actualizar, paso a paso
- Choose a quiet moment and tell the users. The system is down from the moment you stop the old application until the new one finishes starting.
- Make the three copies: database, file store and configuration. See Backups and restore.
- Get the source tree of the new version and build the two images of your edition, as in Requirements and images. The images keep the same names, so the new ones replace the old.
- Compare the Compose file and the list of variables of the new version with yours, and carry over any new required setting. See the Configuration reference.
- Recreate the services. docker compose -f docker-compose.<edition>.yml up -d
- Follow the start-up with docker compose -f docker-compose.<edition>.yml logs -f backend until the box with Edition initialized appears.
- Check curl http://localhost:8222/actuator/info for the new version, sign in and try one task of each module you use.
- Elegí un momento tranquilo y avisá a los usuarios. El sistema queda caído desde que detenés la aplicación vieja hasta que la nueva termina de arrancar.
- Hacé las tres copias: base de datos, almacén de archivos y configuración. Mirá Copias de seguridad y restauración.
- Conseguí el código fuente de la versión nueva y construí las dos imágenes de tu edición, como en Requisitos e imágenes. Las imágenes conservan los mismos nombres, así que las nuevas reemplazan a las viejas.
- Compará el archivo Compose y la lista de variables de la versión nueva con los tuyos, y pasá cualquier ajuste obligatorio nuevo. Mirá la Referencia de configuración.
- Recreá los servicios. docker compose -f docker-compose.<edición>.yml up -d
- Seguí el arranque con docker compose -f docker-compose.<edición>.yml logs -f backend hasta que aparezca el recuadro con Edition initialized.
- Revisá curl http://localhost:8222/actuator/info para ver la versión nueva, ingresá y probá una tarea de cada módulo que uses.
If the upgrade fails
Si la actualización falla
- Read the reason at the end of the log of backend. Keep that text.
- Do not touch the database by hand and do not start the previous version on it.
- Go back: restore the database copy, put the previous images and configuration back and start. See Backups and restore.
- Send the saved text to Kubrik support before trying again.
- Leé el motivo al final del registro de backend. Guardá ese texto.
- No toques la base a mano ni arranques sobre ella la versión anterior.
- Volvé atrás: restaurá la copia de la base, volvé a poner las imágenes y la configuración anteriores y arrancá. Mirá Copias de seguridad y restauración.
- Mandale el texto guardado al soporte de Kubrik antes de intentar de nuevo.
Common issues
Problemas habituales
- "Migration checksum mismatch for migration version …"
- A migration that the database already applied is different in this image. Either the images were built from a modified source tree, or they belong to another line of versions. Do not repair it by hand: go back to the previous images and contact Kubrik support with the number in the message.
- The log names a migration and a database error, and the container stops
- That migration could not be applied to your data. Go back as described above and send the text to Kubrik support.
- The start-up takes much longer than usual
- A version with many migrations, or one that rewrites a large table, takes longer the first time. Follow the log: while new lines appear, it is working.
- After the upgrade the container stops with a message about a missing variable
- The new version asks for a setting that yours does not have. The message names it; add it and start again. The database is not affected.
- «Migration checksum mismatch for migration version …»
- Una migración que la base ya tiene aplicada es distinta en esta imagen. O las imágenes se construyeron desde un código modificado, o son de otra línea de versiones. No lo repares a mano: volvé a las imágenes anteriores y contactá al soporte de Kubrik con el número del mensaje.
- El registro nombra una migración y un error de base de datos, y el contenedor se detiene
- Esa migración no se pudo aplicar a tus datos. Volvé atrás como se describe arriba y mandale el texto al soporte de Kubrik.
- El arranque tarda mucho más que de costumbre
- Una versión con muchas migraciones, o una que reescribe una tabla grande, tarda más la primera vez. Seguí el registro: mientras aparezcan líneas nuevas, está trabajando.
- Después de actualizar, el contenedor se detiene con un mensaje sobre una variable que falta
- La versión nueva pide un ajuste que el tuyo no tiene. El mensaje la nombra; agregala y arrancá de nuevo. La base no se ve afectada.