Create internal portal application in few minutes

Published on, September 13, 2018

Updated March 2020: Works with Rails 6.

 

In first part of this series I explained tools required for DRG CMS portal application and how to install them. If you have successfully installed required tools, lets see how to install portal application skeleton. It should not take more then 5 minutes. Most of the time will be spent on installing gem files.

 

Internal portal application skeleton can be found as Github repository https://github.com/drgcms/drg-portal-jumpstart. Open console, change to your applications root directory and enter:

 

rails new your_app_dir --skip-active-record --skip-action-cable --skip-turbolinks --skip-webpack-install -m https://raw.github.com/drgcms/drg-portal-jumpstart/master/template.rb

 

The command will create new Ruby on Rails project in your_app_dir directory, update necessary configuration files and prepare minimum application templates, to start your own portal.

 

When command prompt returns, change directory to your_app_dir.

 

cd your_app_dir

 

Note: If your MongoDB is not installed locally, you must first update config/mongoid.yml file and set host name (perhaps also username and password) under development: section. Remote MongoDB setup requires this extra step, but default local installation doesn't need any administration at all. No login credentials is required and MongoDB will create new databases and collections automatically, when first used.

 

Start local Ruby on Rails server:

 

rails server


Rails server will start on port 3000. Open your favorite web browser and point to http://localhost:3000  url. You should be welcomed with page doesn't exist error. Which is OK, since no data has yet been declared in portal database.


It is time to seed initialization data into database and create Super user username and password. Change your browser address to http://localhost:3000/init. The url is useful only if no data is present in users and sites collections. Browser will ask you to define Super user username and password. Enter data, remember it and click on process button.


If everything went OK, you are asked to click Click link and are presented with portal application root, similar to application found here http://portal.drgcms.org. Since portal menu is hidden to unknown users, you must first login with super user data defined in previous step.


You are now logged on as Super user. You should see menu with 3 options, login name with logout option on the right and CMS link on the top left corner of the browser. You may look at init_controller.rb and learn, what initialization made behind the scene.

 

Congratulation. You now have fully functional portal application in development environment. It has dashboard to display application states, you can enter data into Diary, and look at Blank application, which only has one menu entry, which does nothing.

 

In the next part of the series, read about how everything is connected together, which collections are required and what must be defined in collections documents in order for portal application to work.

 

Comments