mirror of
https://github.com/boostorg/release-tools.git
synced 2026-01-19 04:42:10 +00:00
102 lines
2.9 KiB
YAML
102 lines
2.9 KiB
YAML
name: Resize Deployment Server
|
|
|
|
# Resize the release-tools deployment server
|
|
# during releases.
|
|
#
|
|
# Boost Releases occur three time per year.
|
|
# Before betas and release, increase the size of the deployment
|
|
# server so publish_release.py will have more CPU.
|
|
#
|
|
# See initial setup instructions at the end of this file.
|
|
#
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
# Runs on Wednesday at 1:00am, on certain months.
|
|
schedule:
|
|
- cron: "0 1 * 3 3"
|
|
- cron: "0 1 * 4 3"
|
|
- cron: "0 1 * 7 3"
|
|
- cron: "0 1 * 8 3"
|
|
- cron: "0 1 * 11 3"
|
|
- cron: "0 1 * 12 3"
|
|
|
|
jobs:
|
|
scale-deploy-server:
|
|
runs-on: ubuntu-latest
|
|
container: amazon/aws-cli:2.32.19
|
|
name: Scale
|
|
env:
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.DEPLOY_AWS_ACCESS_KEY_ID }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.DEPLOY_AWS_SECRET_ACCESS_KEY }}
|
|
if: github.repository == 'boostorg/release-tools'
|
|
steps:
|
|
- name: Debug
|
|
run: |
|
|
set -xe
|
|
pwd
|
|
whoami
|
|
aws --version
|
|
echo "github.event_name is ${{ github.event_name }}"
|
|
|
|
- name: Get number of Wednesday on a Wednesday
|
|
id: number-of-wednesday-on-a-wednesday
|
|
run: >-
|
|
printf >> "$GITHUB_OUTPUT"
|
|
"VALUE=%s"
|
|
"$((($(date +%-d)-1)/7+1))"
|
|
- name: Resize Instance
|
|
if: ${{ ( steps.number-of-wednesday-on-a-wednesday.outputs.VALUE == 2 && github.event_name == 'schedule' ) || ( github.event_name == 'workflow_dispatch' ) }}
|
|
run: |
|
|
aws ssm start-automation-execution --document-name "AWS-ResizeInstance" --document-version "\$DEFAULT" --parameters '{"InstanceId":["${{ secrets.DEPLOY_INSTANCE_ID }}"],"InstanceType":["c8a.xlarge"],"SleepWait":["PT5S"]}' --region ${{ secrets.DEPLOY_REGION }}
|
|
|
|
|
|
# Initial Setup Instructions
|
|
#
|
|
# In AWS, create an instance. Install packages.
|
|
# In AWS IAM, create a user, api keys, assign policies.
|
|
# Assign policies to the user: EC2-Resize and AmazonSSMFullAccess(managed).
|
|
# Create the policy EC2-Resize:
|
|
# {
|
|
# "Version": "2012-10-17",
|
|
# "Statement": [
|
|
# {
|
|
# "Sid": "Stmt1471613026000",
|
|
# "Effect": "Allow",
|
|
# "Action": [
|
|
# "ec2:ModifyInstanceAttribute"
|
|
# ],
|
|
# "Resource": "arn:aws:ec2:_region_:_account_:instance/_instance-id_,
|
|
# "Condition": {
|
|
# "StringEquals": {
|
|
# "ec2:Attribute": "InstanceType"
|
|
# }
|
|
# }
|
|
# },
|
|
# {
|
|
# "Effect": "Allow",
|
|
# "Action": [
|
|
# "ec2:DescribeInstances"
|
|
# ],
|
|
# "Resource": "*"
|
|
# },
|
|
# {
|
|
# "Effect": "Allow",
|
|
# "Action": [
|
|
# "ec2:StartInstances",
|
|
# "ec2:StopInstances"
|
|
# ],
|
|
# "Resource": "arn:aws:ec2:_region_:_account_:instance/_instance-id_,
|
|
# }
|
|
# ]
|
|
# }
|
|
#
|
|
# Fill in _region_, _account_, and _instance-id_.
|
|
#
|
|
# Add github actions secrets:
|
|
#
|
|
# DEPLOY_INSTANCE_ID
|
|
# DEPLOY_REGION
|
|
# DEPLOY_AWS_ACCESS_KEY_ID
|
|
# DEPLOY_AWS_SECRET_ACCESS_KEY
|