Getting Started
Postgres Quick Start
Add rngo to a Postgres-backed application and simulate data in less than five minutes.
Setup
Install the rngo CLI via npm:
> npm install -g rngo
And then authenticate:
> rngo auth
This initiates a device authentication flow by copying a code to your clipboard, opening the rngo web app and prompting you to paste that code.
If you haven't already, you'll first need to sign in or sign up for an account. See the rngo auth
reference for more details.
Initialize Project
Initialize your project by running:
> rngo init
This just adds a config file at .rngo/config.yml
. Edit that file so that the systems
object looks something like this:
systems:
db:
type: postgres
parameters:
host:
value: localhost
user:
value: user
password:
value: secret
database:
value: mydb
A system is any software that maintains state that rngo should simulate - in this case, Postgres. rngo can connect to a system to infer its config and later load the simulated data.
Specifying system parameters in the config is convenient for now, but you'll ultimately want to use environment variables. See the Systems reference for more.
Infer Streams
A stream represents a single logical data set - it corresponds, for example, to a table in a relational database. Like database tables, streams can define relationships amongst eachother, which rngo will respect when simulating data.
You should infer baseline stream configs from the db
system by running:
> rngo infer
This command inpects the db
Postgres database and sets the streams
key in the config. Check out rngo infer
reference for more.
Run Simulation
Now you can run the simulation:
> rngo sim
This uploads the config to the server, where the simulation is run. Then it downloads the data and loads it into the db
Postgres database.
Iterate
Start up your application - in all likelihood, you'll find that some of the simulated data is not realistic.
If so, iterate on your streams config - see the Streams reference to get started.