Thursday, June 15, 2017

Dealing with Postgres "/tmp/.s.PGSQL.5432" error

I have dealt with this error quite a few times, but so infrequently that I forget the solution. When upgrading or wiping and reinstalling PostgreSQL via Homebrew, sometimes a few things get dropped by the scripts for some reason.

Situation: Postgres is running, database has been created, I can log in via psql and interact with the database just fine. Even Django, running via the development runserver, can interact with the database fine. However, when you try to test the production server on Apache, you get the dreaded error:

could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?

Here is the solution:
Quick check to see if /var/pgsql_socket exists:

ls /var/      # nope, nothing here

So then just make one, per the instructions found here

sudo mkdir /var/pgsql_socket/
ln -s /private/tmp/.s.PGSQL.5432 /var/pgsql_socket/

Reload your apache page and voila, it works.

System config: OSX 10.12.5 (Sierra), httpd24, postgresql@9.5 (9.5.7), django 1.9.2

Tuesday, September 27, 2016

Monday, February 1, 2016

Problems starting MySQL

Using MySQL 14.14 distrib 5.7.9 for osx10.11 on El Capitan 10.11.3

An existing MySQL database suddenly stopped running after a restart. When I tried to connect I first got this error:

Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
So tried to run mysql.server start and got this error:

ERROR! The server quit without updating PID file (/usr/local/var/mysql/Honshu.local.pid)

Tried using sudo but that did not change anything.

Went to install location and removed the *.err file (which was 53Mb!?)
sudo rm /usr/local/var/mysql/Honshu.local.err

Then ran mysql.server start and it started up just fine.

Thursday, February 20, 2014

How to Install Shiny Server on OSX

I want to set up the shiny-server to run on an iMac at work so that we can run multiple R-apps over the intranet. According to the docs for Shiny server, OSX is not supported yet (version 1.1.0) so we are going to build it from source and hope for the best!

Instructions for building from source are here. We follow them pretty closely but there are a few gotchas.

The full HowTo is on our GitHub Wiki, here

Monday, September 16, 2013

Creating a Mountain Lion development environment

So I had to set up a new dev environment at work on Mountain Lion. It uses the following components

  • Hombrew
  • Python 2.7.5
  • Django 1.5.2
  • Apache 2.2.25
  • Postgres 9.2.4
  • R 3.0.1
  • Virtualenv
and a bunch of other python libraries and stuff. This system is set up for Bioinformatics development, so there are things that are specific to that. The build is documented on our internal wiki, but I copied the build instructions to the *new* code.ex(python) wiki in my personal github account. The direct link to the build instructions is here.

Friday, September 13, 2013

Understanding Django static files

In struggling to setup a new development/production server on Mountain Lion, I came across this good explanation of django static files and how to configure them.

http://bitsoul.com/2012/10/04/understanding-django-static-files-for-beginners/

Also, this link was also helpful in setting up the environment

http://thecodeship.com/deployment/deploy-django-apache-virtualenv-and-mod_wsgi/

Cheers.

Wednesday, August 28, 2013

Zipping a python dict of lists

Have a python dictionary containing lists. Want to zip the lists together, but don't know the keys. Solution provided from Stackoverflow

http://stackoverflow.com/questions/9828072/zipping-a-python-dict-of-lists