OpenBSD installation

From Mayan EDMS Wiki
Jump to: navigation, search
  1. Install binary dependencies (change the URL based on your hardware platform):
    sudo pkg_add g++ gcc ghostscript-9.07p7-no_x11 fuse graphviz gnupg-1.4.22p1 libmagic poppler-utils postgresql-server libreoffice libpqxx py-virtualenv supervisor tesseract sane-backends-1.0.27p1 sudo-1.8.22
    Installing ghostscript will also install the following required packages: python-2.7.14p1 png-1.6.34 jpeg-1.5.3v0 tiff-4.0.9
  2. Create the parent directory where the project will be deployed:
    sudo mkdir -p /opt
  3. Create the Python virtual environment for the installation:
    sudo virtualenv /opt/mayan-edms
  4. Create an user account for the installation:
    sudo groupadd _mayan
    sudo useradd -c "Mayan EDMS" -g _mayan -s /bin/nologin -L daemon -d /opt/mayan-edms _mayan
  5. Make the mayan user the owner of the installation directory:
    sudo chown -R _mayan:_mayan /opt/mayan-edms
  6. Install Mayan EDMS:
    sudo -u _mayan /opt/mayan-edms/bin/pip install --no-cache-dir mayan-edms
  7. Install the Python client for PostgreSQL and Redis:
    sudo -u _mayan /opt/mayan-edms/bin/pip install --no-cache-dir psycopg2==2.7.3.2 redis==2.10.6
  8. Create the database for the installation (you will be prompted to create a superuser password):
    su - _postgresql
    mkdir /var/postgresql/data
    initdb -D /var/postgresql/data -U postgres -A md5 -E UTF-8 -W
    exit
    rcctl enable postgresql
    rcctl start postgresql
    psql -U postgres -c "CREATE USER mayan WITH password 'mayanuserpass';"
    createdb -U postgres -O mayan mayan
  9. Initialize the project:
    sudo -u _mayan MAYAN_DATABASE_ENGINE=django.db.backends.postgresql MAYAN_DATABASE_NAME=mayan MAYAN_DATABASE_PASSWORD=mayanuserpass MAYAN_DATABASE_USER=mayan MAYAN_DATABASE_HOST=127.0.0.1 MAYAN_MEDIA_ROOT=/opt/mayan-edms/media /opt/mayan-edms/bin/mayan-edms.py initialsetup
  10. Collect the static files:
    sudo -u _mayan MAYAN_MEDIA_ROOT=/opt/mayan-edms/media /opt/mayan-edms/bin/mayan-edms.py collectstatic --noinput
  11. Create the supervisor file at /etc/supervisor/conf.d/mayan.conf:
    [supervisord]
    environment=
        MAYAN_ALLOWED_HOSTS='["*"]',  # For versions < 3.1 use MAYAN_ALLOWED_HOSTS="*"
        MAYAN_CELERY_RESULT_BACKEND="redis://127.0.0.1:6379/0",
        MAYAN_BROKER_URL="redis://127.0.0.1:6379/0",
        PYTHONPATH=/opt/mayan-edms/lib/python2.7/site-packages:/opt/mayan-edms/data,
        MAYAN_MEDIA_ROOT=/opt/mayan-edms/media,
        MAYAN_CONVERTER_GRAPHICS_BACKEND_CONFIG='{libreoffice_path: /usr/local/bin/libreoffice,pdftoppm_dpi: 300, pdftoppm_format: jpeg, pdftoppm_path: /usr/local/bin/pdftoppm, pdfinfo_path: /usr/local/bin/pdfinfo, pillow_format: JPEG}',
        MAYAN_DATABASE_ENGINE=django.db.backends.postgresql,
        MAYAN_DATABASE_HOST=127.0.0.1,
        MAYAN_DATABASE_NAME=mayan,
        MAYAN_DATABASE_PASSWORD=mayanuserpass,
        MAYAN_DATABASE_USER=mayan,
        MAYAN_DATABASE_CONN_MAX_AGE=60,
        MAYAN_DOCUMENT_PARSING_PDFTOTEXT_PATH=/usr/local/bin/pdftotext,
        MAYAN_SIGNATURES_GPG_PATH=/usr/local/bin/gpg,
        MAYAN_SOURCES_SCANIMAGE_PATH: /usr/local/bin/scanimage,
        DJANGO_SETTINGS_MODULE=mayan.settings.production
    
    [program:mayan-gunicorn]
    autorestart = true
    autostart = true
    command = /opt/mayan-edms/bin/gunicorn -w 2 mayan.wsgi --max-requests 500 --max-requests-jitter 50 --worker-class gevent --bind 0.0.0.0:8000 --timeout 120
    user = _mayan
    
    [program:mayan-worker-fast]
    autorestart = true
    autostart = true
    command = nice -n 1 /opt/mayan-edms/bin/mayan-edms.py celery worker -Ofair -l ERROR -Q converter -n mayan-worker-fast.%%h --concurrency=1
    killasgroup = true
    numprocs = 1
    priority = 998
    startsecs = 10
    stopwaitsecs = 1
    user = _mayan
    
    [program:mayan-worker-medium]
    autorestart = true
    autostart = true
    command = nice -n 18 /opt/mayan-edms/bin/mayan-edms.py celery worker -Ofair -l ERROR -Q checkouts_periodic,documents_periodic,indexing,metadata,sources,sources_periodic,uploads,documents -n mayan-worker-medium.%%h --concurrency=1
    killasgroup = true
    numprocs = 1
    priority = 998
    startsecs = 10
    stopwaitsecs = 1
    user = _mayan
    
    [program:mayan-worker-slow]
    autorestart = true
    autostart = true
    command = nice -n 19 /opt/mayan-edms/bin/mayan-edms.py celery worker -Ofair -l ERROR -Q mailing,tools,statistics,parsing,ocr -n mayan-worker-slow.%%h --concurrency=1
    killasgroup = true
    numprocs = 1
    priority = 998
    startsecs = 10
    stopwaitsecs = 1
    user = _mayan
    
    [program:mayan-celery-beat]
    autorestart = true
    autostart = true
    command = nice -n 1 /opt/mayan-edms/bin/mayan-edms.py celery beat --pidfile= -l ERROR
    killasgroup = true
    numprocs = 1
    priority = 998
    startsecs = 10
    stopwaitsecs = 1
    user = _mayan
  12. Configure Redis to discard data when it runs out of memory:
    echo "maxmemory-policy allkeys-lru" >> /etc/redis/redis.conf
    echo "save \"\"" >> /etc/redis/redis.conf
    echo "databases 1" >> /etc/redis/redis.conf
    rcctl enable redis
    rcctl start redis
  13. Start Supervisor
    rcctl enable supervisord
    rcctl start supervisord


Missing[edit]

  • Compressed files support. Missing library counterpart: zlib1g-dev
  • Python FUSE not support on OpenBSD. Breaks the index mirroring app.
  • Use recommended security container. Example: chroot, jail or similar.

Failing tests[edit]

common app[edit]

  • ERROR: test_member_contents (common.tests.test_compressed_files.TarGzArchiveClassTestCase)
      File "/home/rosarior/development/mayan-edms/mayan/apps/common/tests/test_compressed_files.py", line 42, in test_member_contents
        archive = Archive.open(file_object=file_object)
      File "/home/rosarior/development/mayan-edms/mayan/apps/common/compressed_files.py", line 43, in open
        raise NoMIMETypeMatch
    NoMIMETypeMatch
  • ERROR: test_members (common.tests.test_compressed_files.TarGzArchiveClassTestCase)
      File "/home/rosarior/development/mayan-edms/mayan/apps/common/tests/test_compressed_files.py", line 37, in test_members
        archive = Archive.open(file_object=file_object)
      File "/home/rosarior/development/mayan-edms/mayan/apps/common/compressed_files.py", line 43, in open
        raise NoMIMETypeMatch
    NoMIMETypeMatch
  • ERROR: test_open (common.tests.test_compressed_files.TarGzArchiveClassTestCase)
      File "/home/rosarior/development/mayan-edms/mayan/apps/common/tests/test_compressed_files.py", line 32, in test_open
        archive = Archive.open(file_object=file_object)
      File "/home/rosarior/development/mayan-edms/mayan/apps/common/compressed_files.py", line 43, in open
        raise NoMIMETypeMatch
    NoMIMETypeMatch
  • ERROR: test_open_member (common.tests.test_compressed_files.TarGzArchiveClassTestCase)
      File "/home/rosarior/development/mayan-edms/mayan/apps/common/tests/test_compressed_files.py", line 50, in test_open_member
        archive = Archive.open(file_object=file_object)
      File "/home/rosarior/development/mayan-edms/mayan/apps/common/compressed_files.py", line 43, in open
        raise NoMIMETypeMatch
    NoMIMETypeMatch

sources app[edit]

  • ERROR: test_unicode_staging_file (sources.tests.test_classes.StagingFileTestCase)
      File "/home/rosarior/development/mayan-edms/mayan/apps/sources/tests/test_classes.py", line 16, in test_unicode_staging_file
        shutil.copy(TEST_NON_ASCII_DOCUMENT_PATH, temporary_directory)
      File "/usr/local/lib/python2.7/shutil.py", line 133, in copy
        copyfile(src, dst)
      File "/usr/local/lib/python2.7/shutil.py", line 82, in copyfile
        if _samefile(src, dst):
      File "/usr/local/lib/python2.7/shutil.py", line 72, in _samefile
        return os.path.samefile(src, dst)
      File "/home/rosarior/development/mayan-edms/venv/lib/python2.7/posixpath.py", line 155, in samefile
        s1 = os.stat(f1)
    UnicodeEncodeError: 'ascii' codec can't encode characters in position 101-108: ordinal not in range(128)
  • ERROR: test_issue_gh_163 (sources.tests.test_models.UploadDocumentTestCase)
      File "/home/rosarior/development/mayan-edms/mayan/apps/sources/tests/test_models.py", line 258, in test_issue_gh_163
        shutil.copy(TEST_NON_ASCII_DOCUMENT_PATH, temporary_directory)
      File "/usr/local/lib/python2.7/shutil.py", line 133, in copy
        copyfile(src, dst)
      File "/usr/local/lib/python2.7/shutil.py", line 82, in copyfile
        if _samefile(src, dst):
      File "/usr/local/lib/python2.7/shutil.py", line 72, in _samefile
        return os.path.samefile(src, dst)
      File "/home/rosarior/development/mayan-edms/venv/lib/python2.7/posixpath.py", line 155, in samefile
        s1 = os.stat(f1)
    UnicodeEncodeError: 'ascii' codec can't encode characters in position 101-108: ordinal not in range(128)

mirroring app[edit]

  • ERROR: mirroring.tests.test_filesystems (unittest.loader.ModuleImportFailure)
    ImportError: Failed to import test module: mirroring.tests.test_filesystems
    Traceback (most recent call last):
      File "/usr/local/lib/python2.7/unittest/loader.py", line 254, in _find_tests
        module = self._get_module_from_name(name)
      File "/usr/local/lib/python2.7/unittest/loader.py", line 232, in _get_module_from_name
        __import__(name)
      File "/home/rosarior/development/mayan-edms/mayan/apps/mirroring/tests/test_filesystems.py", line 5, in <module>
        from fuse import FuseOSError
      File "/home/rosarior/development/mayan-edms/venv/lib/python2.7/site-packages/fuse.py", line 249, in <module>
        raise NotImplementedError('%s is not supported.' % _system)
    NotImplementedError: OpenBSD is not supported.