Setup Instructions for Tellers - cthit/VoteIT GitHub Wiki

Github

First login or create a GitHub account, which you can do by pressing the Sign Up button at the top right of this page. After you've successfully logged into GitHub, navigate back to this repository, and press the Fork button at the top right.

image

In the following dialogue, make sure it says Your username/VoteIt, and then press "Create Fork" at the bottom of the page.

image

Make sure you now have a repository at github.com/*yourUser*/VoteIt, then proceed to the following step.

Render

First go to https://render.com/ and press GET STARTED at the top right to create an account (or Sign In if you already have one). Create the account with the method of your choosing, and after you login you should see a page that looks like this:

image

If you don't, try to manually go to https://dashboard.render.com/ instead. Afterwards, press the New button at the top right of the page, and then Web Service.

image

You should then see a page that tells you to connect a repo. Press Connect to GitHub:

image

In the following dialogue, click on your username, and then press Only Select Repositories (unless you want render to be able to access all of your repositories), search for/click on Your Username/VoteIt, and then press install at the bottom of the page.

image image

You should be redirected to the previous page, but now have Your Username/VoteIT available to connect. Press connect. image

At this point you should be brought to a page for deploying the service, that looks something like this: image

Update it to look like the following, but change sektionsmote-year-month-day to the correct date of the meeting, for example sektionsmote-2022-12-08.

image

Then make sure you use the Free Option.

image

Go to bottom of the page and then press Advanced. Inside the advanced options, press Add Environment Variable at the top 3 times. Then fill in the following information, Password (the password for the admin page), NUM_USERS (the number of people that should be able to vote. Should be more than you think you need) and CODES_PER_USER (the number of codes that should be generated for every user. Should be more than you expect there to be voting sessions).

image

Then go to the bottom of the page and press Create Web Service. Which should take you to a page that looks like this:

image

Wait for the console (the black box) to print out the following information:

image

Specifically the listening at http://:::*number* part. Then there should be a link at the top left of the page that leads to your deployment of VoteIT. If the link does not work and gives you an error even after it has started listening, try the following.

If the link does not work

Press Manual Deploy then Latest Commit. This should redeploy the instance, and hopefully work this time.

image

VoteIT

First sign in to the admin page at *sektionsmote-year-month-day*.onrender.com/admin, where *sektionsmote-year-month-day* is the name you gave to your instance. Can also just press the link at the top left and add /admin to the end. Login using the password you added to the Environment Variables previously, then you should be greeted with this screen:

image

Press Generate and print new codes to generate new one-time passwords (OTP) for all the intended users. Print and distribute the OTP:s to the users at the meeting.

(Optional)

  • Check out the rawResults (Show raw result) from the previous voting session
  • Only available when the voting session has closed

Keeping the service alive

Because Render shutdown the service after a certain time of inactivity, and all the codes are kept in memory, it is important that the service is used at regular intervals to not have to keep generating codes because they become invalid. To avoid this, either

  1. keep reloading the page once a minute (bad) or
  2. use a script to automatically do this (good).

Linux/Mac

Create a file called script.sh and add the following contents:

SERVERNAME="sektionsmote-year-month-day" # Or whatever name you gave it.
while true; do
    curl -s https://${SERVERNAME}.onrender.com/health-check
    sleep 60
done

Then run chmod -x ./script.sh to make it executable. Afterwards you should just be able to run it using ./script.sh. If you get permission denied try chmod 777 ./script.sh then run the previous command again.

Windows

Create a file called script.ps1 and add the following contents:

$SERVERNAME = "sektionsmote-year-month-day"  # Or whatever name you gave it.
while ($true) {
  $Response = Invoke-WebRequest -URI "https://$servername.onrender.com/health-check" -Method GET -UseBasicParsing
  Write-Host $Response.Content
  Start-Sleep -Seconds 60
}

Save and then right-click the file and press Run with powershell.

Shutting down the script

DO NOT shutdown the script before the meeting is done. This can be done by closing the window, or pressing CTRL + C when the terminal is selected.

After all votes are over

It could be a good idea, if you're worried, to check the logs for suspicious activity, for example more deployments or other activity.

Destroying the server

To destroy the server, go back to dashboard.render.com press on your service (the one with the name you gave it), then click on settings in the sidebar and go all the way to the bottom and press Delete Web Service and follow the on-screen instructions.

image image image

Destroying the fork

Go to github.com/*yourUser*/VoteIT, and then press settings scroll all the way down and press Delete this repository and follow the on-screen instructions.

image image