Revert "Add linkup command to improve link functionality" (#4439)

This reverts commit 2504f6fce4.
This commit is contained in:
Joe Previte 2021-11-03 14:42:14 -07:00 committed by GitHub
parent dcc9cf3dd2
commit 219cad1783
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 1 additions and 50 deletions

1
.gitignore vendored
View File

@ -12,7 +12,6 @@ vendor/modules
node-* node-*
/plugins /plugins
/lib/coder-cloud-agent /lib/coder-cloud-agent
/lib/linkup
.home .home
coverage coverage
**/.DS_Store **/.DS_Store

View File

@ -30,15 +30,6 @@ main() {
chmod +x ./lib/coder-cloud-agent chmod +x ./lib/coder-cloud-agent
set -e set -e
fi fi
if ! [ -f ./lib/linkup ]; then
echo "Downloading Link agent..."
set +e
curl -fsSL "https://storage.googleapis.com/coder-link-releases/latest/linkup-$OS-$ARCH" -o ./lib/linkup
chmod +x ./lib/linkup
set -e
fi
} }
main "$@" main "$@"

View File

@ -61,7 +61,6 @@ EOF
rsync node_modules/ "$RELEASE_PATH/node_modules" rsync node_modules/ "$RELEASE_PATH/node_modules"
mkdir -p "$RELEASE_PATH/lib" mkdir -p "$RELEASE_PATH/lib"
rsync ./lib/coder-cloud-agent "$RELEASE_PATH/lib" rsync ./lib/coder-cloud-agent "$RELEASE_PATH/lib"
rsync ./lib/linkup "$RELEASE_PATH/lib"
fi fi
} }

View File

@ -66,12 +66,6 @@ main() {
echo "Failed to download cloud agent; --link will not work" echo "Failed to download cloud agent; --link will not work"
fi fi
if curl -fsSL "https://storage.googleapis.com/coder-link-releases/latest/linkup-$OS-$ARCH" -o ./lib/linkup; then
chmod +x ./lib/linkup
else
echo "Failed to download Link agent; the Link extension will not work"
fi
if ! vscode_yarn; then if ! vscode_yarn; then
echo "You may not have the required dependencies to build the native modules." echo "You may not have the required dependencies to build the native modules."
echo "Please see https://github.com/cdr/code-server/blob/master/docs/npm.md" echo "Please see https://github.com/cdr/code-server/blob/master/docs/npm.md"

View File

@ -1,16 +0,0 @@
import { logger } from "@coder/logger"
import { ChildProcessWithoutNullStreams, spawn } from "child_process"
import path from "path"
export function startLink(address: URL | string): ChildProcessWithoutNullStreams {
if (typeof address === "string") {
throw new Error("Cannot link socket paths")
}
const port = parseInt(address.port, 10)
logger.debug(`running link targeting ${port}`)
return spawn(path.resolve(__dirname, "../../lib/linkup"), ["--devurl", `code:${port}:code-server`], {
shell: false,
})
}

View File

@ -1,14 +1,12 @@
import { field, logger } from "@coder/logger" import { field, logger } from "@coder/logger"
import { ChildProcessWithoutNullStreams } from "child_process"
import http from "http" import http from "http"
import path from "path" import path from "path"
import { Disposable } from "../common/emitter" import { Disposable } from "../common/emitter"
import { plural, logError } from "../common/util" import { plural } from "../common/util"
import { createApp, ensureAddress } from "./app" import { createApp, ensureAddress } from "./app"
import { AuthType, DefaultedArgs, Feature } from "./cli" import { AuthType, DefaultedArgs, Feature } from "./cli"
import { coderCloudBind } from "./coder_cloud" import { coderCloudBind } from "./coder_cloud"
import { commit, version, vsRootPath } from "./constants" import { commit, version, vsRootPath } from "./constants"
import { startLink } from "./link"
import { register } from "./routes" import { register } from "./routes"
import { humanPath, isFile, loadAMDModule, open } from "./util" import { humanPath, isFile, loadAMDModule, open } from "./util"
@ -156,19 +154,6 @@ export const runCodeServer = async (
logger.info(" - Connected to cloud agent") logger.info(" - Connected to cloud agent")
} }
let linkAgent: undefined | ChildProcessWithoutNullStreams
try {
linkAgent = startLink(serverAddress)
linkAgent.on("error", (error) => {
logError(logger, "link daemon", error)
})
linkAgent.on("close", (code) => {
logger.debug("link daemon closed", field("code", code))
})
} catch (error) {
logError(logger, "link daemon", error)
}
if (args.enable && args.enable.length > 0) { if (args.enable && args.enable.length > 0) {
logger.info("Enabling the following experimental features:") logger.info("Enabling the following experimental features:")
args.enable.forEach((feature) => { args.enable.forEach((feature) => {
@ -196,7 +181,6 @@ export const runCodeServer = async (
return { return {
server: app.server, server: app.server,
dispose: async () => { dispose: async () => {
linkAgent?.kill()
disposeRoutes() disposeRoutes()
await app.dispose() await app.dispose()
}, },