npm
)temp/
and log/
writable.composer install
to install backend dependencies.npm install
to install runtime dependencies.gulp
app/Config/config.local.neon
(see example file config.local.neon.example
).php www/index.php migrations:continue
It is CRITICAL that whole app/
, log/
and temp/
directories are not accessible directly
via a web browser. See security warning.
ERROR: schema "public" already exists in ...
vendor/nextras/migrations/src/Drivers/PgSqlDriver.php
No user in the database
php www/index.php app:user-create
command to create new ordinary user.Basically there are two "featured" GIT branches:
master
acting as stable version (publicly deployed),develop
acting as development version.The application (both of the branches) can run in two environments: development
and production
... The difference is in error handling, building assets. The application itself uses autodetection (from the http host), however for the processes around the environment needs to be specified explicitly.
Note: branches starting with wip-
prefix are contains unfinished and incomplete work.
Due to specific libraries versions the development environment is prepared and maintained in docker containers managed by the docker-compose.
temp/
and log/
writable.composer install
to install backend dependencies.npm install
to install runtime dependencies.gulp
app/Config/config.local.neon
(see example file config.local.neon.example
)..env
in project root and populate it with:
IP=127.0.0.1 # IP address when the Docker container ports (80, 443...) should be binded
PROJECT_PATH=. # On MacOS provide full absolute directory starting with /System/Volumes/Data, provide . otherwise
COMPOSE_PROJECT_NAME=datoscz
docker-compose up
to build and run containers, on change in containers append --build
param to force rebuild (otherwise old will be used).php www/index.php migrations:continue
inside the container where you get by running docker-compose exec webserver bash
.hosts
file to map the selected IP to the name czech-lawyers.test
and www.czech-lawyers.test
. https://czech-lawyers.test
URL.If you experience issue with reading/writing PHP session data add session.savePath: null
to your config.local.neon
.
To enter the container use docker-compose exec webserver bash
in the project root dir.
Access Adminer at http://czech-lawyer.test:8080
(protocol matters!), database itself is available on the given IP address under 5432
port.
Database data are persisted in the Docker volume (see docker-compose.yml
). If you need to reset the database use docker volumes rm datoscz_datos_db_data
To import database dump use psql -h czech-lawyers.test -U datos_user datos_db < advokati-production.sql
when the target database was emptied (or freshly created).
You can start front-end application in development mode by running npm start
in the project root. Web application is then available at http://localhost:8080
.
When having installation done, these steps needs to be performed to get up-to-date version:
docker-compose pull
.git pull
of proper branch (master
, develop
...)composer install
npm install
docker-compose up
php www/index.php migrations:continue
inside docker-compose exec webserver bash
.gulp development
The gulp development
commands automatically builds assets (css, js, images...) and watch for their modification which triggers build immediatelly.
For production use only a full standalone server such as Apache should be used! (Docker is not suitable for production usage!)
For automated build of dependencies there is prepared script deploy.php
which take care about everything done by hand in development mode with that difference that migration of database and gulp task are done for production (no dummy data and no watching for changes in assets).
Doing update: just run php deploy.php
in proper folder (see the configuration section).
Do not forget to especially install and activate php-pgsql
, php-xml
and php-posix
packages in order to prevent failures.
mod_itk
(to run web under given user):
foo
, bar
with sudo access to cestiadvokati.cz
cestiadvokati.cz
web-devel
= branch develop
in production mode for testing before going live.web-production
= branch master
in production mode for live and public instance.For managing database state the project uses Nextras\Migrations which stores the change scripts in database/schema
folder.
Warning: do not change scripts that are already applied on production!
See its documentation: https://nextras.org/migrations/docs/3.0/
Types:
Label: short label/tag/name of the change
For execution from command line (for crawlers...) we use Kdyby\Console (using Symphony\Console).
See its documentation: https://github.com/Kdyby/Console/blob/master/docs/en/index.md
Project is using Ublaboo API routing (via annotations), see documentation. The anotations also works as documentation, see library documentation.
API documentation is stored at /api-doc/
and is not autogenerated (and on production server should be protected by password).
For generating new please open any route with additional parameter such as: /api/advocate/autocomplete?__apiDocuGenerate
.
According to czech laws the system process personal data and therefore is subject of Law 101/2000.
Any further modifications needs to take this into account and implement current approach before they can be merged and deployed.
Auditing log is stored in /log/auditing/YYYY-MM.log
in following format:
DATE AND TIME: 2017-09-05 08:41:37
REQUEST: http://localhost:8000/api/advocate-rankings/1
COUNTERPARTY: [26] Jan Novák
IDENTIFICATION: [::1] => Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36 OPR/47.0.2631.71
AUDITED SUBJECT TYPE: advocate_info
OPERATION: access
REASON: Requested in one record (direct access)
DESCRIPTION: Load advocate [JUDr. František Vomáčka - Brno] with ID [123].
In application, there is service implementing ITransactionLogger
which takes care of logging through logCreate
, logAccess
, logChange
and logRemove
methods.
For all calls these values needs to be provided:
AuditedSubject
only,AuditedReason
only,Information about user are inferred from the current context of the application, however they can be overriden (necessity for console tasks).
When working with transactions, log immediatelly all access operations, delay all change operation after database transaction is done (use ITransactionLogger
for that).
Notes:
Diffable
usable on Entities for obtaining diff of changes.