Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Setup Koolio development environment (Ubuntu) _OLD_

Kaiyu edited this page Feb 13, 2017 · 1 revision

This installation guide is tested for Ubuntu 14.04. For setup in other environments, please contribute!

Install ruby, rails, postgres

There are multiple ways to install ruby on your machine. One way is using rvm. First install rvm:

\curl -L https://get.rvm.io | bash -s stable --ruby

You may need to restart your bash session in order to use rvm command

Next, install ruby 2.2.1, which is the version used when developing koolio:

rvm install 2.2.1

Install bundle command and rails (4.2.1):

gem install bundler
gem install rails --version 4.2.1

Install PostgreSQL 9.3.x

sudo apt-get install postgresql-9.3
sudo apt-get install postgresql-contrib

The second package is needed by the pg_search gem.

Setup the repository:

git clone https://github.com/zkytony/koolio/

Create and configure the database.yml file:

# config/database.yml
development:
  adapter: postgresql
  encoding: unicode
  database: koolio_development
  pool: 5
  username: PSQL_USERNAME
  password: PSQL_PASSWORD

test:
  adapter: postgresql
  encoding: unicode
  database: koolio_test
  pool: 5
  username: PSQL_USERNAME
  password: PSQL_PASSWORD

Note, the default local authentication method for PostgreSQL is peer authentication, which uses system's username. If you are using this method, then in the database.yml file you would put your system's username as the "username" here. The password could be set inside the psql command line interface like this:

ALTER ROLE _username_ WITH PASSWORD 'password';

Create secret keys by running this command:

rake secret

Copy the result to a new file config/secrets.yml. You should generate two keys, one for development, and one for test:

# config/secrets.yml
development:
  secret_key_base: YOUR_KEY

test:
  secret_key_base: YOUR_KEY

Install dependencies by running:

bundle install

If there is an error about installing pg gem, probably your machine didn't install certain postgresql packages. Install these:

sudo apt-get install libq-dev

Install ImageMagick, for image processing:

sudo apt-get install imagemagick

Setup database:

rake db:migrate
rake db:setup

Koolio uses NginX and Unicorn for production server. The setup for production environment is not covered here. Please refer to the other wiki page.

Finally, open config/general.yml, and you will see:

# General settings
ENABLE_MAILER: 'on'
# Storage type for carrierwave uploader. The value can either
# be 'fog' or 'file'. If it is set to 'fog', you will need
# to provide the appropriate configurations for the remote
# storage that you are using.
STORAGE_TYPE: fog

If you would like to disable mailer functionality, change ENABLE_MAILER to 'off'. If you want to store the uploaded files locally, change STOREAE_TYPE to file

Now, try starting up the default WEBrick server in development mode, simply:

rails server
=> Booting WEBrick
=> Rails 4.2.1 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
...