Sunday, 7 April 2013

Installing Tiny Tiny RSS on Bluehost/Hostmonster (v1.7.8)

People report that works for other shared hosts, like Hostmonster. And see the comments on the previous post, for potential help with any problems you may encounter.

Installation steps

To actually get to the point you have a working installation of Tiny Tiny RSS on Bluehost, the following steps are adapted from the basic installation notes:

  1. Download and extract the source code for Tiny Tiny RSS for version 1.7.8. Later versions may change in ways where the following instructions no longer work.
    cd public_html
    wget -c "https://github.com/gothfox/Tiny-Tiny-RSS/archive/1.7.8.tar.gz"
    tar xzf 1.7.8
    mv Tiny-Tiny-RSS-1.7.8 tt-rss
    cd tt-rss
    .
    Note that GitHub serves a file named "1.7.8", so the tar command needs to specify that file name and not the one given to wget. Note that "tt-rss" is used in the SELF_URL_PATH configuration variable mentioned below, and maps to this sub-directory you've created in your "public_html" directory. If you plan to use a unique and secret directory name, you'll need to change both these locations.
  2. Open a web browser to the Bluehost cpanel.
  3. Create the database and database user there, as per Bluehost's instructions.
  4. Import the tt-rss database schema, replacing [user] and [database] respectively with the values you used in cpanel.
    mysql -p -u [user] [database] < schema/ ttrss_schema_mysql.sql
  5. Make the configuration file that Tiny Tiny RSS expects, and prepare to start editing it.
    cp config.php-dist config.php
    nano -w config.php
  6. Edit the following variables within the configuration file:
    • DB_TYPE to "mysql".
    • DB_USER to your user name.
    • DB_NAME to your database name and DB_PASS is of course your database user password.
    • SELF_URL_PATH to incorporate your host name (this must map to the directory name it was extracted to).
    • PHP_EXECUTABLE to /usr/php/53/usr/bin/php.  The tt-rss website states that PHP 5.3 or newer is required, however by default PHP_EXECUTABLE points to version 5.2 of PHP on Bluehost.  Go to the PHP Config button in the Bluehost cpanel and select PHP 5.3 there, this will set your php.ini in your public_html directory and other things.
    • Maybe ENABLE_GZIP_OUTPUT to true. If you do not know that your PHP installation supports GZIP, then go to the extra section below related to checking PHP suitability.
At this point, you should open your browser and view the address in SELF_URL_PATH. It should show you the next screenshot. If you do not see the Tiny Tiny RSS login screen, you have done something wrong.

Securing your installation

At this point you will see the following web page. Log in using the default login name which is "admin" and the default password, which is "password". We will proceed to chance these.


Select the preferences item in the menu on the top right hand side of the feeds view.


Select the rightmost pane, which is the "Users" pane where we will change your password.


Check the "admin" user, and click the "Edit" button in the row above it.



Importing Google Reader data

Tiny Tiny RSS supports importing two things, feed subscriptions, and starred items. Go to Google Takeout and get your Google Reader data. If you do not know how to do this, google how to do it. You should get a zip file with "subscriptions.xml" and "starred.json" files within it (among others). Extract these two files somewhere convenient.

Enable importing from Google Reader. Go to the Plugins sub-pane on the main Preferences pane.


Within the Feeds pane, select the OPML sub-pane and import your "subscriptions.xml" file. If you return to the main view, exiting the preferences screen, then you should see these subscriptions populating the left-hand side of the page.


Within the Feeds pane, select the 'Select starred or shared items from Google Reader' sub-pane. Import your "starred.json" file. This will eventually popup a dialog telling you how many items were imported.


Time to populate the feeds, and then to have them populated automatically from then on.

Automatically updating your feeds

Your feeds have been entered in Tiny Tiny RSS, but it still needs to update your feeds and fetch the new items for you.

This will not fetch all the items you have in Google Reader. This is because feeds offer a set number of recent items, and not all items ever posted to them in the past. Tiny Tiny RSS is not intended to keep older items indefinitely, and from what I can tell users are expected to have it discard them after holding them for a limited period of time.

Do an initial fetch with the following command line:
cd ~public_html/tt-rss
/usr/php/53/usr/bin/php-cli update.php --feeds
If you are successful, this will output the following:
...
[22:11:04/12302] Base feed: http://simple-green-frugal-co-op.blogspot.com/feeds/posts/default
[22:11:04/12302]  => 0000-00-00 00:00:00, 100
...
[22:11:09/12302] Sending digests, batch of max 15 users, headline limit = 1000
[22:11:09/12302] All done.
[22:11:09/12302] Feedbrowser updated, 340 feeds processed.
[22:11:10/12302] Purged 0 orphaned posts.
[22:11:10/12302] Cleaned 0 cached tags.
This may not fetch all your feeds. If it hasn't fetched a feed this is okay, it will eventually fetch it, and is likely limiting the server load per attempt.

Now that you know updating is working, add this as a cron job so that it happens every 30 minutes. Return to your Bluehost control panel and find the 'Cron jobs' link. On the cron jobs page, add a new one that happens twice an hour, with the following command line:
cd /home/disinter/public_html/tt-rss2 && /usr/php/53/usr/bin/php-cli /home/disinter/public_html/tt-rss2/update.php --feeds >/dev/null 2>&1
You will of course need to replace "disinter" with your own Bluehost account name.



Extra: The missing manual

Between the bugs and the lack of documentation, I have several things I wouldn't want to have to work out again due to the extra confusion they caused and the time they wasted:
  • Selecting "Use less traffic" when logging in will cause images to be displayed as links.
  • It is not possible to cache images locally (when feeds are updated) as a global default setting, each feed should be manually set to have this option in Preferences. The best time to do this is just after the feeds are imported (or manually added), and before they are updated for the first time.

Extra: Checking PHP suitability

If you are using a web host that is not Bluehost, you might wish to verify that the version of PHP available to you, is suitable.

The main tt-rss page lists required PHP modules, which are mbstring and json.  These are present on Bluehost, and can be seen by reading the following generated file:
echo "" | php > phpinfo.html
pcntl is also installed, which is said to allow forked updating of subscriptions I guess.  php_basedir has no value, which should mean unlimited open files, but Bluehost may have some other resource limiting in place.  allow_url_fopen is on.  So it all looks good.

Extra: Hostmonster confirmation

Hostmonster is exactly the same as Bluehost with a different logo and a different name. I've switched my hosting to Hostmonster, and setting up tt-rss there is exactly the same as for Bluehost.