Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is the correct way to deploy the code-server on alpine? #6535

Open
4 tasks done
dxkrs opened this issue Nov 15, 2023 · 4 comments
Open
4 tasks done

What is the correct way to deploy the code-server on alpine? #6535

dxkrs opened this issue Nov 15, 2023 · 4 comments
Labels
bug Something isn't working triage This issue needs to be triaged by a maintainer

Comments

@dxkrs
Copy link

dxkrs commented Nov 15, 2023

Is there an existing issue for this?

  • I have searched the existing issues

OS/Web Information

alpine3.18.4 in docker container

Steps to Reproduce

I try to step by step with the offical docs.

  1. docker run --ti alpine:3.18.4
  2. apk update && apk add alpine-sdk bash libstdc++ libc6-compat
  3. apk add python3
  4. apk add nodejs=18.18.2-r0
  5. apk add npm
  6. npm config set python python3 , this command will error, then I try it the npm config edit and add the 'python=python3` in the open file
  7. export FORCE_NODE_VERSION=18
  8. npm install --global code-server --unsafe-perm

Expected

success deploy the code-server

Actual

Print a log of error at the last step.
I see the err tips:"You may not have the required dependencies to build the native modules", then I try to see the lists Node.js requirements and confirm the prerequisites, but also not success.

Logs

/ # npm install --global code-server --unsafe-perm
npm ERR! code 1
npm ERR! path /usr/local/lib/node_modules/code-server
npm ERR! command failed
npm ERR! command sh -c sh ./postinstall.sh
npm ERR! WARNING: Overriding required Node.js version to v18
npm ERR! This could lead to broken functionality, and is unsupported.
npm ERR! USE AT YOUR OWN RISK!
npm ERR! Installing Code dependencies...
npm ERR! User agent: npm/9.6.6 node/v18.18.2 linux x64 workspaces/false
npm ERR! You may not have the required dependencies to build the native modules.
npm ERR! Please see https://github.com/coder/code-server/blob/main/docs/npm.md
npm ERR! npm ERR! code 1
npm ERR! npm ERR! path /usr/local/lib/node_modules/code-server/lib/vscode/node_modules/kerberos
npm ERR! npm ERR! command failed
npm ERR! npm ERR! command sh -c prebuild-install --runtime napi || node-gyp rebuild
npm ERR! npm ERR! make: Entering directory '/usr/local/lib/node_modules/code-server/lib/vscode/node_modules/kerberos/build'
npm ERR! npm ERR!   CXX(target) Release/obj.target/kerberos/src/kerberos.o
npm ERR! npm ERR! make: Leaving directory '/usr/local/lib/node_modules/code-server/lib/vscode/node_modules/kerberos/build'
npm ERR! npm ERR! prebuild-install warn install No prebuilt binaries found (target=4 runtime=napi arch=x64 libc=musl platform=linux)
npm ERR! npm ERR! gyp info it worked if it ends with ok
npm ERR! npm ERR! gyp info using node-gyp@9.3.1
npm ERR! npm ERR! gyp info using node@18.18.2 | linux | x64
npm ERR! npm ERR! gyp info find Python using Python version 3.11.6 found at "/usr/bin/python3"
npm ERR! npm ERR! gyp info spawn /usr/bin/python3
npm ERR! npm ERR! gyp info spawn args [
npm ERR! npm ERR! gyp info spawn args   '/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! npm ERR! gyp info spawn args   '-f',
npm ERR! npm ERR! gyp info spawn args   'make',
npm ERR! npm ERR! gyp info spawn args   '-I',
npm ERR! npm ERR! gyp info spawn args   '/usr/local/lib/node_modules/code-server/lib/vscode/node_modules/kerberos/build/config.gypi',
npm ERR! npm ERR! gyp info spawn args   '-I',
npm ERR! npm ERR! gyp info spawn args   '/usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! npm ERR! gyp info spawn args   '-I',
npm ERR! npm ERR! gyp info spawn args   '/root/.cache/node-gyp/18.18.2/include/node/common.gypi',
npm ERR! npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! npm ERR! gyp info spawn args   '-Dnode_root_dir=/root/.cache/node-gyp/18.18.2',
npm ERR! npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! npm ERR! gyp info spawn args   '-Dnode_lib_file=/root/.cache/node-gyp/18.18.2/<(target_arch)/node.lib',
npm ERR! npm ERR! gyp info spawn args   '-Dmodule_root_dir=/usr/local/lib/node_modules/code-server/lib/vscode/node_modules/kerberos',
npm ERR! npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! npm ERR! gyp info spawn args   '--depth=.',
npm ERR! npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! npm ERR! gyp info spawn args   '--generator-output',
npm ERR! npm ERR! gyp info spawn args   'build',
npm ERR! npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! npm ERR! gyp info spawn args ]
npm ERR! npm ERR! gyp info spawn make
npm ERR! npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! npm ERR! In file included from ../src/kerberos_common.h:5,
npm ERR! npm ERR!                  from ../src/kerberos.h:12,
npm ERR! npm ERR!                  from ../src/kerberos.cc:1:
npm ERR! npm ERR! ../src/unix/kerberos_gss.h:21:14: fatal error: gssapi/gssapi.h: No such file or directory
npm ERR! npm ERR!    21 |     #include <gssapi/gssapi.h>
npm ERR! npm ERR!       |              ^~~~~~~~~~~~~~~~~
npm ERR! npm ERR! compilation terminated.
npm ERR! npm ERR! make: *** [kerberos.target.mk:110: Release/obj.target/kerberos/src/kerberos.o] Error 1
npm ERR! npm ERR! gyp ERR! build error
npm ERR! npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! npm ERR! gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:203:23)
npm ERR! npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:517:28)
npm ERR! npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:292:12)
npm ERR! npm ERR! gyp ERR! System Linux 3.10.0-1160.83.1.el7.x86_64
npm ERR! npm ERR! gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! npm ERR! gyp ERR! cwd /usr/local/lib/node_modules/code-server/lib/vscode/node_modules/kerberos
npm ERR! npm ERR! gyp ERR! node -v v18.18.2
npm ERR! npm ERR! gyp ERR! node-gyp -v v9.3.1
npm ERR! npm ERR! gyp ERR! not ok
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2023-11-15T11_07_26_826Z-debug-0.log

npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2023-11-15T11_07_16_538Z-debug-0.log

Screenshot/Video

No response

Does this issue happen in VS Code or GitHub Codespaces?

  • I cannot reproduce this in VS Code.
  • I cannot reproduce this in GitHub Codespaces.

Are you accessing code-server over a secure context?

  • I am using a secure context.

Notes

So, what the correct way to deploy the code-server on alpine? Or is it not support the alpine in docker?

@dxkrs dxkrs added bug Something isn't working triage This issue needs to be triaged by a maintainer labels Nov 15, 2023
@code-asher
Copy link
Member

code-asher commented Nov 17, 2023

Ah I think we are missing the krb5 dependency in our Alpine instructions. Maybe try installing krb5-dev.

https://github.com/mongodb-js/kerberos#requirements

@bjohnson0524
Copy link

bjohnson0524 commented Mar 11, 2024

I have followed the above steps. When I type code-server on the command line, the message says the server is at http://127.0.0.1:8080, but I can't pull anything up in the browser. I am attaching pictures. Anything else I can check?
docker
server1
web

@code-asher
Copy link
Member

code-asher commented Mar 11, 2024

Ah you probably need to bind to 0.0.0.0. If you use 127.0.0.1 then nothing outside the container can access it, even if the port is exposed.

@bjohnson0524
Copy link

8. npm install --global code-server --unsafe-perm

Thanks. As you suggested, I changed 127.0.0.1 to 0.0.0.0 in the config.yaml file. I restarted the container and now it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage This issue needs to be triaged by a maintainer
Projects
None yet
Development

No branches or pull requests

3 participants