I'm trying to do vagrant up inside the following directory:
~/Desktop/Apps & Co./company/My App/Backend/
I know, I should fix my naming conventions. Can't help it right now, though.
As you can see, there are several special characters in the path, such as (space), &, and ..
The Homestead.yaml file contains this:
folders:
-
map: ~/Desktop/Apps & Co./company/My App/Backend/
to: /home/vagrant/app
When running vagrant up from inside that directory, I'm seeing the following (abbreviated) error:
There was an error loading a Vagrantfile.
Message: LoadError: cannot load such file -- /Users/linusgeffarth/Desktop/Apps & Co./company/My App/Backend/vendor/laravel/homestead/scripts/homestead.rb
Yes, Vagrantfile exists in this directory. I copied the path into terminal to verify.
I tried the following paths in Homestead.yaml:
map: ~/Desktop/Apps & Co./company/My App/Backend/
map: ~/Desktop/Apps&Co./company/MyApp/Backend/
map: ~/Desktop/AppsCo/company/MyApp/Backend/
map: ~/Desktop/Apps\ \&\ Co./company/My\ App/Backend/
map: '~/Desktop/Apps & Co./company/My App/Backend/'
map: "~/Desktop/Apps & Co./company/My App/Backend/"
Any idea how I can use the special chars path and get vagrant up to run properly?
I was finally able to fix this.
Move the directory to some path without special characters, such as ~/Desktop in this case.
Update the Homestead.yaml file and insert the new path: map: ~/Desktop/Backend/app
now, cd into the new directory and run $ vagrant up
$ vagrant ssh should also work now
$ cd app - try to call an API method
$ exit
$ vagrant halt
move the directory to the desired path
cd into the new directory, edit the Homestead.yaml file: map: ~/Desktop/Apps & Co./company/My App/Backend/ (no escapes, nothing)
$ vagrant up
$ vagrant ssh
$ cd app
Now it should work in the desired directory.
Related
I have some directories and files inside a directory called dir1
I am trying to empty that directory using the below code
- name: Clean path
file:
state: absent
path: "/home/location/dir1"
But it is deleting the dir1 itself, i would like to empty it and keep this dir1, what am i missing here, any help on this would be appreciated.
You can try to use a command instead.
- name: Clean path
command: rm -r /home/location/dir1/*
To empty a directory you can use the shell module to run rm with a fileglob:
- name: empty directory
shell: rm -r /home/location/dir1/*
Note that if your directory contains hidden dotfiles, you'll need to explicitly remove those as well:
- name: empty directory containing hidden files
shell: rm -r /home/location/dir1/* /home/location/dir1/.*
Your provided task isn't doing what you want because you're declaring that the directory should be absent, so it gets completely removed rather than emptied.
The command module won't work for the rm because it will not expand file globs, resulting in an error like:
rm: cannot remove '/home/location/dir1/*': No such file or directory
Why not remove the directory with the same task you're using, and re-add it immediately after using the same module? Seems like the most straightforward way to me. You could do some stuff with fileglob and with_items but that seems like over complicating a simple task.
- name: Remove folder
file:
state: absent
path: "/home/location/dir1"
- name: Re-make folder
file:
state: directory
path: "/home/location/dir1"
Using supervisord, I am unable to use a file path with a space in one of the directories. I am trying to use my iCloud Drive folder as the path to the file.
the path:
~/Library/Mobile Documents/com~apple~CloudDocs/Code/modbot/modbot.py
my program supervisord.conf (non working. works when pointed to a new path without a space in the directory)
[program:modbot]
command=/Users/Jonathan/.virtualenvs/modbot/bin/python3.7 /Users/Jonathan/code/modbot/modbot.py
paths I've tired in supervisord.conf:
~/Library/Mobile Documents/com~apple~CloudDocs/Code/modbot/modbot.py
~/Library/Mobile\ Documents/com~apple~CloudDocs/Code/modbot/modbot.py
~/Library/Mobile' 'Documents/com~apple~CloudDocs/Code/modbot/modbot.py
"~/Library/Mobile Documents/com~apple~CloudDocs/Code/modbot/modbot.py"
~/Library/"Mobile Documents"/com~apple~CloudDocs/Code/modbot/modbot.py
After googling I even tried double escaping but nothing is working.
turns out I'm an idiot. supervisord doesn't use ~ so that was the problem, working code:
[program:modbot]
command=/Users/Jonathan/.virtualenvs/modbot/bin/python3.7 "/Users/Jonathan/Library/Mobile Documents/com~apple~CloudDocs/Code/modbot/modbot.py"
I can‘t figure out how to solve this error when I run homestead up:
vm:
* The shared folder guest path must be absolute:
shell provisioner:
* Shell provisioner `args` must be a string or array.
* Shell provisioner `args` must be a string or array.
* Shell provisioner `args` must be a string or array.
My homestead.yaml file looks like
folders:
- map: ~/Code
to: /home/vagrant/Code/
I wrote the same paths like in the laracasts tutorial. What is wrong with the shared folder guest path "/home/vagrant/Code/"?
I have tried a lot of different ways to point to the directory but none of them worked out.
When I echo $PATH in the terminal I get /Users/username/.composer/vendor/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin
Thanks for help!
Change to: /home/vagrant/Code/ to to: /home/vagrant/Code
Also, I think it might have issues with ~/Code needing to be /Users/username/Code instead
Is there any way to make NFS to ignore specified files and/or directories from the synced folder? I have done it with rsync (rsync__exclude), but don't find any reference for NFS. I'm also looking for a solution for SMB. Any ideas?
In my case I had to keep cache and log files unsynchronized, and the solution I found out was to create a symbolic link instead of the cache and log folders (e.g. app/cache and app/log) which points to a directory outside the synchronized folder (e.g. /home/vagrant/project/cache). Then, the files inside app/cache are not synchronized. Hope it helps.
My rep isn't high enough to comment on the above answer, I had the exact same problem. I had to do a little work and figure this detail out:
The symlink must be in your virtual machine. So for example:
vagrant ssh
cd your/webapp
mkdir outside/your/webapp
ln -s outside/your/webapp cache
Now the symlink will show up in your project folder, but you won't actually be synchronizing any files across it.
I managed to combine NFS and RSync. In the RSync we can exclude the NFS folders
This is what I have in my vagrantfile for a Symfony 3.4 project. Every folder will be NFS except the /var folder
biDirectionalNFSFolders = []
Dir.foreach('.') do |folder|
# Skip if not a directory?
# Skip if /var folder
# Skip if . or .. folder
next if !File.directory?(folder) or folder == 'var' or folder == '.' or folder == '..'
# This folder can be NFS synced
fullPath = '/htdocs/' + folder
biDirectionalNFSFolders.push(fullPath)
config.vm.synced_folder "." + fullPath, "/vagrant" + fullPath, type: "nfs", mount_options: ['rw', 'vers=3', 'tcp', 'fsc', 'nolock', 'actimeo=2']
end
# The remaining folders (/var only in this case) can then be Rsynced, the NFS folders will be excluded
config.vm.synced_folder ".", "/vagrant", type: "rsync",
rsync__exclude: biDirectionalNFSFolders
I am using code iginiter. When I try running my application from a local browser then this error is throwing up.
Carabiner: cache path does not exist. Please set the cache path in config/carabiner.php.
I have no clue what it is. Tried some online similar solutions like :
http://www.webdevelopersdiary.com/1/archives/06-2012/1.html
but for some reason nothing seems to work. Please help me to come out of this.
Create cache directory specified in config/carabiner.php, at line #50.
Default setting: $config['cache_dir'] = 'assets/cache/';
Remember that cache_dir path is relative to document root (aka FCPATH from CI ; where index.php is located). On initialization, FCPATH and cache_dir are concatenated, resulting cache_path.
Excerpt from library:
$this->cache_path = $this->fcpath.$this->cache_dir;
Update
You need to create assets/cache directory, which is located in you application root, with write permissions: mkdir -p assets/cache && chmod -R 777 assets/cache
In the end, it will look like this:
$ tree
.
|____application
|____assets
| |____cache
|____index.php
|____system
|____user_guide