question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Docker localhost:5000 SSL timeout

See original GitHub issue

Hello,

I am getting a strange issue,

  1. http://localhost:5000/ correctly redirects to https://localhost:5000/
  2. https://localhost:5000/ does not respond and the request times out

Attempting diagnostics I ran

docker exec -t -i xxxx /bin/bash
bash-4.3# curl 127.0.0.1:5000
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>Redirecting...</title>
<h1>Redirecting...</h1>
<p>You should be redirected automatically to target URL: <a href="https://127.0.0.1:5000/">https://127.0.0.1:5000/</a>.  If not click the link.bash-4.3# 
bash-4.3# curl https://127.0.0.1:5000/
curl: (35) Unknown SSL protocol error in connection to 127.0.0.1:5000 

And from the host system

curl https://localhost:5000/manage/
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 5000 (#0)
* Operation timed out after 10002 milliseconds with 0 out of 0 bytes received
* Curl_http_done: called premature == 1
* Closing connection 0
curl: (28) Operation timed out after 10002 milliseconds with 0 out of 0 bytes received

Unsure on how to proceed at this point in time

Repo is at commit: 3de5d868e208c3d3c3d3bdca2088d64bd0035da4 Docker doorman image built from this commit, also using postgres:latest from docker hub to provide and link the postgres service

docker-compose.yml in use is:

version: '3'

services:
    postgres:
        image: postgres:latest
        ports:
            - "5432:5432"
        environment:
            - "DEBUG=true"
            - "POSTGRES_PASSWORD=t00m4nys3cr3t5"
    doorman:
        image: doorman:latest
        ports:
            - "5000:5000"
        environment:
            - "DOORMAN_ENROLL_SECRET=foo"
            - "DOORMAN_SECRETS_KEY=doorman"
            - "POSTGRES_USER=doorman"
            - "POSTGRES_PASSWORD=t00m4nys3cr3t5"
            - "POSTGRES_PORT=postgres"

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
Oneiroicommented, Jun 13, 2017

Summary of workaround:

  1. On local machine cd doorman/docker/service/api/; openssl req -new -newkey rsa:2048 -days 365 -nodes -x509 -keyout server.key -out server.crt
  2. On local machine modify doorman/docker/service/api/run to the following
#!/bin/sh

cd /src/

export DOORMAN_ENV=prod
export DOORMAN_SETTINGS=$PWD/settings.cfg

exec chpst \
  -u doorman \
  -U doorman \
  gunicorn \
    --workers 4 \
    --bind 0.0.0.0:5000 \
    manage:app \
    --certfile=server.crt \
    --keyfile=server.key
  1. On local machine run cd doorman; docker build -t doorman:latest .
  2. On local machine create docker-compose.yml similar to
version: '3'

services:
    postgres:
        image: postgres:latest
        ports:
            - "5432:5432"
        environment:
            - "DEBUG=true"
            - "POSTGRES_PASSWORD=t00m4nys3cr3t5"
    doorman:
        image: doorman:latest
        ports:
            - "5000:5000"
        environment:
            - "DOORMAN_ENROLL_SECRET=foo"
            - "DOORMAN_SECRETS_KEY=doorman"
            - "POSTGRES_USER=doorman"
            - "POSTGRES_PASSWORD=t00m4nys3cr3t5"
            - "POSTGRES_PORT=postgres"
  1. On local machine run docker-compose up
  2. In a new terminal tab attach to the docker container using docker exec -ti <hash_of_container> /bin/bash (run docker ps -a to get the hash)
  3. Once attached to doorman container run
cp /etc/service/api/server.* /src/
chown doorman:doorman -R /src
cd /src
sed -i "s|SQLALCHEMY_DATABASE_URI.*|SQLALCHEMY_DATABASE_URI = 'postgresql://doorman:t00m4nys3cr3t5@postgres:5432/doorman'|g" /src/doorman/settings.py
python manage.py db upgrade
  1. Now from host machine open https://127.0.0.1:5000/manage you should be able to navigate without error and add queries etc from the interface, if not see steps taken in https://github.com/mwielgoszewski/doorman/issues/101#issuecomment-308073101 for setting the postgres container up.
0reactions
mwielgoszewskicommented, Aug 18, 2017

Do you mind submitting a PR to fix up these issues?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Deploying a minimal flask app in docker - server connection ...
The problem is you are only binding to the localhost interface, you should be binding to 0.0.0.0 if you want the container to...
Read more >
Configuring a registry - Docker Documentation
The timeout for writing to the Redis instance. pool. pool: maxidle: 16 maxactive: 64 idletimeout: 300s. Use these settings to configure the behavior ......
Read more >
How To Set Up a Private Docker Registry on Ubuntu 14.04
Publish to and pull Docker images from your own private Docker ... If you already have an SSL certificate set up or are...
Read more >
docker_image – Manage docker images — Ansible Documentation
Parameters¶ ; http_timeout. integer. Timeout for HTTP requests during the image build operation. Provide a positive integer value for the number of seconds....
Read more >
Setting Up Docker Registry 2.0 Using Cloud Storage
Docker allows users to push and pull images from a registry. The primary, and default, ... Next, generate your SSL signed certificates:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found