Main Content

Configure the Development Version of MATLAB Web App Server in MATLAB Compiler

Start Server Application

  1. Navigate to the development version of MATLAB® Web App Server™ installation location and run the server application. For information about installing the server, see Install the Development Version of MATLAB Web App Server in MATLAB Compiler.

    Operating SystemSteps

    Windows®

    (Administrator)

    Default location of the server application is:

    C:\Program Files\MATLAB\MATLABWebAppServer\R2024a\application

    Right-click MATLABWebAppServer.exe and select Run as administrator.

    Linux®

    Default location of the server application is:

    /usr/local/MATLAB/MATLABWebAppServer/R2024a/application

    At the shell prompt, type:

    run_MATLABWebAppServer.sh <MATLAB_Runtime_Location>

    For example:

    run_MATLABWebAppServer.sh /usr/local/MATLAB/MATLAB_Runtime/R2024a

    macOS

    Default location of the server application is:

    /Applications/MATLAB/MATLABWebAppServer/R2024a/application

    Double-click the app MATLABWebAppServer.app

Service Registration

  1. Click the Service Registration tab, and select one of two options:

    • Register the web apps service using a default account

      Selecting this option registers two services:

      • A service to run the server represented by the tab Server Service User.

      • A service to run the apps represented by the tab Worker Service User.

      Operating SystemServer Service InformationApps Service Information

      Windows

      Account Name: MwWebAppServerR2024a

      Service Name: mw-webapps-R2024a

      Account Name: MwWebAppWorkerR2024a

      Service Name: mw-webapps-launcher-R2024a

      Linux

      Account Name: MwWebAppsServerR2024a

      Service Name: mw-webapps-R2024a

      Service File: /etc/systemd/system/mw-webapps-R2024a.service

      Account Name: MwWebAppsWorkerR2024a

      Service Name: mw-webapps-launcher-R2024a

      Service File: /etc/systemd/system/mw-webapps-launcher-R2024a.service

      macOS (Intel® processor)

      Account Name: MwWebAppsServerR2024a

      Service Name: com.mathworks.mw-webapps-R2024a

      Service File: /Library/LaunchDaemons/com.mathworks.mw-webapps-R2024a.plist

      Account Name: MwWebAppsWorkerR2024a

      Service Name: com.mathworks.mw-webapps-launcher-R2024a

      Service File: /Library/LaunchDaemons/com.mathworks.mw-webapps-launcher-R2024a.plist

    • Register the web apps services using an existing local account

      Selecting this option requires you to register two services represented by the tabs Server Service User and Worker Service User using two local account names and passwords.

  2. You can start or stop the installed service from the Configure and Run tab. The service is automatically started once the service is successfully registered. If the service does not start automatically, click Start.

    1. Start/Stop the server.

    2. Open the web apps home page.

    3. Open the app folder containing the web app archive (.ctf) files.

    4. Open the server log folder.

    5. Specify the port number. Default port is 9988.

    6. Startup Timeout (sec): Defines the maximum time to prepare a new session for the requested app, in seconds. If server is under heavy load or hardware is not adequate, you may need to tweak this setting. Default value is 45 seconds.

    7. Session Timeout (min): Defines the time interval in minutes after which session will be stopped on the server. When session is running and browser tab is opened, periodic heartbeat messages will let server know that user is still interested in the session. If session was abandoned for reasons like computer going to sleep or network disconnected, this interval will define for how long the session will be kept alive on the server. Default value is 5 minutes.

    8. Enable SSL and use HTTPS. For more information, see Enabling HTTPS.

  3. Once you have installed and started the server, click the Open App Folder button to open the folder where compiled web apps are served from. Then serve your web apps by dropping their appName.ctf files in this folder. If the path specified for App Path does not exist, it is created after you start the service.

  4. To open your web apps home page, click Open Home Page.

    You can also configure the service by specifying:

    • the port number used for your web apps

    • timeout values for the session and for startup time

    After making any changes, click Apply to save your configuration.

  5. To stop the service, go to the Configure and Run tab, and click Stop.

  6. To unregister the service, go to the Service Registration tab, and click Unregister.

Note

  1. The maximum number of sessions that the server supports is limited to 32. However, the amount of RAM on the machine may limit you to fewer than 32 sessions.

  2. The server limits the number of MATLAB Compiler™ licensed users who can upload and run web apps to 10.

Secrets Management

Use the secrets management tab to securely handle sensitive information required by your web app. This includes, but is not limited to, passwords, API keys, database connection strings, and cryptographic keys. After modifying secrets stored on the server, you must restart the server to apply the changes.

Add

To add a secret to server storage vault:

  1. Click the Add button to initiate the process of adding a new secret.

  2. In the New Secret Key field, input the name of the secret. This serves as a unique, case-sensitive identifier and should be descriptive of the data it represents. For example, to store a username for a SQL Server, you might enter SQLServerUsername. The secret name is stored as an unencrypted string scalar in your vault.

  3. In the Value field, provide the secret's corresponding value. For instance, the actual username for the SQL Server would be entered here. This value is initially input in plain text.

  4. Click Apply to save the secret. Upon doing so, the secret value is encrypted and stored in your vault using AES-256 encryption, an industry-standard for security.

Remove

To remove a secret key:

  1. From the Secret Key list, select the secret you wish to remove. Ensure you choose the correct key as this action cannot be undone.

  2. Click the Remove button to permanently delete the selected secret from the vault.

Once removed, the secret is no longer retrievable, and any applications or services relying on this secret will need to be updated accordingly to prevent disruptions in functionality.

Metadata

Metadata provides additional context to a secret key without being part of the key itself. For example, metadata can include the creation date of a secret, the name of the person who created it, or the environment it's used for. To add metadata to a secret key:

  1. From the list of secret keys, select the one you wish to annotate and click the Metadata button.

  2. Press the Add button to insert a blank metadata entry, displayed as a key-value pair, into the dialog.

  3. Double-click the placeholder <new key> and enter a descriptive name for the metadata field.

  4. Double-click the placeholder <new value> and input the relevant information that corresponds to the key.

  5. Click Apply and press OK to confirm.

You can introduce multiple metadata entries to a single secret key by repeating the steps above for each new key-value pair.

If at any point you need to remove metadata:

  • Select the key-value pair you intend to delete and click the Delete button.

By carefully managing metadata, you ensure that each secret key is accompanied by useful information that can aid in its identification, usage, and lifecycle management.

Related Topics