Skip to content

Kiosks Localhost Development

luisgreg99 edited this page Jun 28, 2019 · 27 revisions

Local dev environment

# install gems
bundle install

# run db migrations (if any)
bundle exec rake db:migrate

# load default records
bundle exec rake load_data

# install yarn modules 
yarn install

# create config file for environment variables
cp config/local_env.example.yml config/local_env.yml

# create config file for the application
cp config/config.example.yml config/config.yml
cp config/application_config.example.yml.erb config/application_config.yml.erb

# set CAS_BASE_URL, CAS_VALIDATE_URL, KIOSKS_DRUPAL_USERNAME, KIOSKS_DRUPAL_PASSWORD, KIOSKS_DRUPAL_HOST, KIOSKS_ROOMRES_USERNAME, KIOSKS_ROOMRES_PASSWORD and KIOSKS_ROOMRES_HOST variables in config/config.yml
vim config/config.yml

# run yarn instance (new terminal/tab)
yarn run prod

# run server (new terminal/tab)
rails s


Setup Admin Users:

# 1. Login with ONID username
# 2. Start session via console (in a new tab or terminal):

RAILS_ENV=development bundle exec rails c
> u = User.find_by_username("onid_username")
> u.admin = true
> u.save

# 3. Exit with Ctrl+C

Docker Development:

  1. Clone repo
git clone https://github.com/osulp/kiosks.git
  1. create config file for local environment variables, config and application
cp config/local_env.example.yml config/local_env.yml
cp config/config.example.yml config/config.yml
cp config/application_config.example.yml.erb config/application_config.yml.erb
  1. Build and start containers:
docker-compose build
docker-compose up
  1. Re-install yarn to fix issues related to sass or other modules during docker-compose up if any
docker-compose run web bash
> yarn install
  1. Load default data
docker-compose run web bash
> bundle exec rake load_data
  1. Update hosts file vim /etc/hosts to point 127.0.0.1 to an appropriate host for CAS
  2. Become an admin user using the console:
  • Sign in using ONID credentials at /users/sign_in
  • Run the console to update user admin property
docker-compose run web bash
> bundle exec rails c
> u = User.find_by_username("onidusername")
> u.admin = true
> u.save
Clone this wiki locally