Closed gwonmin-tesla closed 11 months ago
tango_postgreSQL 삭제후 PR 내용 적용한 후, docker-compose up -d시에 다음과 같이 project manager에서 에러 발생
$ docker logs tango-project_manager-1
2023/09/18 08:17:34 Waiting for host: tcp://postgresql:5432
2023/09/18 08:17:35 Connected to tcp://postgresql:5432
Apply database migrations
No changes detected in app 'tango'
Operations to perform:
Apply all migrations: admin, auth, contenttypes, oauth2_provider, sessions, tango
Running migrations:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 82, in _execute
return self.cursor.execute(sql)
psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "pg_class_relname_nsp_index"
DETAIL: Key (relname, relnamespace)=(auth_permission_id_seq, 2200) already exists.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 22, in <module>
main()
File "manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 398, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 89, in wrapped
res = handle_func(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/django/core/management/commands/migrate.py", line 246, in handle
fake_initial=fake_initial,
File "/usr/local/lib/python3.7/site-packages/django/db/migrations/executor.py", line 117, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
File "/usr/local/lib/python3.7/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "/usr/local/lib/python3.7/site-packages/django/db/migrations/executor.py", line 227, in apply_migration
state = migration.apply(state, schema_editor)
File "/usr/local/lib/python3.7/site-packages/django/db/migrations/migration.py", line 126, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "/usr/local/lib/python3.7/site-packages/django/db/migrations/operations/models.py", line 92, in database_forwards
schema_editor.create_model(model)
File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/schema.py", line 345, in create_model
self.execute(sql, params or None)
File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/schema.py", line 145, in execute
cursor.execute(sql, params)
File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 66, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python3.7/site-packages/django/db/utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 82, in _execute
return self.cursor.execute(sql)
django.db.utils.IntegrityError: duplicate key value violates unique constraint "pg_class_relname_nsp_index"
DETAIL: Key (relname, relnamespace)=(auth_permission_id_seq, 2200) already exists.
해결책
docker-compose down
명령으로 컨테이너 모두 종료후docker volume rm tango_postgreSQL
명령으로 old volume 제거docker-compose up -d
명령으로 컨테이너 재시작(base) kimkk@chalie ~/work/TANGO [main]$ docker-compose down
[+] Running 12/12
✔ Container tango-labelling-1 Removed 11.4s
✔ Container tango-bms-1 Removed 11.0s
✔ Container tango-code_gen-1 Removed 11.1s
✔ Container tango-cloud_deploy-1 Removed 4.5s
✔ Container tango-project_manager-1 Removed 10.8s
✔ Container registry Removed 0.3s
✔ Container tango-viz2code-1 Removed 0.0s
✔ Container tango-autonn_yoloe-1 Removed 11.3s
✔ Container tango-ondevice_deploy-1 Removed 10.5s
✔ Container tango_k8s Removed 0.0s
✔ Container tango-postgresql-1 Removed 0.5s
✔ Network tango_default Removed 0.4s
(base) kimkk@chalie ~/work/TANGO [main]$ docker volume rm tango_postgreSQL
tango_postgreSQL
(base) kimkk@chalie ~/work/TANGO [main]$ docker compose up -d
[+] Running 13/13
✔ Network tango_default Created 0.1s
✔ Volume "tango_postgreSQL" Created 0.0s
✔ Container tango-code_gen-1 Started 0.6s
✔ Container tango-ondevice_deploy-1 Started 1.2s
✔ Container tango-postgresql-1 Started 1.8s
✔ Container tango-cloud_deploy-1 Started 1.0s
✔ Container tango_k8s Started 1.1s
✔ Container tango-autonn_yoloe-1 Started 1.8s
✔ Container registry Started 0.7s
✔ Container tango-viz2code-1 Started 0.9s
✔ Container tango-bms-1 Started 0.8s
✔ Container tango-labelling-1 Started 1.4s
✔ Container tango-project_manager-1 Started 2.4s
(base) kimkk@chalie ~/work/TANGO [main]$ docker ps -a --format "table {{.Image}}\t{{.Names}}\t{{.Status}}\t{{.Command}}\t{{.Ports}}"
IMAGE NAMES STATUS COMMAND PORTS
tango-project_manager tango-project_manager-1 Up 7 seconds "sh -c 'chmod 777 ./…" 0.0.0.0:8085->8085/tcp, :::8085->8085/tcp
tango-autonn_yoloe tango-autonn_yoloe-1 Up 8 seconds "/opt/nvidia/nvidia_…" 0.0.0.0:8090->8090/tcp, :::8090->8090/tcp
tango-viz2code tango-viz2code-1 Exited (1) 7 seconds ago "sh -c 'cd ./visuali…"
tango-code_gen tango-code_gen-1 Up 9 seconds "sh -c 'cd /app && p…" 0.0.0.0:8888->8888/tcp, :::8888->8888/tcp
registry registry Up 9 seconds "/entrypoint.sh /etc…" 0.0.0.0:8903->5000/tcp, :::8903->5000/tcp
tango-labelling tango-labelling-1 Up 8 seconds "./start.sh" 0.0.0.0:8086->80/tcp, :::8086->80/tcp, 0.0.0.0:8095->10236/tcp, :::8095->10236/tcp
tango-bms tango-bms-1 Up 9 seconds "sh -c 'python manag…" 0.0.0.0:8081->8081/tcp, :::8081->8081/tcp
tango-cloud_deploy tango-cloud_deploy-1 Up 8 seconds "/init" 0.0.0.0:7007->7007/tcp, :::7007->7007/tcp, 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp, 0.0.0.0:8890->8890/tcp, :::8890->8890/tcp
postgres:15.4 tango-postgresql-1 Up 8 seconds "docker-entrypoint.s…" 5432/tcp
tango-kube_deploy tango_k8s Exited (1) 8 seconds ago "bash -c 'cd /app &&…"
tango-ondevice_deploy tango-ondevice_deploy-1 Up 8 seconds "sh -c 'cd /app && p…" 0.0.0.0:8891->8891/tcp, :::8891->8891/tcp
portainer/portainer portainer Up 13 days "/portainer" 8000/tcp, 9443/tcp, 0.0.0.0:9000->9000/tcp, :::9000->9000/tcp
(base) kimkk@chalie ~/work/TANGO [main]$
postgres의 업데이트로 인한 오류로 15.4 버전으로 빌드되도록 수정