How to deploy without changing the contents of a folder on the server?

Asked

Viewed 228 times

3

I’m new to the Nodejs and Git world, I’m trying to develop from a system where users upload images.

Every time I do deploy from the app, users pictures are deleted from folder public/uploads/

How should I proceed so that people’s files are not deleted in this case? I tried using . gitignore in uploads folder, but it didn’t help.

I thought of hosting the images on a server separate from the server where the app is, but only if there is no other way.

I need a way to keep the folder public/uploads/ without being changed when making any deploy.

Note: The site is in Nodejs. The deploy is done using Git on the Openshift server.

  • Are you recording the images inside your application directory? Of course, if you deploy them they will disappear because you are overwriting. To solve, try using a directory outside your application, for example: /var/uploads, etc....

  • OK, solved! In Openshift, there is a space for file storage /app-root/data/ . You can access it via sftp by Filezilla. http://stackoverflow.com/questions/23150714/upload-file-on-openshift Valeu, Wakim; Caputo!

  • 1

    This information is very interesting. It could include an answer and accept it, so that others who come through this question know this solution.

  • Did you find a solution? Poste as an answer to help other people.

1 answer

1

The upload folder should be removed from the repository and inserted into . gitignore (git ignore does not work if the file is already in the repository)

public/uploads/*    

After removing vc creates an empty file (I usually call it Empty). This file must be forcefully inserted into the repository.

git add -f public/uploads/empty    

With this only this file in the sera trackeado folder. git will create the folder but will not touch the files on the server.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.