genouest / biomaj-watcher

Web interface for Biomaj management
1 stars 4 forks source link

"Configuration file '+bank'.properties does not exists" #15

Closed markiskander closed 8 years ago

markiskander commented 8 years ago

Hey guys,

I'm currently setting up BioMAJ and BioMAJ-Watcher in a docker container. I've got it running and everything so far, but when I try to create a new bank, I get the following error:

2015-09-17 20:01:55,872 DEBUG [root][waitress] Initialize alu 2015-09-17 20:01:55,872 ERROR [root][waitress] Bank configuration file does not exists 2015-09-17 20:01:55,873 ERROR [waitress][waitress] Exception when serving /bank/alu/config Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/waitress-0.8.10-py2.7.egg/waitress/channel.py", line 336, in service task.service() File "/usr/local/lib/python2.7/dist-packages/waitress-0.8.10-py2.7.egg/waitress/task.py", line 169, in service self.execute() File "/usr/local/lib/python2.7/dist-packages/waitress-0.8.10-py2.7.egg/waitress/task.py", line 388, in execute app_iter = self.channel.server.application(env, start_response) File "/usr/local/lib/python2.7/dist-packages/pyramid-1.5.1-py2.7.egg/pyramid/router.py", line 242, in call response = self.invoke_subrequest(request, use_tweens=True) File "/usr/local/lib/python2.7/dist-packages/pyramid-1.5.1-py2.7.egg/pyramid/router.py", line 217, in invoke_subrequest response = handle_request(request) File "/usr/local/lib/python2.7/dist-packages/pyramid_debugtoolbar-2.4.1-py2.7.egg/pyramid_debugtoolbar/toolbar.py", line 178, in toolbar_tween return handler(request) File "/usr/local/lib/python2.7/dist-packages/pyramid-1.5.1-py2.7.egg/pyramid/tweens.py", line 21, in excview_tween response = handler(request) File "/usr/local/lib/python2.7/dist-packages/pyramid-1.5.1-py2.7.egg/pyramid/router.py", line 163, in handle_request response = view_callable(context, request) File "/usr/local/lib/python2.7/dist-packages/pyramid-1.5.1-py2.7.egg/pyramid/config/views.py", line 596, in call return view(context, request) File "/usr/local/lib/python2.7/dist-packages/pyramid-1.5.1-py2.7.egg/pyramid/config/views.py", line 329, in attr_view return view(context, request) File "/usr/local/lib/python2.7/dist-packages/pyramid-1.5.1-py2.7.egg/pyramid/config/views.py", line 305, in predicate_wrapper return view(context, request) File "/usr/local/lib/python2.7/dist-packages/pyramid-1.5.1-py2.7.egg/pyramid/config/views.py", line 355, in rendered_view result = view(context, request) File "/usr/local/lib/python2.7/dist-packages/pyramid-1.5.1-py2.7.egg/pyramid/config/views.py", line 501, in _requestonly_view response = view(request) File "/home/bio/biomaj/biomaj-watcher/biomajwatcher/views.py", line 484, in update_bank_config bank = Bank(name, no_log=True) File "/usr/local/lib/python2.7/dist-packages/biomaj-3.0.7-py2.7.egg/biomaj/bank.py", line 53, in init self.config = BiomajConfig(self.name, options) File "/usr/local/lib/python2.7/dist-packages/biomaj-3.0.7-py2.7.egg/biomaj/config.py", line 129, in init raise Exception('Configuration file '+bank+'.properties does not exists') Exception: Configuration file alu.properties does not exists

I input the information in the fields exactly the same as on the host machine, where it saves properly. But it refuses to save in the docker and gives that error in the console.

If it helps diagnose potential installation issues, the docker project can be seen here: https://github.com/markiskander/biomaj-docker

Thanks again!

osallou commented 8 years ago

When creating/updating a bank config, the watcher tries to load existing config file. If no one is present, then it creates one and writes it to disk. Finally, it loads the existing or created property file.

It occurs at this code in biomajwatcher/views.py, line 480:

conf_dir = BiomajConfig.global_config.get('GENERAL', 'conf.dir')
...
config_bank_file = open(os.path.join(conf_dir,name+".properties"),'w')

There could be write errors in Docker context. Does conf dir exists? Your global.properties specifies conf.dir=/home/bio/biomaj/etc, but I see to dir creation nor chmod on this dir in your Dockerfile.

By the way, I do not recommend to install mongo in your Docker instance. This is not a good Docker practice, where you should separate as much as possbile concerns/services. You should rather rely on a second dedicated mongo docker instance. This will furthermore remove the concern of mongo startup delays. You could simply tell users to start a mongo instance (already available on DockerHub), then start your biomaj instance, configuring the mongo url at satrtup with an environment variable, or using Docker link (configure watcher to connect to a biomajmongo instance) and start the mongo instance with such name. Then start your instance with --link option. This is not the point of this ticket but we can discuss of this offline or as a ticket in your project if you want to.

markiskander commented 8 years ago

Hey,

I'll look into what you said about Mongo. Thanks for the advice on that!

As for the dir creation, my mistake. I thought the folders were generated but it appears I needed to manually create them. The Docker's building now so I suppose I'll find out if it works in about 20 minutes or so.

Thank again!

markiskander commented 8 years ago

So it still gives the same error. I added this line to my Dockerfile:

RUN cd /home/bio/biomaj/ && mkdir etc && mkdir log && mkdir process && mkdir cache && mkdir banks

And my global.properties file contains: data.dir=/home/bio/biomaj/banks

conf.dir=/home/bio/biomaj/etc log.dir=/home/bio/biomaj/log process.dir=/home/bio/biomaj/process cache.dir=/home/bio/biomaj/cache

So I'm not sure why the error shows up. Docker usually logs into the container as root so I don't think the issue is with permissions. Any ideas?

Edit: Just in case, I added the default user to sudo in the Dockerfile. I'll see if it works after build.

osallou commented 8 years ago

could be an access right issue with user executing the watcher

in the mkdir, you need to chown dirs to user bio

markiskander commented 8 years ago

Alright, I'll try chown bio folders in the Dockerfile. I'll find out if it works in 20 minutes.

Thanks again

Edit: I did chown -R the whole biomaj directory. So hopefully this should fix any ownership issues

markiskander commented 8 years ago

It appears to have been fixed by doing the chown command. Thank you again!