Skip to content

Instantly share code, notes, and snippets.

@kazeburo
Last active March 7, 2022 08:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kazeburo/e2d54dde415a10f3c06daf603c6e1472 to your computer and use it in GitHub Desktop.
Save kazeburo/e2d54dde415a10f3c06daf603c6e1472 to your computer and use it in GitHub Desktop.
autoscaler v0.5.0 configurations for https://kazeburo.hatenablog.com/entry/2021/09/27/102524
resources:
- type: ServerGroup
name: "hscale-group"
zone: "tk1b"
parent:
type: ELB
name: "hscale-elb"
selector:
names: ["tk-elb"]
min_size: 2
max_size: 5
shutdown_force: false
plans:
- name: smallest
size: 2
- name: medium
size: 3
- name: largest
size: 5
template:
# tags: [ "tag1", "tag2" ]
description: "hscale-group"
interface_driver: "virtio"
plan:
core: 1
memory: 1
dedicated_cpu: false
network_interfaces:
- upstream: "shared" # 共有セグメント
expose:
ports: [80]
server_group_name: "gr1"
disks:
- os_type: "almalinux"
plan: "ssd"
connection: "virtio"
size: 20
edit_parameter:
disabled: false
password: ""
disable_pw_auth: true
enable_dhcp: false
change_partition_uuid: true
ssh_keys:
- "ssh-ed25519 **********"
startup_scripts:
- |
#!/bin/bash
sudo yum install -y nginx
sudo systemctl enable nginx
echo -e "keepalive_requests 10;\ngzip_proxied any;\ngzip on;\ngzip_http_version 1.0;\ngzip_comp_level 9;\ngzip_types text/html;" > /etc/nginx/conf.d/gzip.conf
curl https://ja.wikipedia.org/wiki/%E4%B8%96%E7%95%8C%E9%81%BA%E7%94%A3 > /usr/share/nginx/html/sekai.html
sudo systemctl start nginx
echo "server name: {{ .Name }}" > /usr/share/nginx/html/index.html
echo "OK" > /usr/share/nginx/html/live
firewall-cmd --permanent --add-service http
firewall-cmd --reload
# オートスケーラーの動作設定
autoscaler:
cooldown: 600 # ジョブの連続実行を抑止するためのクールダウン期間を秒数で指定。デフォルト: 600(10分)
[Unit]
Description=SakuraCloud AutoScaler Core Server
[Service]
User=autoscaler
EnvironmentFile=/etc/autoscaler/core.config
ExecStart=/usr/local/sbin/autoscaler start $OPTIONS
# NginxなどでUNIX domain socketをプロキシしたい場合にコメントを解除する
#ExecStartPost=/bin/bash -c "while [ ! -e /var/run/autoscaler/autoscaler.sock ]; do sleep 1; done; /usr/bin/chmod 0660 /var/run/autoscaler/autoscaler.sock"
Restart=always
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment