Git Product home page Git Product logo

postgsail's Introduction

PostgSail

Effortless cloud based solution for storing and sharing your SignalK data. Allow you to effortlessly log your sails and monitor your boat with historical data.

release License issues - postgsail

Test services db, api Test services db, api, web Test services db, grafana

signalk-postgsail: GitHub Release

postgsail-frontend: GitHub Release

postgsail-telegram-bot: GitHub Release

Features

  • Automatically log your voyages without manually starting or stopping a trip.
  • Automatically capture the details of your voyages (boat speed, heading, wind speed, etc).
  • Timelapse video your trips!
  • Add custom notes to your logs.
  • Export to CSV or GPX and download your logs.
  • Aggregate your trip statistics: Longest voyage, time spent at anchorages, home ports etc.
  • See your moorages on a global map, with incoming and outgoing voyages from each trip.
  • Monitor your boat (position, depth, wind, temperature, battery charge status, etc.) remotely.
  • History: view trends.
  • Alert monitoring: get notification on low voltage or low fuel remotely.
  • Notification via email or PushOver, Telegram
  • Offline mode
  • Low Bandwidth mode
  • Awesome statistics and graphs
  • Anything missing? just ask!

Context

It is all about SQL, object-relational, time-series, spatial databases with a bit of python.

PostgSail is an open-source alternative to traditional vessel data management. It is based on a well known open-source technology stack, Signalk, PostgreSQL, TimescaleDB, PostGIS, PostgREST. It does perfectly integrate with standard monitoring tool stack like Grafana.

To understand the why and how, you might want to read Why.md

Architecture

A simple scalable architecture:

Architecture overview

For more clarity and visibility the complete Entity-Relationship Diagram (ERD) is export as PNG and SVG file.

Cloud

If you prefer not to install or administer your instance of PostgSail, hosted versions of PostgSail are available in the cloud of your choice.

The cloud advantage.

Hosted and fully–managed options for PostgSail, designed for all your deployment and business needs. Register and try for free at https://iot.openplotter.cloud/.

Using PostgSail

A full-featured development environment.

With CodeSandbox

With DevPod

With Docker Dev Environments

pre-deploy configuration

To get these running, copy .env.example and rename to .env then set the value accordingly.

# cp .env.example .env

Notice, that PGRST_JWT_SECRET must be at least 32 characters long.

$ head /dev/urandom | tr -dc A-Za-z0-9 | head -c 42 ; echo ''

# nano .env

Deploy

By default there is no network set and all data are store in a docker volume. You can update the default settings by editing docker-compose.yml and docker-compose.dev.yml to your need.

First let's initialize the database.

Step 1. Initialize database

First let's import the SQL schema, execute:

$ docker-compose up db

Step 2. Start backend (db, api)

Then launch the full stack (db, api) backend, execute:

$ docker-compose up db api

The API should be accessible via port HTTP/3000. The database should be accessible via port TCP/5432.

You can connect to the database via a web gui like pgadmin or you can use a client dbeaver.

SQL Configuration

Check and update your postgsail settings via SQL in the table app_settings:

SELECT * FROM app_settings;
UPDATE app_settings
    SET
        value = 'new_value'
    WHERE name = 'app.email_server';

Ingest data

Next, to ingest data from signalk, you need to install signalk-postgsail plugin on your signalk server instance.

Also, if you like, you can import saillogger data using the postgsail helpers, postgsail-helpers.

You might want to import your influxdb1 data as well, outflux. Any taker on influxdb2 to PostgSail? It is definitely possible.

Last, if you like, you can import the sample data from Signalk NMEA Plaka by running the tests. If everything goes well all tests pass successfully and you should receive a few notifications by email or PushOver or Telegram. End-to-End (E2E) Testing.

$ docker-compose up tests

API Documentation

The OpenAPI description output depends on the permissions of the role that is contained in the JWT role claim.

Other applications can also use the PostgSAIL API.

API anonymous:

$ curl http://localhost:3000/

API user_role:

$ curl http://localhost:3000/ -H 'Authorization: Bearer my_token_from_login_or_signup_fn'

API vessel_role:

$ curl http://localhost:3000/ -H 'Authorization: Bearer my_token_from_register_vessel_fn'

API main workflow

Check the End-to-End (E2E) test sample.

Docker dependencies

docker-compose is used to start environment dependencies. Dependencies consist of 3 containers:

  • timescaledb-postgis alias db, PostgreSQL with TimescaleDB extension along with the PostGIS extension.
  • postgrest alias api, Standalone web server that turns your PostgreSQL database directly into a RESTful API.
  • grafana alias app, visualize and monitor your data

Optional docker images

  • pgAdmin, web UI to monitor and manage multiple PostgreSQL
  • Swagger, web UI to visualize documentation from PostgREST
docker-compose -f docker-compose-optional.yml up

Software reference

Out of the box iot platform using docker with the following software:

Releases & updates

PostgSail Release Notes & Future Plans: see planned and in-progress updates and detailed information about current and past releases. PostgSail project

Support

To get support, please create new issue.

There is more likely security flows and bugs.

Contribution

I'm happy to accept Pull Requests! Feel free to contribute.

License

This script is free software, Apache License Version 2.0.

postgsail's People

Contributors

xbgmsharp 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.