btemperli / webtigerjython-cloud

adaption of webtigerjython: cloud-based programming
MIT License
1 stars 1 forks source link

Self hosting? #3

Open FreshImmuc opened 1 month ago

FreshImmuc commented 1 month ago

Hello,

is there any guide on how to self host?

An answer would be very much appreciated :)

btemperli commented 1 month ago

The App is based on the PHP-Framework Lumen.

You need the following things to prepare the app on your own:

If everything works (I recommend to test everything on a local webserver), you can upload it to your self hosted server.

Feel free to come back to me, if I missed something or something did not work as expected. Or when everything is working, so that I can add this small help to the README...

FreshImmuc commented 1 month ago

Yes i have a quiestion on the JS_SFTP Part, Do i just provide any sftp server to store the files? Because what does the maindir mean? Also how do i configure SSL connection to the mysql database?

This would help me very much ! :)

btemperli commented 1 month ago

The JS_SFTP-Part is used for the automatic upload to your/my server. You will see the variables used in the file npm_run/wtj-upload.js.

Just leave this part empty if you don't want to upload the files automatically via node/npm.

FreshImmuc commented 1 month ago

Alright so i got everything working inside the php folder. BUT when i upload the /web folder to a webserver, it tells me many files are missing. I uploaded every missing file that it told me to add but now i get a 500 internal server error. So: What files do i need to actually upload to the web server root dir?

btemperli commented 1 month ago

I just uploaded all the files directly via github-sync. So in my case, there are all files in the web server root dir. Plus I copied the files which are not part of the github-repo, like the .env-file .

The web server directs to the index.php-file in the /web-folder. Also in the /web-folder, there is the /assets-folder.

What you probably not need on the server are the following files & folders:

FreshImmuc commented 1 month ago

Hey, i got everything working after having to configure so much stuff with nginx and docker since my setup is like this. But nevermind it works now :)

BUT webtigerjython itself (the official site) did some changes some days ago. I don't know what they changed but almost all programms of mine don't work anymore. Some logic is broken. Many drawings (gturtle) don't draw correctly anymore. Here is an example:

Old version of WebTigerJython, your currently running cloud files and WebTigerPython: image Current WebTigerJython and my current hosted version of the cloud: image

The exact same code btw.

Can i somehow restore the old version? OR Could you send me the old assets? Also make sure to possibly not update your assets right now because of this :)

Here is the code if you want to try it yourself:

# Round Edges
from gturtle import *
makeTurtle()

start = "F--F--F--"
alpha = 60
rule = "F+F+F-F-FF"
size = 100
edgeR = 10  # Qualität der Eckenrundung
iterations = 2

if(edgeR == 0): # fix für Startfigur
    start = start.replace("F", "FFF")
def leftc(sized):
    if(edgeR == 0):
        return left(alpha)
    for i in range(edgeR):
        forward(sized / edgeR)
        left(alpha / edgeR)

def rightc(sized):
    if(edgeR == 0):
        return right(alpha)
    for i in range(edgeR):
        forward(sized / edgeR)
        right(alpha / edgeR)

def draw(string, sized):
    for i in string:
        if i == "F":
            forward(sized)
        elif i == "+":
            leftc(sized)
        elif i == "-":
            rightc(sized)

def ersetze(string, n, sized):
    if(n == 0):
        return (string, sized)
    for i in range(n):
        string = string.replace("F", rule)
        sized = sized / 3
    return (string, sized)

hideTurtle()
data = ersetze(start, iterations, size)
if(iterations > 0):
    setPenWidth(5 / iterations)
draw(data[0], data[1])
print(data[0], data[1])
showTurtle()
hideTurtle()
btemperli commented 1 month ago

Cool, that the things are working now!

The assets-files are generated directly from the original webtigerjython-project (from the live website), so there is no way to get "older" files from there.

But I can give you access to the assets from my live-environment: wtj.temperli.io/assets.zip.

Hope this helps!