== Chat Server Setup == 1. Install a JRE: 1.5.0 or later. You can check your java version by typing "java -version" at the command line and (if necessary) upgrade your Java installation by visiting http://java.sun.com. On Debian you can use: {{{ apt-get install openjdk-6-jre }}} 2. Download Openfire server tarball (recommended version: 3.9.3): {{{ cd /tmp wget http://www.igniterealtime.org/downloadServlet?filename=openfire/openfire_3_9_3.tar.gz -O openfire.tar.gz }}} 3. Extract the archive to /opt : {{{ cd /opt sudo tar zxvf /tmp/openfire.tar.gz cd /opt/openfire/bin ./openfire start }}} 4. Next steps can be done manually or through a script. == Automatic == This script is right now for custom db integration with Mysql only. 1) Do a clean Sahana Eden install after clearing databases. Use Mysql as the database for Eden by setting it in 000_config.py. The database name will later be used in the automation script. 2) Create a new Mysql database for Openfire server. Remember its name as it will be used in automation script. 3) Install selenium for python. {{{ pip install -U selenium }}} 4) Download script from https://github.com/arnavkagrawal/chatserverautomation/blob/master/chat_server.py 5) Copy it into web2py directory. Eden must already be present. 6) Run the script after making configuration changes near line 116. 7) Run the script using sudo python web2py.py -S eden -M -R chat_server.py. It will take some time to run. == Manual == Doing this will enable web console. Open the browser with url http://:9090/ 4. Follow through the onscreen steps to set up web console. Basic Steps: * Language Selection * Server Settings: Choose default * Database settings: Create a database, say in mysql. Use the same name for database settings.. * Profile Settings: Default (store users and groups in the server database) * Admin account: Give a valid email address for user 'admin' 5. After logging into admin console as 'admin' go into server settings tab, go into HTTP Binding and enable 'Clients can connect to this server using HTTP binding.' and save the settings. The port numbers can be changed to whichever you like. The default ports are 7070 and 7443. This port number is the one which will be used to connect by Sahana Eden Chat. So the chat ip to be entered in 000_config file will be ":". Go to Server->Server Settings->HTTP Binding and enable script syntax. 6. Go into plugins, from Available Plugins install * Broadcast * Client Control * Presence Service * Registration * User Creation * User Import Export If for some reason you cannot see available plugins you can upload jar files after downloading from https://www.igniterealtime.org/projects/openfire/plugins.jsp. 7. Restart the Openfire server. {{{ sudo /opt/openfire/bin/openfire restart }}} == Setup contact list for each user and greeting message == 1. Create a group called "everyone". Users/Groups -> Groups -> Create New Group . 2. Click enable in Contact List (Roster) Sharing. 3. Enter “everyone” as Group Name and tick share group with additional users(after clicking select all users option). 4. Go to User/Group -> Users -> Registration Properties 5. Enter whatever message you want to welcome message box and click on save message. 6. Enter the default group as “everyone” in default group box and click on save group. 7. Then in the registration settings box at the top tick: * Enable welcome message. * Enable automatically adding of new users to a group Click on Save Settings. 8. Go to User/Groups -> Groups. Go to everyone group and manually add admin as the user to that group. == Setup Status messages == 1. Go to Server -> Server Settings -> Presence Service and change presence visibility to Anyone. == Custom DB Integration == === MySQL === 1. In the sql table of auth_user add a user with email "chat_admin@example.com" , username "chat_admin_example.com" and password of your choice(having alphanumeric characters). {{{ w2p db.auth_user.insert(email="chat_admin@example.com", username="chat_admin_example.com", password="changeme", first_name="Chat") db.commit() }}} 2. Open Openfire console http://servname:7070. Go to System Properties and set the following properties. Change: * provider.auth.className to org.jivesoftware.openfire.auth.JDBCAuthProvider * provider.user.className to org.jivesoftware.openfire.user.JDBCUserProvider Add (if some property names are already present modify them to the given values): * jdbcProvider.driver : com.mysql.jdbc.Driver * jdbcProvider.connectionString : jdbc:mysql://localhost/?user=&password= * jdbcAuthProvider.passwordSQL : select password from auth_user where username=? * jdbcAuthProvider.passwordType : plain * jdbcUserProvider.loadUserSQL : select first_name,email from auth_user where username=? * jdbcUserProvider.userCountSQL : select count(*) from auth_user * jdbcUserProvider.allUsersSQL : select username from auth_user * jdbcUserProvider.searchSQL : select username from auth_user where * jdbcUserProvider.usernameField : username * jdbcUserProvider.emailField : email * jdbcUserProvider.nameField : first_name * admin.authorizedJIDs: choose a username from the user database and put it here e.g. chat_admin_example.com@ 3. Restart the Openfire server. {{{ sudo /opt/openfire/bin/openfire restart }}} === PostgreSQL === tbc