Last active
June 22, 2022 08:55
-
-
Save AlPervakov/9341674a2b904177266a9bcc592799a5 to your computer and use it in GitHub Desktop.
yc config files
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 os | |
import time | |
import psutil | |
from flask import Flask | |
app = Flask(__name__) | |
STALE = 12345678910111213 | |
@app.route('/') | |
def hello_world(): | |
t_end = time.time() + 2 | |
while time.time() < t_end: | |
STALE*STALE | |
return "Request finished. CPU load at the end of request: %s \n" % psutil.cpu_percent() | |
@app.route('/health') | |
def healthcheck(): | |
return "OK" |
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
#!/bin/bash | |
apt update | |
apt install -fy python-pip build-essential python-dev | |
pip install flask psutil | |
wget https://gist.githubusercontent.com/AlPervakov/9341674a2b904177266a9bcc592799a5/raw/38bed527b1aad744126633afcbf2de54e3349fbf/app.py -O app.py | |
FLASK_APP=app.py flask run --host=0.0.0.0 --port=80 |
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
#cloud-config | |
disable_root: true | |
timezone: Europe/Moscow | |
repo_update: true | |
repo_upgrade: true | |
apt: | |
preserve_sources_list: true | |
users: | |
- default | |
- name: ubuntu | |
sudo: ALL=(ALL) NOPASSWD:ALL | |
shell: /bin/bash | |
ssh-authorized-keys: | |
- "ssh-rsa <ssh-key>" | |
packages: | |
- nginx | |
runcmd: | |
- [ systemctl, nginx-reload ] | |
- [ systemctl, enable, nginx.service ] | |
- [ systemctl, start, --no-block, nginx.service ] |
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: test-group | |
service_account_id: <id> | |
description: "This instance group was created from YAML config" | |
instance_template: | |
description: "My instance template" | |
platform_id: standard-v1 | |
resources_spec: | |
memory: 2g | |
cores: 1 | |
boot_disk_spec: | |
mode: READ_WRITE | |
disk_spec: | |
type_id: network-hdd | |
size: 10g | |
image_id: fd83bj827tp2slnpp7f0 | |
network_interface_specs: | |
- network_id: enpcp9vv401rtaf668do | |
subnet_ids: | |
- e9be7u6fv4hqfmauv8rk | |
primary_v4_address_spec: | |
one_to_one_nat_spec: | |
ip_version: IPV4 | |
metadata: | |
user-data: |- | |
#cloud-config | |
runcmd: | |
- wget https://gist.githubusercontent.com/AlPervakov/9341674a2b904177266a9bcc592799a5/raw/bd25f596e0b5552083bb824af3cb31b4c127037a/bootstrap.sh | |
- bash bootstrap.sh | |
scale_policy: | |
auto_scale: | |
min_zone_size: 1 | |
max_size: 6 | |
measurement_duration: 60s | |
warmup_duration: 20s | |
stabilization_duration: 100s | |
initial_size: 1 | |
cpu_utilization_rule: | |
utilization_target: 80 | |
deploy_policy: | |
max_unavailable: 2 | |
max_expansion: 2 | |
max_deleting: 1 | |
max_creating: 1 | |
startup_duration: 0s | |
allocation_policy: | |
zones: | |
- zone_id: ru-central1-a | |
load_balancer_spec: | |
target_group_spec: | |
name: my-target-group | |
description: "example target group" | |
health_checks_spec: | |
health_check_specs: | |
- interval: 2s | |
timeout: 1s | |
unhealthy_threshold: 2 | |
healthy_threshold: 2 | |
http_options: | |
port: 80 | |
path: /health |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment