Skip to content

Commit

Permalink
Merge pull request #271 from ITPNYU/app_engine_new_ui
Browse files Browse the repository at this point in the history
App engine new UI
  • Loading branch information
rlho authored Jul 30, 2024
2 parents 48060a4 + fa7bb86 commit 1287a7f
Show file tree
Hide file tree
Showing 272 changed files with 27,821 additions and 1,018 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/deploy_development_app_engine.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Deploy DEVELOPMENT to App Engine
on:
push:
branches:
- main
- app_engine_new_ui
jobs:
deploy:
runs-on: ubuntu-latest
environment: dev
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18.17.1"

- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.SERVICE_ACCOUNT_KEY }}

- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
- name: Create .env file
run: |
cd booking-app
echo "NEXT_PUBLIC_BASE_URL=${{ secrets.NEXT_PUBLIC_BASE_URL }}" >> .env.production
echo "GOOGLE_CLIENT_ID=${{ secrets.GOOGLE_CLIENT_ID }}" >> .env.production
echo "GOOGLE_CLIENT_SECRET=${{ secrets.GOOGLE_CLIENT_SECRET }}" >> .env.production
echo "GOOGLE_REDIRECT_URI=${{ secrets.GOOGLE_REDIRECT_URI }}" >> .env.production
echo "GOOGLE_REFRESH_TOKEN=${{ secrets.GOOGLE_REFRESH_TOKEN }}" >> .env.production
echo "GOOGLE_API_KEY=${{ secrets.GOOGLE_API_KEY }}" >> .env.production
echo "FIREBASE_PROJECT_ID=${{ secrets.FIREBASE_PROJECT_ID }}" >> .env.production
echo "FIREBASE_PRIVATE_KEY_ID=${{ secrets.FIREBASE_PRIVATE_KEY_ID }}" >> .env.production
echo "FIREBASE_PRIVATE_KEY=${{ secrets.FIREBASE_PRIVATE_KEY }}" >> .env.production
echo "FIREBASE_CLIENT_EMAIL=${{ secrets.FIREBASE_CLIENT_EMAIL }}" >> .env.production
echo "FIREBASE_CLIENT_ID=${{ secrets.FIREBASE_CLIENT_ID }}" >> .env.production
echo "FIREBASE_AUTH_URI=${{ secrets.FIREBASE_AUTH_URI }}" >> .env.production
echo "FIREBASE_TOKEN_URI=${{ secrets.FIREBASE_TOKEN_URI }}" >> .env.production
echo "FIREBASE_AUTH_PROVIDER_X509_CERT_URL=${{ secrets.FIREBASE_AUTH_PROVIDER_X509_CERT_URL }}" >> .env.production
echo "FIREBASE_CLIENT_X509_CERT_URL=${{ secrets.FIREBASE_CLIENT_X509_CERT_URL }}" >> .env.production
echo "NEXT_PUBLIC_FIREBASE_API_KEY=${{ secrets.NEXT_PUBLIC_FIREBASE_API_KEY }}" >> .env.production
echo "NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=${{ secrets.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN }}" >> .env.production
echo "NEXT_PUBLIC_FIREBASE_PROJECT_ID=${{ secrets.NEXT_PUBLIC_FIREBASE_PROJECT_ID }}" >> .env.production
echo "NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=${{ secrets.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET }}" >> .env.production
echo "NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=${{ secrets.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID }}" >> .env.production
echo "NEXT_PUBLIC_FIREBASE_APP_ID=${{ secrets.NEXT_PUBLIC_FIREBASE_APP_ID }}" >> .env.production
echo "NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID=${{ secrets.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID }}" >> .env.production
echo "NEXT_PUBLIC_DATABASE_NAME=${{ secrets.NEXT_PUBLIC_DATABASE_NAME }}" >> .env.production
- name: Install dependencies
run: |
cd booking-app
npm ci
- name: Build
run: |
cd booking-app
npm run build
- name: Deploy to App Engine
run: |
cd booking-app
gcloud app deploy app.development.yaml --project=${{ secrets.GCP_PROJECT_ID }} --quiet
68 changes: 68 additions & 0 deletions .github/workflows/deploy_staging_app_engine.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Deploy STAGING to App Engine
on:
push:
branches:
- staging
- app_engine_new_ui
jobs:
deploy:
runs-on: ubuntu-latest
environment: staging
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18.17.1"

- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.SERVICE_ACCOUNT_KEY }}

- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
- name: Create .env file
run: |
cd booking-app
echo "NEXT_PUBLIC_BASE_URL=${{ secrets.NEXT_PUBLIC_BASE_URL }}" >> .env.production
echo "GOOGLE_CLIENT_ID=${{ secrets.GOOGLE_CLIENT_ID }}" >> .env.production
echo "GOOGLE_CLIENT_SECRET=${{ secrets.GOOGLE_CLIENT_SECRET }}" >> .env.production
echo "GOOGLE_REDIRECT_URI=${{ secrets.GOOGLE_REDIRECT_URI }}" >> .env.production
echo "GOOGLE_REFRESH_TOKEN=${{ secrets.GOOGLE_REFRESH_TOKEN }}" >> .env.production
echo "GOOGLE_API_KEY=${{ secrets.GOOGLE_API_KEY }}" >> .env.production
echo "FIREBASE_PROJECT_ID=${{ secrets.FIREBASE_PROJECT_ID }}" >> .env.production
echo "FIREBASE_PRIVATE_KEY_ID=${{ secrets.FIREBASE_PRIVATE_KEY_ID }}" >> .env.production
echo "FIREBASE_PRIVATE_KEY=${{ secrets.FIREBASE_PRIVATE_KEY }}" >> .env.production
echo "FIREBASE_CLIENT_EMAIL=${{ secrets.FIREBASE_CLIENT_EMAIL }}" >> .env.production
echo "FIREBASE_CLIENT_ID=${{ secrets.FIREBASE_CLIENT_ID }}" >> .env.production
echo "FIREBASE_AUTH_URI=${{ secrets.FIREBASE_AUTH_URI }}" >> .env.production
echo "FIREBASE_TOKEN_URI=${{ secrets.FIREBASE_TOKEN_URI }}" >> .env.production
echo "FIREBASE_AUTH_PROVIDER_X509_CERT_URL=${{ secrets.FIREBASE_AUTH_PROVIDER_X509_CERT_URL }}" >> .env.production
echo "FIREBASE_CLIENT_X509_CERT_URL=${{ secrets.FIREBASE_CLIENT_X509_CERT_URL }}" >> .env.production
echo "NEXT_PUBLIC_FIREBASE_API_KEY=${{ secrets.NEXT_PUBLIC_FIREBASE_API_KEY }}" >> .env.production
echo "NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=${{ secrets.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN }}" >> .env.production
echo "NEXT_PUBLIC_FIREBASE_PROJECT_ID=${{ secrets.NEXT_PUBLIC_FIREBASE_PROJECT_ID }}" >> .env.production
echo "NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=${{ secrets.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET }}" >> .env.production
echo "NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=${{ secrets.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID }}" >> .env.production
echo "NEXT_PUBLIC_FIREBASE_APP_ID=${{ secrets.NEXT_PUBLIC_FIREBASE_APP_ID }}" >> .env.production
echo "NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID=${{ secrets.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID }}" >> .env.production
echo "NEXT_PUBLIC_DATABASE_NAME=${{ secrets.NEXT_PUBLIC_DATABASE_NAME }}" >> .env.production
- name: Install dependencies
run: |
cd booking-app
npm ci
- name: Build
run: |
cd booking-app
npm run build
- name: Deploy to App Engine
run: |
cd booking-app
gcloud app deploy app.staging.yaml --project=${{ secrets.GCP_PROJECT_ID }} --quiet
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,8 @@ $RECYCLE.BIN/
# Windows shortcuts
*.lnk

.firebase
# End of https://www.toptal.com/developers/gitignore/api/macos,windows


app.yaml
4 changes: 4 additions & 0 deletions booking-app/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
getToken.js
seed.ts
getRefreshToken.js
*
55 changes: 55 additions & 0 deletions booking-app/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"extends": [
"airbnb-base",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:prettier/recommended",
"next/core-web-vitals"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module",
"project": "./tsconfig.json"
},
"plugins": ["@typescript-eslint", "prettier"],
"rules": {
"no-shadow": "off",
"no-void": "off",
"quotes": ["error", "double"],
"no-nested-ternary": "off",
"comma-dangle": ["error", "always-multiline"],
"arrow-body-style": ["error", "as-needed"],
"spaced-comment": ["error", "always"],
"semi": ["error", "always"],
"eol-last": ["error", "always"],
"object-curly-spacing": ["error", "always"],
"prettier/prettier": "error",
"import/prefer-default-export": "off",
"import/no-extraneous-dependencies": "off",
"no-use-before-define": "off",
"import/extensions": [
"error",
"ignorePackages",
{
"js": "never",
"jsx": "never",
"ts": "never",
"tsx": "never"
}
],
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-shadow": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-use-before-define": "off",
"no-console": "off"
}
}


//
9 changes: 9 additions & 0 deletions booking-app/.firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"projects": {
"default": "flowing-mantis-389917",
"production": "flowing-mantis-389917"
},
"targets": {},
"etags": {},
"dataconnectEmulatorConfig": {}
}
17 changes: 17 additions & 0 deletions booking-app/.gcloudignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This file specifies files that are *not* uploaded to Google Cloud
# using gcloud. It follows the same syntax as .gitignore, with the addition of
# "#!include" directives (which insert the entries of the given .gitignore-style
# file at that point).
#
# For more information, run:
# $ gcloud topic gcloudignore
#
.gcloudignore
# If you would like to upload your .git directory, .gitignore file or files
# from your .gitignore file, remove the corresponding line
# below:
.git
.gitignore

# Node.js dependencies:
node_modules/
39 changes: 39 additions & 0 deletions booking-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts

.env
.env*
44 changes: 44 additions & 0 deletions booking-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Booking App

This project is a booking management application built with Next.js.

## Getting Started

Follow these steps to run the application in your local environment.

### Prerequisites

- Node.js (version 18 or later)
- npm (usually comes with Node.js)

### Installation

1. Clone the repository or download the project files.

2. Navigate to the project directory:
```
cd booking-app
```
3. Install the dependencies:
`npm install`
4. Obtain the `.env` file from a project administrator and place it in the root directory of the project.

### Running the Application

To start the development server:
`npm run dev`
The application should now be running on [http://localhost:3000](http://localhost:3000).

## Environment Variables

This project uses environment variables for configuration. Make sure you have received the `.env` file from a project administrator and placed it in the root directory before running the application.

## Deployment

This project uses automated deployment pipelines:

- Pushing to the `main` branch automatically deploys to the development environment.
- Pushing to the `staging` branch automatically deploys to the staging environment.
- Pushing to the `production` branch automatically deploys to the production environment.

Please ensure you push your changes to the appropriate branch based on the intended deployment environment.
19 changes: 19 additions & 0 deletions booking-app/app.development.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
runtime: nodejs18
instance_class: F1
service: development

automatic_scaling:
min_instances: 1
max_instances: 10
target_cpu_utilization: 0.65

env_variables:
NEXT_PUBLIC_BRANCH_NAME: "development"
NODE_OPTIONS: "--max-old-space-size=4096"

build_env_variables:
NODE_OPTIONS: "--max-old-space-size=4096"

handlers:
- url: /(.*)
script: auto
19 changes: 19 additions & 0 deletions booking-app/app.production.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
runtime: nodejs20
instance_class: F1
service: default

automatic_scaling:
min_instances: 1
max_instances: 10
target_cpu_utilization: 0.65

env_variables:
NEXT_PUBLIC_BRANCH_NAME: "production"
NODE_OPTIONS: "--max-old-space-size=4096"

build_env_variables:
NODE_OPTIONS: "--max-old-space-size=4096"

handlers:
- url: /(.*)
script: auto
19 changes: 19 additions & 0 deletions booking-app/app.staging.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
runtime: nodejs20
instance_class: F1
service: staging

automatic_scaling:
min_instances: 1
max_instances: 10
target_cpu_utilization: 0.65

env_variables:
NEXT_PUBLIC_BRANCH_NAME: "staging"
NODE_OPTIONS: "--max-old-space-size=4096"

build_env_variables:
NODE_OPTIONS: "--max-old-space-size=4096"

handlers:
- url: /(.*)
script: auto
8 changes: 8 additions & 0 deletions booking-app/app/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"trailingComma": "all",
"arrowParens": "avoid",
"printWidth": 80,
"semi": true,
"tabWidth": 2,
"useTabs": false
}
Loading

0 comments on commit 1287a7f

Please sign in to comment.