Skip to content

Instantly share code, notes, and snippets.

@BigRoy
Last active April 4, 2024 12:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BigRoy/bb3613e49ec421acb9d09613d984d98c to your computer and use it in GitHub Desktop.
Save BigRoy/bb3613e49ec421acb9d09613d984d98c to your computer and use it in GitHub Desktop.
Ayon docker, install, setup and management notes

Note these are not any official notes - just random scribbles

Bootstrap

Running bootstrap wont give you the latest dev versions, only whats been released on the bootstrap server by the ynput team.

Updating it from time to time is a good way to see what progress has been made in terms of addons etc. It shouldnt remove old addon version, only add the new ones. That way you can still use older addons should you need. You would need to create a new bundle to accommodate that.

If you want to run the latest addons, you would need to grab that from the openpype github repository (as that is the current location of the ayon addons) then manually build those (instructions should be on the repository in the Server Addon README) then manually upload those newer addons to the ayon server. You can do this via the ayon web interface or command line should you need.

Extending session timeouts

Set e.g. this in the server section of docker-compose.yml:

environment:
  - "AYON_SESSION_TTL=604800"

Updating

Update ayon-docker, also see AYON Docs: Server Deployment - updates and comment: AYON Updating docker + picking the right tag

Latest:

docker pull ynput/ayon:latest
docker compose up -d --build

Dev:

docker pull ynput/ayon:dev
docker compose up -d --build

Before someone helps to debug, it would be good to make sure you are on the latest build. Run make update

Updating server addons

https://github.com/ynput/OpenPype/tree/19f0a77966dbc84898e48425b06015416c48eeef/server_addon#how-to-start

./.poetry/bin/poetry run python ./server_addon/create_ayon_addons.py

Admin

Cleanup / pruning / clearing docker caches

Generally its along the lines of docker buildx prune. Where buildx is the container, image, etc. Just be sure not to blow your volumes away!

Run docker system prune -a' on development machine as part of digital hygiene procedure. It tells you what it is going to delete (unused things). Make sure to keep stuff you want to keep running.

Dump entire database

docker compose exec -T postgres psql -U ayon ayon < yourbackupfile.sql

Backing up + restoring

Source: https://discord.com/channels/517362899170230292/611571347058982927/1187432211067183174

  • run docker compose exec postgres pg_dump -U ayon > backup.sql to create database dump
  • copy storage/ docker-compose.yml and backup.sql to the new machine
  • run docker compose up postgres on the new machine to start only the database (if you run the entire stack, it will be populated with defaults, we want to keep it empty for now)
  • run docker compose exec -T postgres psql -U ayon ayon < backup.sql to restore the backup
  • start everything using docker compose up

By the way, this method also allows upgrading the database server. If you dump the db storage and restore it on the target machine, you need to use the same postgres version, while using pg_dump converts everything in the database to a huge list of sql queries, which you can run on a newer postgres database.

@BigRoy
Copy link
Author

BigRoy commented Dec 21, 2023

@BigRoy
Copy link
Author

BigRoy commented Jan 18, 2024

@BigRoy
Copy link
Author

BigRoy commented Jan 26, 2024

Updating AYON docker + picking the right tag (e.g. dev versus latest)

More details:

To update to a certain tag:

  • set the docker docker-compose.yml to ynput/ayon:dev instead of ynput/ayon:latest
  • docker pull ynput/ayon:dev - the available tags are here: https://hub.docker.com/r/ynput/ayon/tags
  • docker compose up -d --build

Note that it's "not safe" to downgrade the server and thus usually going from dev to latest is not recommended because it may break things because the server can perform database "upgrades" going forward but cannot "downgrade" safely.

@BigRoy
Copy link
Author

BigRoy commented Jan 29, 2024

@BigRoy
Copy link
Author

BigRoy commented Feb 12, 2024

Code snippet to generate an AYON API Key token for a normal user:

import ayon_api
connection = ayon_api.ServerAPI('<your_ayon_url>')
connection.login('<your_username>','<your_password>')
print(connection.access_token)

Source

@BigRoy
Copy link
Author

BigRoy commented Apr 3, 2024

Is there any way through the ayon API to copy settings between bundles? I want to automate uploading new addons, creating a new bundle using the new uploaded addons, copy settings from last production bundle, set the new bundle as production.
I sometimes release updates multiple times a day 😅 and it's a bit cumbersome with all the steps involved.

assuming you are updating addon foo from version 1.0.0 to 1.0.1:

  • [GET] /api/addons/foo/1.0.0/settings?as=1.0.1 - loads settings of 1.0.0, but interpret them using settings model of 1.0.1 (do the best match and conversions if there are any). that returns a json
  • which you then post here [POST] /api/addons/foo/1.0.1/settings.

Both endpoints also accept variant query argument (which defaults to production).

For project settings, it's the same thing, just use /api/addons/{addon_name}/{addon_version}/settings/{project_name}

Source on discord

@BigRoy
Copy link
Author

BigRoy commented Apr 4, 2024

The launcher logic caches where the current machine can find executables - and it will take from that cache if a matching version is found within it. This may be a local build which is not a deployed install - even when not running in dev mode.

This is the logic of ayon launcher:

  • look what bundle should be used
  • look which version of ayon-launcher should be used
  • find in cached paths of ayon-launcher if the version is there
    • it is? just use it
    • it is not? try to download it, install, and use it

source on discord

So it may be that you're seeing an executable path listing a build instead of an installed path:

ayon_info

When finding it in the cache there should be a 'validation' occurring by means of checking the version.py file whether the version listed in the cache actually matches the current version at that path.


On Windows that local 'cache' is stored here: %LOCALAPPDATA%\Ynput\AYON\executables.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment