One way to fix the broken previews and web submissions is to download the XLSForm of each form, change the version number, and re-upload the form. This will generate entirely new previews and web submissions links and is a very quick fix if you don't have an ongoing campaign.
If you have distributed public access links and have an ongoing campaign that uses those links, then new previews and web submissions links might be too disruptive. In that case, you'll need to dump the Enketo databases and secrets from the old machine and restore it to the new machine so you can have your old previews and web submission links.
The instructions below assume that you are not changing the externally facing hostname (e.g., mycentralserver.example.com). If you are, you'll need find and replace the hostnames in the Enketo databases. Doing that is possible, but is out of scope for this post.
I strongly recommend you have a snapshot of both machines before taking any of the following steps!
On the old machine, make sure Central is running as usual. Run the following commands to dump the databases and secrets.
docker exec enketo_redis_main redis-cli -p 6379 save;
docker cp enketo_redis_main:/data/enketo-main.rdb ~/enketo-main.rdb;
docker exec enketo_redis_cache redis-cli -p 6380 save;
docker cp enketo_redis_cache:/data/enketo-cache.rdb ~/enketo-cache.rdb;
docker cp service:/etc/secrets ~/;
Now transfer the enketo-main.rdb
, enketo-cache.rdb
, secrets
files from the home folder of the old machine to the home folder of the new machine. Make sure Central is running as usual, then run the following.
docker stop enketo_redis_main;
docker cp ~/enketo-main.rdb enketo_redis_main:/data/enketo-main.rdb;
docker start enketo_redis_main;
docker stop enketo_redis_cache;
docker cp ~/enketo-cache.rdb enketo_redis_cache:/data/enketo-cache.rdb;
docker start enketo_redis_cache;
docker stop service;
docker cp ~/secrets service:/etc;
docker start service;
In your secrets
folder, you'll have three files: enketo-api-key
, enketo-less-secret
, enketo-secret
. You'll need to use nano to edit your Enketo config to those values.
docker exec -it enketo sh;
apt-get install nano -y;
nano config/config.json;
Update config/config.json
with the secrets
values.
{
"app name": "Enketo",
"base path": "-",
"encryption key": "contents of enketo-secret",
"id length": 31,
"less secure encryption key": "contents of enketo-less-secret",
"linked form and data server": {
"api key": "contents of enketo-api-key",
Now uninstall nano, and exit enketo container.
apt-get remove nano -y;
exit;
Now restart enketo.
docker restart enketo;