SysAdminHome

So you want to install hyperactive as a production site, but you're not a ruby developer and you have no idea about all the intricacies? Never fear, others amongst us have been in a similar situation, and we survived! The hyperactive community is exactly that: hyperactive to get you involved in the community - all meaning that they're very eager to help.

Why would I want to install hyperactive?

The prime reason for installing hyperactive would be to use it as an independent media site, but you may have other ideas and be installing it for some other purpose.

How to install on Debian

Debian and debian-based distros like Ubuntu are currently the favoured operating systems of the hyperactive developers and current sysadmins running hyperactive systems. Therefore, these notes relate to debian primarily - but may be adaptable to other operating systems, too. If you do so, we'd love to hear about it and have our documentation updated!

To start with, you will need to follow the common directions from GetHyperActive.

Then, follow the instructions below.

Set up the mysql databases

$ mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 97
Server version: 5.0.51a-24+lenny4 (Debian)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> CREATE USER 'hyper'@'localhost' IDENTIFIED BY 'MY_SECURE_PASSWORD';
mysql> FLUSH PRIVILEGES;
mysql> create database hyperactive_production;
mysql> GRANT ALL PRIVILEGES ON *.* TO 'hyper'@'localhost' WITH GRANT OPTION;

Run initial database migrations

cd hyperactive
cp config/database.yml.sample config/database.yml # <-- enter your password into the database.yml file if your db server requires one!
mkdir public/system components index log
RAILS_ENV=production rake db:migrate
RAILS_ENV=production rake xapian:rebuild_index models="Content Collective" 

If your MySql server has a username and password set, don't forget to enter the proper information into the config/database.yml file. (Note that git doesn't save empty directories so that is why we have to make lots of directories above).

Setting up Apache2

Install Phusion Passenger for debian apache2:

# aptitude install libapache2-mod-passenger passenger-doc libapache2-mod-removeip

Now set up your apache2 config:

<VirtualHost *:80>
        ServerName hyper.active.site
        ServerAdmin admin@active.site
        SetEnv HTTPS 1

        DocumentRoot /var/www/hyperactive/public/

        <Directory "/var/www/hyperactive/public/">
            Options FollowSymLinks
            AllowOverride None
            Order allow,deny
            Allow from all
        </Directory>

        RewriteEngine On

        # Uncomment for rewrite debugging
        #RewriteLog logs/myapp_rewrite_log
        #RewriteLogLevel 9

        # Check for maintenance file and redirect all requests
        RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
        RewriteCond %{SCRIPT_FILENAME} !maintenance.html
        RewriteRule ^.*$ /system/maintenance.html [L]

        # Rewrite index to check for static
        RewriteRule ^/$ /system/cache/index.html [QSA]

        # Rewrite to check for Rails cached page
        RewriteCond %{THE_REQUEST} !^POST
        RewriteRule ^([^.]+)$ /system/cache/$1.html [QSA]

        # Deflate
        AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml a$
        BrowserMatch ^Mozilla/4 gzip-only-text/html
        BrowserMatch ^Mozilla/4.0r678 no-gzip
        BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

        ErrorLog /var/log/apache2/hyperactive-ssl_error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog /var/log/apache2/hyperactive-ssl_access.log combined

</VirtualHost>

Note: you will need to change some of the site names, etc!

Change the password!

The first thing you should do is to change the administrator password: go to http://your.site.url/admin and enter the user details of admin and password for the user and password, respectively. Now click on the link to change the password!

Keeping up-to-date with changes

Unfortunately, hyperactive currently does not have different branches for production and development (other than those used by the main coders). This means that all the code in the master git repository should be stable enough for production use - or will be fixed very soon if it is not! To stay up-to-date with this code is relatively easy, although there is actually a simple and a complex way of doing it.

The simple way consists of doing the following:

  1. do a git pull origin master in the top-level directory
  2. run RAILS_ENV=production rake db:migrate to run any new database migrations added since your last code code pull

The major question about this technique relates to whether you are likely to lose data from the database being potentially overwritten. This is one response to that thought:

Rails has a concept called "database migrations" - basically they run incrementally and keep code in sync with database schemas. If somebody was being a dick they could just insert a "delete all" statement into a migration and fuck everybody else up, but in general the migrations are safe to run because we don't work with assholes

Also available in: HTML TXT