Unable to connect mariadb from a golang docker app deployed in fly.io

162 Views Asked by At

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"

0

There are 0 best solutions below