Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 108 additions & 0 deletions code-server.kvp
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
Meta.DisplayName=code-server
Meta.Description=Self-hosted VS Code in the browser
Meta.OS=Linux
Meta.AarchSupport=Native
Meta.Arch=All
Meta.Author=juzigu40-ui
Meta.URL=https://github.com/coder/code-server
Meta.DisplayImageSource=url:https://avatars.githubusercontent.com/u/95932066?s=200&v=4
Meta.EndpointURIFormat=http://{ip}:{GenericModule.App.Ports.$ServerPort}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove http://

Meta.ConfigManifest=code-serverconfig.json
Meta.MetaConfigManifest=code-servermetaconfig.json
Meta.ConfigRoot=code-server.kvp
Meta.MinAMPVersion=2.6.0.0
Meta.SpecificDockerImage=cubecoders/ampbase:debian
Meta.DockerRequired=False
Meta.DockerBaseReadOnly=False
Meta.ContainerPolicy=Supported
Meta.ContainerPolicyReason=
Meta.ExtraSetupStepsURI=
Meta.Prerequisites=[]
Meta.ExtraContainerPackages=[]
Meta.ConfigReleaseState=NotSpecified
Meta.NoCommercialUsage=False
Meta.ConfigVersion=1
Meta.ReleaseNotes=
Meta.BreakingReleaseNotes=
Meta.AppConfigId=7d3f9192-9467-4c0d-b003-d0d536ee2534
Meta.ImportableExtensions=[]
Meta.AppIsMultiIPAware=True
App.DisplayName=code-server
App.RootDir=./code-server/
App.BaseDirectory=./code-server/server/
App.SteamWorkshopDownloadLocation=
App.ExecutableWin=
App.ExecutableLinux=server/bin/code-server
App.WorkingDir=server
App.LinuxCommandLineArgs=
App.WindowsCommandLineArgs=
App.CommandLineArgs=--bind-addr {{$ApplicationIPBinding}}:{{$ServerPort}} --auth password --disable-telemetry --disable-update-check --user-data-dir "{{$FullBaseDir}}data" --extensions-dir "{{$FullBaseDir}}extensions" {{CustomArgs}} "{{$FullBaseDir}}workspace"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--auth password --disable-telemetry --disable-update-check

These shouldn't be hard coded but instead should be UI settings in the manifest

App.UseLinuxIOREDIR=False
App.AppSettings={}
App.EnvironmentVariables={"PASSWORD":"{{$RemoteAdminPassword}}","HOME":"{{$FullBaseDir}}home"}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than change the $HOME dir, use the XDG spec

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use RemoteAdminPassword, but instead have a Password setting in the UI

App.CommandLineParameterFormat=--{0}={1}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be space separated

App.CommandLineParameterDelimiter=
App.ExitMethod=OS_CLOSE
App.ExitTimeout=30
App.ExitString=
App.ExitFile=app_exit.lck
App.HasWriteableConsole=False
App.HasReadableConsole=True
App.UDPLogger=False
App.SupportsLiveSettingsChanges=False
App.LiveSettingChangeCommandFormat=
App.ForceIPBinding=False
App.SupportsIPv6=False
App.ApplicationIPBinding=0.0.0.0
App.Ports=@IncludeJson[code-serverports.json]
App.AdminPortRef=0
App.PrimaryApplicationPortRef=ServerPort
App.UniversalSleepApplicationUDPPortRef=0
App.UniversalSleepSteamQueryPortRef=0
App.MaxUsers=0
App.UseRandomAdminPassword=True
App.PersistRandomPassword=True
App.RemoteAdminPassword=
App.AdminMethod=STDIO
App.IgnoreSTDOUTAfterRCON=False
App.AdminLoginTransform=None
App.LoginTransformPrefix=
App.RCONConnectDelaySeconds=5
App.RCONConnectRetrySeconds=5
App.RCONHeartbeatMinutes=0
App.RCONHeartbeatCommand=ping
App.TelnetLoginFormat={0}
App.UpdateSources=@IncludeJson[code-serverupdates.json]
App.PreStartStages=[]
App.UserActions=[]
App.ForceUpdate=False
App.ForceUpdateReason=
App.Compatibility=None
App.SteamUpdateAnonymousLogin=False
App.SteamForceLoginPrompt=False
App.RapidStartup=False
App.SmartExcludeExemptions=["*.json","*.yaml","*.yml","*.toml","*.kvp"]
App.SmartExcludeSupported=True
App.DumpFullChildProcessTree=False
App.MonitorChildProcessName=
App.MonitorDirectChildOnly=False
App.SupportsUniversalSleep=False
App.WakeupMode=Any
App.ApplicationReadyMode=RegexMatch
Console.FilterMatchRegex=
Console.FilterMatchReplacement=
Console.ThrowawayMessageRegex=^$
Console.AppReadyRegex=^\[[^\]]+\] info\s+HTTP server listening on http://.*$
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Escape the forward slashes

Console.UserJoinRegex=^$
Console.UserLeaveRegex=^$
Console.UserChatRegex=^$
Console.UpdateAvailableRegex=^$
Console.MetricsRegex=
Console.SuppressLogAtStart=False
Console.UserActions={}
Limits.SleepMode=False
Limits.SleepOnStart=False
Limits.SleepDelayMinutes=5
Limits.DozeDelay=2
Limits.AutoRetryCount=2
Limits.SleepStartThresholdSeconds=25
50 changes: 50 additions & 0 deletions code-serverconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This entire file should be updated to include as many of the server's command line arguments as is appropriate. Subcategories should be consistent with other templates

The two hidden settings are not needed and should be removed

{
"DisplayName": "code-server Version",
"Category": "code-server:web",
"Subcategory": "Server:download:1",
"Description": "Sets the code-server release version to install. Empty = latest stable release tag from GitHub.",
"Keywords": "code-server,version,release",
"FieldName": "ServerVersion",
"InputType": "text",
"ParamFieldName": "ServerVersion",
"DefaultValue": "",
"Placeholder": "v4.109.5",
"EnumValues": {}
},
{
"DisplayName": "Additional code-server Arguments",
"Category": "code-server:web",
"Subcategory": "Server:runtime:2",
"Description": "Optional extra flags appended to the code-server start command.",
"Keywords": "custom,args,flags",
"FieldName": "CustomArgs",
"InputType": "text",
"ParamFieldName": "CustomArgs",
"DefaultValue": "",
"Placeholder": "--disable-workspace-trust",
"EnumValues": {}
},
{
"DisplayName": "Server Binding",
"Category": "code-server:web",
"Subcategory": "Server:runtime:2",
"Description": "Uses the AMP Application IP Binding for the web listener.",
"Keywords": "binding,ip,address",
"FieldName": "$ApplicationIPBinding",
"InputType": "hidden",
"ParamFieldName": "ApplicationIPBinding",
"EnumValues": {}
},
{
"DisplayName": "Web UI Password",
"Category": "code-server:web",
"Subcategory": "Access:auth:3",
"Description": "Generated by AMP and passed to code-server as the PASSWORD environment variable.",
"Keywords": "password,auth",
"FieldName": "$RemoteAdminPassword",
"InputType": "hidden",
"ParamFieldName": "RemoteAdminPassword",
"EnumValues": {}
}
]
1 change: 1 addition & 0 deletions code-servermetaconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
9 changes: 9 additions & 0 deletions code-serverports.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
{
"Protocol": "TCP",
"Port": 8080,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given 8080 is AMP's default port, it should be something like 9090

"Ref": "ServerPort",
"Name": "Web UI",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Server Port

"Description": "Primary HTTP port used by code-server"
}
]
28 changes: 28 additions & 0 deletions code-serverupdates.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[
{
"UpdateStageName": "Prepare code-server directories",
"UpdateSourcePlatform": "Linux",
"UpdateSource": "Executable",
"UpdateSourceData": "/bin/bash",
"UpdateSourceArgs": "-c \"cd code-server && mkdir -p server data extensions workspace home\"",
"SkipOnFailure": false
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant given these are also created in the following update stages.

As above, don't create home

},
{
"UpdateStageName": "code-server Download",
"UpdateSourcePlatform": "Linux",
"UpdateSourceArch": "x86_64",
"UpdateSource": "Executable",
"UpdateSourceData": "/bin/bash",
"UpdateSourceArgs": "-c \"ServerVersion=\\\"{{ServerVersion}}\\\"; cd code-server; mkdir -p server data extensions workspace home; if [[ -x server/bin/code-server ]]; then InstalledVersion=$(server/bin/code-server --version | head -n1 | tr -d '\\r'); else InstalledVersion=\\\"\\\"; fi; [[ -z \\\"$ServerVersion\\\" ]] && ServerVersion=$(wget -qO- https://api.github.com/repos/coder/code-server/releases/latest | jq -r .tag_name); VersionNoV=\\\"${ServerVersion#v}\\\"; if [[ ! \\\"$ServerVersion\\\" =~ ^v[0-9]+\\.[0-9]+\\.[0-9]+$ ]]; then echo \\\"Invalid code-server version format specified\\\" && exit 1; elif [[ \\\"$InstalledVersion\\\" == \\\"$VersionNoV\\\" ]]; then echo \\\"code-server $ServerVersion already installed. Skipping\\\" && exit 0; else [[ -f code-server.tar.gz ]] && rm -f code-server.tar.gz >/dev/null 2>&1; wget -qO code-server.tar.gz https://github.com/coder/code-server/releases/download/$ServerVersion/code-server-$VersionNoV-linux-amd64.tar.gz || { echo \\\"Download failed from GitHub. Aborting\\\"; exit 1; }; rm -rf server/* >/dev/null 2>&1 && tar -xzf code-server.tar.gz -C server --strip-components=1 >/dev/null 2>&1 && rm -f code-server.tar.gz >/dev/null 2>&1 && chmod +x server/bin/code-server && echo \\\"code-server $ServerVersion downloaded\\\"; fi\"",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

InstalledVersion needs to be trimmed to the first space

"SkipOnFailure": false
},
{
"UpdateStageName": "code-server Download",
"UpdateSourcePlatform": "Linux",
"UpdateSourceArch": "aarch64",
"UpdateSource": "Executable",
"UpdateSourceData": "/bin/bash",
"UpdateSourceArgs": "-c \"ServerVersion=\\\"{{ServerVersion}}\\\"; cd code-server; mkdir -p server data extensions workspace home; if [[ -x server/bin/code-server ]]; then InstalledVersion=$(server/bin/code-server --version | head -n1 | tr -d '\\r'); else InstalledVersion=\\\"\\\"; fi; [[ -z \\\"$ServerVersion\\\" ]] && ServerVersion=$(wget -qO- https://api.github.com/repos/coder/code-server/releases/latest | jq -r .tag_name); VersionNoV=\\\"${ServerVersion#v}\\\"; if [[ ! \\\"$ServerVersion\\\" =~ ^v[0-9]+\\.[0-9]+\\.[0-9]+$ ]]; then echo \\\"Invalid code-server version format specified\\\" && exit 1; elif [[ \\\"$InstalledVersion\\\" == \\\"$VersionNoV\\\" ]]; then echo \\\"code-server $ServerVersion already installed. Skipping\\\" && exit 0; else [[ -f code-server.tar.gz ]] && rm -f code-server.tar.gz >/dev/null 2>&1; wget -qO code-server.tar.gz https://github.com/coder/code-server/releases/download/$ServerVersion/code-server-$VersionNoV-linux-arm64.tar.gz || { echo \\\"Download failed from GitHub. Aborting\\\"; exit 1; }; rm -rf server/* >/dev/null 2>&1 && tar -xzf code-server.tar.gz -C server --strip-components=1 >/dev/null 2>&1 && rm -f code-server.tar.gz >/dev/null 2>&1 && chmod +x server/bin/code-server && echo \\\"code-server $ServerVersion downloaded\\\"; fi\"",
"SkipOnFailure": false
}
]