Thursday, May 23, 2013

PostgreSQL Database Backup on Fedora

This procedure requires you first setup the TTRSS UTILS environment described in the post:  TTRSS  UTILS - Fedora Tiny Tiny RSS Utilities

This method uses CRON under your own userid and pulls db_name and db_user information from your TTRSS config.php

Backup files will be stored in $home/ttrss_maint/db_backup/ and will be retained for 14 days.

Create a .pgpass file in your home directory:

Secure the file:  chmod 600 .pgpass

Copy the contents of ../ttrss_utils/sample_conf/db_backup_crontab into your crontab:  crontab -e
Replace xxxxx with your account_name.

If you wish to run the backup manually:
  1. cd $home 
  2. cd ttrss_maint/ttrss_utils 
  3. ./pgsql_cron_backup

Installing PostgreSQL on Fedora for Tiny Tiny RSS

I recently decided to switch my Tiny Tiny RSS database from MariaDB/MySQL to PostgreSQL.  Mainly  because of this post:  MySQL issues: Lock wait timeout exceeded

The bottom line is you get much better performance from Postgresql.  Postgresql uses less system resources and it really isn't a big deal to install or support; it is fairly simple.  I really don't get why it isn't more popular.  If it were a massive pain, I could understand it, but it really isn't.  Go figure!

That said, here we go...
As root:
yum install postgresql postgresql-server postgresql-contrib php-pgsql

After the install, you must next initialize the postgresql database:
postgresql-setup initdb

Now start and enable the service, so it will automatically start when you boot: 
systemctl start postgresql.service
systemctl enable postgresql.service

Configure the service account for Tiny Tiny RSS: 
su - postgres
createuser -P -S -D -R -l ttrss_user

When prompted to enter a password, create a new password:
enter new password:  your_password

Create the Tiny Tiny RSS Database:
createdb --owner=ttrss_user ttrss_db

Grant permissions to the ttrss_db: 
grant all on database ttrss_db to ttrss_user;

Now you need to modify the postgresql client authentication configuration file to ensure you can login with all the changes you just made: 
cd /var/lib/pgsql/data

Make a backup of the distribution configuration file: 
cp pg_hba.conf pg_hba.conf.dist
vim pg_hba.conf

Now, change the lines ending in 'ident' to end with 'md5'

Restart PostgreSQL to activate all the changes:
systemctl restart postgresql.service

Load the Tiny Tiny RSS Postgresql schema:
psql -U ttrss_user -d ttrss_db -f /var/www/html/ttrss/schema/ttrss_schema_pgsql.sql

Monday, May 13, 2013

Upgrading TTRSS - Sphinx search, schema changes and config.php

After you complete the upgrade, you'll want to check:
  1. config.php-dist to see if there have been any changes.  I have a post which describes a utility that can assist.
  2. Schema changes.  TTRSS will walk you through the procedure, if needed, when you first try to login after an upgrade.
  3. Rebuild the Sphinx full-text index of the ttrss database.  You'll want to do this if there has been a schema change.
To rebuild the Sphinx full-text index:

sudo systemctl stop searchd.service 

Run the indexer to create the full-text index of the ttrss database:

cd /bin
sudo ./indexer --all

sudo systemctl start searchd.service 

That's it.  You're done.


Friday, May 3, 2013

SPDY with NGINX 1.4.0 on Fedora 18 - Tiny Tiny RSS

I've seen many postings regarding the activation of SPDY with Tiny Tiny RSS - quite a few people seem to have installation/configuration problems.

With the recent release of NGINX 1.4.0, SPDY support is included so you don't have to do it manually.  NGINX 1.4.0 will be included with Fedora 19, which will be available in July.

I pulled the spec file from the fedora testing repository and created a build for Fedora 18.  It is available here:  nginx-1.4.0-2.fc18.x86_64.rpm

If you are already running NGINX on Fedora 18 with the current repository rpm all you need do is:  yum upgrade nginx-1.4.0-2.fc18.x86_64.rpm

If not, I highly recommend you first follow these instructions by David Strauss
Tiny Tiny RSS on Fedora 18

A few notes about the install:
  • Remember if you are converting from apache you need to stop and disable the apache service before trying to install nginx
  • I recently installed Fedora on a new computer and did not install Apache, so I made sure that /var/www was set to nginx:nginx.  You also need to edit /etc/php-fpm.d/www.conf and change the user/group parameters in that file from apache to nginx
  • If you don't already have mysql installed, you may wish to install postgresql instead since it has better performance than mysql or mariadb.  I have a post which has more information. 
  • Pay attention to the root settings in ttrss.conf - if you want to specify ttrss in your URL (https://localhost/ttrss), you need to make the root /var/www/html instead of /var/www/html/ttrss - I use /var/www/html in my version of ttrss.conf

After the upgrade to nginx-1.4.0 is complete, change the ttrss.conf file in David's example as follows:

listen 443; to listen 443 ssl spdy; #Turn SPDY on

Then insert the following line directly after:
spdy_headers_comp 7; #Compress your headers

You can find the explanation of these settings here:
NGINX SPDY Reference Page

Alternatively, you can just download the file here and place it in your
/etc/nginx/conf.d directory:  ttrss.conf

Now you can restart your nginx service:
systemctl restart nginx.service

If you wish you can test by installing an addon which is available for either Firefox or Chrome:

Firefox SPDY Indicator

Chrome SPDY Indicator

Have fun!