first commit

commit 70f0fa733c
Signed by: Llewellyn
GPG Key ID: A9201372263741E7
  1. 12
      .editorconfig
  2. 3
      .gitignore
  3. 185
      9.3/php7.4/apache/Dockerfile
  4. 90
      9.3/php7.4/apache/conf/config.inc.php
  5. 133
      9.3/php7.4/apache/conf/docker-entrypoint.sh
  6. 1
      9.3/php7.4/apache/conf/htaccess.txt
  7. 168
      9.3/php7.4/fpm/Dockerfile
  8. 90
      9.3/php7.4/fpm/conf/config.inc.php
  9. 133
      9.3/php7.4/fpm/conf/docker-entrypoint.sh
  10. 1
      9.3/php7.4/fpm/conf/htaccess.txt
  11. 185
      9.3/php8.0/apache/Dockerfile
  12. 90
      9.3/php8.0/apache/conf/config.inc.php
  13. 133
      9.3/php8.0/apache/conf/docker-entrypoint.sh
  14. 1
      9.3/php8.0/apache/conf/htaccess.txt
  15. 168
      9.3/php8.0/fpm/Dockerfile
  16. 90
      9.3/php8.0/fpm/conf/config.inc.php
  17. 133
      9.3/php8.0/fpm/conf/docker-entrypoint.sh
  18. 1
      9.3/php8.0/fpm/conf/htaccess.txt
  19. 260
      Dockerfile.template
  20. 339
      LICENSE
  21. 120
      README.md
  22. 95
      apply-templates.sh
  23. 90
      conf/config.inc.php
  24. 1
      conf/htaccess.txt
  25. 133
      docker-entrypoint.sh
  26. 8
      maintainers.json
  27. 14
      maintainers_hopes.json
  28. 7
      update.sh
  29. 28
      versions-helper.json
  30. 21
      versions.json
  31. 111
      versions.sh

@ -0,0 +1,12 @@
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
[*]
indent_style = tab
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

3
.gitignore vendored

@ -0,0 +1,3 @@
.jq-template.awk
.idea
.versions-helper.json

@ -0,0 +1,185 @@
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
#
# PLEASE DO NOT EDIT IT DIRECTLY.
#
FROM php:7.4-apache
LABEL maintainer="Llewellyn van der Merwe <Llewellynvdm@users.noreply.github.com> (@Llewellynvdm)"
# Disable remote database security requirements.
ENV ROSARIOSIS_INSTALLATION_DISABLE_LOCALHOST_CHECK=1
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
# Ghostscript is required for rendering PDF previews
ghostscript \
# To be able to send mail
sendmail \
nano \
locales \
; \
rm -rf /var/lib/apt/lists/*
# install the PHP extensions we need.
RUN set -ex; \
\
savedAptMark="$(apt-mark showmanual)"; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
libbz2-dev \
libxml2-dev \
libgmp-dev \
libicu-dev \
libfreetype6-dev \
libjpeg-dev \
libldap2-dev \
libmemcached-dev \
libmagickwand-dev \
wkhtmltopdf \
libpq-dev \
libpng-dev \
libwebp-dev \
libzip-dev \
libonig-dev \
postgresql-client \
; \
\
docker-php-ext-configure gd \
--with-freetype \
--with-jpeg \
--with-webp \
; \
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
docker-php-ext-configure ldap --with-libdir="lib/$debMultiarch"; \
docker-php-ext-install -j "$(nproc)" \
bz2 \
bcmath \
exif \
gd \
mbstring \
xml \
xmlrpc \
gmp \
intl \
ldap \
mysqli \
pdo_mysql \
pdo_pgsql \
pgsql \
gettext \
zip \
; \
# https://pecl.php.net/package/imagick
pecl install imagick-3.6.0; \
docker-php-ext-enable imagick; \
rm -r /tmp/pear; \
\
# some misbehaving extensions end up outputting to stdout
out="$(php -r 'exit(0);')"; \
[ -z "$out" ]; \
err="$(php -r 'exit(0);' 3>&1 1>&2 2>&3)"; \
[ -z "$err" ]; \
\
extDir="$(php -r 'echo ini_get("extension_dir");')"; \
[ -d "$extDir" ]; \
# pecl will claim success even if one install fails, so we need to perform each install separately
pecl install APCu-5.1.21; \
pecl install memcached-3.2.0; \
pecl install redis-5.3.7; \
\
docker-php-ext-enable \
apcu \
memcached \
redis \
; \
rm -r /tmp/pear; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark; \
ldd "$extDir"/*.so \
| awk '/=>/ { print $3 }' \
| sort -u \
| xargs -r dpkg-query -S \
| cut -d: -f1 \
| sort -u \
| xargs -rt apt-mark manual; \
\
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf /var/lib/apt/lists/*; \
\
! { ldd "$extDir"/*.so | grep 'not found'; }; \
# check for output like "PHP Warning: PHP Startup: Unable to load dynamic library 'foo' (tried: ...)
err="$(php --version 3>&1 1>&2 2>&3)"; \
[ -z "$err" ]
# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN set -eux; \
docker-php-ext-enable opcache; \
{ \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=2'; \
echo 'opcache.fast_shutdown=1'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini
# set recommended error logging
RUN { \
# https://www.php.net/manual/en/errorfunc.constants.php
echo 'error_reporting = E_ERROR | E_WARNING | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_RECOVERABLE_ERROR'; \
echo 'display_errors = Off'; \
echo 'display_startup_errors = Off'; \
echo 'log_errors = On'; \
echo 'error_log = /dev/stderr'; \
echo 'log_errors_max_len = 1024'; \
echo 'ignore_repeated_errors = On'; \
echo 'ignore_repeated_source = Off'; \
echo 'html_errors = Off'; \
} > /usr/local/etc/php/conf.d/error-logging.ini
RUN set -eux; \
a2enmod rewrite expires; \
\
# https://httpd.apache.org/docs/2.4/mod/mod_remoteip.html
a2enmod remoteip; \
{ \
echo 'RemoteIPHeader X-Forwarded-For'; \
# these IP ranges are reserved for "private" use and should thus *usually* be safe inside Docker
echo 'RemoteIPTrustedProxy 10.0.0.0/8'; \
echo 'RemoteIPTrustedProxy 172.16.0.0/12'; \
echo 'RemoteIPTrustedProxy 192.168.0.0/16'; \
echo 'RemoteIPTrustedProxy 169.254.0.0/16'; \
echo 'RemoteIPTrustedProxy 127.0.0.0/8'; \
} > /etc/apache2/conf-available/remoteip.conf; \
a2enconf remoteip; \
# (replace all instances of "%h" with "%a" in LogFormat)
find /etc/apache2 -type f -name '*.conf' -exec sed -ri 's/([[:space:]]*LogFormat[[:space:]]+"[^"]*)%h([^"]*")/\1%a\2/g' '{}' +
VOLUME /var/www/html
# Define Rosariosis version and expected SHA512 signature
ENV ROSARIOSIS_VERSION 9.3
ENV ROSARIOSIS_SHA512 1e786b5edf9ea6075357c1b7148f00f47e8171b112bc023a11a6e37a88560873a30d128f66a1d1c81af2f7bfbdb3ce3b425ded83a9ddbdfd380367122d8d22cf
# Download package and extract to web volume
RUN set -ex; \
curl -o rosariosis.tar.bz2 -SL https://gitlab.com/francoisjacquet/rosariosis/-/archive/v9.3/rosariosis-v9.3.tar.bz2; \
echo "$ROSARIOSIS_SHA512 *rosariosis.tar.bz2" | sha512sum -c -; \
mkdir -p /usr/src/rosariosis; \
tar -xf rosariosis.tar.bz2 --strip-components=1 -C /usr/src/rosariosis; \
rm rosariosis.tar.bz2; \
chown -R www-data:www-data /usr/src/rosariosis
# Copy init scripts
COPY conf/docker-entrypoint.sh /entrypoint.sh
# Copy our configuration files.
COPY conf/config.inc.php /usr/src/rosariosis/config.inc.php
COPY conf/htaccess.txt /usr/src/rosariosis/.htaccess
ENTRYPOINT ["/entrypoint.sh"]
CMD ["apache2-foreground"]

@ -0,0 +1,90 @@
<?php
/**
* The base configurations of RosarioSIS
*
* You can find more information in the INSTALL.md file
*
* @package RosarioSIS
*/
/**
* PostgreSQL Database Settings
*
* You can get this info from your web host
*/
// Database server hostname: use localhost if on same server.
$DatabaseServer = getenv( 'POSTGRES_HOST' );
// Database username.
$DatabaseUsername = getenv( 'POSTGRES_USER' );
// Database password.
$DatabasePassword = getenv( 'POSTGRES_PASSWORD' );;
// Database name.
$DatabaseName = getenv( 'POSTGRES_DB' );;
// Database port: default is 5432.
$DatabasePort = getenv( 'POSTGRES_PORT' );
/**
* Paths
*/
/**
* Full path to the PostrgeSQL database dump utility for this server
*
* @example /usr/bin/pg_dump
* @example C:/Progra~1/PostgreSQL/bin/pg_dump.exe
*/
$pg_dumpPath = '/usr/bin/pg_dump';
/**
* Full path to wkhtmltopdf binary file
*
* An empty string means wkhtmltopdf will not be called
* and reports will be rendered in HTML instead of PDF
*
* @link http://wkhtmltopdf.org
*
* @example /usr/local/bin/wkhtmltopdf
* @example C:/Progra~1/wkhtmltopdf/bin/wkhtmltopdf.exe
*/
$wkhtmltopdfPath = '/usr/bin/wkhtmltopdf';
/**
* Default school year
*
* Do not change on install
* Change after rollover
* Should match the database to be able to login
*/
$DefaultSyear = getenv( 'ROSARIOSIS_YEAR' );
/**
* Notify email address
* where to send error and new administrator notifications
*
* Leave empty to not receive email notifications
*/
$RosarioNotifyAddress = getenv( 'ROSARIOSIS_ADMIN_EMAIL' );
$RosarioErrorsAddress = getenv( 'ROSARIOSIS_ADMIN_EMAIL' );
/**
* Locales
*
* Add other languages you want to support here
*
* @see locale/ folder
*
* For American, French and Spanish:
*
* @example array( 'en_US.utf8', 'fr_FR.utf8', 'es_ES.utf8' );
*/
$RosarioLocales = array( getenv( 'ROSARIOSIS_LANG' ).'.utf8' );

@ -0,0 +1,133 @@
#!/bin/bash
set -e
if [ -n "$POSTGRES_PASSWORD_FILE" ] && [ -f "$POSTGRES_PASSWORD_FILE" ]; then
POSTGRES_PASSWORD=$(cat "$POSTGRES_PASSWORD_FILE")
fi
if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
uid="$(id -u)"
gid="$(id -g)"
if [ "$uid" = '0' ]; then
case "$1" in
apache2*)
user="${APACHE_RUN_USER:-www-data}"
group="${APACHE_RUN_GROUP:-www-data}"
# strip off any '#' symbol ('#1000' is valid syntax for Apache)
pound='#'
user="${user#$pound}"
group="${group#$pound}"
# set user if not exist
if ! id "$user" &>/dev/null; then
# get the user name
: "${USER_NAME:=www-data}"
# change the user name
[[ "$USER_NAME" != "www-data" ]] &&
usermod -l "$USER_NAME" www-data &&
groupmod -n "$USER_NAME" www-data
# update the user ID
groupmod -o -g "$user" "$USER_NAME"
# update the user-group ID
usermod -o -u "$group" "$USER_NAME"
fi
;;
*) # php-fpm
user='www-data'
group='www-data'
;;
esac
else
user="$uid"
group="$gid"
fi
if [ -n "$POSTGRES_PORT" ]; then
if [ -z "$POSTGRES_HOST" ]; then
POSTGRES_HOST='postgres'
else
echo >&2 "warning: both POSTGRES_HOST and POSTGRES_PORT found"
echo >&2 " Connecting to POSTGRES_HOST ($POSTGRES_HOST)"
echo >&2 " instead of the linked postgres container"
fi
fi
if [ -z "$POSTGRES_HOST" ]; then
echo >&2 "error: missing POSTGRES_HOST and POSTGRES_PORT environment variables"
echo >&2 " Did you forget to --link some_postgres_container:postgres or set an external db"
echo >&2 " with -e POSTGRES_HOST=hostname:port?"
exit 1
fi
# If the DB user is 'root' then use the MySQL root password env var
: "${POSTGRES_USER:=root}"
if [ "$POSTGRES_USER" = 'root' ]; then
: ${POSTGRES_PASSWORD:=$POSTGRES_ROOT_PASSWORD}
fi
: "${POSTGRES_DB:=rosariosis}"
if [ -z "$POSTGRES_PASSWORD" ] && [ "$POSTGRES_PASSWORD_ALLOW_EMPTY" != 'yes' ]; then
echo >&2 "error: missing required POSTGRES_PASSWORD environment variable"
echo >&2 " Did you forget to -e POSTGRES_PASSWORD=... ?"
echo >&2
echo >&2 " (Also of interest might be POSTGRES_USER and POSTGRES_DB.)"
exit 1
fi
if [ ! -e index.php ]; then
# if the directory exists and Rosariosis doesn't appear to be installed AND the permissions of it are root:root, let's chown it (likely a Docker-created directory)
if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' .)" = '0:0' ]; then
chown "$user:$group" .
fi
echo >&2 "Rosariosis not found in $PWD - copying now..."
if [ "$(ls -A)" ]; then
echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!"
(
set -x
ls -A
sleep 10
)
fi
# use full commands
# for clearer intent
sourceTarArgs=(
--create
--file -
--directory /usr/src/rosariosis
--one-file-system
--owner "$user" --group "$group"
)
targetTarArgs=(
--extract
--file -
)
if [ "$uid" != '0' ]; then
# avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted"
targetTarArgs+=(--no-overwrite-dir)
fi
tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}"
if [ ! -e .htaccess ] && [ -f htaccess.txt ]; then
# NOTE: The "Indexes" option is disabled in the php:apache base image so remove it as we enable .htaccess
sed -r 's/^(Options -Indexes.*)$/#\1/' htaccess.txt >.htaccess
chown "$user":"$group" .htaccess
fi
echo >&2 "Complete! Rosariosis has been successfully copied to $PWD"
fi
echo >&2 "========================================================================"
echo >&2
echo >&2 "This server is now configured to run Rosariosis!"
echo >&2
echo >&2 "NOTE: You will need your database server address, database name,"
echo >&2 "and database user credentials to install Rosariosis."
echo >&2
echo >&2 "========================================================================"
fi
exec "$@"

@ -0,0 +1 @@
php_flag display_errors off

@ -0,0 +1,168 @@
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
#
# PLEASE DO NOT EDIT IT DIRECTLY.
#
FROM php:7.4-fpm
LABEL maintainer="Llewellyn van der Merwe <Llewellynvdm@users.noreply.github.com> (@Llewellynvdm)"
# Disable remote database security requirements.
ENV ROSARIOSIS_INSTALLATION_DISABLE_LOCALHOST_CHECK=1
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
# Ghostscript is required for rendering PDF previews
ghostscript \
# To be able to send mail
sendmail \
nano \
locales \
; \
rm -rf /var/lib/apt/lists/*
# install the PHP extensions we need.
RUN set -ex; \
\
savedAptMark="$(apt-mark showmanual)"; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
libbz2-dev \
libxml2-dev \
libgmp-dev \
libicu-dev \
libfreetype6-dev \
libjpeg-dev \
libldap2-dev \
libmemcached-dev \
libmagickwand-dev \
wkhtmltopdf \
libpq-dev \
libpng-dev \
libwebp-dev \
libzip-dev \
libonig-dev \
postgresql-client \
; \
\
docker-php-ext-configure gd \
--with-freetype \
--with-jpeg \
--with-webp \
; \
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
docker-php-ext-configure ldap --with-libdir="lib/$debMultiarch"; \
docker-php-ext-install -j "$(nproc)" \
bz2 \
bcmath \
exif \
gd \
mbstring \
xml \
xmlrpc \
gmp \
intl \
ldap \
mysqli \
pdo_mysql \
pdo_pgsql \
pgsql \
gettext \
zip \
; \
# https://pecl.php.net/package/imagick
pecl install imagick-3.6.0; \
docker-php-ext-enable imagick; \
rm -r /tmp/pear; \
\
# some misbehaving extensions end up outputting to stdout
out="$(php -r 'exit(0);')"; \
[ -z "$out" ]; \
err="$(php -r 'exit(0);' 3>&1 1>&2 2>&3)"; \
[ -z "$err" ]; \
\
extDir="$(php -r 'echo ini_get("extension_dir");')"; \
[ -d "$extDir" ]; \
# pecl will claim success even if one install fails, so we need to perform each install separately
pecl install APCu-5.1.21; \
pecl install memcached-3.2.0; \
pecl install redis-5.3.7; \
\
docker-php-ext-enable \
apcu \
memcached \
redis \
; \
rm -r /tmp/pear; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark; \
ldd "$extDir"/*.so \
| awk '/=>/ { print $3 }' \
| sort -u \
| xargs -r dpkg-query -S \
| cut -d: -f1 \
| sort -u \
| xargs -rt apt-mark manual; \
\
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf /var/lib/apt/lists/*; \
\
! { ldd "$extDir"/*.so | grep 'not found'; }; \
# check for output like "PHP Warning: PHP Startup: Unable to load dynamic library 'foo' (tried: ...)
err="$(php --version 3>&1 1>&2 2>&3)"; \
[ -z "$err" ]
# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN set -eux; \
docker-php-ext-enable opcache; \
{ \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=2'; \
echo 'opcache.fast_shutdown=1'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini
# set recommended error logging
RUN { \
# https://www.php.net/manual/en/errorfunc.constants.php
echo 'error_reporting = E_ERROR | E_WARNING | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_RECOVERABLE_ERROR'; \
echo 'display_errors = Off'; \
echo 'display_startup_errors = Off'; \
echo 'log_errors = On'; \
echo 'error_log = /dev/stderr'; \
echo 'log_errors_max_len = 1024'; \
echo 'ignore_repeated_errors = On'; \
echo 'ignore_repeated_source = Off'; \
echo 'html_errors = Off'; \
} > /usr/local/etc/php/conf.d/error-logging.ini
VOLUME /var/www/html
# Define Rosariosis version and expected SHA512 signature
ENV ROSARIOSIS_VERSION 9.3
ENV ROSARIOSIS_SHA512 1e786b5edf9ea6075357c1b7148f00f47e8171b112bc023a11a6e37a88560873a30d128f66a1d1c81af2f7bfbdb3ce3b425ded83a9ddbdfd380367122d8d22cf
# Download package and extract to web volume
RUN set -ex; \
curl -o rosariosis.tar.bz2 -SL https://gitlab.com/francoisjacquet/rosariosis/-/archive/v9.3/rosariosis-v9.3.tar.bz2; \
echo "$ROSARIOSIS_SHA512 *rosariosis.tar.bz2" | sha512sum -c -; \
mkdir -p /usr/src/rosariosis; \
tar -xf rosariosis.tar.bz2 --strip-components=1 -C /usr/src/rosariosis; \
rm rosariosis.tar.bz2; \
chown -R www-data:www-data /usr/src/rosariosis
# Copy init scripts
COPY conf/docker-entrypoint.sh /entrypoint.sh
# Copy our configuration files.
COPY conf/config.inc.php /usr/src/rosariosis/config.inc.php
COPY conf/htaccess.txt /usr/src/rosariosis/.htaccess
ENTRYPOINT ["/entrypoint.sh"]
CMD ["php-fpm"]

@ -0,0 +1,90 @@
<?php
/**
* The base configurations of RosarioSIS
*
* You can find more information in the INSTALL.md file
*
* @package RosarioSIS
*/
/**
* PostgreSQL Database Settings
*
* You can get this info from your web host
*/
// Database server hostname: use localhost if on same server.
$DatabaseServer = getenv( 'POSTGRES_HOST' );
// Database username.
$DatabaseUsername = getenv( 'POSTGRES_USER' );
// Database password.
$DatabasePassword = getenv( 'POSTGRES_PASSWORD' );;
// Database name.
$DatabaseName = getenv( 'POSTGRES_DB' );;
// Database port: default is 5432.
$DatabasePort = getenv( 'POSTGRES_PORT' );
/**
* Paths
*/
/**
* Full path to the PostrgeSQL database dump utility for this server
*
* @example /usr/bin/pg_dump
* @example C:/Progra~1/PostgreSQL/bin/pg_dump.exe
*/
$pg_dumpPath = '/usr/bin/pg_dump';
/**
* Full path to wkhtmltopdf binary file
*
* An empty string means wkhtmltopdf will not be called
* and reports will be rendered in HTML instead of PDF
*
* @link http://wkhtmltopdf.org
*
* @example /usr/local/bin/wkhtmltopdf
* @example C:/Progra~1/wkhtmltopdf/bin/wkhtmltopdf.exe
*/
$wkhtmltopdfPath = '/usr/bin/wkhtmltopdf';
/**
* Default school year
*
* Do not change on install
* Change after rollover
* Should match the database to be able to login
*/
$DefaultSyear = getenv( 'ROSARIOSIS_YEAR' );
/**
* Notify email address
* where to send error and new administrator notifications
*
* Leave empty to not receive email notifications
*/
$RosarioNotifyAddress = getenv( 'ROSARIOSIS_ADMIN_EMAIL' );
$RosarioErrorsAddress = getenv( 'ROSARIOSIS_ADMIN_EMAIL' );
/**
* Locales
*
* Add other languages you want to support here
*
* @see locale/ folder
*
* For American, French and Spanish:
*
* @example array( 'en_US.utf8', 'fr_FR.utf8', 'es_ES.utf8' );
*/
$RosarioLocales = array( getenv( 'ROSARIOSIS_LANG' ).'.utf8' );

@ -0,0 +1,133 @@
#!/bin/bash
set -e
if [ -n "$POSTGRES_PASSWORD_FILE" ] && [ -f "$POSTGRES_PASSWORD_FILE" ]; then
POSTGRES_PASSWORD=$(cat "$POSTGRES_PASSWORD_FILE")
fi
if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
uid="$(id -u)"
gid="$(id -g)"
if [ "$uid" = '0' ]; then
case "$1" in
apache2*)
user="${APACHE_RUN_USER:-www-data}"
group="${APACHE_RUN_GROUP:-www-data}"
# strip off any '#' symbol ('#1000' is valid syntax for Apache)
pound='#'
user="${user#$pound}"
group="${group#$pound}"
# set user if not exist
if ! id "$user" &>/dev/null; then
# get the user name
: "${USER_NAME:=www-data}"
# change the user name
[[ "$USER_NAME" != "www-data" ]] &&
usermod -l "$USER_NAME" www-data &&
groupmod -n "$USER_NAME" www-data
# update the user ID
groupmod -o -g "$user" "$USER_NAME"
# update the user-group ID
usermod -o -u "$group" "$USER_NAME"
fi
;;
*) # php-fpm
user='www-data'
group='www-data'
;;
esac
else
user="$uid"
group="$gid"
fi
if [ -n "$POSTGRES_PORT" ]; then
if [ -z "$POSTGRES_HOST" ]; then
POSTGRES_HOST='postgres'
else
echo >&2 "warning: both POSTGRES_HOST and POSTGRES_PORT found"
echo >&2 " Connecting to POSTGRES_HOST ($POSTGRES_HOST)"
echo >&2 " instead of the linked postgres container"
fi
fi
if [ -z "$POSTGRES_HOST" ]; then
echo >&2 "error: missing POSTGRES_HOST and POSTGRES_PORT environment variables"
echo >&2 " Did you forget to --link some_postgres_container:postgres or set an external db"
echo >&2 " with -e POSTGRES_HOST=hostname:port?"
exit 1
fi
# If the DB user is 'root' then use the MySQL root password env var
: "${POSTGRES_USER:=root}"
if [ "$POSTGRES_USER" = 'root' ]; then
: ${POSTGRES_PASSWORD:=$POSTGRES_ROOT_PASSWORD}
fi
: "${POSTGRES_DB:=rosariosis}"
if [ -z "$POSTGRES_PASSWORD" ] && [ "$POSTGRES_PASSWORD_ALLOW_EMPTY" != 'yes' ]; then
echo >&2 "error: missing required POSTGRES_PASSWORD environment variable"
echo >&2 " Did you forget to -e POSTGRES_PASSWORD=... ?"
echo >&2
echo >&2 " (Also of interest might be POSTGRES_USER and POSTGRES_DB.)"
exit 1
fi
if [ ! -e index.php ]; then
# if the directory exists and Rosariosis doesn't appear to be installed AND the permissions of it are root:root, let's chown it (likely a Docker-created directory)
if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' .)" = '0:0' ]; then
chown "$user:$group" .
fi
echo >&2 "Rosariosis not found in $PWD - copying now..."
if [ "$(ls -A)" ]; then
echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!"
(
set -x
ls -A
sleep 10
)
fi
# use full commands
# for clearer intent
sourceTarArgs=(
--create
--file -
--directory /usr/src/rosariosis
--one-file-system
--owner "$user" --group "$group"
)
targetTarArgs=(
--extract
--file -
)
if [ "$uid" != '0' ]; then
# avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted"
targetTarArgs+=(--no-overwrite-dir)
fi
tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}"
if [ ! -e .htaccess ] && [ -f htaccess.txt ]; then
# NOTE: The "Indexes" option is disabled in the php:apache base image so remove it as we enable .htaccess
sed -r 's/^(Options -Indexes.*)$/#\1/' htaccess.txt >.htaccess
chown "$user":"$group" .htaccess
fi
echo >&2 "Complete! Rosariosis has been successfully copied to $PWD"
fi
echo >&2 "========================================================================"
echo >&2
echo >&2 "This server is now configured to run Rosariosis!"
echo >&2
echo >&2 "NOTE: You will need your database server address, database name,"
echo >&2 "and database user credentials to install Rosariosis."
echo >&2
echo >&2 "========================================================================"
fi
exec "$@"

@ -0,0 +1 @@
php_flag display_errors off

@ -0,0 +1,185 @@
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
#
# PLEASE DO NOT EDIT IT DIRECTLY.
#
FROM php:8.0-apache
LABEL maintainer="Llewellyn van der Merwe <Llewellynvdm@users.noreply.github.com> (@Llewellynvdm)"
# Disable remote database security requirements.
ENV ROSARIOSIS_INSTALLATION_DISABLE_LOCALHOST_CHECK=1
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
# Ghostscript is required for rendering PDF previews
ghostscript \
# To be able to send mail
sendmail \
nano \
locales \
; \
rm -rf /var/lib/apt/lists/*
# install the PHP extensions we need.
RUN set -ex; \
\
savedAptMark="$(apt-mark showmanual)"; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
libbz2-dev \
libxml2-dev \
libgmp-dev \
libicu-dev \
libfreetype6-dev \
libjpeg-dev \
libldap2-dev \
libmemcached-dev \
libmagickwand-dev \
wkhtmltopdf \
libpq-dev \
libpng-dev \
libwebp-dev \
libzip-dev \
libonig-dev \
postgresql-client \
; \
\
docker-php-ext-configure gd \
--with-freetype \
--with-jpeg \
--with-webp \
; \
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
docker-php-ext-configure ldap --with-libdir="lib/$debMultiarch"; \
docker-php-ext-install -j "$(nproc)" \
bz2 \
bcmath \
exif \
gd \
mbstring \
xml \
xmlrpc \
gmp \
intl \
ldap \
mysqli \
pdo_mysql \
pdo_pgsql \
pgsql \
gettext \
zip \
; \
# https://pecl.php.net/package/imagick
pecl install imagick-3.6.0; \
docker-php-ext-enable imagick; \
rm -r /tmp/pear; \
\
# some misbehaving extensions end up outputting to stdout
out="$(php -r 'exit(0);')"; \
[ -z "$out" ]; \
err="$(php -r 'exit(0);' 3>&1 1>&2 2>&3)"; \
[ -z "$err" ]; \
\
extDir="$(php -r 'echo ini_get("extension_dir");')"; \
[ -d "$extDir" ]; \
# pecl will claim success even if one install fails, so we need to perform each install separately
pecl install APCu-5.1.21; \
pecl install memcached-3.2.0; \
pecl install redis-5.3.7; \
\
docker-php-ext-enable \
apcu \
memcached \
redis \
; \
rm -r /tmp/pear; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark; \
ldd "$extDir"/*.so \
| awk '/=>/ { print $3 }' \
| sort -u \
| xargs -r dpkg-query -S \
| cut -d: -f1 \
| sort -u \
| xargs -rt apt-mark manual; \
\
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf /var/lib/apt/lists/*; \
\
! { ldd "$extDir"/*.so | grep 'not found'; }; \
# check for output like "PHP Warning: PHP Startup: Unable to load dynamic library 'foo' (tried: ...)
err="$(php --version 3>&1 1>&2 2>&3)"; \
[ -z "$err" ]
# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN set -eux; \
docker-php-ext-enable opcache; \
{ \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=2'; \
echo 'opcache.fast_shutdown=1'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini
# set recommended error logging
RUN { \
# https://www.php.net/manual/en/errorfunc.constants.php
echo 'error_reporting = E_ERROR | E_WARNING | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_RECOVERABLE_ERROR'; \
echo 'display_errors = Off'; \
echo 'display_startup_errors = Off'; \
echo 'log_errors = On'; \
echo 'error_log = /dev/stderr'; \
echo 'log_errors_max_len = 1024'; \
echo 'ignore_repeated_errors = On'; \
echo 'ignore_repeated_source = Off'; \
echo 'html_errors = Off'; \
} > /usr/local/etc/php/conf.d/error-logging.ini
RUN set -eux; \
a2enmod rewrite expires; \
\
# https://httpd.apache.org/docs/2.4/mod/mod_remoteip.html
a2enmod remoteip; \
{ \
echo 'RemoteIPHeader X-Forwarded-For'; \
# these IP ranges are reserved for "private" use and should thus *usually* be safe inside Docker
echo 'RemoteIPTrustedProxy 10.0.0.0/8'; \
echo 'RemoteIPTrustedProxy 172.16.0.0/12'; \
echo 'RemoteIPTrustedProxy 192.168.0.0/16'; \
echo 'RemoteIPTrustedProxy 169.254.0.0/16'; \
echo 'RemoteIPTrustedProxy 127.0.0.0/8'; \
} > /etc/apache2/conf-available/remoteip.conf; \
a2enconf remoteip; \
# (replace all instances of "%h" with "%a" in LogFormat)
find /etc/apache2 -type f -name '*.conf' -exec sed -ri 's/([[:space:]]*LogFormat[[:space:]]+"[^"]*)%h([^"]*")/\1%a\2/g' '{}' +
VOLUME /var/www/html
# Define Rosariosis version and expected SHA512 signature
ENV ROSARIOSIS_VERSION 9.3
ENV ROSARIOSIS_SHA512 1e786b5edf9ea6075357c1b7148f00f47e8171b112bc023a11a6e37a88560873a30d128f66a1d1c81af2f7bfbdb3ce3b425ded83a9ddbdfd380367122d8d22cf
# Download package and extract to web volume
RUN set -ex; \
curl -o rosariosis.tar.bz2 -SL https://gitlab.com/francoisjacquet/rosariosis/-/archive/v9.3/rosariosis-v9.3.tar.bz2; \
echo "$ROSARIOSIS_SHA512 *rosariosis.tar.bz2" | sha512sum -c -; \
mkdir -p /usr/src/rosariosis; \
tar -xf rosariosis.tar.bz2 --strip-components=1 -C /usr/src/rosariosis; \
rm rosariosis.tar.bz2; \
chown -R www-data:www-data /usr/src/rosariosis
# Copy init scripts
COPY conf/docker-entrypoint.sh /entrypoint.sh
# Copy our configuration files.
COPY conf/config.inc.php /usr/src/rosariosis/config.inc.php
COPY conf/htaccess.txt /usr/src/rosariosis/.htaccess
ENTRYPOINT ["/entrypoint.sh"]
CMD ["apache2-foreground"]

@ -0,0 +1,90 @@
<?php
/**
* The base configurations of RosarioSIS
*
* You can find more information in the INSTALL.md file
*
* @package RosarioSIS
*/
/**
* PostgreSQL Database Settings
*
* You can get this info from your web host
*/
// Database server hostname: use localhost if on same server.
$DatabaseServer = getenv( 'POSTGRES_HOST' );
// Database username.
$DatabaseUsername = getenv( 'POSTGRES_USER' );
// Database password.
$DatabasePassword = getenv( 'POSTGRES_PASSWORD' );;
// Database name.
$DatabaseName = getenv( 'POSTGRES_DB' );;
// Database port: default is 5432.
$DatabasePort = getenv( 'POSTGRES_PORT' );
/**
* Paths
*/
/**
* Full path to the PostrgeSQL database dump utility for this server
*
* @example /usr/bin/pg_dump
* @example C:/Progra~1/PostgreSQL/bin/pg_dump.exe
*/
$pg_dumpPath = '/usr/bin/pg_dump';
/**
* Full path to wkhtmltopdf binary file
*
* An empty string means wkhtmltopdf will not be called
* and reports will be rendered in HTML instead of PDF
*
* @link http://wkhtmltopdf.org
*
* @example /usr/local/bin/wkhtmltopdf
* @example C:/Progra~1/wkhtmltopdf/bin/wkhtmltopdf.exe
*/
$wkhtmltopdfPath = '/usr/bin/wkhtmltopdf';
/**
* Default school year
*
* Do not change on install
* Change after rollover
* Should match the database to be able to login
*/
$DefaultSyear = getenv( 'ROSARIOSIS_YEAR' );
/**
* Notify email address
* where to send error and new administrator notifications
*
* Leave empty to not receive email notifications
*/
$RosarioNotifyAddress = getenv( 'ROSARIOSIS_ADMIN_EMAIL' );
$RosarioErrorsAddress = getenv( 'ROSARIOSIS_ADMIN_EMAIL' );
/**
* Locales
*
* Add other languages you want to support here
*
* @see locale/ folder
*
* For American, French and Spanish:
*
* @example array( 'en_US.utf8', 'fr_FR.utf8', 'es_ES.utf8' );
*/
$RosarioLocales = array( getenv( 'ROSARIOSIS_LANG' ).'.utf8' );

@ -0,0 +1,133 @@
#!/bin/bash
set -e
if [ -n "$POSTGRES_PASSWORD_FILE" ] && [ -f "$POSTGRES_PASSWORD_FILE" ]; then
POSTGRES_PASSWORD=$(cat "$POSTGRES_PASSWORD_FILE")
fi
if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
uid="$(id -u)"
gid="$(id -g)"
if [ "$uid" = '0' ]; then
case "$1" in
apache2*)
user="${APACHE_RUN_USER:-www-data}"
group="${APACHE_RUN_GROUP:-www-data}"
# strip off any '#' symbol ('#1000' is valid syntax for Apache)
pound='#'
user="${user#$pound}"
group="${group#$pound}"
# set user if not exist
if ! id "$user" &>/dev/null; then
# get the user name
: "${USER_NAME:=www-data}"
# change the user name
[[ "$USER_NAME" != "www-data" ]] &&
usermod -l "$USER_NAME" www-data &&
groupmod -n "$USER_NAME" www-data
# update the user ID
groupmod -o -g "$user" "$USER_NAME"
# update the user-group ID
usermod -o -u "$group" "$USER_NAME"
fi
;;
*) # php-fpm
user='www-data'
group='www-data'
;;
esac
else
user="$uid"
group="$gid"
fi
if [ -n "$POSTGRES_PORT" ]; then
if [ -z "$POSTGRES_HOST" ]; then
POSTGRES_HOST='postgres'
else
echo >&2 "warning: both POSTGRES_HOST and POSTGRES_PORT found"
echo >&2 " Connecting to POSTGRES_HOST ($POSTGRES_HOST)"
echo >&2 " instead of the linked postgres container"
fi
fi
if [ -z "$POSTGRES_HOST" ]; then
echo >&2 "error: missing POSTGRES_HOST and POSTGRES_PORT environment variables"
echo >&2 " Did you forget to --link some_postgres_container:postgres or set an external db"
echo >&2 " with -e POSTGRES_HOST=hostname:port?"
exit 1
fi
# If the DB user is 'root' then use the MySQL root password env var
: "${POSTGRES_USER:=root}"
if [ "$POSTGRES_USER" = 'root' ]; then
: ${POSTGRES_PASSWORD:=$POSTGRES_ROOT_PASSWORD}
fi
: "${POSTGRES_DB:=rosariosis}"
if [ -z "$POSTGRES_PASSWORD" ] && [ "$POSTGRES_PASSWORD_ALLOW_EMPTY" != 'yes' ]; then
echo >&2 "error: missing required POSTGRES_PASSWORD environment variable"
echo >&2 " Did you forget to -e POSTGRES_PASSWORD=... ?"
echo >&2
echo >&2 " (Also of interest might be POSTGRES_USER and POSTGRES_DB.)"
exit 1
fi
if [ ! -e index.php ]; then
# if the directory exists and Rosariosis doesn't appear to be installed AND the permissions of it are root:root, let's chown it (likely a Docker-created directory)
if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' .)" = '0:0' ]; then
chown "$user:$group" .
fi
echo >&2 "Rosariosis not found in $PWD - copying now..."
if [ "$(ls -A)" ]; then
echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!"
(
set -x
ls -A
sleep 10
)
fi
# use full commands
# for clearer intent
sourceTarArgs=(
--create
--file -
--directory /usr/src/rosariosis
--one-file-system
--owner "$user" --group "$group"
)
targetTarArgs=(
--extract
--file -
)
if [ "$uid" != '0' ]; then
# avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted"
targetTarArgs+=(--no-overwrite-dir)
fi
tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}"
if [ ! -e .htaccess ] && [ -f htaccess.txt ]; then
# NOTE: The "Indexes" option is disabled in the php:apache base image so remove it as we enable .htaccess
sed -r 's/^(Options -Indexes.*)$/#\1/' htaccess.txt >.htaccess
chown "$user":"$group" .htaccess
fi
echo >&2 "Complete! Rosariosis has been successfully copied to $PWD"
fi
echo >&2 "========================================================================"
echo >&2
echo >&2 "This server is now configured to run Rosariosis!"
echo >&2
echo >&2 "NOTE: You will need your database server address, database name,"
echo >&2 "and database user credentials to install Rosariosis."
echo >&2
echo >&2 "========================================================================"
fi
exec "$@"

@ -0,0 +1 @@
php_flag display_errors off

@ -0,0 +1,168 @@
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
#
# PLEASE DO NOT EDIT IT DIRECTLY.
#
FROM php:8.0-fpm
LABEL maintainer="Llewellyn van der Merwe <Llewellynvdm@users.noreply.github.com> (@Llewellynvdm)"
# Disable remote database security requirements.
ENV ROSARIOSIS_INSTALLATION_DISABLE_LOCALHOST_CHECK=1
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
# Ghostscript is required for rendering PDF previews
ghostscript \
# To be able to send mail
sendmail \
nano \
locales \
; \
rm -rf /var/lib/apt/lists/*
# install the PHP extensions we need.
RUN set -ex; \
\
savedAptMark="$(apt-mark showmanual)"; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
libbz2-dev \
libxml2-dev \
libgmp-dev \
libicu-dev \
libfreetype6-dev \
libjpeg-dev \
libldap2-dev \
libmemcached-dev \
libmagickwand-dev \
wkhtmltopdf \
libpq-dev \
libpng-dev \
libwebp-dev \
libzip-dev \
libonig-dev \
postgresql-client \
; \
\
docker-php-ext-configure gd \
--with-freetype \
--with-jpeg \
--with-webp \
; \
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
docker-php-ext-configure ldap --with-libdir="lib/$debMultiarch"; \
docker-php-ext-install -j "$(nproc)" \
bz2 \
bcmath \
exif \
gd \
mbstring \
xml \
xmlrpc \
gmp \
intl \
ldap \
mysqli \
pdo_mysql \
pdo_pgsql \
pgsql \
gettext \
zip \
; \
# https://pecl.php.net/package/imagick
pecl install imagick-3.6.0; \
docker-php-ext-enable imagick; \
rm -r /tmp/pear; \
\
# some misbehaving extensions end up outputting to stdout
out="$(php -r 'exit(0);')"; \
[ -z "$out" ]; \
err="$(php -r 'exit(0);' 3>&1 1>&2 2>&3)"; \
[ -z "$err" ]; \
\
extDir="$(php -r 'echo ini_get("extension_dir");')"; \
[ -d "$extDir" ]; \
# pecl will claim success even if one install fails, so we need to perform each install separately
pecl install APCu-5.1.21; \
pecl install memcached-3.2.0; \
pecl install redis-5.3.7; \
\
docker-php-ext-enable \
apcu \
memcached \
redis \
; \
rm -r /tmp/pear; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark; \
ldd "$extDir"/*.so \
| awk '/=>/ { print $3 }' \
| sort -u \
| xargs -r dpkg-query -S \
| cut -d: -f1 \
| sort -u \
| xargs -rt apt-mark manual; \
\
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf /var/lib/apt/lists/*; \
\
! { ldd "$extDir"/*.so | grep 'not found'; }; \
# check for output like "PHP Warning: PHP Startup: Unable to load dynamic library 'foo' (tried: ...)
err="$(php --version 3>&1 1>&2 2>&3)"; \
[ -z "$err" ]
# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN set -eux; \
docker-php-ext-enable opcache; \
{ \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=2'; \
echo 'opcache.fast_shutdown=1'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini
# set recommended error logging
RUN { \
# https://www.php.net/manual/en/errorfunc.constants.php
echo 'error_reporting = E_ERROR | E_WARNING | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_RECOVERABLE_ERROR'; \
echo 'display_errors = Off'; \
echo 'display_startup_errors = Off'; \
echo 'log_errors = On'; \
echo 'error_log = /dev/stderr'; \
echo 'log_errors_max_len = 1024'; \
echo 'ignore_repeated_errors = On'; \
echo 'ignore_repeated_source = Off'; \
echo 'html_errors = Off'; \
} > /usr/local/etc/php/conf.d/error-logging.ini
VOLUME /var/www/html
# Define Rosariosis version and expected SHA512 signature
ENV ROSARIOSIS_VERSION 9.3
ENV ROSARIOSIS_SHA512 1e786b5edf9ea6075357c1b7148f00f47e8171b112bc023a11a6e37a88560873a30d128f66a1d1c81af2f7bfbdb3ce3b425ded83a9ddbdfd380367122d8d22cf
# Download package and extract to web volume
RUN set -ex; \
curl -o rosariosis.tar.bz2 -SL https://gitlab.com/francoisjacquet/rosariosis/-/archive/v9.3/rosariosis-v9.3.tar.bz2; \
echo "$ROSARIOSIS_SHA512 *rosariosis.tar.bz2" | sha512sum -c -; \
mkdir -p /usr/src/rosariosis; \
tar -xf rosariosis.tar.bz2 --strip-components=1 -C /usr/src/rosariosis; \
rm rosariosis.tar.bz2; \
chown -R www-data:www-data /usr/src/rosariosis
# Copy init scripts
COPY conf/docker-entrypoint.sh /entrypoint.sh
# Copy our configuration files.
COPY conf/config.inc.php /usr/src/rosariosis/config.inc.php
COPY conf/htaccess.txt /usr/src/rosariosis/.htaccess
ENTRYPOINT ["/entrypoint.sh"]
CMD ["php-fpm"]

@ -0,0 +1,90 @@
<?php
/**
* The base configurations of RosarioSIS
*
* You can find more information in the INSTALL.md file
*
* @package RosarioSIS
*/
/**
* PostgreSQL Database Settings
*
* You can get this info from your web host
*/
// Database server hostname: use localhost if on same server.
$DatabaseServer = getenv( 'POSTGRES_HOST' );
// Database username.
$DatabaseUsername = getenv( 'POSTGRES_USER' );
// Database password.
$DatabasePassword = getenv( 'POSTGRES_PASSWORD' );;
// Database name.
$DatabaseName = getenv( 'POSTGRES_DB' );;
// Database port: default is 5432.
$DatabasePort = getenv( 'POSTGRES_PORT' );
/**
* Paths
*/
/**
* Full path to the PostrgeSQL database dump utility for this server
*
* @example /usr/bin/pg_dump
* @example C:/Progra~1/PostgreSQL/bin/pg_dump.exe
*/
$pg_dumpPath = '/usr/bin/pg_dump';
/**
* Full path to wkhtmltopdf binary file
*
* An empty string means wkhtmltopdf will not be called
* and reports will be rendered in HTML instead of PDF
*
* @link http://wkhtmltopdf.org
*
* @example /usr/local/bin/wkhtmltopdf
* @example C:/Progra~1/wkhtmltopdf/bin/wkhtmltopdf.exe
*/
$wkhtmltopdfPath = '/usr/bin/wkhtmltopdf';
/**
* Default school year
*
* Do not change on install
* Change after rollover
* Should match the database to be able to login
*/
$DefaultSyear = getenv( 'ROSARIOSIS_YEAR' );
/**
* Notify email address
* where to send error and new administrator notifications
*
* Leave empty to not receive email notifications
*/
$RosarioNotifyAddress = getenv( 'ROSARIOSIS_ADMIN_EMAIL' );
$RosarioErrorsAddress = getenv( 'ROSARIOSIS_ADMIN_EMAIL' );
/**
* Locales
*
* Add other languages you want to support here
*
* @see locale/ folder
*
* For American, French and Spanish:
*
* @example array( 'en_US.utf8', 'fr_FR.utf8', 'es_ES.utf8' );
*/
$RosarioLocales = array( getenv( 'ROSARIOSIS_LANG' ).'.utf8' );

@ -0,0 +1,133 @@
#!/bin/bash
set -e
if [ -n "$POSTGRES_PASSWORD_FILE" ] && [ -f "$POSTGRES_PASSWORD_FILE" ]; then
POSTGRES_PASSWORD=$(cat "$POSTGRES_PASSWORD_FILE")
fi
if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
uid="$(id -u)"
gid="$(id -g)"
if [ "$uid" = '0' ]; then
case "$1" in
apache2*)
user="${APACHE_RUN_USER:-www-data}"
group="${APACHE_RUN_GROUP:-www-data}"
# strip off any '#' symbol ('#1000' is valid syntax for Apache)
pound='#'
user="${user#$pound}"