Skip to content
Jake Piccolo edited this page Sep 22, 2015 · 18 revisions

Overview

Setup

Install Postgres

  1. On Mac OS X I recommend using the mac app, or you can use homebrew. For the mac app installation, remember to add the following to your .profile

export PATH=/Applications/Postgres.app/Contents/Versions/9.4/bin:$PATH

  1. *Start Postgres, and use the sql script create.sql located at sql/common/ inside the project, e.g. psql -U username -d myDataBase -a -f common/create.sql. It will create a user ingress_user and the required tables. Point your configuration files to your Postgres instance, by default localhost:5432 should work.

Install DynamoDB

  1. You can run DynamoDB locally by using the dev version

  2. Install DynamoDB (see link above) and run it with java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -port 7777 where 7777 is the port you wish to connect to and that you have added to your configuration files. Hint: you need to update suripu-service.dev.yml.

  3. Copy *.dev.yml.example to *.dev.yml in each sub module. Update all the username and password accordingly.

Install Java and Maven

  1. You need Java 7 installed. Remember to set JAVA_HOME correctly by adding the following to your .profile

export JAVA_HOME=$(/usr/libexec/java_home).

  1. Install Maven brew install maven (3.2.1), or follow instructions here. See below for additional Maven settings for shared libraries.

  2. IntelliJ Community Edition is an amazing IDE for Java. **If you’re not using IntelliJ, you’re probably doing it wrong.

Import suripu IntelliJ project

  1. Now’s a good time to open IntelliJ and build the project by running mvn clean package in the terminal.

  2. run java -jar your-jar create_table suripu-factory.dev.yml

  3. You’re now ready to start the multiple HTTP service. Each service is independent as they all have different availability, latency and security properties. To start a HTTP service you need to run java -jar path/to/your/jar/file.jar server path/to/your/config/file.yml

  4. Each HTTP service listens on 2 ports (regular and admin) so make sure they are not conflicting. The REST endpoints will be logged by default and connections to databases will be initiated. Should one part of the system be unavailable – most likely misconfigured – your HTTP services will refuse to start.

  5. Pre-populate your local DB with some data:

  • download sql dump from dropbox [Product/software/Research/data_recording]
  • create a temporary database, in psql CREATE DATABASE database_Y_M_D
  • run in command line psql database_Y_M_D < dump-Y-M-D.sql
  1. You will need to set environment variable for AWS keys.

AWS key format.

AWS_ACCESS_KEY_ID BLAH-MY-KEY-HERE
AWS_SECRET_KEY  something+secure+here+password-l33t

Maven

We are hosting some shared libraries on our own maven repo, hosted on S3. Add the following to your ~/.m2/settings.xml

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                      http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
 <server>
  <id>s3.site</id>
  <username></username>
  <password></password>
 </server>
 <server>
  <id>s3.release</id>
  <username></username>
  <password></password>
 </server>
 <server>
  <id>s3.snapshot</id>
  <username></username>
  <password></password>
 </server>
  <server>
  <id>hello-maven</id>
  <username></username>
  <password></password>
 </server>
</servers>
</settings>

The username and password for maven are the AWS_ACCESS_KEY_ID and AWS_SECRET_KEY.

Clone this wiki locally