mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-02-26 07:28:46 -06:00
adapt docs structure
This commit is contained in:
46
docs/extensions/settings/_index.md
Normal file
46
docs/extensions/settings/_index.md
Normal file
@@ -0,0 +1,46 @@
|
||||
---
|
||||
title: "Settings"
|
||||
date: 2018-05-02T00:00:00+00:00
|
||||
weight: 10
|
||||
geekdocRepo: https://github.com/owncloud/ocis-settings
|
||||
geekdocEditPath: edit/master/docs
|
||||
geekdocFilePath: _index.md
|
||||
---
|
||||
|
||||
## Abstract
|
||||
|
||||
When using oCIS, the requirement to store settings arises. This extension provides functionality
|
||||
for other extensions to register new settings within oCIS. It is responsible for storing the respective
|
||||
settings values as well.
|
||||
|
||||
For ease of use, this extension provides an ocis-web extension which allows users to change their settings values.
|
||||
Please refer to the [ocis-web extension docs](https://owncloud.github.io/ocis/extensions/#external-phoenix-apps)
|
||||
for running ocis-web extensions.
|
||||
|
||||
{{< mermaid class="text-center">}}
|
||||
graph TD
|
||||
subgraph ow[ocis-web]
|
||||
ows[ocis-web-settings]
|
||||
owc[ocis-web-core]
|
||||
end
|
||||
ows ---|"listSettingsBundles(),<br>saveSettingsValue(value)"| os[ocis-settings]
|
||||
owc ---|"listSettingsValues()"| sdk[oC SDK]
|
||||
sdk --- sdks{ocis-settings<br>available?}
|
||||
sdks ---|"yes"| os
|
||||
sdks ---|"no"| defaults[Use set of<br>default values]
|
||||
oa[oCIS extensions<br>e.g. ocis-accounts] ---|"saveSettingsBundle(bundle)"| os
|
||||
{{< /mermaid >}}
|
||||
|
||||
The diagram shows how the settings service integrates into oCIS:
|
||||
|
||||
**Settings management:**
|
||||
- oCIS extensions can register *settings bundles* with the ocis-settings service.
|
||||
- The settings frontend can be plugged into ocis-web, showing forms for changing *settings values* as a user.
|
||||
The forms are generated from the registered *settings bundles*.
|
||||
|
||||
**Settings usage:**
|
||||
- Extensions can query ocis-settings for *settings values* of a user.
|
||||
- The ownCloud SDK, used as a data abstraction layer for ocis-web, will query ocis-settings for *settings values* of a user,
|
||||
if it's available. The SDK uses sensible defaults when ocis-settings is not part of the setup.
|
||||
|
||||
For compatibility with ownCloud 10, a migration of ownCloud 10 settings into the storage of ocis-settings will be available.
|
||||
28
docs/extensions/settings/building.md
Normal file
28
docs/extensions/settings/building.md
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
title: "Building"
|
||||
date: 2018-05-02T00:00:00+00:00
|
||||
weight: 30
|
||||
geekdocRepo: https://github.com/owncloud/ocis-settings
|
||||
geekdocEditPath: edit/master/docs
|
||||
geekdocFilePath: building.md
|
||||
---
|
||||
|
||||
{{< toc >}}
|
||||
|
||||
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](https://golang.org/doc/install), to build this project you have to install Go >= v1.12. After the installation of the required tools you need to get the sources:
|
||||
|
||||
{{< highlight txt >}}
|
||||
git clone https://github.com/owncloud/ocis-settings.git
|
||||
cd ocis-settings
|
||||
{{< / 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`.
|
||||
|
||||
## 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-settings -h` to see all available options.
|
||||
75
docs/extensions/settings/bundles.md
Normal file
75
docs/extensions/settings/bundles.md
Normal file
@@ -0,0 +1,75 @@
|
||||
---
|
||||
title: "Settings Bundles"
|
||||
date: 2020-05-04T00:00:00+00:00
|
||||
weight: 50
|
||||
geekdocRepo: https://github.com/owncloud/ocis-settings
|
||||
geekdocEditPath: edit/master/docs
|
||||
geekdocFilePath: bundles.md
|
||||
---
|
||||
|
||||
A **Settings Bundle** is a collection of settings, uniquely identified by the key of the
|
||||
extension registering the bundle and the key of the bundle itself. It's purpose is to let
|
||||
oCIS extensions define settings and make them available to users. They are dynamically
|
||||
rendered into forms, available in the frontend.
|
||||
|
||||
As of now we support five different types of settings:
|
||||
- boolean
|
||||
- integer
|
||||
- string
|
||||
- single choice list of integers or strings
|
||||
- multiple choice list of integers or strings
|
||||
|
||||
Each **Setting** is uniquely identified by a key within the bundle. Some attributes
|
||||
depend on the chosen type of setting. Through the information provided with the
|
||||
attributes of the setting, the settings frontend dynamically renders form elements,
|
||||
allowing users to change their settings individually.
|
||||
|
||||
## Example
|
||||
|
||||
```json
|
||||
{
|
||||
"identifier": {
|
||||
"extension": "ocis-accounts",
|
||||
"bundleKey": "profile"
|
||||
},
|
||||
"displayName": "Profile",
|
||||
"settings": [
|
||||
{
|
||||
"settingKey": "lastname",
|
||||
"displayName": "Lastname",
|
||||
"description": "Input for lastname",
|
||||
"stringValue": {
|
||||
"placeholder": "Set lastname"
|
||||
}
|
||||
},
|
||||
{
|
||||
"settingKey": "age",
|
||||
"displayName": "Age",
|
||||
"description": "Input for age",
|
||||
"intValue": {
|
||||
"min": "16",
|
||||
"max": "200",
|
||||
"step": "2",
|
||||
"placeholder": "Set age"
|
||||
}
|
||||
},
|
||||
{
|
||||
"settingKey": "timezone",
|
||||
"displayName": "Timezone",
|
||||
"description": "User timezone",
|
||||
"singleChoiceValue": {
|
||||
"options": [
|
||||
{
|
||||
"stringValue": "Europe/Berlin",
|
||||
"displayValue": "Europe/Berlin"
|
||||
},
|
||||
{
|
||||
"stringValue": "Asia/Kathmandu",
|
||||
"displayValue": "Asia/Kathmandu"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
272
docs/extensions/settings/getting-started.md
Normal file
272
docs/extensions/settings/getting-started.md
Normal file
@@ -0,0 +1,272 @@
|
||||
---
|
||||
title: "Getting Started"
|
||||
date: 2018-05-02T00:00:00+00:00
|
||||
weight: 25
|
||||
geekdocRepo: https://github.com/owncloud/ocis-settings
|
||||
geekdocEditPath: edit/master/docs
|
||||
geekdocFilePath: getting-started.md
|
||||
---
|
||||
|
||||
{{< toc >}}
|
||||
|
||||
## Installation
|
||||
|
||||
So far we are offering two different variants for the installation. You can choose between [Docker](https://www.docker.com/) 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
|
||||
|
||||
SETTINGS_CONFIG_FILE
|
||||
: Path to config file, empty default value
|
||||
|
||||
SETTINGS_LOG_LEVEL
|
||||
: Set logging level, defaults to `info`
|
||||
|
||||
SETTINGS_LOG_COLOR
|
||||
: Enable colored logging, defaults to `true`
|
||||
|
||||
SETTINGS_LOG_PRETTY
|
||||
: Enable pretty logging, defaults to `true`
|
||||
|
||||
#### Server
|
||||
|
||||
SETTINGS_TRACING_ENABLED
|
||||
: Enable sending traces, defaults to `false`
|
||||
|
||||
SETTINGS_TRACING_TYPE
|
||||
: Tracing backend type, defaults to `jaeger`
|
||||
|
||||
SETTINGS_TRACING_ENDPOINT
|
||||
: Endpoint for the agent, empty default value
|
||||
|
||||
SETTINGS_TRACING_COLLECTOR
|
||||
: Endpoint for the collector, empty default value
|
||||
|
||||
SETTINGS_TRACING_SERVICE
|
||||
: Service name for tracing, defaults to `settings`
|
||||
|
||||
SETTINGS_DEBUG_ADDR
|
||||
: Address to bind debug server, defaults to `0.0.0.0:9194`
|
||||
|
||||
SETTINGS_DEBUG_TOKEN
|
||||
: Token to grant metrics access, empty default value
|
||||
|
||||
SETTINGS_DEBUG_PPROF
|
||||
: Enable pprof debugging, defaults to `false`
|
||||
|
||||
SETTINGS_DEBUG_ZPAGES
|
||||
: Enable zpages debugging, defaults to `false`
|
||||
|
||||
SETTINGS_HTTP_ADDR
|
||||
: Address to bind http server, defaults to `0.0.0.0:9190`
|
||||
|
||||
SETTINGS_HTTP_NAMESPACE
|
||||
: The http namespace
|
||||
|
||||
SETTINGS_HTTP_ROOT
|
||||
: Root path of http server, defaults to `/`
|
||||
|
||||
#### Health
|
||||
|
||||
SETTINGS_DEBUG_ADDR
|
||||
: Address to debug endpoint, defaults to `0.0.0.0:9194`
|
||||
|
||||
### Commandline flags
|
||||
|
||||
If you prefer to configure the service with commandline flags you can see the available variables below.
|
||||
|
||||
#### Global
|
||||
|
||||
--config-file
|
||||
: Path to config file, empty default value
|
||||
|
||||
--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
|
||||
|
||||
--tracing-enabled
|
||||
: Enable sending traces, defaults to `false`
|
||||
|
||||
--tracing-type
|
||||
: Tracing backend type, defaults to `jaeger`
|
||||
|
||||
--tracing-endpoint
|
||||
: Endpoint for the agent, empty default value
|
||||
|
||||
--tracing-collector
|
||||
: Endpoint for the collector, empty default value
|
||||
|
||||
--tracing-service
|
||||
: Service name for tracing, defaults to `settings`
|
||||
|
||||
--debug-addr
|
||||
: Address to bind debug server, defaults to `0.0.0.0:9194`
|
||||
|
||||
--debug-token
|
||||
: Token to grant metrics access, empty default value
|
||||
|
||||
--debug-pprof
|
||||
: Enable pprof debugging, defaults to `false`
|
||||
|
||||
--debug-zpages
|
||||
: Enable zpages debugging, defaults to `false`
|
||||
|
||||
--http-addr
|
||||
: Address to bind http server, defaults to `0.0.0.0:9190`
|
||||
|
||||
--http-namespace
|
||||
: Namespace for internal services communication, defaults to `com.owncloud.web`
|
||||
|
||||
--http-root
|
||||
: Root path of http server, defaults to `/`
|
||||
|
||||
#### Health
|
||||
|
||||
--debug-addr
|
||||
: Address to debug endpoint, defaults to `0.0.0.0:9194`
|
||||
|
||||
### 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](https://github.com/owncloud/ocis/settings/tree/master/config), 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/settings.yml`, `${HOME}/.ocis/settings.yml` or `$(pwd)/config/settings.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-settings --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-settings 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-settings health --help
|
||||
{{< / highlight >}}
|
||||
|
||||
## Metrics
|
||||
|
||||
This service provides some [Prometheus](https://prometheus.io/) 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 `SETTINGS_DEBUG_TOKEN` mentioned above. By default the metrics endpoint is bound to `http://0.0.0.0:9194/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
|
||||
42
docs/extensions/settings/glossary.md
Normal file
42
docs/extensions/settings/glossary.md
Normal file
@@ -0,0 +1,42 @@
|
||||
---
|
||||
title: "Glossary"
|
||||
date: 2020-05-04T12:35:00+01:00
|
||||
weight: 80
|
||||
geekdocRepo: https://github.com/owncloud/ocis-settings
|
||||
geekdocEditPath: edit/master/docs
|
||||
geekdocFilePath: glossary.md
|
||||
---
|
||||
|
||||
In the context of this extension and oCIS in general, we are using the following terminology.
|
||||
|
||||
### Configuration
|
||||
|
||||
- System configuration
|
||||
- e.g. service host names and ports
|
||||
- Changes need to be propagated to other services
|
||||
- Typically modified on the CLI
|
||||
|
||||
### Settings
|
||||
|
||||
- Application level settings
|
||||
- e.g. default language
|
||||
- Can be modified at runtime without restarting the service
|
||||
- Typically modified in the UI
|
||||
|
||||
### Preferences
|
||||
|
||||
- User settings
|
||||
- Subset of "Settings"
|
||||
- e.g. preferred language of a user
|
||||
|
||||
### Settings Bundle
|
||||
|
||||
- Collection of related settings
|
||||
- Registered by an ocis extension
|
||||
|
||||
### Settings Value
|
||||
|
||||
- Manifestation of a setting for a specific user
|
||||
- E.g. used for customization (at runtime) in `ocis-web`
|
||||
- `ocis-web-settings` extension for modifying settings values is provided by this service
|
||||
- Can be queried and modified by other ocis extensions
|
||||
10
docs/extensions/settings/license.md
Normal file
10
docs/extensions/settings/license.md
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: "License"
|
||||
date: 2018-05-02T00:00:00+00:00
|
||||
weight: 90
|
||||
geekdocRepo: https://github.com/owncloud/ocis-settings
|
||||
geekdocEditPath: edit/master/docs
|
||||
geekdocFilePath: license.md
|
||||
---
|
||||
|
||||
This project is licensed under the [Apache 2.0](https://github.com/owncloud/ocis/settings/blob/master/LICENSE) license. For the license of the used libraries you have to check the respective sources.
|
||||
75
docs/extensions/settings/values.md
Normal file
75
docs/extensions/settings/values.md
Normal file
@@ -0,0 +1,75 @@
|
||||
---
|
||||
title: "Settings Values"
|
||||
date: 2020-05-04T00:00:00+00:00
|
||||
weight: 51
|
||||
geekdocRepo: https://github.com/owncloud/ocis-settings
|
||||
geekdocEditPath: edit/master/docs
|
||||
geekdocFilePath: values.md
|
||||
---
|
||||
|
||||
A **Settings Value** is the value an authenticated user has chosen for a specific setting, defined in a
|
||||
*settings bundle*. For choosing settings values as a user the sole entry point is the ocis-web extension
|
||||
provided by this service.
|
||||
|
||||
## Identifying settings values
|
||||
|
||||
A *settings value* is uniquely identified by four attributes. Three of them are coming from the definition of
|
||||
the setting within it's settings bundle (see [Settings Bundles](https://owncloud.github.io/extensions/ocis_settings/bundles/)
|
||||
for an example). The fourth identifies the user.
|
||||
- extension: Key of the extension that registered the settings bundle,
|
||||
- bundleKey: Key of the settings bundle,
|
||||
- settingKey: Key of the setting as defined within the bundle,
|
||||
- accountUuid: The UUID of the authenticated user who has saved the setting.
|
||||
|
||||
{{< hint info >}}
|
||||
When requests are going through `ocis-proxy`, the accountUuid attribute can be set to the static keyword `me`
|
||||
instead of using a real UUID. `ocis-proxy` will take care of minting the UUID of the authenticated user into
|
||||
a JWT, providing it in the HTTP header as `x-access-token`. That UUID is then used in this service, to replace
|
||||
`me` with the actual UUID of the authenticated user.
|
||||
{{< /hint >}}
|
||||
|
||||
## Example of stored settings values
|
||||
|
||||
```json
|
||||
{
|
||||
"values": {
|
||||
"language": {
|
||||
"identifier": {
|
||||
"extension": "ocis-accounts",
|
||||
"bundleKey": "profile",
|
||||
"settingKey": "language",
|
||||
"accountUuid": "5681371f-4a6e-43bc-8bb5-9c9237fa9c58"
|
||||
},
|
||||
"listValue": {
|
||||
"values": [
|
||||
{
|
||||
"stringValue": "de"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"timezone": {
|
||||
"identifier": {
|
||||
"extension": "ocis-accounts",
|
||||
"bundleKey": "profile",
|
||||
"settingKey": "timezone",
|
||||
"accountUuid": "5681371f-4a6e-43bc-8bb5-9c9237fa9c58"
|
||||
},
|
||||
"listValue": {
|
||||
"values": [
|
||||
{
|
||||
"stringValue": "Europe/Berlin"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## gRPC endpoints
|
||||
The obvious way of modifying settings is the ocis-web extension, as described earlier. However, services can
|
||||
use the respective gRPC endpoints of the `ValueService` to query and modify *settings values* as well.
|
||||
The gRPC endpoints require the same identifier attributes as described above, so for making a request to
|
||||
the `ValueService` you will have to make sure that the accountUuid of the authenticated user is available in
|
||||
your service at the time of the request.
|
||||
Reference in New Issue
Block a user