Commit 012be4b6 authored by Matthieu FAURE's avatar Matthieu FAURE
Browse files

Comptoir v2.4.10

parents 7bbe0563 6b5fd028
Pipeline #4168 passed with stage
in 7 minutes and 26 seconds
......@@ -14,6 +14,14 @@ et le projet suit [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
### Fixed
### Security
## [2.4.10](https://gitlab.adullact.net/Comptoir/Comptoir-srv/tags/v2.4.10) - 2019-04-08
### Added
Pour développeurs :
* [#646](https://gitlab.adullact.net/Comptoir/Comptoir-srv/issues/646) Vagrant: choix d'installer en mode debug ou production
## [2.4.10-rc.1](https://gitlab.adullact.net/Comptoir/Comptoir-srv/tags/v2.4.10-rc.1) - 2019-03-27
### Added
......@@ -38,7 +46,7 @@ Pour développeurs :
### Fixed
* [#570](https://gitlab.adullact.net/Comptoir/Comptoir-srv/issues/570) Rétablissement des tri et filtre des utilisateurs (suite à la création de la rubrique Prestataire dans la barre de navigation)
* [#570](https://gitlab.adullact.net/Comptoir/Comptoir-srv/issues/570) Rétablissement des tris et filtre des utilisateurs (suite à la création de la rubrique Prestataire dans la barre de navigation)
* [#609](https://gitlab.adullact.net/Comptoir/Comptoir-srv/issues/609) Mot de passe perdu : Correction de l'envoi du mauvais formulaire qui demandait l'ancien mot de passe.
* [#587](https://gitlab.adullact.net/Comptoir/Comptoir-srv/issues/587) Correction de l'erreur affichée lors de la déclaration d'un compte utilisateur comme utilisateur d'un logiciel
......
......@@ -2,7 +2,7 @@
## You need a db test
as user `superdupont`, do :
as user `superdupont`, do:
```shell
sudo -u postgres psql
......@@ -10,7 +10,7 @@ CREATE DATABASE tests WITH TEMPLATE = template0;
ALTER DATABASE tests OWNER TO comptoir;
\q
```
As any user do :
As any user do:
```shell
sudo -u postgres psql -d tests -f COMPTOIR_DB_For_Tests.sql
......@@ -21,7 +21,7 @@ sudo -u postgres psql -d tests -f COMPTOIR_DB_For_Tests.sql
(It should already be installed on Le comptoir.)
As user `root`, do :
As user `root`, do:
```shell
php composer.phar require --dev phpunit/phpunit:"^5.7|
......@@ -30,15 +30,24 @@ See more on : https://book.cakephp.org/3.0/fr/development/testing.html
## install Xdebug
As any user, do :
As any user, do:
```shell
sudo apt-get install -y php-xdebug
```
## Set test database in conifg/app.php
By default in the `Datasources` section, `test` is commented. Be sure to decommented that part.
If it's commented you can run as any user:
```
sudo -u comptoir sed -i -e "s/\/\/COMPTOIR-DEBUG//" "${COMPTOIR_DIR}/config/app.php"
```
## Run Unit tests
As any user, do :
As any user, do:
```shell
vendor/bin/phpunit --configuration phpunit.xml --coverage-text
......
......@@ -284,7 +284,7 @@ and
],
```
See https://book.cakephp.org/3.0/en/development/testing.html
See <https://book.cakephp.org/3.0/en/development/testing.html>
## COMPTOIR.PHP Configure
......@@ -448,7 +448,7 @@ sudo chown -R www-data:comptoir /home/comptoir/Comptoir-srv/webroot/img/files
```
### Load Debug kit for Comptoir // Useless? https://book.cakephp.org/3.0/en/debug-kit.html
### Load Debug kit for Comptoir // Useless? <https://book.cakephp.org/3.0/en/debug-kit.html>
As user `superdupont`, do:
......
# Vagrant: Vagrant_for_Comptoir_local
This Vm is used when developing Comptoir.
By default we set the host name to `comptoir-vagrant`
It uses the source code place on the developer's host.
It based on the source code from the developer's host.
Run it to show modifications you worked on or to play tests.
## Unit Tests
In the Vagrant/../bootstrap.sh file.
If you want to play unit test make sure you set the `DEBUG` variable on 'true' to install a Comptoir capable to run
unit tests.
You have to rebuild the VM to test each modification you do.
......@@ -15,6 +15,9 @@ Vagrant.configure("2") do |config|
# boxes at https://vagrantcloud.com/search.
config.vm.box = "ubuntu/xenial64"
# Host name of the Vm
config.vm.hostname = "comptoir-vagrant"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
......@@ -71,6 +74,8 @@ Vagrant.configure("2") do |config|
# SHELL
config.vm.provision :shell, path: "bootstrap.sh"
# Synchronizes the folder containing the Comptoir project on the vm
# Some directories must be exclude
config.vm.synced_folder "../../", "/home/comptoir/Comptoir-srv", type: "rsync",
rsync__exclude: [".git/", ".idea/", "logs/", "tmp/", "vendor/", "venv/", "Vagrant/"],
rsync__args: ["--verbose", "--rsync-path='sudo rsync'", "--archive", "--delete"]
......
......@@ -3,6 +3,9 @@
# stop at first error
set -e
# If you set DEBUG on true, you will install all the environment to allow unit tests to play.
declare DEBUG=true
# Variables
declare DEBIAN_FRONTEND noninteractive
### COMPTOIR_HOME ==> Absolute directory containing the Comptoir-srv, *without* trailing slash, eg "/home/comptoir"
......@@ -75,7 +78,7 @@ sudo -u comptoir mkdir -p "${COMPTOIR_DIR_DATASET}/config/SQL/" && cp "${COMPTOI
## OPTIONAL Installation Comptoir: set the COMPTOIR_VERSION to install an older version
echo "===== OPTIONAL Installation Comptoir"
if [ ! -z "${COMPTOIR_REVISION}" ]
if [[ ! -z "${COMPTOIR_REVISION}" ]]
then
cd "${COMPTOIR_DIR}"
sudo -u comptoir git checkout "${COMPTOIR_REVISION}"
......@@ -103,6 +106,33 @@ sudo "${COMPTOIR_DIR}/bin/COMPTOIR_create_DB_database_and_set_ownership.sh" -d "
echo "===== POSTGRESQL Create tables and procedures"
sudo -u comptoir "${COMPTOIR_DIR}/bin/COMPTOIR_create_DB_tables_and_procedures.sh" -d "${COMPTOIR_DIR}"
## PREREQUISITES for unitTest and debugKit
##
## 03.04.19: Running UnitTests erased the DB 'comptoir' which make impossible to run AcceptanceTest in a second time.
## If you want to run both (unit then accpetance), you must do it individually.
## Or you can run Acceptance BEFORE unitTest. See more on issue #648
########################################################################################################################
if [[ "${DEBUG}" ]]
then
### POSTGRESQL Create DB for UnitTests
echo "===== POSTGRESQL Create DB for Unit tests"
sudo -u postgres psql -c "CREATE DATABASE tests WITH TEMPLATE = template0;"
sudo -u postgres psql -c "ALTER DATABASE tests OWNER TO comptoir;"
sudo -u postgres psql -d tests -f "${COMPTOIR_DIR}/config/SQL/COMPTOIR_DB_For_Tests.sql"
echo "===== Install xdebug"
sudo apt-get install -y php-xdebug
### According to the config.vm.hostname setting in Vagrantfile
declare DB_TEST_HOST="comptoir-vagrant"
### POSTGRESQL Create DB for DebugKit
echo "===== POSTGRESQL Create DB for DebugKit"
sudo -u postgres psql -c "CREATE DATABASE debug_kit WITH TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'fr_FR.UTF-8' LC_CTYPE = 'fr_FR.UTF-8';"
sudo -u postgres psql -c "ALTER DATABASE debug_kit OWNER TO comptoir;"
fi
########################################################################################################################
## Composer install Comptoir
echo "===== Composer install Comptoir"
cd "${COMPTOIR_DIR}"
......@@ -113,7 +143,10 @@ sudo -u comptoir /usr/local/bin/composer --no-progress install
## APP.PHP Configure database credentials
echo "===== APP.PHP Configure database credentials"
sudo -u comptoir sed -i -e "s/\/\/COMPTOIR-DEBUG//" "${COMPTOIR_DIR}/config/app.php"
if [[ "${DEBUG}" ]]
then
sudo -u comptoir sed -i -e "s/\/\/COMPTOIR-DEBUG//" "${COMPTOIR_DIR}/config/app.php"
fi
sudo -u comptoir sed -i -e "s/__SALT__/somerandomsalt/" "${COMPTOIR_DIR}/config/app.php"
sudo -u comptoir sed -i -e "s/'php',/env('SESSION_DEFAULTS', 'php'),/" "${COMPTOIR_DIR}/config/app.php"
sudo -u comptoir sed -i -e "s/'host' => 'localhost',/'host' => 'smtp',/" "${COMPTOIR_DIR}/config/app.php"
......@@ -169,7 +202,7 @@ sudo service apache2 reload
## Puts the data files back in place
echo "===== DATA FILES back in place"
if [ ! -z "${COMPTOIR_REVISION}" ]
if [[ ! -z "${COMPTOIR_REVISION}" ]]
then
sudo -u comptoir mkdir -p "${COMPTOIR_DIR_DATASET}/tests/Datasets" && cp -r "${COMPTOIR_DIR_DATASET}/Dataset02" "${COMPTOIR_DIR}/tests/Datasets/"
sudo -u comptoir mkdir -p "${COMPTOIR_DIR}/bin/" && cp "${COMPTOIR_DIR_DATASET}/COMPTOIR_import_DB_data_AND_images.sh" "${COMPTOIR_DIR}/bin/"
......
<?php
/**
* Config/app.default.php
*
* @category Config/app.default
* @package Configappdefaultphp
* @author gauthier julie <julie.gauthier@adullact.org>
* @license https://spdx.org/licenses/AGPL-3.0-or-later.html Affero General Public License
*/
return [
/**
* Debug Level:
......@@ -63,7 +73,7 @@ return [
* You should treat it as extremely sensitive data.
*/
'Security' => [
'salt' => env('SECURITY_SALT','__SALT__'),
'salt' => env('SECURITY_SALT', '__SALT__'),
],
/**
......@@ -247,21 +257,39 @@ return [
//'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
],
// The "test" connection is used by PHPUnit (not DebugKit that uses SQLite)
//COMPTOIR-DEBUG 'test' => [
//COMPTOIR-DEBUG 'className' => 'Cake\Database\Connection',
//COMPTOIR-DEBUG 'driver' => 'Cake\Database\Driver\Postgres',
//COMPTOIR-DEBUG 'persistent' => false,
//COMPTOIR-DEBUG 'host' => 'postgres-test', // hostname is set in .gitlab-ci.yml file
//COMPTOIR-DEBUG 'username' => env('DB_USERNAME', 'comptoir'),
//COMPTOIR-DEBUG 'password' => env('DB_PASSWORD', 'comptoir'),
//COMPTOIR-DEBUG 'database' => env('DB_DATABASE', 'comptoir'),
//COMPTOIR-DEBUG 'encoding' => 'utf8',
//COMPTOIR-DEBUG 'timezone' => 'Europe/Paris',
//COMPTOIR-DEBUG 'cacheMetadata' => true,
//COMPTOIR-DEBUG 'quoteIdentifiers' => false,
//COMPTOIR-DEBUG 'log' => false,
//COMPTOIR-DEBUG //'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
//COMPTOIR-DEBUG ],
//COMPTOIR-DEBUG 'test' => [
//COMPTOIR-DEBUG 'className' => 'Cake\Database\Connection',
//COMPTOIR-DEBUG 'driver' => 'Cake\Database\Driver\Postgres',
//COMPTOIR-DEBUG 'persistent' => false,
//COMPTOIR-DEBUG //'host' => 'postgres-test', // For Docker: hostname is set in .gitlab-ci.yml file
//COMPTOIR-DEBUG 'host' => env('DB_TEST_HOST', 'localhost'),
//COMPTOIR-DEBUG 'username' => env('DB_USERNAME', 'comptoir'),
//COMPTOIR-DEBUG 'password' => env('DB_PASSWORD', 'comptoir'),
//COMPTOIR-DEBUG 'database' => env('DB_DATABASE', 'comptoir'),
//COMPTOIR-DEBUG 'encoding' => 'utf8',
//COMPTOIR-DEBUG 'timezone' => 'Europe/Paris',
//COMPTOIR-DEBUG 'cacheMetadata' => true,
//COMPTOIR-DEBUG 'quoteIdentifiers' => false,
//COMPTOIR-DEBUG 'log' => false,
//COMPTOIR-DEBUG //'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
//COMPTOIR-DEBUG ],
/**
* Configure logging to debug-kit
*/
//COMPTOIR-DEBUG 'debug_kit' => [
//COMPTOIR-DEBUG 'className' => 'Cake\Database\Connection',
//COMPTOIR-DEBUG 'driver' => 'Cake\Database\Driver\Postgres',
//COMPTOIR-DEBUG 'persistent' => false,
//COMPTOIR-DEBUG 'host' => 'localhost',
//COMPTOIR-DEBUG 'username' => 'comptoir',
//COMPTOIR-DEBUG 'password' => 'comptoir',
//COMPTOIR-DEBUG 'database' => 'debug_kit',
//COMPTOIR-DEBUG 'encoding' => 'utf8',
//COMPTOIR-DEBUG 'timezone' => 'Europe/Paris',
//COMPTOIR-DEBUG 'cacheMetadata' => true,
//COMPTOIR-DEBUG 'quoteIdentifiers' => false,
//COMPTOIR-DEBUG ],
],
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment