laravel
laravel copied to clipboard
How to link uploads folder?
Hi,
After deploying the app, all the uploaded images were deleted or maybe moved to somewhere else. I'm not sure what's happening when i deploy something.
How do I automatically link the uploads folder to the openshift data dir? or better if the files on the upload folders are preserved. I've tried adding a link command on deploy script but sadly it didn't work. Can you please assist me in setting this up. Thanks in advance!
ln -sf ${OPENSHIFT_DATA_DIR}public/uploads ${OPENSHIFT_REPO_DIR}public/uploads
ln -sf ${OPENSHIFT_DATA_DIR}public/cards ${OPENSHIFT_REPO_DIR}public/cards
How come its deleted ? If you are pushing from windows, I think there is a problem with the Uppercase and Lowercase naming of images. In Windows, address is case -insensitive in Unix or Mac, it is case-sensitive
This problem had occurred to me once. I ignored to have correct case. In windows, the Site worked perfectly, but after pushing many images aren't displayed. Took a hell lot of time to identify it.
@vignesh0025 Thanks for your reply. Yes I'm using windows and the file names are all in lowercase. I've ssh to the server and checked the deployed app /var/lib/openshift/556687fa4382ec952e0000d8/app-root/repo/public
. The link is there but I couldn't find the uploaded files. I've search the files in the FS and i couldn't find them.
I'm just wondering, the deployed app is from GIT, then does it mean that anything that's not committed will not be included on the new build? The uploaded files are not supposed to be on GIT right? So what's the best way to handle the files?
of-course it should be committed. use 'git add .' before committing and everything is done.
On Mon, Oct 26, 2015 at 11:35 AM, Rex [email protected] wrote:
I'm just wondering, the deployed app is from GIT, then does it mean that anything that's not committed will not be included on the new build? The uploaded files are not supposed to be on GIT right? So what's the best way to handle the files?
— Reply to this email directly or view it on GitHub https://github.com/luciddreamz/laravel/issues/12#issuecomment-151034949.
Vignesh D, [email protected], Ph:0091 8903128695
@vignesh0025
After 7 hours, I was able to sort it out :8ball:
Here's my deploy script . Hope this find helpful to someone.
echo 1>&2
echo "Migrating public uploaded files..." 1>&2
echo 1>&2
if [ ! -d ${OPENSHIFT_DATA_DIR}uploads ]; then
mv -uf ${OPENSHIFT_REPO_DIR}public/uploads ${OPENSHIFT_DATA_DIR}
fi
if [ ! -d ${OPENSHIFT_DATA_DIR}cards ]; then
mv -uf ${OPENSHIFT_REPO_DIR}public/cards ${OPENSHIFT_DATA_DIR}cards
fi
echo 1>&2
echo "Deleting existing uploads folder..." 1>&2
echo 1>&2
#delete folders
rm -Rf ${OPENSHIFT_REPO_DIR}public/uploads
rm -Rf ${OPENSHIFT_REPO_DIR}public/cards
echo 1>&2
echo "linking uploads folder..." 1>&2
echo 1>&2
#link upload folders
ln -sf ${OPENSHIFT_DATA_DIR}uploads ${OPENSHIFT_REPO_DIR}public
ln -sf ${OPENSHIFT_DATA_DIR}cards ${OPENSHIFT_REPO_DIR}public