jpa05-proj-dining - Configuration of proj-dining dev deployment

Step 2: Configure your app for localhost (as documented in the README.md)

2a: Obtain UCSB API key value

First, you will need a value for UCSB_API_KEY. You can obtain a value by following these instructions: UCSB API Key Instructions

2b: OAuth Setup

Assuming that you have set up a project in the Google Developer Console and set up an OAuth Consent Screen for your project (which should have been done in jpa03), you will just need to create a set of OAuth credentials (GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET values) using Steps 1-4 of these instructions: Oauth Google Setup

NOTE: The name of your Dokku app for jpa05 will be

  • dining-dev-yourGithubUsername

So your first Dokku redirect URI will be:

  • http://localhost:8080/login/oauth2/code/google And your second Dokku redirect URI will be:
  • https://dining-dev-yourGithubUsername.dokku-xx.cs.ucsb.edu/login/oauth2/code/google where xx is your team number.

Then, complete Step 1 in oauth.md (set up .env values for localhost, including ADMIN_EMAILS and UCSB_API_KEY)

2c: Launch your application

  • Open two separate terminal windows
  • In the first window, start up the backend with:
    mvn spring-boot:run
    
  • In the second window:
    cd frontend
    nvm install 22.18.0
    nvm use 22.18.0
    npm install  # only on first run or when dependencies change
    npm start
    

Then, the app should be available on http://localhost:8080. Test that Oauth was set up properly by logging in.

Step 3: Configure your app to run on Dokku

3a: Creating and configuring your Dokku app

You will need to create a personal dokku deployment so that you can test future PRs during the legacy code project. This is a quick guide to setting up a proj-dining dokku instance that assumes you are already familiar with the basic operation of dokku, and just need a “cheat sheet” to get up and running quickly.

First, log in to your dokku machine–ssh into csil, then dokku (Login instructions).

The lines in the instructions where you need to modify something are marked with the comment: # modify this

  • The other lines you can copy/paste as is, except for changing dining-dev-yourGithubUsername to your app name
# Create app
dokku apps:create dining-dev-yourGithubUsername

# Create and link postgres database
dokku postgres:create dining-dev-yourGithubUsername-db
dokku postgres:link dining-dev-yourGithubUsername-db dining-dev-yourGithubUsername --no-restart

# Modify dokku settings
dokku git:set dining-dev-yourGithubUsername keep-git-dir true

# Set config vars
dokku config:set --no-restart dining-dev-yourGithubUsername PRODUCTION=true
dokku config:set --no-restart dining-dev-yourGithubUsername GOOGLE_CLIENT_ID=get-value-from-google-developer-console # modify this
dokku config:set --no-restart dining-dev-yourGithubUsername GOOGLE_CLIENT_SECRET=get-value-from-google-developer-console # modify this
dokku config:set --no-restart dining-dev-yourGithubUsername UCSB_API_KEY=get-from-developer.ucsb.edu  # modify this

# Set SOURCE_REPO to the project repo (modify the url)

# This is for the link in the footer, and for the link to currently deployed branch in /api/systemInfo
dokku config:set --no-restart dining-dev-yourGithubUsername SOURCE_REPO=https://github.com/ucsb-cs156/proj-dining

# Set ADMIN_EMAILS to staff emails and team emails
dokku config:set --no-restart dining-dev-yourGithubUsername ADMIN_EMAILS=list-of-admin-emails # modify this

# git sync for first deploy (http)
dokku git:sync dining-dev-yourGithubUsername https://github.com/ucsb-cs156/proj-dining main  # modify this 
dokku ps:rebuild dining-dev-yourGithubUsername

# Enable https
dokku letsencrypt:set dining-dev-yourGithubUsername email yourEmail@ucsb.edu # modify email
dokku letsencrypt:enable dining-dev-yourGithubUsername

# rebuild again
dokku ps:rebuild dining-dev-yourGithubUsername

Your app should now be running at https://dining-dev-yourGithubUsername.dokku-xx.cs.ucsb.edu. Make sure that you are able to log in.

If you have any issues with configuring your Dokku app, see the more detailed instructions: Deploying a Dokku App

Full documentation: Dokku Setup

Return to the main instructions

Please return to the main instructions for information on submitting.