Table Of Contents:
- Introduction
- Get Started
- Get Pro (coming soon)
- Custom Use-case Examples
- Ansible Roles
- Repository Structure
- Versioning
- Contribute
- Troubleshoot
In addition to use-cases provided natively by the ACE-Box, it is now possible to create custom use-cases. This capability allows using the ACE-Box as a platform to develop your own scenarios, demonstrations, trainings, etc.
In the next sections you can find all the needed information to develop your own custom use-case from scratch.
Let's create a custom use-case from scratch, in order to replicate the Basic Observability Demo
use-case previously presented.
-
First of all, create a new repository using the ext-template as a template.
-
Clone your recently created repository locally. Later on, you could either make changes locally or within the ACE-Box VM instance.
git clone https://github.com/dynatrace-ace/basic-dt-demo.git
-
Now, follow the ACE-Box installation guide to spin up a VM and deploy the modules and configurations defined in the custom use-case template.
Be sure to configure theuse-case
variable within theterraform.tfvars
file to point to the custom use-case repository that we are about to develop:use_case = "https://<user>:<personal-access-token>@github.com/dynatrace-ace/basic-dt-demo.git"
Note: you need to provide your github user and personal access token. Replace the placeholders above with your own values.
-
Finish the installation guide and check the output of the terraform apply command with:
terraform output
Note: it should retrieve the IP & SSH key to access the VM that has been just created (ACE-Box)
-
At this point, the framework has provisioned a VM on the selected Cloud Provider and it has automatically cloned our custom use-case repository (
basic-dt-demo
) under the/home/repos/repos/basic-dt-demo
path.
Next step is to go ahead implementing our custom use-case directly from the newly-created machine and, for for this reason, it's required to access the VM via SSH.
Recommended: use an IDE such as Remote Development from Visual Studio for a more straight-forward and comfortable development experience.
SSH config file example:Host <your-ace-box-ip> HostName <your-ace-box-ip> IdentityFile <path-to-the-ssh-key> User ace
At this stage, we have an empty ACE-Box (Linux VM) and we can start building our custom use-case on top of it.
To do so, we are going to use Ansible
and Ansible Roles
to automate and simplify the process. Check out the Ansible Roles section for further details.
More in detail, we’ll build our custom use-case incrementally, modifying the my-use-case/tasks/main.yml
configuration file step-by-step to instruct the Ansible engine on what to deploy to the ACE-Box VM. After each step, we let the engine parse the updated file and deploy the changes accordingly.
-
After having successfully logged in into the ACE-Box VM, we are going to trigger a first run of the
main.yml
configuration file (which just contains a simple "Hello World" print at this stage) to get familiar with the ACE-Box and Ansible.To let the Ansible engine parse the configuration file and implement the instructions, run the following command on the terminal:
ace enable https://github.com/dynatrace-ace/basic-dt-demo.git --local
Note:
The
ace enable --local
command does not clone the repository again, but it works with the local repository (which is at/home/repos/ace-box-ext-template
) and enables the latest changes made during the use-case development. Furthermore, the command does not synchronize any local updates with the remote repository.The
ace enable --local
command is particularly useful during use-case development, as it allows to test and iterate on their changes without overwriting the work or interacting with the remote repository unnecessarily.
-
Now, in order to replicate the
Basic Observability Demo
, we first need to deploy a k8s distribution. To do so, Read the k3s role documentation and add the following instructions to themain.yml
file:- include_role: name: k3s
-
Now that we declared what we want to deploy on the VM, we need to install k3s by running again the ansible
main.yml
leveraging on the same command we used at step7
:ace enable https://github.com/dynatrace-ace/basic-dt-demo.git --local
-
Next step would be to add Dynatrace monitoring to our ACE-Box. Repeat step
8
&9
, but this time following the dt-operator role instructions:include_role: name: dt-operator
-
Let's add a demo app. Repeat step
8
&9
, but this time following the app-easytrade role instructions:- include_role: name: app-easytrade
-
Check the ingress defined for
easytrade-app
in order to access externally to the demo app:ace@ace-box-4c9z:~$ kubectl get ingress -A NAMESPACE NAME CLASS HOSTS ADDRESS PORTS AGE easytrade easytrade-ingress <none> easytrade.35.225.173.223.nip.io 10.128.0.20 80 113s
This is how your main.yml
should look like at the end of Part B
.
- Once you're happy with your changes, commit and push changes to the remote repository. Now you could safely destroy the ACE-Box following the instructions contained in the installation guide.
Whenever you'll recreate it, all the resources and modules defined within the configuration files will get created automatically.
Let's extend our initial Basic Dynatrace Observability use-case, by using more OOTB & custom roles
- Add dashboard & gitlab
Coming soon...
- Create dt token & oauth token
Coming soon...
- Create DT configuration using Monaco, installing an App
Coming soon...
- Extending it, shell script, use variables (what default variables are avaiblable, extra.vars from terraform), custom role
Coming soon...
- What are and how to use Ansible variables
Coming soon...
Ansible is used for automatically setting up and deploying modules on top of the compute instance (VM) created by the ACE-Box framework via Terraform.
Ansible roles play a critical role in automating the setup and configuration of resources for custom use-cases. They are modular units that define specific tasks, such as installing software, configuring environments, or managing services. By leveraging these roles, ACE-Box simplifies the process of provisioning and configuring environments, making the creation and execution of use-cases more efficient.
Out-of-the-box Ansible roles are the roles that are natively provided by the ACE-Box framework, which cover common tasks and scenarios. Leveraging OOTB Ansible roles is recommended and ensures rapid and consistent deployments.
Referring to the Basic Obsevability Demo example, we have used several OOTB Ansible roles (k3s
, dt-operator
and app-easytrade
) to deploy all the needed modules within the ACE-Box VM.
Check out the OOTB roles ReadMe for the complete list of Ansible roles natively provided by the ACE-Box framework.
All the information and the instructions to use an OOTB Ansible role are contained in the ReadMe file located within the folder where the role is defined.
For example, dt-operator ReadMe contains all the instructions to use and the dt-operator
role.
If a particular use-case requires actions beyond the OOTB roles, custom Ansible roles can be defined to meet those specific requirements. These custom roles can be integrated into the use-case's configuration, giving users flexibility while still maintaining a structured, automated approach.
In order for the ACE-Box to understand and properly deploy all the custom use-cases' modules using Ansible, it's mandatory that the custom use-case repository complies with the following folder structure:
roles/
my-use-case/
defaults/
main.yml
tasks/
main.yml
...
More specifically, a folder named roles
must to be available at the repository root, and it must include at least a my-use-case
(literal, not renamed) sub-folder.
This roles
folder, as well as all subfolders and files included in it, is synchronized with the ACE-Box's Ansible working directory. Upon a successful content sync, Ansible engine tries to use this my-use-case
folder as an Ansible role and executes all the instructions specified within the configuration files.
Besides, it is possible to create other sub-folders to source additional custom Ansible roles:
roles/
my-use-case/
additional-custom-ansible-role/
...
For more information, please check out the official Ansible documentation.
At one point, you probably want to create a hardened release of the custom repository you're working on. This is particularly important when a custom use-case is used as part of a hands-on training, etc.
A specific ref (version or branch) can be targeted by appending @my-version
it to the use_case
variable, e.g.:
use_case = "https://<user>:<token>@github.com/my-org/[email protected]"
It is possible to extend the out-of-the-box use-cases by integrating the needed configuration files into the ACE-Box repository.
If you get the following error lines while trying to access the ACE-Box server:
[10:04:38.930] Exec server for ssh-remote+35.225.173.223 failed: Error: Remote host key has changed, port forwarding is disabled
[10:04:38.930] Error opening exec server for ssh-remote+35.225.173.223: Error: Remote host key has changed, port forwarding is disabled
Check also in that piece of logs, where the known_hosts are defined, for example:
Offending ECDSA key in /Users/<user>/.ssh/known_hosts:6
And run the following command locally in order to remove the known_hosts:
rm /Users/<user>/.ssh/known_hosts
Then try to access again your VM