Closed rawbertp closed 5 years ago
I'd suggest keeping the instructions in the wiki. We moved everything out of the README for a better documentation. If you like you can tell the instructions here and we can add it to the wiki if a decision is made.
Thanks for your contributions 🙂
Edit: You could also clone the wiki and push the changes to your GitHub and link them here, so we can cherry-pick your changes.
Could look like this in the wiki, based on the instructions here: https://www.raspberrypi.org/documentation/remote-access/web-server/nginx.md.
Currently Apache and NGINX Webserver are supported. NGINX has a smaller memory footprint and typically better performance, which is especially important on the Raspberry Pis, but it needs some additional steps until you're good to go.
sudo apt install -y libapache2-mod-php
sudo apt install -y nginx php-fpm
sudo apt install -y git php-gd gphoto2
Quick tested with nginx on a fresh Raspbian Buster image, followed the instructions above. Works fine so far.
Added to the instruction: https://github.com/andreknieriem/photobooth/wiki/Installation-on-Debian/_compare/6accec5fe65e654b229c75e421f6d5a88149789c...be6f075ae317836a31b671755b55ee136822b1ec
Any idea for the installation script to use NGINX by default?
The following sed commands will uncomment the corresponding lines:
sed -i 's/^\(\s*\)index index\.html\(.*\)/\1index index\.php index\.html\2/g' /etc/nginx/sites-available/default
sed -i '/location ~ \\.php$ {/s/^\(\s*\)#/\1/g' /etc/nginx/sites-available/default
sed -i '/include snippets\/fastcgi-php.conf/s/^\(\s*\)#/\1/g' /etc/nginx/sites-available/default
sed -i '/fastcgi_pass unix:\/run\/php\//s/^\(\s*\)#/\1/g' /etc/nginx/sites-available/default
sed -i '/.*fastcgi_pass unix:\/run\/php\//,// { /}/s/^\(\s*\)#/\1/g; }' /etc/nginx/sites-available/default
BTW this is how I tested it: https://github.com/rawbertp/photobooth-nginx-script-test
Thanks :) I'll see if I find time in the evening to test it too
One thing probably worth mentioning - this has only been tested on the happy path, i.e. a vanilla nginx installation (on Debian Buster). It may not work/cause issues if the user already did manual changes himself or for other distributions which ship with another config (structure).
I would also recommend to take a backup of the original file before applying any changes.
And finally (before reloading nginx) I would suggest to test the config:
/usr/sbin/nginx -t -c /etc/nginx/nginx.conf &>/dev/null && echo 'config test ok' || echo 'config test failed'
root@81b37c6626c9:/# /usr/sbin/nginx -t -c /etc/nginx/nginx.conf
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
root@81b37c6626c9:/# echo $?
0
root@81b37c6626c9:/#
root@81b37c6626c9:/# echo nonsense >> /etc/nginx/nginx.conf
root@81b37c6626c9:/# /usr/sbin/nginx -t -c /etc/nginx/nginx.conf
nginx: [emerg] unexpected end of file, expecting ";" or "}" in /etc/nginx/nginx.conf:87
nginx: configuration file /etc/nginx/nginx.conf test failed
root@81b37c6626c9:/# echo $?
1
Applied Antique Filter
{success: "image", file: "cb9517914ba5c9f5737994ca610b9881.jpg", time: 2.4943900108337402}
core.js:257 picture processed
{file: "cb9517914ba5c9f5737994ca610b9881.jpg", time: {…}}
file: "cb9517914ba5c9f5737994ca610b9881.jpg"
time:
chroma: 0.7251811027526855
filter: 2.015481948852539a
image: 0.46349191665649414
polaroid: 0.0000059604644775390625
thumb: 0.23497796058654785****
2nd one with NGINX, Applied Antique Filter
{success: "image", file: "e45680c5f28cf6b59478768fe228c673.jpg", time: 1.8362641334533691}
core.js:257 picture processed
{file: "e45680c5f28cf6b59478768fe228c673.jpg", time: {…}}
file: "e45680c5f28cf6b59478768fe228c673.jpg"
time:
chroma: 0.6933839321136475
filter: 1.9205820560455322
image: 0.45045018196105957
polaroid: 0.0000030994415283203125
thumb: 0.23052406311035156
No filter applied
{success: "image", file: "4bf784216520484b17be9f73677e3693.jpg", time: 1.7270090579986572}
core.js:257 picture processed
{file: "4bf784216520484b17be9f73677e3693.jpg", time: {…}}
file: "4bf784216520484b17be9f73677e3693.jpg"
time:
chroma: 0.7118780612945557
filter: 0.000010013580322265625
image: 0.4691948890686035
polaroid: 0.0000019073486328125
thumb: 0.2908461093902588
Applied Antique Filter
{success: "image", file: "9ef622bf8677db9d683d4af4856f3497.jpg", time: 2.3593690395355225}
core.js:257 picture processed
{file: "9ef622bf8677db9d683d4af4856f3497.jpg", time: {…}}
file: "9ef622bf8677db9d683d4af4856f3497.jpg"
time:
chroma: 0.6960411071777344
filter: 1.914086103439331
image: 0.4502990245819092
polaroid: 0.0000050067901611328125
thumb: 0.229841947555542
2nd with apache2, Applied Antique Filter
{success: "image", file: "a97e757e6e213382ebfdf9503a7d4df1.jpg", time: 2.051651954650879}
core.js:257 picture processed
{file: "a97e757e6e213382ebfdf9503a7d4df1.jpg", time: {…}}
file: "a97e757e6e213382ebfdf9503a7d4df1.jpg"
time:
chroma: 0.6931698322296143
filter: 1.905850887298584
image: 0.44994401931762695
polaroid: 0.00000286102294921875
thumb: 0.23006701469421387
No filter applied
{success: "image", file: "03f43af8af78c07a1bceb80b8fc96c1c.jpg", time: 1.8909170627593994}
core.js:257 picture processed
{file: "03f43af8af78c07a1bceb80b8fc96c1c.jpg", time: {…}}
file: "03f43af8af78c07a1bceb80b8fc96c1c.jpg"
time:
chroma: 0.7397301197052002
filter: 0.000012159347534179688
image: 0.507641077041626
polaroid: 0.0000019073486328125
thumb: 0.26639294624328613
there's a small difference, even if it is not that big. on both the first picture takes some more time, while every picture after that is a little faster done.
Thanks for performing these tests. What would be also/especially interesting are memory (RAM) and CPU utilization.
Ordered 2 more MicroSD cards so I don't have to format the same card many times a day ;)
Can tell more next days.
Is your feature request related to a problem? Please describe. No problem but I suggest to replace Apache httpd installation instructions/requirements by nginx. Nginx has a smaller memory footprint and typically better performance, which is especially important on the Raspberry Pis.
Describe the solution you'd like
README.md
. This would allow others to contribute.nginx
andphp-fpm
. This is quite straight-forward and a task of 2-5 minutes. :)Describe alternatives you've considered
One could also provide a howto for both httpd and nginx but I would suggest to make nginx default for reasons mentioned above.
Additional context