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

RabbitMQ startup process hangs when using Docker #18

Closed
chrisamoore opened this issue Sep 26, 2015 · 6 comments
Closed

RabbitMQ startup process hangs when using Docker #18

chrisamoore opened this issue Sep 26, 2015 · 6 comments

Comments

@chrisamoore
Copy link

  • I tried to dockerize this puppy and got some py errors, python is not my strong suit ?
Traceback (most recent call last):
  File "manage.py", line 21, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 330, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 393, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 444, in execute
    output = self.handle(*args, **options)
  File "/home/zulip/deployments/2015-09-26-00-25-59/zerver/management/commands/initialize_voyager_db.py", line 39, in handle
    Realm.objects.create(domain="zulip.com")
  File "/usr/lib/python2.7/dist-packages/django/db/models/manager.py", line 127, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/django/db/models/query.py", line 348, in create
    obj.save(force_insert=True, using=self.db)
  File "/usr/lib/python2.7/dist-packages/django/db/models/base.py", line 710, in save
    force_update=force_update, update_fields=update_fields)
  File "/usr/lib/python2.7/dist-packages/django/db/models/base.py", line 738, in save_base
    updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
  File "/usr/lib/python2.7/dist-packages/django/db/models/base.py", line 822, in _save_table
    result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
  File "/usr/lib/python2.7/dist-packages/django/db/models/base.py", line 861, in _do_insert
    using=using, raw=raw)
  File "/usr/lib/python2.7/dist-packages/django/db/models/manager.py", line 127, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/django/db/models/query.py", line 922, in _insert
    return query.get_compiler(using=using).execute_sql(return_id)
  File "/usr/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 986, in execute_sql
    cursor.execute(sql, params)
  File "/usr/lib/python2.7/dist-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/usr/lib/python2.7/dist-packages/django/db/utils.py", line 97, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/usr/lib/python2.7/dist-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/home/zulip/deployments/2015-09-26-00-25-59/zerver/lib/db.py", line 23, in execute
    return wrapper_execute(self, super(TimeTrackingCursor, self).execute, query, vars)
  File "/home/zulip/deployments/2015-09-26-00-25-59/zerver/lib/db.py", line 11, in wrapper_execute
    return action(sql, params)
django.db.utils.IntegrityError: duplicate key value violates unique constraint "zerver_realm_domain_key"
DETAIL:  Key (domain)=(zulip.com) already exists.
@lfaraone lfaraone changed the title Docker ? Duplicate key when dockerizing Sep 26, 2015
@timabbott
Copy link
Member

that looks like the kind of issue you get if you're repeatedly running scripts/setup/initialize-database without dropping the database in between.

You should run "sudo scripts/setup/postgres-init-db" in between reruns of initialize-database

@DoubleMalt
Copy link

@timabbott If I start a Docker container for Zulip, how do I detect if the database is already initialized?

As the Docker container is usually stateless, all the state is kept in the database. Is there an idempotent way to get the database to a state the current Zulip install needs?

@arnehormann
Copy link

@DoubleMalt you could add a start.sh script as your new RUN-command. In it, check the connection and create everything unless it exists; exec the original RUN-command as the last step.

@lfaraone lfaraone closed this as completed Oct 6, 2015
@chrisamoore
Copy link
Author

Dockerfile:

FROM ubuntu:14.04

WORKDIR /root/zulip

RUN apt-get install wget -y

RUN wget https://www.zulip.com/dist/releases/zulip-server-latest.tar.gz

RUN tar xvfz ./zulip-server-*.tar.gz -C ./

RUN cp -ir ./zulip-server-*/* ./

RUN ./scripts/setup/install
RUN sudo scripts/setup/postgres-init-db
RUN zulip -c /home/zulip/deployments/current/scripts/setup/initialize-database

VOLUME ["/etc/ssl/certs", "/etc/ssl/private"]

OUTPUT Stalled here:

...
Notice: /Stage[main]/Zulip::Rabbit/File[/etc/default/rabbitmq-server]/content: content changed '{md5}7cc5216f193f6be1cb32c45021197b39' to '{md5}d0d028b94fbee9c1f4ff98e109cce3f4'
Notice: /Stage[main]/Zulip::Rabbit/File[/etc/cron.d/rabbitmq-numconsumers]/ensure: defined content as '{md5}dc5158f03148f188b3bc7b7418a4c16a'
Notice: /Stage[main]/Zulip::Rabbit/Exec[epmd]/returns: executed successfully


@chrisamoore chrisamoore changed the title Duplicate key when dockerizing REOPEN : Duplicate key when dockerizing Oct 15, 2015
@timabbott timabbott changed the title REOPEN : Duplicate key when dockerizing RabbitMQ startup process hangs when using Docker Oct 15, 2015
@timabbott timabbott reopened this Oct 15, 2015
@timabbott
Copy link
Member

Reopened with a title matching the current issue, namely the hanging.

@timabbott
Copy link
Member

I believe we fixed the hanging issue some time ago and forgot to close this issue.

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

5 participants