mix tayori.ingest (Tayori v0.1.0)

Copy Markdown View Source

Adds changes to Tayori's inbox (Tayori.Inbox), in two ways.

In the app, with its database: it starts the app and reads every source of the :inbox config, as Tayori.Inbox.ingest/0 does.

$ mix tayori.ingest

From CI, to an app that runs elsewhere: it reads a changelog and a folder of fragments here, and sends their changes to the app's POST /changes (Tayori.Ingest). It does not start the app, and needs no database.

$ mix tayori.ingest --url https://myapp.com/api/machines/news \
    --token "$TAYORI_INGEST_TOKEN" \
    --changelog CHANGELOG.md --fragments priv/news

Options of the second way:

  • --url - the address of the JSON API mounted for machines.
  • --token - the ingest token (else the TAYORI_INGEST_TOKEN environment variable).
  • --changelog - a Keep a Changelog file (Tayori.Sources.Changelog).
  • --fragments - a folder of fragments (Tayori.Sources.Fragments); --recursive reads the folders inside it too.
  • --source - the source of every change sent ("changelog" and "fragments", as the sources of the config name theirs).

It sends 500 changes a request at most, and needs the :req dependency. It prints how many were new, and fails when a request fails or a change is invalid.

In a release, with no Mix, the first way is to ask the running app: bin/my_app rpc "IO.inspect(Tayori.Inbox.ingest())". Not eval, whose node does not start the app.