LLuca 0 Posted July 7, 2019 Hello everyone, first of all I'm glad to have find out about this great forum and community. I need to ask you a question about the recent integration of rad studio: FMXLinux. I've successfully completed all the steps about installing and running FireMonkey for Linux. I've been able to set GTK backend with broadway and to run my sample application on localhost:8080. Now I would like to deploy a web application on my web domain (linux hosting) and I was thinking about writing a php script able to execute the x-executable. Considering that I don't know much about GTK, am I doing the right thing? if not, how can I deploy a FMXLinux app as a web app on a web domain? Thank you for your time Share this post Link to post
Eli M. 38 Posted July 9, 2019 (edited) The way broadwayd appears to work is that it runs a single application on a single port for a single user. The connection is persistent because it is a websocket. This means that you need 1 port set up per concurrent user. I came up with some code but it isn't quite right yet. Basically, you have to run broadwayd and the app in the background. I came with this for loop bash script (edit: works now). Make sure you have enough RAM. #!/bin/bash for i in {1..99} do nohup broadwayd :$i & export GDK_BACKEND=broadway export BROADWAY_DISPLAY=:$i ./FireMonkeyPaintDemo & done Once you get your application running on 100 ports in the background (which will support 100 simultaneous connections/users) then you need a TCP load balancer to turn the 100 points into 1 port. One such tool is HAProxy: https://www.haproxy.com/blog/websockets-load-balancing-with-haproxy/ A simpler tool (with maybe less performance) is called balance (sudo apt install balance ). https://www.systutorials.com/docs/linux/man/1-balance/ Here is a sample command which would load balance 4 broadwayd ports as port 81: balance 81 localhost:8080 localhost:8081 localhost:8082 localhost:8083 After running this and the above you would be able to connect to localhost:81 and it will load balance you across the 4 backend ports. You can probably also do this with TIdMappedPortTCP. Edited July 9, 2019 by Eli M. 1 Share this post Link to post
LLuca 0 Posted July 9, 2019 Thank you for your answer. As soon as I can apply your suggestions I'll update this post. Share this post Link to post
Eli M. 38 Posted July 10, 2019 Updated version. Takes two params. First is the path of the app to run and the second is the port to run it on. Apparently balance only supports 16 (or 32) groups unless you compile it yourself. Example: ./gtkcloud.sh /root/FireMonkeyPaintDemo 81 #!/bin/bash for i in {1..16} do nohup broadwayd :$i & export GDK_BACKEND=broadway export BROADWAY_DISPLAY=:$i $1 & #echo "" done servers="" for ii in {1..18} do let port=8080+$ii servers="$servers localhost:$port:1 %" done echo $servers balance $2 $servers 1 Share this post Link to post