forked from loic-sharma/BaGet
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add docs and their deployment to this repository (#47)
* Add docs and their deployment to this repository * Update actions
- Loading branch information
1 parent
954e60d
commit 24210ca
Showing
48 changed files
with
10,266 additions
and
2 deletions.
There are no files selected for viewing
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,43 @@ | ||
name: Deploy Docs to GitHub Pages | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'docs/**' | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: docs | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: yarn | ||
cache-dependency-path: '**/yarn.lock' | ||
|
||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Build the Docusaurus site | ||
run: yarn build | ||
|
||
- name: Deploy to GitHub Pages | ||
if: success() | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
deploy_key: ${{ secrets.DOCS_DEPLOY_KEY }} | ||
external_repository: 'bagetter/bagetter.github.io' | ||
publish_dir: ./build | ||
publish_branch: main | ||
user_name: 'github-actions[bot]' | ||
user_email: 'github-actions[bot]@users.noreply.github.com' | ||
commit_message: ${{ github.event.head_commit.message }} |
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,20 @@ | ||
# Dependencies | ||
/node_modules | ||
|
||
# Production | ||
/build | ||
|
||
# Generated files | ||
.docusaurus | ||
.cache-loader | ||
|
||
# Misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* |
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 @@ | ||
www.bagetter.com |
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,3 @@ | ||
module.exports = { | ||
presets: [require.resolve('@docusaurus/core/lib/babel/preset')], | ||
}; |
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,4 @@ | ||
# Debugging BaGetter | ||
|
||
!!! warning | ||
This page is a work in progress! |
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,86 @@ | ||
# BaGetter SDK | ||
|
||
You can use BaGetter's [`BaGetter.Protocol`](https://www.nuget.org/packages/BaGetter.Protocol) package to interact with a NuGet server. | ||
|
||
## Getting Started | ||
|
||
Install the [`BaGetter.Protocol`](https://www.nuget.org/packages/BaGetter.Protocol) package: | ||
|
||
``` | ||
dotnet add package BaGetter.Protocol | ||
``` | ||
|
||
## List Package Versions | ||
|
||
Find all versions of the `Newtonsoft.Json` package: | ||
|
||
```csharp | ||
NuGetClient client = new NuGetClient("https://api.nuget.org/v3/index.json"); | ||
|
||
IReadOnlyList<NuGetVersion>> versions = await client.ListPackageVersionsAsync("Newtonsoft.Json"); | ||
|
||
foreach (NuGetVersion version in versions) | ||
{ | ||
Console.WriteLine($"Found version: {version}"); | ||
} | ||
``` | ||
|
||
## Download a package | ||
|
||
```csharp | ||
NuGetClient client = new NuGetClient("https://api.nuget.org/v3/index.json"); | ||
|
||
string packageId = "Newtonsoft.Json"; | ||
NuGetVersion packageVersion = new NuGetVersion("12.0.1"); | ||
|
||
using (Stream packageStream = await client.DownloadPackageAsync(packageId, packageVersion)) | ||
{ | ||
Console.WriteLine($"Downloaded package {packageId} {packageVersion}"); | ||
} | ||
``` | ||
|
||
## Find Package Metadata | ||
|
||
```csharp | ||
NuGetClient client = new NuGetClient("https://api.nuget.org/v3/index.json"); | ||
|
||
// Find the metadata for all versions of a package. | ||
IReadOnlyList<PackageMetadata> items = await client.GetPackageMetadataAsync("Newtonsoft.Json"); | ||
if (!items.Any()) | ||
{ | ||
Console.WriteLine($"Package 'Newtonsoft.Json' does not exist"); | ||
return; | ||
} | ||
|
||
foreach (var metadata in items) | ||
{ | ||
Console.WriteLine($"Version: {metadata.Version}"); | ||
Console.WriteLine($"Listed: {metadata.Listed}"); | ||
Console.WriteLine($"Tags: {metadata.Tags}"); | ||
Console.WriteLine($"Description: {metadata.Description}"); | ||
} | ||
|
||
// Or, find the metadata for a single version of a package. | ||
string packageId = "Newtonsoft.Json" | ||
NuGetVersion packageVersion = new NuGetVersion("12.0.1"); | ||
|
||
PackageMetadata metadata = await client.GetPackageMetadataAsync(packageId, packageVersion); | ||
|
||
Console.WriteLine($"Listed: {metadata.Listed}"); | ||
Console.WriteLine($"Tags: {metadata.Tags}"); | ||
Console.WriteLine($"Description: {metadata.Description}"); | ||
``` | ||
|
||
## Search for packages | ||
|
||
Search for "json" packages: | ||
|
||
```csharp | ||
NuGetClient client = new NuGetClient("https://api.nuget.org/v3/index.json"); | ||
IReadOnlyList<SearchResult> results = await client.SearchAsync("json"); | ||
|
||
foreach (SearchResult result in results) | ||
{ | ||
Console.WriteLine($"Found package {result.PackageId} {searchResult.Version}"); | ||
} | ||
``` |
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,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 [BaGetter vs local feeds](../vs/local-feeds.md) page for reasons to upgrade to BaGetter. | ||
|
||
## 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 BaGetter to require an API Key](https://bagetter.com/docs/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 | ||
} | ||
``` |
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,30 @@ | ||
# Import nuget.org packages | ||
|
||
!!! warning | ||
This page is a work in progress! | ||
|
||
## Mirroring | ||
|
||
You can configure BaGetter to mirror nuget.org. For example, say you install BaGetter, enable mirroring, and try to install the package | ||
[`Newtonsoft.Json`](https://www.nuget.org/packages/Newtonsoft.Json/). BaGetter 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 `.\BaGetter\src\BaGetter` | ||
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 |
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,39 @@ | ||
# 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 BaGetter if you use NuGet.Server. Feel free to open a [GitHub issue](https://github.com/bagetter/BaGetter/issues) if you need help migrating. | ||
|
||
!!! info | ||
Please refer to the [BaGetter vs NuGet.Server](../vs/nugetserver.md) page for reasons to upgrade to BaGetter. | ||
|
||
## Steps | ||
|
||
Make sure that you've installed [nuget.exe](https://www.nuget.org/downloads). In PowerShell, run: | ||
|
||
```ps1 | ||
$source = "<NuGet.Server package source>" | ||
$destination = "<BaGetter package source>" | ||
``` | ||
|
||
If you've [configured BaGetter to require an API Key](https://bagetter.com/docs/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 | ||
if (!(Test-Path "Web.config")) { | ||
throw "Please run this script in the same directory as NuGet.Server's Web.config file" | ||
} | ||
(& nuget.exe list -AllVersions -Source $source).Split([Environment]::NewLine) | % { | ||
$id = $_.Split(" ")[0].Trim() | ||
$version = $_.Split(" ")[1].Trim() | ||
$path = [IO.Path]::Combine("Packages", $id, $version, "${id}.${version}.nupkg") | ||
Write-Host "nuget.exe push -Source $destination ""$path""" | ||
& nuget.exe push -Source $destination $path | ||
} | ||
``` |
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,33 @@ | ||
--- | ||
sidebar_position: 2 | ||
--- | ||
|
||
export const CenterImg = ({children, color}) => ( | ||
<p align="center"> | ||
{children} | ||
</p> | ||
); | ||
|
||
# BaGetter | ||
|
||
BaGetter (pronounced "ba getter") is a lightweight NuGet and symbol server. It is [open source](https://github.com/bagetter/BaGetter), cross-platform, and cloud ready! | ||
|
||
|
||
<CenterImg> | ||
<img width="100%" src="https://user-images.githubusercontent.com/737941/50140219-d8409700-0258-11e9-94c9-dad24d2b48bb.png"/> | ||
</CenterImg> | ||
|
||
## Run BaGetter | ||
|
||
You can run BaGetter on your preferred platform: | ||
|
||
* [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) | ||
|
||
## BaGetter SDK | ||
|
||
You can also use the [`BaGetter.Protocol`](https://www.nuget.org/packages/BaGetter.Protocol) package to interact with a NuGet server. For more information, please refer to the [BaGetter SDK](Advanced/sdk.md) guide. |
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,28 @@ | ||
# Use Alibaba (Aliyun) Object Storage Service | ||
|
||
You can store packages to [Alibaba(Aliyun) OSS](https://www.alibabacloud.com/product/oss). | ||
|
||
## Configure BaGetter | ||
|
||
You can modify BaGetter's configurations by editing the `appsettings.json` file. For the full list of configurations, please refer to [BaGetter's configuration](../configuration.md) guide. | ||
|
||
### Aliyun OSS Storage | ||
|
||
Update the `appsettings.json` file: | ||
|
||
```json | ||
{ | ||
... | ||
|
||
"Storage": { | ||
"Type": "AliyunOss", | ||
"Endpoint": "oss-us-west-1.aliyuncs.com", | ||
"Bucket": "foo", | ||
"AccessKey": "", | ||
"AccessKeySecret": "", | ||
"Prefix": "lib/bagetter" // optional | ||
}, | ||
|
||
... | ||
} | ||
``` |
Oops, something went wrong.