This documentation is for Dash Enterprise.
Dash Enterprise is the fastest way to write & deploy Dash apps and
Jupyter notebooks.
10% of the Fortune 500 uses Dash Enterprise to productionize AI and
data science apps. Find out if your company is using Dash Enterprise.
To set up CI/CD with Dash Enterprise, all you need to do is git push
your code from your CI system to Dash Enterprise. Dash Enterprise handles creating the builds (Docker containers), deploying those containers, and opening up those containers to network traffic. For more details on how deployment works, go to App Structure, Buildpacks, and Deployment Lifecycle.
This set of instructions demonstrates how to write a script that deploys your code to Dash Enterprise from a CI system. In practice, you can modify these scripts to only run when your code has been merged rather than on every branch and pull request.
To set up a CI pipeline for Dash Enterprise:
admin
and licensed_user
roles that will deploy the apps. This user can be a new or existing one (Creating a new user requires access to Keycloak). You’ll consider this user a service account whose purpose is strictly to deploy apps, while app owners still log in using their individual Dash Enterprise accounts to manage apps outside of deployment.git push
command over SSH. There are many ways to do this. Here is one way:Encode the SSH private key in base64:
Mac OS:
bash
cat id_ed25519 | base64 > id_ed25519.base64
Linux:
bash
cat id_ed25519 | base64 -w 0 > id_ed25519.base64
Windows:
bash
certutil -encode id_ed25519 id_ed25519.base64
replacing id_ed25519
with the location of your SSH private key.
This turns
bash
-----BEGIN OPENSSH PRIVATE KEY-----
MIIG4wIBAAKCA
[...]
GtUlPGZb+Dyu1
-----END OPENSSH PRIVATE KEY-----
into
bash
LS0tLS1CRUdJTiBP [...] UEVOU1NIIFBSSVZBV=
Encode your SSH configuration file in base64:
Mac OS:
bash
cat config | base64 > config-base64.txt
Linux:
bash
cat config | base64 -w 0 > config-base64.txt
Windows:
bash
certutil -encode config config-base64.txt
This turns
bash
Host *
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null
into
Vc2VyIGdpdAogHaH [...] ViX3RlbnmlubmdvCg==
Add the following environment variables to your CI tool:
SSH_PRIVATE_KEY
: The base64-encoded SSH private key.SSH_CONFIG
: Your base64-encoded SSH configuration file.Provide the following script to the CI tool. If the CI tool accepts YAML files that
run steps one at a time, then you can provide each of these commands on their own line.
```bash
set -x
echo ‘-----> Project directory’
pwd
ls -al
echo ‘-----> Creating ssh key’
echo “$SSH_PRIVATE_KEY” | base64 –decode -i > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519 # permissioning
eval “$(ssh-agent -s)” # setting ssh environment variable
echo ‘-----> Adding keys to ssh-agent’
ssh-add ~/.ssh/id_ed25519
echo ‘-----> Creating ssh config’
echo “$SSH_CONFIG” | base64 –decode -i > ~/.ssh/config
echo ‘-----> Adding git remote’
git config remote.plotly.url >&- || git remote add plotly git@<your-dash-enterprise-hostname>:<your-dash-app-name>
echo ‘-----> Deploying app’
git push plotly HEAD:main
```
You’ll need to make a few changes to this script:
<your-dash-enterprise-hostname>
with your Dash Enterprise host name.<your-app-name>
with the name of your app as initialized on Dash Enterprise.~/.ssh
may be different on your CI system. Consult your CI system’s docs on SSH.Trigger this CI script when code is merged into main
.