knowledge-repo icon indicating copy to clipboard operation
knowledge-repo copied to clipboard

A short tutorial on how to deploy

Open alexhallam opened this issue 7 years ago • 8 comments

Auto-reviewers: @NiharikaRay @matthewwardrop @earthmancash @danfrankj

Hi, I have been loving this tool. Thus far I have only used runserver to view the knowledge feed. I would now like to deploy. It does not matter to me where it deploys. It could be a custom domain name, or heroku, or anything else. I am just a little lost on how to deploy. From reading the documentation I got this far.

knowledge_repo --repo app/ deploy

From this I get the following:

INFO:knowledge_repo.repositories.gitrepository:Fetching updates to the knowledge repository...
INFO:alembic.runtime.migration:Context impl SQLiteImpl.
INFO:alembic.runtime.migration:Will assume non-transactional DDL.
[2018-01-09 19:33:58 -0500] [17729] [INFO] Starting gunicorn 19.7.1
[2018-01-09 19:33:58 -0500] [17729] [INFO] Listening at: http://0.0.0.0:7000 
[2018-01-09 19:33:58 -0500] [17729] [INFO] Using worker: sync
[2018-01-09 19:33:58 -0500] [17772] [INFO] Booting worker with pid: 17772
[2018-01-09 19:33:58 -0500] [17775] [INFO] Booting worker with pid: 17775
[2018-01-09 19:33:58 -0500] [17778] [INFO] Booting worker with pid: 17778
[2018-01-09 19:33:58 -0500] [17781] [INFO] Booting worker with pid: 17781

This is obviously only viewable on my computer at http://0.0.0.0:7000.

How do I make this deployable to the web?

alexhallam avatar Jan 10 '18 00:01 alexhallam

In our deployment, I'm using nginx to handle proxying to the app, as well as serving images. Something like this.

alecraso avatar Jan 20 '18 04:01 alecraso

@aaronbiller Thanks! For those looking to deploy on AWS, I just got an answer to this question on stackoverflow here. Basically you just set up an EC2 instance, clone you knowledge feed onto your server then, then deploy as you would on your localhost. I ran through this and everything is working fine. One problem with this approach is that I don't have password protection.

alexhallam avatar Jan 20 '18 13:01 alexhallam

@alexhallam Hi Alex. I'm glad you got things sorted out!

A few pointers for you:

  • we recently added support for authentication but did not introduce a default local implementation (expecting that people who cared about such things would create their own integrations). It would probably be a good idea to allow people to set up a static username/password list so that for people looking for a simple solution need not look far. [Patches welcome].
  • If you change the knowledge-repo's port to 80, instead of 7000, then you won't need to type the ':7000' into your browser (:80 is the default for HTTP services).

matthewwardrop avatar Jan 21 '18 22:01 matthewwardrop

@matthewwardrop @alexhallam Just a note that this solution isn't working for me. I am trying to make Knowledge Repo run on an EC2 instance. I configured the server as per docs instructions, and opened the port (7000) via security group in AWS. Should be working but it doesn't, I still get a "site not reachable". Any ideas?

martinapugliese avatar Mar 02 '18 14:03 martinapugliese

@martinapugliese Have you tried running any R programs on your server?

alexhallam avatar Mar 02 '18 19:03 alexhallam

@alexhallam Am using Jupyter, it runs fine. It's the port (7000, but I tried with others) that does not let me connect via browser

martinapugliese avatar Mar 03 '18 08:03 martinapugliese

@martinapugliese I am assuming you also tried testing the Allows inbound HTTP access from any IPv4 address security group also as shown here. Source IP = 0.0.0.0/0

alexhallam avatar Mar 03 '18 11:03 alexhallam

@alexhallam I did! This is the rule added to the security group: screen shot 2018-03-04 at 09 03 18

martinapugliese avatar Mar 04 '18 09:03 martinapugliese