diff --git a/.github/workflows/samples.yml b/.github/workflows/samples.yml new file mode 100644 index 00000000..b656259c --- /dev/null +++ b/.github/workflows/samples.yml @@ -0,0 +1,68 @@ +name: Python Samples Script + +on: + schedule: + - cron: '0 */12 * * *' + +jobs: + run-selenium: + runs-on: ubuntu-latest + + env: + WEBHOOK_URL: ${{ secrets.WEBHOOK }} + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Python 3 + uses: actions/setup-python@v3 + with: + python-version: 3.x + + - name: Install dependencies + run: | + pip install selenium + pip install requests + + - name: Install FFmpeg + run: | + sudo apt-get update + sudo apt-get install -y ffmpeg + + - name: Install SRT + run: | + git clone https://github.com/Haivision/srt.git + cd srt + sudo apt-get install tclsh pkg-config cmake libssl-dev build-essential + ./configure + make + sudo make install + cd .. + + - name: Install Chrome + run: | + wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb + sudo dpkg -i google-chrome-stable_current_amd64.deb + + - name: Install ChromeDriver + run: | + wget https://storage.googleapis.com/chrome-for-testing-public/125.0.6422.60/linux64/chromedriver-linux64.zip + unzip chromedriver-linux64.zip + cd chromedriver-linux64 + sudo mv chromedriver /usr/bin/chromedriver + sudo chown root:root /usr/bin/chromedriver + sudo chmod +x /usr/bin/chromedriver + + - name: Run Selenium script + run: | + python Selenium/antmedia-samples.py + + - name: Install jq + run: sudo apt-get install -y jq + + - name: Send Slack notification on failure + if: ${{ failure() || cancelled() }} + run: | + SLACK_PAYLOAD=$(jq -n --arg text "<@U01UMD36SQ0> GitHub Workflow failed for ${{ github.repository }}" '{text: $text, icon_emoji: ":x:"}') + curl -X POST -H 'Content-type: application/json' --data "$SLACK_PAYLOAD" ${{ env.WEBHOOK_URL }} diff --git a/Selenium/antmedia-samples.py b/Selenium/antmedia-samples.py index 1a315b1e..aeaa5670 100644 --- a/Selenium/antmedia-samples.py +++ b/Selenium/antmedia-samples.py @@ -10,13 +10,16 @@ from selenium.webdriver.chrome.options import Options -# Function to send notification to Slack -def send_slack_message(webhook_url, message, icon_emoji=":x:"): +# Function to send notification to Slack Channel +def send_slack_message(webhook_url, message, user_id, icon_emoji=":x:"): payload = { - "text": message, + "text": f"<@{user_id}> {message}", "icon_emoji": icon_emoji } - response = requests.post(webhook_url, data={"payload": json.dumps(payload)}) + headers = {'Content-Type': 'application/json'} + #response = requests.post(webhook_url, data={"payload": json.dumps(payload)}) + response = requests.post(webhook_url, data=json.dumps(payload), headers=headers) + if response.status_code != 200: print("Error sending Slack message: ", response.text) @@ -56,26 +59,28 @@ def switch_to_first_tab(driver): # Function to remove advertisement from sample pages -def remove_ad(driver): - element = driver.find_element(By.XPATH, "/html/body/div[3]/div") - driver.execute_script("arguments[0].style.display = 'none';", element) +#def remove_ad(driver): +# element = driver.find_element(By.XPATH, "/html/body/div[3]") +# driver.execute_script("arguments[0].style.display = 'none';", element) +# element1 = driver.find_element(By.XPATH, "/html/body/div[6]/div") +# driver.execute_script("arguments[0].style.display = 'none';", element1) # Function to switch to new window and close the advertisement block def switch_window_and_frame(driver): driver.switch_to.window(driver.window_handles[1]) - time.sleep(10) - remove_ad(driver) - time.sleep(2) + time.sleep(15) driver.switch_to.frame(0) time.sleep(3) webhook_url = os.environ['WEBHOOK_URL'] icon_emoji = ":x:" +user_id = 'U01UMD36SQ0' options = Options() options.add_argument('--headless') +options.add_argument("--window-size=1920,1080"); options.add_argument("--use-fake-ui-for-media-stream") options.add_argument("--use-fake-device-for-media-stream") driver = webdriver.Chrome(options=options) @@ -89,8 +94,8 @@ def switch_window_and_frame(driver): driver.execute_script("window.open('https://antmedia.io/webrtc-samples/webrtc-virtual-background/', '_blank');") driver.switch_to.window(driver.window_handles[1]) time.sleep(20) - remove_ad(driver) - time.sleep(2) + #remove_ad(driver) + #time.sleep(2) driver.switch_to.frame(0) time.sleep(3) driver.find_element(By.XPATH, "/html/body/div/div/div[4]/div[3]/img").click() @@ -105,7 +110,7 @@ def switch_window_and_frame(driver): except: if i==1: message = "Virtual background test is failed, check -> https://antmedia.io/webrtc-samples/webrtc-virtual-background/" - send_slack_message(webhook_url, message, icon_emoji) + send_slack_message(webhook_url, message, user_id, icon_emoji) continue switch_to_first_tab(driver) @@ -115,17 +120,18 @@ def switch_window_and_frame(driver): driver.execute_script("window.open('https://antmedia.io/live-demo/', '_blank');") driver.switch_to.window(driver.window_handles[1]) time.sleep(20) - remove_ad(driver) - time.sleep(2) - driver.find_element(By.XPATH, "/html/body/div[5]/div/article[2]/div[2]/div[1]/div[1]/div/div/p/button[1]").click() + #remove_ad(driver) + #time.sleep(2) + driver.find_element(By.XPATH, "/html/body/div[1]/div/article[2]/div[2]/div[1]/div[1]/div/div/p/button[1]").click() time.sleep(15) - driver.find_element(By.XPATH, "/html/body/div[5]/div/article[2]/div[2]/div[1]/div[1]/div/div/p/button[2]").click() + driver.find_element(By.XPATH, "/html/body/div[1]/div/article[2]/div[2]/div[1]/div[1]/div/div/p/button[2]").click() time.sleep(3) print("Live demo is successful") except: message = "Livedemo test is failed, check -> https://antmedia.io/live-demo/" - send_slack_message(webhook_url, message, icon_emoji) + send_slack_message(webhook_url, message, user_id, icon_emoji) + switch_to_first_tab(driver) @@ -136,14 +142,14 @@ def switch_window_and_frame(driver): driver.find_element(By.XPATH, "/html/body/div/div/div[8]/button[1]").click() time.sleep(10) driver.find_element(By.XPATH, "/html/body/div/div/div[7]/div[1]/a").click() - time.sleep(5) + time.sleep(10) driver.find_element(By.XPATH, "/html/body/div/div/div[8]/button[2]").click() time.sleep(3) print("WebRTC to WebRTC is successful") except: message = "WebRTC to WebRTC test is failed, check -> https://antmedia.io/webrtc-samples/webrtc-publish-webrtc-play/" - send_slack_message(webhook_url, message, icon_emoji) + send_slack_message(webhook_url, message, user_id, icon_emoji) driver.close() driver.switch_to.window(driver.window_handles[1]) @@ -156,14 +162,14 @@ def switch_window_and_frame(driver): driver.find_element(By.XPATH, "/html/body/div/div/div[8]/button[1]").click() time.sleep(10) driver.find_element(By.XPATH, "/html/body/div/div/div[7]/div[1]/a").click() - time.sleep(5) + time.sleep(10) driver.find_element(By.XPATH, "/html/body/div/div/div[8]/button[2]").click() time.sleep(5) print("WebRTC to HLS is successful") except: message = "WebRTC to HLS test is failed, check -> https://antmedia.io/webrtc-samples/webrtc-publish-hls-play/" - send_slack_message(webhook_url, message, icon_emoji) + send_slack_message(webhook_url, message, user_id, icon_emoji) driver.close() driver.switch_to.window(driver.window_handles[1]) @@ -188,7 +194,7 @@ def switch_window_and_frame(driver): except: message = "WebRTC audio publish test is failed, check -> https://antmedia.io/webrtc-samples/webrtc-audio-publish-play/" - send_slack_message(webhook_url, message, icon_emoji) + send_slack_message(webhook_url, message, user_id, icon_emoji) driver.close() driver.switch_to.window(driver.window_handles[1]) @@ -205,7 +211,7 @@ def switch_window_and_frame(driver): except: message = "RTMP to WebRTC test is failed, check -> https://antmedia.io/webrtc-samples/rtmp-publish-wertc-play/" - send_slack_message(webhook_url, message, icon_emoji) + send_slack_message(webhook_url, message, user_id, icon_emoji) switch_to_first_tab(driver) @@ -220,7 +226,7 @@ def switch_window_and_frame(driver): except: message = "RTMP to HLS test is failed, check -> https://antmedia.io/webrtc-samples/rtmp-publish-hls-play/" - send_slack_message(webhook_url, message, icon_emoji) + send_slack_message(webhook_url, message, user_id, icon_emoji) switch_to_first_tab(driver) @@ -238,7 +244,7 @@ def switch_window_and_frame(driver): except: message = "SRT to WebRTC test is failed, check -> https://antmedia.io/webrtc-samples/srt-publish-webrtc-play/" - send_slack_message(webhook_url, message, icon_emoji) + send_slack_message(webhook_url, message, user_id, icon_emoji) switch_to_first_tab(driver) @@ -256,7 +262,7 @@ def switch_window_and_frame(driver): except: message = "SRT to HLS test is failed, check -> https://antmedia.io/webrtc-samples/srt-publish-hls-play/" - send_slack_message(webhook_url, message, icon_emoji) + send_slack_message(webhook_url, message, user_id, icon_emoji) switch_to_first_tab(driver) @@ -265,41 +271,59 @@ def switch_window_and_frame(driver): driver.execute_script("window.open('https://antmedia.io/webrtc-samples/deepar-publish-play/', '_blank');") switch_window_and_frame(driver) driver.find_element(By.XPATH, "/html/body/div/div/select").click() - time.sleep(1) - driver.find_element(By.XPATH, "/html/body/div[1]/div/select/option[6]").click() - time.sleep(1) - driver.find_element(By.XPATH, "/html/body/div[1]/div/div[5]/button[1]").click() + time.sleep(2) + driver.find_element(By.XPATH, "/html/body/div[1]/div/select/option[3]").click() + time.sleep(2) + driver.find_element(By.XPATH, "/html/body/div/div/div[5]/button[1]").click() time.sleep(10) - driver.find_element(By.XPATH, "/html/body/div[1]/div/div[5]/button[2]").click() + driver.find_element(By.XPATH, "/html/body/div/div/div[5]/button[2]").click() print("WebRTC Deep AR test is successful") except: message = "WebRTC DeepAR sample test is failed, check -> https://antmedia.io/webrtc-samples/deepar-publish-play/" - send_slack_message(webhook_url, message, icon_emoji) + send_slack_message(webhook_url, message, user_id, icon_emoji) switch_to_first_tab(driver) # Testing Whiteboard sample page try: driver.execute_script("window.open('https://antmedia.io/webrtc-samples/interactive-whiteboard-publish-play/', '_blank');") - switch_window_and_frame(driver) - driver.switch_to.frame("webrtc-publish-frame") - time.sleep(1) - driver.find_element(By.XPATH, "/html/body/div[2]/div/div/div/div[2]/div[6]/button[1]").click() + driver.switch_to.window(driver.window_handles[1]) time.sleep(5) driver.switch_to.frame(0) + time.sleep(2) + driver.find_element(By.XPATH, "/html/body/div[2]/div/div/div/div[2]/div[6]/button[1]").click() + time.sleep(2) + iframe_element = driver.find_element(By.XPATH, "/html/body/div[2]/div/div/div/div[1]/iframe") + driver.switch_to.frame(iframe_element) driver.find_element(By.XPATH, "/html/body/section[2]/canvas[4]").click() time.sleep(2) driver.switch_to.default_content() - driver.switch_to.frame(0) - driver.switch_to.frame("webrtc-play-frame") - driver.find_element(By.XPATH, "/html/body/div[2]/div/div/div/div[3]/div[4]/button[1]").click() + iframe_element1 = driver.find_element(By.XPATH, "/html/body/div/div[2]/div/div/article/div/div/div/div/div/section/div/div/div/div/div/div/div/div/div[2]/iframe") + driver.switch_to.frame(iframe_element1) + driver.find_element(By.XPATH, "/html/body/div[2]/div/div/div/div[2]/div[5]/button[1]").click() time.sleep(10) print("WebRTC white board test is successful") except: message = "WebRTC whiteboard test is failed, check -> https://antmedia.io/webrtc-samples/interactive-whiteboard-publish-play/" - send_slack_message(webhook_url, message, icon_emoji) + send_slack_message(webhook_url, message, user_id, icon_emoji) + +switch_to_first_tab(driver) + +# Testing Conference sample page +try: + driver.execute_script("window.open('https://antmedia.io/webrtc-samples/multitrack-conference-solution/', '_blank');") + switch_window_and_frame(driver) + driver.find_element(By.XPATH, "/html/body/div/div[2]/div[3]/div/div[2]/button[1]").click() + time.sleep(10) + driver.find_element(By.XPATH, "/html/body/div/div[2]/div[3]/div/div[2]/button[2]").click() + time.sleep(3) + print("WebRTC Conference test is successful") + +except: + message = "WebRTC Conference sample test is failed, check -> https://antmedia.io/webrtc-samples/multitrack-conference-solution/" + send_slack_message(webhook_url, message, user_id, icon_emoji) switch_to_first_tab(driver) @@ -319,6 +343,6 @@ def switch_window_and_frame(driver): except: message = "WebRTC data channel test is failed, check -> https://antmedia.io/webrtc-samples/webrtc-data-channel-only/" - send_slack_message(webhook_url, message, icon_emoji) + send_slack_message(webhook_url, message, user_id, icon_emoji) driver.quit() diff --git a/gcp-jinja-template/antmedia-firewall-template.jinja b/gcp-jinja-template/antmedia-firewall-template.jinja new file mode 100644 index 00000000..e33e9ec1 --- /dev/null +++ b/gcp-jinja-template/antmedia-firewall-template.jinja @@ -0,0 +1,45 @@ +{# +Copyright 2016 Google Inc. All rights reserved. +Licensed 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. +#} + +resources: +- type: compute.v1.firewall + name: ams-mongodb-internal + properties: + network: $(ref.antmedia-vpc-network.selfLink) + sourceRanges: + - 10.0.0.0/16 + targetTags: + - antmedia-mongodb + allowed: + - IPProtocol: tcp + ports: + - "27017" + - "22" + +- type: compute.v1.firewall + name: ams-antmedia-external + properties: + network: $(ref.antmedia-vpc-network.selfLink) + sourceRanges: + - 0.0.0.0/0 + targetTags: + - antmedia + allowed: + - IPProtocol: tcp + ports: + - "5080" + - "22" + - "1935" + diff --git a/gcp-jinja-template/antmedia-instance-group-template.jinja b/gcp-jinja-template/antmedia-instance-group-template.jinja new file mode 100644 index 00000000..bce7bc96 --- /dev/null +++ b/gcp-jinja-template/antmedia-instance-group-template.jinja @@ -0,0 +1,52 @@ +resources: +- name: origin-instance-group + type: compute.v1.instanceGroupManager + properties: + zone: {{ properties["zone"] }} + targetSize: 1 + baseInstanceName: antmedia-origin + instanceTemplate: projects/{{ env["project"] }}/global/instanceTemplates/ams-origin-template + namedPorts: + - name: http + port: 5080 + metadata: + dependsOn: + - ams-origin-template + +- name: origin-autoscaler + type: compute.v1.autoscaler + properties: + zone: {{ properties["zone"] }} + target: $(ref.origin-instance-group.selfLink) + autoscalingPolicy: + minNumReplicas: 1 + maxNumReplicas: 10 + coolDownPeriodSec: 60 + cpuUtilization: + utilizationTarget: 0.6 + +- name: edge-instance-group + type: compute.v1.instanceGroupManager + properties: + zone: {{ properties["zone"] }} + targetSize: 1 + baseInstanceName: antmedia-edge + instanceTemplate: projects/{{ env["project"] }}/global/instanceTemplates/ams-edge-template + namedPorts: + - name: http + port: 5080 + metadata: + dependsOn: + - ams-edge-template + +- name: edge-autoscaler + type: compute.v1.autoscaler + properties: + zone: {{ properties["zone"] }} + target: $(ref.edge-instance-group.selfLink) + autoscalingPolicy: + minNumReplicas: 1 + maxNumReplicas: 10 + coolDownPeriodSec: 60 + cpuUtilization: + utilizationTarget: 0.6 diff --git a/gcp-jinja-template/antmedia-instance-template.jinja b/gcp-jinja-template/antmedia-instance-template.jinja new file mode 100644 index 00000000..90495a5e --- /dev/null +++ b/gcp-jinja-template/antmedia-instance-template.jinja @@ -0,0 +1,65 @@ +resources: +- name: ams-origin-template + type: compute.v1.instanceTemplate + properties: + properties: + zone: {{ properties["zone"] }} + machineType: {{ properties["origin_machine_type"] }} + metadata: + items: + - key: startup-script + value: |- + #!/bin/bash + rm -rf /usr/local/antmedia/conf/instanceId + rm -rf /usr/local/antmedia/*.db.* + rm -rf /usr/local/antmedia/*.db + cd /usr/local/antmedia + ./change_server_mode.sh cluster $(ref.{{ env["deployment"] }}-mongodb.networkInterfaces[0].networkIP) + disks: + - deviceName: boot + type: PERSISTENT + boot: true + autoDelete: true + initializeParams: + sourceImage: projects/{{ env["project"] }}/global/images/{{ properties["image_id"] }} + networkInterfaces: + - network: $(ref.antmedia-vpc-network.selfLink) + subnetwork: $(ref.origin-subnet.selfLink) + accessConfigs: + - name: External NAT + type: ONE_TO_ONE_NAT + tags: + items: + - antmedia +- name: ams-edge-template + type: compute.v1.instanceTemplate + properties: + properties: + zone: {{ properties["zone"] }} + machineType: {{ properties["edge_machine_type"] }} + metadata: + items: + - key: startup-script + value: |- + #!/bin/bash + rm -rf /usr/local/antmedia/conf/instanceId + rm -rf /usr/local/antmedia/*.db.* + rm -rf /usr/local/antmedia/*.db + cd /usr/local/antmedia + ./change_server_mode.sh cluster $(ref.{{ env["deployment"] }}-mongodb.networkInterfaces[0].networkIP) + disks: + - deviceName: boot + type: PERSISTENT + boot: true + autoDelete: true + initializeParams: + sourceImage: projects/{{ env["project"] }}/global/images/{{ properties["image_id"] }} + networkInterfaces: + - network: $(ref.antmedia-vpc-network.selfLink) + subnetwork: $(ref.edge-subnet.selfLink) + accessConfigs: + - name: External NAT + type: ONE_TO_ONE_NAT + tags: + items: + - antmedia diff --git a/gcp-jinja-template/antmedia-loadbalancer-template.jinja b/gcp-jinja-template/antmedia-loadbalancer-template.jinja new file mode 100644 index 00000000..ad3e801f --- /dev/null +++ b/gcp-jinja-template/antmedia-loadbalancer-template.jinja @@ -0,0 +1,74 @@ +{% set scenarios = ['origin', 'edge'] %} + + +resources: +{% for scenario in scenarios %} +- name: ams-load-balancer-{{ scenario }} + type: compute.v1.globalForwardingRule + properties: + region: {{ properties["region"] }} + loadBalancingScheme: EXTERNAL + target: $(ref.ams-target-proxy-{{ scenario }}.selfLink) + IPAddress: $(ref.lb-ipaddress-{{ scenario }}.address) + IPProtocol: TCP + portRange: 443-443 + +- name: ams-target-proxy-{{ scenario }} + type: compute.v1.targetHttpsProxy + properties: + urlMap: $(ref.ams-{{ scenario }}.selfLink) + sslCertificates: + - $(ref.ams-ssl-cert-{{ scenario }}.selfLink) + +- name: lb-ipaddress-{{ scenario }} + type: compute.v1.globalAddress + +- name: ams-{{ scenario }} + type: compute.v1.urlMap + properties: + defaultService: $(ref.ams-backend-{{ scenario }}.selfLink) + +- name: ams-ssl-cert-{{ scenario }} + type: compute.v1.sslCertificate + properties: + certificate: | + -----BEGIN CERTIFICATE----- + + -----END CERTIFICATE----- + privateKey: | + -----BEGIN PRIVATE KEY----- + + -----END PRIVATE KEY----- + + +- name: ams-backend-{{ scenario }} + type: compute.v1.backendService + properties: + port: 5080 + portName: http + protocol: HTTP + backends: + - name: backend + balancingMode: UTILIZATION + capacityScaler: 1.0 + group: projects/{{ env["project"] }}/zones/{{ properties["zone"] }}/instanceGroups/{{ scenario }}-instance-group + + maxUtilization: 0.8 + connectionDraining: + drainingTimeoutSec: 300 + healthChecks: + - $(ref.ams-health-check-{{ scenario }}.selfLink) + metadata: + dependsOn: + - {{ scenario }}-instance-group + - ams-health-check-{{ scenario }} + +- name: ams-health-check-{{ scenario }} + type: compute.v1.healthCheck + properties: + type: HTTP + httpHealthCheck: + port: 5080 + requestPath: / + +{% endfor %} diff --git a/gcp-jinja-template/antmedia-mongodb-template.jinja b/gcp-jinja-template/antmedia-mongodb-template.jinja new file mode 100644 index 00000000..2f43a0a2 --- /dev/null +++ b/gcp-jinja-template/antmedia-mongodb-template.jinja @@ -0,0 +1,47 @@ +{# +Copyright 2016 Google Inc. All rights reserved. +Licensed 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. +#} + +resources: +- type: compute.v1.instance + name: {{ env["deployment"] }}-mongodb + properties: + zone: {{ properties["zone"] }} + machineType: https://www.googleapis.com/compute/v1/projects/{{ env["project"] }}/zones/{{ properties["zone"] }}/machineTypes/{{ properties["machine_type"] }} + metadata: + items: + # For more ways to use startup scripts on an instance, see: + # https://cloud.google.com/compute/docs/startupscript + - key: startup-script + value: | + #!/bin/bash + wget https://raw.githubusercontent.com/ant-media/Scripts/master/install_mongodb.sh + bash ./install_mongodb.sh + disks: + - deviceName: boot + type: PERSISTENT + boot: true + autoDelete: true + initializeParams: + sourceImage: https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/family/ubuntu-2204-lts + networkInterfaces: + - network: $(ref.antmedia-vpc-network.selfLink) + subnetwork: $(ref.origin-subnet.selfLink) + # Access Config required to give the instance a public IP address + accessConfigs: + - name: External NAT + type: ONE_TO_ONE_NAT + tags: + items: + - antmedia-mongodb diff --git a/gcp-jinja-template/antmedia-vpc-template.jinja b/gcp-jinja-template/antmedia-vpc-template.jinja new file mode 100644 index 00000000..2e365253 --- /dev/null +++ b/gcp-jinja-template/antmedia-vpc-template.jinja @@ -0,0 +1,33 @@ +resources: +- name: antmedia-vpc-network + type: compute.v1.network + properties: + region: {{ properties["region"] }} + autoCreateSubnetworks: false + +- name: origin-subnet + type: compute.v1.subnetwork + properties: + ipCidrRange: 10.0.1.0/24 + network: $(ref.antmedia-vpc-network.selfLink) + region: {{ properties["region"] }} + +- name: edge-subnet + type: compute.v1.subnetwork + properties: + ipCidrRange: 10.0.2.0/24 + network: $(ref.antmedia-vpc-network.selfLink) + region: {{ properties["region"] }} + +- name: firewall-rule + type: compute.v1.firewall + properties: + network: $(ref.antmedia-vpc-network.selfLink) + sourceRanges: + - 0.0.0.0/0 + allowed: + - IPProtocol: tcp + ports: + - "80" + - "443" + - "22" diff --git a/gcp-jinja-template/antmedia.jinja b/gcp-jinja-template/antmedia.jinja new file mode 100644 index 00000000..8af57d07 --- /dev/null +++ b/gcp-jinja-template/antmedia.jinja @@ -0,0 +1,58 @@ +{# +Copyright 2016 Google Inc. All rights reserved. +Licensed 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. +#} + +{% set default_zone = "us-central1-a" %} +{% set default_region = "us-central1" %} +{% set mongodb_machine_type = "e2-standard-2" %} +{% set origin_machine_type = "c2d-standard-4" %} +{% set edge_machine_type = "c2d-standard-4" %} +{% set image_id = "ams-latest" %} + + + +resources: +- name: antmedia-mongodb + type: antmedia-mongodb-template.jinja + properties: + zone: {{ default_zone }} + machine_type: {{ mongodb_machine_type }} +- name: antmedia-instance + type: antmedia-instance-template.jinja + properties: + zone: {{ default_zone }} + origin_machine_type: {{ origin_machine_type }} + edge_machine_type: {{ edge_machine_type }} + image_id: {{ image_id }} + +- name: antmedia-instance-group + type: antmedia-instance-group-template.jinja + properties: + zone: {{ default_zone }} +- name: antmedia-loadbalancer + type: antmedia-loadbalancer-template.jinja + properties: + zone: {{ default_zone }} + region: {{ default_region}} +- name: antmedia-firewall + type: antmedia-firewall-template.jinja + properties: + zone: {{ default_zone}} +- name: antmedia-vpc-network + type: antmedia-vpc-template.jinja + properties: + region: {{ default_region}} + autoCreateSubnetworks: false + + \ No newline at end of file diff --git a/gcp-jinja-template/antmedia.yaml b/gcp-jinja-template/antmedia.yaml new file mode 100644 index 00000000..f1baae8c --- /dev/null +++ b/gcp-jinja-template/antmedia.yaml @@ -0,0 +1,26 @@ +# Copyright 2016 Google Inc. All rights reserved. +# +# Licensed 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. + +imports: +- path: antmedia-vpc-template.jinja +- path: antmedia-mongodb-template.jinja +- path: antmedia-instance-template.jinja +- path: antmedia-instance-group-template.jinja +- path: antmedia-firewall-template.jinja +- path: antmedia-loadbalancer-template.jinja +- path: antmedia.jinja + +resources: +- name: antmedia + type: antmedia.jinja diff --git a/gcp-jinja-template/backend.jinja b/gcp-jinja-template/backend.jinja new file mode 100644 index 00000000..3f018c9c --- /dev/null +++ b/gcp-jinja-template/backend.jinja @@ -0,0 +1,16 @@ +--- +# Your resource definitions go here under resources key +resources: + - name: my-backend-service # Replace with your desired name + type: compute.v1.backendService # Adjust type based on resource + properties: + portName: http + protocol: HTTP + backend: + group: origin-instance-group # Assuming your instance group name + healthChecks: + - https://www.googleapis.com/compute/v1/healthChecks/default + +# You can add other outputs here if needed +output: + # ...