[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

watchtower makes Django inside docker unaccesible #190

Open
benjujo opened this issue Sep 5, 2023 · 0 comments
Open

watchtower makes Django inside docker unaccesible #190

benjujo opened this issue Sep 5, 2023 · 0 comments

Comments

@benjujo
Copy link
benjujo commented Sep 5, 2023

Setting the LOGGING variable using watchtower in settings.py makes the application unaccesible from the host machine.

The way is configured (settings.py):

import boto3
...
boto3_logs_client = boto3.client(
    "logs",
    aws_access_key_id=AWS_ACCESS_KEY_ID,
    aws_secret_access_key=AWS_SECRET_ACCESS_KEY,
    region_name=AWS_S3_REGION_NAME)

LOGGING = {
    ...
    'handlers' = {
        'watchtower': {
            'level': 'DEBUG',
            'class': 'watchtower.CloudWatchLogHandler',
                     'boto3_client': boto3_logs_client,
                     'log_group': 'the_logs_group',
                     'stream_name': "{machine_name}_{logger_name}",
            'formatter': 'aws', # 'aws' is defined in formatters
        }
    }
    ...
}

When i tried to curl to http://127.0.0.1:8000 throws:

curl: (56) Recv failure: Connection reset by peer

This behavior happens just when using watchower. If I delete the watchtower handler everything works fine.

More context:
Running docker ps seems to be OK:

CONTAINER ID   IMAGE                                COMMAND                  CREATED        STATUS          PORTS                                       NAMES
1232190abcde   docker_image_name                    "python manage.py ru…"   2 hours ago    Up 37 seconds   0.0.0.0:8000->8000/tcp, :::8000->8000/tcp   docker_container_name

And running netstat -atpn:

(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:8000            0.0.0.0:*               LISTEN      -
tcp6       0      0 :::8000                 :::*                    LISTEN      -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant