-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from fccn/igobranco/improvements
Multiple improvements
- Loading branch information
Showing
9 changed files
with
160 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,8 @@ | |
# Because we are using features that are only available on the patched qt version of wkhtmltopdf. | ||
# It is based on ubuntu image because the wkhtmltopdf deb depends on 'libjpeg-turbo8' package that was removed from the debian repositories. | ||
# In future we hope that wkhtmltopdf maintainer review the code and its dependencies. | ||
FROM ubuntu:20.04 | ||
LABEL maintainer="ivo.branco@fccn.pt" | ||
FROM ubuntu:24.04 | ||
LABEL maintainer="[email protected].pt" | ||
|
||
ENV DEBIAN_FRONTEND noninteractive | ||
|
||
|
@@ -15,29 +15,58 @@ RUN apt-get upgrade -y | |
RUN apt-get install -y build-essential xorg libssl-dev libxrender-dev wget | ||
|
||
# Install wkhtmltopdf dependencies | ||
RUN apt-get update && apt-get install -y --no-install-recommends xvfb libfontconfig libjpeg-turbo8 xfonts-75dpi fontconfig | ||
RUN apt-get install -y --no-install-recommends xvfb libfontconfig libjpeg-turbo8 xfonts-75dpi fontconfig | ||
|
||
# Download and install wkhtmltopdf from maintainers page so we include a version with a patched qt and include support for more features. | ||
RUN wget --quiet https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb | ||
RUN dpkg -i wkhtmltox_0.12.6-1.bionic_amd64.deb | ||
RUN rm wkhtmltox_0.12.6-1.bionic_amd64.deb | ||
RUN wget --quiet https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb | ||
RUN dpkg -i wkhtmltox_0.12.6.1-2.jammy_amd64.deb | ||
RUN rm wkhtmltox_0.12.6.1-2.jammy_amd64.deb | ||
|
||
# Install swig debian package for pip requirement endesive | ||
RUN apt-get install -y swig | ||
|
||
# Install python3 and pip | ||
RUN apt-get install -y python3.9 python3-pip | ||
RUN apt-get install -y libssl-dev zlib1g-dev libbz2-dev \ | ||
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \ | ||
xz-utils tk-dev libffi-dev liblzma-dev python3-openssl git | ||
|
||
ARG PYTHON_VERSION=3.11.8 | ||
ENV PYENV_ROOT /opt/pyenv | ||
RUN git clone https://github.com/pyenv/pyenv $PYENV_ROOT --branch v2.3.36 --depth 1 | ||
|
||
# Install Python | ||
RUN $PYENV_ROOT/bin/pyenv install $PYTHON_VERSION | ||
|
||
# Create virtualenv | ||
RUN $PYENV_ROOT/versions/$PYTHON_VERSION/bin/python -m venv /opt/venv | ||
|
||
# Create virtual environment | ||
RUN python3 -m venv /opt/venv | ||
|
||
# Activate virtual environment | ||
ENV PATH /opt/venv/bin:${PATH} | ||
ENV VIRTUAL_ENV /opt/venv/ | ||
|
||
# Cleanup apt cache | ||
RUN apt-get -y clean && \ | ||
apt-get -y purge && \ | ||
rm -rf /var/lib/apt/lists/* /tmp/* | ||
|
||
WORKDIR /app | ||
|
||
RUN pip install \ | ||
# https://pypi.org/project/setuptools/ | ||
# https://pypi.org/project/pip/ | ||
# https://pypi.org/project/wheel/ | ||
setuptools==69.1.1 pip==24.0 wheel==0.43.0 | ||
|
||
# Install requirements file | ||
COPY requirements.txt . | ||
RUN python3 -m pip install -r requirements.txt | ||
RUN python -m pip install -r requirements.txt | ||
|
||
# Default amount of uWSGI processes | ||
ENV UWSGI_WORKERS=2 | ||
|
||
COPY app.py uwsgi.ini ./ | ||
COPY app.py uwsgi.ini default-config.yml ./ | ||
COPY static static | ||
COPY nau nau | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,47 @@ | ||
HTTP_HEADER_NAME: X-NAU-Certificate-force-html | ||
HTTP_HEADER_VALUE: true | ||
# Or alternatively use `OPENEDX_LMS_URL` configuration or `OPENEDX_LMS_URL` environment variable | ||
LMS_SERVER_URL: https://lms.ENV.nau.fccn.pt | ||
CERTIFICATE_FILE_NAME: certificate.pdf | ||
CERTIFICATE_IMAGE_FILE_NAME: certificate | ||
HTTP_HEADER_META_PREFIX: pdfkit- | ||
HTTP_HEADER_META_IMAGE_PREFIX: imgkit- | ||
HTTP_HEADER_META_IMAGE_FORMAT: imgkit-format | ||
HTTP_HEADER_META_VERSION_NAME: nau-course-certificate-version | ||
HTTP_HEADER_META_FILENAME_NAME: nau-course-certificate-filename | ||
HTTP_HEADER_META_IMAGE_FILENAME_NAME: nau-course-certificate-image-filename | ||
HTTP_HEADER_META_LIMIT_NUMBER_PAGES: nau-course-certificate-limit-pages | ||
BUCKET_NAME: nau-ENV-certificates | ||
BUCKET_AWS_ACCESS_KEY_ID: xxxxxxxxxxxxxxxxxxxx | ||
BUCKET_AWS_SECRET_ACCESS_KEY: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | ||
BUCKET_ENDPOINT_URL: http://rgw.nau.fccn.pt | ||
BUCKET_CERTIFICATE_NO_VERSION_KEY: no-version | ||
|
||
DIGITAL_SIGNATURE: | ||
CERTIFICATE_P12_PATH: ./digital_signature_dev/sign-pdf.dev.nau.fccn.pt.p12 | ||
CERTIFICATE_P12_PASSWORD: "1234" | ||
# SIGNATURE_ALGORITHM: sha256 | ||
signaturebox: 742,30,810,60 | ||
signaturebox: 742,50,810,80 | ||
contact: [email protected] | ||
location: Lisboa | ||
reason: | ||
pt-pt: Certificado de curso assinado digitalmente por NAU | ||
en: Digitally signed course certificate by NAU | ||
LOGGING: | ||
version: 1 | ||
disable_existing_loggers: False | ||
root: | ||
level: INFO | ||
handlers: [console] | ||
formatters: | ||
standard: | ||
datefmt: "%Y-%m-%d %H:%M:%S" | ||
format: "%(asctime)s %(levelname)-10s %(message)s" | ||
error: | ||
format: "%(levelname)s <PID %(process)d:%(processName)s> %(name)s.%(funcName)s(): %(message)s" | ||
handlers: | ||
console: | ||
class: logging.StreamHandler | ||
level: DEBUG | ||
stream: ext://sys.stdout | ||
formatter: standard | ||
# BUCKET_NAME: nau-ENV-certificates | ||
# BUCKET_AWS_ACCESS_KEY_ID: xxxxxxxxxxxxxxxxxxxx | ||
# BUCKET_AWS_SECRET_ACCESS_KEY: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | ||
# BUCKET_ENDPOINT_URL: http://rgw.nau.fccn.pt | ||
# BUCKET_CERTIFICATE_NO_VERSION_KEY: no-version | ||
# CERTIFICATE_FILE_NAME: certificate.pdf | ||
# CERTIFICATE_IMAGE_FILE_NAME: certificate | ||
# HTTP_HEADER_NAME: X-NAU-Certificate-force-html | ||
# HTTP_HEADER_VALUE: true | ||
# HTTP_HEADER_META_PREFIX: pdfkit- | ||
# HTTP_HEADER_META_IMAGE_PREFIX: imgkit- | ||
# HTTP_HEADER_META_IMAGE_FORMAT: imgkit-format | ||
# HTTP_HEADER_META_VERSION_NAME: nau-course-certificate-version | ||
# HTTP_HEADER_META_FILENAME_NAME: nau-course-certificate-filename | ||
# HTTP_HEADER_META_IMAGE_FILENAME_NAME: nau-course-certificate-image-filename | ||
# HTTP_HEADER_META_LIMIT_NUMBER_PAGES: nau-course-certificate-limit-pages | ||
# LOGGING: | ||
# version: 1 | ||
# disable_existing_loggers: False | ||
# root: | ||
# level: INFO | ||
# handlers: [console] | ||
# formatters: | ||
# standard: | ||
# datefmt: "%Y-%m-%d %H:%M:%S" | ||
# format: "%(asctime)s %(levelname)-10s %(message)s" | ||
# error: | ||
# format: "%(levelname)s <PID %(process)d:%(processName)s> %(name)s.%(funcName)s(): %(message)s" | ||
# handlers: | ||
# console: | ||
# class: logging.StreamHandler | ||
# level: DEBUG | ||
# stream: ext://sys.stdout | ||
# formatter: standard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
LOGGING: | ||
version: 1 | ||
disable_existing_loggers: False | ||
root: | ||
level: INFO | ||
handlers: [console] | ||
formatters: | ||
standard: | ||
datefmt: "%Y-%m-%d %H:%M:%S" | ||
format: "%(asctime)s %(levelname)-10s %(message)s" | ||
error: | ||
format: "%(levelname)s <PID %(process)d:%(processName)s> %(name)s.%(funcName)s(): %(message)s" | ||
handlers: | ||
console: | ||
class: logging.StreamHandler | ||
level: DEBUG | ||
stream: ext://sys.stdout | ||
formatter: standard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
pdfkit==1.0.0 | ||
imgkit==1.2.2 | ||
Flask==2.2.2 | ||
uWSGI==2.0.21 | ||
PyYAML==6.0 | ||
beautifulsoup4==4.11.1 | ||
requests==2.28.1 | ||
boto3==1.26.37 | ||
PyPDF2==1.28.6 | ||
endesive==2.0.13 | ||
pyOpenSSL==22.1.0 | ||
cryptography==38.0.4 | ||
# Flask doesn't specify the dependency correctly, the new version of Werkzeug | ||
# isn't compatible with older version of Flask | ||
Werkzeug==2.2.2 | ||
imgkit==1.2.3 | ||
Flask==3.0.3 | ||
uWSGI==2.0.27 | ||
PyYAML==6.0.2 | ||
beautifulsoup4==4.12.3 | ||
requests==2.32.3 | ||
boto3==1.35.46 | ||
PyPDF2==3.0.1 | ||
endesive==2.17.3 | ||
pyOpenSSL==24.2.1 | ||
cryptography==43.0.3 | ||
Werkzeug==3.0.4 | ||
# To fix "oscrypto.errors.LibraryNotFoundError: Error detecting the version of libcrypto" https://github.com/wbond/oscrypto/issues/78 | ||
git+https://github.com/wbond/oscrypto.git@d5f3437 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters