arachnys / cabot

Self-hosted, easily-deployable monitoring and alerts service - like a lightweight PagerDuty
MIT License
5.58k stars 590 forks source link

Can't make the docker version works #680

Closed koopernick closed 1 year ago

koopernick commented 4 years ago

Hello,

I wanted to try your cabot docker version, but it seems it doesn't work out of the box (unless I missed something).

Fresh VM (debian 10). Installed docker + docker compose

and I followed this => https://github.com/arachnys/cabot/issues/675#issuecomment-562936874

git clone https://github.com/cabotapp/docker-cabot
cd /docker-cabot

rename the production.env.template file to production.env 

docker-compose up -d

But then, this => http://192.168.1.27:5000 doesn't work (local IP of the VM).

Hmmm… can't reach this page
192.168.1.27 refused to connect.

I'm not familiar with docker (I kind of hate it, not gonna lie), so I don't really know what to check.

Any help would be appreciated !

tborychowski commented 4 years ago

I seem to have a similar issue - docker containers start, but url does not respond. Running docker logs cabot_web_1 shows errors with postgres connection. I don't know python well enough to figure out what's wrong.

Error stack ```sh Traceback (most recent call last): File "/usr/local/bin/cabot", line 11, in sys.exit(main()) File "/usr/local/lib/python2.7/site-packages/cabot/entrypoint.py", line 10, in main execute_from_command_line(sys.argv) File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line utility.execute() File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv self.execute(*args, **cmd_options) File "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute output = self.handle(*args, **options) File "/usr/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 83, in handle executor = MigrationExecutor(connection, self.migration_progress_callback) File "/usr/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 20, in __init__ self.loader = MigrationLoader(self.connection) File "/usr/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 52, in __init__ self.build_graph() File "/usr/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 209, in build_graph self.applied_migrations = recorder.applied_migrations() File "/usr/local/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 65, in applied_migrations self.ensure_schema() File "/usr/local/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 52, in ensure_schema if self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor()): File "/usr/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 254, in cursor return self._cursor() File "/usr/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 229, in _cursor self.ensure_connection() File "/usr/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 213, in ensure_connection self.connect() File "/usr/local/lib/python2.7/site-packages/django/db/utils.py", line 94, in __exit__ six.reraise(dj_exc_type, dj_exc_value, traceback) File "/usr/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 213, in ensure_connection self.connect() File "/usr/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 189, in connect self.connection = self.get_new_connection(conn_params) File "/usr/local/lib/python2.7/site-packages/django/db/backends/postgresql/base.py", line 176, in get_new_connection connection = Database.connect(**conn_params) File "/usr/local/lib/python2.7/site-packages/psycopg2/__init__.py", line 130, in connect conn = _connect(dsn, connection_factory=connection_factory, **kwasync) django.db.utils.OperationalError: could not connect to server: Connection refused Is the server running on host "postgres" (192.168.112.2) and accepting TCP/IP connections on port 5432? Traceback (most recent call last): File "/usr/local/bin/cabot", line 11, in sys.exit(main()) File "/usr/local/lib/python2.7/site-packages/cabot/entrypoint.py", line 10, in main execute_from_command_line(sys.argv) File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line utility.execute() File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv self.execute(*args, **cmd_options) File "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute output = self.handle(*args, **options) File "/usr/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 83, in handle executor = MigrationExecutor(connection, self.migration_progress_callback) File "/usr/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 20, in __init__ self.loader = MigrationLoader(self.connection) File "/usr/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 52, in __init__ self.build_graph() File "/usr/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 209, in build_graph self.applied_migrations = recorder.applied_migrations() File "/usr/local/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 65, in applied_migrations self.ensure_schema() File "/usr/local/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 52, in ensure_schema if self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor()): File "/usr/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 254, in cursor return self._cursor() File "/usr/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 229, in _cursor self.ensure_connection() File "/usr/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 213, in ensure_connection self.connect() File "/usr/local/lib/python2.7/site-packages/django/db/utils.py", line 94, in __exit__ six.reraise(dj_exc_type, dj_exc_value, traceback) File "/usr/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 213, in ensure_connection self.connect() File "/usr/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 189, in connect self.connection = self.get_new_connection(conn_params) File "/usr/local/lib/python2.7/site-packages/django/db/backends/postgresql/base.py", line 176, in get_new_connection connection = Database.connect(**conn_params) File "/usr/local/lib/python2.7/site-packages/psycopg2/__init__.py", line 130, in connect conn = _connect(dsn, connection_factory=connection_factory, **kwasync) django.db.utils.OperationalError: could not connect to server: Connection refused Is the server running on host "postgres" (192.168.112.2) and accepting TCP/IP connections on port 5432? Operations to perform: Apply all migrations: admin, auth, cabot_alert_email, cabot_alert_hipchat, cabot_alert_slack, cabot_alert_twilio, cabotapp, contenttypes, sessions, sites Running migrations: Applying contenttypes.0001_initial... OK Applying auth.0001_initial... OK Applying admin.0001_initial... OK Applying admin.0002_logentry_remove_auto_add... OK Applying contenttypes.0002_remove_content_type_name... OK Applying auth.0002_alter_permission_name_max_length... OK Applying auth.0003_alter_user_email_max_length... OK Applying auth.0004_alter_user_username_opts... OK Applying auth.0005_alter_user_last_login_null... OK Applying auth.0006_require_contenttypes_0002... OK Applying auth.0007_alter_validators_add_error_messages... OK Applying auth.0008_alter_user_username_max_length... OK Applying cabotapp.0001_initial... OK Applying cabot_alert_email.0001_initial... OK Applying cabot_alert_hipchat.0001_initial... OK Applying cabotapp.0002_auto_20170131_1537... OK Applying cabotapp.0003_auto_20170201_1045... OK Applying cabot_alert_slack.0001_initial... OK Applying cabot_alert_twilio.0001_initial... OK Applying cabotapp.0004_auto_20170802_1327... OK Applying cabotapp.0005_auto_20170818_1202... OK Applying cabotapp.0006_auto_20170821_1000... OK Applying cabotapp.0007_statuscheckresult_consecutive_failures... OK Applying sessions.0001_initial... OK Applying sites.0001_initial... OK Applying sites.0002_alter_domain_unique... OK [2020-02-10 10:04:39 +0000] [13] [INFO] Starting gunicorn 19.7.1 [2020-02-10 10:04:39 +0000] [13] [INFO] Listening at: http://0.0.0.0:5000 (13) [2020-02-10 10:04:39 +0000] [13] [INFO] Using worker: sync [2020-02-10 10:04:39 +0000] [18] [INFO] Booting worker with pid: 18 [2020-02-10 10:04:39 +0000] [23] [INFO] Booting worker with pid: 23 [2020-02-10 10:04:39 +0000] [24] [INFO] Booting worker with pid: 24 [2020-02-10 10:04:40 +0000] [33] [INFO] Booting worker with pid: 33 [2020-02-10 10:04:40 +0000] [38] [INFO] Booting worker with pid: 38 Operations to perform: Apply all migrations: admin, auth, cabot_alert_email, cabot_alert_hipchat, cabot_alert_slack, cabot_alert_twilio, cabotapp, contenttypes, sessions, sites Running migrations: No migrations to apply. [2020-02-10 10:09:23 +0000] [13] [INFO] Starting gunicorn 19.7.1 [2020-02-10 10:09:23 +0000] [13] [INFO] Listening at: http://0.0.0.0:5000 (13) [2020-02-10 10:09:23 +0000] [13] [INFO] Using worker: sync [2020-02-10 10:09:23 +0000] [18] [INFO] Booting worker with pid: 18 [2020-02-10 10:09:24 +0000] [23] [INFO] Booting worker with pid: 23 [2020-02-10 10:09:24 +0000] [28] [INFO] Booting worker with pid: 28 [2020-02-10 10:09:24 +0000] [33] [INFO] Booting worker with pid: 33 [2020-02-10 10:09:24 +0000] [38] [INFO] Booting worker with pid: 38 Operations to perform: Apply all migrations: admin, auth, cabot_alert_email, cabot_alert_hipchat, cabot_alert_slack, cabot_alert_twilio, cabotapp, contenttypes, sessions, sites Running migrations: No migrations to apply. [2020-02-10 10:12:59 +0000] [13] [INFO] Starting gunicorn 19.7.1 [2020-02-10 10:12:59 +0000] [13] [INFO] Listening at: http://0.0.0.0:5000 (13) [2020-02-10 10:12:59 +0000] [13] [INFO] Using worker: sync [2020-02-10 10:12:59 +0000] [18] [INFO] Booting worker with pid: 18 [2020-02-10 10:12:59 +0000] [19] [INFO] Booting worker with pid: 19 [2020-02-10 10:12:59 +0000] [28] [INFO] Booting worker with pid: 28 [2020-02-10 10:12:59 +0000] [33] [INFO] Booting worker with pid: 33 [2020-02-10 10:12:59 +0000] [38] [INFO] Booting worker with pid: 38 ```
C0rn3j commented 4 years ago

How about you follow the official docs? https://cabotapp.com/qs/quickstart.html

tborychowski commented 4 years ago

@C0rn3j, I did follow that

C0rn3j commented 4 years ago

@tborychowski I meant that for OP who didn't seem to edit the compose file.

koopernick commented 4 years ago

You can close this issue. I went with something else (that has a proper doc describing all the steps).

tborychowski commented 4 years ago

@koopernick would you mind sharing what? 🙂 I'm still looking...

C0rn3j commented 4 years ago

As the author you should be able to close your own issue.

jijojv commented 4 years ago

postgres made a breaking change in https://github.com/docker-library/postgres/issues/681 fix is to update docker-compose.yml

   postgres:
-    image: postgres:9.6-alpine
+    image: postgres:9.6.16-alpine
poohsen commented 4 years ago

the image change worked for me. maybe this would have been called the the travis build but that one is failing due to sth. else, unfortunately.

wubingjie commented 4 years ago

postgres made a breaking change in docker-library/postgres#681 fix is to update docker-compose.yml

   postgres:
-    image: postgres:9.6-alpine
+    image: postgres:9.6.16-alpine

This is the right way to solve the problem, it worked thank you

JeanFred commented 4 years ago

Thanks for reporting and providing a fix − I pushed it as 961d0f4 over in cabotapp/docker-cabot.

redge76 commented 4 years ago

Well... Don't you think that the right way to fix this is to provide a password for the postgres db ?

Add an environment variable in the db service in the docker-compose.yml file: db: image: postgres:alpine environment:

and in the development.env.example file, provide this password to in the connection string: DATABASE_URL=postgres://postgres:cabot-password@db:5432/postgres

JeanFred commented 4 years ago

@redge76

Well... Don't you think that the right way to fix this is to provide a password for the postgres db ?

Add an environment variable in the db service in the docker-compose.yml file: db: image: postgres:alpine environment:

  • POSTGRES_PASSWORD=cabot-password volumes:
  • datavolume:/var/lib/postgresql/data

and in the development.env.example file, provide this password to in the connection string: DATABASE_URL=postgres://postgres:cabot-password@db:5432/postgres

Arguably a better solution indeed, thanks @redge76. See https://github.com/cabotapp/docker-cabot/pull/42