eyedeekay / em-dosbox-in-a-box

Emscripten-Compiled dosbox running in a container with a web server.
9 stars 0 forks source link

site not appearing at port 8080 or 405 #1

Open JakeTrock opened 5 years ago

JakeTrock commented 5 years ago

I run a site at http://jakesandbox.com which is, as you can tell, my sandbox, and decided to test out your repo. I've never used docker before, but installed everything in the instructions, and ran it properly(at least I think I did). However, the DOSBox page doesn't seem to be appearing at jakesandbox.com:8080 or port 405, what should I do, is there something that I didn't do correctly in the instructions? image P.S. I'll give you any more info if need be. @eyedeekay

eyedeekay commented 5 years ago

Thanks for trying my project and pointing this out. Sorry it took me so long to get back to you. A "docker log em-dosbox" would be helpful, as well as the contents of the config.mk. Also, I'm just spitballing based on the thing I accidentally left out of the instructions, but did you uncomment the line with "#include config.mk" in it in the Makefile? That may be the source of the issue. I'm away from my equipment, but I'll have more for you soon.

Also, I'm absolutely happy to help you here, but there are actually more mature projects which do what this does in a more stable way. This is messy, held together with tape and chewing gum. Just a thing I did to learn about emscripten. They do more, too, provide a prettier interface for one thing(Emscripten's default styling for the pages it generates is pretty cluttered). Are you sure you this is the one you want? If the best way to resolve your issue is to try a different version of the concept think we should do that.

JakeTrock commented 5 years ago

alright, thanks a million! config.mk wasn't commented out, and here's my docker log and config.mk https://pastebin.com/6vQNe0z1 https://pastebin.com/LYsX5jVm I'm only 16 and have spent the past two months trying to get emscripten working properly on Ubuntu 18.04, to no avail. When I saw your repo, it was my last hope, and I can safely say that my idiot's brain is much more satisfied with your repo than it was with anything else. I sincerely thank you for helping me. P.s. Do you know where the js/html files are placed by your program?

eyedeekay commented 5 years ago

I created the issue. My bad. I'm going to try and fix it a couple different ways before I push up a new version, but it'll be fixed soon. I forgot to document how to get the actual programs into the folder where the launcher script generates looks for files to generate data from, which is /home/dosbox/em-dosbox/src/programs and the pages will be generated in /home/dosbox/em-dosbox/src/. Actually, I didn't create the issue, the old version would have worked had $(PWD) evaluated to the correct value. It needed tidied up anyway though so it's good that I did it anyway.

The rest of this is pretty much just an explanation of why it is the way it is and what it does, because I think you are experiencing the conditions that led me to do it this way in the first place. I had to look back through it and refresh my memory and because you seem like you want to use it, it seems like it's important for me to explain it.

First part is about your emscripten problem, the Ubuntu emscripten packages were pretty old last time I checked them. It's a little annoying, but everybody only has so many hours in their day. I've pretty much taken to doing anything I have to do with emscripten in Docker containers(Actually that's the reason for how this was set up). Alpine linux, which is commonly used for Docker containers, has up-to-date emscripten packages in it's edge branch. It's not how you're "supposed" to use it, but if you wanted to get a minimal alpine userspace with the latest emscripten packages and some common toolchain components, you could:

FROM alpine:edge
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" | tee -a /etc/apk/repositories
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" | tee -a /etc/apk/repositories
RUN apk update -U
RUN apk add bash emscripten-fastcomp emscripten emscripten-optimizer \
    emscripten-libs-asmjs emscripten-libs-wasm make autoconf autoconf-archive \
    automake darkhttpd git glib-dev glib markdown
CMD bash -i

docker build -t hokuco/alpine-emscripten .

and then, whenever you needed your emscripten tools, you could drop into the container by running

docker run -i --name alpine-emscripten hokuco/alpine-emscripten

That's a little shortcut around your toolchain issues. It's also a fairly comprehensive set of emscripten tools to use as the basis for future containers. Docker users are kind of notorious for assuming that the solution to every problem is more Docker, but when it comes to emscripten, this really helps keep things together.

I couldn't remember how I did this, and I've worked my way back through it now but I really did a poor job naming the variables in this thing. What happens is that launch.sh starts darkhttpd with a placeholder page, then loops over all the folders in /home/dosbox/em-dosbox/src/programs to find DOS programs to package with emscripten. While doing so, it redirects the log files to format the output as a markdown document. Then it puts them all together, emits a new home page, and restarts darkhttpd. The files that are generated are placed in /home/dosbox/em-dosbox/src. The launch.sh script is the only significant component of this and it is due for a revision.

I'll have it all fixed soon.

eyedeekay commented 5 years ago

OK so the changes I just made seem to be working on my server, but the index file is still hideous. It makes a text file with links interspersed. Clicking those links will take you to the games. Most of them will work, but I can't account for every way a game might be configured or load data so YMMV. The launch.sh script has been reworked in some minor ways to make it clearer what it is outputting.

Edit: I'm sorry man, I am so tired, I've been running non stop all week. I needed to get some of the brittleness out of this thing before you used it again. Let's see, your actual issue was the volume thing. As long as the layout of the folder you pass to --volume is

/working/directory/programs
    /game1
        game.exe
        game.cfg
        cwsdpmi.exe
    /game2
        game.exe
        game.cfg
        cwsdpmi.exe
    /game3
        game.exe
        game.cfg
        cwsdpmi.exe

        ...etc

It should work. Let me know what happens when you try it.

eyedeekay commented 5 years ago

Also for some reason $(PWD) doesn't seem to evaluate to the working directory in your environment. I've just worked around that by setting it in the Makefile.

JakeTrock commented 5 years ago

Words cannot express how grateful I am. I hope I didn't ruin your night. Also my issue may be that my gamedir structure is actually like this: /Game1 game.exe game.i386 /config 1.pk3 2.pk3 4.pk3 5.pk3 6.pk3 7.pk3 8.pk3 Link to gamefiles: https://wetransfer.com/downloads/c6ac263eeec98b4b95d241cbdc50c5e820180928114956/2256b2

eyedeekay commented 5 years ago

It should work with the folder like that too, but I'm going to try it out after work tonight with openarena and see how things go.

JakeTrock commented 5 years ago

You're awesome :)

eyedeekay commented 5 years ago

Oh shoot. I saw your issue over on the js-dos repo, and if @caiiiycuk's version won't do OpenArena because it's too big, then my little toy here definitely won't. I'm not really in a position to make those kind of changes to em-dosbox or dosbox right now(In fact I don't even know what changes would need to be made). I'm going to go ahead and leave this issue open until I can revisit it, but it's probably going to be some time before I can fix this for you.

JakeTrock commented 5 years ago

Alright, I'll resolve it to the best of my ability, and if it works I'll credit you no matter what