Using Dropbox to sync Local sites between computers


#1

I setup my Dropbox to sync between my computers so I can ensure I’m always able to pick up where I left off when developing locally, even when work is not yet committed. More importantly, I can very easily roll back changes/deleted files since I use Dropbox’ packrat feature.

Here’s how to get it setup:

  1. Start with Local setup with the sites on one computer, store the sites you want to share inside a Dropbox folder
  2. Export each site to blueprints
  3. Move blueprints from ~/Library/Application Support/Local by Flywheel/blueprints to the other computer
  4. Install Local on other computer
  5. Import blueprints but use a different folder outside of the Dropbox folder, this is temporary
  6. Sites will provision and get setup in Docker
  7. Now we can change the paths easily enough
  8. Checkout/clone the Local Add-on repo for Volumes - https://github.com/getflywheel/local-addon-volumes to the ~/Library/Application Support/Local by Flywheel/addons/local-addon-volumes folder
  9. Enable the add-on ‘Volumes Manager’ then restart Local
  10. Go into each site that you want to be based in the Dropbox folder and start them
  11. Go to the More > Volumes section of the site info
  12. Adjust the directory path easily by changing the values on the left side, then click ‘Remap Volumes’
  13. Local will provision the updated mappings
  14. After doing this for all of the sites you want to move/change, edit the ~/Library/Application Support/Local by Flywheel/sites.json file and adjust the ‘path’ strings there too.

Now you’ve got Dropbox shared Local sites, which shares the files and server configs/logs.


Cloning sites stopped working
#2

FYI, same method works for any file syncing method, if you’re using Google Drive or whatever. Goal is to ultimately get Local to change the path to the synced directories.


Local Development Backup (using Google Drive)
#3

A post was split to a new topic: Local Router cannot connect to site


#4

Sorry, unable to help you since I didn’t run into that. I would suggest opening a new topic, linking to this one saying you followed the steps, and posting your exact error.


Simplified syncing between Macs
#5

This is actually a giant step back from using MAMP/XAMP, especially for anyone who has more than a few sites to sync, more than two machines to sync with, who is frequently creating new sites or rarely switches between machines.

Compare with:

  1. Install MAMP on Mac A and point web root to dropbox
  2. Install MAMP on Mac B and point web root to the same folder

… and point the each WP installation to a remote DB, but I suppose that is also needed in the Local setup you describe but isn’t listed as a step. The crucial part is that it syncs all existing and future installs in one go with far fewer steps.

It’s like all the smarts that have gone into Local’s various features are working against it when you want to sync sites. I am going to write a feature request for Local to recognize existing container directory structure. I hope that’s even possible with all the virtualization tech.


#6

I’ve tried sharing DBs too back when I used VVV and that wasn’t pretty.

I would like to see Local have the ability to pick up new installs from the “Local Sites” folder (if the folder structure matches theirs and files are there).

But beyond that, the instructions I posted above aren’t really too hard to follow. You do it once and then you’re done on each machine. It’s been working great for me, I’ve had it up and working on three Macs (iMac + iMac + MBP) at once too.


#7

That’s exactly what I had in mind.


#8

This worked great. The only side effect seems to be that the “live link” options no longer works. Sites I have not set up to sync work fine.

Any ideas?

Paul


#9

The problem with dropbox it’s the app dont work correctly if you have over 300 000 files ! and wordpress use a lot of files. Me i have project folder, which contain a lot of website test and have over 900 000 files, and now dropbox dont work very good…


#10

@sc0ttkclark Thank you, I think i might get this to work.
I am however stuck on point 14.

1.) Do I move the sites.json file from the original computer or the 2nd computer?
2.) Where to do i move it?
3.) If I have some sites on the second computer that I do not want to sync with `dropbox, will they stay in tact?

Thank you.


#11

@sc0ttkclark One more thing, please:
This is how my remapping looks; is this right?
I deleted the /var and changed log to logs
Thank you very much.

FROM:
/Users/user/Local Sites/beads/logs/php
/var/log/php
TO:
/Users/user/Dropbox/Flywheel/Beads/logs/php
/logs/php

FROM:
/Users/user/Local Sites/beads/app
/app
TO:
/Users/user/Dropbox/Flywheel/Beads/app
/app

FROM:
/Users/user/Local Sites/beads/logs/supervisor
/var/log/supervisor
TO:
/Users/user/Dropbox/Flywheel/Beads/logs/supervisor
/logs/supervisor

FROM:
/Users/user/Local Sites/beads/logs/mysql
/var/log/mysql
TO:
/Users/user/Dropbox/Flywheel/Beads/logs/mysql
/logs/mysql

FROM:
/Users/user/Local Sites/beads/logs/nginx
/var/log/nginx
TO:
/Users/user/Dropbox/Flywheel/Beads/logs/nginx
/logs/nginx


#12

This part was rather obvious, my bad:
Just edited the sites.json, and changed

“path”: “/Users/user/Local Sites/beads”,
to
“path”: “/Users/user/Dropbox/Flywheel/beads”,

BUT, when testing it doesn’t work.

  • Stopped both sites on both computers.
  • Quit LBF on both computers
  • Open LBF on 1st computer and start site
  • Add new post.
  • Stop site
  • Quit LBF
  • Wait for dropbox to finish sync
  • Opened LBF on 2nd computer
  • No changes, no new post…

If I add a plugin on the one computer, it reflects on the other.
But If I activate it, it stay deactivated on the other computer.
So the issue seems to be the path to the SQL that is wrong…


#13

This is what worked for me (a bit simpler list of to-do’s and hopefully helps others):

Computer A:

  1. Install/Setup https://github.com/getflywheel/local-addon-volumes
  2. MUST HAVE THE SITE RUNNING - don’t try remapping volumes when the site isn’t running
  3. Move the app, conf, and logs files from /Users/me/Local Sites/example to /Users/me/Dropbox/local-sites/example.local/
  4. Delete the /Users/me/Local Sites/example/local-site.json file (if exists)
  5. Modify the ~/Library/Application Support/Local by Flywheel/sites.json file with the new site location
  6. Remap the volumes and click the “Remap Volumes” button to restart the site and everything will be good-to-go
  7. Test the site is running on “Computer A”

Computer B:

  1. Install/Setup https://github.com/getflywheel/local-addon-volumes
  2. Create a new site with the same name (e.g. “example.local”) with generic WP install
  3. MUST HAVE THE SITE RUNNING - don’t try remapping volumes when the site isn’t running
  4. Make sure Dropbox is in sync
  5. Follow the same steps for remapping the volumes, restarting the site, and changing the JSON files

Notes:

  • Do not run both Computer A’s site and Computer B’s site at the same times
  • If you Stop on one computer and Start on the other, you may need to fully quit Local by Flywheel
  • For some reason, database is not syncing (feel free to share your ideas how to fix this)
  • You can delete the original /Users/me/Local Sites/example folder or create a symlink or alias and put it there, pointing to the new/actual location