From 5e2dd89bef59a45125f0f02137652965f0f13e6a Mon Sep 17 00:00:00 2001 From: Jared Dunbar Date: Sat, 18 Sep 2021 22:21:13 -0400 Subject: [PATCH] Various Updates * Updated Readme * Added new restrictive DynamoDB Policy document * Added run.sh from EC2 instance filesystem --- README.md | 32 +++++++++++++++++++++++++++++++- dynamodb-policy.json | 15 +++++++++++++++ run.sh | 4 ++++ 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 dynamodb-policy.json create mode 100755 run.sh diff --git a/README.md b/README.md index fbb0cc1..f678661 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,33 @@ # eln1-stats -Electrical Age 1.0 Stats Server Source Code \ No newline at end of file +Electrical Age 1.0 Stats Server Source Code + +## Project Layout + +Filesystem: +* .aws/config - sets us-east-1 as region +* .aws/credentials - uses AWS credentials (`arn:aws:iam::464053648600:user/eln1_stats`) +* main.py - Source Code +* run.sh - Script to run in Screen +* templates/modinfo.json - Modinfo Json (template file) +* /etc/nginx/nginx.conf - nginx configuration (simple proxy to unpriv port) + +Also contained in this repository is the dynamodb policy document for put access to the DB + +## Starting the script + +Log in as the `arch` user (`vadu.pem` key) and then run `sudo su - stat` to become the stats user. + +```shell +screen -S stats +``` + +```shell +./run.sh +``` + +Exit screen and profit. + +## Python Requirements + +boto3 and flask are required Python libraries. diff --git a/dynamodb-policy.json b/dynamodb-policy.json new file mode 100644 index 0000000..a2e7002 --- /dev/null +++ b/dynamodb-policy.json @@ -0,0 +1,15 @@ +{ + "Version": "2012-10-17", + "Statement": [ + { + "Sid": "Eln1StatsDynamo", + "Effect": "Allow", + "Action": [ + "dynamodb:PutItem" + ], + "Resource": [ + "arn:aws:dynamodb:us-east-1:464053648600:table/eln1_stats" + ] + } + ] +} diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..3f3a9ad --- /dev/null +++ b/run.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +cd /home/stat +python3 main.py > /dev/null