[SOLVED] Problem with database version and Appmarket

Hi all,

I installed the Appmarket addon in a VM, following these steps:
AppMarket Installation and Configuration
and also paying attention for the tips from @esfreire:
enter link description here
enter link description here
This installation was done without errors, all OK.

Now, I’m trying to install AppMarket in another virtual machine, which also has a opennebula-sunstone & opennebula-server previous installation. However, there are several issues which I can’t solve, because I followed the same steps that in the first VM, but the installation failed when I trying to start the opennebula-appmarket service

[root@test-opennebula centos]# /etc/init.d/opennebula-appmarket start Reloading systemd: [ OK ] Starting opennebula-appmarket (via systemctl): Job for opennebula-appmarket.service failed because the control process exited with error code. See "systemctl status opennebula-appmarket.service" and "journalctl -xe" for details. [FALLÓ]

This is the output of the opennebula-appmarket status:
> [root@test-opennebula centos]# systemctl status opennebula-appmarket -l
> ● opennebula-appmarket.service - LSB: start and stop opennebula-appmarket
> Loaded: loaded (/etc/rc.d/init.d/opennebula-appmarket)
> Active: failed (Result: exit-code) since mar 2016-03-15 10:47:16 CET; 5min ago
> Docs: man:systemd-sysv-generator(8)
> Process: 29033 ExecStart=/etc/rc.d/init.d/opennebula-appmarket start (code=exited, status=1/FAILURE)

> mar 15 10:47:14 test-opennebula runuser[29037]: pam_unix(runuser:session): session opened for user oneadmin by (uid=0)
> mar 15 10:47:14 test-opennebula opennebula-appmarket[29033]: Starting AppMarket Server daemon: Stale .lock detected. Erasing it.
> mar 15 10:47:14 test-opennebula opennebula-appmarket[29033]: /usr/bin/appmarket-server: line 71: /var/run/one/appmarket-server.pid: Permission denied
> mar 15 10:47:16 test-opennebula opennebula-appmarket[29033]: Error executing appmarket-server.
> mar 15 10:47:16 test-opennebula opennebula-appmarket[29033]: Check /var/log/one/appmarket-server.error or /var/log/one/appmarket-server.log for more information
> mar 15 10:47:16 test-opennebula opennebula-appmarket[29033]: [FAILED]
> mar 15 10:47:16 test-opennebula systemd[1]: opennebula-appmarket.service: control process exited, code=exited status=1
> mar 15 10:47:16 test-opennebula systemd[1]: Failed to start LSB: start and stop opennebula-appmarket.
> mar 15 10:47:16 test-opennebula systemd[1]: Unit opennebula-appmarket.service entered failed state.
> mar 15 10:47:16 test-opennebula systemd[1]: opennebula-appmarket.service failed.

Here are the contents of the file appmarket-server.error, which says that an upgrade is required

[root@test-opennebula centos]# cat /var/log/one/appmarket-server.error 
:public is no longer used to avoid overloading Module#public, use :public_folder or :public_dir instead
    from /usr/lib/one/ruby/oneapps/market/controllers/appmarket-server.rb:52:in `block in <main>'
Version mismatch, upgrade required. 
DB VERSION: 20003
AppMarket VERSION: 200100
Run the 'appmarket-db' command`

And if I run the command appmarket-db, the output says:

[root@test-opennebula centos]# appmarket-db
The DB is already in the last version

Any ideas? Thanks for your help.

Best regards,

Pablo

Another issue which I found during the installation of AppMarket is related to the installation of the required gems, in the installation guide previously mentioned, the following step says:

Required gems. To install the gems needed by AppMarket do this as root:
cd /usr/lib/one/ruby/oneapps/market
bundle install
gem 'json'
gem 'haml'
gem 'sinatra'
gem 'mongo'
gem 'bson_ext'
gem 'rspec'
gem 'rack-test'
gem 'redcarpet'
gem 'mail'
gem 'bcrypt-ruby'
gem 'opennebula-cli'

What does it means “root” user? It means that we must be logged as oneadmin user? I installed it logged as system root user, but I doubted if this is correct. The following message appears if I install the required gems as root:

[root@opennebula01 market]# /usr/local/bin/bundle install
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root
users on this machine.

As you can see, I have to use the absolute path for the bundle executable : /usr/local/bin/bundle install, because if I use only bundle install, I’m not able to execute bundle:

[root@opennebula01 market]# bundle install
bash: bundle: no se encontró la orden

Another problem that I found is related to the install of nokogiri gem:

An error occurred while installing nokogiri (1.6.7.2), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.7.2'` succeeds before bundling.

so I installed it with the suggested option:

If you are using Bundler, tell it to use the option:
    bundle config build.nokogiri --use-system-libraries
    bundle install

This option runs well for me, there are any problem to install it on this way?

Finally, the output is:

Rubygems 2.0.14 is not threadsafe, so your gems will be installed one at a time. Upgrade to Rubygems 2.1.0 or higher to enable parallel gem installation.
Using bcrypt 3.1.11
Using bson 1.12.5
Using builder 3.2.2
Using tilt 2.0.2
Using json 1.8.3
Using mime-types 2.99.1
Using mini_portile2 2.0.0
Using trollop 2.1.2
Using rack 1.6.4
Using redcarpet 2.3.0
Using bundler 1.11.2
Using bson_ext 1.12.5
Using mongo 1.12.5
Using haml 4.0.7
Using mail 2.6.3
Installing nokogiri 1.6.7.2 with native extensions
Using rack-protection 1.5.3
Installing rbvmomi 1.8.2
Using sinatra 1.4.7
Installing opennebula 4.14.2
Installing opennebula-cli 4.14.2
Bundle complete! 10 Gemfile dependencies, 21 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.

Thanks in advance!

Cheers,

Pablo

… up.

No ideas?

:expressionless:

Could you check the contents of your Mongo DB? There should be:

  • a “market” db (if it was not changed in the appmarket conf)
  • a “db_versioning” collection with the version number

Hi @dmolina,

thanks for you reply,

This is the output of the db_versioning table in the corrupt opennebula-server installation:

 > db.db_versioning.find()
{ "_id" : ObjectId("56d5b2e3e21e886009000002"), "version" : "2.1.0", "version_code" : 200100, "timestamp" : 1456845539 }
{ "_id" : ObjectId("56d6cf41e21e8864d3000001"), "version" : "1.9.80", "version_code" : 10980, "timestamp" : 1456918337 }
{ "_id" : ObjectId("56d6cf41e21e8864d3000002"), "version" : "1.9.85", "version_code" : 10985, "timestamp" : 1456918337 }
{ "_id" : ObjectId("56d6cf41e21e8864d3000003"), "version" : "1.9.90", "version_code" : 10990, "timestamp" : 1456918337 }
{ "_id" : ObjectId("56d6cf41e21e8864d3000004"), "version" : "2.0.0", "version_code" : 20000, "timestamp" : 1456918337 }
{ "_id" : ObjectId("56d6cf41e21e8864d3000005"), "version" : "2.0.1", "version_code" : 20001, "timestamp" : 1456918337 }
{ "_id" : ObjectId("56d6cf41e21e8864d3000006"), "version" : "2.0.2", "version_code" : 20002, "timestamp" : 1456918337 }
{ "_id" : ObjectId("56d6cf41e21e8864d3000007"), "version" : "2.0.3", "version_code" : 20003, "timestamp" : 1456918337 }

Finally, I decided to make a new installation of opennebula-server & appmarket in a new clean virtual machine (centos 7), which works well, and this is the output of the db_versioning of the machine with appmarket running well,

> db.db_versioning.find()
{ "_id" : ObjectId("56e8359b8f93ee3862000002"), "version" : "2.1.0", "version_code" : 200100, "timestamp" : 1458058651 }

Nevertheless, although I have a new installation, I have kept the old one which has failed to start. I would appreciate any help to fix this problem. :sweat:

Best regards!

Hi all,

Finally I solved this issue, thanks to @dmolina for the advices.

I only remove all the documents in the collection with the exception of the document corresponding to “version” : “2.1.0”.

The next step is to restart opennebula-appmarket service, and everything works correctly.

P.D. If you execute the command appmarket-db after remove the database documents, the problem comes back.

Regards,