This is a proposal how to set up an environment to write code and debug it for
- Streams (core and addons) - PHP code
- Addon Faces - Python code
Howto Debug - Debian 11 - KVM
Recommended
- Install KVM
- Install Debian11 inside new virtual machine
- Install your debug environment (streams) inside the vm
- Take snapshots of your vm to start over with a clean install if neccessary
easyinstall - install Streams under localhost
Use the install script of streams, https://codeberg.org/streams/streams/src/branch/dev/.easyinstall
This will install the latest PHP version automatically, at the time of writing php8.2.
Open http://localhost in a webbrowser and follow the steps.
Important
Switch off mail confirmation before you register the first user (using the same mail address as the admin)
cd /var/www/streams/
util/config system verify_email 0
util/config system
Change rights to have full access
chmod -R a+rwx /var/www/streams/
Php debug
Xdebug3
Install
php --version
su -
apt-get install php-xdebug
reboot
Done! Optionally...
...create a file to print infos
cd /var/www/streams/
nano a.php
Copy the following content into the a.php
<?php
phpinfo();
xdebug_info();
?>
Netbeans - as debugger
apt-get install snapd
sudo snap install netbeans --classic
apt-get install default-jdk
Start Netbeans, create a new PHP project and use the existing sources under /var/www/mywebsite
If the debugger does not stop in the code... Check the php version, see output of http://localhost/a.php above. Look at "Additional .ini files parsed" and double check with https://xdebug.org/docs/install The time of writing (12/2022) the *.ini to go for is for example
/etc/php/8.2/apache2/conf.d/20-xdebug.ini
Insert
xdebug.mode=debug
xdebug.client_host=localhost
xdebug.client_port=9003
xdebug.idekey="netbeans-xdebug"
Python debug
Install python and pycharm
su -
apt-get update
apt-get -y install python3-pip git php
snap install pycharm-community --classic
or VSCodium
sudo apt update
sudo apt install snapd
sudo snap install core
sudo snap install codium --classic
example launch.json for codium
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/faces.py",
"args": [
"--host", "127.0.0.1",
"--user", "streams",
"--pass", "xxx",
"--db", "streams",
"--imagespath", "/var/www/streams/store/a",
"--channelid", "1",
"--procid", "45bfc6dfdc",
"--loglevel", "2",
"--logfile", "/var/www/log/faces.log"
],
"console": "integratedTerminal",
"justMyCode": true
}
]
}
To start playing around...
Contribute changes to the addons faces
Fork
Fork https://codeberg.org/streams/streams-addons
Add your fork
cd /var/www/streams/extend/addon/zaddons
git remote add ojrandom https://codeberg.org/ojrandom/streams-addons.git
git remote -v
Let point the pull to the official repository, in the example "origin/dev" Let point the push to your branch, in the example "ojrandom/dev"
git pull --set-upstream origin dev
git config pull.rebase false
git fetch ojrandom
git switch -c dev --track origin/dev
git pull
git push --set-upstream ojrandom dev
git push
Push changes to your fork evertime you want to make a merge request for the official repostitory. Fetch and merge the official repository (see "git config pull.rebase false" above)
git pull
git push
or if the git-upstream is set not set
git push ojrandom deepface
Helpers
Cache credentials 5 min
git config credential.helper 'cache --timeout=300'
Nice git log
nano /var/www/streams/extend/addon/zaddons/.git/config
insert
[alias]
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --branches
use
git lg
change branch on production server
git pull origin/dev
git checkout dev
git branch --set-upstream-to origin/dev
git pull
nano /var/www/streams/extend/addon/zaddons/.git/config