Skip to content

Commit

Permalink
Added README file
Browse files Browse the repository at this point in the history
  • Loading branch information
peder280370 committed Mar 6, 2015
1 parent 5b8f844 commit 3cec923
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 3 deletions.
95 changes: 95 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
VesselTrack
==========================

Live monitoring of AIS vessel targets.

The data is persisted in a MySQL database.

## Prerequisites

* Java 8
* Maven (for building)
* MySQL


## Building ##

mvn clean install

## Launch

The build produces a executable .war-file in the /target folder. The application can be launched with:

java -jar target/vessel-track-0.1-SNAPSHOT.war

or by using maven:

mvn spring-boot:run

A local deployment will setup VesselTrack at the following URL:

http://localhost:8080/index.html

## Configuration

VesselTrack can be configured by passing runtime parameters to it.
Please refer to [src/main/resources/application.properties](src/main/resources/application.properties)

Example (master instance):

java -jar target/vessel-track-0.1-SNAPSHOT.war \
--server.port=9000 \
--aisbus=aisbus.xml \
--spring.datasource.url=jdbc:mysql://localhost:3306/track \
--aisbusFilter="s.country in (DNK)"

Example (slave instance):

java -jar target/vessel-track-0.1-SNAPSHOT.war \
--server.port=9090 \
--spring.datasource.url=jdbc:mysql://localhost:3306/track \
--slave=true

## Docker

VesselTrack is being built at docker.io [https://registry.hub.docker.com/u/dmadk/vessel-track/](https://registry.hub.docker.com/u/dmadk/vessel-track/)

The base command for running dmadk/vessel-track is:

sudo docker run dmadk/vessel-track


## REST API ##

#### Vessel target information

http://locahost:8080/vessels/{mmsi}

#### Vessel target list

http://locahost:8080/vessels/list

The following GET arguments can be supplied for filtering

* `top` - the top latitude
* `left` - the left longitude
* `bottom` - the bottom latitude
* `right` - the right longitude
* `maxHits` - The maximum number of vessels

#### Vessel target count

http://locahost:8080/vessels/count

Same arguments as list

#### Historical track

http://locahost:8080/vessels/track/{mmsi}

Past track for the given vessel. The following GET arguments can be supplied for trimming the output

* `minDist` (meters) - Samples the past track. The minimum distance between
positions will be `minDist`. This argument can greatly reduce the number of track points for vessels at berth or anchor.
* `age` - How long back to get past track for (format: https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html#parse-java.lang.CharSequence)

7 changes: 4 additions & 3 deletions src/main/java/dk/dma/vessel/track/store/TargetStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ public class TargetStore {

static final Logger LOG = LoggerFactory.getLogger(TargetStore.class);

public static final String PRIME_TARGETS_DB_SQL =
"select v.mmsi from " + VesselTarget.class.getSimpleName() + " v";

public static final String LOAD_TARGETS_SQL =
"SELECT t FROM " + VesselTarget.class.getSimpleName() + " t " +
" where t.lastReport > :lastReport";

public static final String PRIME_TARGETS_DB_SQL =
"select v.mmsi from " + VesselTarget.class.getSimpleName() + " v";

public static final String LOAD_TARGETS_INCL_PAST_TRACKS_SQL =
"SELECT t FROM " + VesselTarget.class.getSimpleName() + " t " +
" left join fetch t.lastPastTrackPos p " +
Expand Down Expand Up @@ -156,6 +156,7 @@ private void loadFromDB() {
/**
* Periodically expire vessel targets from the cache
*/
@Transactional
@Scheduled(cron="10 0 */1 * * *")
public void periodicallyExpireTargets() {
long t0 = System.currentTimeMillis();
Expand Down

0 comments on commit 3cec923

Please sign in to comment.