0

i am a full stack developer for the web. as a part of my job sometimes i need to manage development and production servers.

i want to keep production and development servers as exactly same as possible in packages and configuration.

so basically, i want to have exact copy of old server whenever i need.

i don't want to use disk images because i can't transfer disk images between cloud providers. (sometimes i need it)

to achieve me needs, i'm using a shell script that installs specific versions of the packages. example:

aptitude install -y apache2=2.4.18-2ubuntu3.1
aptitude install -y libapache2-mod-ruid2=0.9.8-3
... and so on

So i wonder...

  • is this a good approach?
  • is there any better solution?
  • how long a specific version of a package hosted in repositories?
3
  • 11
    Look into provisioning and managing servers with tools like Ansible, Chef, Puppet, Salt Stack, or similar. This is the correct way to go about this.
    – R. S.
    Oct 16, 2016 at 22:41
  • 2
    @kormoc is absolutely right. Google "configuration management system".
    – ceejayoz
    Oct 16, 2016 at 22:54
  • 1
    just googled and wow. i couldn't find the right word despite my long research. my bad! thanks. @kormoc
    – Yarimadam
    Oct 17, 2016 at 8:19

1 Answer 1

1

The answer to your question in the way you wrote it was given by @kormoc. But you tagged it with docker and although your question directly doesn't involve docker I will give the docker approach to this problem:

What you want is to have the same environment from dev to production, not to have the same packages this is only one way to resolve the problem.

Docker allows you pack your application with everything you need to run despite what is installed on your server.

You write in your Dockerfile every package you need:

FROM ubuntu:trusty
RUN aptitude install -y apache2=2.4.18-2ubuntu3.1
RUN aptitude install -y libapache2-mod-ruid2=0.9.8-3

... and so on

Then you create an image from it and run this image in the server you want. The only requirement is to have docker installed.

Regards

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .