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

bit server start issue in self hosted docker in kubernetes cluster (any load balancer setup) #4923

Closed
pgangwani opened this issue Oct 4, 2021 · 8 comments
Assignees
Labels

Comments

@pgangwani
Copy link

pgangwani commented Oct 4, 2021

Describe the bug

While deploying self hosted bit-server in kubernetes env (GCP), ui doesnt work as static/* points to root of the load-balancer always.

Steps to Reproduce

Access the README.md of https://github.com/pgangwani/bit-server-static-public-path-issue

Expected Behavior

Server should be up and the respective static folder path should be either relative point to the same public as index.html or there should be runtime method to override:

PUBLIC_URL=/bit-dev bit start

Screenshots, exceptions and logs

Static assets goes 404

If applicable, add screenshots, exceptions, and logs to help explain your problem.

Specifications

  • Bit version: 0.0.513
  • Workspace type: (harmony/legacy) harmony (bit init --bare)
  • Node version: 12.22.6
  • npm / yarn version: npm
  • Platform: mac os

for harmony workspace

  • relevant env
  • relevant aspects

for leagacy

  • Bit compiler (include version):
  • Bit tester (include version):

Additional context

[Update] 10/5
Worked with @KutnerUri on testing the suggested ASSET_PATH in webpack.browser.config.ts , which worked for setting publicpath for static/but got new cascaded issue into attention where /graphql gives 404

Partially working
Issue 2

Related Pull Request

#4958

@KutnerUri
Copy link
Contributor

We should probably use process.env.ASSET_PATH, it seems to be the default recommended by webpack:
https://webpack.js.org/guides/public-path/.

They also have the option of publicPath: 'auto', it seems relevant.

@pgangwani
Copy link
Author

pgangwani commented Oct 5, 2021

We should probably use process.env.ASSET_PATH, it seems to be the default recommended by webpack: https://webpack.js.org/guides/public-path/.

They also have the option of publicPath: 'auto', it seems relevant.

process.env.ASSET_PATH didnt work when I did ASSET_PATH=/bit-dev bit start
We definitely need this override when deploying assets in cdn but if its deployed on same server, we can have relative path for static/* but now it goes to root route (/) there is problem especially setup with load balancers or proxies.

@KutnerUri I have spent time to setup the repo. Please check and let me know if there is already a way to solve that by making the change as fork.

@KutnerUri
Copy link
Contributor

KutnerUri commented Oct 5, 2021

yes, the code needs some tweaking.
Do you want to try it locally and maybe make a PR? It will be much faster for you to test it locally with your setup, and we will handle it sooner.

I believe the relevant code is here -

I think you can just replace it with:

publicPath: process.env.ASSET_PATH || '/';

setup might be as simple as

# clone
git clone https://github.com/teambit/bit.git
cd bit

# install
rm -rf node_modules public/bit
bit install # this might take a long time
bit compile

# probably not needed:
# npm run build
# npm run build:types 
## OR
# npm run build:windows 

# one time registration
npm run dev-link bd
# OR
npm run dev-link:windows bd

# you will then be able to run:
bd -v
# output will be "last-tag 0.0.516"
# (unlike bit -v, which outputs "0.0.516"

# etc 
> ~/project/example-project$
bd start --rebuild

remember to watch your cloned bit folder before starting to code!

> ~/project/bit$ bit watch

@pgangwani
Copy link
Author

@KutnerUri : I scratched my head already by trying few things with above steps by setting cmd link as bit-local , might be in other webpack files at the same place of publicPath . I wish I have deep knowledge of bit building blocks . I would just love to contribute. Believe me. May be you can help me later ?
For now, trying exactly the steps as you said and update here.

@pgangwani pgangwani changed the title bit server start issue in self hosted docker in kubernetes cluster bit server start issue in self hosted docker in kubernetes cluster (any load balancer setup) Oct 7, 2021
@pgangwani
Copy link
Author

There is open PR #4958 for this.

@afanan
Copy link

afanan commented Nov 5, 2021

I pulled the latest bitcli/bit version: 0.0.555, but I still have the same problem. Is it resolved? @pgangwani @KutnerUri

@KutnerUri
Copy link
Contributor

This feature is too complicated. We tried to make it work with Pgangwani's PR, but it's not working in all edge cases. :/

@itaymendel
Copy link
Contributor

unfornunatily, at this point we are not looking support this type of structure.

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

No branches or pull requests

5 participants