|
| 1 | +# Symfony demo app for Dynatrace |
| 2 | + |
| 3 | +This Demo is to show how PHP SDK can be used in a Symfony application for a Docker environment with monitoring tools enabled. |
| 4 | + |
| 5 | +For now, we configured the docker environment for Dynatrace. |
| 6 | + |
| 7 | +## Requirements |
| 8 | + |
| 9 | +- PHP at least 8.1 |
| 10 | +- Symfony 6 |
| 11 | +- Docker |
| 12 | +- Registration in Dynatrace |
| 13 | + |
| 14 | +## Installation |
| 15 | + |
| 16 | +1. Clone/Download the example folder. |
| 17 | +2. Navigate to the path `symfony-app-dynatrace/`. |
| 18 | + |
| 19 | +### Token creation |
| 20 | +1. Create the token in Dynatrace at least with PAAS and "Ingest metrics" scopes. |
| 21 | +2. The token is necessary to paste it in the .env file later. |
| 22 | + |
| 23 | + |
| 24 | +## Using the Symfony Demo app in a Docker Environment |
| 25 | + |
| 26 | +### Configuring the Demo App |
| 27 | + |
| 28 | +1. Open the Terminal |
| 29 | +2. Run `composer install` or `composer update` |
| 30 | +3. Copy the [.env.sample](docker/php/.env.sample) file to the root folder renaming it to `.env`. So in the root folder run `cp docker/php/.env.sample .env`. |
| 31 | +4. Fill the `.env` file with the missing data. |
| 32 | +5. Run `composer dump-env prod` |
| 33 | + |
| 34 | +### Preparing the Docker environment |
| 35 | + |
| 36 | +1. Always in the Root of the project |
| 37 | +2. Run `docker compose up` |
| 38 | +3. Wait until the environment is running |
| 39 | + |
| 40 | +### Navigate the application |
| 41 | + |
| 42 | +1. Navigate to [http://localhost:8080/products](http://localhost:8080/products) or [http://localhost:8080/categories](http://localhost:8080/categories) |
| 43 | +2. The result would be an array objects containing products or categories. |
| 44 | +3. If it's not make sure that in Merchant Center in the project key selected (see the environment variable for the client credentials in the point 3 of the Installation section), there would be some data for products and categories. |
| 45 | +4. Go in the Dynatrace UI to see the monitoring of the API calls. |
| 46 | + |
| 47 | +The docker configuration files will be found in the `docker/php` folder and the `docker-compose.yml` in the `symfony-app-dynatrace/` folder so they can be used in your application. |
0 commit comments