Skip to content
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

add docs about dev mode field in manifest #447

Closed
wants to merge 5 commits into from
Closed
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions src/content/reference/manifest.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,41 @@ metadata:
custom.label/dev: "true"
```

#### mode (string, optional)

Defines how `okteto up` will setup the development container and behave within the cluster.

Currently two options are available:
- `sync`: (default) Sync & run your code in a remote development container.
- `hybrid`: Run your code on your local computer instead of in a remote development container, while rest of your service components runs in your remote cluster.
viddo marked this conversation as resolved.
Show resolved Hide resolved

Most use-cases should use default `sync` mode, but `hybrid` may be desired to achieve a faster development experience in some scenarios:
viddo marked this conversation as resolved.
Show resolved Hide resolved

| | `sync` | `hybrid` |
|---|---|---|
| Soure code | Uses Syncthing to sync files bidirectionally with your remote development container | Uses local source code directly, no files syncing needed |
viddo marked this conversation as resolved.
Show resolved Hide resolved
| `command` context | Runs in the _remote development container_ | Runs on your _local machine_, so traffic need to be rerouted from/to cluster, e.g. using `reverse` option |

##### `hybrid` motivation and example
viddo marked this conversation as resolved.
Show resolved Hide resolved

viddo marked this conversation as resolved.
Show resolved Hide resolved
A typical use-case and motivation for using `hybrid` is when developing a service that require "very fast" file-change-to-reload times. Frontend development tooling (e.g. Webpack) is a common example. Since hybrid mode avoids having to sync file changes to remote development container and wait for the container to detect file changes to trigger a rebuild, it's typically order-of-magnitude faster than `sync` mode.
viddo marked this conversation as resolved.
Show resolved Hide resolved
viddo marked this conversation as resolved.
Show resolved Hide resolved

On the other hand, with the service running locally breaks replicability between OS, and may add latency when accessing the rest of the services in the cluster. But it's usually an OK tradeoff for development purposes.
viddo marked this conversation as resolved.
Show resolved Hide resolved

If you want to use the hybrid mode, you only need to configure the necessary ports to expose the service running on your local machine to the development container in remote so that the rest of the components running on the cluster can communicate with the development container as if it were the one running the application remotely. To do that, you can make use of the [reverse](reference/manifest.mdx#reverse) field, which will expose the indicated port of your local machine to the desired port on the development container.
viddo marked this conversation as resolved.
Show resolved Hide resolved

```yaml
dev:
frontend:
mode: hybrid
reverse:
- 3000:8080
workdir: ./frontend
command: ["npx webpack watch --mode development"]
```

in the example shown we have indicated that we develop the `frontend` service locally using the `mode: hybrid` field. The service running locally will execute the command defined in the `command` field in the directory indicated in `workdir`. In addition, the application will expose on port `3000` of the development container what it exposes on port `8080` of the local machine, making it possible for other components running on the cluster to access the service as if it were running remotely.

#### nodeSelector (map[string]string, optional)

List of labels that the node must have to include the development container on it.
Expand Down