Deploy your app
- How-to
- 1 minute
Permissions
To deploy your Dynatrace app, you need the following IAM permissions:
app-engine:apps:install
app-engine:apps:run
If you're planning to uninstall it completely, you might also need the following permission:
app-engine:apps:delete
Deploy from a local device
- Ensure your user has the required IAM permissions.
- Navigate to the root of your project.
- Run the following command in your terminal:
npm run deploy
Deploy from a CI/CD pipeline
- Create an OAuth client that has the required IAM permissions.
- In your CI/CD pipeline, set the environment variables
DT_APP_OAUTH_CLIENT_ID
andDT_APP_OAUTH_CLIENT_SECRET
with the generated client ID and client secret. - Run the following command within your pipeline:
npm run deploy
Examples
- Jenkins
- Github Actions
- Gitlab
Jenkinsfile
pipeline {
// Replace the following lines with a Docker or Kubernetes agent with an image with node v22
agent {
kubernetes {
// Example of a Kubernetes agent
cloud 'linux-amd64'
yaml """
kind: Pod
spec:
containers:
- name: nodejs
image: node22
args:
- cat
tty: true
"""
defaultContainer 'nodejs'
}
}
stages {
stage('Install') {
steps {
sh('npm ci')
}
}
stage('Lint') {
steps {
sh 'npm run lint'
}
}
stage('Build') {
steps {
sh('npm run build')
}
}
stage('Deploy') {
steps {
sh('npx dt-app deploy --skip-build')
}
}
}
}
.github/workflows/main.yml
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '22'
- name: Install
run: npm ci
- name: Lint
run: npm run lint
- name: Build
run: npm run build
- name: Deploy
run: npx dt-app deploy --skip-build
.gitlab-ci.yml
default:
image: node:22
stages:
- install
- lint
- build
- deploy
install:
stage: install
script:
- npm ci
artifacts:
paths:
- node_modules/
lint:
stage: lint
script:
- npm run lint
build:
stage: build
script:
- npm run build
artifacts:
paths:
- .dt-app
- dist
deploy:
stage: deploy
script:
- npx dt-app deploy --skip-build
Note
Every time you modify the app.config.json
file, you must increase the version number in the file before re-deploying the app.
If you don't increase the version number, you need to uninstall the current deployed version.
Uninstall the app
- Ensure your user or the OAuth token used on the CI/CD pipeline has the
app-engine:apps:delete
permission. - Run the following command in your terminal:
npm run uninstall
Still have questions?
Find answers in the Dynatrace Community