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?
18 Replies
Project ID:
7a1d3284-12a9-43fa-8d00-f0d4bff60434
build logs please - https://bookmarklets.up.railway.app/log-downloader/
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
there u go
i can share my screen if it's faster
have you changed your build command?
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
try changing it to
go build -o out cmd/server/main.go
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:
you would use the variables that your code uses
what variables does your code use?
connectionString := "host=localhost port=5432 user=postgres password=pass dbname=gira sslmode=disable"
i've set it up like this, but i'm not sure what variable to use for dbname:
PGDATABASE
sry pop up on image
ok perfect
thank you
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
do these values change per instance? or are they consistent across db deployments?
it works
i love you
bye
the database name would be the same across all deployments of postgres, but you should still use an environment variable for it