How does deployment to remote servers work?

I am a little new to version control and deployment environments , and I focused on my training on this issue: how deployment environments work if developers cannot work on the same local computer and are always forced to work on a remote server ?

How to set up the deployment environment flow in accordance with best practices?

In this example, I looked at three deployment environments: development , production, and production ; and three storage environments: local , server repository, and destination server .

This is the flowchart I came across, but I have no idea if this is correct or how to implement it correctly:

deployment version control block diagram

PS. I thought that test tests on the server might have limited access via login or ip check, if you're interested.

+8
version-control webserver web deployment web-development-server
source share
1 answer

I can give you (in my experience) good and honest practice, this is not the only approach, since there is no unique standard on how to work with all projects:

  • Use a distributed version control system (e.g. git / github):

    • Make a private / public repository to handle your project
  • local Development:

    • Developers will associate the project with your repo and contribute to this, it is recommended that each of them work in a branch and create a new branch for each new function.
    • Your team has one responsible for merging branches that are ready with the master branch
    • I highly recommend working with a virtual machine during development:
      • To isolate the development environment from the host machine and deal with dependencies
      • To have a virtual machine ID on a remote production server
      • Easy reset, delete, play
      • ...
      • I suggest using VirtualBox for the virtual machine provider and Vagrant to provide
      • I suggest that your project folder be a shared folder between your host and your virtual machine, so you will write your source codes on your OS using your favorite editor and at the same time this code exists and runs inside your virtual machine, this is not surprising amazing ?!
    • If you work with python , I also highly recommend using virtual environments (e.g. virtualenv or anaconda ) to isolate and manage internal dependencies
    • Then, each developer after writing some source code can make and push their changes in the repository
    • I suggest using project automation customization tools such as ( fabric / fabtools for python):
      • Creating a script or something that with one click of a mouse or with some commands reproduces the entire environment and all the dependencies and everything necessary to start the project, so all the developers of the backend, frontend, designers ... no it is important to know their knowledge, as well as the types of their host machines that can make the project work very simply. I also suggest doing the same on remote servers, either manually or using tools such as (fabric / fabtools). In secript, os dependencies will be mainly installed, then project dependencies, then cloning the project repo from your Virsion Control, and for To do this, you need to provide access to the remote server repository (testing, intermediate and production): add the public ssh keys of each server to the keys in your version control system (or use agent forwarding with fabric )
  • Remote servers:

    • You will need at least a production server that will make your project accessible to end users.
    • it is recommended that you also have test and intermediate level servers (I assume that you know the purpose of each of them).
  • Deployment flow: locally-repo-remote server, how does it work ?:

    • Grant access to the repository of remote servers (testing, intermediate and production): add the public ssh keys of each server to the keys in your version control system (or redirecting the user agent using fabric )
    • Developer writes code on his machine
    • In the end, it writes the tests for its code and runs them locally (and on the testing server).
    • The developer commits and pushes his code to the branch that he uses into the remote repository
    • Deployment:

      5.1 If you want to expand the function branch for testing or statement:

      • ssh access to the server, and then cd to the project folder (cloned from the repo manually or through a script machine)
      • git checkout <the branch used>
      • git pull origin <the branch used>

      5.2 If you want to deploy production:

      • Make a pull request and after the request for receipt has been verified by the manager and combined with the master branch
      • ssh access to the server, and then cd to the project folder (manual cloning from the repo or script automation)
      • git checkout master # is not required, it should always be on the main
      • git pull origin master
        • I suggest writing a script like with fabric / fabtools or using tools like Jenkins to automate the deployment task. Howl! Deployment done!

Thi is a slightly simplified approach; there are still many other recommended and best prefix tools and tasks.

+4
source share

All Articles