From 1eea6c8e99e69db8ad781b843e79292411d14de3 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Sat, 11 Apr 2020 19:52:10 +0200 Subject: [PATCH] Add Crismapp, closes #304 --- build/build-all.sh | 3 + lxc-apps/crismapp/app | 27 ++++++++ lxc-apps/crismapp/image | 33 ++++++++++ lxc-apps/crismapp/image.d/config.patch | 64 +++++++++++++++++++ .../crismapp/image.d/etc/nginx/nginx.conf | 44 +++++++++++++ .../crismapp/image.d/etc/php5/php-fpm.conf | 13 ++++ .../image.d/etc/services.d/.s6-svscan/finish | 4 ++ .../crismapp/image.d/etc/services.d/nginx/run | 3 + .../image.d/etc/services.d/php-fpm/run | 3 + .../crismapp/image.d/srv/crismapp/index.php | 2 + lxc-apps/crismapp/install.sh | 32 ++++++++++ lxc-apps/crismapp/install/createdb.sql | 3 + .../crismapp/install/crismapp_conf/config.php | 5 ++ lxc-apps/crismapp/install/mariadb_conf/my.cnf | 24 +++++++ lxc-apps/crismapp/uninstall.sh | 8 +++ 15 files changed, 268 insertions(+) create mode 100644 lxc-apps/crismapp/app create mode 100644 lxc-apps/crismapp/image create mode 100644 lxc-apps/crismapp/image.d/config.patch create mode 100644 lxc-apps/crismapp/image.d/etc/nginx/nginx.conf create mode 100644 lxc-apps/crismapp/image.d/etc/php5/php-fpm.conf create mode 100755 lxc-apps/crismapp/image.d/etc/services.d/.s6-svscan/finish create mode 100755 lxc-apps/crismapp/image.d/etc/services.d/nginx/run create mode 100755 lxc-apps/crismapp/image.d/etc/services.d/php-fpm/run create mode 100644 lxc-apps/crismapp/image.d/srv/crismapp/index.php create mode 100755 lxc-apps/crismapp/install.sh create mode 100644 lxc-apps/crismapp/install/createdb.sql create mode 100644 lxc-apps/crismapp/install/crismapp_conf/config.php create mode 100644 lxc-apps/crismapp/install/mariadb_conf/my.cnf create mode 100755 lxc-apps/crismapp/uninstall.sh diff --git a/build/build-all.sh b/build/build-all.sh index e640bfc..0a47b47 100755 --- a/build/build-all.sh +++ b/build/build-all.sh @@ -66,6 +66,9 @@ spoc-app publish ckan/app spoc-image build -p crisiscleanup/image spoc-app publish crisiscleanup/app +spoc-image build -p crismapp/image +spoc-app publish crismapp/app + spoc-image build -p cts/image spoc-app publish cts/app diff --git a/lxc-apps/crismapp/app b/lxc-apps/crismapp/app new file mode 100644 index 0000000..07d11f5 --- /dev/null +++ b/lxc-apps/crismapp/app @@ -0,0 +1,27 @@ +{ + "version": "0.0.1-200411", + "meta": { + "title": "Crismapp", + "desc-cs": "Test", + "desc-en": "Test", + "license": "GPL" + }, + "containers": { + "crismapp": { + "image": "crismapp_0.0.1-200411", + "depends": [ + "crismapp-mariadb" + ], + "mounts": { + "crismapp/crismapp_conf/config.php": "srv/crismapp/6/app/config.php:file" + } + }, + "crismapp-mariadb": { + "image": "mariadb_10.4.12-200403", + "mounts": { + "crismapp/mariadb_conf/my.cnf": "etc/my.cnf:file", + "crismapp/mariadb_data": "var/lib/mysql" + } + } + } +} diff --git a/lxc-apps/crismapp/image b/lxc-apps/crismapp/image new file mode 100644 index 0000000..e664d10 --- /dev/null +++ b/lxc-apps/crismapp/image @@ -0,0 +1,33 @@ +IMAGE crismapp_0.0.1-200411 +FROM alpine3.8-php5.6_5.6.40-200403 + +RUN EOF + # Install runtime dependencies + apk --no-cache add php5-mysqli php5-pdo_mysql + + # Install build dependencies + apk --no-cache add --virtual .deps git + + # Clone Crismapp + git clone https://github.com/rostanetek/crismapp /srv/crismapp +EOF + +COPY image.d + +RUN EOF + # Patch config + cd /srv/crismapp + patch -p0 "SET NAMES utf8", + PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, +--- 6/app/db.php ++++ 6/app/db.php +@@ -6,22 +6,7 @@ + + /* rostanetek.cz */ + +- /* +-$GLOBALS['host'] = 'wm53.wedos.net'; +-$GLOBALS['db_user'] = 'a61192_disert'; +-$GLOBALS['db_password'] = 'jhdVu9D7'; +-$GLOBALS['db_name'] = 'd61192_disert'; +-*/ +- /* localhost*/ +- +-$GLOBALS['host'] = 'localhost'; +-$GLOBALS['db_user'] = 'root'; +-$GLOBALS['db_password'] = ''; +-$GLOBALS['db_name'] = 'disertace'; +- +- +- +- ++include ('config.php'); + + //uzivatele + define('DB_HOST', $GLOBALS['host']); diff --git a/lxc-apps/crismapp/image.d/etc/nginx/nginx.conf b/lxc-apps/crismapp/image.d/etc/nginx/nginx.conf new file mode 100644 index 0000000..aaedd87 --- /dev/null +++ b/lxc-apps/crismapp/image.d/etc/nginx/nginx.conf @@ -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/crismapp; + index index.php; + + location / { + try_files $uri $uri/ /index.php$is_args$args; + } + + location ~ \.php$ { + fastcgi_pass unix:/var/run/crismapp.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; + } + } +} diff --git a/lxc-apps/crismapp/image.d/etc/php5/php-fpm.conf b/lxc-apps/crismapp/image.d/etc/php5/php-fpm.conf new file mode 100644 index 0000000..2c12a0d --- /dev/null +++ b/lxc-apps/crismapp/image.d/etc/php5/php-fpm.conf @@ -0,0 +1,13 @@ +[global] +error_log = /proc/self/fd/2 +daemonize = no + +[crismapp] +catch_workers_output = yes +user = crismapp +group = crismapp +listen.owner = nginx +listen.group = nginx +listen = /var/run/crismapp.sock +pm = ondemand +pm.max_children = 16 diff --git a/lxc-apps/crismapp/image.d/etc/services.d/.s6-svscan/finish b/lxc-apps/crismapp/image.d/etc/services.d/.s6-svscan/finish new file mode 100755 index 0000000..c9e7add --- /dev/null +++ b/lxc-apps/crismapp/image.d/etc/services.d/.s6-svscan/finish @@ -0,0 +1,4 @@ +#!/bin/execlineb -P + +foreground { s6-svwait -d -t 3000 nginx } +foreground { s6-svwait -d -t 3000 php-fpm } diff --git a/lxc-apps/crismapp/image.d/etc/services.d/nginx/run b/lxc-apps/crismapp/image.d/etc/services.d/nginx/run new file mode 100755 index 0000000..dff57ac --- /dev/null +++ b/lxc-apps/crismapp/image.d/etc/services.d/nginx/run @@ -0,0 +1,3 @@ +#!/bin/execlineb -P + +nginx -g "daemon off;" diff --git a/lxc-apps/crismapp/image.d/etc/services.d/php-fpm/run b/lxc-apps/crismapp/image.d/etc/services.d/php-fpm/run new file mode 100755 index 0000000..e2296de --- /dev/null +++ b/lxc-apps/crismapp/image.d/etc/services.d/php-fpm/run @@ -0,0 +1,3 @@ +#!/bin/execlineb -P + +php-fpm5 -F diff --git a/lxc-apps/crismapp/image.d/srv/crismapp/index.php b/lxc-apps/crismapp/image.d/srv/crismapp/index.php new file mode 100644 index 0000000..746f301 --- /dev/null +++ b/lxc-apps/crismapp/image.d/srv/crismapp/index.php @@ -0,0 +1,2 @@ +