local-kubernetes
or kubernetes
provider is used, container
modules can be configured to hot-reload their running services when the module's sources change (i.e. without redeploying). In essence, hot-reloading syncs files into the appropriate running containers (local or remote) when code is changed by the user, and optionally runs a post-sync command inside the container.--hot
option via garden deploy
or garden dev
commands (e.g. garden dev --hot=foo-service,bar-service
). If these services don't belong to a module defining a hotReload
configuration (see below for an example), an error will be thrown if their names are passed to the --hot
option.*
(e.g. --hot=*
/--hot-reload=*
) to deploy all compatible services with hot reloading enabled (i.e. all services belonging to a module that defines a hotReload
configuration).garden deploy
(without the watch flag) results in the service being redeployed in standard configuration.hotReload
field specifies the destination path inside the running container that the module's (top-level) directory (where its garden.yml
resides) is synced to..gitignore
.source
is specified along with target
, that subpath in the module's directory is synced to the target instead of the default of syncing the module's top-level directory.source
/target
pairs, but note that the source
paths must be disjoint, i.e. a source
path may not be a subdirectory of another source
path within the same module. Here's an example:hotReloadArgs
specifies the arguments to use to run the container (when deployed with hot reloading enabled). If no hotReloadArgs
are specified, args
is also used to run the container when the service is deployed with hot reloading enabledpostSyncCommand
postSyncCommand
can also be added to a module's hot reload configuration. This command is executed inside the running container during each hot reload, after syncing is completed (as the name suggests).hot-reload-post-sync-command
example project. Here, a postSyncCommand
is used to touch
a file, updating its modification time. This way, nodemon
only has to watch one file to keep the running application up to date. See the hot-reload-post-sync-command
example for more details and a fuller discussion.