jamesrwhite / minicron

🕰️ Monitor your cron jobs
GNU General Public License v3.0
2.34k stars 154 forks source link

Not able to initialize sqlite3 database. #305

Open ndrolf opened 6 years ago

ndrolf commented 6 years ago

My guess is it is a gem version issue but I am not strong in Ruby. The server component starts up but generates database errors. I am guessing the first step is to do the db setup.

<~/minicron/server/bin>$ ./minicron-server db setup
uninitialized constant ActiveRecord::Tasks::DatabaseTasks::Rails

/usr/local/rvm/gems/ruby-2.4.4/gems/activerecord-5.2.1/lib/active_record/tasks/database_tasks.rb:101:in `env': uninitialized constant ActiveRecord::Tasks::DatabaseTasks::Rails (NameError)
    from /usr/local/rvm/gems/ruby-2.4.4/gems/activerecord-5.2.1/lib/active_record/tasks/database_tasks.rb:237:in `load_schema'
    from /root/minicron/server/lib/minicron/cli/commands.rb:47:in `block (2 levels) in add_db_cli_command'
    from /usr/local/rvm/gems/ruby-2.4.4/gems/commander-4.4.7/lib/commander/command.rb:182:in `call'
    from /usr/local/rvm/gems/ruby-2.4.4/gems/commander-4.4.7/lib/commander/command.rb:153:in `run'
    from /usr/local/rvm/gems/ruby-2.4.4/gems/commander-4.4.7/lib/commander/runner.rb:446:in `run_active_command'
    from /usr/local/rvm/gems/ruby-2.4.4/gems/commander-4.4.7/lib/commander/runner.rb:68:in `run!'
    from /root/minicron/server/lib/minicron/cli.rb:70:in `run'
    from ./minicron-server:14:in `block in <main>'
    from /root/minicron/server/lib/minicron.rb:146:in `capture_output'
    from ./minicron-server:12:in `<main>'

<~/minicron/server/bin>$ rvm list
=> ruby-2.4.4 [ x86_64 ]
 * ruby-2.5.1 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

<~/minicron/server/bin>$ gem list

*** LOCAL GEMS ***

actionpack (5.2.1)
actionview (5.2.1)
active_record_migrations (5.2.0.1)
active_record_tasks (1.1.0)
activemodel (5.2.1, 5.1.6, 4.2.10)
activerecord (5.2.1, 4.2.10)
activerecord-db-tasks (0.0.2)
activerecord-migrations (1.3.0)
activesupport (5.2.1, 5.1.6, 4.2.10)
ansi-to-html (0.0.3)
arel (9.0.0, 8.0.0, 6.0.4)
aws-eventstream (1.0.1)
aws-partitions (1.113.0)
aws-sdk-core (3.38.0)
aws-sigv4 (1.0.3)
backports (3.11.4)
better_errors (2.5.0)
bigdecimal (default: 1.3.2)
builder (3.2.3)
bundler (default: 1.16.6)
bundler-unload (1.0.2)
coderay (1.1.2)
commander (4.4.7)
concurrent-ruby (1.1.3)
crass (1.0.4)
cron2english (0.1.6)
daemons (1.2.6)
did_you_mean (1.1.0)
erubi (1.7.1)
erubis (2.7.0)
eventmachine (1.2.7)
executable-hooks (1.6.0)
faraday (0.15.3)
ffi (1.9.25)
ffi-compiler (1.0.1)
gem-wrappers (1.4.0)
highline (2.0.0)
i18n (1.1.1, 0.9.5)
insidious (0.3)
io-console (default: 0.4.6)
jmespath (1.4.0)
json (default: 2.0.4)
jwt (2.1.0)
loofah (2.2.3)
mail (2.7.1)
method_source (0.9.2)
mini_mime (1.0.1)
mini_portile2 (2.3.0)
minitest (5.10.1)
multi_json (1.13.1)
multipart-post (2.0.0)
mustermann (1.0.3)
net-telnet (0.1.1)
nokogiri (1.8.5)
openssl (default: 2.0.7)
pagerduty (2.1.2)
parse-cron (0.1.4)
parslet (1.8.2)
power_assert (0.4.1)
psych (default: 2.2.2)
rack (2.0.6)
rack-protection (2.0.4)
rack-test (1.1.0)
rails-dom-testing (2.0.3)
rails-html-sanitizer (1.0.4)
railties (5.2.1)
rainbow (3.0.0, 2.2.2)
rake (12.3.1, 12.0.0)
rdoc (default: 5.0.0)
rubygems-bundler (1.4.5)
rvm (1.11.3.9)
scrypt (3.0.6)
sinatra (2.0.4)
sinatra-activerecord (2.0.13)
sinatra-asset_pipeline (0.0.1)
sinatra-contrib (2.0.4)
sinatra-flash (0.3.0)
slack-notifier (2.3.2)
sprockets (3.7.2)
sprockets-helpers (1.2.1)
sqlite3 (1.3.13)
test-unit (3.2.3)
thin (1.7.2)
thor (0.20.3)
thread_safe (0.3.6)
tilt (2.0.8)
toml (0.2.0)
twilio-ruby (5.15.2)
tzinfo (1.2.5)
xmlrpc (0.2.1)

<~/minicron/server/bin>$ sqlite3 --version
3.7.17 2013-05-20 00:56:22 118a3b35693b134d56ebd780123b7fd6f1497668
<~/minicron/server/bin>$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.6 (Maipo)
<~/minicron/server/bin>$ rpm -qi sqlite-devel
Name        : sqlite-devel
Version     : 3.7.17
Release     : 8.el7
Architecture: x86_64
Install Date: Thu 15 Nov 2018 03:11:35 PM EST
Group       : Development/Libraries
Size        : 374846
License     : Public Domain
Signature   : RSA/SHA256, Tue 25 Aug 2015 10:00:23 PM EDT, Key ID 199e2f91fd431d51
Source RPM  : sqlite-3.7.17-8.el7.src.rpm
Build Date  : Thu 23 Jul 2015 07:59:24 AM EDT
Build Host  : x86-035.build.eng.bos.redhat.com
Relocations : (not relocatable)
Packager    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
Vendor      : Red Hat, Inc.
URL         : http://www.sqlite.org/
Summary     : Development tools for the sqlite3 embeddable SQL database engine
Description :
This package contains the header files and development documentation
for sqlite. If you like to develop programs using sqlite, you will need
to install sqlite-devel.
danie1k commented 4 years ago

It's not only sqlite, but all db engines.

Try changing: https://github.com/jamesrwhite/minicron/blob/15702030f5ebb63537852626b19b408317acc6e9/server/minicron.gemspec#L27

to

  spec.add_runtime_dependency 'activerecord', '= 5.0.1'

and

https://github.com/jamesrwhite/minicron/blob/b207d41d2943f371ef7330bb832aaaf40aec6413/server/minicron.gemspec#L42

to

  spec.add_runtime_dependency 'activesupport', '= 5.0.1'

before bundle install