drupal-vm icon indicating copy to clipboard operation
drupal-vm copied to clipboard

Create Symlink or Add VirtualDirectory

Open sbubaron opened this issue 10 years ago • 7 comments

Hi,

I'm attempting to get simplesaml to work within my DrupalVM environment. It is currently working within Acquia, using a Symlink that points from docroot/simplesaml to ../simplesamlphp/www

The symlink is part of my git repo, but simply appears as a file in my docroot named simplesaml with the contents ../simplesamlphp/www

I've read that there are issues with symlinks, vagrant and windows, none of the solutions I found seemed inline with DrupalVM/my setup.

Another alternative that could work would be to create an Apache VirtualDirectory and point it to the simplesamlphp/www folder, I just don't know how to go about configuring that.

I am on DrupalVM 2.5.1, I'm not opposed to upgrading if that is a requirement.

As always any help is appreciated.

Thanks, Rich

sbubaron avatar Jun 06 '16 20:06 sbubaron

alright I was able to create a symlink manually by adding the following to my vagrantfile:

config.vm.provider :virtualbox do |v| v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"] end

I then vagrant up --provision from with a shell (git for windows) running as administrator -- I could then ssh into my vagrant guest OS and create a symlink using ln -s -- prior to this I would get a "protocol error"

I'm still curious if there's a better approach -- ideally I think the Apache Virtual Directory would be more sustainable for me / my team as I'm afraid this solution is a bit fragile.

sbubaron avatar Jun 06 '16 21:06 sbubaron

@sbubaron - One way to make that hack work a little better in the interim is to add it to a Vagrantfile.local file that you commit to your project repo—that way you don't have to maintain a fork of Drupal VM just for that project.

In the past, when I've dealt with simpleSAMLphp, I just gave up on getting it working in the local environments for a number of reasons :)

If you're on Windows, and you need to use symlinks, you have to use native synced folders (or suffer through some strange speedbumps with SMB or trying NFS), and it's best to have the symlink generated within the VM. And then on top of all that, there will be some other 'fun' problems that crop up.

geerlingguy avatar Jun 06 '16 21:06 geerlingguy

See related: http://www.jeffgeerling.com/blog/2016/using-smb-symlinks-instead-native-synced-folders-vagrant-and-virtualbox

Also: http://docs.drupalvm.com/en/latest/other/windows/

geerlingguy avatar Jun 06 '16 21:06 geerlingguy

I'm going to close this issue as I can't see any further way of making it work better in a Windows environment besides what's already mentioned in the above two links; SMB especially is helpful in this case, but the main thing is symlinks are a little difficult to manage in a Windows environment, so I recommend if at all possible to avoid their use.

geerlingguy avatar Jul 24 '16 17:07 geerlingguy

Np it's actually working well for me, I'll try to remember what I did exactly and share.

Rich

On Jul 24, 2016 1:02 PM, "Jeff Geerling" [email protected] wrote:

I'm going to close this issue as I can't see any further way of making it work better in a Windows environment besides what's already mentioned in the above two links; SMB especially is helpful in this case, but the main thing is symlinks are a little difficult to manage in a Windows environment, so I recommend if at all possible to avoid their use.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/geerlingguy/drupal-vm/issues/708#issuecomment-234788714, or mute the thread https://github.com/notifications/unsubscribe-auth/AKbKDuLinobo3yIQ-NDofa-80lopeczZks5qY5qngaJpZM4IvR9r .

sbubaron avatar Jul 24 '16 21:07 sbubaron

For whatever reason the symlink stopped working (I think it may have something to do with viewing it in a text editor?) -- so I had to recreate it.

After trying a few different things, what worked for me was opening a admin command prompt and using mklink

d:\git\doitsbu\docroot>mklink /D simplesaml ..\simplesamlphp\www
symbolic link created for simplesaml <<===>> ..\simplesamlphp\www

Don't use windows paths i.e. D:\git\doitsbu\simplesamlphp\www as they won't work in the VM.

I also created a Vagrantfile.local with:

config.vm.provider :virtualbox do |v|
  v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"] 
end

sbubaron avatar Aug 05 '16 18:08 sbubaron

@sbubaron - Thanks so much for adding this info, it will be helpful for others setting up simplesaml locally on Windows!

geerlingguy avatar Aug 05 '16 19:08 geerlingguy