arachnys / cabot

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

Programming error in development #377

Open alondahari opened 8 years ago

alondahari commented 8 years ago

Hi, I'm trying to set up cabot in a development environment, but I'm getting an error screen in all of the creation screens. The error is: column cabotapp_statuscheck.allowed_num_failures does not exist LINE 1: ...ue", "cabotapp_statuscheck"."expected_numhosts", "cabotapp...

screenshot: https://www.dropbox.com/s/gvdm793oiabfldf/Screenshot%202016-09-21%2011.06.19.png?dl=0

Thanks!

dbuxton commented 8 years ago

Looks like you haven't run migrations?

alondahari commented 8 years ago

Looks like you're right. Haven't noticed I got an error. When I run docker-compose run --rm web bash bin/build-app

I get this error: https://www.dropbox.com/s/kjy3e3jcxacxwhv/Screenshot%202016-09-21%2015.37.20.png?dl=0

help?

dbuxton commented 7 years ago

No idea, looks like something has got stuck in Postgres. If you don't have any data in there, I'd just destroy the containers and rebuild from scratch.

(something like docker-compose -f docker-compose.yml down --rmi all)

yuribit commented 7 years ago

Same error here..

Error in migration: cabotapp:0010_plugin_data_migration
JeanFred commented 7 years ago

Not sure what’s happening here. I have purged Cabot on my machine and re-followed the instructions step-by-step − everything works fine for me…

@yuribit or @jazzdragon, Can you please indicate step-by-step how to reproduce this ? That would help heaps :)

yuribit commented 7 years ago

The error happens randomly when running

docker-compose build
docker-compose run --rm web bash bin/build-app
rkalicinski commented 7 years ago

The problem could be caused by the way containers are launched using docker compose. Containers are launched parallel so it may happen that cabot app cannot connect to postgres database because it didn't finish to startup. A solution may be to add some sleep during cabot launch script before manage.py is run.

JeanFred commented 7 years ago

The problem could be caused by the way containers are launched using docker compose. Containers are launched parallel so it may happen that cabot app cannot connect to postgres database because it didn't finish to startup. A solution may be to add some sleep during cabot launch script before manage.py is run.

That may well be the case − Good point @rkalicinski. I somehow thought the docker-entrypoint.sh was also waiting for the db container to be started but that’s not the case. I’ll submit a PR shortly adding this.

dbuxton commented 7 years ago

Well, docker-compose itself will wait for the container to be running but not necessarily for all the processes in the container to run. That's why when we run tests on travis there's a sleep 20 command to make sure the database wakes up: https://github.com/arachnys/cabot/blob/4d7f9b07ef13d8b2561d3c4993f7ffa5e9fc0625/.travis.yml#L18

However if the database is already created etc I haven't had trouble with this in practice.

mikeder commented 7 years ago

I ran into this issue yesterday when I tried to disable some of the default alert plugins in the env_file:

If you put the default alert plugins back and redeploy/recreate the container the database should be populated correctly. https://github.com/arachnys/cabot/blob/master/conf/production.env.example#L2

CABOT_PLUGINS_ENABLED=cabot_alert_hipchat==1.7.0,cabot_alert_twilio==1.1.4,cabot_alert_email==1.3.1