skip to Main Content

Using DigitalOcean droplet with IPv4 147.182.203.240. Followed the Dokku tutorial with some changes, which I’ll list here. The list also includes things I’ve already tried

  • App built from Dockerfile. Container exposes port 3000 through EXPOSE
  • Setting path for correct Dockerfile with dokku builder-dockerfile:set myapp dockerfile-path .dokku/Dockerfile
  • Set config.force_ssl = false on production.rb
  • As recommended on some sites, nginx’s sites-enabled/default folder was deleted. Nginx then restarted but no changes. Even after this change, Nginx home page stills shows up intermittently when you visit the drolet IP: http://147.182.203.240.
  • Following Dokku docs on EXPOSE, added a map from 3000 to 80, and deleted map from 000 to 3000. dokku ports:list returns:
dokku ports:list blog-demo
-----> Port mappings for blog-demo
    -----> scheme  host port  container port
    http           80         3000

dokku domains:report returns:

dokku domains:report
=====> blog-demo domains information
       Domains app enabled:           true
       Domains app vhosts:            147.182.203.240
       Domains global enabled:        true
       Domains global vhosts:         packer-6481b5fa-f32f-c6ab-b44d-a2621ac2dcee
  • Finally added firewall exception to port 3000: sudo ufw allow 3000/tcp. IP still shows nginx home page, or "Unable to connect" message. However IP:3000 shows a blue screenenter image description here However rails app logs don’t show nothing relevant.

App is apparently running without issues, I can see the usual Puma logs when server starts (Listening on http://127.0.0.1:3000), but I’m unable to connect the app with the IP to see the Rails home page. Any suggestions are welcomed.

2

Answers


  1. Chosen as BEST ANSWER

    After a completely clean re-try, it looks like there was a mix of settings from an older Dokku version.

    Digital Ocean's 1-click Dokku droplet does not include the latest Dokku version. After an initial setup, I upgraded the version without any success to the deployment. As a last resource, I created a non-1-click droplet and then installed Dokku manually, everything works as expected.

    There are already issues in the official repo, so nothing new to add.


  2. This is not an answer but rather a big comment. Also I don’t deploy with Dokku neither Docker.

    Though with NGINX, if you expose only ports 80 (http) and 443 (https), which is the desired behavior, you can usually no longer reach your website with the ip address only. Nginx server directives resolve the domain into an app served on the machine. This allows to have multiple websites running on the same server.

    Like you could have two rails app running on your droplet, one with puma running on 3000 and another with puma running on 3001. When you type the url mywebsite.com then NGINX will resolve to 3000 and if you type myotherwebsite.com NGINX will send to 3001.

    This is NGINX server directives that does this balancing.

    So it is hard to tell what is happening until you know what Dokku is actually doing under the hood.

    Also folder sites-enabled in Nginx, usually contains symlinks, to files located in sites-available folder where the Nginx config is located for your websites.
    Then Nginx compiles everything it finds in sites-enabled (that is just links to sites-available folder) into a big configuration file. If you have no longer any symlink in sites-enabled then Nginx config is blank.
    (Also Nginx is highly configurable, so things might be different depending on how Dokku configures it)

    So I suggest to have a look into Nginx sites-available folder to see what actually dokku is doing to proxy your website.

    If you see something like :

    server {
      listen 80 ;
      listen [::]:80 ;
      server_name mywebsite.com www.mywebsite.com;
    

    Then it means you can only reach your website through mywebsite.com or www.mywebsite.com and no longer through 147.182.203.240

    (Also I suggest to keep everything as is in sites-enabled so the config in sites-available is used)

    If you have a spare domain name, just go to your DNS setting, and do an A to 147.182.203.240, then tells Dokku this is your domain and check what happens.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search