Howto launch several SàT instances
SàT is not intended to have several instances. However, it can be useful sometimes, e.g. if you want an instance as your main XMPP client, and an other one for development purpose.
/!\ the following howto need the development version /!\
In the following howto, we suppose we have already a running instance of sat in ~/dev/sat that we use for development, and we want to add ~/sat_main as our primary XMPP client.
first clone sat repository
cd hg clone http://repos.goffi.org/sat sat_main
We need to have a sat_conf suitable for this instance. As the conf is cascading, you just have to create one in sat_main which indicate the new directory. i.e. if you have already ~/.sat.conf with the following content:
which means "my media are in ~/dev/sat_media" and will be used by both ~/dev/sat and ~/sat_main, just add a new conf in ~/sat_main/src/.sat.conf with the following content:
[DEFAULT] local_dir=~/.sat_main/ pid_dir=%(local_dir)s
which mean "my data dir for ~/sat_main is at ~/.sat_main, and the same dir is used for the pid file".
Now we must tell sat_main to use a different bridge (D-Bus) interface. For this we use bridge_constructor to generate a new bridge. Go to ~/sat_main/src/bridge/bridge_constructor and enter the following command:
SAT_BRIDGE_CONST_INT_PREFIX='"org.goffi.sat_main"' ./bridge_constructor.py --force && cp generated/DBus.py ../DBus.py
The SAT_BRIDGE_CONST_INT_PREFIX environment variable means "use org.goffi.sat_main as interface instead of the usual org.goffi.SAT", we use that to generate the backend (--force is to overwrite any previously existing bridge), and if everything is alright, we copy it as a new backend bridge. We do the same for the frontend:
SAT_BRIDGE_CONST_INT_PREFIX='"org.goffi.sat_main"' ./bridge_constructor.py -s frontend --force && cp generated/DBus.py ../../../frontends/src/bridge/DBus.py
at this point, we have nearly everything done, we just have to tell python to use the good files. Create a lib dir with symbolic links to the directory we want to use:
cd ~/sat_main mkdir lib cd lib ln -s ../src sat ln -s ../frontends/src sat_frontends
Finally, we have to tell python to use these links. We just have to export the following variable each time we want to use ~/sat_main instead of ~/dev/sat:
and then, in the same shell of course, launch sat:
cd ~/sat_main/src ./sat.sh
- you need to export PYTHON_PATH before launching frontends too, else your frontend will connect to the other SàT instance.
- you can check that you instance is correctly launched by checking that org.goffi.sat_main exist, using e.g. D-Feet.
- you have to change ports numbers in parameters for servers running to avoid conflict (e.g. IMAP server)
- if you experience some troubles and an installed version of sat is launched instead of this sat_main, check for any .pth file that could override your sys.path dynamically. For example we experienced a problem with easy-install that has been solved like that:
sudo updatedb # to rebuild your locate database locate "*.pth"
This found a file /usr/local/lib/python2.7/dist-packages/easy-install.pth from where we had to remove /usr/local/lib/python2.7/dist-packages
Use VirtualEnv to launch concurrent instances.