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

Not working. The script is not reading the environment variables. #10

Open
ilovefreesw opened this issue Jun 23, 2023 · 7 comments
Open

Comments

@ilovefreesw
Copy link

The script is not reading the environment variables that I supply in Terminal. It doesn't even take them if I hard code them in docker compose file. I get error as well.

clickhouse install es

hardcoded envs

housewatch-redis-1   | 1:C 23 Jun 2023 10:18:42.468 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
housewatch-redis-1   | 1:C 23 Jun 2023 10:18:42.472 # Redis version=6.2.7, bits=64, commit=00000000, modified=0, pid=1, just started
housewatch-redis-1   | 1:C 23 Jun 2023 10:18:42.472 # Configuration loaded
housewatch-redis-1   | 1:M 23 Jun 2023 10:18:42.477 * Increased maximum number of open files to 10032 (it was originally set to 1024).
housewatch-redis-1   | 1:M 23 Jun 2023 10:18:42.479 * monotonic clock: POSIX clock_gettime
housewatch-redis-1   | 1:M 23 Jun 2023 10:18:42.484 # A key '__redis__compare_helper' was added to Lua globals which is not on the globals allow list nor listed on the deny list.
housewatch-redis-1   | 1:M 23 Jun 2023 10:18:42.484 * Running mode=standalone, port=6379.
housewatch-redis-1   | 1:M 23 Jun 2023 10:18:42.485 # Server initialized
housewatch-redis-1   | 1:M 23 Jun 2023 10:18:42.485 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
housewatch-redis-1   | 1:M 23 Jun 2023 10:18:42.487 * Loading RDB produced by version 6.2.7
housewatch-redis-1   | 1:M 23 Jun 2023 10:18:42.491 * RDB age 33 seconds
housewatch-redis-1   | 1:M 23 Jun 2023 10:18:42.491 * RDB memory usage when created 0.77 Mb
housewatch-redis-1   | 1:M 23 Jun 2023 10:18:42.492 # Done loading RDB, keys loaded: 0, keys expired: 0.
housewatch-redis-1   | 1:M 23 Jun 2023 10:18:42.492 * DB loaded from disk: 0.006 seconds
housewatch-redis-1   | 1:M 23 Jun 2023 10:18:42.493 * Ready to accept connections
housewatch-web-1     |  INFO  Accepting connections at http://localhost:3000
housewatch-app-1     | Failed to connect to :9440
housewatch-app-1     | Traceback (most recent call last):
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 342, in connect
housewatch-app-1     |     return self._init_connection(host, port)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 306, in _init_connection
housewatch-app-1     |     self.socket = self._create_socket(host, port)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 257, in _create_socket
housewatch-app-1     |     for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM):
housewatch-app-1     |   File "/usr/local/lib/python3.10/socket.py", line 955, in getaddrinfo
housewatch-app-1     |     for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
housewatch-app-1     | socket.gaierror: [Errno -2] Name or service not known
housewatch-app-1     | Traceback (most recent call last):
housewatch-app-1     |   File "/code/manage.py", line 22, in <module>
housewatch-app-1     |     main()
housewatch-app-1     |   File "/code/manage.py", line 18, in main
housewatch-app-1     |     execute_from_command_line(sys.argv)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
housewatch-app-1     |     utility.execute()
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 440, in execute
housewatch-app-1     |     self.fetch_command(subcommand).run_from_argv(self.argv)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 402, in run_from_argv
housewatch-app-1     |     self.execute(*args, **cmd_options)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 448, in execute
housewatch-app-1     |     output = self.handle(*args, **options)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 96, in wrapped
housewatch-app-1     |     res = handle_func(*args, **kwargs)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/core/management/commands/migrate.py", line 97, in handle
housewatch-app-1     |     self.check(databases=[database])
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 475, in check
housewatch-app-1     |     all_issues = checks.run_checks(
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/core/checks/registry.py", line 88, in run_checks
housewatch-app-1     |     new_errors = check(app_configs=app_configs, databases=databases)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/core/checks/urls.py", line 14, in check_url_config
housewatch-app-1     |     return check_resolver(resolver)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/core/checks/urls.py", line 24, in check_resolver
housewatch-app-1     |     return check_method()
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/urls/resolvers.py", line 494, in check
housewatch-app-1     |     for pattern in self.url_patterns:
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/utils/functional.py", line 57, in __get__
housewatch-app-1     |     res = instance.__dict__[self.name] = self.func(instance)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/urls/resolvers.py", line 715, in url_patterns
housewatch-app-1     |     patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/utils/functional.py", line 57, in __get__
housewatch-app-1     |     res = instance.__dict__[self.name] = self.func(instance)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/urls/resolvers.py", line 708, in urlconf_module
housewatch-app-1     |     return import_module(self.urlconf_name)
housewatch-app-1     |   File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
housewatch-app-1     |     return _bootstrap._gcd_import(name[level:], package, level)
housewatch-app-1     |   File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
housewatch-app-1     |   File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
housewatch-app-1     |   File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
housewatch-app-1     |   File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
housewatch-app-1     |   File "<frozen importlib._bootstrap_external>", line 883, in exec_module
housewatch-app-1     |   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
housewatch-app-1     |   File "/code/housewatch/urls.py", line 6, in <module>
housewatch-app-1     |     from housewatch.api.analyze import AnalyzeViewset
housewatch-app-1     |   File "/code/housewatch/api/analyze.py", line 5, in <module>
housewatch-app-1     |     from housewatch.clickhouse.client import run_query, ch_host, existing_system_tables
housewatch-app-1     |   File "/code/housewatch/clickhouse/client.py", line 59, in <module>
housewatch-app-1     |     existing_system_tables = [row["name"] for row in run_query(EXISTING_TABLES_SQL, use_cache=False)]
housewatch-app-1     |   File "/code/housewatch/clickhouse/client.py", line 46, in run_query
housewatch-app-1     |     result = client.execute(final_query, settings=settings, with_column_types=True, query_id=query_id)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/client.py", line 345, in execute
housewatch-app-1     |     with self.disconnect_on_error(query, settings):
housewatch-app-1     |   File "/usr/local/lib/python3.10/contextlib.py", line 135, in __enter__
housewatch-app-1     |     return next(self.gen)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/client.py", line 289, in disconnect_on_error
housewatch-app-1     |     self.establish_connection(settings)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/client.py", line 276, in establish_connection
housewatch-app-1     |     self.connection.force_connect()
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 235, in force_connect
housewatch-app-1     |     self.connect()
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 363, in connect
housewatch-app-1     |     raise err
housewatch-app-1     | clickhouse_driver.errors.NetworkError: Code: 210. Name or service not known (:9440)
housewatch-worker-1  | Failed to connect to :9440
housewatch-worker-1  | Traceback (most recent call last):
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 342, in connect
housewatch-worker-1  |     return self._init_connection(host, port)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 306, in _init_connection
housewatch-worker-1  |     self.socket = self._create_socket(host, port)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 257, in _create_socket
housewatch-worker-1  |     for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM):
housewatch-worker-1  |   File "/usr/local/lib/python3.10/socket.py", line 955, in getaddrinfo
housewatch-worker-1  |     for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
housewatch-worker-1  | socket.gaierror: [Errno -2] Name or service not known
housewatch-worker-1  | Traceback (most recent call last):
housewatch-worker-1  |   File "/usr/local/bin/celery", line 8, in <module>
housewatch-worker-1  |     sys.exit(main())
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/celery/__main__.py", line 15, in main
housewatch-worker-1  |     sys.exit(_main())
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/celery/bin/celery.py", line 217, in main
housewatch-worker-1  |     return celery(auto_envvar_prefix="CELERY")
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
housewatch-worker-1  |     return self.main(*args, **kwargs)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1055, in main
housewatch-worker-1  |     rv = self.invoke(ctx)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
housewatch-worker-1  |     return _process_result(sub_ctx.command.invoke(sub_ctx))
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
housewatch-worker-1  |     return ctx.invoke(self.callback, **ctx.params)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/click/core.py", line 760, in invoke
housewatch-worker-1  |     return __callback(*args, **kwargs)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func
housewatch-worker-1  |     return f(get_current_context(), *args, **kwargs)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/celery/bin/base.py", line 134, in caller
housewatch-worker-1  |     return f(ctx, *args, **kwargs)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/celery/bin/worker.py", line 343, in worker
housewatch-worker-1  |     worker = app.Worker(
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/celery/worker/worker.py", line 94, in __init__
housewatch-worker-1  |     self.app.loader.init_worker()
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/celery/loaders/base.py", line 111, in init_worker
housewatch-worker-1  |     self.import_default_modules()
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/celery/loaders/base.py", line 105, in import_default_modules
housewatch-worker-1  |     raise response
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/celery/utils/dispatch/signal.py", line 276, in send
housewatch-worker-1  |     response = receiver(signal=self, sender=sender, **named)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/celery/fixups/django.py", line 82, in on_import_modules
housewatch-worker-1  |     self.worker_fixup.validate_models()
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/celery/fixups/django.py", line 121, in validate_models
housewatch-worker-1  |     run_checks()
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/django/core/checks/registry.py", line 88, in run_checks
housewatch-worker-1  |     new_errors = check(app_configs=app_configs, databases=databases)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/django/core/checks/urls.py", line 14, in check_url_config
housewatch-worker-1  |     return check_resolver(resolver)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/django/core/checks/urls.py", line 24, in check_resolver
housewatch-worker-1  |     return check_method()
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/django/urls/resolvers.py", line 494, in check
housewatch-worker-1  |     for pattern in self.url_patterns:
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/django/utils/functional.py", line 57, in __get__
housewatch-worker-1  |     res = instance.__dict__[self.name] = self.func(instance)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/django/urls/resolvers.py", line 715, in url_patterns
housewatch-worker-1  |     patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/django/utils/functional.py", line 57, in __get__
housewatch-worker-1  |     res = instance.__dict__[self.name] = self.func(instance)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/django/urls/resolvers.py", line 708, in urlconf_module
housewatch-worker-1  |     return import_module(self.urlconf_name)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
housewatch-worker-1  |     return _bootstrap._gcd_import(name[level:], package, level)
housewatch-worker-1  |   File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
housewatch-worker-1  |   File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
housewatch-worker-1  |   File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
housewatch-worker-1  |   File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
housewatch-worker-1  |   File "<frozen importlib._bootstrap_external>", line 883, in exec_module
housewatch-worker-1  |   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
housewatch-worker-1  |   File "/code/housewatch/urls.py", line 6, in <module>
housewatch-worker-1  |     from housewatch.api.analyze import AnalyzeViewset
housewatch-worker-1  |   File "/code/housewatch/api/analyze.py", line 5, in <module>
housewatch-worker-1  |     from housewatch.clickhouse.client import run_query, ch_host, existing_system_tables
housewatch-worker-1  |   File "/code/housewatch/clickhouse/client.py", line 59, in <module>
housewatch-worker-1  |     existing_system_tables = [row["name"] for row in run_query(EXISTING_TABLES_SQL, use_cache=False)]
housewatch-worker-1  |   File "/code/housewatch/clickhouse/client.py", line 46, in run_query
housewatch-worker-1  |     result = client.execute(final_query, settings=settings, with_column_types=True, query_id=query_id)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/client.py", line 345, in execute
housewatch-worker-1  |     with self.disconnect_on_error(query, settings):
housewatch-worker-1  |   File "/usr/local/lib/python3.10/contextlib.py", line 135, in __enter__
housewatch-worker-1  |     return next(self.gen)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/client.py", line 289, in disconnect_on_error
housewatch-worker-1  |     self.establish_connection(settings)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/client.py", line 276, in establish_connection
housewatch-worker-1  |     self.connection.force_connect()
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 235, in force_connect
housewatch-worker-1  |     self.connect()
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 363, in connect
housewatch-worker-1  |     raise err
housewatch-worker-1  | clickhouse_driver.errors.NetworkError: Code: 210. Name or service not known (:9440)
housewatch-worker-1 exited with code 1
housewatch-app-1     | Performing system checks...
housewatch-app-1     | 
housewatch-app-1     | Failed to connect to :9440
housewatch-app-1     | Traceback (most recent call last):
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 342, in connect
housewatch-app-1     |     return self._init_connection(host, port)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 306, in _init_connection
housewatch-app-1     |     self.socket = self._create_socket(host, port)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 257, in _create_socket
housewatch-app-1     |     for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM):
housewatch-app-1     |   File "/usr/local/lib/python3.10/socket.py", line 955, in getaddrinfo
housewatch-app-1     |     for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
housewatch-app-1     | socket.gaierror: [Errno -2] Name or service not known
housewatch-app-1     | Failed to connect to :9440
housewatch-app-1     | Traceback (most recent call last):
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 342, in connect
housewatch-app-1     |     return self._init_connection(host, port)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 306, in _init_connection
housewatch-app-1     |     self.socket = self._create_socket(host, port)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 257, in _create_socket
housewatch-app-1     |     for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM):
housewatch-app-1     |   File "/usr/local/lib/python3.10/socket.py", line 955, in getaddrinfo
housewatch-app-1     |     for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
housewatch-app-1     | socket.gaierror: [Errno -2] Name or service not known
housewatch-app-1     | Exception in thread django-main-thread:
housewatch-app-1     | Traceback (most recent call last):
housewatch-app-1     |   File "/usr/local/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
housewatch-app-1     |     self.run()
housewatch-app-1     |   File "/usr/local/lib/python3.10/threading.py", line 953, in run
housewatch-app-1     |     self._target(*self._args, **self._kwargs)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/utils/autoreload.py", line 64, in wrapper
housewatch-app-1     |     fn(*args, **kwargs)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/core/management/commands/runserver.py", line 134, in inner_run
housewatch-app-1     |     self.check(display_num_errors=True)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 475, in check
housewatch-app-1     |     all_issues = checks.run_checks(
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/core/checks/registry.py", line 88, in run_checks
housewatch-app-1     |     new_errors = check(app_configs=app_configs, databases=databases)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/core/checks/urls.py", line 14, in check_url_config
housewatch-app-1     |     return check_resolver(resolver)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/core/checks/urls.py", line 24, in check_resolver
housewatch-app-1     |     return check_method()
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/urls/resolvers.py", line 494, in check
housewatch-app-1     |     for pattern in self.url_patterns:
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/utils/functional.py", line 57, in __get__
housewatch-app-1     |     res = instance.__dict__[self.name] = self.func(instance)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/urls/resolvers.py", line 715, in url_patterns
housewatch-app-1     |     patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/utils/functional.py", line 57, in __get__
housewatch-app-1     |     res = instance.__dict__[self.name] = self.func(instance)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/urls/resolvers.py", line 708, in urlconf_module
housewatch-app-1     |     return import_module(self.urlconf_name)
housewatch-app-1     |   File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
housewatch-app-1     |     return _bootstrap._gcd_import(name[level:], package, level)
housewatch-app-1     |   File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
housewatch-app-1     |   File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
housewatch-app-1     |   File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
housewatch-app-1     |   File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
housewatch-app-1     |   File "<frozen importlib._bootstrap_external>", line 883, in exec_module
housewatch-app-1     |   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
housewatch-app-1     |   File "/code/housewatch/urls.py", line 6, in <module>
housewatch-app-1     |     from housewatch.api.analyze import AnalyzeViewset
housewatch-app-1     |   File "/code/housewatch/api/analyze.py", line 5, in <module>
housewatch-app-1     |     from housewatch.clickhouse.client import run_query, ch_host, existing_system_tables
housewatch-app-1     |   File "/code/housewatch/clickhouse/client.py", line 59, in <module>
housewatch-app-1     |     existing_system_tables = [row["name"] for row in run_query(EXISTING_TABLES_SQL, use_cache=False)]
housewatch-app-1     |   File "/code/housewatch/clickhouse/client.py", line 46, in run_query
housewatch-app-1     |     result = client.execute(final_query, settings=settings, with_column_types=True, query_id=query_id)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/client.py", line 345, in execute
housewatch-app-1     |     with self.disconnect_on_error(query, settings):
housewatch-app-1     |   File "/usr/local/lib/python3.10/contextlib.py", line 135, in __enter__
housewatch-app-1     |     return next(self.gen)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/client.py", line 289, in disconnect_on_error
housewatch-app-1     |     self.establish_connection(settings)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/client.py", line 276, in establish_connection
housewatch-app-1     |     self.connection.force_connect()
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 235, in force_connect
housewatch-app-1     |     self.connect()
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 363, in connect
housewatch-app-1     |     raise err
housewatch-app-1     | clickhouse_driver.errors.NetworkError: Code: 210. Name or service not known (:9440)
^CGracefully stopping... (press Ctrl+C again to force)

@yakkomajuri
Copy link
Contributor

Hey @ilovefreesw! Try setting CLICKHOUSE_SECURE=False and see if that works

@ilovefreesw
Copy link
Author

No sir .. it still doesn't work.

ilfs@ilfs-80xv:~/Public/project/HouseWatch$ CLICKHOUSE_HOST=localhost \
CLICKHOUSE_CLUSTER=default \
CLICKHOUSE_USER=default \
CLICKHOUSE_PASSWORD=1234 \
CLICKHOUSE_SECURE=False \
docker compose -f docker-compose.yml up
WARN[0000] The "CLICKHOUSE_CA" variable is not set. Defaulting to a blank string. 
WARN[0000] The "CLICKHOUSE_DATABASE" variable is not set. Defaulting to a blank string. 
WARN[0000] The "CLICKHOUSE_VERIFY" variable is not set. Defaulting to a blank string. 
WARN[0000] The "CLICKHOUSE_VERIFY" variable is not set. Defaulting to a blank string. 
WARN[0000] The "CLICKHOUSE_DATABASE" variable is not set. Defaulting to a blank string. 
WARN[0000] The "CLICKHOUSE_CA" variable is not set. Defaulting to a blank string. 
[+] Running 4/4
 ✔ Container housewatch-worker-1  Recreated                                                                                                  0.3s 
 ✔ Container housewatch-web-1     Created                                                                                                    0.0s 
 ✔ Container housewatch-app-1     Recreated                                                                                                  0.3s 
 ✔ Container housewatch-redis-1   Created                                                                                                    0.0s 
Attaching to housewatch-app-1, housewatch-redis-1, housewatch-web-1, housewatch-worker-1
housewatch-redis-1   | 1:C 26 Jun 2023 07:09:01.854 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
housewatch-redis-1   | 1:C 26 Jun 2023 07:09:01.854 # Redis version=6.2.7, bits=64, commit=00000000, modified=0, pid=1, just started
housewatch-redis-1   | 1:C 26 Jun 2023 07:09:01.854 # Configuration loaded
housewatch-redis-1   | 1:M 26 Jun 2023 07:09:01.865 * Increased maximum number of open files to 10032 (it was originally set to 1024).
housewatch-redis-1   | 1:M 26 Jun 2023 07:09:01.865 * monotonic clock: POSIX clock_gettime
housewatch-redis-1   | 1:M 26 Jun 2023 07:09:01.866 # A key '__redis__compare_helper' was added to Lua globals which is not on the globals allow list nor listed on the deny list.
housewatch-redis-1   | 1:M 26 Jun 2023 07:09:01.866 * Running mode=standalone, port=6379.
housewatch-redis-1   | 1:M 26 Jun 2023 07:09:01.866 # Server initialized
housewatch-redis-1   | 1:M 26 Jun 2023 07:09:01.866 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
housewatch-redis-1   | 1:M 26 Jun 2023 07:09:01.866 * Loading RDB produced by version 6.2.7
housewatch-redis-1   | 1:M 26 Jun 2023 07:09:01.867 * RDB age 5 seconds
housewatch-redis-1   | 1:M 26 Jun 2023 07:09:01.867 * RDB memory usage when created 0.77 Mb
housewatch-redis-1   | 1:M 26 Jun 2023 07:09:01.867 # Done loading RDB, keys loaded: 0, keys expired: 0.
housewatch-redis-1   | 1:M 26 Jun 2023 07:09:01.867 * DB loaded from disk: 0.000 seconds
housewatch-redis-1   | 1:M 26 Jun 2023 07:09:01.867 * Ready to accept connections
housewatch-web-1     |  INFO  Accepting connections at http://localhost:3000
housewatch-app-1     | Failed to connect to localhost:9000
housewatch-app-1     | Traceback (most recent call last):
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 342, in connect
housewatch-app-1     |     return self._init_connection(host, port)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 306, in _init_connection
housewatch-app-1     |     self.socket = self._create_socket(host, port)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 278, in _create_socket
housewatch-app-1     |     raise err
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 269, in _create_socket
housewatch-app-1     |     sock.connect(sa)
housewatch-app-1     | OSError: [Errno 99] Cannot assign requested address
housewatch-app-1     | Traceback (most recent call last):
housewatch-app-1     |   File "/code/manage.py", line 22, in <module>
housewatch-app-1     |     main()
housewatch-app-1     |   File "/code/manage.py", line 18, in main
housewatch-app-1     |     execute_from_command_line(sys.argv)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
housewatch-app-1     |     utility.execute()
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 440, in execute
housewatch-app-1     |     self.fetch_command(subcommand).run_from_argv(self.argv)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 402, in run_from_argv
housewatch-app-1     |     self.execute(*args, **cmd_options)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 448, in execute
housewatch-app-1     |     output = self.handle(*args, **options)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 96, in wrapped
housewatch-app-1     |     res = handle_func(*args, **kwargs)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/core/management/commands/migrate.py", line 97, in handle
housewatch-app-1     |     self.check(databases=[database])
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 475, in check
housewatch-app-1     |     all_issues = checks.run_checks(
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/core/checks/registry.py", line 88, in run_checks
housewatch-app-1     |     new_errors = check(app_configs=app_configs, databases=databases)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/core/checks/urls.py", line 14, in check_url_config
housewatch-app-1     |     return check_resolver(resolver)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/core/checks/urls.py", line 24, in check_resolver
housewatch-app-1     |     return check_method()
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/urls/resolvers.py", line 494, in check
housewatch-app-1     |     for pattern in self.url_patterns:
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/utils/functional.py", line 57, in __get__
housewatch-app-1     |     res = instance.__dict__[self.name] = self.func(instance)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/urls/resolvers.py", line 715, in url_patterns
housewatch-app-1     |     patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/utils/functional.py", line 57, in __get__
housewatch-app-1     |     res = instance.__dict__[self.name] = self.func(instance)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/urls/resolvers.py", line 708, in urlconf_module
housewatch-app-1     |     return import_module(self.urlconf_name)
housewatch-app-1     |   File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
housewatch-app-1     |     return _bootstrap._gcd_import(name[level:], package, level)
housewatch-app-1     |   File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
housewatch-app-1     |   File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
housewatch-app-1     |   File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
housewatch-app-1     |   File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
housewatch-app-1     |   File "<frozen importlib._bootstrap_external>", line 883, in exec_module
housewatch-app-1     |   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
housewatch-app-1     |   File "/code/housewatch/urls.py", line 6, in <module>
housewatch-app-1     |     from housewatch.api.analyze import AnalyzeViewset
housewatch-app-1     |   File "/code/housewatch/api/analyze.py", line 5, in <module>
housewatch-app-1     |     from housewatch.clickhouse.client import run_query, ch_host, existing_system_tables
housewatch-app-1     |   File "/code/housewatch/clickhouse/client.py", line 59, in <module>
housewatch-app-1     |     existing_system_tables = [row["name"] for row in run_query(EXISTING_TABLES_SQL, use_cache=False)]
housewatch-app-1     |   File "/code/housewatch/clickhouse/client.py", line 46, in run_query
housewatch-app-1     |     result = client.execute(final_query, settings=settings, with_column_types=True, query_id=query_id)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/client.py", line 345, in execute
housewatch-app-1     |     with self.disconnect_on_error(query, settings):
housewatch-app-1     |   File "/usr/local/lib/python3.10/contextlib.py", line 135, in __enter__
housewatch-app-1     |     return next(self.gen)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/client.py", line 289, in disconnect_on_error
housewatch-app-1     |     self.establish_connection(settings)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/client.py", line 276, in establish_connection
housewatch-app-1     |     self.connection.force_connect()
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 235, in force_connect
housewatch-app-1     |     self.connect()
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 363, in connect
housewatch-app-1     |     raise err
housewatch-app-1     | clickhouse_driver.errors.NetworkError: Code: 210. Cannot assign requested address (localhost:9000)
housewatch-worker-1  | Failed to connect to localhost:9000
housewatch-worker-1  | Traceback (most recent call last):
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 342, in connect
housewatch-worker-1  |     return self._init_connection(host, port)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 306, in _init_connection
housewatch-worker-1  |     self.socket = self._create_socket(host, port)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 278, in _create_socket
housewatch-worker-1  |     raise err
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 269, in _create_socket
housewatch-worker-1  |     sock.connect(sa)
housewatch-worker-1  | OSError: [Errno 99] Cannot assign requested address
housewatch-worker-1  | Traceback (most recent call last):
housewatch-worker-1  |   File "/usr/local/bin/celery", line 8, in <module>
housewatch-worker-1  |     sys.exit(main())
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/celery/__main__.py", line 15, in main
housewatch-worker-1  |     sys.exit(_main())
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/celery/bin/celery.py", line 217, in main
housewatch-worker-1  |     return celery(auto_envvar_prefix="CELERY")
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
housewatch-worker-1  |     return self.main(*args, **kwargs)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1055, in main
housewatch-worker-1  |     rv = self.invoke(ctx)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
housewatch-worker-1  |     return _process_result(sub_ctx.command.invoke(sub_ctx))
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
housewatch-worker-1  |     return ctx.invoke(self.callback, **ctx.params)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/click/core.py", line 760, in invoke
housewatch-worker-1  |     return __callback(*args, **kwargs)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func
housewatch-worker-1  |     return f(get_current_context(), *args, **kwargs)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/celery/bin/base.py", line 134, in caller
housewatch-worker-1  |     return f(ctx, *args, **kwargs)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/celery/bin/worker.py", line 343, in worker
housewatch-worker-1  |     worker = app.Worker(
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/celery/worker/worker.py", line 94, in __init__
housewatch-worker-1  |     self.app.loader.init_worker()
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/celery/loaders/base.py", line 111, in init_worker
housewatch-worker-1  |     self.import_default_modules()
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/celery/loaders/base.py", line 105, in import_default_modules
housewatch-worker-1  |     raise response
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/celery/utils/dispatch/signal.py", line 276, in send
housewatch-worker-1  |     response = receiver(signal=self, sender=sender, **named)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/celery/fixups/django.py", line 82, in on_import_modules
housewatch-worker-1  |     self.worker_fixup.validate_models()
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/celery/fixups/django.py", line 121, in validate_models
housewatch-worker-1  |     run_checks()
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/django/core/checks/registry.py", line 88, in run_checks
housewatch-worker-1  |     new_errors = check(app_configs=app_configs, databases=databases)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/django/core/checks/urls.py", line 42, in check_url_namespaces_unique
housewatch-worker-1  |     all_namespaces = _load_all_namespaces(resolver)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/django/core/checks/urls.py", line 61, in _load_all_namespaces
housewatch-worker-1  |     url_patterns = getattr(resolver, "url_patterns", [])
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/django/utils/functional.py", line 57, in __get__
housewatch-worker-1  |     res = instance.__dict__[self.name] = self.func(instance)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/django/urls/resolvers.py", line 715, in url_patterns
housewatch-worker-1  |     patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/django/utils/functional.py", line 57, in __get__
housewatch-worker-1  |     res = instance.__dict__[self.name] = self.func(instance)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/django/urls/resolvers.py", line 708, in urlconf_module
housewatch-worker-1  |     return import_module(self.urlconf_name)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
housewatch-worker-1  |     return _bootstrap._gcd_import(name[level:], package, level)
housewatch-worker-1  |   File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
housewatch-worker-1  |   File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
housewatch-worker-1  |   File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
housewatch-worker-1  |   File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
housewatch-worker-1  |   File "<frozen importlib._bootstrap_external>", line 883, in exec_module
housewatch-worker-1  |   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
housewatch-worker-1  |   File "/code/housewatch/urls.py", line 6, in <module>
housewatch-worker-1  |     from housewatch.api.analyze import AnalyzeViewset
housewatch-worker-1  |   File "/code/housewatch/api/analyze.py", line 5, in <module>
housewatch-worker-1  |     from housewatch.clickhouse.client import run_query, ch_host, existing_system_tables
housewatch-worker-1  |   File "/code/housewatch/clickhouse/client.py", line 59, in <module>
housewatch-worker-1  |     existing_system_tables = [row["name"] for row in run_query(EXISTING_TABLES_SQL, use_cache=False)]
housewatch-worker-1  |   File "/code/housewatch/clickhouse/client.py", line 46, in run_query
housewatch-worker-1  |     result = client.execute(final_query, settings=settings, with_column_types=True, query_id=query_id)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/client.py", line 345, in execute
housewatch-worker-1  |     with self.disconnect_on_error(query, settings):
housewatch-worker-1  |   File "/usr/local/lib/python3.10/contextlib.py", line 135, in __enter__
housewatch-worker-1  |     return next(self.gen)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/client.py", line 289, in disconnect_on_error
housewatch-worker-1  |     self.establish_connection(settings)
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/client.py", line 276, in establish_connection
housewatch-worker-1  |     self.connection.force_connect()
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 235, in force_connect
housewatch-worker-1  |     self.connect()
housewatch-worker-1  |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 363, in connect
housewatch-worker-1  |     raise err
housewatch-worker-1  | clickhouse_driver.errors.NetworkError: Code: 210. Cannot assign requested address (localhost:9000)
housewatch-worker-1 exited with code 1
housewatch-app-1     | Performing system checks...
housewatch-app-1     | 
housewatch-app-1     | Failed to connect to localhost:9000
housewatch-app-1     | Traceback (most recent call last):
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 342, in connect
housewatch-app-1     |     return self._init_connection(host, port)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 306, in _init_connection
housewatch-app-1     |     self.socket = self._create_socket(host, port)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 278, in _create_socket
housewatch-app-1     |     raise err
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 269, in _create_socket
housewatch-app-1     |     sock.connect(sa)
housewatch-app-1     | OSError: [Errno 99] Cannot assign requested address
housewatch-app-1     | Failed to connect to localhost:9000
housewatch-app-1     | Traceback (most recent call last):
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 342, in connect
housewatch-app-1     |     return self._init_connection(host, port)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 306, in _init_connection
housewatch-app-1     |     self.socket = self._create_socket(host, port)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 278, in _create_socket
housewatch-app-1     |     raise err
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 269, in _create_socket
housewatch-app-1     |     sock.connect(sa)
housewatch-app-1     | OSError: [Errno 99] Cannot assign requested address
housewatch-app-1     | Exception in thread django-main-thread:
housewatch-app-1     | Traceback (most recent call last):
housewatch-app-1     |   File "/usr/local/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
housewatch-app-1     |     self.run()
housewatch-app-1     |   File "/usr/local/lib/python3.10/threading.py", line 953, in run
housewatch-app-1     |     self._target(*self._args, **self._kwargs)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/utils/autoreload.py", line 64, in wrapper
housewatch-app-1     |     fn(*args, **kwargs)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/core/management/commands/runserver.py", line 134, in inner_run
housewatch-app-1     |     self.check(display_num_errors=True)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 475, in check
housewatch-app-1     |     all_issues = checks.run_checks(
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/core/checks/registry.py", line 88, in run_checks
housewatch-app-1     |     new_errors = check(app_configs=app_configs, databases=databases)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/core/checks/urls.py", line 14, in check_url_config
housewatch-app-1     |     return check_resolver(resolver)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/core/checks/urls.py", line 24, in check_resolver
housewatch-app-1     |     return check_method()
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/urls/resolvers.py", line 494, in check
housewatch-app-1     |     for pattern in self.url_patterns:
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/utils/functional.py", line 57, in __get__
housewatch-app-1     |     res = instance.__dict__[self.name] = self.func(instance)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/urls/resolvers.py", line 715, in url_patterns
housewatch-app-1     |     patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/utils/functional.py", line 57, in __get__
housewatch-app-1     |     res = instance.__dict__[self.name] = self.func(instance)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/django/urls/resolvers.py", line 708, in urlconf_module
housewatch-app-1     |     return import_module(self.urlconf_name)
housewatch-app-1     |   File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
housewatch-app-1     |     return _bootstrap._gcd_import(name[level:], package, level)
housewatch-app-1     |   File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
housewatch-app-1     |   File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
housewatch-app-1     |   File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
housewatch-app-1     |   File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
housewatch-app-1     |   File "<frozen importlib._bootstrap_external>", line 883, in exec_module
housewatch-app-1     |   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
housewatch-app-1     |   File "/code/housewatch/urls.py", line 6, in <module>
housewatch-app-1     |     from housewatch.api.analyze import AnalyzeViewset
housewatch-app-1     |   File "/code/housewatch/api/analyze.py", line 5, in <module>
housewatch-app-1     |     from housewatch.clickhouse.client import run_query, ch_host, existing_system_tables
housewatch-app-1     |   File "/code/housewatch/clickhouse/client.py", line 59, in <module>
housewatch-app-1     |     existing_system_tables = [row["name"] for row in run_query(EXISTING_TABLES_SQL, use_cache=False)]
housewatch-app-1     |   File "/code/housewatch/clickhouse/client.py", line 46, in run_query
housewatch-app-1     |     result = client.execute(final_query, settings=settings, with_column_types=True, query_id=query_id)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/client.py", line 345, in execute
housewatch-app-1     |     with self.disconnect_on_error(query, settings):
housewatch-app-1     |   File "/usr/local/lib/python3.10/contextlib.py", line 135, in __enter__
housewatch-app-1     |     return next(self.gen)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/client.py", line 289, in disconnect_on_error
housewatch-app-1     |     self.establish_connection(settings)
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/client.py", line 276, in establish_connection
housewatch-app-1     |     self.connection.force_connect()
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 235, in force_connect
housewatch-app-1     |     self.connect()
housewatch-app-1     |   File "/usr/local/lib/python3.10/site-packages/clickhouse_driver/connection.py", line 363, in connect
housewatch-app-1     |     raise err
housewatch-app-1     | clickhouse_driver.errors.NetworkError: Code: 210. Cannot assign requested address (localhost:9000)

@ilovefreesw
Copy link
Author

@yakkomajuri is there a way to connect to 8123 instead of 9000 .... because the other Clickhouse house client that I have Dbeaver is also refusing to connect to 9000 port ... it only connects to 8123, saying port 9000 is for Clickhosue cli client only.

@yakkomajuri
Copy link
Contributor

Hey @ilovefreesw! Feel free to submit a PR for this

@my-git-hub
Copy link

@ilovefreesw - it's best not to change docker-compose.yaml file as it could get changed on upgrade

@yakkomajuri - what about adding .env.example with all system variables and default values that application depends on? I think there's a missing variable in docker-compose.yaml for
OPENAI_MODEL=
OPENAI_API_KEY=
I've added now:

version: '3'

services:
    app:
        build: .
        environment:
            REDIS_URL: redis://redis:6379
            CLICKHOUSE_HOST: $CLICKHOUSE_HOST
            CLICKHOUSE_PORT: $CLICKHOUSE_PORT
            CLICKHOUSE_DATABASE: $CLICKHOUSE_DATABASE
            CLICKHOUSE_USER: $CLICKHOUSE_USER
            CLICKHOUSE_PASSWORD: $CLICKHOUSE_PASSWORD
            CLICKHOUSE_CLUSTER: $CLICKHOUSE_CLUSTER
            CLICKHOUSE_SECURE: $CLICKHOUSE_SECURE
            CLICKHOUSE_VERIFY: $CLICKHOUSE_VERIFY
            CLICKHOUSE_CA: $CLICKHOUSE_CA
            OPENAI_API_KEY: $OPENAI_API_KEY
            OPENAI_MODEL: $OPENAI_MODEL

I've also faced this issue and would suggest that the README.md https://github.com/PostHog/HouseWatch#-deploy is updated as the command given doesn't work out of the box. As I didn't know the port 9440, I went ahead and changed the file housewatch/clickhouse/client.py, but that had no affect as connecting to port 9000 with encryption turned was unsuccessful also.

...
ch_host = os.getenv("CLICKHOUSE_HOST", "localhost")
ch_port = os.getenv("CLICKHOUSE_PORT", "9440")
ch_verify = os.getenv("CLICKHOUSE_VERIFY", True)
ch_ca = os.getenv("CLICKHOUSE_CA", None)
ch_secure = os.getenv("CLICKHOUSE_SECURE", True)

pool = ChPool(
    host=ch_host,
    port=ch_port,
...

@posthog-contributions-bot
Copy link

This issue has 2278 words at 5 comments. Issues this long are hard to read or contribute to, and tend to take very long to reach a conclusion. Instead, why not:

  1. Write some code and submit a pull request! Code wins arguments
  2. Have a sync meeting to reach a conclusion
  3. Create a Request for Comments and submit a PR with it to the meta repo or product internal repo

Is this issue intended to be sprawling? Consider adding label epic or sprint to indicate this.

@yakkomajuri
Copy link
Contributor

Yeah we definitely need some better documentation/examples. Feel free to submit a PR with suggestions

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

3 participants