Skip to main content

learn

Quickstart

Here's a minimal example to get you up and running.

Up and running​

Create a license file​

Create a license.env file with your license variables. If you don't have one yet, you can get one here for free.

LICENSE_ID=xxx
LICENSE_EMAIL=xxx
LICENSE_ORGANIZATION=xxx
LICENSE_EDITION=xxx
LICENSE_EXPIRATION=xxx
LICENSE_SIGNATURE=xx

Set the configuration​

Create a hello-world.json file with this configuration. Don’t worry about the connection details, as you'll see in a minute.

{
"generators": [
{
"table": "testTable",
"row": {
"testColumn": {
"_gen": "oneOf",
"choices": [
"πŸ‘", "πŸ”₯", "❀️"
]
}
}
}
],
"connections": {
"pg": {
"kind": "postgres",
"connectionConfigs": {
"host": "localhost",
"port": 5432,
"db": "mydb"
}
}
}
}

Launch ShadowTraffic​

Launch ShadowTraffic in watch mode (--watch). This command will print out 10 example events and then stop. Every time you change your config file, it'll rerun. The --stdout flag sends all generated data to your terminal, so it doesn't write to Postgres, giving you an interactive development flow. Note that --stdout, --watch, and --sample are all non-mandatory flags.

docker run --env-file license.env -v $(pwd)/hello-world.json:/home/config.json shadowtraffic/shadowtraffic:latest --config /home/config.json --watch --sample 10 --stdout

Connect to Postgres​

Update your configuration file to connect to a live Postgres instance. Create testTable with testColumn, and rerun the Docker command without --stdout, --sample, and --watch. Data should flow into your table.


Want to learn more? Try the video guides or the cheat sheet.