How to setup remote debugging in PyCharm on Windows with Vagrant? - vagrant

I have been able to setup Vagrant on Windows 7 64-bit for a django project. The Vagrant instance is running the application with postgres as backend. I have setup port forwarding, so I am able to access through my browser on local machine. I have also setup remote interpreter in PyCharm. But, I am unable to figure out how to open the project, which is on vagrant instance, in PyCharm 3.0. I also have the source code on my local machine.
Any ideas?
Thanks

Synced Folders may be something you are looking for.
NOTE: by default Vagrant use VirtualBox's vboxsf for synced folder and share your project directory (where the Vagrantfile resides) to /vagrant within the guest.
However, vboxsf has known performance issues with large number of files and directories. You can try to move the project to /vagrant (or whatever synced folder) so that both the host (Windows 7) and guest can access the project easily. See if it works well. If you see slowness try moving to NFS or sshfs.
Reference
Vagrant shared and synced folders
What is the difference between shared folder and synced folder in Vagrant?

Related

React-native packager does not detect changes made on host computer when running in vagrant VM's synced folder

I am running a vagrant VM on OSX. I have set up a synced folder for the VM in which I run react-native packager. When I edit files on my host computer, the packager does not automatically detect that the file has changed. This works if I edit the file directly in the VM. I have checked that the file actually changes on the VM when I edit it on my host computer. Has anybody had the same problem or figured out a solution how to get this working?

Using a local editor with Vagrant

I typically use the atom editor for any coding work and have folders on my computer with the code. After doing some updates on my Mac OS computer, some ruby gems stopped worked, rvm no longer responded and homebrew gave me a ton of trouble. I want to prevent this from happening again and figured I'd use Vagrant instead. I like it so far and it works fine, however I want to use my Atom editor nevertheless.
Normally I work on projects using gulp or grunt and they compile the files whenever any changes are made. While I have managed to connect to Vagrant with FileZilla, I have no idea how to connect atom to it. All I need is to edit the files in the Vagrant VM, as I would if they were stored in regular directories on my Mac. Any idea how to solve this?
you can certainly use your current workflow but you do not necessarily need to connect to your vm using Filezilla or another protocol.
The best is to look at Synced Folders and synchronized your project directory. By default vagrant synchronized your current directory (where the Vagrantfile is store) to the /vagrant directory in the vm. so if you can place your project directory within the same folder, they will be automatically synchronized.
If Atom (I am not user of this editor) have a special folder where you store your project files, you can add this folder as synchronized folder. Add the following to your Vagrantfile
config.vm.synced_folder "/Users/fhenri/project/tac.local", "/project"
In my case this synchronized my host (mac os) folder /Users/fhenri/project/tac.local to the vm folder /project so whenever I make a change in this folder, I can see the exact same change from the vm.
If you use ruby and gems, it might be good to install the gem locally (within your project structure that you can share between the host and the guest) so they are automatically reflected in the 2 environments when you make a change.
When you're using gulpor grunt you would launch them from the vm, working on a synchronized folder and all the changes you will make from the mac os host would automatically be picked up on the vm. I remember when working with default Virtual box sharing folder, automatically is not flash light, you should allow a few seconds delay but still it is working.
If performance is becoming an issue, you can look at nfs synchronization type by making the change
config.vm.synced_folder "/Users/fhenri/project/tac.local", "/project", type: "nfs"
It should improve a bit

How to access files downloaded on my windows machine from boot2docker?

I have a file which is downloaded from browser. I have boot2docker on my windows machine. From boot2docker, how can i access my downloaded file? Is it possible?
If you setup shared directories with VirtualBox, it is possible, however, it is overly complex for not much.
I'd advise to simply use curl or wget within boot2docker to download your file(s).
An other solution would be to use winscp to upload your file from windows to boot2docker.
The download folder should be mounted in boot2docker already.
From Boot2Docker's README:
Alternatively, Boot2Docker includes the VirtualBox Guest Additions
built in for the express purpose of using VirtualBox folder sharing.
The first of the following share names that exists (if any) will be
automatically mounted at the location specified:
Users share at /Users
/Users share at /Users
c/Users share at /c/Users
/c/Users share at/c/Users`
c:/Users share at/c/Users`
Since Windows' default download location is C:\Users\[username]\Downloads your downloaded file should be in the Boot2Docker VM at /c/Users/[username]/Downloads.

Meteor Vagrant: Where should the project code files be?

I have successfully configured Meteor on my Windows machine via vagrant along with running the sample app in the browser by following the tutorial given at https://gist.github.com/ahoereth/2607d2ee99103a0a9bc9.
For the last two hours, I have explored all of the Window's directories in search of the code created by meteor create sampleapp command, but I can't find any clue where the code is. As vagrant claims that code is in the Windows directory not the VM box, can anyone give me a hint where it could be hiding?
The directory that's shared with the Windows host is the /vagrant directory. In the VM, the home directory might be different, and won't be visible from Windows.
However, if you want to run the Meteor app from the shared directory, be prepared for a world of pain whenever you install a package that has a : in its name, as Windows won't support that character in the filename, and you'll get a cryptic error in the VM.
Since packages in Meteor 0.9+ regularly have : in their names, developing Meteor apps in the VM/Windows shared directory is a no-go.

Jenkins / Vagrant / VirtualBox - Virtualbox is running as the system user?

I'm pretty new to both VirtualBox and Vagrant, but not Jenkins. I have a Jenkins build being run on a Windows slave that is running "vagrant up" in a specific directory. There was a problem with the VM- I went to that directory and tried to manually run vagrant up and it started recloning the box. Investigating, the VirtualBox VMs folder is being stored in /Windows/system32... I have looked and the Jenkins process and the VirtualBox process are definately being run as the user account that is running the jenkins slave. If I log into that account and launch virtualbox, it looks for VMs in the account home directory though!
I could probably fix this by pointing both accounts to a third location, but I would like to understand why this is happening. Any takers?
According to the docs, since VirtualBox 4.0, the default location where virtual machines are saved is the current system user's home directory. So:
C:\Documents and Settings\<username> on Windows
/Users/<username> on Mac OS X
/home/<username> on Linux and Solaris
Take a look at the Default Machine Folder settings of the virtualbox on your Windows slave to see if anyone has changed the path to /Windows/System32
File > Preferences > General > Default Machine Folder
Also, I am assuming you are using the jenkins vagrant plugin to spawn your vagrant box? (If not, you should). AFAIK, that plugin doesn't require any system administrator privilege on the slave machine.

Resources