question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Docker - PB docker-compose run --rm web update.sh

See original GitHub issue

Je n’arrive pas à faire marcher Geotrek avec Docker. Lors de la migration j’obtiens les erreurs suivantes (testé avec la branche 2.57.0 et master)

  File "/opt/geotrek-admin/geotrek/core/urls.py", line 39, in <module>
    urlpatterns += registry.register(Path, PathEntityOptions, menu=(settings.PATH_MODEL_ENABLED and settings.TREKKING_TOPOLOGY_ENABLED))
  File "/opt/geotrek-admin/mapentity/registry.py", line 228, in register
    self.content_type_ids.append(model.get_content_type_id())
  File "/opt/geotrek-admin/mapentity/models.py", line 240, in get_content_type_id
    return ContentType.objects.get_for_model(cls).pk
  File "/opt/venv/lib/python3.8/site-packages/django/contrib/contenttypes/models.py", line 55, in get_for_model
    ct, created = self.get_or_create(
  File "/opt/venv/lib/python3.8/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/opt/venv/lib/python3.8/site-packages/django/db/models/query.py", line 576, in get_or_create
    return self._create_object_from_params(kwargs, params)
  File "/opt/venv/lib/python3.8/site-packages/django/db/models/query.py", line 610, in _create_object_from_params
    obj = self.create(**params)
  File "/opt/venv/lib/python3.8/site-packages/django/db/models/query.py", line 447, in create
    obj.save(force_insert=True, using=self.db)
  File "/opt/venv/lib/python3.8/site-packages/django/db/models/base.py", line 753, in save
    self.save_base(using=using, force_insert=force_insert,
  File "/opt/venv/lib/python3.8/site-packages/django/db/models/base.py", line 790, in save_base
    updated = self._save_table(
  File "/opt/venv/lib/python3.8/site-packages/django/db/models/base.py", line 895, in _save_table
    results = self._do_insert(cls._base_manager, using, fields, returning_fields, raw)
  File "/opt/venv/lib/python3.8/site-packages/django/db/models/base.py", line 933, in _do_insert
    return manager._insert(
  File "/opt/venv/lib/python3.8/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/opt/venv/lib/python3.8/site-packages/django/db/models/query.py", line 1254, in _insert
    return query.get_compiler(using=using).execute_sql(returning_fields)
  File "/opt/venv/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1397, in execute_sql
    cursor.execute(sql, params)
  File "/opt/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 66, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/opt/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/opt/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/opt/venv/lib/python3.8/site-packages/django/db/utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/opt/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
django.db.utils.IntegrityError: null value in column "name" violates not-null constraint
DETAIL:  Failing row contains (30, null, core, path).

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:16 (16 by maintainers)

github_iconTop GitHub Comments

2reactions
amandine-sahlcommented, Apr 30, 2021

Effectivement, après avoir supprimé le répertoire et reclonner le dépot, j’ai réussi à installer la base de données sans erreur. Merci pour les réponses à ce ticket

0reactions
submarcoscommented, Apr 30, 2021

Bonjour, oui je me doute. les images docker et la procédure d’install sont testés dans la CI de test de geotrek, c’est à dire à chaque nouveau commit :

https://github.com/GeotrekCE/Geotrek-admin/blob/master/.circleci/config.yml#L40

ici on ajoute juste un container postgis 2.5 pour les tests de l’image de production (et on recupère l’image construite dans un job précédent), et on execute le update.sh dans la foulée.

Par acquis de conscience, j’ai testé tel que + avec une BDD en postgis 3.0, sans reproduire l’erreur. J’ai testé aussi avec la version de developement, sur master et sur le tag 2.57.0, sans reproduire l’erreur.

Par contre il y a eu un changement dernierement, si tu as un dossier env ou venv dans ton repo (que produisait geotrek precedemment), essaie de le supprimer avant de relancer. Il se peut aussi que l’ancienne version des dependences de geotrek remplace la version de l’image à cause du volume, ce qui pourrait causer ton erreur.

Tu peux retester en partant de 0 :

  • git clone dans un nouveau dossier (pour etre sur de ne pas avoir d’anciens reliquats)

mode dev

  • pocedure d’install en mode dev (qui utilise une bdd vierge embarquée)
  • docker-compose build
  • docker-compose run --rm web update.sh (docker créé la bdd au 1er lancement, ce qui peut causer une erreur au 1er lancement)

mode prod

  • pocedure d’install en mode prod (qui utilise une bdd externe / sur l’hote)
  • docker pull geotrekce/admin:latest
  • docker-compose run --rm web update.sh

Tu ne devrais pas avoir de problème

Read more comments on GitHub >

github_iconTop Results From Across the Web

docker compose run - Docker Documentation
Commands you use with run start in new containers with configuration defined by that of the service, including volumes, links, and other details....
Read more >
Issues - GitHub
docker-compose run --rm smart_backend ./migrate.sh #69 ... There was a large maintenance update in July. Also, are you able to either exec ...
Read more >
xvfb docker - Ramozzi & Friends
1 Usage Xvfb container will open X server ":99" port. sh. ... If I do first $ docker-compose run web bash then $...
Read more >
Interactive shell using Docker Compose - Stack Overflow
docker-compose run --rm myapp ... docker-compose exec redis sh docker-compose exec web sh ... docker-compose run myapp sh should do the deal.
Read more >
How To Install and Use Docker Compose on Ubuntu 20.04
Docker Compose is a tool that allows you to run multi-container application environments based on ... Published on June 5, 2020 · Updated...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found