Git Product home page Git Product logo

cloud-init-isucon's Introduction

cloud-init-isucon

Overview

cloud-initに対応した環境でISUCONの過去問を構築するためのcloud-config集です。 Apple Silicon(aarch64)にも対応しているため、Multipassなどと組み合わせればM1 Mac上で過去問環境の構築が可能です。

汎用的に作ってるので、cloud-initに対応した環境、例えばAWSAzureGoogle CloudOracle CloudさくらのクラウドMultipassVMwareなど、クラウドからローカルまで幅広く使えるはずです。

cloud-config

サーバ内の構築にはAnsibleを使っています。Ansibleのplaybookのみ必要な場合はmatsuu/ansible-isuconをどうぞ。

Usage

さくらのクラウドでの利用方法

詳細な手順はさくらのナレッジをご確認ください。

AWSでの利用方法

AWSはユーザーデータにcloud-initを渡すことができます。 詳細は公式ドキュメントをご確認ください。

Multipassでの利用方法

  • Multipass実行環境を用意します
    • macOSユーザーはHomebrewを使ってインストール可能です
    brew install multipass
    winget.exe install Multipass
  • このリポジトリ内のcfgファイルを手元に用意します
  • cloud-initを使って起動します
    git clone https://github.com/matsuu/cloud-init-isucon.git
    cd cloud-init-isucon
    
    # isucon10予選の場合
    multipass launch --name isucon10q --cpus 2 --disk 20G --memory 4G --timeout 86400 --cloud-init isucon10q/isucon10q.cfg 20.04
    
    # isucon11予選の場合
    multipass launch --name isucon11q --cpus 2 --disk 20G --memory 4G --timeout 86400 --cloud-init isucon11q/isucon11q.cfg 20.04
    
    # isucon11本選の場合
    multipass launch --name isucon11f --cpus 2 --disk 20G --memory 4G --timeout 86400 --cloud-init isucon11f/isucon11f.cfg 20.04
    
    # isucon12予選の場合
    multipass launch --name isucon12q --cpus 2 --disk 20G --memory 4G --timeout 86400 --cloud-init isucon12q/isucon12q.cfg 22.04
    
    # isucon12本選の場合
    multipass launch --name isucon12f --cpus 2 --disk 20G --memory 4G --timeout 86400 --cloud-init isucon12f/isucon12f.cfg 22.04
    • cpus, disk, memoryは必要に応じて増減させてください
    • 末尾の 20.0422.04 はUbuntuのバージョンです
    • cloud-initは時間がかかるため以下のようなメッセージが表示される場合がありますが、バックグラウンドで構築は継続しています
      launch failed: The following errors occurred:
      timed out waiting for initialization to complete
      
  • 進捗は /var/log/cloud-init-output.log で確認できます
    multipass exec isucon12q -- tail -f /var/log/cloud-init-output.log
  • multipass shell でシェルが使えます
    multipass shell isucon12q
  • 環境の停止再開は stop/start です
    multipass stop isucon12q
    multipass start isucon12q
  • 環境の削除は multipass delete --purge です
    multipass delete --purge isucon12q

FAQ

isuconユーザもしくはあるべきファイルが存在しない

Multipassやさくらのクラウドでの構築の場合、サーバ起動後も環境構築が続いている可能性があります。 /var/log/cloud-init-output.log で進捗を確認してください。

tail -f /var/log/cloud-init-output.log

構築の途中でエラーが発生した

ネットワークの状況やスリープモードなどの影響で構築中にエラーが発生した場合は以下のコマンドで再試行ができます。

sudo /var/lib/cloud/instance/scripts/runcmd

再試行や環境を一から作り直しても解決しない場合はissueで報告してみてください。

Others

License

MIT

cloud-init-isucon's People

Contributors

eichisanden avatar kazeburo avatar matsuu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.