This guide assumes that a fully functional installation of CMS Fiona exists. Please also take account of the installation requirements.
-
Install the application and the components on which it depends
First, create a new Rails application:Change into the newly created directory of your project:$ rails new myProject --skip-bundle
Add the required Rails Connector gems to the$ cd myProjectGemfile:Then install the additional software:gem 'mysql2' gem 'infopark_rails_connector', '~> x.y.z' gem 'infopark_fiona_connector', '~> x.y.z'
Up to version 6.8.0: Copy your license file,$ bundle installlicense.xml, to theconfigdirectory. -
Prepare the CMS Fiona database
For the Rails Connector to access the data of the Content Manager (CM), its database needs to be changed to MySQL and optimized for the Rails Connector. To do so, change into the directory of the instance and execute the following command:
Since the Rails Connector only reads from the CM database, we recommend creating a separate read-only database user for the application. You can create one using the following commands:# The preconfigured instance name is "default". $ cd FIONA/instance/instanceName $ ./bin/CM -railsify
$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 18 Server version: 5.0.41-community MySQL Community Edition (GPL) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> grant read on fiona_cm.* to fiona_cm_ro@localhost identified by 'fiona_cm_ro';
-
Create additional databases for the Rails application
Create additional databases for the live data by means of the following commands. You require such a database for every environment (development,production,preview,test).$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 18 Server version: 5.0.41-community MySQL Community Edition (GPL) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> create database myProject_development; Query OK, 1 row affected (0.00 sec) mysql> grant all on myProject_development.* to fiona@localhost identified by 'fiona'; Query OK, 1 row affected (0.00 sec) mysql> create database myProject_production; Query OK, 1 row affected (0.00 sec) mysql> grant all on myProject_production.* to fiona@localhost identified by 'fiona'; Query OK, 1 row affected (0.00 sec) mysql> create database myProject_preview; Query OK, 1 row affected (0.00 sec) mysql> grant all on myProject_preview.* to fiona@localhost identified by 'fiona'; Query OK, 1 row affected (0.00 sec) mysql> create database myProject_test; Query OK, 1 row affected (0.00 sec) mysql> grant all on myProject_test.* to fiona@localhost identified by 'fiona'; Query OK, 1 row affected (0.00 sec) mysql> exit Bye
-
Adjust the database connection
In conjunction with the Rails Connector, your Rails application uses two databases each of which needs to be configured in every environment:- One database for the CMS content (
cms) - One database for the application specific content (
development,production,previewortest)
config/database.ymlfile. Adjust its content according to your database setup.cms: adapter: mysql2 database: fiona_cm username: fiona_cm_ro password: fiona_cm_ro encoding: utf8 host: YOUR_CMS_DATABASE_SERVER development: adapter: mysql2 database: myProject_development username: fiona password: fiona encoding: utf8 host: YOUR_RAILS_DATABASE_SERVER test: adapter: mysql2 database: myProject_test username: fiona password: fiona encoding: utf8 host: YOUR_RAILS_DATABASE_SERVER production: adapter: mysql2 database: myProject_production username: fiona password: fiona encoding: utf8 host: YOUR_RAILS_DATABASE_SERVER preview: adapter: mysql2 database: myProject_preview username: fiona password: fiona encoding: utf8 host: YOUR_RAILS_DATABASE_SERVER
- One database for the CMS content (
-
Finish the Rails Connector installation
Change back into the main directory of the rails application and trigger the automatic installation of the Rails Connector:This$ cd myProject $ rails generate rails_connector:install create config/initializers/rails_connector.rb create app/models/obj.rb create config/local/configuration.rb append app/assets/javascripts/application.js gsub app/assets/stylesheets/application.css remove public/index.html remove app/assets/images/rails.png gsub app/views/layouts/application.html.erb gsub app/views/layouts/application.html.erb
generatorcreates the additional files required or provided by the Rails Connector. -
Adjust CMS instance configuration
Unless you are using thedefaultinstance, specify the instance name the Rails Connector should use in theconfig/initializer/rails_connector.rbfile:RailsConnector::Configuration.instance_name = "instanceName"
-
Set up preview environment
To have the CMS preview delivered by the Rails Connector, you require a suitable Rails environment. We recommend to derive it from the production environment by making a copy of theproduction.rbfile:To change the Rails Connector mode, add this line to the copied environment file:$ cp config/environments/production.rb config/environments/preview.rb
RailsConnector::Configuration.mode = "editor"
-
Test the application
Start the application server in thedevelopmentenvironment using the following command:Test the opeability of the application by requesting the start page at$ rails s => Booting WEBrick => Rails 3.2.19 application starting in development on http://0.0.0.0:3000 Call with -d to detach => Ctrl-C to shutdown server
http://localhost:3000/. -
Integrate the Rails preview
Integrate the Rails preview into the CMS GUI.