R
Railway•2mo 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•2mo ago
Project ID: f78d75b5-8972-4d61-8517-22bbccefb41e
Brody
Brody•2mo ago
values in the nixpacks.toml file can not overwrite anything in the service settings
Boxer
Boxer•2mo ago
:cat_woah:
Brody
Brody•2mo ago
you are thinking of a railway.json file
Boxer
Boxer•2mo ago
that's true
Brody
Brody•2mo ago
but other than that what makes you think it's not being used? have you checked the build table?
Boxer
Boxer•2mo ago
i see there's a nixpacksConfigPath in the railway config maybe ill try that yeah
Boxer
Boxer•2mo ago
No description
Brody
Brody•2mo 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
Boxer•2mo ago
Yea quite a bit, this is a shared package monorepo so that wouldn't work
Brody
Brody•2mo ago
gotcha what are you using? nx, turbo?
Boxer
Boxer•2mo ago
turbo adding the nixpacksconfigpath might be working'
Boxer
Boxer•2mo ago
No description
Brody
Brody•2mo ago
you may need to adjust the the root directory in the Caddyfile
Boxer
Boxer•2mo ago
yeah for formatting i think this might work
Want results from more Discord servers?
Add your server