Skip to content
This repository has been archived by the owner on Sep 17, 2022. It is now read-only.

Latest commit

 

History

History
88 lines (63 loc) · 3.52 KB

README.md

File metadata and controls

88 lines (63 loc) · 3.52 KB

Backend was replaced by NEXT api endpoints

See: https://github.com/SocietyClub/RCV

Rank Choice Voting Backend API

Table of Contents


About the Project

The backend for Ranked Choice Voting. For any questions regarding this project contact [email protected]

Contributing

Follow these guidelines:

Restful Verb Documentation

Read this before you make changes to the API!

https://www.restapitutorial.com/lessons/httpmethods.html

Getting Started

Make sure to install Golang on your local system beforehand: https://golang.org/dl/

Generate credentials for service account

  1. Log into Google Cloud and head to Service accounts under the IAM & Admin page. https://console.cloud.google.com/iam-admin/serviceaccounts

Service account img

  1. Select rcv-service-account and under action click Manage Keys
  2. Create a new key, select json file format and save it for later. Do not save the key in this repo in case we accidently deploy it :)
  3. Provide authentication credentials to your application code by setting the environment variable GOOGLE_APPLICATION_CREDENTIALS

Keys

For more details check out: https://cloud.google.com/firestore/docs/quickstart-servers#go

How To Run the API

Clone the repository

git clone https://github.com/SocietyClub/RCV-backend.git
cd RCV-backend/api
go get

Running the API Locally

  1. Copy service accounts credentials that you generated in the previous steps.

  2. Paste credentials in RCV-backend\api\configs\config.yml under credentials inside the string.

  3. Run the following commands

$env:GOOGLE_APPLICATION_CREDENTIALS="../firestore_prod_key.json" # or where your key is stored at...
cd RCV-backend/api
go run main.go

DO NOT COMMIT PUSH CREDENTIALS, ALWAYS REMOVE THEM AFTER DEPLOYMENT

Other Development Info

Deployment

Only package maintainers have access to deploy. These instructions are for them.

Once you are authorized to deploy through gcloud via your google account, you may download gcloud locally (https://cloud.google.com/sdk/docs/quickstart?authuser=5) or use the terminal from the online google console.

  1. Go to https://console.cloud.google.com/home/dashboard?project=societyclub-rcv-backend and open the terminal (or download gcloud locally)

gcp terminal button

  1. gcloud config set project societyclub-rcv-backend You can check if the config was set properly via gcloud config list
  2. git clone https://github.com/SocietyClub/RCV-backend.git
  3. cd RCV-backend/helloworld
  4. git pull
  5. gcloud app deploy