Author: Xu Lei The starting address of the article: https://smartide.cn/zh/blog/2022-0729-sprint23/
SmartIDE is an open source cloud native IDE developed by a group of developers for all developers. Our mission is to "give developers cloud native superpowers"!
Using SmartIDE, you only need to learn a simple command smartide start to build an open source environment of any development language with one click, including: Java, DotNet, JavaScript/front-end, Go language, Python, PHP, C/C++ seven mainstream technology stacks; You can also use SmartIDE on Windows/MacOS/Linux three operating systems , you can also choose your favorite IDE tools, including: VSCode/JetBrains family bucket.
SmartIDE v1.0 (CLI Build v1.0.23.4650, Server Build v1.0.23.4646) has been released, and after more than 4000 Builds, we finally released v1.0. The current version has completed the closed-loop feature of enterprise-level cloud-native CloudIDE, allowing individual/team/enterprise users to use VSCode/JetBrains family bucket/OpenSumi on Windows/Mac/Linux to develop any project under 7 technology stacks. And supports WebIDE and Hybrid mixed mode and three workspace access methods of WebTerminal.
This release includes the content of Sprint 20-23, including the following features: complete k8s mode support, team management capabilities, hybrid mode that simplifies using local IDE (VSCode/JetBrains Gateway) to connect to SmartIDE workspace, workspace extension component Web Terminal , ARM processor support and Gitlab CI/CD pipeline support. In addition, we have also expanded the scope of VMLC support, and provided corresponding VMLC developer images for both node and java technology stacks.
The CLI code is officially open source
We have completed the open source of the CLI code, and the relevant code has been pushed to our code repositories on GitHub and Gitee, including the full set of CLI code (written in Golang, using the GPLv3 open source license). This set of codes has been iterated since October 24, 2021. So far, more than 700 submissions have been completed and more than 4,000 versions have been released. We hope that more community partners can participate in the open source.
Open source address: (click the original link at the end of the article to get the address directly)
-
https://github.com/SmartIDE/SmartIDE/tree/main/cli
-
https://gitee.com/smartide/SmartIDE/tree/main/cli
Full k8s mode
We have released complete k8s mode support. Independent developers can use the CLI to deploy the SmartIDE workspace to the k8s cluster with one click, and team administrators can share the k8s cluster with developers in the team through SmartIDE Server. When using SmartIDE Server to create a k8s workspace, a dynamic second-level domain name URL and ssh connection address pointing to the workspace will be created at the same time. Developers can directly access their own workspace through this dynamic second-level domain name. This means that developers can access SmartIDE workspaces running in k8s from any device, including traditional PCs, tablets/iPads, and mobile phones.
CLI start k8s workspace
This method is suitable for individual developers to use their own private k8s cluster as a development and debugging environment. Developers only need to configure the k8s access key locally (the default location ~/.kube/config), and then they can use the following commands to connect SmartIDE to the cloud The workspace is deployed to the k8s cluster. Once started, the cli will automatically complete the mapping of the container port in the workspace to the localhost port through the kubectl command of k8s, and developers can access the workspace running in k8s through the port on localhost.
The example script to deploy k8s workspace directly using CLI is as follows
## cli 一键部署k8s工作区指令
smartide start --k8s <当前集群> \
--repourl https://github.com/idcf-boat-house/boathouse-calculator.git \
--filepath .ide/k8s.ide.yaml
## cli 获取工作区列表指令,可以用来获取 工作区Id 并查看工作区运行状态
smartide list
## cli 删除工作区
smartide remove <工作区Id>
The following figure: The effect of using cli to complete the k8s workspace is as follows, and use VSCode WebIDE, VSCode desktop version and JetBrains Webstorm remote mode to connect to the k8s workspace.
Server starts k8s workspace
SmartIDE Server supports one-click private deployment, you only need a Linux host to complete the deployment, and do not depend on k8s cluster. After the server is deployed, the administrator can bind one or more k8s clusters to the server and assign these k8s clusters to different teams.
Below: SmartIDE Server environment bound to 3 k8s clusters and a linux host at the same time
It is very simple to deploy k8s workspace using Server, as long as you select the corresponding k8s resource in Workspace | Workspace Management | New Workspace.
Below: Using k8s resources to add a new workspace
Through the ssh connection address exposed by the k8s workspace, developers can directly use the local terminal program to connect to the SmartIDE workspace and complete various operations through the terminal. At the same time, developers can also use the ssh remote connection capability of VSCode and JetBrains Gateway to connect local VSCode or JetBrains series IDEs (including: IntelliJ IDEA, PyCharm, GoLand, WebStorm, etc.) to the remote work of SmartIDE, so that developers can At the same time, it takes into account the fast operation experience of the local IDE and the various benefits brought by the remote workspace.
The following figure: The k8s workspace started by Server is connected to work through VSCode WebIDE, VSCode desktop and IDEA IntelliJ remote mode at the same time
The SmartIDE workspace provides VMLC support. You can activate the VMLC capability on your own k8s cluster, and then you can run docker or k8s cluster nested inside the SmartIDE workspace running in the k8s cluster. Developers can use the VMLC capability to easily create and destroy their own k8s cluster, and use this personal k8s cluster to complete the complete development, testing and deployment iterations of cloud native applications, which will simplify the complexity of developing cloud native applications for developers, and Effectively reduce the probability of deployment errors on formal clusters, and greatly improve the development efficiency of cloud-native applications.
Related documentation reference:
-
Server Private Deployment Operation Manual
-
Initialize k8s cluster for SmartIDE Server
-
[Open Source Cloud Native Conference] Live demo: k8s Matryoshka development and debugging dapr application
-
Why is Dapr a more elegant microservices framework than SpringCloud and Istio?
-
SmartIDE Server Quick Start Tutorial
Teams share resources
A new team management capability has been added to SmartIDE Server. Developers can create teams and add other users to the team as needed. The creator of the team will become the administrator of the current team. As an administrator, you can bind the host or k8s cluster to the team and allow other team members to use these resources to create workspaces.
Below: Team resources will display the team they belong to
Hybrid Hybrid Mode Optimization - VSCode SSH Remote and JetBrains Gateway Support
We have simplified the operation steps for connecting VSCode SSH Remote to the SmartIDE workspace. When the developer uses the CLI to start the workspace, the CLI will automatically add a remote connection to the .ssh/config file. At this time, the developer only needs to open the remote connection of VSCode Plug-in, you can see the configured remote connection, just click to complete the connection. During this process, SmartIDE will also automatically update the ~/.ssh/authorizedkeys file in the remote workspace container and add the local ssh public key, so that developers no longer need to enter a password when connecting to the remote workspace. One-click connection is possible.
For developers who prefer to use JetBrains series IDE, you still need to manually create a remote connection in JetBrains Gateway to use Hybrid mode, but the above authorizedkey settings are also valid for JetBrains Gateway, so the connection process will be simpler. We will continue to optimize the support for JetBrains remote work mode in the future to achieve one-click connection capability.
WebTerminal support
In order to facilitate developers to use the terminal to access the SmartIDE workspace, we provide a workspace extension (Workspace AddOn). Developers can add --addon webterminal when creating a workspace to add a browser-based terminal window to the workspace. Although the terminal function is provided in VSCode and JetBrains' WebIDE, providing a separate terminal window will still greatly facilitate developers to manage the workspace. For example, when you need to run a daemon process, you need to access other containers in the workspace Or when you want to use a Vim-like editor.
The WebTerminal function can be added to the environment by adding the --addon webterminal parameter to the cli startup command in local/host mode. The example command is as follows
## 添加 --addon webterminal 启动工作区
smartide start --host 1 --addon webterminal https://github.com/idcf-boat-house/boathouse-calculator.git
Figure below: All containers in the current workspace can be accessed through WebTerminal, and split-screen terminal is supported for convenient parallel operations.
SmartIDE WebTerminal is based on our open source project ysk2014/webshell, so it adopts the same MIT open source protocol as the original project. WebTerminal is also the first Workspace Addon we provided, and we will gradually provide more extensions in the future to enhance developers' ability to operate remote workspaces.
Open source address of SmartIDE WebTerminal:
-
https://github.com/SmartIDE/smartide-web-terminal
-
https://gitee.com/smartide/smartide-web-terminal
ARM support
In this iteration, we provide support for ARM processors. Currently, ARM processors have been widely used in many fields, including: PCs (Apple's M series computers), mobile devices, edge computing and IoT, and servers. SmartIDE is different from other CloudIDEs in that we encapsulate the scheduling capabilities of the cloud/remote workspace into an independent cli program (already open source), and use the cross-platform features of the go language to support running cli on multiple operating systems. Provides SmartIDE with cross-platform and cross-device running capabilities that any other CloudIDE does not have. This time, our support for ARM processors has further greatly expanded our cross-end capabilities. In the future, we will explore embedding CloudIDE into mobile devices, edge computing and IoT fields to provide developers with ubiquitous development environment management capabilities. .
We also optimized the installation script and provided installation channels corresponding to the ARM version, including MacOS and Linux.
Mac Stable Installation
# MacOS
# Intel芯片
curl -OL "https://smartidedl.blob.core.chinacloudapi.cn/releases/$(curl -L -s https://smartidedl.blob.core.chinacloudapi.cn/releases/stable.txt)/smartide-osx" \
&& mv -f smartide-osx /usr/local/bin/smartide \
&& ln -s -f /usr/local/bin/smartide /usr/local/bin/se \
&& chmod +x /usr/local/bin/smartide
# Apple芯片(比如M1/M2系列)
curl -OL "https://smartidedl.blob.core.chinacloudapi.cn/releases/$(curl -L -s https://smartidedl.blob.core.chinacloudapi.cn/releases/stable.txt)/smartide-osx-arm64" \
&& mv -f smartide-osx-arm64 /usr/local/bin/smartide \
&& ln -s -f /usr/local/bin/smartide /usr/local/bin/se \
Linux stable version installation
# Linux
# x86 架构处理器
curl -OL "https://smartidedl.blob.core.chinacloudapi.cn/releases/$(curl -L -s https://smartidedl.blob.core.chinacloudapi.cn/releases/stable.txt)/smartide-linux-amd64" \
&& sudo mv -f smartide-linux-amd64 /usr/local/bin/smartide \
&& sudo ln -s -f /usr/local/bin/smartide /usr/local/bin/se \
&& sudo chmod +x /usr/local/bin/smartide
# arm 架构处理器
curl -OL "https://smartidedl.blob.core.chinacloudapi.cn/releases/$(curl -L -s https://smartidedl.blob.core.chinacloudapi.cn/releases/stable.txt)/smartide-linux-arm64" \
&& sudo mv -f smartide-linux-arm64 /usr/local/bin/smartide \
&& sudo ln -s -f /usr/local/bin/smartide /usr/local/bin/se \
&& sudo chmod +x /usr/local/bin/smartide
Below: Running a containerized workspace using the ARM-native version of SmartIDE CLI on an Apple MacPro M1
This time our support for ARM processors includes
-
The cli for Linux and MacOS operating systems provides both amd64 and arm64 builds and has been released to the daily build and stable channels
-
The arm version of SmartIDE Server related images (smartide-web and smartide-api) and related dependent images (including the basic component images related to the tekton pipeline) have been pushed to Alibaba Cloud Image Warehouse and DockerHub
-
The tekton-task image containing the smartide-cli arm64 version has been pushed to the Alibaba Cloud image repository and DockerHub
-
The arm version of the developer image has been pushed to the Alibaba Cloud image repository and DockerHub
-
The Server one-click deployment script provides built-in arm support, which can automatically identify the current deployment environment and automatically use arm-related resources. For details, please refer to the Server Private Deployment Operation Manual
For specific resource content and links, please refer to
-
https://github.com/SmartIDE/SmartIDE/issues/29
GitLab CI pipeline support
One of our main considerations in designing the core functions of SmartIDE into a CLI is to allow developers to integrate the capabilities of cloud-native IDEs into their own systems at the lowest cost and in the easiest way. In this iteration, we began to further implement this mission, and provided a mode=pipeline operation mode in the CLI, which allows users to use the SmartIDE CLI to create workspaces in their own pipelines. This time, only remote access is available. In the host mode, the k8s mode will also be opened in the future.
scenes to be used:
-
Extend an existing enterprise pipeline system into a CloudIDE management system
-
Deploy a test environment with the corresponding version of the code, which will facilitate developers to locate problems in the test environment and debug them directly in the test environment
-
Create a development and debugging environment for a specific historical version. When we receive user defect reports, we often find that the code version in our development environment is much ahead of the version used by users. In this case, developers can use SmartIDE to create a temporary environment and directly locate a specific historical version (using commitId directly), which can avoid polluting the developer's local area, and also avoid developers from fixing the problem after the new version ( untested) code goes live via HOTFIX entrainment.
The method of use is very simple. Place the following .gitlab-ci.yml in your own gitlab code base to extend the gitlab-ci pipeline with the ability to manage cloud native IDEs.
variables:
#remote host information which you can deploy your dev workspace and open it in WebIDE
SMARTIDE_REMOTE_HOST: <remote dev/test env>
SMARTIDE_REMOTE_HOST_USERNAME: <host username>
SMARTIDE_REMOTE_HOST_PASSWORD: <host password>
#git repo you want to develop in smartide, you can use predefined variable $CI_REPOSITORY_URL
#for the URL to clone the current Git repository (the URL already contain token, so you dont need to
#consider Authentication problem, for custom git repo url, you need resolve authentication yourself with token or ssh..)
SMARTIDE_GIT_REPO_ADDRESS: $CI_REPOSITORY_URL
#callback api address which you want to receive workspace information and trigger other custom events
SMARTIDE_CALLBACK_API_ADDRESS: <callback api address>
stages:
setup_dev_env
smartide:
stage: setup_dev_env
image:
name: registry.cn-hangzhou.aliyuncs.com/smartide/smartide-cli:4475
entrypoint: [""]
script:
smartide version
- smartide start --mode pipeline --isInsightDisabled false --host $SMARTIDE_REMOTE_HOST --username $SMARTIDE_REMOTE_HOST_USERNAME --password $SMARTIDE_REMOTE_HOST_PASSWORD --callback-api-address $SMARTIDE_CALLBACK_API_ADDRESS $SMARTIDE_GIT_REPO_ADDRESS
The above gitlab-ci pipeline script will use the current code base to create a cloud workspace. Developers can embed their desired IDE, middleware or other environment in this cloud workspace by customizing the .ide.yaml configuration file. Please refer to Project Adaptation and Mirroring and Templates .
In this iteration, we simply extended the existing functions of SmartIDE CLI, and provided a pipeline operation mode on top of the existing client | server operation modes. This mode is actually a headless mode, cli will not try to open the browser, nor will it call the api of the smartide server, but allows the user to specify a callback address $SMARTIDE_CALLBACK_API_ADDRESS . When the CLI completes the workspace creation, it will notify this address of the workspace details callback according to the established json format. In this way, developers can easily integrate CloudIDE capabilities into existing enterprise-level DevOps platforms, all they need is a pipeline scheduling tool (gitlab-ci, jenkins, azure pipeline or any other support command line invocation) tool) and an interface that receives callbacks in json format.
The gitlab-ci integration example provided this time is just the beginning. The current SmartIDE CLI features have formed a closed loop. We will start to explore and provide more integration methods in subsequent iterations, so that developers can enjoy cloud development in the easiest way. the benefits of.
For details on gitlab-ci support, please refer to:
-
https://github.com/SmartIDE/SmartIDE/issues/30
Empowering developers with cloud-native technologies has always been our mission.
It will be held in Beijing on September 17-18 , 2022, and a product will be built and released from 0 to 1 within 36 hours.
Enterprises can participate in teams & individuals, hurry up and get on the bus~👇