Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
171 changes: 171 additions & 0 deletions Build Automation.xojo_code
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
#tag BuildAutomation
Begin BuildStepList Linux
Begin BuildProjectStep Build
End
Begin IDEScriptBuildStep DockerImage , AppliesTo = 2, Architecture = 1, Target = 0
'*************************************************************
'Xojo Web App 2 Docker - How to use with your Xojo-built .app?
'*************************************************************
'1. copy the folder 'scripts' to your project folder.
'2. Edit the file 'Dockerfile' in your favourite Text Editor.
' 1. Look for the last line: CMD /app/CRCCalculatorWeb
' Make sure the App Name is the same as in your Xojo
' project in Build Settings -> Linux
' 2. Look for the line: EXPOSE 80
' Make sure the App Name is the same as in your Xojo
' project in Build Settings -> Shared: Build (Port)
'3. Create a PostBuild Copy File Step 'CopyDockerfile'
' Copy the file 'resources/Dockerfile' to 'App Parent Folder'
'4. create a PostBuild Script, place it after the
' build step and copy-and-paste this one.
'5. Add/Modify the Constant App.constDockerTag to fit your
' Company/App
'6. Read the Comments in the PostBuild Script,
' modify according to your needs.
'**************************************************

'**************************************************
'Setup Xojo Web App 2 Docker - Post Build Script
'**************************************************
'1. Read the comments in this PostBuild Script
'2. Edit the values according to your needs
'**************************************************
'3. If it's working for you: Do you like it? Does it help you? Has it saved you time and money?
' You're welcome - it's free...
' If you want to say thanks I appreciate a message or a small donation.
' Contact: xojo@jo-tools.ch
' PayPal: https://paypal.me/jotools
'**************************************************


'**************************************************
'Requires Docker Installation
'**************************************************
'Download, install and run Docker.app:
'https://docs.docker.com/docker-for-mac/install/
'**************************************************

'Configuration
'-------------
'Docker Tag: will be used from App.constDockerTag
'Docker Push (to Docker Hub):
Var bDockerPushEnabled As Boolean = False
Select Case PropertyValue("App.StageCode")
Case "0" 'Development
bDockerPushEnabled = False
Case "1" 'Alpha
bDockerPushEnabled = False
Case "2" 'Beta
bDockerPushEnabled = False
Case "3" 'Final
bDockerPushEnabled = True
End Select


'*******************************************
'Xojo Web App 2 Docker - Let's go...
'*******************************************
'you shouldn't need to modify anything below
'(but feel free to do so :-)
'*******************************************
If (Not TargetMacOS) Then
Print "The Post Build Script 'DockerImage' can only be run on macOS. You need to modify the Shell Commands if you're building on Linux or Windows."
Return
End If


'Check Build Target
Select Case CurrentBuildTarget
Case 17
'Linux (Intel, 64Bit)
Else
Print "The only supported Build Target for the Post Build Script 'DockerImage' is: Linux, Intel 64Bit"
Return
End Select

'Check Build
If DebugBuild Then
Print "The Post Build Script 'DockerImage' should not be run for Debug Run's."
Return
End If

'Xojo Project Settings
Var sPROJECT_PATH As String = Trim(DoShellCommand("echo $PROJECT_PATH", 0))
If Right(sPROJECT_PATH, 1) = "/" Then
'no trailing /
sPROJECT_PATH = Mid(sPROJECT_PATH, 1, Len(sPROJECT_PATH)-1)
End If
Var sBUILD_LOCATION As String = ReplaceAll(CurrentBuildLocation, "\", "") 'don't escape Path
Var sBUILD_APPNAME As String = CurrentBuildAppName

If (sPROJECT_PATH = "") Then
Print "Xojo Web App 2 Docker requires to get the Environment Variable $PROJECT_PATH from the Xojo IDE." + EndOfLine + EndOfLine + "Unfortunately, it's empty.... try again after re-launching the Xojo IDE and/or rebooting your machine."
Return
End If

'App Version -> used for Docker Image Tag
Var sAPP_VERSION As String = PropertyValue("App.MajorVersion") + "." + PropertyValue("App.MinorVersion") + "." + PropertyValue("App.BugVersion")
Select Case PropertyValue("App.StageCode")
Case "0"
sAPP_VERSION = sAPP_VERSION + "-dev"
Case "1"
sAPP_VERSION = sAPP_VERSION + "-alpha"
Case "2"
sAPP_VERSION = sAPP_VERSION + "-beta"
End Select

'DockerTag
Var sDOCKER_TAG As String = ConstantValue("App.constDockerTag")
If (sDOCKER_TAG = "") Then
Print "Xojo Web App 2 Docker requires the Constant: App.constDockerTag."
Return
End If
sDOCKER_TAG = sDOCKER_TAG + ":" + sAPP_VERSION

'Add DockerFile
Call DoShellCommand("cp """ + sPROJECT_PATH + "/scripts/Dockerfile"" """ + sBUILD_LOCATION + "/Dockerfile""", 0)


'The Contents of Array will later be passed to
'the ShellScript 'xojo2docker.sh', which does all the processing
'
'The order is important, so don't change anything here without
'changing the ShellScript, too.
Var sShellArguments() As String

'Parameters required to create the Docker Image
sShellArguments.Add(sPROJECT_PATH)
sShellArguments.Add(sBUILD_LOCATION)
sShellArguments.Add(sBUILD_APPNAME)
sShellArguments.Add(sDOCKER_TAG)
sShellArguments.Add(If(bDockerPushEnabled, "yes", "no"))

'Make sure the ShellScript is executable:
Call DoShellCommand("chmod 755 """ + sPROJECT_PATH + "/scripts/xojo2docker.sh""", 0)

If (Not DebugBuild) Then
'Automate Terminal:
'Pass ShellArguments to Script and execute it in Terminal.app
Call DoShellCommand("osascript -e 'tell application ""Terminal"" to activate'", 0)
Call DoShellCommand("osascript -e 'tell application ""Terminal"" to do script ""\""" + sPROJECT_PATH + "/scripts/xojo2docker.sh\"" \""" + Join(sShellArguments, "\"" \""") + "\""""'", 0)
Return 'see progress and errors in Terminal.app
End If

End
End
Begin BuildStepList Mac OS X
Begin BuildProjectStep Build
End
Begin SignProjectStep Sign
DeveloperID=
End
End
Begin BuildStepList Windows
Begin BuildProjectStep Build
End
End
Begin BuildStepList Xojo Cloud
Begin BuildProjectStep Build
End
End
#tag EndBuildAutomation
87 changes: 87 additions & 0 deletions cubesql-webadmin.xojo_project
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
Type=Web2
RBProjectVersion=2024.01
MinIDEVersion=20200200
OrigIDEVersion=20240100
Folder=resources;resources;&h0000000035B107FF;&h0000000000000000;false
Folder=styles;styles;&h00000000139DBFFF;&h0000000000000000;false
Folder=webapp;webapp;&h0000000018D38FFF;&h0000000000000000;false
Folder=main;webapp/main;&h000000001D9447FF;&h0000000018D38FFF;false
WebView=LoginPage;webapp/main/LoginPage.xojo_code;&h000000005492FFFF;&h000000001D9447FF;false
WebView=CubeSQLAdminPage;webapp/main/CubeSQLAdminPage.xojo_code;&h000000004DEBB7FF;&h000000001D9447FF;false
Folder=dialogs;webapp/dialogs;&h0000000054A427FF;&h0000000018D38FFF;false
WebView=dlgRegisterServer;webapp/dialogs/dlgRegisterServer.xojo_code;&h000000000EEC17FF;&h0000000054A427FF;false
WebView=dlgDatabaseCreate;webapp/dialogs/dlgDatabaseCreate.xojo_code;&h0000000045C397FF;&h0000000054A427FF;false
WebView=dlgUserCreate;webapp/dialogs/dlgUserCreate.xojo_code;&h0000000064C14FFF;&h0000000054A427FF;false
WebView=dlgUserGroups;webapp/dialogs/dlgUserGroups.xojo_code;&h00000000347EFFFF;&h0000000054A427FF;false
WebView=dlgPrivilegeGrant;webapp/dialogs/dlgPrivilegeGrant.xojo_code;&h0000000022F4BFFF;&h0000000054A427FF;false
WebView=dlgCommonName;webapp/dialogs/dlgCommonName.xojo_code;&h0000000053B56FFF;&h0000000054A427FF;false
Folder=containers;webapp/containers;&h000000005859EFFF;&h0000000018D38FFF;false
Class=App;webapp/App.xojo_code;&h0000000055A03FFF;&h0000000018D38FFF;false
WebSession=Session;webapp/Session.xojo_code;&h0000000046C87FFF;&h0000000018D38FFF;false
Module=modCubeSQLAdmin;webapp/modCubeSQLAdmin.xojo_code;&h00000000097C9FFF;&h0000000018D38FFF;false
Class=cntBase;webapp/containers/cntBase.xojo_code;&h0000000041D557FF;&h000000005859EFFF;false
WebContainer=cntStatus;webapp/containers/cntStatus.xojo_code;&h000000000A45BFFF;&h000000005859EFFF;false
WebContainer=cntCommands;webapp/containers/cntCommands.xojo_code;&h000000002752C7FF;&h000000005859EFFF;false
WebContainer=cntRegistration;webapp/containers/cntRegistration.xojo_code;&h000000002FA707FF;&h000000005859EFFF;false
WebContainer=cntRegistrationAction;webapp/containers/cntRegistrationAction.xojo_code;&h000000000788EFFF;&h000000005859EFFF;false
WebContainer=cntDatabases;webapp/containers/cntDatabases.xojo_code;&h0000000040B4DFFF;&h000000005859EFFF;false
WebContainer=cntGroups;webapp/containers/cntGroups.xojo_code;&h0000000034036FFF;&h000000005859EFFF;false
WebContainer=cntUsers;webapp/containers/cntUsers.xojo_code;&h00000000700FF7FF;&h000000005859EFFF;false
WebContainer=cntPrivileges;webapp/containers/cntPrivileges.xojo_code;&h0000000018AA4FFF;&h000000005859EFFF;false
WebContainer=cntConsole;webapp/containers/cntConsole.xojo_code;&h000000004BD2DFFF;&h000000005859EFFF;false
WebContainer=cntClients;webapp/containers/cntClients.xojo_code;&h000000002140EFFF;&h000000005859EFFF;false
WebContainer=cntLog;webapp/containers/cntLog.xojo_code;&h000000002B1057FF;&h000000005859EFFF;false
MultiImage=icon_128;resources/icon_128.xojo_image;&h000000007294E7FF;&h0000000035B107FF;false
BuildSteps=Build Automation;Build Automation.xojo_code;&h000000001394FFFF;&h0000000000000000;false
ColorAsset=colTextKey;styles/colTextKey.xojo_color;&h000000005870AFFF;&h00000000139DBFFF;false
Module=modWebStyles;styles/modWebStyles.xojo_code;&h0000000002BE7FFF;&h00000000139DBFFF;false
DefaultWindow=LoginPage
MajorVersion=0
MinorVersion=0
SubVersion=1
NonRelease=0
Release=0
InfoVersion=cubeSQL Web Admin
LongVersion=jo-tools.ch
ShortVersion=0.0.1
WinCompanyName=example.com
WinInternalName=cubesqlwebadmin
WinProductName=cubeSQL Web Admin
WinFileDescription=cubeSQL Web Admin
AutoIncrementVersionInformation=False
BuildFlags=&h180
BuildLanguage=&h0
DebugLanguage=&h0
Region=
WindowsName=cubeSQLWebAdmin.exe
MacCarbonMachName=cubeSQLWebAdmin
LinuxX86Name=cubeSQLWebAdmin
MacCreator=
MDI=0
MDICaption=
DefaultEncoding=&h0
AppIcon=cubesql-webadmin.xojo_resources;&h0
OSXBundleID=ch.jo-tools.cubesqlwebadmin
DebuggerCommandLine=--CubeSQLHostname=localhost --CubeSQLPort=4440 --CubeSQLUsername=admin --CubeSQLPassword=admin
UseGDIPlus=False
UseBuildsFolder=True
HiDPI=True
DarkMode=True
CopyRedistNextToWindowsEXE=False
IncludePDB=False
WinUIFramework=False
IsWebProject=True
WebDebugPort=8080
WebLivePort=80
WebSecurePort=443
WebProtocol=1
WebHTMLHeader=<style>\n.listboxDbHeaderAlignment th:nth-child(1)\x2C\n.listboxDbHeaderAlignment th:nth-child(3)\x2C\n.listboxDbHeaderAlignment th:nth-child(5) {\n text-align: center;\n}\n\n.listboxGroupsHeaderAlignment th:nth-child(2) {\n text-align: center;\n}\n\n.listboxUsersHeaderAlignment th:nth-child(2) {\n text-align: center;\n}\n</style>
WebHostingIdentifier=
WebHostingAppName=cubeSQLWebAdmin
WebHostingDomain=
LinuxBuildArchitecture=1
MacBuildArchitecture=4
OptimizationLevel=6
WindowsVersions={1f676c76-80e1-4239-95bb-83d0f6d0da78}|{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}
WindowsRunAs=0
MacOSMinimumVersion=
Binary file added cubesql-webadmin.xojo_resources
Binary file not shown.
Binary file added resources/icon_128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions resources/icon_128.xojo_image
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#tag MultiImage
Image icon_128
#tag ImageRepresentation
SaveInfo = APHRcwIABwDAAwAAYm9va8ADAAAAAAQQMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAApAIAAAQAAAADAwAAAAQAAAUAAAABAQAAVXNlcnMAAAAFAAAAAQEAAGp1ZXJnAAAACQAAAAEBAABEb2N1bWVudHMAAAAGAAAAAQEAAEdpdEh1YgAACAAAAAEBAABqby10b29scxQAAAABAQAAY3ViZXNxbC13ZWJhZG1pbi1kZXYJAAAAAQEAAHJlc291cmNlcwAAAAwAAAABAQAAaWNvbl8xMjgucG5nIAAAAAEGAAAQAAAAIAAAADAAAABEAAAAVAAAAGQAAACAAAAAlAAAAAgAAAAEAwAAnVMAAAAAAAAIAAAABAMAABCQBQAAAAAACAAAAAQDAABBkAUAAAAAAAgAAAAEAwAAUr8jAAAAAAAIAAAABAMAAJVf7wIAAAAACAAAAAQDAABaYd8FAAAAAAgAAAAEAwAAZ2LfBQAAAAAIAAAABAMAAGxi3wUAAAAAIAAAAAEGAADQAAAA4AAAAPAAAAAAAQAAEAEAACABAAAwAQAAQAEAAAgAAAAABAAAQcDiKhgAAAAYAAAAAQIAAAEAAAAAAAAAHwIAAAAAAAAfAgAAAAAAAAgAAAAEAwAABgAAAAAAAAAEAAAAAwMAAPUBAAAIAAAAAQkAAGZpbGU6Ly8vCwAAAAEBAABDYWRtaXVtIFNTRAAIAAAABAMAAABwxNjRAQAACAAAAAAEAABBxdYDwYAAACQAAAABAQAAOEFDQjE5RDItRjMxMi00MDExLTg2NzItMDM1NkE1NzM2NUEzGAAAAAECAACBAAAAAQAAAO8TAAABAAAA7xMAAAEAAAABAAAAAQEAAC8AAAAAAAAAAQUAADMAAAABAgAAZG5pYgAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAcG5nPz8/PwAAAAAAAAAAAOQAAAD+////AQAAAAAAAAASAAAABBAAAKgAAAAAAAAABRAAAFABAAAAAAAAEBAAAIgBAAAAAAAAQBAAAHgBAAAAAAAAAiAAAFQCAAAAAAAABSAAAMQBAAAAAAAAECAAANQBAAAAAAAAESAAAAgCAAAAAAAAEiAAAOgBAAAAAAAAEyAAAPgBAAAAAAAAICAAADQCAAAAAAAAMCAAAGACAAAAAAAAAcAAAKgBAAAAAAAAEcAAACAAAAAAAAAAEsAAALgBAAAAAAAAENAAAAQAAAAAAAAAF/AAAJQAAAAAAAAAIvAAAGgCAAAAAAAAAAA=
FullPath = /Users/juerg/Documents/GitHub/jo-tools/cubesql-webadmin-dev/resources/icon_128.png
PartialPath = resources\icon_128.png
#tag ImageSpecification
Comment =
Device = 31
HSize = 128.00
Orientation = Any
Platform = 15
PPI = 72
VSize = 128.00
#tag EndImageSpecification
#tag EndImageRepresentation
#tag ImageRepresentation
SaveInf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AAAAAAABSAAAMQBAAAAAAAAECAAANQBAAAAAAAAESAAAAgCAAAAAAAAEiAAAOgBAAAAAAAAEyAAAPgBAAAAAAAAICAAADQCAAAAAAAAMCAAAGACAAAAAAAAAcAAAKgBAAAAAAAAEcAAACAAAAAAAAAAEsAAALgBAAAAAAAAENAAAAQAAAAAAAAAF/AAAJQAAAAAAAAAIvAAAGgCAAAAAAAAAAA=
FullPath = /Users/juerg/Documents/GitHub/jo-tools/cubesql-webadmin-dev/resources/icon_256.png
PartialPath = resources\icon_256.png
#tag ImageSpecification
Comment =
Device = 31
HSize = 128.00
Orientation = Any
Platform = 15
PPI = 144
VSize = 128.00
#tag EndImageSpecification
#tag EndImageRepresentation
#tag ImageRepresentation
#tag ImageSpecification
Comment =
Device = 31
HSize = -1.00
Orientation = Any
Platform = 15
PPI = 216
VSize = -1.00
#tag EndImageSpecification
#tag EndImageRepresentation
End Image
#tag EndMultiImage
Binary file added resources/icon_256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions scripts/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#BASE IMAGE
FROM ubuntu:22.04

#ENVIRONMENT
ENV CUBESQL_HOSTNAME=host.docker.internal
ENV CUBESQL_PORT=4430
ENV CUBESQL_ENCRYPTION=AES256
ENV CUBESQL_USERNAME=admin
ENV CUBESQL_PASSWORD=

#INSTALL REQUIRED LIBRARIES
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y libunwind8 libglib2.0 libsoup2.4-1

#ADD APPLICATION TO DOCKER IMAGE
ADD / /app/

#EXPOSE PORT AND RUN APPLICATION
EXPOSE 80
WORKDIR /app
CMD /app/cubeSQLWebAdmin
Loading