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

Kubernetes on GCE failing #1719

Open
khwerhahn opened this issue Jun 30, 2019 · 5 comments

Comments

@khwerhahn
Copy link

commented Jun 30, 2019

Description

I'm trying to deploy a buffalo app to GCE (kubernetes cluster), but I always get the output:

2019-06-30 13:50:01.065 CEST
�[36mINFO�[0m[2019-06-30T11:50:01Z] Starting application at 127.0.0.1:8080
2019-06-30 13:50:01.066 CEST
�[36mINFO�[0m[2019-06-30T11:50:01Z] Starting Simple Background Worker
2019-06-30 13:51:50.364 CEST
2019/06/30 11:51:50 context canceled
2019-06-30 13:51:50.364 CEST
�[36mINFO�[0m[2019-06-30T11:51:50Z] Shutting down application
2019-06-30 13:51:50.364 CEST
�[36mINFO�[0m[2019-06-30T11:51:50Z] Shutting down worker
[36mINFO�[0m[2019-06-30T11:51:50Z] Stopping Simple Background Worker

I'm really not sure what it causes to fail. I have a suspicion that it has to do with the database url parsing, but I cannot localize the error, due to the concrete error output. I have commented out the app.Use(popmw.Transaction(models.DB)) in actions/app.go and I don't get the following error anymore: [POP] 2019/06/29 17:01:21 warn - unable to load connection production: parse postgres://xxxxxxx:xxxxxxxxxxx@xx.xx.xxx.xx:5432/postgres_production?sslmode=disable: net/url: invalid userinfo , but the application still keeps crashing.

I'm using the following Dockerfile:

FROM gobuffalo/buffalo:development as builder
ENV BP=$GOPATH/src/github.com/khwerhahn/khw

RUN mkdir -p $BP
WORKDIR $BP

RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh

ADD . .

RUN dep ensure --vendor-only
RUN npm rebuild node-sass
RUN npm install

RUN buffalo build --static -o /bin/app

FROM alpine
RUN apk add --no-cache bash

WORKDIR /bin/

COPY --from=builder /bin/app .

EXPOSE 8080

CMD /bin/app

Info

Please run buffalo info and paste the information below where it says "PASTE_HERE". <=== doens't say that!

-> Go: Checking installation
✓ The `go` executable was found on your system at: /usr/local/bin/go

-> Go: Checking minimum version requirements
✓ Your version of Go, 1.12.3, meets the minimum requirements.

-> Go: Checking GOPATH
✓ You appear to be operating inside of your GOPATH.

-> Go: Checking Package Management
⚠ You do not appear to be using a package management system.

It is strongly suggested that you use one of the following package management systems:

* Go Modules (Recommended) - https://gobuffalo.io/en/docs/gomods
* Dep - https://github.com/golang/dep

For help setting up your Go environment please follow the instructions for you platform at:

https://www.gopherguides.com/courses/preparing-your-environment-for-go-development

-> Go: Checking PATH
✓ Your PATH contains /Users/konstantinwerhahn/Go/bin.

-> Node: Checking installation
✓ The `node` executable was found on your system at: /usr/local/bin/node

-> Node: Checking minimum version requirements
✓ Your version of Node, v10.9.0, meets the minimum requirements.

-> NPM: Checking installation
✓ The `npm` executable was found on your system at: /usr/local/bin/npm

-> NPM: Checking minimum version requirements
✓ Your version of NPM, 6.9.0, meets the minimum requirements.

-> Yarn: Checking installation
✓ The `yarnpkg` executable was found on your system at: /usr/local/bin/yarnpkg

-> Yarn: Checking minimum version requirements
✓ Your version of Yarn, 1.16.0, meets the minimum requirements.

-> PostgreSQL: Checking installation
✓ The `postgres` executable was found on your system at: /usr/local/bin/postgres

-> PostgreSQL: Checking minimum version requirements
✓ Your version of PostgreSQL, 10.5, meets the minimum requirements.

-> MySQL: Checking installation
✘ The `mysql` executable could not be found on your system.
For help setting up your MySQL environment please follow the instructions for you platform at:

https://www.mysql.com/downloads/

-> SQLite3: Checking installation
✓ The `sqlite3` executable was found on your system at: /usr/bin/sqlite3

-> SQLite3: Checking minimum version requirements
✓ Your version of SQLite3, 3.24.0, meets the minimum requirements.

-> Cockroach: Checking installation
✘ The `cockroach` executable could not be found on your system.
For help setting up your Cockroach environment please follow the instructions for you platform at:

https://www.cockroachlabs.com/docs/stable/

-> Buffalo: Checking installation
✓ The `buffalo` executable was found on your system at: /usr/local/bin/buffalo

-> Buffalo: Checking minimum version requirements
✓ Your version of Buffalo, v0.14.6, meets the minimum requirements.
@paganotoni

This comment has been minimized.

Copy link
Member

commented Jul 3, 2019

@khwerhahn is your database configured to be accessed from the GKE cluster?

@khwerhahn

This comment has been minimized.

Copy link
Author

commented Jul 3, 2019

@paganotoni yes I have other apps accessing the database. Is there anyway to isolate the database functionality in Buffalo completely to see if this is the problem or there might be another root cause?

@paganotoni

This comment has been minimized.

Copy link
Member

commented Jul 3, 2019

Yes. you can disable the tx middleware by commenting out:

app.Use(popmw.Transaction(models.DB))

In your app.go.

Another thing that comes to my mind is the health-check URL. Did you set up one for your deployment? (one thing that happened to me was that my GKE cluster was killing my app because it was not able to reach the health endpoint).

@paganotoni

This comment has been minimized.

Copy link
Member

commented Jul 3, 2019

Also ensure you're not doing

c.Value("tx").(*pop.Connection)

In your test endpoint.

@khwerhahn

This comment has been minimized.

Copy link
Author

commented Jul 3, 2019

@paganotoni: So it has nothing to do with the db connection. It must be something else. In the container log of GCE the following output is logged:

2019-07-03 19:51:26.132 CEST
�[36mINFO�[0m[2019-07-03T17:51:26Z] Starting application at 127.0.0.1:8080
2019-07-03 19:51:26.132 CEST
�[36mINFO�[0m[2019-07-03T17:51:26Z] Starting Simple Background Worker
2019-07-03 19:53:25.546 CEST
2019/07/03 17:53:25 context canceled
2019-07-03 19:53:25.546 CEST
�[36mINFO�[0m[2019-07-03T17:53:25Z] Shutting down application
I 2019-07-03T17:53:25.546523124Z �[36mINFO�[0m[2019-07-03T17:53:25Z] Shutting down worker
I 2019-07-03T17:53:25.546516070Z �[36mINFO�[0m[2019-07-03T17:53:25Z] Shutting down application
2019-07-03 19:53:25.546 CEST
�[36mINFO�[0m[2019-07-03T17:53:25Z] Stopping Simple Background Worker

Not sure why the "context canceled" is output. Any hints?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.