I will receive a Raspberry Pi 4 with 4GB next week and would like to setup a Linux Webserver on it, for Xojo Web Apps.
Does anyone have a recommended Setup (Linux, Librarys, Apps, …) or even a Script i can run which would install the needed Components on Raspbian or anything alike?
BTW: Wouldnt it be a nice Community Project? Maybe a GitHub Repo in which we maintain/offer a Script for Xojo web App Devs which would prepare a recommended Linux for Xojo Web Apps?
I am not that experienced with Linux but will try to save my findings for later use in a Script and i will offer it then on GitHub. But because of my missing Linux Background, i can’t promise that i will really get to a point at which i can offer something.
I now have my Raspberry. Installed Raspian (headless). Installed apache2, php, mariadb and samba (for file sharing).
I placed a simple Hello World Xojo Web App into my /usr/lib/cgi-bin folder.
After trying to open the App within my local Network via http:///cgi-bin/test.cgi, is see the following in the apache error.log:
AH01215: /usr/lib/cgi-bin/test: 1: /usr/lib/cgi-bin/test: Syntax error: Unterminated quoted string: /usr/lib/cgi-bin/test.cgi
AH01215: Use of uninitialized value $length in subtraction (-) at /usr/lib/cgi-bin/test.cgi line 131.: /usr/lib/cgi-bin/test.cgi
AH01215: Use of uninitialized value $length in numeric eq (==) at /usr/lib/cgi-bin/test.cgi line 130.: /usr/lib/cgi-bin/test.cgi
End of script output before headers: test.cgi
Install raspian desktop
Install libunwind8
Compile your Xojo web app for Linux/arm on your Mac or PC
Drag the app to the Pi
Double click the app on the pi
[quote=480056:@Andy Broughton]Install raspian desktop
Install libunwind8
Compile your Xojo web app for Linux/arm on your Mac or PC
Drag the app to the Pi
Double click the app on the pi[/quote]
That works just fine with Desktop Apps, but i would like to create Web Apps and access them within my local Network and i would like to use a mySQL Server on the Pi for Data Storing and Sharing.
Once I have access, I create a folder in /opt where I copy my Xojo webapp
Then you can start your webapp by typing something like this in your terminal:
My assumption was, i would have to run a Webserver and the “start” the Web App from the Browser using just a URL.
I have my App finally up and running
For future reference, here is what i did:
I “installed” the latest Raspbian (with no Desktop/headless) on my SD Card and placed an empty text file called “ssh” in the main folder of the boot Partition.
I connected via ssh to my Raspberry now running Raspbian and updated/upgraded it and set it up using raspi-config
I installed libunwind8 (sudo apt-get install libunwind8)
I gave the pi User ownership of the /opt/ Folder (sudo chown pi /opt/)
Using a SFTP Connection, i created a Folder in /opt/ and placed my App within it
Then, i made my App executable (chmod 0755 /opt/test/test)
I started my app (/opt/test/test)
Now i can access my App via any Browser in my local Network using the IP Adress/Hostname + the Port i have choosen in Xojo Shared Build Settings (http://Schneppi-Webserver:8080)
[quote=480068:@Oliver Osswald]Just for anyone who comes later to this thread, you may also consider of adding such code to your App.Open event handler:
[code]Me.AutoQuit=False
// Allow your app to show up in any iframe
Self.Security.FrameEmbedding = WebAppSecurityOptions.FrameOptions.Allow
#If Not DebugBuild Then // Do not try to daemonize a debug build
Call Me.Daemonize #endif[/code][/quote]
If i do this, i should add an Exit (Quit) Option to my App. Correct? Or how would i force quit it from the shell?
EDITED:
If you want to autoquit your webapp as soon as you have deleted the program files, then you add a property of type timer to the App object plus a method ‘QuitTimer_Action’:
[code]Private Sub QuitTimer_Action(sender As Timer) #Pragma Unused sender
Dim f As FolderItem
f = GetFolderItem(“”)
Dim n As String = Lowercase(App.ExecutableFile.Name)
f = GetFolderItem(f.NativePath + n)
If (f.Exists = False) Then #IF Not DebugBuild
App.Quit #ENDIF
End If
End Sub
[/code]
And in Open Event Handler you add code like this:
// Start a timer which runs a AutoQuit method
QuitTimer = New Timer
AddHandler QuitTimer.Action, AddressOf QuitTimer_Action
QuitTimer.Period = 5000
QuitTimer.Mode = Timer.ModeMultiple
For anyone who would like to use a mySQL Database on the Pi within your Apps.
Install MariaDB with sudo apt-get install mariadb-server
If you would like to Manage your Datases with an App like Valentina Studio from your Desktop:
Access the mySQL Shell using mysql -u root
Enter GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'YOUR-DB-ROOT-PASSWORD' WITH GRANT OPTION;
Do a FLUSH PRIVILEGES;
Instead of ‘root’@’%’ you can also use ‘root’@‘192.168.178.10’ to restrict the access to a specific address or with the % placeholder to address ranges (f.e. ‘root’@‘192.168.178.%’
Exit the mySQL Shell with exit and restart the MariaDB Server with sudo systemctl stop mariadb and then sudo systemctl rt mariadb
[quote=480067:@Sascha S]Thank you @Oliver Osswald and @Andy Broughton !
My assumption was, i would have to run a Webserver and the “start” the Web App from the Browser using just a URL.
I have my App finally up and running
For future reference, here is what i did:
I “installed” the latest Raspbian (with no Desktop/headless) on my SD Card and placed an empty text file called “ssh” in the main folder of the boot Partition.
I connected via ssh to my Raspberry now running Raspbian and updated/upgraded it and set it up using raspi-config
I installed libunwind8 (sudo apt-get install libunwind8)
I gave the pi User ownership of the /opt/ Folder (sudo chown pi /opt/)
Using a SFTP Connection, i created a Folder in /opt/ and placed my App within it
Then, i made my App executable (chmod 0755 /opt/test/test)
I started my app (/opt/test/test)
Now i can access my App via any Browser in my local Network using the IP Adress/Hostname + the Port i have choosen in Xojo Shared Build Settings (http://Schneppi-Webserver:8080)[/quote]
Just like I said! (with a couple of extra steps) Glad you got it working.