Skip to content

Setting up your dev environment

Slin Lee edited this page May 13, 2020 · 20 revisions

Prerequisites

  • Install Vagrant
  • Install VirtualBox
  • Clone the Webapp repo
  • Set environment variables in the vagrant VM (after you log into the vm with the vagrant ssh step). The critical ones are:
    • SQS and SNS env variables documented here
    • AWS S3 buckets. Please contact @kepricon for details.
    • Mock backend. The mockbackend is enabled by default. To disable it set export JOB_MOCK_CYCLE=0 before running mvn spring-boot:run

These instructions are meant to be run in the root folder once you clone the pathmind-webapp repo.

If you have Vagrant installed (vagrantup.com), you can set up a local environment with this command:

> vagrant up

This will build a VM and install all the prerequisites and set up the local database.

You can edit files normally using your favorite IDE outside the VM, and then run the server with these commands:

> vagrant up                     // This boots the vm
> vagrant ssh                    // This logs you into the VM
> mvn clean install              // Build required libraries
> cd /Vagrant/pathmind-webapp    // Change to the webapp directory
> mvn spring-boot:run            // Run the webapp

the first mvn clean install builds the required shared libraries.

This might vary system by system, but the local webserver is accessible at 127.0.0.1:8080


Troubleshooting tips:

  • vagrant provision will run the setup script again. This is good if for some reason the environment variables aren't set up correctly, etc
  • In more extreme cases, you can start from scratch with vagrant destroy
  • Make sure your VM has enough RAM allocated to it. This shouldn't be the case anymore, but if you see a JAVA OOM error/Heap Space error you can increase the ram for the VM.

The Vagrantfile can be found here if you're interested

--

Here are instructions from Henri that are useful to know. Maybe one day I'll clean this up.

Running the app

Instead if running mvn spring-boot:run in the root of the project, now you need to run it in the 'pathmind-webapp' sub-module.

Modules

Now we have the following modules

  • pathmind-parent
    • pathmind-shared
    • pathmind-database
    • pathmind-services
    • pathmind-updater
    • pathmind-updater

pathmind-parent

This is the parent module. Running mvn clean install here builds all sub-modules.

This module should contain all dependency versions. Dependencies in sub-modules should not contain version numbers, version numbers are defined here in the <dependencyManagement> section.

Also, dependencies defined in the <dependencies> section are applied to every sub-module.

pathmind-shared

Shared code for every module.

pathmind-database

Contains

  • Entities (data classes)
  • generated JOQ classes (the plugin to generate these classes is still in the pathmind-webapp sub-module)
  • Liquibase migrations (the plugin to generate these classes is still in the pathmind-webapp sub-module)
  • DAOs
  • Repositories
  • Some util classes used by DAOs
  • Event bus implementations which need data classes from this module.

pathmind-services

Contains all service classes and util and DTO classes used by service classes,

pathmind-webapp

UI code goes here. This is the only module which can contain Vaadin UI code.

pathmind-updater

This is the module for a standalone updater app but because we don't have a mechanism to push updates from this app to the webapp yet (and also to avoid too many changes at once) this is just another jar module on the project right now.

Configuration

Configurations from application.properties have been moved to 'pathmind-shared' (shared.properties). Property values defined in shared.properties can be overridden in application.properties in the pathmind-webapp module. Also, after pathmind-updater is its own independent app, it will have its own application.properties which inherits shared.properties.

Clone this wiki locally