Comments (12)
Seeing similar behavior when running the latest Vagrant install of origin, as well.
from django-ex.
@cjryan I can reproduce this on an aws RHEL machine with the latest origin ami
from django-ex.
@cjryan the problem is origin v1.1.3 + template@latest-master.
See openshift/origin#7379 (comment)
Unfortunately, unlike in origin's sample-app, this repo is not being tagged with every origin release.
Please use an older version of the template for now:
$ oc new-app https://raw.githubusercontent.com/openshift/django-ex/4706c39a7035/openshift/templates/django-postgresql.json
And for the next releases we'll have vendored copies of the templates in origin:
https://github.com/openshift/origin/tree/master/examples/quickstarts
Other than that we need to discuss if we want to make any changes here.
@bparees any opinion on the matter?
from django-ex.
@rhcarvalho thanks for taking a look at this. Unfortunately, that version of the the older template won't work, as we are explicitly testing the
"postCommit": {
"script": "./manage.py test"
}
functionality. It looks like we'll have to hang tight until the vendored copies of the templates are available.
from django-ex.
@cjryan aha got it. You can use the command and/or args form:
"postCommit": {
"args": ["./manage.py", "test"]
}
or
"postCommit": {
"command": ["/bin/bash", "-c", "./manage.py", "test"]
}
or
"postCommit": {
"command": ["/bin/bash", "-c"],
"args": ["./manage.py", "test"]
}
and some other combinations of those ;)
The underlying problem here is that v1.1.3 runs the script
form of the hook using /bin/sh -c
, and that doesn't work with our automation to enable scl collections. After the release we changed it to /bin/sh -ic
which will work with scl out-of-the-box.
If you still want to test the script form in v1.1.3, you will need to enable the Python collection explicitly in the script:
"postCommit": {
"script": "scl_enable python[VERSION] ./manage.py test"
}
from django-ex.
FWIW, the error message ImportError: No module named django.core.management
is coming from the system Python, not from the SCL Python version where django and all other dependencies were installed.
from django-ex.
This problem would be avoided if a Python virtual environment was being used in the image and the bin directory for that was in the PATH. SCL Python only then needs to be enabled during the build phase for the image. See sclorg/s2i-python-container#90 (comment)
from django-ex.
@GrahamDumpleton I'm not entirely sure, at least not for all apps.
If you run something that depends on a shared library, scl_enable
is also setting LD_LIBRARY_PATH
, among other things, that would not be correctly set in the virtualenv. Does that make sense? Or is that important only on build time?
I'm all in favor of having the Python image use virtualenv.
While it could alleviate the problem for Python, it's a non-solution for other languages. We still need to deal with enabling collections...
from django-ex.
Especially if the install location of SCL packages is fixed as being /opt/rh
they should be compiling the Python binaries with a LD_RUN_PATH
compiled into them of /opt/rh/python27/root/usr/lib64
. That is what one would normally do if installing Python into a non standard location. That way LD_LIBRARY_PATH
isn't needed at run time. Either way, simply set LD_LIBRARY_PATH
in the Docker image.
from django-ex.
@GrahamDumpleton thanks for the explanation! I don't know how the SCL Python binaries are compiled. The LD_LIBRARY_PATH
was one that came to mind because it tripped me up in the past ;)
Setting envs in the Dockerfile is something we have discussed though, but yet haven't gone that path because AFAIK we don't have a clean way to get what are the env changes after a "scl_enable some-collection" run.
If you have any trick on how to do that, I'd be interested to hear/read ;)
I believe if we had a script that we run and it spits out Dockerfile ENV instructions that are equivalent to enabling a collection, that would make our lives happier.
💡 Perhaps a Python script that captures the current environment, run scl_enable
and then compare the new with the old environment interpreting diffs in a smart way (like additions to PATH
instead of replacement).
from django-ex.
The problem has been explained and solutions listed in #34 (comment)
Closing this, @cjryan please let me know if you still have trouble and I can reopen.
from django-ex.
@rhcarvalho @GrahamDumpleton Apologies for the delayed response, thank you for the solutions to the issue at hand.
from django-ex.
Related Issues (20)
- Contribution: Flask-ex (based on this repo) HOT 2
- Update example in readme to Python to 3.6 HOT 1
- upgrade psycopg2 to 2.7.7 HOT 1
- Changes for django 2.1 support HOT 1
- Unable to start django HOT 2
- add new build environment variable to allow this template to be easily deployed in air gapped environments HOT 1
- Update unicorn to 19.10.0
- Upgrade to Django 2.2 HOT 1
- Dead links HOT 1
- Different database password in Django and PostgreSQL containers HOT 2
- Branch 2.2.x sqlite version problem HOT 2
- Master branch suggest old Django version HOT 3
- module_path, class_name = dotted_path.rsplit('.', 1) ValueError: not enough values to unpack (expected 2, got 1) HOT 4
- Django 3.2 LTS
- Example Django apps do not work with FIPS enabled clusters HOT 9
- ImproperlyConfigured HOT 1
- Testing issue creation for samples operator HOT 1
- No Action Required !! Testing automation workflow HOT 1
- Django 4.2 LTS is out HOT 2
- Adding a template for using css HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-ex.