E
E
Egor2016-04-15 15:06:52
git
Egor, 2016-04-15 15:06:52

How to build a website with git?

There is a site on a normal hosting. If there are any edits and changes, then everything is uploaded via FTP immediately to the live site. Each time you make changes, you have to compile, for example, .styl files into .css, and then compress and upload them to the hosting. I would like to automate all these processes. I tried to read on this topic and made a few questions for which I have not yet found an answer for myself:
1. Came to such a scheme of work. The developer copies the sources from the repository to his local machine, edits something and sends the changes, let’s say, to a special test branch in git, from which the sources are then compiled and uploaded to the test version of the site. The older developer sees that everything is fine, the git test branch is copied to the master branch and the site is assembled from it and copied to the normal version of the site. Is this the right way to work?
2. As far as I understand, usually hosting may not be enough for such manipulations. Do I need to switch to some VPS / VDS solutions in this case?
3. The articles I found were either rather old or used different build tools. What are the best build tools to use now? The site is usually powered by php/js.
4. How to work with the database in this case?
I’ll make a reservation right away, I’m not familiar with this topic, maybe I misunderstood or explained something. And if possible, of course, please give a link to how this can be organized.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
D
dmitriy, 2016-04-15
@DarkSir

1. the right approach. gitflow to help you
2. usually the proxy server can do this. For example, codeship.io (100 deployments per month for free), you can install your own server (VPS / VDS) and configure Jenkins, TeamSity, PhpCI
3. there is phing that can automate routine operations (preparation, cleanup of directories, migrations, js-css min, etc. .d.)
4. through migrations, if there are none, there are third-party https://phinx.org , also in the orm kit there is a migration tool, for example, Propel2, there are migrations in the same phing

W
wwarlock, 2016-04-23
@wwarlock

If the server can be accessed via SSH (and most hosts do), then no intermediaries are needed.
Install git and it lives perfectly inside the home folder even.
That is, root rights are not needed to install the git.
Well, the git repository is also just a folder.
In principle, you can probably search and maybe there are ways to organize access to the repository via FTP.
By the way, as an option, you can map FTP as a network drive to the local machine.
Then you don't even need to install git on the remote machine, everything can be done on the local machine.
In any case, in Linux, this is done without problems.

A
Andrey, 2016-04-15
@AndreyMyagkov

Each time you make changes, you have to compile, for example, .styl files into .css, and then compress and upload them to the hosting. I would like to automate all these processes.

Use gulp to build the frontend

S
seregamorph, 2016-04-21
@seregamorph

Your question does not explicitly state how the collected sorts will be hosted (in the new scheme).
Just in case, I’ll clarify: if suddenly the deployment will be done using the git repository (there will be a clone of the repository on the hosting), do not forget in the server settings (apache, nginx, etc.) to prohibit access to the .git directory via http, otherwise you risk exposing something which should not be visible.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question