Docker install

This document provides the necessary steps for installation of InstaMate on a any system that runs Docker.

This setup is recommended only if you are running InstaMate on your home network, as otherwise your access token might be at risk. If you intend to expose InstaMate directly to the internet please secure the installation (to be documented soon)

Requirements#

  • Docker (if you are new to Docker, see Installing Docker and Docker Compose)
  • A Machine that's always on, so InstaMate can continually fetch data
  • External internet access, to talk to the API graph

Instructions#

  1. Create a file called docker-compose.yml with the following content:

    docker-compose.yml
    version: "3"
    services:
    instamate:
    image: pihomeserver/instamate:latest
    restart: always
    environment:
    - HOST=${INSTAMATE_HOST:-"0.0.0.0"}
    - PORT=${INSTAMATE_PORT:-"8080"}
    - SESSION_SECRET=${SESSION_SECRET:-"Your Session Secret goes here"}
    - POSTGRES_URI=${POSTGRES_URI:-"database"}
    - FACEBOOK_APPLICATIONID=${FACEBOOK_APPLICATIONID}
    - FACEBOOK_APPLICATIONSECRET=${FACEBOOK_APPLICATIONSECRET}
    - FACEBOOK_API_URL=${FACEBOOK_API_URL:-"https://graph.facebook.com/v9.0"}
    - FACEBOOK_CALLBACK_URL=${FACEBOOK_CALLBACK_URL:-"https://your_reference.ngrok.io/auth/facebook/callback"}
    - POSTGRES_USER=${POSTGRES_USER:-instamate}
    - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-secret}
    - POSTGRES_DB=instamate
    - POSTGRES_PORT=${POSTGRES_PORT:-"5432"}
    - CRON_REELS_ENABLED=${CRON_REELS_ENABLED:-"0"}
    - CRON_REELS_SEQUENCE=${CRON_REELS_SEQUENCE:-"*/15 * * * *"}
    - CRON_REELS_ERROR_TIMER=${CRON_REELS_ERROR_TIMER:-"8"}
    - CRON_LIFETIME_ENABLED=${CRON_LIFETIME_ENABLED:-"1"}
    - CRON_LIFETIME_SEQUENCE=${CRON_LIFETIME_SEQUENCE:-"0 */12 * * *"}
    - CRON_LIFETIME_ERROR_TIMER=${CRON_LIFETIME_ERROR_TIMER:-"2"}
    - CRON_STORIES_ENABLED=${CRON_STORIES_ENABLED:-"1"}
    - CRON_STORIES_SEQUENCE=${CRON_STORIES_SEQUENCE:-"*/15 * * * *"}
    - CRON_STORIES_ERROR_TIMER=${CRON_STORIES_ERROR_TIMER:-"1"}
    - CRON_INSIGHTS_ENABLED=${CRON_INSIGHTS_ENABLED:-"1"}
    - CRON_INSIGHTS_SEQUENCE=${CRON_INSIGHTS_SEQUENCE:-"*/15 * * * *"}
    - CRON_INSIGHTS_ERROR_TIMER=${CRON_INSIGHTS_ERROR_TIMER:-"1"}
    - CRON_MEDIA_ENABLED=${CRON_MEDIA_ENABLED:-"1"}
    - CRON_MEDIA_SEQUENCE=${CRON_MEDIA_SEQUENCE:-"*/5 * * * *"}
    - CRON_MEDIA_ERROR_TIMER=${CRON_MEDIA_ERROR_TIMER:-"1"}
    ports:
    - "${INSTAMATE_PORT:-'8080'}:${INSTAMATE_PORT:-'8080'}"
    networks:
    - instamate
    database:
    image: postgres:13
    restart: always
    environment:
    - POSTGRES_USER=${POSTGRES_USER:-instamate}
    - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-secret}
    - POSTGRES_DB=${POSTGRES_DB:-instamate}
    volumes:
    - ./instamate-db:/var/lib/postgresql/data
    ports:
    - "${POSTGRES_PORT:-'5432'}:${POSTGRES_PORT:-'5432'}"
    networks:
    - instamate
    restart: unless-stopped
    grafana:
    image: pihomeserver/instamate-grafana:latest
    environment:
    - DATABASE_USER=${POSTGRES_USER:-instamate}
    - DATABASE_PASS=${POSTGRES_PASSWORD:-secret}
    - DATABASE_NAME=${POSTGRES_DB:-instamate}
    - DATABASE_HOST=${POSTGRES_URI:-database}
    ports:
    - "${GRAFANA_PORT:-'3000'}:${GRAFANA_PORT:-'3000'}"
    volumes:
    - instamate-grafana-data:/var/lib/grafana
    networks:
    - instamate
    restart: unless-stopped
    networks:
    instamate:
    driver: bridge
    volumes:
    postgres:
    instamate-grafana-data:

    You can also use the existing file in the GitHub repository

  2. Start the docker containers with docker-compose --env-file env up. env is the file created in the previous step (see here) To run the containers in the background add the -d flag:

    docker-compose --env-file env up -d

Usage#

  1. Open the web interface http://your-ip-address:your-instamate-port
  2. Use the menu to log in with your Facebook account, at least
  3. The Grafana dashboards are available at http://your-ip-address:your-grafana-port