Setup Dropbox On Azure
Setup box on Azure
Setup Dropbox on Azure
We can use dropbox for efficient 2-way project sync!
This approach works for any IDE -
atom
orwebstorm
orvscode
- they don't have to know about the remote filesystem.This will allow us to write code locally and have the changes show up on the remote box.
Adding/deleting files will work
File permissions will be properly reflected
Configuring
selective sync
via the dropbox UI will prevent the transfer of bulky dependencies back to your local filesystemsuch features are often difficult to setup or absent in other sync tools.
Tools like
SourceTree
can simply deal with our local filesystem without any knowledge of the remote filesystem.
Install Dropbox agent
sudo apt install nautilus-dropbox
echo "export LC_ALL=en_US.UTF-8 && export LANG=en_US.UTF-8" >> ~/.bashrc && source ~/.bashrc
At this point you should not find any results when you run:
sudo find / -iname dropboxd
Run
dropbox start -i
to install the daemonIt will get stuck because it's not showing you the logs which give the URL for linking your account
Let's find the daemon using:
sudo find / -iname dropboxd
... here is an example output:To stop the previous process we need its PID. The easiest way to find the PID is to run the same process again and it will tell you the PID of the process that's already running:
Now kill it:
kill 10537
... change10537
to be the PID you see in your screen, ofcourse!Now run it in foreground and you will get the account linking URL you need.
copy/paste the url you see in the logs to your browser, follow the instructions
you MUST NOT stop or kill the process while you are linking your account in the browser
eventually the logs will give you a welcome message indicating that account linking its done
Now you should definitely use
ctrl+c
to stop the foreground process and check that aDropbox
folder exists:ls -alrt ~/Dropbox
Since the accounts are linked, start dropbox in background again:
dropbox start -i
NOTE:
dropboxd
will start syncing everything in your dropbox account immediately, the next few steps will work to correct this behaviour.But we want to tell
dropboxd
to avoid syncing anything other than our code/projects.Switch to your
Dropbox
directory and exclude any files that it has begun syncing:
Check the status:
dropbox status
If its still trying to sync then every few minutes, rerun:
cd ~/Dropbox/ && dropbox exclude add * && ls -alrt ~/Dropbox && dropbox status
After the status check declares:
Up to date
Run this command one last time to be sure:
cd ~/Dropbox/ && dropbox exclude add *
Now the contents of your
Dropbox
directory should be empty:cd ~/Dropbox/ && ls
Feel free to take a look at everything which has been excluded:
dropbox exclude list
If the directory you want to sync is also excluded, then remove it from exclude list by
~/bin/dropbox.py exclude remove [DIRECTORY] [DIRECTORY]
Maintainence
Uninstalling dropbox
dropbox stop
sudo apt-get remove --purge nautilus-dropbox
sudo find / -iname dropboxd
remove all the results, for ex:
rm -rf /home/${USER}/.dropbox-dist
sudo find / -iname dropbox
rm -rf /home/${USER}/Dropbox/.dropbox
rm -rf /home/${USER}/Dropbox/.dropbox.cache
Unlink the machine from your dropbox account by finding its device name at:
https://www.dropbox.com/account/security
in the dropbox account online where it was previously linked and removing it. Otherwise you won't see the following logs to help you unlink from a previous account and relink to a new account if you are hoping to do an uninstall and then a reinstall eventually:
If you code using dropbox for sync long enough, you will run into an issue where dropbox will either crash or hang or both because of a limit on maximum number of files it can monitor for changes.
If you are lucky then the logs will magically pop-up on your console stating:
You can protect against this by understanding what is going on. For example I found out that I had provided significantly less resources than what dropbox recommends!
Or you could simply go ahead and make the fix:
You're welcome ;)
Sync projects via Dropbox
Now that we've excluded everything known to us, you can place any new code-related projects & folders into dropbox and they will sync between.
https://www.digitalocean.com/community/questions/dropbox-works-with-digitalocean-droplets
You probably don't want to host content out of your Dropbox folder, but there's a basic trick for mirroring Dropbox content outside of the Dropbox folder: create a symbolic link.
Example: ln -s /var/www/foo.com ~/Dropbox/foo.com
This will cause Dropbox to treat /var/www/foo.com as if it resided inside the Dropbox folder. All other clients will see foo.com as a folder within the Dropbox folder, and will transparently sync across that symlink.
Other References
Last updated