diff --git a/Dockerfile.display-leaderboard b/Dockerfile.display-leaderboard index 534fbb5..7c76140 100644 --- a/Dockerfile.display-leaderboard +++ b/Dockerfile.display-leaderboard @@ -19,6 +19,6 @@ WORKDIR /app RUN npm install -EXPOSE 5013 +EXPOSE 5004 CMD ["node", "index.js"] diff --git a/Dockerfile.resource-management b/Dockerfile.resource-management index 64de523..f8e8348 100644 --- a/Dockerfile.resource-management +++ b/Dockerfile.resource-management @@ -19,6 +19,6 @@ WORKDIR /app RUN npm install -EXPOSE 5013 +EXPOSE 5007 CMD ["node", "index.js"] diff --git a/FSL-Architecture-DevOps/cloudbuild/fsl-game.yaml b/FSL-Architecture-DevOps/cloudbuild/fsl-game.yaml new file mode 100644 index 0000000..e9531f8 --- /dev/null +++ b/FSL-Architecture-DevOps/cloudbuild/fsl-game.yaml @@ -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 diff --git a/FSL-Architecture-DevOps/deployment/display-leader-board.yml b/FSL-Architecture-DevOps/deployment/display-leader-board.yaml similarity index 100% rename from FSL-Architecture-DevOps/deployment/display-leader-board.yml rename to FSL-Architecture-DevOps/deployment/display-leader-board.yaml diff --git a/FSL-Architecture-DevOps/deployment/display-leaderboard.yml b/FSL-Architecture-DevOps/deployment/display-leaderboard.yaml similarity index 100% rename from FSL-Architecture-DevOps/deployment/display-leaderboard.yml rename to FSL-Architecture-DevOps/deployment/display-leaderboard.yaml diff --git a/FSL-Architecture-DevOps/deployment/redis-listener.yml b/FSL-Architecture-DevOps/deployment/redis-listener.yaml similarity index 100% rename from FSL-Architecture-DevOps/deployment/redis-listener.yml rename to FSL-Architecture-DevOps/deployment/redis-listener.yaml diff --git a/FSL-Architecture-DevOps/deployment/score-update-listener.yml b/FSL-Architecture-DevOps/deployment/score-update-listener.yaml similarity index 100% rename from FSL-Architecture-DevOps/deployment/score-update-listener.yml rename to FSL-Architecture-DevOps/deployment/score-update-listener.yaml diff --git a/FSL-Architecture-DevOps/deployment/simulator-dep.yml b/FSL-Architecture-DevOps/deployment/simulator-dep.yaml similarity index 100% rename from FSL-Architecture-DevOps/deployment/simulator-dep.yml rename to FSL-Architecture-DevOps/deployment/simulator-dep.yaml diff --git a/FSL-Architecture-DevOps/deployment/simulator-listener.yml b/FSL-Architecture-DevOps/deployment/simulator-listener.yaml similarity index 100% rename from FSL-Architecture-DevOps/deployment/simulator-listener.yml rename to FSL-Architecture-DevOps/deployment/simulator-listener.yaml diff --git a/FSL-Architecture-DevOps/deployment/simulator.yml b/FSL-Architecture-DevOps/deployment/simulator.yaml similarity index 100% rename from FSL-Architecture-DevOps/deployment/simulator.yml rename to FSL-Architecture-DevOps/deployment/simulator.yaml diff --git a/FSL-Architecture-DevOps/deployment/simulatorlistener.yml b/FSL-Architecture-DevOps/deployment/simulatorlistener.yaml similarity index 100% rename from FSL-Architecture-DevOps/deployment/simulatorlistener.yml rename to FSL-Architecture-DevOps/deployment/simulatorlistener.yaml diff --git a/FSL-Architecture-DevOps/deployment/spanner-update-listener.yml b/FSL-Architecture-DevOps/deployment/spanner-update-listener.yaml similarity index 98% rename from FSL-Architecture-DevOps/deployment/spanner-update-listener.yml rename to FSL-Architecture-DevOps/deployment/spanner-update-listener.yaml index 4a6eb60..e669be9 100644 --- a/FSL-Architecture-DevOps/deployment/spanner-update-listener.yml +++ b/FSL-Architecture-DevOps/deployment/spanner-update-listener.yaml @@ -5,7 +5,7 @@ metadata: app: spanner-updater name: spanner-updater spec: - replicas: 2 + replicas: 10 selector: matchLabels: app: spanner-updater diff --git a/FSL-Architecture-DevOps/deployment/spannerupdate.yml b/FSL-Architecture-DevOps/deployment/spannerupdate.yaml similarity index 100% rename from FSL-Architecture-DevOps/deployment/spannerupdate.yml rename to FSL-Architecture-DevOps/deployment/spannerupdate.yaml diff --git a/FSL-Architecture-DevOps/deployment/update-leaderboard-deployment.yml b/FSL-Architecture-DevOps/deployment/update-leaderboard-deployment.yaml similarity index 100% rename from FSL-Architecture-DevOps/deployment/update-leaderboard-deployment.yml rename to FSL-Architecture-DevOps/deployment/update-leaderboard-deployment.yaml diff --git a/FSL-Architecture-DevOps/deployment/update-leaderboard.yml b/FSL-Architecture-DevOps/deployment/update-leaderboard.yaml similarity index 100% rename from FSL-Architecture-DevOps/deployment/update-leaderboard.yml rename to FSL-Architecture-DevOps/deployment/update-leaderboard.yaml diff --git a/FSL-Architecture-DevOps/deployment/update-score-listener.yml b/FSL-Architecture-DevOps/deployment/update-score-listener.yaml similarity index 100% rename from FSL-Architecture-DevOps/deployment/update-score-listener.yml rename to FSL-Architecture-DevOps/deployment/update-score-listener.yaml diff --git a/Terraform/main.tf b/FSL-Architecture-DevOps/terraform/main.tf similarity index 100% rename from Terraform/main.tf rename to FSL-Architecture-DevOps/terraform/main.tf diff --git a/Terraform/terraform.tfvars b/FSL-Architecture-DevOps/terraform/terraform.tfvars similarity index 100% rename from Terraform/terraform.tfvars rename to FSL-Architecture-DevOps/terraform/terraform.tfvars diff --git a/Terraform/variables.tf b/FSL-Architecture-DevOps/terraform/variables.tf similarity index 86% rename from Terraform/variables.tf rename to FSL-Architecture-DevOps/terraform/variables.tf index 0b51f96..60e47d8 100644 --- a/Terraform/variables.tf +++ b/FSL-Architecture-DevOps/terraform/variables.tf @@ -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" { diff --git a/FSL-MS-Display-Leaderboard/ENV b/FSL-MS-Display-Leaderboard/ENV new file mode 100644 index 0000000..d931f83 --- /dev/null +++ b/FSL-MS-Display-Leaderboard/ENV @@ -0,0 +1,9 @@ +REDIS_URL='redis://:6379/1' +RESOURCE_MANAGEMENT_REDIS_URL='redis://:6379/2' +PORT=5013 +NODE_ENV=uat +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 \ No newline at end of file diff --git a/FSL-MS-Resource-Management/ENV b/FSL-MS-Resource-Management/ENV new file mode 100644 index 0000000..d931f83 --- /dev/null +++ b/FSL-MS-Resource-Management/ENV @@ -0,0 +1,9 @@ +REDIS_URL='redis://:6379/1' +RESOURCE_MANAGEMENT_REDIS_URL='redis://:6379/2' +PORT=5013 +NODE_ENV=uat +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 \ No newline at end of file diff --git a/FSL-MS-Simulator/ENV b/FSL-MS-Simulator/ENV new file mode 100644 index 0000000..d931f83 --- /dev/null +++ b/FSL-MS-Simulator/ENV @@ -0,0 +1,9 @@ +REDIS_URL='redis://:6379/1' +RESOURCE_MANAGEMENT_REDIS_URL='redis://:6379/2' +PORT=5013 +NODE_ENV=uat +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 \ No newline at end of file diff --git a/FSL-Tools/locust/FantasyFlow.yaml b/FSL-Tools/locust/FantasyFlow.yaml index 0d2b27e..32b10ca 100644 --- a/FSL-Tools/locust/FantasyFlow.yaml +++ b/FSL-Tools/locust/FantasyFlow.yaml @@ -63,5 +63,5 @@ data: # print('***********************************************************************************') # print('###################################################################################') # print('***********************************************************************************') - time.sleep(1) + time.sleep(0.005)