Commit 9c324e8a authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

- Déploiement DOCKER (version dev)

parent 1911b4d0
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
build
docker-compose.yml
 No newline at end of file

dockerize/dev/build.sh

0 → 100644
+116 −0
Original line number Diff line number Diff line
#!/bin/bash

################################################################################
currentPath=$(pwd)

#if [[ -z $1 ]]
#then
#    config_location=$1
#else
#    config_location="$currentPath/config"
#fi
config_location="$currentPath/config"


dir_oscar_root=$(realpath "$currentPath/../../")
dir_build=$(realpath "$currentPath/build")
url_composer="https://getcomposer.org/download/latest-1.x/composer.phar"
config_file="$config_location/config.ini"

echo "Oscar used : $dir_oscar_root"
echo "Config dir : $config_location"
echo "Config file : $config_file"
echo "Docker content : $dir_build"



# load configuration
echo "# Load config from $config_file"
source <(grep = "$config_file")

# Récap
echo " - Proxy : $proxy"
echo " - GIT : $git_remote (branch: $git_branch)"
echo " - Dest : $destination"


read -p "Continuer (Ctrl+c pour annuler )?" $y

# Création des dossiers
mkdir -p $dir_build/documents/activity
mkdir -p $dir_build/documents/public
mkdir -p $dir_build/database
mkdir -p $dir_build/mails

echo "cd $dir_oscar_root"
cd $dir_oscar_root


export http_proxy=$proxy
export https_proxy=$proxy

if [[ ! -f 'composer.phar' ]]
then
  echo "Récupération de composer 1 depuis $url_composer"
  wget $url_composer
  # php composer.phar install
fi



file_oscar_local="$dir_oscar_root/config/autoload/local.php"

# Copie des configuration
if [[ ! -f $file_oscar_local ]]
then
  echo "Copie de $config_location/local.php vers '$file_oscar_local'"
  cp $config_location/local.php file_oscar_local
fi

file_oscar_worker="$dir_oscar_root/config/oscarworker.service"
if [[ ! -f $file_oscar_worker ]]
then
  echo "Copie de $config_location/oscarworker.service '$file_oscar_worker'"
  cp $config_location/oscarworker.service $file_oscar_worker
fi

file_oscar_unicaenauth="$dir_oscar_root/config/autoload/unicaen-auth.local.php"
if [[ ! -f $file_oscar_unicaenauth ]]
then
  echo "Copie de $config_location/unicaen-auth.local.php '$file_oscar_unicaenauth'"
  cp $config_location/unicaen-auth.local.php $file_oscar_unicaenauth
fi

file_oscar_unicaenapp="$dir_oscar_root/config/autoload/unicaen-app.local.php"
if [[ ! -f $file_oscar_unicaenapp ]]
then
  echo "Copie de $config_location/unicaen-app.local.php '$file_oscar_unicaenapp'"
  cp $config_location/unicaen-app.local.php $file_oscar_unicaenapp
fi

file_oscar_editable="$dir_oscar_root/config/autoload/oscar-editable.yml"
if [[ ! -f $file_oscar_editable ]]
then
  echo "Création du fichier '$file_oscar_editable' (chmod 777)"
  touch "$file_oscar_editable"
  chmod 777 "$file_oscar_editable"
fi

cd $currentPath

echo "# Création du docker-compose"
cp docker-compose.dist.yml docker-compose.yml

sed -i "s#PARAM_OSCAR_PATH#$dir_oscar_root#g" docker-compose.yml
sed -i "s#PARAM_DATABASE_PATH#$dir_build/database#g" docker-compose.yml
sed -i "s#PARAM_PROXY#$proxy#g" docker-compose.yml

cmd="docker-compose build"
echo "EXEC $cmd"

$cmd

echo "DONE"
echo " - Launch: docker-compose up -d"
echo " - Go to oscar app: docker-compose oscar_dev_macclane exec sh"
+6 −0
Original line number Diff line number Diff line
[Locations]
proxy=http://proxy.unicaen.fr:3128

[Git]
git_remote=git@git.unicaen.fr:open-source/oscar.git
git_branch=macclane
+198 −0
Original line number Diff line number Diff line
<?php
return array(
    'view_manager' => array(
        'display_not_found_reason' => getenv('APPLICATION_ENV') == 'development',
        'display_exceptions'       => getenv('APPLICATION_ENV') == 'development',
    ),

    // Oscar
    'oscar' => [
        // Oscar Live
        'socket' => false,

        // gearman
        'gearman-job-server-host'=>'oscar_dev_gearman_macclane',

        ////////////////////////////////////////////////////////////////////////
        // ! EXPERIMENTAL !
        'generated-documents' => [],

        // Répartition horaire
        'declarationsDurations' => [
            'dayLength'     => [
                'value' => 7.5,
                'max' => 10.0,
                'min' => 5.0,
                'days' => ['1' => 8.0, '2' => 8.0, '3' => 8.0, '4' => 8.0, '5' => 8.0, '6' => 0.0, '7' => 0.0]
            ],

            'weekLength'     => [
                'value' => 37.0,
                'max' => 44.0,
                'min' => 20.0,
                'userChange' => false
            ],

            'monthLength' => [
                'value' => 144.0,
                'max'   => 184.0,
                'min' => 80.0,
                'userChange' => false
            ],

            'weekExceptions' => [
                '3'         => 3.0,
            ],
        ],

        // Exemples de modèle horaire
        'scheduleModeles' => [],

        // Désactive / Active l'option d'importation des calendriers
        'importEnable' => false,


        ////////////////////////////////////////////////////////////////////////
        //
        // PATHS  (Optionnel)
        //
        // Emplacements utilisés par oscar pour stoquer des fichiers.
        // Ces emplacements doivent être accessibles et ouvert en écriture.
        //
        ////////////////////////////////////////////////////////////////////////
        'paths' => [
            // Emplacement où sont stoqués les documents Oscar
            'document_oscar' => realpath(__DIR__) . '/../../../documents/activity/',

            // Emplacement où sont stoqués les documents administratifs Oscar
            'document_admin_oscar' => realpath(__DIR__) . '/../../../documents/public/',

            // Modèle de feuille de temps
            'timesheet_modele' => realpath(__DIR__.'/../../data/timesheet_model.xls'),
        ],

         // Système de recherche
        'strategy' => [
            'activity' => [
                'search_engine' => [
                    // Elasticsearch
                    'class' => \Oscar\Strategy\Search\ActivityElasticSearch::class,
                    'params' => [['oscar_dev_elasticsearch_macclane:9200']]
                ]
            ],
            'person' => [
                'search_engine' => [
                    // Elasticsearch
                    'class' => \Oscar\Strategy\Search\PersonElasticSearch::class,
                    'params' => [['oscar_dev_elasticsearch_macclane:9200']]
                ]
            ],
            'organization' => [
                'search_engine' => [
                    // Elasticsearch
                    'class' => \Oscar\Strategy\Search\OrganizationElasticSearch::class,
                    'params' => [['oscar_dev_elasticsearch_macclane:9200']]
                ]
            ]
        ],

        ////////////////////////////////////////////////////////////////////////
        //
        // CONNECTORS (Optionnel)
        //
        // Les connecteurs sont les points d'entrées pour les données utilisées
        // dans Oscar.
        // Pour le moment ne sont gérés que :
        // - Person (participants aux activités de recherche)
        // - Organization (Structures/Organisations impliquées dans les activités)
        //
        ////////////////////////////////////////////////////////////////////////
        'connectors' => [
            // Connection au tiers d'où seront obtenu les structures
            'organization' => [],
            'person' => []
        ],

        /*** Notifications ***/
        'notifications' => [
            // L'utilisateur peut configurer la fréquence des notifications
            'override' => false,

            // Envoi automatique
            'fixed' => ['Mer8', 'Lun20'] // ex: IMPOSE une notification chaque mercredis à 8 heure et Lundis à 20 heures
        ],

        /**********************************/
        /*** Qualification des dépenses ***/

        // Plan comptable général par défaut (standard)
        // Utilisé pour initialiser le plan comptable (modifiable ensuite
        // vie l'interface d'administration)
        'spenttypesource' => dirname(__DIR__).'/../install/plan-comptable.csv',

        // Masses
        'spenttypeannexes' => [
            "F" => "Fonctionnement",
            "I" => "Investissement",
            "P" => "Personnel"
        ],
        /**********************************/


        /*** Système d'envoi des mails ***/
        // Utilisé pour la génération des URLs dans les mails en ligne de commande
        'urlAbsolute' => 'http://localhost:8080',

        'mailer' => [
            'transport' => [
                'type' => 'file',
                'path' => realpath(__DIR__.'/../../../mails'),
            ],

            // Expéditeur
            'from' => [ 'oscar-bot@unicaen.fr' => 'Oscar Bot'],

            // Envoi d'une copy (Non effectif)
            'copy' => ['stephane.bouvry@unicaen.fr'],

            // Envoi activé
            'send' => true,
            'send_false_exception' => [],

            // Préfixe ajouté dans les sujets
            'subjectPrefix' => '[OSCAR DEV] ',

            // Emplacement du fichier de layout pour les mails
            'template' => realpath(__DIR__.'/../../module/Oscar/view/mail.phtml'),

            // Mails utilisé pour les tests / rapport
            'administrators' => ['stephane.bouvry@unicaen.fr', 'jacksay14@gmail.com']
        ]
    ],

    // Accès BDD
    'doctrine' => array(
        'connection' => array(
            'orm_default' => array(
                // Postgresql
                'driverClass' => '\Doctrine\DBAL\Driver\PDOPgSql\Driver',
                ////////////////////////////////////////////////////////////////

                'doctrine_type_mappings' => array(
                    'enum' => 'string'
                ),

                ////////////////////////////////////////////////////// CONNEXION
                // Exemple
                'params' => array(
                    'host'=>'oscar_dev_postgresql_macclane',
                    'port'     => '5432',
                    'user'     => 'oscar',
                    'password' => 'azerty',
                    'dbname'   => 'oscar_dev',
                    'charset'  => 'utf8'
                ),
            ),
        ),
    ),
);
+21 −0
Original line number Diff line number Diff line
[Unit]
Description=OSCAR Worker
After=gearmand.service
StartLimitIntervalSec=60
StartLimitBurst=3

[Install]
WantedBy=multi-user.target

[Service]
Restart=on-failure
Type=simple
ExecStop=/bin/kill -s TERM $MAINPID
Restart=always
RestartSec=30

# Mettre le chemin complet vers bin/oscar-worker.php
ExecStart=/usr/bin/php /var/OscarApp/bin/oscar-worker.php

# Root
User=root
 No newline at end of file
Loading