summaryrefslogtreecommitdiff
path: root/README
diff options
context:
space:
mode:
Diffstat (limited to 'README')
-rw-r--r--README81
1 files changed, 81 insertions, 0 deletions
diff --git a/README b/README
new file mode 100644
index 0000000..3036d69
--- /dev/null
+++ b/README
@@ -0,0 +1,81 @@
+# The Bike Project Visitor Log Playbook #
+This repository contains the content needed to run the bike project visitor log.
+
+- Ansible is used to configure the host server
+- The visitor logging software runs in a docker container
+- The logs themselves are stored in text files in /var/tbp
+- Reporting is available via tbpReport.sh
+
+# Ansible #
+Ansible is a tool for configuring a server. The setup.yml and accompanying yml
+files in the tasks/ directory tell ansible how to configure the server (create
+users, copy files, run docker, etc)
+
+## Getting started
+### Configuration
+First, server specific variables must be set in the localhosts file:
+
+domainname: The domainname of the server (e.g. google.com)
+letsencrypt_test: Typically false. Set to true when testing to avoid
+ LetsEncrypt ratelimiting.
+tbp_server: URL to access the visitor log from. Should be subdomain.domainname
+ (e.g. tbp.google.com)
+tbp_username: User that will own log files. The user will be created if it does
+ not exist. Container will run as this user.
+tbp_uid: UID to use for the user.
+
+### Installing ansible
+From this directory, run:
+
+ $ pip install -r requirements.txt
+
+### Running ansible
+Simply run this command:
+
+ $ ansible-playbook -i localhosts setup.yml
+
+# The Vistor Log and Docker
+The docker container is just a lighttpd image with cgi enabled and the bash
+script that runs the logging webpage. I wrote it mainly for my enjoyment years
+ago, so I can't make many promises on readability. It's probably good to keep
+CGI stuff containerized.
+
+## File structure
+The following files are created on the host filesystem and mounted in the tbp
+container:
+
+- /var/tbp/firsttime.txt: Hashed list of first visits. Used to determine if a
+ visitor has used there "one free visit"
+- /var/tbp/members.csv: The LittleGreenLight member list. CSV with the
+ following columns
+
+"LGL Constituent ID","External Constituent ID","First Name","Last Name","LGL
+membership ID","Membership level","Membership status","Membership end"
+
+- /var/tbp/visits.csv: Record of visitors
+
+## Member Update
+Ansible creates a cronjob in `tbp_username`'s crontab to update the member list every 6 hours.
+
+## Reporting
+./docker/tbp/tbpReport.sh is a script that can generate a report.
+
+One week report
+
+ $ tbpReport.sh -w /var/tbp/visits.csv
+
+One month report
+
+ $ tbpReport.sh -m /var/tbp/visits.csv
+
+One year report
+
+ $ tbpReport.sh -y /var/tbp/visits.csv
+
+The server can send this report via email:
+
+ $ tbpReport.sh -w /var/tbp/visits.csv | mutt -s "Weekly TBP Visit Report" -- foo@gmail.com
+
+Scheduled reporting is not configured by ansible as email configurations will
+vary.
+