Table of Contents

Intellij IDEA - Setup of Ticketer dev environment

Original Creator : — Anna Dowling

Updated by : — Colm Carew

Updated by : — Oleksandr Kononov

Updated by : — Conor Giles

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 so if you need DBs/Appfiles for a different customer you will have to do it the hard way.

For either method, you need to create an appfiles directory first.

Appfile Setup

If you are on MacOS Catalina, the method is different from earlier versions, or on linux. If you are not on Catalina, you can run the following commands and skip the next part marked 'Catalina Setup'.

Normal setup
Catalina Setup

Apple's new APFS prevents you from writing anything directly to '/', so a workaround is needed to create our '/export' directory. We will achieve this using 'synthetic fixlinks', mapping a virtual directory on '/' to a directory on our writeable Data volume. First, we must create the directory on our Data volume:

Now, we create a synthetic.conf file which maps '/export' to our newly created directory.

Inside this file, add the following line:

export	System/Volumes/Data/export

Note: The whitespace between export and System must be a tab.
Now restart the system to push the changes.

The Easy Way

ansible-playbook -i ../env-configuration/prodext local.yml --diff --extra-vars "database=ticketer mysql_root_pass=THEDBPASS"  --vault-id @prompt
ansible-playbook -i ../env-configuration/prodext local.yml --diff --extra-vars "mysql_path='docker exec -i CONTAINER /usr/local/mysql/bin/mysql'  database=ticketer mysql_root_pass=THEDBPASS"  --vault-id @prompt

Note that some tickets reference the snmp_manager database. Installing this database is not strictly necessary, but can avoid errors when running. Install with the following command like above:

ansible-playbook -i ../env-configuration/prodext local.yml --diff --extra-vars "database=snmp_manager mysql_root_pass=THEDBPASS number_of_traps_to_get=100000"  --vault-id @prompt

The Harder Way

mysql -uroot -p -e 'set global max_allowed_packet = 1000000000'
mysql -uroot -p DB < db.dump

Import Prerequisites

  1. IntelliJ Ultimate Edition
  2. Install Grails 2.2.4 for Mac Install SDK Man http://sdkman.io/install.html and use it to install grails 2.2.4 (sdk install grails 2.2.4)
  3. MySQL 5.7 - use dbdb and the ansible scripts above to set up the DB
  4. 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
  5. Ensure you set GWT_HOME in your .bashrc or .bash_profile(for Mac) file as follows: export GWT_HOME=“~/gwt-location”
  6. Java 7.0.262 - sdk install java 7.0.262-zulu
  7. Groovy 2.4.3 - sdk install groovy 2.4.3
  8. Ticketer Project:
    1. Clone project via git from here

Importing project to IntelliJ

Import Ticketer project as existing project and make sure you have Grails 2.2.4 installed on machine and use that as the Grails option. Also make sure that you have Groovy 2.4.3 installed. Intellij should automatically detect this is a Grails project and allow you to select the correct version on the wizard setup page.☐ Go to Project Settings and make sure that you have the following dependencies set up:

Make sure you have a log file with the following path

  /export/home/scotty/logs/grails/Ticketer.log

Usual Problems

- The same goes with GWT_HOME, ensure that GWT_HOME is set and can be accessed from within the IDEAJ terminal - set it in .bashrc or .bash_profile

  echo $GWT_HOME

Project Settings:

Platform Settings:

3. 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 Errigal Password Convention and run the following scripts (copy and paste if using mysql prompt- order in which you run the scripts is important!):

  1. Run the development transform scripts (located in ticketer/scripts/db/development_transform.sql) on your ticketed db - make sure to change all emails.
  2. Run the appropriate upgrade scripts(located in idms-sql-script/upgrade/RELEASE_NUMBER/Ticketer_X_XX_X_upgrade.sql - at the time of setting up the ticketer, Ticketer_2_19_0_upgrade.sql was used) on your ticketed db - make sure to change all emails!!!

4. Editing Run/Debug Configurations for ticketed (top nav bar)

Add the following to your vmoptions, located in edit configurations:

-Xms1024m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m -Djava.ticketer.database=ticketer -Dgrails.server.port.http=8083

If needed to input jvm options from command line rather than idea:

export GRAILS_OPTS="-Xms1024m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m -Djava.ticketer.database=ticketer -Dgrails.server.port.http=8083"

5. Setting up logs for grails:

Run the following to create and own directory for grails logs:

sudo mkdir -p /export/home/scotty/logs/grails/quite

sudo chown user-name:staff /export/home/sudo chown user-name:staff /export/home/scotty/logs/grails/

touch /export/home/scotty/logs/grails/Ticketer.log

6. Running project in IntelliJ:

Note: If problems are experienced when compiling the project and/or gwt modules, try to clean your .grails cache by removing the Ticketer folder located in your ~/.grails/2.2.4/projects/ and run clean, compile, compile-gwt-modules again.

Note: IF you are having issues running the application in Idea (especially on Linux) but its OK from the console and you are getting the error: “cannot invoke method getat() on null object” - start run-app with the “–stacktrace” flag to pinpoint the error which in my case was relating to: def versionNumber = currentGwtHome[-5..-1] being null in the BuildConfig.groovy.

To fix this /etc/environment needs to have GWT_HOME set here as the .bashrc is sometimes not sufficient for other applications to pick it up

7. Accessing application via web browser:

At this point your application should be up and running, navigate to http://localhost:8083/Ticketer/.

Well done!

8. Adding a user

If you are just running the ticketer locally and don't have access to any user management tools, you can use this script to add a new ticketer user. Follow the instructions in the readme to quickly create a new user for exploring the workbench with.
Alternatively, you can do this process manually by doing the following: