Skip to content

Latest commit

 

History

History
113 lines (94 loc) · 4.38 KB

README.md

File metadata and controls

113 lines (94 loc) · 4.38 KB

Toggl Track Companion

Source Checks Release Last Commit License

Toggl Track Companion is a web based application to give you addional views and reports for your Toggl Track account.

Self Hosting

Toggl Track Companion is designed to run in containers. Make sure to have a running docker setup with docker compose.

docker-compose.yml

# sample config to run toggl track companion with traefik as a reverse proxy

services:
  mongodb:
    image: docker.io/mongo:latest
    restart: unless-stopped
    volumes:
      - ./mongodb/data:/data/db
      - ./mongodb/config/mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
    env_file:
      - ./mongodb/config/mongodb.env
    labels:
      - com.centurylinklabs.watchtower.enable=true
    networks:
      - internal

  web:
    image: ghcr.io/jan-di/toggl-track-companion:main
    restart: unless-stopped
    command: web
    labels:
      - com.centurylinklabs.watchtower.enable=true
      - traefik.enable=true
      - traefik.http.routers.toggl-track-companion.entryPoints=https
      - traefik.http.routers.toggl-track-companion.rule=Host(`toggl-track-companion.example`)
      - traefik.http.routers.toggl-track-companion.tls=true
      - traefik.http.services.toggl-track-companion.loadbalancer.server.scheme=http
      - traefik.http.services.toggl-track-companion.loadbalancer.server.port=5000
    env_file:
      - ./companion/companion.env
    networks:
      - internal
      - reverse-proxy
    depends_on:
      - mongodb

  updater:
    image: ghcr.io/jan-di/toggl-track-companion:main
    restart: unless-stopped
    command: updater
    labels:
      - com.centurylinklabs.watchtower.enable=true
    env_file:
      - ./companion/companion.env
    networks:
      - internal
    depends_on:
      - mongodb

networks:
  internal:
    external: false
  reverse-proxy:
    external: true

mongodb/config/mongodb.env

MONGO_INITDB_ROOT_USERNAME=root
MONGO_INITDB_ROOT_PASSWORD=<secure-password-for-root-user>
MONGO_INITDB_DATABASE=app

mongodb/config/mongo-init.js

db.createUser({
  user: "app",
  pwd: "<secure-password-for-app-user>",
  roles: [{ role: "dbOwner", db: "app" }],
});

db.grantRolesToUser("app", [{ role: "clusterMonitor", db: "admin" }]);

companion/companion.env

DATABASE_URI = 'mongodb://app:<secure-password-for-app-user>@mongodb:27017/app'
FLASK_SESSION_SECRET = "<random-generated-session-secret>"
SYNC_INTERVAL_CALENDAR = 900
SYNC_INTERVAL_TOGGL = 3600

Configuration

Variable Default Description
SERVER_ID required Unique ID of this ttc instance
SERVER_URL required External url of your instance (with schema and path)
DATABASE_URI required URL to Mongodb database.
FLASK_SESSION_SECRET required Random string that is used to sign session keys.
SYNC_INTERVAL_CALENDAR 3600 Sync interval for schedule calendars in seconds
SYNC_INTERVAL_TOGGL 86400 Sync interval for toggl data in seconds
LOG_LEVEL "INFO" Loglevel. See python docs for valid values.