Skip to content

App Development Guide

In Foundry, apps are dockerized containers designed to run on a specified port, optionally handling file-based inputs. This containerized approach ensures portability, consistency, and ease of deployment across environments, whether on local machines, HPC clusters, or cloud platforms.

This guide provides a general overview of app development, including best practices for structuring directories, containerizing applications, and integrating them within the Foundry platform. While all apps share the same fundamental architecture, specific examples—such as R-Shiny apps or Jupyter Notebooks—illustrate unique configurations tailored to their use cases.

Anatomy of an App

App Definition

In the app definition, set the following values:

  1. Set the name of the app
  2. If the docker image is hosted on Dockerhub, provide the path
  3. Select the container
  4. Set status to active
  5. The command to run when the container is activated. This can be left blank if the run command was set in the dockerfile. (as above CMD ["R", "-e", "shiny::runApp('/gsea-explorer')"])
  6. Set the port number. This should match the port that is set in the app.R file.

    options(shiny.host = "0.0.0.0", shiny.port = 8789)
    
  7. Set Websocket-reconnection-mode to None (default)

  8. Set the Container Environment to ``` DISABLE_AUTH: true WWW_ROOT_PATH: "/api/route/#{proxy.getRuntimeValue('SHINYPROXY_PROXY_ID')}/"

Example R-Shiny App

This directory structure isn't required, we find this structure helpful to create applications that are both reproducible and easy to maintain.

A directory structure similar to below can be tracked on Github and Dockerhub for easy version control and containerization.

|-- parent-directory/
    |-- README.md
    |-- Dockerfile
    |-- app-directory/
        |-- app.R
        |-- R/
            |-- # additional scripts sourced by app
            |--
            |--
        |-- www/
            |-- # CSS files
            |--
            |--
        |-- data/
            |-- # Data files used for app
            |--
            |--