From b96c68d0a64a2104673a09a99fe637534762757b Mon Sep 17 00:00:00 2001 From: Nathan Wallach Date: Sun, 14 Jul 2019 16:26:19 +0300 Subject: [PATCH 1/2] Reinsert the $externalPrograms{pdflatex} setting in conf/site.conf.dist as it was (accidentally) removed in commit https://github.com/openwebwork/webwork2/commit/bea85e1259f493127206731cf471650398b55983 --- conf/site.conf.dist | 1 + 1 file changed, 1 insertion(+) diff --git a/conf/site.conf.dist b/conf/site.conf.dist index 9485105f0f..fc4c6432f3 100644 --- a/conf/site.conf.dist +++ b/conf/site.conf.dist @@ -104,6 +104,7 @@ $externalPrograms{git} = "/usr/bin/git"; # equation rendering/hardcopy utiltiies #################################################### $externalPrograms{latex} ="/usr/bin/latex"; +$externalPrograms{pdflatex} ="/usr/bin/pdflatex --shell-escape"; $externalPrograms{dvipng} ="/usr/bin/dvipng"; #################################################### From 040166bb5f0e8e666e85a17fcc601aff5f4ea653 Mon Sep 17 00:00:00 2001 From: Nathan Wallach Date: Fri, 19 Jul 2019 03:58:37 +0300 Subject: [PATCH 2/2] Changes to support multilingual PDF generation. The main goal was to support multilingual PDF generation using XeLaTeX and polyglossia. My test case was English+Hebrew, so I have added XeLaTeX conf/snippets/hardcopyThemes directories for using polyglossia for English and English+Hebrew. Fonts (culmus) were installed in the Docker image to provide the Hebrew fonts needed to test the English+Hebrew xelatex compilation. conf/localOverrides.conf.dist contains sample code to use the\ new themes. conf/site.conf.dist contains a commented out option to use xelatex instead of pdflatex. The docker-config/ has additional sample config files, and docker-entrypoint.sh was moved into docker-config/. In particular there are very rough sample files for using WW with SSL in Docker, but the placeholder certificate and key files would need to be put in place, as well as various settings adjusted in the config files. The code in lib/WeBWorK/ContentGenerator/Hardcopy.pm which displays the available hardcopyThemes options was changed to avoid the use of maketext. Local installations may have local hardcopyThemes and they will not have entries in the PO translations files, and the prior code would trigger errors as a result. The version of xelatex and various latex packages in Ubuntu 16.04 did not manage to compile the Hebrew+English latex files I tested, but they compile under Ubuntu 18.04. As a result, the Dockerfile was changed to build upon Ubuntu 18.04 (LTS), which had originally been intended to be done in a different PR. Along the way, many Perl modules are now installed from the Ubuntu repositories, which saved on "cpanm" local installation. Several additional tools, as well as some packages for SSL support were added to the image. The docker-compose.yml was updated, and includes sample code to use various external resources, and to store Apache logs outside the image. At present, the docker config files are set up under the assumption that the OPL is mounted from OUTSIDE the docker image. That saves on build time, and allows sharing it between different images (but may slow things down somewhat) but there is a commented out block in Dockerfile to put the OPL in the image. The Dockerfile also updates the base Ubuntu image, created locales, sets the timezone, etc. Several lines for SSL support are commented out, and should be enabled for sites using SSL, once the relevant customized configuration files and certificates are provided to the image (possibly via external mounts). Settings for SQL password in docker-compose.yml should be effective if they are set/exist when the MariaDB container boots up with an empty database directory/volume. Thus, those passwords should be set BEFORE the first "docker-compose up" or after the mysql data volume is deleted. --- Dockerfile | 260 ++++++++++++------ conf/localOverrides.conf.dist | 32 +++ conf/site.conf.dist | 5 + .../hardcopyPostamble.tex | 3 + .../hardcopyPreamble.tex | 80 ++++++ .../hardcopyProblemDivider.tex | 6 + .../hardcopySetDivider.tex | 4 + .../hardcopySetFooter.pg | 26 ++ .../hardcopySetHeader.pg | 71 +++++ .../hardcopyUserDivider.tex | 3 + .../hardcopyPostamble.tex | 4 + .../hardcopyPreamble.tex | 85 ++++++ .../hardcopyProblemDivider.tex | 6 + .../hardcopySetDivider.tex | 8 + .../hardcopySetFooter.pg | 27 ++ .../hardcopySetHeader.pg | 71 +++++ .../hardcopyUserDivider.tex | 7 + .../XeLaTeX-oneColumn/hardcopyPostamble.tex | 3 + .../XeLaTeX-oneColumn/hardcopyPreamble.tex | 83 ++++++ .../hardcopyProblemDivider.tex | 6 + .../XeLaTeX-oneColumn/hardcopySetDivider.tex | 4 + .../XeLaTeX-oneColumn/hardcopySetFooter.pg | 24 ++ .../XeLaTeX-oneColumn/hardcopySetHeader.pg | 71 +++++ .../XeLaTeX-oneColumn/hardcopyUserDivider.tex | 3 + .../XeLaTeX-twoColumn/hardcopyPostamble.tex | 4 + .../XeLaTeX-twoColumn/hardcopyPreamble.tex | 88 ++++++ .../hardcopyProblemDivider.tex | 6 + .../XeLaTeX-twoColumn/hardcopySetDivider.tex | 8 + .../XeLaTeX-twoColumn/hardcopySetFooter.pg | 19 ++ .../XeLaTeX-twoColumn/hardcopySetHeader.pg | 71 +++++ .../XeLaTeX-twoColumn/hardcopyUserDivider.tex | 7 + docker-compose.yml | 109 +++++++- docker-config/apache/000-default.conf | 34 +++ docker-config/apache/apache2.conf | 234 ++++++++++++++++ docker-config/apache/htaccess | 1 + docker-config/apache/index.html | 12 + docker-config/apache/mpm_prefork.conf | 19 ++ .../docker-entrypoint.sh | 38 +-- docker-config/ssl/default-ssl.conf | 138 ++++++++++ .../local/PutYourCertificate_and_key_here.txt | 8 + docker-config/ssl/local/my.crt | 0 docker-config/ssl/local/my.key | 0 docker-config/ssl/local/myCA_chain.crt | 0 docker-config/ssl/ssl.conf | 85 ++++++ lib/WeBWorK/ContentGenerator/Hardcopy.pm | 4 +- 45 files changed, 1661 insertions(+), 116 deletions(-) create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopyPostamble.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopyPreamble.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopyProblemDivider.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopySetDivider.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopySetFooter.pg create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopySetHeader.pg create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopyUserDivider.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopyPostamble.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopyPreamble.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopyProblemDivider.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopySetDivider.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopySetFooter.pg create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopySetHeader.pg create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopyUserDivider.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopyPostamble.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopyPreamble.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopyProblemDivider.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopySetDivider.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopySetFooter.pg create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopySetHeader.pg create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopyUserDivider.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopyPostamble.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopyPreamble.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopyProblemDivider.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopySetDivider.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopySetFooter.pg create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopySetHeader.pg create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopyUserDivider.tex create mode 100644 docker-config/apache/000-default.conf create mode 100644 docker-config/apache/apache2.conf create mode 100644 docker-config/apache/htaccess create mode 100644 docker-config/apache/index.html create mode 100644 docker-config/apache/mpm_prefork.conf rename docker-entrypoint.sh => docker-config/docker-entrypoint.sh (75%) create mode 100644 docker-config/ssl/default-ssl.conf create mode 100644 docker-config/ssl/local/PutYourCertificate_and_key_here.txt create mode 100644 docker-config/ssl/local/my.crt create mode 100644 docker-config/ssl/local/my.key create mode 100644 docker-config/ssl/local/myCA_chain.crt create mode 100644 docker-config/ssl/ssl.conf diff --git a/Dockerfile b/Dockerfile index 6ce968804f..41e525a687 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,4 @@ -FROM ubuntu:16.04 - - +FROM ubuntu:18.04 ENV PG_BRANCH=develop \ WEBWORK_URL=/webwork2 \ @@ -22,6 +20,8 @@ ENV PG_BRANCH=develop \ # Only /var/log/apache2 is handled by /etc/logrotate.d/apache2. APACHE_LOG_DIR=/var/log/apache2 \ APP_ROOT=/opt/webwork \ + DEBIAN_FRONTEND=noninteractive \ + DEBCONF_NONINTERACTIVE_SEEN=true \ DEV=0 ENV WEBWORK_DB_DSN=DBI:mysql:${WEBWORK_DB_NAME}:${WEBWORK_DB_HOST}:${WEBWORK_DB_PORT} \ @@ -29,69 +29,133 @@ ENV WEBWORK_DB_DSN=DBI:mysql:${WEBWORK_DB_NAME}:${WEBWORK_DB_HOST}:${WEBWORK_DB_ PG_ROOT=$APP_ROOT/pg \ PATH=$PATH:$APP_ROOT/webwork2/bin +# For ubuntu 18.04 add libemail-address-xs-perl +# For ubuntu 18.04 replace texlive-generic-recommended with texlive-plain-generic +# texlive-generic-recommended # For ubuntu 16.04 - contains path.sty +# texlive-plain-generic # For ubuntu 18.04 - contains path.sty + + + RUN apt-get update \ + && apt-get -y upgrade \ && apt-get install -y --no-install-recommends --no-install-suggests \ - apache2 \ - curl \ - dvipng \ - gcc \ - libapache2-request-perl \ - libcrypt-ssleay-perl \ - libdatetime-perl \ - libdancer-perl \ - libdancer-plugin-database-perl \ - libdbd-mysql-perl \ - libemail-address-perl \ - libexception-class-perl \ - libextutils-xsbuilder-perl \ - libfile-find-rule-perl-perl \ - libgd-perl \ - libhtml-scrubber-perl \ - libjson-perl \ - liblocale-maketext-lexicon-perl \ - libmail-sender-perl \ - libmime-tools-perl \ - libnet-ip-perl \ - libnet-ldap-perl \ - libnet-oauth-perl \ - libossp-uuid-perl \ - libpadwalker-perl \ - libpath-class-perl \ - libphp-serialization-perl \ - libxml-simple-perl \ - libsoap-lite-perl \ - libsql-abstract-perl \ - libstring-shellquote-perl \ - libtemplate-perl \ - libtext-csv-perl \ - libtimedate-perl \ - libuuid-tiny-perl \ - libxml-parser-perl \ - libxml-writer-perl \ - libxmlrpc-lite-perl \ - libapache2-reload-perl \ - libxmlrpc-lite-perl \ - libxml-simple-perl \ - make \ - netpbm \ - preview-latex-style \ - texlive \ - texlive-latex-extra \ - libc6-dev \ - git \ - mysql-client \ - && rm -fr /var/lib/apt/lists/* - -# Warning - when I tried to include XML::Simple near the start of the first "cpanm install" line, there was an error: -# Building and testing XMLRPC-Lite-0.717 ... ! Installing XMLRPC::Lite failed. See /root/.cpanm/work/1551887935.125/build.log for details. Retry with --force to force install it. -# so it was put into a second "cpanm install" line. - -RUN curl -Lk https://cpanmin.us | perl - App::cpanminus \ - && cpanm install XML::Parser::EasyTree Iterator Iterator::Util Pod::WSDL Array::Utils HTML::Template Mail::Sender Email::Sender::Simple Data::Dump Statistics::R::IO - -##RUN cpanm install XML::Simple \ -# && rm -fr ./cpanm /root/.cpanm /tmp/* + apache2 \ + curl \ + dvipng \ + gcc \ + libapache2-request-perl \ + libcrypt-ssleay-perl \ + libdatetime-perl \ + libdancer-perl \ + libdancer-plugin-database-perl \ + libdbd-mysql-perl \ + libemail-address-xs-perl \ + libexception-class-perl \ + libextutils-xsbuilder-perl \ + libfile-find-rule-perl-perl \ + libgd-perl \ + libhtml-scrubber-perl \ + libjson-perl \ + liblocale-maketext-lexicon-perl \ + libmail-sender-perl \ + libmime-tools-perl \ + libnet-ip-perl \ + libnet-ldap-perl \ + libnet-oauth-perl \ + libossp-uuid-perl \ + libpadwalker-perl \ + libpath-class-perl \ + libphp-serialization-perl \ + libxml-simple-perl \ + libsoap-lite-perl \ + libsql-abstract-perl \ + libstring-shellquote-perl \ + libtemplate-perl \ + libtext-csv-perl \ + libtimedate-perl \ + libuuid-tiny-perl \ + libxml-parser-perl \ + libxml-writer-perl \ + libxmlrpc-lite-perl \ + libapache2-reload-perl \ + cpanminus \ + libxml-parser-easytree-perl \ + libiterator-perl \ + libiterator-util-perl \ + libpod-wsdl-perl \ + libtest-xml-perl \ + libmodule-build-perl \ + libxml-semanticdiff-perl \ + libxml-xpath-perl \ + libpath-tiny-perl \ + libarray-utils-perl \ + libhtml-template-perl \ + libtest-pod-perl \ + libemail-sender-perl \ + libmail-sender-perl \ + libmodule-pluggable-perl \ + libemail-date-format-perl \ + libcapture-tiny-perl \ + libthrowable-perl \ + libdata-dump-perl \ + libfile-sharedir-install-perl \ + libclass-tiny-perl \ + libtest-requires-perl \ + libtest-mockobject-perl \ + libtest-warn-perl \ + libsub-uplevel-perl \ + libtest-exception-perl \ + libuniversal-can-perl \ + libuniversal-isa-perl \ + libtest-fatal-perl \ + libjson-xs-perl \ + make \ + netpbm \ + preview-latex-style \ + texlive \ + texlive-latex-extra \ + texlive-plain-generic \ + texlive-xetex \ + texlive-latex-recommended \ + texlive-lang-other \ + texlive-lang-arabic \ + libc6-dev \ + git \ + mysql-client \ + tzdata \ + apt-utils \ + locales \ + debconf-utils \ + vim \ + telnet \ + mc \ + file \ + ssl-cert \ + ca-certificates \ + culmus \ + fonts-linuxlibertine \ + lmodern \ + && apt-get clean \ + && rm -fr /var/lib/apt/lists/* /tmp/* + +# texlive-generic-recommended # For ubuntu 16.04 - contains path.sty +# texlive-plain-generic # For ubuntu 18.04 - contains path.sty +RUN echo 'America/New_York' > /etc/timezone \ + && echo "tzdata tzdata/Areas select America\ntzdata tzdata/Zones/America select New_York\nlocales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8\nlocales locales/default_environment_locale select en_US.UTF-8\ndebconf debconf/frontend select Noninteractive\nca-certificates ca-certificates/trust_new_crts select yes" > /tmp/preseed.txt \ + && cp -a /etc/locale.gen /etc/locale.gen.orig \ + && echo "en_US ISO-8859-1\nen_US.UTF-8 UTF-8" > /etc/locale.gen \ + && rm -f /etc/localtime /etc/timezone \ + && debconf-set-selections /tmp/preseed.txt \ + && dpkg-reconfigure -f noninteractive tzdata \ + && /usr/sbin/locale-gen + +# Perl module installs - those not packaged for Ubuntu + +RUN cpanm install Statistics::R::IO \ + && rm -fr ./cpanm /root/.cpanm /tmp/* + +# XML::Parser::EasyTree Iterator Iterator::Util Pod::WSDL Array::Utils HTML::Template Mail::Sender Email::Sender::Simple Data::Dump RUN mkdir -p $APP_ROOT/courses $APP_ROOT/libraries $APP_ROOT/webwork2 @@ -104,41 +168,46 @@ RUN mkdir -p $APP_ROOT/courses $APP_ROOT/libraries $APP_ROOT/webwork2 # && mv webwork2-${WEBWORK_BRANCH} $APP_ROOT/webwork2 \ # && rm -rf /tmp/${WEBWORK_BRANCH}.tar.gz /tmp/webwork2-${WEBWORK_BRANCH} +# The next block installs PG from Git, using the branch set above as PG_BRANCH. +# and compiles color.c in the copy INSIDE the image. + RUN curl -fSL https://github.com/openwebwork/pg/archive/${PG_BRANCH}.tar.gz -o /tmp/${PG_BRANCH}.tar.gz \ && tar xzf /tmp/${PG_BRANCH}.tar.gz \ && mv pg-${PG_BRANCH} $APP_ROOT/pg \ && rm /tmp/${PG_BRANCH}.tar.gz \ - && curl -fSL https://github.com/openwebwork/webwork-open-problem-library/archive/master.tar.gz -o /tmp/opl.tar.gz \ - && tar xzf /tmp/opl.tar.gz \ - && mv webwork-open-problem-library-master $APP_ROOT/libraries/webwork-open-problem-library \ - && rm /tmp/opl.tar.gz + && cd $APP_ROOT/pg/lib/chromatic \ + && gcc color.c -o color + +# The next block would install the OPL from Git. Disabled for developers who +# use an external OPL tree. + +#RUN curl -fSL https://github.com/openwebwork/webwork-open-problem-library/archive/master.tar.gz -o /tmp/opl.tar.gz \ +# && tar xzf /tmp/opl.tar.gz \ +# && mv webwork-open-problem-library-master $APP_ROOT/libraries/webwork-open-problem-library \ +# && rm /tmp/opl.tar.gz + +# MathJax RUN curl -fSL https://github.com/mathjax/MathJax/archive/master.tar.gz -o /tmp/mathjax.tar.gz \ && tar xzf /tmp/mathjax.tar.gz \ && mv MathJax-master $APP_ROOT/MathJax \ && rm /tmp/mathjax.tar.gz - #&& rm /tmp/VERSION - #curl -fSL https://github.com/openwebwork/webwork2/archive/WeBWorK-${WEBWORK_VERSION}.tar.gz -o /tmp/WeBWorK-${WEBWORK_VERSION}.tar.gz \ - #&& tar xzf /tmp/WeBWorK-${WEBWORK_VERSION}.tar.gz \ - #&& mv webwork2-WeBWorK-${WEBWORK_VERSION} $APP_ROOT/webwork2 \ - #&& rm /tmp/WeBWorK-${WEBWORK_VERSION}.tar.gz \ RUN echo "PATH=$PATH:$APP_ROOT/webwork2/bin" >> /root/.bashrc COPY . $APP_ROOT/webwork2 - # Move these lines into docker-entrypoint.sh so the bind mount of courses # will be available #RUN cd $APP_ROOT/webwork2/courses.dist \ # && cp *.lst $APP_ROOT/courses/ \ # && cp -R modelCourse $APP_ROOT/courses/ -RUN cd $APP_ROOT/pg/lib/chromatic \ - && gcc color.c -o color +COPY docker-config/ssl/default-ssl.conf /etc/apache2/sites-available/default-ssl.conf # setup apache +# if no SSL needed - comment out the line && a2enmod ssl && a2ensite default-ssl \ RUN cd $APP_ROOT/webwork2/conf \ && cp webwork.apache2.4-config.dist webwork.apache2.4-config \ && cp $APP_ROOT/webwork2/conf/webwork.apache2.4-config /etc/apache2/conf-enabled/webwork.conf \ @@ -146,30 +215,43 @@ RUN cd $APP_ROOT/webwork2/conf \ && a2enmod mpm_prefork \ && sed -i -e 's/Timeout 300/Timeout 1200/' /etc/apache2/apache2.conf \ && sed -i -e 's/MaxRequestWorkers 150/MaxRequestWorkers 20/' \ - -e 's/MaxConnectionsPerChild 0/MaxConnectionsPerChild 100/' \ - /etc/apache2/mods-available/mpm_prefork.conf \ + -e 's/MaxConnectionsPerChild 0/MaxConnectionsPerChild 100/' \ + /etc/apache2/mods-available/mpm_prefork.conf \ && cp $APP_ROOT/webwork2/htdocs/favicon.ico /var/www/html \ + && mkdir -p $APACHE_RUN_DIR $APACHE_LOCK_DIR $APACHE_LOG_DIR \ + && mkdir /etc/ssl/local \ + && a2enmod rewrite \ && sed -i -e 's/^$/\ - PerlPassEnv WEBWORK_URL\n\ - PerlPassEnv WEBWORK_ROOT_URL\n\ - PerlPassEnv WEBWORK_DB_DSN\n\ - PerlPassEnv WEBWORK_DB_USER\n\ - PerlPassEnv WEBWORK_DB_PASSWORD\n\ - PerlPassEnv WEBWORK_SMTP_SERVER\n\ - PerlPassEnv WEBWORK_SMTP_SENDER\n\ - PerlPassEnv WEBWORK_TIMEZONE\n\ - \n/' /etc/apache2/conf-enabled/webwork.conf - -RUN cd $APP_ROOT/webwork2/ \ + PerlPassEnv WEBWORK_URL\n\ + PerlPassEnv WEBWORK_ROOT_URL\n\ + PerlPassEnv WEBWORK_DB_DSN\n\ + PerlPassEnv WEBWORK_DB_USER\n\ + PerlPassEnv WEBWORK_DB_PASSWORD\n\ + PerlPassEnv WEBWORK_SMTP_SERVER\n\ + PerlPassEnv WEBWORK_SMTP_SENDER\n\ + PerlPassEnv WEBWORK_TIMEZONE\n\ + \n/' /etc/apache2/conf-enabled/webwork.conf +#\ +# && a2enmod ssl && a2ensite default-ssl +# The LAST line, and the "\" on the line above should be commented out if SSL is not needed + +RUN mkdir $APP_ROOT/libraries/webwork-open-problem-library \ + && cd $APP_ROOT/webwork2/ \ && chown www-data DATA ../courses htdocs/applets logs tmp $APP_ROOT/pg/lib/chromatic \ && chmod -R u+w DATA ../courses htdocs/applets logs tmp $APP_ROOT/pg/lib/chromatic -COPY docker-entrypoint.sh /usr/local/bin/ +COPY docker-config/docker-entrypoint.sh /usr/local/bin/ ENTRYPOINT ["docker-entrypoint.sh"] EXPOSE 80 +# Comment out the next line if SSL is not needed +#EXPOSE 443 + WORKDIR $APP_ROOT + + + CMD ["apache2", "-DFOREGROUND"] diff --git a/conf/localOverrides.conf.dist b/conf/localOverrides.conf.dist index 82c449ec4c..27607ff2b9 100644 --- a/conf/localOverrides.conf.dist +++ b/conf/localOverrides.conf.dist @@ -512,4 +512,36 @@ $options{useOPLdefFiles}=1; $permissionLevels{show_answer_group_info_checkbox} = "admin"; $permissionLevels{modify_tags} = "admin"; + +################################################################################ + +# Available Hardcopy themes (located in snippets) - adds four XeLaTeX themes +# using polyglossia for multilingual support and fontspec. + +$hardcopyThemes = [ qw ( + oneColumn + twoColumn + XeLaTeX-oneColumn + XeLaTeX-twoColumn + XeLaTeX-Hebrew-oneColumn + XeLaTeX-Hebrew-twoColumn +)]; + +# Hardcopy theme names (pretty names for themes) +$hardcopyThemeNames = { + oneColumn => 'pdfLaTeX - English - One Column', + twoColumn => 'pdfLaTeX - English - Two Columns', + XeLaTeX-oneColumn => 'XeLaTeX - English - one Column', + XeLaTeX-twoColumn => 'XeLaTeX - English - two Columns', + XeLaTeX-Hebrew-oneColumn => 'XeLaTeX - Hebrew/English - one Column', + XeLaTeX-Hebrew-twoColumn => 'XeLaTeX - Hebrew/English - two Columns', +}; + +# Change default Hardcopy theme - in order to use an XeLaTeX theme, we must set +# $externalPrograms{pdflatex} to use xelatex (here or in site.conf) !!! +#$hardcopyTheme = "XeLaTeX-twoColumn"; +#$externalPrograms{pdflatex} ="/usr/bin/xelatex --shell-escape"; + +################################################################################ + 1; #final line of the file to reassure perl that it was read properly. diff --git a/conf/site.conf.dist b/conf/site.conf.dist index fc4c6432f3..15570d5d70 100644 --- a/conf/site.conf.dist +++ b/conf/site.conf.dist @@ -104,7 +104,12 @@ $externalPrograms{git} = "/usr/bin/git"; # equation rendering/hardcopy utiltiies #################################################### $externalPrograms{latex} ="/usr/bin/latex"; + $externalPrograms{pdflatex} ="/usr/bin/pdflatex --shell-escape"; +# Consider using xelatex instead of pdflatex for multilingual use, and +# use polyglossia and fontspec packages (which require xelatex or lualatex). +#$externalPrograms{pdflatex} ="/usr/bin/xelatex --shell-escape"; + $externalPrograms{dvipng} ="/usr/bin/dvipng"; #################################################### diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopyPostamble.tex b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopyPostamble.tex new file mode 100644 index 0000000000..8e831736a7 --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopyPostamble.tex @@ -0,0 +1,3 @@ + +\vfill +\end{document} diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopyPreamble.tex b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopyPreamble.tex new file mode 100644 index 0000000000..94abacd10d --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopyPreamble.tex @@ -0,0 +1,80 @@ +\batchmode +\documentclass[11pt]{amsart} +\usepackage{amsmath,amsfonts,amssymb,multicol} + +% For XeLaTeX + polyglossia - using Hebrew and the Culmus fonts +\usepackage{fontspec} +\usepackage{xunicode} + +\usepackage{booktabs,tabularx,colortbl,caption,xcolor} + +% Load the polyglossia package to support multiple languages. +% see https://ctan.org/pkg/polyglossia +\usepackage{polyglossia} + +% bidi needs to be loaded AFTER caption,xcolor +\usepackage{bidi} + +\setdefaultlanguage{hebrew} +\setotherlanguage{english} +\setmainfont{Frank Ruehl CLM} +\setmonofont{Miriam Mono CLM} +\setsansfont{Simple CLM} + +% When using default English +% Use \begin{hebrew} block of text \end{hebrew} for paragraphs. +% +% When using default Hebrew +% Use \begin{hebrew} block of text \end{hebrew} for paragraphs. + +\usepackage{path} + \discretionaries |~!@$%^&*()_+`-=#{"}[]:;'<>,.?\/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789| +\usepackage{graphicx} + +% There is no support for epstopdf in xelatex, but it supports eps files natively +%\usepackage{epstopdf} % allows use of eps files + +% WeBWorK used Control+_ = ^_ for verbatim... so we change its charcode +\catcode`\=12 + +\usepackage{epsf} +\usepackage{epsfig} +\usepackage{pslatex} +\usepackage{fullpage} + +% Comment out 3 lines - XeLaTeX supports UTF-8 and the euro symbol already +%\usepackage[utf8]{inputenc} +%\usepackage{eurosym} % the euro symbol +%\DeclareUnicodeCharacter{20AC}{\euro} % make it possible to use the UTF-8 character for the euro symbol in problems + +\pagestyle{plain} +\def\endline{\bigskip\hrule width \hsize height 0.8pt } +\newcommand{\lt}{<} +\newcommand{\gt}{>} +\newcommand{\less}{<} +\newcommand{\grt}{>} + +% This is used to signal PG that we are not using multicols +\newcommand{\nocolumns}{} + +% BEGIN capa tex macros + +\newcommand{\capa}{{\sl C\kern-.10em\raise-.00ex\hbox{\rm A}\kern-.22em% +{\sl P}\kern-.14em\kern-.01em{\rm A}}} + +\newenvironment{choicelist} +{\begin{list}{} + {\setlength{\rightmargin}{0in}\setlength{\leftmargin}{0.13in} + \setlength{\topsep}{0.05in}\setlength{\itemsep}{0.022in} + \setlength{\parsep}{0in}\setlength{\belowdisplayskip}{0.04in} + \setlength{\abovedisplayskip}{0.05in} + \setlength{\abovedisplayshortskip}{-0.04in} + \setlength{\belowdisplayshortskip}{0.04in}} + } +{\end{list}} + +% END capa tex macros + +\begin{document} +\newpage +\setcounter{page}{1} diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopyProblemDivider.tex b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopyProblemDivider.tex new file mode 100644 index 0000000000..4ccf3ac14c --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopyProblemDivider.tex @@ -0,0 +1,6 @@ + +\medskip +\goodbreak +\hrule +\nobreak +\smallskip diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopySetDivider.tex b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopySetDivider.tex new file mode 100644 index 0000000000..a66b59253a --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopySetDivider.tex @@ -0,0 +1,4 @@ + +\newpage% +\setcounter{page}{1}% + diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopySetFooter.pg b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopySetFooter.pg new file mode 100644 index 0000000000..cb6b9be060 --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopySetFooter.pg @@ -0,0 +1,26 @@ +# +# hardcopySetFooter.pg - generic hardcopy set footer file +# + +DOCUMENT(); +loadMacros( + "PG.pl", + "PGbasicmacros.pl" +); + +BEGIN_TEXT +$BR + +\newfontfamily\libertine{Linux Libertine O} + +\begin{english} +\noindent {\tiny Generated by WeBWorK {\libertine \copyright}} +\end{english} + +\begin{hebrew} +\noindent{\tiny נוצר על ידי \textenglish{WeBWorK} {\libertine \copyright}} +\end{hebrew} + +END_TEXT + +ENDDOCUMENT(); diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopySetHeader.pg b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopySetHeader.pg new file mode 100644 index 0000000000..7a357d2d13 --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopySetHeader.pg @@ -0,0 +1,71 @@ +DOCUMENT(); + +loadMacros( + "PG.pl", + "PGbasicmacros.pl", +); + +TEXT($BEGIN_ONE_COLUMN); + +TEXT(MODES(TeX =>EV3(<<'EOT'),HTML=>"",Latex2HTML=>"")); +\noindent {\large \bf $studentName} +\hfill +\noindent {\large \bf MTH 161 $sectionNumber Fall 2003} +\par + +EOT + +BEGIN_TEXT + +$BBOLD WeBWorK assignment number $setNumber is due : $formattedDueDate. $EBOLD + +$PAR +The +(* home page *) +\{ +#htmlLink(qq!http://www.math.rochester.edu/courses/161/home/!,"home +page") +\} +for the course contains the syllabus, grading policy and other +information. +$PAR +END_TEXT + +################## +# EDIT BELOW HERE +################## +BEGIN_TEXT +$HR +$PAR +This file is /conf/snippets/hardcopySetHeader.pg you can use it as +a model for creating files which introduce each problem set. +$PAR +$HR +END_TEXT +################## +# EDIT ABOVE HERE +################## +BEGIN_TEXT +The primary purpose of WeBWorK is to let you know that you are getting the correct answer or to alert +you if you are making some kind of mistake. Usually you can attempt a problem as many times as you want before +the due date. However, if you are having trouble figuring out your error, you should +consult the book, or ask a fellow student, one of the TA's or +your professor for help. Don't spend a lot of time guessing -- it's not very efficient or effective. +$PAR +Give 4 or 5 significant digits for (floating point) numerical answers. +For most problems when entering numerical answers, you can if you wish +enter elementary expressions such as \( 2\wedge3 \) instead of 8, \( sin(3*pi/2) \)instead +of -1, \( e\wedge (ln(2)) \) instead of 2, +\( (2+tan(3))*(4-sin(5))\wedge6-7/8 \) instead of 27620.3413, etc. + Here's the +\{ htmlLink(qq!http://webwork.math.rochester.edu/docs/docs/pglanguage/availableFunctions.html!,"list of the functions") \} + which WeBWorK understands. +$PAR +You can use the Feedback button on each problem +page to send e-mail to the professors. + + +$END_ONE_COLUMN +END_TEXT + +ENDDOCUMENT(); # This should be the last executable line in the problem. diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopyUserDivider.tex b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopyUserDivider.tex new file mode 100644 index 0000000000..25cb763f38 --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopyUserDivider.tex @@ -0,0 +1,3 @@ + +\newpage% +\setcounter{page}{1}% diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopyPostamble.tex b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopyPostamble.tex new file mode 100644 index 0000000000..8e46f0cdb3 --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopyPostamble.tex @@ -0,0 +1,4 @@ + +\end{multicols} +\vfill +\end{document} diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopyPreamble.tex b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopyPreamble.tex new file mode 100644 index 0000000000..b9c5983e1a --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopyPreamble.tex @@ -0,0 +1,85 @@ +\batchmode +\documentclass[10pt]{amsart} +\usepackage{amsmath,amsfonts,amssymb,multicol} + +% For XeLaTeX + polyglossia - using Hebrew and the Culmus fonts +\usepackage{fontspec} +\usepackage{xunicode} + +\usepackage{booktabs,tabularx,colortbl,caption,xcolor} + +% Load the polyglossia package to support multiple languages. +% see https://ctan.org/pkg/polyglossia +\usepackage{polyglossia} + +% bidi needs to be loaded AFTER caption,xcolor +\usepackage{bidi} + +\setdefaultlanguage{hebrew} +\setotherlanguage{english} +\setmainfont{Frank Ruehl CLM} +\setmonofont{Miriam Mono CLM} +\setsansfont{Simple CLM} + +% When using default English +% Use \begin{hebrew} block of text \end{hebrew} for paragraphs. +% +% When using default Hebrew +% Use \begin{hebrew} block of text \end{hebrew} for paragraphs. + +\usepackage{path} + \discretionaries |~!@$%^&*()_+`-=#{"}[]:;'<>,.?\/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789| +\usepackage{graphicx} + +% There is no support for epstopdf in xelatex, but it supports eps files natively +%\usepackage{epstopdf} % allows use of eps files + +% WeBWorK used Control+_ = ^_ for verbatim... so we change its charcode +\catcode`\=12 + +\usepackage{epsf} +\usepackage{epsfig} +\usepackage{pslatex} + +% Comment out 3 lines - XeLaTeX supports UTF-8 and the euro symbol already +%\usepackage[utf8]{inputenc} +%\usepackage{eurosym} % the euro symbol +%\DeclareUnicodeCharacter{20AC}{\euro} % make it possible to use the UTF-8 character for the euro symbol in problems + +\pagestyle{plain} +\textheight 9in +\oddsidemargin = -0.42in +\evensidemargin = -0.42in +\textwidth= 7.28in +\columnsep = .25in +\columnseprule = .4pt +\def\endline{\bigskip\hrule width \hsize height 0.8pt } +\newcommand{\lt}{<} +\newcommand{\gt}{>} +\newcommand{\less}{<} +\newcommand{\grt}{>} + +% BEGIN capa tex macros + +\newcommand{\capa}{{\sl C\kern-.10em\raise-.00ex\hbox{\rm A}\kern-.22em% +{\sl P}\kern-.14em\kern-.01em{\rm A}}} + +\newenvironment{choicelist} +{\begin{list}{} + {\setlength{\rightmargin}{0in}\setlength{\leftmargin}{0.13in} + \setlength{\topsep}{0.05in}\setlength{\itemsep}{0.022in} + \setlength{\parsep}{0in}\setlength{\belowdisplayskip}{0.04in} + \setlength{\abovedisplayskip}{0.05in} + \setlength{\abovedisplayshortskip}{-0.04in} + \setlength{\belowdisplayshortskip}{0.04in}} + } +{\end{list}} + +% END capa tex macros + +\begin{document} +\voffset=-0.8in +\newpage +\setcounter{page}{1} +\begin{multicols}{2} +\columnwidth=\linewidth diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopyProblemDivider.tex b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopyProblemDivider.tex new file mode 100644 index 0000000000..4ccf3ac14c --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopyProblemDivider.tex @@ -0,0 +1,6 @@ + +\medskip +\goodbreak +\hrule +\nobreak +\smallskip diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopySetDivider.tex b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopySetDivider.tex new file mode 100644 index 0000000000..2832139795 --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopySetDivider.tex @@ -0,0 +1,8 @@ + +\end{multicols} % close off the columns from the set above + +\newpage% +\setcounter{page}{1}% +\begin{multicols}{2} +\columnwidth=\linewidth % reopen the columns for the following set + diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopySetFooter.pg b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopySetFooter.pg new file mode 100644 index 0000000000..28597e4dd1 --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopySetFooter.pg @@ -0,0 +1,27 @@ +# +# hardcopySetFooter.pg - generic hardcopy set footer file +# + +DOCUMENT(); +loadMacros( + "PG.pl", + "PGbasicmacros.pl" +); + +BEGIN_TEXT +$BEGIN_ONE_COLUMN + +\newfontfamily\libertine{Linux Libertine O} + +\begin{english} +\noindent {\tiny Generated by WeBWorK {\libertine \copyright}} +\end{english} + +\begin{hebrew} +\noindent{\tiny נוצר על ידי \textenglish{WeBWorK} {\libertine \copyright}} +\end{hebrew} + +$END_ONE_COLUMN +END_TEXT + +ENDDOCUMENT(); diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopySetHeader.pg b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopySetHeader.pg new file mode 100644 index 0000000000..7a357d2d13 --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopySetHeader.pg @@ -0,0 +1,71 @@ +DOCUMENT(); + +loadMacros( + "PG.pl", + "PGbasicmacros.pl", +); + +TEXT($BEGIN_ONE_COLUMN); + +TEXT(MODES(TeX =>EV3(<<'EOT'),HTML=>"",Latex2HTML=>"")); +\noindent {\large \bf $studentName} +\hfill +\noindent {\large \bf MTH 161 $sectionNumber Fall 2003} +\par + +EOT + +BEGIN_TEXT + +$BBOLD WeBWorK assignment number $setNumber is due : $formattedDueDate. $EBOLD + +$PAR +The +(* home page *) +\{ +#htmlLink(qq!http://www.math.rochester.edu/courses/161/home/!,"home +page") +\} +for the course contains the syllabus, grading policy and other +information. +$PAR +END_TEXT + +################## +# EDIT BELOW HERE +################## +BEGIN_TEXT +$HR +$PAR +This file is /conf/snippets/hardcopySetHeader.pg you can use it as +a model for creating files which introduce each problem set. +$PAR +$HR +END_TEXT +################## +# EDIT ABOVE HERE +################## +BEGIN_TEXT +The primary purpose of WeBWorK is to let you know that you are getting the correct answer or to alert +you if you are making some kind of mistake. Usually you can attempt a problem as many times as you want before +the due date. However, if you are having trouble figuring out your error, you should +consult the book, or ask a fellow student, one of the TA's or +your professor for help. Don't spend a lot of time guessing -- it's not very efficient or effective. +$PAR +Give 4 or 5 significant digits for (floating point) numerical answers. +For most problems when entering numerical answers, you can if you wish +enter elementary expressions such as \( 2\wedge3 \) instead of 8, \( sin(3*pi/2) \)instead +of -1, \( e\wedge (ln(2)) \) instead of 2, +\( (2+tan(3))*(4-sin(5))\wedge6-7/8 \) instead of 27620.3413, etc. + Here's the +\{ htmlLink(qq!http://webwork.math.rochester.edu/docs/docs/pglanguage/availableFunctions.html!,"list of the functions") \} + which WeBWorK understands. +$PAR +You can use the Feedback button on each problem +page to send e-mail to the professors. + + +$END_ONE_COLUMN +END_TEXT + +ENDDOCUMENT(); # This should be the last executable line in the problem. diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopyUserDivider.tex b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopyUserDivider.tex new file mode 100644 index 0000000000..a23eb585dc --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopyUserDivider.tex @@ -0,0 +1,7 @@ + +\end{multicols} % close off the columns from the set above + +\newpage% +\setcounter{page}{1}% +\begin{multicols}{2} +\columnwidth=\linewidth % reopen the columns for the following set diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopyPostamble.tex b/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopyPostamble.tex new file mode 100644 index 0000000000..8e831736a7 --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopyPostamble.tex @@ -0,0 +1,3 @@ + +\vfill +\end{document} diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopyPreamble.tex b/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopyPreamble.tex new file mode 100644 index 0000000000..098e7be374 --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopyPreamble.tex @@ -0,0 +1,83 @@ +\batchmode +\documentclass[11pt]{amsart} +\usepackage{amsmath,amsfonts,amssymb,multicol} + +% For XeLaTeX + polyglossia +\usepackage{fontspec} +\usepackage{xunicode} + +\usepackage{booktabs,tabularx,colortbl,caption,xcolor} + +% Load the polyglossia package to support multiple languages. +% see https://ctan.org/pkg/polyglossia +\usepackage{polyglossia} +\setdefaultlanguage{english} +% Can add additional languages +%\setotherlanguage{supported_language} + +% Can add additional languages +%\setotherlanguage{supported_language} + +% Can set TTF/OTF fonts, ex with +%\setmainfont{main font name} +%\setmonofont{mono font name} +%\setsansfont{sans font name} + + +% If needed - can load the bidi package to support RTL and LTR languages +% using automatic direction changes (where it works) for Unicode UTF-8 +% encoded text. +% The bidi package needs to be loaded AFTER caption, xcolor. +%\usepackage{bidi} + +\usepackage{path} + \discretionaries |~!@$%^&*()_+`-=#{"}[]:;'<>,.?\/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789| +\usepackage{graphicx} + +% There is no support for epstopdf in xelatex, but it supports eps files natively +%\usepackage{epstopdf} % allows use of eps files + +% WeBWorK used Control+_ = ^_ for verbatim... so we change its charcode +\catcode`\=12 + +\usepackage{epsf} +\usepackage{epsfig} +\usepackage{pslatex} +\usepackage{fullpage} + +% Comment out 3 lines - XeLaTeX supports UTF-8 and the euro symbol already +%\usepackage[utf8]{inputenc} +%\usepackage{eurosym} % the euro symbol +%\DeclareUnicodeCharacter{20AC}{\euro} % make it possible to use the UTF-8 character for the euro symbol in problems + +\pagestyle{plain} +\def\endline{\bigskip\hrule width \hsize height 0.8pt } +\newcommand{\lt}{<} +\newcommand{\gt}{>} +\newcommand{\less}{<} +\newcommand{\grt}{>} + +% This is used to signal PG that we are not using multicols +\newcommand{\nocolumns}{} + +% BEGIN capa tex macros + +\newcommand{\capa}{{\sl C\kern-.10em\raise-.00ex\hbox{\rm A}\kern-.22em% +{\sl P}\kern-.14em\kern-.01em{\rm A}}} + +\newenvironment{choicelist} +{\begin{list}{} + {\setlength{\rightmargin}{0in}\setlength{\leftmargin}{0.13in} + \setlength{\topsep}{0.05in}\setlength{\itemsep}{0.022in} + \setlength{\parsep}{0in}\setlength{\belowdisplayskip}{0.04in} + \setlength{\abovedisplayskip}{0.05in} + \setlength{\abovedisplayshortskip}{-0.04in} + \setlength{\belowdisplayshortskip}{0.04in}} + } +{\end{list}} + +% END capa tex macros + +\begin{document} +\newpage +\setcounter{page}{1} diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopyProblemDivider.tex b/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopyProblemDivider.tex new file mode 100644 index 0000000000..4ccf3ac14c --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopyProblemDivider.tex @@ -0,0 +1,6 @@ + +\medskip +\goodbreak +\hrule +\nobreak +\smallskip diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopySetDivider.tex b/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopySetDivider.tex new file mode 100644 index 0000000000..a66b59253a --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopySetDivider.tex @@ -0,0 +1,4 @@ + +\newpage% +\setcounter{page}{1}% + diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopySetFooter.pg b/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopySetFooter.pg new file mode 100644 index 0000000000..f6e1baf3ee --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopySetFooter.pg @@ -0,0 +1,24 @@ +# +# hardcopySetFooter.pg - generic hardcopy set footer file +# + +DOCUMENT(); +loadMacros( + "PG.pl", + "PGbasicmacros.pl" +); + +BEGIN_TEXT +$BR + +\begin{english} +\noindent {\tiny Generated by WeBWorK \copyright} +\end{english} + +\begin{hebrew} +\noindent{\tiny נוצר על ידי \textenglish{WeBWorK} \copyright} +\end{hebrew} + +END_TEXT + +ENDDOCUMENT(); diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopySetHeader.pg b/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopySetHeader.pg new file mode 100644 index 0000000000..7a357d2d13 --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopySetHeader.pg @@ -0,0 +1,71 @@ +DOCUMENT(); + +loadMacros( + "PG.pl", + "PGbasicmacros.pl", +); + +TEXT($BEGIN_ONE_COLUMN); + +TEXT(MODES(TeX =>EV3(<<'EOT'),HTML=>"",Latex2HTML=>"")); +\noindent {\large \bf $studentName} +\hfill +\noindent {\large \bf MTH 161 $sectionNumber Fall 2003} +\par + +EOT + +BEGIN_TEXT + +$BBOLD WeBWorK assignment number $setNumber is due : $formattedDueDate. $EBOLD + +$PAR +The +(* home page *) +\{ +#htmlLink(qq!http://www.math.rochester.edu/courses/161/home/!,"home +page") +\} +for the course contains the syllabus, grading policy and other +information. +$PAR +END_TEXT + +################## +# EDIT BELOW HERE +################## +BEGIN_TEXT +$HR +$PAR +This file is /conf/snippets/hardcopySetHeader.pg you can use it as +a model for creating files which introduce each problem set. +$PAR +$HR +END_TEXT +################## +# EDIT ABOVE HERE +################## +BEGIN_TEXT +The primary purpose of WeBWorK is to let you know that you are getting the correct answer or to alert +you if you are making some kind of mistake. Usually you can attempt a problem as many times as you want before +the due date. However, if you are having trouble figuring out your error, you should +consult the book, or ask a fellow student, one of the TA's or +your professor for help. Don't spend a lot of time guessing -- it's not very efficient or effective. +$PAR +Give 4 or 5 significant digits for (floating point) numerical answers. +For most problems when entering numerical answers, you can if you wish +enter elementary expressions such as \( 2\wedge3 \) instead of 8, \( sin(3*pi/2) \)instead +of -1, \( e\wedge (ln(2)) \) instead of 2, +\( (2+tan(3))*(4-sin(5))\wedge6-7/8 \) instead of 27620.3413, etc. + Here's the +\{ htmlLink(qq!http://webwork.math.rochester.edu/docs/docs/pglanguage/availableFunctions.html!,"list of the functions") \} + which WeBWorK understands. +$PAR +You can use the Feedback button on each problem +page to send e-mail to the professors. + + +$END_ONE_COLUMN +END_TEXT + +ENDDOCUMENT(); # This should be the last executable line in the problem. diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopyUserDivider.tex b/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopyUserDivider.tex new file mode 100644 index 0000000000..25cb763f38 --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopyUserDivider.tex @@ -0,0 +1,3 @@ + +\newpage% +\setcounter{page}{1}% diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopyPostamble.tex b/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopyPostamble.tex new file mode 100644 index 0000000000..8e46f0cdb3 --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopyPostamble.tex @@ -0,0 +1,4 @@ + +\end{multicols} +\vfill +\end{document} diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopyPreamble.tex b/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopyPreamble.tex new file mode 100644 index 0000000000..02702e2cae --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopyPreamble.tex @@ -0,0 +1,88 @@ +\batchmode +\documentclass[10pt]{amsart} +\usepackage{amsmath,amsfonts,amssymb,multicol} + +% For XeLaTeX + polyglossia +\usepackage{fontspec} +\usepackage{xunicode} + +\usepackage{booktabs,tabularx,colortbl,caption,xcolor} + +% Load the polyglossia package to support multiple languages. +% see https://ctan.org/pkg/polyglossia +\usepackage{polyglossia} +\setdefaultlanguage{english} +% Can add additional languages +%\setotherlanguage{supported_language} + +% Can add additional languages +%\setotherlanguage{supported_language} + +% Can set TTF/OTF fonts, ex with +%\setmainfont{main font name} +%\setmonofont{mono font name} +%\setsansfont{sans font name} + + +% If needed - can load the bidi package to support RTL and LTR languages +% using automatic direction changes (where it works) for Unicode UTF-8 +% encoded text. +% The bidi package needs to be loaded AFTER caption, xcolor. +%\usepackage{bidi} + +\usepackage{path} + \discretionaries |~!@$%^&*()_+`-=#{"}[]:;'<>,.?\/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789| +\usepackage{graphicx} + +% There is no support for epstopdf in xelatex, but it supports eps files natively +%\usepackage{epstopdf} % allows use of eps files + +% WeBWorK used Control+_ = ^_ for verbatim... so we change its charcode +\catcode`\=12 + +\usepackage{epsf} +\usepackage{epsfig} +\usepackage{pslatex} + +% Comment out 3 lines - XeLaTeX supports UTF-8 and the euro symbol already +%\usepackage[utf8]{inputenc} +%\usepackage{eurosym} % the euro symbol +%\DeclareUnicodeCharacter{20AC}{\euro} % make it possible to use the UTF-8 character for the euro symbol in problems + +\pagestyle{plain} +\textheight 9in +\oddsidemargin = -0.42in +\evensidemargin = -0.42in +\textwidth= 7.28in +\columnsep = .25in +\columnseprule = .4pt +\def\endline{\bigskip\hrule width \hsize height 0.8pt } +\newcommand{\lt}{<} +\newcommand{\gt}{>} +\newcommand{\less}{<} +\newcommand{\grt}{>} + +% BEGIN capa tex macros + +\newcommand{\capa}{{\sl C\kern-.10em\raise-.00ex\hbox{\rm A}\kern-.22em% +{\sl P}\kern-.14em\kern-.01em{\rm A}}} + +\newenvironment{choicelist} +{\begin{list}{} + {\setlength{\rightmargin}{0in}\setlength{\leftmargin}{0.13in} + \setlength{\topsep}{0.05in}\setlength{\itemsep}{0.022in} + \setlength{\parsep}{0in}\setlength{\belowdisplayskip}{0.04in} + \setlength{\abovedisplayskip}{0.05in} + \setlength{\abovedisplayshortskip}{-0.04in} + \setlength{\belowdisplayshortskip}{0.04in}} + } +{\end{list}} + +% END capa tex macros + +\begin{document} +\voffset=-0.8in +\newpage +\setcounter{page}{1} +\begin{multicols}{2} +\columnwidth=\linewidth diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopyProblemDivider.tex b/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopyProblemDivider.tex new file mode 100644 index 0000000000..4ccf3ac14c --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopyProblemDivider.tex @@ -0,0 +1,6 @@ + +\medskip +\goodbreak +\hrule +\nobreak +\smallskip diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopySetDivider.tex b/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopySetDivider.tex new file mode 100644 index 0000000000..2832139795 --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopySetDivider.tex @@ -0,0 +1,8 @@ + +\end{multicols} % close off the columns from the set above + +\newpage% +\setcounter{page}{1}% +\begin{multicols}{2} +\columnwidth=\linewidth % reopen the columns for the following set + diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopySetFooter.pg b/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopySetFooter.pg new file mode 100644 index 0000000000..b3cfb96c4f --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopySetFooter.pg @@ -0,0 +1,19 @@ +# +# hardcopySetFooter.pg - generic hardcopy set footer file +# + +DOCUMENT(); +loadMacros( + "PG.pl", + "PGbasicmacros.pl" +); + +BEGIN_TEXT +$BEGIN_ONE_COLUMN + +\noindent {\tiny Generated by \copyright WeBWorK, http://webwork.maa.org, Mathematical Association of America} + +$END_ONE_COLUMN +END_TEXT + +ENDDOCUMENT(); diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopySetHeader.pg b/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopySetHeader.pg new file mode 100644 index 0000000000..7a357d2d13 --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopySetHeader.pg @@ -0,0 +1,71 @@ +DOCUMENT(); + +loadMacros( + "PG.pl", + "PGbasicmacros.pl", +); + +TEXT($BEGIN_ONE_COLUMN); + +TEXT(MODES(TeX =>EV3(<<'EOT'),HTML=>"",Latex2HTML=>"")); +\noindent {\large \bf $studentName} +\hfill +\noindent {\large \bf MTH 161 $sectionNumber Fall 2003} +\par + +EOT + +BEGIN_TEXT + +$BBOLD WeBWorK assignment number $setNumber is due : $formattedDueDate. $EBOLD + +$PAR +The +(* home page *) +\{ +#htmlLink(qq!http://www.math.rochester.edu/courses/161/home/!,"home +page") +\} +for the course contains the syllabus, grading policy and other +information. +$PAR +END_TEXT + +################## +# EDIT BELOW HERE +################## +BEGIN_TEXT +$HR +$PAR +This file is /conf/snippets/hardcopySetHeader.pg you can use it as +a model for creating files which introduce each problem set. +$PAR +$HR +END_TEXT +################## +# EDIT ABOVE HERE +################## +BEGIN_TEXT +The primary purpose of WeBWorK is to let you know that you are getting the correct answer or to alert +you if you are making some kind of mistake. Usually you can attempt a problem as many times as you want before +the due date. However, if you are having trouble figuring out your error, you should +consult the book, or ask a fellow student, one of the TA's or +your professor for help. Don't spend a lot of time guessing -- it's not very efficient or effective. +$PAR +Give 4 or 5 significant digits for (floating point) numerical answers. +For most problems when entering numerical answers, you can if you wish +enter elementary expressions such as \( 2\wedge3 \) instead of 8, \( sin(3*pi/2) \)instead +of -1, \( e\wedge (ln(2)) \) instead of 2, +\( (2+tan(3))*(4-sin(5))\wedge6-7/8 \) instead of 27620.3413, etc. + Here's the +\{ htmlLink(qq!http://webwork.math.rochester.edu/docs/docs/pglanguage/availableFunctions.html!,"list of the functions") \} + which WeBWorK understands. +$PAR +You can use the Feedback button on each problem +page to send e-mail to the professors. + + +$END_ONE_COLUMN +END_TEXT + +ENDDOCUMENT(); # This should be the last executable line in the problem. diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopyUserDivider.tex b/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopyUserDivider.tex new file mode 100644 index 0000000000..a23eb585dc --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopyUserDivider.tex @@ -0,0 +1,7 @@ + +\end{multicols} % close off the columns from the set above + +\newpage% +\setcounter{page}{1}% +\begin{multicols}{2} +\columnwidth=\linewidth % reopen the columns for the following set diff --git a/docker-compose.yml b/docker-compose.yml index df1c97e7f1..3cc83fc5e0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,45 +1,134 @@ -version: '2' +version: '3.5' services: db: image: mariadb:10.1 + volumes: + - mysql:/var/lib/mysql + # Set up UTF8MB4 in config file for the container. # Needs to be done BEFORE the database is created. - # - "./docker-config/db/mariadb.cnf:/etc/mysql/conf.d/mariadb.cnf" + - "./docker-config/db/mariadb.cnf:/etc/mysql/conf.d/mariadb.cnf" + restart: always + environment: - MYSQL_ROOT_PASSWORD: randomepassword + + # When the MariaDB container is first started it will set the + # the MYSQL_ROOT_PASSWORD if there is no mysql database in the + # data volume. + MYSQL_ROOT_PASSWORD: sqlRootPasswordSetThisPasswordBEFOREfirstStartingTheDBcontainer + + # When the MariaDB container is first started it will create + # the WW database and WW DB user based on: MYSQL_DATABASE: webwork MYSQL_USER: webworkWrite - MYSQL_PASSWORD: passwordRW + MYSQL_PASSWORD: passwordRWsetItBeforeFirstStartingTheDBcontainer + app: + build: . - image: webwork + + image: webwork_215_ubuntu_1804 + depends_on: - db - r + volumes: + + # Mount main (Git controlled) webwork2 tree - WITHOUT local files - ".:/opt/webwork/webwork2" + # OR mount it from a fixed external location + #- "/path_to/webwork2:/opt/webwork/webwork2" + + # Sometimes it is helpful to mount certain webwork2/conf files from elsewhere + # so the main contents of webwork2 can be shared by several hosts (ex. NFS) + #- "/per_host_conf_path/conf/authen_LTI.conf:/opt/webwork/webwork2/conf/authen_LTI.conf" + #- "/per_host_conf_path/conf/localOverrides.conf:/opt/webwork/webwork2/conf/localOverrides.conf" + #- "/per_host_conf_path/conf/site.conf:/opt/webwork/webwork2/conf/site.conf" + + # webwork2 misc LOCAL files - mount live (per host) so NOT in the main webwork2 location + #- "/per_host_conf_path/htdocs/my_site_info.txt:/opt/webwork/webwork2/htdocs/my_site_info.txt" + + # webwork2 LOCAL logs and htdocs/tmp directories (per host) + #- "/per_host_data_path/webwork2/logs:/opt/webwork/webwork2/logs" + #- "/per_host_data_path/webwork2/htdocs/tmp:/opt/webwork/webwork2/htdocs/tmp" # OLD approach put the courses tree under webwork2/.data/courses #- "./.data/courses:/opt/webwork/courses" # NEW appoach puts the courses tree in a separate tree outside of webwork2/ - "../ww-docker-data/courses:/opt/webwork/courses" + # OR mount like (here we are assuming that the hosts have different courses on them) + #- "/per_host_data_path/courses/:/opt/webwork/courses/" + + # Apache logs - to have them persistent (per host) mount directory from outside. + #- "/per_host_data_path/apache2_logs:/var/log/apache2" # Uncomment the line below to use local OPL for development - #- "../opl:/opt/webwork/libraries/webwork-open-problem-library" - # Uncomment the line below to use local PG for development + #- "/path_to/webwork-open-problem-library:/opt/webwork/libraries/webwork-open-problem-library" + + # Shared main /pg repository - allows local PG development + #- "/path_to_shared/pg:/opt/webwork/pg" + # OR - "../pg:/opt/webwork/pg" + + # ========================================================== + # The mounts from ./docker-config/ below are local samples. + # In production, there may be per-host versions of most + # of these files stored in an appropriate place. + # If not - the samples should be edited as needed. + # ========================================================== + + # Main index.html page with a redirect + - "./docker-config/apache/index.html:/var/www/html/index.html" + - "./docker-config/apache/htaccess:/var/www/html/.htaccess" + + # Apache config + - "./docker-config/apache/000-default.conf:/etc/apache2/sites-available/000-default.conf" + - "./docker-config/apache/apache2.conf:/etc/apache2/apache2.conf" + - "./docker-config/apache/mpm_prefork.conf:/etc/apache2/mods-enabled/mpm_prefork.conf" + + # SSL certificates (subdirectory with certificate and key) - should probably be outside webwork2/ tree + - "./docker-config/ssl/local/:/etc/ssl/local" + + # Apache SSL config (make sure default-ssl.conf points to the certificates where they will be in the container) + - "./docker-config/ssl/ssl.conf:/etc/apache2/mods-available/ssl.conf" + - "./docker-config/ssl/default-ssl.conf:/etc/apache2/sites-available/default-ssl.conf" + + hostname: myhost.mydomain + ports: + # For a personal machine - "8080:80" + + # For a production machine + #- "80:80" + #- "443:443" + + # For a production machine + #restart: always + environment: + DEV: 0 + + APACHE_RUN_GROUP: www-data + + WEBWORK_DB_PASSWORD: passwordRWsetItBeforeFirstStartingTheDBcontainer + # should be the same password as MYSQL_PASSWORD above. + +# WEBWORK_ROOT_URL: https://myhost.mydomain +# WEBWORK_SMTP_SERVER: smtp.mydomain +# WEBWORK_SMTP_SENDER: support@myhost2.mydomain +# WEBWORK_TIMEZONE: America/New_York + r: image: ubcctlt/rserve - ports: - - "6311:6311" +# # The R server need not be available from outside the local Docker network. +# ports: +# - "6311:6311" volumes: mysql: - diff --git a/docker-config/apache/000-default.conf b/docker-config/apache/000-default.conf new file mode 100644 index 0000000000..bba08d79ee --- /dev/null +++ b/docker-config/apache/000-default.conf @@ -0,0 +1,34 @@ + + # The ServerName directive sets the request scheme, hostname and port that + # the server uses to identify itself. This is used when creating + # redirection URLs. In the context of virtual hosts, the ServerName + # specifies what hostname must appear in the request's Host: header to + # match this virtual host. For the default virtual host (this file) this + # value is not decisive as it is used as a last resort host regardless. + # However, you must set it for any further virtual host explicitly. + ServerName myhost.mydomain + + ServerAdmin support@mydomain + DocumentRoot /var/www/html + + # May want to redirect non-https traffic to https + #Redirect permanent /webwork2 https://myhost.mydomain/webwork2 + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + + +# vim: syntax=apache ts=4 sw=4 sts=4 sr noet diff --git a/docker-config/apache/apache2.conf b/docker-config/apache/apache2.conf new file mode 100644 index 0000000000..e8be63c2a6 --- /dev/null +++ b/docker-config/apache/apache2.conf @@ -0,0 +1,234 @@ +# This is the main Apache server configuration file. It contains the +# configuration directives that give the server its instructions. +# See http://httpd.apache.org/docs/2.4/ for detailed information about +# the directives and /usr/share/doc/apache2/README.Debian about Debian specific +# hints. +# +# +# Summary of how the Apache 2 configuration works in Debian: +# The Apache 2 web server configuration in Debian is quite different to +# upstream's suggested way to configure the web server. This is because Debian's +# default Apache2 installation attempts to make adding and removing modules, +# virtual hosts, and extra configuration directives as flexible as possible, in +# order to make automating the changes and administering the server as easy as +# possible. + +# It is split into several files forming the configuration hierarchy outlined +# below, all located in the /etc/apache2/ directory: +# +# /etc/apache2/ +# |-- apache2.conf +# | `-- ports.conf +# |-- mods-enabled +# | |-- *.load +# | `-- *.conf +# |-- conf-enabled +# | `-- *.conf +# `-- sites-enabled +# `-- *.conf +# +# +# * apache2.conf is the main configuration file (this file). It puts the pieces +# together by including all remaining configuration files when starting up the +# web server. +# +# * ports.conf is always included from the main configuration file. It is +# supposed to determine listening ports for incoming connections which can be +# customized anytime. +# +# * Configuration files in the mods-enabled/, conf-enabled/ and sites-enabled/ +# directories contain particular configuration snippets which manage modules, +# global configuration fragments, or virtual host configurations, +# respectively. +# +# They are activated by symlinking available configuration files from their +# respective *-available/ counterparts. These should be managed by using our +# helpers a2enmod/a2dismod, a2ensite/a2dissite and a2enconf/a2disconf. See +# their respective man pages for detailed information. +# +# * The binary is called apache2. Due to the use of environment variables, in +# the default configuration, apache2 needs to be started/stopped with +# /etc/init.d/apache2 or apache2ctl. Calling /usr/bin/apache2 directly will not +# work with the default configuration. + + +# Global configuration +# + +ServerName myhost.mydomain +ServerAdmin support@mydomain + +# +# ServerRoot: The top of the directory tree under which the server's +# configuration, error, and log files are kept. +# +# NOTE! If you intend to place this on an NFS (or otherwise network) +# mounted filesystem then please read the Mutex documentation (available +# at ); +# you will save yourself a lot of trouble. +# +# Do NOT add a slash at the end of the directory path. +# +#ServerRoot "/etc/apache2" + +# +# The accept serialization lock file MUST BE STORED ON A LOCAL DISK. +# +#Mutex file:${APACHE_LOCK_DIR} default + +# +# The directory where shm and other runtime files will be stored. +# + +DefaultRuntimeDir ${APACHE_RUN_DIR} + +# +# PidFile: The file in which the server should record its process +# identification number when it starts. +# This needs to be set in /etc/apache2/envvars +# +PidFile ${APACHE_PID_FILE} + +# +# Timeout: The number of seconds before receives and sends time out. +# +Timeout 1200 + +# +# KeepAlive: Whether or not to allow persistent connections (more than +# one request per connection). Set to "Off" to deactivate. +# +KeepAlive On + +# +# MaxKeepAliveRequests: The maximum number of requests to allow +# during a persistent connection. Set to 0 to allow an unlimited amount. +# We recommend you leave this number high, for maximum performance. +# +MaxKeepAliveRequests 100 + +# +# KeepAliveTimeout: Number of seconds to wait for the next request from the +# same client on the same connection. +# +KeepAliveTimeout 5 + + +# These need to be set in /etc/apache2/envvars +User ${APACHE_RUN_USER} +Group ${APACHE_RUN_GROUP} + +# +# HostnameLookups: Log the names of clients or just their IP addresses +# e.g., www.apache.org (on) or 204.62.129.132 (off). +# The default is off because it'd be overall better for the net if people +# had to knowingly turn this feature on, since enabling it means that +# each client request will result in AT LEAST one lookup request to the +# nameserver. +# +HostnameLookups Off + +# ErrorLog: The location of the error log file. +# If you do not specify an ErrorLog directive within a +# container, error messages relating to that virtual host will be +# logged here. If you *do* define an error logfile for a +# container, that host's errors will be logged there and not here. +# +ErrorLog ${APACHE_LOG_DIR}/error.log + +# +# LogLevel: Control the severity of messages logged to the error_log. +# Available values: trace8, ..., trace1, debug, info, notice, warn, +# error, crit, alert, emerg. +# It is also possible to configure the log level for particular modules, e.g. +# "LogLevel info ssl:warn" +# +LogLevel warn + +# Include module configuration: +IncludeOptional mods-enabled/*.load +IncludeOptional mods-enabled/*.conf + +# Include list of ports to listen on +Include ports.conf + + +# Sets the default security model of the Apache2 HTTPD server. It does +# not allow access to the root filesystem outside of /usr/share and /var/www. +# The former is used by web applications packaged in Debian, +# the latter may be used for local directories served by the web server. If +# your system is serving content from a sub-directory in /srv you must allow +# access here, or in any related virtual host. + + Options FollowSymLinks + AllowOverride None + Require all denied + + + + AllowOverride None + Require all granted + + + + Options Indexes FollowSymLinks + AllowOverride None + Require all granted + + + + Options Indexes FollowSymLinks + AllowOverride All + Require all granted + + +# +# Options Indexes FollowSymLinks +# AllowOverride None +# Require all granted +# + + +# AccessFileName: The name of the file to look for in each directory +# for additional configuration directives. See also the AllowOverride +# directive. +# +AccessFileName .htaccess + +# +# The following lines prevent .htaccess and .htpasswd files from being +# viewed by Web clients. +# + + Require all denied + + + +# +# The following directives define some format nicknames for use with +# a CustomLog directive. +# +# These deviate from the Common Log Format definitions in that they use %O +# (the actual bytes sent including headers) instead of %b (the size of the +# requested file), because the latter makes it impossible to detect partial +# requests. +# +# Note that the use of %{X-Forwarded-For}i instead of %h is not recommended. +# Use mod_remoteip instead. +# +LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined +LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined +LogFormat "%h %l %u %t \"%r\" %>s %O" common +LogFormat "%{Referer}i -> %U" referer +LogFormat "%{User-agent}i" agent + +# Include of directories ignores editors' and dpkg's backup files, +# see README.Debian for details. + +# Include generic snippets of statements +IncludeOptional conf-enabled/*.conf + +# Include the virtual host configurations: +IncludeOptional sites-enabled/*.conf + +# vim: syntax=apache ts=4 sw=4 sts=4 sr noet diff --git a/docker-config/apache/htaccess b/docker-config/apache/htaccess new file mode 100644 index 0000000000..876d1a5355 --- /dev/null +++ b/docker-config/apache/htaccess @@ -0,0 +1 @@ +Redirect /index.html https://myhost.mydomain/webwork2/ diff --git a/docker-config/apache/index.html b/docker-config/apache/index.html new file mode 100644 index 0000000000..82d7d007d7 --- /dev/null +++ b/docker-config/apache/index.html @@ -0,0 +1,12 @@ + + + + + WeBWorK site - redirects to main page + + + You probably want to use the + the WeBWorK list of courses page + + + diff --git a/docker-config/apache/mpm_prefork.conf b/docker-config/apache/mpm_prefork.conf new file mode 100644 index 0000000000..0ed3dd99ca --- /dev/null +++ b/docker-config/apache/mpm_prefork.conf @@ -0,0 +1,19 @@ +# prefork MPM +# StartServers: number of server processes to start +# MinSpareServers: minimum number of server processes which are kept spare +# MaxSpareServers: maximum number of server processes which are kept spare +# MaxRequestWorkers: maximum number of server processes allowed to start +# MaxConnectionsPerChild: maximum number of requests a server process serves + + + StartServers 5 + MinSpareServers 5 + MaxSpareServers 18 + MaxRequestWorkers 25 + MaxConnectionsPerChild 35 + + +# Was MaxRequestWorkers 30 +# Was MaxConnectionsPerChild 100 +# +# vim: syntax=apache ts=4 sw=4 sts=4 sr noet diff --git a/docker-entrypoint.sh b/docker-config/docker-entrypoint.sh similarity index 75% rename from docker-entrypoint.sh rename to docker-config/docker-entrypoint.sh index 7860cee2f5..bb687f2338 100755 --- a/docker-entrypoint.sh +++ b/docker-config/docker-entrypoint.sh @@ -22,7 +22,7 @@ if [ "$1" = 'apache2' ]; then -e 's/mail{smtpServer} = '\'''\''/mail{smtpServer} = $ENV{"WEBWORK_SMTP_SERVER"}/' \ -e 's/mail{smtpSender} = '\'''\''/mail{smtpSender} = $ENV{"WEBWORK_SMTP_SENDER"}/' \ -e 's/siteDefaults{timezone} = "America\/New_York"/siteDefaults{timezone} = $ENV{"WEBWORK_TIMEZONE"}/' \ - -e 's/$server_groupID = '\''wwdata'\''/$server_groupID = "root"/' \ + -e 's/$server_groupID = '\''wwdata'\''/$server_groupID = "www-data"/' \ $APP_ROOT/webwork2/conf/site.conf fi fi @@ -36,7 +36,7 @@ if [ "$1" = 'apache2' ]; then umask 2 cd $APP_ROOT/courses WEBWORK_ROOT=$APP_ROOT/webwork2 $APP_ROOT/webwork2/bin/addcourse admin --db-layout=sql_single --users=$APP_ROOT/webwork2/courses.dist/adminClasslist.lst --professors=admin - chown www-data:root -R $APP_ROOT/courses + chown www-data:www-data -R $APP_ROOT/courses echo "Admin course is created." fi # modelCourses link if not existing @@ -49,9 +49,9 @@ if [ "$1" = 'apache2' ]; then # create htdocs/tmp directory if not existing if [ ! -d "$APP_ROOT/webwork2/htdocs/tmp" ]; then mkdir $APP_ROOT/webwork2/htdocs/tmp + chown www-data:www-data -R $APP_ROOT/webwork2/htdocs/tmp echo "htdocs/tmp directory created" fi - chown www-data:root -R $APP_ROOT/webwork2/htdocs/tmp # defaultClasslist.lst and adminClasslist.lst files if not existing if [ ! -f "$APP_ROOT/courses/defaultClasslist.lst" ]; then @@ -69,7 +69,11 @@ if [ "$1" = 'apache2' ]; then cd $APP_ROOT/webwork2/bin ./OPL-update fi - + # Compile chromatic/color.c if necessary - may be needed for PG directory mounted from outside image + if [ ! -f "$APP_ROOT/pg/lib/chromatic/color" ]; then + cd $APP_ROOT/pg/lib/chromatic + gcc color.c -o color + fi # generate apache2 reload config if needed if [ $DEV -eq 1 ]; then echo "PerlModule Apache2::Reload" > /etc/apache2/conf-enabled/apache2-reload.conf @@ -82,20 +86,22 @@ if [ "$1" = 'apache2' ]; then # Fix possible permission issues echo "Fixing ownership and permissions (just in case it is needed)" cd $APP_ROOT/webwork2 - rm -rf htdocs/tmp/* # pointers which which have no target shut down the rebuild process. - # the tmp directory is rebuilt automatically at the cost of some speed. - chown -R www-data logs tmp DATA htdocs/tmp + # Symbolic links which have no target outside the Docker container + # cause problems duringt the rebuild process on some systems. + # So we delete them. They will be rebuilt automatically when needed again + # at the cost of some speed. + find htdocs/tmp -type l -exec rm -f {} \; + chown -R www-data:www-data logs tmp DATA htdocs/tmp chmod -R u+w logs tmp DATA ../courses htdocs/tmp cd $APP_ROOT - find courses -type f -exec chown www-data:root {} \; - find courses -type d -exec chown www-data:root {} \; - - # echo "start cpan install XML::Simple" - # cpan install XML::Simple - # echo "end fixing ownership and permissions" - # OLD: chown www-data -R $APP_ROOT/courses - # but that sometimes caused errors in Docker on Mac OS X when there was a broken symbolic link somewhere in the directory tree being processed + # The chown for files/directories under courses is done using find, as + # using a simple "chown -R www-data $APP_ROOT/courses" would sometimes + # cause errors in Docker on Mac OS X when there was a broken symbolic link + # somewhere in the directory tree being processed. + find courses -type f -exec chown www-data:www-data {} \; + find courses -type d -exec chown www-data:www-data {} \; + echo "end fixing ownership and permissions" fi - exec "$@" +exec "$@" diff --git a/docker-config/ssl/default-ssl.conf b/docker-config/ssl/default-ssl.conf new file mode 100644 index 0000000000..0c2ee4d404 --- /dev/null +++ b/docker-config/ssl/default-ssl.conf @@ -0,0 +1,138 @@ + + + ServerAdmin support@mydomain + + DocumentRoot /var/www/html + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + + # SSL Engine Switch: + # Enable/Disable SSL for this virtual host. + SSLEngine on + + # A self-signed (snakeoil) certificate can be created by installing + # the ssl-cert package. See + # /usr/share/doc/apache2/README.Debian.gz for more info. + # If both key and certificate are stored in the same file, only the + # SSLCertificateFile directive is needed. + #SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem + #SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key + + SSLCertificateFile /etc/ssl/local/my.crt + SSLCertificateKeyFile /etc/ssl/local/my.key + SSLCertificateChainFile /etc/ssl/local/myCA_chain.crt + + # Server Certificate Chain: + # Point SSLCertificateChainFile at a file containing the + # concatenation of PEM encoded CA certificates which form the + # certificate chain for the server certificate. Alternatively + # the referenced file can be the same as SSLCertificateFile + # when the CA certificates are directly appended to the server + # certificate for convinience. + #SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt + + # Certificate Authority (CA): + # Set the CA certificate verification path where to find CA + # certificates for client authentication or alternatively one + # huge file containing all of them (file must be PEM encoded) + # Note: Inside SSLCACertificatePath you need hash symlinks + # to point to the certificate files. Use the provided + # Makefile to update the hash symlinks after changes. + #SSLCACertificatePath /etc/ssl/certs/ + #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt + + # Certificate Revocation Lists (CRL): + # Set the CA revocation path where to find CA CRLs for client + # authentication or alternatively one huge file containing all + # of them (file must be PEM encoded) + # Note: Inside SSLCARevocationPath you need hash symlinks + # to point to the certificate files. Use the provided + # Makefile to update the hash symlinks after changes. + #SSLCARevocationPath /etc/apache2/ssl.crl/ + #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl + + # Client Authentication (Type): + # Client certificate verification type and depth. Types are + # none, optional, require and optional_no_ca. Depth is a + # number which specifies how deeply to verify the certificate + # issuer chain before deciding the certificate is not valid. + #SSLVerifyClient require + #SSLVerifyDepth 10 + + # SSL Engine Options: + # Set various options for the SSL engine. + # o FakeBasicAuth: + # Translate the client X.509 into a Basic Authorisation. This means that + # the standard Auth/DBMAuth methods can be used for access control. The + # user name is the `one line' version of the client's X.509 certificate. + # Note that no password is obtained from the user. Every entry in the user + # file needs this password: `xxj31ZMTZzkVA'. + # o ExportCertData: + # This exports two additional environment variables: SSL_CLIENT_CERT and + # SSL_SERVER_CERT. These contain the PEM-encoded certificates of the + # server (always existing) and the client (only existing when client + # authentication is used). This can be used to import the certificates + # into CGI scripts. + # o StdEnvVars: + # This exports the standard SSL/TLS related `SSL_*' environment variables. + # Per default this exportation is switched off for performance reasons, + # because the extraction step is an expensive operation and is usually + # useless for serving static content. So one usually enables the + # exportation for CGI and SSI requests only. + # o OptRenegotiate: + # This enables optimized SSL connection renegotiation handling when SSL + # directives are used in per-directory context. + #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire + + SSLOptions +StdEnvVars + + + SSLOptions +StdEnvVars + + + # SSL Protocol Adjustments: + # The safe and default but still SSL/TLS standard compliant shutdown + # approach is that mod_ssl sends the close notify alert but doesn't wait for + # the close notify alert from client. When you need a different shutdown + # approach you can use one of the following variables: + # o ssl-unclean-shutdown: + # This forces an unclean shutdown when the connection is closed, i.e. no + # SSL close notify alert is send or allowed to received. This violates + # the SSL/TLS standard but is needed for some brain-dead browsers. Use + # this when you receive I/O errors because of the standard approach where + # mod_ssl sends the close notify alert. + # o ssl-accurate-shutdown: + # This forces an accurate shutdown when the connection is closed, i.e. a + # SSL close notify alert is send and mod_ssl waits for the close notify + # alert of the client. This is 100% SSL/TLS standard compliant, but in + # practice often causes hanging connections with brain-dead browsers. Use + # this only for browsers where you know that their SSL implementation + # works correctly. + # Notice: Most problems of broken clients are also related to the HTTP + # keep-alive facility, so you usually additionally want to disable + # keep-alive for those clients, too. Use variable "nokeepalive" for this. + # Similarly, one has to force some clients to use HTTP/1.0 to workaround + # their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and + # "force-response-1.0" for this. + # BrowserMatch "MSIE [2-6]" \ + # nokeepalive ssl-unclean-shutdown \ + # downgrade-1.0 force-response-1.0 + + + + +# vim: syntax=apache ts=4 sw=4 sts=4 sr noet diff --git a/docker-config/ssl/local/PutYourCertificate_and_key_here.txt b/docker-config/ssl/local/PutYourCertificate_and_key_here.txt new file mode 100644 index 0000000000..a1eb1a947d --- /dev/null +++ b/docker-config/ssl/local/PutYourCertificate_and_key_here.txt @@ -0,0 +1,8 @@ +This directory should have your real SSL key and certificate, and +the Certificate Authority's root certificate or certrificate chain. + +The file names should match those defined in default-ssl.conf, ex: + + SSLCertificateFile /etc/ssl/local/my.crt + SSLCertificateKeyFile /etc/ssl/local/my.key + SSLCertificateChainFile /etc/ssl/local/myCA_chain.crt diff --git a/docker-config/ssl/local/my.crt b/docker-config/ssl/local/my.crt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docker-config/ssl/local/my.key b/docker-config/ssl/local/my.key new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docker-config/ssl/local/myCA_chain.crt b/docker-config/ssl/local/myCA_chain.crt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docker-config/ssl/ssl.conf b/docker-config/ssl/ssl.conf new file mode 100644 index 0000000000..7e364639e9 --- /dev/null +++ b/docker-config/ssl/ssl.conf @@ -0,0 +1,85 @@ + + + # Pseudo Random Number Generator (PRNG): + # Configure one or more sources to seed the PRNG of the SSL library. + # The seed data should be of good random quality. + # WARNING! On some platforms /dev/random blocks if not enough entropy + # is available. This means you then cannot use the /dev/random device + # because it would lead to very long connection times (as long as + # it requires to make more entropy available). But usually those + # platforms additionally provide a /dev/urandom device which doesn't + # block. So, if available, use this one instead. Read the mod_ssl User + # Manual for more details. + # + SSLRandomSeed startup builtin + SSLRandomSeed startup file:/dev/urandom 512 + SSLRandomSeed connect builtin + SSLRandomSeed connect file:/dev/urandom 512 + + ## + ## SSL Global Context + ## + ## All SSL configuration in this context applies both to + ## the main server and all SSL-enabled virtual hosts. + ## + + # + # Some MIME-types for downloading Certificates and CRLs + # + AddType application/x-x509-ca-cert .crt + AddType application/x-pkcs7-crl .crl + + # Pass Phrase Dialog: + # Configure the pass phrase gathering process. + # The filtering dialog program (`builtin' is a internal + # terminal dialog) has to provide the pass phrase on stdout. + SSLPassPhraseDialog exec:/usr/share/apache2/ask-for-passphrase + + # Inter-Process Session Cache: + # Configure the SSL Session Cache: First the mechanism + # to use and second the expiring timeout (in seconds). + # (The mechanism dbm has known memory leaks and should not be used). + #SSLSessionCache dbm:${APACHE_RUN_DIR}/ssl_scache + SSLSessionCache shmcb:${APACHE_RUN_DIR}/ssl_scache(512000) + SSLSessionCacheTimeout 300 + + # Semaphore: + # Configure the path to the mutual exclusion semaphore the + # SSL engine uses internally for inter-process synchronization. + # (Disabled by default, the global Mutex directive consolidates by default + # this) + #Mutex file:${APACHE_LOCK_DIR}/ssl_mutex ssl-cache + + + # SSL Cipher Suite: + # List the ciphers that the client is permitted to negotiate. See the + # ciphers(1) man page from the openssl package for list of all available + # options. + # Enable only secure ciphers: + SSLCipherSuite HIGH:!aNULL + + # SSL server cipher order preference: + # Use server priorities for cipher algorithm choice. + # Clients may prefer lower grade encryption. You should enable this + # option if you want to enforce stronger encryption, and can afford + # the CPU cost, and did not override SSLCipherSuite in a way that puts + # insecure ciphers first. + # Default: Off + #SSLHonorCipherOrder on + + # The protocols to enable. + # Available values: all, SSLv3, TLSv1, TLSv1.1, TLSv1.2 + # SSL v2 is no longer supported + SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1 + + # Allow insecure renegotiation with clients which do not yet support the + # secure renegotiation protocol. Default: Off + #SSLInsecureRenegotiation on + + # Whether to forbid non-SNI clients to access name based virtual hosts. + # Default: Off + #SSLStrictSNIVHostCheck On + + + +# vim: syntax=apache ts=4 sw=4 sts=4 sr noet diff --git a/lib/WeBWorK/ContentGenerator/Hardcopy.pm b/lib/WeBWorK/ContentGenerator/Hardcopy.pm index 1bd3c554b8..c1c442eec4 100644 --- a/lib/WeBWorK/ContentGenerator/Hardcopy.pm +++ b/lib/WeBWorK/ContentGenerator/Hardcopy.pm @@ -566,7 +566,9 @@ sub display_form { } - my %hardcopyThemeNames = map {$_ => $r->maketext($ce->{hardcopyThemeNames}->{$_})} @{$ce->{hardcopyThemes}}; + # Using maketext on the next line would trigger errors when a locak hardcopyTheme is installed. + # my %hardcopyThemeNames = map {$_ => $r->maketext($ce->{hardcopyThemeNames}->{$_})} @{$ce->{hardcopyThemes}}; + my %hardcopyThemeNames = map {$_ => $ce->{hardcopyThemeNames}->{$_}} @{$ce->{hardcopyThemes}}; print CGI::table({class=>"FormLayout"}, CGI::Tr({},