https://discord.umbraco.com logo
#help-with-umbraco
Models in umbraco cloud
# help-with-umbraco
u

2lach

01/29/2024, 1:12 PM
Hey so im working with umbraco cloud and got 2 instances 1 dev and 1 live When working locally i got "ModelsBuilder" set to "ModelsMode": "SourceCodeManual" however this setting breaks the site in the live/production environment. I fixed the error in prod by deleting the models and pushing the changes, this breaks my dev env instead but my production env works fine. However this does not feel like a good solution. Whats the recommended way to work with models between local -> dev -> prod environments? since the InMemoryAuto option in not a viable option when working locally
managed to find a solution by using:
Copy code
"ModelsBuilder": {
        "ModelsMode": "SourceCodeAuto",
        "ModelsDirectory": "~/umbraco/models"
      }
in production and in dev
Copy code
"ModelsBuilder": {
        "ModelsMode": "SourceCodeAuto",
       }
a

Ambert

01/29/2024, 7:02 PM
Usually for production mode you set modelsbuilderMode to None and just include the models in your release
u

2lach

01/30/2024, 7:03 AM
Will try this
a

Ambert

01/30/2024, 10:06 AM
Makes it a bit safer, so you know you have the exact same models
m

mistyn8

01/30/2024, 10:39 AM
@Ambert but isn't that the rub.. here you are expecting to always change any doctypes locally and push left to right.. but once you'd delivered a cloud site to the end client they could conceivable be left to their own devices, changing doctypes and partial files directly on cloud... so either they have to code with magic strings
node.Value<string>("new property")
or you have to say
ModelsBuilderMode None
isn't how you want it on cloud? I do find having used umbraco since v4 that some of the original beauty of umbraco around you didn't need a developer and CD/CI setup to allow a less tech client self serve via the back office with a bit of guidance has been eroded back to if you want that change you need your developer.... the new runtime production mode for instance that suggests best practise is to lock down template alterations on production in favour of your developer has to deploy changes. I know it's more of an enterprise methodology at that point..... but.... 😉 It's almost like we need a uda deploy via the backoffice local->developent->uat->production to know to regenerate modelsbuilder files on a doctype change?
a

Ambert

01/30/2024, 10:55 AM
Might be brain atm, but i dont get the point, you prefer to make on the fly changes on production?
m

mistyn8

01/30/2024, 11:07 AM
trying to say that you might deliver a cloud site to your client and that's the end of your involvement.. The umbraco backofice on prod is there for them to self serve. And that used to include template alteration/doctype alteration by that end client were simple developer things that the umbraco backoffice opened up to them in a none tech WYSIWYG UI. eg Somehting small fry... I want to add a second mobile no to a person, and display it on the site.. well away you go then setting-> doctype add the new property, now alter the person partial/component @person.SecondMobile and you're good to go. (all via the friendly intuitive Umbraco backoffice on your production site no costly developer needed) 🙂
a

Ambert

01/30/2024, 11:33 AM
Still possible ofcourse, but id not recommend if your project/business cant have downtime / breakdowns, its much safer, haha
m

mistyn8

01/30/2024, 1:31 PM
I just think the UMB usp is being diluted with best practise that Prod should now just be for a content editor.. (no template or partial changes allowed etc.. ) 🙂 With regards no downtime, first step would be to add a uat tier to cloud?... Do you happen to know if doctype change on cloud uat -> deployed to Prod gives us regenerated models builder on prod? I'm guessing not as that should be what @2lach was reporting deploying via the backoffice schema changes can cause modelsbuilder out of sync issues on higher tiers?
s

Sebastiaan

01/30/2024, 1:37 PM
@mistyn8 uSync helps with all of that and you can have best practices AND a sane development process (AND if you really must let random people mess around with your carefully tailored website 😅 ).
u

2lach

01/30/2024, 5:46 PM
This worked well 👍
a

Ambert

01/30/2024, 5:46 PM
Good to hear @2lach 😄