-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tutorial pages, update quick start guides (#90)
- Loading branch information
Showing
7 changed files
with
186 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Tutorial 1: Two services | ||
|
||
> [!NOTE] | ||
> | ||
> This tutorial is work in progress. | ||
Make sure that you have either completed the | ||
[docker compose](../quick-start/docker-compose/README.md) or | ||
[kubernetes](../quick-start/kubernetes.md) quick start. | ||
|
||
In this tutorial you will learn more about the structure of an application | ||
simulation configuration (app sim config) and how you can influence the behavior | ||
of your services. | ||
|
||
Create a new empty directory, in this directory, create a `config.yaml` file | ||
with the following content: | ||
|
||
```yaml | ||
services: | ||
frontend: | ||
type: java | ||
endpoints: | ||
http: | ||
/list: | ||
- http://backend/list/items | ||
backend: | ||
type: java | ||
endpoints: | ||
http: | ||
/list/items: | ||
- slow,1024 | ||
loaders: | ||
user1: | ||
type: curl | ||
wait: 5 | ||
sleep: 1 | ||
urls: | ||
- http://frontend/list | ||
``` | ||
This configuration file defines two services and one loader: | ||
1. The service `frontend` is a Java-based application, that provides an HTTP | ||
endpoint called `/list`. When this endpoint gets called, it will send a HTTP | ||
request to the URL `http://backend/list/items` | ||
2. The service `backend` is also a Java-based application that provides an HTTP | ||
endpoint, called `/list/items`. When this endpoind gets called, it will some | ||
"slow" code for ~1024 milliseconds. | ||
3. The loader `user1` is a [curl](https://curl.se/)-based load generator. It | ||
will wait 5 seconds after start up and then call the URL | ||
`http://frontend/list` repeatedly. It will wait 1 second between each call. | ||
|
||
Use your preferred [generator](../../scripts/generators/) to deploy this | ||
simulation: | ||
|
||
- For docker compose run | ||
|
||
```shell | ||
docker run --rm -t -i -v ${PWD}:/mnt cisco-open/app-simulator-generators-docker-compose --config /mnt/config.yaml --output /mnt/docker-compose.yaml | ||
docker compose up | ||
``` | ||
|
||
- For kubernetes run | ||
|
||
```shell | ||
docker run --rm -t -i -v ${PWD}/deployments:/app/deployments -v ${PWD}:/mnt ghcr.io/cisco-open/app-simulator-generators-k8s:latest --config /mnt/config.yaml | ||
kubectl apply -f deployments/ | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,45 @@ | ||
# Tutorial 2: A database and more services | ||
|
||
> [!NOTE] | ||
> | ||
> This tutorial is work in progress. | ||
In this tutorial we will take the simulation with | ||
[two services from tutorial 1](./1-two-services.md) and add a database and some | ||
additional services. | ||
|
||
If you continue from tutorial 1, open `config.yaml`, otherwise create a file | ||
with that name in an empty directory. Fill the file with the following content: | ||
|
||
```yaml | ||
services: | ||
frontend: | ||
type: java | ||
endpoints: | ||
http: | ||
/list: | ||
- http://backend/list/items | ||
backend: | ||
type: java | ||
endpoints: | ||
http: | ||
/list/items: | ||
- slow,1024 | ||
- sql://backend-db/mydb?query=SELECT id, name FROM items | ||
/insert/item: | ||
- sql://backend-db/mydb?query=INSERT INTO items(id,name) VALUES(123, | ||
'test') | ||
databases: | ||
backend-db: | ||
type: mysql | ||
databases: | ||
mydb: | ||
items: [id, name] | ||
loaders: | ||
user1: | ||
type: curl | ||
wait: 5 | ||
sleep: 1 | ||
urls: | ||
- http://frontend/list | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
# Tutorial 3: Errors and randomness | ||
|
||
to be done | ||
> [!NOTE] | ||
> | ||
> This tutorial is work in progress. | ||
In this tutorial we will take the simulation | ||
[from tutorial 2](./2-a-database-and-more-services.md) and introduce errors and | ||
randomness into the behavior of the services | ||
|
||
If you continue from tutorial 2, open `config.yaml`, otherwise create a file | ||
with that name in an empty directory. Fill the file with the following content: | ||
|
||
```yaml | ||
|
||
``` |