skip to Main Content

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.

3

Answers


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

    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
  3. I though Docker was only for containerizing your app with all the installation files and configurations before pushing to the production

    Docker is useful whenever you need to configure the runtime environment in an isolated manner. Production, local development, other environments – all need the same runtime. All benefit from the runtime definition and isolation that docker provides. Arguably docker is even more useful in workstation-centric development, than it is in production.

    I wanted to install redis and configure it while trying out something interested.

    Instead of installing redis on your os directly, run the preexisting docker image for redis.

    In a separate project I needed another clean redis configuration and installation.

    Instantiate the docker image again and now you have 2 isolated redis servers running locally.

    In front-end side I tried and installed a few npm packages globally.

    Run your npm code within a nodejs docker container

    At some point I installed python 3.4 now require 3.6

    Different versions of python is a great use case for docker containers, which will tagged with specific python versions.

    At some point I installed nginx and configured it, now need another configuration and wipe the previous one out,

    Nginx also has a very useful official container.

    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

    Yeah, it gets messy quick. That’s why docker is such a great solution. Give every project dedicated services and use docker-compose to simplify the networking and building components. Fight the temptation to use a docker container for more than one service – instead stitch them together with docker networks.

    Read https://docs.docker.com/get-started/overview/ to get started with docker.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search