I am trying to get the web, db and redis services running via docker compose but my web container keeps going down. And on inspecting the logs, i see :- urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='localhost', port=8443): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fc998b43070>: Failed to establish a new connection: [Errno 111] Connection refused'))
To Reproduce the issue :-
1. git clone https://github.com/PostHog/posthog && cd posthog and run docker-compose up -d
2. This is my docker compose file :-
services:
db:
container_name: posthog_db
environment:
POSTGRES_DB: posthog
POSTGRES_PASSWORD: posthog
POSTGRES_USER: posthog
image: postgres:alpine
volumes:
- postgres-data:/var/lib/postgresql/data
redis:
container_name: posthog_redis
image: redis:alpine
web:
container_name: posthog_web
depends_on:
- db
- redis
environment:
SKIP_SERVICE_VERSION_REQUIREMENTS: '1'
DISBALE_SECURE_SSL_REDIRECT: 'true'
SECURE_COOKIES: 'false'
DATABASE_URL: postgres://posthog:posthog@db:5432/posthog
REDIS_URL: redis://redis:6379/
SECRET_KEY: "eda6e05b653466fd47892f7b26a253eeda17e2df1d932c8022b6f0ab"
image: posthog/posthog:latest
links:
- db:db
- redis:redis
ports:
- 8000:8000
- 80:8000
volumes:
postgres-data:
version: '2'
On inspecting the logs, this is what i am seeing.
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 169, in _new_conn
conn = connection.create_connection(
File "/usr/local/lib/python3.8/site-packages/urllib3/util/connection.py", line 96, in create_connection
raise err
File "/usr/local/lib/python3.8/site-packages/urllib3/util/connection.py", line 86, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 699, in urlopen
httplib_response = self._make_request(
File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 382, in _make_request
self._validate_conn(conn)
File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn
conn.connect()
File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 353, in connect
conn = self._new_conn()
File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 181, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f7e78794190>: Failed to establish a new connection: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
resp = conn.urlopen(
File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 755, in urlopen
retries = retries.increment(
File "/usr/local/lib/python3.8/site-packages/urllib3/util/retry.py", line 574, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='localhost', port=8443): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f7e78794190>: Failed to establish a new connection: [Errno 111] Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 21, in
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.8/site-packages/django/core/management/init.py", line 419, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.8/site-packages/django/core/management/init.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 398, in execute
output = self.handle(*args, **options)
File "/home/posthog/code/ee/management/commands/migrate_clickhouse.py", line 41, in handle
self.migrate(CLICKHOUSE_HTTP_URL, options)
File "/home/posthog/code/ee/management/commands/migrate_clickhouse.py", line 44, in migrate
database = Database(
File "/usr/local/lib/python3.8/site-packages/infi/clickhouse_orm/database.py", line 111, in init
self.db_exists = self._is_existing_database()
File "/usr/local/lib/python3.8/site-packages/infi/clickhouse_orm/database.py", line 418, in _is_existing_database
r = self._send("SELECT count() FROM system.databases WHERE name = '%s'" % self.db_name)
File "/usr/local/lib/python3.8/site-packages/infi/clickhouse_orm/database.py", line 369, in _send
r = self.request_session.post(self.db_url, params=params, data=data, stream=stream, timeout=self.timeout)
File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 590, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='localhost', port=8443): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f7e78794190>: Failed to establish a new connection: [Errno 111] Connection refused'))
Environment
Ubuntu 20.04.3 LTS && Ubuntu 16.04
Docker version 20.10.9, build c2ea9bc && Docker version 19.03.12, build 48a66213fe
docker-compose version 1.22.0, build f46880fe && docker-compose version 1.8.0, build unknown