Update README

This commit is contained in:
xbgmsharp
2023-07-09 23:59:56 +02:00
parent 1c62aaa853
commit 931544663e

View File

@@ -1,7 +1,9 @@
# PostgSail # 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. 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.
## Features ## Features
- Automatically log your voyages without manually starting or stopping a trip. - Automatically log your voyages without manually starting or stopping a trip.
- Automatically capture the details of your voyages (boat speed, heading, wind speed, etc). - Automatically capture the details of your voyages (boat speed, heading, wind speed, etc).
- Timelapse video your trips! - Timelapse video your trips!
@@ -14,9 +16,10 @@ Effortless cloud based solution for storing and sharing your SignalK data. Allow
- Alert monitoring: get notification on low voltage or low fuel remotely. - Alert monitoring: get notification on low voltage or low fuel remotely.
- Notification via email or PushOver, Telegram - Notification via email or PushOver, Telegram
- Offline mode - Offline mode
- Low Bandwith mode - Low Bandwidth mode
## Context ## Context
It is all about SQL, object-relational, time-series, spatial databases with a bit of python. 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. PostgSail is an open-source alternative to traditional vessel data management.
@@ -25,23 +28,35 @@ It is based on a well known open-source technology stack, Signalk, PostgreSQL, T
To understand the why and how, you might want to read [Why.md](https://github.com/xbgmsharp/postgsail/tree/main/Why.md) To understand the why and how, you might want to read [Why.md](https://github.com/xbgmsharp/postgsail/tree/main/Why.md)
## Architecture ## Architecture
For more clarity and visibility the complete [Entity-Relationship Diagram (ERD)](https://github.com/xbgmsharp/postgsail/tree/main/ERD/README.md) is export as PNG and SVG file. For more clarity and visibility the complete [Entity-Relationship Diagram (ERD)](https://github.com/xbgmsharp/postgsail/tree/main/ERD/README.md) is export as PNG and SVG file.
## Cloud ## 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. 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. ### The cloud advantage.
Hosted and fullymanaged options for PostgSail, designed for all your deployment and business needs. Register and try for free at https://iot.openplotter.cloud/. Hosted and fullymanaged options for PostgSail, designed for all your deployment and business needs. Register and try for free at https://iot.openplotter.cloud/.
## Using PostgSail ## Using PostgSail
## Cloud developement ### full-featured development environment
- https://codesandbox.io/p/sandbox/stoic-bird-5g6gk8 The Visual Studio Code Remote - Containers extension lets you use a Docker container as a full-featured development environment.
#### With codesandbox
- https://codesandbox.io/p/github/xbgmsharp/postgsail/main
#### With DevPod
- https://devpod.sh/open#https://github.com/xbgmsharp/postgsail/&workspace=postgsail&provider=docker&ide=openvscode
#### With Docker Dev Environments
- https://open.docker.com/dashboard/dev-envs?url=https://github.com/xbgmsharp/postgsail/
Open in Docker Dev Environments Open in Docker Dev Environments
### pre-deploy configuration ### pre-deploy configuration
To get these running, copy `.env.example` and rename to `.env` then set the value accordinly. To get these running, copy `.env.example` and rename to `.env` then set the value accordingly.
```bash ```bash
# cp .env.example .env # cp .env.example .env
@@ -49,32 +64,40 @@ To get these running, copy `.env.example` and rename to `.env` then set the valu
Notice, that `PGRST_JWT_SECRET` must be at least 32 characters long. Notice, that `PGRST_JWT_SECRET` must be at least 32 characters long.
`$ head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32 ; echo ''` `$ head /dev/urandom | tr -dc A-Za-z0-9 | head -c 42 ; echo ''`
```bash ```bash
# nano .env # nano .env
``` ```
### Deploy ### Deploy
By default there is no network set and the postgresql data are store in a docker volume. By default there is no network set and the postgresql data are store in a docker volume.
You can update the default settings by editing `docker-compose.yml` to your need. You can update the default settings by editing `docker-compose.yml` to your need.
Then simply excecute:
```bash First let's initialize the database.
$ docker-compose up
```
#### Initialize database #### Initialize database
Then simply excecute:
First let's import the SQL schema, excecute:
```bash ```bash
$ docker-compose up db $ docker-compose up db
``` ```
#### start backend (db, api) #### Start backend (db, api)
Then simply excecute:
Then launch the full stack (db, api) backend, excecute:
```bash ```bash
$ docker-compose up db api $ 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](https://www.pgadmin.org/) or you can use a client [dbeaver](https://dbeaver.io/).
### SQL Configuration ### SQL Configuration
Check and update your postgsail settings via SQL in the table `app_settings`: Check and update your postgsail settings via SQL in the table `app_settings`:
@@ -91,6 +114,7 @@ UPDATE app_settings
``` ```
### Ingest data ### Ingest data
Next, to ingest data from signalk, you need to install [signalk-postgsail](https://github.com/xbgmsharp/signalk-postgsail) plugin on your signalk server instance. Next, to ingest data from signalk, you need to install [signalk-postgsail](https://github.com/xbgmsharp/signalk-postgsail) plugin on your signalk server instance.
Also, if you like, you can import saillogger data using the postgsail helpers, [postgsail-helpers](https://github.com/xbgmsharp/postgsail-helpers). Also, if you like, you can import saillogger data using the postgsail helpers, [postgsail-helpers](https://github.com/xbgmsharp/postgsail-helpers).
@@ -100,24 +124,29 @@ Any taker on influxdb2 to PostgSail? It is definitly possible.
Last, if you like, you can import the sample data from Signalk NMEA Plaka by running the tests. 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 sucessfully and you should recieve a few notifications by email or PushOver. If everything goes well all tests pass sucessfully and you should recieve a few notifications by email or PushOver.
``` ```
$ docker-compose up tests $ docker-compose up tests
``` ```
### API Documentation ### API Documentation
The OpenAPI description output depends on the permissions of the role that is contained in the JWT role claim. The OpenAPI description output depends on the permissions of the role that is contained in the JWT role claim.
API anonymous: API anonymous:
``` ```
$ curl http://localhost:3000/ $ curl http://localhost:3000/
``` ```
API user_role: API user_role:
``` ```
$ curl http://localhost:3000/ -H 'Authorization: Bearer my_token_from_login_or_signup_fn' $ curl http://localhost:3000/ -H 'Authorization: Bearer my_token_from_login_or_signup_fn'
``` ```
API vessel_role: API vessel_role:
``` ```
$ curl http://localhost:3000/ -H 'Authorization: Bearer my_token_from_register_vessel_fn' $ curl http://localhost:3000/ -H 'Authorization: Bearer my_token_from_register_vessel_fn'
``` ```
@@ -138,12 +167,15 @@ Check the [unit test sample](https://github.com/xbgmsharp/postgsail/blob/main/te
- [pgAdmin](https://hub.docker.com/r/dpage/pgadmin4), web UI to monitor and manage multiple PostgreSQL - [pgAdmin](https://hub.docker.com/r/dpage/pgadmin4), web UI to monitor and manage multiple PostgreSQL
- [Swagger](https://hub.docker.com/r/swaggerapi/swagger-ui), web UI to visualize documentation from PostgREST - [Swagger](https://hub.docker.com/r/swaggerapi/swagger-ui), web UI to visualize documentation from PostgREST
``` ```
docker-compose -f docker-compose-optional.yml up docker-compose -f docker-compose-optional.yml up
``` ```
### Software reference ### Software reference
Out of the box iot platform using docker with the following software: Out of the box iot platform using docker with the following software:
- [Signal K server, a Free and Open Source universal marine data exchange format](https://signalk.org) - [Signal K server, a Free and Open Source universal marine data exchange format](https://signalk.org)
- [PostgreSQL, open source object-relational database system](https://postgresql.org) - [PostgreSQL, open source object-relational database system](https://postgresql.org)
- [TimescaleDB, Time-series data extends PostgreSQL](https://www.timescale.com) - [TimescaleDB, Time-series data extends PostgreSQL](https://www.timescale.com)
@@ -151,6 +183,7 @@ Out of the box iot platform using docker with the following software:
- [Grafana, open observability platform | Grafana Labs](https://grafana.com) - [Grafana, open observability platform | Grafana Labs](https://grafana.com)
### Releases & updates ### Releases & updates
PostgSail Release Notes & Future Plans: see planned and in-progress updates and detailed information about current and past releases. [PostgSail project](https://github.com/xbgmsharp?tab=projects) PostgSail Release Notes & Future Plans: see planned and in-progress updates and detailed information about current and past releases. [PostgSail project](https://github.com/xbgmsharp?tab=projects)
### Support ### Support