Skip to content

LeoChabrier/ftrack-docker-webhook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ftrack-docker-webhook

Python Docker ftrack License: Unlicense Version

Dockerized ftrack event listeners for small VFX structures.

Built for studios running a Synology, QNAP, or any NAS with Docker support — each hook ships as a standalone .tar image you can upload and run in a container.


Overview

This repository contains a collection of Python scripts that listen to ftrack events via the ftrack-python-api. Each event hook is independently dockerized, so you can deploy only the ones you need.

It's a pretty legacy way to do it, but it works.

Available Hooks

Hook Description
linked_tasks_status_update When a task status changes, automatically updates the status of its linked (downstream) tasks.
version_to_daily On version publish, automatically adds the new version to the project's dailies playlist.

Project Structure

ftrack-docker-webhook/
├── python/
│   └── ftrack_docker_webhook/
│       ├── __init__.py
│       ├── utils.py                 # Shared utilities (session, helpers)
│       ├── status_types.py          # Status enum definitions
│       ├── linked_tasks_status_update/
│       │   ├── main.py              # Event listener
│       │   ├── Dockerfile
│       │   └── docker_run.ps1       # Build & export script
│       └── version_to_daily/
│           ├── main.py              # Event listener
│           ├── Dockerfile
│           └── docker_run.ps1       # Build & export script
├── scripts/
│   ├── copy_key.ps1                 # Copy encryption key before build
│   └── venv.ps1                     # Create local venv
├── requirements.txt
├── bump_version.sh                  # Tag & release helper
├── VERSION
└── LICENSE

Prerequisites

  • Docker installed on the host (NAS or local machine)
  • Python 3.11+ (for local development only)
  • An ftrack account with API access
  • A Fernet encryption key (secret.key) used to decrypt the API key at runtime

Environment Setup

Each container reads its configuration from a .env file. Create one at the repository root:

cp .env.example .env

Required variables:

# ftrack
FTRACK_SERVER_URL=https://your-studio.ftrackapp.com
ENCRYPTED_FTRACK_API_KEY=<your-encrypted-api-key>

# Paths to the Fernet secret key (per platform)
SECRET_KEY_PATH_WINDOWS=C:\path\to\secret.key
SECRET_KEY_PATH_MAC=/path/to/secret.key
SECRET_KEY_PATH_LINUX=/app/secret.key

Tip: Use the provided scripts/copy_key.ps1 to copy your secret.key into the build context before building images.


Local Development

# Create a virtual environment & install dependencies
python -m venv .venv
source .venv/bin/activate        # Linux / macOS
# .venv\Scripts\activate         # Windows

pip install -r requirements.txt

Run a hook locally (e.g. linked tasks):

export PYTHONPATH="$(pwd)/python"
python python/ftrack_docker_webhook/linked_tasks_status_update/main.py

Building & Deploying Docker Images

Each hook is built and exported as a .tar file that can be uploaded directly to your NAS container manager (Synology Container Manager, QNAP Container Station, etc.).

1. Copy the encryption key into the build context

# Edit scripts/copy_key.ps1 to point to your actual secret.key location, then:
powershell -File scripts/copy_key.ps1

2. Build & export a hook

Linked Tasks Status Update:

docker build -t linked_task_status_update \
  -f python/ftrack_docker_webhook/linked_tasks_status_update/Dockerfile .

docker save -o linked_task_status_update.tar linked_task_status_update

Version to Daily:

docker build -t version_to_daily \
  -f python/ftrack_docker_webhook/version_to_daily/Dockerfile .

docker save -o version_to_daily.tar version_to_daily

3. Upload to your NAS

  1. Open your NAS Docker / Container Manager UI
  2. Go to ImagesImport (or Add from file)
  3. Upload the .tar file
  4. Create a container from the imported image
  5. Mount or copy your .env and secret.key into the container
  6. Start the container — the hook will begin listening to ftrack events

Versioning

Version is tracked in the VERSION file and via git tags. Use the bump script to release:

bash bump_version.sh
# Follow the prompt to choose major / minor / patch

Adding a New Hook

  1. Create a new directory under python/ftrack_docker_webhook/your_hook_name/
  2. Add a main.py with your event logic, using the shared utilities:
    from ftrack_docker_webhook import utils
    
    session = utils.session_connect()
    session.event_hub.connect()
    
    def main(event, _):
        # Your logic here
        session.cache.clear()
    
    utils.subscribe_to_event(session, main)
  3. Add a Dockerfile following the existing pattern
  4. Build, export, and upload to your NAS

License

This project is released into the public domain under the Unlicense.

Made by Léo Chabrier.

About

Python & Docker templates to dockerize event listenner on Ftrack (Tracking Production Platform)

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors