-
Notifications
You must be signed in to change notification settings - Fork 0
Datathon ‐ Operations Site
The Operations Site is on the branch called datathon-ops and is used for the following services:
- Collecting Participant responses from Google Forms (Registrations)
- Verifying Participants at In-Person Events
- Participant Tracking (Stage of Application, Event Attendance)
- Access to QR Code Scanner for Volunteers
We will assume that you have already cloned the Website and switched to the datathon-ops branch
-
Sign in to the DS3 Developers MongoDB Atlas using the DS3 Developer Google Account
-
Check to see if the
aws-ds3-datathoncluster is active, if it is not activated then activate it -
Go to the Sidebar to look for
Database Access -
Select the User Name:
netlify-datathon-adminand ClickEDIT -
Click
Edit Password -
Click
Autogenerate Secure Passwordand save the<PASSWORD>to be used for Deployment
If the Datathon is expected to have In-Person Events, you must create a new commit with changes to the variable called datathonServices. This variable creates a mapping between a date and a list of service labels. The exact location of this variable can be found here. For more details about how these objects generate services for the participant can be found here.
-
Create a
.env.stagingfile inside the root folder of theWebsiterepositorytouch .env.staging
-
Copy the below configuration for the
.env.staging# Header Secret VALIDATION_SECRET='' NEXT_PUBLIC_VALIDATION_SECRET='insert-validation-secret' # MongoDB Congifurations MONGO_URI='mongodb+srv://netlify-datathon-admin:<PASSWORD>@aws-ds3-datathon.gjox5mc.mongodb.net/?retryWrites=true&w=majority&appName=aws-ds3-datathon' MONGO_DB='prod' # Next-Auth Configurations NEXTAUTH_URL='https://datathon-ops.ds3utsc.com/' NEXTAUTH_SECRET=''
-
Generate
VALIDATION_SECRETusing the following commandopenssl rand -base64 32
-
Use the value provided to
VALIDATION_SECRETas the value forNEXT_PUBLIC_VALIDATION_SECRET -
Generate
NEXTAUTH_SECRETusing the following commandopenssl rand -base64 32
-
Log In to the Netlify using the
devDS3GitHub Account -
Click the
Add new siteButton -
Click the
Import an existing projectoption from the dropdown -
Click the
Deploy with GitHubbutton and authenticate -
Use the dropdown above to select
theDS3organization -
Select the
WebsiteRepository -
Change the
Branch to deployfrommaintodatathon-ops -
Scroll down and click the
Add environmental variablesand add the above list of key-value pairs -
Add this environmental variable for Netlify only:
NEXT_FORCE_EDGE_IMAGES=true -
Once all the above environmental variables have been added, click
Deploy Websiteand monitor the Deploy log for any issues -
Once the site has been successfully deployed, go to the sidebar and click
Domain Management -
Click
Add DomainButton -
Update the site domain to
datathon-ops.ds3utsc.comand then clickAdd subdomain -
Visit https://datathon-ops.ds3utsc.com/ to see if the site is accessible.
After deploying the site, some tests need to be done manually to see if the site is working as expected. We will do this by creating mock participants and volunteers and using them to log in and test the QR Code Scanner. You will notice that the requests will go to localhost:3000 instead of datathon-ops.ds3utsc.com, this is because these endpoints are not required on the production site and are only used to debug and test locally.
Ensure that you have the above .env.staging and to start the local server make use of the below.
pnpm stagingTo Mock Participants, run the following command with the query params filled:
curl --location
--request POST 'http://localhost:3000/api/participant/seed?numOfParticipants=<INT>&startDate=<YYYY-MM-DD>&endDate=<YYYY-MM-DD>&dayStep=<INT>' \
--header 'ds3-secret: <VALIDATION_SECRET>'Please save the above data, since it will include QR Codes which will be used for testing the QR Code Scanner.
To Mock Volunteers, run the following command with the query params filled:
curl --location
--request POST 'http://localhost:3000/api/volunteer/seed?numOfVolunteers=<INT>' \
--header 'ds3-secret: <VALIDATION_SECRET>'Please save the above data, as it will contain mock logins to be used to test the Authentication and QR Code Scanner
For more information about how the data is generated check the respective files: Participant, Volunteer
You can now visit https://datathon-ops.ds3utsc.com/ to go through with the tests below
-
Check if you can authenticate using one of the Mock Volunteer
-
Check if the QR Scanner will turn on and turn off after approximately 10 seconds
-
Check if the QR Code Scanner works by using one of the Mock Participants
-
Check if the Mock Participant can be Checked In
-
Check if the Mock Participant can have their service usage updated
-
Check if the Mock Volunteer can Log out and Log back in later
Once the above testing is complete, remove all databases from MongoDB Atlas
- Acceptance: Will be sent out to participants who have met the criteria of the Datathon (Example from Datathon 2024).
- Hacker Package: Will be sent out to participants once registrations have been closed (Example from Datathon 2024).
We use react-email, to create the personalized emails sent to each participant. To make changes to the already existing templates follow the instructions below.
Datathon-Emails/
├── components
│ └── common.tsx
├── emails
│ ├── hacker-package.tsx
│ └── participant-acceptance.tsx
├── package.json
├── pnpm-lock.yaml
├── pnpm-workspace.yaml
├── readme.md
└── static
└── datathon.png
-
Create a new folder called
Datathon-Emails.mkdir Datathon-Emails
-
Install
react-emailand related packagespnpm add react-email @react-email/components -E
-
Update the
package.jsonwith these scripts"scripts": { "email": "email dev --dir src/components/Emails", "export": "email export" }
-
Create a new folder called
emailsand moveacceptance.tsx,hacker-package.tsxfromWebsite/src/components/Emails/ -
Create a new folder called
componentsand movecommon.tsxfromWebsite/src/components/Emails/ -
Create a new folder called static and move the Email Banner Image
-
Create a new file called
pnpm-workspace.yamlpackages: - '.react-email/**'
-
Run
pnpm devto start a local server to see changes made to the templates
For more details, check out the official docs for manual setup
To send official emails to participants, we will make use of the thedatasciencecube@gmail.com email address. We will also require an App-Specific Password to send emails using the above address. There also needs to be a new Email Banner Image for the Datathon, for which talk to the Design Team about this.
The below environment variables are to be used when sending emails to participants, just add then to the .env.staging.
For the Email Banner, create a new commit to the datathon-ops to upload it to GitHub and update the Image URL below.
GMAIL_USER='thedatasciencecube@gmail.com'
GMAIL_PASSWORD='<app-specific-password>'
EMAIL_BANNER_IMAGE_URL='https://github.com/theDS3/Website/blob/datathon-ops/src/<folder-path>/email-banner.png?raw=true'To send emails to participants with either Acceptance or Hacker Packages, follow the below steps
-
Clone the
Websiterepository and Select thedatathon-opsbranch -
Ensure that you have the above
.env.stagingand Email Specific Environmental Variables in the.env.staging -
Update the Templates for
acceptance.tsxandhacker-package.tsx -
Generate a batch of emails to send
-
Start the Local Server using the below command
pnpm staging
-
Run the following command with the batch of emails
curl --location 'http://localhost:3000/api/participant/emails/{acceptance|hacker-package}' \ --header 'Content-Type: application/json' \ --data-raw '{"emails": ["<EMAIL_1>", "<EMAIL_2>", ..., "<EMAIL_N>"] }'
Once the Volunteer registration form has been closed, talk to the Events Team to gather the final list of volunteer emails and generate the volunteer logins. This will only work on the local server and not on the Netlify Servers.
Ensure that you have the above .env.staging and to start the local server make use of the below.
pnpm stagingThen run the following in a separate terminal
curl --location 'http://localhost:3000/api/volunteer' \
--header 'ds3-secret: <VALIDATION_SECRET>'
--header 'Content-Type: application/json' \
--data '{"emails": ["<EMAIL_1>", "<EMAIL_2>", ..., "<EMAIL_N>"] }'Once you get a final response, send the emails and passwords to the Events Team who will send them to the volunteers
-
Follow the instructions in Cleanup for Google Forms
-
Follow the instructions in Cleanup for Main Site
-
Remove all MongoDB Databases on Atlas related to
aws-ds3-datathon -
Log In to the Netlify using the
devDS3GitHub Account -
Select from the
SitesCard the site calleddatathon-ops.ds3utsc.com -
Select the
Site ConfigurationButton -
Scroll down to the last card on the page, which should be titled
Danger Zone -
Select
Delete this siteand provide the site name toDelete -
Delete the
.env.stagingrm .env.staging