V
V
Vit2014-01-24 19:29:20
PHP
Vit, 2014-01-24 19:29:20

What is the best way to store a project in VCS and deploy it?

Hello.
I love deploying/updating projects on production servers using source control (now mainly SVN, future projects are planned on GIT).
Previously, I almost never stored any used third-party libraries or frameworks in VCS: I installed them globally for the entire system via PEAR on the server during the initial deployment or downloaded them manually. And now I'm looking at composer, I like it, but it installs the libraries directly into the project folder. And so I asked myself: is it more correct to store these libraries in VCS too, or is it better to ignore the entire vendor folder, and if necessary, do a composer install?
In addition: often some of the libraries installed via composer are not needed in production: all sorts of PHPUnit and Codeception. They are only for developers. Is it worth it or not to store them in VCS and upload them to production along with the rest of the code?
And even some libraries that are needed for the application to work carry unnecessary files with them: tests, demos, etc. I also somehow don’t want to clog the repository and production server with them.
I had an idea that from the full version for development, you can use some script or phing to remove files that are unnecessary in production and store the remaining necessary code in another branch or another repository and deploy from it. But again, I'm not sure if this is correct.
Of course, I don’t feel sorry, you can store everything in the repository and upload it to production. But for some reason it seems to me that this is not quite true. I want to know how others do it and why.
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
sajgak, 2014-01-24
@sajgak

1. I don’t know how it is in puff, node npm has dependances and dev-dependances, respectively, when deploying, only production dependencies are pulled and only the sources themselves are stored in the turnip
2. the project build in production is slightly larger than the standard Internet. store - usually more complicated than svn up / switch, it is, at a minimum, editing configs (you don't store passwords to the database in the turnip? :)), building the client code css / js, etc. For such things, there are a bunch of all kinds of stray, I advise you to use www.rexify.org a bit of a real pearl, a week of writing a config and deploy is done with one button

D
Dmitry, 2014-01-24
@dmkuznetsov

composer has a require-dev option . Perhaps this is what you need.
In general, who does what. Someone saves resources and pumps out all dependencies during installation. And someone thinks about the integrity of the project and does not want to depend on the availability of external resources, so they store everything in one repository.

A
Artur Smirnov, 2014-01-26
@artursmirnov

Look towards Grunt . With it, you can describe the 'deploy' task, for example, which will perform all the necessary actions - pull the necessary dependencies, change configs, collect JS/CSS, distribute it to servers, etc. The task itself can be run manually via the command line, it can be passed to it
. Accordingly, you can hook the task to a GIT event (for example, to merge into the master).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question