User Tools

Site Tools


onboarding:advanced:intellij_idea_-_setup_of_noc_portal_dev_environment

Intellij IDEA - Setup of NOC Portal Development Environment

Author: Anna Dowling Edited By : Colm Carew

DB and Appfile Setup

Unfortunately there are a lot of steps here but there is an easy way and a hard way, the easy way only applies to EXT DB for now so if you need DBs/Appfiles for a different customer you will have to do it the hard way.

For either you should run these two commands first :

  • sudo mkdir -p /export/home/scotty/appfiles/
  • sudo chown -R $(whoami) /export/home/scotty

The Easy Way

  • Clone the following two projects into the same folder (I suggest an applications folder or IdeaProjects folder) :
  • CD into database-backup
  • Run the following command
    • ansible-playbook -i ../env-configuration/prodcrc local.yml –diff –extra-vars “database=noc_portal mysql_root_pass=THEDBPASS” –vault-id @prompt
  • Note that prodcrc can be replaced with prodext if you want EXT data. The database is noc_portal and ensure to change the root password to your local root password install
  • If you are running MySQL through docker you will need to run:
    • ansible-playbook -i ../env-configuration/prodcrc local.yml –diff –extra-vars “mysql_path='docker exec -i CONTAINER /usr/local/mysql/bin/mysql' database=noc_portal mysql_root_pass=THEDBPASS” –vault-id @prompt
  • You will need the password for this so also ask someone for that if you don't know it, Once done just leave it run and complete and it should download the DB and run development transforms as well as download the app files. You can then move on to import the project into Intellij

The Harder Way

  • Download a micro/small database from a customer and load it into your local MySQL instance. - note you will want to set your max allowed packet large for this
    • set global max_allowed_packet = 1000000000;
    • mysql -uroot -p DB < db.dump
  • Run the Dev scripts on this database, they should be found in - https://bitbucket.org/errigal/idms-sql-script
  • Go to a customer app server and download the appfiles for this application and put them in the location we created above

Prerequisites

  • Grails 2.2.4 - sdk install grails 2.2.4
  • MySQL running - don't go above MySQL 5.5
  • GWT 2.5.1
  • Ensure you set GWT_HOME in your .bashrc file as follows: export GWT_HOME=“/Users/user-name/gwt-location”
  • Java 1.7 - sdk list java - install the Java 7 one
  • Get noc_portal db - from /mysql-backup/dailybackups from the slave db server.
  • Ensure you have a write user locally for the noc_portal db : grant all on noc_portal.* to 'writer'@'%' identified by 'ozzrules';
  • Clone project from git using git clone link-to-noc-portal-repo-on-bitbucket

Importing project into IntelliJ

  • Import NocPortal project as existing project and make sure you have the correct version of grails and groovy installed on your machine and use that as the grails option.

Go to Project Settings and make sure that you have the following dependencies set up:

Project Structure:

  • Project SDK: Java 1.7
  • Modules: nocportal & nocportal-grailsPlugins - path to GWT installation directory need to be correctly set up.
  • Library: GWT SDK (get-user)
  • Facets: nocportal & nocportal-grailsPlugins - path to GWT installation directory need to be correctly set up.
  • Artifacts: nocportal & nocportal-grailsPlugins - GWT artifacts.

Platform Settings:

  • SDK: Java 1.7
  • Global Libraries: Groovy 2.4.3 and Grails 2.2.4.

Creating and running SQL scripts

Not required but advisable to run scripts from mysql prompt. Run mysql -uroot -p command in your terminal to open mysql prompt, enter your password which ideally should be the normal errigal convention and run following scripts (copy and paste if using mysql prompt- order in which you run the scripts is important!):

  • Create a new file and copy and paste contents of prepare_qa_noc_portal_qts.sql. Change urls in company_config and ticketer_config tables to localhost - make sure to change all emails. Save file as development_transform_cc.sql for a later use. Run contents of a new development_transform_cc.sql in your mysql server.
  • n DataSource.groovy comment out dbCreate = “create-drop” and uncomment: dbCreate = “update”.

Editing Run/Debug Configurations for nocportal (top nav bar)

  • Add the following to your vmoptions, located in edit configurations: -Xms1024m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m -Djava.nocportal.database=noc_portal -Dgrails.server.port.http=8080

Setting up logs for grails:

Run the following to create and own directory for appfiles:

  • sudo mkdir -p /usr/local/appfiles/
  • sudo chown user-name:staff /usr/local/appfiles/

Pulling down and extracting appfiles

  • Download app files from app handler and locate them in /usr/local/appfiles/ folder on your machine

Running project in IntelliJ:

  • Run cmd + alt + g to access grails terminal.
  • Run clean in grails terminal to clean the project. This wipes out gwt modules.
  • Run compile in grails terminal to compile the project.
  • Run compile-gwt-modules in grails terminal.
  • Run the project using ^R or green arrow in the top panel.

Accessing application via web browser:

onboarding/advanced/intellij_idea_-_setup_of_noc_portal_dev_environment.txt · Last modified: 2021/06/25 10:09 by 127.0.0.1