garethbjohnson / gutendex

Web API for Project Gutenberg ebook metadata
https://gutendex.com
MIT License
236 stars 48 forks source link

Add Docker and DockerCompose #22

Open coleyr opened 2 years ago

coleyr commented 2 years ago

I added in files to make it possible to use docker and docker-compose so that setup could be one line.

I really appreciate this project and I wanted to use it for a school library application. I thought adding the docker files would make it easier to use for production or development.

The application and postgres can be run using docker-compose from the docker folder using the command: docker-compose up The application can be run with nginx, and postgres using: docker-compose -f ./production_docker_compose up

In the env file in the docker folder I added "POPUlATE_ON_START" variable, if set to true, when the application is run, python manage.py updatecatalog will be called.

garethbjohnson commented 2 years ago

Thank you for the pull request! This would make running and serving Gutendex much easier. I do not have much experience with Docker, but I will take some time to try your code and learn what each line is doing.

coleyr commented 2 years ago

Hey @garethbjohnson, I would be happy to meet sometime and talk over the changes. I will also work on a readme for the docker folder for install instructions.

garethbjohnson commented 2 years ago

Hi @coleyr, I have tried a few times to run docker-compose up with POPULATE_ON_START=true, but just before I would expect it to start updating the catalog, it seems to stall for a very long time, and my laptop gets loud and hot. Do you have any guesses about why this happens or how to prevent it? Or is this part of normal intended operation, and I just need to be patient while my machine works hard?

coleyr commented 2 years ago

So, without seeing Logs or watching the process, my guess would be the parsing process is taking extra long, largely due to the fact the containers have fewer resources available due to being a percent of your local machine. That said, I have worked on a separate branch to parse the tar file with fewer read write operations. But the load on start currently has many reads and writes inside the container which takes a while.

On Wed, Mar 23, 2022, 3:29 PM Gareth @.***> wrote:

Hi @coleyr https://github.com/coleyr, I have tried a few times to run docker-compose up with POPULATE_ON_START=true, but just before I would expect it to start updating the catalog, it seems to stall for a very long time, and my laptop gets loud and hot. Do you have any guesses about why this happens or how to prevent it? Or is this part of normal intended operation, and I just need to be patient while my machine works hard?

— Reply to this email directly, view it on GitHub https://github.com/garethbjohnson/gutendex/pull/22#issuecomment-1076739097, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFY3XAORFKFP57S7CGUZQ73VBNWIXANCNFSM5PVI5J3A . You are receiving this because you were mentioned.Message ID: @.***>