Why, startup quote api and Docker

My first blog and my first post.

The reason to start a blog ? The Why ? (I’ve just finished reading Start with Why by Simon Sinek….)

  • Share my experience and projects
  • Learn about your experience and projects

Although in the last 100 years technology improve our lives quality about a 10x factor, we still study/learn in the same way of 2000 years before. Write and read are still the best method to share knowledge.

So, here I am.

In honour of the Daniel Pennac’s ten rules I’ll follow 3 simple rules to make more enjoyable reading this blog:

  1. Don’t write more than 900 words;
  2. Be interesting (don’t try to be, remember Yoda ?);
  3. Write for your and my fun

So I’ll don’t overwhelming you with hundreds of thousands of sentences about who come first between egg or chicken. I’ll figure out the best I can write about my entreprenurship plan, experience, hobbies, travel (I’m planning to see some countries) and about my strange country (Italy).

I think is always interesting to know what there is behind something, for example behind this blog. Well, I love python and after start this blog with django I choose to use Nikola, a simple and powerful static site generator and hosting it with github.

The dynamic part of the site is based on javascript and ajax calls to a simple django backend. You can use this url api.chrisbarra.me/api/quote/get to get a random quote (json format) or api.chrisbarra.me to see a simple html page.

Back to architect, I use a Digital Ocean vps, with Ubuntu and Docker. Docker is awesome, for the first 2 hours. After that I have a form of hate and love (much love than hate), but I’ll talk about this in the next weeks.

I have 1 simple docker container with python, uWSGI and NGINX.

Here you can find my repo with my docker and config files.

Now ssh your digital ocean vps or whatever you want to use

ssh root@ipyourhostmachine

Change your dir

# Clone git repository of your project or change your directory with your ROOT
# project directory, this is very important because this command "ADD ./ /app" 
# copy all your files from your current directory to the /app container's dir
cd rootprojectdir

Download my Dockerfile

# Always from ROOT directory of your project download my Dockerfile
# remember to change your uwsgi.ini if your wsgi.py is not located in api/wsgi.py dir
# More information in my Dockerfile
sudo curl -o Dockerfile https://raw.githubusercontent.com/barrachri/dockerfiles/master/dockerfile/Dockerfile_app

Build image from Dockerfile and name it appserver_image

docker build -t appserver_image .

Run a container from appserver_image and expose port 80 from the container to port 80 of the host machine and name this container appserver

docker run -d -p 80:80 --name appserver appserver_image

We looking for mount point directories between our container and host machine

docker inspect --format='{{.Volumes}}' appserver

The output will be something like this


If you want to stop and restart your container

docker stop appserver
docker start appserver

If something went wrong simple

docker logs appserver

After that we need to set this container to start automatically, we can do that with supervisor

sudo apt-get install supervisor
sudo nano /etc/supervisor/supervisord.conf

And add this text at end

command=/usr/bin/docker start -a appserver

Save and then

sudo reboot

Now your python app should be online !

I hope this was useful for other questions I’m here !

No country for young men

Are you looking the graph at the top of this page ? It is mean how much money Italy will have to pay to somebody (130% of its GDP) and how many young italians are not working.

Our big problem

I like to say that if you are a retired person, with a good month cheque, Italy will be a perfect country for you.

Beatiful place, awesome foods, we have mountains, lakes, sea, hills. And the cost of living isn’t too high.

But, if you are under the 30, well…Italy is not the right country for you.

We have a unemployement rate near 40% for people between 15-24, a jobs law that protect people who don’t want to work rather than people who want to work.

And if you want to be an entrepreneur the things is even worse.

We have a fiscal policy that prefers medium and large companies, rather than startups or one person companies. If you want to start a limited company you need a notary, because you need a public act.

The price for this service it is around 2000 euro (2776$), at some conditions you can start a “simplified” limited company, and in this case you pay nothing.

After notary you need to pay aroud 368 euro (510$) to the chamber of commerce for annual fees. Now you have your company and your VAT number.

But you haven’t met your worst enemy yet, burocracy.

To follow every month-stupid-crazy-burocracy-thing you need an accountant, for an annual cost around 5000 euro (6942$/year).

Now you have a company and an accountant, you haven’t earned nothing yet but you know that you are out of 7368 euro or 5368 euro with a “simplified” limited company (10229$ or 7453$).

But that’s not all, you need to pay INAIL (National Institute for Insurance against Accidents at Work) from 270 euro/year (374$/year) and you need to pay INPS (National Istitute for Social Security).

Every shareholder that works for its company needs to pay INPS, for a minium cost of 3000 euro/year (4163$/year).

So after the first year, you have to pay at least around 8638 euro (12000 $) even if you haven’t sold anything yet.

If you are an employee, you are not in a better condition. Your net wage it is around 50% of what your employer pay for you.

So if you take 1200 euro/month (1665$/month) your employer will pays around 2400 euro/month (3330$/month) for your wage and social security.

Now you can understand why Italy is 65th in the doing business ranking 2014.

Our very big problem

Sure we have other big problems but I think that our biggest problem is our political situation. Our chambers (parliament and senate) are very strange. 115 members on 854 are guilty of crimes from fraud to mafia.

We have a political system that cost too much, with too many people and that is far from be useful to its nation.


One of the founder of Forza italia (Silvio Berlusconi’s party), Marcello dell’Utri, was found guilty of mafia association and he was locked in a Beirut hospital for a international arrest warrant from italian justice.

But stop with pessimist, is there a little hope ?

Yes and no.

No because the problems are still the same from when I’m born. And every years the same answers come from politicians (we could do this, we should do that, we’ll make this) but the problems still remain.

Yes, because hope is the last to die.


We can still be a great nation but in the meantime, if you are a young italian, and if you don’t want to loose to many years to fight with windmills you can use google maps and look how big the world is and how many opportunities it has to offer.

How to start with Python and some useful resources

Python is an awesome language, simple, explicit, readable and powerful.

I spent a lot of time wondering about how to start learning Python, which resources use and what books I should buy.

After this and some money spent on books I want to share my experience:

First of all there’s a lot of free resources so I think it is not useful to invest too much money on books or other things.

To start

There’s a lot of interesting Python online courses, they don’t talk about every aspect of Python but they are a good starting point.

Remember to start with Python 3 !

Online courses

So pick up one of this course and start learning Python.


If you prefer some good books I think this is the best to start.

  • Learning Python – Awesome book, it talks deeply about every aspect of Python and sometimes it’s a little “boring”. But, personally, I can call it the Python Bible. This book costs a lot of money and it’s worth it, but often you’ll find interesting offer (50 % discount) on O’Reilly site.

Useful resource


  • Pyvideo – A collection of PyCon talks


Same as for “Learning Python”, these books cost a lot of money, but you can get them with some good discount on O’Really site.


Events and Conferences

Go to meetup.com and look for a Python meetup in your city and most of all take a ticket for the next PyCon in your country. This is my first year that I’ve participated in PyCon Italy and DjangoVillage and it was a great experience which left me wondering why I have not gone before.

Mistakes to avoid

Don’t make my mistake to buy a lot of interesting long books about Python when you’re not started to code yet.

Remember, reading docs and books is important but code is much more important ! So after studying function, generators, class and others remember to write some code to see if you understood what you have studied.

It’s time to code now !

Amazing Iceland

This is my first post about my travels, I hope you will enjoy it.

Let’s start !

Day 18 March 2015, finally it is time to go, just a few days in London and then right to Reykjavík.

I have planned this travel some months ago and the idea was clear from the beginning:

rent a car and take the most from this awesome island.

Do you know the right time when I have said “I want to go to Iceland” ?

After I saw “The Secret life of Walter Mitty”.

And after doing some web zapping I have got a ticket !

Milan->London – London->Reykjavík – Reykjavík->London – London->Milan.

For only 170 euro.

This was my trip around Iceland, from Reykjavík to Hofn and then back to the capital.

Some information

Days in Iceland: 6

Total budget: 848 euro, included all things from flights, car, food, fuel, hostel, etc.

Company: Completely alone

I think the best way to talk about this travel is through some photos because sometimes what you are seeing it leaves you speechless.


The dawn in Reykjavík is amazing.


Snow around the road to Pingvellir.

300.000 people are the number of Iceland citizens, and when you are driving you have more chance to meet an alien than some humans.

Near Reykjavík you will find the Pingvellir National Park, the most ancient european parliament!

Maybe the name parliament is a little misleading, because actually there isn’t any building, just a lot of rocks.


Jökulsárlón, it is a very depth lake (around 260 meters) between the Vatnajokull and the Atlantic sea.

Lava field

A small shelter in a lava field.


Famous cliffs near Vik.


Yes… you will need a lot of supplies when you travel out of the Reykjavík area!

Vatnajokull National Park

Road to the Vatnajokull.

Svartifoss a beautiful waterfall near Vatnajokull National Park.

The amazing mascotte of the entire travel, Master Yoda during a force experiment.


Eyjafjallajökull museum, just under the volcano.

Do you know how to say Eyjafjallajökull ?

At least for now Iceland is one of the most beautiful countries I have ever seen.

Amazing landscapes that are really unique and it is worth every euro that I spent there.

3 things that I will always remember from Iceland:

1) Me, my car and the Nature

The ring road, the road n. 1, it is amazing.

After I have left the Reykjavík area I was the major of the time only with me, my super Dacia Duster and the Nature. It was really hard to meet someone else out of some touristic places.

2) The Aurora

Yes, I have got it !

It costs me a night sleeping in my car outside Kirkjubæjarklaustur with an outside temperature of -5 degrees Celsius without a sleeping bag….

but again it is worth every “fuc* it is too cold outside!”.

3) Music from Iceland

During my trip I was alone, but not completely alone !

Fortunately there were some radio stations and the most trasmitted song was Crystal of the “Of Monsters and Man”, amazing song and although I appreciated their music before this travel (Dirty Paws is one of the movie soundtrack from The Secret Life of Walter Mitty) after it I listen very often to their music. I have found a kind of link between their music and the Iceland landscape.

What ?!?! You are still not sure about visit Iceland ? Watch this video !