R
Railway14mo ago
macwilko

Can't build go project

Using a Dockerfile I can't seem to get the GOROOT working, and package imports seem to break.
# syntax=docker/dockerfile:1

FROM golang:1.21

WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY * ./
RUN CGO_ENABLED=0 GOOS=linux go build -o /server
CMD ["/server"]
# syntax=docker/dockerfile:1

FROM golang:1.21

WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY * ./
RUN CGO_ENABLED=0 GOOS=linux go build -o /server
CMD ["/server"]
#12 [6/6] RUN CGO_ENABLED=0 GOOS=linux go build -o /server



#12 1.402 authorization.go:6:2: package exotic/exotic-auth/db/chat_users_db/model is not in std (/usr/local/go/src/exotic/exotic-auth/db/chat_users_db/model)

#12 1.402 main.go:5:2: package exotic/exotic-auth/handlers is not in std (/usr/local/go/src/exotic/exotic-auth/handlers)

#12 1.402 authorization.go:7:2: package exotic/exotic-auth/security_helpers is not in std (/usr/local/go/src/exotic/exotic-auth/security_helpers)

#12 1.402 login.go:9:2: package exotic/exotic-auth/tasks is not in std (/usr/local/go/src/exotic/exotic-auth/tasks)

#12 1.402 found packages handlers (authorization.go) and tasks (deliver_email_task.go) in /app



#12 ERROR: process "/bin/sh -c CGO_ENABLED=0 GOOS=linux go build -o /server" did not complete successfully: exit code: 1
#12 [6/6] RUN CGO_ENABLED=0 GOOS=linux go build -o /server



#12 1.402 authorization.go:6:2: package exotic/exotic-auth/db/chat_users_db/model is not in std (/usr/local/go/src/exotic/exotic-auth/db/chat_users_db/model)

#12 1.402 main.go:5:2: package exotic/exotic-auth/handlers is not in std (/usr/local/go/src/exotic/exotic-auth/handlers)

#12 1.402 authorization.go:7:2: package exotic/exotic-auth/security_helpers is not in std (/usr/local/go/src/exotic/exotic-auth/security_helpers)

#12 1.402 login.go:9:2: package exotic/exotic-auth/tasks is not in std (/usr/local/go/src/exotic/exotic-auth/tasks)

#12 1.402 found packages handlers (authorization.go) and tasks (deliver_email_task.go) in /app



#12 ERROR: process "/bin/sh -c CGO_ENABLED=0 GOOS=linux go build -o /server" did not complete successfully: exit code: 1
254 Replies
Percy
Percy14mo ago
Project ID: dd3f96f7-3ab3-4453-86a3-32328b2f81d6
macwilko
macwilkoOP14mo ago
dd3f96f7-3ab3-4453-86a3-32328b2f81d6
macwilko
macwilkoOP14mo ago
No description
macwilko
macwilkoOP14mo ago
No description
macwilko
macwilkoOP14mo ago
i'm probably being dumb
Brody
Brody14mo ago
hold on, whats with the atoi for on the redis env?
macwilko
macwilkoOP14mo ago
total go nooby that's the database I think /0 i think usually
Brody
Brody14mo ago
Atoi turns a string into an int
root
root14mo ago
Can you use Nixpacks?
macwilko
macwilkoOP14mo ago
yup, those ENV vars always strings right i would but... it's on an ancient Go version
root
root14mo ago
Ah, fair pretty sure you shouldn't use atoi for the redis db though
Brody
Brody14mo ago
yeah why are you trying to convert the database url into an int?
root
root14mo ago
You have all of your dependencies listed in your go.mod, right?
macwilko
macwilkoOP14mo ago
sorry those ENV vars are mostly fine for my local dev, I'll have to change them around when I get it compiling for Railway
macwilko
macwilkoOP14mo ago
No description
macwilko
macwilkoOP14mo ago
kinda looks like that locally
root
root14mo ago
I'd just use the REDIS_URL
Brody
Brody14mo ago
bruh, my bad i was reading REDIS_DB as REDIS_URL couldnt figure out what the hell you where doing
macwilko
macwilkoOP14mo ago
ahah, I'll fix that, tbh it looks bad
root
root14mo ago
like so
No description
macwilko
macwilkoOP14mo ago
ooo
root
root14mo ago
what happened to my newlines
macwilko
macwilkoOP14mo ago
that looks nice
root
root14mo ago
No description
root
root14mo ago
there we go hollup
macwilko
macwilkoOP14mo ago
how did you manage this terminal prompt?
Brody
Brody14mo ago
thats not any better lol
root
root14mo ago
Ray.so - Create beautiful images of your code
Turn your code into beautiful images. Choose from a range of syntax colors, hide or show the background, and toggle between a dark and light window.
macwilko
macwilkoOP14mo ago
fancy
root
root14mo ago
THE NEWLINES EXIST IN MY BROWSER I SWEAR I TOOK A SCREENSHOT OF IT oh wait hold on i'm dumb
macwilko
macwilkoOP14mo ago
😄
root
root14mo ago
No description
root
root14mo ago
there we go
macwilko
macwilkoOP14mo ago
Well i feel in great company with learning Go now 😄 thanks!
Brody
Brody14mo ago
okay back to the main problem, whats this exotic auth thing
macwilko
macwilkoOP14mo ago
ok this service is what will power the initial screen....
macwilko
macwilkoOP14mo ago
No description
macwilko
macwilkoOP14mo ago
it's basically gonna be a central server that will create a community, and then register it in a database, it'll then spin up a server on railway
root
root14mo ago
nitpick: I feel like the I agree checkbox should be a checkbox instead of a radiobutton
macwilko
macwilkoOP14mo ago
oo yes, should be 😄 so i have this auth thingy working locally, but just wanted to test it running on a real server
root
root14mo ago
Ah!
Brody
Brody14mo ago
so locally where is exotic/exotic-auth/handlers?
macwilko
macwilkoOP14mo ago
then I'm gonna start playing with the GraphQL api to create a server
root
root14mo ago
You need to have a URL-based package name like github.com/macwilko/exotic/exotic-auth
Brody
Brody14mo ago
not always
root
root14mo ago
Otherwise it treats it as part of the stdlib, right?
macwilko
macwilkoOP14mo ago
No description
root
root14mo ago
What's the name specified in your go.mod?
macwilko
macwilkoOP14mo ago
No description
macwilko
macwilkoOP14mo ago
should I change that?
root
root14mo ago
Try changing that, yeah Generally change it to the URL of the git repository
Brody
Brody14mo ago
try to just exotic
root
root14mo ago
don't do what brody says that's advice for a normal go file, not go.mod
Brody
Brody14mo ago
i have never needed a url in my go.mod file
root
root14mo ago
🤷‍♂️
No description
macwilko
macwilkoOP14mo ago
No description
root
root14mo ago
yes try that
macwilko
macwilkoOP14mo ago
ok
0.860 authorization.go:9:2: no required module provides package github.com/macwilko/exotic-auth/db/chat_users_db/model; to add it:

0.860 go get github.com/macwilko/exotic-auth/db/chat_users_db/model
0.860 authorization.go:9:2: no required module provides package github.com/macwilko/exotic-auth/db/chat_users_db/model; to add it:

0.860 go get github.com/macwilko/exotic-auth/db/chat_users_db/model
root
root14mo ago
Do you have the db/chat_users_db/model directory in your project? Or is that a separate module?
macwilko
macwilkoOP14mo ago
No description
macwilko
macwilkoOP14mo ago
No description
macwilko
macwilkoOP14mo ago
yes it's a directory
root
root14mo ago
huh
macwilko
macwilkoOP14mo ago
weird right >.< I always seem to mess up build tools
Brody
Brody14mo ago
so to be clear, yes use a url in the go.mod file if you are developing a module that will be imported by other go apps, but you arent doing that, this is the app itself, it does not need to have a url in the go.mod file
macwilko
macwilkoOP14mo ago
No description
macwilko
macwilkoOP14mo ago
guys... omg im dumb it was a got dang issues with the files copy the COPY command wasn't copying those files that were flagged as erroring lol my bad >.< thankyou for the help both of you
Brody
Brody14mo ago
now do a multistage image
macwilko
macwilkoOP14mo ago
O.O @Brody sorry one last thing... DB_SERVER_URL="root:Password123@tcp(127.0.0.1:3306)/chat_users_db?parseTime=true" this was a oddity ... for MySQL i had to specify tcp() this works locally on my server on the machine at home but on railway it's giving an error 2023/10/25 17:31:45 ERROR Unable to connect to db 2023/10/25 17:31:45 ERROR dial tcp: lookup mysql.railway.internal on 8.8.8.8:53: no such host panic: dial tcp: lookup mysql.railway.internal on 8.8.8.8:53: no such host I modified the URL to be ...
root:password@tcp(mysql.railway.internal:3306)/railway?parseTime=true
root:password@tcp(mysql.railway.internal:3306)/railway?parseTime=true
wow after I removed the TCP proxy it worked O.O (in the database settings on Railway)
Brody
Brody14mo ago
yeah the drivers want a dsn, railway only provides a url
macwilko
macwilkoOP14mo ago
gotcha ok app says its running
macwilko
macwilkoOP14mo ago
No description
Brody
Brody14mo ago
and the failed lookup, the private networks dns resolver is not available until about 2 seconds
macwilko
macwilkoOP14mo ago
exotic-auth-production.up.railway.app but not getting through, probably the PORT is wrong I hard coded the app to be on 3000 right 😄
Brody
Brody14mo ago
addr := ":3000"

if envPort := os.Getenv("PORT"); envPort != "" {
addr = ":" + envPort
}

app.Listen(addr)
addr := ":3000"

if envPort := os.Getenv("PORT"); envPort != "" {
addr = ":" + envPort
}

app.Listen(addr)
macwilko
macwilkoOP14mo ago
perfect its weird Railway doesn't add that to the variables
macwilko
macwilkoOP14mo ago
No description
macwilko
macwilkoOP14mo ago
you'd think PORT is added here
Brody
Brody14mo ago
its generated behind the scenes and changes every deployment
Brody
Brody14mo ago
0.1% cpu usage? does railway agree with that?
macwilko
macwilkoOP14mo ago
apparently lol no
Brody
Brody14mo ago
railway says 0.0 right?
macwilko
macwilkoOP14mo ago
yeah
Brody
Brody14mo ago
okay cool
macwilko
macwilkoOP14mo ago
what does your response time say? you're in canada right?
Medim
Medim14mo ago
cool metrics also, huge available ram
macwilko
macwilkoOP14mo ago
it's from gogiber 😄
Medim
Medim14mo ago
dayum
No description
macwilko
macwilkoOP14mo ago
yup
Brody
Brody14mo ago
its around 100ms
macwilko
macwilkoOP14mo ago
ok
Medim
Medim14mo ago
cryingman
No description
macwilko
macwilkoOP14mo ago
No description
macwilko
macwilkoOP14mo ago
would be cool if Railway could use the private url if the database isn't exposed
Brody
Brody14mo ago
i wouldnt worry about it, the data tab is flakey at best
macwilko
macwilkoOP14mo ago
😦 fair
Brody
Brody14mo ago
why mysql tho
macwilko
macwilkoOP14mo ago
i'll probably need to expose it though right, otherwise I'm not really able to expose it
Brody
Brody14mo ago
doesnt mysql use 500mb of mem on idle?
macwilko
macwilkoOP14mo ago
i like boring tech for data things. Less surprises 😄
Brody
Brody14mo ago
fair, ill change my question, why mysql over postgres
macwilko
macwilkoOP14mo ago
honestly it's just I'm a little more familiar with it i didn't see an especially good reason to learn postgres
Brody
Brody14mo ago
mariadb 🙂
macwilko
macwilkoOP14mo ago
right
Brody
Brody14mo ago
doesnt use as much mem as mysql, but not as little as postgres
macwilko
macwilkoOP14mo ago
how much is postgres out of curiousity?
Brody
Brody14mo ago
and i have a nice template for mariadb 🙂
macwilko
macwilkoOP14mo ago
i guess the biggest cost running free chat servers will be the database, good point
Brody
Brody14mo ago
so how are you handling the dsn database variable?
macwilko
macwilkoOP14mo ago
hold on a sec, I'll see if I can answer that AI is processing your answer
Brody
Brody14mo ago
why dont you just answer the question lol
macwilko
macwilkoOP14mo ago
I think i'll keep it public
Brody
Brody14mo ago
the database?
macwilko
macwilkoOP14mo ago
yeah
Brody
Brody14mo ago
why
macwilko
macwilkoOP14mo ago
I won't be able to connect to it otherwise (outside of the app)
Brody
Brody14mo ago
gotcha but how are you giving your code the dsn string?
Medim
Medim14mo ago
make it private just in prod salute thats what i do
macwilko
macwilkoOP14mo ago
how are you gonna fix problems to users if you can't modify the databse?
Brody
Brody14mo ago
build tooling to do that
Medim
Medim14mo ago
don't let users have problems in prod AUGH
macwilko
macwilkoOP14mo ago
is that neccisary though? I mean my PlanetScale database is public, how can someone hack your database? The passwords are so long it's impossible to brute force
Medim
Medim14mo ago
better be safe than sorry
Brody
Brody14mo ago
but my question mac 😦
macwilko
macwilkoOP14mo ago
i'm doing a string replace atm, so manually adding the tcp() bit lol
macwilko
macwilkoOP14mo ago
No description
macwilko
macwilkoOP14mo ago
my smooth 🧠
Brody
Brody14mo ago
just make a referenceable dsn variable, set this in the database's service variables and then referance this in your service
MYSQL_PRIVATE_DSN=mysql://${{MYSQLUSER}}:${{MYSQL_ROOT_PASSWORD}}@tcp(${{RAILWAY_PRIVATE_DOMAIN}}:3306)/${{MYSQL_DATABASE}}
MYSQL_PRIVATE_DSN=mysql://${{MYSQLUSER}}:${{MYSQL_ROOT_PASSWORD}}@tcp(${{RAILWAY_PRIVATE_DOMAIN}}:3306)/${{MYSQL_DATABASE}}
macwilko
macwilkoOP14mo ago
that works I'll try that one sec
Brody
Brody14mo ago
was that a question or a statement
macwilko
macwilkoOP14mo ago
statement that'll make it much easier to build the template thingy ok everything seems to be working good now... next task is to use the Railway GraphQL API from the Auth server, to create a new project with some services and such
macwilko
macwilkoOP14mo ago
alright 😄 thx! oh, right, back to the original problem though... connecting via tcp() with the internal address seems to fail?
macwilko
macwilkoOP14mo ago
should I use udp or something?
Brody
Brody14mo ago
fail with that 8.8.8.8 dns error?
macwilko
macwilkoOP14mo ago
yes if you remove the tcp proxy it works, but I don't wanna do that, otherwise I can't access the database from home (outside of railway)
Brody
Brody14mo ago
you are using github.com/go-sql-driver/mysql right?
macwilko
macwilkoOP14mo ago
yep
Brody
Brody14mo ago
add a time.Sleep(5 * time.Second) before the sql.Open
macwilko
macwilkoOP14mo ago
No description
macwilko
macwilkoOP14mo ago
right ok adding a sleep, one sec
Brody
Brody14mo ago
are you using an alpine image to run your app in?
macwilko
macwilkoOP14mo ago
# syntax=docker/dockerfile:1

FROM golang:1.21
# syntax=docker/dockerfile:1

FROM golang:1.21
strange
macwilko
macwilkoOP14mo ago
No description
macwilko
macwilkoOP14mo ago
different error now
${{MYSQLUSER}}:${{MYSQL_ROOT_PASSWORD}}@tcp(${{RAILWAY_PRIVATE_DOMAIN}}:3306)/${{MYSQL_DATABASE}}
${{MYSQLUSER}}:${{MYSQL_ROOT_PASSWORD}}@tcp(${{RAILWAY_PRIVATE_DOMAIN}}:3306)/${{MYSQL_DATABASE}}
macwilko
macwilkoOP14mo ago
No description
Brody
Brody14mo ago
side question, you are missing the schema there??
macwilko
macwilkoOP14mo ago
at least from what I've seen in sqlx, this is the right way
macwilko
macwilkoOP14mo ago
Gist
Go mysql sqlx example
Go mysql sqlx example. GitHub Gist: instantly share code, notes, and snippets.
Brody
Brody14mo ago
okay ill see what i can do, since i have had no issues with just database/sql
macwilko
macwilkoOP14mo ago
right >.< thankyou yeah that's weird... I'de prefer to use sqlx because plain sql makes things much harder (no sql injection protection for bindvars)
Brody
Brody14mo ago
wouldnt it be funny if i upload this test code and see no issues (im testing with sqlx.Connect)
macwilko
macwilkoOP14mo ago
going to try socket() instead of tcp()
macwilko
macwilkoOP14mo ago
No description
Brody
Brody14mo ago
okay its not just you
| MYSQL_PRIVATE_URL | mysql.railway.internal | mysql | Error | sql.Open error: dial tcp | 3.097963115s |
| | | | | [fd12:5e83:1f04::25:ff4:c6be]:3306: | |
| | | | | connect: connection refused | |
| MYSQL_PRIVATE_URL | mysql.railway.internal | mysql | Error | sql.Open error: dial tcp | 3.097963115s |
| | | | | [fd12:5e83:1f04::25:ff4:c6be]:3306: | |
| | | | | connect: connection refused | |
macwilko
macwilkoOP14mo ago
yeah 😦 i'm not barking mad promise 😄
Brody
Brody14mo ago
okay but why would sqlx require a different format, thats just frustrating
macwilko
macwilkoOP14mo ago
https://dev.mysql.com/doc/refman/8.0/en/transport-protocols.html i know... it's weird i was wondering if anyone of those would help hmm i might try omit the tcp bit entirely maybe nope 😦
Brody
Brody14mo ago
is your database sleeping?
macwilko
macwilkoOP14mo ago
nope
Brody
Brody14mo ago
i only got that error since the databases where sleeping, once they are awake i cant reproduce
macwilko
macwilkoOP14mo ago
oh is your url like this:
${{MYSQLUSER}}:${{MYSQL_ROOT_PASSWORD}}@tcp(${{RAILWAY_PRIVATE_DOMAIN}}:3306)/${{MYSQL_DATABASE}}
${{MYSQLUSER}}:${{MYSQL_ROOT_PASSWORD}}@tcp(${{RAILWAY_PRIVATE_DOMAIN}}:3306)/${{MYSQL_DATABASE}}
Brody
Brody14mo ago
though i am using github.com/xo/dburl to turn the regular database url environment variable into a dsn
macwilko
macwilkoOP14mo ago
No description
macwilko
macwilkoOP14mo ago
can you share that code please ^.^ never even heard of a DSN until today lol
Brody
Brody14mo ago
dsn, _ := dburl.Parse("<url>")

fmt.Println(dsn.DSN)
dsn, _ := dburl.Parse("<url>")

fmt.Println(dsn.DSN)
macwilko
macwilkoOP14mo ago
actually my URL is
${{MYSQLUSER}}:${{MYSQL_ROOT_PASSWORD}}@tcp(${{RAILWAY_PRIVATE_DOMAIN}}:3306)/${{MYSQL_DATABASE}}?parseTime=true
${{MYSQLUSER}}:${{MYSQL_ROOT_PASSWORD}}@tcp(${{RAILWAY_PRIVATE_DOMAIN}}:3306)/${{MYSQL_DATABASE}}?parseTime=true
Although I doubt that makes much difference
Brody
Brody14mo ago
this code prints the same dsn that reference variable would render to
macwilko
macwilkoOP14mo ago
sorry brody do you mind sharing: the ENV var you're using the lines that involve sqlx.Connect?
macwilko
macwilkoOP14mo ago
No description
Brody
Brody14mo ago
using 100% default database url env vars for both the public and private version of that env
macwilko
macwilkoOP14mo ago
right
Brody
Brody14mo ago
code, one sec
macwilko
macwilkoOP14mo ago
DATABASE_URL=${{MySQL.MYSQL_PRIVATE_URL}}
Brody
Brody14mo ago
yep thats what im doing, i havent modified any variables on the database services
macwilko
macwilkoOP14mo ago
sounds good, will make it easier too... i guess I just assumed the tcp was needed didn't know about the DSN bit
Brody
Brody14mo ago
it is dsn.DSN will wrap the host:port in tcp()
macwilko
macwilkoOP14mo ago
i see
Brody
Brody14mo ago
for the mysql driver that is needed
macwilko
macwilkoOP14mo ago
woo connected works wtf does it do differently that's so weird
Brody
Brody14mo ago
sqlx.Connect just calls sql.Open with the same driver name and data source name passed into it, so sqlx wasnt the problem
macwilko
macwilkoOP14mo ago
hmm, one thing is it seems to omit the parseTime=true I need to check if the databsae works without that
Brody
Brody14mo ago
then add it back
query := dsn.Query()

query.Set("connect_timeout", "5")
query.Set("timeout", "5")

dsn.RawQuery = query.Encode()
query := dsn.Query()

query.Set("connect_timeout", "5")
query.Set("timeout", "5")

dsn.RawQuery = query.Encode()
this is the code i have been using https://github.com/brody192/database-connection-tester/blob/main/internal/dbtest/databases/sql.go#L16-L30
macwilko
macwilkoOP14mo ago
oo brody you are intense
Brody
Brody14mo ago
🙂
No description
macwilko
macwilkoOP14mo ago
idk how many support engineers go into this level of detail lol
Brody
Brody14mo ago
they all do
macwilko
macwilkoOP14mo ago
guess so, salute
Brody
Brody14mo ago
i used this setup to find out that the mongodb template railway offered didnt listen on ipv6 and ipv4 by default, only ipv4
macwilko
macwilkoOP14mo ago
🙂 yeah you're essentially automating all the testing I guess
Brody
Brody14mo ago
cute little print out
Starting 12 Tests...
+-----------------------+----------------------------+----------+---------+-------+--------------+
| ENV | Host | Scheme | Status | Error | Duration |
+-----------------------+----------------------------+----------+---------+-------+--------------+
| MARIADB_PRIVATE_URL | mariadb.railway.internal | mariadb | Success | N/A | 7.498273ms |
| REDIS_PRIVATE_URL | redis.railway.internal | redis | Success | N/A | 8.496766ms |
| DRAGONFLY_PRIVATE_URL | dragonfly.railway.internal | redis | Success | N/A | 10.852575ms |
| DRAGONFLY_PUBLIC_URL | roundhouse.proxy.rlwy.net | redis | Success | N/A | 11.62038ms |
| MARIADB_PUBLIC_URL | monorail.proxy.rlwy.net | mariadb | Success | N/A | 13.966628ms |
| REDIS_PUBLIC_URL | monorail.proxy.rlwy.net | redis | Success | N/A | 14.615561ms |
| POSTGRES_PRIVATE_URL | postgres.railway.internal | postgres | Success | N/A | 19.508288ms |
| MONGO_PRIVATE_URL | mongodb.railway.internal | mongodb | Success | N/A | 20.859384ms |
| MONGO_PUBLIC_URL | monorail.proxy.rlwy.net | mongodb | Success | N/A | 22.994126ms |
| POSTGRES_PUBLIC_URL | monorail.proxy.rlwy.net | postgres | Success | N/A | 25.561527ms |
| MYSQL_PUBLIC_URL | viaduct.proxy.rlwy.net | mysql | Success | N/A | 1.88047089s |
| MYSQL_PRIVATE_URL | mysql.railway.internal | mysql | Success | N/A | 3.041569359s |
+-----------------------+----------------------------+----------+---------+-------+--------------+
| Total | 3.042123138s |
+-----------------------+----------------------------+----------+---------+-------+--------------+
Starting 12 Tests...
+-----------------------+----------------------------+----------+---------+-------+--------------+
| ENV | Host | Scheme | Status | Error | Duration |
+-----------------------+----------------------------+----------+---------+-------+--------------+
| MARIADB_PRIVATE_URL | mariadb.railway.internal | mariadb | Success | N/A | 7.498273ms |
| REDIS_PRIVATE_URL | redis.railway.internal | redis | Success | N/A | 8.496766ms |
| DRAGONFLY_PRIVATE_URL | dragonfly.railway.internal | redis | Success | N/A | 10.852575ms |
| DRAGONFLY_PUBLIC_URL | roundhouse.proxy.rlwy.net | redis | Success | N/A | 11.62038ms |
| MARIADB_PUBLIC_URL | monorail.proxy.rlwy.net | mariadb | Success | N/A | 13.966628ms |
| REDIS_PUBLIC_URL | monorail.proxy.rlwy.net | redis | Success | N/A | 14.615561ms |
| POSTGRES_PRIVATE_URL | postgres.railway.internal | postgres | Success | N/A | 19.508288ms |
| MONGO_PRIVATE_URL | mongodb.railway.internal | mongodb | Success | N/A | 20.859384ms |
| MONGO_PUBLIC_URL | monorail.proxy.rlwy.net | mongodb | Success | N/A | 22.994126ms |
| POSTGRES_PUBLIC_URL | monorail.proxy.rlwy.net | postgres | Success | N/A | 25.561527ms |
| MYSQL_PUBLIC_URL | viaduct.proxy.rlwy.net | mysql | Success | N/A | 1.88047089s |
| MYSQL_PRIVATE_URL | mysql.railway.internal | mysql | Success | N/A | 3.041569359s |
+-----------------------+----------------------------+----------+---------+-------+--------------+
| Total | 3.042123138s |
+-----------------------+----------------------------+----------+---------+-------+--------------+
macwilko
macwilkoOP14mo ago
well good job deploys are about ~1 minute now and not 10 minutes ooo
Brody
Brody14mo ago
10 minutes??
macwilko
macwilkoOP14mo ago
nice to see MySQL connects the fastest 😄 Yeah... the ruby build process is slow af
Brody
Brody14mo ago
i think mysql was sleeping at that time heres a test where all dbs are awake
Starting 12 Tests...
+-----------------------+----------------------------+----------+---------+-------+-------------+
| ENV | Host | Scheme | Status | Error | Duration |
+-----------------------+----------------------------+----------+---------+-------+-------------+
| MARIADB_PUBLIC_URL | monorail.proxy.rlwy.net | mariadb | Success | N/A | 7.969834ms |
| MARIADB_PRIVATE_URL | mariadb.railway.internal | mariadb | Success | N/A | 8.905264ms |
| REDIS_PUBLIC_URL | monorail.proxy.rlwy.net | redis | Success | N/A | 9.064799ms |
| DRAGONFLY_PUBLIC_URL | roundhouse.proxy.rlwy.net | redis | Success | N/A | 10.875556ms |
| MYSQL_PUBLIC_URL | viaduct.proxy.rlwy.net | mysql | Success | N/A | 10.797191ms |
| MYSQL_PRIVATE_URL | mysql.railway.internal | mysql | Success | N/A | 12.232928ms |
| DRAGONFLY_PRIVATE_URL | dragonfly.railway.internal | redis | Success | N/A | 13.565742ms |
| REDIS_PRIVATE_URL | redis.railway.internal | redis | Success | N/A | 11.709066ms |
| POSTGRES_PUBLIC_URL | monorail.proxy.rlwy.net | postgres | Success | N/A | 22.98597ms |
| POSTGRES_PRIVATE_URL | postgres.railway.internal | postgres | Success | N/A | 24.28533ms |
| MONGO_PRIVATE_URL | mongodb.railway.internal | mongodb | Success | N/A | 25.718863ms |
| MONGO_PUBLIC_URL | monorail.proxy.rlwy.net | mongodb | Success | N/A | 26.869439ms |
+-----------------------+----------------------------+----------+---------+-------+-------------+
| Total | 28.487027ms |
+-----------------------+----------------------------+----------+---------+-------+-------------+
Starting 12 Tests...
+-----------------------+----------------------------+----------+---------+-------+-------------+
| ENV | Host | Scheme | Status | Error | Duration |
+-----------------------+----------------------------+----------+---------+-------+-------------+
| MARIADB_PUBLIC_URL | monorail.proxy.rlwy.net | mariadb | Success | N/A | 7.969834ms |
| MARIADB_PRIVATE_URL | mariadb.railway.internal | mariadb | Success | N/A | 8.905264ms |
| REDIS_PUBLIC_URL | monorail.proxy.rlwy.net | redis | Success | N/A | 9.064799ms |
| DRAGONFLY_PUBLIC_URL | roundhouse.proxy.rlwy.net | redis | Success | N/A | 10.875556ms |
| MYSQL_PUBLIC_URL | viaduct.proxy.rlwy.net | mysql | Success | N/A | 10.797191ms |
| MYSQL_PRIVATE_URL | mysql.railway.internal | mysql | Success | N/A | 12.232928ms |
| DRAGONFLY_PRIVATE_URL | dragonfly.railway.internal | redis | Success | N/A | 13.565742ms |
| REDIS_PRIVATE_URL | redis.railway.internal | redis | Success | N/A | 11.709066ms |
| POSTGRES_PUBLIC_URL | monorail.proxy.rlwy.net | postgres | Success | N/A | 22.98597ms |
| POSTGRES_PRIVATE_URL | postgres.railway.internal | postgres | Success | N/A | 24.28533ms |
| MONGO_PRIVATE_URL | mongodb.railway.internal | mongodb | Success | N/A | 25.718863ms |
| MONGO_PUBLIC_URL | monorail.proxy.rlwy.net | mongodb | Success | N/A | 26.869439ms |
+-----------------------+----------------------------+----------+---------+-------+-------------+
| Total | 28.487027ms |
+-----------------------+----------------------------+----------+---------+-------+-------------+
12 tests all done at the same time in under 30ms
macwilko
macwilkoOP14mo ago
3s 😦
Brody
Brody14mo ago
3s from sleep
macwilko
macwilkoOP14mo ago
right 😉 gotcha so basically every query to the database is minimum 12ms?
Brody
Brody14mo ago
those are connection times, queries would be far faster at least the connection rtt would be, not accounting for actual the time it takes to do the query on the database itself
macwilko
macwilkoOP14mo ago
sec just seeing if I can fix this salute
Brody
Brody14mo ago
bugs are fun
macwilko
macwilkoOP14mo ago
i live for the bugs
macwilko
macwilkoOP14mo ago
we're in business, everything working so I figure to keep it more affordable, makes sense to have seperate databases probably a Pro feature. I'll make it so free servers spin up their own little go api but connect to the same database and then the Pro or Self hosted options can have dedicated resources
Brody
Brody14mo ago
use sqlite in a volume 🙂
macwilko
macwilkoOP14mo ago
oo maybe lol, that would be neat and really affordable to run i mean what's the trade offs there? won't sqlite be very slow to access?
Brody
Brody14mo ago
disk accessed databases would be faster than network accessed databases it's closer and all that
macwilko
macwilkoOP14mo ago
true
Brody
Brody14mo ago
and railways volumes are very fast
macwilko
macwilkoOP14mo ago
i guess its the locking of the database that's the issue for sqlite interesting
Brody
Brody14mo ago
sqlite handles that stuff doesn't it?
macwilko
macwilkoOP14mo ago
well, tbf that's a good thing to look into, and does change the game in terms of performance / cost
Brody
Brody14mo ago
the only cost for sqlite would be the cost of the volume
macwilko
macwilkoOP14mo ago
right yeah that's basically nothing ok so a typical server might have, what, 500 people in max? so could an sqlite database handle 500 or so active partipants in a given server, writing occasionally to update their last_seen_at time and maybe post a message in a channel every often remember because chat servers are inherently write heavy
SQLite supports an unlimited number of simultaneous readers, but it will only allow one writer at any instant in time.
SQLite supports an unlimited number of simultaneous readers, but it will only allow one writer at any instant in time.
single writer
Brody
Brody14mo ago
a single writer for any data anywhere on the database, or just a single writer per table?
macwilko
macwilkoOP14mo ago
Brody
Brody14mo ago
you did just say writing occasionally
macwilko
macwilkoOP14mo ago
SQLite only supports one writer at a time per database file. i mean, it could easily be there's many writers think about when a couple of people are typing in a channel and there's 20 odd channels one one person will be able to write at a time 😦
Brody
Brody14mo ago
conclusion, use postgres 🙂
macwilko
macwilkoOP14mo ago
heh shame honestly, I'd wish sqlite would work well just thinking about this. there's very little benefit deploying dedicated databases per server. So I can stick with one database, but many replica's of the Go api (for websockets / api calls etc). The only people needing a dedicated DB are enterprise users and they'll use a self hosted option anyway.
Brody
Brody14mo ago
okay then use a different document database
macwilko
macwilkoOP14mo ago
lol why do you dislike mysql so much lol it's fine
Brody
Brody14mo ago
postgres is still sql
root
root14mo ago
Do yourself a favor, don't use a document database
macwilko
macwilkoOP14mo ago
oh yeah, for sure won't be 😄
Brody
Brody14mo ago
sqlite is a document database? no?
root
root14mo ago
no
macwilko
macwilkoOP14mo ago
alrighty, time to get myself all dirty and get familiar with Railway GraphQL sqlite is like, sql but liter 😄
Brody
Brody14mo ago
I'm just calling on disk databases a document database my bad
macwilko
macwilkoOP14mo ago
no worries
Brody
Brody14mo ago
okay so use a different on disk database?
macwilko
macwilkoOP14mo ago
i'm guessing its a blob of data with lots of smart ways to efficiently index and lookup data hmm, are there any other good options? i think sqlite is the only on-disk database that offers sql like features I've heard of but anyway, I think I've concluded, there's not much cost/benefit to seperate the db for free servers. i can run a single mysql db for those users no issue, and then pro/self hosted options can use their own db if I get issues with the railway database I can switch over to planetscale later
Brody
Brody14mo ago
woohoo pog
macwilko
macwilkoOP14mo ago
is that what your concern is I guess the resiliancy of the databases
Brody
Brody14mo ago
brain empty no concerns found
macwilko
macwilkoOP14mo ago
phew your brain is becoming a beautiful almond
Brody
Brody14mo ago
almonds are too bumpy
Brody
Brody14mo ago
lmao
macwilko
macwilkoOP14mo ago
ok dumb question, but what if I have another Dockerfile in my project like Dockerfile.scheduler can I have railway build that instead?
Brody
Brody14mo ago
sure can (not a dumb question by any means) https://docs.railway.app/develop/variables#user-provided-configuration-variables
RAILWAY_DOCKERFILE_PATH=Dockerfile.scheduler
RAILWAY_DOCKERFILE_PATH=Dockerfile.scheduler
macwilko
macwilkoOP14mo ago
amazing
:46:42 ERROR Redis Error

2023/10/25 21:46:42 ERROR dial tcp [::1]:6379: connect: connection refused
:46:42 ERROR Redis Error

2023/10/25 21:46:42 ERROR dial tcp [::1]:6379: connect: connection refused
argh i think it's a bug with Shared variables
macwilko
macwilkoOP14mo ago
No description
macwilko
macwilkoOP14mo ago
I added this as a shared variable but then in the service the RAILWAY_PRIVATE_DOMAIN is missing
macwilko
macwilkoOP14mo ago
No description
macwilko
macwilkoOP14mo ago
I also don't see it here i don't have the patience to fix this right now, gonna leave it as it is gotta get other stuff working lol
Brody
Brody14mo ago
not a bug, just simply not how that works remove it from the shared variables, and add it to the redis service
macwilko
macwilkoOP14mo ago
i mean i appear to be missing the private url in redis
Brody
Brody14mo ago
yes, add it back
macwilko
macwilkoOP14mo ago
oh
Brody
Brody14mo ago
it never had one to begin with I can promise you that
macwilko
macwilkoOP14mo ago
i see
Want results from more Discord servers?
Add your server