2017-06-29 21:12:51 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
SOURCE_DIR=$(realpath $(dirname "${0}"))
|
|
|
|
|
|
|
|
# Install dependencies for SeedDMS
|
2017-10-07 19:26:04 +02:00
|
|
|
apt-get -y --no-install-recommends install ghostscript id3 imagemagick libreoffice-calc libreoffice-writer php7.0-gd php7.0-fpm php7.0-mbstring php7.0-pgsql php7.0-xml php-log php-mail php-pear poppler-utils unoconv
|
2017-06-29 21:12:51 +02:00
|
|
|
|
|
|
|
# Install SeedDMS
|
2017-09-10 22:32:54 +02:00
|
|
|
wget https://sourceforge.net/projects/seeddms/files/seeddms-5.1.3/seeddms-quickstart-5.1.3.tar.gz/download -O /srv/seeddms.tgz
|
|
|
|
tar xzf /srv/seeddms.tgz -C /srv
|
|
|
|
mv /srv/seeddms51x /srv/seeddms
|
|
|
|
rm -f /srv/seeddms.tgz
|
2017-06-30 18:17:07 +02:00
|
|
|
|
2017-10-07 22:30:39 +02:00
|
|
|
# Patch Previewers
|
|
|
|
patch -d /srv/seeddms -p0 <${SOURCE_DIR}/seeddms/seeddms-previewers.patch
|
|
|
|
|
2017-06-30 18:17:07 +02:00
|
|
|
# Populate database
|
2017-09-16 14:38:50 +02:00
|
|
|
export SEEDDMS_PWD=$(head -c 18 /dev/urandom | base64)
|
2017-09-10 22:32:54 +02:00
|
|
|
envsubst <${SOURCE_DIR}/seeddms/tmp/seeddms-createdb.sql >/tmp/seeddms-createdb.sql
|
|
|
|
sudo -u postgres psql -f /tmp/seeddms-createdb.sql
|
|
|
|
rm -f /tmp/seeddms-createdb.sql
|
2017-06-30 18:17:07 +02:00
|
|
|
export PGPASSWORD=${SEEDDMS_PWD}
|
2017-09-10 22:32:54 +02:00
|
|
|
psql -f /srv/seeddms/www/install/create_tables-postgres.sql seeddms seeddms
|
2017-06-30 18:17:07 +02:00
|
|
|
|
|
|
|
# Configure SeedDMS
|
2017-09-10 22:49:39 +02:00
|
|
|
envsubst <${SOURCE_DIR}/seeddms/srv/seeddms/www/conf/settings.xml >/srv/seeddms/www/conf/settings.xml
|
2017-09-10 22:32:54 +02:00
|
|
|
rm -rf /srv/seeddms/www/install/
|
2017-09-16 21:35:44 +02:00
|
|
|
export SEEDDMS_ADMIN_USER=admin
|
|
|
|
export SEEDDMS_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
|
|
|
|
export SEEDDMS_ADMIN_EMAIL=admin@example.com
|
|
|
|
envsubst <${SOURCE_DIR}/seeddms/tmp/seeddms-adminpwd.sql >/tmp/seeddms-adminpwd.sql
|
|
|
|
psql -f /tmp/seeddms-adminpwd.sql seeddms seeddms
|
|
|
|
unset PGPASSWORD
|
2017-10-07 13:25:30 +02:00
|
|
|
rm -f /tmp/seeddms-adminpwd.sql
|
2017-06-30 18:17:07 +02:00
|
|
|
|
2017-09-10 22:49:39 +02:00
|
|
|
# Create OS user
|
|
|
|
adduser --system --group --home /srv/seeddms --shell /bin/false seeddms
|
2017-10-13 09:31:19 +02:00
|
|
|
chown -R seeddms:www-data /srv/seeddms/
|
2017-06-29 21:12:51 +02:00
|
|
|
|
2017-09-10 22:49:39 +02:00
|
|
|
# Create PHP and nginx app definition
|
|
|
|
cp ${SOURCE_DIR}/seeddms/etc/php/7.0/fpm/pool.d/seeddms.conf /etc/php/7.0/fpm/pool.d/seeddms.conf
|
2017-06-29 21:12:51 +02:00
|
|
|
cp ${SOURCE_DIR}/seeddms/etc/nginx/apps-available/seeddms /etc/nginx/apps-available/seeddms
|
|
|
|
ln -s /etc/nginx/apps-available/seeddms /etc/nginx/apps-enabled/seeddms
|
|
|
|
|
|
|
|
# Restart services
|
2017-09-10 22:49:39 +02:00
|
|
|
systemctl restart php7.0-fpm
|
2017-06-29 21:12:51 +02:00
|
|
|
systemctl restart nginx
|
|
|
|
|
2017-10-07 23:09:08 +02:00
|
|
|
# Install cron job
|
|
|
|
cp ${SOURCE_DIR}/seeddms/etc/cron.d/seeddms /etc/cron.d/seeddms
|
|
|
|
|
2017-09-14 21:56:09 +02:00
|
|
|
# Add portal application definition
|
2017-09-18 11:20:56 +02:00
|
|
|
${SOURCE_DIR}/basic/portal-app-manager.py seeddms "/seeddms/" "${SEEDDMS_ADMIN_USER}" "${SEEDDMS_ADMIN_PWD}"
|