Operations 7 min read

Automating Web Code Deployments with Git, Rsync, and Tornado

This article describes how a Linux operations team streamlined frequent web code releases by building a web‑based deployment system that combines Git for version control, Rsync for synchronization, and Python/Tornado for backend services, eliminating manual intervention and improving efficiency.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Automating Web Code Deployments with Git, Rsync, and Tornado

Daily Ops Issues

In daily operations, code releases—especially web updates—are the most common task, with fragmented and frequent deployment requests. When the team was small, a single engineer could push code via scripts, but as projects and developers multiplied, releases consumed most of the ops engineer's time.

Attempted Solutions

Restricting release frequency and scheduling non‑urgent updates helped little because urgent changes cannot be postponed, and scheduled releases hinder rapid iteration.

Final Approach

To avoid a passive workflow, a web‑based system was built that uses Git and Rsync to automate code publishing. The company’s codebase remains in SVN, but Git is employed for version tagging and rollback, while Rsync synchronizes files to other servers. Screenshots of the deployment system are shown below.

Open‑Source Technologies Used

rsync – synchronizes code to servers;

git – tags versions and enables rollback;

tornado – Python web framework providing backend services;

angularjs – front‑end MVC framework for browser‑backend interaction via JSON;

bootstrap – gives the ops‑written UI a professional look.

Code Release Workflow

1. Developers submit a code update with fields such as "update reason" and "SVN path".

2. The backend stores the request in a database and marks it as "waiting for pre‑release update".

3. A background process periodically checks for pending pre‑release updates, runs svn up on the given path, and marks the request as "pre‑release updated, awaiting testing".

4. Developers or testers verify the pre‑release environment; if issues remain, they modify the code, commit to SVN, and either click "return for modification" or "resubmit" to loop back to step 3 until tests pass.

5. After successful testing, developers click "test passed", moving the request to "awaiting approval".

6. The responsible person approves the release, changing the status to "approved, ready to execute" and granting developers release permission.

7. Developers click "publish code", setting the status to "execution pending".

8. The backend detects the "execution pending" status and runs Git commands:

git add .; git commit -m "update reason"; git tag <em>new_version</em>

, then pulls the changes to the production directory and finally executes an rsync command to sync the code to the production environment.

Rollback Workflow

1. In the web deployment system, select a released version and click "request rollback".

2. The responsible person reviews the rollback request.

3. Developers perform the rollback.

4. The backend finds the "awaiting rollback" record, checks out the specified tag (e.g., git checkout -b 18 18; git checkout 18) to create and switch to a branch for that version, then uses rsync to synchronize the code back to production, completing the version rollback.

Final Thoughts

Operations work can be dull or enjoyable; the key is to recognize repetitive tasks and automate them with well‑designed processes. Automation not only saves time but also enhances programming and problem‑solving skills, turning ops into a challenging and fun discipline.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

OperationsGittornadoDeployment AutomationrsyncAngularJS
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.