Skip to content

Материалы к вебинару «Отключаем ЦОД, или как тестировать отказоустойчивость в облаке».

License

Notifications You must be signed in to change notification settings

yandex-cloud-examples/yc-webinar-web-application-ha-lt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Failure testing example pipeline

This solution is suitable only for Yandex Cloud

Before begining

Check resource quotas
Resource requirements are based on initial default quotas in an empty, newly created cloud

You will need

Quota Value
Number of cloud networks 2
Number of security groups 7
Number of all public IP addresses 2
Number of static public IP addresses 1
Number of subnets 8
Number of disks 9
Number of vCPUs for instances 25
Total RAM for instances 50 GB
Number of instances 8
Total SSD capacity 170 GB
Total size of non-replicated SSDs 465 GB
Number of instance groups 3

Infrastructure preparation

  1. Delegate a DNS domain to Yandex Cloud. It could be either a 2nd level domain or a 3rd level domain. 2nd level domain should be delegated through a domain registrar. 3rd level domain can be delegated via your DNS hosting. You need to create in your DNS zone (e.g. example.com) two NS records like these:
    playground.example.com.           3600    IN      NS      ns1.yandexcloud.net.
    playground.example.com.           3600    IN      NS      ns2.yandexcloud.net.
    
  2. Install Yandex Cloud CLI and setup access to the cloud via
    yc init
    
  3. Create an empty cloud folder for experiments and get its folder_id.
  4. Create new or use an exiting GitLab instance.
  5. In GitLab create a new empty project and get the project id. It could be found in the "Project overview" section of the Project page.
  6. Create the project access token with Maintainer role and api scope (it grants complete read and write access to the scoped project API).
  7. Install terraform and setup access to your cloud
  8. Clone this repo.
  9. Get into boostrap subdirectory.
  10. Prepare terraform variables e.g. create in boostrap subdirectory terraform.tfvars file with the following content
    folder_id             = "b1gxxxxxxxxxxx"                              # your folder_id here
    dns_domain            = "playground.example.com"                      # your domain here
    dns_hostnames         = ["test1"]                                     # subdomain name here
    gitlab_runner_enabled = true
    gitlab_url            = "https://xxxxxxx.gitlab.yandexcloud.net"      # your GitLab instance URL
    gitlab_project_id     = "0000"                                        # your GitLab project id
    gitlab_username       = "your-username"                               # your GitLab username
    gitlab_access_token   = "glpat-xxxxxxxxxx"                            # your GitLab project access token
    
  11. Prepare environment:
    export YC_TOKEN=$(yc iam create-token)
    
  12. Run
    terraform init
    terraform apply
    
    check the plan and confirm the creation. This step will prepare the initial infrastructure - DNS, Container Registry, gitlab-runner. It will also prepare the repo by adding necessary CI/CD variables and registering gitlab-runner.

Test running

  1. Follow to root directory of the new repo.
  2. Set the remote tracked repository by executing (don't forget to set URL of your repo)
    git remote set-url origin git@xxxxxxx.gitlab.yandexcloud.net:new/repo/location.git
    
  3. Put the code to GitLab
    git add .
    git commit -m "Initial commit"
    git push --set-upstream origin master
    
  4. Go to build section on the GitLab project page and watch the pipeline.
  5. Check the result in the job log and on the ALB monitoring page.
  6. Ensure that the clean job compete successfully. If it doesn't try to run it again

Resources releasing

  1. Be sure that the clean step of the pipeline was done completely
  2. Open the Yandex Cloud web console, go to the Container Registry in testing folder and remove all images from the container registry.
  3. Go to bootstrap directory and run terraform destroy, check the plan and confirm the deletion

About

Материалы к вебинару «Отключаем ЦОД, или как тестировать отказоустойчивость в облаке».

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published