trying to run wasp.sh server on docker

Hey guys, so I tried dockerising wasp-sh after I saw it on your recent reddit post. 1. I created a docker container - docker run ubuntu - and installed dependencies incl. node, npm 2. installed wasp.sh using script, modified .bashrc with paths, create test app inside a folder in /MyApp 3. ran docker commit to save as an image 4. run my wasp.sh container docker run -dit -p 3000:3000 -v /services/wasp-sh/MyApp:/MyApp --name wasp-sh wasp-image /bin/bash It works, inside the container I now run (wasp create test) and (wasp start) and I can access my app in browser. But once I try defining some entities and query them (as in the tutorial) I get Loading... followed by "Error: AxiosError: Network" Sorry I am a noob at React and Axios, any pointers to where I messed up? Need additional ports, or is it CORS? Any logs I can hunt around in? Cheers.
14 Replies
roy_unlimited
roy_unlimitedOPβ€’8mo ago
PS. I know I should have built it properly using a dockerfile but just wanted to try on foot first.. PPS. It's probably not docker, just tried on a VM, still getting Axios Network Error
Filip
Filipβ€’8mo ago
Hey @roy_unlimited, we'll need more details on the error. Can you show me what you see in your browser's devtools? Or, even better, export a file from your network tab: https://requestly.com/blog/how-to-download-all-network-requests-of-a-website/
How to Download all Network Requests of a Website
Network logs serve as a vital tool for web developers , providing valuable insights into the communication between web applications and servers. By examining the network logs, developers can understand how data is transferred, identify performance bottlenecks, and debug issues effectively. Network logs are like detailed records of conversations ...
roy_unlimited
roy_unlimitedOPβ€’8mo ago
Hey @sodic , thank you for pointing me in the right direction! It's CORS. Do you reckon if I put it behind traefik on https it might improve the situation? Seen as it's already docker that will be quick. Otherwise I think I might have seen a forum post somewhere about "disabling" CORS policy in Axiom or react or ... (no idea what I am doing).. Would that be a better option? Lastly, a question for another time, just for info: Is it a really bad idea to "develop" on a remote machine like a selfhosted VM? I am using VSCode and commit to a local gitea , then pull on the docker that runs wasp.sh. The tutorial seems to suggest I need to autogenerates some things with the wasp extension (I have installed wasp also locally on mac, but so far , the VSCode extension cannot find in the PATH. ) Anyway I'm still curious to see if I can get it running first with CORS. Checked out a couple more frameworks and some low-code solutions in the meantime, and this still seems it might be one of the quickest for me to get started. Cheers for your help!
No description
roy_unlimited
roy_unlimitedOPβ€’8mo ago
(PS. let me know if you still need the full replay ) PPS. Sorry, in case my setup is still really confusing. My local machine, which runs VSCode , is a mac on my home VLAN. The docker host is a linux VM on my dev VLAN. I.e. different subnets with routing. Firewall rule to allow all between those two. I'd definitely make life easier for myself if I just developed on localhost. Or I'd probably need to go the PostgreSQL route: Make a docker compose stack with wasp-sh and a PostgreSQL container. If I understand the docs correctly that is ( : at that point the complexity seemed to jump though so I noped out for the time being... I suppose I answered my own question, develop on localhost or learn better self hosting ( - ;
Filip
Filipβ€’8mo ago
Hey @roy_unlimited, thanks for the long response, I'll answer your questions one by one πŸ™‚ Let's start with the most obvious one (which you mentioned)
I'd definitely make life easier for myself if I just developed on localhost.
Why are you putting yourself through this torture :D? Unless you want to learn all this stuff, then go for it. But why not just simply develop the app (Wasp or otherwise) regularly - local terminal and localhost. I'm asking because, even if we fix all the CORS issues you hit so far, other issues will just keep popping up (not just with Wasp, but with everything else) because all these tools are built with normal environments in mind. So, in short, you have a Mac, why not just use that? .
(PS. let me know if you still need the full replay )
No need if you figured it out πŸ™‚ .
Filip
Filipβ€’8mo ago
Do you reckon if I put it behind traefik on https it might improve the situation? Seen as it's already docker that will be quick.
The easiest (and official) solution is just telling the server about the client's URL so Wasp can configure CORS correctly. You can do this using an evironment variable: https://wasp-lang.dev/docs/advanced/accessing-app-config#server-configuration-object
Accessing the configuration | Wasp
Whenever you start a Wasp app, you are starting two processes.
roy_unlimited
roy_unlimitedOPβ€’8mo ago
Thank you @sodic ! I guess it's due to my little selfhosting hobby that anything on localhost just feels wrong haha. Ended up with the impression everything comes in containers. (Having also played around with that VScode dev containers extension) However I am also trying to avoid dev environment cruft on the Mac, and just wanting a clean system with only the needed dependencies... Thanks very much for pointing the CORS link out to me! I'll give that a try first. In the end I guess I'll setup another VM after all and remote into it with screen sharing. Then I got localhost and a remote dev machine xD Thanks for your help!
MEE6
MEE6β€’8mo ago
Wohooo @roy_unlimited, you just became a Waspeteer level 1!
Filip
Filipβ€’8mo ago
that anything on localhost just feels wrong haha
Haha, yeah, I recommend you suffer through it. And I get what you mean with a clean system without dependencies. Used to bother me too, but once you get used to it, it removes a world of pain πŸ˜„
roy_unlimited
roy_unlimitedOPβ€’8mo ago
Yeah I definitely just have to get used to (insert Jeff Goldblum in Jurassic Park) the paradigm Thanks again ( :
Filip
Filipβ€’8mo ago
Don't mention it πŸ™‚
roy_unlimited
roy_unlimitedOPβ€’8mo ago
@sodic "localhost" based dev VM, but using VSCode on local mac with SSH remote extension. so it auto-rebuilds on file change. Thrilled to say this seems to be working out - Thanks for this awesome framework!
No description
No description
roy_unlimited
roy_unlimitedOPβ€’8mo ago
I'm really hyped since I may actually be able to make an actual app. +1000
miho
mihoβ€’8mo ago
Noice!
Want results from more Discord servers?
Add your server