Repository: elliotmatson/Docker-Davinci-Resolve-Project-Server Branch: main Commit: 765aa40e4b6d Files: 11 Total size: 18.1 KB Directory structure: gitextract_6jtl65fb/ ├── .github/ │ ├── FUNDING.yml │ └── workflows/ │ ├── docker.yml │ ├── lint.yml │ ├── stack-healthcheck.yml │ └── stale.yml ├── LICENSE.md ├── README.md ├── docker-compose.yml ├── pgadmin-config-creator/ │ ├── Dockerfile │ └── app.py └── renovate.json ================================================ FILE CONTENTS ================================================ ================================================ FILE: .github/FUNDING.yml ================================================ --- # These are supported funding model platforms github: [elliotmatson] ================================================ FILE: .github/workflows/docker.yml ================================================ --- # This workflow uses actions that are not certified by GitHub. # They are provided by a third-party and are governed by # separate terms of service, privacy policy, and support # documentation. # GitHub recommends pinning actions to a commit SHA. # To get a newer version, you will need to update the SHA. # You can also reference a tag or branch, # but the action may change without warning. name: Docker Build, Push on: release: types: [published, edited] workflow_dispatch: permissions: read-all env: REGISTRY: ghcr.io IMAGE_NAME: elliotmatson/pgadmin-config-creator DOCKER_IMAGE: elliotmatson/pgadmin-config-creator jobs: build-and-push-image: runs-on: ubuntu-latest permissions: security-events: write contents: read packages: write steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - name: Set up QEMU uses: docker/setup-qemu-action@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v4 - name: Log in to Docker Hub uses: docker/login-action@v4 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Log in to the Container registry uses: docker/login-action@v4 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@v6 with: images: | ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} ${{ env.DOCKER_IMAGE }} tags: | type=ref,event=branch type=ref,event=pr type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} - name: Build and push Docker image uses: docker/build-push-action@v7 with: context: ./pgadmin-config-creator platforms: linux/amd64,linux/arm64,linux/arm/v7 push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} ================================================ FILE: .github/workflows/lint.yml ================================================ --- name: Lint on: push: pull_request: permissions: {} jobs: run-lint: name: Lint runs-on: ubuntu-latest permissions: # to fix any linting issues contents: write packages: read # To report GitHub Actions status checks statuses: write steps: - name: Check out the codebase. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 with: # Full git history is needed to get a proper list of changed files fetch-depth: 0 - name: Lint Code Base uses: github/super-linter/slim@v7 env: VALIDATE_RENOVATE: false FIX_YAML_PRETTIER: true FIX_MARKDOWN_PRETTIER: true FIX_MARKDOWN: true FIX_JSON_PRETTIER: true FIX_JSON: true DEFAULT_BRANCH: main GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ================================================ FILE: .github/workflows/stack-healthcheck.yml ================================================ --- name: Stack Healthcheck on: push: pull_request: workflow_dispatch: permissions: read-all jobs: test: name: Test Stack runs-on: ubuntu-latest steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - name: Deploy the stack, timeout if not healthy after 2m run: timeout 120 docker compose up --quiet-pull --wait - name: Check creating database run: docker compose logs | grep "CREATE DATABASE" - name: Check database creation run: docker compose logs | grep "Success. You can now start the database server" - name: Check postgres init run: docker compose logs | grep "PostgreSQL init process complete; ready for start up." ================================================ FILE: .github/workflows/stale.yml ================================================ --- name: "Close stale issues and PRs" on: schedule: - cron: "0 */1 * * *" workflow_dispatch: permissions: issues: write pull-requests: write jobs: stale: runs-on: ubuntu-latest steps: - uses: actions/stale@v10 with: stale-issue-message: "This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days." days-before-stale: 30 days-before-close: 7 exempt-issue-labels: no-stale ================================================ FILE: LICENSE.md ================================================ # MIT License Copyright (c) 2022 Elliot Matson Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.md ================================================ # Davinci Resolve Project Server ![Lint](https://github.com/elliotmatson/Docker-Davinci-Resolve-Project-Server/actions/workflows/lint.yml/badge.svg) ![Healthcheck](https://github.com/elliotmatson/Docker-Davinci-Resolve-Project-Server/actions/workflows/stack-healthcheck.yml/badge.svg) ![Docker Build](https://github.com/elliotmatson/Docker-Davinci-Resolve-Project-Server/actions/workflows/docker.yml/badge.svg) Simple Resolve project server with automatic backups ## Table of Contents - [Davinci Resolve Project Server](#davinci-resolve-project-server) - [Table of Contents](#table-of-contents) - [Introduction](#introduction) - [Features](#features) - [Configuration](#configuration) - [Database](#database) - [Backups](#backups) - [PGAdmin](#pgadmin) - [Volume Locations](#volume-locations) - [Installation](#installation) - [QNAP Installation](#qnap-installation) - [Synology](#synology) - [Linux](#linux) - [Different PostgreSQL versions](#different-postgresql-versions) - [Setting up a PostgreSQL 9.5 or 11 Project Server](#setting-up-a-postgresql-95-or-11-project-server) - [Thanks](#thanks) ## Introduction There are a lot of ways to host a Resolve project server, but each of them has their own set of issues. The official project server requires manual backups, and other options can be complicated for those that don't have access to an IT team. Hopefully this is a more reliable and simpler solution for smaller teams! ### Features - **Lightweight** - Docker based, so doesn't require a full macOS or Windows machine or VM. - **Platform Independent** - can be installed on Windows, Mac, Linux, QNAP, Synology, RPi, really anything that can run Docker. - **Compatible with Resolve's existing backup/restore functions** - All backup files use the standard Resolve \*.backup file syntax, and can be restored from the Resolve UI - **Built-in PGAdmin Server** - PGAdmin is a tool for administering a PostgreSQL Server, and is helpful for diagnosing problems and migrating/updating entire servers ## Configuration There are a few things we'll need to edit at the top of the docker-compose.yml file to configure our installation: ```yaml --- version: "3.8" x-common: database: &db-environment POSTGRES_DB: database POSTGRES_USER: &pg-user postgres POSTGRES_PASSWORD: DaVinci TZ: America/Chicago POSTGRES_LOCATION: &db-location "???:/var/lib/postgresql/data" backup: &backup-environment SCHEDULE: "@daily" BACKUP_KEEP_DAYS: 7 BACKUP_KEEP_WEEKS: 4 BACKUP_KEEP_MONTHS: 6 BACKUP_LOCATION: &bk-location "???:/backups" admin: &admin-environment PGADMIN_DEFAULT_EMAIL: admin@admin.com PGADMIN_DEFAULT_PASSWORD: root PGADMIN_PORT: &pgadmin-port "3001:80" ``` ### Database To configure the server itself, we'll want to configure the environment variables below: | Environment Variable |Meaning| |---|---| | POSTGRES_DB | Name of your database. Name it whatever you like. | | POSTGRES_USER | Username you will use to connect to your database. The Resolve default is "postgres" | | POSTGRES_PASSWORD | Password you will use to connect to your database. The Resolve default is "DaVinci" | | TZ | Your timezone, here is [a list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)| | POSTGRES_LOCATION | Location your database will be stored. See [Volume Locations](#volume-locations) | ### Backups To configure the backups, we'll want to configure the variables below: | Environment Variable |Meaning| |---|---| | SCHEDULE | This is a [cron string](https://www.freeformatter.com/cron-expression-generator-quartz.html) for how often backups are created. can be "@daily", "@every 1h", etc | | BACKUP_KEEP_DAYS | Number of daily backups to keep before removal. | | BACKUP_KEEP_WEEKS | Number of weekly backups to keep before removal. | | BACKUP_KEEP_MONTHS | Number of monthly backups to keep before removal. | | BACKUP_LOCATION | Location your backups will be stored. See [Volume Locations](#volume-locations) | ### PGAdmin To configure PGAdmin, we'll want to configure the variables below: | Environment Variable |Meaning| |---|---| | PGADMIN_DEFAULT_EMAIL | Email used for PGAdmin login. Default is "admin@admin.com" | | PGADMIN_DEFAULT_PASSWORD | Password used for PGAdmin login. Default is "root" | | PGADMIN_PORT | String configuring port to expose PGAdmin on. Syntax is "YOUR_PORT:80" | ### Volume Locations The location of your database and backups depend on what platform you are installing on. You will need the full path to the folder you want them stored in. On a QNAP NAS for example, if I wanted to use a folder called "Backups" inside a shared folder named "Videos" for my backups location, the path would be `/shares/Videos/Backups/`, and my `BACKUP_LOCATION` value would look like this: ```yaml BACKUP_LOCATION: &bk-location "/shares/Videos/Backups/:/backups" ``` On Ubuntu, if I wanted to use a folder named "database" in the home directory of the user named "johndoe" for my database location, the path would be `/home/johndoe/database/`, and my `POSTGRES_LOCATION` value would look like this: ```yaml POSTGRES_LOCATION: &db-location "johndoe/database/:/var/lib/postgresql/data" ``` I recommend putting your database on an SSD, your access speed will be noticeably slower on a spinning drive. Once you have configured these settings, save your modified docker-compose.yml file and move on to installation! ## Installation ### QNAP Installation Installing on a QNAP NAS is relatively simple. One note, please put the database files on an SSD. You will thank me later 1. If you don't already have it, install Container Station from the QNAP app store. 2. In Container Station, click "Create", then click "Create Application" 3. Name your application whatever you like (eg. ResolveServer) 4. Copy/Paste your modified docker-compose.yml file, hit "Validate YAML" to test it, and if it passes, click "Create" 5. Container Station will download the files it needs and start the app. Once it's done, you should be able to connect Resolve to the IP address of your QNAP using the database name and credentials ### Synology See [this discussion](https://github.com/elliotmatson/Docker-Davinci-Resolve-Project-Server/discussions/15#discussioncomment-4615278) ### Linux 1. Follow the [Docker installation instructions for your Linux distribution](https://docs.docker.com/engine/install/) 2. Install [Docker Compose](https://docs.docker.com/compose/install/) 3. Move your modified docker-compose.yml file to a folder on your Linux machine, then navigate to that folder in the terminal. 4. Run: `docker compose up -d` 5. Docker-compose will download the files it needs and start the app. Once it's done, you should be able to connect Resolve to the IP address of your Linux Server instance using the database name and credentials ## Different PostgreSQL versions Generally, Resolve is not very tolerant of mismatched PostgreSQL versions. Resolve 18-20 use PostgreSQL 13, which is what this repository now defaults to. Resolve 17 and below use PostgreSQL 9.5. Unfortunately the major release 9.5 is EOL, and 9.5.4 in particular has a lot of vulnerabilities that make it insecure. Since most people are still using the default Resolve credentials for their server, security generally isn't the biggest concern, but if you are trying to secure your project server with an older version of Resolve, you will want to move to a supported version of PostgreSQL. Resolve 17 and below still use a legacy feature that has been removed in PostgreSQL 12, so the latest major version that is useable is 11, which will be maintained until November 9, 2023. ### Setting up a PostgreSQL 9.5 or 11 Project Server To setup a PostgreSQL 9.5 or 11 server instead of 13, there are 2 lines that need to be changed in docker_compose.yml: ```yaml services: postgres: image: postgres:13 ... pgbackups: image: prodrigestivill/postgres-backup-local:13 ... ... ``` to the following: ```yaml services: postgres: image: postgres:9.5 ... pgbackups: image: prodrigestivill/postgres-backup-local:9.5 ... ... ``` ## Thanks -[prodrigestivill](https://github.com/prodrigestivill/) for his [PostgreSQL Backup docker image](https://github.com/prodrigestivill/docker-postgres-backup-local) ================================================ FILE: docker-compose.yml ================================================ --- version: "3.8" x-common: database: &db-environment POSTGRES_DB: &pg-db database POSTGRES_USER: &pg-user postgres POSTGRES_PASSWORD: DaVinci TZ: America/Chicago POSTGRES_LOCATION: &db-location "./db:/var/lib/postgresql/data" backup: &backup-environment SCHEDULE: "@daily" BACKUP_KEEP_DAYS: 7 BACKUP_KEEP_WEEKS: 4 BACKUP_KEEP_MONTHS: 6 BACKUP_LOCATION: &bk-location "./backups:/backups" admin: &admin-environment PGADMIN_DEFAULT_EMAIL: admin@admin.com PGADMIN_DEFAULT_PASSWORD: root PGADMIN_PORT: &pgadmin-port "3001:80" # # ------------------------------------------------------------------------------------------ # DANGER ZONE BELOW # # The remainder of this file likely does not need to be changed. # Please only make modifications # below if you understand what you are doing. # services: postgres: container_name: resolve_pgsql image: postgres:13 restart: always ports: - "5432:5432" environment: <<: [*db-environment] volumes: - *db-location healthcheck: test: ["CMD", "pg_isready", "-U", *pg-user, "-d", *pg-db] interval: 10s timeout: 5s retries: 5 pgbackups: container_name: resolve_pgbackup image: prodrigestivill/postgres-backup-local:13 restart: always volumes: - *bk-location depends_on: - postgres environment: <<: [*db-environment, *backup-environment] POSTGRES_HOST: postgres POSTGRES_EXTRA_OPTS: --blobs --format=custom --quote-all-identifiers BACKUP_SUFFIX: .backup HEALTHCHECK_PORT: 8080 healthcheck: interval: 30s pgadmin: container_name: resolve_pgadmin image: dpage/pgadmin4 restart: always environment: <<: [*admin-environment] PGADMIN_SERVER_JSON_FILE: /pgadmin4-config/servers.json ports: - *pgadmin-port volumes: - pgadmin-config:/pgadmin4-config - pgadmin:/var/lib/pgadmin - *bk-location entrypoint: "/bin/sh" command: - -c - | mkdir -p /var/lib/pgadmin/storage/$${PGADMIN_DEFAULT_EMAIL//@/_}/ ln -s /backups /var/lib/pgadmin/storage/$${PGADMIN_DEFAULT_EMAIL//@/_}/ /entrypoint.sh depends_on: - postgres - pgadmin-config healthcheck: test: [ "CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost/misc/ping || exit 1", ] pgadmin-config: container_name: resolve_pgadmin-config-creator image: ghcr.io/elliotmatson/pgadmin-config-creator:latest restart: on-failure environment: <<: [*db-environment] volumes: - pgadmin-config:/config volumes: pgadmin-config: pgadmin: ================================================ FILE: pgadmin-config-creator/Dockerfile ================================================ FROM python:3.14-slim RUN useradd -m pgadmin-config-creator RUN mkdir /app && mkdir /config COPY . /app RUN chown -R pgadmin-config-creator:pgadmin-config-creator /app /config USER pgadmin-config-creator WORKDIR /app CMD ["python", "app.py"] HEALTHCHECK CMD test -f /config/servers.json || exit 1 ================================================ FILE: pgadmin-config-creator/app.py ================================================ """Creates a default pgAdmin config file""" import json import os import time # quit if config file already exists if os.path.exists("/config/servers.json"): print("/config/servers.json already exists.") else: # open json file in docker volume with open("/config/servers.json", "w", encoding="utf-8") as f: print("created " + f.name) # template json string TEMPLATE_STRING = ( '{"Servers": {"1": {"Name": "DavinciResolve", ' '"Group": "Servers", "Port": 5432, "Username": ' '"postgres", "Host": "postgres", "SSLMode": "prefer", "MaintenanceDB": "postgres"}}}' ) data = json.loads(TEMPLATE_STRING) # fix username data["Servers"]["1"]["Username"] = os.getenv("POSTGRES_USER") print("Printing json to file...") print(data) # update config file json.dump(data, f, indent=2) print("Done. Sleeping...") # Sleep until GHA Healthchecks are complete. # I'm sure there's a better way to get this to not # stall a docker-compose up --wait, but I don't know # what it is time.sleep(125) ================================================ FILE: renovate.json ================================================ { "$schema": "https://docs.renovatebot.com/renovate-schema.json", "extends": [ "config:recommended" ], "lockFileMaintenance": { "enabled": true, "automerge": true }, "packageRules": [ { "matchDepTypes": [ "devDependencies" ], "automerge": true, "matchPackageNames": [ "/lint/", "/prettier/" ] }, { "matchUpdateTypes": [ "minor", "patch", "pin", "digest" ], "automerge": true } ] }