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

Error installing default monitoring fixture in Docker #11182

Open
NyakudyaA opened this issue Jun 20, 2023 · 0 comments
Open

Error installing default monitoring fixture in Docker #11182

NyakudyaA opened this issue Jun 20, 2023 · 0 comments

Comments

@NyakudyaA
Copy link
Contributor

Expected Behavior

Actual Behavior

It produces the following error

 | Public Hostname or IP is localhost
django4geonode  | Public PORT is None
django4geonode  | /usr/local/bin/django-admin.py:17: RemovedInDjango40Warning: django-admin.py is deprecated in favor of django-admin.
django4geonode  |   warnings.warn(
django4geonode  | /usr/local/lib/python3.10/dist-packages/django/db/models/fields/__init__.py:1416: RuntimeWarning: DateTimeField Service.last_check received a naive datetime (1970-01-01 00:00:00) while time zone support is active.
django4geonode  |   warnings.warn("DateTimeField %s received a naive datetime (%s)"
django4geonode  | Traceback (most recent call last):
django4geonode  |   File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 84, in _execute
django4geonode  |     return self.cursor.execute(sql, params)
django4geonode  | psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "monitoring_service_name_key"
django4geonode  | DETAIL:  Key (name)=(geoserver-hostgeoserver) already exists.
django4geonode  | 
django4geonode  | 
django4geonode  | The above exception was the direct cause of the following exception:
django4geonode  | 
django4geonode  | Traceback (most recent call last):
django4geonode  |   File "/usr/local/bin/django-admin.py", line 21, in <module>
django4geonode  |     management.execute_from_command_line()
django4geonode  |   File "/usr/local/lib/python3.10/dist-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
django4geonode  |     utility.execute()
django4geonode  |   File "/usr/local/lib/python3.10/dist-packages/django/core/management/__init__.py", line 413, in execute
django4geonode  |     self.fetch_command(subcommand).run_from_argv(self.argv)
django4geonode  |   File "/usr/local/lib/python3.10/dist-packages/django/core/management/base.py", line 354, in run_from_argv
django4geonode  |     self.execute(*args, **cmd_options)
django4geonode  |   File "/usr/local/lib/python3.10/dist-packages/django/core/management/base.py", line 398, in execute
django4geonode  |     output = self.handle(*args, **options)
django4geonode  |   File "/usr/local/lib/python3.10/dist-packages/modeltranslation/management/commands/loaddata.py", line 49, in handle
django4geonode  |     return super().handle(*fixture_labels, **options)
django4geonode  |   File "/usr/local/lib/python3.10/dist-packages/django/core/management/commands/loaddata.py", line 78, in handle
django4geonode  |     self.loaddata(fixture_labels)
django4geonode  |   File "/usr/local/lib/python3.10/dist-packages/django/core/management/commands/loaddata.py", line 123, in loaddata
django4geonode  |     self.load_label(fixture_label)
django4geonode  |   File "/usr/local/lib/python3.10/dist-packages/django/core/management/commands/loaddata.py", line 190, in load_label
django4geonode  |     obj.save(using=self.using)
django4geonode  |   File "/usr/local/lib/python3.10/dist-packages/django/core/serializers/base.py", line 223, in save
django4geonode  |     models.Model.save_base(self.object, using=using, raw=True, **kwargs)
django4geonode  |   File "/usr/local/lib/python3.10/dist-packages/django/db/models/base.py", line 776, in save_base
django4geonode  |     updated = self._save_table(
django4geonode  |   File "/usr/local/lib/python3.10/dist-packages/django/db/models/base.py", line 858, in _save_table
django4geonode  |     updated = self._do_update(base_qs, using, pk_val, values, update_fields,
django4geonode  |   File "/usr/local/lib/python3.10/dist-packages/django/db/models/base.py", line 912, in _do_update
django4geonode  |     return filtered._update(values) > 0
django4geonode  |   File "/usr/local/lib/python3.10/dist-packages/django/db/models/query.py", line 802, in _update
django4geonode  |     return query.get_compiler(self.db).execute_sql(CURSOR)
django4geonode  |   File "/usr/local/lib/python3.10/dist-packages/django/db/models/sql/compiler.py", line 1559, in execute_sql
django4geonode  |     cursor = super().execute_sql(result_type)
django4geonode  |   File "/usr/local/lib/python3.10/dist-packages/django/db/models/sql/compiler.py", line 1175, in execute_sql
django4geonode  |     cursor.execute(sql, params)
django4geonode  |   File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 66, in execute
django4geonode  |     return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
django4geonode  |   File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
django4geonode  |     return executor(sql, params, many, context)
django4geonode  |   File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 79, in _execute
django4geonode  |     with self.db.wrap_database_errors:
django4geonode  |   File "/usr/local/lib/python3.10/dist-packages/django/db/utils.py", line 90, in __exit__
django4geonode  |     raise dj_exc_value.with_traceback(traceback) from exc_value
django4geonode  |   File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 84, in _execute
django4geonode  |     return self.cursor.execute(sql, params)
django4geonode  | django.db.utils.IntegrityError: Problem installing fixture '/tmp/default_monitoring_apps_docker.json': Could not load monitoring.Service(pk=3): duplicate key value violates unique constraint "monitoring_service_name_key"
django4geonode  | DETAIL:  Key (name)=(geoserver-hostgeoserver) already exists.
django4geonode  | 
django4geonode  | ERROR installing monitoring fixture: Encountered a bad command exit code!
django4geonode  | 

Steps to Reproduce the Problem

  1. Clone the repository and checkout master or whatever branch
  2. docker compose up -d --build
  3. docker compose logs -f django

Specifications

  • Installation type (vanilla, geonode-project): vanilla
  • Installation method (manual, docker): docker

Possible fix

change https://github.com/GeoNode/geonode/blob/master/tasks.py#L673 to "name": str(os.environ["HOSTNAME"]), resolves the issue but don't know if it's the correct approach

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

1 participant