3

I have a MariaDB server running in AWS. I have enabled firewall rule for 3306 in the running instance and when I deploy the golang app in Heroku, I am able to get the API responses from the deployed heroku app. But, when I deploy the same golang app in fly.io, I am not able to get the API results from fly.io. Please help me on this.

Dockerfile:

FROM golang:1.18 AS builder

RUN mkdir /app
ADD . /app
WORKDIR /app

RUN CGO_ENABLED=0 GOOS=linux go build -o app cmd/server/main.go

FROM alpine:latest AS production
COPY --from=builder /app .
CMD ["./app"]

fly.toml

# fly.toml file generated for {I used my app name here} on 2022-05-21T09:08:25+05:30

app = "{I used my app name here}"

kill_signal = "SIGINT"
kill_timeout = 5
processes = []

[env]

[experimental]
  allowed_public_ports = []
  auto_rollback = true

[[services]]
  http_checks = []
  internal_port = 8080
  processes = ["app"]
  protocol = "tcp"
  script_checks = []

  [services.concurrency]
    hard_limit = 25
    soft_limit = 20
    type = "connections"

  [[services.ports]]
    force_https = true
    handlers = ["http"]
    port = 80

  [[services.ports]]
    handlers = ["tls", "http"]
    port = 443

  [[services.tcp_checks]]
    grace_period = "1s"
    interval = "15s"
    restart_limit = 0
    timeout = "2s"

  • can you provide service definition file for container? How your service is expose? Also are you able to reach server within namespace? – jits_on_moon May 22 '22 at 06:35
  • @jits_on_moon I do not have service definitions. I declared secret keys in fly.io and those keys - mariadb connection string is one of them. I am just using these env variables and when I comment the code for db, it works just fine. But, when I deploy with db connection strings, I am not even able to start app. the ui window fly.io platform just shows "your app is being deployed". I tried with changing db connection strings got from oracle cloud instance now and getting same result. used keys: os.Getenv("MARIADB") os.Getenv("PORT") os.Getenv("CERTFILEPATH") os.Getenv("CERTKEYPATH") – chunchugappa May 22 '22 at 10:29

0 Answers0