mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-11 18:51:31 +00:00
Build modified streamline images
The official image from streamline does not currently work for the arm64 platform. As a temporary measure, the source code and docker build scripts have been lifted from the official images and are used to build locally. Some additional modifications are made to reduce overall image size, these are documented in docker/README.md
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
worker_processes 1;
|
||||
error_log stderr warn;
|
||||
pid /run/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main_timed '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for" '
|
||||
'$request_time $upstream_response_time $pipe $upstream_cache_status';
|
||||
|
||||
access_log /dev/stdout main_timed;
|
||||
error_log /dev/stderr notice;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
index index.php index.html;
|
||||
error_log /var/log/nginx/error.log;
|
||||
access_log /var/log/nginx/access.log;
|
||||
server_name localhost;
|
||||
root /var/www/html/public;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
try_files $uri =404;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
fastcgi_pass 127.0.0.1:9000;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
[global]
|
||||
; Log to stderr
|
||||
error_log = /dev/stderr
|
||||
|
||||
[www]
|
||||
user = streamline
|
||||
group = streamline
|
||||
; The address on which to accept FastCGI requests.
|
||||
; Valid syntaxes are:
|
||||
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on
|
||||
; a specific port;
|
||||
; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
|
||||
; a specific port;
|
||||
; 'port' - to listen on a TCP socket to all addresses
|
||||
; (IPv6 and IPv4-mapped) on a specific port;
|
||||
; '/path/to/unix/socket' - to listen on a unix socket.
|
||||
; Note: This value is mandatory.
|
||||
listen = 127.0.0.1:9000
|
||||
|
||||
; Enable status page
|
||||
pm.status_path = /fpm-status
|
||||
|
||||
; Ondemand process manager
|
||||
pm = ondemand
|
||||
|
||||
; The number of child processes to be created when pm is set to 'static' and the
|
||||
; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
|
||||
; This value sets the limit on the number of simultaneous requests that will be
|
||||
; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
|
||||
; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
|
||||
; CGI. The below defaults are based on a server without much resources. Don't
|
||||
; forget to tweak pm.* to fit your needs.
|
||||
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
|
||||
; Note: This value is mandatory.
|
||||
pm.max_children = 100
|
||||
|
||||
; The number of seconds after which an idle process will be killed.
|
||||
; Note: Used only when pm is set to 'ondemand'
|
||||
; Default Value: 10s
|
||||
pm.process_idle_timeout = 10s;
|
||||
|
||||
; The number of requests each child process should execute before respawning.
|
||||
; This can be useful to work around memory leaks in 3rd party libraries. For
|
||||
; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
|
||||
; Default Value: 0
|
||||
pm.max_requests = 1000
|
||||
|
||||
; Make sure the FPM workers can reach the environment variables for configuration
|
||||
clear_env = no
|
||||
|
||||
; Catch output from PHP
|
||||
catch_workers_output = yes
|
||||
|
||||
; Remove the 'child 10 said into stderr' prefix in the log and only show the actual message
|
||||
decorate_workers_output = no
|
||||
|
||||
; Enable ping page to use in healthcheck
|
||||
ping.path = /fpm-ping
|
||||
@@ -0,0 +1,5 @@
|
||||
[supervisord]
|
||||
nodaemon=false
|
||||
|
||||
[program:mariadb]
|
||||
command=/usr/bin/mysqld_safe --datadir='/var/lib/mysql' --port=3306 --skip-networking=0
|
||||
@@ -0,0 +1,4 @@
|
||||
[mysqld]
|
||||
max_binlog_size=3M
|
||||
log-basename=bin
|
||||
log-bin=/var/lib/mysql/logs/bin
|
||||
+132
@@ -0,0 +1,132 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This script helps to initialise MariaDB and setup fresh database instance
|
||||
|
||||
# execute any pre-init scripts
|
||||
for i in /scripts/pre-init.d/*sh
|
||||
do
|
||||
if [ -e "${i}" ]; then
|
||||
echo "[i] pre-init.d - processing $i"
|
||||
. "${i}"
|
||||
fi
|
||||
done
|
||||
|
||||
# create bin-logs folder
|
||||
if [ ! -d "/var/lib/mysql/logs" ]; then
|
||||
echo "[i] created logs folder."
|
||||
mkdir -p /var/lib/mysql/logs/
|
||||
fi
|
||||
|
||||
if [ -d "/run/mysqld" ]; then
|
||||
echo "[i] mysqld already present, skipping creation"
|
||||
chown -R mysql:mysql /run/mysqld
|
||||
else
|
||||
echo "[i] mysqld not found, creating...."
|
||||
mkdir -p /run/mysqld
|
||||
chown -R mysql:mysql /run/mysqld
|
||||
fi
|
||||
|
||||
if [ -d /var/lib/mysql/mysql ]; then
|
||||
echo "[i] MySQL directory already present, skipping creation"
|
||||
chown -R mysql:mysql /var/lib/mysql
|
||||
else
|
||||
echo "[i] MySQL data directory not found, creating initial DBs"
|
||||
|
||||
chown -R mysql:mysql /var/lib/mysql
|
||||
|
||||
mysql_install_db --user=mysql --data=/var/lib/mysql > /dev/null
|
||||
|
||||
tfile=`mktemp`
|
||||
if [ ! -f "$tfile" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
cat << EOF > $tfile
|
||||
USE mysql;
|
||||
FLUSH PRIVILEGES ;
|
||||
GRANT ALL ON *.* TO 'root'@'%' identified by '$MYSQL_ROOT_PASSWORD' WITH GRANT OPTION ;
|
||||
GRANT ALL ON *.* TO 'root'@'localhost' identified by '$MYSQL_ROOT_PASSWORD' WITH GRANT OPTION ;
|
||||
SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ;
|
||||
DROP DATABASE IF EXISTS test ;
|
||||
FLUSH PRIVILEGES ;
|
||||
EOF
|
||||
|
||||
if [[ "$MYSQL_DATABASE" != "" ]]; then
|
||||
echo "[i] Creating database: $MYSQL_DATABASE"
|
||||
if [ "$MYSQL_CHARSET" != "" ] && [ "$MYSQL_COLLATION" != "" ]; then
|
||||
echo "[i] with character set [$MYSQL_CHARSET] and collation [$MYSQL_COLLATION]"
|
||||
echo "CREATE DATABASE IF NOT EXISTS \`$MYSQL_DATABASE\` CHARACTER SET $MYSQL_CHARSET COLLATE $MYSQL_COLLATION;" >> $tfile
|
||||
else
|
||||
echo "[i] with character set: 'utf8' and collation: 'utf8_general_ci'"
|
||||
echo "CREATE DATABASE IF NOT EXISTS \`$MYSQL_DATABASE\` CHARACTER SET utf8 COLLATE utf8_general_ci;" >> $tfile
|
||||
fi
|
||||
|
||||
if [ "$MYSQL_USER" != "" ]; then
|
||||
echo "[i] Creating user: $MYSQL_USER with password $MYSQL_PASSWORD"
|
||||
|
||||
echo "GRANT ALL ON `$MYSQL_DATABASE`.* TO '$MYSQL_USER'@'127.0.0.1' IDENTIFIED BY '$MYSQL_PASSWORD';" >> $tfile;
|
||||
echo "GRANT ALL ON \`$MYSQL_DATABASE\`.* to '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD';" >> $tfile
|
||||
fi
|
||||
fi
|
||||
|
||||
/usr/bin/mysqld --user=mysql --bootstrap --verbose=0 --skip-name-resolve --skip-networking=0 --log-basename=bin --log-bin=/var/lib/mysql/logs/bin < $tfile
|
||||
rm -f $tfile
|
||||
|
||||
# only run if we have a starting MYSQL_DATABASE env variable AND
|
||||
# the /docker-entrypoint-initdb.d/ file is not empty
|
||||
if [ "$MYSQL_DATABASE" != "" ] && [ "$(ls -A /docker-entrypoint-initdb.d 2>/dev/null)" ]; then
|
||||
|
||||
# start the server temporarily so that we can import seed files
|
||||
echo
|
||||
echo "Preparing to process the contents of /docker-entrypoint-initdb.d/"
|
||||
echo
|
||||
TEMP_OUTPUT_LOG=/tmp/mysqld_output
|
||||
/usr/bin/mysqld --user=mysql --skip-name-resolve --skip-networking=0 --log-basename=bin --log-bin=/var/lib/mysql/logs/bin --silent-startup > "${TEMP_OUTPUT_LOG}" 2>&1 &
|
||||
PID="$!"
|
||||
|
||||
# watch the output log until the server is running
|
||||
until tail "${TEMP_OUTPUT_LOG}" | grep -q "Version:"; do
|
||||
sleep 0.2
|
||||
done
|
||||
|
||||
# use mysql client to import seed files while temp db is running
|
||||
# use the starting MYSQL_DATABASE so mysql knows where to import
|
||||
MYSQL_CLIENT="/usr/bin/mysql -u root -p$MYSQL_ROOT_PASSWORD"
|
||||
|
||||
# loop through all the files in the seed directory
|
||||
# redirect input (<) from .sql files into the mysql client command line
|
||||
# pipe (|) the output of using `gunzip -c` on .sql.gz files
|
||||
for f in /docker-entrypoint-initdb.d/*; do
|
||||
case "$f" in
|
||||
*.sql) echo " $0: running $f"; eval "${MYSQL_CLIENT} ${MYSQL_DATABASE} < $f"; echo ;;
|
||||
*.sql.gz) echo " $0: running $f"; gunzip -c "$f" | eval "${MYSQL_CLIENT} ${MYSQL_DATABASE}"; echo ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# send the temporary mysqld server a shutdown signal
|
||||
# and wait till it's done before completeing the init process
|
||||
kill -s TERM "${PID}"
|
||||
wait "${PID}"
|
||||
rm -f TEMP_OUTPUT_LOG
|
||||
echo "Completed processing seed files."
|
||||
fi;
|
||||
|
||||
echo
|
||||
echo 'MySQL init process done. Ready for start up.'
|
||||
echo
|
||||
|
||||
echo "exec /usr/bin/mysqld --user=mysql --console --skip-name-resolve --skip-networking=0 --log-basename=bin --log-bin=/var/lib/mysql/logs/bin " "$@"
|
||||
fi
|
||||
|
||||
# execute any pre-exec scripts
|
||||
for i in /scripts/pre-exec.d/*sh
|
||||
do
|
||||
if [ -e "${i}" ]; then
|
||||
echo "[i] pre-exec.d - processing $i"
|
||||
. ${i}
|
||||
fi
|
||||
done
|
||||
|
||||
exec /usr/bin/mysqld --user=mysql --console --skip-name-resolve --skip-networking=0 --log-basename=bin --log-bin=/var/lib/mysql/logs/bin &
|
||||
|
||||
return $?
|
||||
@@ -0,0 +1,11 @@
|
||||
FROM nginx:alpine3.18-slim
|
||||
|
||||
ENV NGINXUSER=streamline
|
||||
ENV NGINXGROUP=streamline
|
||||
|
||||
RUN set -eux; \
|
||||
mkdir -p /var/www/html/public; \
|
||||
adduser -g ${NGINXGROUP} -s /bin/sh -D ${NGINXUSER}; \
|
||||
sed -i "s/user www-data/user ${NGINXUSER}/g" /etc/nginx/nginx.conf
|
||||
|
||||
ADD .docker/nginx/default.conf /etc/nginx/conf.d/default.conf
|
||||
@@ -0,0 +1,22 @@
|
||||
server {
|
||||
listen 80;
|
||||
index index.php index.html;
|
||||
error_log /var/log/nginx/error.log;
|
||||
access_log /var/log/nginx/access.log;
|
||||
server_name _;
|
||||
root /var/www/html/public;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
try_files $uri =404;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
fastcgi_pass php:9000;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
FROM php:8.2-fpm-alpine
|
||||
|
||||
ENV PHPGROUP=streamline
|
||||
ENV PHPUSER=streamline
|
||||
|
||||
RUN set -eux; \
|
||||
adduser -g ${PHPGROUP} -s /bin/sh -D ${PHPUSER}; \
|
||||
sed -i "s/user = www-data/user = ${PHPUSER}/g" /usr/local/etc/php-fpm.d/www.conf; \
|
||||
sed -i "s/group = www-data/group = ${PHPGROUP}/g" /usr/local/etc/php-fpm.d/www.conf; \
|
||||
mkdir -p /var/www/html/public; \
|
||||
docker-php-ext-install pdo pdo_mysql opcache
|
||||
|
||||
COPY .docker/php/opcache.ini /usr/local/etc/php/conf.d/opcache.ini
|
||||
|
||||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
|
||||
COPY ./ /var/www/html
|
||||
|
||||
WORKDIR /var/www/html
|
||||
|
||||
RUN set -eux; \
|
||||
composer install; \
|
||||
chmod 777 -R /var/www/html/storage; \
|
||||
chown -R www-data:www-data /var/www/html
|
||||
|
||||
CMD ["php-fpm", "-y", "/usr/local/etc/php-fpm.conf", "-R"]
|
||||
@@ -0,0 +1,11 @@
|
||||
[opcache]
|
||||
opcache.enable=1
|
||||
; 0 means it will check on every request
|
||||
; 0 is irrelevant if opcache.validate_timestamps=0 which is desirable in production
|
||||
opcache.revalidate_freq=0
|
||||
opcache.validate_timestamps=1
|
||||
opcache.max_accelerated_files=10000
|
||||
opcache.memory_consumption=192
|
||||
opcache.max_wasted_percentage=10
|
||||
opcache.interned_strings_buffer=16
|
||||
opcache.fast_shutdown=1
|
||||
Reference in New Issue
Block a user