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

Database error when running a second time #6

Closed
besendorf opened this issue Aug 13, 2019 · 5 comments
Closed

Database error when running a second time #6

besendorf opened this issue Aug 13, 2019 · 5 comments
Assignees
Labels
bug Something isn't working cannot reproduce Couldn't Reproduce the the bug help wanted Extra attention is needed wontfix This will not be worked on

Comments

@besendorf
Copy link
Contributor

besendorf commented Aug 13, 2019

When I run the the container again after I remove it. Creating Super user fails with an execption.
When I remove the volume (the data folder). It works again. But this means I cant store data when the container isnt running.
Also the data folder is completly empty.

etesync_1           | Create Database
etesync_1           | Operations to perform:
etesync_1           |   Apply all migrations: admin, auth, authtoken, contenttypes, journal, sessions
etesync_1           | Running migrations:
etesync_1           |   No migrations to apply.
etesync_1           | Create Super User
etesync_1           | Traceback (most recent call last):
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 85, in _execute
etesync_1           |     return self.cursor.execute(sql, params)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py", line 298, in execute
etesync_1           |     return Database.Cursor.execute(self, query, params)
etesync_1           | sqlite3.IntegrityError: UNIQUE constraint failed: auth_user.username
etesync_1           | 
etesync_1           | The above exception was the direct cause of the following exception:
etesync_1           | 
etesync_1           | Traceback (most recent call last):
etesync_1           |   File "manage.py", line 22, in <module>
etesync_1           |     execute_from_command_line(sys.argv)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
etesync_1           |     utility.execute()
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 375, in execute
etesync_1           |     self.fetch_command(subcommand).run_from_argv(self.argv)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 316, in run_from_argv
etesync_1           |     self.execute(*args, **cmd_options)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 353, in execute
etesync_1           |     output = self.handle(*args, **options)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/core/management/commands/shell.py", line 92, in handle
etesync_1           |     exec(sys.stdin.read())
etesync_1           |   File "<string>", line 1, in <module>
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/contrib/auth/models.py", line 161, in create_superuser
etesync_1           |     return self._create_user(username, email, password, **extra_fields)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/contrib/auth/models.py", line 144, in _create_user
etesync_1           |     user.save(using=self._db)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/contrib/auth/base_user.py", line 73, in save
etesync_1           |     super().save(*args, **kwargs)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/db/models/base.py", line 718, in save
etesync_1           |     force_update=force_update, update_fields=update_fields)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/db/models/base.py", line 748, in save_base
etesync_1           |     updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/db/models/base.py", line 831, in _save_table
etesync_1           |     result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/db/models/base.py", line 869, in _do_insert
etesync_1           |     using=using, raw=raw)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/db/models/manager.py", line 82, in manager_method
etesync_1           |     return getattr(self.get_queryset(), name)(*args, **kwargs)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/db/models/query.py", line 1136, in _insert
etesync_1           |     return query.get_compiler(using=using).execute_sql(return_id)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1289, in execute_sql
etesync_1           |     cursor.execute(sql, params)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 68, in execute
etesync_1           |     return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers
etesync_1           |     return executor(sql, params, many, context)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 85, in _execute
etesync_1           |     return self.cursor.execute(sql, params)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/db/utils.py", line 89, in __exit__
etesync_1           |     raise dj_exc_value.with_traceback(traceback) from exc_value
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 85, in _execute
etesync_1           |     return self.cursor.execute(sql, params)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py", line 298, in execute
etesync_1           |     return Database.Cursor.execute(self, query, params)
etesync_1           | django.db.utils.IntegrityError: UNIQUE constraint failed: auth_user.username
etesync_1           | Create Database
etesync_1           | Operations to perform:
etesync_1           |   Apply all migrations: admin, auth, authtoken, contenttypes, journal, sessions
etesync_1           | Running migrations:
etesync_1           |   No migrations to apply.
etesync_1           | Create Super User
etesync_1           | Traceback (most recent call last):
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 85, in _execute
etesync_1           |     return self.cursor.execute(sql, params)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py", line 298, in execute
etesync_1           |     return Database.Cursor.execute(self, query, params)
etesync_1           | sqlite3.IntegrityError: UNIQUE constraint failed: auth_user.username
etesync_1           | 
etesync_1           | The above exception was the direct cause of the following exception:
etesync_1           | 
etesync_1           | Traceback (most recent call last):
etesync_1           |   File "manage.py", line 22, in <module>
etesync_1           |     execute_from_command_line(sys.argv)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
etesync_1           |     utility.execute()
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 375, in execute
etesync_1           |     self.fetch_command(subcommand).run_from_argv(self.argv)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 316, in run_from_argv
etesync_1           |     self.execute(*args, **cmd_options)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 353, in execute
etesync_1           |     output = self.handle(*args, **options)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/core/management/commands/shell.py", line 92, in handle
etesync_1           |     exec(sys.stdin.read())
etesync_1           |   File "<string>", line 1, in <module>
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/contrib/auth/models.py", line 161, in create_superuser
etesync_1           |     return self._create_user(username, email, password, **extra_fields)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/contrib/auth/models.py", line 144, in _create_user
etesync_1           |     user.save(using=self._db)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/contrib/auth/base_user.py", line 73, in save
etesync_1           |     super().save(*args, **kwargs)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/db/models/base.py", line 718, in save
etesync_1           |     force_update=force_update, update_fields=update_fields)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/db/models/base.py", line 748, in save_base
etesync_1           |     updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/db/models/base.py", line 831, in _save_table
etesync_1           |     result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/db/models/base.py", line 869, in _do_insert
etesync_1           |     using=using, raw=raw)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/db/models/manager.py", line 82, in manager_method
etesync_1           |     return getattr(self.get_queryset(), name)(*args, **kwargs)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/db/models/query.py", line 1136, in _insert
etesync_1           |     return query.get_compiler(using=using).execute_sql(return_id)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1289, in execute_sql
etesync_1           |     cursor.execute(sql, params)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 68, in execute
etesync_1           |     return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers
etesync_1           |     return executor(sql, params, many, context)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 85, in _execute
etesync_1           |     return self.cursor.execute(sql, params)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/db/utils.py", line 89, in __exit__
etesync_1           |     raise dj_exc_value.with_traceback(traceback) from exc_value
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 85, in _execute
etesync_1           |     return self.cursor.execute(sql, params)
etesync_1           |   File "/usr/local/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py", line 298, in execute
etesync_1           |     return Database.Cursor.execute(self, query, params)
etesync_1           | django.db.utils.IntegrityError: UNIQUE constraint failed: auth_user.username
@victor-rds
Copy link
Owner

Please try new version of the image, Just one thing Superuser is only on the first run, no need to keep the variable after the first run, also now the README explain how to create superusers and update the database.

@besendorf
Copy link
Contributor Author

This issue is quite old. Last year I changed the image tag from alpine to slim and didnt encounter the issue anymore. Today I wanted to migrate to etebase and the same error occured. Changing to slim fixed the issue again.

@victor-rds victor-rds reopened this Dec 19, 2020
@victor-rds
Copy link
Owner

This still happening with the new Etebase?

@victor-rds
Copy link
Owner

I use alpine for myself and had no problems so far

@besendorf
Copy link
Contributor Author

Yes this happens on alpine. I changed to slim and then it worked

@victor-rds victor-rds added the bug Something isn't working label Dec 19, 2020
@victor-rds victor-rds self-assigned this Dec 19, 2020
@victor-rds victor-rds added cannot reproduce Couldn't Reproduce the the bug help wanted Extra attention is needed labels Dec 19, 2020
@victor-rds victor-rds added the wontfix This will not be worked on label Nov 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cannot reproduce Couldn't Reproduce the the bug help wanted Extra attention is needed wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants