From 88a632b152c7d3212dc288e08874ae7319792f93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Touz=C3=A9?= Date: Fri, 21 Jun 2019 16:56:35 +0200 Subject: [PATCH] Documentation update and .env files clean-up. --- .env | 1 - .template.env | 14 +++++++++++ README.md | 59 ++++++++++++++++++++++++++++++++++++++++++++ composer.json | 2 ++ composer.lock | 6 +++-- config/services.yaml | 2 +- doc/README.md | 50 ------------------------------------- 7 files changed, 80 insertions(+), 54 deletions(-) create mode 100644 .template.env create mode 100644 README.md delete mode 100644 doc/README.md diff --git a/.env b/.env index 74a5d593..b5e0e33b 100644 --- a/.env +++ b/.env @@ -16,7 +16,6 @@ ###> symfony/framework-bundle ### APP_ENV=dev APP_SECRET=70224d578f9919b2c3cb966f6117856b -APP_VERSION='0.4.1' #TRUSTED_PROXIES=127.0.0.1,127.0.0.2 #TRUSTED_HOSTS='^localhost|example\.com$' ###< symfony/framework-bundle ### diff --git a/.template.env b/.template.env new file mode 100644 index 00000000..927f35d0 --- /dev/null +++ b/.template.env @@ -0,0 +1,14 @@ +# This is a template for environement configuration +# You should rename this file to .env.local and change the configuration according to your specific infrastructure. +# see .env for more information and documentation + +###> symfony/framework-bundle ### +APP_ENV=prod #should be prod or dev +APP_SECRET=thisIsNotASecretChangeIt #random ~32 characters string +###< symfony/framework-bundle ### + +###> doctrine/doctrine-bundle ### +# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url +DATABASE_URL=pgsql://user:password@127.0.0.1:5432/databasename?charset=UTF8 #update DB name, user and password +DATABASE_VERSION=9.6 #update to your DB version (>=9.6) +###< doctrine/doctrine-bundle ### \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 00000000..a7c52419 --- /dev/null +++ b/README.md @@ -0,0 +1,59 @@ +# RapportNav + +Outil pour éditer des rapports de mission de contrôle, à destination des agents de la Direction des Affaires Maritimes (DAM). +L'objectif de l'outil est de permettre la centralisation des données d'une mission de contrôle pour produire à l'ensemble des parties prenantes (environnement, sécurité maritime, gens de mers, ...) les rapports nécessaire ou exposer la base à un outil de visualisation pour le suivi d'indicateurs. + +L'application est développée avec Symfony 4, apprès avoir cloné le dépôt et installé les dépenances avec composer il est nécessaire de configurer l'application. +Pour ce faire, renommer le fichier d'exemple `.template.env` en `.env.local` et y insérer les informations nécessaires (connexion à la base de données, ...). +La documentation plus détaillée est en anglais ci-dessous. + +# RapportNav (en) + +Simple reporting tool for Direction des Affaires Maritimes (French Maritime Affairs) public officials. + +## Requirements + +* PHP7.2 +* composer + +Other requirements are in composer.json and packages.json (for PHP and js) managed by [composer](https://getcomposer.org/) and [yarn](https://yarnpkg.com/) +To check all requirements on server use `composer check-platform-reqs` (after libraries install you may have additional platform requirements). + +## Install + +Install instructions are for server using Apache on Debian (Apache user being `www-data`) adapt to your needs. + +A PostGre database and role should be created for the application. + +```(bash) +$ cd /var/www/ +$ git clone https://github.com/SebastienTouze/rapportNav.git app/rapportNav +``` +Before taking the next steps, create your environment `.env.local` file copying `.template.env`. +You will need to configure : +* the app setting (**APP_ENV** and **APP_SECRET**) + * note that APP_ENV can be *prod*, *dev* or you can add other environment [see Symfony documentation for more information](https://symfony.com/doc/current/configuration.html#configuration-environments) + * make APP_SECRET random and unique, it is used as a seed for various functionalities [see Symfony documentation for more information](https://symfony.com/doc/current/reference/configuration/framework.html#secret) +* the database access and version (**DATABASE_URL** and **DATABASE_VERSION**) + +Then finish install: + +```(bash) +$ chown -R www-data:www-data app-ppr/ +$ sudo -u www-data composer install +$ sudo -u www-data composer check-platform-reqs +$ sudo -u www-data yarn install +$ sudo -u www-data bin/console doctrine:migration:migrate +``` + +### Test environment configuration (for developers) + +For tests only it is required to create a `var/data` folder where a SQLite database for tests will be instantiated. + + +## Conventions + +Regarding coding style, if you use PHPStorm it should follow the coding rules in `.idea/codeStyle/codeStyleConfig.xml`. + + + diff --git a/composer.json b/composer.json index 99bb79f8..a867c3aa 100644 --- a/composer.json +++ b/composer.json @@ -5,8 +5,10 @@ "php": "^7.1.3", "ext-ctype": "*", "ext-iconv": "*", + "ext-intl": "^1.1", "ext-json": "*", "ext-mbstring": "*", + "ext-pgsql": "^7.2", "friendsofsymfony/user-bundle": "^2.1", "sensio/framework-extra-bundle": "^5.1", "sonata-project/admin-bundle": "^3.48", diff --git a/composer.lock b/composer.lock index 08f0f130..4cbbe189 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3cceb71fb4baaa0a33fc3585d991716d", + "content-hash": "70eb3c57c6bb81950ebf50a2f379e711", "packages": [ { "name": "cocur/slugify", @@ -7665,8 +7665,10 @@ "php": "^7.1.3", "ext-ctype": "*", "ext-iconv": "*", + "ext-intl": "^1.1", "ext-json": "*", - "ext-mbstring": "*" + "ext-mbstring": "*", + "ext-pgsql": "^7.2" }, "platform-dev": [] } diff --git a/config/services.yaml b/config/services.yaml index bed2867f..d45c0a2a 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -5,7 +5,7 @@ # https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration parameters: locale: 'fr' - app.version: '%env(resolve:APP_VERSION)%' + app.version: '0.4.1' services: # default configuration for services in *this* file diff --git a/doc/README.md b/doc/README.md deleted file mode 100644 index 7475c054..00000000 --- a/doc/README.md +++ /dev/null @@ -1,50 +0,0 @@ -# General documentation - -## Requirements - -PHP7.2 -php7.2-xml -php7.2-zip -php7.2-pgsql -php7.2-intl -PostGreSQL >=9.4 (because of use of JSONB), used 10.6 (dev, change in `config/packages/doctrine.yaml` if required) -For testes SQLite and php_sqlite are required. - -Other requirements are in composer.json and packages.json (for PHP and js) managed by [composer](https://getcomposer.org/) and [yarn](https://yarnpkg.com/) - -## Install - -Install on server uses specific user `ppr` and suppose to clone from local repository in `/var/repo/1`, adapt to your needs -(to install on a developer computer you should only need to stat with `composet intall`). - -A PostGre database should be created with a user for the application, after the installation you may need to change the parameters in the `.env` file. - -```(bash) -$ cd /var/www/ -$ git clone /var/repo/1 app/ppr -$ chown -R ppr:www-data app-ppr/ -$ su ppr -$ composer install -$ yarn install -$ bin/console doctrine:migration:migrate -``` - -**Current project application specific note** : a `ciblage` user has been created on the server with rights on `rapportage` DB. -`.env.local` file is addited with **prod** env and DB user/password. - - -### Test environement configuration - - -For tests only it is required to create a `var/data` folder where the sqlite database for tests will be intanciated. - - -## Conventions - -Regarding coding style, if you use PHPStorm it will automatically follow the coding rules in `.idea/codeStyle/codeStyleConfig.xml`. - -## ToDos - -* add instructions to import initial form data - -