Introduce Sigmah installation script, closes #144
This commit is contained in:
parent
2036f581ad
commit
5eee68077e
@ -18,6 +18,7 @@ ${SOURCE_DIR}/pandora.sh
|
|||||||
${SOURCE_DIR}/sahana.sh
|
${SOURCE_DIR}/sahana.sh
|
||||||
${SOURCE_DIR}/sambro.sh
|
${SOURCE_DIR}/sambro.sh
|
||||||
${SOURCE_DIR}/seeddms.sh
|
${SOURCE_DIR}/seeddms.sh
|
||||||
|
${SOURCE_DIR}/sigmah.sh
|
||||||
${SOURCE_DIR}/ushahidi.sh
|
${SOURCE_DIR}/ushahidi.sh
|
||||||
|
|
||||||
# Perform cleanup only if DEBUG environment variable is not set
|
# Perform cleanup only if DEBUG environment variable is not set
|
||||||
|
BIN
basic/srv/portal/img/Sigmah.png
Normal file
BIN
basic/srv/portal/img/Sigmah.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
@ -191,6 +191,15 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="c" id="sigmah">
|
||||||
|
<h2><a href="#"><img src="img/Sigmah.png" alt="Sigmah" title="Sigmah">Sigmah</a></h2>
|
||||||
|
<p>Rozpočtování získávání finančních prostředků.</p>
|
||||||
|
<ul>
|
||||||
|
<li><strong>Login:</strong> <span class="login"></span></li>
|
||||||
|
<li><strong>Heslo:</strong> <span class="password"></span></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="c" id="diaspora">
|
<div class="c" id="diaspora">
|
||||||
<h2><a href="#"><img src="img/Diaspora.png" alt="diaspora*" title="diaspora*">diaspora*</a></h2>
|
<h2><a href="#"><img src="img/Diaspora.png" alt="diaspora*" title="diaspora*">diaspora*</a></h2>
|
||||||
<p>Autonomní sociání síť s možností propojení do cizích sociálních sítí.</p>
|
<p>Autonomní sociání síť s možností propojení do cizích sociálních sítí.</p>
|
||||||
|
59
sigmah.sh
Executable file
59
sigmah.sh
Executable file
@ -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
|
11
sigmah/etc/nginx/apps-available/sigmah
Normal file
11
sigmah/etc/nginx/apps-available/sigmah
Normal file
@ -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;
|
||||||
|
}
|
6
sigmah/tmp/sigmah-createdb.sql
Normal file
6
sigmah/tmp/sigmah-createdb.sql
Normal file
@ -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;
|
@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0">
|
||||||
|
|
||||||
|
<persistence-unit name="sigmah-dev" transaction-type="RESOURCE_LOCAL">
|
||||||
|
<provider>org.hibernate.ejb.HibernatePersistence</provider>
|
||||||
|
<properties>
|
||||||
|
|
||||||
|
<property name="hibernate.archive.autodetection" value="class" />
|
||||||
|
|
||||||
|
<!-- Loaded from pom configuration. -->
|
||||||
|
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
|
||||||
|
<property name="hibernate.connection.driver_class" value="org.postgresql.Driver" />
|
||||||
|
<property name="hibernate.connection.username" value="sigmah" />
|
||||||
|
<property name="hibernate.connection.password" value="${SIGMAH_PWD}" />
|
||||||
|
<property name="hibernate.connection.url" value="jdbc:postgresql://localhost:5432/sigmah" />
|
||||||
|
<property name="hibernate.show_sql" value="false" />
|
||||||
|
<property name="hibernate.format_sql" value="false" />
|
||||||
|
|
||||||
|
<!-- validate | update | create | create-drop | {empty} -->
|
||||||
|
<property name="hibernate.hbm2ddl.auto" value="update" />
|
||||||
|
|
||||||
|
<!-- Important : connection pool. -->
|
||||||
|
<property name="hibernate.connection.provider_class" value="org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider" />
|
||||||
|
|
||||||
|
<!-- Connection pool configuration. -->
|
||||||
|
<!-- https://community.jboss.org/wiki/HowToConfigureTheC3P0ConnectionPool -->
|
||||||
|
<!-- http://www.mchange.com/projects/c3p0/ -->
|
||||||
|
<property name="hibernate.c3p0.min_size" value="1" />
|
||||||
|
<property name="hibernate.c3p0.max_size" value="15" />
|
||||||
|
<property name="hibernate.c3p0.max_statements" value="100" />
|
||||||
|
<property name="hibernate.c3p0.timeout" value="0" />
|
||||||
|
<property name="hibernate.c3p0.acquire_increment" value="1" />
|
||||||
|
<property name="hibernate.c3p0.numHelperThreads" value="6" />
|
||||||
|
|
||||||
|
</properties>
|
||||||
|
</persistence-unit>
|
||||||
|
|
||||||
|
</persistence>
|
@ -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
|
Loading…
Reference in New Issue
Block a user