The Big Picture

I have a Flask site which-- previously-- was running successfully on Ubuntu on Linode. I bootstrapped it with Yeoman, and as a result, I did not need to figure out the difference between nginx, wsgi/Werkzeug, and gunicorn.

However, that is biting me in the butt now that I'm trying to migrate it to my first Digitalocean droplet, using their pre-configured disk image of Ubuntu 16.04 with Dokku 0.7.2. This is my first time with Docker or Dokku, or containerization in general.

Dokku did not give an error when deploying my Flask app-- it told me the app is running on my droplet's IP address followed by :17520. (I am not using a domain name, just the IP address.)

Problem Definition

My site does not respond to HTTP requests, despite Dokku saying it succeeded in deployment. Chrome says "This site can't be reached".

Solutions I've Already Tried

It took a few tries for Dokku to deploy my app without an error, because I needed to add some files to the root of my local repository and try pushing it again.

The Procfile

First I needed Procfile, which contains the single line web: python run.py where run.py is:

from app import app app.run(host = '', debug = True)

Ignoring My Node.js Dev Tooling

Next I needed to prevent Dokku from seeing my Node.js development tooling and trying to deploy this as a Node.js app. So I added .slugignore containing the single line package.json, and .buildpacks containing the single line https://github.com/heroku/heroku-buildpack-python and pushed again to git push dokku.


Yeoman did not include gunicorn when I bootstrapped this app-- just nginx and wsgi/Werkzeug. I noticed all Python Procfile examples used gunicorn as the HTTP server, so I added gunicorn==0.17.2 to my requirements.txt. I changedProcfiletoweb: gunicorn app:app`. Dokku did not throw an error when installing this version, but there is still no response to HTTP requests.


Dokku log

When I log on to my droplet and run the command dokku log [my_app_name], it says:

2017-01-17T17:11:04.733185275Z app[web.1]: * Running on (Press CTRL+C to quit) 2017-01-17T17:11:04.734938531Z app[web.1]: * Restarting with stat 2017-01-17T17:11:05.024834922Z app[web.1]: * Debugger is active! 2017-01-17T17:11:05.029750092Z app[web.1]: * Debugger pin code: 208-261-801 So I also tried to append :5000 to the IP address. And of course, just to be safe, I tried port 80 too. Still no luck.

After I installed gunicorn, the log read:

2017-01-18T17:09:38.303046670Z app[web.1]: 2017-01-18 17:09:38 [8] [INFO] Starting gunicorn 0.17.2 2017-01-18T17:09:38.303864158Z app[web.1]: 2017-01-18 17:09:38 [8] [INFO] Listening at: (8) 2017-01-18T17:09:38.304140278Z app[web.1]: 2017-01-18 17:09:38 [8] [INFO] Using worker: sync 2017-01-18T17:09:38.310057688Z app[web.1]: 2017-01-18 17:09:38 [148] [INFO] Booting worker with pid: 148


Still logged in to my droplet, I went to var/log/dokku and opened the file events.log, ending with this: Jan 17 16:27:55 [my-app-name] dokku-installer.py[7291]: - - [17/Jan/2017 16:27:55] "GET /favicon.ico HTTP/1.0" 200 - Jan 17 16:28:27 [my-app-name] dokku-installer.py[7291]: - - [17/Jan/2017 16:28:27] "HEAD / HTTP/1.0" 200 - Jan 17 16:29:49 [my-app-name] dokku-installer.py[7291]: SHA256: [then the SHA] Jan 17 16:29:50 [my-app-name] dokku-installer.py[7291]: - - [17/Jan/2017 16:29:50] "POST /setup HTTP/1.0" 200 - Jan 17 16:29:50 [my-app-name] dokku-installer.py[7291]: Stopping nginx (via systemctl): nginx.service. Jan 17 16:29:51 [my-app-name] dokku-installer.py[7291]: Starting nginx (via systemctl): nginx.service. Jan 17 16:29:51 [my-app-name] dokku-installer.py[7291]: /bin/sh: 1: stop: not found

  • 2
    Wow, there's a wall of text. You need to make your question easy to understand if you want answers. Suggest you edit your question to start with big picture and problem definition. You need to include appropriate configuration, logs, and potentially curl headers depending on the problem. – Tim Jan 18 '17 at 0:55
  • I hope this edit is better. – user2605279 Jan 18 '17 at 17:32
  • Do some basic problem solving. Try to ping your server. Next install a basic web server (nginx/apache) and get their hello world page up. Continue on. There's not enough information to diagnose the "This site can't be reached" message. – Tim Jan 18 '17 at 18:16

What is your nginx configuration and nginx logs? Is this nginx instance running natively on the host and managed with systemd?

What does netstat -tulpn on the server say?

Do you see port 5000 from the container forwarded to a port on the host computer? (check docker ps for this information)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.