Commit Graph

142 Commits

Author SHA1 Message Date
759a94e49b Blender finder: also handle exec.ErrNotFound as "expected"
Blender not being found can be reported via various errors (this should be
reworked in the 'blender finder API' at some point). `exec.ErrNotFound` is
returned when Blender cannot be found on `$PATH`, which is something that's
absolutely fine. This is now logged less dramatically.
2022-09-22 12:39:40 +02:00
161a7f7cb3 Less dramatic logging when Blender cannot be found
Avoid the word "error" in logging when Blender cannot be found. Typically
these are warnings, and having the word "error" there makes people think
otherwise.
2022-09-22 12:37:46 +02:00
7d2970bbe3 update-version: always quote the version number in YAML
Without quotes, YAML would see `3.0-beta1` as string, but `3.0` as float.
2022-09-12 15:55:21 +02:00
6e401f882f Worker: fix typo 'FFmepg' -> 'FFmpeg'
Just a logging message fix, no functional changes.
2022-08-31 15:34:42 +02:00
e394e75f64 update-version: also update latest version on project website
`make update-version` now also updates
`web/project-website/data/flamenco.yaml` so that the new version is
listed as the latest one on flamenco.blender.org.

Note that such a change will only be visible online after publishing the
site with `make project-website`. Be sure to only do this after the
build has been uploaded there, to avoid dead links.
2022-08-31 15:14:46 +02:00
1355ec5e1d Worker: Change how the worker shuts down
Instead of sending the current process an interrupt signal, use a dedicated
channel to signal the wish to shut down. The main function responds to that
channel closing by performing the shutdown.

This solves an issue where the Worker would not cleanly shut down on
Windows when `offline` state was requested by the Manager.
2022-08-12 11:15:19 -07:00
7d3d3d1d60 Fix T100183: Setup assist: don't quit when browser can't be launched
When launching Flamenco from a server system with no way to open a web
browser, just ask the user to launch one. Quitting the Manager because
of this was a bit too dramatic.
2022-08-04 11:21:43 +02:00
f97bfac8c5 Refactor Manager, move webservice code from main.go into its own file
Extract some code from `cmd/flamenco-manager/main.go` into `webservice.go`
in the same directory, just to make `main.go` a little smaller.

No functional changes.
2022-08-04 10:40:56 +02:00
f81f5587f2 Version updater: don't log git commands
Don't log the git commands in the version updater Go code. They are already
shown by the Makefile (`update-version` target), and we should only have
one set of those commands to maintain.
2022-08-03 12:42:45 +02:00
4947712bec Worker: also log found Blender at startup
Similar to the logging of the found FFmpeg, log the version of Blender at
Worker startup.
2022-07-29 09:48:56 +02:00
377583c9e2 Cleanup: worker, move FFmpeg-finding at startup into its own file
Just a move of code from `main.go` to a dedicated file in the same package.

No functional changes
2022-07-29 09:47:30 +02:00
d4dfa2d071 Add release cycle to versioning of Flamenco
Include `RELEASE_CYCLE` in the Makefile. This is mentioned at startup of
Manager and Worker, and reflects in the software version they report.

If `RELEASE_CYCLE == "release"`, Manager and Worker report their version
as `ApplicationVersion`. If it's any other string, the Git hash will get
appended.
2022-07-28 15:10:27 +02:00
c79fe55068 Worker: Refactor the running of subprocesses
Blender and FFmpeg were run in the same way, using copy-pasted code. This
is now abstracted away into the CLI runner, which in turn is moved into
its own subpackage.

No functional changes.
2022-07-28 14:34:33 +02:00
Francesco Siddi
9948fdab71 Rename First Time Wizard to Setup Assistant
This commit does not introduce functional changes, besides renaming
every mention of 'wizard' with 'setup assistant'. In order to run the
manager setup assistant use:

./flamenco-manager -setup-assistant

The change was introduced to favor more neutral and descriptive working
for this functionality. Thanks to Sybren for helping to get this done!
2022-07-25 17:17:04 +02:00
3206842fe8 Manager: log "own URLs" last, to make them more visible
Logging the URLs at which the Manager can be reached as the last thing
when starting up, in the hope that this makes them more noticable and
inviting to actually visit.
2022-07-25 17:10:41 +02:00
c1a728dc2f Version updates via Makefile
Flamenco now no longer uses the Git tags + hash for the application
version, but an explicit `VERSION` variable in the `Makefile`.

After changing the `VERSION` variable in the `Makefile`, run
`make update-version`.

Not every part of Flamenco looks at this variable, though. Most
importantly: the Blender add-on needs special handling, because that
doesn't just take a version string but a tuple of integers. Running
`make update-version` updates the add-on's `bl_info` dict with the new
version. If the version has any `-blabla` suffix (like `3.0-beta0`) it
will also set the `warning` field to explain that it's not a stable
release.
2022-07-25 16:08:07 +02:00
ab8ecc24cc Cleanup: Add missing license specifiers
Add license specifiers to Go files that were missing them:

```
// SPDX-License-Identifier: GPL-3.0-or-later
```

No functional changes.
2022-07-25 16:08:07 +02:00
09946c0894 Worker: use bundled FFmpeg if available
Worker will now try one of the following paths, relative to the flamenco-worker
executable, in order to find FFmpeg. If they cannot be found, `$PATH` is
searched for FFmpeg.

- `tools/ffmpeg-$GOOS-$GOARCH`
- `tools/ffmpeg-$GOOS`
- `tools/ffmpeg`

On Windows these paths will have a `.exe` suffix appended. `$GOOS` is the
operating system, like "linux", "darwin", "windows", etc. `$GOARCH` is the
architecture, like "amd64", "386", etc.
2022-07-22 16:37:14 +02:00
a6e3442aa0 Revert "Manager: add source location when logging in debug/trace mode"
This reverts commit eb65ac9085ca0e86e6dd8a436fb06e766af04d60. It caused
too much logging noise.
2022-07-21 14:16:33 +02:00
2f76df437b T99415: Worker: change default location for writing local files
Change the location where the Worker writes its local files so that it
follows the XDG specification (instead of writing to the current working
directory).

- Linux:   `$HOME/.local/share/flamenco`
- Windows: `C:\Users\UserName\AppData\Local\Flamenco`
- macOS:   `$HOME/Library/Application Support/Flamenco`

NOTE: The old files will not be loaded any more. This means that if
nothing is done and the new worker is run as-is, it will reregister as a
brand new worker. Move `flamenco-worker-credentials.yaml` and
`flamenco-worker.sqlite` to the new location to avoid this.
2022-07-19 12:08:41 +02:00
eb65ac9085 Manager: add source location when logging in debug/trace mode
Just a little debugging tool.
2022-07-18 19:05:19 +02:00
47e517a3a5 Worker: cleanly sign off after flushing buffer
When running the Worker with the `-flush` CLI argument, actually sign off
from the Manager before shutting down.
2022-07-18 16:36:45 +02:00
778ad6927b Manager: nicer logging of its own URLs
Log the URLs in an easier to read and also easier-to-copy-paste format.
2022-07-18 15:37:07 +02:00
bf5bf86f03 Manager: log own URLs at startup
Log the URLs at which the Manager thinks it should be reachable, at
startup.
2022-07-18 14:45:49 +02:00
d7b164133a Sleep Scheduler implementation for the Manager
The Manager now has a sleep scheduler for Workers. The API and background
service work, but there is no web interface yet.

Manifest Task: T99397
2022-07-17 17:27:32 +02:00
7d049d3cda Manager: make artificial API delay actually optional
For development of the web interface, to get a less predictable order of
asynchronous requests, the API responses were artificially delayed. This
was supposed to be optional, to be enabled via the `-delay` CLI argument,
but somehow the optionalness either never made it in or was mysteriously
removed.
2022-07-16 13:24:59 +02:00
b511fad968 Manager: add profiler support
Add a `-pprof` CLI option to enable the profiler. It will expose profiler
info on the web interface at `/debug/pprof/`.

To have a nice view of this, including flame graphs, run:

```
go tool pprof -http localhost:8082 http://localhost:8080/debug/pprof/profile
```
2022-07-15 15:08:00 +02:00
809036898b Stresser: cleanly sign off when shutting down 2022-07-15 15:08:00 +02:00
35fe0146d3 Add stress tester for task updates
Build with `make stresser`. Run with:

  ./stresser -worker UUID -secret ABCXYZ

The worker ID and secret can be obtained from
`flamenco-worker-credentials.yaml`. If left empty, the stresser will
register as a new worker, and log the credentials to be used on the next
invocation.
2022-07-15 15:08:00 +02:00
38b8220476 Restart Flamenco Manager when the first-time wizard is complete 2022-07-14 17:52:38 +02:00
aa9837b5f0 First incarnation of the first-time wizard
This adds a `-wizard` CLI option to the Manager, which opens a webbrowser
and shows the First-Time Wizard to aid in configuration of Flamenco.

This is work in progress. The wizard is just one page, and doesn't save
anything yet to the configuration.
2022-07-14 11:17:03 +02:00
c87358b89b Manager: improve error message when unable to create UPnP/SSDP server
Rather than just print the error message ("error creating UPnP/SSDP
server"), it now explains what the effect is of this error (workers
unable to automatically find this Manager) and how to solve it (pass
`-manager URL` to the Worker).
2022-07-07 11:57:27 +02:00
d4429d593c Unify task log storage & manager-local storage
The task logs storage system is refactored to use the `local_storage`
package. Configuration options have also changed:

- `task_logs_path` is renamed to `local_manager_storage_path`, to
  emphasise that only the Manager deals with those files, with default
  value `./flamenco-manager-storage`.
- `storage_path` is renamed to `shared_storage_path`, to emphasise this
  is the storage shared between Manager and Workers, with default value
  `./flamenco-shared-storage`.

Task logs are still stored in
`${local_manager_storage_path}/job-{jobUUID[0:4]}/{jobUUID}/task-{taskUUID}.txt`

Manifest task: T99409
2022-07-05 17:58:58 +02:00
feaf9545a6 Revert "Move the webapp from /app/… to /app/v3/…"
This reverts commit fcb261f5d336c4362339e6da5b35a340ec5aa6e1. The
`/app/v3` URL didn't look nice enough.
2022-07-05 11:51:05 +02:00
fcb261f5d3 Move the webapp from /app/… to /app/v3/…
This will help in the future to host multiple (major) versions of Flamenco
on the same system, redirecting based on their URL prefix.
2022-07-04 12:22:41 +02:00
7d64d1bca4 Move SwaggerUI to /api/v3/swagger-ui
Include the `v3` path component in the Swagger UI URL.
2022-07-04 12:21:18 +02:00
6efd67b05c Manager: implement FetchJobLastRenderedInfo() API operation
Allow querying for the URL & available versions of a job's last-rendered
image.
2022-06-28 17:08:00 +02:00
c613c1993a Manager: serve favicons at root web URL 2022-06-28 12:46:51 +02:00
26867c4b96 Addon packer: make sure the top level of the ZIP is the module
When installing, Blender will just unzip directly into the addons dir,
so the ZIP has to contain the `flamenco` package directory.

This also makes things simpler, naming-wise. We can offer the addon from
the Manager web interface as `flamenco3-addon.zip`, and still have it
install into the `addons/flamenco` directory.
2022-06-28 12:44:05 +02:00
c3345131c7 Rename flamenco-addon.zip to flamenco3-addon.zip
Just to be explicit this is for the new Flamenco version.
2022-06-28 12:17:57 +02:00
d60eab20bb Worker: allow setting the Manager URL from the commandline
This makes it possible to start Flamenco Worker at Blender Studio with
a worker-local current working directory, with the executable in a shared
filesystem.
2022-06-28 11:43:40 +02:00
fb89658530 Refactor: replace os.IsNotExist() with errors.Is(err, fs.ErrNotExist()
`os.IsNotExist()` is from before `errors.Is()` existed. The latter is the
recommended approach, as it also recognised wrapped errors.

No functional changes, except for recognising more cases of "does not
exist" errors as such.
2022-06-28 10:24:46 +02:00
def56b5d22 Serve the add-on via the web interface
Serve the Blender add-on via the web interface, downloadable from
`/flamenco-addon.zip`.
2022-06-27 16:12:50 +02:00
1b40038e3d Add Go program that can create the addon ZIP file
Use Go to create the addon ZIP file, to be independent of any ZIP
executable being installed on the system.
2022-06-27 15:58:14 +02:00
7b028df8ac Manager: serve static files of the webapp at /app/
Vue Router generates URLs for which there are no static files on the
filesystem (like `/jobs/{job ID}`). To make this work, the webapp's
`index.html` has to be served for such requests. The client-side JavaScript
then figures out how things fit together, and can even render a nice 404
page if necessary.

This shouldn't happen for non-webapp URLs, though. Because of this, the
entire webapp (including the "serve `index.html` if file not found logic)
is moved to a `/app/` base URL.

`make flamenco-manager` now also builds the webapp and embeds the static
files into the binary.

`make flamenco-manager_race` does NOT rebuild the static web files, to
help speed up of debug cycles. Run `make webapp-static` to rebuild the
webapp itself, if necessary, or run a separate web development server with
`yarn --cwd web/app run dev --host`.
2022-06-27 14:53:42 +02:00
e687c95e5d Manager: add "last rendered image" processing pipeline
Add a handler for the OpenAPI `taskOutputProduced` operation, and an
image thumbnailing goroutine.

The queue of images to process + the function to handle queued images
is managed by `last_rendered.LastRenderedProcessor`. This queue currently
simply allows 3 requests; this should be improved such that it keeps
track of the job IDs as well, as with the current approach a spammy job
can starve the updates from a more calm job.
2022-06-24 16:51:11 +02:00
a43826ce0c Manager: register OpenAPI body decoders for image mime types
The OpenAPI library we use for request validation needs to know per mime
type how to handle the contents. The same function for
`application/octet-stream` is now used for `image/png` and `image/jpeg`
as well.
2022-06-24 16:40:48 +02:00
32e737466b Manager: clarify log message
Change "accepted CORS origins" to "acceptable CORS origins", as the former
is too ambiguous (it can mean "I just accepted these" or "These are the
acceptable ones").
2022-06-20 14:32:25 +02:00
9ddf72fa37 Worker: sign off as last step of shutdown
Within the shutdown procedure, signing off is now the last thing the
worker does. This makes things more consistent from the Manager's point
of view (like receiving last-second log entries while the Worker is still
online).
2022-06-16 12:19:03 +02:00
b922722614 Manager: broadcast worker timeouts over SocketIO
This way the web interface will also show timed-out workers.
2022-06-13 13:05:20 +02:00