SeedDMS 6.0.24

This commit is contained in:
Disassembler 2023-05-14 16:31:15 +02:00
commit 798ae8f1a4
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499
16 changed files with 397 additions and 0 deletions

14
.env Normal file
View File

@ -0,0 +1,14 @@
POSTGRES_HOST=seeddms-postgres
POSTGRES_USER=seeddms
POSTGRES_PASSWORD=seeddms
POSTGRES_DB=seeddms
SEEDDMS_ADMIN_USER=admin
SEEDDMS_ADMIN_EMAIL=admin@example.com
SEEDDMS_ADMIN_PASSWORD=seedDMS123!
SMTP_HOST=seeddms-smtp
SMTP_PORT=25
SMTP_SENDER=admin@example.com
SMTP_USERNAME=
SMTP_PASSWORD=

45
README.md Normal file
View File

@ -0,0 +1,45 @@
SeedDMS
=======
Overview
--------
SeedDMS is a free document management system with an easy to use web based user interface for small
and medium sized enterprises. SeedDMS 6.0 runs on PHP 7.4 and is configured to use PostgreSQL
as backend. SeedDMS integrates with LibreOffice via [unoconv](https://github.com/unoconv/unoconv)
in order to provide previews and conversions for commonly used document formats.
Development without docker-compose
----------------------------------
```bash
rm -rf ~/postgres_data
mkdir ~/postgres_data
podman run -it --rm \
--env "POSTGRES_USER=seeddms" \
--env "POSTGRES_PASSWORD=seeddms" \
--env "POSTGRES_DB=seeddms" \
--volume ~/postgres_data:/var/lib/postgresql/data \
--ip 10.88.0.2 \
docker.io/postgres:14-alpine
```
```bash
podman build -t seeddms:latest seeddms
rm -rf ~/seeddms_{conf,data}
mkdir ~/seeddms_{conf,data}
podman run --rm \
--volume ~/seeddms_conf:/mnt/conf \
--volume ~/seeddms_data:/mnt/data \
seeddms:latest \
sh -c "cp -rp /srv/seeddms/conf /mnt; cp -rp /srv/seeddms/data /mnt"
podman run -it --rm \
--env-file .env \
--volume ~/seeddms_conf:/srv/seeddms/conf \
--volume ~/seeddms_data:/srv/seeddms/data \
--add-host seeddms-postgres:10.88.0.2 \
--ip 10.88.0.3 \
seeddms:latest
```

34
docker-compose.yml Normal file
View File

@ -0,0 +1,34 @@
---
version: '3'
services:
seeddms:
build: seeddms
image: seeddms:6.0.24-230514
restart: unless-stopped
depends_on:
- seeddms-postgres
env_file:
- .env
expose:
- 8080
ports:
- 8080:8080
volumes:
- seeddms_conf:/srv/seeddms/conf
- seeddms_data:/srv/seeddms/data
seeddms-postgres:
image: postgres:14-alpine
restart: unless-stopped
environment:
- POSTGRES_USER
- POSTGRES_PASSWORD
- POSTGRES_DB
volumes:
- postgres_data:/var/lib/postgresql/data
volumes:
seeddms_conf:
seeddms_data:
postgres_data:

49
seeddms/Dockerfile Normal file
View File

@ -0,0 +1,49 @@
FROM docker.io/alpine:3.15
ARG SEEDDMS_VERSION=6.0.24
RUN \
# Update packages
apk --no-cache upgrade && \
# Install common packages
apk --no-cache add libbz2 libgcc libressl libstdc++ libxml2 libxslt ncurses-libs pcre readline s6 xz-libs && \
# Install PHP
apk --no-cache add nginx php7 php7-ctype php7-curl php7-fileinfo php7-fpm php7-gd php7-iconv php7-intl php7-json php7-mbstring php7-mcrypt php7-opcache php7-openssl php7-pear php7-pdo_pgsql php7-session php7-simplexml php7-xml php7-xsl php7-zip && \
# Install glibc-compiled iconv (see https://github.com/docker-library/php/issues/240)
# Provides /usr/lib/preloadable_libiconv.so for LD_PRELOAD
apk --no-cache --repository https://dl-cdn.alpinelinux.org/alpine/v3.13/community/ add gnu-libiconv=1.15-r3 && \
# Install other dependencies
apk --no-cache add ghostscript imagemagick libreoffice-calc libreoffice-impress libreoffice-writer poppler-utils postgresql-client python3 ttf-opensans && \
# Set time zone data
apk --no-cache add tzdata && \
cp /usr/share/zoneinfo/UTC /etc/localtime && \
apk --no-cache del tzdata && \
# Set python interpret
ln -s /usr/bin/python3 /usr/bin/python && \
# Install unoconv
wget https://raw.githubusercontent.com/dagwieers/unoconv/master/unoconv -O /usr/bin/unoconv && \
chmod +x /usr/bin/unoconv && \
# Cleanup
rm -rf /etc/crontabs/root /etc/periodic
RUN \
# Install SeedDMS
wget https://sourceforge.net/projects/seeddms/files/seeddms-${SEEDDMS_VERSION}/seeddms-quickstart-${SEEDDMS_VERSION}.tar.gz/download -O - | tar xzf - -C /srv && \
mv /srv/seeddms* /srv/seeddms && \
rm -rf /srv/seeddms/www/install /srv/seeddms/www/ext/example && \
# Create OS user
addgroup -S -g 8080 seeddms && \
adduser -S -u 8080 -h /srv/seeddms -s /bin/false -g seeddms -G seeddms seeddms && \
chown -R seeddms:seeddms /srv/seeddms
RUN \
# Fix missing "secret" column in create_tables-postgres.sql inserts
sed -i "s/'21232f297a57a5a743894a0e4a801fc3'/'21232f297a57a5a743894a0e4a801fc3', ''/" /srv/seeddms/seeddms/install/create_tables-postgres.sql
COPY --chown=seeddms:seeddms image.d/srv/seeddms/ /srv/seeddms/
COPY image.d/etc/ /etc/
COPY image.d/entrypoint.sh /
VOLUME ["/srv/seeddms/conf", "/srv/seeddms/data"]
EXPOSE 8080
ENTRYPOINT ["/entrypoint.sh"]

30
seeddms/image.d/entrypoint.sh Executable file
View File

@ -0,0 +1,30 @@
#!/bin/sh
set -e
if [ "$*" != "" ]; then
exec "$@"
fi
echo "Starting SeedDMS..."
# Fix volume permissions
chown -R seeddms:seeddms /srv/seeddms/conf /srv/seeddms/data
# Populate database
export PGPASSWORD=${POSTGRES_PASSWORD}
DB_EXISTS=$(psql -h "${POSTGRES_HOST}" -Atc "SELECT 1 FROM \"tblVersion\"" "${POSTGRES_DB}" "${POSTGRES_USER}" 2>/dev/null || true)
if [ -z "${DB_EXISTS}" ]; then
cat /srv/seeddms/seeddms/install/create_tables-postgres.sql | psql -h "${POSTGRES_HOST}" "${POSTGRES_DB}" "${POSTGRES_USER}"
cat /srv/seeddms/seeddms/install/custom.sql | psql -h "${POSTGRES_HOST}" "${POSTGRES_DB}" "${POSTGRES_USER}"
fi
psql -h "${POSTGRES_HOST}" -Atc "UPDATE \"tblUsers\" SET login = '${SEEDDMS_ADMIN_USER}', pwd = MD5('${SEEDDMS_ADMIN_PASSWORD}'), email = '${SEEDDMS_ADMIN_EMAIL}' WHERE id = 1" "${POSTGRES_DB}" "${POSTGRES_USER}"
# TODO: Update database
# Looks like database schema updates are done only in new minor version (e.g. 6.0.x -> 6.1.x)
unset PGPASSWORD
# Configure SeedDMS
/usr/bin/php -f /srv/seeddms/settings-from-env-vars.php
chown seeddms:seeddms /srv/seeddms/conf/settings.xml
# Exec into s6 supervisor
exec /bin/s6-svscan /etc/services.d

View File

@ -0,0 +1 @@
*/10 * * * * /srv/seeddms/seeddms/utils/seeddms-indexer >/dev/null

View File

@ -0,0 +1,44 @@
user nginx;
pid /run/nginx.pid;
worker_processes 1;
error_log /dev/stderr warn;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
access_log off;
server_tokens off;
client_max_body_size 100m;
sendfile on;
tcp_nodelay on;
send_timeout 300;
server {
listen 8080;
server_name localhost;
root /srv/seeddms/www;
index index.php;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/seeddms.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param HTTP_HOST $http_x_forwarded_host if_not_empty;
fastcgi_param HTTPS "on";
fastcgi_param REQUEST_SCHEME "https";
fastcgi_param SERVER_NAME $http_x_forwarded_server_name if_not_empty;
fastcgi_param SERVER_PORT $http_x_forwarded_server_port if_not_empty;
}
}
}

View File

@ -0,0 +1,17 @@
[global]
error_log = /proc/self/fd/2
daemonize = no
[seeddms]
catch_workers_output = yes
user = seeddms
group = seeddms
listen.owner = nginx
listen.group = nginx
listen = /var/run/seeddms.sock
pm = ondemand
pm.max_children = 16
php_admin_value[error_reporting] = E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
php_admin_value[upload_max_filesize] = 100M
php_admin_value[post_max_size] = 100M
env[LANG]=en_US.UTF-8

View File

@ -0,0 +1,5 @@
#!/bin/execlineb -P
/bin/foreground { /bin/s6-svwait -d -t 3000 cron }
/bin/foreground { /bin/s6-svwait -d -t 3000 nginx }
/bin/foreground { /bin/s6-svwait -d -t 3000 php-fpm }

View File

@ -0,0 +1,4 @@
#!/bin/execlineb -P
/bin/fdmove -c 2 1
/usr/sbin/crond -f -d 8

View File

@ -0,0 +1,3 @@
#!/bin/execlineb -P
/usr/sbin/nginx -g "daemon off;"

View File

@ -0,0 +1,4 @@
#!/bin/execlineb -P
/bin/export LD_PRELOAD /usr/lib/preloadable_libiconv.so
/usr/sbin/php-fpm7 -F

View File

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<site>
<display siteName="DMS" footNote="" printDisclaimer="true" language="cs_CZ" theme="bootstrap" previewWidthList="600" previewWidthDetail="600" availablelanguages="" showFullPreview="true" convertToPdf="true"/>
<edition strictFormCheck="false" viewOnlineFileTypes=".txt;.text;.html;.htm;.xml;.pdf;.gif;.png;.jpg;.jpeg" enableConverting="true" enableEmail="true" enableUsersView="true" enableFullSearch="true" enableFolderTree="true" expandFolderTree="1" enableLanguageSelector="true" stopWordsFile="" sortUsersInList="" sortFoldersDefault="n" editOnlineFileTypes="" enableSessionList="false" enableClipboard="true" enableMenuTasks="true" enableDropUpload="true" enableMultiUpload="true" enableRecursiveCount="true" maxRecursiveCount="0" enableHelp="false" enableThemeSelector="false" maxSizeForFullText="0" fullSearchEngine="lucene" defaultSearchMethod="database" showSingleSearchHit="false" enableDropFolderList="true"/>
<calendar enableCalendar="true" calendarDefaultView="w" firstDayOfWeek="1"/>
</site>
<system>
<server rootDir="/srv/seeddms/www/" httpRoot="/" contentDir="/srv/seeddms/data/" stagingDir="/srv/seeddms/data/staging/" luceneDir="/srv/seeddms/data/lucene/" logFileEnable="true" logFileRotation="d" enableLargeFileUpload="true" partitionSize="2000000" dropFolderDir="" cacheDir="/srv/seeddms/data/cache/" maxUploadSize=""/>
<authentication enableGuestLogin="false" enablePasswordForgotten="true" restricted="true" enableUserImage="false" disableSelfEdit="false" passwordStrength="0" passwordExpiration="0" passwordHistory="0" passwordStrengthAlgorithm="advanced" loginFailure="0" encryptionKey="" enableGuestAutoLogin="false" autoLoginUser="0" quota="0" undelUserIds="" cookieLifetime="0" defaultAccessDocs="0">
<connectors>
<connector enable="false" type="ldap" host="ldaps://ldap.host.com" port="389" baseDN="" bindDN="" bindPw="" filter=""/>
<connector enable="false" type="AD" host="ldap.example.com" port="389" baseDN="" accountDomainName="example.com" bindDN="" bindPw=""/>
</connectors>
</authentication>
<database dbDriver="pgsql" dbHostname="" dbDatabase="" dbUser="" dbPass="" doNotCheckVersion="false"/>
<smtp smtpServer="" smtpPort="" smtpSendFrom="" smtpUser="" smtpPassword=""/>
</system>
<advanced>
<display siteDefaultPage="" rootFolderID="1" titleDisplayHack="true" showMissingTranslations="false"/>
<authentication guestID="2" adminIP=""/>
<edition enableAdminRevApp="false" versioningFileName="versioning_info.txt" workflowMode="advanced" enableVersionDeletion="true" enableVersionModification="true" enableDuplicateDocNames="true" enableOwnerRevApp="false" enableSelfRevApp="false" enableUpdateRevApp="false" presetExpirationDate="" overrideMimeType="false" removeFromDropFolder="false"/>
<notification enableNotificationAppRev="true" enableOwnerNotification="false" enableNotificationWorkflow="false"/>
<server coreDir="" luceneClassDir="" contentOffsetDir="1048576" maxDirID="0" updateNotifyTime="86400" extraPath="/srv/seeddms/pear" cmdTimeout="30" maxExecutionTime="7200"/>
<converters target="fulltext">
<converter mimeType="application/pdf">pdftotext -enc UTF-8 -nopgbrk %s -</converter>
<converter mimeType="text/rtf">unoconv -d document -f txt --stdout %s</converter>
<converter mimeType="application/msword">unoconv -d document -f txt --stdout %s</converter>
<converter mimeType="application/vnd.oasis.opendocument.text">unoconv -d document -f txt --stdout %s</converter>
<converter mimeType="application/vnd.openxmlformats-officedocument.wordprocessingml.document">unoconv -d document -f txt --stdout %s</converter>
<converter mimeType="application/vnd.ms-excel">unoconv -d spreadsheet -f csv --stdout %s</converter>
<converter mimeType="application/vnd.oasis.opendocument.spreadsheet">unoconv -d spreadsheet -f csv --stdout %s</converter>
<converter mimeType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet">unoconv -d spreadsheet -f csv --stdout %s</converter>
<converter mimeType="application/vnd.ms-powerpoint">unoconv -d presentation -f pdf --stdout %s | pdftotext -enc UTF-8 -nopgbrk - -</converter>
<converter mimeType="application/vnd.oasis.opendocument.presentation">unoconv -d presentation -f pdf --stdout %s | pdftotext -enc UTF-8 -nopgbrk - -</converter>
<converter mimeType="application/vnd.openxmlformats-officedocument.presentationml.presentation">unoconv -d presentation -f pdf --stdout %s | pdftotext -enc UTF-8 -nopgbrk - -</converter>
<converter mimeType="text/html">unoconv -d document -f txt --stdout %s</converter>
<converter mimeType="text/plain">cat %s</converter>
</converters>
<converters target="preview">
<converter mimeType="image/png">convert -resize %wx '%f' '%o'</converter>
<converter mimeType="image/gif">convert -resize %wx '%f' '%o'</converter>
<converter mimeType="image/jpg">convert -resize %wx '%f' '%o'</converter>
<converter mimeType="image/jpeg">convert -resize %wx '%f' '%o'</converter>
<converter mimeType="image/svg+xml">convert -resize %wx '%f' '%o'</converter>
<converter mimeType="application/pdf">convert -density 100 -resize %wx '%f[0]' '%o'</converter>
<converter mimeType="text/rtf">unoconv -d document -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'</converter>
<converter mimeType="application/msword">unoconv -d document -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'</converter>
<converter mimeType="application/vnd.oasis.opendocument.text">unoconv -d document -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'</converter>
<converter mimeType="application/vnd.openxmlformats-officedocument.wordprocessingml.document">unoconv -d document -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'</converter>
<converter mimeType="application/vnd.ms-excel">unoconv -d spreadsheet -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'</converter>
<converter mimeType="application/vnd.oasis.opendocument.spreadsheet">unoconv -d spreadsheet -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'</converter>
<converter mimeType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet">unoconv -d spreadsheet -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'</converter>
<converter mimeType="application/vnd.ms-powerpoint">unoconv -d presentation -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'</converter>
<converter mimeType="application/vnd.oasis.opendocument.presentation">unoconv -d presentation -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'</converter>
<converter mimeType="application/vnd.openxmlformats-officedocument.presentationml.presentation">unoconv -d presentation -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'</converter>
<converter mimeType="text/html">unoconv -d document -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'</converter>
<converter mimeType="text/plain">unoconv -d document -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'</converter>
</converters>
<converters target="pdf">
<converter mimeType="text/rtf">unoconv -d document -f pdf -o '%o' '%f'</converter>
<converter mimeType="application/msword">unoconv -d document -f pdf -o '%o' '%f'</converter>
<converter mimeType="application/vnd.oasis.opendocument.text">unoconv -d document -f pdf -o '%o' '%f'</converter>
<converter mimeType="application/vnd.openxmlformats-officedocument.wordprocessingml.document">unoconv -d document -f pdf -o '%o' '%f'</converter>
<converter mimeType="application/vnd.ms-excel">unoconv -d spreadsheet -f pdf -o '%o' '%f'</converter>
<converter mimeType="application/vnd.oasis.opendocument.spreadsheet">unoconv -d spreadsheet -f pdf -o '%o' '%f'</converter>
<converter mimeType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet">unoconv -d spreadsheet -f pdf -o '%o' '%f'</converter>
<converter mimeType="application/vnd.ms-powerpoint">unoconv -d presentation -f pdf -o '%o' '%f'</converter>
<converter mimeType="application/vnd.oasis.opendocument.presentation">unoconv -d presentation -f pdf -o '%o' '%f'</converter>
<converter mimeType="application/vnd.openxmlformats-officedocument.presentationml.presentation">unoconv -d presentation -f pdf -o '%o' '%f'</converter>
<converter mimeType="text/html">unoconv -d document -f pdf -o '%o' '%f'</converter>
<converter mimeType="text/plain">unoconv -d document -f pdf -o '%o' '%f'</converter>
</converters>
</advanced>
<extensions/>
</configuration>

View File

@ -0,0 +1,13 @@
INSERT INTO "tblAttributeDefinitions" (name, objtype, type) VALUES
('Licence', 2, 3),
('Autor', 2, 3),
('Source URL', 2, 5),
('Email', 2, 6),
('Organization', 2, 3),
('ISBN', 2, 3),
('Published', 2, 7),
('Language', 0, 3),
('Phone', 2, 1),
('Region', 0, 3),
('Org. abbreviation', 2, 3),
('ISSN', 2, 3);

View File

@ -0,0 +1,15 @@
#!/bin/sh
if [ -z "${SEEDDMS_HOME}" ]; then
parentdir=$(dirname "$0")
export SEEDDMS_HOME=$(dirname "$parentdir")
fi
# Prevent indexer jobs to run simultaneously by using a file lock
(
if ! flock -n 3; then
echo "Previous indexer job is still running"
exit 1
fi
php -f "${SEEDDMS_HOME}/utils/indexer.php" -- "${@}"
) 3>/srv/seeddms/indexer.lock

View File

@ -0,0 +1,43 @@
<?php
define("SEEDDMS_CONFIG_FILE", "/srv/seeddms/conf/settings.xml");
require("/srv/seeddms/seeddms/inc/inc.Settings.php");
$dbHostname = getenv("POSTGRES_HOST");
if ($dbHostname) {
$settings->_dbHostname = $dbHostname;
}
$dbDatabase = getenv("POSTGRES_DB");
if ($dbDatabase) {
$settings->_dbDatabase = $dbDatabase;
}
$dbUser = getenv("POSTGRES_USER");
if ($dbUser) {
$settings->_dbUser = $dbUser;
}
$dbPass = getenv("POSTGRES_PASSWORD");
if ($dbPass) {
$settings->_dbPass = $dbPass;
}
$smtpServer = getenv("SMTP_HOST");
if ($smtpServer) {
$settings->_smtpServer = $smtpServer;
}
$smtpPort = getenv("SMTP_PORT");
if ($smtpPort) {
$settings->_smtpPort = $smtpPort;
}
$smtpSendFrom = getenv("SMTP_SENDER");
if ($smtpSendFrom) {
$settings->_smtpSendFrom = $smtpSendFrom;
}
$smtpUser = getenv("SMTP_USERNAME");
if ($smtpUser) {
$settings->_smtpUser = $smtpUser;
}
$smtpPassword = getenv("SMTP_PASSWORD");
if ($smtpPassword) {
$settings->_smtpPassword = $smtpPassword;
}
$settings->save();