Domino makes it easy to publish interactive analytical dashboards, or apps. Apps are a great way for data scientists to share work with many stakeholders. They empower others to interact with data and analyses on their own.
Apps in Domino let data scientists use their preferred app framework. Most often, data scientists publish apps built in Shiny, Dash, or Flask. But like the rest of the platform, when you publish an app in Domino, it’s open and flexible; publish an app with any framework that serves content over HTTP.
Domino amplifies the power of these frameworks and provides powerful capabilities automatically. With one click in Domino, publish your Shiny, Dash, Flask, or other app and immediately get these benefits:
-
Robust hosting on vertically-scalable hardware
-
Permission settings to control access to your app
-
Logs that show app users easily
-
Version control to snapshot fully-reproducible artifacts each time you publish a new version of your app
When you publish an app, Domino looks for an app.sh
file in your project to find the launch instructions. Aside from your app.sh
file, your app development process mirrors development outside of Domino; just include your app’s files in your Domino project. This consistency ensures your code is portable if you ever need to run it elsewhere.
When Domino launches your app, it runs the app.sh
file within the container that contains your project files. The app.sh
file must contain the command(s) to start the web hosting process.
For a Shiny app, this is the simplest form for your app.sh
file:
R -e 'shiny::runApp("./", port=8888, host="0.0.0.0")'
See more complete samples and app code:
Once your app.sh
and app code is complete, follow these steps to publish your app:
-
Make sure your project contains your app code and an
app.sh
file. -
In your project, go to Publish > App.
-
Fill in the form with your desired values.
Tip -
Click Publish.
To view your app, anyone with access can browse directly to the app URL. To get the URL, go to App in your project and click Copy App Link.
To browse more apps, go to the Launchpad in Domino UI. Here you can see all apps with Show in Launchpad enabled.
You can find these features in your project’s App page.
Access controls and permissions
Manage access with the Permission tab:
-
Anyone, including anonymous users - In this mode, anyone with the URL can access your app, even if they don’t have a Domino account.
-
Anyone with an account - Anyone logged in to Domino with an account can access the app.
-
Invited users only - Only users you explicitly invite can access the app.
-
Invited users (others can request access) - Only users you explicitly invite can access the app, but users can request access (and you approve).
Version control
The App Versions tab contains an entry for each past version of a published app. This history is helpful if you need to browse to a previous version to see what changed or revert to an earlier state. You can also check when a prior version was changed or check the logs for a previous version.
You might want to create apps that need to know who uses them. For example, this is useful if you want to load specific default values or preferences, or if you want to access different data based on who views your app.
To enable this, Domino passes the username of a user who accesses your Domino app in an HTTP header named domino-username
.
If your app framework gives you access to the HTTP headers of the active request, retrieve the domino-username
for use by your app code. If you allow users who are not logged in to Domino to view your apps, the value of the domino-username
header is Anonymous
.
Example
Create the files for this Flask example that gets the Domino username of an app viewer in your project:
#!/usr/bin/env bash
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
export FLASK_APP=app.py
export FLASK_DEBUG=1
python -m flask run --host=0.0.0.0 --port=8888
Here is a simple app.py
file that renders a template named index.html
.
This app imports request
from flask
, which gives you access to the headers of the active HTTP request.
import flask
from flask import request, redirect, url_for
class ReverseProxied(object):
def __init__(self, app):
self.app = app
def __call__(self, environ, start_response):
script_name = environ.get('HTTP_X_SCRIPT_NAME', '')
if script_name:
environ['SCRIPT_NAME'] = script_name
path_info = environ['PATH_INFO']
if path_info.startswith(script_name):
environ['PATH_INFO'] = path_info[len(script_name):]
return self.app(environ, start_response)
app = flask.Flask(__name__)
app.wsgi_app = ReverseProxied(app.wsgi_app)
# Homepage which uses a template file
@app.route('/')
def index_page():
return flask.render_template("index.html")
There is a template file at templates/index.html
that fetches the
domino-username
header from the requests
object and renders it.
<!DOCTYPE html>
<html>
<body>
<h1>Your username is {{ request.headers.get("domino-username") }}</h1>
</body>
</html>
If you host this app in Domino and open it, you’ll see something like this where the username shown matches the username of the app user.
On the App Versions tab, click on a version in the table to see information about that version:
-
The Logs tab displays logs from Domino’s execution of your app (Setup output) and from any logs that your app generates (User output).
-
The Details tab shows the specific version of project files and datasets the app uses.
-
The Resource Usage tab shows you CPU and memory utilization.
-
Apps run until you explicitly stop them. If your app isn’t used anymore, stop it to optimize your compute spend.
-
Unlike a job or a workspace, an app that runs in Domino never commits (or syncs) file changes from its local disk to the Domino project’s file store. If you want to run an app that persists data, your app’s logic must write it to some data source, such as a database.
-
The performance of your app depends on the design of the application. See Optimize App Scalability and Performance.