Replicate CentOS Server for Local Testing Server - centos

I have a CentOS 6.4 Server running ruby 1.9.3, ruby on rails, with nginx, Unicorn, postgras SQL
I would like to copy the WEBSERVER to a local machine to use for development purposes.
I have installed CentOS, ruby, rails, nginx, postgras SQL and unicorn on my local machine already..
is there a way to use SSH to copy filesystem? or some alternative
What i want to do is take my web-server... and pretty much duplicate the entire machine... MIRROR COPY that is fully functional independently... so i can modify and test new additions before i put it in production.

You say that you have already installed webserver (nginx) to both servers, since that what exactly are you trying to copy?
Surely you can use scp -r <src> <dest> in order to copy some folder from one peer to another or rsync -avz <src> <dest> if you're trying to synchronize the same directories on different approach.
Since you are using RHEL-like Linux distro, you can simply create image of your physical server and deploy it on the local machine as virtual machine. Use virt-p2v for that.

Related

Java web application: start coding from a remote git repo in a debian VPS server

I have a VPS server, the OS is debian.
I have a ssh access to the server.
In debian I have a src folder containing a git repo of a java web application. The path of the git repo is /src/myRepo.
I want to start coding with a java IDE (netbeans?). What do I have to do?
This problem usually has nothing to do with Git.
Basically the workflow is:
Work on your project locally, build test.
Deploy the resulting JAR files to the VPS.
Re-test they work as intended on the VPS.
That is, in order to support this workflow,
on your VPS you need:
A working JRE.
A working web server — if you don't intend to host your Java application
using something dedicated (like tomcat), otherwise you need that hosting
application installed and configured.
A working SSH server.

Upload and Deploy Golang application to VPS

I've made a Go app and when I run the exe locally it works fine. Where would I upload this to on my VPS? public_html/domain.com/somefolder ? or /usr/somefolder with SSH?
I have my app, my .exe and src-files, but what do I do with it when I deploy online on my VPS? I haven't been able to find a tutorial about this, so I hope you can help me.
do I upload all files in my src folder including the binaries from when I've written "go build"?
upload to where on my VPS? using ssh or cpanel / ftp program or what?
What are the steps from "go build" on your own local windows 8 computer to uploading and running it online on a linux server?
Ps.
Additionally will CentOS 5.1.1 although not supported https://golang.org/doc/install - allow for me to run an already linux compiled go program on my VPS, and does it only mean that I cannot install Go and do compilation on the CentOS 5.x server? Would CentOS 5.1.1 explain the "segmentation fault" error shh gives me when running the command "./[filename]"?
Well, usually, you would:
Copy the binary you created + all resource files (html, css, images, ...)
(optionally the source code as well)
Have a way to ensure the program keeps running
crontab can be used to check if your program is alive, but a simple monitoring program would suffice as well (which you can write yourself)
Run the binary as a non-privileged user
(you can also combine it with something like Docker if you want)
It does not make sense to put it inside public_html/domain.com/somefolder, as it is not public html code. You'd want your files somewhere they cannot be accessed unless using the application/binary you created.
My apologies for not having neat source links to my story. However, this does seem like the best thing to do.
Another important note:
Even though your VPS may run Windows, you can also deploy linux binaries to a Linux VPS (which are drastically cheaper) - looking at this SO question.
A short note I wrote on writing golang app on osx and deploying on Linux server: http://kumargaurav.co/2016/08/10/deploy-go-lang-app-linux-server/

how to install operating system on a virtual machine programatically

It may be a duplicate question but i could not find it anywhere.
Anyway, my goal to install operating system(both linux and windows) programatically on a virtual machine running on vmware hosts.
Although my search, I am quite lost about where to start.
Is there a framework or project you can suggest?
You could use templates; i.e. create a VM, install the Linux distribution of your choice and make the VM a template. Then don't create VMs but deploy the template.
Alternatively, google for the Linux distribution of your choice and something like "network installation". You'll need a DHCP server and probably a TFTP and/or web server.
Working with Templates and Clones
Creating VMware Virtual Machine Templates
Try having a look at Vagrant: http://www.vagrantup.com/. It allows you to install/uninstall a predefined VM from the command line.

What is the best way to sync your codefiles to your remote server?

currently I am maintaining a django web application and I am using rsync via ssh to sync between my files and edits, using www-data user.
Then I reload the apache server.
I have tried git but had many problems on pushing, initiating a bare git couldn't help either.
Apart from deleted files from the source, rsync does it's job quite good.
What do you use?
Using OS: Ubuntu 10.04 LTS x64 on both server and local
I use mercurial, it's really easy to get running locally and very easy to push changes between different "servers".
you don't say what O/S you're using. I'm using Windows with tortoiseHg. I also use the VisualHg add-in for Visual Studio
When it comes to sync files between machines, I use BitTorrent Sync. Works on every major platform and it is super easy to configure. It even works for mobile devices.
Check out http://www.bittorrent.com/sync

how do you build your appliances?

virtual machines hold great promise as a way to distribute hard to configure applications. i have been using jeos vmbuilder (and some bash scripts) to generate my appliances, but i'm looking for something more elegant.
in my case, i'm looking for a solution that will build a linux-based vm with configured versions of tomcat and mysql as a base. each future release would be a new war file and a sql update script. it'd be really nice if already deployed vms could self-update and test builds could be pushed to ec2.
in my brief search, i've found rpath rbuilder, turnkey linux,
vagrant up, suse studio, jeos vmbuilder, and vmware studio. rather than try all of these, i figure i'd ask what this community uses to build and distribute appliances...
I use pungi myself.