Solving “connection refused” issues on Debian Sid

Some weeks ago I started to experiment some network issues on my debian sid:

  • The selenium-remote-control was not running:

I could even try to do a: “telnet localhost 4444″, it just did not work.

  • My Apache-Solr was not capable to subscribe to apache-activemq

When reading the log, I saw:

javax.jms.JMSException: Could not connect to broker URL: tcp://localhost:61616. Reason: java.net.ConnectException: Connection refused
at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:35)
at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:280
Could not connect to broker URL: tcp://localhost:61616. Reason: java.net.ConnectException: Connection refused
Suddenly I noticed something weird in my netstat:
tcp6       0      0 :::8983                 :::*                    LISTEN      3865/solr-globocom
tcp6       0      0 :::8161                 :::*                    LISTEN      3901/activemq-globo
tcp6       0      0 :::61616                :::*                    LISTEN      3901/activemq-globo
tcp6       0      0 127.0.0.1:41879         127.0.0.1:61616         ESTABLISHED 3865/solr-globocom
tcp6       0      0 127.0.0.1:61616         127.0.0.1:41879         ESTABLISHED 3901/activemq-globo

Everything is being bound as IPv6… humm, that doesn’t have a good smell….

Looking for solutions I’ve found this file:

/etc/sysctl.d/bindv6only.conf

interesting, huh?!?

Openning up that file, I saw a full description of it, then I just needed to change its property from this:

net.ipv6.bindv6only = 1

to this:

net.ipv6.bindv6only = 0
Well, if you have the same problem, jsut change that, restart your PC, and be happy!

Hosting and deploying django apps on Dreamhost

About two years ago, I’ve signed up to Dreamhost. My goals were and still being to host my personal projects, websites and so on.

Once I am a Django web developer, one of my first actions were to create a django deployment setup, good and flexible enough. The time passed on and have been got new experiences, and the best desision, i think, was to create a new python sandbox, i mean, a customized python environment.

How is it possible ?

Simple! Just compiling python from scratch, with a fake root path (a prefix)

Anyway, the deployment process involves more variables, like setting both htaccess and dispatch files for each project, installing some basic modules such PIL and MySQL and so on…

So, i ever wanted to create a super duper script to do all that “dirty” work. And i did it last weekend!

I were working ia a freelance job and decided to create a subdomain to host test instance of them.

A new sandbox, ready to make my tests to create the super script.

So folks, i present you the brand new: django_dreamhost.sh :)

It’s composed by 4 files:

  • django_dreamhost.sh itself
  • djangify.template – a template with will become a script to setup new projects (htaccess and dipatch files, for instance)
  • htaccess.template – a template that will become the .htaccess of each project of yours
  • dispatch.template – will become the dispatch.fcgi for your projects as well

“But do i need to download all them ?”, of course NO!

You just download the main script, and he will do all do hard work!

“I wanna contribute, modify or do anything with that script, can I ?”, of course yes! All parts of the script are GPLv2 +

You can also always get the development version through git repository:

git clone http://git.nacaolivre.org/django_dreamhost

Don’t want to get all code, just the script ?

Download it at: http://gnu.gabrielfalcao.com/django_dreamhost/django_dreamhost.sh

What does that script do ?

He will do the following steps:

  1. Download Python, Django, Python-setuptools, Python-fastcgi to a directory called downloads
  2. Extract all
  3. Create a local root at $HOME/.myroot and the subdirs etc and usr
  4. Set the new bin path to you global path through bashrc and bash_profile
  5. Compile and install python to the new prefix: $HOME/.myroot/usr
  6. Install Django, rename django-admin.py to django-admin
  7. Setup your bash-completion to support django scripts
  8. Install the python modules above with the new python
  9. Install PIL and MYSQL modules through easy_install (setuptools)
  10. Download the template scripts to $HOME/projects/script_templates
  11. Replace the custom tags in templates
  12. Move the djangify.template to the new bin PATH: $HOME/usr/bin and give it execution permission

I thinks it’s all.

I currently use Fabric to help on deployment, and i have a quite smart basic setup for it to work with this dreamhost django environment, but it will be approached in the next blog post :)

See you, folks!

Powered by WordPress with GimpStyle Theme design by Horacio Bella.
Entries and comments feeds. Valid XHTML and CSS.