forked from NuGet/NuGetGallery
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
88fa3d7
commit 1a26ca4
Showing
9 changed files
with
159 additions
and
65 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Deploying the NuGet Gallery to Windows Azure Cloud Services | ||
|
||
## Setting up resources | ||
To run the NuGet Gallery on Windows Azure Cloud Services you need to provision the following Azure resources: | ||
|
||
1. An Azure Cloud Service | ||
2. An Azure SQL Database (preferably in a dedicated Azure SQL Server) to hold the package metadata | ||
3. An Azure Storage account to hold package files, diagnostics data, etc. | ||
|
||
It is assumed you've already provisioned the SQL Database and Storage Account using the [main guide](../README.md). | ||
|
||
## Provisioning the Frontend | ||
Create an Azure Cloud Service. Poof, done. Ok, not quite. Grab the [src\NuGetGallery.Cloud\ServiceConfiguration.Local.cscfg](..\..\..\src\NuGetGallery.Cloud\ServiceConfiguration.Local.cscfg) file and copy it to somewhere **OUTSIDE** the repository. Give it a name that you'll remember like "MyNuGetGallery.TestEnvironment.cscfg". Update the settings as per the comments inside the file using the connection strings you received while provisioning resources for the site (SQL DB, Azure Storage, etc.). | ||
|
||
Save this file somewhere safe and **SECURE** as it now has passwords for your database inside! | ||
|
||
## Deploying the Service | ||
These steps should be repeated each time you have new code to deploy. | ||
|
||
### Migrate the Database | ||
Migrate the database by running "Update-Database" from the Package Manager Console in a Visual Studio session with NuGetGallery.sln. You must select "NuGetGallery" as the default project. Use the "-ConnectionString" parameter to specify the connection string to the target database. | ||
|
||
We attempt to ensure most migrations are additive, but please verify this before migrating your database. Our development process attempts to ensure that old code can read new data for a short transition period. If you keep your code up to date with ours (we deploy approximately fortnightly) then you should be able to match this process. | ||
|
||
### Updating Service Credentials | ||
We highly recommend updating service credentials (SQL passwords, Azure Storage keys, etc.) on each deployment to reduce the risk of credential leakage. Some incomplete notes on doing this are listed below: | ||
|
||
1. Use the CreateSqlUser task in the 'galops' executable (implemented in NuGetGallery.Operations) to create a SQL User suitable for the Gallery Frontend and update the SQL Connection String for the Frontend to use it. NOTE: DO NOT remove the old user until the old code is offline. ALSO: DO NOT use this user in the Backend as the Backend requires administrator permissions. | ||
2. Regenerate the Azure Storage keys that are NOT CURRENTLY BEING USED by the live service and update the following settings with it. NOTE: There are multiple storage accounts (Primary, Backup and optionally Diagnostics). All storage account keys should be refreshed like this. | ||
|
||
### Deploy the package | ||
1. Click on the cloud service | ||
2. Click "Staging" at the top | ||
3. Click "Update" at the bottom | ||
4. Upload/Select from blob storage the CSCFG and CSPKG files produced by building the solution | ||
5. Select "ALL" roles and check all the checkboxes | ||
6. Enter a meaningful name for the deployment (i.e. "Oct14 @ 1529 (deadbeef21)", where deadbeef21 is the commit hash of the build being used) | ||
7. GO! | ||
8. Once deployment completes, verify the staging URL | ||
9. If the staging URL checks out, VIP Swap! | ||
10. Repeat steps 1-7 to deploy the same code to the Staging slot so you can easily make configuration changes and VIP Swap to reduce downtime. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Deploying the NuGet Gallery to Windows Azure Websites | ||
|
||
## Setting up resources | ||
To run the NuGet Gallery on Windows Azure Websites you need to provision the following Azure resources: | ||
|
||
1. An Azure Website running .Net 4.5 to run the gallery frontend | ||
2. An Azure SQL Database (preferably in a dedicated Azure SQL Server) to hold the package metadata | ||
3. An Azure Storage account to hold package files, diagnostics data, etc. | ||
4. [Optional] An Azure Cloud Service to run the gallery backend worker | ||
5. [Optional] An Azure Cloud Service to provide SSL Forwarding and Traffic Management to the gallery frontend | ||
|
||
It is assumed you've already provisioned the SQL Database and Storage Account using the [main guide](../README.md). | ||
|
||
## Provisioning the Frontend | ||
Create an Azure Website and configure it for deployment however you choose (Git deployment, FTP, etc.). | ||
|
||
Using the connection strings you received while provisioning resources for the site (SQL DB, Azure Storage, etc.), go to the Configure tab of the website and set the AppSettings. To determine what to set, open the [src\NuGetGallery\Web.config](..\..\..\src\NuGetGallery\Web.config) file up and use the comments in the AppSettings section to assist you. | ||
|
||
Save the changes and get ready to deploy! | ||
|
||
## Deploying the Frontend with Git | ||
(If you want to use a different deployment mechanism, you're on your own :)) | ||
|
||
Go back to the dashboard tab and set up deployment from source control. Assuming you cloned this repo from Git, you probably want to choose "Local Git Repository". That is the case we will cover here. | ||
|
||
Once you complete this wizard, you'll need to set up deployment credentials. I'll assume you've got that under control ;). Go to the gallery and checkout the branch you want to deploy (say 'master'): | ||
|
||
``` | ||
git checkout master | ||
``` | ||
|
||
Add Azure as remote and push that branch up! | ||
|
||
``` | ||
git remote add azure [git url] | ||
git push azure master | ||
``` | ||
|
||
NOTE: If you don't use master, make sure to update the "Branch to Deploy" setting in the Configure tab. | ||
|
||
After pushing, the site will build, which may take a while. Once finished, just browse to the site and it should start up! The first request may take quite a while, so be prepared to wait a few minutes. | ||
|
||
Now that you've got the site up, try registering a user and uploading a package! | ||
|
||
## Deploying the backend | ||
TODO. |
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters