R
Railway•13mo ago
Codemunsta

Deployment issues in Golang project

Project id : 4e543459-a744-4198-970b-be420281426a I am trying to deploy a go lang application, it's services where setup in a docker compose file but i noticed docker compose is not supported yet. So i created a redis and postgres service in my project but after building the deploy logs give this error : github.com/go-redis/redis/v8: /usr/local/go/pkg/tool/linux_amd64/compile: signal: killed failed to build, error: exit status 1
No description
34 Replies
Percy
Percy•13mo ago
Project ID: 4e543459-a744-4198-970b-be420281426a
Brody
Brody•13mo ago
please do not use air when on railway are you using a dockerfile?
Codemunsta
Codemunsta•13mo ago
hey brody, thanks for reaching out. yes i am using a docker file, along with a docker compose .yml file i would remove air now and retry
Brody
Brody•13mo ago
railway doesn't do anything with the compose file, so send me the Dockerfile please
Codemunsta
Codemunsta•13mo ago
No description
Brody
Brody•13mo ago
not very ideal tbh
Codemunsta
Codemunsta•13mo ago
i just tried to tweak it now to remove air and run with go run. however if u can suggest a better one, would be much appreciated
Brody
Brody•13mo ago
working on it
Codemunsta
Codemunsta•13mo ago
thanks how about the services on the docker compose, redis and postgres. that would mean i have to set that up manually? and how so.
Brody
Brody•13mo ago
you said you already added them didnt you?
Codemunsta
Codemunsta•13mo ago
yhh i did, was just confirming if any relative setup would be required after
Brody
Brody•13mo ago
have you added the service variables? https://docs.railway.app/develop/variables#reference-variables
FROM golang:1.20-alpine

WORKDIR /app

COPY go.mod go.sum ./

RUN go mod download

COPY . ./

RUN go build -o main ./...

ENTRYPOINT ["/app/main"]
FROM golang:1.20-alpine

WORKDIR /app

COPY go.mod go.sum ./

RUN go mod download

COPY . ./

RUN go build -o main ./...

ENTRYPOINT ["/app/main"]
the COPY .env .env has been omitted on purpose, you should absolutely not commit your .env file to your repo even if it is a private repo
Codemunsta
Codemunsta•13mo ago
Hello good morning, thanks for assisting. so i have updated the files, the build runs but it fails to connect to the db
Codemunsta
Codemunsta•13mo ago
No description
Brody
Brody•13mo ago
^
Want results from more Discord servers?
Add your server