10 months ago
I have the following configuration. What's wrong?
{
"$schema": "https://schema.railpack.com/",
"secrets": [
"BETTER_AUTH_SECRET",
"BETTER_AUTH_URL",
"CORS_ORIGIN",
"DATABASE_URL",
"DISCORD_CLIENT_ID",
"DISCORD_CLIENT_SECRET",
"GOOGLE_CLIENT_ID",
"GOOGLE_CLIENT_SECRET",
"TWITCH_CLIENT_ID",
"TWITCH_CLIENT_SECRET"
],
"steps": {
"install": {
"commands": ["bun install"],
"variables": {
"NODE_ENV": "production"
}
},
"build": {
"inputs": [{ "step": "install" }],
"secrets": ["BETTER_AUTH_URL", "CORS_ORIGIN", "DATABASE_URL"],
"commands": ["bun run db:generate && bun run --filter web build"]
},
"predeploy": {
"inputs": [{ "step": "build" }],
"commands": ["bun run db:migrate"]
}
},
"deploy": {
"startCommand": "bun run --filter web start",
"variables": {
"NODE_ENV": "production"
}
}
}I somehow got it working using some configs in the Settings tab but I'm wondering if it's possible to make this work only using a railpack config.
75 Replies
I somehow got it working using some configs in the Settings tab but I'm wondering if it's possible to make this work only using a railpack config.
the problem is, that I need to run the generate in the root directory bc of prisma
10 months ago
Can you try this in your build step? local
"build": {
"inputs": [
{
"step": "install"
},
{
"local": true
}
],
"commands": [
"bun run db:generate && bun run --filter web build"
]
}
}10 months ago
Also on install,
"install": {
"inputs": [
{
"local": true,
"include": [
"package.json",
"bun.lockb",
"bun.lock"
]
}
],
"commands": [
"bun install"
]
}10 months ago
Try that
10 months ago
sorry (put yoour desired bun version)
"install": {
"inputs": [
{
"image": "oven/bun:latest"
},
{
"local": true,
"include": [
"package.json",
"bun.lockb",
"bun.lock"
]
}
],
"commands": [
"bun install"
]
}10 months ago
I also missed this, "local": {} instead of true
at least the docker image pulled. idk. it feels like the code is just straight up missing or sth

10 months ago
Hmm
and the other thing to keep in mind that it somehow worked with this config
but I normally don't deploy on railpack directly thus this isn't a sutable option for me
10 months ago
You can generate a railpack from that service (with that config)
10 months ago
Click the service, and the latest deployment (with your desired config) then click Details.
{
"$schema": "https://railway.com/railway.schema.json",
"build": {
"builder": "RAILPACK",
"buildCommand": "bun run db:generate && bun run --filter web build"
},
"deploy": {
"runtime": "V2",
"numReplicas": 1,
"startCommand": "bun run --filter web start",
"preDeployCommand": [
"bun run db:migrate"
],
"sleepApplication": false,
"useLegacyStacker": false,
"multiRegionConfig": {
"europe-west4-drams3a": {
"numReplicas": 1
}
},
"restartPolicyType": "NEVER"
}
}i'm not sure if that is railpack directly? looks like its some railway specific configuration
10 months ago
You are correct
10 months ago
My bad on that one
10 months ago
Have you tried explicitly including at the steps? Only thing that comes to mind now

{
"$schema": "https://schema.railpack.com/",
"secrets": [
"BETTER_AUTH_SECRET",
"BETTER_AUTH_URL",
"CORS_ORIGIN",
"DATABASE_URL",
"DISCORD_CLIENT_ID",
"DISCORD_CLIENT_SECRET",
"GOOGLE_CLIENT_ID",
"GOOGLE_CLIENT_SECRET",
"TWITCH_CLIENT_ID",
"TWITCH_CLIENT_SECRET"
],
"steps": {
"install": {
"inputs": [
{
"image": "oven/bun:latest"
},
{
"local": true,
"include": ["."]
}
],
"commands": ["bun install"]
},
"build": {
"inputs": [
{ "step": "install" },
{
"local": true,
"include": ["."]
}
],
"secrets": ["BETTER_AUTH_URL", "CORS_ORIGIN", "DATABASE_URL"],
"commands": ["bun run db:generate", "bun run --filter web build"]
},
"predeploy": {
"inputs": [
{ "step": "build" },
{
"local": true,
"include": ["."]
}
],
"commands": ["bun run db:migrate"]
}
},
"deploy": {
"startCommand": "bun run --filter web start",
"variables": {
"NODE_ENV": "production"
}
}
}like this?
10 months ago
Yes
10 months ago
10 months ago
Okay this looks better
10 months ago
At least its picking up stuff
10 months ago
I need to drop off for a bit, I'd suggest you use the config that works in the meanwhile so you don't get more frustrated - I'll give this a shot once I'm back, also someone with more experience in Railpack might jump in and help
10 months ago
<:salute:1137099685417451530>
10 months ago
any reason you need that custom railpack config in the first place?
I'm trying to deploy using railpack on dokploy but I wasn't able to get my railpack running at all
10 months ago
ah I see. in most cases I would say it is not recommend to use a custom config file if possible since it lose out on several optimizations that railpack makes. in your case it looks like you just want to have a custom build and start command. I'm not sure the configuration options in Dokploy, but can you set these variables
RAILPACK_BUILD_CMD=bun run db:generate && bun run --filter web build && bun run db:migrateRAILPACK_START_CMD=bun run --filter web start
And the other thing I used the config for is the limitation of wich Secrets are shared in the different steps, as Better Auth spams me with those annoying "Do not include XYZ_SECRET in the build process..." messages
10 months ago
I see. can you try something like
{
"$schema": "https://schema.railpack.com/",
"secrets": [
"BETTER_AUTH_SECRET",
"BETTER_AUTH_URL",
"CORS_ORIGIN",
"DATABASE_URL",
"DISCORD_CLIENT_ID",
"DISCORD_CLIENT_SECRET",
"GOOGLE_CLIENT_ID",
"GOOGLE_CLIENT_SECRET",
"TWITCH_CLIENT_ID",
"TWITCH_CLIENT_SECRET"
],
"steps": {
"build": {
"secrets": ["BETTER_AUTH_URL", "CORS_ORIGIN", "DATABASE_URL"],
"commands": ["bun run db:generate", "bun run --filter web build"]
},
"predeploy": {
"inputs": [{ "step": "build" }],
"commands": ["bun run db:migrate"]
}
},
"deploy": {
"inputs": ["...", { "step": "predeploy", "include": ["."] }],
"startCommand": "bun run --filter web start",
"variables": {
"NODE_ENV": "production"
}
}
}the main changes
- you don't need to include inputs unless you are changing them or they are non-default
- you need to include the predeploy output in the final image
10 months ago
Did what was suggested work for you?
10 months ago
Is the underscore in the host a typo? _
10 months ago
Can’t have underscores in the host name

10 months ago
Look in the Private Networking section for the proper endpoint
10 months ago
Does it look like this in Settings -> Private Networking?

10 months ago
the private network is not available when building at the moment. you can instead do the migration at the start. Change the start command to bun run db:migrate && bun run --filter web start
okay, that seems to have worked on railway. but for some reason the migration fails on my dokploy instance.. <:confused:1031885128613511219>

Looks like there are some files missing. Any Idea why?
That's my current config:
{
"$schema": "https://schema.railpack.com/",
"secrets": [
"BETTER_AUTH_SECRET",
"BETTER_AUTH_URL",
"CORS_ORIGIN",
"DATABASE_URL",
"DISCORD_CLIENT_ID",
"DISCORD_CLIENT_SECRET",
"GOOGLE_CLIENT_ID",
"GOOGLE_CLIENT_SECRET",
"TWITCH_CLIENT_ID",
"TWITCH_CLIENT_SECRET"
],
"steps": {
"build": {
"commands": [
"apt-get update && apt-get install -y tree && tree -I 'node_modules'",
"bun run --filter @esc-plus-app/db db:generate -- --schema=$(pwd)/packages/db/prisma/schema/schema.prisma",
"bun run --filter '*' build"
]
},
"predeploy": {
"secrets": ["DATABASE_URL"],
"inputs": [{ "step": "build" }],
"commands": ["bun run --filter @esc-plus-app/db db:migrate"]
}
},
"deploy": {
"inputs": ["...", { "step": "predeploy", "include": ["."] }],
"startCommand": "bun run --filter web start",
"variables": {
"NODE_ENV": "production"
}
}
}
why does this only copy the package.json and the prisma-dir? do I need to add a input to my first build step??












