Symlink in Laravel current release folder from external folder - laravel

I am using zero downtime deployment for Laravel and I have a folder which is updated regularly with weather files.
The folder structure is like:
releases/1 - where the current release is.
current/ - linked to /releases/1 and this is where Apache server root is.
public/weather - this is the folder where weather files are stored (via ftp process).
Can I use symlink on public/weather -> /current/public/weather?
Command I try to use:
ln -nfs --relative /var/www/html/public/weather /var/www/html/current/public/weather
the command appears to work, however I can not see it linked with ls -al.
If I try:
ln /var/www/html/public/weather /var/www/html/current/public/weather
I get this error.
ln: /var/www/html/public/wdisplay: hard link not allowed for directory
Thank you

Related

WebLogic 12c - Difference Between Stage Directory and Upload

I uploaded a new ear file to WebLogic 12c. I then issued the *nix find command that outputs the md5sums of the files that the search finds. I noticed that there are two different versions of the ear I uploaded.
I know that one of the md5sums is a sum for the previous version of the ear file and the other md5sum is for the latest version of the file. I saw that the previous version is in a folder under a directory called stage. The latest version is under a folder called AdminServer. Please see the output of the find command below that shows this:
[me#corp-box ~]$ find /app -name CORP_UI.ear -exec md5sum "{}" \;
0d03c0bf96b3f700da5c44454a66ace8
/app/oracle/Oracle/Middleware/Oracle_Home/user_projects/domains/die_domain/servers/CORP/stage/CORP_UI/CORP_UI.ear
649f5c222e014fb7af05178e13cab708
/app/oracle/Oracle/Middleware/Oracle_Home/user_projects/domains/die_domain/servers/AdminServer/upload/CORP/app/CORP_UI.ear
md5sum:
/app/oracle/Oracle/Middleware/Oracle_Home/user_projects/domains/die_domain/config/deployments/CORP_UI.ear: Is a directory [me#corp-box ~]$
I saw a question pertaining to the stage folder at the following URL: Is it safe to delete the stage directory?
I am wondering what the stage directory is? Is this where applications go to die? Why would the previous version of the application be in the stage directory and the new copy under the ../AdminServer/upload/.. directory?
According to oracle documentation, the Upload directory is:
"The directory path on the Administration Server where all uploaded applications are placed."
the Stage directory is:
"The directory path on the Managed Server where all staged (prepared) applications are placed."
The stage directory can be deleted after stopping the managed servers.
As a matter of fact you can delete the whole directories /servers/ and their content. Whenever you restart the managed servers they are recreated by weblogic. Just pay attention not to delete the admin server directory!

laravel symlink is changed when code is pushed to live site

I am using laravel 5.5's storage symlink to store images. When I push code to the git and pull from live site then symlink path on live site becomes same as is on my local code .
My local has this symlink
storage -> /home/path/to/project/app/public/
But live site expects this symlink path
storage -> /var/www/html/website.com/public_html/project_code/storage/app/public/
Every time I have to delete symlink and create it again on live site.
I have do these steps on live site
cd public
rm storage
cd ..
php artisan storage:link
after doing these steps my symlink becomes according to live site and then it starts working.
Live site should have this symlink
storage -> /var/www/html/website.com/public_html/project_code/storage/app/public/
project_code/.gitignore :
public/storage
project_code/storage/app/.gitignore
*
!public/
!.gitignore
How I can get rid of this issue.
Thanks in advance!
As your symlink points to another location within the same project, you can safely use relative paths while linking, instead of having absolute one (which is what artisan is setting up). That would require manual linking though:
cd app/public
ln -s ../storage/app/public storage
Remove current storage symlink first if you have it already.
You might consider setting up a post-receive hook in the target Git repo (the one you are pushing to). See this one for instance.
In that hook, you can add any step you need (like fixing the symlink).

What is a usual workflow for dealing with shared files with capistrano?

My .csv recreates on every release, and, as I understand, to keep its data unchanged between deploys I need to put it in /shared directory and simlink to it from my deploy.rb.
Is this the right route? (I have this question because I don't seem to find much info on how to do this with respect to, eg, databases, for some reason. /shared directory is mostly used for .conf files and paperclip-like directories).
When using capistrano, your application code will be "uploaded" to some directory on the server. Capistrano uses this structure:
/path_to_folder:
current - symlink to the directory with the current release
releases - contains all kept releases
shared - files that should persist between releases
So to your question - copy the .csv file somewhere into "shared" directory and then in the config/deploy.rb add this:
namespace :deploy do
task :create_symlinks do
run "ln -s #{shared_path}/something.csv #{latest_release}/db/something.csv"
end
end
after 'deploy:update_code', 'deploy:create_symlinks'
Replace "something" with the file name that you copied. You can also put the csv file into some directory under "shared" if you want to, I'd use "db" in this case. If you do so, don't forget to update path in the symlink.

Symlink not working when pointing one subfolder to a sibling subfolder

Trying to create a symlink in my hostgator shared hosting account via Jailshell 4.1 and my Mac's Terminal as a test before applying the symlinks to a larger project.
When I try the following it doesn't seem to work:
ln -s public_html/y public_html/x
As I get the following response:
ln: creating symbolic link `public_html/x/y': Permission denied
I am simply trying to set it up so that going to public_html/x will instead take me to public_html/y. My ultimate goal is to later configure many wordpress sites to share a single set of core files without sharing databases, as described here:
http://jason.pureconcepts.net/2012/08/wordpress-multitenancy/
http://jason.pureconcepts.net/2013/04/updated-wordpress-multitenancy/
Edit: Both folders /x and /y already exist, containing a simple index file in each.

Accessing Symlink folder in ~/Sites folder on Mac (Web Sharing)

I have a local development environment setup on my mac and I am having permission issues accessing a folder in my ~/Sites directory.
Essentially I have Folder A in my Dropbox folder.
I created a SymLink of Folder A to my ~/Sites folder
ln -s ~/Sites ~/Dropbox/FolderA
When I try to access Folder A like so: localhost/~username/FolderA
The page says You don't have permission to access /~username/FolderA on this server
Can someone help me figure out this problem. When I do the same thing on MAMP I don't have this issue. Thanks in advance.
Go on private/etc/apache2/users/, edit your usernamefile.conf, add to the Options line, the option SymLinksIfOwnerMatch, don't use FollowSymLinks if the directory contains important personal files, if for example the dir that you want link is are under your Documents or Dropbox.
Remember that the directory linked by your symbolic link must have 755 permission, and so her parents!
Let's suppose you have /Users/foo/Dropbox/MySites/BarSite, both Users, foo, Dropbox, MySites, BarSite must be 755.

Resources