phpMyAdmin server side component for the error reporting system. It uses
CakePHP, the migrations plugin and, for the development environment, the
debug kit plugin. The GitHub login is implemented in
src/Controller/DevelopersController.php, there is no OAuth plugin.
In order to deploy the app in this repo you need to follow these steps:
- Clone this repo or extract the zip file
- Add a virtual hosts entry pointing at the
webrootdirectory of the files you extracted in the previous step, and not at the directory itself: the application code has to stay out of the document root. - Run
composer installto download and configure dependencies and library files - Configure the web server (see below)
- Create the database for the server
- Install the PHP extensions listed in Requirements
- cd application_root_dir (directory under which subdirectory
srcresides) - mkdir tmp;
- mkdir logs;
- set permissions for tmp and logs directory
-
HTTPDUSER=`ps aux | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1` setfacl -R -m u:${HTTPDUSER}:rwx tmpsetfacl -R -d -m u:${HTTPDUSER}:rwx tmpsetfacl -R -m u:${HTTPDUSER}:rwx logssetfacl -R -d -m u:${HTTPDUSER}:rwx logs
-
- The
composer installof the previous step createsconfig/app.phpfromconfig/app.default.phpand generates its security salt. If you installed the dependencies another way, copy the default configuration fileconfig/app.default.phptoconfig/app.phpyourself. Make sure to change the salts, debug level and the database credentials in theapp.phpfile. - Add the
AcceptedReportsVersionskey to an existingconfig/app.php, it is documented inconfig/app.default.php. The reports of the versions that are not listed are dropped, and without the key every report is dropped. - Copy the
oauth_example.phptooauth.phpand follow the instructions below to set the appropriate variables in the file. - Copy the
forwarding_example.phptoforwarding.phpand fill the values. - Run the migrations that have been created so far to setup the database
- For existing systems: update and run migrations
bin/cake migrations mark_migrated 20150607191654bin/cake migrations migrate - For new system: just run migration
bin/cake migrations migrate
- For existing systems: update and run migrations
- php >= 8.4
- The
curl,intl,json,mbstringandpdo_mysqlextensions, the same list is declared incomposer.json. On Debian:sudo apt-get install php-curl php-intl php-mbstring php-mysql - MySQL or MariaDB. The continuous integration runs the MariaDB version packaged in Debian 13 trixie (11.8).
The application is served from the webroot directory, and the web server has
to send every request to webroot/index.php. Example configurations are kept
in the docs directory:
See docs/server-setup.md for the document root, the permissions, the PHP-FPM pool and the application URL.
The application relies on authentication using GitHub. To obtain the client ID and key, visit application settings in your Github profile and register an application there.
The callback for the github app should be <http://YOUR_PREFERRED_DOMAIN>/developers/callback where YOUR_PREFERRED_DOMAIN is the URL you wish to access the local instance on.
Copy the example configuration in config/oauth_example.php to config/oauth.php and replace the dummy credentials with the obtained client ID and secret.
The service files a GitHub issue for a report once a developer forwards it, and it keeps the status of the report up to date from the state of that issue: when somebody closes or reopens the issue, the matching report follows.
Add the webhook to the repository named by the GithubRepoPath key of
config/oauth.php, with https://<host>:<port>/events as payload URL, the
Issues events and the secret token of the GithubWebhookSecret key.
See docs/github-webhook.md for the whole setup, the statuses it changes and the answers it sends.
- Get a Github Personal Access token as explained here
- You need to set the
reposcope for this token. - Set value of obtained
GithubAccessTokeninconfig/oauth.php - After setting value of
GithubAccessTokeninconfig/oauth.phpas explained above, you can run the synchronization action as
bin/cake sync_github_issue_states- This can be scheduled as a cron job too.
You can run the test suite with:
composer run test --timeout=0The coding standard and the static analysis can be run with:
composer run phpcs
composer run phpstanTo schedule and run cron jobs, CakePHP provides a console tool. A command can be run as a cron job.
For example, following is the command to execute src/Command/StatsCommand.php which caches the error reporting statistics for later use.
bin/cake statsThe statistics cache expires in one day so we need to schedule this command to run everyday as cron job.
A separate log file, logs/cron_jobs.log, is maintained for all the cron jobs:
the code logs with the cron_jobs scope and the scope is configured in the
Log section of config/app.php. The logging is done via the Log class.
All the failures and other activity relating to cron jobs should be reported
there only. That makes debugging easier in case of a failure.
