Skip to content

Commit

Permalink
Update Nitro docs (#127)
Browse files Browse the repository at this point in the history
* docs: add nitro docus

* huge update on Nitro docs

* Update github version and stars

* Add CICD for nitro docs and enable posthog plugin

* disable nitro build for docs/** path

* Change support.md

---------

Co-authored-by: 0xSage <[email protected]>
Co-authored-by: Service Account <[email protected]>
  • Loading branch information
3 people authored Nov 13, 2023
1 parent b92f310 commit cb85601
Show file tree
Hide file tree
Showing 55 changed files with 13,752 additions and 66 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ on:
branches:
- main
tags: ['v*.*.*']
paths: ['.github/scripts/**','.github/workflows/**', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu']
paths: ['.github/scripts/**','.github/workflows/build.yml', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '!docs/**', '!.gitignore']
pull_request:
types: [opened, synchronize, reopened]
paths: ['.github/scripts/**','.github/workflows/**', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu']
paths: ['.github/scripts/**','.github/workflows/build.yml', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '!docs/**', '!.gitignore']

env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
Expand Down
73 changes: 73 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Nitro Docs

on:
push:
branches:
- main
paths:
- 'docs/**'
pull_request:
branches:
- main
paths:
- 'docs/**'
- '.github/workflows/docs.yml'
# Review gh actions docs if you want to further define triggers, paths, etc
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on

jobs:
deploy:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18

- name: Install jq
uses: dcarbone/[email protected]

- name: Fill env vars
run: |
env_example_file=".env.example"
touch .env
while IFS= read -r line || [[ -n "$line" ]]; do
if [[ "$line" == *"="* ]]; then
var_name=$(echo $line | cut -d '=' -f 1)
echo $var_name
var_value="$(jq -r --arg key "$var_name" '.[$key]' <<< "$SECRETS")"
echo "$var_name=$var_value" >> .env
fi
done < "$env_example_file"
working-directory: docs
env:
SECRETS: '${{ toJson(secrets) }}'

- name: Install dependencies
run: yarn install
working-directory: docs
- name: Build website
run: sed -i '/process.env.DEBUG = namespaces;/c\// process.env.DEBUG = namespaces;' ./node_modules/debug/src/node.js && yarn build
working-directory: docs

- name: Add Custome Domain file
if: github.event_name == 'push' && github.event.pull_request.head.repo.full_name != github.repository
run: echo "${{ vars.DOCUSAURUS_DOMAIN }}" > ./docs/build/CNAME

# Popular action to deploy to GitHub Pages:
# Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus
- name: Deploy to GitHub Pages
if: github.event_name == 'push' && github.event.pull_request.head.repo.full_name != github.repository
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Build output to publish to the `gh-pages` branch:
publish_dir: ./docs/build
# The following lines assign commit authorship to the official
# GH-Actions bot for deploys to `gh-pages` branch:
# https://github.com/actions/checkout/issues/13#issuecomment-724415212
# The GH actions bot is used by default if you didn't specify the two fields.
# You can swap them out with your own user credentials.
user_name: github-actions[bot]
user_email: 41898282+github-actions[bot]@users.noreply.github.com
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
*.pdb

# Kernel Module Compile Results
*.mod*
*.mod
*.cmd
.tmp_versions/
modules.order
Expand Down
2 changes: 2 additions & 0 deletions docs/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
POSTHOG_PROJECT_API_KEY=xxxx
POSTHOG_APP_URL=xxxx
21 changes: 21 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 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*
.env
45 changes: 45 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Website

This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.

### Installation

```
$ yarn
```

### Local Development

```
$ yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

Using SSH:

```
$ USE_SSH=true yarn deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.

### Additional Plugins
- @docusaurus/theme-live-codeblock
- [Redocusaurus](https://redocusaurus.vercel.app/): manually upload swagger files at `/openapi/OpenAPISpec.json`
3 changes: 3 additions & 0 deletions docs/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
6 changes: 6 additions & 0 deletions docs/blog/authors.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dan-jan:
name: Daniel Onggunhao
title: Co-Founder
url: https://github.com/dan-jan
image_url: https://avatars.githubusercontent.com/u/101145494?v=4
email: [email protected]
12 changes: 12 additions & 0 deletions docs/blog/hello-world.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: Hello World
description: This is my first post on Docusaurus.
slug: hello-world
authors:
- name: Daniel
tags: [hello, jan]
image: https://i.imgur.com/mErPwqL.png
hide_table_of_contents: false
---

Hello World!
Empty file added docs/blog/test.md
Empty file.
3 changes: 3 additions & 0 deletions docs/docs/api/overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Overview
---
4 changes: 4 additions & 0 deletions docs/docs/community/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: Nitro Changelog
---

54 changes: 54 additions & 0 deletions docs/docs/community/coc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
title: Code of Conduct
---

# Maximize Signal-to-Noise Ratio

## 1. Don't Waste Time
- **Efficient Contributions**: Ensure your posts, commits, or comments are efficient and valuable. Avoid low-effort or trivial contributions.
- **Consequence of Non-Compliance**: Repeated low-value contributions may lead to removal or a ban.
- **Impact**: This policy aims to minimize distractions and time-wasting (Noise).

## 2. Add Value
- **Contribute Meaningfully**: Your contributions should be concise, impactful, and helpful.
- **Focus on Clarity**: Be clear and to the point. Avoid lengthy, complex explanations where simpler ones will do.

## 3. Do No Harm
- **Respectful Interaction**: No tolerance for insults, trolling, or disruptive debates.
- **Maintain Positive Environment**: Harassing behavior or needless argumentation will lead to an immediate, irrevocable ban.

### Guidelines for Constructive Contributions

**Effective Use of Time**:
- Time is invaluable. Use it wisely and respect others' time.
- Make sure reading your contribution is worthwhile and not a drain on cognitive resources.

**What to Do**:
- **High-Quality Posts**: Well-organized, clear, concise, and to the point.
- **Efficient Demonstrations**: Convey information quickly and clearly.
- **Useful Examples**: Illustrate how and why things work without unnecessary detail.

**What to Avoid**:
- **Unproductive Debates**: Avoid arguing over minor details or off-topic issues.
- **Shifting Focus**: Don’t constantly change topics or goals.
- **Excessive Length or Irrelevance**: Long-winded, opinionated, or irrelevant posts.

### Encouraging Valuable Contributions

**Focus on Adding Value**:
- Contribute only when it enhances understanding, solves problems, or is genuinely helpful.
- If unsure whether your contribution adds value, consider refining or omitting it.

**Positive Contributions Include**:
- Solving problems efficiently.
- Adding or improving code.
- Sharing resources that benefit the collective understanding.

### Maintaining a Respectful Environment

**Zero Tolerance for Disruptive Behavior**:
- Any form of trolling, flaming, or griefing is strictly prohibited.
- Disruptive behavior leads to immediate and permanent exclusion.

**Participation is a Privilege**:
- Remember that being part of this project and community is a privilege. Act responsibly and respectfully to maintain a productive and inclusive environment.
41 changes: 41 additions & 0 deletions docs/docs/community/contribuiting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
title: Contributing to Nitro
---

Nitro is an open-source, fast, lightweight, and embeddable inference engine. It's used in [Jan](https://jan.ai/). This document guides you through the process of contributing to Nitro, whether you’re new to open source or an experienced contributor.

- For New Contributors, please check out [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/) for a general guide on open-source contribution.

## Code of Conduct
Before contributing, please read our [Code of Conduct](coc) to understand the rules and expectations in our community.

## Get Involved
There are many ways to contribute to Nitro, and not all involve coding. Here's a few ideas to get started:

- Begin by going through the [Getting Started](nitro/overview) guide. If you encounter issues or have suggestions, let us know by [opening an issue](https://github.com/janhq/nitro/issues).

- Browse [open issues](https://github.com/janhq/nitro/issues). You can offer workarounds, clarification, or suggest labels to help organize issues. If you find an issue you’d like to resolve, feel free to [open a pull request](https://github.com/janhq/nitro/pulls). Start with issues tagged as `Good first issue`.

- Read through Nitro's documentation. If something is confusing or can be improved, click “Edit this page” at the bottom of most docs to propose changes directly on GitHub.

- Check out feature requests from the community. You can contribute by opening a [pull request](https://github.com/janhq/nitro/pulls) for something you’re interested in working on.

### Join our Discord Channel
We have the [#nitro-dev](https://discord.gg/FTk2MvZwJH) channel on [Discord](https://discord.gg/FTk2MvZwJH) to discuss all things about Nitro development. You can also be of great help by helping other users in the help channel.

## How to Contribute
### Reporting Issues
- If you encounter problems with Nitro, create a [GitHub issue](https://github.com/janhq/nitro).
- Describe the issue in detail, including error logs and steps to reproduce it.

### Feature Requests
- For new features, submit a request on [Nitro’s official GitHub](https://github.com/janhq/nitro). Avoid duplicate requests and clearly explain the benefits of your proposed feature.

### Pull Requests
- You can submit one Pull Request (PR) per day.
- Make sure your PR has a clear description and adheres to Nitro's code style and structure.
- Avoid unnecessary reformatting or refactoring. PRs not following these guidelines will be considered non-compliant and may be rejected.

### Triaging Issues and PRs
- Help manage incoming issues and PRs by asking for more information, suggesting labels, flagging stale issues, or asking for test plans.
- Review code if you can and provide constructive feedback.
17 changes: 17 additions & 0 deletions docs/docs/community/support.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: Support
---

On this page we've listed some Nitro-related communities that you can be a part of; see the other pages in this section for additional online and in-person learning materials.

## Discord

Join our [Discord](https://discord.gg/FTk2MvZwJH) for questions and discussion. Use the `#nitro-dev`` channel for discussions or questions.

## Github

Join our [Github](https://github.com/janhq/nitro) for understanding codebase.

## News
For the latest news about Nitro, follow [Nitro Discord](https://discord.gg/FTk2MvZwJH) and the [official Nitro blog](https://nitro.jan.ai) on this website.

6 changes: 6 additions & 0 deletions docs/docs/guides/overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Overview
slug: /guides
---

About Nitro
3 changes: 3 additions & 0 deletions docs/docs/guides/troubleshooting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Troubleshooting Nitro
---
33 changes: 33 additions & 0 deletions docs/docs/nitro/architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: Architecture
---

:::info
This document is being updated. Please stay tuned.
:::

![Nitro Architecture](img/architecture.drawio.png)

### Components

- **Nitro CLI**: A command-line interface that manages model conversion and compilation for deployment.

- **Converter**: Transforms the model into a compatible format (GGUF) for the Nitro system.
- **Compiler**: Optimizes the converted model for efficient execution.

- **TensorRT - LLM**: A specialized component for large language models using NVIDIA's TensorRT optimization.

- **Triton Inference Server**: Serves the optimized model, facilitating scalable and efficient inference requests via gRPC.

- **Nitro.cpp**: The C++ implementation handling the deployment and interfacing of the models.

- **Adapters**:
- **llama.cpp**:
- **Triton LMDeploy**:.
- **Inference File Server**: Manages files necessary for inference operations.
- **Cache**: Stores temporary data to improve performance.
- **Apps**:
- **Interface**:
- **JanAPI**:
- **OpenAI Compatible**: Ensures compatibility with OpenAI standards for ease of integration.

Binary file added docs/docs/nitro/img/architecture.drawio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit cb85601

Please sign in to comment.