-
Notifications
You must be signed in to change notification settings - Fork 8
Running ProdigyView examples on Debian
Here is quick guide how to run ProdigyView - PHP MicroServices Examples on Plain Debian 9 Linux
Tested OS:
lsb_release -ds
Debian GNU/Linux 9.9 (stretch)
Problem: We need at least PHP7.1 - using guide from https://blog.venca-x.cz/debian-9-stretch-instalace-php-7-1/
sudo bash
apt-get install apt-transport-https lsb-release ca-certificates
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > \
/etc/apt/sources.list.d/php.list
apt-get update
Install common requirements:
sudo apt-get install php7.1-cli php7.1-common php7.1-xml \
php7.1-mbstring composer git
Optional: Install tmux to have multiple terminal windows available via ssh:
sudo apt-get install tmux
Now we can setup examples (as any unprivileged user):
mkdir ~/projects
cd ~/projects
git clone https://github.com/ProdigyView-Toolkit/Microservices-Examples-PHP.git
cd Microservices-Examples-PHP
Install any Mail Transport Agent (MTA) - the example require
command /usr/sbin/sendmail
in the system. Try for example:
sudo apt-get install exim4
We may partially follow https://github.com/ProdigyView-Toolkit/Microservices-Examples-PHP#how-to-run
cd ~/projects/Microservices-Examples-PHP/email
# NOTE: 'composer install' did not work well in my example (missing classes etc...)
composer update
# ensure that there are no errors (warning are mostly OK :-)
Now we can prepare tmux:
- run
tmux
command - press
Ctrl
-b
followed by"
(withoutCtrl
!) to open new pane.
Now press Ctrl
-b
followed by ;
to swith to upper pane.
And enter command:
php7.1 server.php
# there should be no message
Now press Ctrl
-b
followed by ;
to switch back to lower pane.
And enter command:
php7.1 client.php
Message Sent
In server pane you should see new message Processing...
NOTE: The e-mail will be not actually delivered, however you can look at Exim4 log:
sudo tail /var/log/exim4/mainlog | grep example.com
2019-06-08 08:43:51 1hZWx5-0003xE-Rq <= [email protected] U=ansible P=local S=921 id=afhIrPchdPmIHhFiNoVTpTJJrAKu63g3bKCUApXk@debian-9
2019-06-08 08:43:52 1hZWx5-0003xE-Rq ** [email protected] R=nonlocal: Mailing to remote domains not supported
2019-06-08 08:43:52 1hZWx6-0003xG-8L ** [email protected] R=nonlocal: Mailing to remote domains not supported
To end server do this:
- press
Ctrl
-b
followed by;
to switch back to upper pane - press
Ctrl
-c
to terminate server
Now you can go to next example...
NOTE: To completely exit tmux
you can use Ctrl
-b
followed by x
(and answer yes to question Kill pane (y/n)?
.
And repeat it again to kill next pane. Then tmux
will exit.
We need to install additional dependencies:
sudo apt-get install rabbitmq-server wget ffmpeg php7.1-bcmath
And then basically follow https://github.com/ProdigyView-Toolkit/Microservices-Examples-PHP#video-processing-and-rabbitmq:
cd ~/projects/Microservices-Examples-PHP/video
# NOTE: I rather use update instead of install:
composer update
Ensure there is no error in composer update
output (it often means that some required php extension
is not installed).
Run server in one terminal/pane:
cd ../video # ensure that your NOT in email directory any longer!
php7.1 server.php
And run client in another terminal/pane:
cd ../video # ensure that your NOT in email directory any longer!
php7.1 client.php
Sent Video To Server!'
On server pane you should see progress:
--2019-06-08 09:16:17-- https://sample-videos.com/video123/mp4/720/big_buck_bunny_720p_20mb.mp4
# wget progress
Resolving sample-videos.com (sample-videos.com)... 45.249.110.23
Connecting to sample-videos.com (sample-videos.com)|45.249.110.23|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 21069678 (20M) [video/mp4]
Saving to: âvideo.mp4â
# followed by ffmpeg progress
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
frame= 510 fps=7.4 q=28.0 size= 3139kB time=00:00:20.37 bitrate=1262.0kbits/s speed=0.296x
# NOTE: The video conversion may take few minutes to finish....
[aac @ 0x1977900] Qavg: 590.648
Finished Processing
Done.
You need to install this additional package:
sudo apt-get install php7.1-curl
And then follow https://github.com/ProdigyView-Toolkit/Microservices-Examples-PHP#restful-crud-api
(with one exception - I rather used update
instead of install
).
Also note that this time server is started using:
cd ../rest
php7.1 -S 127.0.0.1:8080
PHP 7.1.30-1+0~20190531112602.19+stretch~1.gbpab9d28 Development Server started at Sat Jun 8 09:34:12 2019
Listening on http://127.0.0.1:8080
Document root is /home/ansible/projects/Microservices-Examples-PHP/rest
Press Ctrl-C to quit.
And client (standard):
cd ../rest
Not yet tested (TODO).
Copyright © Henryk Paluch. All rights reserved.
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License