Skip to content
Snippets Groups Projects
Commit 57f16dae authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Remise en ordre de bataille (doc, docker, etc.) du projet.

parent be7ee581
No related branches found
No related tags found
No related merge requests found
###########################################################################################
#
# 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
# 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.
- 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).
......@@ -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
......@@ -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",
......
<?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' ) {
......
*local.php
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.
<?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,
],
];
DoctrineORMModule/
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
Listen 80
Listen 443
<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>
<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
[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
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'
<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') ?> &raquo;</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') ?> &raquo;</a></p>
</div>
<div class="span4">
<h2><?php echo $this->translate('Help &amp; 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') ?> &raquo;</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>
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]
......@@ -15,6 +14,3 @@ RewriteRule ^.*$ - [NC,L]
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment