Remark42 Migration¶
This guide describes how to migrate Remark42 data from a Docker container (deployed with Ansible) to the new Helm chart deployment on Kubernetes.
Prerequisites¶
- Access to the Docker host running the existing Remark42 container
kubectlconfigured to access the target Kubernetes cluster and namespace- The Helm chart deployed with a
ReadWriteOncePVC (data-remark42) - The Remark42 container exposes the export/import commands via the
remark42binary
Overview¶
Remark42 stores all state — comments, users and uploaded images — on disk under /srv/var. The simplest and most reliable migration is to copy the entire data directory from the old container into the new PVC.
1. Stop the old container¶
Stop the Docker container so that no new comments are written during the migration:
2. Export the data from the Docker volume¶
Create a tar archive of the Remark42 data volume. Replace remark_data01 with the volume name configured in your Ansible role (remark42_volume_name).
docker run --rm -v remark_data01:/srv/var -v "$PWD":/backup alpine \
tar czf /backup/remark42-data.tar.gz -C /srv/var .
This writes remark42-data.tar.gz to the current directory.
Download the remark42-data.tar.gz to the localhost.
3. Prepare the target PVC¶
The Remark42 pod must not be running while you write to its PVC. Scale the deployment down:
Start a helper pod for the restore:
kubectl run remark42-restore --image alpine --restart=Never \
--command -- sleep 3600 \
--overrides='{"spec":{"containers":[{"name":"remark42-restore","image":"alpine","command":["sleep","3600"],"volumeMounts":[{"name":"data","mountPath":"/srv/var"}]}],"volumes":[{"name":"data","persistentVolumeClaim":{"claimName":"data-remark42"}}]}}'
Copy the archive into the helper pod with and restore:
kubectl cp remark42-data.tar.gz remark42-restore:/tmp/remark42-data.tar.gz
kubectl exec remark42-restore -- tar xzf /tmp/remark42-data.tar.gz -C /srv/var
kubectl exec remark42-restore -- chown -R 100:100 /srv/var
kubectl delete pod remark42-restore
4. Start the new deployment¶
5. Verify¶
Check that the pod starts and Remark42 serves the migrated comments:
Post-migration¶
- Update the DNS records for
comment.janikvonrotz.chto point to the Kubernetes ingress. - Remove the old Docker container and volume once the migration is verified.
- Enable K8up backups (
k8up.enabled: true) and create thes3-credentialssecret.