How can I automate Node.js deployments? - deployment

I'm looking for something analogous to Capistrano for Rails - https://github.com/capistrano/capistrano/wiki/
I'd like to be able to run a single command from my workstation that will update the code on my server(s) from a GitHub project and handle all necessary process restarting for the application. I need to be able to control specifically when this happens, not use a hook in GitHub's checkin event.
Are Node.js developers also using Capistrano, or is there a tool that works better for Node.js?

You could use fabric, it's a python lib. Nodejs already uses python for some build operations for extensions, no reason you couldn't also use python to do what you're asking.
http://docs.fabfile.org/en/1.2.2/index.html
I don't know of a javascript lib that does this, not to say there isn't one though. Fabric sounds very much like what capistrano is, but maybe a tiny bit different in some aspects.

Capistrano seems to be the most popular choice.

Related

Build RPM to deploy

I would like to know what is the best method to deploy applications like Django, Flask etc.. is by building RPM files or by using a tool like fabric which more or less does the same thing.. I'm trying to figure out the best approach to handle deployment and automation.
After considering the requirements I believe in my situation fabric will work best for basic deployments to multiple servers. While rpms can do similar things every time there is a change in source a new RPM must be created which for my environment will not work since the source code changes frequently. Any input from anyone is welcome. But I feel at least for me this will work best in the current situation.

Deploying Go App

I have a REST API endpoint written in Go and I am wondering what is the best way to deploy it. I know that using Google App Engine would probably make my life easier in terms of deployment. But, suppose that I want to deploy this on AWS. What options/process/procedures do I have. What are some of the best practices out there? Do I need to write my own task to build, SCP and run it?
One option that I am interested in trying is using Fabric to create deployment tasks.
Just got back from Mountain West DevOps today where we talked about this, a lot. (Not for Go specifically, but in general.)
To be concise, all I can say is: it depends.
For a simple application that doesn't receive high use, you might just manually spin up an instance, plop the binary onto it, run it, and then you're done. (You can cross-compile your Go binary if you're not developing on the production platform.)
For slightly more automation, you might write a Python script that uploads and runs the latest binary to an EC2 instance for you (using boto/ssh).
Even though Go programs are usually pretty safe (especially if you test), for more reliability, you might daemonize the binary (make it a service) so that it will run again if it crashes for some reason.
For even more autonomy, use a CI utility like Jenkins or Travis. These can be configured to run deployment scripts automatically when you commit code to a certain branch or apply tags.
For more powerful automation, you can take it up another notch and use tools like Packer or Chef. I'd start with Packer unless your needs are really intense. The Packer developer talked about it today and it looks simple and powerful. Chef serves several enterprises, but might be overkill for you.
Here's the short of it: the basic idea with Go programs is that you just need to copy the binary onto the production server and run it. It's that simple. How you automate that or do it reliably is up to you, depending on your needs and preferred workflow.
Further reading: http://www.reddit.com/r/golang/comments/1r0q79/pushing_and_building_code_to_production/ and specifically: https://medium.com/p/528af8ee1a58

Best way for deploying websites?

How do you deploy your websites?
For example: I am developing a site with a php framework and have it under version controle with git with all my local configs. When I want to put it on a web server for testing or updating the live application i have to copy it onto the server, change the config files, delete my test stuff etc.
So how do you handle these tasks?
I thought about using ant and write a deployment script for this.
Does there already exists a common solution for this "problem"? Because I don't think im the only one who need something like this.
There are quite a bunch of stuff available, but you might like Phing (like ANT for java).
Questions related to PHP+Phing:
Do you use Phing?
How do you manage your build [using Phing] process?
Setting up a deployment / build / CI cycle for PHP projects
what can Phing do that Ant can't?
Also read this questions sounds very interesting How To Deploy Your PHP Applications Correctly?
There is a specific question (a possible duplicate of your questions) has been answered a while ago, take a look at it Deploy a project using Git push
It seems you are using php, you should be good to go with capistrano. It is very easy to use capistrano for deployment with rails but it can also be tricked a bit to use for php.
Basically what you do with capistrano is -
Tell it which is you application server
Tell you database server
Tell web server (in most cases web server, app server and db server are same)
Specify you git repository with branch you want to deploy from
Once configured, you can deploy with capistrano with single command. You can even rollback your deployments from some of backup releases created by capistrano.
Now form some the repetitive tasks like, copying configs files like database configs (which generally are ignored in git), you create some tasks, which just creates symlinks or copies the files at appropriate location. These tasks will be called with deploy_hookes e.g. after_symlink hook.
You can find more about capistrano here - https://github.com/capistrano/capistrano/wiki
It comes with very good documentation, after getting overview, you may search for your framework specific approach to do this.

Could you use Nuget / OpenWrap to manage remote deployments?

I haven't thought this through to completion, but it seems that if nuget is a tool for managing the inclusion of packages in a known location, could it not be used as a deployment tool for web servers (a website being just a very large package itself)?
A service running on the web server would ping a nuget server for updates, and install them when available. There would have to be some additional management (recycling app pools, making sure that all your webservers don't update at the same time etc.), but I think it could work?
Any thoughts?
Yes that's definitly on the roadmap for openrasta/openwrap, so it's not a crazy idea. Some people already have done some of that work themselves.
This sort of thing is usually known as a Continuous Integration (CI for short) setup. You could probably cobble something together with Nuget but there are already some pretty good tools out there. Cruise and TFS to name a couple.
If you're looking for a mad scientist project though, carry on and let the community know what you come up with!

Best Practice: Erlang Application Deploy on windows

When deploying a ready to use erlang application I don't want the user to
Find the right erl release on the
internet.
Install the erl vm
unzip and decide a location for the beam files (with the application)
read a readme
modify anything that even looks like a config file
I have a couple of ideas of what could be a way but I would like to get some input.
SAE (stand-alone Erlang) used to be a pretty good solution for situations like you describe, but that no longer seems to be maintained.
Although I've never used it myself, CEAN seems like it might come close to what you want: it offers a self-extracting installer (though not for Windows at present) and the option to deliver a customized minimal Erlang framework.
There is also Erlware.
At our core we host public
repositories containing reliable
Erlang OTP-compliant applications. Our
repositories enable developers to use
software written by the Erlang
community and to publish and
distribute their own software.
It's more backend orient though, so not a complete solution.
The reltool application first released with Erlang R13B02 is aimed at solving this issue. Note that it is currently a beta release (version 0.5).