Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pillow requirement from <8,>=7.1.1 to >=7.1.1,<10 in /sdks/python #6

Open
wants to merge 91 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
543ebd5
Create main.tf
ruslan-ikhsan Oct 7, 2022
9c0705c
Update main.tf
ruslan-ikhsan Oct 7, 2022
220c87b
Create requirements.txt
ruslan-ikhsan Oct 7, 2022
45d42b2
Add files via upload
ruslan-ikhsan Oct 7, 2022
d9bcf31
Added main.py to src/
ruslan-ikhsan Oct 7, 2022
290c473
Create README.md
ruslan-ikhsan Oct 7, 2022
43674e3
Update README.md
ruslan-ikhsan Oct 7, 2022
28c614b
state file
ruslan-ikhsan Oct 7, 2022
1c8288b
Merge branch 'akvelon:master' into master
ruslan-ikhsan Oct 10, 2022
639637c
Merge branch 'master' of https://github.com/ruslan-ikhsan/beam
ruslan-ikhsan Oct 10, 2022
c6ef5aa
Update tf backend script
ruslan-ikhsan Oct 10, 2022
37b2bf2
Update TF scripts
ruslan-ikhsan Oct 12, 2022
747884f
Merge branch 'akvelon:master' into master
ruslan-ikhsan Oct 13, 2022
e1f7fb5
New Terraform CF backend scripts
ruslan-ikhsan Oct 13, 2022
6c17da2
Update Terraform v2 for backend
ruslan-ikhsan Oct 13, 2022
d7df37f
Update backend.tf
ruslan-ikhsan Oct 13, 2022
bdbb0b1
Added api_enable tf scripts
ruslan-ikhsan Oct 13, 2022
d909cb0
Update main.tf
ruslan-ikhsan Oct 13, 2022
dd816db
Update main.tf
ruslan-ikhsan Oct 13, 2022
f52c02d
Updated tf files
ruslan-ikhsan Oct 13, 2022
f2fc394
Update main.tf
ruslan-ikhsan Oct 13, 2022
b11b95d
Update main.tf
ruslan-ikhsan Oct 13, 2022
2876c05
Updated some tf sciprts
ruslan-ikhsan Oct 13, 2022
74df645
Updated TF Files v.2
ruslan-ikhsan Oct 13, 2022
a4980de
Updated files tf scripts
ruslan-ikhsan Oct 13, 2022
240d5a8
Update main.tf
ruslan-ikhsan Oct 13, 2022
57b3b0b
Updated tf scripts
ruslan-ikhsan Oct 13, 2022
f4aec3d
Update main.tf
ruslan-ikhsan Oct 13, 2022
5e0a8b8
Update main.tf
ruslan-ikhsan Oct 13, 2022
dc0abf2
Updates
ruslan-ikhsan Oct 13, 2022
3f51e83
Update main.tf
ruslan-ikhsan Oct 13, 2022
d2a4191
Update tf scripts
ruslan-ikhsan Oct 13, 2022
18170dd
Update main.tf
ruslan-ikhsan Oct 13, 2022
ad1150a
Merge branch 'master' of https://github.com/ruslan-ikhsan/beam
ruslan-ikhsan Oct 13, 2022
02f98fc
Set up GitHub workflow
ruslan-ikhsan Oct 13, 2022
8aebdb4
Update
ruslan-ikhsan Oct 13, 2022
c278350
Update main.tf
ruslan-ikhsan Oct 13, 2022
22641ce
Update main.tf
ruslan-ikhsan Oct 13, 2022
a4c4b60
Update outputs.tf
ruslan-ikhsan Oct 13, 2022
341303e
Some summary
ruslan-ikhsan Oct 13, 2022
095ca73
Update variables.tf
ruslan-ikhsan Oct 13, 2022
55f6f46
Updates
ruslan-ikhsan Oct 13, 2022
ee0ec16
Updated
ruslan-ikhsan Oct 13, 2022
aa5463b
Udpated
ruslan-ikhsan Oct 13, 2022
f3dfc56
Updates
ruslan-ikhsan Oct 13, 2022
89930c2
Update main.tf
ruslan-ikhsan Oct 14, 2022
b98e52e
Add
ruslan-ikhsan Oct 14, 2022
d30d33d
Updates
ruslan-ikhsan Oct 14, 2022
460d11c
Updates
ruslan-ikhsan Oct 14, 2022
84b8238
Almost Final version
ruslan-ikhsan Oct 14, 2022
4068db6
Almost Final Version
ruslan-ikhsan Oct 14, 2022
87551b3
Update
ruslan-ikhsan Oct 14, 2022
6587c02
Update variables.tf
ruslan-ikhsan Oct 14, 2022
a449d5b
Update main.tf
ruslan-ikhsan Oct 14, 2022
eecdf31
Updates
ruslan-ikhsan Oct 14, 2022
0b9ef2b
Updates
ruslan-ikhsan Oct 14, 2022
e96f3e0
Updates
ruslan-ikhsan Oct 14, 2022
8f1346e
Updates
ruslan-ikhsan Oct 16, 2022
22100d8
Final update
ruslan-ikhsan Oct 16, 2022
6dc9d34
Delete cloud-build.yml
ruslan-ikhsan Oct 16, 2022
950970f
Delete redundant dir cloud-build
ruslan-ikhsan Oct 16, 2022
da14172
Merge branch 'master' of https://github.com/ruslan-ikhsan/beam
ruslan-ikhsan Oct 16, 2022
c01fbf8
Delete redundant terraform dir
ruslan-ikhsan Oct 16, 2022
d9efe93
Delete state.tfbackend
ruslan-ikhsan Oct 16, 2022
f7fbfb9
Update main.tf
ruslan-ikhsan Oct 16, 2022
4c483fd
Move files
ruslan-ikhsan Oct 18, 2022
bd09314
Update cloudbuild.yaml
ruslan-ikhsan Oct 18, 2022
08f58cc
Create gcp-deploy.yml
ruslan-ikhsan Oct 18, 2022
b9ba2c6
Update gcp-deploy.yml
ruslan-ikhsan Oct 18, 2022
7c500f1
Update main.tf
ruslan-ikhsan Oct 19, 2022
9a2770a
Update TF script for TOB backend
ruslan-ikhsan Oct 20, 2022
f98c1fd
Delete gcp-deploy.yml
ruslan-ikhsan Oct 21, 2022
487fd43
Update main.tf
ruslan-ikhsan Oct 21, 2022
7483e7f
Final updates. Ready for review
ruslan-ikhsan Oct 21, 2022
1099308
Deleted locals variable
ruslan-ikhsan Oct 21, 2022
1925bc1
Cloud Build for PG Backend (go, java)
ruslan-ikhsan Oct 25, 2022
88c7fcb
Update cloudbuild_playground_backend.yml
ruslan-ikhsan Oct 25, 2022
5035e6b
Update cloudbuild_playground_backend.yml
ruslan-ikhsan Oct 25, 2022
55ba7b4
Update cloudbuild_playground_backend.yml
ruslan-ikhsan Oct 25, 2022
53f1621
Update cloudbuild_playground_backend.yml
ruslan-ikhsan Oct 25, 2022
395fc76
Update cloudbuild_playground_backend.yml
ruslan-ikhsan Oct 25, 2022
879c95a
Update cloudbuild_playground_backend.yml
ruslan-ikhsan Oct 25, 2022
a43aeb4
Update cloudbuild_playground_backend.yml
ruslan-ikhsan Oct 25, 2022
f776bf3
Update cloudbuild_playground_backend.yml
ruslan-ikhsan Oct 25, 2022
ef90679
Update cloudbuild_playground_backend.yml
ruslan-ikhsan Oct 25, 2022
665f03c
Update cloudbuild_playground_backend.yml
ruslan-ikhsan Oct 25, 2022
30e6995
Update cloudbuild_playground_backend.yml
ruslan-ikhsan Oct 26, 2022
e2dcbbc
Update cloudbuild_playground_backend.yml
ruslan-ikhsan Oct 26, 2022
b1514f7
New cloudbuild yaml for backend
ruslan-ikhsan Oct 26, 2022
d67ff29
Update cloudbuild_playground_backend.yml
ruslan-ikhsan Oct 26, 2022
eafb90e
Update pillow requirement from <8,>=7.1.1 to >=7.1.1,<10 in /sdks/python
dependabot[bot] Oct 27, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions cloudbuild_playground_backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

steps:

- name: 'openjdk:11'
args: ['-c', './gradlew playground:backend:precommit']
# This step builds the base image for Beam Playground backend builds
# - name: 'gcr.io/cloud-builders/docker'
# args:
# - 'build'
# - '--tag=us-central1-docker.pkg.dev/$PROJECT_ID/$_ARTIFACT_REGISTRY_REPOSITORY_ID/backend-builder:latest'
# - '-f'
# - 'gha-cloudbuild/dockerfiles/Dockerfile-base-image-backend'
# - '.'
#
# # This step builds Beam Playground backend container for golang
# - name: 'us-central1-docker.pkg.dev/$PROJECT_ID/$_ARTIFACT_REGISTRY_REPOSITORY_ID/backend-builder:latest'
# entrypoint: './gradlew'
# args:
# - ':playground:backend:containers:go:docker'
#
# # This step builds Beam Playground backend container for java
# - name: 'us-central1-docker.pkg.dev/$PROJECT_ID/$_ARTIFACT_REGISTRY_REPOSITORY_ID/backend-builder:latest'
# entrypoint: './gradlew'
# args:
# - ':playground:backend:containers:java:docker'
#
# # This step builds Beam Playground backend container for java
# - name: 'us-central1-docker.pkg.dev/$PROJECT_ID/$_ARTIFACT_REGISTRY_REPOSITORY_ID/backend-builder:latest'
# entrypoint: './gradlew'
# args:
# - ':playground:backend:containers:python:docker'
#
#
# # This step builds Beam Playground backend container for java
# - name: 'us-central1-docker.pkg.dev/$PROJECT_ID/$_ARTIFACT_REGISTRY_REPOSITORY_ID/backend-builder:latest'
# entrypoint: './gradlew'
# args:
# - ':playground:backend:containers:router:docker'
#
#
# # This step builds Beam Playground backend container for java
# - name: 'us-central1-docker.pkg.dev/$PROJECT_ID/$_ARTIFACT_REGISTRY_REPOSITORY_ID/backend-builder:latest'
# entrypoint: './gradlew'
# args:
# - ':playground:backend:containers:scio:docker'
#
#substitutions:
# _DOCKERTAG: ${GITHUB_SHA}
# _ARTIFACT_REGISTRY_REPOSITORY_ID: playground-repository
#
#images:
# - 'us-central1-docker.pkg.dev/$PROJECT_ID/$_ARTIFACT_REGISTRY_REPOSITORY_ID/backend-builder:latest'
#
#timeout: 3600s
68 changes: 68 additions & 0 deletions gha-cloudbuild/cloudbuild_playground_backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

steps:

- name: 'golang'
args: ['./gradlew playground:backend:precommit']
# This step builds the base image for Beam Playground backend builds
# - name: 'gcr.io/cloud-builders/docker'
# args:
# - 'build'
# - '--tag=us-central1-docker.pkg.dev/$PROJECT_ID/$_ARTIFACT_REGISTRY_REPOSITORY_ID/backend-builder:latest'
# - '-f'
# - 'gha-cloudbuild/dockerfiles/Dockerfile-base-image-backend'
# - '.'
#
# # This step builds Beam Playground backend container for golang
# - name: 'us-central1-docker.pkg.dev/$PROJECT_ID/$_ARTIFACT_REGISTRY_REPOSITORY_ID/backend-builder:latest'
# entrypoint: './gradlew'
# args:
# - ':playground:backend:containers:go:docker'
#
# # This step builds Beam Playground backend container for java
# - name: 'us-central1-docker.pkg.dev/$PROJECT_ID/$_ARTIFACT_REGISTRY_REPOSITORY_ID/backend-builder:latest'
# entrypoint: './gradlew'
# args:
# - ':playground:backend:containers:java:docker'
#
# # This step builds Beam Playground backend container for java
# - name: 'us-central1-docker.pkg.dev/$PROJECT_ID/$_ARTIFACT_REGISTRY_REPOSITORY_ID/backend-builder:latest'
# entrypoint: './gradlew'
# args:
# - ':playground:backend:containers:python:docker'
#
#
# # This step builds Beam Playground backend container for java
# - name: 'us-central1-docker.pkg.dev/$PROJECT_ID/$_ARTIFACT_REGISTRY_REPOSITORY_ID/backend-builder:latest'
# entrypoint: './gradlew'
# args:
# - ':playground:backend:containers:router:docker'
#
#
# # This step builds Beam Playground backend container for java
# - name: 'us-central1-docker.pkg.dev/$PROJECT_ID/$_ARTIFACT_REGISTRY_REPOSITORY_ID/backend-builder:latest'
# entrypoint: './gradlew'
# args:
# - ':playground:backend:containers:scio:docker'
#
#substitutions:
# _DOCKERTAG: ${GITHUB_SHA}
# _ARTIFACT_REGISTRY_REPOSITORY_ID: playground-repository
#
#images:
# - 'us-central1-docker.pkg.dev/$PROJECT_ID/$_ARTIFACT_REGISTRY_REPOSITORY_ID/backend-builder:latest'
#
#timeout: 3600s
41 changes: 41 additions & 0 deletions gha-cloudbuild/dockerfiles/Dockerfile-base-image-backend
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
###############################################################################
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
###############################################################################

FROM gcr.io/cloud-builders/gcloud

ARG GO_VERSION=1.19.2
ENV PATH="${PATH}:/usr/local/go/bin"

RUN apt-get update >/dev/null

# Install Docker
# See: https://docs.docker.com/engine/install/ubuntu/#install-using-the-convenience-script
RUN curl -fsSL https://get.docker.com -o get-docker.sh
RUN sh ./get-docker.sh >/dev/null

# Install Go
# See: https://go.dev/doc/install
RUN curl -OL https://golang.org/dl/go$GO_VERSION.linux-amd64.tar.gz
RUN sha256sum go$GO_VERSION.linux-amd64.tar.gz
RUN tar -C /usr/local -xvf go$GO_VERSION.linux-amd64.tar.gz
RUN rm go$GO_VERSION.linux-amd64.tar.gz
RUN go version

# Install Java
RUN apt-get install openjdk-11-jdk -y >/dev/null
RUN java -version
60 changes: 60 additions & 0 deletions learning/tour-of-beam/terraform-v2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# [Tour of Beam] Deploying backend infrastructure as GCP Cloud Function with GCP, Terraform and Cloud Build
This tutorial explains how to create Tour of Beam backend infrastructure as a GCP Cloud Functions using Infrastructure as a Code (IaC) and GitOps methodoliges.


### Deployment
Prerequisites:
- Active GCP project with billing enabled
- Existing bucket to store Terraform state (name to be declared in backend.tf)
- Existing service account with the following roles:
- Cloud Functions Admin
- Project IAM Admin
- Service Account Admin
- Service Account User
- Storage Admin
- Storage Object Admin
- Exported JSON Key of service account above

#### Configuring your environment

Steps below will:
1. Enable required APIs for the project
2. Create service account and assign required IAM roles to it (service account to run the function with)
3. Create bucket to archive and store source code
4. Create cloud functions to each function defined in backend source code


```bash
# Create environment directory per your requirements/policy
mkdir environments/dev
cd ../environments/dev
# Import exported JSON Key using
export GOOGLE_APPLICATION_CREDENTIALS = '..key path...'
# Initiliaze and run terraform
terraform init
terraform plan
terraform apply
terraform destroy
```


### Sample usage

Entry point: list sdk names
```
$ curl -X GET https://$REGION-$PROJECT_ID.cloudfunctions.net/getSdkList | json_pp
```
[response](./samples/api/get_sdk_list.json)

Get content tree by sdk name (SDK name == SDK id)
```
$ curl -X GET 'https://$REGION-$PROJECT_ID.cloudfunctions.net/getContentTree?sdk=python'
```
[response](./samples/api/get_content_tree.json)


Get unit content tree by sdk name and unitId
```
$ curl -X GET 'https://$REGION-$PROJECT_ID.cloudfunctions.net/getContentTree?sdk=python&id=challenge1'
```
[response](./samples/api/get_unit_content.json)
12 changes: 12 additions & 0 deletions learning/tour-of-beam/terraform-v2/backend_state.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
terraform {
backend "gcs" {
bucket = "tour-of-beam-backend-tfstate-bucket"
prefix = "terraform-state"
}
required_providers {
google = {
source = "hashicorp/google"
version = "~> 4.40.0"
}
}
}
33 changes: 33 additions & 0 deletions learning/tour-of-beam/terraform-v2/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
provider "google" {
project = var.project_id
}

module "iam" {
source = "./modules/iam"
project_id = var.project_id
service_account_id = var.service_account_id
depends_on = [module.api_enable]
}

module "buckets" {
source = "./modules/buckets"
project_id = var.project_id
bucket_name = var.bucket_name
depends_on = [module.iam, module.api_enable]
}

module "api_enable" {
source = "./modules/api_enable"
project_id = var.project_id
}

module "cloud_functions" {
source = "./modules/cloud_functions"
region = var.region
project_id = var.project_id
bucket_name = var.bucket_name
service_account_id = module.iam.service-account-email
source_archive_bucket = module.buckets.functions-bucket-name
source_archive_object = module.buckets.function-bucket-object
depends_on = [module.buckets, module.iam, module.api_enable]
}
27 changes: 27 additions & 0 deletions learning/tour-of-beam/terraform-v2/modules/api_enable/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Enable API for Cloud Build
resource "google_project_service" "cloud_build" {
project = var.project_id
service = "cloudbuild.googleapis.com"
disable_on_destroy = false
}

# Enable API for Cloud Function
resource "google_project_service" "cloud_function" {
project = var.project_id
service = "cloudfunctions.googleapis.com"
disable_on_destroy = false
}

# Enable API for Resource Manager
resource "google_project_service" "resource_manager" {
project = var.project_id
service = "cloudresourcemanager.googleapis.com"
disable_on_destroy = false
}

# Enable API for IAM
resource "google_project_service" "iam" {
project = var.project_id
service = "iam.googleapis.com"
disable_on_destroy = false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
variable "project_id" {
description = "The ID of the Google Cloud project within which resources are provisioned"
}
16 changes: 16 additions & 0 deletions learning/tour-of-beam/terraform-v2/modules/buckets/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
resource "google_storage_bucket" "cloud_functions_bucket" {
name = var.bucket_name
location = var.location
project = var.project_id
storage_class = "STANDARD"
}

resource "google_storage_bucket_object" "zip" {
# Use an MD5 here. If there's no changes to the source code, this won't change either.
# We can avoid unnecessary redeployments by validating the code is unchanged, and forcing
# a redeployment when it has!
name = "${data.archive_file.source_code.output_md5}.zip"
bucket = google_storage_bucket.cloud_functions_bucket.name
source = data.archive_file.source_code.output_path
content_type = "application/zip"
}
11 changes: 11 additions & 0 deletions learning/tour-of-beam/terraform-v2/modules/buckets/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
output "functions-bucket-id" {
value = google_storage_bucket.cloud_functions_bucket.id
}

output "functions-bucket-name" {
value = google_storage_bucket.cloud_functions_bucket.name
}

output "function-bucket-object" {
value = google_storage_bucket_object.zip.name
}
19 changes: 19 additions & 0 deletions learning/tour-of-beam/terraform-v2/modules/buckets/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#Generates archive of source code
variable "bucket_name" {
description = "The bucket name to store functions' source code"
}

variable "location" {
description = "Cloud Functions bucket Region"
default = "us-central1"
}

variable "project_id" {
description = "The ID of the Google Cloud project within which resources are provisioned"
}

data "archive_file" "source_code" {
type = "zip"
source_dir = "../backend"
output_path = "/tmp/backend.zip"
}
Loading