How to get code from Github to "go"
November 1, 2017 2:44 AM   Subscribe

So there's this Github-project Bookdrop - I would like to run it on my own. Could you walk me through the general steps I'd need to take to run this somewhere else - and where? I was thinking about an AWS- or so service - but how do I actually do this??

I was thinking about learning to program a bit - and there's this service that recently folded that I was thinking about resurrecting for my own use. A potential double-win.

The service that folded was: Bookdrop - and it's not working because they went over the limit of interactions that Dropbox allows per App. - I think setting up a new instance would solve this problem - and I'd like to learn to deal with code a bit better - but I don't even know what I would google for or how to read what language it is written in (python?) - for the basics/a structure learning environment I started doing this course:

MITx: 6.00.1x Introduction to Computer Science and Programming Using Python

but I'd still like to set this up - hope me please?
posted by mathiu to Computers & Internet (11 answers total) 3 users marked this as a favorite
From reviewing the code, it is written in Python using the Flask framework with Celery as a task queue.

Here's a tutorial from Google on how to setup Flask with AWS:

This would likely be quite a bit of a learning curve if you are still learning Python. I would recommend finishing your Python course first, then learning about Flask apps and how to deploy them locally. Once that is complete, try approaching the deployment to AWS.
posted by graxe at 4:12 AM on November 1, 2017

hope me please?

In my experience, there's nothing better than a project you want to make happen to get you motivated to learn something new. You're in the perfect position to make a big leap in your knowledge and ability. For the first while, everything will seem overwhelming and confusing. Flail around with Google. Flail around with trying things. Bang your head against the problem repeatedly. Gradually, bits will start to connect together. One day you'll realize that you understand most of it.

One things that sometimes shortens the flailing a bit: Google for exact error phrases, in double quotes. Or... parts of error phrases, if there's a bit that looks like it's specific to your instance.

I've approached a number of pieces of software that way when there was no-one to explain it to me and the documentation was either poor or overwhelming. In fact, I'd say I've built my career on doing that. I get too impatient to wait for someone to come along to explain everything to me, and if that person does come along I realize that I don't get most of what they're telling me anyway until I've banged my head through the problem on my own.

(I read about a study a while back which offered some support for my approach: The researchers found that when students left a class feeling confused, they did better on a subsequent test than when they left a class feeling like the teacher had explained things perfectly.)

I hope that hopes you a bit. Go forth and flail!
posted by clawsoon at 6:05 AM on November 1, 2017 [4 favorites]

In a lot of ways deployment and programming are different skills that are only partially related, so I don't entirely agree that you want to hold off until you're a black belt pythonista.

That said: This is absolutely an incredibly steep learning curve you're setting yourself. But this is probably also the easiest version of that curve and the version where copy and pasting other people's recipes will work most of the time and then you can go back and figure out what you actually did and why you had that set of arguments. It is a slightly less steep learning curve if you have some coding knowledge to draw on but there's also a lot of systems interaction that is incomprehensible for everyone the first time.

I'll endorse clawsoon above: Go flail. Lean on Google and StackOverflow, and remember an AWS instance is disposable --- if you break it, don't waste too much time trying to unbreak it, just blow it away and start fresh.
posted by PMdixon at 6:36 AM on November 1, 2017 [1 favorite]

Thanks a lot for the ideas & encouragement.

So generally the order as I understand it would be: get "generic" server capacity online (AWS), install tools to serve the content and execute the python code on the server (Nginx, uWSGI, some plugins for the python environment)?

Is the python code then compiled on my machine and uploaded as an executable to the server or does it "run" without prior outside compiling in the special environment I set up on the server?

Is there some article/book that gives a general overview of "programming" and deployment including an overview of the gritty parts of interlocking services (for deployment/load sharing/databases etc.)
posted by mathiu at 7:09 AM on November 1, 2017

(Nginx, uWSGI, some plugins for the python environment)?

No. The Python code runs directly and binds to the socket, no HTTP server required.
posted by Talez at 7:44 AM on November 1, 2017

To be honest, I'm not sure AWS would be the best start. If it's just a python flask app, your best bet would be get it running locally on a dev machine or virtual machine. Given your last set of questions, you do have a bit of a learning curve ahead of you, but nothing that's insurmountable. After you understand how it works locally, you can move on to deploying it somewhere on the web, AWS or a more "traditional" hosting service (I think WebFaction might be good for this, personally).
posted by cgg at 7:44 AM on November 1, 2017 [3 favorites]

Lightsail is pretty cheap an uses AWS without the massive AWS learning curve.
posted by Talez at 8:00 AM on November 1, 2017

OK, and the last question: what would be a fitting solution for a local VM or so on a mac - are there "prepackaged"-ISOs I can start in (what?) mac app? I have the Anaconda Navigator for exercises from the class.. (which is a development environment as I understand)
posted by mathiu at 8:03 AM on November 1, 2017

Virtualbox + Ubuntu ISO.
posted by Talez at 8:05 AM on November 1, 2017 [1 favorite]

If you have a Python or Flask meetup near you, you might want to go there and ask them questions, especially if they have an office hours event for beginners.
posted by Lycaste at 9:43 AM on November 1, 2017 [1 favorite]

It looks like this app is written to be deployed on Heroku. That's much easier than manually running an AWS instance, or setting up the databases on your own computer.

Clone the project onto your computer:
    git clone
Create a Heroku account, and create a new app in that account using the "Heroku git" deployment method. Then you can install the Heroku CLI and follow that app's instructions to "Deploy using Heroku Git"
    cd kindlebox/
    heroku git:remote -a YOUR_APP_NAME_HERE
    git push heroku master
And, from the project's Makefile, it looks like you need to do this at least once:
    heroku run 'python db upgrade'
You will need to connect a Redis DB to the app using the "Resources > Add-ons" page.

You will probably need to the set environment variables using heroku config:set

If you make changes to the source code (to fix bugs or change analytics keys, etc), you have to commit them to git in order to deploy them.
    git commit -am "DESCRIPTION OF CHANGES"
    git push heroku master

posted by Phssthpok at 8:08 PM on November 1, 2017

« Older let's scrape this thing clean!   |   EWW proofreading Newer »
This thread is closed to new comments.