Skip to content

Commit

Permalink
added cloudbuild scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
dw800 committed Mar 2, 2023
1 parent e9258f6 commit 86f1530
Show file tree
Hide file tree
Showing 23 changed files with 178 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.display-leaderboard
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ WORKDIR /app

RUN npm install

EXPOSE 5013
EXPOSE 5004

CMD ["node", "index.js"]
2 changes: 1 addition & 1 deletion Dockerfile.resource-management
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ WORKDIR /app

RUN npm install

EXPOSE 5013
EXPOSE 5007

CMD ["node", "index.js"]
143 changes: 143 additions & 0 deletions FSL-Architecture-DevOps/cloudbuild/fsl-game.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
steps:
# get GKE credentials
- name: 'gcr.io/cloud-builders/gcloud'
args: ['container', 'clusters', 'get-credentials', '$GKE_CLUSTER_NAME', '--zone=$GKE_ZONE']
env:
- 'GKE_CLUSTER_NAME=fsl-demo-cluster'
- 'GKE_ZONE=us-west1-a'

# install ngnix ingress
- name: 'gcr.io/cloud-builders/kubectl'
args: ['apply', '-f', 'https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.5.1/deploy/static/provider/cloud/deploy.yaml']

# install cert manager
- name: 'gcr.io/cloud-builders/kubectl'
args: ['apply', '-f', 'https://github.com/cert-manager/cert-manager/releases/download/v1.11.0/cert-manager.yaml']

# Clone the repository
- name: 'gcr.io/cloud-builders/git'
args:
- clone
- https://github.com/google/fsl-gaming.git
- demo

# start of docker build

# build the redis-listener image
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/$PROJECT_ID/redis-listener:latest', '-f', 'Dockerfile.redis-listener', './demo']

# push the redis-listener image
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'gcr.io/$PROJECT_ID/redis-listener:latest']

# build the spanner-update-listener image
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/$PROJECT_ID/spanner-update-listener:latest', '-f', 'Dockerfile.spanner-update-listener', './demo']

# push the spanner-update-listener image
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'gcr.io/$PROJECT_ID/spanner-update-listener:latest']

# build the score-update-listener image
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/$PROJECT_ID/score-update-listener:latest', '-f', 'Dockerfile.score-update-listener', './demo']

# push the score-update-listener image
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'gcr.io/$PROJECT_ID/score-update-listener:latest']

# build the simulator-listener image
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/$PROJECT_ID/simulator-listener:latest', '-f', 'Dockerfile.simulator-listener', './demo']

# push the simulator-listener image
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'gcr.io/$PROJECT_ID/simulator-listener:latest']

# build the simulator image
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/$PROJECT_ID/simulator:latest', '-f', 'Dockerfile.simulator', './demo']

# push the simulator image
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'gcr.io/$PROJECT_ID/simulator:latest']

# build the display-leaderboard image
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/$PROJECT_ID/display-leaderboard:latest', '-f', 'Dockerfile.display-leaderboard', './demo']

# push the display-leaderboard image
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'gcr.io/$PROJECT_ID/display-leaderboard:latest']

# build the update-leaderboard image
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/$PROJECT_ID/update-leaderboard:latest', '-f', 'Dockerfile.update-leaderboard', './demo']

# push the update-leaderboard image
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'gcr.io/$PROJECT_ID/update-leaderboard:latest']

# build the resource-management image
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/$PROJECT_ID/resource-management:latest', '-f', 'Dockerfile.resource-management', './demo']

# push the resource-management image
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'gcr.io/$PROJECT_ID/resource-management:latest']

# start of k8s deployment

# install cluster issuer for cert
- name: 'gcr.io/cloud-builders/kubectl'
args: ['apply', '-f', './demo/FSL-Architecture-DevOps/deployment/cluster-issuer.yaml']

# deploy redis listener
- name: 'gcr.io/cloud-builders/kubectl'
args: ['apply', '-f', './demo/FSL-Architecture-DevOps/deployment/redis-listener.yaml']

# deploy spanner update listener
- name: 'gcr.io/cloud-builders/kubectl'
args: ['apply', '-f', './demo/FSL-Architecture-DevOps/deployment/spanner-update-listener.yaml']

# deploy score update listener
- name: 'gcr.io/cloud-builders/kubectl'
args: ['apply', '-f', './demo/FSL-Architecture-DevOps/deployment/score-update-listener.yaml']

# deploy simulator listener
- name: 'gcr.io/cloud-builders/kubectl'
args: ['apply', '-f', './demo/FSL-Architecture-DevOps/deployment/simulator-listener.yaml']

# deploy simulator
- name: 'gcr.io/cloud-builders/kubectl'
args: ['apply', '-f', './demo/FSL-Architecture-DevOps/deployment/simulator.yaml']

# deploy update leaderboard
- name: 'gcr.io/cloud-builders/kubectl'
args: ['apply', '-f', './demo/FSL-Architecture-DevOps/deployment/update-leaderboard.yaml']

# deploy display leaderboard
- name: 'gcr.io/cloud-builders/kubectl'
args: ['apply', '-f', './demo/FSL-Architecture-DevOps/deployment/display-leaderboard.yaml']

# deploy resource management
- name: 'gcr.io/cloud-builders/kubectl'
args: ['apply', '-f', './demo/FSL-Architecture-DevOps/deployment/resource-management.yaml']

# deploy ingress
- name: 'gcr.io/cloud-builders/kubectl'
args: ['apply', '-f', './demo/FSL-Architecture-DevOps/deployment/ingress.yaml']

images:
- 'gcr.io/$PROJECT_ID/redis-listener:latest'
- 'gcr.io/$PROJECT_ID/spanner-update-listener:latest'
- 'gcr.io/$PROJECT_ID/score-update-listener:latest'
- 'gcr.io/$PROJECT_ID/simulator-listener:latest'
- 'gcr.io/$PROJECT_ID/simulator:latest'
- 'gcr.io/$PROJECT_ID/display-leaderboard:latest'
- 'gcr.io/$PROJECT_ID/update-leaderboard:latest'
- 'gcr.io/$PROJECT_ID/resource-management:latest'

# timeout in 2 hours
timeout: 7200s
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
app: spanner-updater
name: spanner-updater
spec:
replicas: 2
replicas: 10
selector:
matchLabels:
app: spanner-updater
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@ variable "VPC_NAME" {

variable "SPANNER_TOPIC" {
type = string
default = "pushToSpannerTest"
default = "pushToSpanner"
}

variable "SIMULATOR_TOPIC" {
type = string
default = "simulatorTest"
default = "simulatorScore"
}

variable "REDIS_TOPIC" {
type = string
default = "updateRedisTest"
default = "updateRedis"
}

variable "SCORE_TOPIC" {
type = string
default = "updateScoreTest"
default = "updateScore"
}

variable "REDIS_INST_NAME" {
Expand Down
9 changes: 9 additions & 0 deletions FSL-MS-Display-Leaderboard/ENV
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
REDIS_URL='redis://<IP or hostname>:6379/1'
RESOURCE_MANAGEMENT_REDIS_URL='redis://<IP or hostname>:6379/2'
PORT=5013
NODE_ENV=uat
PROJECT_ID=<GCP Project ID>
PUBSUB_SUBSCRIPTION_ID=pushToSpanner-sub
PUBSUB_SIMULATOR_SUBSCRIPTION_ID=simulatorScore-sub
PUBSUB_REDIS_SUBSCRIPTION_ID=updateRedis-sub
PUBSUB_UPDATE_SCORE_SUBSCRIPTION_ID=updateScore-sub
9 changes: 9 additions & 0 deletions FSL-MS-Resource-Management/ENV
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
REDIS_URL='redis://<IP or hostname>:6379/1'
RESOURCE_MANAGEMENT_REDIS_URL='redis://<IP or hostname>:6379/2'
PORT=5013
NODE_ENV=uat
PROJECT_ID=<GCP Project ID>
PUBSUB_SUBSCRIPTION_ID=pushToSpanner-sub
PUBSUB_SIMULATOR_SUBSCRIPTION_ID=simulatorScore-sub
PUBSUB_REDIS_SUBSCRIPTION_ID=updateRedis-sub
PUBSUB_UPDATE_SCORE_SUBSCRIPTION_ID=updateScore-sub
9 changes: 9 additions & 0 deletions FSL-MS-Simulator/ENV
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
REDIS_URL='redis://<IP or hostname>:6379/1'
RESOURCE_MANAGEMENT_REDIS_URL='redis://<IP or hostname>:6379/2'
PORT=5013
NODE_ENV=uat
PROJECT_ID=<GCP Project ID>
PUBSUB_SUBSCRIPTION_ID=pushToSpanner-sub
PUBSUB_SIMULATOR_SUBSCRIPTION_ID=simulatorScore-sub
PUBSUB_REDIS_SUBSCRIPTION_ID=updateRedis-sub
PUBSUB_UPDATE_SCORE_SUBSCRIPTION_ID=updateScore-sub
2 changes: 1 addition & 1 deletion FSL-Tools/locust/FantasyFlow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@ data:
# print('***********************************************************************************')
# print('###################################################################################')
# print('***********************************************************************************')
time.sleep(1)
time.sleep(0.005)

0 comments on commit 86f1530

Please sign in to comment.