Got feedback? We welcome contributions and feedback. Create an issue or email devrel@dynatrace.com
Kudos go to Adam Gardner (@agardnerIT) for doing most of the technical work and Katharina Sick (@katharinasick) for her help with Backstage.
Watch a full demo and more on YouTube as part of Observability Guide for Platform Engineering - Part 2
Download the Observability Guide to Platform Engineering eBook
Thanks for being interested in this Platform Engineering Codespace Demo. This demo is a smaller version of our Platform Engineering Tutorial with Dynatrace that we delivered for Perform 2024 as a HOTDAY. This repo stands up a reference IDP (Internal Development Platform) to show case a self-service onboarding and release of applications that are automatically observed and validated with Dynatrace - all with the power of GitHub Codespaces (or any other similiar tool that supports devcontainers).
The tools in this IDP include:
- GitHub (as your Git repo)
- Backstage (as your self-service portal)
- ArgoCD (as your GitOps operator)
- Argo Workflows (to trigger post deployment tasks)
- OpenTelemetry (for standard observability)
- OpenFeature (for feature flagging)
- Keptn (for deployment observability)
- KubeAudit (for additional cluster level security checks)
- KubeHunter (for additional security checks)
- Dynatrace (your observability, security and automation platform)
If you follow all instructions you should have your own IDP running in a GitHub Codespace within about 5-10 minutes!
Note: This currently only works in GitHub-hosted devcontainers. It does not run locally (yet). We are investigating support for this + Gitpod support. If you have experience in these areas, we ❤️ contributions so get involved!
If you don't already have a Grail enabled Dynatrace SaaS tenant, sign up for a free trial here: free 15 day Dynatrace trial
Make a note of the Dynatrace environment name. This is the first part of the URL. abc12345
would be the environment ID for https://abc12345.apps.dynatrace.com
- For those running in other environments (such as
sprint
), make a note of your environment:dev
,sprint
orlive
The following link will provide some oAuth permissions. To these, please also include the following
document:documents:write
document:documents:read
automation:workflows:read
automation:workflows:write
storage:logs:read
storage:events:read
storage:events:write
storage:metrics:read
storage:bizevents:read
storage:bizevents:write
storage:system:read
storage:buckets:read
storage:spans:read
storage:entities:read
storage:fieldsets:read
Follow the documentation to set up an OAuth client + policy + bind to your service user account email.
This is required so that the codespace can create documents (notebooks + dashboards) in Dynatrace and the platform can send business events (aka bizevents) and to Dynatrace.
You should now have 5 pieces of information:
- A DT environment (
dev
,sprint
orlive
) - A DT environment ID
- An oAuth client ID
- An oAuth client secret
- An account URN
Create a Dynatrace access token with the following permissions. This token will be used by the setup script to automatically create all other required DT tokens.
apiTokens.read
apiTokens.write
You should now have 6 pieces of information:
- A DT environment (
dev
,sprint
orlive
) - A DT environment ID
- An oAuth client ID
- An oAuth client secret
- An account URN
- An API token
Fork this repo.
⚠️ This step is important!⚠️
This demo uses one GitHub action to automatically merge Pull Requests when apps are onboarded.
In your fork, go to Actions
and click the green button: I understand my workflows, go ahead and enable them
.
In your fork:
- Switch to the
main
branch - Click the green
Code
button - Change to
Codespaces
- Click the
...
and chooseNew with options...
Warning! Do not click the green "Create codespace on codespace" button!!
Fill in the form and launch the codespace.
If you have already defined the environment variables in your repository, you'll see a screen asking you to associate those secrets with this repository. Please check the boxes as shown below.
The codespace will launch in a new browser window.
Wait until the Running postStartCommand...
disappears. It should take ~10 minutes.
Get ArgoCD password:
ARGOCDPWD=$(kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d)
echo $ARGOCDPWD
The username is: admin
Change to Ports
tab and open ArgoCD (port 30100
) & log in.
Backstage is also available (port 30105
).
In Backstage (port 30105
), navigate to "Create" and use the "Create a New Application" template.
Backstage will open a Pull Request on GitHub and the automerge action will immediately merge that PR (for convenience in the demo setup).
The new repo will be templated into the customer-apps
folder.
When Argo picks up the app, it will become available on port 80
. Click ports
and open the Demo App
link.
Append your application name, team name and application environment to the path in the following format:
https://CodeSpaceName-80.app.github.dev/simplenodeservice-team01-preprod
The codespace self-tests on startup so look for a trace showing the end-to-end health:
https://abc12345.sprint.apps.dynatracelabs.com/ui/apps/dynatrace.classic.distributed.traces/ui/diagnostictools/purepaths?gtf=-30m&gf=all&servicefilter=0%1E50%11codespace-platform%1067%11startup-automated-test
- Open the
Distributed Traces
screen - Filter for
Service Name ~ codespace-platform
- Filter for
Span name (ingested spans only) ~ startup-automated-test
If something goes wrong setting up the codespace, logs are sent directly to the Dynatrace SaaS ingest endpoint so fetch logs
to see what went wrong.
TODO. See this issue.
If you follow the above instructions, a GitHub Codespace will be created under your account. This is effectively a container running on GitHub's cloud infrastructure.
GitHub provides generous free usage limits and (by default) sets the billing limit to $0 (so you cannot be charged without explicit consent).
For most users, there will be absolutely no charge for running this demo. However, we advise deleting the codespace after this tutorial. To do so, go to https://github.com/codespaces and delete the codespace.
For more information, see GitHub Codespaces documentation.
tail -f /workspaces/.codespaces/.persistedshare/creation.log