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

Duplicate key "accounts_email_key" on restarting docker service #955

Closed
cosad3s opened this issue Aug 17, 2021 · 2 comments
Closed

Duplicate key "accounts_email_key" on restarting docker service #955

cosad3s opened this issue Aug 17, 2021 · 2 comments
Labels
kind/improvement This issue is not a Bug nor a Feature project/horusec-platform This issue is related to the project https://github.com/ZupIT/horusec-platform

Comments

@cosad3s
Copy link

cosad3s commented Aug 17, 2021

What happened:

After the fresh installation of Horusec Platform, when the Docker service is restarted containers fails to start.

What you expected to happen:

Horusec Plateform restarted successfully after Docker service restart.

How to reproduce it (as minimally and precisely as possible):

sudo docker service stop
sudo docker service start

Anything else we need to know?:

Environment:

  • Horusec version (use horusec version):
horuszup/horusec-api:v2.16.4          
horuszup/horusec-analytic:v2.16.4     
horuszup/horusec-core:v2.16.4         
horuszup/horusec-messages:v2.16.4     
horuszup/horusec-webhook:v2.16.4      
horuszup/horusec-auth:v2.16.4         
horuszup/horusec-vulnerability:v2.16.4
postgres:12                           
horuszup/horusec-manager:v2.16.4      
  • Operating System: Linux kali 5.10.0-kali5-amd64 Feature/api horusec-platform#1 SMP Debian 5.10.24-1kali1 (2021-03-23) x86_64 GNU/Linux
  • Network plugin / Tool and version (if this is a network-related / tool bug):
  • Others:

Probably caused by the default configuration of horusec-auth ; docker logs of Postgres:

2021-08-17 07:08:06.255 UTC [37] ERROR:  duplicate key value violates unique constraint "accounts_email_key"
2021-08-17 07:08:06.255 UTC [37] DETAIL:  Key (email)=(dev@example.com) already exists.
2021-08-17 07:08:06.255 UTC [37] STATEMENT:  INSERT INTO "accounts" ("account_id","email","password","username","is_confirmed","is_application_admin","created_at","updated_at") VALUES ($1,$2,$3,$4,$5,$6,$7,$8)

Possible workaround: set the environment variable HORUSEC_ENABLE_DEFAULT_USER to false in compose.yaml.

@wiliansilvazup
Copy link
Contributor

Hello @cactuschibre
thanks for the feedback, please update the versions of all services to the latest available which would be v2.16.5 in this version we've made some updates that you can follow in the project release-notes.
About the specific error saying about the duplication of keys, we understand that a deal must be done so that an error log does not appear in the application, but it does not affect the functionalities, I will put an example below that right after it tries to create the default user it'll start the application normally without any problem.

ERROR: duplicate key value violates unique constraint "accounts_email_key" (SQLSTATE 23505)
[1.019ms] [rows:0] INSERT INTO "accounts" ("account_id","email","password","username","is_confirmed","is_application_admin","created_at","updated_at") VALUES ('XX','XX','XX','XX',true,false,'2021-08-17 09:28:04.55','2021-08-17 09:28:04.55')
time="2021-08-17T09:28:04Z" level=info msg="{CONFIG} default user dev with email dev@example.com already exists"
time="2021-08-17T09:28:04Z" level=info msg="{AUTH GRPC} grpc server listening on 8007 tpc port"
time="2021-08-17T09:28:04Z" level=info msg="swagger can be accessed on: http://localhost:8006/swagger/index.html"
time="2021-08-17T09:28:04Z" level=info msg="service running on 8006 http port"

i'll leave this issue open to create the deal as soon as possible !!

@nathanmartinszup nathanmartinszup transferred this issue from ZupIT/horusec-platform Jan 27, 2022
@nathanmartinszup nathanmartinszup added kind/improvement This issue is not a Bug nor a Feature project/horusec-platform This issue is related to the project https://github.com/ZupIT/horusec-platform labels Jan 27, 2022
@nathanmartinszup
Copy link
Contributor

nathanmartinszup commented Feb 14, 2022

This issue was fixed and will be available in the next release, so i will close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/improvement This issue is not a Bug nor a Feature project/horusec-platform This issue is related to the project https://github.com/ZupIT/horusec-platform
Projects
None yet
Development

No branches or pull requests

3 participants