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

docker-sync support #105

Open
bsormagec opened this issue Aug 5, 2017 · 58 comments
Open

docker-sync support #105

bsormagec opened this issue Aug 5, 2017 · 58 comments

Comments

@bsormagec
Copy link

I think docker-sync support will be good for mac because docker has poor performance on osx. Can you add this to devilbox ?

@cytopia
Copy link
Owner

cytopia commented Aug 8, 2017

@bsormagec thanks for pointing it out. Can you direct me to some more documentation about this.

@cytopia cytopia self-assigned this Aug 8, 2017
@bsormagec
Copy link
Author

@vzlatev
Copy link

vzlatev commented Dec 8, 2017

Hello,

Any plans to include it in the upcoming releases - on OSX without docker-sync web apps are awfully slow.

Regards

@coredevel
Copy link

coredevel commented Jan 17, 2018

+1, without docker-sync there are a couple of options for os x when mounting shares using bind mounts:

  • consistent or default: The default setting with full consistency, as described above.
  • delegated: The container runtime’s view of the mount is authoritative. There may be delays before updates made in a container are visible on the host.
  • cached: The macOS host’s view of the mount is authoritative. There may be delays before updates made on the host are visible within a container.

(Source: https://docs.docker.com/engine/admin/volumes/bind-mounts/#configure-mount-consistency-for-macos)

Unfortunately though none of them appear to resolve the bi-directional sync without huge performance overheads (in the case of the default consistent setting) or persistence issues (e.g. if uploading images to a cms and building up a site's content locally with the docker container instance). Using vagrant in the past for large Magento builds I tried both unison and gatling-rsync, the latter being more performant and the final solution chosen which worked wonders. It ended up being a v similar setup to the docker-sync native_osx implementation, more reading material here:

As an aside a short term workaround to resolve performance issues at the moment is to use memcache/redis caching which works really well, managed to get a basic WordPress instance sub 80ms fully rendered in the browser!

@mad99
Copy link

mad99 commented Apr 23, 2018

Any news about a well usable and reasonably fast system under osx?

Have tried to extend the Makefile on my own (process to include docker-sync-stack). But it does not work well...
Maybe someone else is also to try to do this way. Would great to share or hear from news in this directions!

@cytopia
Copy link
Owner

cytopia commented Apr 24, 2018

This is still on the agenda, however the roadmap is currently really filled and me alone working on that takes some time. Probably somebody wants to jump in on this issue and submit a PR.

@johnwbaxter
Copy link

I tried setting up docker-sync but ended up somehow making docker use 400% cpu...will try again though as it's almost unusable on OSX as it stands.

@johnwbaxter
Copy link

@cytopia What would it cost to sponsor you to move this to the top of the list?

@cytopia
Copy link
Owner

cytopia commented Jul 4, 2018

@johnwbaxter I'd rather have someone helping me on this issue, as I dont' have a Mac at the moment. So I cannot get sponsored on this one and make an unreliable promises/guess. But thank you for bringing this up.

@cytopia
Copy link
Owner

cytopia commented Aug 7, 2018

There seems to be a native approach by Docker for volume mounts with the following options:

  • consistent
  • cached
  • delegated

How would one of those strategy perform against the current mount options:

https://docs.docker.com/docker-for-mac/osxfs-caching/#tuning-with-consistent-cached-and-delegated-configurations

Might give it a try. If this does not work out, I will have alook into docker-sync

@cytopia
Copy link
Owner

cytopia commented Aug 12, 2018

@bsormagec @vzlatev @Richdel @mad99 @johnwbaxter

The above suggestion should now be easily achievable via global mount options: https://devilbox.readthedocs.io/en/latest/configuration-files/env-file.html#mount-options

@ericgerhardy
Copy link

Has anyone solved this problem by using docker-sync or the global mount options? If yes, could you please tell us your configuration? Thanks in advance!

@cytopia
Copy link
Owner

cytopia commented Oct 2, 2018

@ericfynnmaier have you already tried one of these:

MOUNT_OPTIONS=,consistent
MOUNT_OPTIONS=,cached
MOUNT_OPTIONS=,delegated

Probably ,cached will give you some performance boost. I have no OSX anymore to try. Can you give it a shot and report how well it performs in terms of the empty default

@ericgerhardy
Copy link

@cytopia thank you! I added ,cached to the .env and e.g. Wordpress loads way faster!

@vielhuber
Copy link

,cached only seems to improve performance on mac, but not windows.
how do windows people work with devilbox in a performant manner?

@cytopia
Copy link
Owner

cytopia commented Nov 6, 2018

@vielhuber I haven't looked into Windows yet for those kinds of performance improvements. Any idea what alternatives are offered for Windows

@vielhuber
Copy link

vielhuber commented Nov 6, 2018

The only tool everybody is mentionning is "docker-sync" (http://docker-sync.io/).
This seems to solve the problems everywhere.
But it seems quite complex to install on Windows.

@cytopia
Copy link
Owner

cytopia commented Nov 6, 2018

OK, didn't know that this also works on Windows.

@cytopia
Copy link
Owner

cytopia commented Mar 10, 2019

Docker Sync Support (PR open)

@bsormagec @vzlatev @Richdel @mad99 @johnwbaxter @ericfynnmaier @vielhuber @jeffwhitfield @anselmdk @krebbi @chiribuc @OksanaRomaniv @akuehn @lesteak @Yame- @Ohrlab

I have created a first working draft including instructions how to get this working.

Thanks again to @chiribuc jumping in and providing a working example.

@buderus199
Copy link

I have tested docker-sync on my updated windows 10 machine with latest stable docker for desktop. Mainly because of slow magento 2 project.

I'm using latest devilbox from master branch and I have added docker-sync.yml & docker-compose-dev.yml file (from docker-sync branch) to devilbox root folder. I did run docker-sync and get "success Starting Docker-Sync in the background", but can't see any improvements in loading times or deployment (php bin/magento setup:static-content:deploy) for magento 2 project. Probably I'm missing something?

@cytopia
Copy link
Owner

cytopia commented Apr 27, 2019

@buderus199 Did you adjust (uncomment) the sync_strategy according to what is required for Windows?

https://github.com/cytopia/devilbox/pull/535/files#diff-09bf18a28f8967be55bc552a00f967dfR32

@buderus199
Copy link

@cytopia yes I have used sync_strategy: 'unison'

This is the output when running docker-sync start from Ubuntu WSL:

/var/lib/gems/2.5.0/gems/docker-sync-0.5.11/lib/docker-sync/update_check.rb:41: warning: Insecure world writable dir /mnt/c in PATH, mode 040777
ok Starting unison for sync devilbox-intranet-sync
doing initial sync with unison
Unison 2.51.2 (ocaml 4.06.1): Contacting server...
Looking for changes
Reconciling changes
Propagating updates
UNISON 2.51.2 (OCAML 4.06.1) started propagating changes at 14:30:48.56 on 29 Apr 2019
[BGN] Copying from /app_sync to /host_sync
[END] Copying
UNISON 2.51.2 (OCAML 4.06.1) finished propagating changes at 14:30:48.56 on 29 Apr 2019
Saving synchronizer state
Synchronization complete at 14:30:48 (1 item transferred, 0 skipped, 0 failed)
real 0m 0.04s
user 0m 0.04s
sys 0m 0.00s
chown ing file to uid 1000

And it stays like this for hours. Not sure if it is normal to stay like this...

@cytopia
Copy link
Owner

cytopia commented May 2, 2019

@buderus199 If the docker-sync command stales, its probably something to ask these guys: https://github.com/EugenMayer/docker-sync/

@ClearMarble
Copy link

I'm using the PR for this and noticing a definite performance improvement on MacOS. CPU usage seems significantly lighter on page loads.

@stale
Copy link

stale bot commented Aug 30, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the issue:stale This issue has become stale and is marked for auto-close label Aug 30, 2019
@stale stale bot closed this as completed Sep 6, 2019
@cytopia cytopia added issue:protected and removed issue:stale This issue has become stale and is marked for auto-close labels Nov 17, 2019
@cytopia cytopia reopened this Nov 17, 2019
@ClearMarble
Copy link

Hey, do you imagine this would still work if I updated to the latest version? Been holding off updating due to this but don't know if anything relevant has really changed.

@cytopia cytopia mentioned this issue Oct 8, 2020
7 tasks
@pirex360
Copy link

pirex360 commented Dec 5, 2020

Still at this date, the last version of devilbox on mac , using laravel...very slow.

@krebbi
Copy link

krebbi commented Dec 7, 2020

Same here. It's incredible slow on my Macbook Pro.
I have to restart the Docker Images every few hours, otherwise they are slowing down over time.

@cytopia
Copy link
Owner

cytopia commented Dec 7, 2020

The performance is still an issue with MacOS itself - they haven't improved it yet (since years).
The workaround using docker-sync is still blocked by this missing feature: EugenMayer/docker-sync#649

@science695
Copy link

@cytopia Since they seem to have found an intense debate on this setting, would it not be possible to default it to native, and in instructions for macos say uncomment this line from the .env sample?

syncs:
  default-sync:
    sync_strategy: '${SYNC_STRATEGY:native}'

env-sample

# For MacOS using docker-sync, uncomment this line:
# SYNC_STRATEGY=rsync

It seems like the extra step to add 1 line to .env file is much better than being without this feature to fix the MacOS performance problem.

@cube-dan
Copy link

@cytopia,

Has your mac situation changed since 2018? You said "... as I dont' have a Mac at the moment."

If you have you developed a devilbox specific docker-sync.yml file for PR #535, I'd love to give it a spin and report back my test results here.

Simply put, I'm volunteering time to help, any way I can, to help get the docker-sync feature off the ground.

Thanks @cytopia for all your amazing work on DevilBox!

-Dan

@FJLessing
Copy link

@cytopia or anyone really has there been any movement on this front?

@Lenitr
Copy link

Lenitr commented Apr 11, 2022

Docker on Mac has an experimental feature now that allows directory sharing using a Monterey only function called VirtioFS. I'm currently experimenting with it to see if everything runs ok using this. So far it speeds up the containers significantly, especially on requests with a lot of file reads.

Last week i had some issues with composer packages, giving it another go now.

@Lenitr
Copy link

Lenitr commented Apr 21, 2022

So far so good, haven't encountered any issues anymore since switching.
Running composer, installing npm packages etc. all done in devilbox php container ran without issues (at least for my usage).

I'm running MacOS Montery 12.3.1 on an Intel Macbook with Docker Desktop 4.7.1 (4.7.0 last week).

The feature can be enabled here:
Screenshot 2022-04-20 at 11 19 48

Hopefully more people can try it out and post their feedback, I think it's worth a try (but keep in mind that it's an experimental feature).

@anselmdk
Copy link

@Lenitr that sounds awesome. Is that all you needed to do, no settings withing devilbox?

@Lenitr
Copy link

Lenitr commented Apr 25, 2022

@anselmdk Yes, correct. The slowness was not a Devilbox issue, but rather Docker on Mac issue. Sharing the filesystem was very slow, but this new technique seems to be a bit faster. Only changing the setting in Docker desktop sped up the containers for me.

To manage your expectations though, it's still not as fast as running any Docker containers on a Linux host, but it's a nice improvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests