Please follow all of these steps to setup your development environment correctly. For deployment, mostly use the Azure section.
- Install git
- Install VS Code
- Install these VS Code extensions:
- Install Postgres 16 with default settings
- Install Node.js
- If asked to install NPM or any other dependencies, select yes
- After installing all of these, restart your computer
- Open VS Code
- Press
Control + Shift + Pto open the command palette- Can also go to
View > Command Palette
- Can also go to
- Select
Git: Clone - Paste the url of this repository (
https://github.com/UTDallasEPICS/tx-osteo-tracker) - Select the location you want your project directory to be
- Open the repository location in VS Code
- Open pgAdmin 4 (installed with Postgres 16)
- Keep the username of the master account as
postgres - When prompted for a master password, enter a password that is long but simple (no complex characters). Remember this password
- Under the default Postgres 16 server, create a new database and name it something simple (e.g.
testdb) - Create a
.envtext file at the project repository root in VS Code - Add a new line to the
.envfile:DATABASE_URL="postgresql://postgres:PASSWORD@localhost:5432/NAME?schema=public"wherePASSWORDis your account password andNAMEis the database name - Open the terminal in VS Code with
Control + `or go toTerminal > New Terminal - In the terminal, run
npm install -g prisma - Restart your computer
- Check if the
ENV Secretsfile is up to date on Edusourced. If this file exists and is valid, you can just copy the values from there into.envand skip this whole step. Otherwise, please follow along. - If no Auth0 application exists, create one by following these instructions. If one already exists, ask for an invite.
- Once Auth0 is setup, go to the application's settings and copy
Domain,Client ID, andClient Secret - Add three new lines to the
.envfile with the copied values:
AUTH0_DOMAIN="SOMETHING.us.auth0.com"
AUTH0_CLIENTID="copied from client id field"
AUTH0_SECRET="copied from client secret field"
- If Azure is not setup, follow the instructions here. Setup the environment variables as described in the section.
- You should have variables similar to
.env.example
- In the VS Code terminal, run
npm installat the project root - Run
prisma migrate devto update the database schema - Run
npm run devto start the development server - You are now ready to start developing!
- Create an account or sign in at auth0.com
- Create a new tenant and give it a name
- Go to the the tenant's
Getting Startedpage - Click on
Create Application, give it a name, and chooseRegular Web Application - Click
Skip Integration - Go to the application's settings
- Under
Allowed Callback URLsadd the following (replace[HOSTNAME]with the web server address):
https://[HOSTNAME]/api/auth/callback/login
- Under
Allowed Logout URLsadd the following:
https://[HOSTNAME]/api/auth/callback/logout
- Under
Advanced > OAuth, enable theHS256authentication method. - Click
Save - Go to
Applications > APIsand choose the default management API - Go to
Machine to Machine Applicationsand click the dropdown for the created application - Add the
update:userspermission and click update - Add team members by going to
Tenant Settings > Tenant Members
The following services must be created and configured properly for deployment. Some of these services (i.e. the database) can be skipped for local development.
- Azure SQL for Postgres
- Make sure connections are allowed via a url (i.e.
postgres://...) - The url will be formatted like a normal Prisma Postgres URL with the username and password configured when creating the service
- Enable the setting to make the service is accessible to all Azure services
- To initialize the database, temporarily add your own IP address to the network settings, change the local
DATABASE_URLenvironment variable to the deployed database, and runprisma migrate dev
- Make sure connections are allowed via a url (i.e.
- Static Web App
- Configure to deploy based on this GitHub repo
- Modify the generated Github action to include the environment variable
DISABLE_ENV_CHECKING="true" - Make sure to include all required environment variables with a
NUXT_prefix, exceptDATABASE_URL
- BLOB Storage
- Make sure the setting to allow changing anonymous access at the container level is enabled
- Need
imagescontainer (configure for BLOB-level anonymous access) - Need
qualificationscontainer (no anonymous access)
- Front Door / CDN Profile with Endpoint
- Configure to point to BLOB Storage
- Communication Service
- Create associated email communication service and a
DoNotReplyemail domain
- Create associated email communication service and a
- Azure Functions
- Create a function app and deploy the function code from the
functionsdirectory in this repo - Recommended to use the VSCode Extension
- Copy the
AUTH0_SECRETenv variable into the function app from the static web app (don't includeNUXT_prefix) - Add a
HOST_ORIGINenv variable that points to the static web host origin (i.e.https://volunteer.texasosteo.org) - Add a
AzureWebJobsStorageenv variable with the same value asAZURE_STORAGE_CONNECTION_STRING
- Create a function app and deploy the function code from the
- If a custom domain is to be used, the DNS records for the domain should be setup to allow for Azure to use it. Static Web App, the email service, and the functions app should then be configured to use it.
Once these services are correctly setup, they can be used to fill out the environment variables for the static web app. When using the static web app, prefix all variables except DATABASE_URL with NUXT_. If developing locally, this does not need to be done, and simply follow .env.example.
- (
NUXT_)AZURE_COMMUNICATION_SERVICE_CONNECTION_STRING- The connection string for the communication service
- Found in the Keys section
- (
NUXT_)AZURE_CDN_ORIGIN- The origin URL (i.e.
https://www.example.net/) for the CDN/Frontdoor profile
- The origin URL (i.e.
- (
NUXT_)AZURE_EMAIL_ADDRESS- The created
DoNotReplyemail domain
- The created
- (
NUXT_)AZURE_STORAGE_ACCOUNT_NAME- The literal name of the created BLOB Storage account
- (
NUXT_)AZURE_STORAGE_CONNECTION_STRING- The connection string for the BLOB Storage account
- Found in the Keys section
- (
NUXT_)AZURE_STORAGE_SHARED_KEY- The access key for the BLOB Storage account
- Found in the Keys section next to the connection string
- (
NUXT_)OVERRIDE_HOST- When deployed, set this to the host domain (i.e.
volunteer.texasosteo.org)
- When deployed, set this to the host domain (i.e.
DATABASE_URL- The Postgres connection string (i.e.
postgres://...) from Azure SQL
- The Postgres connection string (i.e.