Make Ushahidi SPOC-compatible, cont'd

This commit is contained in:
Disassembler 2020-03-24 18:21:52 +01:00
parent 6cb0440d4a
commit 268dc6447c
Signed by: Disassembler
GPG Key ID: 524BD33A0EE29499
6 changed files with 27 additions and 14 deletions

View File

@ -15,7 +15,8 @@
], ],
"mounts": { "mounts": {
"ushahidi/ushahidi_conf/env": "srv/ushahidi/platform/.env:file", "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": { "ushahidi-redis": {

View File

@ -3,7 +3,7 @@ FROM alpine3.11-php7.3_7.3.15-200313
RUN EOF RUN EOF
# Install runtime dependencies # 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 # 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 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 # Create OS user
addgroup -S -g 8080 ushahidi addgroup -S -g 8080 ushahidi
adduser -S -u 8080 -h /srv/ushahidi -s /bin/false -g ushahidi -G ushahidi 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 EOF
COPY image.d COPY image.d

View File

@ -23,10 +23,10 @@ http {
server_name localhost; server_name localhost;
root /srv/ushahidi; root /srv/ushahidi;
index index.php; index index.html index.php;
location / { location / {
try_files $uri $uri/ /index.html; try_files $uri $uri/ /index.html /index.php;
} }
location /platform { location /platform {

View File

@ -4,6 +4,8 @@ set -ev
# Volumes # Volumes
MARIADB_CONF="${VOLUMES_DIR}/ushahidi/mariadb_conf" MARIADB_CONF="${VOLUMES_DIR}/ushahidi/mariadb_conf"
MARIADB_DATA="${VOLUMES_DIR}/ushahidi/mariadb_data" 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_CONF="${VOLUMES_DIR}/ushahidi/ushahidi_conf"
USHAHIDI_DATA="${VOLUMES_DIR}/ushahidi/ushahidi_data" 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 100000 -g 100000 -m 755 -d ${MARIADB_CONF}
install -o 103306 -g 103306 -m 750 -d ${MARIADB_DATA} 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 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 # Create database
export USHAHIDI_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=') 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 spoc-container start ushahidi-redis
# Configure Ushahidi # Configure Ushahidi
USHAHIDI_APPKEY=$(spoc-container exec ushahidi -- sh -c 'cd /srv/ushahidi/platform; php artisan key:generate') export USHAHIDI_APPKEY=$(head -c 32 /dev/urandom | base64 | tr -d '+/=' | cut -c0-32) # Must be exactly 32 characters
install -o 108080 -g 100000 -m 750 -d ${USHAHIDI_CONF} install -o 100000 -g 108080 -m 750 -d ${USHAHIDI_CONF}
install -o 108080 -g 108080 -m 755 -d ${USHAHIDI_DATA} install -o 108080 -g 108080 -m 755 -d ${USHAHIDI_DATA}
envsubst <ushahidi_conf/env | install -o 108080 -g 100000 -m 640 /dev/stdin ${USHAHIDI_CONF}/env install -o 108080 -g 108080 -m 755 -d ${USHAHIDI_DATA}/passport
install -o 108080 -g 108080 -m 640 ushahidi_conf/config.json ${USHAHIDI_CONF}/config.json envsubst <ushahidi_conf/env | install -o 100000 -g 108080 -m 640 /dev/stdin ${USHAHIDI_CONF}/env
install -o 100000 -g 108080 -m 644 ushahidi_conf/config.json ${USHAHIDI_CONF}/config.json
spoc-container exec ushahidi -- sh -c 'cd /srv/ushahidi/platform; php artisan passport:keys'
# Populate database # Populate database
spoc-container exec ushahidi -- sh -c 'cd /srv/ushahidi/platform; php artisan migrate' spoc-container exec ushahidi -- sh -c 'cd /srv/ushahidi/platform; php artisan migrate'

View File

@ -0,0 +1,6 @@
{
"backend_url": "https://ush.spotter.vm/platform",
"client_id": "ushahidiui",
"client_secret": "35e7f0bca957836d05ca0492211b0ac707671261",
"google_analytics_id": ""
}

View File

@ -4,11 +4,12 @@ APP_KEY=${USHAHIDI_APPKEY}
APP_TIMEZONE=Europe/Prague APP_TIMEZONE=Europe/Prague
APP_LANGUAGES=cs,en APP_LANGUAGES=cs,en
DB_TYPE=mysql DB_CONNECTION=mysql
DB_HOST=ushahidi-mariadb DB_HOST=ushahidi-mariadb
DB_NAME=ushahidi DB_PORT=3306
DB_USER=ushahidi DB_DATABASE=ushahidi
DB_PASS=${USHAHIDI_PWD} DB_USERNAME=ushahidi
DB_PASSWORD=${USHAHIDI_PWD}
CACHE_DRIVER=redis CACHE_DRIVER=redis
QUEUE_DRIVER=redis QUEUE_DRIVER=redis