Skip to content
This repository has been archived by the owner on Jan 18, 2021. It is now read-only.

separate reva services #4

Merged
merged 1 commit into from
Jan 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 41 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,57 @@ You can download prebuilt binaries from the GitHub releases or from our [downloa

## Development

Make sure you have a working Go environment, for further reference or a guide take a look at the [install instructions](http://golang.org/doc/install.html). This project requires Go >= v1.13. For the frontend it's also required to have [NodeJS](https://nodejs.org/en/download/package-manager/) and [Yarn](https://yarnpkg.com/lang/en/docs/install/) installed.
Make sure you have a working Go environment, for further reference or a guide take a look at the [install instructions](http://golang.org/doc/install.html).

```console
git clone https://github.com/owncloud/ocis-reva.git
cd ocis-reva

yarn install
yarn build

make generate build

./bin/ocis-reva -h
```

To run a demo installation you can use the preconfigured defaults and start all necessary services:
```
bin/ocis-reva frontend & \
bin/ocis-reva gateway & \
bin/ocis-reva users & \
bin/ocis-reva auth-basic & \
bin/ocis-reva auth-bearer & \
bin/ocis-reva sharing & \
bin/ocis-reva storage-root & \
bin/ocis-reva storage-home & \
bin/ocis-reva storage-home-data & \
bin/ocis-reva storage-oc & \
bin/ocis-reva storage-oc-data
```

The root storage serves the available namespaces from disk using the local storage driver. In order to be able to navigate into the `/home` and `/oc` storage providers you have to create these directories:
```
mkdir /var/tmp/reva/root/home
mkdir /var/tmp/reva/root/oc
```

Note: the owncloud storage driver currently requires a redis server running on the local machine.

You should now be able to get a file listing of a users home using
```
curl -X PROPFIND http://localhost:9140/remote.php/dav/files/ -v -u einstein:relativity
```

## Users

The default config uses the demo user backend, which contains three users:
```
einstein:relativity
marie:radioactivty
richard:superfluidity
```

For details on the `json` and `ldap` backends see the [documentation](https://owncloud.github.io/ocis-reva/#users)


## Security

If you find a security issue please contact security@owncloud.com first.
Expand Down
7 changes: 7 additions & 0 deletions changelog/unreleased/issue-6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Change: start multiple services with dedicated commands

The initial version would only allow us to use a set of reva configurations to start multiple services.
We use a more opinionated set of commands to start dedicated services that allows us to configure them individually.
It allowcs us to switch eg. the user backend to LDAP and fully it on the cli.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allows*

the user backend to LDAP and fully it on the cli -> the user backend to LDAP fully it on the cli


https://github.com/owncloud/ocis-reva/issues/6
2 changes: 1 addition & 1 deletion docker/Dockerfile.linux.amd64
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ LABEL maintainer="ownCloud GmbH <devops@owncloud.com>" \
org.label-schema.vendor="ownCloud GmbH" \
org.label-schema.schema-version="1.0"

EXPOSE 9135 9136
EXPOSE 9140 9141 9142 9143

ENTRYPOINT ["/usr/bin/ocis-reva"]
CMD ["server"]
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile.linux.arm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ LABEL maintainer="ownCloud GmbH <devops@owncloud.com>" \
org.label-schema.vendor="ownCloud GmbH" \
org.label-schema.schema-version="1.0"

EXPOSE 9135 9136
EXPOSE 9140 9141 9142 9143

ENTRYPOINT ["/usr/bin/ocis-reva"]
CMD ["server"]
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile.linux.arm64
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ LABEL maintainer="ownCloud GmbH <devops@owncloud.com>" \
org.label-schema.vendor="ownCloud GmbH" \
org.label-schema.schema-version="1.0"

EXPOSE 9135 9136
EXPOSE 9140 9141 9142 9143

ENTRYPOINT ["/usr/bin/ocis-reva"]
CMD ["server"]
Expand Down
2 changes: 1 addition & 1 deletion docs/content/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ anchor: "about"
weight: 10
---

This service provides a simple hello world example API to show the integration of custom plugins within [Phoenix](https://github.com/owncloud/phoenix).
This service provides an ocis extension that wraps [reva](https://github.com/cs3org/reva/) and adds an opinionated configuration to it.
15 changes: 3 additions & 12 deletions docs/content/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,20 @@ anchor: "building"
weight: 30
---

As this project is built with Go and NodeJS, so you need to install that first. The installation of Go and NodeJS is out of the scope of this document, please follow the official documentation for [Go](https://golang.org/doc/install), [NodeJS](https://nodejs.org/en/download/package-manager/) and [Yarn](https://yarnpkg.com/lang/en/docs/install/), to build this project you have to install Go >= v1.13. After the installation of the required tools you need to get the sources:
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.13. After the installation of the required tools you need to get the sources:

{{< highlight txt >}}
git clone https://github.com/owncloud/ocis-reva.git
cd ocis-reva
{{< / 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`.
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`.

### Frontend

{{< highlight txt >}}
yarn install
yarn build
{{< / highlight >}}

The above commands will install the required build dependencies and build the whole frontend bundle. This bundle will we embeded into the binary later on.

### Backend

{{< highlight txt >}}
make generate
make build
{{< / highlight >}}

The above commands will embed the frontend bundle into the binary. Finally you should have the binary within the `bin/` folder now, give it a try with `./bin/ocis-reva -h` to see all available options.
The above command should produce the binary within the `bin/` folder now, give it a try with `./bin/ocis-reva -h` to see all available options.
251 changes: 1 addition & 250 deletions docs/content/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,254 +21,5 @@ TBD

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
The configuration tries to map different configuration options from reva into dedicated services. For now please run `bin/ocis-reva {command} -h` to see the list of available options or have a look at [the flagsets](https://github.com/owncloud/ocis-reva/tree/master/pkg/flagset) and the mapping to a reva config in the corresponding [commands](https://github.com/owncloud/ocis-reva/tree/master/pkg/command).

If you prefer to configure the service with environment variables you can see the available variables below.

##### Global

REVA_CONFIG_FILE
: Path to config file, empty default value

REVA_LOG_LEVEL
: Set logging level, defaults to `info`

REVA_LOG_COLOR
: Enable colored logging, defaults to `true`

REVA_LOG_PRETTY
: Enable pretty logging, defaults to `true`

##### Server

REVA_TRACING_ENABLED
: Enable sending traces, defaults to `false`

REVA_TRACING_TYPE
: Tracing backend type, defaults to `jaeger`

REVA_TRACING_ENDPOINT
: Endpoint for the agent, empty default value

REVA_TRACING_COLLECTOR
: Endpoint for the collector, empty default value

REVA_TRACING_SERVICE
: Service name for tracing, defaults to `reva`

REVA_DEBUG_ADDR
: Address to bind debug server, defaults to `0.0.0.0:9109`

REVA_DEBUG_TOKEN
: Token to grant metrics access, empty default value

REVA_DEBUG_PPROF
: Enable pprof debugging, defaults to `false`

REVA_DEBUG_ZPAGES
: Enable zpages debugging, defaults to `false`

REVA_HTTP_ADDR
: Address to bind http server, defaults to `0.0.0.0:9105`

REVA_HTTP_ROOT
: Root path of http server, defaults to `/`

REVA_GRPC_ADDR
: Address to bind grpc server, defaults to `0.0.0.0:9106`

REVA_ASSET_PATH
: Path to custom assets, empty default value

##### Health

REVA_DEBUG_ADDR
: Address to debug endpoint, defaults to `0.0.0.0:9109`

#### 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 `reva`

--debug-addr
: Address to bind debug server, defaults to `0.0.0.0:9109`

--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:9105`

--http-root
: Root path of http server, defaults to `/`

--grpc-addr
: Address to bind grpc server, defaults to `0.0.0.0:9106`

--asset-path
: Path to custom assets, empty default value

##### Health

--debug-addr
: Address to debug endpoint, defaults to `0.0.0.0:9109`

#### 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-reva/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/reva.yml`, `${HOME}/.ocis/reva.yml` or `$(pwd)/config/reva.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-reva --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-reva 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-reva 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 `REVA_DEBUG_TOKEN` mentioned above. By default the metrics endpoint is bound to `http://0.0.0.0:9109/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
Loading