Search code examples
pythonrherokugunicornknowledge-repo

How to deploy the airbnb knowledge feed


I have been using airbnbs knowledge repo on local host. The problem is that I have very little web dev experience so I am pretty clueless on how to get this to run on online, preferably on a password protected site.

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?


Solution

  • Look into using some sort of cloud hosting service such as Amazon AWS. After signing up you can create a simple EC2 instance, which is essentially a virtual server running on AWS's data-centers.

    You can then SSH into your virtual server (aka EC2 instance), and install knowledge repo the same way you installed it on your machine above.

    The site should be available under the instance's public DNS name at the port you selected to run the web application (in the example its 7000).

    Regarding controlling access to your server, you should consider using a Security Group, which can limit which IP addresses can access your EC2 Instance on a given port.

    If you are the only one who will be accessing it, simply use your own public IP address on the web application port (i.e. 7000).

    There is plenty of documentation on this online, here are some starters.

    Getting started with EC2 instances

    Gettings started with EC2 Security Groups

    Please consider that using AWS is not free, however there is a free tier you can probably use for a long duration without incurring charges. I believe some of the t2 class instances are included in the free tier. See Free Tier

    Given you don't have a large amount of traffic hitting your site, you should be fine with the instances provided for free.

    I wrote the above thinking this is not going to be a production-grade site which will incur large amount of traffic, and I provided more of a 'quick n' dirty' approach. If at one point you find yourself needing to have this more scalable, resilient, and deployable approach, you can start looking into other offerings by Amazon such as CloudFormation, Elastic Load Balancing, Route53, etc.