Skip to content

Commit

Permalink
Improve documentation (loic-sharma#550)
Browse files Browse the repository at this point in the history
  • Loading branch information
loic-sharma authored Jul 4, 2020
1 parent 5aeef27 commit 68e99bf
Show file tree
Hide file tree
Showing 18 changed files with 142 additions and 74 deletions.
4 changes: 4 additions & 0 deletions docs/advanced/debugging.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Debugging BaGet

!!! warning
This page is a work in progress!
File renamed without changes.
18 changes: 9 additions & 9 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

You can modify BaGet's configurations by editing the `appsettings.json` file.

## Require an API Key
## Require an API key

You can require that users provide a password, called an API Key, to publish packages.
You can require that users provide a password, called an API key, to publish packages.
To do so, you can insert the desired API key in the `ApiKey` field.

```json
Expand All @@ -20,7 +20,7 @@ Users will now have to provide the API key to push packages:
dotnet nuget push -s http://localhost:5000/v3/index.json -k NUGET-SERVER-API-KEY package.1.0.0.nupkg
```

## Enable Read-Through Caching
## Enable read-through caching

Read-through caching lets you index packages from an upstream source. You can use read-through
caching to:
Expand All @@ -46,7 +46,7 @@ The following `Mirror` setting configures BaGet to index packages from [nuget.or
!!! info
`PackageSource` is the value of the [NuGet service index](https://docs.microsoft.com/en-us/nuget/api/service-index).

## Enable Package Hard Deletions
## Enable package hard deletions

To prevent the ["left pad" problem](https://blog.npmjs.org/post/141577284765/kik-left-pad-and-npm),
BaGet's default configuration doesn't allow package deletions. Whenever BaGet receives a package deletion
Expand All @@ -64,7 +64,7 @@ downloaded if you know the package's id and version. You can override this behav
}
```

## Enable Package Overwrites
## Enable package overwrites

Normally, BaGet will reject a package upload if the id and version are already taken. You can configure BaGet
to overwrite the already existing package by setting `AllowPackageOverwrites`:
Expand All @@ -79,14 +79,14 @@ to overwrite the already existing package by setting `AllowPackageOverwrites`:
}
```

## Private Feeds
## Private feeds

A private feed requires users to authenticate before accessing packages.

!!! warning
Private feeds are not supported at this time! See [this pull request](https://github.com/loic-sharma/BaGet/pull/69) for more information.

## Database Configuration
## Database configuration

BaGet supports multiple database engines for storing package information:

Expand Down Expand Up @@ -130,7 +130,7 @@ There are two settings related to the database configuration:
- **Type**: The database engine to use, this should be one of the strings from the above list such as `PostgreSql` or `Sqlite`.
- **ConnectionString**: The connection string for your database engine.

## IIS Server Options
## IIS server options

IIS Server options can be configured under the `IISServerOptions` key. The available options are detailed at [docs.microsoft.com](https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.builder.iisserveroptions)
Note: If not specified, the MaxRequestBodySize in BaGet defaults to 250MB (262144000 bytes), rather than the ASP.NET Core default of 30MB
Expand All @@ -145,4 +145,4 @@ Note: If not specified, the MaxRequestBodySize in BaGet defaults to 250MB (26214

...
}
```
```
36 changes: 36 additions & 0 deletions docs/import/local-feeds.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Import packages from a local feed

[Local feeds](https://docs.microsoft.com/en-us/nuget/hosting-packages/local-feeds) let you use a folder as a NuGet package source.

!!! info
Please refer to the [BaGet vs local feeds](../vs/local-feeds.md) page for reasons to upgrade to BaGet.

## Steps

Make sure that you've installed [nuget.exe](https://www.nuget.org/downloads). In PowerShell, run:

```ps1
$source = "C:\path\to\local\feed"
$destination = "http://localhost:5000/v3/index.json"
```

If you've [configured BaGet to require an API Key](https://loic-sharma.github.io/BaGet/configuration/#requiring-an-api-key), set it using [the `setapikey` command](https://docs.microsoft.com/en-us/nuget/reference/cli-reference/cli-ref-setapikey):

```ps1
& nuget.exe setapikey "MY-API-KEY" -Source $destination
```

Now run the following PowerShell script:

```ps1
$packages = nuget list -AllVersions -Source $source
$packages | % {
$id, $version = $_ -Split " "
$nupkg = $id + "." + $version + ".nupkg"
$path = [IO.Path]::Combine($source, $id, $version, $nupkg)
Write-Host "nuget.exe push -Source $destination ""$path"""
& nuget.exe push -Source $destination $path
}
```
30 changes: 30 additions & 0 deletions docs/import/nugetorg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Import nuget.org packages

!!! warning
This page is a work in progress!

## Mirroring

You can configure BaGet to mirror nuget.org. For example, say you install BaGet, enable mirroring, and try to install the package
[`Newtonsoft.Json`](https://www.nuget.org/packages/Newtonsoft.Json/). BaGet doesn't have this package yet, so it will
automatically index this package from nuget.org. This is also known as "read-through caching".

For more information, please see [Enable read-through caching](../configuration#enable-read-through-caching).

## Importing package downloads from nuget.org

You can import package downloads from nuget.org:

1. Navigate to `.\BaGet\src\BaGet`
2. Run:

```
dotnet run -- import-downloads
```

## Importing all nuget.org packages

* TODO Check-in code
* Explain scaling
* Rebuild indexes at end
* Importing downloads from nuget.org
4 changes: 2 additions & 2 deletions docs/tools/migrate.md → docs/import/nugetserver.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Migrate from NuGet.Server
# Import NuGet.Server packages

[NuGet.Server](https://github.com/NuGet/NuGet.Server) is a lightweight standalone NuGet server. It is strongly recommended that you upgrade to BaGet if you use NuGet.Server. Feel free to open a [GitHub issue](https://github.com/loic-sharma/BaGet/issues) if you need help migrating.

Expand All @@ -17,7 +17,7 @@ $destination = "<BaGet package source>"
If you've [configured BaGet to require an API Key](https://loic-sharma.github.io/BaGet/configuration/#requiring-an-api-key), set it using [the `setapikey` command](https://docs.microsoft.com/en-us/nuget/reference/cli-reference/cli-ref-setapikey):

```ps1
& nuget.exe setapikey "NUGET-SERVER-API-KEY" -Source $destination
& nuget.exe setapikey "MY-API-KEY" -Source $destination
```

Now run the following PowerShell script:
Expand Down
14 changes: 7 additions & 7 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ BaGet (pronounced "baguette") is a lightweight NuGet and symbol server. It is [o

You can run BaGet on your preferred platform:

* [On your computer](quickstart/local.md)
* [Docker](quickstart/docker.md)
* [Azure](quickstart/azure.md)
* [AWS](quickstart/aws.md)
* [Google Cloud](quickstart/gcp.md)
* [Alibaba Cloud(Aliyun)](quickstart/aliyun.md)
* [On your computer](installation/local.md)
* [Docker](installation/docker.md)
* [Azure](installation/azure.md)
* [AWS](installation/aws.md)
* [Google Cloud](installation/gcp.md)
* [Alibaba Cloud(Aliyun)](installation/aliyun.md)

## BaGet SDK

You can also use the [`BaGet.Protocol`](https://www.nuget.org/packages/BaGet.Protocol) package to interact with a NuGet server. For more information, please refer to the [BaGet SDK](tools/sdk.md) guide.
You can also use the [`BaGet.Protocol`](https://www.nuget.org/packages/BaGet.Protocol) package to interact with a NuGet server. For more information, please refer to the [BaGet SDK](advanced/sdk.md) guide.
File renamed without changes.
6 changes: 3 additions & 3 deletions docs/quickstart/aws.md → docs/installation/aws.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ To use MySQL, update the `appsettings.json` file:
}
```

## Publish Packages
## Publish packages

Publish your first package with:

Expand All @@ -78,7 +78,7 @@ dotnet nuget push -s http://localhost:5000/v3/index.json symbol.package.1.0.0.sn
!!! warning
You should secure your server by requiring an API Key to publish packages. For more information, please refer to the [Require an API Key](../configuration.md#require-an-api-key) guide.

## Restore Packages
## Restore packages

You can restore packages by using the following package source:

Expand All @@ -89,7 +89,7 @@ Some helpful guides:
* [Visual Studio](https://docs.microsoft.com/en-us/nuget/consume-packages/install-use-packages-visual-studio#package-sources)
* [NuGet.config](https://docs.microsoft.com/en-us/nuget/reference/nuget-config-file#package-source-sections)

## Symbol Server
## Symbol server

You can load symbols by using the following symbol location:

Expand Down
8 changes: 4 additions & 4 deletions docs/quickstart/azure.md → docs/installation/azure.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Use Azure to scale BaGet. You can store metadata on [Azure SQL Database](https:/

You can modify BaGet's configurations by editing the `appsettings.json` file. For the full list of configurations, please refer to [BaGet's configuration](../configuration.md) guide.

### Azure SQL Database
### Azure SQL database

Update the `appsettings.json` file:

Expand Down Expand Up @@ -87,7 +87,7 @@ Update the `appsettings.json` file:
}
```

## Publish Packages
## Publish packages

Publish your first package with:

Expand All @@ -104,7 +104,7 @@ dotnet nuget push -s http://localhost:5000/v3/index.json symbol.package.1.0.0.sn
!!! warning
You should secure your server by requiring an API Key to publish packages. For more information, please refer to the [Require an API Key](../configuration.md#require-an-api-key) guide.

## Restore Packages
## Restore packages

You can restore packages by using the following package source:

Expand All @@ -115,7 +115,7 @@ Some helpful guides:
* [Visual Studio](https://docs.microsoft.com/en-us/nuget/consume-packages/install-use-packages-visual-studio#package-sources)
* [NuGet.config](https://docs.microsoft.com/en-us/nuget/reference/nuget-config-file#package-source-sections)

## Symbol Server
## Symbol server

You can load symbols by using the following symbol location:

Expand Down
8 changes: 4 additions & 4 deletions docs/quickstart/docker.md → docs/installation/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ You can now run BaGet:
docker run --rm --name nuget-server -p 5555:5000 --env-file baget.env -v "$(pwd)/baget-data:/var/baget" loicsharma/baget:latest
```

## Publish Packages
## Publish packages

Publish your first package with:

Expand All @@ -55,11 +55,11 @@ dotnet nuget push -s http://localhost:5555/v3/index.json -k NUGET-SERVER-API-KEY
!!! warning
The default API Key to publish packages is `NUGET-SERVER-API-KEY`. You should change this to a secret value to secure your server. See [Configure BaGet](#configure-baget).

## Browse Packages
## Browse packages

You can browse packages by opening the URL [`http://localhost:5555/`](http://localhost:5555/) in your browser.

## Restore Packages
## Restore packages

You can restore packages by using the following package source:

Expand All @@ -70,7 +70,7 @@ Some helpful guides:
* [Visual Studio](https://docs.microsoft.com/en-us/nuget/consume-packages/install-use-packages-visual-studio#package-sources)
* [NuGet.config](https://docs.microsoft.com/en-us/nuget/reference/nuget-config-file#package-source-sections)

## Symbol Server
## Symbol server

You can load symbols by using the following symbol location:

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

With a few extra steps you can run BaGet behind a Windows IIS proxy. This has many benefits, including automatic restarts on reboots.

## IIS Setup
## IIS setup

1. Install the [.NET Core Runtime](https://dotnet.microsoft.com/download) on the web server.
1. Copy the BaGet directory over to your hosting area such as `C:\Inetpub\wwwroot\BaGet`
Expand All @@ -18,14 +18,14 @@ With a few extra steps you can run BaGet behind a Windows IIS proxy. This has ma
- Choose `BaGetAppPool` as the application pool
- In the Binding area, enter the default BaGet port of 5000

## BaGet Folder Permissions
## BaGet folder permissions

You **may** need to give special permissions to the top-level BaGet folder so that the app can persist its state. This is necessary as the Application Pools' identity is a virtual account that isn't recognized by the Windows User Management Console. For more information, please refer to ASP.NET Core's documentation:

* [Application Pools](https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-2.2#application-pools)
* [Application Pool Identity](https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-2.2#application-pool-identity)

## Alternative Storage Path
## Alternative storage path

!!! info
Virtual Directories do not work with IIS and Kestrel. For more information, please refer to [ASP.NET Core's documentation](https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-2.2#virtual-directories).
Expand All @@ -44,6 +44,6 @@ Ensure that the configuration's storage `Path` has the appropriate forward slash
Note that you will need to adjust folder permissions if the `Path` is created outside of the BaGet top-level directory. See the [BaGet Folder Permissions](#baget-folder-permissions).


## IIS Server Options
## IIS server options

Settings such as the maximum package size can be configured for IIS in the appsettings.json file - see [IIS Server Options](../configuration.md#iis-server-options).
6 changes: 3 additions & 3 deletions docs/quickstart/local.md → docs/installation/local.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

You can modify BaGet's configurations by editing the `appsettings.json` file. For the full list of configurations, please refer to [BaGet's configuration](../configuration.md) guide.

## Publish Packages
## Publish packages

Publish your first package with:

Expand All @@ -28,7 +28,7 @@ dotnet nuget push -s http://localhost:5000/v3/index.json symbol.package.1.0.0.sn
!!! warning
You should secure your server by requiring an API Key to publish packages. For more information, please refer to the [Require an API Key](../configuration.md#require-an-api-key) guide.

## Restore Packages
## Restore packages

You can restore packages by using the following package source:

Expand All @@ -39,7 +39,7 @@ Some helpful guides:
* [Visual Studio](https://docs.microsoft.com/en-us/nuget/consume-packages/install-use-packages-visual-studio#package-sources)
* [NuGet.config](https://docs.microsoft.com/en-us/nuget/reference/nuget-config-file#package-source-sections)

## Symbol Server
## Symbol server

You can load symbols by using the following symbol location:

Expand Down
22 changes: 0 additions & 22 deletions docs/tools/mirroring.md

This file was deleted.

16 changes: 16 additions & 0 deletions docs/vs/local-feeds.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Local Feeds

!!! warning
This page is a work in progress!

[Local feeds](https://docs.microsoft.com/en-us/nuget/hosting-packages/local-feeds), also known as "folder feeds", let you
use a folder as a NuGet package source. You can access these packages using a network share.

# BaGet vs local feeds

Local feeds are very simple and are lack features like:

1. Search functionality
1. A user interface to browse your packages
1. Authentication for package uploads
1. Cloud storage for large feeds
Loading

0 comments on commit 68e99bf

Please sign in to comment.