docker-sync user here ![]()
Essentially, I created a modified version of bin/docker/boot_dev to start the container in detached mode with the docker-sync’ed volumes, so the rest of the Discourse bin/docker scripts would still work.
This is how I structured everything.
.
|-- src/
|-- docker-sync.yml
|-- up
|-- down
src/ is the cloned Discourse git repo.
up is the aforementioned modified boot_dev script, to docker-sync start and start the docker container; down stops docker-sync and the docker container.
My `docker-sync.yml`
version: "2"
options:
verbose: true
syncs:
discourse-sync:
src: './src'
sync_userid: '1000'
sync_groupid: '1000'
sync_excludes: ['tmp/cache', '.DS_Store', '._*', 'data/postgres*', 'log/development.log']
postgres-sync:
src: './src/data/postgres'
sync_userid: '107'
sync_groupid: '112'
Critical snippet in `up`
docker-sync start
docker run -d -p 1080:1080 -p 3000:3000 \
--volumes-from discourse-sync \
--volumes-from postgres-sync \
-v "postgres-sync:/shared/postgres_data:nocopy" \
-v "discourse-sync:/src:nocopy" \
-e BUNDLE_PATH=/src/vendor/bundle \
--hostname=discourse \
--name=discourse_dev \
--restart=always \
discourse/discourse_dev:release /sbin/boot
I kinda forgot why I have two separate sync’ed volumes: one for the database and another for the source code.
Never got around to perfect the script since it just works
Lemme know if you’ve any questions!