diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000000000000000000000000000000000000..0a58511c00195de96413aded0d51d11603496402
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,37 @@
+###########################################################################################
+#
+# Image pour le dev.
+#
+###########################################################################################
+
+FROM unicaen-dev-php7.0-apache
+
+LABEL maintainer="Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>"
+
+ENV APACHE_CONF_DIR=/etc/apache2 \
+ PHP_CONF_DIR=/etc/php/7.0
+
+## Installation de packages requis.
+RUN apt-get install -y \
+ sqlite3 \
+ php7.0-pdo-sqlite
+
+# Nettoyage
+RUN apt-get autoremove -y && apt-get clean && rm -rf /tmp/* /var/tmp/*
+
+# Symlink apache access and error logs to stdout/stderr so Docker logs shows them
+RUN ln -sf /dev/stdout /var/log/apache2/access.log
+RUN ln -sf /dev/stdout /var/log/apache2/other_vhosts_access.log
+RUN ln -sf /dev/stderr /var/log/apache2/error.log
+
+# Config PHP.
+ADD docker/php.conf ${PHP_CONF_DIR}/fpm/conf.d/webapp.ini
+
+# Configuration Apache et FPM
+ADD docker/apache-ports.conf ${APACHE_CONF_DIR}/ports.conf
+ADD docker/apache-site.conf ${APACHE_CONF_DIR}/sites-available/webapp.conf
+ADD docker/apache-site-ssl.conf ${APACHE_CONF_DIR}/sites-available/webapp-ssl.conf
+ADD docker/fpm/pool.d/app.conf ${PHP_CONF_DIR}/fpm/pool.d/webapp.conf
+
+RUN a2ensite webapp webapp-ssl && \
+ service php7.0-fpm reload
diff --git a/README.md b/README.md
index 4fcdf8d629cd1c98e9efe2e5f4ff8aa2d00bbd2d..d60a58e159304a8c9c588eaf7ad6ca60d97fdebf 100644
--- a/README.md
+++ b/README.md
@@ -1,17 +1,44 @@
# Squelette d'application Unicaen
+
+## Build et lancement du container Docker
+
+ $ docker-compose up --build -d
+
+## Installation des dépendances PHP :
+
+ $ docker-compose run skeleton-application composer install
+
+## Base données de démonstration
+
+Vérifiez que la base de données de démo existe dans le module 'Demo' :
+
+ $ docker-compose run skeleton-application sqlite3 module/Demo/data/db/demo.sqlite ".schema"
+
+Interrogez la table `user` pour vérifier la présence de l'utilisateur local `demo`, exemple :
+
+ $ docker-compose run skeleton-application sqlite3 module/Demo/data/db/demo.sqlite "select * from user;"
+
## Configuration du projet
- Renommez `config/autoload/local.php.dist` en `local.php`.
- A l'intérieur du fichier, remplacez false par true pour afficher tous les messages d'erreur.
-
-- Copiez dans votre dossier `config/autoload` les fichiers de configuration locaux et globaux
- de UnicaenApp, UnicaenAuth et UnicaenCode :
+
+- Copiez dans votre dossier `config/autoload` les fichiers de configuration locaux et globaux `.dist`
+ des bibliothèques utilisées sans leur extension `.dist` :
```bash
-cp vendor/unicaen/app/config/*.dist config/autoload/
-cp vendor/unicaen/auth/config/*.dist config/autoload/
-cp vendor/unicaen/code/config/*.dist config/autoload/
+cp vendor/unicaen/app/config/unicaen-app.global.php.dist config/autoload/unicaen-app.global.php
+cp vendor/unicaen/app/config/unicaen-app.local.php.dist config/autoload/unicaen-app.local.php
+cp vendor/unicaen/auth/config/unicaen-auth.global.php.dist config/autoload/unicaen-auth.global.php
+cp vendor/unicaen/auth/config/unicaen-auth.local.php.dist config/autoload/unicaen-auth.local.php
+cp vendor/unicaen/code/config/unicaen-code.global.php.dist config/autoload/unicaen-code.global.php
```
-- Reportez-vous aux docs des modules Personnalisez ces fichiers de configuration locaux et globaux selon vos besoins.
-
\ No newline at end of file
+- Le cas échéant, reportez-vous aux docs des modules concernés pour adapter ces fichiers de configuration à vos besoins :
+ - [unicaen/app](https://git.unicaen.fr/lib/unicaen/app)
+ - [unicaen/auth](https://git.unicaen.fr/lib/unicaen/auth)
+ - [unicaen/code](https://git.unicaen.fr/lib/unicaen/code)
+
+## Test de l'application
+
+Théoriquement, l'application devrait être accessible à l'adresse [htpps://localhost:8843](htpps://localhost:8843).
+Le port utilisé dépend des redirections configurées dans le fichier [docker-compose.yml](docker-compose.yml).
diff --git a/composer.json b/composer.json
index 20071d8cd92562922950d95172c7b6bc55987bd1..1aff7fd8aba4b5a6299d9469ac4469c3d87024be 100755
--- a/composer.json
+++ b/composer.json
@@ -17,5 +17,10 @@
"zendframework/zend-test": ">=2.3",
"phpunit/PHPUnit": ">=3.7",
"zendframework/zend-developer-tools": ">=1.0"
+ },
+ "scripts": {
+ "post-install-cmd": [
+ "mkdir -p data/DoctrineORMModule/Proxy ; chmod -R 777 data/DoctrineORMModule/Proxy"
+ ]
}
}
\ No newline at end of file
diff --git a/composer.lock b/composer.lock
index 25573c9c66b3345692608e1d4b030510bac63793..3a1d3742c615a436be665b49af61acc8bc759766 100644
--- a/composer.lock
+++ b/composer.lock
@@ -1522,7 +1522,7 @@
"source": {
"type": "git",
"url": "https://git.unicaen.fr/lib/unicaen/app.git",
- "reference": "bc1f9f3da92257804b0cb6b93a105933195a5a9b"
+ "reference": "fa7e14bbd80206ab70ec1327dfd4c5b9a01ccee2"
},
"require": {
"doctrine/doctrine-orm-module": ">=0.7",
@@ -1565,7 +1565,7 @@
]
},
"description": "Module de base des applications unicaen",
- "time": "2019-02-06T11:21:28+00:00"
+ "time": "2019-02-07T13:34:05+00:00"
},
{
"name": "unicaen/auth",
@@ -1573,7 +1573,7 @@
"source": {
"type": "git",
"url": "https://git.unicaen.fr/lib/unicaen/auth.git",
- "reference": "d80ab1b78e36470e66eb0b1839469121a2ca3cab"
+ "reference": "bd13ecebdc85fa069d291dbb622f989a18a84624"
},
"require": {
"jasig/phpcas": ">=1.3.3",
@@ -1596,7 +1596,7 @@
]
},
"description": "Module d'authentification pour les applications Unicaen",
- "time": "2019-02-06T13:20:50+00:00"
+ "time": "2019-02-07T14:26:43+00:00"
},
{
"name": "unicaen/bjy-authorize",
diff --git a/config/application.config.php b/config/application.config.php
index 71450e2f62c6f22677a94c28213a6bab184c8995..ff9e9024163f84618641b49d287ae99e68bbe447 100755
--- a/config/application.config.php
+++ b/config/application.config.php
@@ -1,10 +1,17 @@
<?php
$modules = [
+ 'ZfcBase',
+ 'DoctrineModule',
+ 'DoctrineORMModule',
+ 'ZfcUser',
+ 'ZfcUserDoctrineORM',
+ 'BjyAuthorize',
+ 'AssetManager',
+ 'UnicaenApp',
+ 'UnicaenAuth',
'Application',
- 'ZfcBase', 'DoctrineModule', 'DoctrineORMModule', 'ZfcUser', 'ZfcUserDoctrineORM',
- 'BjyAuthorize', 'AssetManager',
- 'UnicaenApp', 'UnicaenAuth',
+ 'Demo',
];
if ( 'development' == getenv('APPLICATION_ENV') ?: 'production' ) {
diff --git a/config/autoload/.gitignore b/config/autoload/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..8962df0ec5187cdaea79cbae2fafa9d2dafb2dba
--- /dev/null
+++ b/config/autoload/.gitignore
@@ -0,0 +1 @@
+*local.php
diff --git a/config/autoload/README.md b/config/autoload/README.md
deleted file mode 100755
index 4e504db024d85325fdc16f0c0d49d61a2649bcd2..0000000000000000000000000000000000000000
--- a/config/autoload/README.md
+++ /dev/null
@@ -1,8 +0,0 @@
-About this directory:
-=====================
-
-By default, this application is configured to load all configs in
-`./config/autoload/{,*.}{global,local}.php`. Doing this provides a
-location for a developer to drop in configuration override files provided by
-modules, as well as cleanly provide individual, application-wide config files
-for things like database connections, etc.
diff --git a/config/autoload/local.php.dist b/config/autoload/local.php.dist
old mode 100755
new mode 100644
index ebbe6fa2e64f851c0a5641fce963bad8c5ee343a..2a0cce12d2219e0191a4f372f83134006da8d347
--- a/config/autoload/local.php.dist
+++ b/config/autoload/local.php.dist
@@ -1,7 +1,7 @@
<?php
-return array(
- 'view_manager' => array(
- 'display_not_found_reason' => false,
- 'display_exceptions' => false,
- ),
-);
+return [
+ 'view_manager' => [
+ 'display_not_found_reason' => true,
+ 'display_exceptions' => true,
+ ],
+];
diff --git a/data/.gitignore b/data/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..ae8c28abc275267367968fe4b31d3a876b03ddb9
--- /dev/null
+++ b/data/.gitignore
@@ -0,0 +1 @@
+DoctrineORMModule/
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000000000000000000000000000000000000..fcc82bf96afab1314d24f8679fd6445062e6b69d
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,13 @@
+version: '2'
+
+services:
+ skeleton-application:
+ container_name: skeleton-application-container
+ build:
+ context: .
+ ports:
+ - "8880:80"
+ - "8843:443"
+ volumes:
+ - .:/var/www/webapp
+ working_dir: /var/www/webapp
diff --git a/docker/apache-ports.conf b/docker/apache-ports.conf
new file mode 100644
index 0000000000000000000000000000000000000000..24c3bb25553799a8d9cf668d90e81cb791b77047
--- /dev/null
+++ b/docker/apache-ports.conf
@@ -0,0 +1,2 @@
+Listen 80
+Listen 443
diff --git a/docker/apache-site-ssl.conf b/docker/apache-site-ssl.conf
new file mode 100644
index 0000000000000000000000000000000000000000..ca15061cbb1334f36db1f7897cf3852f4aa6debd
--- /dev/null
+++ b/docker/apache-site-ssl.conf
@@ -0,0 +1,30 @@
+<VirtualHost *:443>
+ ServerName localhost
+ DocumentRoot /var/www/webapp/public
+
+ SetEnv APPLICATION_ENV "development"
+
+ RewriteEngine On
+
+ <Directory /var/www/webapp/public>
+ DirectoryIndex index.php
+ AllowOverride All
+ Require all granted
+ </Directory>
+
+ <IfModule proxy_fcgi_module>
+ <FilesMatch ".+\.ph(ar|p|tml)$">
+ SetHandler "proxy:unix:/var/run/php7.0-fpm-webapp.sock|fcgi://localhost/"
+ </FilesMatch>
+ </IfModule>
+
+ SSLEngine on
+ SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
+ SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
+
+ Header always set Strict-Transport-Security "max-age=15768000; includeSubdomains;"
+
+ ErrorLog ${APACHE_LOG_DIR}/error.log
+ CustomLog ${APACHE_LOG_DIR}/access.log combined
+ #LogLevel debug
+</VirtualHost>
diff --git a/docker/apache-site.conf b/docker/apache-site.conf
new file mode 100644
index 0000000000000000000000000000000000000000..410da616cdf4c5f35e9836a0c0f05362f28bf165
--- /dev/null
+++ b/docker/apache-site.conf
@@ -0,0 +1,13 @@
+<VirtualHost *:80>
+ ServerName localhost
+ DocumentRoot /var/www/webapp/public
+
+ RewriteEngine On
+
+ Header always set Strict-Transport-Security "max-age=15768000; includeSubdomains;"
+
+ ### Redirection en HTTPS
+ RewriteCond %{SERVER_PORT} !^443$
+ RewriteRule ^/(.*) https://%{SERVER_NAME}:443/$1 [L,R]
+
+</VirtualHost>
\ No newline at end of file
diff --git a/docker/fpm/pool.d/app.conf b/docker/fpm/pool.d/app.conf
new file mode 100644
index 0000000000000000000000000000000000000000..33ec134e1adb80a695e3a6e2dfb75f9c15f7e1cc
--- /dev/null
+++ b/docker/fpm/pool.d/app.conf
@@ -0,0 +1,24 @@
+[webapp]
+
+user = www-data
+group = www-data
+
+listen = /var/run/php7.0-fpm-webapp.sock
+listen.owner = www-data
+listen.group = www-data
+
+; mandatory values
+; Soit:
+; pm = dynamic
+; pm.max_children = 5
+; pm.start_servers = 2
+; pm.min_spare_servers = 1
+; pm.max_spare_servers = 3
+; Soit:
+pm = ondemand
+pm.max_children = 35
+pm.process_idle_timeout = 10s
+pm.max_requests = 500
+
+request_slowlog_timeout = 30
+slowlog = /var/log/php5-fpm.slow.log
diff --git a/docker/php.conf b/docker/php.conf
new file mode 100644
index 0000000000000000000000000000000000000000..e2c35fd3b81c318085c210a379ba098954735c3c
--- /dev/null
+++ b/docker/php.conf
@@ -0,0 +1,30 @@
+date.timezone = Europe/Paris
+
+short_open_tag = Off
+expose_php = Off
+
+log_errors = On
+display_startup_errors = On
+display_errors = On
+error_reporting = E_ALL & ~E_DEPRECATED & ~E_NOTICE
+
+max_execution_time = 120
+
+# NB: ne peut-être supérieur au memory_limit du php.ini
+memory_limit = 256M
+
+# NB: post_max_size > upload_max_filesize
+upload_max_filesize = 51M
+post_max_size = 52M
+
+opcache.enable = 0
+
+xdebug.remote_enable = 1
+xdebug.remote_connect_back = 1
+xdebug.profiler_enable_trigger = 1
+
+xdebug.collect_params = 2
+xdebug.var_display_max_children = 1024
+xdebug.var_display_max_data = -1
+xdebug.max_nesting_level = 256
+# Attention: trop diminuer 'max_nesting_level' peut causer une erreur 'Maximum function nesting level of x reached'
diff --git a/module/Application/view/application/index/index.phtml b/module/Application/view/application/index/index.phtml
index 3ead9214a3a0b434e494d370535910e5bfd59efb..ef9738b278aaaf6320bdae9bfce37f78dd4f099a 100755
--- a/module/Application/view/application/index/index.phtml
+++ b/module/Application/view/application/index/index.phtml
@@ -1,25 +1,19 @@
-<div class="hero-unit">
+<div class="jumbotron">
<h1><?php echo sprintf($this->translate("Bienvenue dans le squelette d'application Unicaen")) ?></h1>
- <p><?php echo sprintf($this->translate("Félicitations! Vous avez insallé avec succès le squelette d'application Unicaen propulsé par %sZend Framework 2%s. La version du framework utilisée est la %s."), '<a href="https://github.com/zendframework/ZendSkeletonApplication" target="_blank">', '</a>', \Zend\Version\Version::VERSION) ?></p>
- <p><a class="btn btn-success btn-large" href="<?php echo $this->url('zfcuser/login') ?>"><?php echo $this->translate('Connectez-vous...') ?></a></p>
-</div>
-
-<div class="row">
- <div class="span4">
- <h2><?php echo $this->translate('Follow Development') ?></h2>
- <p><?php echo sprintf($this->translate('Zend Framework 2 is under active development. If you are interested in following the development of ZF2, there is a special ZF2 portal on the official Zend Framework website which provides links to the ZF2 %swiki%s, %sdev blog%s, %sissue tracker%s, and much more. This is a great resource for staying up to date with the latest developments!'), '<a href="http://framework.zend.com/wiki/display/ZFDEV2/Home">', '</a>', '<a href="http://framework.zend.com/zf2/blog">', '</a>', '<a href="https://github.com/zendframework/zf2/issues">', '</a>') ?></p>
- <p><a class="btn btn-success" href="http://framework.zend.com" target="_blank"><?php echo $this->translate('ZF2 Development Portal') ?> »</a></p>
- </div>
-
- <div class="span4">
- <h2><?php echo $this->translate('Discover Modules') ?></h2>
- <p><?php echo sprintf($this->translate('The community is working on developing a community site to serve as a repository and gallery for ZF2 modules. The project is available %son GitHub%s. The site is currently live and currently contains a list of some of the modules already available for ZF2.'), '<a href="https://github.com/zendframework/modules.zendframework.com">', '</a>') ?></p>
- <p><a class="btn btn-success" href="http://modules.zendframework.com/" target="_blank"><?php echo $this->translate('Explore ZF2 Modules') ?> »</a></p>
- </div>
-
- <div class="span4">
- <h2><?php echo $this->translate('Help & Support') ?></h2>
- <p><?php echo sprintf($this->translate('If you need any help or support while developing with ZF2, you may reach us via IRC: %s#zftalk on Freenode%s. We\'d love to hear any questions or feedback you may have regarding the beta releases. Alternatively, you may subscribe and post questions to the %smailing lists%s.'), '<a href="irc://irc.freenode.net/zftalk">', '</a>', '<a href="http://framework.zend.com/wiki/display/ZFDEV/Mailing+Lists">', '</a>') ?></p>
- <p><a class="btn btn-success" href="http://webchat.freenode.net?channels=zftalk" target="_blank"><?php echo $this->translate('Ping us on IRC') ?> »</a></p>
- </div>
+ <p>
+ Félicitations! Vous avez insallé avec succès le squelette d'application Unicaen. <br>
+ La version du framework utilisée est la <?php echo \Zend\Version\Version::VERSION ?>
+ </p>
+ <?php if (!$this->identity()): ?>
+ <p class="text-danger">
+ <strong>
+ <?php echo $this->translate("Vous n'êtes pas connecté-e."); ?>
+ </strong>
+ </p>
+ <p>
+ <a class="btn btn-success btn-lg" href="<?php echo $this->url('zfcuser/login') ?>">
+ <?php echo $this->translate('Connectez-vous...') ?>
+ </a>
+ </p>
+ <?php endif ?>
</div>
diff --git a/public/.htaccess b/public/.htaccess
index d86900190b4e527aa911e5f38200b569b2e919db..ec20b4840147f946ed7718bcbc386f8017a2407a 100755
--- a/public/.htaccess
+++ b/public/.htaccess
@@ -1,20 +1,16 @@
RewriteEngine On
-RewriteBase /unicaen-skeleton-application
# The following rule tells Apache that if the requested filename
# exists, simply serve it.
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
-# The following rewrites all other queries to index.php. The
+# The following rewrites all other queries to index.php. The
# condition ensures that if you are using Apache aliases to do
-# mass virtual hosting, the base path will be prepended to
+# mass virtual hosting, the base path will be prepended to
# allow proper resolution of the index.php file; it will work
-# in non-aliased environments as well, providing a safe, one-size
+# in non-aliased environments as well, providing a safe, one-size
# fits all solution.
RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]
-
-# development par défaut, à rechanger ensuite
-SetEnv APPLICATION_ENV "development"
\ No newline at end of file