Deployment issue (probably a settings issue)

Go Project is building but the deployment gives an error: /bin/bash: line 1: ./out: No such file or directory could a brave soul lend me a hand?
Solution:
try changing it to go build -o out cmd/server/main.go
Jump to solution
18 Replies
Percy
Percy7mo ago
Project ID: 7a1d3284-12a9-43fa-8d00-f0d4bff60434
SyrianSam
SyrianSamOP7mo ago
7a1d3284-12a9-43fa-8d00-f0d4bff60434 [Region: us-west1] ============== Using Nixpacks ============== context: d8d1dc40cb7d7ec83b41a303743833b0 ╔════════════ Nixpacks v1.21.2 ════════════╗ ║ setup │ go ║ ║──────────────────────────────────────────║ ║ install │ go mod download ║ ║──────────────────────────────────────────║ ║ build │ go build cmd/server/main.go ║ ║──────────────────────────────────────────║ ║ start │ ./out ║ ╚══════════════════════════════════════════╝ #0 building with "default" instance using docker driver #1 [internal] load build definition from Dockerfile #1 transferring dockerfile: 2.36kB done #1 DONE 0.1s #2 [internal] load metadata for ghcr.io/railwayapp/nixpacks:ubuntu-1707782610 #2 ... #3 [internal] load metadata for docker.io/library/ubuntu:jammy #3 DONE 0.3s #2 [internal] load metadata for ghcr.io/railwayapp/nixpacks:ubuntu-1707782610 #2 DONE 0.5s #4 [stage-0 1/11] FROM ghcr.io/railwayapp/nixpacks:ubuntu-1707782610@sha256:8f4b0fd95dc3311cf9a59f236d8d7d7f956fe21a2a1d64b53c82f12c4e859f09 #4 DONE 0.0s #5 [stage-0 2/11] WORKDIR /app/ #5 CACHED #6 [stage-1 1/5] FROM docker.io/library/ubuntu:jammy@sha256:a6d2b38300ce017add71440577d5b0a90460d0e57fd7aec21dd0d1b0761bbfb2 #6 DONE 0.0s #7 [internal] load .dockerignore #7 transferring context: 2B done #7 DONE 0.1s #8 [internal] load build context #8 transferring context: 118.90kB 0.1s done #8 DONE 0.2s im having a boomer moment let me figure out how to bookmark the thing
SyrianSam
SyrianSamOP7mo ago
there u go i can share my screen if it's faster
Brody
Brody7mo ago
have you changed your build command?
SyrianSam
SyrianSamOP7mo ago
yes go build cmd/server/main.go it didnt build with default settings because my go file is in a subdir i tried setting my start command to go run cmd/server/main.go but it didnt fix the issue
Solution
Brody
Brody7mo ago
try changing it to go build -o out cmd/server/main.go
SyrianSam
SyrianSamOP7mo ago
the deployment is succesful, thank you very much i'm trying to connect to the postgresdb do you know what env variables i should use? i'm currently using these ones:
No description
Brody
Brody7mo ago
you would use the variables that your code uses what variables does your code use?
SyrianSam
SyrianSamOP7mo ago
connectionString := "host=localhost port=5432 user=postgres password=pass dbname=gira sslmode=disable"
SyrianSam
SyrianSamOP7mo ago
i've set it up like this, but i'm not sure what variable to use for dbname:
No description
Brody
Brody7mo ago
PGDATABASE
SyrianSam
SyrianSamOP7mo ago
sry pop up on image
No description
SyrianSam
SyrianSamOP7mo ago
ok perfect thank you
Brody
Brody7mo ago
you can hover your mouse to the right of the hidden text to show you an eye icon that will temporarily show you the value
SyrianSam
SyrianSamOP7mo ago
do these values change per instance? or are they consistent across db deployments? it works i love you bye
Brody
Brody7mo ago
the database name would be the same across all deployments of postgres, but you should still use an environment variable for it
Want results from more Discord servers?
Add your server