How to install CommaFeed (with MySQL and Apache Reverse Proxy) under Arch Linux

Standard

CommaFeed

CommaFeed is a lightweight, self-hosted alternative to Google Reader. I was looking for a self-hosted solution since The Old Reader became way too slow to be usable and CommaFeed fits the bill nicely.

Note: This post assumes you want to access CommaFeed from a subdomain (i.e commafeed.example.com), if you don’t want that, follow the guide and do the extra steps at the end of this post.

Here are the – surprisingly few – steps you need to follow to install it on an Arch Linux server:

$ pacman -S maven
$ packer -S jdk #(You can use other AUR helpers, or simply download the tarball from AUR).
$ git clone https://github.com/Athou/commafeed.git
$ cd commafeed
$ mvn clean package tomee:build -Pprod -Pmysql

If this is the first time you are building CommaFeed, this will take a little while as maven will fetch a lot of build dependencies. After the compilation is finished, do the following – as root – in the build directory:

# mkdir /opt/commafeed
# mv target/commafeed.zip /opt/commafeed
# cd /opt/commafeed && unzip commafeed.zip
# mv webapps/commafeed.war webapps/ROOT.war

Now, open conf/tomee.xml and set your MySQL connection credentials.

Finally, mark the binaries as executable with:

# chmod +x bin/*.sh

At this point, you can access CommaFeed on the default port (8082) but let’s configure a reverse proxy so we can access it on port 80 without affecting other applications on that port.

In your VirtualHosts configuration, add the following (replacing example.com with your domain):

NameVirtualHost *:80

<VirtualHost *>
    ServerAdmin me@example.com
    ServerName commafeed.example.com
    ProxyPreserveHost On

    # setup the proxy
    <Proxy *>
        Order allow,deny
        Allow from all
    </Proxy>
    ProxyPass / http://localhost:8082/
    ProxyPassReverse / http://localhost:8082/
</VirtualHost>

You are almost ready!

Open up the MySQL database you have created for CommaFeed and run the following query:

UPDATE APPLICATIONSETTINGS SET publicUrl = 'http://commafeed.example.com/';

Now, we can finally start the application:

# sh /opt/commafeed/bin/startup.sh

That’s it! You should now be able to access CommaFeed by visiting http://commafeed.example.com!

If you ever need to stop the server, you can simply run:

# sh /opt/commafeed/bin/shutdown.sh

Enjoy ๐Ÿ™‚ Feel free to ask any questions in the comments.

P.S: If you don’t want to install to a subdomain, here’s what to do. Let’s assume you want CommaFeed to be accessed via http://example.com/commafeed.

# mv /opt/commafeed/webapps/ROOT.war /opt/commafeed/webapps/commafeed.war

In your Apache VirtualHost config, find the following lines:

    ProxyPass / http://localhost:8082/
    ProxyPassReverse / http://localhost:8082/

and replace them with:

    ProxyPass /commafeed/ http://localhost:8082/commafeed/
    ProxyPassReverse /commafeed/ http://localhost:8082/commafeed/

Now, run the following SQL query in your CommaFeed database:

UPDATE APPLICATIONSETTINGS SET publicUrl = 'http://example.com/commafeed/';

Finally, restart the application:

# sh /opt/commafeed/bin/shutdown.sh
# sh /opt/commafeed/bin/startup.sh

… and voila! You are all set ๐Ÿ™‚