DEV Community

Claudio Fior
Claudio Fior

Posted on

Deploy changes of a php legacy application

The fuss

I am the mantainer of an 11 years old php application. It's a monolithic application, it has only 5 classes but it works. It was built using mysql 5 and php 5.3, now it keeps working with mariadb 10 and php 7.4.

Static code analisys

The most used tools to maintain and add new functionalities are:

  • git to trace changes in the code;
  • robot framework, to create test cases of the functionalities of the web application;
  • postman to test web servicies and api;
  • phpstorm and phpstan that provides a lot of suggestions to avoid deprecated functionalities and increase code readability;
  • sonarqube to trace the changes on code quality over time and find ugly pieces of code and forgotten parts.

Deploy the changes

At the moment the code deploy was made manually, comparing the code base with Beyond compare. Today I have tried a new way using git.

I have copied the .git folder in stage and production environment and keep only the stage and main branches in each of the two environments.

Every change is a new branch, when I have to publish the change i merge the branch with stage or main branch.

In the server I run

git fetch # Get the changes
git merge # Merge the changes
Enter fullscreen mode Exit fullscreen mode

If there are some discrepancies in some script the last command shows a list of files not aligned.

I can restore the files with the command

git restore <<file_name>>
Enter fullscreen mode Exit fullscreen mode

It works, but I have fear to create a complete mess.
Any suggestion of an alternative strategy?

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay