I'm trying to learn how to use Vagrant with the idea of setting up a development environment that should be exactly (if possible) to an already existing production server.
The question here is: what is the easiest way to accomplish that?
I'm a developer and I have full access to the production server, but it's not managed by me. I just know my way around the server a bit to set up websites, work with cPanel, some WHM, etc...
The server runs CentOS 6.5 with Apache, MySQL and PHP.
Is there a way I can "export" that server's configuration with all the applications it has, modules, versions, etc... and use that to create a Vagrant Box? Or is it a matter of manually analyzing everything and writing it down?
If the way to go is the second option, can I get any advice on how to do that without missing anything?
I don't think there is a direct way to export an existing server configuration into a Vagrant box, which essentially, requires you to clone the server into a VM format supported by one of Vagrant's providers (such as an OVA
file for Virtualbox).
AFAIK, you may have to do this manually unfortunately. The way I will go about it (at least at the application level) is:
conf/httpd.conf
, conf/extra
and modules
(I think these are the major ones), and import them into the apache server in your Vagrant box.--no-data
option to exclude data export if your production database is too big for your development needs. (Table 4.9 on that link I shared provides a comprehensive list of options.)As mentioned, these are only application-level set-ups and configurations. There are probably other configurations in your production server related to firewalls, SSH keys, user permissions etc. which you may or may not need to duplicate in your development environment.
Hope this helps.