Waypoint のGetting Started を試してみた
Waypoint
- 2020/10/15 にHashiConf で発表された新製品
Waypoint のGetting Started を試す
- 以下のページの動作確認を実施
動作確認した環境について
- macOS Catalina 10.15.7
- メモリ: 8GB
- VirtualBox バージョン 6.1.14 r140239
- CentOS 8.2.2004
- VirtualBox 上にCentOS 8 を立ち上げて、waypoint を構築
waypoint のインストール
CentOS 8 上に構築していきます。
- waypoint バイナリをインストールします
$ sudo yum install -y yum-utils $ sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo $ sudo yum -y install waypoint
- はじめにwaypoint Dockerコンテナをpull します
$ sudo docker pull hashicorp/waypoint:latest latest: Pulling from hashicorp/waypoint df20fa9351a1: Pull complete 464c4c2e60be: Pull complete 802d9b65569c: Pull complete Digest: sha256:689cae07ac8836ceba1f49c0c36ef57b27ebf61d36009bc309d2198e7825beb9 Status: Downloaded newer image for hashicorp/waypoint:latest docker.io/hashicorp/waypoint:latest
- waypoint サーバを立ち上げます
$ sudo waypoint install --platform=docker -accept-tos ✓ Server container started Waypoint server successfully installed and configured! The CLI has been configured to connect to the server automatically. This connection information is saved in the CLI context named "install-1602898408". Use the "waypoint context" CLI to manage CLI contexts. The server has been configured to advertise the following address for entrypoint communications. This must be a reachable address for all your deployments. If this is incorrect, manually set it using the CLI command "waypoint server config-set". Advertise Address: waypoint-server:9701 HTTP UI Address: https://localhost:9702
- UI Address をブラウザで開くと、Waypoint の管理画面が表示されます
- 本検証環境では、VirtualBox のホストマシンからアクセスしたため、VMのアドレスを指定して確認しています
https://192.168.56.110:9702
- ログイン時のToken は以下で取得します
- 本検証環境では、VirtualBox のホストマシンからアクセスしたため、VMのアドレスを指定して確認しています
$ sudo waypoint token new
サンプルアプリケーションのビルド、デプロイ、リリースの実施
- サンプルアプリケーションのダウンロード
$ git clone https://github.com/hashicorp/waypoint-examples.git
- waypoint を実行するディレクトリへ移動
waypoint.hcl
が必要です
$ cd waypoint-examples/docker/nodejs $ ls Procfile README.md data.db index.js package.json public views waypoint.hcl
- waypoint を使ってビルド、デプロイ、リリースの実施
$ sudo waypoint up » Building... Creating new buildpack-based image using builder: heroku/buildpacks:18 ✓ Creating pack client ✓ Building image ✓ Injecting entrypoint binary to image » Deploying... ✓ Setting up waypoint network ✓ Starting container ⠧ App deployed as container: example-nodejs-01EMT3TBE2G1CRMCDCYQ5KRG50 » Releasing... The deploy was successful! A Waypoint deployment URL is shown below. This can be used internally to check your deployment and is not meant for external traffic. You can manage this hostname using "waypoint hostname." URL: https://secretly-amazing-marmot.waypoint.run Deployment URL: https://secretly-amazing-marmot--v1.waypoint.run
アプリケーションの動作確認
アプリケーションのアップデート
docker/nodejs/views/pages/index.ejs
の18行目を適宜変更- 例
- 変更前:
<h1>This Node.js app was deployed with Waypoint.</h1>
- 変更後:
<h1>This Node.js app was deployed with Waypoint. Testing updated. </h1>
- 変更前:
- 例
$ sudo waypoint up » Building... Creating new buildpack-based image using builder: heroku/buildpacks:18 ✓ Creating pack client ✓ Building image ✓ Injecting entrypoint binary to image Generated new Docker image: example-nodejs:latest » Deploying... ✓ Setting up waypoint network ✓ Starting container ⠏ App deployed as container: example-nodejs-01EMT4GPYEWSV43VNTMC8QXAVY » Releasing... The deploy was successful! A Waypoint deployment URL is shown below. This can be used internally to check your deployment and is not meant for external traffic. You can manage this hostname using "waypoint hostname." URL: https://secretly-amazing-marmot.waypoint.run Deployment URL: https://secretly-amazing-marmot--v2.waypoint.run
- 再度、アプリケーションのWebページを確認
- 以下のURL で開く
- https://secretly-amazing-marmot.waypoint.run
-
Testing updated
が追加されている
デプロイ後のWaypoint UI での確認
アプリケーションの削除
- 削除前の確認
$ sudo docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 18532d017dda example-nodejs:latest "/waypoint-entrypoin…" 6 minutes ago Up 6 minutes 0.0.0.0:32769->3000/tcp example-nodejs-01EMT4GPYEWSV43VNTMC8QXAVY d4903838094a 4a1737d832be "/waypoint-entrypoin…" 19 minutes ago Up 19 minutes 0.0.0.0:32768->3000/tcp example-nodejs-01EMT3TBE2G1CRMCDCYQ5KRG50 8a788375f6de hashicorp/waypoint:latest "/usr/bin/waypoint s…" 32 minutes ago Up 32 minutes 0.0.0.0:9701-9702->9701-9702/tcp waypoint-server
- アプリケーションの削除
$ sudo waypoint destroy » Destroying releases... » Destroying deployments... Destroy successful!
- 削除後の確認
$ sudo docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 8a788375f6de hashicorp/waypoint:latest "/usr/bin/waypoint s…" 33 minutes ago Up 33 minutes 0.0.0.0:9701-9702->9701-9702/tcp waypoint-server
備考
- 2019年の Mitchell Hashimoto in Tokyo! HashiCorp Meetup で新しい製品を開発中、とMitchell が話されていた。それがこの
waypoint
だったのだろうか - まだ、このツールを深く見れていないが、アプリケーション開発者に対して様々な構築・運用する手間を取らせない、と言う方向性は正しいと思う
- Waypointとは何か