diff --git a/00-install.sh b/00-install.sh index 3551c6a..63f5e7c 100755 --- a/00-install.sh +++ b/00-install.sh @@ -18,6 +18,7 @@ ${SOURCE_DIR}/pandora.sh ${SOURCE_DIR}/sahana.sh ${SOURCE_DIR}/sambro.sh ${SOURCE_DIR}/seeddms.sh +${SOURCE_DIR}/sigmah.sh ${SOURCE_DIR}/ushahidi.sh # Perform cleanup only if DEBUG environment variable is not set diff --git a/basic/srv/portal/img/Sigmah.png b/basic/srv/portal/img/Sigmah.png new file mode 100644 index 0000000..8b07dbe Binary files /dev/null and b/basic/srv/portal/img/Sigmah.png differ diff --git a/basic/srv/portal/index.html b/basic/srv/portal/index.html index b63d439..3d6716e 100644 --- a/basic/srv/portal/index.html +++ b/basic/srv/portal/index.html @@ -191,6 +191,15 @@ +
+

SigmahSigmah

+

Rozpočtování získávání finančních prostředků.

+ +
+

diaspora*diaspora*

Autonomní sociání síť s možností propojení do cizích sociálních sítí.

diff --git a/sigmah.sh b/sigmah.sh new file mode 100755 index 0000000..4a972ce --- /dev/null +++ b/sigmah.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +SOURCE_DIR=$(realpath $(dirname "${0}"))/sigmah + +# Install Tomcat +apt-get -y --no-install-recommends install openjdk-8-jre-headless python-bcrypt tomcat8 + +# Download Sigmah +wget https://github.com/sigmah-dev/sigmah/releases/download/v2.0.2/sigmah-2.0.2.war -O /tmp/sigmah.war +unzip /tmp/sigmah.war -d /var/lib/tomcat8/webapps/sigmah +rm -f /tmp/sigmah.war + +# Create database +export SIGMAH_PWD=$(head -c 18 /dev/urandom | base64) +envsubst <${SOURCE_DIR}/tmp/sigmah-createdb.sql >/tmp/sigmah-createdb.sql +sudo -u postgres psql -f /tmp/sigmah-createdb.sql +rm -f /tmp/sigmah-createdb.sql + +# Configure Sigmah +mkdir -p /srv/sigmah/{files,archives} +chown -R tomcat8:tomcat8 /srv/sigmah +envsubst <${SOURCE_DIR}/var/lib/tomcat8/webapps/sigmah/WEB-INF/classes/META-INF/persistence.xml >/var/lib/tomcat8/webapps/sigmah/WEB-INF/classes/META-INF/persistence.xml +cp ${SOURCE_DIR}/var/lib/tomcat8/webapps/sigmah/WEB-INF/classes/sigmah.properties /var/lib/tomcat8/webapps/sigmah/WEB-INF/classes/sigmah.properties +cp /var/lib/tomcat8/webapps/sigmah/sigmah/images/header/org-default-logo.png /srv/sigmah/files/logo.png + +# Populate database +wget https://github.com/sigmah-dev/sigmah/releases/download/v2.0.2/sigmah-MinimumDataKit-2.0.postgresql.sql -O /tmp/sigmah-MinimumDataKit.sql +wget https://github.com/sigmah-dev/sigmah/releases/download/v2.0.2/sigmah-newOrganizationLaunchScript-2.0.postgresql.sql -O /tmp/sigmah-newOrganizationLaunchScript.sql +export SIGMAH_ADMIN_USER=Admin +export SIGMAH_ADMIN_EMAIL=admin@example.com +export SIGMAH_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) +export SIGMAH_ADMIN_HASH=$(python -c "import bcrypt; print bcrypt.hashpw('${SIGMAH_ADMIN_PWD}', bcrypt.gensalt(10, prefix=b'2a'))") +sed -i "s|§OrganizationName§|Demo organization|g" /tmp/sigmah-newOrganizationLaunchScript.sql +sed -i "s|§OrganizationLogoFilename§|logo.png|g" /tmp/sigmah-newOrganizationLaunchScript.sql +sed -i "s|§HeadquartersCountryCode§|CZ|g" /tmp/sigmah-newOrganizationLaunchScript.sql +sed -i "s|§UserEmail§|${SIGMAH_ADMIN_EMAIL}|g" /tmp/sigmah-newOrganizationLaunchScript.sql +sed -i "s|§UserName§|${SIGMAH_ADMIN_USER}|g" /tmp/sigmah-newOrganizationLaunchScript.sql +sed -i "s|§UserFirstName§|${SIGMAH_ADMIN_USER}|g" /tmp/sigmah-newOrganizationLaunchScript.sql +sed -i "s|§UserLocale§|en|g" /tmp/sigmah-newOrganizationLaunchScript.sql +sed -i "s|\$2a\$10\$pMcTA1p9fefR8U9NoOPei.H0eq/TbbdSF27M0tn9iDWBrA4JHeCDC|${SIGMAH_ADMIN_HASH}|" /tmp/sigmah-newOrganizationLaunchScript.sql +export PGPASSWORD=${SIGMAH_PWD} +psql -f /tmp/sigmah-MinimumDataKit.sql -U sigmah sigmah +psql -f /tmp/sigmah-newOrganizationLaunchScript.sql -U sigmah sigmah +unset PGPASSWORD +rm -f /tmp/sigmah-MinimumDataKit.sql +rm -f /tmp/sigmah-newOrganizationLaunchScript.sql + +# Create nginx app definition +cp ${SOURCE_DIR}/etc/nginx/apps-available/sigmah /etc/nginx/apps-available/sigmah +ln -s /etc/nginx/apps-available/sigmah /etc/nginx/apps-enabled/sigmah + +# Restart services +systemctl restart tomcat8 +systemctl restart nginx + +# Add portal application definition +portal-app-manager sigmah "/sigmah/" "${SIGMAH_ADMIN_EMAIL}" "${SIGMAH_ADMIN_PWD}" + +# TODO: Split tomcat installation, secure port 8080 diff --git a/sigmah/etc/nginx/apps-available/sigmah b/sigmah/etc/nginx/apps-available/sigmah new file mode 100644 index 0000000..f4c75d7 --- /dev/null +++ b/sigmah/etc/nginx/apps-available/sigmah @@ -0,0 +1,11 @@ +location /sigmah { + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header X-Forwarded-Proto https; + proxy_set_header Host $http_host; + proxy_set_header Proxy ""; + proxy_redirect off; + proxy_buffering off; + proxy_read_timeout 90; + proxy_connect_timeout 90; + proxy_pass http://127.0.0.1:8080/sigmah; +} diff --git a/sigmah/tmp/sigmah-createdb.sql b/sigmah/tmp/sigmah-createdb.sql new file mode 100644 index 0000000..f9c46d4 --- /dev/null +++ b/sigmah/tmp/sigmah-createdb.sql @@ -0,0 +1,6 @@ +CREATE ROLE sigmah NOSUPERUSER NOCREATEDB NOCREATEROLE NOINHERIT LOGIN ENCRYPTED PASSWORD '${SIGMAH_PWD}'; +CREATE DATABASE sigmah; +REVOKE ALL ON DATABASE sigmah FROM public; +ALTER DATABASE sigmah OWNER TO sigmah; +\c sigmah; +CREATE EXTENSION pg_trgm; diff --git a/sigmah/var/lib/tomcat8/webapps/sigmah/WEB-INF/classes/META-INF/persistence.xml b/sigmah/var/lib/tomcat8/webapps/sigmah/WEB-INF/classes/META-INF/persistence.xml new file mode 100644 index 0000000..4ad5a0f --- /dev/null +++ b/sigmah/var/lib/tomcat8/webapps/sigmah/WEB-INF/classes/META-INF/persistence.xml @@ -0,0 +1,39 @@ + + + + + org.hibernate.ejb.HibernatePersistence + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sigmah/var/lib/tomcat8/webapps/sigmah/WEB-INF/classes/sigmah.properties b/sigmah/var/lib/tomcat8/webapps/sigmah/WEB-INF/classes/sigmah.properties new file mode 100644 index 0000000..32fcb65 --- /dev/null +++ b/sigmah/var/lib/tomcat8/webapps/sigmah/WEB-INF/classes/sigmah.properties @@ -0,0 +1,40 @@ +# +# All Sigmah code is released under the GNU General Public License v3 +# See COPYRIGHT.txt and LICENSE.txt. +# + + + +# -- +# FILES STORAGE +# -- + +# Root directory name where files are stored. +files.repository.name=/srv/sigmah/files + +# Root directory name where backup archives are stored. +archives.repository.name=/srv/sigmah/archives/ + +#Maximum size of the uploaded files (bytes) +files.upload.maxSize=20971520 + +# -- +# MAILS +# -- + +mail.hostname=localhost +mail.port=25 +mail.from.address=sigmah@spotter.ngo +mail.from.name=Sigmah +# Authentication (leave empty if no authentication is required). +mail.auth.username= +mail.auth.password= +mail.encoding=UTF-8 +mail.contentType=text/html + +mail.support.to=sigmah@spotter.ngo + +# -- +# MAPS API +# -- +maps.key=AIzaSyBvIF3D550tlpL6o1xRrDurGo-81VhHlOw