Skip to content

Instantly share code, notes, and snippets.

@benbasscom
Last active January 17, 2023 15:14
Show Gist options
  • Save benbasscom/848f0a46bb81f3c1c1dd to your computer and use it in GitHub Desktop.
Save benbasscom/848f0a46bb81f3c1c1dd to your computer and use it in GitHub Desktop.
#######################################################
Please note that this does NOT bring over any users or groups. You need to restore OD for your Open Directory users to log in properly.
On the Target Server
1. Setup new Target Server with IP domain name etc.
2. Start the wiki service - log in and check that it is running properly.
3. Turn off the Wiki Service on your Target Server, and quit out of Server.app
On Source Server
1. Copy the FileData from your source server to your target server
a. Copy FileData from your latest Bender Backup.
b. Copy directly from /Library/Server/Wiki/FileData
2. Perform a dump of your collab database:
a. Copy the collab.pgdump /Backups folder if using Bender
b. Manually perform the pg dump:
pg_dump -h "/Library/Server/Wiki/PostgresSocket" --format=c --compress=9 --blobs --username=collab --file=/tmp/collab.pgdump collab
**Note you can and should change the destination of the pgdump.**
On the Target Server
1. Copy the FileData to the target system.
/Library/Server/Wiki/FileData
2. Set owners and permissions on the target.
sudo chown -R _teamsserver:_teamsserver /Library/Server/Wiki/FileData
sudo chmod -R +a "www allow search" /Library/Server/Wiki/FileData
3. Prepare the Target for the pgdump.
Connect to the psql service for the Wiki Service. This will be done from within psql, so your prompt will change.
sudo psql -h "/Library/Server/Wiki/PostgresSocket" -U collab template1
Clear out PID so we can drop the database:
SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = 'collab' AND pid <> pg_backend_pid();
Drop the existing collab database:
drop database "collab";
Create a new collab database:
create database "collab";
Quit out of psql:
\q
4. Restore the Wiki by loading the pgdump from the Source Server:
1. Enable Wiki Service in Server.app
2. sudo pg_restore -h "/Library/Server/Wiki/PostgresSocket" -d collab -U collab --single-transaction "/Path/to/location/of/collab.pgdump"
5. Clean up wiki permissions, searchindex and quicklooks.
sudo wikiadmin fixPermissions
sudo wikiadmin rebuildSearchIndex
sudo wikiadmin resetQuicklooks
6. Log in to your wiki's on the Target Server.
#######################################################
@nitrokevin
Copy link

will this also work on El Capitan?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment