Skip to content

ilkkao/trailmate

Repository files navigation

Trailmate

Build Status

🐻 Check the demo: Live Trailmate in action

Trailmate is a simple companion web app for trail cameras that support email transport. It includes a SMTP server which the camera can directly connect to. You don't need to setup email servers, MX records or email to HTTP gateways.

Installation with Docker compose

Recommended way to run Trailmate is with docker. Example docker-compose.yml file:

version: '3'
services:
  trailmate:
    image: ilkkao/trailmate:latest
    restart: unless-stopped
    volumes:
      - trailmate-data:/data
    ports:
      - "80:3001"
      - "2526:2526"
    environment:
      - HTTP_SERVER_URL=http://example.com
      - [email protected]
      - CAMERA_TZ_OFFSET=3
      - IMAGE_DIR=/data/images
      - DB_FILE=/data/database.db
      - ADMIN_PASSWORD=verysecret
volumes:
  trailmate-data:

Application configuration

Environment variable Type Default value Description
HTTP_SERVER_URL Mandatory - Public URL of the web site. For example http://myowntrailcam.com.
SECRET_EMAIL_ADDRESS Mandatory - The to: email address the trail camera has to use. This acts as a password.
CAMERA_TZ_OFFSET Mandatory - Timezone the camera is configured to use.
IMAGE_DIR Mandatory - Persisten directory for received images.
DB_FILE Mandatory - Location for the SQLite database file.
ADMIN_PASSWORD Mandatory - Admin password, currently needed for image deletion via the web page.
LOCALE Optional en-us Default user interface language.
HTTP_SERVER_PORT Optional 3001 Port for the nodejs web server.
SMTP_SERVER_PORT Optional 2526 SMTP port for incoming mails. Default 2526 is selected so that it is unlikely blocked by ISPs.
MAILGUN_API_KEY Optional -not set- Mailgun API key notification emails. Has the form key-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
MAILGUN_DOMAIN Optional -not set- Mailgun API domain.
MAILGUN_FROM Optional -not set- From: header used in notification emails. For example My camera <[email protected]>
MAILGUN_TO Optional -not set- Comma separated list of email addresses that receive the notifications. For example [email protected],[email protected]
GOOGLE_ANALYTICS_ID Optional -not set- Google Analytics ID. Has the form UA-111111111-1
VERBOSE Optional false Log web server requests to stdout.

Trail camera configuration

In your camera settings, enable email sending and use the following setting values:

Setting Correct value
SMTP server Your web server public host name or IP address. For example myowntrailcam.com
SMTP port The port you configured with SMTP_SERVER_PORT environment variable or the default 2526
Use SSL Can be set to enabled or disabled. Trailmate supports both.
Use authentication Can be set to enabled or disabled. Trailmate is flexible
Username Can be anything. Trailmate accepts any value
Password Can be anything. Trailmate accepts any value
To address Must match to SECRET_EMAIL_ADDRESS you configured. Note that for trailmate this is just a string and shuold not be a real existing email address. Good example would be [email protected].

See trailmate logs in case of any SMTP issues.

Development

Run locally in dev mode

Install node modules:

$ cd client && yarn
$ cd server && yarn

Run client dev server in first terminal:

$ cd client && yarn start-dev

Run server in second terminal:

$ cd server && yarn start-dev

Access the website at http://localhost:3000/

Simulate upload from Mailgun

curl -X POST \
  -F "Date=Thu, 28 Jul 2018 21:34:01 +0200" \
  -F "attachment-count=1" \
  -F "attachment-1=@fixtures/sample-burrel-camera-image.jpg" \
  http://localhost:3001/api/upload-image-foobar

About

Trail camera website

Resources

Stars

Watchers

Forks

Packages

No packages published