Files
abot/README.md
2018-12-15 10:16:30 +02:00

2.9 KiB

aBot engine

  • Make voting questions in simple text files

  • single choice, multiple choice and open text questions supported

    • read more from example questions sets
  • Preview form online

  • Get tokens for voting in command line

  • Send unique URLs to your voters (mailing example script included)

  • Summarize results in the command line

  • Online part runs with python3 + flask + gunicorn

  • Command line tools python3

Basic usage instructions

  • Install requirements ./install.me
  • Start server ./start.me
  • Create questions in questions/my_poll.txt
  • Have draft: true in the questions, and view the poll at preview
  • Change to draft: false to enable voting
  • Add tokens for the vote: ./manager my_poll token --prefix http://localhost:8041
  • Open the link to vote
  • Get summary of votes: ./manager my_poll summary

Additional usage

During the poll, you can observe the vote counts:

  • Add an observer token: ./manager my_poll token --prefix http://localhost:8041 --role observer
  • Open the link to see vote counts
  • If the question se allows voters to see results after casting their vote show_results: true, then observer can also see the results.

Example installation on debian

Install web server as root

apt install nginx virtualenv python3 git
# edit the config of /etc/nginx/sites-enabled/default to have your host name
systemctl enable nginx
systemctl start nginx
virtualenv -p python3 certbot
. cerbot/bin/activate
pip install certbot-nginx
certbot --nginx
  • In /etc/nginx/sites-enabled/defaut: replace the "location /" with a proxy:
  location / {
    proxy_pass http://127.0.0.1:8041/;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Scheme $scheme;
  }
  • Restart server, systemctl restart nginx
  • At this point your browser should error with a bad gateway

Install aBot as a normal user

git clone https://bitbucket.org/MoonQ/abot
cd abot
./install.me
  • You can run the ./start.me to test your installation
  • It's recommended to run service as a daemon for more robustness, to survive reboots etc.. You can do it for example with runit.

Installing runit

  • Run these commands as root:
apt install runit runit-systemd
systemctl enable runit
systemctl start runit
mkdir -p /etc/sv/abot/log
  • Edit file /etc/sv/abot/run, with correct values
#!/bin/sh

exec 2>&1
cd /[PATH-TO-ABOT-INSTALLATION]
exec chpst -u [NORMAL-USER-NAME] ./start.me
  • Edit file /etc/sv/abot/log/run, with correct values
#!/bin/sh
exec chpst -u [NORMAL-USER-NAME] svlogd -tt /[PATH-TO-ABOT-INSTALLATION]/log
  • Enable service:
ln -s /etc/sv/abot /etc/service/abot
  • Finally, as the normal user, create the log folder, mkdir [PATH-TO-ABOT-INSTALLATION]/log
  • The log folder should be populated with file current which has the log of the process.