My question concerns migrating a web app built in Flask to a Droplet.
I have built the app in a private workspace, using the Flask template in C9. Now it's been developed, I want to set up the app in a Digital Ocean droplet. To connect a brand new C9 SSH workspace to a droplet is fine; however, the SSH workspace by default does not have many of the dependencies (mySQL; Flask) and this is a major pain. I'm using a droplet with Ubuntu NodeJS 6.9.5 on 14.04.
Is there a way to have my existing private dev workspace cloned to an SSH workspace? It would be even better to have a single workspace maintained that syncs to the other, should I wish to take down the droplet for any reason.
Thanks.
Open Remote Explorer, select SSH Targets and notice that the AWS Cloud9 host has been added. Click on Open Config to edit the SSH config file and specify the IP Address, username and private key path. Now connect to the Host — Select the Remote OS i.e. Linux and confirm that you want to connect.
In your Github profile go to setting->SSH and GPG keys-> New SSH key. (https://github.com/settings/keys/new). Add a title and paste the key.
Why can't you just image the disk, a digital copy of a working c9 to your new workplace, then use rsync to do increment sync.
rsync -azHAXxP -e 'ssh -p22' username@your-droplet-IP \
"dd if=/dev/sda of=myworking-droplet.iso bs=512 conv=noerror,sync"
Now that you have a full copy of working droplet as an image (.iso) file, you can copy this to any hard disk of your choice and boot into it.
If your C9 filesize is less than 30G, you can copy this into usb drive and maintain a locally bootable copy, that is you can image this unto any larger USB and make it bootable, to achieve this do :
Image your iso file to usb with :
dd if=myworking-droplet of=/dev/sdb bs=512k conv=noerror,sync
Once finished, remove your drive, plug it into another PC, change the boot order to USB Drive and boot into your C9 locally
It gets better if you just want to sync your C9 workspace directory over SSH connection to another box, use:
`rsync -azHAXxP -e 'ssh -p22' username@your-droplet-IP:/path/to/your/workspace .`
The above will clone your workspace directory over to your current box. NOTE: The dot at the end of the command is necessary.
Also you can mount your remote workspace file system to your local computer so you can make changes on the fly and treat your droplet as local storage, so you can work and access the same workspace locally without the need to login into your Cloud9 everytime you want to make changes or work on your project, to achieve this use:
Install SSHFS if not already installed with :
sudo apt-get install sshfs
Create a local directory in which to mount the droplet's file system.
sudo mkdir /mnt/mydroplet
Mount your droplet with:
sudo sshfs -o allow_other,defer_permissions \
[email protected]:/ /mnt/mydroplet
If your droplet is configured for login via ssh key authorization, use this:
`sudo sshfs -o allow_other,defer_permissions,IdentityFile=~/.ssh/id_rsa \
[email protected]:/ /mnt/mydroplet`
Now you can work with files on your droplet as if it were a physical device attached to your local machine.
`cd /mnt/mydroplet`
Creat a test file
touch TestFile.php
Now login into you Clound9 and verify that you can access and modify the newly created file i.e TestFile.php
Now you can code locally, it immediately appears on your C9, or upload files from your local machine to your Cloud9 by copy file to your locally mounted directory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With