WebAssemblyとBlazor 、WebAssembly System Interfaceでコンテナライズの設計を解説
WebAssembly(WASM)とWebAssembly System Interface(WASI)は、コンテナライゼーションのアーキテクチャのひとつです。DockerやWSL(Windows Subsystem for Linux)と同じく、皆さんの業務ロジックにモビリティとスケーラビリティを与えてくれます。モビリティとスケーラビリティを考慮したプログラムを作る一例として、Rust、Nodeなどの技術を交えコンテナライゼーションを解説します。
Rust Teams Toolkit Deploy Teams apps withMicrosoft Graph, and in Azure and M365 Azure Static Web Apps Create and manage Azure Static Web Apps directly Remote Development Remote SSH Remote Containers Remote WSL Docker Containerization tool Language support Thunder Client API Client Extention Visual Studio Code Extensionsの準備 MongoDB for VS Code for working with MongoDB, whether your own instance or in MongoDB Atlas. Microsoft.AspNetCore.R azor.VSCode.BlazorWas mDebuggingExtension
— docker founder: Solomon Hykes “If WASM+WASI existed in 2008, we wouldn't have needed to created Docker. That's how important it is. Webassembly on the server is the future of computing. A standardized system interface was the missing link. Let's hope WASI is up to the task!” “2008年にWASM + WASIが存在していれば、 Dockerを作成する必要はありませんでした。それがど れほど重要かです。サーバー上のWebAssemblyは、 コンピューティングの未来です。” Docker Birthday #3: docker blog tweet of Solomon Hykes
CRÉDITOS: este modelode apresentação foi criado pelo Slidesgo, inclui ícones da Flaticon e infográficos e imagens da Freepik Thank you 今後ともよろしくお願いします。 tetsuro.takao@processtune.com mvp.microsoft.com/en-us/PublicProfile/4029060 blog.processtune.com 73
73.
Link ● slidesgo :本プレゼンテーションのテンプレートWebサイト(本プレゼンテーションのURL) https://slidesgo.com/ (theme/eu-energy-strategy-business-meeting#search-space&position-2&results-73) ● GraalVM https://www.graalvm.org/ ● Install Docker CE on Ubuntu 20.04 https://lindevs.com/install-docker-ce-on-ubuntu/ ● Differences between GitHub Apps and OAuth Apps https://docs.github.com/en/developers/apps/getting-started-with-apps/differences-between-github-apps-and-oauth-apps ● pksunkara/octonode https://github.com/pksunkara/octonode ● Installing gh on Linux and BSD https://github.com/cli/cli/blob/trunk/docs/install_linux.md ● A Possible New Backend for Rust https://jason-williams.co.uk/a-possible-new-backend-for-rust ● EJS https://ejs.co/ ● pug https://pugjs.org/api/getting-started.html ● Handlebars https://jason-williams.co.uk/a-possible-new-backend-for-rust
slidesgo : 本プレゼンテーションのテンプレートWebサイト(本プレゼンテーションのURL) https://slidesgo.com/(theme/eu-energy-strategy-business-meeting#search-space&position-2&results-73) Cloud Native Computing Foundation (CNCF) : https://www.cncf.io/ Introducing gRPC, a new open source HTTP/2 RPC Framework : https://developers.googleblog.com/2015/02/introducing-grpc-new-open-source-http2.html Announcing HTTP/2 support in Azure App Service : https://azure.microsoft.com/ja-jp/blog/announcing-http-2-support-in-azure-app-service/ WHATWG : https://whatwg.org/ The LLVM Compiler Infrastructure : https://llvm.org/ llvm-project : GitHub https://github.com/llvm/llvm-project Configure options for the ASP.NET Core Kestrel web server : https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel/options?view=aspnetcore-5.0#http2-limits WebSocket : https://docs.microsoft.com/ja-jp/windows/uwp/networking/websockets Azure Web PubSub : https://azure.microsoft.com/en-us/services/web-pubsub/ Reference Links 1
76.
Azure SignalR サービスとは: https://docs.microsoft.com/ja-jp/azure/azure-signalr/signalr-overview Cloud Native Apps (monthly resource) : https://github.com/microsoft/monthlyresources/?ocid=AID303759 HTTP/2 in Windows 10: Browser, Apps and Web Server : https://channel9.msdn.com/Events/Build/2015/3-88 Server Events : https://docs.servicestack.net/server-events#server-event-clients Azure Web PubSub Serviceを触ってみた : https://www.slideshare.net/ssuser293809/azure-web-pubsub-service Microservices and the First Law of Distributed Objects : https://martinfowler.com/articles/distributed-objects-microservices.html OASIS Message Queuing Telemetry Transport (MQTT) TC : https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=mqtt Use streaming in ASP.NET Core SignalR : https://docs.microsoft.com/en-us/aspnet/core/signalr/streaming?view=aspnetcore-5.0 Azure Web PubSub : GitHub https://github.com/Azure/azure-webpubsub gRPC services with ASP.NET Core : Visual Studio https://docs.microsoft.com/en-us/aspnet/core/grpc/aspnetcore?view=aspnetcore-5.0&tabs=visual-studio Reference Links 2
77.
High-performance Services withgRPC: What's new in .NET 5 : https://channel9.msdn.com/events/dotnetConf/2020/High-performance-Services-with-gRPC-Whats-new-in-NET- 5?term=gRPC%20HTTP2&pubDate=year&lang-ja=true&lang-en=true gRPC Web with .NET : https://channel9.msdn.com/Shows/On-NET/gRPC-Web-with-NET?term=gRPC%20HTTP2&pubDate=year&lang- en=true&pageSize=15 .NET Core での gRPC のトラブルシューティング : https://docs.microsoft.com/ja-jp/aspnet/core/grpc/troubleshoot?view=aspnetcore-5.0 APACHE KAFKA : https://kafka.apache.org/ Quickstart: Create a serverless simple chat application with Azure Functions and Azure Web PubSub service : https://docs.microsoft.com/en-us/azure/azure-web-pubsub/quickstart-serverless?tabs=javascript NET での gRPC でサポートされているプラットフォーム : https://docs.microsoft.com/ja-jp/aspnet/core/grpc/supported-platforms?view=aspnetcore-5.0 Cloud Endpoints for gRPC : https://cloud.google.com/endpoints/docs/grpc/about- grpc#:~:text=gRPC%20is%20a%20high%20performance,create%20distributed%20applications%20and%20services. Using Docker in WSL 2 : https://code.visualstudio.com/blogs/2020/03/02/docker-in-wsl2 docker docs : https://docs.docker.com/ Reference Links 3
78.
How to Dealwith Lock Holder Preemption : https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.369.9589&rep=rep1&type=pdf Steve Jobs, 1955-2011 : https://www.theverge.com/2011/10/05/steve-jobs-1955-2011-2 Linux Kernel 5.15 Released with New NTFS File System, In-Kernel SMB Server, and More : https://9to5linux.com/linux-kernel-5-15-released-with-new-ntfs-file-system-in-kernel-smb-server-and-more Xerox Corp. v. Apple Computer, Inc., 734 F. Supp. 1542 (N.D. Cal. 1990) : https://law.justia.com/cases/federal/district-courts/FSupp/734/1542/1461830/ Apple Computer Inc. v. Microsoft Corp., 759 F. Supp. 1444 (N.D. Cal. 1991) : https://law.justia.com/cases/federal/district-courts/FSupp/759/1444/1472666/ Inflation Calculator : https://www.in2013dollars.com/us/inflation/1997?amount=1 U.S. Dollar to Japanese Yen Spot Exchange Rates for 1997 from the Bank of England : https://www.poundsterlinglive.com/bank-of-england-spot/historical-spot-exchange-rates/usd/USD-to-JPY-1997 Information Anxiety 2 (Hayden/Que) 2nd Edition : https://www.amazon.com/Information-Anxiety-2-Hayden- Que/dp/0789724103/ref=sr_1_1?ie=UTF8&qid=1341674668&sr=8-1&keywords=Information+Anxiety+2 それは「情報」ではない。―無情報爆発時代を生き抜くためのコミュニケーション・デザイン : Amazon Link Software Development for Small Teams : Google Books Google Book Link Reference Links 4
79.
What Is Domain-DrivenDesign? : O'Reilly https://www.oreilly.com/library/view/what-is-domain-driven/9781492057802/ch04.html Steve Jobs, 1955-2011 : https://www.theverge.com/2011/10/05/steve-jobs-1955-2011-2 Wasmtime:A small and efficient runtime for WebAssembly & WASI https://wasmtime.dev/ Fastly のネイティブ WebAssembly コンパイラ & ランタイム「Lucet」を発表 https://www.fastly.com/blog/announcing-lucet-fastly-native-webassembly-compiler-runtime WebAssembly Micro Runtime(WAMR):組み込み向け軽量ランタイム(JIT除く) https://github.com/bytecodealliance/wasm-micro-runtime WASMER https://wasmer.io/ WebAssembly System Interface (WASI): Node.js v17.1.0 documentation https://nodejs.org/api/wasi.html Azure Active Directory Domain Services のマネージド ドメインのグループ ポリシーを管理する https://docs.microsoft.com/ja-jp/azure/active-directory-domain-services/manage-group-policy 移動ユーザー プロファイルの展開 https://docs.microsoft.com/ja-jp/windows-server/storage/folder-redirection/deploy-roaming-user-profiles#step-4- optionally-create-a-gpo-for-roaming-user-profiles UBUNTU 12.04 ACTIVE DIRECTORY AUTHENTICATION http://koo.fi/blog/2013/01/06/ubuntu-12-04-active-directory-authentication/ Reference Links 5
80.
Ubuntu Linux 仮想マシンをAzure Active Directory Domain Services のマネージド ドメインに参加させる https://docs.microsoft.com/ja-jp/azure/active-directory-domain-services/join-ubuntu-linux-vm Android で MSAL を使用してクロス アプリ SSO を有効にする : Microsoft Docs https://docs.microsoft.com/ja-jp/azure/active-directory/develop/msal-android-single-sign-on Containers in the enterprise:Results from research conducted in 2020 by IBM Market Development & Insights https://www.ibm.com/downloads/cas/VG8KRPRM Reference Links 6
Editor's Notes
#2 古くから考えられていた分散コンピューティングという概念は、現在では多くのクラウドインフラストラクチャのおかげで設定レベルで利用できるようになりました。クラウドネイティブなソリューションの利点であるスケーラビリティやモビリティ、セキュリティ、アベイラビリティ、継続的インテグレーションなどの実装の多くの部分から開発者は解放されたものの、ソリューションアーキテクトがこれまで以上に「クラウドネイティブなソリューションは分散コンピューティングであること」を意識する必要があります。 分散コンピューティングのアーキテクチャの中でソリューションアーキテクトが最も気にしなければいけないことはメッセージングです。一方、最も多いイベントドリブンプログラミングを行う開発者を人員配置することは、最も安全にプロジェクトを進行していく方法のひとつとしてプロジェクトマネージャの関心ごとのひとつです。さらに、開発者はイベントドリブンプログラミングを行う場合、分散コンピューティングで「いつ」「誰の」イベントが「誰に」飛ぶのかを意識しながら問題解決領域内で分散しているステートの一貫性を保つように実装設計し構築する必要があります。そのためクラウドのソフトウェア開発に携わる人間は、立場に関係なくメッセージング・ミドルウェアの知識と、それぞれのミドルウェアをどのように構成するかという部分について見識を深める必要があります。 次に、メッセージング・ミドルウェアを理解すると、今度はそれをどのようにコンテナライズすればよいのか?という疑問に出会うことになります。コンテナライズはソフトウェアが基盤に依存することなく動くように構成することで、クラウドネイティブなソリューションの利点を最大限生かすための概念のひとつです。 dockerやkubernetesはコンテナライゼーションの道具なので、その操作を覚えてもコンテナライゼーションを設計できるわけではありません。また、コンテナライゼーションを設計していないコンテナをそれらのツールで作成しても、クラウドネイティブなソリューションの利点を活かすことは難しく、かえってコンテナライゼーションに関わる余計な作業が増えるだけです。 そこで、今回は身近でかつ開発環境を選ばないWebAssembly(WASM)やWebAssembly System Interface(WASI)を例にコンテナライゼーションの設計のお話をします。
#44 作業効率の良い環境で作業してください。私はWindowsのVisual Studio Codeでの作業に慣れているのでGitHubからダウンロードして作業をしています。まず、nodeのバージョンを確認してください。linux側と同じなら問題ありません。また、node_modulesフォルダ、.gitignoreファイルやhttp-errorのnodeモジュール、expressのbody-parserや開発証明書も追加します。【クリック】.gitignoreファイルはdotnet newで作ります。【クリック】実際この6行打つだけで画面が出ます。
#45 今度はWindows側で開発するのでVisual Studio CodeのExtensionを追加しておきます【画面説明】
#46 GitHubからダウンロードしてきたフォルダをVisual Studio Codeで開いてデバッグペインを開くとデバッグ方法の選択肢が表示されます。【クリック】Run and Debugで選択ツールバーが表示しますので、EdgeかChromeを選択します。【クリック】launch.jsonが開くのでurlのポートを80に直してAdd configurationを選びます。【クリック】選択肢が表示されますので、リストの一番下まで移動し「Run “npm start” in a debug terminal」を選択します。【クリック】最後に出来上がった2つをcompaundsでつなげてデバッグリストの名前を選択して実行します。【クリック】terminalで200、スタックにブラウザとnpmが起動していることを確認します。終了はデバッグのツールバーで2つのスタックを終了させます。
#51 SVGを取得する部分を作成します。【クリック】外部APIリクエストにaxiosとSVGのXML部分を抜き出すのにexpress-xml-bodyparserを使うのでVisual Studio Codeのターミナルを使ってインストールします。また、今回は使いませんが「npm i svgson」をやっておきます。【クリック】外部‘Webにリクエストを投げる部分とレスポンスを取得する部分は、10個と1個の違いなのでほぼ同じですが、axiosの使い方に少し工夫します。【クリック】svgを受け取る際に同期処理としてresponse.dataを待ちます。また、Expressサーバーが次の処理に進むのはファンクションの中で10個取得したかどうかを判定しています。【クリック】実行するとひとつ取得と10個取得ができていることを確認できます。さきほどsvgsonを今回やらないと言いましたがこのSVGのXMLはサニタイズされているので後処理が必要です。その後処理を行うためにsvgsonを使うので、またの機会に解説します。
#52 次にmongoです。【クリック】Dockerの8082のデータベースを起動しておいてVisual Studio CodeでMongoDB Extentionを起動します。先ほど作成したコネクションを選択して、Add Databeseを選択します。Playgroundが開きますので、編集してDBを作成して行きます。【クリック】database「SVGServiceDB」、collection「UsersState」、createCollectionはそのままで「db.UsersState.Insert」を追加します。フィールドはaccountとurlだけ入れておきます。値は好きなものを入れておきます。先ほど設計した内容では、既定で「アイコンを取ってきてからDBに書き込み」です、また最新を問い合わせるオプションはまだ実装していないので、この状態でプログラムの開発準備が整いました。実行します。【クリック】Resultが表示されますので、Playgroundの3点リーダーを使って画面を操作します。【クリック】追加されたことを確認します。
#53 npm I mongodbでインストールした後にrequireでインポートしてコードで使用します。【クリック】処理ではmongoClientの接続、アカウントの有無確認アップデートまたは追加の処理を追加するだけです。