R
Railway•3mo ago
Boxer

Caddy in a monorepo?

I was following your template @Brody to deploy vite with Caddy https://github.com/brody192/vite-react-template/blob/main/Caddyfile in my monorepo but I think my nixpacks.toml is not getting picked up. f78d75b5-8972-4d61-8517-22bbccefb41e I created a file for my landing page in deployments/landing-nixpacks.toml
# https://nixpacks.com/docs/configuration/file

# set up some variables to minimize annoyance
[variables]
NPM_CONFIG_UPDATE_NOTIFIER = 'false' # the update notification is relatively useless in a production environment
NPM_CONFIG_FUND = 'false' # the fund notification is also pretty useless in a production environment

[phases.build]
cmds = ['pnpm --filter landing build']

# download caddy from nix
[phases.caddy]
dependsOn = [
'setup',
] # make sure this phase runs after the default 'setup' phase
nixpkgsArchive = 'ba913eda2df8eb72147259189d55932012df6301' # Caddy v2.8.4 - https://github.com/NixOS/nixpkgs/commit/ba913eda2df8eb72147259189d55932012df6301
nixPkgs = ['caddy'] # install caddy as a nix package

# format the Caddyfile with fmt
[phases.fmt]
dependsOn = [
'caddy',
] # make sure this phase runs after the 'caddy' phase so that we know we have caddy downloaded
cmds = [
'caddy fmt --overwrite Caddyfile',
] # format the Caddyfile to fix any formatting inconsistencies

# start the caddy web server
[start]
cmd = 'exec caddy run --config apps/landing/Caddyfile --adapter caddyfile 2>&1' # start caddy using the Caddyfile config and caddyfile adapter
# https://nixpacks.com/docs/configuration/file

# set up some variables to minimize annoyance
[variables]
NPM_CONFIG_UPDATE_NOTIFIER = 'false' # the update notification is relatively useless in a production environment
NPM_CONFIG_FUND = 'false' # the fund notification is also pretty useless in a production environment

[phases.build]
cmds = ['pnpm --filter landing build']

# download caddy from nix
[phases.caddy]
dependsOn = [
'setup',
] # make sure this phase runs after the default 'setup' phase
nixpkgsArchive = 'ba913eda2df8eb72147259189d55932012df6301' # Caddy v2.8.4 - https://github.com/NixOS/nixpkgs/commit/ba913eda2df8eb72147259189d55932012df6301
nixPkgs = ['caddy'] # install caddy as a nix package

# format the Caddyfile with fmt
[phases.fmt]
dependsOn = [
'caddy',
] # make sure this phase runs after the 'caddy' phase so that we know we have caddy downloaded
cmds = [
'caddy fmt --overwrite Caddyfile',
] # format the Caddyfile to fix any formatting inconsistencies

# start the caddy web server
[start]
cmd = 'exec caddy run --config apps/landing/Caddyfile --adapter caddyfile 2>&1' # start caddy using the Caddyfile config and caddyfile adapter
But i noticed the configs in the service settings are not getting overriden :/
GitHub
vite-react-template/Caddyfile at main · brody192/vite-react-template
Contribute to brody192/vite-react-template development by creating an account on GitHub.
24 Replies
Percy
Percy•3mo ago
Project ID: f78d75b5-8972-4d61-8517-22bbccefb41e
Brody
Brody•3mo ago
values in the nixpacks.toml file can not overwrite anything in the service settings
Boxer
BoxerOP•3mo ago
:cat_woah:
Brody
Brody•3mo ago
you are thinking of a railway.json file
Boxer
BoxerOP•3mo ago
that's true
Brody
Brody•3mo ago
but other than that what makes you think it's not being used? have you checked the build table?
Boxer
BoxerOP•3mo ago
i see there's a nixpacksConfigPath in the railway config maybe ill try that yeah
Boxer
BoxerOP•3mo ago
No description
Brody
Brody•3mo ago
you shouldn't need that perhaps you have not set the root directory correctly? have you read my guide? - https://docs.railway.app/tutorials/deploying-a-monorepo
Boxer
BoxerOP•3mo ago
Yea quite a bit, this is a shared package monorepo so that wouldn't work
Brody
Brody•3mo ago
gotcha what are you using? nx, turbo?
Boxer
BoxerOP•3mo ago
turbo adding the nixpacksconfigpath might be working'
Boxer
BoxerOP•3mo ago
No description
Brody
Brody•3mo ago
you may need to adjust the the root directory in the Caddyfile
Boxer
BoxerOP•3mo ago
yeah for formatting i think this might work
Boxer
BoxerOP•3mo ago
looks like it deployed
No description
Boxer
BoxerOP•3mo ago
waiting on website to appear 🤞 https://landing-production-7ab3.up.railway.app
Brody
Brody•3mo ago
there is no waiting, that is a 404 that caddy is returning
Boxer
BoxerOP•3mo ago
Oh 😭
Brody
Brody•3mo ago
^
Boxer
BoxerOP•3mo ago
Yeah that’s what I’m trying to figure out. I thought caddy run apps/landing/Caddyfile was the way to do it I see, i tested locally and i also get a blank page the fix was to fix this line in the Caddyfile
root * apps/landing/dist
root * apps/landing/dist
Brody
Brody•3mo ago
i was right 🙂
Boxer
BoxerOP•3mo ago
always i never worked with caddy so didnt understand at first thanks!
Brody
Brody•3mo ago
no problem!
Want results from more Discord servers?
Add your server