Question

I want to deploy a Magento application with Capistrano 3. Let's say I would use this gitignore file. Since these files are not in the repository, they won't be copied to the remote server. But the first time I deploy the application it should copy these files. What is the best way to achieve this? Should I upload the files to the remote server manually the first time? Should I use another .gitignore and include the files in the repository? Or is there a better way?

Was it helpful?

Solution

Disclaimer: I am not familiar with Magento at all.

For everyting that has to be run once before the first deployment on each server use deploy:setup (see docs).

The problem in your case is, that capistrano will per default create a new directory each time you deploy and link it as current. Thus even when you copy the files for the first deploy, the second deploy will use another folder.

I see two approaches:

  1. Copy the files in question on every deploy
  2. Use the shared folder that capistrano creates and upload your files there only once (during setup) and on later deploys copy or link the files/folders accordingly

Generally you should reconsider your project structure. Maybe it would be a good thing to don't put all those files on gitignore, since they seem to be an integral part of your project. Generally I only put things on gitignore that are:

  1. Reproducable (e.g. compiled assets)
  2. Temporary (cache, etc.)
  3. Sensitive (config files containing passwords)
  4. Local (e.g. configs or the like, that are specific on every machine)

So in your case it seems you got some libraries and stuff like that on .gitignore and I guess without those your project would not work. Thus I would either add them to the repo or consider adding them as submodules, if they are larger and subject to changes by a third party.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top