posty / posty_api

Utility to administrate mailserver based on postfix and dovecot
www.posty-soft.org
Other
85 stars 19 forks source link

mysql2 must be required in Gemfile #32

Closed ngphban closed 8 years ago

ngphban commented 8 years ago

Hi, execute[rake db:migrate] error: 'Please install the mysql2 adapter: gem install activerecord-mysql2-adapter (mysql2 is not part of the bundle. Add it to Gemfile.)' Detailed log is attached. rake_execute_failed.txt

Seemed mysql2 did not get installed, as you can see in below: Gemfile content

ubuntu@ip-172-31-31-20:/srv/posty_api$ pwd
/srv/posty_api
ubuntu@ip-172-31-31-20:/srv/posty_api$ cat Gemfile
source 'http://rubygems.org'

gem 'rack', '~> 1.5.2'
gem 'rake', '~> 10.3.2'
gem 'grape', '~> 0.7.0'
gem 'activerecord', '~> 3.2.22', require: 'active_record'
gem 'json'
gem 'grape-swagger'
gem 'rack-cors', require: 'rack/cors'
gem 'schema_plus', '~> 1.5.1'

group :test, :development do
  gem 'rspec'
  gem 'rack-test', require: 'rack/test'
  gem 'shotgun'
  gem 'racksh'
  gem 'rubocop'
end

group :mysql, optional: true do
  gem 'mysql2', '~> 0.3.16'
end

group :postgresql, optional: true do
  gem 'pg', '~> 0.18.4'
  gem 'activerecord-postgresql-adapter'
end

Check if mysql2 is installed==> NOT

ubuntu@ip-172-31-31-20:/srv/posty_api$ gem list | grep -i mysql

Tried to work around by manually installing mysql2..Still failed with same error

ubuntu@ip-172-31-31-20:/srv/posty_api$ sudo gem install mysql2
Fetching: mysql2-0.4.3.gem (100%)
Building native extensions.  This could take a while...
Successfully installed mysql2-0.4.3
Parsing documentation for mysql2-0.4.3
unable to convert "\x9C" from ASCII-8BIT to UTF-8 for /usr/local/lib/ruby/gems/2.0.0/extensions/x86_64-linux/2.0.0-static/mysql2-0.4.3/mysql2/mysql2.so, skipping
unable to convert "\x9C" from ASCII-8BIT to UTF-8 for lib/mysql2/mysql2.so, skipping
Installing ri documentation for mysql2-0.4.3
1 gem installed
ubuntu@ip-172-31-31-20:/srv/posty_api$ gem list | grep -i mysql
mysql2 (0.4.3)

To give it a go, I had to edit the Gemfile to directly include the mysql2 gem. You can see my edited Gemfile attached Gemfile_edited.txt

ubuntu@ip-172-31-31-20:/srv/posty_api$ diff Gemfile Gemfile.orig
11,12c11
< gem 'mysql2', '~> 0.3.16'
< =begin

---
> 
29d27
< =end

With the second work-around, my boot-strap can go to next steps

* execute[rake db:migrate] action run
    - execute rake db:migrate
  * execute[rake api_key:generate] action run
    - execute rake api_key:generate
  * git[/srv/posty_webui] action sync
    - clone from https://github.com/posty/posty_webui into /srv/posty_webui
    - checkout ref 1650cb6d10ce3da8e915077f5d65488fecb21500 branch master
  * link[/var/www/posty_webui] action create
    - create symlink at /var/www/posty_webui to /srv/posty_webui/dist
    - change owner from '' to 'www-data'
    - change group from '' to 'www-data'
  * template[/srv/posty_webui/dist/settings.json] action create/usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.11.2/lib/bundler/rubygems_integration.rb:355:in `block in replace_bin_path': can't find executable racksh (Gem::Exception)
    from /usr/local/bin/racksh:22:in `<main>'

    - update content in file /srv/posty_webui/dist/settings.json from 5c8a9d to 404afc
    --- /srv/posty_webui/dist/settings.json 2016-03-09 05:37:38.840145864 +0100
    +++ /srv/posty_webui/dist/.settings.json20160309-2783-13n2j1n   2016-03-09 05:37:39.304145864 +0100
    @@ -1,19 +1,9 @@

My environment: RubyGem

buntu@ip-172-31-31-20:/srv/posty_api$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 2.6.1
  - RUBY VERSION: 2.0.0 (2014-05-08 patchlevel 481) [x86_64-linux]
  - INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.0.0
  - USER INSTALLATION DIRECTORY: /home/ubuntu/.gem/ruby/2.0.0
  - RUBY EXECUTABLE: /usr/local/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - SPEC CACHE DIRECTORY: /home/ubuntu/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /usr/local/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /usr/local/lib/ruby/gems/2.0.0
     - /home/ubuntu/.gem/ruby/2.0.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /usr/local/sbin
     - /usr/local/bin
     - /usr/sbin
     - /usr/bin
     - /sbin
     - /bin
     - /usr/games
     - /usr/local/games

Platform:

ubuntu@ip-172-31-31-20:/srv/posty_api$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.3 LTS
Release:    14.04
Codename:   trusty
chicobico commented 8 years ago

Try bundle install --with mysql