Setting up AYON Service Host (ASH)

About AYON Service Host (ASH)

AYON addons provide services that carry out tasks on the AYON server.
e.g. ftrack leecher which stores ftrack events.

AYON uses ASH to manage services in a similar fashion to portainer.
With ASH, AYON can create, start, stop, and remove services as needed.

ASH Setup

The documentation outlines two approaches for setting up ASH using Docker Compose as mentioned in Setting up using docker compose section.

  1. Use the same stack as the server.
  2. Create a completely separate one.

Let me explain it further.

Use the same stack as the server

For Ynput Cloud subscribers, please refer to the subsequent section, Create a completely separate one or reach out to us at support@ynput.io for additional support.

Run ASH as a part of your main Ayon stack. in other words by modifying the docker compose file which found in the self-hosted AYON.

Steps:

  1. Open docker-compose.yml inside your ayon-docker clone
  2. Add the following code at the end of the file, you are free to change the host name.
    ASH section in ayon-docker compose file
      worker:
        image: ynput/ayon-ash:latest
        hostname: worker-01
        restart: unless-stopped
        network_mode: host
        depends_on:
          - server
        volumes:
          - "/var/run/docker.sock:/var/run/docker.sock"
        environment:
          - "AYON_API_KEY=<your-api-key>"
          - "AYON_SERVER_URL=<your-ayon-server-url>"
    

For the sake of clarity, here’s how my compose file looks like:

My full ayon-docker compose file
version: "3.7"

services:
  postgres:
    image: postgres:15
    restart: unless-stopped
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ayon"]
      interval: 5s
      timeout: 5s
      retries: 5

    expose: [5432]

    volumes:
      - "/etc/localtime:/etc/localtime:ro"
      - "db:/var/lib/postgresql/data"

    environment:
      - "POSTGRES_USER=ayon"
      - "POSTGRES_PASSWORD=ayon"
      - "POSTGRES_DB=ayon"

  redis:
    image: redis:alpine
    restart: unless-stopped
    healthcheck:
      test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
      interval: 5s
      timeout: 5s
      retries: 5

    expose: [6379]


  server:
    image: ynput/ayon:dev
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:5000/api/info"]
      interval: 10s
      timeout: 2s
      retries: 3

    depends_on:
      postgres:
        condition: service_healthy
      redis:
        condition: service_started
    # uncomment for older versions of Docker (>4.0.0) and comment out above "depends on" section.
    #depends_on:
      #- postgres
      #- redis

    expose: [5000]
    ports: ["5000:5000"]

    volumes:
      - "./addons:/addons"
      - "./storage:/storage"

      # comment out the following line on Windows
      - "/etc/localtime:/etc/localtime:ro"

      # uncomment the following line if you need to work on the backend code
      # - "./backend:/backend"

  worker:
    image: ynput/ayon-ash:latest
    hostname: worker-01
    restart: unless-stopped
    network_mode: host
    depends_on:
      - server
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
    environment:
      - "AYON_API_KEY=<your-api-key>"
      - "AYON_SERVER_URL=<your-ayon-server-url>"


volumes:
  db: {}

Create a completely separate one

Run ASH separately by either creating a new compose file or cloning ash repo.

You can create it on the same machine where you run AYON server or on different machines, it’s up to your preference.

Steps:

  1. Create a directory maybe name it my-ayon-ash
  2. In that directory, Create empty file docker-compose.yml
  3. Copy & paste the following code inside it. you are free to change the host name.
    ASH separate compose file
    version: "3.7"
    
    services:
      worker:
        image: ynput/ayon-ash:latest
        hostname: worker-02
        restart: unless-stopped
        network_mode: host
        volumes:
          - "/var/run/docker.sock:/var/run/docker.sock"
        environment:
          - "AYON_API_KEY=<your-api-key>"
          - "AYON_SERVER_URL=<your-ayon-server-url>"
    
  4. In the same directory as the compose file, Run
    sudo docker compose up -d
    

Here’s how it looks like on my side:

compose file services list
2 Likes