In my previous article, I introduced Rust, explained how to install it, and created a simple Rust project. With the help of a container and OpenShift's "import from Git" functionality, you can onboard a Rust application onto OpenShift quickly.
[ Keep Rust syntax and tips on hand with this free Rust cheat sheet. ]
You can find the Rust project used in this example in my GitHub repository. The code is based on a repo created by the development team at Actix, a web framework for Rust. The most important files inside the repo include the dockerfile, Cargo.toml, and src/main.rs:
- The
dockerfilepulls the latest Rust image and runs thecargo buildcommand. - The
Cargo.tomlfile includes the Actix web dependency and package information. - The
main.rsscript contains the web server code, which displays "Hello, Openshift!" on port 8080.
Onboard Rust using OpenShift Web Console
- Log into the OpenShift Web Console.
- Click on Developer on the left sidebar at the very top.
- Click the Add button.
- Select the Import from Git option.
- Add the Git repository URL:
https://github.com/nnlama/rust_k8s_webserver - Click Create.
Cargo builds the project in five to 10 minutes. You must have these OpenShift resources:
- One pod in the completed stage to build the Rust application
- One pod in the running stage to run the Rust web server
- One service
- One route to expose the Rust application
Access the route to the application under the Networking tab on the OpenShift Web Console. Copy and paste the URL into your local browser to see a "Hello OpenShift!" message.
Congratulations! You have successfully onboarded your first Rust application on OpenShift. If you are interested in contributing to the Rust community, please visit the Rust Programming Language Handbook and Rustaceans.org for more information on becoming an official Rustacean.
저자 소개
Nicole Lama is a first-generation Panamanian-American with a bachelor's in biomedical sciences and a master's in bioinformatics and computational biology. Since 2015, she has worked with academics, tech startups, and Fortune 500 companies to help meet their data extraction, transformation, mobilization, storage, analytics, and visualization needs. She specializes in Python, machine learning, and open source technology.
채널별 검색
오토메이션
기술, 팀, 인프라를 위한 IT 자동화 최신 동향
인공지능
고객이 어디서나 AI 워크로드를 실행할 수 있도록 지원하는 플랫폼 업데이트
오픈 하이브리드 클라우드
하이브리드 클라우드로 더욱 유연한 미래를 구축하는 방법을 알아보세요
보안
환경과 기술 전반에 걸쳐 리스크를 감소하는 방법에 대한 최신 정보
엣지 컴퓨팅
엣지에서의 운영을 단순화하는 플랫폼 업데이트
인프라
세계적으로 인정받은 기업용 Linux 플랫폼에 대한 최신 정보
애플리케이션
복잡한 애플리케이션에 대한 솔루션 더 보기
가상화
온프레미스와 클라우드 환경에서 워크로드를 유연하게 운영하기 위한 엔터프라이즈 가상화의 미래