Concen is a Rails Engine for managing and monitoring a Rails application from a web interface. It includes content management system, real-time traffic monitoring, and real-time performance monitoring. It's built to be flexible and customizable to fit custom needs.
Status: Dormant. Checkout Content Directory for a much lightweight alternative.
Concen is a Rails Engine for managing and monitoring a Rails application from a web interface. It includes content management system, real-time traffic monitoring, and real-time performance monitoring. It’s built to be flexible and customizable to fit custom needs.
Add the following to the Gemfile of a Rails application.
gem "concen", "~> 0.2.9"
Run the rake task to setup Concen.
rake concen:setup
Follow the brief guide upon completion of the rake task.
Most of the Rails applications will likely need a Content Management System (CMS) at some point or another. It could be for a blog or just static content. For the static content, it is very simple to write in the Rails views. If the programmer was the writer himself, this approach is very straight forward. But often the writers are not programmers. Concen allows the writers to write the content easily from day one. Then, programmers can programatically include this content in the Rails views. The CMS itself has a simple text editor and a simple file uploader. Content can be represented in the form of text and files (images, videos, sounds, etc).
Back to the Rails application, the developer/programmer could place these contents in the views. For example with the following method call.
Concen::Page.published.desc(:publish_time)
The above method call will return all the contents that have been marked as published and sort them by publish time. In this fashion, Rails views could be free from any static content.
Concen also comes with a configurable Markdown parser. Markdown is a recommended text format to be used in Concen. Markdown is easy to understand and always in plain text mode. You can easily generate HTML from the Markdown formatted content with the following method call.
Concen::Page.published.desc(:publish_time).first.content_in_html
Generating static content should not be performed for every request because it is expensive. Concen does not have a mechanism of caching. However it is very simple in Rails to cache a page. You don’t have to use Rails page caching mechanism. You simply need to set the proper Cache-Control header. For example the following code will cache a page for 5 minutes in any reverse proxy and in the client browser. You can add a Rack Cache or setup Nginx reverse proxy cache easily or even Varnish when the time comes.
expires_in 5.minutes, :public => true
fresh_when :etag => @article, :public => true
There are no rules enforced for writing content in the CMS. But there are certain writing styles that will help writing content more convenient and manageable.
Here is an example with single-segment content.
Title: 1984
Description: Nineteen Eighty-Four (sometimes written 1984) is a 1948 dystopian fiction written by George Orwell about a society ruled by an oligarchical dictatorship.
Publish Time: tomorrow
-----
It was a bright cold day in April, and the clocks were striking thirteen. Winston Smith, his chin nuzzled into his breast in an effort to escape the vile wind, slipped quickly through the glass doors of Victory Mansions, though not quickly enough to prevent a swirl of gritty dust from entering along with him.
Here is another example with multiple-segment content.
Title: 1984
Description: Nineteen Eighty-Four (sometimes written 1984) is a 1948 dystopian fiction written by George Orwell about a society ruled by an oligarchical dictatorship.
Publish Time: tomorrow
-----
@ Chapter 1
It was a bright cold day in April, and the clocks were striking thirteen. Winston Smith, his chin nuzzled into his breast in an effort to escape the vile wind, slipped quickly through the glass doors of Victory Mansions, though not quickly enough to prevent a swirl of gritty dust from entering along with him.
-----
@ Chapter 2
As he put his hand to the door-knob Winston saw that he had left the diary open on the table. DOWN WITH BIG BROTHER was written all over it, in letters almost big enough to be legible across the room. It was an inconceivably stupid thing to have done. But, he realized, even in his panic he had not wanted to smudge the creamy paper by shutting the book while the ink was wet.
Content can be divided with 3 or more hyphen (-). The first part will always be metadata declaration. The rest will be the content.
“Publish Time” meta data has special treatment, where it accepts date in natural language format, relative to the current time.
To obtain the content, you typically will call the following.
Concen::Page.published.desc(:publish_time).first.content
Or if you want the content in HTML format, simply call the following.
Concen::Page.published.desc(:publish_time).first.content_in_html
content_in_html
accepts an argument of the content segment key. In this example if you declare “Chapter 2”, the key will be “chapter_2”.
Insert the Visit Recorder JavaScript in your layout. It’s recommended to append this code block right before the closing </body>
tag.
For layout in Haml, insert the following code block.
= javascript_include_tag visit_recorder_js_url
:javascript
VisitRecorder.record({});
For layout in ERB, insert the following code block.
<script src="http://steverandytantra.com/visits/js" type="text/javascript"></script>
<script>
//<![CDATA[
VisitRecorder.record({});
//]]>
</script>
There are many commercial performance monitoring solutions for a Rails application. But when starting out with a simple application you might not want the extra steps to setup these commercial solutions. Concen comes with a simple real-time performance monitoring. It doesn’t give you an extensive reports like the commercial solutions, but it’s just enough to get you going to the next level. When the time comes, you can add a more suitable solution.
There is no extra setup for this free real-time performance monitoring. And there is no more reason not to know which controller actions are slow.
To access Concen web interface, use “concen” subdomain for example http://concen.domain.com. When it’s accessed for the first time, it will prompt to create a new master user. This user will have full control over the Concen. Pow rack server is recommended because it provides access to subdomain by default.
If you have used Concen for any of your websites and would like to be listed here. Please send me a message.
0.2.9:
0.2.8:
0.2.7:
0.2.6:
0.2.5:
0.2.4:
0.2.3:
0.2.2:
0.2.1:
0.2.0:
0.1.7:
0.1.6:
0.1.5:
0.1.4:
0.1.3: Minor bug fixes
0.1.2: Minor bug fixes
0.1.1: Minor bug fixes
0.1: Initial release
Copyright © Steve Randy Tantra
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.