Skip to content

Commit

Permalink
Publish documentation on GitHub Pages (#1085)
Browse files Browse the repository at this point in the history
* Add template structure

* Customize theme

* Add existing pages

* Setup basic structure

* More content

* Document storages

* Fill landing page

* Remove underscores from URLs

* Move content from FAQ into docs

* Remove TODOs for now

* Link to website
  • Loading branch information
Acconut authored Feb 23, 2024
1 parent 809a8c8 commit 9b6f2f0
Show file tree
Hide file tree
Showing 28 changed files with 984 additions and 331 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,14 @@ updates:
go:
patterns:
- '*'

- package-ecosystem: bundler
directory: /docs/
schedule:
interval: monthly
allow:
- dependency-type: direct
groups:
website:
patterns:
- '*'
18 changes: 18 additions & 0 deletions .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,21 @@ jobs:
run: |
go vet ./pkg/...
go vet ./internal/...
pages:
runs-on: ubuntu-latest
defaults:
run:
working-directory: docs
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1' # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
cache-version: 0 # Increment this number if you need to re-download cached gems
working-directory: '${{ github.workspace }}/docs'
- name: Build with Jekyll
run: bundle exec jekyll build
66 changes: 66 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Sample workflow for building and deploying a Jekyll site to GitHub Pages
name: Deploy Jekyll site to Pages

on:
push:
branches:
- "main"
paths:
- "docs/**"

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

jobs:
# Build job
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: docs
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1' # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
cache-version: 0 # Increment this number if you need to re-download cached gems
working-directory: '${{ github.workspace }}/docs'
- name: Setup Pages
id: pages
uses: actions/configure-pages@v3
- name: Build with Jekyll
# Outputs to the './_site' directory by default
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
env:
JEKYLL_ENV: production
- name: Upload artifact
# Automatically uploads an artifact from the './_site' directory by default
uses: actions/upload-pages-artifact@v1
with:
path: "docs/_site/"

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,7 @@ breaking changes have been introduced, please look at the [1.13.0 tag](https://g

## Documentation

* [Installation](/docs/installation.md)
* [Using the `tusd` binary](/docs/usage-binary.md)
* [Monitoring the server](/docs/monitoring.md)
* [Receiving events with hooks](/docs/hooks.md)
* [Managing upload locks](/docs/locks.md)
* [Using the tusd package programmatically](/docs/usage-package.md)
* [FAQ & Common issues](/docs/faq.md)
The entire documentation, including guides on installing, using, and configuring tusd can be found on the website: [tus.github.io/tusd](https://tus.github.io/tusd).

## Build status

Expand Down
12 changes: 12 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# These are directly copied from Jekyll's first-party docs on `.gitignore` files:
# https://jekyllrb.com/tutorials/using-jekyll-with-bundler/#commit-to-source-control

# Ignore the default location of the built site, and caches and metadata generated by Jekyll
_site/
.sass-cache/
.jekyll-cache/
.jekyll-metadata

# Ignore folders generated by Bundler
.bundle/
vendor/
7 changes: 7 additions & 0 deletions docs/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
source 'https://rubygems.org'

gem "jekyll", "~> 4.3.3" # installed by `gem jekyll`
# gem "webrick" # required when using Ruby >= 3 and Jekyll <= 4.2.2

gem "just-the-docs", "0.7.0" # pinned to the current release
# gem "just-the-docs" # always download the latest release
86 changes: 86 additions & 0 deletions docs/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
colorator (1.1.0)
concurrent-ruby (1.2.2)
em-websocket (0.5.3)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0)
eventmachine (1.2.7)
ffi (1.16.3)
forwardable-extended (2.6.0)
google-protobuf (3.25.1-arm64-darwin)
google-protobuf (3.25.1-x86_64-linux)
http_parser.rb (0.8.0)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
jekyll (4.3.3)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
i18n (~> 1.0)
jekyll-sass-converter (>= 2.0, < 4.0)
jekyll-watch (~> 2.0)
kramdown (~> 2.3, >= 2.3.1)
kramdown-parser-gfm (~> 1.0)
liquid (~> 4.0)
mercenary (>= 0.3.6, < 0.5)
pathutil (~> 0.9)
rouge (>= 3.0, < 5.0)
safe_yaml (~> 1.0)
terminal-table (>= 1.8, < 4.0)
webrick (~> 1.7)
jekyll-include-cache (0.2.1)
jekyll (>= 3.7, < 5.0)
jekyll-sass-converter (3.0.0)
sass-embedded (~> 1.54)
jekyll-seo-tag (2.8.0)
jekyll (>= 3.8, < 5.0)
jekyll-watch (2.2.1)
listen (~> 3.0)
just-the-docs (0.7.0)
jekyll (>= 3.8.5)
jekyll-include-cache
jekyll-seo-tag (>= 2.0)
rake (>= 12.3.1)
kramdown (2.4.0)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liquid (4.0.4)
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.4.0)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (5.0.4)
rake (13.0.6)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rexml (3.2.6)
rouge (4.2.0)
safe_yaml (1.0.5)
sass-embedded (1.69.5-arm64-darwin)
google-protobuf (~> 3.23)
sass-embedded (1.69.5-x86_64-linux-gnu)
google-protobuf (~> 3.23)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
unicode-display_width (2.5.0)
webrick (1.8.1)

PLATFORMS
arm64-darwin-22
arm64-darwin-23
x86_64-linux

DEPENDENCIES
jekyll (~> 4.3.3)
just-the-docs (= 0.7.0)

BUNDLED WITH
2.3.26
13 changes: 13 additions & 0 deletions docs/hooks.md → docs/_advanced-topics/hooks.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
---
title: Customization via hooks
layout: default
nav_order: 1
---

## Table of contents
{: .no_toc .text-delta }

1. TOC
{:toc}

# Hooks
{: .no_toc }

When integrating tusd into an application, it is important to establish a communication channel between tusd and your main application. For this purpose, tusd provides a hook system which triggers user-defined actions when certain events happen, for example when an upload is created or finished. This simple-but-powerful system enables many uses, such as logging, validation, authorization, and post-processing of the uploaded files.

Expand Down
6 changes: 6 additions & 0 deletions docs/locks.md → docs/_advanced-topics/locks.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
---
title: Upload locks
layout: default
nav_order: 2
---

# Upload Locks

## Why are locks necessary?
Expand Down
6 changes: 6 additions & 0 deletions docs/monitoring.md → docs/_advanced-topics/monitoring.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
---
title: Monitoring tusd
layout: default
nav_order: 3
---

# Monitoring tusd

tusd exposes metrics at the `/metrics` endpoint ([example](https://tusd.tusdemo.net/metrics)) in the [Prometheus Text Format](https://prometheus.io/docs/instrumenting/exposition_formats/#text-based-format). This allows you to hook up Prometheus or any other compatible service to your tusd instance and let it monitor tusd. Alternatively, there are many [parsers and client libraries](https://prometheus.io/docs/instrumenting/clientlibs/) available for consuming the metrics format directly.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
---
title: Embedding in Go programs
layout: default
nav_order: 4
---

# Using the tusd package programmatically

Besides from running tusd using the provided binary, you can embed it into your own Go program:
Expand Down
66 changes: 66 additions & 0 deletions docs/_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
title: tusd documentation
description: Reference server implementation in Go of tus, the open protocol for resumable file uploads.
theme: just-the-docs

url: https://just-the-docs.github.io

# Custom color scheme from _sass/color_schemes/custom.scss
color_scheme: custom

logo: "/assets/images/logo.png"
favicon_ico: "/assets/images/favicon.png"

# External navigation links
nav_external_links:
- title: tusd on GitHub
url: https://github.com/tus/tusd
opens_in_new_tab: true
- title: tus.io project
url: https://tus.io
opens_in_new_tab: true

# Footer "Edit this page on GitHub" link text
gh_edit_link: true
gh_edit_link_text: "Edit this page on GitHub."
gh_edit_repository: "https://github.com/tus/tusd"
gh_edit_branch: "main"
gh_edit_source: docs
gh_edit_view_mode: "edit"

# Define Jekyll collections
collections:
advanced-topics:
permalink: "/:collection/:path/"
output: true
storage-backends:
permalink: "/:collection/:path/"
output: true
getting-started:
permalink: "/:collection/:path/"
output: true

just_the_docs:
# Define which collections are used in just-the-docs
collections:
getting-started:
name: Getting Started
storage-backends:
name: Storage Backends
advanced-topics:
name: Advanced Topics

callouts:
highlight:
color: yellow
important:
title: Important
color: blue
new:
title: New
color: green
note:
title: Note
color: purple
warning:
title: Warning
color: red
Loading

0 comments on commit 9b6f2f0

Please sign in to comment.