#Speeding up deployment times?

26 messages · Page 1 of 1 (latest)

half zephyr
#

Greets! Love Railway... so much easier than GCP . But only don't love how long it takes to deploy containers. My svelte4 app takes almost 5 mins to build and deploy, with about 1/3 being just deploying. I'm not sure what is up.. on netlify it's about half the time, same code. Wondering what I can do to speed things up somewhat. Any tips appreciated, if documented somewhere. Maybe there are some extra checks for prod etc that I can disable in my staging env so I can get to testing it faster.

Project ID : 7ff52821-b7d2-459c-bff8-3f070394a82b

lofty prairieBOT
#

Project ID: 7ff52821-b7d2-459c-bff8-3f070394a82b

half zephyr
#

Note that, there's nothing wrong. The deploy works fine without any errors or warnings and the app works fine. It's just.... slow to get there. Hurts the dev cycle a bit.

obtuse topaz
#

hello, would you mind if i shared the build table here so we can talk about it, I'm seeing a lot of room for improvements

half zephyr
#

which is the build table?

obtuse topaz
#

the table at the top of the build logs

half zephyr
#

oh at the top of the build?

#

sure

obtuse topaz
#
╔══════════════════════════════ Nixpacks v1.31.0 ══════════════════════════════╗
║ setup      │ nodejs, libreoffice, qpdf, libnss3, libatk1.0-0, libatk-        ║
║            │ bridge2.0-0, libcups2, libgbm1, libasound2, libpangocairo-1.0-  ║
║            │ 0, libxss1, libgtk-3-0, libxshmfence1, libglu1                  ║
║──────────────────────────────────────────────────────────────────────────────║
║ install    │ npm install -g [email protected] && corepack enable               ║
║            │ pnpm i --frozen-lockfile                                        ║
║──────────────────────────────────────────────────────────────────────────────║
║ build      │   echo "Looking for soffice..." && find / -name soffice         ║
║            │ 2>/dev/null && echo "Soffice search complete." && corepack      ║
║            │ enable && corepack prepare [email protected] --activate && pnpm       ║
║            │ install && cd packages && cd common && pnpm build && cd .. &&   ║
║            │ cd jobs && pnpm build && cd .. && cd ai && pnpm build && cd ..  ║
║            │ && if [ "$NODE_ENV" = "development" ]; then echo "Skipping      ║
║            │ builds in development mode"; else if [ "$RAILWAY_SERVICE" =     ║
║            │ "dashboard" ]; then cd dashboard && pnpm build; elif [          ║
║            │ "$RAILWAY_SERVICE" = "jobs" ]; then echo "jobs package already  ║
║            │ built"; elif [ "$RAILWAY_SERVICE" = "api" ]; then cd api &&     ║
║            │ pnpm build; fi; fi                                              ║
║            │                                                                 ║
║──────────────────────────────────────────────────────────────────────────────║
║ start      │ cd packages/$RAILWAY_SERVICE && pnpm start                      ║
╚══════════════════════════════════════════════════════════════════════════════╝
half zephyr
#

i see a couple spots where the build takes many seconds, esp at the end. but also the deploy step after build takes about 2 mins

#

is that just because the codebase has gotten to be sprawling? (node_modules is huge now?)

obtuse topaz
#
  1. i dont think your svelte app needs libreoffice and all of its deps?
  2. you are enabling corepack twice, once in the install, and again in the build phase
  3. your install command is installing all deps for all packages, you can likely get away with only installing the deps needed for the svelte app.
  4. you are running install twice, once during the install phase, and again in the build phase.
  5. its a tell tale sign if you are using cd in any phase, something is being done wrong, you should be using the --filter flag for pnpm instead
#

im sure theres more, but thats what sticks out to me

half zephyr
#

THANK YOU!

  1. my svelte app doesnt need libreoffice, but my backend does. it's a monorepo. i'll think about how i can improve this so it's not installed in the frontend's container
  2. which stage should i be using to enable corepack, install or build?
  3. monorepo-- not sure if can just install minimums for svelte app, but will play around here
  4. good catch!
  5. blame AI 🙂

I'll look at all these suggestions.

But would you say all this affects the deploy time after the build as well? (maybe because libre is huge? idk)

gaunt crescent
#

maybe netlify is doing cache on your builds while Railway doesn't most of the times

obtuse topaz
#
  1. do you have a nixpacks.toml file with those deps defined? you could create a svelte specific nixpacks.toml file that doesnt include that stuff.
  2. yep, install only.
  3. maybe, im not sure if your svelte app will rely on built files from other packages.
  4. 🙂
  5. fair

But would you say all this affects the deploy time after the build as well? (maybe because libre is huge? idk)

oh yes for sure, a lot is happening that doesnt need to, you could likely even get your build times down even further with a custom dockerfile since then you could really tweak every bit of how the build is done.

obtuse topaz
half zephyr
#

there's no silver bullet here, i think is your takeaway @brody

i've clearly just got to bear down and redo everything with my own docker, feels like, vs battling with nixpacks. then i can test it faster locally to ensure that the docker build phases are quick. agree?

#

like, a container config for each of my services in the monorepo.

obtuse topaz
#

you could definitely do all you need to with a nixpacks.toml file, but I personally would do with a Dockerfile, yeah

#

a dockerfile for each package

#

and dont use cd lol

half zephyr
#

right, no more cd FTW

#

do you guys have any example projects i could reference on how to set up the dockerfile within railway?

obtuse topaz
#

Just have a svelte.Dockerfile in your repo and set a RAILWAY_DOCKERFILE_PATH=svelte.Dockerfile variable

obtuse topaz
#

!s