Skip to content
Leonardo R Souza edited this page Sep 21, 2020 · 27 revisions

Weby and Rails installation HowTo

Tutorial based on a GNU/Linux Debian 7 (jessie) installation with PostgreSQL server.

Requeriments

Installing dependencies

# aptitude install postgresql-9.4 git imagemagick libpq-dev libncurses5-dev libffi-dev curl build-essential libssl-dev libreadline6-dev zlib1g-dev zlib1g libsqlite3-dev libmagickwand-dev libqtwebkit-dev libqt4-dev libreadline-dev libxslt-dev ghostscript ntpdate

To install the dependecies above on Ubuntu 14.04, follow this guide:

https://gorails.com/setup/ubuntu/14.04

Install ruby 2.1 from a Ruby environment manager. For example, rbenv:

https://github.com/cercomp/weby/wiki/Simple-Ruby-Version-Management-(rbenv)

Configuring database

Log-in as root and switch the user to postgres

$ su -
# su postgres

Execute the commands below to create a PostgreSQL user and give it permission to create a database. In this example, the user name is weby.

psql
CREATE USER weby ENCRYPTED PASSWORD 'your_pass';
ALTER USER weby CREATEDB;

For local connections, alter the "ident" column from "peer" to "md5" in the file /etc/postgresql/9.x/main/pg_hba.conf

# "local" is for Unix domain socket connections only
local   all         all                               md5

Restart the database daemon:

$ sudo /etc/init.d/postgresql restart

Download the Weby source code from git

$ git clone https://github.com/cercomp/weby.git

After downloading, get in the weby directory:

$ cd weby

Configuring Weby

Copy the file example to reflect the original content, in this using the environment configs (production, development or test).

$ cp config/database.yml.example config/database.yml
$ cp config/secrets.yml.example config/secrets.yml

Set the environment variables.

$ export RAILS_ENV="Your env name. Ex.: production"
$ export PG_USER="Your DB user name. Ex.: weby"
$ export PG_PASS="Your DB password. Ex.: W34db#"
$ export PG_HOST="Your Host IP. Ex.: db.domain.com"
$ export PG_DB="Your DB name. Ex.: weby"
$ export PG_PORT="Your DB port. Ex.: 5432"
$ export SECRET_KEY_BASE="The secret hash, for generate using: $ rake secret. ex.: d42f89e05bca1a1..."

Run bundle to install the required gems of Weby

$ bundle install

If the command above didn't work, execute these commands:

$ gem install bundler
$ rbenv rehash
$ bundle install

Move file the config email before create the database:

$ mv config/initializers/email.rb config/

Creating the database

$ rake db:create
$ rake db:schema:load
$ rake db:seed

For the production environment run:

$ rake assets:precompile

Back the email config file:

$ mv config/email.rb config/initializers/

If necessary, modify the file '.git/config'

[remote "origin"]
  fetch = +refs/heads/*:refs/remotes/origin/*
  url = https://github.com/cercomp/weby.git

Starting the rails server

$ rails s -p 3000 -b lvh.me

OR

$ rails s -p 3000 -b 0.0.0.0

Checking in the browser

Access the URL below from your favorite browser

http://lvh.me:3000

Clone this wiki locally