Repository: rucio/rucio

Issue:
docker setup issues
Motivation
----------

I had a few issues setting up the dev environment, mainly with the documentation at `etc/docker/dev/README.rst`.


Modification
------------

`docker exec -it dev_rucio_1 bin/bash` has a typo, it should be `/bin/bash`

It should be mentioned that SELinux will block access to the directories mounted inside the container so it should be disabled.

`logshow` doesn't work:

```[root@rucio rucio]# logshow
 --*- multitail 6.4.2 (C) 2003-2014 by folkert@vanheusden.com -*--

The following problem occured:
-----------------------------
ttyname(0) failed.
If this is a bug, please report the following information:
The last system call returned: 2 which means "No such file or directory"
Terminated
```
After this the terminal freezes up and the multitail processes have to be forcibly killed from outside the container.

The tests create a lot of junk in the database (RSEs, accounts, etc), is there a way to reset the database back to a clean state?



Discussion:
You can run `tools/run_tests_docker.sh -i` to do just the database init again. I'll add the rest to the docs. 

For logshow, you are missing a pseudo-terminal in docker, are you sure you did `-t` to `docker exec` ? Also, make sure you run a recent docker version (e.g., the default in CentOS is `v1.xx`, you need at least `v12.xx`, that's 11 major releases in between ;-) If you install the one from the linked repo in the docs you will get `v19.xx`.
Indeed I was using the default CentOS 7 version 1.13. After updating to 19.03.4 it works. Maybe you can add the requirement for a newer version to the doc as well?



Resolving patch:
diff --git a/lib/rucio/daemons/conveyor/finisher.py b/lib/rucio/daemons/conveyor/finisher.py
--- a/lib/rucio/daemons/conveyor/finisher.py
+++ b/lib/rucio/daemons/conveyor/finisher.py
@@ -1,4 +1,4 @@
-# Copyright 2015-2018 CERN for the benefit of the ATLAS collaboration.
+# Copyright 2015-2019 CERN for the benefit of the ATLAS collaboration.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -14,11 +14,12 @@
 #
 # Authors:
 # - Wen Guan <wguan.icedew@gmail.com>, 2015-2016
-# - Mario Lassnig <mario.lassnig@cern.ch>, 2015
+# - Mario Lassnig <mario.lassnig@cern.ch>, 2015-2019
 # - Vincent Garonne <vgaronne@gmail.com>, 2015-2018
 # - Martin Barisits <martin.barisits@cern.ch>, 2015-2019
 # - Cedric Serfon <cedric.serfon@cern.ch>, 2017-2019
 # - Hannes Hansen <hannes.jakob.hansen@cern.ch>, 2018
+# - Robert Illingworth <illingwo@fnal.gov>, 2019
 # - Andrew Lister <andrew.lister@stfc.ac.uk>, 2019
 #
 # PY3K COMPATIBLE
@@ -149,15 +150,16 @@ def finisher(once=False, sleep_time=60, activities=None, bulk=100, db_bulk=1000)
                 logging.error('%s %s', prepend_str, traceback.format_exc())
         except Exception as error:
             logging.critical('%s %s', prepend_str, str(error))
+
+        if once:
+            return
+
         end_time = time.time()
         time_diff = end_time - start_time
         if time_diff < sleep_time:
             logging.info('%s Sleeping for a while :  %s seconds', prepend_str, (sleep_time - time_diff))
             graceful_stop.wait(sleep_time - time_diff)
 
-        if once:
-            return
-
     logging.info('%s Graceful stop requests', prepend_str)
 
     heartbeat.die(executable, hostname, pid, hb_thread)


Test patch: