Install Fat Free Crm on Apache + Phusion Passenger

    Recently, I was tasked with deploying a free CRM with a web interface. After a brief search on the Internet, I came across Fat Free Crm . I did not find installation instructions on the site and therefore set it on a whim. Hope my installation experience helps someone.
    UPD Updated based on comments.

    Preamble



    My installation was on a Gentoo Linux OS, but I don’t think it will be difficult to repeat on other OSs.
    So let's get started.
    We believe that Ruby on Rails itself is already installed. Here are the versions of the packages on which I deployed the application:

    # emerge ruby ​​rubygems rails rack passenger -p
    These are the packages that would be merged, in order:
    Calculating dependencies ... done!
    [ebuild R] dev-lang / ruby-1.8.6_p369 
    [ebuild R] dev-ruby / rubygems-1.3.5 
    [ebuild R] dev-ruby / rack-1.0.0 
    [ebuild R] dev-ruby / rails-2.3.4 
    [ebuild R] www-apache / passenger-2.2.4
    


    Install and configure CRM



    Download the source codes from here , unpack it on the server into a directory with sites. For example, at /var/www/crm.example.com/htdocs/.

    Let's go to this directory:
    # cd /var/www/crm.example.com/htdocs/


    Let's create the MySQL database:
    # mysql -uMYSQL_USER -pMYSQL_PASSWORD
    > create database fat_free_crm;
    > grant all privileges on fat_free_crm. * to 'fat_free_crm' @ 'localhost' identified by 'PASSWORD';
    > flush privileges;
    > quit
    


    MYSQL_USER is your MySQL user to work with the database
    MYSQL_PASSWORD user password MYSQL_USER
    PASSWORD user password fat_free_crm

    Now we will create a file with the database connection configuration:

    config / database.yml:
    production:
      adapter: mysql
      encoding: utf8
      database: fat_free_crm
      host: localhost
      username: fat_free_crm
      password: PASSWORD
    


    The config / database.mysql.yml file contains examples that will help you adapt the configuration file to your needs, for example, connect to the database via a socket.

    Comment out the line in config / environment.rb
    RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION

    so that the application uses the latest version of Rails installed on the system.

    Next in the file public / dispatch.cgi you need the line
    require "dispatcher"
    

    replaced by
    require "/usr/lib64/ruby/gems/1.8/gems/rails-2.3.4/lib/dispatcher.rb"
    


    The bottom line is to specify the full path to the Rails manager in the file.

    Now expand the database schema:

    # RAILS_ENV = production rake crm: setup
    


    Web server setup



    There is a real trifle left: configure apache to work with this beautiful application.
    Set the rights to the files:

    # chown -R apache: apache *
    


    Instead of apache: apache you need to enter user: group, on behalf of which you want to run the application.

    Now configure the virtual host.

    /etc/apache2/vhosts.d/crm_example_com.conf:
    
            ServerName crm.example.com
            ServerAdmin dadmin@example.com
            ErrorLog /var/www/crm.example.com/error/error_log
            CustomLog /var/www/crm.example.com/error/access_log combined
            DocumentRoot /var/www/crm.example.com/htdocs/public
            
                    Options Indexes ExecCGI FollowSymLinks
                    RailsEnv production # This line is optional, not needed for a typical installation
                    AllowOverride all
                    Allow from all
                    Order allow, deny
            


    Final chord:

    # /etc/init.d/apache2 reload
    

    Also popular now: