Git Product home page Git Product logo

signal's Introduction

signal-server

Build Status

Version 1.0.8

To run the migrations

Before running the migration you'll need to create a db and add the extensions:

createuser signal --createdb -h localhost -U postgres
createdb signal -O signal -h localhost -U postgres
psql -U postgres -d signal -c "CREATE EXTENSION IF NOT EXISTS pgcrypto" -h localhost
psql -U postgres -d signal -c "CREATE EXTENSION IF NOT EXISTS postgis" -h localhost
psql -U signal   -d signal -c "CREATE SCHEMA IF NOT EXISTS signal" -h localhost

lein migrate

Generate Sample Data

This will generate random data in all the tables of the database using clojure.spec by running:

lein sampledata

To run the tests

lein test or lein test2junit to generate a JUnit xml and html output

To run the linter

lein eastwood

To generate a code coverage report

lein cloverage

To run the formatter

lein cljfmt fix

To generate the docs

lein codox

MQTT TLS setup

In order to connect to the MQTT broker, we need to present a valid client certificate. To do this we must create a keystore to be used by the service.

# create a keystore to hold the client cert and key
openssl pkcs12 -export -out keystore.p12 -in client.crt -inkey client.key

We may also need to tell the JVM to trust the CA that signed the client certificate by setting up a custom trust store. This is required if the default trust store doesn't contain the CA that signed your client certificate.

# create a copy the default trust store
cp $(JAVA_HOME)/jre/lib/security/cacerts custom-cacerts.jks

# import the custom CA into it
keytool -import -file ca.crt -alias "My Custom CA" -keystore custom-cacerts.jks

Then we can configure the server to use our keystores and truststores by setting the following environment variables (which will get set to corresponding JVM system properties):

TRUST_STORE, TRUST_STORE_TYPE, TRUST_STORE_PASSWORD, KEY_STORE, KEY_STORE_TYPE, KEY_STORE_PASSWORD

If you need to deploy to a Cloud Foundry environment, you can deploy the container like this:

docker build -t quay.io/boundlessgeo/signal:devio .
docker push quay.io/boundlessgeo/signal:devio
cf push signal -o quay.io/boundlessgeo/signal:devio

Using signal

To use signal, you must first sign up for an account, which you can do using the webapp or the REST API

curl 'http://localhost:8085/api/users' \
--data-binary '{"name":"Mickey Mouse","email":"[email protected]","password":"test123"}' \
-H 'Content-Type: application/json'

Then you can exchange your account credentials for an access token, by authenticating using the webapp or REST API

REST Endpoints

All end points return a response of the for {result:<result>,error:<error>}

Authenticate (POST)

curl 'http://localhost:8085/api/authenticate' \
--data-binary '{"email":"[email protected]","password":"test123"}' \
-H 'Content-Type: application/json'

Create User POST

curl -XPOST 'http://localhost:8085/api/authenticate' \
--data-binary '{"email":"[email protected]","password":"test123"}' \
-H 'Content-Type: application/json'

List Users GET

curl -XGET 'http://localhost:8085/api/users'

signal's People

Contributors

tetriscode avatar craig-boundless avatar

Watchers

L3DLP avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.