install wave in a box

Install Wave in a box (Apache) on CentOS

Google had unveiled a real time messaging platform in 2009, and in April 2012 Google discontinued wave and released its source code to open source community. Apache Software Foundation consequently accepted Google Wave into its incubator program.
Apache Wave is a distributed, near-real-time, rich collaboration platform that allows users to work together in new and exciting ways. It allows for flexible modes of communication, blending chat, email and collaborative document editing into one seamless environment. In this post, I am going to talk about how you can install wave on your server, which is widely known as Wave in Box (WiB).

System Configuration:

I am using a Virtual Machine with following configuration:

  • CPU : 2 vCPU
  • RAM: 4 GB
  • OS : CentOS 6.2

Pre-requisites:

To install Apache Wave, following applications should be installed first:

  • Java JDK – Either Sun/Oracle JDK or Open JDK both appear to work
  • ANT Build tool
  • Mercurial Distributed Source Control Package
  • Eclipse – The chosen IDE for Wave development
  • Subversion (To download wave)
  • MongoDB (optional)

Use Yum package manager to install all the pre-requisites

[root@centos ~]# yum install mercurial eclipse java-1.6.0-openjdk java-1.6.0-openjdk-devel subversion mongodb

Install Wave

1) Download wave source : Go to the root directory and use the following command to download the Apache wave source

[root@centos ~]# svn co https://svn.apache.org/repos/asf/incubator/wave/trunk
A    trunk/.classpath
A    trunk/make_cert.sh
A    trunk/RELEASE-NOTES
A    trunk/server-config.xml
A    trunk/proto_src
A    trunk/proto_src/org
A    trunk/proto_src/org/waveprotocol
A    trunk/proto_src/org/waveprotocol/protobuf
A    trunk/proto_src/org/waveprotocol/protobuf/Extensions.java
A    trunk/proto_src/org/waveprotocol/wave
..... (many things will download here)
.....
A    trunk/war/static
A    trunk/war/static/document.png
A    trunk/war/static/logo.png
A    trunk/war/static/images
A    trunk/war/static/images/unknown.jpg
A    trunk/war/static/earth.png
A    trunk/war/static/microphone.png
A    trunk/war/static/wiab_screenshot_small.jpg
A    trunk/war/static/auth.css
A    trunk/war/static/favicon.ico
A    trunk/war/static/wiab_screenshot.jpg
A    trunk/wiab-logging.conf
Checked out revision 1523889.
[root@centos ~]#

2) The above mentioned command will create a directory named “trunk”. Go to the directory where you will see the following files:

[root@centos ~]# cd trunk/
[root@centos trunk]# ls
build-classpath.xml             build-proto.xml        jaas.config              NOTICE                   README.export-import  server.config.example             third_party
build-common.xml                build.xml              jsongadgets.json         platforms                RELEASE-NOTES         server-config.xml                 thumbnail_patterns
build-libraries-proto.xml       CHANGES                KEYS                     process-script-args.sh   run-export.sh         server.federation.config          tools
build-macros.xml                check-certificates.sh  LICENSE                  prosody.cfg.lua.example  run-import.sh         server.federation.config.example  war
build.properties                DISCLAIMER             make_cert.sh             proto_src                run-server.bat        src                               wiab-logging.conf
build-proto.properties.example  doc                    migrate-attachments.xml  README                   run-server.sh         test
[root@centos trunk]#

3) Build the source using “ ant ” command.

[root@centos wave-protocol]# ant
Buildfile: build.xml

init-logging:
    [mkdir] Created dir: /usr/local/src/wave-protocol/build/logs
     [echo] Logging to /usr/local/src/wave-protocol/build/logs/build_2013-09-13_06-16-41.log

init:
    [mkdir] Created dir: /usr/local/src/wave-protocol/build/proto
    [mkdir] Created dir: /usr/local/src/wave-protocol/build/messages
    [mkdir] Created dir: /usr/local/src/wave-protocol/build/src
    [mkdir] Created dir: /usr/local/src/wave-protocol/build/test
    [mkdir] Created dir: /usr/local/src/wave-protocol/build/coverage
    [mkdir] Created dir: /usr/local/src/wave-protocol/dist
    [mkdir] Created dir: /usr/local/src/wave-protocol/build/staging
    [mkdir] Created dir: /usr/local/src/wave-protocol/build/dep
    [mkdir] Created dir: /usr/local/src/wave-protocol/test_out

This may display the error “ BUILD FAILED ” on running the compile-gwt as shown below.

compile-gwt:
     [java] Compiling module org.waveprotocol.box.webclient.WebClientProd
     [java]    Computing all possible rebind results for 'org.waveprotocol.wave.client.wavepanel.impl.toolbar.EditorToolbarResources'
     [java]       Rebinding org.waveprotocol.wave.client.wavepanel.impl.toolbar.EditorToolbarResources
     [java]          Invoking generator com.google.gwt.resources.rebind.context.StaticClientBundleGenerator
     [java]             Creating fields
     [java]                [ERROR] An error occurred while trying to write the image bundle.
     [java] javax.imageio.IIOException: Can't create output stream!
     [java]     at javax.imageio.ImageIO.write(ImageIO.java:1564)
     [java]     at com.google.gwt.resources.rg.ImageBundleBuilder.createImageBytes(ImageBundleBuilder.java:561)
     [java]     at com.google.gwt.resources.rg.ImageBundleBuilder.render(ImageBundleBuilder.java:680)

[java]     at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:82)
     [java]     at com.google.gwt.dev.Compiler.main(Compiler.java:177)
     [java]    [ERROR] Errors in 'org/waveprotocol/wave/client/widget/button/icon/IconButtonTemplate.java'
     [java]       [ERROR] Line 298: Failed to resolve 'org.waveprotocol.wave.client.widget.button.icon.IconButtonTemplate.Resources1' via deferred binding

BUILD FAILED
/root/pro/trunk/build.xml:357: Java returned: 1

Total time: 1 minute 49 seconds
[root@centos trunk]#

Solution of this error has been provided at https://groups.google.com/forum/#!msg/google-web-toolkit/tAC3kC9eius/DZOdOLhEC-cJ

So, to fix the issue add following in /etc/security/limits.conf It will increase the open file limit of the server to 2048.

*               soft    nofile          2048

Now compile the wave with ant again and you will get BUILD SUCCESSFUL message

dist-server:
      [jar] Building jar: /root/pro/trunk/dist/wave-in-a-box-server-0.4-incubating.jar
    [touch] Creating /root/pro/trunk/build/dep/dist-server

dist-export-import-dep:

dist-export-import:
      [jar] Building jar: /root/pro/trunk/dist/wave-in-a-box-export-import-0.4-incubating.jar
    [touch] Creating /root/pro/trunk/build/dep/dist-export-import

dist:

BUILD SUCCESSFUL
Total time: 18 minutes 30 seconds
[root@centos trunk]#

4) Create Server Config file : After successful build, we will have to create server configuration file. Execute following command to create server.config file

[root@centos trunk]# ant -f server-config.xml
Buildfile: server-config.xml

create-folders:
    [mkdir] Created dir: /root/pro/trunk/_certificates
    [mkdir] Created dir: /root/pro/trunk/_attachments
    [mkdir] Created dir: /root/pro/trunk/_accounts
    [mkdir] Created dir: /root/pro/trunk/_deltas
    [mkdir] Created dir: /root/pro/trunk/_sessions

server-config:
     [echo] Generating server.config
     [copy] Copying 1 file to /root/pro/trunk
     [copy] Copying 1 file to /root/pro/trunk

BUILD SUCCESSFUL
Total time: 0 seconds
[root@centos trunk]#

5) Open “server.config” file in your favorite editor (vi, nano or vim) and make the following changes:

http_frontend_public_address = IP_ADDRESS_OF SERVER:9898 or HOSTNAME:9898
http_websocket_public_address = IP_ADDRESS_OF SERVER:9898 or HOSTNAME:9898
http_websocket_presented_address = IP_ADDRESS_OF SERVER:9898 or HOSTNAME:9898
http_frontend_addresses = IP_ADDRESS_OF SERVER:9898 or HOSTNAME:9898

Save and Exit the file.

6) Now execute the “./run-server.sh” file.

[root@centos wave-protocol]# ./run-server.sh

If you don’t see any Java Exceptions or Error try to access wave using http://hostname:9898 or http://ipaddress:9898