Skip to content
This repository has been archived by the owner on Dec 2, 2020. It is now read-only.

Socket file creation? #16

Closed
dinshaw opened this issue Apr 22, 2013 · 5 comments
Closed

Socket file creation? #16

dinshaw opened this issue Apr 22, 2013 · 5 comments

Comments

@dinshaw
Copy link

dinshaw commented Apr 22, 2013

to avoid the need to customize the database config, would it be possible/a good idea to do something like:

$ mysqladmin variables | grep socket
> /opt/boxen/data/mysql/socket
$ ln -s /opt/boxen/data/mysql/socket /tmp/mysql.sock

?
This worked for me on a Mt Lion install. This is my first dip into Puppet/Boxen, so sorry if i missed something obvious.

if it seems like a good approach, i will submit a PR

@iowillhoit
Copy link

+1 This worked for me too. Could be missing something also, but I needed this symlink to be able to connect Sequel Pro to my local mysql server.

@dinshaw
Copy link
Author

dinshaw commented May 13, 2013

i ended up overriding the project with:

  if $mysql {
    $mysql_dbs = $mysql ? {
      true    => ["${name}_development", "${name}_test"],
      default => $mysql,
    }

    mysql::db { $mysql_dbs:
      notify => File['/tmp/mysql.sock']
    }
  }

  file { '/tmp/mysql.sock':
    ensure => link,
    target => '/opt/boxen/data/mysql/socket',
  }

I didn't go all the way to getting the path from the system, but wouldn't be too hard.

@blackjid
Copy link
Member

There is a issue #3 where this is discussed but, they ended up using a bloated database.yml file.
I would prefere a solution that works without modifying the app code.

@iowillhoit
Copy link

Agreed. I was trying to get this running for a simple php project, and ran into a bit of trouble. First I used the symlink that @dinshaw first tried:

ln -s /opt/boxen/data/mysql/socket /tmp/mysql.sock

This allowed Sequel Pro to connect, but not php because the defaults in the php.ini were looking for the socket at /var/mysql/mysql.sock

So, instead of changing every instance of /var/mysql/mysql.sock in the php.ini to /tmp/mysql.sock or /opt/boxen/data/mysql/socket.. I left the php.ini alone, deleted the symlink and created a new one:

mkdir /var/mysql  
ln -s /opt/boxen/data/mysql/socket /var/mysql/mysql.sock

For good measure I restarted mysql and apache:

sudo /opt/boxen/homebrew/Cellar/mysql/5.5.20-boxen2/support-files/mysql.server restart
sudo apachectl restart

..and got it working for both php and Sequel Pro.

Now I am new to Boxen and have not yet taken the high dive into Puppet. I'm afraid I'm probably not the one to submit a pull request until I make it further into Puppet's Docs. Perhaps someone would be willing to take this on and I could learn from the commit. Thanks a lot

@seanknox
Copy link
Contributor

I think this comes down to engineering teams determining the tools they use; if they decide to use Boxen or support developers using Boxen, it's not (IMO) much to provide Rails database configs (in the examples above) with support for Boxen or non-Boxen users.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

4 participants