I want to download a copy of our instance to send for hosting on a new server. How do I download this copy?
The easiest way is always to backup the database and export to the new instance. @Herbert. The Instance has all of its details in the database. Then restore to the new instance created in the new server.
Yes, @KMurumba is correct. I always take a backup of our DHIS2 instance and restore on my laptop for testing/development purposes. It just works - except the following:
- We need to run the analytics once again to see the reports etc. I don’t know why.
- The customisation of login page. I suppose the pictures we load are kept under a system level folder, not part of the database.
This is true because, with the new instance, you have to run analytics to get data from the database. So it is something that needs to be run. It is the reason why for any change in data, you have to run the analytics to get data in visualization.
The images are always stored in the system folders (War File). These should be noted so that all the relevant images are copied to the new server.
* Please tick the “Solution” box below if the answer helps to resolve your issue.
This will help others to identify whether a question/clarification is answered correctly.
It’s not 100% correct that you HAVE to run analytics - you can dump and then restore the db WITH all the analytics tables. But it is in general much more efficient to drop the analytics tables (e.g. by using the psql “-T analytics*” parameter) and then re-run analytics, for several reasons:
- Restoring uses a single thread whereas analytics runs use multi-threading, so the latter is faster.
- The dump file is smaller and thus easier to transfer (assuming it’s a net transfer).
There are at least two formats you can use for dumping postgresql databases: either as a folder where each table is dumped and compressed, or as a single file. The latter is probably easier, so use these commands (assuming the user role is called ‘dhis’). -f is the filename and -d the database name
pg_dump -U dhis -T analytics* -f .sql
to restore on the new server:
psql -U dhis -f .sql -d
Enter password when prompted.