Backups and restore
Copias de seguridad y restauración
Kubrik OS does not back itself up. Three things have to be copied, and the three have to be restored together: the database, the file store and the configuration with its secret keys.
Kubrik OS no hace copias por su cuenta. Hay tres cosas que copiar, y las tres se restauran juntas: la base de datos, el almacén de archivos y la configuración con sus claves secretas.
What must be backed up
Qué hay que copiar
| What | Where it is | What you lose without it |
|---|---|---|
| The database | The postgres service, volume pgdata-<edition>. | Everything: organisations, users, products, documents, accounting. |
| The file store | The bucket named in MINIO_S3_BUCKET. With the Enterprise file, the volume minio-enterprise. | Every uploaded file: product images, attached documents. The database keeps only the reference to each file. |
| The configuration | The Compose file you edited, .env and, if you use it, assets/config.json. | The settings of the installation and, above all, its secret keys. |
| Qué | Dónde está | Qué perdés sin eso |
|---|---|---|
| La base de datos | El servicio postgres, volumen pgdata-<edición>. | Todo: organizaciones, usuarios, productos, documentos, contabilidad. |
| El almacén de archivos | El bucket que figura en MINIO_S3_BUCKET. Con el archivo de Enterprise, el volumen minio-enterprise. | Todos los archivos subidos: imágenes de productos, documentos adjuntos. La base guarda solo la referencia a cada archivo. |
| La configuración | El archivo Compose que editaste, .env y, si lo usás, assets/config.json. | Los ajustes de la instalación y, sobre todo, sus claves secretas. |
The cache needs no backup, and the location database can be downloaded again.
La caché no necesita copia, y la base de ubicación se puede bajar de nuevo.
Back up the database
Copiar la base de datos
Use the standard PostgreSQL tool, which is inside the postgres container. It can run while the system is in use.
Usá la herramienta estándar de PostgreSQL, que está dentro del contenedor postgres. Se puede correr con el sistema en uso.
- Run the copy. docker compose -f docker-compose.<edition>.yml exec -T postgres pg_dump -U ks_erp_java -Fc ks_erp_java > kubrik-os.dump
- Check the file. It must not be empty, and its size should resemble that of the previous copy.
- Take it off the server. A copy that lives only on the same disk as the database does not protect you.
- Corré la copia. docker compose -f docker-compose.<edición>.yml exec -T postgres pg_dump -U ks_erp_java -Fc ks_erp_java > kubrik-os.dump
- Revisá el archivo. No tiene que estar vacío, y su tamaño debería parecerse al de la copia anterior.
- Sacalo del servidor. Una copia que vive solo en el mismo disco que la base no te protege.
ks_erp_java is the name of the database and of its owner in the Compose files. If you changed them, use yours.
ks_erp_java es el nombre de la base y el de su dueño en los archivos Compose. Si los cambiaste, usá los tuyos.
Back up the file store
Copiar el almacén de archivos
Copy the whole bucket with the tool of your file store: the MinIO client for a MinIO server, or the versioning and replication of the bucket in Amazon S3. Do it right after the database copy, so that both reflect the same moment. A file store that is slightly newer than the database does no harm; an older one leaves records that point to files that are not there.
Copiá el bucket entero con la herramienta de tu almacén: el cliente de MinIO para un servidor MinIO, o el versionado y la replicación del bucket en Amazon S3. Hacelo enseguida después de la copia de la base, para que las dos reflejen el mismo momento. Un almacén un poco más nuevo que la base no hace daño; uno más viejo deja registros que apuntan a archivos que no están.
Restore
Restaurar
- Put the configuration back: the Compose file and .env with the original keys.
- Start only the database. docker compose -f docker-compose.<edition>.yml up -d postgres
- Load the copy into an empty database. docker compose -f docker-compose.<edition>.yml exec -T postgres pg_restore -U ks_erp_java -d ks_erp_java --clean --if-exists < kubrik-os.dump
- Put the files back in the bucket.
- Start the rest. docker compose -f docker-compose.<edition>.yml up -d. Use images of the same version as the copy, or a newer one: at start-up the application brings the database up to its own version.
- Check with curl http://localhost:8222/actuator/health, sign in and open a record with an image.
- Volvé a poner la configuración: el archivo Compose y .env con las claves originales.
- Levantá solo la base de datos. docker compose -f docker-compose.<edición>.yml up -d postgres
- Cargá la copia en una base vacía. docker compose -f docker-compose.<edición>.yml exec -T postgres pg_restore -U ks_erp_java -d ks_erp_java --clean --if-exists < kubrik-os.dump
- Volvé a poner los archivos en el bucket.
- Levantá el resto. docker compose -f docker-compose.<edición>.yml up -d. Usá imágenes de la misma versión que la copia, o de una más nueva: al arrancar, la aplicación lleva la base a su propia versión.
- Revisá con curl http://localhost:8222/actuator/health, ingresá y abrí un registro con imagen.
Common issues
Problemas habituales
- After a restore, sign-in works but nobody passes the two-step verification
- The installation runs with a different PMS_SECURITY_TOTP_ENCRYPTION_KEY than the one of the copy. Put the original key back.
- After a restore, an integration reports that its access data is invalid
- KSERP_MASTER_KEY_V1 or KUBRIK_WORKFLOW_SECRET_KEY are not the original ones. Put them back; if they are lost, the access data has to be loaded again in each organisation.
- After a restore, products show no image
- The file store was not restored, or it is older than the database, or MINIO_S3_BUCKET points to another bucket.
- pg_restore reports errors about roles
- The copy names database users that do not exist in the new server. Start the application once on the empty database so that it creates them, then restore.
- Después de restaurar, el ingreso funciona pero nadie pasa la verificación en dos pasos
- La instalación corre con otra PMS_SECURITY_TOTP_ENCRYPTION_KEY que la de la copia. Volvé a poner la clave original.
- Después de restaurar, una integración informa que sus datos de acceso no son válidos
- KSERP_MASTER_KEY_V1 o KUBRIK_WORKFLOW_SECRET_KEY no son las originales. Volvé a ponerlas; si se perdieron, hay que cargar de nuevo los datos de acceso en cada organización.
- Después de restaurar, los productos no muestran imagen
- El almacén de archivos no se restauró, o es más viejo que la base, o MINIO_S3_BUCKET apunta a otro bucket.
- pg_restore informa errores sobre roles
- La copia nombra usuarios de base de datos que no existen en el servidor nuevo. Arrancá la aplicación una vez sobre la base vacía para que los cree, y después restaurá.