This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fetch from 'node-fetch'; | |
import {JSDOM} from 'jsdom'; | |
/** | |
* Small wrapper method for getting the actual HTML content of a website | |
* @param {string} url The URL to get the HTML for | |
* @return {Promise<string>} The HTML content as string | |
*/ | |
const getWebsiteContent = async (url: string): Promise<string> => { | |
// Simple HTTP call |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## create-sa.sh | |
#### Variables | |
SERVICE_ACCOUNT_ID="customer-1" | |
PROJECT_ID="my-medium-demo-project-299218" | |
SA_DESCRIPTION="Customer 1 description" | |
SA_DISPLAY_NAME="Customer 1" | |
ROLE_NAME="roles/cloudfunctions.invoker" | |
#### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## create-sa-key.sh | |
#### Variables | |
SERVICE_ACCOUNT_ID="customer-1" | |
PROJECT_ID="my-medium-demo-project-299218" | |
#### | |
### Create private key for service account | |
gcloud iam service-accounts keys create ~/key.json \ | |
--iam-account "$SERVICE_ACCOUNT_ID@$PROJECT_ID.iam.gserviceaccount.com" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// part of external-service/index.ts | |
/** | |
* 1. Define a GET endpoint with the url "/ping" | |
*/ | |
app.get('/ping', async (request, reply) => { | |
// Just rename global variable for ease of use | |
const url: string = cloudFunctionEndpoint; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.gitignore | |
.dockerignore | |
Dockerfile | |
build | |
node_modules | |
README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Name the node stage "builder" | |
FROM node:15-alpine AS builder | |
# Set working directory | |
WORKDIR /app | |
# Copy our node module specification | |
COPY package.json package.json | |
COPY yarn.lock yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Name the node stage "builder" | |
FROM node:15-alpine AS builder | |
# Set working directory | |
WORKDIR /app | |
# Copy our node module specification | |
COPY package.json package.json | |
COPY yarn.lock yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
# $PORT will be provided by 'docker run' | |
listen $PORT; | |
server_name localhost; | |
location / { | |
root /usr/share/nginx/html; | |
index index.html index.htm; | |
try_files $uri /index.html; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Name the node stage "builder" | |
FROM node:15-alpine AS builder | |
# Set working directory | |
WORKDIR /app | |
# Copy our node module specification | |
COPY package.json package.json | |
COPY yarn.lock yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node_modules | |
build | |
README.md | |
.gitignore | |
deploy.sh |