- SSH into any student server, create two new directories in the home directory with
mkdir public_html
andmkdir csss
- Modify the permission of
public_html
to be permissions 711 (usels -l
to check current permissions andchmod 711 <directory/file name>
to change permissions) cd public_html
and fetch the repo content directly with the following command. The idea is that everything in this repo should be in~/public_html
git init git remote add origin https://github.com/ubccsss/elections.git git fetch origin git checkout -b master --track origin/master
- Make sure all files in
public_html
have 644 permissions, particularly the.htaccess
file,index.html
, andstyle.css
. Any scripts may have even 700 permissions as they run under suexec (as of September 2019) by the department's deisgn. (Don't even bother trying to run apache locally.) Theimages/
folder may need to have 711 permissions, and ensure the individual images have 644 or 744 permissions as well. - Run
make
to generate theelections.cgi
file touch elections.db
(or whatever you want to call the dbfile)- Open another terminal,
cd ~/csss
, generate a PKCS1 private key withopenssl genrsa -traditional -out private.pem 2048
and give it 600 permissions (making sure the~/.ssh
and~/csss
folders are also accessible, with 700 permissions) - Go back to the
~/public_html
, modify theconfig.yml
to your liking. Note that the absolute path is something like/home/<letter>/<cwl>/
- Bootstrap the database: run
./elections.cgi -migrate
. At this stage, you should be able to open your browser and see the election website athttps://www.students.cs.ubc.ca/~YOUR_CWL/index.html
- In your other teminal for
~/csss
, createsids.txt
and fill it in with information you get from Giuliana or whichever admin from the CS department is in charge - Test. If something fails, erase, re-bootstrap the elections.db and run
./elections.cgi -migrate
again.
Each candidate should submit a bio (historically, the limit has been 200 words) and a headshot.
To update candidate bios, edit the description under the bios
key in config.yml
. Take care to indent the bios properly if they are multiline.
To copy over the headshots from your local machine, use scp ./local_path yourcwl@remote.students.cs.ubc.ca/public_html/images/candidate_name.jpg
. See the SCP man page for more information. Then, update the paths in config.yml
.
If certain positions are not being voted on, you can delete them from the positions
key in config.yml
. Otherwise, under positions.candidates
, list the candidates for that position. The values provided must exactly match the names of candidates in the bios
section.
sqlite3
has been installed on the department servers, so run sqlite3 ~/public_html/elections.db
to get access to the vote database.
This is the table schema for the votes
table:
sqlite> pragma table_info(votes);
0|id|INTEGER|0||1
1|created_at|datetime|0||0
2|updated_at|datetime|0||0
3|deleted_at|datetime|0||0
4|position|varchar(255)|0||0
5|candidate|varchar(255)|0||0
For elections with uncontested positions, run the following to view the results of the election:
SELECT position, candidate, count(distinct id) FROM votes GROUP BY position, candidate;
Refer to the constitution for the election win criteria for contested positions.
If there are stylistic/structural changes to our main website, you may want to sync those changes here in this repo. The way to do it is simply by running go run gettemplate/gettemplate.go
in the root folder. Note that this currently gettemplate.go
is outdated so you will have to manually change a couple things in the new template.html
file. This includes:
- Make sure that the html between the header and footer tags is "empty". See previous git commits for
template.html
for examples - Get rid of the integrity property in the style.css link tag (there might be a better solution?)
- Fix broken images by adding the
https://ubccsss.org
prefix