Intellij IDEA - Setup of SNMP Manager environment
Author: David McGee + Colm Carew + Avi
Prerequisites
In order for everything to go as smoothly as possible please ensure you have done or will do the following before importing the project into Idea.
Ensure you can run Intellij as sudo as the Snmp Manager needs to be run as sudo - sudo /Applications/IntelliJ\ IDEA.app/Contents/MacOS/idea - maybe set up and alias
-
Download Mac JDK-7 from dropbox and place it in ~/.sdkman/candidates/java/
You will need to download GWT 2.5.1 and keep it in a secure directory i.e. your user directory or your documents
http://www.gwtproject.org/versions.html. Once downloaded you will need to set GWT_HOME to be the location of where you put the downloaded directory - do this in your .bashrc or .bash_profile file
Ensure your host file (/etc/hosts for mac/linux) contains the following entry : 23.23.106.9 errigalArtifactory errigalArtefactory
Ensure you have Idea Ultimate as Idea CE does not support grails. The applications can be run from the command line.
Ensure your password for the root account in MySQL is the same as on our QA - ask someone if you don't know it :)
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 CC and EXT DBs for now.
For either you should run these two commands first :
The Easy Way
* Install the necessary tools:
Install Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Install Ansible
Install SSHPASS
brew install https://raw.githubusercontent.com/kadwanev/bigboybrew/master/Library/Formula/sshpass.rb
CD into database-setup
Run the following command
ansible-playbook -i ../env-configuration/prodcrc local.yml --diff --extra-vars "database=snmp_manager mysql_root_pass=THEDBPASS" --vault-id @prompt
Note that prodcrc can be replaced with prodext if you want EXT data. The database is snmp_manager 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=snmp_manager 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
The Harder Way
Download a micro/small SNMP Manager database from a customer and load it into your local MySQL instance.
-
Create the following directory and make sure to take the SnmpManagerFiles directory from the same instance you took the database from (i.e. if you take an EXT DB you also have to go to the EXT app handler and get the Appfiles for this application). Again, please ask a colleague for help here if you don't know what to do.
Make sure these folders are owned by you
-
Importing the Project in Idea
Click Import Project and Select the snmpmanager project and click ok
Choose Create project from existing sources and click next
Click next to leave the Project Name as default
Click next again
You will then be asked to pick an SDK, ensure you choose 1.7
You will then be asked from the grails version, navigate and find your install of grails 2.5.6, select it and click next
You will then be given a list of detected frameworks, click Finish
Once loaded you should be asked to Configure GWT, click configure then click OK on the next popup
You should now locate the development scripts and run them against your freshly imported SNMP Manager database. If there are no development scripts, run the QA scripts.
Next you will need to locate the grails configuration and click edit, this will be at the top bar of Idea and should be to the right
In the VM Options enter the following, remember to change the database to your appropriately named database for the Reporting Manager
In the Command line options (above the VM options) make sure it looks like
run-app --refresh-dependencies -Dgrails.server.port.http=8082
NOTE as of grails 2.5.6 –refresh-dependencies is important as you will get a class not found error for ireasoning (The Snmp Trap Jar)
Click Apply and OK
Right click the ./lib folder and click on “Add as library”
Open the Run Grails Command Window in Idea, on Mac this is accomplished via CMD+ALT+G
Enter clean as a command click ok and allow it to finish
Open the Grails command window again and run compile and allow it to finish
Open the Grails command window again and run compile-gwt-modules and allow it to finish
Click Run and the Grails Application should run. Monitor the logs to ensure you do not get any exceptions!
Tips/Troubleshooting
Only look at these if you're having issues
If you have issues with dependency errors on compile, ensure you are running Intellij as ROOT
Quartz : You may want to drop and recreate the quartz/qrtz tables : http://wiki.err/doku.php?id=development:grails:grails25&s%5B%5D=qrtz
You may experience issues with the following when trying to get the SNMP Manager setup on a dev environment:
SNMP Manager won't start due to MIB/Trap Rules/File mismatch. We need to make sure that the trap rule files referenced in the database are the same as the files you have on your local dev box :) This is why it's important to take the database and files from the same QA location, within a close time interval.