Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Alex 30 posts 120 karma points
    Feb 11, 2015 @ 20:28
    Alex
    0

    Bug? Lost access to my stylesheets/templates

    Hi everyone,

    I had a strange thing happen to my umbraco backend a couple days ago. I basically lost access to my stylesheets and templates from the umbraco backend (I am an administrator with full access and run Umbraco 7). I could see them at their respective location in the menus (settings->templates->mytemplate), however when trying to access them, the window would get stuck during the loading phase and the content would never appear.

    This happened out of the blue. 

    I did a new deployment and copied/pasted all the umbraco related files, without restoring the database, and it all came back together. Now I am worried that this might occur again once my site goes live. Would anyone have some insights of what the causes could be?

  • Ryios 122 posts 263 karma points
    Feb 11, 2015 @ 21:10
    Ryios
    0

    Sounds like they no longer existed in the physical disk. They will still show up in the back office if they don't exist on disk. Could something else have happened to make them no longer be on the disk?

    Templates/Css/Js etc are not physically stored in the database, just references to them.

  • Alex 30 posts 120 karma points
    Feb 11, 2015 @ 21:12
    Alex
    0

    Thanks for the quick reply mate. The issue is that they still were physically there, which is why I am getting confused. I did have a couple guys adding content at the same time, but they would not have been able to remove anything.

  • Ryios 122 posts 263 karma points
    Feb 11, 2015 @ 21:33
    Ryios
    0

    How are you deploying, just copying stuff out or doing a publish from visual studio with MSDeploy?

  • Ryios 122 posts 263 karma points
    Feb 11, 2015 @ 21:37
    Ryios
    0

    Also, it could have been an angular js issue.

    The backoffice in Umbraco 7 is basically 100% angular JS, it's a thick client. So the ui will still appear to function when the application pool shuts down (as all the ui is running client side), or is resetting etc. However something like loading a template will make it perform server side ajax calls. I find that occasionally said server side call will timeout (because the app pool doesn't spin back up fast enough, or it did but now the authenitcation session is dead). Then I have to refresh the whole page to (maybe login again) to get it to load something.

  • Alex 30 posts 120 karma points
    Feb 11, 2015 @ 22:08
    Alex
    0

    This happened in my staging envyonment, which shares an sql server database with my dev environment. To update the Umbraco instance on staging, I do a publish and copy the files physically there.

    Once happy with staging, I will move everything to my production environment which has its own sql server database. If it is only a sync problem with db reference between two environments that happened here I am happy, as it will never occur in production, I am just not sure at this point.

    Thank you for the heads up on the backoffice angular js.

  • Ryios 122 posts 263 karma points
    Feb 11, 2015 @ 22:43
    Ryios
    100

    Ahh, your problem is probably the cache... Umbraco caches everything it loads, including templates. Because you are sharing the same database with your local environment and the staging server, you have 2 different caches for the same datasource. What probably happened is you deployed some stuff but the staging cache didn't refresh.

    To fix that just republish the site via the Content node in the back office, it will reset the cache..

    I'll add on how I setup my stuff,


    In our setup, I have the entire site in visual studio, and I have MSDeploy configured. So I just right click the site in solution explorer and click publish.

    There I get the choice of publishing to dev (staging) or production. It applies web.config transforms for each configuration. So if I publish to dev it uses the localhost db server, because sql is on the box, but if I publish to production it uses the db server connection string (production sql server).

    Locally (running on my local VM) I use my own sql database for umbraco, and occasionally I just do a backup of staging and make it my local database, so I can pound my local environment without breaking staging.

    Now, templates are the equivalent of mvc views if umbraco is in MVC mode, cshtml files. They are in my project in visual studio in the views folder, which is the umbraco structure for doing so.

    So if I publish from visual studio, the views (aka Templates) go out with the publish. Being MSDeploy, only templates that have been added or updated go out. Same thing with my css and scripts folder. However we don't keep our css and scripts in umbraco, I made an Empty ASP.Net website called "CDNHost" and all our css/js is in there, so it's like our own CDN. I deploy that from the same solution as well.

    SO my site structure is like this

    CDN Host
        -> Lib
            -> BootStrap
               -> Live
                   -> Css
                      -> Bootstrap.min.css .... etc
        -> etc...
    SomeNameUmbraco (usses the nuget package to install umbraco)
        -> App_Plugins
        -> Code
        -> Config
        -> config
        -> css
        -> Dependencies
        -> umbraco (we don't include the entire tree in the project, just the stuff we added, the rest is on disk, but not in the project)
           -> Images
              -> Icons we have added
        -> Views
           -> Partials
           etc...
        web.config
        etc
    

    The web.config has 2 transformations, one for dev and one for production, which is done by adding 2 new build configurations. Production is based on the release build configuration and Dev is based on the Debug Build Configuration. So our production site deploys in release mode and Staging in debug mode.

    Also we have some css files in the site (show up in back office) but only site specific styles that I wanted our designer to be able to edit. (I'm working on a source controlled enabled asset manager to solve that problem, browser css/js ide)

    We use the CDN approach because we have mutiple sites all using bootstrap, font awesome etc, and we didn't want our users to be downloading bootstrap 10 times...

    Deployment wise, it's easy because all I have to do is

    SomeNameHereUmbraco -> Publish -> Dev Server

    And it's done, I don't have to push out document types, data types, or packages either, because we only use umbraco packages with nuget versions, and we use USiteBuilder to code first all of our Document Types

    However, USiteBuilder has some bugs, so we manage our own branch of USiteBuilder (made some tweaks). I also completely recoded how uSiteBuilder syncs data types to support some complex property editors we developed and to support updating existing datatypes with new names etc.

    I should add on, that we do use Courier, which doesn't have a nuget package, so we have to make sure that's installed on 2 local environments, staging, and production... And it breaks USiteBuilder without some assembly redirect bindings for Castle. Was a pain to get working, but it works well now. The only thing we use Courier for is Media Types (deploying from local -> staging) and moving content from staging to production.

  • Ryios 122 posts 263 karma points
    Feb 11, 2015 @ 23:01
    Ryios
    0

    The cache actually confuses me, because I can delete the temp folder from AppData, reset every application pool, IIS Reset, and somehow the cache is still there... It must be storing it some place else. So I thought maybe ASPNet Temporary Files, so I deleted that too, nope still cached, so maybe in roaming or somewhere in program files, not sure.

  • Alex 30 posts 120 karma points
    Feb 12, 2015 @ 21:04
    Alex
    0

    This is brilliant. Thank you very much Ryan.

  • Alex 30 posts 120 karma points
    Feb 12, 2015 @ 21:06
    Alex
    0

    I need to rethink my deployment strategy now, thank you again for your input !

  • Ryios 122 posts 263 karma points
    May 01, 2015 @ 09:03
    Ryios
    0

    Yeah, I really need to get a blog up on how to setup deployment like I have, it's pretty awesome.

    We have right click publishing on 4 sites and 3 databases. I can move a change from Local Dev, to Staging, test it, then to Prod in less than 5 minutes... Assuming a small change.

    More than that, I need to fork USiteBuilder and submit my customizations for a pull request, as I fixed DataType syncing in Umbraco 7 and added support for Media Types.

Please Sign in or register to post replies

Write your reply to:

Draft