Home

Awesome

openSenseMap in Docker Compose

This repository contains the docker-compose.yml how opensensemap.org is run. It includes a watchtower image which will periodically checks for and deploys updated images.

What you need

How to run

Use the script create-volumes.sh to create docker volumes. These will be used by the services specified in docker-compose.yml.

Create self signed certificates for inter-service communication with generateCertificates.sh.

After you installed the software listed above, created the subdomains and place the docker-compose.yml on your server. You may want to configure some values in a docker-compose.override.yml. Configuration happens mainly through environment keys.

Afterwards you can start everything with docker-compose up -d. This repository also contains some bash scripts to deploy updated images.

Certificates for secure inter-service communication

The generateCertificates.sh script wraps certstrap to create a self signed certificate authority which can be used to sign server and client certificates.

Prerequisites

Grab at least version 1.1.1 of certstrap (github.com/square/certstrap/releases)

Usage

./generateCertificates.sh YOUR-CERTIFICATE-AUTHORITY-NAME SERVICE1[,SERVICE2,...]

Generates a new certficate authority named YOUR-CERTIFICATE-AUTHORITY-NAME and certificates for services named SERVICE1 and SERVICE2. The certificates are valid for hostnames SERVICE_NAME and localhost and are stored in a new folder called certificates.

You can convert the certificate files to \n delimited strings using sed -z 's/\n/\\n/g' < certificate.crt.

Configuration

Service web

keycommentoptional
WEB_DOMAINyour domain without protocol. also no www
API_DOMAINnormally api.yourdomain.tld
INGRESS_DOMAINnormally ingress.yourdomain.tld
ISSUER_ADDRESSyour email for automatic issuing of a letsencrypt tls certificate
ADDITIONAL_VHOSTSAllows to specify additional vhosts for the caddy web server.y
USE_STAGING_CAif true a test-certificate will be issued. Otherwise omit this keyy

Service api

keycommentoptional
NODE_ENVshould be set to production to enable https checking in the api.
NODE_CONFIGJSON string containing the configuration of the openSenseMap-API service

Service mongo

keycommentoptional
OSEM_dbuserthe database user to connect to your mongodb, should be the same in services api, mongo, ttn-integration and mqtt-integrationy
OSEM_dbuserpassthe password for the mongodb user, should be the same in services api, mongo, ttn-integration and mqtt-integrationy

Service mailer

keycommentoptional
SENSEBOX_MAILER_CA_CERTthe certificate of your CA. Server and client should be signed by this CA. See Certificates for secure inter-service communication for more information.
SENSEBOX_MAILER_SERVER_CERTthe server certificate
SENSEBOX_MAILER_SERVER_KEYthe key of the server certificate
SENSEBOX_MAILER_SMTP_SERVERthe smtp server address
SENSEBOX_MAILER_SMTP_PORTthe smtp server port
SENSEBOX_MAILER_SMTP_USERthe smtp server user
SENSEBOX_MAILER_SMTP_PASSWORDthe smtp server password
SENSEBOX_MAILER_FROM_DOMAINthe domain you are sending from
SENSEBOX_MAILER_HONEYBADGER_APIKEYapi key for honeybadger error reportingy

Service ttn-integration

keycommentoptional
ENVshould be set to prod in production.
OSEM_dbuserthe database user to connect to your mongodb, should be the same in services api, mongo and ttn-integrationy
OSEM_dbuserpassthe password for the mongodb user, should be the same in services api, mongo and ttn-integrationy
OSEM_dbhostthe hostname or ip of the mongodb instance, should be the same in services api and ttn-integrationy
OSEM_dbportthe port of the mongodb instance, should be the same in services api and ttn-integrationy
OSEM_dbauthsourcethe authSource of the mongodb instance, should be the same in services api and ttn-integrationy
OSEM_dbdbthe name of the mongodb database, should be the same in services api and ttn-integrationy
OSEM_dbconnectionstringalternative method to specify the mongodb connection string. If you specify this, dbuser,dbhost and dbpass will be ignoredy
TTN_OSEM_PORTthe port on which the ttn integration runsy
TTN_OSEM_loglevelloglevel for the ttn integration. info, warn, errory

Service mqtt-integration

keycommentoptional
NODE_ENVshould be set to production in production.
NODE_CONFIGJSON string containing the configuration of the mqtt-osem-integration service

Service backup

keycommentoptional
DUPLY_GPG_KEYgpg key id or 'disabled'
DUPLY_GPG_PWgpg password for the keyy
DUPLY_TARGET_URLduplicity target url. See duplicity man page
DUPLY_TARGET_USERuser for accessing the target urly
DUPLY_TARGET_PASSpassword for accessing the target urly
DUPLY_SOURCEsource folder for backups
DUPLY_MAXAGEage after duplicity deletes old backupsy
DUPLY_MAXFULLBKPAGEage after duplicity creates a new full backup instead of a incremental oney
DUPLY_ACTIONduply action. See [http://duply.net/wiki/index.php/Duply-documentation](duply documentation)y
SCHEDULECron schedule for running the backupy
SLACK_HOOK_URLSlack webhook url for duply post scripty
DUPLY_PREComplete Duply pre script. Use $$ to escape single $.y
DUPLY_POSTComplete Duply post script. Use $$ to escape single $.y