From c73f1cd3258c12fc65f2e00c28698f620a2704f3 Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Mon, 16 Sep 2019 11:57:08 +0200 Subject: [PATCH] Start to publish documentation --- .drone.starlark | 59 +++++- .drone.yml | 44 ++++ .github/settings.yml | 3 +- Makefile | 4 + config/.gitignore | 3 +- config/example.json | 1 + config/example.yml | 3 + docs/archetypes/default.md | 6 + docs/config.toml | 16 ++ docs/content/about.md | 8 + docs/content/building.md | 28 +++ docs/content/getting-started.md | 230 ++++++++++++++++++++ docs/content/license.md | 10 + docs/layouts/_default/list.html | 0 docs/layouts/_default/single.html | 0 docs/layouts/index.html | 57 +++++ docs/layouts/partials/style.html | 337 ++++++++++++++++++++++++++++++ docs/static/syntax.css | 59 ++++++ 18 files changed, 863 insertions(+), 5 deletions(-) create mode 100644 config/example.json create mode 100644 docs/archetypes/default.md create mode 100644 docs/config.toml create mode 100644 docs/content/about.md create mode 100644 docs/content/building.md create mode 100644 docs/content/getting-started.md create mode 100644 docs/content/license.md create mode 100644 docs/layouts/_default/list.html create mode 100644 docs/layouts/_default/single.html create mode 100644 docs/layouts/index.html create mode 100644 docs/layouts/partials/style.html create mode 100644 docs/static/syntax.css diff --git a/.drone.starlark b/.drone.starlark index e76cbde89..309d42994 100644 --- a/.drone.starlark +++ b/.drone.starlark @@ -10,7 +10,10 @@ def main(ctx): binary('windows'), ] - after = manifest() + after = [ + manifest(), + documentation() + ] for b in before: for s in stages: @@ -385,7 +388,7 @@ def binary(name): } def manifest(): - return [{ + return { 'kind': 'pipeline', 'type': 'docker', 'name': 'manifest', @@ -424,4 +427,54 @@ def manifest(): 'refs/tags/**' ] } - }] + } + +def documentation(): + return { + 'kind': 'pipeline', + 'type': 'docker', + 'name': 'documentation', + 'platform': { + 'os': 'linux', + 'arch': 'amd64', + }, + 'steps': [ + { + 'name': 'generate', + 'image': 'webhippie/hugo:latest', + 'pull': 'always', + 'commands': [ + 'make docs' + ] + }, + { + 'name': 'publish', + 'image': 'plugins/gh-pages:1', + 'pull': 'always', + 'settings': { + 'username': { + 'from_secret': 'github_username' + }, + 'password': { + 'from_secret': 'github_token' + }, + 'pages_directory': 'docs/public/', + 'temporary_base': 'tmp/', + }, + 'when': { + 'event': { + 'exclude': [ + 'pull_request' + ] + } + } + } + ], + 'depends_on': [], + 'trigger': { + 'ref': [ + 'refs/heads/master', + 'refs/pull/**' + ] + } + } diff --git a/.drone.yml b/.drone.yml index 6107bfbcb..77ab40066 100644 --- a/.drone.yml +++ b/.drone.yml @@ -649,4 +649,48 @@ depends_on: - darwin - windows +--- +kind: pipeline +type: docker +name: documentation + +platform: + os: linux + arch: amd64 + +steps: +- name: generate + pull: always + image: webhippie/hugo:latest + commands: + - make docs + +- name: publish + pull: always + image: plugins/gh-pages:1 + settings: + pages_directory: docs/public/ + password: + from_secret: github_token + temporary_base: tmp/ + username: + from_secret: github_username + when: + event: + exclude: + - pull_request + +trigger: + ref: + - refs/heads/master + - refs/pull/** + +depends_on: +- amd64 +- arm64 +- arm +- linux +- darwin +- windows + ... diff --git a/.github/settings.yml b/.github/settings.yml index 0498c98a6..f7cd7a28e 100644 --- a/.github/settings.yml +++ b/.github/settings.yml @@ -1,7 +1,8 @@ --- repository: name: ocis - description: ':atom_symbol: ownCloud Infinit Scale stack' + description: ':atom_symbol: ownCloud Infinite Scale Stack' + homepage: https://owncloud.github.io/ocis/ topics: reva, ocis private: false diff --git a/Makefile b/Makefile index 0c427fd45..fffb7ce8f 100644 --- a/Makefile +++ b/Makefile @@ -125,3 +125,7 @@ gorunpkg: ifndef HAS_GORUNPKG go get -u github.com/vektah/gorunpkg endif + +.PHONY: docs +docs: + cd docs; hugo diff --git a/config/.gitignore b/config/.gitignore index 8156cfdcc..daaf7850b 100644 --- a/config/.gitignore +++ b/config/.gitignore @@ -1 +1,2 @@ -hyper.yml +ocis.yml +ocis.json diff --git a/config/example.json b/config/example.json new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/config/example.json @@ -0,0 +1 @@ +{} diff --git a/config/example.yml b/config/example.yml index e69de29bb..c81cf5b7c 100644 --- a/config/example.yml +++ b/config/example.yml @@ -0,0 +1,3 @@ +--- + +... diff --git a/docs/archetypes/default.md b/docs/archetypes/default.md new file mode 100644 index 000000000..4e777bee1 --- /dev/null +++ b/docs/archetypes/default.md @@ -0,0 +1,6 @@ +--- +title: "{{ replace .TranslationBaseName "-" " " | title }}" +date: {{ .Date }} +anchor: "{{ replace .TranslationBaseName "-" " " | title | urlize }}" +weight: +--- diff --git a/docs/config.toml b/docs/config.toml new file mode 100644 index 000000000..57076e4d6 --- /dev/null +++ b/docs/config.toml @@ -0,0 +1,16 @@ +baseURL = "https://owncloud.github.io/ocis/" +languageCode = "en-us" +title = "ownCloud Infinite Scale Stack" +pygmentsUseClasses = true + +[blackfriday] + angledQuotes = true + fractions = false + plainIDAnchors = true + smartlists = true + extensions = ["hardLineBreak"] + +[params] + author = "ownCloud GmbH" + description = "Launch all oCIS services" + keywords = "reva, ocis" diff --git a/docs/content/about.md b/docs/content/about.md new file mode 100644 index 000000000..f92b3e7e4 --- /dev/null +++ b/docs/content/about.md @@ -0,0 +1,8 @@ +--- +title: "About" +date: 2018-05-02T00:00:00+00:00 +anchor: "about" +weight: 10 +--- + +This tool provides a single entrypoint for the whole ownCloud Infinite Scale stack. diff --git a/docs/content/building.md b/docs/content/building.md new file mode 100644 index 000000000..0fbdd6dca --- /dev/null +++ b/docs/content/building.md @@ -0,0 +1,28 @@ +--- +title: "Building" +date: 2018-05-02T00:00:00+00:00 +anchor: "building" +weight: 30 +--- + +As this project is built with Go, so you need to install that first. The installation of Go is out of the scope of this document, please follow the official documentation for [Go](golang). After the installation of the required tools you need to get the sources: + +{{< highlight txt >}} +git clone https://github.com/owncloud/ocis.git +cd ocis +{{< / highlight >}} + +All required tool besides Go itself and make are bundled or getting automatically installed within the `GOPATH`. All commands to build this project are part of our `Makefile` and respectively our `package.json`. + +## Backend + +{{< highlight txt >}} +make generate +make build +{{< / highlight >}} + +Finally you should have the binary within the `bin/` folder now, give it a try with `./bin/ocis -h` to see all available options. + +[golang]: https://golang.org/doc/install +[nodejs]: https://nodejs.org/en/download/package-manager/ +[yarn]: https://yarnpkg.com/lang/en/docs/install/ diff --git a/docs/content/getting-started.md b/docs/content/getting-started.md new file mode 100644 index 000000000..a835bf8b9 --- /dev/null +++ b/docs/content/getting-started.md @@ -0,0 +1,230 @@ +--- +title: "Getting Started" +date: 2018-05-02T00:00:00+00:00 +anchor: "getting-started" +weight: 20 +--- + +## Installation + +So far we are offering two different variants for the installation. You can choose between [Docker](docker) or pre-built binaries which are stored on our download mirrors and GitHub releases. Maybe we will also provide system packages for the major distributions later if we see the need for it. + +### Docker + +TBD + +### Binaries + +TBD + +## Configuration + +We provide overall three different variants of configuration. The variant based on environment variables and commandline flags are split up into global values and command-specific values. + +### Envrionment variables + +If you prefer to configure the service with environment variables you can see the available variables below. + +#### Global + +OCIS_LOG_LEVEL +: Set logging level, defaults to `info` + +OCIS_LOG_COLOR +: Enable colored logging, defaults to `true` + +OCIS_LOG_PRETTY +: Enable pretty logging, defaults to `true` + +#### Server + +OCIS_DEBUG_ADDR +: Address to bind debug server, defaults to `0.0.0.0:8001` + +OCIS_DEBUG_TOKEN +: Token to grant metrics access, empty default value + +OCIS_DEBUG_PPROF +: Enable pprof debugging, defaults to `false` + +OCIS_HTTP_ADDR +: Address to bind http server, defaults to `0.0.0.0:8000` + +OCIS_HTTP_ROOT +: Root path for http endpoint, defaults to `/` + +OCIS_SERVICES_ENABLED +: List of enabled services, defaults to `phoenix,ocs,webdav,hello` + +#### Health + +OCIS_DEBUG_ADDR +: Address to debug endpoint, defaults to `0.0.0.0:8001` + +### Commandline flags + +If you prefer to configure the service with commandline flags you can see the available variables below. + +#### Global + +--log-level +: Set logging level, defaults to `info` + +--log-color +: Enable colored logging, defaults to `true` + +--log-pretty +: Enable pretty logging, defaults to `true` + +#### Server + +--debug-addr +: Address to bind debug server, defaults to `0.0.0.0:8001` + +--debug-token +: Token to grant metrics access, empty default value + +--debug-pprof +: Enable pprof debugging, defaults to `false` + +--http-addr +: Address to bind http server, defaults to `0.0.0.0:8000` + +--http-root +: Root path for http endpoint, defaults to `/` + +--services-enabled +: List of enabled services, defaults to `phoenix,ocs,webdav,hello` + +#### Health + +--debug-addr +: Address to debug endpoint, defaults to `0.0.0.0:8001` + +### Configuration file + +So far we support the file formats `JSON` and `YAML`, if you want to get a full example configuration just take a look at [our repository](repo), there you can always see the latest configuration format. These example configurations include all available options and the default values. The configuration file will be automatically loaded if it's placed at `/etc/ocis/ocis.yml`, `${HOME}/.ocis/ocis.yml` or `$(pwd)/config/ocis.yml`. + +## Usage + +The program provides a few sub-commands on execution. The available configuration methods have already been mentioned above. Generally you can always see a formated help output if you execute the binary via `ocis --help`. + +### Server + +The server command is used to start the http and debug server on two addresses within a single process. The http server is serving the general webservice while the debug server is used for health check, readiness check and to server the metrics mentioned below. For further help please execute: + +{{< highlight txt >}} +ocis server --help +{{< / highlight >}} + +### Health + +The health command is used to execute a health check, if the exit code equals zero the service should be up and running, if the exist code is greater than zero the service is not in a healthy state. Generally this command is used within our Docker containers, it could also be used within Kubernetes. + +{{< highlight txt >}} +ocis health --help +{{< / highlight >}} + +## Metrics + +This service provides some [Prometheus](prom) metrics through the debug endpoint, you can optionally secure the metrics endpoint by some random token, which got to be configured through one of the flag `--debug-token` or the environment variable `OCIS_DEBUG_TOKEN` mentioned above. By default the metrics endpoint is bound to `http://0.0.0.0:8001/metrics`. + +go_gc_duration_seconds +: A summary of the GC invocation durations + +go_gc_duration_seconds_sum +: A summary of the GC invocation durations + +go_gc_duration_seconds_count +: A summary of the GC invocation durations + +go_goroutines +: Number of goroutines that currently exist + +go_info +: Information about the Go environment + +go_memstats_alloc_bytes +: Number of bytes allocated and still in use + +go_memstats_alloc_bytes_total +: Total number of bytes allocated, even if freed + +go_memstats_buck_hash_sys_bytes +: Number of bytes used by the profiling bucket hash table + +go_memstats_frees_total +: Total number of frees + +go_memstats_gc_cpu_fraction +: The fraction of this program's available CPU time used by the GC since the program started + +go_memstats_gc_sys_bytes +: Number of bytes used for garbage collection system metadata + +go_memstats_heap_alloc_bytes +: Number of heap bytes allocated and still in use + +go_memstats_heap_idle_bytes +: Number of heap bytes waiting to be used + +go_memstats_heap_inuse_bytes +: Number of heap bytes that are in use + +go_memstats_heap_objects +: Number of allocated objects + +go_memstats_heap_released_bytes +: Number of heap bytes released to OS + +go_memstats_heap_sys_bytes +: Number of heap bytes obtained from system + +go_memstats_last_gc_time_seconds +: Number of seconds since 1970 of last garbage collection + +go_memstats_lookups_total +: Total number of pointer lookups + +go_memstats_mallocs_total +: Total number of mallocs + +go_memstats_mcache_inuse_bytes +: Number of bytes in use by mcache structures + +go_memstats_mcache_sys_bytes +: Number of bytes used for mcache structures obtained from system + +go_memstats_mspan_inuse_bytes +: Number of bytes in use by mspan structures + +go_memstats_mspan_sys_bytes +: Number of bytes used for mspan structures obtained from system + +go_memstats_next_gc_bytes +: Number of heap bytes when next garbage collection will take place + +go_memstats_other_sys_bytes +: Number of bytes used for other system allocations + +go_memstats_stack_inuse_bytes +: Number of bytes in use by the stack allocator + +go_memstats_stack_sys_bytes +: Number of bytes obtained from system for stack allocator + +go_memstats_sys_bytes +: Number of bytes obtained from system + +go_threads +: Number of OS threads created + +promhttp_metric_handler_requests_in_flight +: Current number of scrapes being served + +promhttp_metric_handler_requests_total +: Total number of scrapes by HTTP status code + +[docker]: https://www.docker.com/ +[repo]: https://github.com/owncloud/ocis/tree/master/config +[prom]: https://prometheus.io/ diff --git a/docs/content/license.md b/docs/content/license.md new file mode 100644 index 000000000..8c398aa2c --- /dev/null +++ b/docs/content/license.md @@ -0,0 +1,10 @@ +--- +title: "License" +date: 2018-05-02T00:00:00+00:00 +anchor: "license" +weight: 40 +--- + +This project is licensed under the [Apache 2.0](license) license. For the license of the used libraries you have to check the respective sources. + +[license]: https://github.com/owncloud/ocis/blob/master/LICENSE diff --git a/docs/layouts/_default/list.html b/docs/layouts/_default/list.html new file mode 100644 index 000000000..e69de29bb diff --git a/docs/layouts/_default/single.html b/docs/layouts/_default/single.html new file mode 100644 index 000000000..e69de29bb diff --git a/docs/layouts/index.html b/docs/layouts/index.html new file mode 100644 index 000000000..f3dca91f1 --- /dev/null +++ b/docs/layouts/index.html @@ -0,0 +1,57 @@ + + + + + + + + + {{ .Site.Title }} + + + + + + {{ partial "style.html" . }} + + + + + + {{ range .Data.Pages.ByWeight }} +
+

+ + {{ .Title }} + + + + + Back to Top + + +

+ + {{ .Content | markdownify }} +
+ {{ end }} + + diff --git a/docs/layouts/partials/style.html b/docs/layouts/partials/style.html new file mode 100644 index 000000000..cba6e127d --- /dev/null +++ b/docs/layouts/partials/style.html @@ -0,0 +1,337 @@ + + + diff --git a/docs/static/syntax.css b/docs/static/syntax.css new file mode 100644 index 000000000..681758d06 --- /dev/null +++ b/docs/static/syntax.css @@ -0,0 +1,59 @@ +/* Background */ .chroma { color: #f8f8f2; background-color: #272822 } +/* Error */ .chroma .err { color: #960050; background-color: #1e0010 } +/* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; } +/* LineTable */ .chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; width: auto; overflow: auto; display: block; } +/* LineHighlight */ .chroma .hl { display: block; width: 100%;background-color: #ffffcc } +/* LineNumbersTable */ .chroma .lnt { margin-right: 0.4em; padding: 0 0.4em 0 0.4em; } +/* LineNumbers */ .chroma .ln { margin-right: 0.4em; padding: 0 0.4em 0 0.4em; } +/* Keyword */ .chroma .k { color: #66d9ef } +/* KeywordConstant */ .chroma .kc { color: #66d9ef } +/* KeywordDeclaration */ .chroma .kd { color: #66d9ef } +/* KeywordNamespace */ .chroma .kn { color: #f92672 } +/* KeywordPseudo */ .chroma .kp { color: #66d9ef } +/* KeywordReserved */ .chroma .kr { color: #66d9ef } +/* KeywordType */ .chroma .kt { color: #66d9ef } +/* NameAttribute */ .chroma .na { color: #a6e22e } +/* NameClass */ .chroma .nc { color: #a6e22e } +/* NameConstant */ .chroma .no { color: #66d9ef } +/* NameDecorator */ .chroma .nd { color: #a6e22e } +/* NameException */ .chroma .ne { color: #a6e22e } +/* NameFunction */ .chroma .nf { color: #a6e22e } +/* NameOther */ .chroma .nx { color: #a6e22e } +/* NameTag */ .chroma .nt { color: #f92672 } +/* Literal */ .chroma .l { color: #ae81ff } +/* LiteralDate */ .chroma .ld { color: #e6db74 } +/* LiteralString */ .chroma .s { color: #e6db74 } +/* LiteralStringAffix */ .chroma .sa { color: #e6db74 } +/* LiteralStringBacktick */ .chroma .sb { color: #e6db74 } +/* LiteralStringChar */ .chroma .sc { color: #e6db74 } +/* LiteralStringDelimiter */ .chroma .dl { color: #e6db74 } +/* LiteralStringDoc */ .chroma .sd { color: #e6db74 } +/* LiteralStringDouble */ .chroma .s2 { color: #e6db74 } +/* LiteralStringEscape */ .chroma .se { color: #ae81ff } +/* LiteralStringHeredoc */ .chroma .sh { color: #e6db74 } +/* LiteralStringInterpol */ .chroma .si { color: #e6db74 } +/* LiteralStringOther */ .chroma .sx { color: #e6db74 } +/* LiteralStringRegex */ .chroma .sr { color: #e6db74 } +/* LiteralStringSingle */ .chroma .s1 { color: #e6db74 } +/* LiteralStringSymbol */ .chroma .ss { color: #e6db74 } +/* LiteralNumber */ .chroma .m { color: #ae81ff } +/* LiteralNumberBin */ .chroma .mb { color: #ae81ff } +/* LiteralNumberFloat */ .chroma .mf { color: #ae81ff } +/* LiteralNumberHex */ .chroma .mh { color: #ae81ff } +/* LiteralNumberInteger */ .chroma .mi { color: #ae81ff } +/* LiteralNumberIntegerLong */ .chroma .il { color: #ae81ff } +/* LiteralNumberOct */ .chroma .mo { color: #ae81ff } +/* Operator */ .chroma .o { color: #f92672 } +/* OperatorWord */ .chroma .ow { color: #f92672 } +/* Comment */ .chroma .c { color: #75715e } +/* CommentHashbang */ .chroma .ch { color: #75715e } +/* CommentMultiline */ .chroma .cm { color: #75715e } +/* CommentSingle */ .chroma .c1 { color: #75715e } +/* CommentSpecial */ .chroma .cs { color: #75715e } +/* CommentPreproc */ .chroma .cp { color: #75715e } +/* CommentPreprocFile */ .chroma .cpf { color: #75715e } +/* GenericDeleted */ .chroma .gd { color: #f92672 } +/* GenericEmph */ .chroma .ge { font-style: italic } +/* GenericInserted */ .chroma .gi { color: #a6e22e } +/* GenericStrong */ .chroma .gs { font-weight: bold } +/* GenericSubheading */ .chroma .gu { color: #75715e }