From b4193e4a246684974ecc4c40a230a07d921c737f Mon Sep 17 00:00:00 2001 From: Robert Date: Fri, 2 Jun 2017 16:01:57 +0200 Subject: Merge branch 'master' of github.com:af83/stif-boiv --- install/README | 9 ++++ install/deploy-helper.sh | 102 ++++++++++++++++++++++++++++++++++++++ install/sidekiq-stif-boiv.service | 52 +++++++++++++++++++ install/stif-boiv-setup.sh | 84 +++++++++++++++++++++++++++++++ install/stif-boiv.conf | 38 ++++++++++++++ install/template-stif-boiv.sql | 11 ++++ 6 files changed, 296 insertions(+) create mode 100644 install/README create mode 100755 install/deploy-helper.sh create mode 100644 install/sidekiq-stif-boiv.service create mode 100755 install/stif-boiv-setup.sh create mode 100644 install/stif-boiv.conf create mode 100644 install/template-stif-boiv.sql (limited to 'install') diff --git a/install/README b/install/README new file mode 100644 index 000000000..9825e6575 --- /dev/null +++ b/install/README @@ -0,0 +1,9 @@ +Script d'initialisation de l'environnement logiciel pour accueillir le BOIV +Prérequis : debian 8 (Jessie) netinst + +Paramètres : exporter les variables d'environnements +DATABASE_HOST permet de régler l'hôte qui héberge la base de données +valeur par défaut : localhost + +Procédure : en tant qu'utilisateur root, exécuter la commande depuis le répertoire courrant +./stif-boiv-setup.sh diff --git a/install/deploy-helper.sh b/install/deploy-helper.sh new file mode 100755 index 000000000..487c4539c --- /dev/null +++ b/install/deploy-helper.sh @@ -0,0 +1,102 @@ +#!/bin/bash -e + +export BASEDIR=$PREFIX/var/www/stif-boiv + +export RUN_USER=www-data +export RUN_GROUP=src + +export SUDO="" + +function setup() { + mkdir -p $BASEDIR + mkdir -p $BASEDIR/releases $BASEDIR/shared + + $SUDO mkdir -p $PREFIX/etc/stif-boiv + ln -fs $PREFIX/etc/stif-boiv $BASEDIR/shared/config + + mkdir -p $BASEDIR/shared/config/environments + + mkdir -p $BASEDIR/shared/public + mkdir -p $BASEDIR/shared/public/uploads + mkdir -p $BASEDIR/shared/public/assets + + mkdir -p $BASEDIR/shared/tmp/uploads + + $SUDO chown $RUN_USER:$RUN_GROUP $BASEDIR/shared/public/uploads $BASEDIR/shared/tmp/uploads + + default_config +} + +function default_config() { + DATABASE_PASSWORD=${DATABASE_PASSWORD:-FIXME} + DATABASE_HOST=${DATABASE_HOST:-"localhost"} + + cd $BASEDIR/shared/config + + if [ ! -f secrets.yml ]; then + cat > secrets.yml < database.yml < /etc/apt/sources.list.d/bearstech.list < /etc/apt/sources.list.d/nodesource.list </dev/null 2>&1 && echo "Mot de passe correct" +./deploy-helper.sh setup + +echo "!!! Configuration intiale terminée. Vous pouvez maintenant déployer l'applicatif" diff --git a/install/stif-boiv.conf b/install/stif-boiv.conf new file mode 100644 index 000000000..6b2abe4eb --- /dev/null +++ b/install/stif-boiv.conf @@ -0,0 +1,38 @@ + + ServerName boiv.stif.info + + DocumentRoot /var/www/stif-boiv/current/public + + PassengerDefaultUser www-data + PassengerUserSwitching off + + PassengerRuby /usr/bin/ruby2.3 + RackEnv production + + ExpiresActive On + + ExpiresByType application/javascript "access plus 1 year" + ExpiresByType application/x-javascript "access plus 1 year" + ExpiresByType application/x-shockwave-flash "access plus 1 year" + ExpiresByType image/gif "access plus 1 year" + ExpiresByType image/ico "access plus 1 year" + ExpiresByType image/jpeg "access plus 1 year" + ExpiresByType image/jpg "access plus 1 year" + ExpiresByType image/png "access plus 1 year" + ExpiresByType image/vnd.microsoft.icon "access plus 1 year" + ExpiresByType image/x-icon "access plus 1 year" + ExpiresByType text/css "access plus 1 year" + ExpiresByType text/javascript "access plus 1 year" + ExpiresByType font/truetype "access plus 1 year" + ExpiresByType application/x-font-ttf "access plus 1 year" + + + AllowOverride None + Require all granted + + + + # Replace with correct policy + Require all denied + + diff --git a/install/template-stif-boiv.sql b/install/template-stif-boiv.sql new file mode 100644 index 000000000..4d4a19afe --- /dev/null +++ b/install/template-stif-boiv.sql @@ -0,0 +1,11 @@ +set ON_ERROR_STOP=on; + +CREATE SCHEMA shared_extensions; +GRANT ALL ON SCHEMA shared_extensions TO PUBLIC; +CREATE EXTENSION IF NOT EXISTS postgis WITH SCHEMA shared_extensions; +CREATE EXTENSION IF NOT EXISTS hstore WITH SCHEMA shared_extensions; + +UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template_stif_boiv'; + +VACUUM FULL FREEZE; + -- cgit v1.2.3