├── contents ├── ca.md ├── mesh-gateway.md ├── l7-splitting.md ├── sidecar.md ├── utilities.md ├── l7-routing.md ├── consul-template.md ├── centerized-config.md ├── hello-consul.md ├── intentions.md ├── srd.md ├── cli.md └── observability.md ├── .gitignore ├── .github ├── ISSUE_TEMPLATE │ ├── config.yaml │ └── generic.md ├── renovate.json5 └── workflows │ └── textlint.yaml ├── assets ├── nginx │ ├── bar-container │ │ ├── Dockerfile │ │ └── index.html │ ├── foo-container │ │ ├── Dockerfile │ │ └── index.html │ └── docker-compose.yml └── cluster_setup │ ├── vagrant │ ├── README.md │ └── Vagrantfile │ └── aws │ └── README.md ├── .textlintrc.json └── README.md /contents/ca.md: -------------------------------------------------------------------------------- 1 | ca -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /contents/mesh-gateway.md: -------------------------------------------------------------------------------- 1 | mesh-gateway.md -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yaml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | -------------------------------------------------------------------------------- /assets/nginx/bar-container/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nginx 2 | COPY index.html /usr/share/nginx/html -------------------------------------------------------------------------------- /assets/nginx/foo-container/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nginx 2 | COPY index.html /usr/share/nginx/html -------------------------------------------------------------------------------- /assets/nginx/bar-container/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Hello Consul From Bar Container

4 | 5 | 6 | -------------------------------------------------------------------------------- /assets/nginx/foo-container/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Hello Consul From Foo Container

4 | 5 | 6 | -------------------------------------------------------------------------------- /.textlintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": {}, 3 | "filters": {}, 4 | "rules": { 5 | "ja-space-between-half-and-full-width": { 6 | "space": "always", 7 | "lintStyledNode": true 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /assets/nginx/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3.3" 2 | services: 3 | foo: 4 | build: 5 | context: ./foo-container 6 | dockerfile: Dockerfile 7 | ports: 8 | - 8080:80 9 | 10 | bar: 11 | build: 12 | context: ./bar-container 13 | dockerfile: Dockerfile 14 | ports: 15 | - 9090:80 -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/generic.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Generic Issue Template 3 | about: Describe this issue template's purpose here. 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | ## Issue Overview 11 | Please describe the overview/details of issue you observed. 12 | 13 | 14 | ## (Optional) ToDo 15 | Please fill out the action items if you have already ideas for fixing issue. 16 | - [ ] 17 | - [ ] 18 | -------------------------------------------------------------------------------- /.github/renovate.json5: -------------------------------------------------------------------------------- 1 | // refs: https://docs.renovatebot.com/configuration-options/ 2 | { 3 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 4 | "extends": [ 5 | "config:base", 6 | "schedule:weekly", 7 | "group:allNonMajor", 8 | ":semanticCommits", 9 | ":semanticCommitTypeAll(chore)", 10 | ":disableDependencyDashboard" 11 | ], 12 | "labels": ["deps", "renovate"], 13 | "baseBranches": ["main"], 14 | "rangeStrategy": "bump" 15 | } 16 | -------------------------------------------------------------------------------- /.github/workflows/textlint.yaml: -------------------------------------------------------------------------------- 1 | name: textlint 2 | 3 | on: 4 | pull_request: 5 | paths: 6 | - "contents/**/*.md" 7 | workflow_dispatch: 8 | 9 | permissions: 10 | contents: read 11 | 12 | jobs: 13 | textlint-ja: 14 | runs-on: ubuntu-24.04 15 | steps: 16 | - name: Checkout 17 | uses: actions/checkout@v6 18 | 19 | - name: Setup Node.js 20 | uses: actions/setup-node@v6 21 | 22 | - name: Install textlint rules 23 | run: npm install -D textlint textlint-rule-preset-ja-spacing 24 | 25 | - name: Run textlint 26 | run: | 27 | export PATH="$PATH:$(npm root)/.bin" 28 | textlint README.md ./contents/**/*.md 29 | -------------------------------------------------------------------------------- /assets/cluster_setup/vagrant/README.md: -------------------------------------------------------------------------------- 1 | # Consul cluster の構築 Vagrant 版 2 | 3 | ## 前提条件 4 | 5 | * [Vagrant](https://www.vagrantup.com/downloads.html) 6 | * [Virtualbox](https://www.virtualbox.org/wiki/Downloads) 7 | * [Vagrantfile](Vagrantfile) 8 | 9 | ## Vagrant の実行 10 | 11 | Vagrantfile が置いてあるディレクトリに移動し、以下のコマンドを打ちます。 12 | ```shell 13 | vagrant up 14 | ``` 15 | 16 | もし Vagrant 実行で下記のエラーが発生した場合は、Vagrant の vbguest プラグインが古い可能性があります。以下のコマンドでアップデートしてください。 17 | 18 | ```shell 19 | vagrant plugin update vagrant-vbguest 20 | ``` 21 | 22 | Vagrant が自動的に VM や Consul のバイナリをダウンロードしてクラスタが構築されます。 23 | 24 | この設定では、1台の Consul サーバーと2台の Consul クライアントが構築されます。 25 | 26 | * Server 27 | - IP address: 172.20.20.3 28 | - Hostname: server1 29 | - Vagrant からのログイン方法: 30 | - `vagrant ssh s1` 31 | 32 | * Client1 33 | - IP address: 172.20.20.4 34 | - Hostname: Client1 35 | - Vagrant からのログイン方法: 36 | - `vagrant ssh c1` 37 | 38 | * Client2 39 | - IP address: 172.20.20.5 40 | - Hostname: Client1 41 | - Vagrant からのログイン方法: 42 | - `vagrant ssh c2` 43 | 44 | ## 動作確認 45 | 46 | どれでも好きな VM にログインして、以下のコマンドを打ってください。 47 | 48 | ```shell 49 | consul members 50 | ``` 51 | 52 | このコマンドは現在参加していくクラスタに Join している全てのメンバーを表示します。以下のような出力であれば無事にクラスタが構築されています。 53 | 54 | ```console 55 | vagrant@client2:~$ consul members 56 | Node Address Status Type Build Protocol DC Segment 57 | server1 172.20.20.3:8301 alive server 1.5.3 2 dc1 58 | client1 172.20.20.4:8301 alive client 1.5.3 2 dc1 59 | client2 172.20.20.5:8301 alive client 1.5.3 2 dc1 60 | ``` 61 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HashiCorp Consul Workshop 2 | 3 | [Consul](https://www.consul.io/) は HashiCorp が中心に開発をする OSS の Servcie Discovery や Service Mesh を実現するためのツールです。Service Discovery やヘルスチェックなどの基本的な機能に加えて mTLS, L7 Traffic Management やコンフィグレーション管理など様々な機能を提供しています。Consul はマルチプラットフォームでかつ全ての機能を HTTP API で提供しているため、環境やクライアントを問わず利用することができます。 4 | 5 | 本ワークショップは OSS の機能を中心に様々なユースケースに合わせたハンズオンを用意しています。 6 | 7 | ## Pre-requisite 8 | 9 | * 環境 10 | * macOS or Linux 11 | 12 | * ソフトウェア 13 | * Consul 14 | * Docker / Docker Compose 15 | * Java 12(いつか直します...) 16 | * jq, watch, wget, curl 17 | 18 | ## 資料 19 | 20 | * [Consul Overview](https://docs.google.com/presentation/d/126Y5PgELCuYcR-j4IRQcj7sxczMKT0PgFWS8x9StHXE/edit?usp=sharing) 21 | 22 | ## Consul 概要の学習 23 | こちらのビデオをご覧ください。 24 | 25 | [HashiCorp Consul で始めるマルチクラウドサービスメッシュ](https://www.youtube.com/watch?v=QruAFCchmog) 26 | 27 | ## Agenda 28 | 29 | 1. [初めての Consul](contents/hello-consul.md) 30 | 1. [Service Discovery](contents/srd.md) 31 | 1. Service Mesh 32 | * [Sidecar Proxy の導入](contents/sidecar.md) 33 | * [Intensions](contents/intentions.md) 34 | * [L7 Traffic Management: Routing](contents/l7-routing.md) 35 | * [L7 Traffic Management: Splitting](contents/l7-splitting.md) 36 | * [Centerized Configration](contents/centerized-config.md) 37 | * [Consul Template](contents/consul-template.md) 38 | * [Observability](contents/observability.md) 39 | * Mesh Gateway 40 | * Certification Management 41 | 1. Kubernetes 連携 42 | 1. [運用系機能色々](contents/utilities.md) 43 | 1. [Enterprise 版機能の紹介](https://docs.google.com/presentation/d/1EdCRjc9nCBf9txf4xk__8BOUFYr5WhObsjz4IliAMgg/edit?usp=sharing) 44 | -------------------------------------------------------------------------------- /assets/cluster_setup/vagrant/Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | # Consul installation script 5 | $install_consul = <