Project

General

Profile

Actions

Bug #1687

closed

install from dev branch with mysql adapter does not work

Added by Jason Gerry almost 12 years ago. Updated over 11 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Rails
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

New to Foreman, I hope this helps some. Instead of just filing the bug, I have tried to work through some of the issues and I have it working in MySQL now. At least partly.

I'm building from the dev branch:

git clone https://github.com/theforeman/foreman.git -b develop

I'm getting this error trying to use MySQL as a database:

# RAILS_ENV=production bundle exec rake db:migrate
/usr/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:10: warning: already initialized constant ENC_NONE
/usr/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:11: warning: already initialized constant ENC_EUC
/usr/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:12: warning: already initialized constant ENC_SJIS
/usr/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:13: warning: already initialized constant ENC_UTF8
rake aborted!
undefined method `collect' for #<Mysql::Result:0x7f7c8f8e4578>

I was able to initialize the db with MySQL by doing the following:

Changed Gemfile:

# diff Gemfile Gemfile.orig 
44c44
<   gem 'ruby-mysql'
---
>   gem 'mysql'
47,49c47,49
< #group :mysql2 do
< #  gem 'mysql2', '< 0.3'
< #end
---
> group :mysql2 do
>   gem 'mysql2', '< 0.3'
> end

I also removed all other mysql gems from the bundle, I'm not sure if I would have had to that if I had started over and re-cloned the repository. This is entirely my inexperience with rails / gems / bundle I'm sure.

# bundle exec gem uninstall mysql2
# bundle exec gem uninstall mysql

then I set adapter to mysql in database.yml

production:
  adapter: mysql
  database: foreman
  username: foreman
  password: *******
  encoding: utf8
  reconnect: false
  pool: 5
  timeout: 5000
  host: localhost
  socket: /var/lib/mysql/mysql.sock

I had to explicitly set the socket since it was defaulting to looking in /tmp/, this solved the issue. I suspect this will vary by distribution? I'm running on Centos 6.2.

Another note: I had to install into an empty database, trying to run db:migrate on my puppet stored config db gave me another error:

** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
==  ChangeHostBuildDefaultToFalse: migrating ==================================
-- change_column(:hosts, :build, :boolean, {:default=>false})
   -> 0.0154s
rake aborted!
An error has occurred, all later migrations canceled:

I was hoping to share the same db between puppet and foreman, according to:

http://theforeman.org/projects/foreman/wiki/Puppet_Facts

I think this should be possible but the docs aren't totally clear to me, it does say if you use the same db that facts can be shared. I am using the "storeconfigs" param in puppet.conf, also using the "thin_storeconfigs" param, maybe this only works on the full storeconfig without thin_?

I'm happy to try and more thoroughly test some of this stuff, I hope this is helpful in some way. Thanks.

Actions

Also available in: Atom PDF