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

[Notes]: unable to run via docker per instructions #317

Closed
kobuki opened this issue Nov 6, 2022 · 12 comments
Closed

[Notes]: unable to run via docker per instructions #317

kobuki opened this issue Nov 6, 2022 · 12 comments
Assignees

Comments

@kobuki
Copy link

kobuki commented Nov 6, 2022

What happened?

Running the app via docker using the following command fails:

$ docker run --name webssh2 -d -p 2222:2222 -v $PWD/config.json:/usr/src/config.json billchurch/webssh2
f41f6df65f26172b044e3474632af6ca1474238565a14e9f7ef8af9bd8f45f29

Container exits here instantly. Config file attached. Made from sample config file in Git. Output of docker logs below.

config.json.txt

Node Version

N/A

NPM Version

N/A

Server OS Version

Debian 10.12

WebSSH2 release version

N/A

OS and Version of SSH server

N/A

Browser Version

N/A

Relevant log output

$ docker logs webssh2
WebSSH2 service reading config from: /usr/src/config.json
/usr/src/server/app.js:22
  origins: config.http.origins,
                       ^

TypeError: Cannot read property 'origins' of undefined
    at Object.<anonymous> (/usr/src/server/app.js:22:24)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)
    at Module.require (internal/modules/cjs/loader.js:961:19)
    at require (internal/modules/cjs/helpers.js:92:18)
    at Object.<anonymous> (/usr/src/index.js:11:20)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
@tip2tail
Copy link

@kobuki @billchurch did you find a fix for this?
I had webssh2 working, tweaked the config file and now cannot get it to run at all - even when I revert back to the initial file.
Same error

@tip2tail
Copy link

tip2tail commented Jan 29, 2023

I have done some digging and I have found that the built version of server/app.js within the docker image itself differs from the defined source version in a couple of places. See higlighted below:
image

I worked around this by duplicating my config to match - e.g. socketio.origins config as http.origins
image

As well as session.secret and session.name as express.secret and express.name respectively.

This allows the process to start, however attempting to then launch within the browser results in another error:
image

@billchurch is there something going wrong in the compile of the JS?

@tip2tail
Copy link

Just to follow up - I have attempted to build a completely fresh version of this with docker and still get the same cursorBlink error

@billchurch
Copy link
Owner

@tip2tail, sorry I've been out for a bit. looking at this and will fix it this week. thanks for doing the digging.

@billchurch
Copy link
Owner

@tip2tail

Okay, so I think I see what's happening. In 0.4.7 I'm changing that schema a bit, so the example that's in main now is dev/0.4.7.

If you change the tag of this repository to 0.4.6, the example is correct for that version and should work properly.

https://github.com/billchurch/webssh2/blob/0.4.6/app/config.json.sample

webssh2 % git status
HEAD detached at 0.4.6
nothing to commit, working tree clean
webssh2 % docker run -it --rm -p 2222:2222 -v $PWD/app/config.json.sample:/usr/src/config.json billchurch/webssh2
WebSSH2 service reading config from: /usr/src/config.json
WebSSH2 service listening on 0.0.0.0:2222

@kobuki
Copy link
Author

kobuki commented Feb 6, 2023

So... as soon as you release 0.4.7, we can run the container without quirks and until then we must manually checkout 0.4.6?

@billchurch
Copy link
Owner

@kobuki probably a better way you could phrase that to the only developer working on a project for free...

The example config.json you're pulling from main is the development branch. the 0.4.6 tag would contain the correct example config.json (as well as the correct README).

@billchurch billchurch removed the bug label Feb 6, 2023
@billchurch billchurch changed the title [Bug]: unable to run via docker per instructions [Notes]: unable to run via docker per instructions Feb 6, 2023
@billchurch
Copy link
Owner

@kobuki you can feel free to pull billchurch/webssh2:main if you want the current development branch, but its probably not what you want.

@kobuki
Copy link
Author

kobuki commented Feb 6, 2023

No, I'm thankful for every piece of free software, including yours, that I have access to. I'm saying this as someone who also works on OSS projects even here. But as one I usually try to produce a master that can be used as-is and work on feature branches otherwise. I was a little baffled on why a code that's being regularly maintained refuses to even load its config. But, no offense was intended, I shoulda chosen my wording a bit better, maybe.

In any case, I can try out webssh2 in 0.4.6 now, thanks for the hints!

@billchurch
Copy link
Owner

if you're using docker, you don't need to checkout anything. A proper config for the version is the only thing you need, which is going to be stored under the tag for that version.

@billchurch
Copy link
Owner

I updated docker page as well...

@tip2tail
Copy link

tip2tail commented Feb 6, 2023

@billchurch Very much appreciated and thanks for the detail on what the root cause was.
Glad to have helped!

Thanks again
M

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants