Skip to content

Commit

Permalink
Support #380 by undoing all of the upgrades from #374
Browse files Browse the repository at this point in the history
  • Loading branch information
nutjob4life committed Nov 15, 2024
1 parent b438ae2 commit a6fbd4d
Show file tree
Hide file tree
Showing 20 changed files with 97 additions and 84 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/delivery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:
push:
branches:
- main
- i374
- i380
paths:
- 'src/**'
- 'docker/Dockerfile'
Expand Down
64 changes: 38 additions & 26 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# `numpy-gitpod` and `numpy-dev`—and I'm not going to use a `-dev` image in production.) See the `py_deps`
# below.

FROM alpine:3.19
FROM alpine:3.18


# Configurable Arguments
Expand Down Expand Up @@ -58,8 +58,8 @@ RUN \
:

RUN \
build_deps="automake bzip2-dev cyrus-sasl-dev git g++ gcc libffi-dev libjpeg-turbo-dev libwebp-dev libxml2-dev libxslt-dev make musl-dev openjpeg-dev openldap-dev openssl-dev pcre-dev python3-dev postgresql-dev su-exec tiff-dev zlib-dev py3-pip" &&\
run_deps="curl krb5-libs libgcc libjpeg-turbo libldap libpq libsasl libstdc++ libwebp libxml2 libxslt netcat-openbsd openjpeg python3 rsync tiff tidyhtml py3-gunicorn py3-flask" &&\
build_deps="automake bzip2-dev cyrus-sasl-dev git g++ gcc libffi-dev libjpeg-turbo-dev libwebp-dev libxml2-dev libxslt-dev make musl-dev openjpeg-dev openldap-dev openssl-dev pcre-dev python3-dev postgresql-dev su-exec tiff-dev zlib-dev" &&\
run_deps="curl krb5-libs libgcc libjpeg-turbo libldap libpq libsasl libstdc++ libwebp libxml2 libxslt netcat-openbsd openjpeg python3 rsync tiff tidyhtml" &&\
py_deps="py3-numpy py3-pandas py3-pillow py3-psycopg2 py3-biopython" &&\
/sbin/apk update --quiet &&\
/sbin/apk add --no-progress --quiet --virtual /edrn-build $build_deps &&\
Expand All @@ -69,21 +69,31 @@ RUN \

# Over on GitHub Actions, we need to fail fast and not hit the six hour run limit, so make sure we got it right

RUN echo `/usr/bin/python3 --version` | grep -q '^Python 3\.11\.'
RUN echo `/usr/bin/python3 -c 'import numpy; print(numpy.__version__)'` | grep -q '^1\.25\.'
RUN echo `/usr/bin/python3 -c 'import pandas; print(pandas.__version__)'` | grep -q '^2\.0\.'
RUN echo `/usr/bin/python3 -c 'import PIL; print(PIL.__version__)'` | grep -q '^10\.3\.'
RUN echo `/usr/bin/python3 -c 'import psycopg2; print(psycopg2.__version__)'` | grep -q '^2\.9\.'
RUN [ "`/usr/bin/python3 --version`" = "Python 3.11.10" ]
RUN [ "`/usr/bin/python3 -c 'import numpy; print(numpy.__version__)'`" = "1.24.4" ]
RUN [ "`/usr/bin/python3 -c 'import pandas; print(pandas.__version__)'`" = "1.5.3" ]
RUN [ "`/usr/bin/python3 -c 'import PIL; print(PIL.__version__)'`" = "9.5.0" ]
RUN [ "`/usr/bin/python3 -c 'import psycopg2; print(psycopg2.__version__)'`" = "2.9.6 (dt dec pq3 ext lo64)" ]
RUN [ "`/usr/bin/python3 -c 'import Bio; print(Bio.__version__)'`" = "1.81" ]

# RUN echo `/usr/bin/python3 --version` | grep -q '^Python 3\.11\.'
# RUN echo `/usr/bin/python3 -c 'import numpy; print(numpy.__version__)'` | grep -q '^1\.25\.'
# RUN echo `/usr/bin/python3 -c 'import pandas; print(pandas.__version__)'` | grep -q '^2\.0\.'
# RUN echo `/usr/bin/python3 -c 'import PIL; print(PIL.__version__)'` | grep -q '^10\.3\.'
# RUN echo `/usr/bin/python3 -c 'import psycopg2; print(psycopg2.__version__)'` | grep -q '^2\.9\.'
# Note that Biopython does not use MAJOR.MINOR.MICRO versions so there's no trailing dot here
RUN echo `/usr/bin/python3 -c 'import Bio; print(Bio.__version__)'` | grep -q '^1\.81'
# RUN echo `/usr/bin/python3 -c 'import Bio; print(Bio.__version__)'` | grep -q '^1\.81'

RUN \
: See https://github.com/python-ldap/python-ldap/issues/432 for workaround to Python LDAP vs OpenLDAP 2.5 issue &&\
echo 'INPUT ( libldap.so )' > /usr/lib/libldap_r.so &&\
/usr/bin/python3 -m venv --system-site-packages --upgrade-deps /app &&\
/usr/bin/install -o edrn -g edrn -d /app/media /app/static /app/wheels &&\
/usr/bin/python3 -m ensurepip --upgrade &&\
/usr/bin/pip3 install --quiet --progress-bar off --upgrade pip setuptools wheel &&\
/usr/bin/pip3 install gunicorn==20.1.0 &&\
/usr/bin/install -o edrn -g edrn -d /app /app/media /app/static /app/wheels &&\
:


COPY --chown=edrn:edrn ./dist/*.whl /app/wheels/

# Normally a single RUN would work fine:
Expand All @@ -103,30 +113,32 @@ COPY --chown=edrn:edrn ./dist/*.whl /app/wheels/
# Except the Docker plugin for Jenkins at CBIIT chokes with an HTTP 400 error because apparently
# the single layer made above is too big. So, we have to do these in separate RUNs:

RUN /app/bin/pip3 install --progress-bar off /app/wheels/edrnsite.controls-*.whl
RUN /app/bin/pip3 install --progress-bar off /app/wheels/edrnsite.streams-*.whl
RUN /app/bin/pip3 install --progress-bar off /app/wheels/edrnsite.content-*.whl
RUN /app/bin/pip3 install --progress-bar off /app/wheels/edrn.collabgroups-*.whl
RUN /app/bin/pip3 install --progress-bar off /app/wheels/edrn.theme-*.whl
RUN /app/bin/pip3 install --progress-bar off /app/wheels/edrnsite.ploneimport-*.whl
RUN /app/bin/pip3 install --progress-bar off /app/wheels/eke.geocoding-*.whl
RUN /app/bin/pip3 install --progress-bar off /app/wheels/eke.knowledge-*.whl
RUN /app/bin/pip3 install --progress-bar off /app/wheels/eke.biomarkers-*.whl
RUN /app/bin/pip3 install --progress-bar off /app/wheels/edrnsite.search-*.whl
RUN /app/bin/pip3 install --progress-bar off /app/wheels/edrn.metrics-*.whl
RUN /app/bin/pip3 install --progress-bar off /app/wheels/edrnsite.policy-*.whl
RUN /usr/bin/pip3 install --progress-bar off /app/wheels/edrnsite.controls-*.whl
RUN /usr/bin/pip3 install --progress-bar off /app/wheels/edrnsite.streams-*.whl
RUN /usr/bin/pip3 install --progress-bar off /app/wheels/edrnsite.content-*.whl
RUN /usr/bin/pip3 install --progress-bar off /app/wheels/edrn.collabgroups-*.whl
RUN /usr/bin/pip3 install --progress-bar off /app/wheels/edrn.theme-*.whl
RUN /usr/bin/pip3 install --progress-bar off /app/wheels/edrnsite.ploneimport-*.whl
RUN /usr/bin/pip3 install --progress-bar off /app/wheels/eke.geocoding-*.whl
RUN /usr/bin/pip3 install --progress-bar off /app/wheels/eke.knowledge-*.whl
RUN /usr/bin/pip3 install --progress-bar off /app/wheels/eke.biomarkers-*.whl
RUN /usr/bin/pip3 install --progress-bar off /app/wheels/edrnsite.search-*.whl
RUN /usr/bin/pip3 install --progress-bar off /app/wheels/edrn.metrics-*.whl
RUN /usr/bin/pip3 install --progress-bar off /app/wheels/edrnsite.policy-*.whl

# And this too:

RUN \
cd /app &&\
: Get the static files ready &&\
/sbin/su-exec edrn /usr/bin/env LDAP_BIND_PASSWORD=unused SIGNING_KEY=unused /app/bin/django-admin collectstatic --settings edrnsite.policy.settings.ops --no-input --clear --link &&\
/sbin/su-exec edrn /usr/bin/env LDAP_BIND_PASSWORD=unused SIGNING_KEY=unused /usr/bin/django-admin collectstatic --settings edrnsite.policy.settings.ops --no-input --clear --link &&\
: Clean up clean up everybody everywhere &&\
: PrismaCloud does not like pip to be in the image &&\
/usr/bin/pip3 uninstall --yes --quiet pip &&\
/sbin/apk del --quiet /edrn-build &&\
/bin/rm -rf /app/wheels &&\
/bin/rm -rf /var/cache/apk/* &&\
/bin/chown -R edrn:edrn /app/lib/python3.*/site-packages &&\
/bin/chown -R edrn:edrn /usr/lib/python3.*/site-packages &&\
:

COPY --chown=edrn:edrn docker/*.py /app/
Expand All @@ -141,7 +153,7 @@ EXPOSE 8000
VOLUME ["/app/media"]
USER edrn
WORKDIR /app
ENTRYPOINT ["/app/bin/python3"]
ENTRYPOINT ["/usr/bin/python3"]
CMD ["/usr/bin/gunicorn", "-c", "/app/gunicorn.conf.py"]
HEALTHCHECK --interval=5m --timeout=2m --start-period=10m CMD /usr/bin/curl --fail --retry 6 --max-time 5 --retry-delay 10 --retry-max-time 60 http://127.0.0.1:8000/ || /bin/sh -c 'killall5 -TERM && (/bin/sleep 10; killall5 -KILL)'

Expand Down
4 changes: 2 additions & 2 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ services:
#
# Port 6379, not published.
cache:
image: redis:7.4.1-alpine3.20
image: redis:7.0.11-alpine3.18
networks:
- lattice
restart: on-failure
Expand Down Expand Up @@ -174,7 +174,7 @@ services:
# Worker processes run Django functions so it needs all the same env vars as `portal`.
worker:
image: ${EDRN_IMAGE_OWNER-edrndocker/}edrn-portal:${EDRN_VERSION:-6.3.0-uid26013}
entrypoint: ['/app/bin/django-admin', 'worker', '--verbosity', '2']
entrypoint: ['/usr/bin/django-admin', 'worker', '--verbosity', '2']
volumes:
-
type: bind
Expand Down
4 changes: 2 additions & 2 deletions src/edrn.collabgroups/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ package_dir =
packages = find_namespace:
python_requires = >= 3.9
install_requires =
django < 6
wagtail < 6
django < 5, > 4
wagtail < 6, > 5
edrnsite.streams
edrnsite.content

Expand Down
4 changes: 2 additions & 2 deletions src/edrn.metrics/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ packages = find_namespace:
python_requires = >= 3.9
install_requires =
edrn.auth
django < 6
wagtail < 6
django < 5, > 4
wagtail < 6, > 5


[options.packages.find]
Expand Down
4 changes: 2 additions & 2 deletions src/edrn.theme/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ python_requires = >= 3.9
install_requires =
edrn.auth
edrnsite.controls
django < 6
wagtail < 6
django < 5, > 4
wagtail < 6, > 5


[options.packages.find]
Expand Down
6 changes: 3 additions & 3 deletions src/edrnsite.content/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ packages = find_namespace:
python_requires = >= 3.9
install_requires =
edrnsite.streams
django < 6
wagtail < 6
django < 5, > 4
wagtail < 6, > 5
django-widget-tweaks ~= 1.4.12
wagtail-django-recaptcha ~= 1.0
django-recaptcha ~= 3.0.0
gdown ~= 4.7.1
pandas ~= 2.0.3 # Must match py3-pandas package in Dockerfile
pandas ~= 1.5.3 # Must match py3-pandas package in Dockerfile


# A couple of the forms in this package actually depend on eke.knowledge, but eke.knowledge depends on
Expand Down
4 changes: 2 additions & 2 deletions src/edrnsite.controls/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ package_dir =
packages = find:
python_requires = >= 3.9
install_requires =
django < 6
wagtail < 6
django < 5, > 4
wagtail < 6, > 5


[options.packages.find]
Expand Down
4 changes: 2 additions & 2 deletions src/edrnsite.ploneimport/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ package_dir =
packages = find_namespace:
python_requires = >= 3.9
install_requires =
django < 6
wagtail < 6
django < 5, > 4
wagtail < 6, > 5


[options.packages.find]
Expand Down
18 changes: 9 additions & 9 deletions src/edrnsite.policy/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@ install_requires =
edrnsite.ploneimport
eke.biomarkers
edrn.metrics
edrn.auth ~= 2.0.1
celery[redis] ~= 5.4.0
edrn.auth ~= 2.0.0
celery[redis] ~= 5.2.7
dj-database-url ~= 2.1.0
django ~= 5.0.9
django-auth-ldap ~= 5.1.0
django ~= 4.2.9
django-auth-ldap ~= 4.1.0
django-celery-results ~= 2.5.1
django-redis ~= 5.4.0
pillow ~= 10.3.0 # Must match py3-pillow package installed in Dockerfile
psycopg2 ~= 2.9.9 # Must match py3-pyscopg2 package installed in Dockerfile
pillow == 9.5.0 # Must match py3-pillow package installed in Dockerfile
psycopg2 == 2.9.6 # Must match py3-pyscopg2 package installed in Dockerfile
pymemcache ~= 3.5.2
wagtail == 5.2.6
wagtail == 5.2.3
wagtail-favicon ~= 0.3.0
wagtail-metadata ~= 5.0.0
tzdata == 2024.2
wagtailmenus ~= 4.0.1
tzdata == 2022.1
wagtailmenus ~= 3.1.9
wagtail-robots @ git+https://github.com/unexceptable/wagtail-robots.git@9a47b6c09bec120bd5a85f4c7c1856cdc7f71f51


Expand Down
4 changes: 2 additions & 2 deletions src/edrnsite.policy/src/edrnsite/policy/settings/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
# Debug Mode
# ----------
#
# This had better be off!
# This had better be off! TURN THIS BACK TO FALSE!!!
#
# 🔗 https://docs.djangoproject.com/en/3.2/ref/settings/#debug

DEBUG = True
DEBUG = False


# Secret Key
Expand Down
4 changes: 2 additions & 2 deletions src/edrnsite.search/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ packages = find_namespace:
python_requires = >= 3.9
install_requires =
edrnsite.controls
django < 6
wagtail < 6
django < 5, > 4
wagtail < 6, > 5
elasticsearch == 7.13.4


Expand Down
4 changes: 2 additions & 2 deletions src/edrnsite.streams/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ package_dir =
packages = find_namespace:
python_requires = >= 3.9
install_requires =
django < 6
wagtail < 6
django < 5, > 4
wagtail < 6, > 5


[options.packages.find]
Expand Down
4 changes: 2 additions & 2 deletions src/edrnsite.test/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ install_requires =
selenium ~= 4.9.1
edrnsite.controls
edrnsite.content
django < 6
wagtail < 6
django < 5, > 4
wagtail < 6, > 5


[options.packages.find]
Expand Down
10 changes: 5 additions & 5 deletions src/eke.biomarkers/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ install_requires =
eke.knowledge
edrnsite.content
edrn.auth
biopython ~= 1.81 # Must mathc py3-biopython package in Dockerfile
django < 6
biopython == 1.81 # Must mathc py3-biopython package in Dockerfile
django < 5, > 4
django_plotly_dash == 1.7.1
numpy ~= 1.25.2 # Must match py3-numpy package in Dockerfile
pandas ~= 2.0.3 # Must match py3-pandas package in Dockerfile
numpy == 1.24.4 # Must match py3-numpy package in Dockerfile
pandas == 1.5.3 # Must match py3-pandas package in Dockerfile
rdflib ~= 6.1.1 # Regression in 6.2.0, see https://github.com/RDFLib/rdflib/issues/2120
sortedcontainers ~= 2.4.0
wagtail < 6
wagtail < 6, > 5
Werkzeug == 2.0.3 # django_plotly_dash fails with 2.1


Expand Down
4 changes: 2 additions & 2 deletions src/eke.geocoding/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ packages = find_namespace:
python_requires = >= 3.9
install_requires =
boto3 ~= 1.24.75
django < 6
django < 5, > 4
geocoder ~= 1.38.1
wagtail < 6
wagtail < 6, > 5


[options.packages.find]
Expand Down
12 changes: 6 additions & 6 deletions src/eke.knowledge/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ install_requires =
edrnsite.controls
edrn.collabgroups
eke.geocoding
biopython ~= 1.81 # Must match py3-biopython package in Dockerfile
biopython == 1.81 # Must match py3-biopython package in Dockerfile
boto3 ~= 1.24.75
celery ~= 5.4.0
celery ~= 5.2.7
dash-dangerously-set-inner-html ~= 0.0.2
django < 6
django < 5, > 4
django_plotly_dash == 1.7.1
humanize ~= 4.3.0
libgravatar ~= 1.0.4
numpy ~= 1.25.2 # Must match py3-numpy package in Dockerfile
pandas ~= 2.0.3 # Must match py3-pandas package in Dockerfile
numpy == 1.24.4 # Must match py3-numpy package in Dockerfile
pandas == 1.5.3 # Must match py3-pandas package in Dockerfile
rdflib == 6.1.1 # Regression in 6.2.0, see https://github.com/RDFLib/rdflib/issues/2120
sortedcontainers ~= 2.4.0
wagtail < 6
wagtail < 6, > 5
Werkzeug == 2.0.3 # django_plotly_dash fails with 2.1

[options.packages.find]
Expand Down
3 changes: 2 additions & 1 deletion src/eke.knowledge/src/eke/knowledge/sciencedata.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ def faceted_markup(self, request):
return ''.join(rows)

def get_context(self, request: HttpRequest, *args, **kwargs) -> dict:
app = DjangoDash('ScienceDataDashboard') # ← referenced in data-collection-index.html

context = super().get_context(request, *args, **kwargs)
context['statistics'] = DataStatistic.objects.child_of(self).order_by('title')
matches = context['knowledge_objects']
Expand Down Expand Up @@ -317,7 +319,6 @@ def get_context(self, request: HttpRequest, *args, **kwargs) -> dict:
cats_figure.update_layout(showlegend=False, margin=dict(l=20, r=20, t=40, b=20))
cats_legend = ghetto_plotly_legend([i[0] for i in c.most_common()], palette)

app = DjangoDash('ScienceDataDashboard') # ← referenced in data-collection-index.html
app.layout = html.Div(className='container', children=[
html.Div(className='row', children=[
html.Div(className='col-md-4', children=[
Expand Down
10 changes: 5 additions & 5 deletions support/cbiit-deploy-prod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ bzip2 --decompress --stdout /local/content/edrn/database-access/edrn.sql.bz2 | \
echo ""
echo "📀 Initial database setup"
ssh -q $USER@$WEBSERVER "cd $WEBROOT ; \
docker compose --project-name edrn exec portal /app/bin/django-admin makemigrations &&\
docker compose --project-name edrn exec portal /app/bin/django-admin migrate &&\
docker compose --project-name edrn exec portal /app/bin/django-admin fixtree &&\
docker compose --project-name edrn exec portal /app/bin/django-admin collectstatic --no-input --clear" || exit 1
docker compose --project-name edrn exec portal /usr/bin/django-admin makemigrations &&\
docker compose --project-name edrn exec portal /usr/bin/django-admin migrate &&\
docker compose --project-name edrn exec portal /usr/bin/django-admin fixtree &&\
docker compose --project-name edrn exec portal /usr/bin/django-admin collectstatic --no-input --clear" || exit 1

echo ""
echo "🤷‍♀️ Restarting the portal and stopping search engine"
Expand All @@ -145,7 +145,7 @@ docker compose --project-name edrn start portal" || exit 1
echo ""
echo "🆙 Applying upgrades"
ssh -q $USER@$WEBSERVER "cd $WEBROOT ; \
docker compose --project-name edrn exec portal /app/bin/django-admin copy_daily_hits_from_wagtailsearch" || exit 1
docker compose --project-name edrn exec portal /usr/bin/django-admin copy_daily_hits_from_wagtailsearch" || exit 1

echo ""
echo "🤷‍♀️ Final portal restart and restart of search engine"
Expand Down
Loading

0 comments on commit a6fbd4d

Please sign in to comment.