44 lines
1.3 KiB
Markdown
44 lines
1.3 KiB
Markdown
|
# retailtwin
|
||
|
|
||
|
Implementation of a digital twin of a retail corporation that operates a chain of grocery stores will be described. The implementation is of course limited but comprehensive enough to get some key insights about why corporate IT looks the way it looks. If anyone intends to create antifragile data systems it's important to study how fragile systems come to be on the first place.
|
||
|
|
||
|
## Bootstrap the database
|
||
|
|
||
|
First create a postgresql database.
|
||
|
|
||
|
```bash
|
||
|
createdb -h localhost -U postgresuser retail
|
||
|
```
|
||
|
|
||
|
In this case we decided to call the database `retail` and we created it in the same computer we will be running the digital twin. Then sync the data models in the freshly created database with:
|
||
|
|
||
|
```bash
|
||
|
retailtwin init postgresql://postgresuser:password@localhost/retail
|
||
|
```
|
||
|
|
||
|
Then we can populate the database with dummy data with the `bootstrap` subcommand:
|
||
|
|
||
|
```bash
|
||
|
retailtwin bootstrap postgresql://postgresuser:password@localhost/retail
|
||
|
```
|
||
|
|
||
|
Finally we can create all the necessary functions, procedures, and triggers with
|
||
|
|
||
|
```bash
|
||
|
retailtwin sync postgresql://postgresuser:password@localhost/retail
|
||
|
```
|
||
|
|
||
|
## Terminals
|
||
|
|
||
|
There are currently three available terminals to operate with the digital twin:
|
||
|
|
||
|
### Stocking terminal
|
||
|
|
||
|
```bash
|
||
|
stock [DB_URI] [Store location]
|
||
|
```
|
||
|
|
||
|
```bash
|
||
|
stock postgresql://postgresuser:password@localhost/retail 1
|
||
|
```
|