PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, September 28, 2022

[FIXED] When using CI, how can I keep my environments clean?

 September 28, 2022     continuous-deployment, continuous-integration, deployment     No comments   

Issue

We're currently using CI on a few small projects before we jump the gun with our larger projects.

The problem we're facing is that continuously deploying updates is causing our environments to be dirty. What I mean by dirty is that old files aren't being removed. After a while, it's not uncommon for us to notice that dozens of files are no longer being used. For example, for our Python projects, we notice that many of our pip packages located in our virtualenv are obsolete because we stopped using it.

Our current method is combating this issue is by nuking the folder where the application resides on the server and uploading the fresh artifacts created by our build server.

Is there an alternative way? I ask because obviously, creating a brand new environment every time we push adds a substantial amount of time for our deployment. I figure this is quite a common problem, which is why I'm a little surprised that I can find any literature with regards to this.


Solution

You can use rolling symlinks instead of nuking folders. the way this works is you create a directory for each feature that you run CI on . For ex lets say you have 2 folders F1 and F2 corresponding to your features.

If you want to run CI on F1 you will create a symlink that switches to F1. When you want to test F2, you need to switch the symlink to F2 and so on. This way you do not have to redeploy every piece of code. Most of the modern tools(java compiler, copy commands) already have a mechanism to not override artefacts if they are the same.

To improve your CI env, you can create all temporary artefacts in a temporary folder and clean them up once you are done with CI



Answered By - Biswajit_86
Answer Checked By - Clifford M. (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing