Digital voting system for Abakus' general assembly
vote assumes you have a MongoDB-server running on mongodb://localhost:27017/vote
and a redis-server running as localhost:6379
. To change the URL, export MONGO_URL
and REDIS_URL
as an environment variable.
# Start MongoDB and Redis, both required for development and production
$ docker-compose up -d
# Install all dependencies
$ yarn
$ yarn dev # terminal 1, backend and old frontend
$ yarn dev:client # terminal 2, new frontend
The following docs outline the technical usage, if you've got someone else to set it up for you and are looking for how to interact with the GUI, check out HOWTO.md (in norwegian).
Initially you will need to create a moderator and or admin user in order to login
# Create a user via the CLI. You are prompted to select usertype.
$ ./bin/users create-user <username> <cardKey>
vote uses a RFID-reader to register and activate/deactivate users. This is done to make sure that only people that are at the location can vote. The RFID-reader needs to be connected to the computer that is logged in to the moderator panel. See section about using the card reader further down this readme.
Check docs for the environment variable
ETHEREAL
if you intend to develop email related features
$ yarn start
MONGO_URL
default
: mongodb://0.0.0.0:27017/vote
REDIS_URL
default
: localhost
ICON_SRC
(optional)default
: /static/images/Abakule.jpg
COOKIE_SECRET
default
: in dev: localsecret
, otherwise emptyFRONTEND_URL
defualt
: http://localhost:3000
FROM
default
: Abakus
FROM_MAIL
default
: [email protected]
SMTP_URL
smtps://username:[email protected]/?pool=true
GOOGLE_AUTH
NODE_ENV
development
, test
or production
See app.js
and env.js
for the rest
For a production deployment example, see deployment in the
deployment
folder
$ yarn build
$ ICON_SRC=https://some-domain/image.png NODE_ENV=production GOOGLE_AUTH=base64encoding yarn start
Make sure you have enabled Experimental Web Platform features and are using Google Chrome. Experimental features can be enabled by navigating to: chrome://flags/#enable-experimental-web-platform-features. Please check that the USB card reader is connected. When prompted for permissions, please select the card reader (CP210x).
When using the card readers on a linux based system there can be permission problems with google-chrome. Chrome needs access to the ports, and often the ports are controlled by another group, so chrome cannot use them. Therefore you must do one of the following:
root
NOTE: This has stopped working on modern versions of ubuntu-based distros, most likely due to the use of flatpak.
$ sudo google-chrome
OR
dialout
group.$ ls -al /dev/ttyUSB* | cut -d ' ' -f 2`
$ groups
tty
is in the dialout
group, so add your user to that group with:$ sudo usrmod -a -G dialout $USER
You need to sign in and out to get the new privileges!
vote uses vitest for backend cypress for the frontent tests. To run them all you can do:
# Frontend (headless) and backend
$ yarn test
# Frontend with gui
$ yarn test:frontend
We have a list of every occasion vote has been used. If you or your organization use vote for your event we would love if you made a PR where you append your event to the list.
The list is located at ./usage.yml
. Just create a new entry at the bottom. Then run yarn lint
to see if your YAML is correct.
MIT © webkom, Abakus Linjeforening