Showing posts from September, 2017

How to fix node's "IOError: CRC check failed" error when installing Open edX ginkgo.1 release

During the installation process of Open edX ginkgo.1 release (native), you may encounter this error:

{"changed": true, "cmd": "/edx/app/edxapp/venvs/edxapp/bin/nodeenv /edx/app/edxapp/nodeenvs/edxapp --node=6.11.1 --prebuilt --force", "delta": "0:09:19.500992", "end": "2017-09-27 06:20:43.488592", "failed": true, "rc": 1, "start": "2017-09-27 06:11:23.987600", "stderr": " * Install prebuilt node (6.11.1) ..Traceback (most recent call last):\n  File \"/edx/app/edxapp/venvs/edxapp/bin/nodeenv\", line 11, in <module>\n    sys.exit(main())\n  File \"/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/\", line 1010, in main\n    create_environment(env_dir, opt)\n  File \"/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/\", line 843, in create_environment\n    install_node(env_dir, src_dir…

Deploy OpenStack on a single Ubuntu16.04 server using conjure-up

I'm sure that you heard a lot about the greatness of Canonical's conjure-up tool and how easy it is to deploy cloud platforms e.g. Kubernete, OpenStack etc... According to the conjure-up and Ubuntu websites, it's straightforward to have those big stack installed:


$ sudo snap install conjure-up --classic
$ conjure-up

That's all they says. But, seriously, when I tried to deploy the Openstack NovaLXD (deploy OpenStack's components into LXD containers) using conjure-up in Ubuntu 16.04, it's pain in the ass. I spent almost 3 days to make it work. Let me explain what happened:

In Ubuntu 16.04, you can only use conjure-up installed through snappy not through apt:

$ sudo snap install conjure-up

That's not much of a deal as you can see. The problem is that conjure-up cannot communicate with the default LXD (network bridge interfaces, storage pools) shipped with Ubuntu 16.04. I felt super c…

Simple real time search and filter using jQuery

Let's say you have a list of HTML elements (div) and you want to implement the search and filter functionality. Here is dead simple example:

Assuming your HTML block looks like the following:

<input type="text" id="search" placeholder="Type to search">
<button id="search-btn">Search</button>

<div class="list-partner">
<div class="partner-item">...</div>
        <div class="partner-item">...</div>
        <div class="partner-item">...</div>

And this javascript snippet will add the magic:

var rows = jQuery('.list-partner .partner-item');
jQuery('#search-btn').click(function() {
var val = jQuery.trim(jQuery('#search').val()).replace(/ +/g, ' ').toLowerCase();

var itemtxt = jQuery(this).text().replace(/\s+/g, ' ').toLowerCase();

Reset the containerized OpenStack Dashboard admin's password using JuJu

If you're running a containerized OpenStack's architecture (e.g. conjure-up will deploy OpenStack this way), you must have a tool to orchestrate all the containers. I'm using Ubuntu's JuJu and really love it. For example, in order to reset the OpenStack Dashboard admin's password, I don't have to directly go into the keystone service to do that, I just run this from the host machine:
1. Find the machine's number and ip address on which the keystone installed
$ juju machines
For example, the machine number is 9, ip address is
2. Reset the admin's password to 12345678 (the default user is admin): 
$ juju run "sudo keystone --os-auth-url= --os-endpoint= --os-token=48FM7htnHkxxHkNT2RmMNxwpYRRcnmp8dbghtwMYWcg2BRRs9qmcMMtRww8tTCZ4 user-password-update --pass 12345678 admin" --machine=9

How to access OpenStack Dashboard installed in a headless Ubuntu server using conjure-up

After I finished installing OpenStack using Ubuntu's conjure-up on a single machine, I found myself struggle to access the dashboard. The only machine that can access the OpenStack Dashboard is the host server which is a headless Ubuntu server. It's because conjure-up installs OpenStack by deploy its components to multiple containers with a virtual private network that connects those services. So in order to access the dashboard from outside, I had to create an iptable rule that NAT the OpenStack Dashboard container's http port (443 or 80) to a host server's port (443 properly). Here is an example:

sudo iptables -t nat -A PREROUTING -p tcp -d <ip of the host server> --dport 443 -j DNAT --to-destination <internal ip of the openstack dashboard service, usually 10.x.x.x>:443

After that, I was able to access the OpenStack web interface from other machines.

Get url parameter using javascript

This is pretty neat javascript snippet to get the URL's parameters:

var getUrlParameter = function getUrlParameter(sParam) {
    var sPageURL = decodeURIComponent(,
        sURLVariables = sPageURL.split('&'),

    for (i = 0; i < sURLVariables.length; i++) {
        sParameterName = sURLVariables[i].split('=');
        if (sParameterName[0] === sParam) {
            return sParameterName[1] === undefined ? true : sParameterName[1];