28 Commits
Author SHA1 Message Date
Fedor Korotkov 88506b1adb Remove license tier validation (#428) 2026-04-12 15:27:27 -04:00
Fedor KorotkovandCodex be869f10d4 Refactor listing VMs (#399)
* Removed unnesesary ListOptions

* Refactor genericList to accept string prefixes instead of byte slices

* Optimize VM listing logic with singleflight to deduplicate concurrent request

* Refactor VM listing logic: rename variables for clarity and update error messages

* fix: address PR review feedback

- use singleflight DoChan with context cancellation for list VMs

🤖 Generated with [Codex](https://chatgpt.com/codex)

Co-Authored-By: Codex <codex@openai.com>

---------

Co-authored-by: Codex <codex@openai.com>
2026-02-05 18:51:45 +01:00
6fe523ef69 Add pagination support for listing VM events (#386)
* Add pagination support for listing VM events

Introduced a paginated event listing API, added support for pagination parameters in the request, and included cursor-based navigation using headers. Relevant tests and Badger store implementations were updated to support the new logic.

* Remove support for ordering VM events

Dropped `ListOrder` type, `order` query parameter, and related logic for ordering VM events. Updated tests, API schema, and Badger store to reflect the removal.

* Remove invalid VM events ordering test

Deleted a test case for invalid VM events ordering since the `order` query parameter and related functionality have been removed.

* Add support for ordering VM events

Implemented `order` query parameter for specifying sort order (ascending/descending) of VM events. Updated API schema, Badger store, and added related tests.

* Add support for limiting and ordering VM logs

Introduced `--limit` and `--order` flags for controlling the number of log lines and their sort order (ascending/descending). Updated API client to handle new options.

* Update internal/controller/store/badger/badger_events.go

Co-authored-by: Nikolay Edigaryev <edigaryev@gmail.com>

* fix: address PR review feedback

- switch logs CLI to --tail with desc ordering
- reuse ParseLogsOrder in controller with helpful errors
- always use ListEventsPage and scope event cursors
- move events pagination coverage to integration test

🤖 Generated with [Codex](https://chatgpt.com/codex)

Co-Authored-By: Codex <codex@openai.com>

* refactor: simplify prefix trimming and improve error formatting

- Replaced manual prefix check with `bytes.TrimPrefix` in Badger store.
- Enhanced error message formatting in VM logs controller.

* fix: address PR review feedback

- use suggested reverse seek in badger events pagination
- add events pagination client helper and use it in integration test

🤖 Generated with [Codex](https://chatgpt.com/codex)

Co-Authored-By: Codex <codex@openai.com>

---------

Co-authored-by: Nikolay Edigaryev <edigaryev@gmail.com>
Co-authored-by: Codex <codex@openai.com>
2026-01-22 09:22:53 -05:00
Fedor Korotkov 173a34b083 Some extra documentation for LLMs (#377) 2025-12-03 20:45:58 +01:00
Fedor Korotkov 86f0afb5a3 Small timout for worker notification (#242)
* Small timout for worker notification

It seems at the moment if a worker re-establishes notify stream (for example, if network flips or proxy breaks the connection) then we can see "no worker registered with this name" errors.

This change makes Notifier to wait for 30 seconds before failing, at the time of calling `Notifier#Notify` we know such worker exists.

PS not sure if we need to make the timeout configurable.

* Wait via context

* Make sure all `context`s for `Notify` is time bounded

* Lint issues
2025-02-06 17:30:09 +00:00
Fedor Korotkov e40ce6d999 Build Windows binaries (#215)
* Build client for Windows

* Dry Run
2024-11-01 14:33:34 -04:00
Fedor Korotkov b6fe371416 allow to set up worker name (#210) 2024-10-11 07:44:01 -04:00
Fedor Korotkov 1f5bb26d20 Notarize macOS Binaries (#184) 2024-06-19 20:41:11 +04:00
Fedor Korotkov dc3eeef5b1 Support URLs in hostDir policies (#146)
* Support URLs in hostDir policies

We can't just blindly allow remote URLs since they might contain symlinks leading to outside the archive. Instead, let's support specifying URLs where the remote archive can come from.

Fixes #145

* Ignore Lint issue

* Reverted old validation logic
2023-10-24 21:01:34 +04:00
Fedor Korotkov f6b48b7c42 Change event prefix to preserve order under load (#89)
* Change event prefix to preserve order under load

When there are a lot of events streamed from a worker, it's possible to have two batches coming for the same timestamp (which is a timestamp of the event on the worker). This way the existing logic would mess up the order because `index` and the random number doesn't guarantee the order.

To fix this I've changed the format of the prefix for the event to include tro things:

1. Timestamp in nanoseconds of the injection time on the controller so two sequential batches will have guaranteed order unless they are processed within a nanosecond.
2. Made the `index` being fixed length with trailing zeros, so they are properly lexicographically sorted (`000001`, `000002`, ...).

* No need to disable linting
2023-06-05 17:01:12 +00:00
Fedor Korotkov 010df300a3 Add basic Prometheus metrics (#82)
Fixes #71
2023-04-21 10:05:01 +04:00
Fedor Korotkov dd5e588eb0 Support Bridged Network (#78)
* Support Bridged Network

Inspired by https://github.com/cirruslabs/tart/issues/473

* Fixed tests
2023-04-20 15:04:07 +04:00
Fedor Korotkov a8771a046e Orchard Social Card (#79) 2023-04-20 02:05:48 +04:00
Fedor Korotkov ea1e5c8578 Documented how to access VMs (#69) 2023-03-29 16:09:57 +04:00
Fedor Korotkov f152043f19 Reactive Scheduling (#67)
Before we had two main loops: controller loop to assign VMs and worker loop to start VMs. Each of the loops was performed upon an interval every N seconds.

This change introduces a mechanism for reactively requesting loop execution:

 1. Controller loop will be executed upon VM creation to try to immediately schedule.
 2. A worker will be notified upon a VM assigment and worker loop will be requested to sync immediately.

 Fixes #31
2023-03-28 20:51:41 +04:00
Fedor Korotkov 5eaf6b24d4 Make port-forward endpoint to wait for the VM (#65)
* Make port-forward endpoint to wait for the VM

Fixes #62

* Fixes after rebase
2023-03-27 23:52:21 +04:00
Fedor Korotkov f42026824c Configure workers to log to a file (#59)
* Configure workers to log to a file

As a best practice. Inspired by https://github.com/uber-go/zap/blob/845ca51d5b8d9fed9fe14f35ab13b6b160d5762d/FAQ.md#does-zap-support-log-rotation

* Removed redundant error check

* Make log file optional
2023-03-24 18:03:27 +00:00
Fedor Korotkov 63ba8b5532 Separate context for orchard dev (#56)
Fixes #51
2023-03-24 13:10:35 -04:00
Fedor Korotkov b1813a2a92 Deployment guide to GCP (#44)
* Deployment guide to GCP

* Update DeploymentGuide.md

* Refer to Ansible Playbook

* read permissions as well
2023-03-24 09:49:06 -04:00
Fedor KorotkovandNikolay Edigaryev 362ea85b4f Always require a client for running a worker (#52)
* Always require a client for running a worker

* Actually validate roles

* Delete worker

Fixes #46

* Update internal/worker/worker.go

Co-authored-by: Nikolay Edigaryev <edigaryev@gmail.com>

---------

Co-authored-by: Nikolay Edigaryev <edigaryev@gmail.com>
2023-03-24 17:44:20 +04:00
Fedor Korotkov cdf5c5eb00 Simplified bootstrapping of a cluster (#40)
* Simplified bootstrapping of a cluster

Introduced a new convention about a pre-defined `bootstrap-admin` account for `orchard controller run`. Providing `ORCHARD_BOOTSTRAP_ADMIN_TOKEN` will auto-create such user for easier configuration. `bootstrap-admin` can be used for creating other service accounts on the first run and after that can be disposed.

Also change `orchard worker run` to expect controller URL as the only parameter and a bootstrap token passed via an argument instead of using a context that might not be created.

* Missing error check
2023-03-22 23:43:37 +04:00
Fedor Korotkov 9b5ad09841 Consolidate controller bootstrap login in run command (#38) 2023-03-21 15:36:55 -04:00
Fedor Korotkov bdc781214c Prepare for release (#37)
* Prepare for release

Added LICENSE, set version and configured GoReleaser/Docker

* Updated LICENSE
2023-03-20 15:28:24 -04:00
Fedor Korotkov fb3056d3ae Refactorings for simplify readability (#35) 2023-03-17 06:11:28 -04:00
Fedor Korotkov 3ecf98c039 Support startup/shutdown scripts (#33)
* Support `startup`/`shutdown` scripts

Fixes #26

* Fixed Go modules after rebase

* Fixes after rebase
2023-03-14 22:15:54 +04:00
Fedor KorotkovandNikolay Edigaryev 0582108ea6 Events Entity (#28)
* Generic Events

We can try to use these generic events for script execution and storing of the output logs in events with `log` kind.

* Lint issues

* Cleanup events upon VM deletion

* Basic integration test

* Run an actual VM in tests

* Apply suggestions from code review

Co-authored-by: Nikolay Edigaryev <edigaryev@gmail.com>

* Use POST

* Make newEventKey private

* Append events in batches

* Lint issues

* Private `scopePrefix`

---------

Co-authored-by: Nikolay Edigaryev <edigaryev@gmail.com>
2023-03-13 08:04:17 -04:00
Fedor Korotkov 165662bb0a Better state syncing and other improvements (#24) 2023-03-01 11:42:16 -05:00
Fedor Korotkov edb9b3d693 Refactored working with a storage (#20) 2023-02-08 19:36:30 -05:00