so I have a server with Linux to which I deploy staging Laravel application from Gitlab using the Gitlab Envoy guide
The structure of folders is as follows:
main folder where user is redirected to
folder with all releases
specific release app
specific release app
There is a problem when creating a symlink between
ln -nfs releases/timestamp public_html
the symlink that is created looks like this
./releases/timestamp -> public_html/timestamp
now it is supposed to be like this
./releases/timestamp -> public_html
does anyone know why this happens and possibly how to fix it?
This happens because public_html
already exists and is a directory.
From the man ln
(bold is mine):
Given one or two arguments,
ln
creates a link to an existing filesource_file
. Iftarget_file
is given, the link has that name;target_file
may also be a directory in which to place the link; otherwise it is placed in the current directory. If only the directory is specified, the link will be made to the last component ofsource_file
.
In order to achieve what you want you should remove the public_html
folder first (or add -F
option to ln
command, but it's not guaranteed to work).