Code Server
In this example, we will create an 3rd Party App Marketplace SKU for Code Server. This is distributed as a Docker Container via DockerHub.
The app itself is available via DockerHub and is maintained by the good folks at LinuxServer
Prerequisites¶
As a service provider, you already have completed the following:
- Provisioned a Kubernetes cluster (e.g. Rafay MKS)
- Your Cluster has connectivity to the Internet to download container images from DockerHub
- Deployed a cluster blueprint with critical addons (i.e. Ingress Controller, GPU Operator etc)
- Access to a domain (e.g. paas.demo.gorafay.net) with TLS certificates to support https based access via the user's web browser
Info
If you are operating in an air gapped or locked down environment, please download and host the container image in an internally accessible container registry.
Create Code Server App SKU¶
- Login into the "Default Org" and navigate to the PaaS Studio
- Click on Service Profiles and click on "New Service Profile"
This will launch a wizard to create a new service profile.
- Provide a unique name (e.g. codeserver)
- Provide an optional Display Name (e.g. Code Server)
- Provide an optional description (This will be presented to the end user when they select and launch the card for the SKU)
- For Environment Template, select "system-serverless-pods"
- For version, select the latest version (e.g. v6)
- For Service Type, select from the dropdown list (managed by the super admin role)
- Enable the toggle for auto creation of compute
- Save & Continue
Profile Configuration¶
General¶
Update the fields in the "general" section if needed
Card Design¶
-
Provide the URL for an image which will be presented to the user as an Icon when they select the SKU (e.g. https://user-images.githubusercontent.com/5768801/99205104-8d519600-2785-11eb-9171-e2952f22d2ab.png)
-
Update the readme field with a description which will be presented to the end user when they select the SKU (e.g. Code Server App)
Info
Click on "Preview" to view what the readme will look like for the end user.
Input Settings¶
In this section, you get to specify
- Default values for required inputs
- Which inputs can be overridden by end users
- How the inputs can be selected by end users (e.g. dropdown list, text box etc)
Here is the documentation to run Code Server
docker run -d \
--name=code-server \
-e PUID=1000 \
-e PGID=1000 \
-e TZ=Etc/UTC \
-e PASSWORD=password `#optional` \
-e HASHED_PASSWORD= `#optional` \
-e SUDO_PASSWORD=password `#optional` \
-e SUDO_PASSWORD_HASH= `#optional` \
-e PROXY_DOMAIN=code-server.my.domain `#optional` \
-e DEFAULT_WORKSPACE=/config/workspace `#optional` \
-e PWA_APPNAME=code-server `#optional` \
-p 8443:8443 \
-v /path/to/code-server/config:/config \
--restart unless-stopped \
lscr.io/linuxserver/code-server:latest
Info
Due to security considerations, service providers will prefer to have web apps be accessed on "port 443" (https).
User Overrides¶
Disable "Allow Overrides for All" This disables all overrides for end users when they use it. We will selectively enable some fields in the subsequent steps.
Default Inputs¶
In this step, you will customize the standard profile with "default" values that are relevant for your deployment.
| Name | Value | Override |
|---|---|---|
| Access Mode | NO | |
| Container Port | 8443 | NO |
| CPU | 2000 | NO |
| Enable Storage | true | NO |
| Enable Web Access | true | NO |
| Env Vars | ["PUID=1000", "PGID=1000", "TZ=Etc/UTC", "PASSWORD=generateToken()"] | NO |
| Host Cluster Name | NO | |
| Hostname Suffix | NO | |
| Ingress Class Name | NO | |
| Kubeconfig | NO | |
| Memory | 4000 | NO |
| Pod Image | lscr.io/linuxserver/code-server:latest | NO |
| SKU Type | notebook | NO |
| Storage Path | NO | |
| Storage Size | NO | |
| Volume Mounts | [{"mount_path": "/config","volume_name": "config","is_pvc_required": "true","size": "10Gi","storage_class_name": "openebs-hostpath","access_mode": "ReadWriteOnce"}] | NO |
Once configured, it should look like the image below.
Hostname Suffix
Specify the DNS hostname that you intend to use to serve the web applications. In our example, we are using "paas.demo.gorafay.net". Every instance of the web app can be accessed on a dynamically generated URL pattern that will look like "https://random prefix.paas.demo.gorafay.net"
Kubeconfig
- In the Infrastructure portal, click on the "gear" symbol on the far right of the target Kubernetes cluster
- Select "Download ZTKA Kubeconfig"
- Open the downloaded file with an IDE
- Copy the content and paste it into the Kubeconfig field in the above step.
Output Settings¶
Once the web application has been successfully deployed, we need to help user quickly find the URL for the app.
- Click on "Add Output"
- Under name, enter "Host Name"
- Under label, enter "URL"
- Click on "Add Output" again
- Under name, enter "Token"
- Under label, enter "Password"
Info
The name "Host Name" will dynamically retrieve the https URL for the deployed web app.
Schedules & Actions¶
Skip these
Click on "Save" to save the profile. Now, we have a ready to use the Code Server App SKU. It should look like the following
Test Code Server App SKU¶
Now, we are ready to test our newly created Code Server App SKU.
- In the SKU Studio, click on "Service Instances"
- Ensure the "system-catalog" project is selected
- Click on New Service Instance
- Click Select on the Code Server Card
- Enter a name for the instance
- Click Save & Continue
- Click Deploy
Within 1-2 minutes, you should see a successfully deployed instance. See example below.
Now, click on the URL and you should be taken to your Code Server App. Use the password provided in the output to login. You should see something like the image below.
Share SKU with Customer Orgs¶
At this point, although the SKU works, it is not available to Customer Orgs automatically. Service Providers need to perform the following to make the SKU available to customer orgs
- Login into the Rafay Ops Console
- Click on System Resources
- Click on Service Profiles
You should now see the newly created SKU (e.g. codeserver).
- Click on Actions to initiate SKU sharing
- You will be presented with the option to share the SKU with "Select Orgs" or "All Orgs"
- Select one of these options and the SKU will now be immediately available and usable by the selected customer orgs.











