Docker deployment of Web 2.0 Apps

Hi All,

For testing purposes I am trying to deploy a web app to a Linux based container. With my old Web 1.0 apps this still succeeds, however, with my new Web 2.0 app the container runs, but no pages are loaded/shown in the browser. The fav-icon is loaded and the page source show some Xojo statements and a bunch of scripts:

I have tried with multiple apps, same result.

I used this dockerfile to compose the image:

#BASE IMAGE
FROM ubuntu:20.04

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

#ADD APPLICATION TO DOCKER IMAGE
ADD / /app/

#EXPOSE PORT AND RUN APPLICATION
EXPOSE 80
WORKDIR /app
CMD /app/my_application

There are no errors in the logs as far as I can see. I think that I might be missing some libraries? Anybody has an idea or a working example for a dockerfile with the correct libraries?

Jacco

The system requirements seem to indicate that youā€™re missing glibc and libstdc++

  • glib 2.0
  • glib 2.64.6 (ARM 64-bit)
  • glibc-2.11 (32-bit)
  • glibc-2.14 (64-bit)
  • glibc-2.31 (ARM 64-bit)
  • libstdc++.so.6.0.13
  • libunwind8

https://documentation.xojo.com/resources/system_requirements_for_current_release.html#system-requirements

2 Likes

Hi Greg

Thx for pointing out this page, this is probably what I am looking for. I will report back if this is the case. As soon as I am back I will test this.

regards,
Jacco

FWIW, I have done this with Web 2.0. Iā€™ll look up my settings when I get to my desk.

That would be great, thanks for helping!

You looking to auto deploy on digitalocean?

This is what iā€™m using:

#BASE IMAGE
FROM debian:latest

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

#ADD APPLICATION TO DOCKER IMAGE
ADD / /app/

#EXPOSE PORT AND RUN APPLICATION
EXPOSE 80
WORKDIR /app
CMD /app/[appname]

replace [appname] with the actual name of the build app file (executable)
i use debian cause of less bloat and more speed.

1 Like

Hi Derk, no, Iā€™m putting my app on Docker Hub so that the customer can pull new images as they are pushed from my system and test this in his own Docker container. Thx for sharing your dockerfile and advice. I will test this also.

1 Like

I have recently updated one of my examples: GitHub: jo-tools/crccalculator
It now uses a DockerFile based on Ubuntu 22.04.

Xojo Web App 2 Docker

The above GitHub repository contains Documentation about how to package a Xojo built Web Application in a Docker Image. The Web application Xojo example project CRCCalculatorWeb.xojo_project includes a Post Build Script which automates the task of building the Docker Image of the web application.

9 Likes

Hi JĆ¼rg, this Docker file works, and Derkā€™s version also. Now I seem to run into another issue where I use a subclassed URLConnection. That seems to do nothing and I cannot ā€˜Try/Catchā€™ the exception. Maybe better to put this one in another threadā€¦ I have libsoup included in the docker so in theory it should work.

Maybe check the url again?
Iā€™m sure i use urlconnection in my releases. Perhaps you can check ā€œldd appnameā€

Do you use the error event to log your issues?

I am testing with Windows and Linux and got confused somehow. URLConnection is doing its job fine but I messed up an OAuth2 routine prior to the request I needed the token for. So I ended up using an invalid token for the request. Therefore there was no exception to catch besides an unauthorized error:-) Now it is working fine and dandy:-)

I have used your debian dockerfile, however I got some strange results with URLConnection when I use libsoup2.4-1 When I change that to libsoup2.4 it works fine.

Perhaps xojo may need to update the system requirements then?
Iā€™m always using this libsoup2.4-1 thanks for the info.
Do you build with 2023R4 ?

Iā€™m not sure, you could try to test a URLConnection in a small project with this libsoup version. Xojoā€™s requirements are stated libsoup version 2.4

Yes I build with 2023R4

I see, so that package you used was ā€œlibsoup2.4ā€ ?

Yes, correct, that worked for my App

1 Like