Skip to main content

File Syncing

Raftt keeps all the repository files synced between the local machine and the remote environment to allow live development in the remote environment.

The whole repository is synced, excluding the files ignored by git (defined in .gitignore files).

Under the hood, the syncing is performed by an OSS tool called Syncthing.

Mounting a Synced Folder

You can specify bind mounts inside your docker-compose file or mount a repo_volume() in the .raftt file to access the synced files in any service. For example, if you have the following docker-compose in the root of your repository:

version: '3'
services:
web:
build: .
volumes:
- .:/app

The synced repository directory will be mounted at /app in the remote container.

Similarly,

    volumes:
- ./models:/models

Would mount the models subdirectory to the destination container under /models.

By default, the dev container includes a mount of the entire synced folder in /code. Feel free to move this to wherever is convenient for you! :)

Overlaying Mounts

In some cases, you may need to mount code over existing content in the container. This works as expected. If you need to preserve some of it, you can accomplish that by using a volume:

version: '3'
services:
web:
build: .
volumes:
- .:/app
- /app/node_modules

This will make /app mounted to the synced repository, but within it, "node_modules" will auto-initialize an unnamed volume with the file's contents from the image. See the equivalent docker documentation here.