Install Guide

If you already have a working ruby environment and know what to do, the easiest way is just:

gem install rsence

If you have an older version of rsence installed, it’s be automatically updated along other gems when you run:

gem update

For system-wide installs, run the gem command as a superuser. A common way for doing so is prefixing the command with sudo.

RSence 2.1 is verified to be compatible with Rubinius. To use RSence with Rubinius, just use “rbx gem” instead of just “gem” for installation.

The following instructions contain detailed steps for installing Ruby, RSence and its dependencies on each supported platform:

System Dependencies

This is a list of system level dependencies. You only need to do this step once; follow the steps of for your target operating system.

Mac OS X

Mac OS X 10.6 “Snow Leopard” and 10.7 “Lion”

Mac OS X 10.4 “Tiger” and 10.5 “Leopard”

This step applies only to Mac OS X 10.4 “Tiger” and 10.5 “Leopard”. The default ruby build of these versions of Mac OS X is somewhat broken.

Debian and Ubuntu Linux

This step applies only to Debian, Ubuntu and similar Linux distributions.

Microsoft Windows

RSence works just fine on Windows too, with a few limitations. Windows compatibility has been officially tested on Windows XP SP3 and Windows 7 (64 bit).

Install ruby 1.8.7:

Install RSence

Create RSence environment

Replace the \my_projects path with the path to the directory where you want to run or develop your projects. Likewise, replace my_project with something descriptive for your project.

Windows limitations

If you install the sqlite dll and the sqlite3 gem, you’ll gain persistent sessions and this warning message will disappear: `Warning: Session database is not available. Can’t use persistent sessions`

It’s not a dependency in the default install, because it’s not strictly required and makes the first installation much easier. Also, you can use any other database supported by Sequel instead of Sqlite.

Backgrounding on Windows is not yet implemented, because POSIX signals are not fully implemented in windows and backgrounding requires some Windows-specific service hooks.

However, if you run RSence under Cygwin, everything should work like on a UNIX machines.

Other UNIX / Linux systems:

This step applies to systems not listed above.

You’ll have to figure out how to install the dependencies on your own, but generally this is the list of software you should look for:

Ruby Library Dependencies

The `rsence` gem depends on the dummy `rsence-deps` gem, which depends on all essential dependencies of RSence. Optionally, you probably want at a database and a database adapter supported by Sequel This not only enables SessionStorage (persistent sessions between RSence restarts), but some plugins written for RSence depend on at least Sqlite.

Detailed list of ruby libraries used

Setting up RSence

The primary installation method of RSence is via RubyGems.

To ensure your RubyGems is up-to-date, run:

sudo gem update --system

Even if RubyGems is up-to-date, ensure your installed gems are up-to-date, some of these are updated frequently. This will also update RSence release versions to the most recent version, if installed.

sudo gem update

Install RSence

This will install RSence via RubyGems, the preferred method. All dependencies are installed too, except for the ones you already might have installed.

gem install rsence

Debian/Ubuntu users need to include /var/lib/gems/1.8/bin into PATH either by adding it directly there or by making a symbolic link:

sudo ln -s /var/lib/gems/1.8/bin/rsence /usr/local/bin/rsence

Optionally, you might want to contribute to RSence development, just clone or fork the GIT repository on Github:

http://github.com/rsence/rsence

When installed, ensure it works by exploring the help of the ‘rsence’ command, like:

rsence
rsence help
rsence help version
rsence help run
rsence help init

etc..

Setting up

Creating a RSence project environment

To set up an environment for your RSence project, use the init command. In this example ‘/home/me/projects’ is assumed as your project directory. Replace that with a path that matches your own environment. The RSence project directory must either be empty or will be created automatically.

rsence init /home/me/projects/my_first_rsence_project

To see the options of the init command, use

rsence help init

By default, init asks a few simple questions to write your configuration file. Just press enter, if you want to keep the suggested default options.

The questions are:

You may edit the conf/config.yaml at a later time to change these settings. The full list (and the defaults) are specified in the ‘conf/default_conf.yaml’ file in the installation directory of RSence.

Any differences in your local configuration replace the default. If the configuration option type is an Array, the defaults are not replaced, the defaults are appended to. If your configuration only has partial items of a Hash defined, only those are applied to the default.

Start RSence in the development mode with logs printed to the standard output:

The debug/development mode has the most verbose output and is the intended mode of RSence for development. Changes in your code are automatically (re)loaded and the javascript is not obfuscated or minimized in any way. Values also have human-readable id’s.

cd /home/me/projects/my_first_rsence_project
rsence run -df

Open a web browser

Stop RSence

Just press CTRL-C in the terminal, if RSence was started using the ‘run’ command.

Modes of operation

RSence supports two main modes of operation: in the foreground and in the background. Each have various options. Use the ‘rsence help run’ and ‘rsence help start’ commands to read more about them.

Starting RSence as a foreground process.

The ‘run’ mode is well suited for development. Especially when combined with the -d and -f options.

Starting in foreground mode:

rsence run

Starting in foreground mode with debug mode:

rsence run -d

Starting in foreground mode with debug and logging in foreground:

rsence run -df

Stopping in foreground mode: Press CTRL-C

Starting RSence as a daemon (background mode).

In the background mode, standard output and standard errors are logged in the ‘log’ directory of your project and the PID file is written in the ‘run’ directory. This mode of operation is best suited for production deployment and it’s not available on Microsoft Windows, because full POSIX compliance is not available on Windows.

rsence start

Stopping RSence in background mode

rsence stop

Checking RSence status in background mode

rsence status

To store the RSence sessions into the session database while in background mode

rsence save

The sessions are also stored when stopping and restarting RSence. Use the ‘save’ command regularly from a cron script or equivalent in a production environment.

Restarting RSence in background mode

rsence restart

Re-setting the sessions

This is needed only, if the session storage becomes corrupt in a development environment (changing value definitions and such). This invalidates all ongoing sessions. Just apply the –reset-sessions option after the run, start or restart command in the command prompt.

rsence restart --reset-sessions

The ‘-r’ switch is equivalent to ‘–reset-sessions’

*NOTE: All the sessions currently connected clients are invalidated and need to reload the page*

Running in development mode

Just apply the -d option after the run, start or restart command in the command prompt.

rsence restart -d

What does development mode do?

Other command-line options

Just run this command to see the available options:

rsence help <command>

example:

rsence help run

Running RSence using rackup

rackup conf/config.ru

Running RSence using unicorn

unicorn conf/config.ru -c conf/unicorn.conf

Plugin installation

If you followed the previous steps, you are ready to install some plugins.

Installing plugins

Copy or move a plugin bundle directory into the “plugins” directory.

Un-Installing plugins

Move a plugin bundle out of the the “plugins” directory.

Temporarily disabling a plugin

Create an empty file named “disabled” in the plugin bundle to disable it.

touch plugins/legacy/disabled

Getting more information