#Monorepo Deploy

33 messages · Page 1 of 1 (latest)

mild forge
#

Does anyone have experience with monorepo deploy?

I have nest.js back that deploys fine, and vite react that I need proxy for, so I am trying out caddy and the config I found on the official file. But something is not working as intended since caddy is not serving front. How can I add command to just serve the front, and leave backend to work as is?

torn timberBOT
#

Project ID: 8f9a18e5-76b5-4894-a3fc-54f4ddfe030b

mild forge
#

8f9a18e5-76b5-4894-a3fc-54f4ddfe030b

dapper mantle
#

please share your repo

mild forge
dapper mantle
#

shared monorepo?

mild forge
#

what do you mean?

dapper mantle
#

is this a shared monorepo?

mild forge
#

oh, yes it is shared monorepo

dapper mantle
#

does the frontend actually use exports from other packages in the repo?

mild forge
#

yes, it uses types defined in the backend

dapper mantle
#

then you would not want to set a root directory

mild forge
#

yeah, I do not use root directory, I am defining custom build commands. My idea was to somehow install caddy without disturbing backend, and then just serve frontend via caddy, backend is fine as it is

dapper mantle
#

yes you do

mild forge
#

yeah, that was a failed experiment 😄

#

I tried that, since other approach did not work

dapper mantle
mild forge
#

removed

dapper mantle
#

you also don't wan't to use cd in build or start commands, if you end up using cd in such a senario, it is likely the incorrect solution

mild forge
#

I will write scripts in root package.json to handle this

dapper mantle
#

looks like you already have the script needed to build the frontend build:fe

mild forge
#

created scripts to build from root folder

#

now all 3 services are running from root without cd

dapper mantle
#

awsome, now you have to point nixpacks to the config file using a NIXPACKS_CONFIG_FILE service variable, and have a start script to start caddy

mild forge
#

this would help me run custom nixpack for frontend only?

dapper mantle
#

yes

mild forge
#

aight, let me try it

#

cmds = [
'caddy fmt --overwrite ./Caddyfile',
] # format the Caddyfile to fix any formatting inconsistencies

this step fails, even though nixpack is in the same folder. I have tried writing just caddyfile. Should I put full path from root, something like apps/frontend/Caddyfile?

dapper mantle
#

yeah you will need the full path

mild forge
#

worked so far, I now get

#

but I assume I can figure it out from here, thanks!

dapper mantle
#

awesome!

dapper mantle
#

!s