Sync files from local

One of the two ways Remote Development can be done in Bunnyshell is by synchronizing your local project files into the container. This is the default way of running Remote Development in Bunnyshell.


Pre-requisites

You will need to know the Remote Path for the component you wish to start a remote development session for. This is the path from the container running in Kubernetes. The folder contents will be replaced with the contents from your local folder, when starting the remote development session. usually, this is the WORKDIR from your Dockerfile.


Run the Remote Development command

  1. Once you know the Component ID, you need to run the command.
$ bns remote-development up --component bLzVRA1z61

The following steps also apply in case the wizard was used to target the component.

  1. If the Pod contains multiple containers, you will be asked to pick the container you want to develop remotely on.
$ bns remote-development up --component bLzVRA1z61
? Select container  [Use arrows to move, type to filter]
> api
  nginx-api

  1. Then, you will be asked for the local path you want to sync - it defaults to the current working directory.
$ bns remote-development up --component bLzVRA1z61
? Select container api
? Local Path [tab for suggestions] (/Users/myuser)

You can also pass the local path using the command parameter --local-sync-path or -l.


  1. Afterwards, you must select the remote path, in which your local files will be sync'ed.
$ bns remote-development up --component bLzVRA1z61
? Select container api
? Local Path /Users/myuser/playground/env-yaml-examples/apps/nodejs
? Remote Path

You can also pass the remote path using the command parameter --remote-sync-path or -r.


  1. You need to wait for the Pod definition to be changed.
$ bns remote-development up --component bLzVRA1z61
? Select container api
? Local Path /Users/myuser/playground/env-yaml-examples/apps/nodejs
? Remote Path /usr/src/app/backend
∙●∙ Waiting for pod to be ready

You can adjust the timeout for this operation by passing in the `--wait-timeout parameter.


  1. If all goes well, the SSH connection with the Pod is established and you will have access to a shell inside the container:
$ bns remote-development up --component bLzVRA1z61
? Select container api
? Local Path /Users/myuser/playground/env-yaml-examples/apps/nodejs
? Remote Path /usr/src/app/backend
∙●∙ Waiting for pod to be ready
root@api-1234a5bc6-d7ef8:/usr/src/app/backend#

👍

Using the shell inside the container you can run the same commands you use on local to build/watch your application.


Control the sync mode

You can choose to run the synchronization mode for Mutagen by using the --sync-mode parameter. Please see the Mutagen documentation page for file synchronization for more details.

Available sync modes are two-way-safe, two-way-resolved, one-way-safe, one-way-replica and none. The default is default two-way-resolved.

none sync mode disables file sync alltogether and is used when working in Exclusive remote files mode.