Mumuki Laboratory
Code assement web application for the Mumuki Platform
About
Laboratory is a multitenant Rails webapp for solving exercises, organized in terms of chapters and guides.
Installing
For development, you've to add to your /etc/hosts
file:
127.0.0.1 localmumuki.io
127.0.0.1 central.localmumuki.io
127.0.0.1 central.classroom.localmumuki.io
TL;DR install
- Install Vagrant and VirtualBox
- Run
curl https://raw.githubusercontent.com/mumuki/mumuki-development-installer/master/install.sh | bash
cd mumuki && vagrant ssh
and then - inside Vagrant VM -cd /vagrant/laboratory
- Go to step 7
1. Install essentials and base libraries
First, we need to install some software: PostgreSQL database, RabbitMQ queue, and some common Ruby on Rails native dependencies
sudo apt-get install autoconf curl git build-essential libssl-dev autoconf bison libreadline6 libreadline6-dev zlib1g zlib1g-dev postgresql libpq-dev rabbitmq-server
2. Install rbenv
rbenv is a ruby versions manager, similar to rvm, nvm, and so on.
curl https://raw.githubusercontent.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc # or .bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bashrc # or .bash_profile
3. Install ruby
Now we have rbenv installed, we can install ruby and bundler
rbenv install 2.3.1
rbenv global 2.3.1
rbenv rehash
gem install bundler
gem install escualo
4. Set development variables
echo "MUMUKI_AUTH0_CLIENT_ID=... \
MUMUKI_AUTH0_CLIENT_SECRET=... \
MUMUKI_AUTH0_DOMAIN=...\
MUMUKI_AUTHORIZATION_PROVIDER=...\
MUMUKI_SAML_IDP_SSO_TARGET_URL=...\
" >> ~/.bashrc # or .bash_profile
5. Configure authentication provider
The MUMUKI_LOGIN_PROVIDER
environment variable can take any of the following values:
developer
auth0
"saml
5.1 Developer
The developer mode does not need any extra configuration
5.2 Auth0
Just configure the MUMUKI_AUTH0_CLIENT_ID
, MUMUKI_AUTH0_CLIENT_SECRET
and MUMUKI_AUTH0_DOMAIN
environment variables with the values provided by auth0.
5.3 SAML
First, configure the MUMUKI_SAML_IDP_SSO_TARGET_URL
environment variable with the "single sign on URL" provided by your SAML IdP.
Then copy in the root of this project, the public key certificate (also provided by your SAML IdP) and save it as saml.crt
. Check its permitions so rails can read it.
Last, you have to ask your SAML IdP to federate your SP. Start rails and send the XML available at {YOUR_DOMAIN}/auth/saml/metadata
to your SAML IdP.
6. Create database user
We need to create a PostgreSQL role - AKA a user - who will be used by Laboratory to create and access the database
sudo -u postgres psql <<EOF
create role mumuki with createdb login password 'mumuki';
EOF
7. Clone this repository
Because, err... we need to clone this repostory before developing it
😛
git clone https://github.com/mumuki/mumuki-laboratory
cd mumuki-laboratory
8. Install and setup database
bundle install
bundle exec rake db:create db:schema:load db:seed
Starting the server
bundle exec rails s
Running
Hit http://central.localmumuki.io:3000/ on your browser and have fun!
Running the tests
To prepare the db:
RAILS_ENV=test bundle exec rake db:create db:migrate
To run the tests:
bundle exec rspec