Skip to content

Commit

Permalink
Overhaul BaGet's documentation (loic-sharma#324)
Browse files Browse the repository at this point in the history
  • Loading branch information
loic-sharma authored Sep 9, 2019
1 parent 2a9ce61 commit 2c27656
Show file tree
Hide file tree
Showing 14 changed files with 412 additions and 246 deletions.
25 changes: 0 additions & 25 deletions docs/cloud/aws.md

This file was deleted.

65 changes: 0 additions & 65 deletions docs/cloud/azure.md

This file was deleted.

23 changes: 15 additions & 8 deletions docs/configuration.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Configuration

You can modify BaGet's configurations by editing the [`appsettings.json`](https://github.com/loic-sharma/BaGet/blob/master/src/BaGet/appsettings.json) file.
You can modify BaGet's configurations by editing the `appsettings.json` file.

## Requiring 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 @@ -17,16 +17,16 @@ To do so, you can insert the desired API key in the `ApiKey` field.
Users will now have to provide the API key to push packages:

```c#
dotnet nuget push -s http://localhost:5000/v3/index.json -k NUGET-SERVER-API-KEY newtonsoft.json.11.0.2.nupkg
dotnet nuget push -s http://localhost:5000/v3/index.json -k NUGET-SERVER-API-KEY package.1.0.0.nupkg
```

## Enabling 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:

1. Speed up your builds if restores from [nuget.org](https://nuget.org) are slow
2. Enable package restores in offline scenarios
1. Enable package restores in offline scenarios

The following `Mirror` settings configures BaGet to index packages from [nuget.org](https://nuget.org):

Expand All @@ -46,7 +46,7 @@ The following `Mirror` settings configures BaGet to index packages from [nuget.o
!!! info
`PackageSource` is the value of the [NuGet service index](https://docs.microsoft.com/en-us/nuget/api/service-index).

## Enabling 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
}
```

## Enabling Package Overwrites
## Enable Package Overwrites

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

## 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.
74 changes: 8 additions & 66 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,71 +1,13 @@
# BaGet

## Getting Started
BaGet (pronounced "baguette") is a lightweight NuGet and symbol server. It is [open source](https://github.com/loic-sharma/BaGet), cross-platform, and cloud ready!

1. Install [.NET Core SDK](https://www.microsoft.com/net/download)
2. Download and extract [BaGet's latest release](https://github.com/loic-sharma/BaGet/releases)
3. Start the service with `dotnet BaGet.dll`
4. Browse `http://localhost:5000/` in your browser
## Run BaGet

## Pushing Packages
You can run BaGet on your preferred platform:

You can push a package using this command:

```
dotnet nuget push -s http://localhost:5000/v3/index.json newtonsoft.json.11.0.2.nupkg
```

## Using BaGet as a Symbol Server

You can use BaGet as a Symbol Server by uploading
[symbol packages](https://docs.microsoft.com/en-us/nuget/create-packages/symbol-packages-snupkg).
After you've pushed a package to BaGet, you can push its corresponding
symbol package using this command:

```
dotnet nuget push -s http://localhost:5000/v3/index.json symbol.package.1.0.0.snupkg
```

You will need to add the symbol location `http://localhost:5000/api/download/symbols` to load symbols from BaGet.
[Use this guide](https://docs.microsoft.com/en-us/visualstudio/debugger/specify-symbol-dot-pdb-and-source-files-in-the-visual-studio-debugger?view=vs-2017#configure-symbol-locations-and-loading-options) for Visual Studio.

## Running BaGet on Docker

If you'd like, you can run BaGet on Docker:

1. Pull the latest [docker image](https://hub.docker.com/r/loicsharma/baget):

```
docker pull loicsharma/baget
```

2. Create a file named `baget.env` with the content:

```
ApiKey=NUGET-SERVER-API-KEY
Storage__Type=FileSystem
Storage__Path=/var/baget/packages
Database__Type=Sqlite
Database__ConnectionString=Data Source=/var/baget/baget.db
Search__Type=Database
```

!!! info
The `baget.env` file stores [BaGet's configuration](configuration) as environment
variables. To learn how these configurations work, please refer to
[ASP.NET Core's Configuration documentation](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-2.1&tabs=basicconfiguration#configuration-by-environment).

3. Create a folder named `baget-data`
4. Run:

```
docker run --rm --name nuget-server -p 5555:80 --env-file baget.env -v "$(pwd)/baget-data:/var/baget" loicsharma/baget:latest
```

5. Push your first package with:

```
dotnet nuget push -s http://localhost:5555/v3/index.json -k NUGET-SERVER-API-KEY newtonsoft.json.11.0.2.nupkg
```

6. Open the URL `http://localhost:5555/` in your browser
* [On your computer](quickstart/local.md)
* [Docker](quickstart/docker.md)
* [Azure](quickstart/azure.md)
* [AWS](quickstart/aws.md)
* [Google Cloud](quickstart/gcp.md)
24 changes: 0 additions & 24 deletions docs/private-feeds.md

This file was deleted.

98 changes: 98 additions & 0 deletions docs/quickstart/aws.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Run BaGet on AWS

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

Use Amazon Web Services to scale BaGet. You can store metadata on [Amazon RDS](https://aws.amazon.com/rds/postgresql/) and upload packages to [Amazon S3](https://aws.amazon.com/s3/).

## Configure BaGet

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.

### Amazon S3

Update the `appsettings.json` file:

```json
{
...

"Storage": {
"Type": "AwsS3",
"Region": "us-west-1",
"Bucket": "foo",
"AccessKey": "",
"SecretKey": ""
},

...
}
```

### Amazon RDS

To use PostgreSQL, update the `appsettings.json` file:

```json
{
...

"Database": {
"Type": "PostgreSql",
"ConnectionString": "..."
},

...
}
```

To use MySQL, update the `appsettings.json` file:

```json
{
...

"Database": {
"Type": "MySql",
"ConnectionString": "..."
},

...
}
```

## Publish Packages

Publish your first package with:

```
dotnet nuget push -s http://localhost:5000/v3/index.json package.1.0.0.nupkg
```

Publish your first [symbol package](https://docs.microsoft.com/en-us/nuget/create-packages/symbol-packages-snupkg) with:

```
dotnet nuget push -s http://localhost:5000/v3/index.json symbol.package.1.0.0.snupkg
```

!!! 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

You can restore packages by using the following package source:

`http://localhost:5000/v3/index.json`

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

You can load symbols by using the following symbol location:

`http://localhost:5000/api/download/symbols`

For Visual Studio, please refer to the [Configure Debugging](https://docs.microsoft.com/en-us/visualstudio/debugger/specify-symbol-dot-pdb-and-source-files-in-the-visual-studio-debugger?view=vs-2017#configure-symbol-locations-and-loading-options) guide.
Loading

0 comments on commit 2c27656

Please sign in to comment.