Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Executing "docker-compose run web ./populate.sh" reveals $VIRTUAL_ENV not set #7

Closed
kernie opened this issue Apr 18, 2018 · 6 comments

Comments

@kernie
Copy link

kernie commented Apr 18, 2018

Hi,

I created a docker-compose.yml file as described in file INSTALL.rst and got it "up".

Then executing

docker-compose run web ./populate.sh

lead to error messages indicating that the variable VIRTUAL_ENV in script populate.sh was not set. In consequence the initialization data was searched in /src/.... instead of /home/invenio/reroils/src/....

Maybe a

source /home/invenio/reroils/bin/activate

must be placed in the script.

Going over with

docker-compose exec web bash

and executing

./populate.sh

works perfectly.

Maarten

@iGormilhit
Copy link

iGormilhit commented Apr 18, 2018

Hi @kernie , glad to see that someone got interested in our Invenio project!
After the connection to the container, did you have to activate the virtualenv? Or launching the populate.sh was enough?

Edit: I don't see the difference between docker-compose exec web ./populate.sh and docker-compose exec web bash and then ./populate.sh, that's why I ask about the virtualenv activation.
Edit 2 : Did you launched first the install.sh script? This should have activate the virtualenv I think.

@kernie
Copy link
Author

kernie commented Apr 18, 2018

When using the second approach I hadn't to activate. To my understanding, the virtualenv is activated in the bashrc. So, logging in activates the virtualenv.

I placed a little script like:

#!/bin/bash
echo $VIRTUAL_ENV
echo "done envi.sh"

into the reroils environment and executed:

docker-compose exec web ./envi.sh

which gives


done envi.sh

However executing inside the ennvironment I get

./envi.sh 
/home/invenio/reroils
done envi.sh

Thanks,
Maarten

@jma
Copy link
Contributor

jma commented Apr 19, 2018

Hello @kernie,

did you run docker-compose up and wait until it has been finished before running docker-compose run web ./populate.sh? Just to be sure.

Thanks.

@kernie
Copy link
Author

kernie commented Apr 19, 2018

At least for the example with the envi.sh script I'm absolutely sure that everything was settled and ready.

I can rerun it.

Would a simple docker-compose down && docker-compose up be sufficient or is a "harder" reset necessary?

@jma
Copy link
Contributor

jma commented Apr 19, 2018

You have to remove your local repository (changeit in your docker-compose file).

@kernie
Copy link
Author

kernie commented Apr 19, 2018

OK,

removed the local_dir and rerun docker-compose up, followed the log to see when everything was ready, then doing docker-compose exec web ./populate.shand seeing:

Role "admins - Admins Group" added to user "User <id=1, [email protected]>" successfully.
Role "superusers - Super Users Group" added to user "User <id=1, [email protected]>" successfully.
Role "cataloguer - Cataloguer" added to user "User <id=2, [email protected]>" successfully.
Usage: dojson [OPTIONS] COMMAND1 [ARGS]... [COMMAND2 [ARGS]...]...

Error: Invalid value for "-i" / "--input": Could not open file: /src/reroils-data/data/patron.json: No such file or directory
Traceback (most recent call last):
  File "/home/invenio/reroils/bin/invenio", line 11, in <module>
    load_entry_point('invenio-app', 'console_scripts', 'invenio')()
  File "/home/invenio/reroils/lib/python3.5/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/invenio/reroils/lib/python3.5/site-packages/flask/cli.py", line 380, in main
    return AppGroup.main(self, *args, **kwargs)
  File "/home/invenio/reroils/lib/python3.5/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/invenio/reroils/lib/python3.5/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/invenio/reroils/lib/python3.5/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/invenio/reroils/lib/python3.5/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/invenio/reroils/lib/python3.5/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/invenio/reroils/lib/python3.5/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/invenio/reroils/lib/python3.5/site-packages/flask/cli.py", line 257, in decorator
    return __ctx.invoke(f, *args, **kwargs)
  File "/home/invenio/reroils/lib/python3.5/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/invenio/reroils/src/invenio-records/invenio_records/cli.py", line 82, in create
    data = json.load(source)
  File "/usr/local/lib/python3.5/json/__init__.py", line 268, in load
    parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
  File "/usr/local/lib/python3.5/json/__init__.py", line 319, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.5/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.5/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

The line Could not open file: /src/reroils-data/data/patron.json doesn't show the VIRTUAL_ENV part which is empty....

iGormilhit pushed a commit that referenced this issue May 1, 2018
iGormilhit pushed a commit that referenced this issue May 2, 2018
jma pushed a commit that referenced this issue May 2, 2018
@jma jma closed this as completed in b392cae May 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants