From 268dc6447cdca47dc2d8ef343c00aa98ce8ca02b Mon Sep 17 00:00:00 2001 From: Disassembler Date: Tue, 24 Mar 2020 18:21:52 +0100 Subject: [PATCH] Make Ushahidi SPOC-compatible, cont'd --- lxc-apps/ushahidi/app | 3 ++- lxc-apps/ushahidi/image | 5 +++-- lxc-apps/ushahidi/image.d/etc/nginx/nginx.conf | 4 ++-- lxc-apps/ushahidi/install.sh | 14 +++++++++----- .../ushahidi/install/ushahidi_conf/config.json | 6 ++++++ lxc-apps/ushahidi/install/ushahidi_conf/env | 9 +++++---- 6 files changed, 27 insertions(+), 14 deletions(-) create mode 100644 lxc-apps/ushahidi/install/ushahidi_conf/config.json diff --git a/lxc-apps/ushahidi/app b/lxc-apps/ushahidi/app index 05a87ba..8ff6cd5 100644 --- a/lxc-apps/ushahidi/app +++ b/lxc-apps/ushahidi/app @@ -15,7 +15,8 @@ ], "mounts": { "ushahidi/ushahidi_conf/env": "srv/ushahidi/platform/.env:file", - "ushahidi/ushahidi_data": "srv/ushahidi/platform/application/media/uploads" + "ushahidi/ushahidi_conf/config.json": "srv/ushahidi/config.json:file", + "ushahidi/ushahidi_data": "srv/ushahidi/platform/storage" } }, "ushahidi-redis": { diff --git a/lxc-apps/ushahidi/image b/lxc-apps/ushahidi/image index 09df5fd..268ad0b 100644 --- a/lxc-apps/ushahidi/image +++ b/lxc-apps/ushahidi/image @@ -3,7 +3,7 @@ FROM alpine3.11-php7.3_7.3.15-200313 RUN EOF # Install runtime dependencies - apk --no-cache add php7-curl php7-imap php7-mysqli php7-pdo_mysql + apk --no-cache add php7-curl php7-imap php7-mysqli php7-pecl-memcached php7-pecl-redis php7-pdo_mysql # Download Ushahidi wget https://github.com/ushahidi/platform-client/releases/download/v4.4.1/ushahidi-platform-client-bundle-v4.4.1.tar.gz -O - | tar xzf - -C /srv @@ -14,7 +14,8 @@ RUN EOF # Create OS user addgroup -S -g 8080 ushahidi adduser -S -u 8080 -h /srv/ushahidi -s /bin/false -g ushahidi -G ushahidi ushahidi - chown -R ushahidi:ushahidi /srv/ushahidi/platform/application/logs /srv/ushahidi/platform/application/cache /srv/ushahidi/platform/application/media/uploads + mkdir /srv/ushahidi/platform/storage + chown -R ushahidi:ushahidi /srv/ushahidi/platform/storage EOF COPY image.d diff --git a/lxc-apps/ushahidi/image.d/etc/nginx/nginx.conf b/lxc-apps/ushahidi/image.d/etc/nginx/nginx.conf index 6994616..899d250 100644 --- a/lxc-apps/ushahidi/image.d/etc/nginx/nginx.conf +++ b/lxc-apps/ushahidi/image.d/etc/nginx/nginx.conf @@ -23,10 +23,10 @@ http { server_name localhost; root /srv/ushahidi; - index index.php; + index index.html index.php; location / { - try_files $uri $uri/ /index.html; + try_files $uri $uri/ /index.html /index.php; } location /platform { diff --git a/lxc-apps/ushahidi/install.sh b/lxc-apps/ushahidi/install.sh index cf09e7c..2e97ed7 100755 --- a/lxc-apps/ushahidi/install.sh +++ b/lxc-apps/ushahidi/install.sh @@ -4,6 +4,8 @@ set -ev # Volumes MARIADB_CONF="${VOLUMES_DIR}/ushahidi/mariadb_conf" MARIADB_DATA="${VOLUMES_DIR}/ushahidi/mariadb_data" +REDIS_CONF="${VOLUMES_DIR}/ushahidi/redis_conf" +REDIS_DATA="${VOLUMES_DIR}/ushahidi/redis_data" USHAHIDI_CONF="${VOLUMES_DIR}/ushahidi/ushahidi_conf" USHAHIDI_DATA="${VOLUMES_DIR}/ushahidi/ushahidi_data" @@ -11,7 +13,7 @@ USHAHIDI_DATA="${VOLUMES_DIR}/ushahidi/ushahidi_data" install -o 100000 -g 100000 -m 755 -d ${MARIADB_CONF} install -o 103306 -g 103306 -m 750 -d ${MARIADB_DATA} install -o 100000 -g 100000 -m 644 mariadb_conf/my.cnf ${MARIADB_CONF}/my.cnf -spoc-container exec mifosx-mariadb -- mysql_install_db --user=mysql --datadir=/var/lib/mysql --auth-root-authentication-method=socket --skip-test-db +spoc-container exec ushahidi-mariadb -- mysql_install_db --user=mysql --datadir=/var/lib/mysql --auth-root-authentication-method=socket --skip-test-db # Create database export USHAHIDI_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=') @@ -25,11 +27,13 @@ install -o 100000 -g 106379 -m 640 redis_conf/redis.conf ${REDIS_CONF}/redis.con spoc-container start ushahidi-redis # Configure Ushahidi -USHAHIDI_APPKEY=$(spoc-container exec ushahidi -- sh -c 'cd /srv/ushahidi/platform; php artisan key:generate') -install -o 108080 -g 100000 -m 750 -d ${USHAHIDI_CONF} +export USHAHIDI_APPKEY=$(head -c 32 /dev/urandom | base64 | tr -d '+/=' | cut -c0-32) # Must be exactly 32 characters +install -o 100000 -g 108080 -m 750 -d ${USHAHIDI_CONF} install -o 108080 -g 108080 -m 755 -d ${USHAHIDI_DATA} -envsubst