2

I have a go app in the main.go file which has a server. The server is running on localhost:9090. I have my manifest.yaml:

applications:
  - name: golang-app
    buildpacks:
      - https://github.com/cloudfoundry/go-buildpack
    memory: 4GB
    disk_quota: 4GB
    instances: 1
    env:
      GO_APP_ENV: prod
    services:
      - go_mariadb-prod

When I push the app with cf push -f manifest.prod.yaml, everything seems to be working at first. Everything is beeing downloaded and built correctly.

But at the end it crashes and in the logs there is this error:

2023-03-07T14:14:13.86+0100 [CELL/0] OUT Downloading droplet...
   2023-03-07T14:14:14.50+0100 [CELL/0] OUT Downloaded droplet (6.8M)
   2023-03-07T14:14:14.50+0100 [CELL/0] OUT Starting health monitoring of container
   2023-03-07T14:14:14.92+0100 [APP/PROC/WEB/0] ERR bash: ./main: No such file or directory
   2023-03-07T14:14:14.93+0100 [APP/PROC/WEB/0] OUT Exit status 127
   2023-03-07T14:14:14.93+0100 [CELL/SSHD/0] OUT Exit status 0
   2023-03-07T14:14:20.21+0100 [API/1] OUT Process has crashed with type: "web"
   2023-03-07T14:14:20.22+0100 [CELL/0] OUT Cell b8118f92-f568-41d6-a3a1-125361b0d5c2 stopping instance d0442bce-ea3e-4c23-5c08-6ac4
   2023-03-07T14:14:20.22+0100 [CELL/0] OUT Cell b8118f92-f568-41d6-a3a1-125361b0d5c2 destroying container for instance d0442bce-ea3e-4c23-5c08-6ac4

I cant't figure out whats wrong here. I tried so many things by changing the manifest.yaml or the push command. But nothing works.

Zwen2012
  • 3,360
  • 9
  • 40
  • 67

1 Answers1

0

When using the go-buildpack you should stick to this docs

In general, I suggest using the CF Binary-Buildpack (way faster).

You can just build the GO app as a linux binary (shown below) on your system and just push the binary and needed assets to CF then.

GOOS=linux CGO_ENABLED=0 GOARCH=amd64 go build -ldflags '-s -w' -o main ./cmd/main.go
Mb175
  • 55
  • 9