Add GNU Health demo database, closes #164

This commit is contained in:
Disassembler 2017-12-04 08:57:59 +01:00
parent ca7e455db5
commit c0389bba85
3 changed files with 13 additions and 1 deletions

View File

@ -175,6 +175,7 @@
<ul>
<li><strong>Login:</strong> <span class="login"></span></li>
<li><strong>Heslo:</strong> <span class="password"></span></li>
<li><strong>Heslo k demu:</strong> <span class="demopassword">gnusolidario</span></li>
</ul>
</div>

View File

@ -29,7 +29,7 @@ patch -d /srv/gnuhealth/sao -p0 <${SOURCE_DIR}/gnuhealth/gnuhealth-sao-dependenc
virtualenv --system-site-packages -p /usr/bin/python3 /srv/gnuhealth
echo '. /srv/gnuhealth/bin/activate' >/srv/gnuhealth/.bash_profile
# Create database
# Create databases
export GNUHEALTH_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '/+=')
envsubst <${SOURCE_DIR}/gnuhealth/tmp/gnuhealth-createdb.sql >/tmp/gnuhealth-createdb.sql
sudo -u postgres psql -f /tmp/gnuhealth-createdb.sql
@ -55,6 +55,13 @@ echo ${GNUHEALTH_ADMIN_PWD} >/srv/gnuhealth/.adminpwd
sudo -u gnuhealth -i TRYTONPASSFILE=/srv/gnuhealth/.adminpwd /srv/gnuhealth/gnuhealth/tryton/server/trytond-4.2.7/bin/trytond-admin -d gnuhealth --all -v
rm -f /srv/gnuhealth/.adminpwd
# Populate demo database
wget http://health.gnu.org/downloads/postgres_dumps/gnuhealth-3.2rc1.sql.gz -O /tmp/gnuhealth_demo.sql.gz
export PGPASSWORD=${GNUHEALTH_PWD}
zcat /tmp/gnuhealth_demo.sql.gz | psql gnuhealth_demo gnuhealth
unset PGPASSWORD
rm -f /tmp/gnuhealth_demo.sql.gz
# Configure GNU Health service
cp ${SOURCE_DIR}/gnuhealth/lib/systemd/system/gnuhealth.service /lib/systemd/system/gnuhealth.service
systemctl daemon-reload

View File

@ -2,3 +2,7 @@ CREATE ROLE gnuhealth NOSUPERUSER NOCREATEDB NOCREATEROLE NOINHERIT LOGIN ENCRYP
CREATE DATABASE gnuhealth;
REVOKE ALL ON DATABASE gnuhealth FROM public;
ALTER DATABASE gnuhealth OWNER TO gnuhealth;
CREATE DATABASE gnuhealth_demo;
REVOKE ALL ON DATABASE gnuhealth_demo FROM public;
ALTER DATABASE gnuhealth_demo OWNER TO gnuhealth;