From ffcdbed3b8d9a8a7c104c9255c28370e1ecd22ae Mon Sep 17 00:00:00 2001 From: Christopher Meiklejohn Date: Tue, 15 Sep 2020 17:27:42 -0400 Subject: [PATCH 01/25] Add procps to the image to be able to run ps. --- docker/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/Dockerfile b/docker/Dockerfile index 12e2bacf1ae..51742402df2 100755 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -103,6 +103,7 @@ apt-get install -y --no-install-recommends \ gcc \ python3-dev \ python3-venv \ + procps \ && mkdir -p "${PROJECT_INSTALL_DIR}" \ && chown -R mayan:mayan "${PROJECT_INSTALL_DIR}" \ && chown -R mayan:mayan /src From 1e701b33862063553068ff8944e8c4f45edc1ee3 Mon Sep 17 00:00:00 2001 From: Christopher Meiklejohn Date: Tue, 15 Sep 2020 17:28:36 -0400 Subject: [PATCH 02/25] Add procps to lower base image. --- docker/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/Dockerfile b/docker/Dockerfile index 51742402df2..2cdf9b41c10 100755 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -39,6 +39,7 @@ apt-get update \ libmariadb3 \ libpq5 \ libreoffice \ + procps \ poppler-utils \ python3-distutils \ sane-utils \ From be0b3a47c64d2d0bde8819ce609dca5d4e5c4e70 Mon Sep 17 00:00:00 2001 From: Christopher Meiklejohn Date: Tue, 15 Sep 2020 17:30:04 -0400 Subject: [PATCH 03/25] Switch to development configuration from production. --- docker/rootfs/usr/local/bin/entrypoint.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docker/rootfs/usr/local/bin/entrypoint.sh b/docker/rootfs/usr/local/bin/entrypoint.sh index 1407c5cd5b6..f4154cdf9f5 100755 --- a/docker/rootfs/usr/local/bin/entrypoint.sh +++ b/docker/rootfs/usr/local/bin/entrypoint.sh @@ -19,7 +19,9 @@ export MAYAN_BIN=/opt/mayan-edms/bin/mayan-edms.py export MAYAN_INSTALL_DIR=/opt/mayan-edms export MAYAN_PYTHON_BIN_DIR=/opt/mayan-edms/bin/ export MAYAN_MEDIA_ROOT=/var/lib/mayan -export MAYAN_SETTINGS_MODULE=${MAYAN_SETTINGS_MODULE:-mayan.settings.production} +export MAYAN_SETTINGS_MODULE=${MAYAN_SETTINGS_MODULE:-mayan.settings.development} + +export PYTHONDONTWRITEBYTECODE=1 # Set DJANGO_SETTINGS_MODULE to MAYAN_SETTINGS_MODULE to avoid two # different environments for the setting file. From f0635679562b4a7eff44861513d2954c5c625755 Mon Sep 17 00:00:00 2001 From: Christopher Meiklejohn Date: Tue, 15 Sep 2020 17:34:14 -0400 Subject: [PATCH 04/25] Enable debug for Django in the development environment. --- mayan/settings/testing/development.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mayan/settings/testing/development.py b/mayan/settings/testing/development.py index 203a44cec10..7e09012c170 100644 --- a/mayan/settings/testing/development.py +++ b/mayan/settings/testing/development.py @@ -1,4 +1,4 @@ from .base import * # NOQA -DEBUG = False +DEBUG = True SIGNATURES_GPG_PATH = '/usr/bin/gpg1' From 97320de675e88e04a016ff463224a19e04abfdfa Mon Sep 17 00:00:00 2001 From: Christopher Meiklejohn Date: Tue, 15 Sep 2020 17:34:38 -0400 Subject: [PATCH 05/25] Start unicorn with the reload flag. --- mayan/apps/platform/templates/platform/supervisord_docker.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mayan/apps/platform/templates/platform/supervisord_docker.tmpl b/mayan/apps/platform/templates/platform/supervisord_docker.tmpl index a88e7f42ac7..cf517688d89 100644 --- a/mayan/apps/platform/templates/platform/supervisord_docker.tmpl +++ b/mayan/apps/platform/templates/platform/supervisord_docker.tmpl @@ -1,7 +1,7 @@ [program:mayan-gunicorn] autorestart = false autostart = true -command = /bin/bash -c "${MAYAN_GUNICORN_BIN} -w ${MAYAN_GUNICORN_WORKERS} ${MAYAN_GUNICORN_TEMPORARY_DIRECTORY} mayan.wsgi --max-requests 500 --max-requests-jitter 50 --worker-class sync --bind 0.0.0.0:8000 --env DJANGO_SETTINGS_MODULE=${MAYAN_SETTINGS_MODULE} --timeout ${MAYAN_GUNICORN_TIMEOUT}" +command = /bin/bash -c "${MAYAN_GUNICORN_BIN} -w ${MAYAN_GUNICORN_WORKERS} ${MAYAN_GUNICORN_TEMPORARY_DIRECTORY} mayan.wsgi --max-requests 500 --max-requests-jitter 50 --worker-class sync --bind 0.0.0.0:8000 --env DJANGO_SETTINGS_MODULE=${MAYAN_SETTINGS_MODULE} --timeout ${MAYAN_GUNICORN_TIMEOUT} --reload" redirect_stderr = true stderr_logfile = /dev/fd/2 stderr_logfile_maxbytes = 0 From 39982418390584d97f963cf6e2a4d0cb135bef36 Mon Sep 17 00:00:00 2001 From: Christopher Meiklejohn Date: Tue, 15 Sep 2020 17:37:10 -0400 Subject: [PATCH 06/25] Switch to development environment and enable reload flag. --- mayan/apps/platform/templates/platform/supervisord.tmpl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mayan/apps/platform/templates/platform/supervisord.tmpl b/mayan/apps/platform/templates/platform/supervisord.tmpl index f13a50a3421..3c170c37ed2 100644 --- a/mayan/apps/platform/templates/platform/supervisord.tmpl +++ b/mayan/apps/platform/templates/platform/supervisord.tmpl @@ -1,17 +1,18 @@ [supervisord] environment= PYTHONPATH="{{ MEDIA_ROOT }}/mayan_settings", - DJANGO_SETTINGS_MODULE=mayan.settings.production, + DJANGO_SETTINGS_MODULE=mayan.settings.development, MAYAN_MEDIA_ROOT="{{ MEDIA_ROOT }}", MAYAN_ALLOWED_HOSTS="{{ ALLOWED_HOSTS }}", MAYAN_CELERY_RESULT_BACKEND="{{ CELERY_RESULT_BACKEND }}", MAYAN_CELERY_BROKER_URL="{{ CELERY_BROKER_URL }}", MAYAN_DATABASES="{{ DATABASES }}" + PYTHONDONTWRITEBYTECODE=1 [program:mayan-gunicorn] autorestart = true autostart = true -command = {{ INSTALLATION_PATH }}/bin/gunicorn -w {{ GUNICORN_WORKERS }} mayan.wsgi --max-requests 500 --max-requests-jitter 50 --worker-class sync --bind 0.0.0.0:8000 --timeout {{ GUNICORN_TIMEOUT }} +command = {{ INSTALLATION_PATH }}/bin/gunicorn -w {{ GUNICORN_WORKERS }} mayan.wsgi --max-requests 500 --max-requests-jitter 50 --worker-class sync --bind 0.0.0.0:8000 --timeout {{ GUNICORN_TIMEOUT }} --reload user = mayan {% for worker in workers %} From d710addb67c7af59ed9a621a2c0c1c3965cd9ac8 Mon Sep 17 00:00:00 2001 From: Christopher Meiklejohn Date: Tue, 15 Sep 2020 17:38:20 -0400 Subject: [PATCH 07/25] Disable manifest storage. --- mayan/settings/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mayan/settings/base.py b/mayan/settings/base.py index 84094fa9e06..c4cf880c73c 100644 --- a/mayan/settings/base.py +++ b/mayan/settings/base.py @@ -239,7 +239,7 @@ 'mayan.apps.common.finders.MayanAppDirectoriesFinder', ) -STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' +STATICFILES_STORAGE = 'whitenoise.storage.StaticFilesStorage' TEST_RUNNER = 'mayan.apps.common.tests.runner.MayanTestRunner' From 3caba71ecc14cb45e316ed09c9a6a516cb9fa0e0 Mon Sep 17 00:00:00 2001 From: Christopher Meiklejohn Date: Tue, 15 Sep 2020 17:41:20 -0400 Subject: [PATCH 08/25] Add new compose file. --- docker/docker-compose.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 901e911e82e..037af9b3359 100755 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -19,6 +19,7 @@ services: MAYAN_CELERY_RESULT_BACKEND: redis://:${MAYAN_REDIS_PASSWORD:-mayanredispassword}@redis:6379/1 MAYAN_DATABASES: "{'default':{'ENGINE':'django.db.backends.postgresql','NAME':'${MAYAN_DATABASE_DB:-mayan}','PASSWORD':'${MAYAN_DATABASE_PASSWORD:-mayandbpass}','USER':'${MAYAN_DATABASE_USER:-mayan}','HOST':'postgresql'}}" MAYAN_DOCKER_WAIT: "postgresql:5432 redis:6379" + PYTHONDONTWRITEBYTECODE: 1 # Replace with the line below when using RabbitMQ # MAYAN_DOCKER_WAIT: "postgresql:5432 redis:6379 rabbitmq:5672" # To add operating system packages, like additional OCR language, @@ -26,14 +27,16 @@ services: # MAYAN_APT_INSTALLS: "tesseract-ocr-deu tesseract-ocr-nld" # To add Python libraries, like LDAP, put then in the variable below. # MAYAN_PIP_INSTALLS: "python-ldap" - image: mayanedms/mayanedms:3 + image: mayanedms/mayanedms:3.4.17 networks: - bridge ports: - "80:8000" restart: unless-stopped volumes: - - ${MAYAN_APP_VOLUME:-app}:/var/lib/mayan + - ${ABSOLUTE_PATH_TO_WHERE_YOU_CLONED_MAYAN}/docker-volumes/mayan-edms/media:/var/lib/mayan + - ${ABSOLUTE_PATH_TO_WHERE_YOU_CLONED_MAYAN}/mayan/apps/appearance/static/appearance:/opt/mayan-edms/static/appearance + - ${ABSOLUTE_PATH_TO_WHERE_YOU_CLONED_MAYAN}/mayan:/opt/mayan-edms/lib/python3.7/site-packages/mayan # Optional volumes to access external data like staging or watch folders # - /opt/staging_files:/staging_files # - /opt/watch_folder:/watch_folder @@ -48,7 +51,7 @@ services: - bridge restart: unless-stopped volumes: - - ${MAYAN_POSTGRES_VOLUME:-postgres}:/var/lib/postgresql/data + - ${ABSOLUTE_PATH_TO_WHERE_YOU_CLONED_MAYAN}/docker-volumes/mayan-edms/postgres:/var/lib/postgresql/data redis: command: @@ -74,7 +77,7 @@ services: - bridge restart: unless-stopped volumes: - - ${MAYAN_REDIS_VOLUME:-redis}:/data + - ${ABSOLUTE_PATH_TO_WHERE_YOU_CLONED_MAYAN}/docker-volumes/mayan-edms/redis:/data # Optional services From 3a5151a2c4153408a6fcfc561ef329c449e29cfa Mon Sep 17 00:00:00 2001 From: Christopher Meiklejohn Date: Wed, 16 Sep 2020 23:10:40 -0400 Subject: [PATCH 09/25] Fix css path. --- docker/docker-compose.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 037af9b3359..2893a4d92c6 100755 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -34,9 +34,9 @@ services: - "80:8000" restart: unless-stopped volumes: - - ${ABSOLUTE_PATH_TO_WHERE_YOU_CLONED_MAYAN}/docker-volumes/mayan-edms/media:/var/lib/mayan - - ${ABSOLUTE_PATH_TO_WHERE_YOU_CLONED_MAYAN}/mayan/apps/appearance/static/appearance:/opt/mayan-edms/static/appearance - - ${ABSOLUTE_PATH_TO_WHERE_YOU_CLONED_MAYAN}/mayan:/opt/mayan-edms/lib/python3.7/site-packages/mayan + - ${MAYAN}/docker-volumes/mayan-edms/media:/var/lib/mayan + - ${MAYAN}/mayan/apps/appearance/static/appearance/css:/opt/mayan-edms/static/appearance/css + - ${MAYAN}/mayan:/opt/mayan-edms/lib/python3.7/site-packages/mayan # Optional volumes to access external data like staging or watch folders # - /opt/staging_files:/staging_files # - /opt/watch_folder:/watch_folder @@ -51,7 +51,7 @@ services: - bridge restart: unless-stopped volumes: - - ${ABSOLUTE_PATH_TO_WHERE_YOU_CLONED_MAYAN}/docker-volumes/mayan-edms/postgres:/var/lib/postgresql/data + - ${MAYAN}/docker-volumes/mayan-edms/postgres:/var/lib/postgresql/data redis: command: @@ -77,7 +77,7 @@ services: - bridge restart: unless-stopped volumes: - - ${ABSOLUTE_PATH_TO_WHERE_YOU_CLONED_MAYAN}/docker-volumes/mayan-edms/redis:/data + - ${MAYAN}/docker-volumes/mayan-edms/redis:/data # Optional services From 1303125f85d75355549e55702f9740861216008e Mon Sep 17 00:00:00 2001 From: Christopher Meiklejohn Date: Wed, 16 Sep 2020 23:10:55 -0400 Subject: [PATCH 10/25] Don't link, copy. --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 2cdf9b41c10..220df4447ce 100755 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -135,7 +135,7 @@ RUN set -a \ && pip install --no-cache-dir dist/mayan* \ # Install the static content && mayan-edms.py installdependencies \ -&& MAYAN_STATIC_ROOT=${PROJECT_INSTALL_DIR}/static mayan-edms.py preparestatic --link --noinput +&& MAYAN_STATIC_ROOT=${PROJECT_INSTALL_DIR}/static mayan-edms.py preparestatic --noinput COPY --chown=mayan:mayan requirements/testing-base.txt "${PROJECT_INSTALL_DIR}" From 13b4d5d82d883e98fcf6798af66fe25ec69267ad Mon Sep 17 00:00:00 2001 From: Christopher Meiklejohn Date: Thu, 17 Sep 2020 08:12:25 -0400 Subject: [PATCH 11/25] Add README. --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 4d8db41b125..c9a68ef73ff 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,11 @@ +Instructions for running the CMU-313 Mayan. + +``` +1. git clone git@github.com:cmu-313/mayan-edms.git +2. make docker-build +3. MAYAN=`pwd` docker-compose -f docker/docker-compose.yml up +``` + [![pypi][pypi]][pypi-url] ![python][python] ![license][license] From b59b8d9dd7835d1fd84b4dd44813d1bfbd88ac56 Mon Sep 17 00:00:00 2001 From: "Christopher S. Meiklejohn" Date: Thu, 17 Sep 2020 15:29:50 -0400 Subject: [PATCH 12/25] Update README.md --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c9a68ef73ff..973decd8f1d 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,9 @@ Instructions for running the CMU-313 Mayan. ``` 1. git clone git@github.com:cmu-313/mayan-edms.git -2. make docker-build -3. MAYAN=`pwd` docker-compose -f docker/docker-compose.yml up +2. cd mayan-edms +3. make docker-build +4. MAYAN=`pwd` docker-compose -f docker/docker-compose.yml up ``` [![pypi][pypi]][pypi-url] From 899cca2557894c16969d484c8bd8d4d868a9e405 Mon Sep 17 00:00:00 2001 From: Claire Le Goues Date: Fri, 18 Sep 2020 13:19:58 -0400 Subject: [PATCH 13/25] Update README.md Use the template repo first, then clone. --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 973decd8f1d..871a720b15e 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,11 @@ Instructions for running the CMU-313 Mayan. ``` -1. git clone git@github.com:cmu-313/mayan-edms.git -2. cd mayan-edms -3. make docker-build -4. MAYAN=`pwd` docker-compose -f docker/docker-compose.yml up +1. click "Use this template" and create a repository for your team +2. git clone +3. cd mayan-edms +4. make docker-build +5. MAYAN=`pwd` docker-compose -f docker/docker-compose.yml up ``` [![pypi][pypi]][pypi-url] From 1a1b00ca292701ad9dea17645634241b32f18f4e Mon Sep 17 00:00:00 2001 From: Claire Le Goues Date: Fri, 18 Sep 2020 13:26:07 -0400 Subject: [PATCH 14/25] Update README.md Minor typo. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 871a720b15e..668d990aa90 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Instructions for running the CMU-313 Mayan. ``` 1. click "Use this template" and create a repository for your team 2. git clone -3. cd mayan-edms +3. cd 4. make docker-build 5. MAYAN=`pwd` docker-compose -f docker/docker-compose.yml up ``` From 99db57fc5cbede21ca71dca984c5506cca2b5398 Mon Sep 17 00:00:00 2001 From: Rohan Padhye Date: Tue, 24 Aug 2021 17:19:13 -0400 Subject: [PATCH 15/25] Add expect script for programattic credential management --- .github/changepassword.exp | 55 ++++++++++++++++++++++++++++++++++++++ docker/Dockerfile | 1 + 2 files changed, 56 insertions(+) create mode 100644 .github/changepassword.exp diff --git a/.github/changepassword.exp b/.github/changepassword.exp new file mode 100644 index 00000000000..de8da406553 --- /dev/null +++ b/.github/changepassword.exp @@ -0,0 +1,55 @@ +#!/usr/bin/expect -f +# +# This Expect script was generated by autoexpect on Tue Aug 24 19:02:13 2021 +# Expect and autoexpect were both written by Don Libes, NIST. +# +# Note that autoexpect does not guarantee a working script. It +# necessarily has to guess about certain things. Two reasons a script +# might fail are: +# +# 1) timing - A surprising number of programs (rn, ksh, zsh, telnet, +# etc.) and devices discard or ignore keystrokes that arrive "too +# quickly" after prompts. If you find your new script hanging up at +# one spot, try adding a short sleep just before the previous send. +# Setting "force_conservative" to 1 (see below) makes Expect do this +# automatically - pausing briefly before sending each character. This +# pacifies every program I know of. The -c flag makes the script do +# this in the first place. The -C flag allows you to define a +# character to toggle this mode off and on. + +set force_conservative 0 ;# set to 1 to force conservative mode even if + ;# script wasn't run conservatively originally +if {$force_conservative} { + set send_slow {1 .1} + proc send {ignore arg} { + sleep .1 + exp_send -s -- $arg + } +} + +# +# 2) differing output - Some programs produce different output each time +# they run. The "date" command is an obvious example. Another is +# ftp, if it produces throughput statistics at the end of a file +# transfer. If this causes a problem, delete these patterns or replace +# them with wildcards. An alternative is to use the -p flag (for +# "prompt") which makes Expect only look for the last line of output +# (i.e., the prompt). The -P flag allows you to define a character to +# toggle this mode off and on. +# +# Read the man page for more info. +# +# -Don + + +set timeout -1 +spawn /opt/mayan-edms/bin/mayan-edms.py changepassword admin +match_max 100000 +expect -exact "Changing password for user 'admin'\r +Password: " +send -- "cmu-313-mayan\r" +expect -exact "\r +Password (again): " +send -- "cmu-313-mayan\r" +expect eof + diff --git a/docker/Dockerfile b/docker/Dockerfile index 4c9c59aca84..c10c5f45f3a 100755 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -35,6 +35,7 @@ apt-get update \ && apt-get install -y --no-install-recommends \ ca-certificates \ exiftool \ + expect \ fonts-arphic-uming \ fonts-arphic-ukai \ fonts-unfonts-core \ From 6f2295d45fc1dd03d5af9dda6d6efbedb8fbed30 Mon Sep 17 00:00:00 2001 From: Allison Chang Date: Fri, 10 Sep 2021 02:41:46 +0000 Subject: [PATCH 16/25] updating button to be darker for accessibility --- .../templates/appearance/generic_form_subtemplate.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mayan/apps/appearance/templates/appearance/generic_form_subtemplate.html b/mayan/apps/appearance/templates/appearance/generic_form_subtemplate.html index 1c29a672f1b..9e8ae9ee4e0 100644 --- a/mayan/apps/appearance/templates/appearance/generic_form_subtemplate.html +++ b/mayan/apps/appearance/templates/appearance/generic_form_subtemplate.html @@ -89,7 +89,7 @@

{% endif %} {% for button in extra_buttons %} -