cheat.sh icon indicating copy to clipboard operation
cheat.sh copied to clipboard

Add documentation to run your own mirror

Open deewakar opened this issue 7 years ago • 5 comments
trafficstars

Running python srv.py gave an import error.

$ python bin/srv.py Traceback (most recent call last): File "bin/srv.py", line 9, in from gevent.wsgi import WSGIServer ImportError: No module named wsgi

Would you mind adding documentation on how to run your own cheat.sh server. Thanks.

deewakar avatar Jul 12 '18 02:07 deewakar

Have you tried installing the requirements.txt file? pip install -r requirements.txt If you don't want to have those dependencies installed globally, you could use a virtualenv.

jporsay avatar Jul 12 '18 17:07 jporsay

Yes, I did exactly that. I created a virtualenv and pip installed the requirements.txt file. When I ran srv.py file, it gave the above import error. Then I did a little google search and decided to change from gevent.wsgi import WSGIServer to from gevent.pywsgi import WSGIServer. It led to another import error:

no module named polyglot.detect

Then I installed polyglot. Even then it complained about not finding the hardcoded filepath related to #44,

No such file or directory: '/home/igor/git/github.com/adambard/learnxinyminutes-docs/awk.html.markdown

So, one thing is for sure, polyglot is missing from the requirements.txt file.

deewakar avatar Jul 13 '18 02:07 deewakar

I see that get_answer module starting an external process get-answer-for-question.. Not sure what that is. I believe it is important to know this for hosting a mirror .

I was trying to figure out where/how cheat.sh is extracting data from different sources. It looks like except for learn x in y, everything else is being delegated to the above said external binary. Correct me if I'm wrong.

spy16 avatar Jul 13 '18 05:07 spy16

I've just made commit 22953bb109adc45c142e0653ca87f10d7a798065 on my fork -- this provides a Dockerfile and docker-compose.yml to be used for running locally. It will install all packages and modules, then pull down cheatsheets and run Redis alongside the app.

I'll see about doing some Documentation work this week and then making a pull request for all of the changes.

bglopez avatar Jul 30 '18 06:07 bglopez

README now has an instruction how to run own mirror with docker-compose.

docker-compose up

Does that work for you?

abitrolly avatar Nov 13 '21 17:11 abitrolly