Skip to content

Commit

Permalink
Simplified development setup
Browse files Browse the repository at this point in the history
* Renamed `Enable-LocalTestme.ps1` to `Setup-DevEnvironment.ps1`
* Made `Setup-DevEnvironment.ps1` run migrations
* Updated README
* Removed Windows SDK Dependency
* Changed hostname to localhost instead of nuget.localtest.me
* Updated the Gallery's version of ServerCommon
  • Loading branch information
loic-sharma committed Apr 27, 2017
1 parent 547931a commit f862709
Show file tree
Hide file tree
Showing 7 changed files with 157 additions and 222 deletions.
4 changes: 2 additions & 2 deletions .vs/config/applicationhost.config
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@
<virtualDirectory path="/" physicalPath="..\..\src\NuGetGallery" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:80:nuget.localtest.me" />
<binding protocol="https" bindingInformation="*:443:nuget.localtest.me" />
<binding protocol="http" bindingInformation="*:80:localhost" />
<binding protocol="https" bindingInformation="*:443:localhost" />
</bindings>
</site>
<siteDefaults>
Expand Down
98 changes: 30 additions & 68 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,79 +10,42 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope

## Build and Run the Gallery in (arbitrary number) easy steps

1. Prerequisites. Install these if you don't already have them:
1. Visual Studio 2015 - Custom install so that you may also install Microsoft SQL Server Data Tools. This will provide the LocalDB that Windows Azure SDK requires.
2. PowerShell 2.0 (comes with Windows 7+)
3. [NuGet](http://docs.nuget.org/docs/start-here/installing-nuget)
4. [Windows Azure SDK](http://www.microsoft.com/windowsazure/sdk/)
1. Prerequisites:
1. Visual Studio 2017 - Install the following `Workloads`:
* ASP.NET and web development
* Azure development
2. PowerShell 4.0
2. Clone it!

```git clone git@github.com:NuGet/NuGetGallery.git```
```PS C:\Code> git clone git@github.com:NuGet/NuGetGallery.git```
3. Build it!

```
cd NuGetGallery
.\build
PS C:\Code> cd NuGetGallery
PS C:\Code\NuGetGallery> .\build
```
4. Set up the website in IIS Express!
1. We highly recommend using IIS Express. Use the [Web Platform Installer](http://microsoft.com/web) to install it if you don't have it already (it comes with recent versions of VS and WebMatrix though). Make sure to at least once run IIS Express as an administrator.
2. In an ADMIN powershell prompt, run the `.\tools\Enable-LocalTestMe.ps1` file. It allows non-admins to host websites at: `http(s)://nuget.localtest.me`, it configures an IIS Express site at that URL and creates a self-signed SSL certificate. For more information on `localtest.me`, check out [readme.localtest.me](http://readme.localtest.me). However, because [Server Name Indication](https://en.wikipedia.org/wiki/Server_Name_Indication) is not supported in the Network Shell on versions of Windows before 8, you must have at least Windows 8 to run this script successfully.
3. If you're having trouble, go to the _Project Properties_ for the Website project, click on the _Web_ tab and change the URL to `localhost:port` where _port_ is some port number above 1024.
5. Create the Database!
There are two ways you can create the databases. From Visual Studio 2015 or from the command line.
1. From Visual Studio 2015
1. Open Visual Studio 2015
2. Open the Package Manager Console window
3. Ensure that the Default Project is set to `NuGetGallery`
4. Open the NuGetGallery.sln solution from the root of this repository. ***Important:*** Make sure the Package Manager Console has been opened once before you open the solution. If the solution was already open, open the package manager console and then close and re-open the solution (from the file menu)
5. Run the following command in the Package Manager Console:
``` powershell
Update-Database -StartUpProjectName NuGetGallery -ConfigurationTypeName MigrationsConfiguration
```
If this fails, you are likely to get more useful output by passing `-Debug` than `-Verbose`.
2. From the command line. ***Important:*** You must have successfully built the Gallery (step 3) for this to succeed.
* Run `Update-Databases.ps1` in the `tools` folder to migrate the databases to the latest version.
* To Update both databases, Nuget Gallery and Support Request, run this command
``` powershell
.\tools\Update-Databases.ps1 -MigrationTargets NugetGallery,NugetGallerySupportRequest
```
* To update only the Nuget Gallery DB, run this
``` powershell
.\tools\Update-Databases.ps1 -MigrationTargets NugetGallery
```
* And to update only the Support Request DB, run this
``` powershell
.\tools\Update-Databases.ps1 -MigrationTargets NugetGallerySupportRequest
```
* Additionally you can provide a `-NugetGallerySitePath` parameter to the `Update-Databases.ps1` script to indicate that you want to perform the migration on a site other than the one that is built with this repository.
6. When working with the gallery, e-mail messages are saved to the file system (under `~/App_Data`).
* To change this to use an SMTP server, edit `src\NuGetGallery\Web.Config` and add a `Gallery.SmtpUri` setting. Its value should be an SMTP connection string, for example `smtp://user:password@smtpservername:25`.
* To turn off e-mail confirmations, edit `src\NuGetGallery\Web.Config` and change the value of `Gallery.ConfirmEmailAddresses` to `false`.
7. Ensure the 'NuGetGallery' project (under the Frontend folder) is set to the Startup Project
That's it! You should now be able to press Ctrl-F5 to run the site!
Be aware that you might detect a change in the __applicationhost.config__:
Unfortunately Visual Studio will replace the relative path with an absolute path. The committed applicationhost.config-file is currently the easiest way to setup the localtest.me-binding for IIS Express.
However, you can force Git to ignore the change with this command:
4. Set up the website!
```PS C:\Code\NuGetGallery> .\tools\Setup-DevEnvironment.ps1```
5. Ensure the `NugetGallery` project is the StartUp Project and press `F5` to run the site! That's it!
When working with the gallery, e-mail messages are saved to the file system (under `~/App_Data`).
You can use an SMTP server instead by editing `src\NuGetGallery\Web.Config` and adding a `Gallery.SmtpUri`
setting. Its value should be an SMTP connection string, such as: `smtp://user:password@smtpservername:25`.
You can also turn off e-email confirmations by changing the value of `Gallery.ConfirmEmailAddresses` to `false`
in the `src\NugetGallery\Web.Config` file.
Visual Studio may modify the `applicationhost.config` file. You can force git to ignore changes to this file
with:
git update-index --assume-unchanged .vs/config/applicationhost.config
You can undo this with this command:
git update-index --no-assume-unchanged .vs/config/applicationhost.config
git update-index --no-assume-unchanged .vs/config/applicationhost.config
This should help to prevent unwanted file commits.
This should help prevent unwanted file commits.
## Contribute
If you find a bug with the gallery, please visit the [Issue tracker](https://github.com/NuGet/NuGetGallery/issues) and
create an issue. If you're feeling generous, please search to see if the issue is already logged before creating a
Expand Down Expand Up @@ -122,8 +85,7 @@ This is the Git workflow we're currently using:
### Setting up
1. Clone and checkout the following branches (to make sure local copies are made): '
2. '.
Clone and checkout the `dev` branch.
### When starting a new feature/unit of work.
Expand All @@ -136,13 +98,13 @@ This is the Git workflow we're currently using:
git pull dev
2. __Create a topic branch to do your work.__
You must work in topic branches, in order to help us keep our features isolated and easily moved between branches.
You must work in topic branches to help us keep our features isolated and easily moved between branches.
Our policy is to start all topic branches off of the 'dev' branch.
Branch names should use the following format '[user]-[bugnumber]-[shortdescription]'. If there is no bug yet,
Branch names should use the following format '[user]-[bugnumber]'. If there is no bug yet,
create one and assign it to yourself!
git checkout dev
git checkout -b anurse-123-makesuckless
git checkout -b anurse-123
3. __Do your work.__
Now, do your work using the following highly accurate and efficient algorithm :)
Expand All @@ -160,7 +122,7 @@ This is the Git workflow we're currently using:
5. if (moreWorkToDo) go to #3.1 else go to #4.
4. __Start a code review.__
Start a code review by pushing your branch up to GitHub (```git push origin anurse-123-makesuckless```) and
Start a code review by pushing your branch up to GitHub (```git push origin anurse-123```) and
creating a Pull Request from your branch to ***dev***. Wait for at least someone on the team to respond with: ":shipit:" (that's called the
"Ship-It Squirrel" and you can put it in your own comments by typing ```:shipit:```).
Expand All @@ -171,7 +133,7 @@ This is the Git workflow we're currently using:
git checkout dev
git pull origin dev
git merge anurse-123-makesuckless
git merge anurse-123
... resolve conflicts ...
git push origin dev
Expand Down
6 changes: 3 additions & 3 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ param (
[string]$SemanticVersion = '1.0.0-zlocal',
[string]$Branch,
[string]$CommitSHA,
[string]$BuildBranch = '1c479a7381ebbc0fe1fded765de70d513b8bd68e'
[string]$BuildBranch = '37ff6e758c38b3f513af39f881399ce85f4ff20b'
)

# For TeamCity - If any issue occurs, this script fail the build. - By default, TeamCity returns an exit code of 0 for all powershell scripts, even if they fail
# This script should fail the build if any issue occurs.
trap {
Write-Host "BUILD FAILED: $_" -ForegroundColor Red
Write-Host "ERROR DETAILS:" -ForegroundColor Red
Expand Down Expand Up @@ -81,7 +81,7 @@ Invoke-BuildStep 'Set version metadata in AssemblyInfo.cs' {

Invoke-BuildStep 'Building solution' {
$SolutionPath = Join-Path $PSScriptRoot "NuGetGallery.sln"
Build-Solution $Configuration $BuildNumber -MSBuildVersion "14" $SolutionPath -SkipRestore:$SkipRestore -MSBuildProperties "/p:MvcBuildViews=true" `
Build-Solution $Configuration $BuildNumber -MSBuildVersion "15" $SolutionPath -SkipRestore:$SkipRestore -MSBuildProperties "/p:MvcBuildViews=true" `
} `
-ev +BuildErrors

Expand Down
2 changes: 1 addition & 1 deletion src/NuGetGallery/NuGetGallery.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2091,7 +2091,7 @@
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>80</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>https://nuget.localtest.me</IISUrl>
<IISUrl>https://localhost</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
Expand Down
2 changes: 1 addition & 1 deletion src/NuGetGallery/Web.config
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<!-- Set this if you have a Google Analytics property for the site -->
<add key="Gallery.AzureCdnHost" value="" />
<!-- Set this to the Azure CDN Host you are using for blob storage, if you have configured one -->
<add key="Gallery.SiteRoot" value="http://nuget.localtest.me/" />
<add key="Gallery.SiteRoot" value="http://localhost" />
<add key="reCAPTCHA::PrivateKey" value="" />
<add key="reCAPTCHA::PublicKey" value="" />

Expand Down
147 changes: 0 additions & 147 deletions tools/Enable-LocalTestMe.ps1

This file was deleted.

Loading

0 comments on commit f862709

Please sign in to comment.