Setup:Production/Installing on a Slicehost virtual server

From Cerberus Helpdesk Wiki

Jump to: navigation, search

This article assumes that:

Conventions:


Contents

Introduction

At WebGroup Media we run a mix of physical and virtual servers from a variety of providers. We manage physical hardware for our Cerb4 On-Demand service and it's cost effective because of volume (spreading the cost over many customers sharing resources).

Occasionally we have customers whose requirements put them in a space between our On-Demand service (fully managed by us) and a dedicated server (fully managed by them). They're looking for something where they don't need to hassle with or invest in hardware, but still have enough access to a server to log in through the console, modify code, save and copy backups, connect to the database, and install tools. SliceHost fills this space perfectly by providing inexpensive virtual servers.

The advantage of a cheap virtual server is you can run an application with special installation requirements (such as PHP5/MySQL5) that are different than your existing infrastructure. It's also useful to allow a single application to live outside an intranet firewall. Each app can have its preferred environment and be self-contained.

The reasons SliceHost is great for Cerb4 hosting:

At the time of writing, the most cost-effective SliceHost plans are:

After the $70/mo point, we feel you'll get more resources for your money using a different solution like Amazon EC2 or a dedicated server.

If you decide to sign up at SliceHost you can use this link and the Cerb4 project will get a couple bucks of account credit.

Setting up the new server

Update the package manager's cache:

Install Apache2, PHP5, MySQL5, and a few other tools:


(you'll be prompted for a MySQL root password. Choose something you'll remember)

DNS

You'll need to create an "A" record in your DNS to point your preferred domain name to the IP of your slice. Instructions for this vary depending on your environment, and if you aren't your system administrator your best bet is to ask them for help with this step.

Getting the Cerb4 files

Create a directory that will store the Cerb4 project files:

Enter the new directory:

Checkout the latest stable Cerb4 branch as the 'admin' directory using Subversion:

Set permissions:

Make sure all directories are visible:


Enabling friendly URLs

Let's enable Apache2's mod_rewrite for friendlier URLs (/tickets/search vs. /index.php/tickets/search).

Change into the directory with Cerb4's project files:

Enable mod_rewrite in Apache2:

Copy the .htaccess-dist template to .htaccess to enable it:

Enabling friendly URLs on nginx

If you are using nginx the .htaccess file will not enable redirects. To have it work correctly, just add the following directives in your server config

       location ~ ^/cerb5/(api|features|libs|storage)/ {
           return 403;
       }
       location / {
           if (!-e $request_filename) { 
               rewrite ^/(.+)$ /index.php/$1 last;
           }
       }
       location ~ ^(.+.php)(.*)$ {
           fastcgi_split_path_info ^(.+.php)(.*)$;
           fastcgi_pass 127.0.0.1:9000;
           fastcgi_index  index.php;
           fastcgi_param  SCRIPT_FILENAME  /var/www$fastcgi_script_name;
           fastcgi_param  PATH_INFO        $fastcgi_path_info;
           include fastcgi_params;
           fastcgi_param  QUERY_STRING     $query_string;
           fastcgi_param  REQUEST_METHOD   $request_method;
           fastcgi_param  CONTENT_TYPE     $content_type;
           fastcgi_param  CONTENT_LENGTH   $content_length;
           fastcgi_intercept_errors        on;
           fastcgi_ignore_client_abort     off;
           fastcgi_connect_timeout 60;
           fastcgi_send_timeout 180;
           fastcgi_read_timeout 180;
           fastcgi_buffer_size 128k;
           fastcgi_buffers 4 256k;
           fastcgi_busy_buffers_size 256k;
           fastcgi_temp_file_write_size 256k;
       }  

These assume that Cerb5 is installed in the root of the server. Otherwise just prepend the path to Cerb5 (for example rewrite ^/support/cerb5/index.php/.*$) /support/cerb5/index.php last;) It would also be a good idea to create a blank .htaccess file so Cerb5 knows to generate Friendly URLs.

Building MailParse

Cerb4 uses the MailParse PHP extension to parse e-mail efficiently. We'll need to build it since it's not part of the default PHP installation or in Ubuntu's package repository.

Install the mailparse extension using PHP's PECL tool:

Create the mailparse.ini configuration file for PHP5:


mailparse.ini:


Creating the virtual host in Apache

Note: Remember to replace helpdesk.example.com with your own domain name.

Create the virtual host in Apache2:


helpdesk.example.com:


Configuring PHP

We need a little more memory than PHP gives us by default. We also want to explicitly define our temporary directory for file uploads.


Find the following lines and update their values.

php.ini:


Activate the new website


Create the MySQL database



Installing Cerb4

Now we're going to run the Cerb4 installer. If you don't have an existing SMTP/POP3 server, you can configure Gmail to work with Cerb4.

The Cerb4 Installer

Database Setup

(enter the same information you used when creating the database)

Click the Continue button.

Settings

Outgoing Mail

Your Account

Registration

Cleaning up

Enter the Cerb4 project directory:

Remove the installation directory for security purposes:


Setting up your scheduled tasks timer


If that works, then continue:


(pick a hard to guess password)


crontab:


Performance Tuning

Out of the box Cerb4 is pretty fast, but we can make it even faster. For more information on Memcached and APC, read the article on Performance.

Memcached

Memcached provides a shared memory cache where arbitrary information can be read frequently without incurring the overhead of a database.

Install the memcached daemon and the PHP5 client library:

Edit the configuration file:


memcached.conf:

Find the "-m" line and reduce the shared memory to 2MB. That should be plenty for the cache of a single helpdesk on our virtual server.


Start the Memcached daemon:

Edit Cerb4's framework.config.php file to take advantage of Memcached:


framework.config.php:

Uncomment (remove the leading "//") the following options and set their value.


Log in for the first time

Installing the Support Center

The Support Center allows your community to use their web browser to:

Creating a Support Center in Cerb4

You can customize your new Support Center to your heart's desire later. For now, let's add an example contact situation.

Deploying the Support Center

For demonstration purposes we're going to deploy your new Support Center on the same domain as your helpdesk, but you could deploy it on *any* domain on *any* server that supports PHP4 or PHP5.

You're open for business!

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox