-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #65 from DocCyblade/development
Turnkey Mayan-EDMS v14.2 - Ready
- Loading branch information
Showing
26 changed files
with
634 additions
and
3 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
WEBMIN_FW_TCP_INCOMING = 22 80 443 12320 12321 12322 | ||
|
||
CREDIT_ANCHORTEXT = Turnkey Mayan EDMS Appliance | ||
|
||
COMMON_OVERLAYS += adminer nginx | ||
COMMON_CONF += adminer-pgsql | ||
|
||
|
||
# Include the PostgreSQL/PHP make file | ||
include $(FAB_PATH)/common/mk/turnkey/pgsql.mk | ||
include $(FAB_PATH)/common/mk/turnkey.mk | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
turnkey-mayan-edms-14.2 (1) turnkey; urgency=low | ||
|
||
* Initial release of appliance: | ||
- Mayan EDMS v2.2 | ||
- includes PostgreSQL for database backend | ||
- includes Nginx for web front end | ||
- upstream source install (PyPI) | ||
|
||
* Based on the work of community member Ken Robinson (@DocCyblade) | ||
Build source: https://github.com/DocCyblade/tkl-mayan-edms | ||
|
||
* Note: Please refer to turnkey-core's changelog for changes common to all | ||
appliances. | ||
|
||
-- Ken Robinson <[email protected]> Mon, 08 May 2017 23:54:00 -0400 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
#!/bin/bash -ex | ||
|
||
# Demo files download function | ||
# dl [URL] [TARGET DIR] [TARGET FILE NAME] | ||
# | ||
dl() { | ||
[ "$FAB_HTTP_PROXY" ] && PROXY="--proxy $FAB_HTTP_PROXY" | ||
cd $2; curl -L -f $PROXY $1 -o $3; cd - | ||
} | ||
|
||
# Use FAB proxy with PIP | ||
# fab-pip-install [package] | ||
fab-pip-install() { | ||
[ "$FAB_HTTP_PROXY" ] && PROXY="--proxy $FAB_HTTP_PROXY" | ||
pip $PROXY install $1 | ||
} | ||
|
||
# Use FAB proxy with PIP Upgrade | ||
# fab-pip-upgrade [package] | ||
fab-pip-upgrade() { | ||
[ "$FAB_HTTP_PROXY" ] && PROXY="--proxy $FAB_HTTP_PROXY" | ||
pip $PROXY install -U $1 | ||
} | ||
|
||
# Set variables | ||
# | ||
DB_NAME=mayan | ||
DB_USER=mayan | ||
DB_PASS=$(mcookie) | ||
|
||
|
||
APP_SETTINGS=/usr/share/mayan-edms/mayan/settings/local.py | ||
APP_SETTINGS_TEMPLATE=/usr/share/mayan-edms/mayan/settings/settings.template | ||
APP_SETTINGS_DATA_DIR=/usr/share/mayan-edms/mayan/media/document_storage | ||
|
||
# Create application directory (virtualenv) | ||
cd /usr/share | ||
virtualenv mayan-edms | ||
|
||
# Activate the environment | ||
source /usr/share/mayan-edms/bin/activate | ||
|
||
# Upgrade PIP within the virtualenv | ||
fab-pip-upgrade pip | ||
|
||
# Install Mayan EDMS from PyPI | ||
fab-pip-install mayan-edms | ||
|
||
# Install Python client for PostgreSQL | ||
fab-pip-install psycopg2 | ||
|
||
# Install Python client for Redis key-value store | ||
fab-pip-install redis | ||
|
||
# Install Python uWSGI server | ||
fab-pip-install uwsgi | ||
|
||
|
||
# Start postgresql server | ||
/etc/init.d/postgresql start | ||
|
||
# Create the database user and database for the installation | ||
su postgres -c "createuser $DB_USER" | ||
su postgres -c "createdb -O $DB_USER $DB_NAME" | ||
su postgres -c "psql postgres" << EOF | ||
alter user $DB_USER with encrypted password '$DB_PASS'; | ||
EOF | ||
|
||
|
||
# Create log file directory for mayan and uwsgi | ||
mkdir /var/log/mayan | ||
mkdir /var/log/uwsgi | ||
|
||
# Make a convenience symbolic link | ||
cd /usr/share/mayan-edms | ||
ln -s lib/python2.7/site-packages/mayan . | ||
|
||
# Make doc store | ||
mkdir -p $APP_SETTINGS_DATA_DIR | ||
|
||
# Create an initial settings file and db.template | ||
# We will recreate this on first boot, but create it | ||
# here for testing builds. | ||
mayan-edms.py createsettings -v 3 | ||
|
||
cat << EOF > $APP_SETTINGS_TEMPLATE | ||
DEBUG = False | ||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.postgresql_psycopg2', | ||
'NAME': '$DB_NAME', | ||
'USER': '$DB_USER', | ||
'PASSWORD': '$DB_PASS', | ||
'HOST': 'localhost', | ||
'PORT': '5432', | ||
} | ||
} | ||
BROKER_URL = 'redis://127.0.0.1:6379/0' | ||
CELERY_RESULT_BACKEND = 'redis://127.0.0.1:6379/0' | ||
EMAIL_HOST = 'localhost' | ||
EMAIL_PORT = 25 | ||
EOF | ||
|
||
|
||
|
||
# Create initial settings | ||
mayan-edms.py createsettings | ||
|
||
# Apply the settings template | ||
cat $APP_SETTINGS_TEMPLATE >> $APP_SETTINGS | ||
|
||
|
||
# Init Mayan Database | ||
mayan-edms.py initialsetup | ||
|
||
|
||
# Disable the default NGINX site | ||
rm /etc/nginx/sites-enabled/default | ||
|
||
# Enable the NGINX site for Mayan EDMS | ||
ln -s /etc/nginx/sites-available/mayan /etc/nginx/sites-enabled/ | ||
|
||
# Collect static files | ||
mayan-edms.py collectstatic --noinput | ||
|
||
|
||
# Make the installation and directory readable and writable by the webserver user | ||
chown www-data:www-data /usr/share/mayan-edms -R | ||
|
||
# Stop postgresql server | ||
/etc/init.d/postgresql stop | ||
|
||
|
||
# Link Nginx Adminer conifg | ||
ln -s /etc/nginx/sites-available/adminer /etc/nginx/sites-enabled/adminer | ||
|
||
# Configure fastcgi for Adminer via Nginx (php-fastcgi) | ||
update-rc.d php-fastcgi defaults |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Mayan EDMS: https://$ipaddr | ||
Web shell: https://$ipaddr:12320 | ||
Webmin: https://$ipaddr:12321 | ||
Adminer: https://$ipaddr:12322 | ||
SSH/SFTP: root@$ipaddr (port 22) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
SOCKETDIR=/var/run/nginx | ||
mkdir -p $SOCKETDIR | ||
chown root:www-data $SOCKETDIR | ||
chmod 770 $SOCKETDIR | ||
|
||
START=yes | ||
EXEC_AS_USER=www-data:www-data | ||
PHP_FCGI_SOCKET=$SOCKETDIR/$NAME.sock | ||
PHP_FCGI_CHILDREN=2 | ||
PHP_FCGI_MAX_REQUESTS=1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
#! /bin/sh | ||
### BEGIN INIT INFO | ||
# Provides: php-fastcgi | ||
# Required-Start: $all | ||
# Required-Stop: $all | ||
# Default-Start: 2 3 4 5 | ||
# Default-Stop: 0 1 6 | ||
# Short-Description: Start and stop php-cgi in external FASTCGI mode | ||
# Description: Start and stop php-cgi in external FASTCGI mode | ||
### END INIT INFO | ||
|
||
# Author: Kurt Zankl <[email protected]> | ||
|
||
# Do NOT "set -e" | ||
|
||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | ||
NAME=php-fastcgi | ||
DESC="php-cgi in external FASTCGI mode" | ||
DAEMON=/usr/bin/php-cgi | ||
PIDFILE=/var/run/$NAME.pid | ||
SCRIPTNAME=/etc/init.d/$NAME | ||
|
||
# Exit if the package is not installed | ||
[ -x "$DAEMON" ] || exit 0 | ||
|
||
# Read configuration variable file if it is present | ||
[ -r /etc/default/$NAME ] && . /etc/default/$NAME | ||
|
||
# Load the VERBOSE setting and other rcS variables | ||
. /lib/init/vars.sh | ||
|
||
# Define LSB log_* functions. | ||
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present. | ||
. /lib/lsb/init-functions | ||
|
||
# If the daemon is not enabled, give the user a warning and then exit, | ||
# unless we are stopping the daemon | ||
if [ "$START" != "yes" -a "$1" != "stop" ]; then | ||
log_warning_msg "To enable $NAME, edit /etc/default/$NAME and set START=yes" | ||
exit 0 | ||
fi | ||
|
||
# Process configuration | ||
export PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS | ||
DAEMON_ARGS="-q -b $PHP_FCGI_SOCKET" | ||
|
||
|
||
|
||
do_start() | ||
{ | ||
# Return | ||
# 0 if daemon has been started | ||
# 1 if daemon was already running | ||
# 2 if daemon could not be started | ||
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ | ||
|| return 1 | ||
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \ | ||
--background --make-pidfile --chuid $EXEC_AS_USER --startas $DAEMON -- \ | ||
$DAEMON_ARGS \ | ||
|| return 2 | ||
} | ||
|
||
do_stop() | ||
{ | ||
# Return | ||
# 0 if daemon has been stopped | ||
# 1 if daemon was already stopped | ||
# 2 if daemon could not be stopped | ||
# other if a failure occurred | ||
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE > /dev/null # --name $DAEMON | ||
RETVAL="$?" | ||
[ "$RETVAL" = 2 ] && return 2 | ||
# Wait for children to finish too if this is a daemon that forks | ||
# and if the daemon is only ever run from this initscript. | ||
# If the above conditions are not satisfied then add some other code | ||
# that waits for the process to drop all resources that could be | ||
# needed by services started subsequently. A last resort is to | ||
# sleep for some time. | ||
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON | ||
[ "$?" = 2 ] && return 2 | ||
# Many daemons don't delete their pidfiles when they exit. | ||
rm -f $PIDFILE | ||
return "$RETVAL" | ||
} | ||
|
||
case "$1" in | ||
start) | ||
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" | ||
do_start | ||
case "$?" in | ||
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; | ||
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; | ||
esac | ||
;; | ||
stop) | ||
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" | ||
do_stop | ||
case "$?" in | ||
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; | ||
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; | ||
esac | ||
;; | ||
restart|force-reload) | ||
log_daemon_msg "Restarting $DESC" "$NAME" | ||
do_stop | ||
case "$?" in | ||
0|1) | ||
do_start | ||
case "$?" in | ||
0) log_end_msg 0 ;; | ||
1) log_end_msg 1 ;; # Old process is still running | ||
*) log_end_msg 1 ;; # Failed to start | ||
esac | ||
;; | ||
*) | ||
# Failed to stop | ||
log_end_msg 1 | ||
;; | ||
esac | ||
;; | ||
*) | ||
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 | ||
exit 3 | ||
;; | ||
esac | ||
|
||
# The colon at the end makes sure that the script returns the correct return value of log_end_msg | ||
# using systemd with this script, it will fail without this colon! Keep it there! | ||
|
||
: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
|
||
fastcgi_param QUERY_STRING $query_string; | ||
fastcgi_param REQUEST_METHOD $request_method; | ||
fastcgi_param CONTENT_TYPE $content_type; | ||
fastcgi_param CONTENT_LENGTH $content_length; | ||
|
||
fastcgi_param SCRIPT_NAME $fastcgi_script_name; | ||
fastcgi_param REQUEST_URI $request_uri; | ||
fastcgi_param DOCUMENT_URI $document_uri; | ||
fastcgi_param DOCUMENT_ROOT $document_root; | ||
fastcgi_param SERVER_PROTOCOL $server_protocol; | ||
|
||
fastcgi_param GATEWAY_INTERFACE CGI/1.1; | ||
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; | ||
|
||
fastcgi_param REMOTE_ADDR $remote_addr; | ||
fastcgi_param REMOTE_PORT $remote_port; | ||
fastcgi_param SERVER_ADDR $server_addr; | ||
fastcgi_param SERVER_PORT $server_port; | ||
fastcgi_param SERVER_NAME $server_name; | ||
|
||
fastcgi_param HTTP_PROXY ""; | ||
|
||
# PHP only, required if PHP was built with --enable-force-cgi-redirect | ||
fastcgi_param REDIRECT_STATUS 200; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
include /etc/nginx/fastcgi_params; | ||
|
||
location ~ \.php$ { | ||
# http://forum.nginx.org/read.php?2,88845,page=3 | ||
try_files $uri =404; | ||
|
||
fastcgi_pass unix:/var/run/nginx/php-fastcgi.sock; | ||
fastcgi_index index.php; | ||
} |
Oops, something went wrong.