Upload asynchronously to Amazon S3 using Tornado

TornadoWeb is a great non-blocking web server written in Python and Boto3 is the Amazon Web Services (AWS) SDK for Python, which allows developers to write in a very easy manner software that makes use of Amazon services like S3. Unfortunately boto3 S3 wrapper is blocking and if you would just use it out of the box in a Tornado application it will block the main thread because it uses a synchronous HTTP client.
Continue reading Upload asynchronously to Amazon S3 using Tornado

Deploy cherrymusic using Nginx, Supervisord and Virtualenv on Ubuntu

Cherrymusic is a music streaming server written in python.

We assume the deployment is done in /home/user/music.domain.com

Cherrymusic

1. Go to the deployment folder and clone the cherrymusic repo

cd /home/user/music.domain.com
git clone https://github.com/devsnd/cherrymusic

2. Create and enable the virtualenv

python3 -m venv music_env
source music_env/bin/activate

3. Test if the cherrymusic server starts and stop it afterwords

python cherrymusic --setup --port 8080
(ctrl+c)

4. If you executed this commands under another user than the one under which you want to run cherrymusic

(eg: you ran the commands as root but you want to run under the user `user`)

mkdir -p /home/user/.config/cherrymusic
cp ~/.config/cherrymusic/cherrymusic.conf /home/user/.config/cherrymusic/

5. Edit cherrymusic.conf from the `user`’s home and set the `basedir` with the path where your music collection is stored.
eg: /var/music

Continue reading Deploy cherrymusic using Nginx, Supervisord and Virtualenv on Ubuntu

Google Chrome UI extremely large

Today I updated google-chrome-stable to version 43.0.2357.124-1 and I had an unpleasant surprise. Everything was looking bigger: the top bar, the bookmark bar, the menus, the font on the website. Something like this:

Screenshot from 2015-06-11 09:50:04

It seems the fix is to start the chrome browser with –force-device-scale-factor option.

Screenshot from 2015-06-11 09:55:01

And the result is:

Screenshot from 2015-06-11 09:57:14

The UI looks again like before.

Create a Cassandra cluster with OpsCenter on Amazon EC2

Today I played a little with Cassandra on Amazon EC2. It was a very user friendly and pleasant experience to deploy a cluster with 2 nodes in one region using DataStax OpsCenter.

First I started a m1.small instance in Amazon EC2 where I installed OpsCenter. For this I chose Centos 6, the official AMI. Before starting to install OpsCenter, we need to configure the firewall in order to be able to access it. In AWS console, under the Security group, there is “CentOS 6 -x86_64- – with Updates-6 – 2014-09-29-AutogenByAWSMP-“. We need to righ-click on it and Edit inbound rules. Here we add a new Custom TCP Rule with port 8888 and the Source IP: My IP.

Anyway, I noticed that the instance has also an iptables firewall and the port 8888 is not open. So, on the instance I did:

iptables -I INPUT 4 -p tcp --dport 8888 -j ACCEPT
iptables-save | tee /etc/sysconfig/iptables

Now, we can install OpsCenter. All you need to do is to follow the installation guide for RPM package from DataStax:

Continue reading Create a Cassandra cluster with OpsCenter on Amazon EC2