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 issues prevent service from starting #60

Open
johntopleyons opened this issue Aug 29, 2018 · 2 comments
Open

Database issues prevent service from starting #60

johntopleyons opened this issue Aug 29, 2018 · 2 comments
Assignees
Labels

Comments

@johntopleyons
Copy link
Contributor

johntopleyons commented Aug 29, 2018

Newly cloned repo, running docker-compose up:

{"level":"error","ts":1535530007.07787,"caller":"models/db.go:97","msg":"Error pinging data source","service":"surveysvc","event":"error","data":"dial tcp 172.17.0.2:5432: getsockopt: connection refused","created":"2018-08-29T08:06:47Z","stacktrace":"github.com/ONSdigital/rm-survey-service/models.logError\n\t/home/travis/gopath/src/github.com/ONSdigital/rm-survey-service/models/db.go:97\ngithub.com/ONSdigital/rm-survey-service/models.testDBConnection\n\t/home/travis/gopath/src/github.com/ONSdigital/rm-survey-service/models/db.go:68\ngithub.com/ONSdigital/rm-survey-service/models.InitDB\n\t/home/travis/gopath/src/github.com/ONSdigital/rm-survey-service/models/db.go:39\nmain.main\n\t/home/travis/gopath/src/github.com/ONSdigital/rm-survey-service/main.go:39\nruntime.main\n\t/home/travis/.gimme/versions/go1.8.linux.amd64/src/runtime/proc.go:185"}

Possibly related, the following error occurs during service start-up on Google Kubernetes Engine:

jsonPayload: {
  caller:  "rm-survey-service/main.go:47"    
  level:  "fatal"    
  msg:  "event="Failed to start" error="unable to initialise API model" error_message=pq: relation "survey.survey" does not exist"    
  stacktrace:  "main.main
	/home/travis/gopath/src/github.com/ONSdigital/rm-survey-service/main.go:47
runtime.main
	/home/travis/.gimme/versions/go1.8.linux.amd64/src/runtime/proc.go:185"    
  ts:  1535527713.97238    
 }

It worked last week.

@benjefferies
Copy link
Contributor

I wonder if this is a timing issue as it worked for me. Maybe adding restart/healthcheck would be useful?

    restart: always
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8080/info"]
      interval: 1m30s
      timeout: 10s
      retries: 3

@johntopleyons
Copy link
Contributor Author

It looks like the unable to initialise the API model error I was seeing on GKE was as a result of having a survey_schema_migrations table hanging around. When I cleared that down properly I no longer got that error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants