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!
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.
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?
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.
Member
23 Points
193 Posts
Migrating from Development, to Staging, to Production?
Mar 27, 2017 01:40 PM|Captain Planet|LINK
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.
All-Star
52131 Points
23240 Posts
Re: Migrating from Development, to Staging, to Production?
Mar 27, 2017 02:39 PM|mgebhard|LINK
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.
Member
23 Points
193 Posts
Re: Migrating from Development, to Staging, to Production?
Mar 29, 2017 07:27 PM|Captain Planet|LINK
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.
Member
23 Points
193 Posts
Re: Migrating from Development, to Staging, to Production?
Mar 29, 2017 07:42 PM|Captain Planet|LINK
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.