Deploying web apps on Linux

Introduction

Web apps are often much simpler for your users and customers to use than desktop apps. They don't have to worry about installing any software or dealing with updates because now you do. Instead of your customers deploying your software on their computers, you have to deploy the software on your web servers.

You can deploy your web apps to Virtual Private Servers (VPS) with proper configuration. Shared Hosting typically does not work due to general lack of configurability. For the simplest hosting and deployment experience, you should consider using Xojo Cloud.

Additional information here:

  • Web App Deployment Overview

  • Web App Deployment Details

Deployment steps

  1. Build your web app for Linux.

  2. Connect to your web server using the SFTP client of your choice.

  3. Navigate to the folder where you want your web app.

  4. Upload your web app (including the Libs and Resources folders) using Binary mode.

  5. Verify execute flag.

Now you need to run your web app on the server. You'll need to connect to the server in order to do this, using ssh (Secure Shell). Secure Shell (and the ssh command) are available from the terminal or command line or Windows, macOS and Linux.

  1. Connect to the server using ssh (secure shell) with this command: ssh login@mywebsite.co

  2. Enter the password when prompted.

  3. Navigate to the folder where you uploaded your web app.

  4. Start the app using this command: ./TestApp

You can now access your web app in your web browser using the domain name and port. If "TestApp" was compiled to use port 8080, you can access it using a URL like this:

Note that if you exit from ssh your web app will terminate unless you daemonize it. Use this code in the App.Opening event to daemonize a standalone web app:

Call Daemonize

On macOS, the use of Daemonize is discouraged by Apple. You should use launchd instead.

Note

Xojo does not provide support for configuring your web server for use with Xojo web apps. If you require easy, one-click deployment of your Xojo web apps consider using Xojo Cloud.

Load balancing

Using load balancing software such as HAProxy or NGINX with standalone web apps can be a way to greatly increase concurrent users and improve performance.

Watch this XDC video for more information: Load Balancing and Other Techniques for Enterprise Web Apps

Note

Xojo does not provide support for configuring your web server for use with Xojo web apps. If you require easy, one-click deployment of your Xojo web apps consider using Xojo Cloud.

Troubleshooting

Things don't always go this smoothly, however. This section has some tips for you as you troubleshoot.

32-bit libraries

By default, 64-bit version of Linux do not include the 32-bit libraries that are needed by 32-bit Xojo web apps. Please refer to the System Requirements for details on how to apply the 32-bit libraries to your Linux distribution. Also make sure that the libicu library is available. You can avoid this step by building your web app as a 64-bit app.

Dependencies

Not all Linux installations have the necessary dependencies for Xojo apps pre-installed. Refer to the System Requirements for details. To determine which libraries are used by Xojo, you can use the ldd command:

ldd Xojo

Web logs

If you get an "Internal Server Error" or any error, you need to check the web server log for specifics. A common source of problems is incorrect permissions.

Permissions

Your web app needs to have the correct permissions enabled so that the web server can run the web app. This is done using the chown and chmod commands. The necessary permissions vary by the Linux distribution and Apache installation. Permissions of "755" are often a good starting point.

Executable settings

When uploading your web app to the server, ensure the app and its libs folder are uploaded in binary mode, everything else in ASCII mode. Many FTP clients get this correct automatically, but some do not.

Unable to locate a library in libs folder

First, ensure you have uploaded all the contents of the Libs folder in Binary mode.

Check the Options FollowSymLinks in your Apache configuration.

Internal server error

This can mean any number of things. Check your web server logs.