ronreiter / interactive-tutorials

Interactive Tutorials
Apache License 2.0
4.03k stars 2.56k forks source link

Clarify how to run specific language sites (ie, learn-js.org)? #617

Closed sdbedi closed 2 years ago

sdbedi commented 3 years ago

By default, the makefile will run learnpython.org. Is it possible to run other sites with the makefile? The documentation on this appears to have been cut off -

"The development version of the web server requires that you specify the domain you are working on, e.g.:"

shrn01 commented 2 years ago

As far as I understand, change the domain given in the makefile to the domain you want to work on, and it would work. (e.g. change learnpython.org to learn-golang.org, it should give you golang tutorial page)

Or you could just use virtualenv with python3 and getaway without using docker.

ronreiter commented 2 years ago

@shrn01 correct. We need to implement this by overriding the website using an environment variable and starting the container with a command line env var (prefixing the make command and passed to docker-compose).

sdbedi commented 2 years ago

That makes sense - but would we need to edit the website_docker.conf as well?

Moreover, would we want the build to default to learnpython.org in the absence of a command line arg?

shrn01 commented 2 years ago

I don't think we need to edit the conf files.

I'm thinking of adding a shell script which is the entry point to docker, and it executes gunicorn when in production and flask dev server if in dev mode. Hope this makes sense here.

Defaulting it to learnpython.org can be done using a variable.

sdbedi commented 2 years ago

Sort of. Would you need to add a shell script though? Couldn't you just pass the command line argument to the makefile?

shrn01 commented 2 years ago

Yeah we can do that too, but you need to give the entire entry point to the app in the make file i.e. the entire command, but yes, it can be done.

Remember,.the makefile calls dockerfile so this entire command should be passed as an environment variable to the docker file and that variable can be added to the entry point field.

ronreiter commented 2 years ago

As I said on another issue here, the solution would be to override the entrypoint with the flask dev server alongisde the domain (-d) argument, through the Makefile's docker-compose function.

shrn01 commented 2 years ago

So basically for dev server we use docker-compose (docker-compose up) and for production it's dockerfile (docker build and docker run) is it?

Sorry if I'm asking too much, I have very litte experience with docker.

ronreiter commented 2 years ago

Actually, I haven't really set up a production deployment script at all. Right now I just run docker compose up on an instance. The production set up should use Digital Ocean's applications feature.

ronreiter commented 2 years ago

Simplified, please refer to README.md