6.9 KiB
Executable File
Install
In order to setup the application for development for the first time please see the following instructions and recommendations.
Dev-Environment Requirements
Make sure your dev-environment or server fulfills the following requirements:
- PHP >= 8.0
- PHP extensions: mbstring, gd, zip, dom, pdo, pdo-mysql/pdo-pgsql/pdo-sqlsrv, sqlite, bcmath, imap*, redis*, memcached*, ftp*, socket*, curl*, xml*
- databases: mysql/postgresql/sqlsrv
- web server: apache2/nginx
- mod_headers (apache2)
The application and frameworks can use different databases. For the normal development process you only need one (whichever you prefer). However, in order to test against all supported databases and all code paths you would have to install all above mentioned databases.
Extensions marked with * are optional but recommended. They are only required in special situations. Requirements with a / in between mean that only one of the dependencies is necessary depending on your preferences and previous decisions.
Steps which are not explained in this documentation are how to install and setup the above mentioned software and extensions. You also should configure the web server paths accordingly in order to access the application in the browser.
Installation Options
- Option 1: Full installation, code checks/tests, generating documentation. Not recomended as quick setup
- Option 2: Only installs the application with some tests. Requires you to install the dev tools manually. Recommended
- Option 3: Only installs the application, due to the large amount of data takes some time to execute. Recommended
Option 1: Linux Shell Script
This also installs all required dev tools and sets up the directory structure by itself. Using this method also tears down previous installs for a fresh install perfect for re-installing from the current development version. Furthermore, the use of PHPUnit also makes sure that the application is working as intended. The PHPUnit install also provides lots of dummy data for better integration and functionality testing of your own code/modules.
Steps
The following steps will setup the application, download all necessary tools and perform extensive code quality checks and documentation tasks:
- Go to the directory where you want to install the build script
- Run
git clone -b develop https://github.comkaraka-management/Build.git - Modify
config.sh(most likely the db credentials and paths) - Run
chmod +x buildProject.sh - Run
./buildProject.sh
After the installation you'll have access to the following content:
- Application:
http://127.0.0.1 - Code Coverage:
http://127.0.0.1/Build/coverage/ - Test Report:
${INSPECTION_PATH}/test/ReportExternal - Unit Test Report:
${INSPECTION_PATH}/test/testdox.txt - PHPStan Report:
${INSPECTION_PATH}/test/phpstan.json - ... and more
Annotation
During this process the database automatically gets dropped (if it exists) and re-created. If you don't have xdebug installed but phpdbg you can replace php phpunit ... with phpdbg -qrr phpunit.phar ... or use pcov for much faster code coverage generation in Build/Inspection/Php/tests.sh
Option 2: PHPUnit Test Suits
This will only setup the application including some dummy data and also perform the code tests but no quality checks.
Steps
- Go to the directory where you want to install the application
- Run
git clone -b develop https://github.comkaraka-management/Orange-Management.git - Run
git submodule update --init --recursive - Run
git submodule foreach git checkout develop - Install Composer
- Run
composer installinsideOrange-Management - Run
php vendor/bin/phpunit --configuration tests/phpunit_no_coverage.xmlinsideOrange-Managementor openhttp://127.0.0.1/Install
After the installation you'll have access to the following content:
- Application:
http://127.0.0.1 - Code Coverager:
http://127.0.0.1/Build/coverage/
Annotation
During this process the database automatically gets dropped (if it exists) and re-created. If you don't have xdebug installed but phpdbg you can replace php phpunit ... with phpdbg -qrr phpunit.phar ... or use pcov for much faster code coverage generation.
Git Hooks (Linux only)
The git hooks perform various checks and validations during the commit and warn the developer about invalid code or code style/guideline violations.
For developers it is recommended to copy the contents of the default.sh file in the Build repository under Hooks to your pre-commit file in the .git/hooks directory. If the pre-commit file doesn't exist just create it.
The same should be done with every module. Simply go to .git/modules/**/hooks and also add the content of the default.sh file to all pre-commit files.
By doing this every commit will be inspected and either pass without warnings, pass with warnings or stop with errors. This will allow you to fix code before committing it. Be aware only changed files will be inspected. Also make sure all pre-commit have +x permissions.
Tools
The following tools are important to test the application and to ensure the code quality. The configurations and sample shell executions can be found in the Build directory. These tools are also downloaded during the setup process of the buildProject.sh script.
- composer
- phploc
- phpunit
- phpcs
- phpmetrics
- documentor
- phpstan
Option 3: Demo Application
This will only setup the application including some dummy data and also perform the code tests but no quality checks. Compared to option 2 this includes much more test data and it doesn't execute a unit test.
- Go to the directory where you want to install the application
- Run
git clone -b develop https://github.comkaraka-management/Orange-Management.git - Run
git submodule update --init --recursive - Run
git submodule foreach git checkout develop - Install Composer
- Run
composer installinsideOrange-Management - Create the database table
oms - Run
php demoSetup/setup.phpinsideOrange-Management
After the installation you'll have access to the following content:
- Application:
http://127.0.0.1
Annotation
- During this process the database automatically gets dropped (if it exists) and re-created
- The total storage space needed for this installation (w/o profiling data) is ≈10 GB
- The database space needed for this installation is ≈500 MB
- The runtime of the script is approx. 1h but can be slower depending on the hardware (slower CPU, hard drive vs SSD)
Profiling
You maybe want to use the following command to run the install script instead in order to also generate a cachegrind output for memory and performance profiling:
php -dxdebug.profiler_enable=1 -dxdebug.mode=develop,debug,profile -dxdebug.output_dir=/your/path demoSetup/setup.php
This may use a lot of resources and storage space (≈15 GB of cachegrind data w/o trace data and ≈120 GB w/ trace data)