Synchronization of the production and development environment

I have a web application on my computer and on a web server with ssh. The problem is that I am developing the application locally on my computer, and I want to synchronize it with the server without copying files via ftp. Is there any other way? git?

+3
source share
5 answers

You do not indicate which operating systems or languages ​​are involved, so this makes it difficult for a particular job.

Git (and SVN and Mercurial, etc.) is great for version control, but system synchronization often requires more than version control. If you are a person like Python, you might like to read Modern Python Hacker Tools: Virtualenv, Fabric, and Pip . This suggests that synchronization is not only the code, but also your entire environment.

For simple file storage on two systems in sync, I recommend rsync . I use this for all kinds of tasks, both on the same machine, and for backup / synchronization of directories between machines. We have a client in SoCal, where we make a three-level backup strategy (2 on the site, 1 outside the site) from more than 5 terabytes of data, and it is based on rsync and rsnapshot .

:

, , , . . . virtualenv Python .., Ruby/Rails, , - . , , , , .

: - . . , 100% , , dev, . , , , , 500 .

+8

.

script .

, , , script, script.

, // .

+3

git .

- (a. tar.gz, ), , (, ), ssh/scp.

. , , , ..

+2

Capistrano, Rails, , - ( ).

:

  • .
  • (git/mercurial/svn/whatever)
  • cap deploy .

3 - , , , . Capistrano , "release" ( - 20091028230834, ) , , current . , . :

...deploy-to-path/current  ->  ./releases/20091028230834
...deploy-to-path/releases/
    20091028230834/
    20091028225623/
    ...    # You can configure the number of releases kept after deployment.
...deploy-to-path/shared/
    cached-copy/  # A cached copy of your repository, which Capistrano updates
    ...           # Any shared data, like file uploads, for your application.

Capistrano . , - . , , , (deploy.rb) :

  • ? (, www.example.com)
  • ssh? (, )
  • ? ( URL- )
  • ?

, capify ( ) ( ), , . , / .

+2

, ... , .

As already mentioned, you can use git to synchronize the code. When you have a new set of changes that you think are ready, they can go to the branch or at least tag them so that you know what changes were brought together.

Then you can synchronize these changes with the staging directory and flip the switch if thins were checked there.

0
source

Source: https://habr.com/ru/post/1726183/


All Articles