Testing
I hate my stupid computer
Thursday, 24 December 2020
Saturday, 28 July 2012
Wiki is dead long live Wiki - Restoring Lion Server from TimeMachine
I found myself in the situation of having to restore my company's Lion Server from a Time Machine backup.
All to-do with upgrading to Mountain Lion and finding it completely trashed MySQL, but that's another story
Apple have removed Lion Server install from the App store, but luckily I kept a backup. I created a bootable USB from it and booted the Mac from it.
From here I was able to restore from a TimeMachine Backup.
Sigh of relief.. We use the Lion Server Wiki extensively and it also is home to a bug tracking database (Mantis), so getting it back up quickly is critical!
Time to sit back and wait..
After the restore the server comes back up and I can login with the original admin password, great!
Hang on...
When I access the wiki I get a who series of errors and and no wiki!!! Opening the Server app and selecting the Wiki service, it gives me "error reading settings"
After much googling I found this nugget (here):
sudo echo "limit maxfiles 10240 120000" > /etc/launchd.conf
So I tried, after rebooting I found I could no longer log into the Server app, turned out the service had not started. So i did this:
This restarted the service and I could start and login to the Server app. Still the Wiki service was showing an error.
Then I found this (here)
That did the job! Something todo with the postgres database for the Wiki.
Now I can get to the Wiki and login..
BUT .. Where is the data??
Our bug database works, but thats using MySql and is separate web site. The Wiki is blank!
Turns out that when restoring from TimeMachine it does not restore the Wiki data
So after much searching I found a solution (here)
/<backupdisk>/Backups.backupdb/<servername>/<date>/<disk>/Library/Server/Wiki/FileData
Copy the FileData folder to the users home
You will also need the postgres database which is in:
/<backup disk>/Backups.backupdb/<servername>/<date>/<disk>/Library/Server/PostgreSQL
I'm not sure why, but mine was in Backup/dumpall.psql.gz So after copying it to the users home I had to extract it.
I did this by changing the permissions using finder to give me read access. Then double clicking on the copied .gz. This gave me a dump all.psql
Then I did the following:
sudo cp -R $HOME/FileData /Library/Server/Wiki/FileData
sudo chown -R _teamsserver:_teamsserver /Library/Server/Wiki/FileData
sudo serveradmin start postgres
sudo rake -f /usr/share/collabd/server/Rakefile db:drop
sudo createuser -U _postgres -d -s collab
sudo createdb -U collab collab
sudo psql -U _postgres -d collab -U collab -f $HOME/dumpall.psql
sudo serveradmin start wiki
And that did it, one restored Wiki Server!!
sudo chmod -R +a "www allow read" /Library/Server/Wiki/FileData
sudo serveradmin stop wiki
sudo serveradmin stop wiki
sudo rake -f /usr/share/collabd/server/Rakefile db:drop
sudo createuser -U _postgres -d -s collab
sudo createdb -U collab collab
sudo psql -U _postgres -d collab -U collab -f $HOME/dumpall.psql
sudo serveradmin start wiki
And that did it, one restored Wiki Server!!
I can't be 100% certain that everything works until people start using it on Monday morning.
Thanks to all who posted in the forums and blogs! Thanks to Apple for such a nasty bug!
Saturday, 28 January 2012
Calling C/C++ functions from Objective C
I Have just started my first proper project Xcode and found myself wanting to re-use C and C++ code.
Do it like this:
Create a c/cpp file and header in XCode
Write some c or cpp code
Include the header in your objective C file
Call your code! easy.
If the code is cpp, then you have to rename your objective C file (.m) to .mm
Subscribe to:
Posts (Atom)