Connect to slack via irc/irssi

Note : Slack teams need to have the irc gateway enabled by the team admin for this to work.

This post provides a configuration example for irssi. Generic irc connection information for slack can be found at this page.

First, obtain your irc gateway priveleges by going to https://\.slack.com/account/gateways</code>

and fill out \</code>, \</code> and \</code> in the following commands.

/network add -nick <user> slack
/server add -auto -ssl -network slack <host> 6697 <pass>
/save

You only need the -ssl flag if your team admin has required ssl for irc connections. If no ssl is required, ports 6667 and 8000 can be used as well.

You can now connect to slack by typing

/connect slack

This will open up new windows for every channel in your team and you should be good to go.

As slack users become active or inactive, you’ll see the following active/inactive messages in your channel.

11:02 -!- mode/#general [+v foo : active] by foo
11:03 -!- mode/#general [-v foo : away] by foo

You can hide these messages via

/ignore -network slack * MODES

Multi Node devstack setup

Note : A detailed guide to a Multi-Node devstack setup can be found in openstack documentation, this guide simply elaborates on the node configuration.

This guide covers setting up a separate controller, cinder and compute node via devstack. Configuration of each node is addressed individually.

Controller Node

The controller node must be brought up first as the cinder/compute node rely on it for services. You would bring up devstack regularly using the following configuration :

# Controller configuration
[[local|localrc]]

SERVICE_TOKEN=azertytoken
ADMIN_PASSWORD=foobar
MYSQL_PASSWORD=foobar
SERVICE_PASSWORD=foobar
DATABASE_PASSWORD=foobar
RABBIT_PASSWORD=foobar

HOST_IP=10.192.194.1
PUBLIC_INTERFACE=ens0

MULTI_HOST=True

disable_service c-vol
disable_service n-cpu
disable_service n-net

We disable c-vol, n-cpu & n-net because we do not want to run the cinder volume, nova compute or nova network on the controller node, as we have separate nodes for this. Setting MULTI_HOST=True is required for a multi node setup.

Once devstack has been launched, remember to allow inbound amqp & mysql connections via the following iptables rules :


# keystone
$ sudo iptables -I INPUT 1 -p tcp --dport 5000 -j ACCEPT

# amqp
$ sudo iptables -I INPUT 1 -p tcp --dport 5672 -j ACCEPT
$ sudo iptables -I INPUT 1 -p tcp --dport 5673 -j ACCEPT
$ sudo iptables -I INPUT 1 -p tcp --dport 15672 -j ACCEPT

# mysql
$ sudo iptables -I INPUT 1 -p tcp --dport 3306 -j ACCEPT

# glance
$ sudo iptables -I INPUT 1 -p tcp --dport 9292 -j ACCEPT

# cinder api
$ sudo iptables -I INPUT 1 -p tcp --dport 8776 -j ACCEPT

While the cinder and compute node can be brought up simulatenously, ensure that the controller node is completely up and running before bringing up the other nodes.

Cinder Node

Next we bring up the cinder node. The configuration here is slightly more complicated.

# Cinder configuration
[[local|localrc]]

SERVICE_TOKEN=azertytoken
ADMIN_PASSWORD=foobar
MYSQL_PASSWORD=foobar
SERVICE_PASSWORD=foobar
DATABASE_PASSWORD=foobar
RABBIT_PASSWORD=foobar

SERVICE_HOST=10.192.194.1 # controller ip
HOST_IP=10.192.194.2
PUBLIC_INTERFACE=ens0

MULTI_HOST=True

MYSQL_HOST=$SERVICE_HOST
RABBIT_HOST=$SERVICE_HOST
CINDER_SERVICE_HOST=$SERVICE_HOST
GLANCE_HOSTPORT=$SERVICE_HOST:9292
DATABASE_TYPE=mysql

ENABLED_SERVICES=c-sch,c-vol

CINDER_ENABLED_BACKENDS=lvm:lvmdriver-1

[[post-config|$CINDER_CONF]]
[DEFAULT]
my_ip=$HOST_IP

[lvmdriver-1]
VOLUME_GROUP="stack-volumes"
VOLUME_NAME_PREFIX="volume-"

We only enable the required services, c-sch and c-vol here as this will be a cinder only node. Note the difference in format while disabling individual services and enabling an array.

We also add a post config section to cinder to make some changes required for a multi node setup. The my\_ip value, used to indicate iscsi target address defaults to SERVICE\_HOST which normally indicates the devstack host ip. For a multi-node setup we need to change it to HOST\_IP. We also declare an lvm backend with a backend name (lvmdriver-1 in this case). When the cinder service with an lvm backend is started, it creates a new volume group named in the format \<VOLUME\_GROUP\>-\<backend_name\>. By specifying the VOLUME\_GROUP under the named lvm backend configuration section, we can control the name to be stack-volumes-lvmdriver-1. By creating this volume group before devstack is brought up, when can make devstack use our preconfigured VG.

Once devstack has been launched, remember to allow inbound iscsi connections via the following iptables rules :

# iscsi
$ sudo iptables -I INPUT 1 -p tcp --dport 3260 -j ACCEPT

Compute Node

For the compute node, the configuration is much simpler.

# Compute configuration
[[local|localrc]]

SERVICE_TOKEN=azertytoken
ADMIN_PASSWORD=foobar
MYSQL_PASSWORD=foobar
SERVICE_PASSWORD=foobar
DATABASE_PASSWORD=foobar
RABBIT_PASSWORD=foobar

SERVICE_HOST=10.192.194.1 # controller ip
HOST_IP=10.192.194.3
PUBLIC_INTERFACE=ens0

MULTI_HOST=True

MYSQL_HOST=$SERVICE_HOST
RABBIT_HOST=$SERVICE_HOST
CINDER_SERVICE_HOST=$SERVICE_HOST
GLANCE_HOSTPORT=$SERVICE_HOST:9292
DATABASE_TYPE=mysql

ENABLED_SERVICES=n-cpu,n-net

For the compute node, we similarly enable only the required services. Once you have all three nodes up and running, you should have a fully working multi-node setup deployed. Happy stacking !

Note : devstack code changes quite rapidly and might be sometimes unstable. This instructions were verified working at the time of the Kilo Release, but YMMV.

Copying large blocks of text between different vim instances

Copying large blocks of text within vim instances can be messy, and often mess up formatting while pasting text in another vim instance. This post explains how to use a temporary buffer to store blocks of text you want to copy/paste into local or remote instances. This is fairly straightforward as long as you are a little comfortable with vim.

Enter visual mode (esc + v) and select the text you wish to copy. Yank your text (y) and then run the following commands to open a temporary buffer, paste contents into buffer, and close buffer and return to previous buffer and release the *.swp file

:e /tmp/dummy
paste the text to the new buffer (p)
:w
:bp

Here, we are using /tmp/dummy as our temporary buffer. Now copy your dummy file to your remote location, or skip this step if you’re copying between local instances. Make sure you use the correct path if you rename or move the temporary buffer file. Pasting text is as simple as going to normal mode and reading in the file

:r /tmp/dummy

And your copying is done.

Originally seen on the vim wiki here

Migrate from RHEL7 to CentOS7 repos

Damn that RHN subscription, continued

Note : The rpm versions keep changing with every package update and might be out of date. You can check the correct current versions by going here

# Remove the RHEL7 release packages
yum remove rhnlib redhat-support-tool redhat-support-lib-python
rpm -qa| egrep "rhn|redhat" | xargs rpm -e --nodeps

# These create an issue later, so remove these directories now
rm -rf /usr/share/redhat-release/
rm -rf /usr/share/doc/redhat-release/

# Import the CentOS 7 GPG key
rpm --import http://mirror.centos.org/centos/7/os/x86_64/RPM-GPG-KEY-CentOS-7

# Install the CentOS 7 release packages
yum localinstall http://mirror.centos.org/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-24.el7.noarch.rpm
yum localinstall http://mirror.centos.org/centos/7/os/x86_64/Packages/yum-3.4.3-118.el7.centos.noarch.rpm
yum localinstall http://mirror.centos.org/centos/7/os/x86_64/Packages/centos-logos-70.0.6-1.el7.centos.noarch.rpm
yum localinstall http://mirror.centos.org/centos/7/os/x86_64/Packages/centos-release-7-0.1406.el7.centos.2.3.x86_64.rpm

# Clean database & upgrade all packages
yum clean all
yum install deltarpm yum-presto
yum upgrade

# Change GRUB2 entries
grub2-mkconfig -o /boot/grub2/grub.cfg

You should have moved completely from RHEL packages to CentOS packages at the end of this step. Please note that these instructions are for x86_64, you need to replace ‘x86_64’ with ‘i386’ in the urls if you are on a 32-bit system.

Migrate from RHEL6 to CentOS6 repos

Damn that RHN subscription

Note : The rpm versions keep changing with every package update and might be out of date. You can check the correct current versions by going here

While the instructions on the CentOS wiki are pretty good, they seem to be lacking removal of redhat-release-server, which is required to actually move to RHEL to CentOS repos. This is an updated version of that page, with slightly fewer commands.

yum remove rhnlib abrt-plugin-bugzilla redhat-release-notes*
rpm -e --nodeps redhat-release redhat-release-server redhat-indexhtml
yum localinstall http://mirror.centos.org/centos/6/os/x86_64/Packages/centos-release-6-5.el6.centos.11.1.x86_64.rpm
yum localinstall http://mirror.centos.org/centos/6/os/x86_64/Packages/centos-indexhtml-6-1.el6.centos.noarch.rpm
yum localinstall http://mirror.centos.org/centos/6/os/x86_64/Packages/yum-3.2.29-40.el6.centos.noarch.rpm
yum localinstall http://mirror.centos.org/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
yum clean all
yum upgrade

You should have moved completely from RHEL packages to CentOS packages at the end of this step. Please note that these instructions are for x86_64, you need to replace ‘x86_64’ with ‘i386’ in the urls if you are on a 32-bit system.