-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved deno run --watch
support, watch support inside Docker
#79
Conversation
Things to test:
It would be good if we can introduce some automated / e2e CI testing for these categories at some point - extending the current tests beyond inference. But we can just manually test for this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work and great cleanup with the validate phase.
I'd say the only change I'd like is to split the entrypoint script, since we're adding more logic into here with watch.
Also have a few comments and questions inline.
@@ -123,7 +123,6 @@ Limitations: | |||
* All numbers are exported as `Float`s | |||
* Unrecognised types will become opaque scalars, for example: union types. | |||
* Optional object fields are not currently supported | |||
* Complex input types are supported by the connector, but are not supported in "commands" in Hasura3 projects |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
* (Optionally) If you want your development vendor and inference resources to be used to speed up deployment, add the following to your `./config.json`: | ||
```json | ||
{ | ||
"functions": "./functions/index.ts", | ||
"vendor": "./functions/vendor", | ||
"preVendor": true, | ||
"schemaLocation": "./functions/schema.json", | ||
"schemaMode": "INFER" | ||
} | ||
``` | ||
* Make sure to .gitignore your computed `vendor` and `schema.json` files. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
functions (string): Location of your functions entrypoint (default: ./functions/index.ts) | ||
functions (string): Location of your functions entrypoint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why no documented default for functions, but present for preVendor, schemaMode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't default functions
any more, you must specify it as something yourself, so there is no default. You will get an error if you leave it out or put in a blank string. In all the places where we control the locations of the functions (ie. in docker) we specify it. We specify it in all the documentation. We also generate a value in a blank configuration object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason for this? I thought it was an advantage minimise boilerplate in the config.
const defaults = { | ||
preVendor: true, | ||
validate_raw_configuration(configuration: RawConfiguration): Promise<Configuration> { | ||
if (configuration.functions.trim() === "") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like an odd check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't leave out functions any more. You must specify it.
|
||
# Pre-cache inference results and dependencies | ||
RUN EARLY_ENTRYPOINT_EXIT=true sh /app/entrypoint.sh | ||
RUN PRECACHE_ONLY=true /app/entrypoint.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably just split the initial actions into a seperate script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What, and call it from this script? It still needs to happen on container start for those volume-mounting their functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Call the build actions from the dockerfile directly or via a build script, then remove them from the entrypoint script
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right... yeah this would work on connector create, but not for people doing local docker... bummer
Changes to be included in the next upcoming releaase. | ||
Changes to be included in the next upcoming release. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doy.
Should probably have a better error if the config is missing the functions:
|
Weird. I thought the SDK would prevent it from getting that far in the code :/ The types are a lie. |
Fatal errors seem to kill the watch command in some instances:
|
There's not much point having the two versions:
after making programInfo just propagate exceptions rather than exit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's goooo!
Follow up items:
- test direct invocation off deno.com
- non-null coalescense
- test Docker image from registry
- test with new CLI tools
- Tag new release
- Add changelog entry for new tag
- Notify channels of new release
Description
This PR improves support for running the connector using
deno run --watch
where the connector gets restarted by Deno whenever the function files change. It adds support for running the connector in watch mode using Docker.Part of the improvements to make watch mode work better include
Various version updates have also been made:
Solution Design
We now have a difference between
RawConfiguration
andConfiguration
. We perform our inference only invalidate_raw_configuration
and capture the results in theConfiguration
. This then powers every usage of the inference, including the schema endpoint and actual queries. It also provides a central place for configuration defaulting (such as defaulting to "INFER").The entrypoint script now looks for a
WATCH
env var and if it is"1"
or"true"
it generates a different configuration that enables INFER mode and turns on deno's--watch
flag.Fixes: #26