How should you Develop your project?

This is a suggested approach that uses the advantages of multiple branching to assign it to the multi-stage development process, combining the advantages they offer.

Multi-branching

1

  • Master - contains production code. All development code is merged into master when it is ready.
  • Staging - this branch contains pre-production or development code, when the features are finished then they are merged here.

During the development cycle, a variety of supporting branches are used:

  • Feature-* - feature branches are used to develop new features for the upcoming releases.
  • Hotfix-* - hotfix branches are necessary to act immediately upon an undesired status of master or staging.

Some advantages of this approach are:

  • Better coordinating of development phase
  • The feature teams know that what they are working on does not affect the other feature teams until the new feature is integrated
  • No one works on the Main or master branch. All development is done in a staging or feature branches.
  • Easy versioning or tagging
  • Easy rollback

Development Phases

2

Using the previous multi-branch scheme, it can be used to separate it into local, staging and production environments as it can be seen in the previous image

Multi-branching for Multi-stage

Features and hotfixes branches for local environment

  • Easier work with and fixing problems

Staging branch for testing on the cloud before production

  • Safer coding practices
  • It enables you to test any changes or major new features that you plan to implement in a secure environment
  • Provide you with the opportunity to catch errors and bugs without putting your site at risk
  • Give you privacy to build and update websites without a bunch of prying eyes checking in on you
  • Staging sites save time you would otherwise spend repairing errors and bugs in a live production environment

Master branch for production

  • This is the version of your website that users will see, any code that reaches this point should have already gone through the previous stages of local and staging, greatly reducing the possibility of deploying errors or bugs to the production environment. If you’ve been careful throughout the development process, this iteration of your site should be bug-free and provide a flawless user experience.

Local Environment

3

  • In this environment you work with Docker or Vagrant since these tools allow us to keep our system clean for longer
  • All the code tested in this environment is pushed to the feature or hotfix branches
  • Easy and fast error fixing as it is tested in a local environment where it is not necessary to upload and deploy the code to the cloud to see the changes

Staging Environment

4

  • Pipelining to test and deploy in the cloud in a production-like environment
  • Fix problems so they don't production environment
  • Optional -> DB in a Docker container (the cheapest)

Production Environment

5

  • The code that reached this point must have gone through the previous stages, greatly reducing the chances of errors at this stage
  • Reduce downtime for services
  • DB in an RDS instance with all of its advantages

References

4 branching workflows for Git
The Benefits of Using Staging Environments in WordPress Development
What Is A Staging Site?