Update the local debian packages using ansible - node.js

I am trying to come up with a deployment strategy in developer environments using Ansible.
I have a few builds (node.js) coming out every day usually in the form of debian packages.
Eg: my_product_1.0.0_33.deb is the corresponding debian for build#33.
I am trying to automate the deployment on existing as well as new environments using Ansible. So what is the preferred way of updating the build packages using Ansible?
Eg: my_product_1.0.0_44.deb is my new build with build id #44 which I want to install on top of the existing build.
I am going through the Ansible documentation and below mentioned is the way I think will work for now.
Check if any package of "my_product" is installed and if not installed, install the latest debian.
If yes, check if the right build id of my_product is installed
If yes, don't restart the service and leave as is
If no, uninstall the existing package, install the new build debian and restart the service.
Is this the preferred approach of updating the debian packages in an environment or is there a better way to do this in Ansible?
The debian packages I receive are not hosted in any repository and are local .deb files.

Is this the preferred approach of updating the debian packages in an
environment or is there a better way to do this in Ansible?
This is a reasonably common approach. It could be simplified a bit by hosting your debs on an internal repo, but that's not necessary.
In general, you don't need to do things like "check if a package is installed and if not, install the latest version". You just specify the package name to the apt module and it handles the conditional logic for you.
For restarting the service if a new version has been deployed, look into handlers.

Related

Using container for Linux applications?

I am experimenting with multiple versions of QEMU.
This involves downloading different versions and variants of source code, and running the usual: configure, make and make install.
The problem is I can't install multiple versions simultaneously because they use the same install script. I need to uninstall (make uninstall) before I install another one. This only works if I have kept the makefile of the installed binaries.
I think what I would like to do is something similar to Python's virtualenv. A standalone Linux user(?) environment for each application that I can easily remove.
Is there such a thing? Or is my approach completely flawed?
I think the best approach for such cases is docker container. Docker is a container-based virtualization technology, In which you can build your customized Linux-based environment and host your application inside it. thereafter, that means, you have containerized your application and its ready to be distributed and run easily.

Git/Egit configs

I am trying to migrate to git and would like to stay inside my familiar IDE (Eclipse), and apparently Egit is the plugin to use.
A few questions:
Does Egit require git? Meaning, do I need to first install git on my machine, prior to installing the Egit plugin?; and
If the answer to #1 above is "yes", and I do need to first install git, then after I install git, are there any system-level configurations, or git commands (to be ran from the shell) that I need to perform before I install Egit? Note I do plan on using a private repo on GitHub which I believe uses SSL keys...if that changes the answer to this question at all...
Also I'm on Ubuntu Desktop 12.04 - just fyi in case there are linux-specific settings, etc.
Thanks in advance!
No, EGit does not require Git as it is based JGit, which is a pure Java implementation of Git.

Linux standalone 'installation' of Postgresql

For easy deployment, I'd like to ship an installation of Postgres as part of the application. Is it possible to include an already compiled and runnable version of Postgres that can be launched as process? I was able to do such thing with a Windows and MacOS version, but haven't found anything about Linux on that matter yet. Perhaps someone has tried this before and can share some insights...
You haven't stated what linux OS you're using.
Assuming it's a Redhat variant why not package your application as an RPM package? You could then declare a dependency on the standard Postgres package which would be automatically installed yum. Same principle applies if you're using Debian based systems, just a different packaging format.
From the user's perspective the OS's native packaging format is always the easiest way to install your application. Just requires effort to package it properly.
You can find cross-platform binaries from these pages on PostgreSQL official website:
For easy GUI .run installers, use links provided at http://www.enterprisedb.com/products-services-training/pgdownload.
If your target machine has no X installed on it, or you want to automate installation process with shell scripts, then you can download RPM or Deb packages from http://community.openscg.com/se/postgresql/packages.jsp
I found these links on http://www.postgresql.org/download/linux/ubuntu/, under "Cross distribution packages" and "Graphical installer".
I quote from those pages:
Note: The cross distribution packages do not fully integrate with the platform-specific packaging systems.
You must have root priviliges to install these packages, however, none of your systems library files will be altered. The supporting libraries that these binaries require are included locally as part of the install. This is the "special sauce" that allows identical binaries to run on different linux distro's.

Port a debian package to YUM for CentOS

I have a project that runs on Debian and uses many packages provided from the Debian repositories.
Because of demand, I've looked into porting the project to CentOS, but found that many of the packages I require are completely missing - at least 10 dependencies would have to be compiled manually at install time on the users machine.
My question is, what is the best way to create an installer for the user's machine? Should I use automake tools (with the standard ./configure, make, make install), to compile the required libraries, or is this a non-standard approach. Note that my app doesn't actually need to be compiled since it is written in Python, so is it weird to do a "make", when you're not compiling your own app?
Should the configure script just warn the user that package X is missing, and let them handle the rest?
Should I roll my own dependency checker by runng pkg-config manually a few times for each library required, and exit if something is missing?
I'm quite new to this, so any tips to get me moving in the right direction are appreciated.
Edit: I am familiar with RPM and yum for red hat base distros, but CentOS is missing many multimedia packages that I require. An example of one of my package dependencies is "liquidsoap" which is a programmable audio engine: http://savonet.sourceforge.net/
This is available on Debian, but not Redhat/Centos
See this link on CentOS package management.
http://wiki.centos.org/PackageManagement/Yum
CentOS is redhat based and does not use .deb packages by default. However apt package management has been ported to tons of platforms, you may be able to use a port for centOS
If you use YUM whatever packages you need will be there for your application as redhat distros need all the same things that any other distro does.
EDIT: To get the details out of comments
Packages not available on the target platform either have to be built (possibly as a port) on the target platform and then shipped in the ported package (in this case YUM), or code needs to be modified and forked to use packages which already are available on the target platform. The choice depends on which is worse, or which is even possible given your constraints.

Centralized Installer

I am looking for an installer for my product. My requirement is that from one Node (Physical Machine) I should be able to install the software on multiple machines (Node). My product is a HA platform that needs to be installed on multiple Linux machines to form a cluster. Is there any installers that can do this free or paid. Currently we are developing on Linux, going forward we may need to support other Unix type OS.
Thanking you in advance
Package your product appropriately for the distribution (e.g. deb package) and use the standard management tools for the platform. Many simplicity-oriented people use
for node in $nodes; do ssh $node sudo apt-get install $package; done
and there is a host of cluster management software out there, one of which you are probably using.
I don't know if there is an "installer" the way you use in Windows machines. However you can create packages depending on your system. For Debian like systems you can create .deb packages, and for Red Hat style you can create .rpm packages.
The way the packages are created is to specify a correct installation path for files and pre-install & post-install scripts to execute when you install the files. Also you can set dependencies on your package, so that if you require some important library, the deb/rpm installer won't install your package until the required library is installed.
Hope that makes sense with my broken English:)

Resources