Posts

Making httplib and urlparse modules compatible with both Python 2 & 3

There are some changes in Python 3 especially some packages are renamed such as httplib -> http.client and urlparse -> urllib.parse . Below is a way to make those 2 work in both Python 2 and 3: import sys if sys.version_info[0] < 3:     import httplib     import urlparse else:     import http.client as httplib     import urllib.parse as urlparse Note: ' sys.version_info[0] < 3 ' is used to check the current running python version.

An overview of the Freezer-DR (Disaster Recovery) project

Image
Freezer-DR is a project that provides compute node high availability for OpenStack. The Freezer-DR comprises 4 main boxes: Monitors: collecting data from compute nodes Fencers: do fencing operations Evacuators: to evacuate VMs Notifiers: notification Freezer-DR is designed using an extensible architecture which allows us to plug any software solution/library into the above boxes by implementing the drivers. For example, I can use Monasca as the monitor, IPMI or libvirt as fencers, open stack nova client as evacuator, python SMTP lib as the notifier, as long as I have the drivers for those software or libraries. Right now, there is only a limited number of supported drivers for monitors, fencers, evacuators, and notifiers but you can always easily write your own drivers to use the desired libraries or software. Below figure describes the workflow of Freezer-DR: (1) Freezer-DR monitors all the compute nodes (2) If it found any fail node, Freezer-DR will fenc...

Nginx error says "upstream sent too big header while reading response header from upstream"

My PHP web server with Nginx as reverse proxy says "upstream sent too big header while reading response header from upstream" And, here is how to fix it: 1. Edit the nginx configuration for my site, for example, /etc/nginx/sites-available/mysite $ sudo nano /etc/nginx/sites-available/mysite Modify these lines ...         location ~ \.php$ {                 include snippets/fastcgi-php.conf;                 fastcgi_pass unix:/run/php/php7.0-fpm.sock;                 fastcgi_buffer_size 128k;                 fastcgi_buffers 4 256k;                 fastcgi_busy_buffers_size 256k;         } ... 2. Restart nginx and enjoy $ sudo systemctl restart nginx

kolla-ansible deploy stucks at "haproxy : Waiting for virtual IP to appear"

I was trying to deploy Kolla all-in-one and stuck at TASK [haproxy : Waiting for virtual IP to appear] Here is how I fixed it: 1. Because, another service in the network may use the same Virtual Router ID, It is 51 by default. So, change the default " keepalived_virtual_router_id " to another value (free and in the range of 0-255) $ sudo vi /etc/kolla/globals.yml ... keepalived_virtual_router_id: "251" ... 2. Run  kolla-genpwd  to generate /etc/kolla/passwords.yml $ sudo kolla-genpwd 3. Enjoy

Failed to build docker images with kolla-build?

Most of the time when I am trying to build docker images using the kolla-build tool, I got something like: ... ERROR:kolla.common.utils:almanach-api Failed with status: matched ERROR:kolla.common.utils:almanach-collector Failed with status: matched ERROR:kolla.common.utils:bifrost-deploy Failed with status: matched ... One thing you can try is to build the images from source: $ kolla-build almanach-api almanach-collector bifrost-deploy -t source

How to install E-Commerce module in Bitnami' Open edX distribution

Important note: Bitnami distribution of Open edX is designed for testing and demonstration purposes so the e-commerce module integration is for experiment only. Please use this installation guide as your own risk. Bitnami' Open edX distribution only includes several core services such as LMS, Studio, XQueue, Forum as well as supporting services like MySQL, MongoDB, Memcached, Apache or Elasticsearch (more details here ). Additionally, Bitnami' application structure for Open edX is different than the official stack supported by the Open edX community. So, because of those reasons, in order to integrate the e-commerce module in your running instance, currently, there is no way other than doing it manually. I have had a chance to deploy successfully the e-commerce into a test Open edX instance for a customer. Below is how I did it. You can use it as a reference and leave me a comment if you find any errors or want to add something. 1. Directory structure: Assuming you ...

Got "/opt/stack/requirements/.venv/bin/pip’: No such file or directory" error installing devstack

Strangely tonight when trying to install devstack for a new experiment, after a couple failing attempts (mostly with directory permissions), I got this message saying: "/opt/stack/requirements/.venv/bin/pip’: No such file or directory" What happens? Turns out it is just virtualenv was failed to install pip in the previous try. Fortunately, I found an easy fix: $ virtualenv /opt/stack/requirements/.venv/ Then I just need to execute stack.sh again. Awesome!