Home > Enterprise >  Separate environments for learning or trying out vs production (sandboxes?)
Separate environments for learning or trying out vs production (sandboxes?)

Time:12-23

Can you suggest me a way of separating learning/trying out vs production in the same computer? I am in such a place that I know a lot of JS and production ready skills whilst sometimes require probing or trying out simpler stuff or basics. I presume that a lot of engineers are also in a similar place.

This is the situation I am facing with right now.

  • I wanted to install redis and configure it while trying out something interested.
  • In a separate project I needed another clean redis configuration and installation.
  • In front-end side I tried and installed a few npm packages globally.
  • At some point I installed python 3.4 now require 3.6
  • At some point I installed nginx and configured it, now need another configuration and wipe the previous one out,
  • If I start a big project right now I feel like my computer will eventually let me down due to several attempts I previously done

et cetera, these all create friction on both my learning and exploration

Now, it crosses mind to use separate virtual box installations for trying out things, but this answer is trivial, please suggest something else.

P.S.: I am using Linux Mint.

CodePudding user response:

You can install and use Docker, which is also trivial, however, if your environment is Linux you can use LXC

CodePudding user response:

There isn't really a single good answer to this sort of question of course; but some things that are generally a good idea are:

  1. use git repos to keep the source "backed up" (obviously your local pc should not be the git server); commit your changes all the time, if you can't hold your breath for as long as the timespan between 2 commits, then you're doing it wrong (or you may have asthma, see a doctor).

  2. Always build your project with there being not just multiple, but a variable amount of "deployments" in mind. That means not hardcoding absolute paths and database names/ports/hostnames and things like that. If your project needs database/api credentials then that should be in a configfile of sorts (or in the env); that configfile should be stored outside the codebase and shouldn't be checked into your git repos (though there can ofcourse be a config template in there).

  3. Always have at least 2 deployments of any project actually deployed. Next to the (obvious) "live"/"production" deployment, which your clients/users use, you want a "dev"-version for yourself where you can freely shit the bed, and for bigger projects you may well want multiple. Each deployment would have its own database, and it's own copy of the code/assets.

  4. It can be useful to deploy everything inside podman or docker containers, that makes it easier to have a near-identical system in both development and production (incase those are different servers), but that may be too much overhead for you.

  5. Have a method (maybe a script) that makes it very easy to deploy updates from your gitrepo or dev-deployment, to the production deployment. Based on your description, i'm guessing if a client tells you she wants some minor cosmetic changes done, you do them straight on the live version; very convenient and fast, but a horrible thing in practice. once you switch from that workflow to having a seperate dev-deploy, you'll feel slowed down by that (which you are), but if you optimize that workflow over time you'll get to the point where you could still deploy cosmetic changes in a minute orso, while having fully separated deployments, it is worth the time investment.

  6. Have a personal devtools git repo or something similar. You're likely using an IDE such as VS code ? Back up your vs code user config in that repo, update it reasonably frequently. Use a texteditor, photoshop/editor, etc etc, same deal. You hear that ticking sound ? that's the bomb that's been placed on your motherboard. It might go off tonight, it might not go off for years, but you never know, always expect it could be today or tomorrow, so have stuff backed up externally and/or on offline media.


There's a lot more but those are some of the basics that spring to mind.

  • Related