Learned that we created the tables using the gateway role (or user… postgres is weird about that name), BUT we created the tables within the postgres database
When we log into the weatherbox database shows nothing
Switch databases and create tables AGAIN
Get straight into the database: psql -d weatherbox
For files: psql -d weatherbox -f filename.sql
Clean up the original postgres database, those tables don't belong there
finding sql files
cd /etc/postgresql/13/main
ls
Create table using sql file: psql -d weatherbox -f multi-table.sql
Write data to the tables
run INSERT commands manually
run the gateway
Fake traffic script: fake_xr.py –> Added “encoding='utf8'” in line 31
write fake data to postgres
cd into control-tower, gateway
source env/bin/activate
cd into control-tower, gateway, src
in one window:
python3 fake_traffic.py
in another window:
export GATEWAY_DB_URI=“postgresql:gateway@localhost/weatherbox
* more generically: postgresql:user:secret@host/mydb
python gateway_server.py ./fakexbee
Program keeps breaking, so unsure of what the problem is. May be issue within the python code
October 13, 2022
Set up discord on lab computer
Ran “python3 fake_traffic.py” in one window and ran “python3 src/gateway_server.py ./src/ttyFakeTraffic” in another –> error
Ran “python3 fake_traffic.py” in one window. Ran “python3 src/gateway_server.py ./src/ttyFakeTraffic” and export GATEWAY_DB_URI=“postgresql : / / gateway@localhost/weatherbox” in same window –> different error
Changed gateway URI to “export GATEWAY_DB_URI=“postgresql : / / gateway@localhost/weatherbox””
Gave gateway role permission to login
Found error in table labels
Edited previous documentation
Edited tables using two methods:
Manually: alter table NAME rename column OLD COLUMN to NEW COLUMN
Drop old tables and run setup commands from the script using “psql -d weatherbox -f multi-table.sql”
Ran “python3 fake_traffic.py” in one window. Ran “python3 src/gateway_server.py ./src/ttyFakeTraffic” and export GATEWAY_DB_URI=“postgresql : / / gateway@localhost/weatherbox” in same window
SUCCESS: FAKE DATA FLOODING DATABASE!!
Tested database with actual data from apple by using ./run_production.sh auto