More details on how to run an election and documentation of setup.

This commit is contained in:
Bradley M. Kuhn 2013-12-18 18:09:12 -05:00
parent 35e87c2c65
commit b1d5cc17b6

39
README
View file

@ -11,15 +11,46 @@ Setting up an election:
$mysql_user = "someuser"; $mysql_user = "someuser";
$mysql_password = "somepassword"; $mysql_password = "somepassword";
$mysql_db = "somedb"; $mysql_db = "somedb";
$committee_name = "The Vote Masters";
$committee_email = "elections@example.org";
?> ?>
1. When I deploy, I create an account for the election, as the mysql root user: 1. When I deploy, I create an account for the election, as the mysql root user:
mysql -u root -p mysql -u root -p
Password: <MYSQLROOTPW> Password: <MYSQLROOTPW>
mysql> CREATE USER 'someusername' identified by 'somepassword';
mysql> CREATE DATABASE somedbname; Then Run these commands at the mysql> prompt:
mysql> quit CREATE USER 'someusername' identified by 'somepassword';
CREATE DATABASE somedbname;
Then, exit, and at the main command line run:
msyql -u root -p -D somedbname < ..../vote/include/schema.sql msyql -u root -p -D somedbname < ..../vote/include/schema.sql
Then run this again:
mysql -u root -p mysql -u root -p
Password: <MYSQLROOTPW> Password: <MYSQLROOTPW>
mysql> GRANT SELECT on somedb.elections TO someuser@localhost;
and at the mysql command line, run these grant commands:
GRANT SELECT on somedb.elections TO someuser@localhost;
GRANT SELECT on somedb.election_choices TO someuser@localhost;
2. Create an election, with something like this:
mysql -u root -D somedb -p
SET NAMES 'utf8';
INSERT t INTO elections (type, name, voting_start, voting_end, choices_nb, question) VALUES ("elections", "2011 Spring Election", "2011-05-29 00:00:00", "2011-06-12 23:59:59", "7", "Which candidates would you like to see Elected?");
set @el_id = @@IDENTITY;
INSERT INTO election_choices (election_id, choice)
VALUES
(@el_id, 'Candidate 1'),
(@el_id, 'Candidate 2'),
(@el_id, 'Candidate 3'),
(@el_id, 'Candidate 4');
select @el_id;
That number you see at the end is your election id. The URL you'll give out
is thus something like:
http://example.org/vote?election_id=THAT_NUMBER