locked
Migrating from Development, to Staging, to Production? RRS feed

  • Question

  • User-745958333 posted

    Hi all.

    I'm a single developer (i.e, there's no team involved) and my site is about to go Live.  My site includes reading from a back-end database and uploading files (the files are named according to primary keys inserted into the database, so there is a relationship there).

    Anyway.  I'm thinking about a strategy of migrating from my Development environment (i.e, my laptop with Visual Studio and IIS Express) to some form of Staging site (so I can get friends and family to test remotely) and then to a Production site.  Whilst maintaining version control somehow.

    What's the best strategy for this?  Am i best to buy another domain (such as mydomaintest.co.uk) for the staging environment and point it to 'another' (i.e the staging version) website on my virtual private server etc?

    Just wondered what the recommended approach is.  I'm worried about things becoming unmanageable and overwriting things in my production filesystem or database!

    Thanks.

    Monday, March 27, 2017 1:40 PM

All replies

  • User475983607 posted

    Captain Planet

    What's the best strategy for this?  Am i best to buy another domain (such as mydomaintest.co.uk) for the staging environment and point it to 'another' (i.e the staging version) website on my virtual private server etc?

    I would unless you want to test on the production URL.

    You can use source control to manage your environments.  For example, has a branch for dev, test and prod.  Then only merge from dev to test and test to prod.  The strategy is also dependent on the source control you are using.  Here are a few examples.

    https://www.visualstudio.com/en-us/articles/branching-strategies-with-tfvc

    https://www.visualstudio.com/en-us/docs/tfvc/branch-strategically

    For the database,m it's common to "refresh" dev or test with production data from time to time or at the end of a production build/deployment.

    Monday, March 27, 2017 2:39 PM
  • User-745958333 posted

    Thanks for this.  I've set up a test domain now as advised.  I've then set up two publishing profiles in Visual Studio called Dev and Prod that publish via FTP to my dev site (staging) and my prod site.  It works well.

    However I don't think this publish method (FTP) supports code first database migrations.  What I mean by that is, the Database section under Settings is blank.  It says "Databases aren't supported by this method".  Which is fine.  However, I then tested the following and it didn't work as expected:

    - Added a new public property to a DB model

    - Ran add-migration testdev (it found the changes)

    - Ran update-database (it made the changes to my dev database)

    I then changed the publish profile in the drop down list to Prod....

    - Ran add-migration testprod (it DID NOT find the changes)

    I imagine web.config transformations only take place during Publish time and not when adding a migration?  What would be the best way for me to manage this?

    Thanks again.

    Wednesday, March 29, 2017 7:27 PM
  • User-745958333 posted

    I've done some Googling and think I'm perhaps best to manually run the scripts generated from the migrations and apply them manually to the production database.

    Wednesday, March 29, 2017 7:42 PM