Eugeny / tabby-web

Tabby Web - an SSH/Telnet/Serial client in your browser.
https://tabby.sh
MIT License
806 stars 120 forks source link

build broken ? #128

Closed toxic0berliner closed 2 months ago

toxic0berliner commented 2 months ago

Im currently unable to build the tabby-web container. I'm using my gitlab CI & runners to do this and am getting the following error :

#37 CACHED
#38 [build-backend 15/15] RUN APP_DIST_STORAGE=file:///app-dist /venv/*/bin/python ./manage.py add_version 1.0.187-nightly.1
#38 1.476 INFO Resolving tabby-web-container@1.0.187-nightly.1
#38 2.277 INFO Downloading tabby-web-container@1.0.187-nightly.1 from https://registry.npmjs.org/tabby-web-container/-/tabby-web-container-1.0.187-nightly.1.tgz
#38 11.99 INFO Resolving tabby-core@1.0.187-nightly.1
#38 12.35 INFO Downloading tabby-core@1.0.187-nightly.1 from https://registry.npmjs.org/tabby-core/-/tabby-core-1.0.187-nightly.1.tgz
#38 12.76 INFO Resolving tabby-settings@1.0.187-nightly.1
#38 13.07 INFO Downloading tabby-settings@1.0.187-nightly.1 from https://registry.npmjs.org/tabby-settings/-/tabby-settings-1.0.187-nightly.1.tgz
#38 13.23 gzip: invalid magic
#38 13.23 tar: Child returned status 1
#38 13.23 tar: Error is not recoverable: exiting now
#38 13.28 Traceback (most recent call last):
#38 13.28   File "./manage.py", line 22, in <module>
#38 13.28     main()
#38 13.28   File "./manage.py", line 18, in main
#38 13.28     execute_from_command_line(sys.argv)
#38 13.28   File "/venv/tabby-web-9TtSrW0h-py3.7/lib/python3.7/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
#38 13.28     utility.execute()
#38 13.28   File "/venv/tabby-web-9TtSrW0h-py3.7/lib/python3.7/site-packages/django/core/management/__init__.py", line 413, in execute
#38 13.28     self.fetch_command(subcommand).run_from_argv(self.argv)
#38 13.28   File "/venv/tabby-web-9TtSrW0h-py3.7/lib/python3.7/site-packages/django/core/management/base.py", line 354, in run_from_argv
#38 13.28     self.execute(*args, **cmd_options)
#38 13.28   File "/venv/tabby-web-9TtSrW0h-py3.7/lib/python3.7/site-packages/django/core/management/base.py", line 398, in execute
#38 13.28     output = self.handle(*args, **options)
#38 13.28   File "/app/tabby/app/management/commands/add_version.py", line 56, in handle
#38 13.28     ["tar", "-xzf", f.name, "-C", str(extraction_tmp)]
#38 13.28   File "/usr/local/lib/python3.7/subprocess.py", line 363, in check_call
#38 13.28     raise CalledProcessError(retcode, cmd)
#38 13.28 subprocess.CalledProcessError: Command '['tar', '-xzf', '/tmp/tmpfp8gbxia', '-C', '/tmp/tmp_ra3c54q']' returned non-zero exit status 2.
#38 ERROR: process "/bin/sh -c APP_DIST_STORAGE=file:///app-dist /venv/*/bin/python ./manage.py add_version ${BUNDLED_TABBY}" did not complete successfully: exit code: 1
------
 > [build-backend 15/15] RUN APP_DIST_STORAGE=file:///app-dist /venv/*/bin/python ./manage.py add_version 1.0.187-nightly.1:
13.28     self.fetch_command(subcommand).run_from_argv(self.argv)
13.28   File "/venv/tabby-web-9TtSrW0h-py3.7/lib/python3.7/site-packages/django/core/management/base.py", line 354, in run_from_argv
13.28     self.execute(*args, **cmd_options)
13.28   File "/venv/tabby-web-9TtSrW0h-py3.7/lib/python3.7/site-packages/django/core/management/base.py", line 398, in execute
13.28     output = self.handle(*args, **options)
13.28   File "/app/tabby/app/management/commands/add_version.py", line 56, in handle
13.28     ["tar", "-xzf", f.name, "-C", str(extraction_tmp)]
13.28   File "/usr/local/lib/python3.7/subprocess.py", line 363, in check_call
13.28     raise CalledProcessError(retcode, cmd)
13.28 subprocess.CalledProcessError: Command '['tar', '-xzf', '/tmp/tmpfp8gbxia', '-C', '/tmp/tmp_ra3c54q']' returned non-zero exit status 2.
------
 4 warnings found (use --debug to expand):
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 32)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 54)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 55)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 56)
Dockerfile:48
--------------------
  46 |     RUN FRONTEND_BUILD_DIR=/frontend /venv/*/bin/python ./manage.py collectstatic --noinput
  47 |     RUN apk add tar
  48 | >>> RUN APP_DIST_STORAGE=file:///app-dist /venv/*/bin/python ./manage.py add_version ${BUNDLED_TABBY}
  49 |     
  50 |     # ----
--------------------
ERROR: failed to solve: process "/bin/sh -c APP_DIST_STORAGE=file:///app-dist /venv/*/bin/python ./manage.py add_version ${BUNDLED_TABBY}" did not complete successfully: exit code: 1

I did try to add the tar package as I found it somewhere to be a hint on alpine when tar complains about invalid magic but no luck, this is my addition online 47 :

RUN FRONTEND_BUILD_DIR=/frontend /venv/*/bin/python ./manage.py collectstatic --noinput
RUN apk add tar
RUN APP_DIST_STORAGE=file:///app-dist /venv/*/bin/python ./manage.py add_version ${BUNDLED_TABBY}

same behaviour on another machine using docker compose build. Strangely downloading the https://registry.npmjs.org/tabby-settings/-/tabby-settings-1.0.187-nightly.1.tgz file in my browser seems to give me a valid tar gz, or at least my gnu tar binary can handle it without issues...

Building on debian 12 with Docker version 25.0.3, build 4debf41 and Docker Compose version v2.24.5

Any help or idea is welcome.

Not a fan of relying on npmjs repos though, probably we could build the tabby-* npm packages locally too... couldn't fins their source in a few mins of search here on github&google, might make a bigger effort later when I get this working :)

Eugeny commented 2 months ago

Now exactly sure what's causing this, especially given that the other two packages are getting downloaded & unpacked fine - have you tried changing $BUNDLED_TABBY to a different version so that it grabs different packages from NPM?

toxic0berliner commented 2 months ago

Yes not sure myself. Tried older versions too and every time at least one package failed randomly... Seeing it just tar extract the files in what seems to me is /dist-app I'm going to try disabling them and extracting the packages from npmjs myself...

Strangely though I never managed to get the tabby-web to answer anything on /api/1/anything it always gave me 404 so I had to try the alternative build in rust but it isn't supporting gateways... Will try to fix the build of tabby-web container at least, happy you confirmed everything is there so I'll have to dig a bit deeper but I 'll get it to serve the gateway/choose and point it to my gateway;)

toxic0berliner commented 2 months ago

Hello. I didn't try the bundled tabby en var but I got it fully working by downloading manually the packages, fixing my GitHub client ID, and editing the db to set me as super admin 😉 I will try to build the node packages myself anyway, my goal is to add my custom oauth2 to my local authelia as well as trying to enable "auto login" as the app itself is already behind authelia forward auth, so it makes sense for me to always attempt a login as it will always succeed.

Thanks already for the kind help @Eugeny ! If you have some pointers regarding custom oauth2 or auto login I'd happy to hear them.

Looks to be a really nice app, congrats on the amazing result, sad to see you had to shelve it, but don't feel bad and take care of yourself we'll manage with what you have already given to the community you owe nothing more. Good luck with your future endeavors!