arachnys / cabot

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

Ubuntu 14.04 syncdb error #326

Closed alxschwarz closed 8 years ago

alxschwarz commented 8 years ago

Log:

sudo: foreman run -e conf/production.env python manage.py syncdb
[ubuntu@54.208.] out: Syncing...
[ubuntu@54.208.] out: Creating tables ...
[ubuntu@54.208.] out: Creating table auth_permission
[ubuntu@54.208.] out: Creating table auth_group_permissions
[ubuntu@54.208.] out: Creating table auth_group
[ubuntu@54.208.] out: Creating table auth_user_groups
[ubuntu@54.208.] out: Creating table auth_user_user_permissions
[ubuntu@54.208.] out: Creating table auth_user
[ubuntu@54.208.] out: Creating table django_content_type
[ubuntu@54.208.] out: Creating table django_session
[ubuntu@54.208.] out: Creating table django_site
[ubuntu@54.208.] out: Creating table django_admin_log
[ubuntu@54.208.] out: Creating table south_migrationhistory
[ubuntu@54.208.] out: Creating table cabot_alert_slack_slackalert
[ubuntu@54.208.] out: Creating table cabot_alert_slack_slackalertuserdata
[ubuntu@54.208.] out:
[ubuntu@54.208.] out: You just installed Django's auth system, which means you don't have any superusers defined.
[ubuntu@54.208.] out: Would you like to create one now? (yes/no): yes
[ubuntu@54.208.] out: Username (leave blank to use 'root'):
[ubuntu@54.208.] out: Email address: alexfinn@protonamil.ch
[ubuntu@54.208.] out: Password:
[ubuntu@54.208.] out: Password (again):
[ubuntu@54.208.] out: Traceback (most recent call last):
[ubuntu@54.208.] out:   File "manage.py", line 11, in <module>
[ubuntu@54.208.] out:     execute_from_command_line(sys.argv)
[ubuntu@54.208.] out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
[ubuntu@54.208.] out:     utility.execute()
[ubuntu@54.208.] out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
[ubuntu@54.208.] out:     self.fetch_command(subcommand).run_from_argv(self.argv)
[ubuntu@54.208.] out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
[ubuntu@54.208.] out:     self.execute(*args, **options.__dict__)
[ubuntu@54.208.] out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
[ubuntu@54.208.] out:     output = self.handle(*args, **options)
[ubuntu@54.208.] out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 415, in handle
[ubuntu@54.208.] out:     return self.handle_noargs(**options)
[ubuntu@54.208.] out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/south/management/commands/syncdb.py", line 92, in handle_noargs
[ubuntu@54.208.] out:     syncdb.Command().execute(**options)
[ubuntu@54.208.] out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
[ubuntu@54.208.] out:     output = self.handle(*args, **options)
[ubuntu@54.208.] out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 415, in handle
[ubuntu@54.208.] out:     return self.handle_noargs(**options)
[ubuntu@54.208.] out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/core/management/commands/syncdb.py", line 112, in handle_noargs
[ubuntu@54.208.] out:     emit_post_sync_signal(created_models, verbosity, interactive, db)
[ubuntu@54.208.] out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/core/management/sql.py", line 216, in emit_post_sync_signal
[ubuntu@54.208.] out:     interactive=interactive, db=db)
[ubuntu@54.208.] out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 185, in send
[ubuntu@54.208.] out:     response = receiver(signal=self, sender=sender, **named)
[ubuntu@54.208.] out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py", line 126, in create_superuser
[ubuntu@54.208.] out:     call_command("createsuperuser", interactive=True, database=db)
[ubuntu@54.208.] out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 159, in call_command
[ubuntu@54.208.] out:     return klass.execute(*args, **defaults)
[ubuntu@54.208.] out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
[ubuntu@54.208.] out:     output = self.handle(*args, **options)
[ubuntu@54.208.] out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 141, in handle
[ubuntu@54.208.] out:     self.UserModel._default_manager.db_manager(database).create_superuser(**user_data)
[ubuntu@54.208.] out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/contrib/auth/models.py", line 195, in create_superuser
[ubuntu@54.208.] out:     **extra_fields)
[ubuntu@54.208.] out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/contrib/auth/models.py", line 186, in _create_user
[ubuntu@54.208.] out:     user.save(using=self._db)
[ubuntu@54.208.] out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/db/models/base.py", line 545, in save
[ubuntu@54.208.] out:     force_update=force_update, update_fields=update_fields)
[ubuntu@54.208.] out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/db/models/base.py", line 582, in save_base
[ubuntu@54.208.] out:     update_fields=update_fields, raw=raw, using=using)
[ubuntu@54.208.] out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 185, in send
[ubuntu@54.208.] out:     response = receiver(signal=self, sender=sender, **named)
[ubuntu@54.208.] out:   File "/home/ubuntu/2016-03-28-7344efa/cabot/cabotapp/models.py", line 919, in create_user_profile
[ubuntu@54.208.] out:     UserProfile.objects.create(user=instance)
[ubuntu@54.208.] out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/db/models/manager.py", line 157, in create
[ubuntu@54.208.] out:     return self.get_queryset().create(**kwargs)
[ubuntu@54.208.] out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/db/models/query.py", line 322, in create
[ubuntu@54.208.] out:     obj.save(force_insert=True, using=self.db)
[ubuntu@54.208.] out:   File "/home/ubuntu/2016-03-28-7344efa/cabot/cabotapp/models.py", line 907, in save
[ubuntu@54.208.] out:     return super(UserProfile, self).save(*args, **kwargs)
[ubuntu@54.208.] out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/db/models/base.py", line 545, in save
[ubuntu@54.208.] out:     force_update=force_update, update_fields=update_fields)
[ubuntu@54.208.] out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/db/models/base.py", line 573, in save_base
[ubuntu@54.208.] out:     updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
[ubuntu@54.208.] out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/db/models/base.py", line 654, in _save_table
[ubuntu@54.208.] out:     result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
[ubuntu@54.208.] out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/db/models/base.py", line 687, in _do_insert
[ubuntu@54.208.] out:     using=using, raw=raw)
[ubuntu@54.208.] out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/db/models/manager.py", line 232, in _insert
[ubuntu@54.208.] out:     return insert_query(self.model, objs, fields, **kwargs)
[ubuntu@54.208.] out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/db/models/query.py", line 1514, in insert_query
[ubuntu@54.208.] out:     return query.get_compiler(using=using).execute_sql(return_id)
[ubuntu@54.208.] out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 903, in execute_sql
[ubuntu@54.208.] out:     cursor.execute(sql, params)
[ubuntu@54.208.] out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/db/backends/util.py", line 53, in execute
[ubuntu@54.208.] out:     return self.cursor.execute(sql, params)
[ubuntu@54.208.] out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/db/utils.py", line 99, in __exit__
[ubuntu@54.208.] out:     six.reraise(dj_exc_type, dj_exc_value, traceback)
[ubuntu@54.208.] out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/db/backends/util.py", line 53, in execute
[ubuntu@54.208.] out:     return self.cursor.execute(sql, params)
[ubuntu@54.208.] out: django.db.utils.ProgrammingError: relation "cabotapp_userprofile" does not exist
[ubuntu@54.208.] out: LINE 1: INSERT INTO "cabotapp_userprofile" ("user_id", "mobile_numbe...
[ubuntu@54.208.] out:                     ^
[ubuntu@54.208.] out:
[ubuntu@54.208.] out:

Fatal error: sudo() received nonzero return code 1 while executing!

Requested: foreman run -e conf/production.env python manage.py syncdb
Executed: sudo -S -p 'sudo password:'  /bin/bash -l -c "cd /home/ubuntu/2016-03-28-7344efa >/dev/null && source /home/ubuntu/venv/bin/activate && foreman run -e conf/production.env python manage.py syncdb"

Aborting.
Disconnecting from 54.208.... done
```.`
dbuxton commented 8 years ago

How annoying. I guess it needs to be

python manage.py syncdb --migrate

In the fabfile.

Can you try and let me know how you get on?

alxschwarz commented 8 years ago

I just tried it but the result is the same.

dbuxton commented 8 years ago

@AlexFinn can you try again with master? I've merged #328 to revert the changes that I think have caused this

alxschwarz commented 8 years ago

@dbuxton log:

out:  > cabotapp:0010_plugin_data_migration
out: Adding content type 'cabotapp | alertpluginuserdata'
out: Adding content type 'cabotapp | service'
out: Adding content type 'cabotapp | instancestatussnapshot'
out: Adding content type 'cabotapp | graphitestatuscheck'
out: Adding content type 'cabotapp | statuscheckresult'
out: Adding content type 'cabotapp | instance'
out: Adding content type 'cabotapp | jenkinsstatuscheck'
out: Adding content type 'cabotapp | shift'
out: Adding content type 'cabotapp | alertplugin'
out: Adding content type 'cabotapp | httpstatuscheck'
out: Adding content type 'cabotapp | servicestatussnapshot'
out: Adding content type 'cabotapp | icmpstatuscheck'
out: Adding content type 'cabotapp | statuscheck'
out: Adding content type 'cabotapp | alertacknowledgement'
out: Adding content type 'cabotapp | userprofile'
out: Error in migration: cabotapp:0010_plugin_data_migration
out: Traceback (most recent call last):
out:   File "manage.py", line 11, in <module>
out:     execute_from_command_line(sys.argv)
out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
out:     utility.execute()
out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
out:     self.fetch_command(subcommand).run_from_argv(self.argv)
out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
out:     self.execute(*args, **options.__dict__)
out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
out:     output = self.handle(*args, **options)
out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/south/management/commands/migrate.py", line 111, in handle
out:     ignore_ghosts = ignore_ghosts,
out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/south/migration/__init__.py", line 220, in migrate_app
out:     success = migrator.migrate_many(target, workplan, database)
out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/south/migration/migrators.py", line 256, in migrate_many
out:     result = migrator.__class__.migrate_many(migrator, target, migrations, database)
out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/south/migration/migrators.py", line 331, in migrate_many
out:     result = self.migrate(migration, database)
out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/south/migration/migrators.py", line 133, in migrate
out:     result = self.run(migration, database)
out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/south/migration/migrators.py", line 114, in run
out:     return self.run_migration(migration, database)
out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/south/migration/migrators.py", line 84, in run_migration
out:     migration_function()
out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/south/migration/migrators.py", line 60, in <lambda>
out:     return (lambda: direction(orm))
out:   File "/home/ubuntu/2016-03-29-fa61497/cabot/cabotapp/migrations/0010_plugin_data_migration.py", line 28, in forwards
out:     polymorphic_ctype = orm['contenttypes.contenttype'].objects.get(model='hipchatalert'),
out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/db/models/manager.py", line 151, in get
out:     return self.get_queryset().get(*args, **kwargs)
out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/db/models/query.py", line 304, in get
out:     num = len(clone)
out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/db/models/query.py", line 77, in __len__
out:     self._fetch_all()
out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/db/models/query.py", line 857, in _fetch_all
out:     self._result_cache = list(self.iterator())
out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/db/models/query.py", line 220, in iterator
out:     for row in compiler.results_iter():
out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 713, in results_iter
out:     for rows in self.execute_sql(MULTI):
out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 786, in execute_sql
out:     cursor.execute(sql, params)
out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/db/backends/util.py", line 53, in execute
out:     return self.cursor.execute(sql, params)
out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/db/utils.py", line 99, in __exit__
out:     six.reraise(dj_exc_type, dj_exc_value, traceback)
out:   File "/home/ubuntu/venv/local/lib/python2.7/site-packages/django/db/backends/util.py", line 53, in execute
out:     return self.cursor.execute(sql, params)
out: django.db.utils.InternalError: current transaction is aborted, commands ignored until end of transaction block
out:
out:

Fatal error: sudo() received nonzero return code 1 while executing!

Requested: foreman run -e conf/production.env python manage.py migrate cabotapp --noinput
Executed: sudo -S -p 'sudo password:'  /bin/bash -l -c "cd /home/ubuntu/2016-03-29-fa61497 >/dev/null && source /home/ubuntu/venv/bin/activate && foreman run -e conf/production.env python manage.py migrate cabotapp --noinput"

Aborting.
dbuxton commented 8 years ago

Did you drop the database first?

alxschwarz commented 8 years ago

it was clean instance

cmclaughlin commented 8 years ago

@AlexFinn is it working for you now?

alxschwarz commented 8 years ago

@cmclaughlin I will try tomorrow

alxschwarz commented 8 years ago

@cmclaughlin @dbuxton All works! Thanks :)

alxschwarz commented 8 years ago

and little "error":

[ubuntu@54.173.] sudo: restart cabot
[ubuntu@54.173.] out: restart: Unknown instance:
[ubuntu@54.173.] out:

Warning: sudo() received nonzero return code 1 while executing 'restart cabot'!

[ubuntu@54.173.] sudo: start cabot
[ubuntu@54.173.] out: cabot start/running
[ubuntu@54.173.] out:

Done!
JeanFred commented 8 years ago

Thanks for testing @AlexFinn :)

alxschwarz commented 8 years ago

:)