Tag Archives: python

OpenShift Cookbook by Packt Publishing

Author: Shekhar Gulati
Publisher: Packt Pubblications
URL: https://www.packtpub.com/virtualization-and-cloud/openshift-cookbook
GitHub: https://github.com/OpenShift-Cookbook

On Amazon: http://www.amazon.com/OpenShift-Cookbook-Shekhar-Gulati/dp/1783981202/

This great book lets you, with a very little effort, to understand the OpenShift technology. You don’t need a strong background on virtualization and container technologies, but at the same time it does not get bored a skilled user.

The overview on the OpenShift technology and its utilities (rhc) is very clear and easy to follow, also thanks to the OpenShift free profile which allows you to test and play with the rhc command while you go through with the book reading. More complex tasks like backups, snapshots, rollbacks are addressed and explained. Also the security aspects are taken into account.

Several real-world examples, with end-to-end receipts, are showed in the book: MySQL, PostgreSQL, MongoDB for database apps, Python, Java, Node.js for web oriented development.

A chapter is dedicated on how to use Jenkins CI as a Continuous Integration system for OpenShift apps; this is an aspect which is most of the times not took into account, but it’s very important nowadays.

I would consider as the “core” of the book the chapter on scaling OpenShift applications, which is a salient characteristic of OpenShift and it is not always an easy task to solve.

In conclusion a must have book if you want to start and play with OpenShift, even if you are a beginner or if you are not but you don’t have familiarity with complex and scalable application deployment.

All the code mentioned in the book is available on their GitHub repo: https://github.com/OpenShift-Cookbook.

WebVirtMgr with LXC support

This is the connections page backported from WebVirtMgr 4.8.7

https://github.com/daniviga/webvirtmgr/

WebVirtMgr (by retspen) is a simple but great libvirt frontend written in python with Django. It currently supports only KVM as hypervisor. However libvirt can be already used to manage other hypervisors (like XEN) and it also supports LXC containers.

Using the container libvirt feature I extended WebVirtMgr, creating a fork, which adds LXC support and other minor improvements (see https://github.com/daniviga/webvirtmgr/commits/master)

LXC support currently has some limitations:

  • The LXC container filesystem must be created manually (this is a libvirt limitation)
  • Even the LXC domain creation isn’t supported right now (you need to create the XML and define the domain manually, virt-install can be used)
  • Web remote console is under development and not yet ready (some work has been made using butterfly)
  • LXC domain deletion doesn’t remove its filesystem
  • Snapshotting is not supported (another libvirt limitation, it can be done manually with LVM or Btrfs)

But basic functions works well:

  • Management of remote hosts (via TCP, SSH, TLS, socket)
  • Start, stop, shutdown, pause
  • Autostart
  • CPU and RAM limits assignment
  • Network interfaces management
  • Clone (only the domain, filesystem must be copied manually)

My WebVirtMgr fork contains also some minor differences and improvements compared to the original:

  • The old connections list page (with a table instead of boxes) has been kept
  • It supports a very basic ACLs system (for both KVM and LXC). With this feature non-admin users can be created (using the django-admin interface) that can only have specific access to a pre-defined set of VMs/LXCs. This means that user “foo“, for example, can only start/stop/shutdown or access the remote console of the VM “my_vm

The installation procedure remains the same as the original project.

Screenshots

This is the connections page backported from WebVirtMgr 4.8.7

This is the connections page backported from WebVirtMgr 4.8.7

KVM instances

The KVM instances view

The LXC instances view

The LXC instances view

An example of a running LXC container

An example of a running LXC container

An LXC domain can be cloned, and a random MAC address can be generated

An LXC domain can be cloned, and a random MAC address can be generated

An example of an LXC deletion

An example of an LXC deletion

Instance admin interface: you can assign users

Instance admin interface: you can assign users

 Links

Installing ObsPy on Fedora 18

obspy-logo

ObsPy is an open-source project dedicated to provide a Python framework for processing seismological data. It provides parsers for common file formats, clients to access data centers and seismological signal processing routines which allow the manipulation of seismological time series (see Beyreuther et al. 2010, Megies et al. 2011).

The goal of the ObsPy project is to facilitate rapid application development for seismology.

https://github.com/obspy/obspy/wiki

ObsPy packages are available only for Debian/Ubuntu, however is possible to install it on Fedora via Python Package Index (PyPI). Not all deps are explained on ObsPy wiki pages so here is the complete procedure to install the software on Fedora 18:

First set up all the dependencies via yum

[root@sam ~]# yum install -y python-devel python-setuptools numpy scipy python-matplotlib python-matplotlib python-matplotlib gcc-gfortran python-suds python-sqlalchemy python-lxml

Now you can install ObsPy as explained in theirs wiki (https://github.com/obspy/obspy/wiki/Installation-on-Linux-via-PyPI)

[root@sam ~]# easy_install -U distribute; easy_install -N obspy

To test if the installation was successful use obspy-runtests

[daniele@sam ~]$ obspy-runtests
................................................................................................................................................................................................s.....................................................
[...]
----------------------------------------------------------------------
Ran 839 tests in 65.348s
 
OK

That’s all.

References:

 

 

Install Arista Transcoder on Fedora 18

aristaArista Transcoder (http://www.transcoder.org/) is a useful transcoder tool build upon Python and GStreamer. It’s not available in Fedora yum repositories, but the installation from source is quite easy.

Let’s go.

First: download the sources from its website and untar them

[daniele@sam ~]wget http://programmer-art.org/media/releases/arista-transcoder/arista-0.9.7.tar.gz; tar xzvf arista-0.9.7.tar.gz

Second: install the dependencies required to build and install Arista and the extra GStreamer plugins (if not already installed) via yum

[daniele@sam ~]sudo yum -y install python3-devel gstreamer-ffmpeg gstreamer-plugins-good gstreamer-plugins-bad-free gstreamer-plugins-bad-nonfree gstreamer-plugins-ugly

Arista uses HAL which is deprecated since Fedora 15 and removed from Fedora 16, so to run Arista you also need to install python-gudev which uses udev instead of HAL.

[daniele@sam ~]sudo yum -y install python-gudev

Third: build and install the software and remove install sources

[daniele@sam ~]cd arista-0.9.7
[daniele@sam arista-0.9.7]$ python setup.py build
[daniele@sam arista-0.9.7]sudo python setup.py install
[daniele@sam arista-0.9.7]$ cd ~; rm -Rf arista-0.9.7

Fourth: run Arista from command line or from your application menu!

[daniele@sam ~]$ arista-gtk

arista-fedora18

Done!