mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-04 11:19:39 -06:00
Add 'phoenix/' from commit '4bf510094903bb71f9ef70edf6abcb54e3b631fb'
git-subtree-dir: phoenix git-subtree-mainline:1517eb9436git-subtree-split:4bf5100949
This commit is contained in:
8
phoenix/.codacy.yml
Normal file
8
phoenix/.codacy.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
exclude_paths:
|
||||
- CHANGELOG.md
|
||||
- changelog/**
|
||||
- docs/**
|
||||
- pkg/proto/**
|
||||
|
||||
...
|
||||
2
phoenix/.dockerignore
Normal file
2
phoenix/.dockerignore
Normal file
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!bin/
|
||||
698
phoenix/.drone.star
Normal file
698
phoenix/.drone.star
Normal file
@@ -0,0 +1,698 @@
|
||||
def main(ctx):
|
||||
before = [
|
||||
testing(ctx),
|
||||
]
|
||||
|
||||
stages = [
|
||||
docker(ctx, 'amd64'),
|
||||
docker(ctx, 'arm64'),
|
||||
docker(ctx, 'arm'),
|
||||
binary(ctx, 'linux'),
|
||||
binary(ctx, 'darwin'),
|
||||
binary(ctx, 'windows'),
|
||||
]
|
||||
|
||||
after = [
|
||||
manifest(ctx),
|
||||
changelog(ctx),
|
||||
readme(ctx),
|
||||
badges(ctx),
|
||||
website(ctx),
|
||||
]
|
||||
|
||||
return before + stages + after
|
||||
|
||||
def testing(ctx):
|
||||
return {
|
||||
'kind': 'pipeline',
|
||||
'type': 'docker',
|
||||
'name': 'testing',
|
||||
'platform': {
|
||||
'os': 'linux',
|
||||
'arch': 'amd64',
|
||||
},
|
||||
'steps': [
|
||||
{
|
||||
'name': 'generate',
|
||||
'image': 'webhippie/golang:1.13',
|
||||
'pull': 'always',
|
||||
'commands': [
|
||||
'make generate',
|
||||
],
|
||||
'volumes': [
|
||||
{
|
||||
'name': 'gopath',
|
||||
'path': '/srv/app',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'name': 'vet',
|
||||
'image': 'webhippie/golang:1.13',
|
||||
'pull': 'always',
|
||||
'commands': [
|
||||
'make vet',
|
||||
],
|
||||
'volumes': [
|
||||
{
|
||||
'name': 'gopath',
|
||||
'path': '/srv/app',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'name': 'staticcheck',
|
||||
'image': 'webhippie/golang:1.13',
|
||||
'pull': 'always',
|
||||
'commands': [
|
||||
'make staticcheck',
|
||||
],
|
||||
'volumes': [
|
||||
{
|
||||
'name': 'gopath',
|
||||
'path': '/srv/app',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'name': 'lint',
|
||||
'image': 'webhippie/golang:1.13',
|
||||
'pull': 'always',
|
||||
'commands': [
|
||||
'make lint',
|
||||
],
|
||||
'volumes': [
|
||||
{
|
||||
'name': 'gopath',
|
||||
'path': '/srv/app',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'name': 'build',
|
||||
'image': 'webhippie/golang:1.13',
|
||||
'pull': 'always',
|
||||
'commands': [
|
||||
'make build',
|
||||
],
|
||||
'volumes': [
|
||||
{
|
||||
'name': 'gopath',
|
||||
'path': '/srv/app',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'name': 'test',
|
||||
'image': 'webhippie/golang:1.13',
|
||||
'pull': 'always',
|
||||
'commands': [
|
||||
'make test',
|
||||
],
|
||||
'volumes': [
|
||||
{
|
||||
'name': 'gopath',
|
||||
'path': '/srv/app',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'name': 'codacy',
|
||||
'image': 'plugins/codacy:1',
|
||||
'pull': 'always',
|
||||
'settings': {
|
||||
'token': {
|
||||
'from_secret': 'codacy_token',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
'volumes': [
|
||||
{
|
||||
'name': 'gopath',
|
||||
'temp': {},
|
||||
},
|
||||
],
|
||||
'trigger': {
|
||||
'ref': [
|
||||
'refs/heads/master',
|
||||
'refs/tags/**',
|
||||
'refs/pull/**',
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
def docker(ctx, arch):
|
||||
return {
|
||||
'kind': 'pipeline',
|
||||
'type': 'docker',
|
||||
'name': arch,
|
||||
'platform': {
|
||||
'os': 'linux',
|
||||
'arch': arch,
|
||||
},
|
||||
'steps': [
|
||||
{
|
||||
'name': 'generate',
|
||||
'image': 'webhippie/golang:1.13',
|
||||
'pull': 'always',
|
||||
'commands': [
|
||||
'make generate',
|
||||
],
|
||||
'volumes': [
|
||||
{
|
||||
'name': 'gopath',
|
||||
'path': '/srv/app',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'name': 'build',
|
||||
'image': 'webhippie/golang:1.13',
|
||||
'pull': 'always',
|
||||
'commands': [
|
||||
'make build',
|
||||
],
|
||||
'volumes': [
|
||||
{
|
||||
'name': 'gopath',
|
||||
'path': '/srv/app',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'name': 'dryrun',
|
||||
'image': 'plugins/docker:18.09',
|
||||
'pull': 'always',
|
||||
'settings': {
|
||||
'dry_run': True,
|
||||
'tags': 'linux-%s' % (arch),
|
||||
'dockerfile': 'docker/Dockerfile.linux.%s' % (arch),
|
||||
'repo': ctx.repo.slug,
|
||||
},
|
||||
'when': {
|
||||
'ref': {
|
||||
'include': [
|
||||
'refs/pull/**',
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
'name': 'docker',
|
||||
'image': 'plugins/docker:18.09',
|
||||
'pull': 'always',
|
||||
'settings': {
|
||||
'username': {
|
||||
'from_secret': 'docker_username',
|
||||
},
|
||||
'password': {
|
||||
'from_secret': 'docker_password',
|
||||
},
|
||||
'auto_tag': True,
|
||||
'auto_tag_suffix': 'linux-%s' % (arch),
|
||||
'dockerfile': 'docker/Dockerfile.linux.%s' % (arch),
|
||||
'repo': ctx.repo.slug,
|
||||
},
|
||||
'when': {
|
||||
'ref': {
|
||||
'exclude': [
|
||||
'refs/pull/**',
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
'volumes': [
|
||||
{
|
||||
'name': 'gopath',
|
||||
'temp': {},
|
||||
},
|
||||
],
|
||||
'depends_on': [
|
||||
'testing',
|
||||
],
|
||||
'trigger': {
|
||||
'ref': [
|
||||
'refs/heads/master',
|
||||
'refs/tags/**',
|
||||
'refs/pull/**',
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
def binary(ctx, name):
|
||||
if ctx.build.event == "tag":
|
||||
settings = {
|
||||
'endpoint': {
|
||||
'from_secret': 's3_endpoint',
|
||||
},
|
||||
'access_key': {
|
||||
'from_secret': 'aws_access_key_id',
|
||||
},
|
||||
'secret_key': {
|
||||
'from_secret': 'aws_secret_access_key',
|
||||
},
|
||||
'bucket': {
|
||||
'from_secret': 's3_bucket',
|
||||
},
|
||||
'path_style': True,
|
||||
'strip_prefix': 'dist/release/',
|
||||
'source': 'dist/release/*',
|
||||
'target': '/ocis/%s/%s' % (ctx.repo.name.replace("ocis-", ""), ctx.build.ref.replace("refs/tags/v", "")),
|
||||
}
|
||||
else:
|
||||
settings = {
|
||||
'endpoint': {
|
||||
'from_secret': 's3_endpoint',
|
||||
},
|
||||
'access_key': {
|
||||
'from_secret': 'aws_access_key_id',
|
||||
},
|
||||
'secret_key': {
|
||||
'from_secret': 'aws_secret_access_key',
|
||||
},
|
||||
'bucket': {
|
||||
'from_secret': 's3_bucket',
|
||||
},
|
||||
'path_style': True,
|
||||
'strip_prefix': 'dist/release/',
|
||||
'source': 'dist/release/*',
|
||||
'target': '/ocis/%s/testing' % (ctx.repo.name.replace("ocis-", "")),
|
||||
}
|
||||
|
||||
return {
|
||||
'kind': 'pipeline',
|
||||
'type': 'docker',
|
||||
'name': name,
|
||||
'platform': {
|
||||
'os': 'linux',
|
||||
'arch': 'amd64',
|
||||
},
|
||||
'steps': [
|
||||
{
|
||||
'name': 'generate',
|
||||
'image': 'webhippie/golang:1.13',
|
||||
'pull': 'always',
|
||||
'commands': [
|
||||
'make generate',
|
||||
],
|
||||
'volumes': [
|
||||
{
|
||||
'name': 'gopath',
|
||||
'path': '/srv/app',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'name': 'build',
|
||||
'image': 'webhippie/golang:1.13',
|
||||
'pull': 'always',
|
||||
'commands': [
|
||||
'make release-%s' % (name),
|
||||
],
|
||||
'volumes': [
|
||||
{
|
||||
'name': 'gopath',
|
||||
'path': '/srv/app',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'name': 'finish',
|
||||
'image': 'webhippie/golang:1.13',
|
||||
'pull': 'always',
|
||||
'commands': [
|
||||
'make release-finish',
|
||||
],
|
||||
'volumes': [
|
||||
{
|
||||
'name': 'gopath',
|
||||
'path': '/srv/app',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'name': 'upload',
|
||||
'image': 'plugins/s3:1',
|
||||
'pull': 'always',
|
||||
'settings': settings,
|
||||
'when': {
|
||||
'ref': [
|
||||
'refs/heads/master',
|
||||
'refs/tags/**',
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
'name': 'changelog',
|
||||
'image': 'toolhippie/calens:latest',
|
||||
'pull': 'always',
|
||||
'commands': [
|
||||
'calens --version %s -o dist/CHANGELOG.md' % ctx.build.ref.replace("refs/tags/v", "").split("-")[0],
|
||||
],
|
||||
'when': {
|
||||
'ref': [
|
||||
'refs/tags/**',
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
'name': 'release',
|
||||
'image': 'plugins/github-release:1',
|
||||
'pull': 'always',
|
||||
'settings': {
|
||||
'api_key': {
|
||||
'from_secret': 'github_token',
|
||||
},
|
||||
'files': [
|
||||
'dist/release/*',
|
||||
],
|
||||
'title': ctx.build.ref.replace("refs/tags/v", ""),
|
||||
'note': 'dist/CHANGELOG.md',
|
||||
'overwrite': True,
|
||||
'prerelease': len(ctx.build.ref.split("-")) > 1,
|
||||
},
|
||||
'when': {
|
||||
'ref': [
|
||||
'refs/tags/**',
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
'volumes': [
|
||||
{
|
||||
'name': 'gopath',
|
||||
'temp': {},
|
||||
},
|
||||
],
|
||||
'depends_on': [
|
||||
'testing',
|
||||
],
|
||||
'trigger': {
|
||||
'ref': [
|
||||
'refs/heads/master',
|
||||
'refs/tags/**',
|
||||
'refs/pull/**',
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
def manifest(ctx):
|
||||
return {
|
||||
'kind': 'pipeline',
|
||||
'type': 'docker',
|
||||
'name': 'manifest',
|
||||
'platform': {
|
||||
'os': 'linux',
|
||||
'arch': 'amd64',
|
||||
},
|
||||
'steps': [
|
||||
{
|
||||
'name': 'execute',
|
||||
'image': 'plugins/manifest:1',
|
||||
'pull': 'always',
|
||||
'settings': {
|
||||
'username': {
|
||||
'from_secret': 'docker_username',
|
||||
},
|
||||
'password': {
|
||||
'from_secret': 'docker_password',
|
||||
},
|
||||
'spec': 'docker/manifest.tmpl',
|
||||
'auto_tag': True,
|
||||
'ignore_missing': True,
|
||||
},
|
||||
},
|
||||
],
|
||||
'depends_on': [
|
||||
'amd64',
|
||||
'arm64',
|
||||
'arm',
|
||||
'linux',
|
||||
'darwin',
|
||||
'windows',
|
||||
],
|
||||
'trigger': {
|
||||
'ref': [
|
||||
'refs/heads/master',
|
||||
'refs/tags/**',
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
def changelog(ctx):
|
||||
repo_slug = ctx.build.source_repo if ctx.build.source_repo else ctx.repo.slug
|
||||
return {
|
||||
'kind': 'pipeline',
|
||||
'type': 'docker',
|
||||
'name': 'changelog',
|
||||
'platform': {
|
||||
'os': 'linux',
|
||||
'arch': 'amd64',
|
||||
},
|
||||
'clone': {
|
||||
'disable': True,
|
||||
},
|
||||
'steps': [
|
||||
{
|
||||
'name': 'clone',
|
||||
'image': 'plugins/git-action:1',
|
||||
'pull': 'always',
|
||||
'settings': {
|
||||
'actions': [
|
||||
'clone',
|
||||
],
|
||||
'remote': 'https://github.com/%s' % (repo_slug),
|
||||
'branch': ctx.build.source if ctx.build.event == 'pull_request' else 'master',
|
||||
'path': '/drone/src',
|
||||
'netrc_machine': 'github.com',
|
||||
'netrc_username': {
|
||||
'from_secret': 'github_username',
|
||||
},
|
||||
'netrc_password': {
|
||||
'from_secret': 'github_token',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
'name': 'generate',
|
||||
'image': 'webhippie/golang:1.13',
|
||||
'pull': 'always',
|
||||
'commands': [
|
||||
'make changelog',
|
||||
],
|
||||
},
|
||||
{
|
||||
'name': 'diff',
|
||||
'image': 'owncloud/alpine:latest',
|
||||
'pull': 'always',
|
||||
'commands': [
|
||||
'git diff',
|
||||
],
|
||||
},
|
||||
{
|
||||
'name': 'output',
|
||||
'image': 'owncloud/alpine:latest',
|
||||
'pull': 'always',
|
||||
'commands': [
|
||||
'cat CHANGELOG.md',
|
||||
],
|
||||
},
|
||||
{
|
||||
'name': 'publish',
|
||||
'image': 'plugins/git-action:1',
|
||||
'pull': 'always',
|
||||
'settings': {
|
||||
'actions': [
|
||||
'commit',
|
||||
'push',
|
||||
],
|
||||
'message': 'Automated changelog update [skip ci]',
|
||||
'branch': 'master',
|
||||
'author_email': 'devops@owncloud.com',
|
||||
'author_name': 'ownClouders',
|
||||
'netrc_machine': 'github.com',
|
||||
'netrc_username': {
|
||||
'from_secret': 'github_username',
|
||||
},
|
||||
'netrc_password': {
|
||||
'from_secret': 'github_token',
|
||||
},
|
||||
},
|
||||
'when': {
|
||||
'ref': {
|
||||
'exclude': [
|
||||
'refs/pull/**',
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
'depends_on': [
|
||||
'manifest',
|
||||
],
|
||||
'trigger': {
|
||||
'ref': [
|
||||
'refs/heads/master',
|
||||
'refs/pull/**',
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
def readme(ctx):
|
||||
return {
|
||||
'kind': 'pipeline',
|
||||
'type': 'docker',
|
||||
'name': 'readme',
|
||||
'platform': {
|
||||
'os': 'linux',
|
||||
'arch': 'amd64',
|
||||
},
|
||||
'steps': [
|
||||
{
|
||||
'name': 'execute',
|
||||
'image': 'sheogorath/readme-to-dockerhub:latest',
|
||||
'pull': 'always',
|
||||
'environment': {
|
||||
'DOCKERHUB_USERNAME': {
|
||||
'from_secret': 'docker_username',
|
||||
},
|
||||
'DOCKERHUB_PASSWORD': {
|
||||
'from_secret': 'docker_password',
|
||||
},
|
||||
'DOCKERHUB_REPO_PREFIX': ctx.repo.namespace,
|
||||
'DOCKERHUB_REPO_NAME': ctx.repo.name,
|
||||
'SHORT_DESCRIPTION': 'Docker images for %s' % (ctx.repo.name),
|
||||
'README_PATH': 'README.md',
|
||||
},
|
||||
},
|
||||
],
|
||||
'depends_on': [
|
||||
'changelog',
|
||||
],
|
||||
'trigger': {
|
||||
'ref': [
|
||||
'refs/heads/master',
|
||||
'refs/tags/**',
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
def badges(ctx):
|
||||
return {
|
||||
'kind': 'pipeline',
|
||||
'type': 'docker',
|
||||
'name': 'badges',
|
||||
'platform': {
|
||||
'os': 'linux',
|
||||
'arch': 'amd64',
|
||||
},
|
||||
'steps': [
|
||||
{
|
||||
'name': 'execute',
|
||||
'image': 'plugins/webhook:1',
|
||||
'pull': 'always',
|
||||
'settings': {
|
||||
'urls': {
|
||||
'from_secret': 'microbadger_url',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
'depends_on': [
|
||||
'readme',
|
||||
],
|
||||
'trigger': {
|
||||
'ref': [
|
||||
'refs/heads/master',
|
||||
'refs/tags/**',
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
def website(ctx):
|
||||
return {
|
||||
'kind': 'pipeline',
|
||||
'type': 'docker',
|
||||
'name': 'website',
|
||||
'platform': {
|
||||
'os': 'linux',
|
||||
'arch': 'amd64',
|
||||
},
|
||||
'steps': [
|
||||
{
|
||||
'name': 'prepare',
|
||||
'image': 'owncloudci/alpine:latest',
|
||||
'commands': [
|
||||
'make docs-copy'
|
||||
],
|
||||
},
|
||||
{
|
||||
'name': 'test',
|
||||
'image': 'webhippie/hugo:latest',
|
||||
'commands': [
|
||||
'cd hugo',
|
||||
'hugo',
|
||||
],
|
||||
},
|
||||
{
|
||||
'name': 'list',
|
||||
'image': 'owncloudci/alpine:latest',
|
||||
'commands': [
|
||||
'tree hugo/public',
|
||||
],
|
||||
},
|
||||
{
|
||||
'name': 'publish',
|
||||
'image': 'plugins/gh-pages:1',
|
||||
'pull': 'always',
|
||||
'settings': {
|
||||
'username': {
|
||||
'from_secret': 'github_username',
|
||||
},
|
||||
'password': {
|
||||
'from_secret': 'github_token',
|
||||
},
|
||||
'pages_directory': 'docs/',
|
||||
'target_branch': 'docs',
|
||||
},
|
||||
'when': {
|
||||
'ref': {
|
||||
'exclude': [
|
||||
'refs/pull/**',
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
'name': 'downstream',
|
||||
'image': 'plugins/downstream',
|
||||
'settings': {
|
||||
'server': 'https://cloud.drone.io/',
|
||||
'token': {
|
||||
'from_secret': 'drone_token',
|
||||
},
|
||||
'repositories': [
|
||||
'owncloud/owncloud.github.io@source',
|
||||
],
|
||||
},
|
||||
'when': {
|
||||
'ref': {
|
||||
'exclude': [
|
||||
'refs/pull/**',
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
'depends_on': [
|
||||
'badges',
|
||||
],
|
||||
'trigger': {
|
||||
'ref': [
|
||||
'refs/heads/master',
|
||||
'refs/pull/**',
|
||||
],
|
||||
},
|
||||
}
|
||||
35
phoenix/.editorconfig
Normal file
35
phoenix/.editorconfig
Normal file
@@ -0,0 +1,35 @@
|
||||
# http://editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[Makefile]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
[*.go]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
[*.starlark]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.{yml,json}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.{js,vue}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.{css,less}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = true
|
||||
12
phoenix/.github/config.yml
vendored
Normal file
12
phoenix/.github/config.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
# Configuration for update-docs - https://github.com/behaviorbot/update-docs
|
||||
|
||||
# Comment to be posted to on PRs that don't update documentation
|
||||
updateDocsComment: >
|
||||
Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a [changelog](https://github.com/owncloud/ocis-phoenix/blob/master/changelog/README.md) item based on your changes.
|
||||
updateDocsWhiteList:
|
||||
- Tests-only
|
||||
- tests-only
|
||||
- Tests-Only
|
||||
|
||||
updateDocsTargetFiles:
|
||||
- changelog/unreleased/
|
||||
0
phoenix/.github/issue_template.md
vendored
Normal file
0
phoenix/.github/issue_template.md
vendored
Normal file
0
phoenix/.github/pull_request_template.md
vendored
Normal file
0
phoenix/.github/pull_request_template.md
vendored
Normal file
98
phoenix/.github/settings.yml
vendored
Normal file
98
phoenix/.github/settings.yml
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
---
|
||||
repository:
|
||||
name: ocis-phoenix
|
||||
description: ':atom_symbol: Serve Phoenix for oCIS'
|
||||
homepage: https://owncloud.github.io/ocis-phoenix/
|
||||
topics: reva, ocis
|
||||
|
||||
private: false
|
||||
has_issues: true
|
||||
has_projects: false
|
||||
has_wiki: false
|
||||
has_downloads: false
|
||||
|
||||
default_branch: master
|
||||
|
||||
allow_squash_merge: true
|
||||
allow_merge_commit: true
|
||||
allow_rebase_merge: true
|
||||
|
||||
labels:
|
||||
- name: bug
|
||||
color: d73a4a
|
||||
description: Something isn't working
|
||||
- name: documentation
|
||||
color: 0075ca
|
||||
description: Improvements or additions to documentation
|
||||
- name: duplicate
|
||||
color: cfd3d7
|
||||
description: This issue or pull request already exists
|
||||
- name: enhancement
|
||||
color: a2eeef
|
||||
description: New feature or request
|
||||
- name: good first issue
|
||||
color: 7057ff
|
||||
description: Good for newcomers
|
||||
- name: help wanted
|
||||
color: 008672
|
||||
description: Extra attention is needed
|
||||
- name: invalid
|
||||
color: e4e669
|
||||
description: This doesn't seem right
|
||||
- name: question
|
||||
color: d876e3
|
||||
description: Further information is requested
|
||||
- name: wontfix
|
||||
color: ffffff
|
||||
description: This will not be worked on
|
||||
- name: effort/trivial
|
||||
color: c2e0c6
|
||||
description: Required effort to finish task
|
||||
- name: effort/0.25d
|
||||
color: c2e0c6
|
||||
description: Required effort to finish task
|
||||
- name: effort/0.5d
|
||||
color: c2e0c6
|
||||
description: Required effort to finish task
|
||||
- name: effort/1d
|
||||
color: c2e0c6
|
||||
description: Required effort to finish task
|
||||
- name: effort/2d
|
||||
color: c2e0c6
|
||||
description: Required effort to finish task
|
||||
- name: effort/4d
|
||||
color: c2e0c6
|
||||
description: Required effort to finish task
|
||||
- name: effort/5d
|
||||
color: c2e0c6
|
||||
description: Required effort to finish task
|
||||
- name: effort/10d
|
||||
color: c2e0c6
|
||||
description: Required effort to finish task
|
||||
|
||||
teams:
|
||||
- name: ci
|
||||
permission: admin
|
||||
- name: employees
|
||||
permission: push
|
||||
|
||||
branches:
|
||||
- name: master
|
||||
protection:
|
||||
required_pull_request_reviews:
|
||||
required_approving_review_count: 1
|
||||
dismiss_stale_reviews: false
|
||||
require_code_owner_reviews: false
|
||||
dismissal_restrictions: {}
|
||||
required_status_checks:
|
||||
strict: true
|
||||
contexts:
|
||||
- continuous-integration/drone/pr
|
||||
enforce_admins: false
|
||||
restrictions:
|
||||
users: []
|
||||
teams:
|
||||
- ci
|
||||
- employees
|
||||
|
||||
...
|
||||
7
phoenix/.gitignore
vendored
Normal file
7
phoenix/.gitignore
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
coverage.out
|
||||
|
||||
/bin
|
||||
/dist
|
||||
/hugo
|
||||
|
||||
/assets
|
||||
373
phoenix/CHANGELOG.md
Normal file
373
phoenix/CHANGELOG.md
Normal file
@@ -0,0 +1,373 @@
|
||||
# Changelog for [unreleased] (UNRELEASED)
|
||||
|
||||
The following sections list the changes in ocis-phoenix unreleased.
|
||||
|
||||
[unreleased]: https://github.com/owncloud/ocis-phoenix/compare/v0.13.0...master
|
||||
|
||||
## Summary
|
||||
|
||||
* Bugfix - Fix external app URLs: [#218](https://github.com/owncloud/product/issues/218)
|
||||
* Change - Remove pdf-viewer from default apps: [#85](https://github.com/owncloud/ocis-phoenix/pull/85)
|
||||
|
||||
## Details
|
||||
|
||||
* Bugfix - Fix external app URLs: [#218](https://github.com/owncloud/product/issues/218)
|
||||
|
||||
The URLs for the default set of external apps was hardcoded to localhost:9200. We fixed that by
|
||||
using relative paths instead.
|
||||
|
||||
https://github.com/owncloud/product/issues/218
|
||||
https://github.com/owncloud/ocis-phoenix/pull/83
|
||||
|
||||
* Change - Remove pdf-viewer from default apps: [#85](https://github.com/owncloud/ocis-phoenix/pull/85)
|
||||
|
||||
OCIS-web doesn't have a dedicated pdf-viewer app anymore but instead uses the default browser
|
||||
behaviour for PDFs. We removed pdf-viewer from the set of default apps.
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/85
|
||||
|
||||
# Changelog for [0.13.0] (2020-08-25)
|
||||
|
||||
The following sections list the changes in ocis-phoenix 0.13.0.
|
||||
|
||||
[0.13.0]: https://github.com/owncloud/ocis-phoenix/compare/v0.12.0...v0.13.0
|
||||
|
||||
## Summary
|
||||
|
||||
* Change - Update Phoenix: [#81](https://github.com/owncloud/ocis-phoenix/pull/81)
|
||||
|
||||
## Details
|
||||
|
||||
* Change - Update Phoenix: [#81](https://github.com/owncloud/ocis-phoenix/pull/81)
|
||||
|
||||
Updated phoenix from v0.15.0 to v0.16.0
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/81
|
||||
https://github.com/owncloud/phoenix/releases/tag/v0.16.0
|
||||
|
||||
# Changelog for [0.12.0] (2020-08-19)
|
||||
|
||||
The following sections list the changes in ocis-phoenix 0.12.0.
|
||||
|
||||
[0.12.0]: https://github.com/owncloud/ocis-phoenix/compare/v0.11.0...v0.12.0
|
||||
|
||||
## Summary
|
||||
|
||||
* Change - Enable Settings and Accounts apps by default: [#80](https://github.com/owncloud/ocis-phoenix/pull/80)
|
||||
* Change - Update Phoenix: [#79](https://github.com/owncloud/ocis-phoenix/pull/79)
|
||||
|
||||
## Details
|
||||
|
||||
* Change - Enable Settings and Accounts apps by default: [#80](https://github.com/owncloud/ocis-phoenix/pull/80)
|
||||
|
||||
The default ocis-web config now adds the frontend of ocis-accounts and ocis-settings to the
|
||||
builtin web config.
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/80
|
||||
|
||||
* Change - Update Phoenix: [#79](https://github.com/owncloud/ocis-phoenix/pull/79)
|
||||
|
||||
Updated phoenix from v0.14.0 to v0.15.0
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/79
|
||||
https://github.com/owncloud/phoenix/releases/tag/v0.15.0
|
||||
|
||||
# Changelog for [0.11.0] (2020-08-17)
|
||||
|
||||
The following sections list the changes in ocis-phoenix 0.11.0.
|
||||
|
||||
[0.11.0]: https://github.com/owncloud/ocis-phoenix/compare/v0.10.0...v0.11.0
|
||||
|
||||
## Summary
|
||||
|
||||
* Bugfix - Exit when assets or config are not found: [#76](https://github.com/owncloud/ocis-phoenix/pull/76)
|
||||
* Bugfix - Build docker images with alpine:latest instead of alpine:edge: [#73](https://github.com/owncloud/ocis-phoenix/pull/73)
|
||||
* Change - Hide searchbar by default: [#116](https://github.com/owncloud/product/issues/116)
|
||||
* Change - Update Phoenix: [#78](https://github.com/owncloud/ocis-phoenix/pull/78)
|
||||
|
||||
## Details
|
||||
|
||||
* Bugfix - Exit when assets or config are not found: [#76](https://github.com/owncloud/ocis-phoenix/pull/76)
|
||||
|
||||
When a non-existing assets folder is specified, there was only a warning log statement and the
|
||||
service served the builtin assets instead. It is safe to exit the service in such a scenario,
|
||||
instead of serving other assets than specified. We changed the log level to `Fatal` on
|
||||
non-existing assets. Similar for the web config, it was not failing on service level, but only
|
||||
showing an error in the web ui, wenn the specified config file could not be found. We changed the
|
||||
log level to `Fatal` as well.
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/76
|
||||
https://github.com/owncloud/ocis-phoenix/pull/77
|
||||
|
||||
* Bugfix - Build docker images with alpine:latest instead of alpine:edge: [#73](https://github.com/owncloud/ocis-phoenix/pull/73)
|
||||
|
||||
ARM builds were failing when built on alpine:edge, so we switched to alpine:latest instead.
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/73
|
||||
|
||||
* Change - Hide searchbar by default: [#116](https://github.com/owncloud/product/issues/116)
|
||||
|
||||
Since file search is not working at the moment we decided to hide the search bar by default.
|
||||
|
||||
https://github.com/owncloud/product/issues/116
|
||||
https://github.com/owncloud/ocis-phoenix/pull/74
|
||||
|
||||
* Change - Update Phoenix: [#78](https://github.com/owncloud/ocis-phoenix/pull/78)
|
||||
|
||||
Updated phoenix from v0.13.0 to v0.14.0
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/78
|
||||
|
||||
# Changelog for [0.10.0] (2020-07-17)
|
||||
|
||||
The following sections list the changes in ocis-phoenix 0.10.0.
|
||||
|
||||
[0.10.0]: https://github.com/owncloud/ocis-phoenix/compare/v0.9.0...v0.10.0
|
||||
|
||||
## Summary
|
||||
|
||||
* Change - Update Phoenix: [#72](https://github.com/owncloud/ocis-phoenix/pull/72)
|
||||
|
||||
## Details
|
||||
|
||||
* Change - Update Phoenix: [#72](https://github.com/owncloud/ocis-phoenix/pull/72)
|
||||
|
||||
Updated phoenix from v0.12.0 to v0.13.0
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/72
|
||||
|
||||
# Changelog for [0.9.0] (2020-07-10)
|
||||
|
||||
The following sections list the changes in ocis-phoenix 0.9.0.
|
||||
|
||||
[0.9.0]: https://github.com/owncloud/ocis-phoenix/compare/v0.8.1...v0.9.0
|
||||
|
||||
## Summary
|
||||
|
||||
* Bugfix - Allow silent refresh of access token: [#69](https://github.com/owncloud/ocis-konnectd/issues/69)
|
||||
* Change - Update Phoenix: [#70](https://github.com/owncloud/ocis-phoenix/pull/70)
|
||||
|
||||
## Details
|
||||
|
||||
* Bugfix - Allow silent refresh of access token: [#69](https://github.com/owncloud/ocis-konnectd/issues/69)
|
||||
|
||||
Sets the `X-Frame-Options` header to `SAMEORIGIN` so the oidc client can refresh the token in
|
||||
an iframe.
|
||||
|
||||
https://github.com/owncloud/ocis-konnectd/issues/69
|
||||
https://github.com/owncloud/ocis-phoenix/pull/69
|
||||
|
||||
* Change - Update Phoenix: [#70](https://github.com/owncloud/ocis-phoenix/pull/70)
|
||||
|
||||
Updated phoenix from v0.11.1 to v0.12.0
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/70
|
||||
|
||||
# Changelog for [0.8.1] (2020-06-29)
|
||||
|
||||
The following sections list the changes in ocis-phoenix 0.8.1.
|
||||
|
||||
[0.8.1]: https://github.com/owncloud/ocis-phoenix/compare/v0.8.0...v0.8.1
|
||||
|
||||
## Summary
|
||||
|
||||
* Change - Update Phoenix: [#68](https://github.com/owncloud/ocis-phoenix/pull/68)
|
||||
|
||||
## Details
|
||||
|
||||
* Change - Update Phoenix: [#68](https://github.com/owncloud/ocis-phoenix/pull/68)
|
||||
|
||||
Updated phoenix from v0.11.0 to v0.11.1
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/68
|
||||
|
||||
# Changelog for [0.8.0] (2020-06-26)
|
||||
|
||||
The following sections list the changes in ocis-phoenix 0.8.0.
|
||||
|
||||
[0.8.0]: https://github.com/owncloud/ocis-phoenix/compare/v0.7.0...v0.8.0
|
||||
|
||||
## Summary
|
||||
|
||||
* Change - Update Phoenix: [#67](https://github.com/owncloud/ocis-phoenix/pull/67)
|
||||
|
||||
## Details
|
||||
|
||||
* Change - Update Phoenix: [#67](https://github.com/owncloud/ocis-phoenix/pull/67)
|
||||
|
||||
Updated phoenix from v0.10.0 to v0.11.0
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/67
|
||||
|
||||
# Changelog for [0.7.0] (2020-05-26)
|
||||
|
||||
The following sections list the changes in ocis-phoenix 0.7.0.
|
||||
|
||||
[0.7.0]: https://github.com/owncloud/ocis-phoenix/compare/v0.6.0...v0.7.0
|
||||
|
||||
## Summary
|
||||
|
||||
* Change - Update Phoenix: [#66](https://github.com/owncloud/ocis-phoenix/pull/66)
|
||||
|
||||
## Details
|
||||
|
||||
* Change - Update Phoenix: [#66](https://github.com/owncloud/ocis-phoenix/pull/66)
|
||||
|
||||
Updated phoenix from v0.9.0 to v0.10.0
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/66
|
||||
|
||||
# Changelog for [0.6.0] (2020-04-28)
|
||||
|
||||
The following sections list the changes in ocis-phoenix 0.6.0.
|
||||
|
||||
[0.6.0]: https://github.com/owncloud/ocis-phoenix/compare/v0.5.0...v0.6.0
|
||||
|
||||
## Summary
|
||||
|
||||
* Change - Update Phoenix: [#65](https://github.com/owncloud/ocis-phoenix/pull/65)
|
||||
|
||||
## Details
|
||||
|
||||
* Change - Update Phoenix: [#65](https://github.com/owncloud/ocis-phoenix/pull/65)
|
||||
|
||||
Updated phoenix from v0.8.0 to v0.9.0
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/65
|
||||
|
||||
# Changelog for [0.5.0] (2020-04-14)
|
||||
|
||||
The following sections list the changes in ocis-phoenix 0.5.0.
|
||||
|
||||
[0.5.0]: https://github.com/owncloud/ocis-phoenix/compare/v0.4.1...v0.5.0
|
||||
|
||||
## Summary
|
||||
|
||||
* Change - Update Phoenix: [#63](https://github.com/owncloud/ocis-phoenix/pull/63)
|
||||
|
||||
## Details
|
||||
|
||||
* Change - Update Phoenix: [#63](https://github.com/owncloud/ocis-phoenix/pull/63)
|
||||
|
||||
Updated phoenix from v0.7.0 to v0.8.0
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/63
|
||||
|
||||
# Changelog for [0.4.1] (2020-04-01)
|
||||
|
||||
The following sections list the changes in ocis-phoenix 0.4.1.
|
||||
|
||||
[0.4.1]: https://github.com/owncloud/ocis-phoenix/compare/v0.4.0...v0.4.1
|
||||
|
||||
## Summary
|
||||
|
||||
* Bugfix - Create a new tag to fix v0.4.0: [#62](https://github.com/owncloud/ocis-phoenix/pull/62)
|
||||
|
||||
## Details
|
||||
|
||||
* Bugfix - Create a new tag to fix v0.4.0: [#62](https://github.com/owncloud/ocis-phoenix/pull/62)
|
||||
|
||||
Release v0.4.0 is using the wrong assets. We fixed that by creating a new release.
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/62
|
||||
|
||||
# Changelog for [0.4.0] (2020-03-31)
|
||||
|
||||
The following sections list the changes in ocis-phoenix 0.4.0.
|
||||
|
||||
[0.4.0]: https://github.com/owncloud/ocis-phoenix/compare/v0.2.0...v0.4.0
|
||||
|
||||
## Summary
|
||||
|
||||
* Change - Update Phoenix: [#60](https://github.com/owncloud/ocis-phoenix/pull/60)
|
||||
* Enhancement - Configuration: [#57](https://github.com/owncloud/ocis-phoenix/pull/57)
|
||||
|
||||
## Details
|
||||
|
||||
* Change - Update Phoenix: [#60](https://github.com/owncloud/ocis-phoenix/pull/60)
|
||||
|
||||
Updated phoenix from v0.6.0 to v0.7.0
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/60
|
||||
|
||||
* Enhancement - Configuration: [#57](https://github.com/owncloud/ocis-phoenix/pull/57)
|
||||
|
||||
Extensions should be responsible of configuring themselves. We use Viper for config loading
|
||||
from default paths. Environment variables **WILL** take precedence over config files.
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/57
|
||||
|
||||
# Changelog for [0.2.0] (2020-03-17)
|
||||
|
||||
The following sections list the changes in ocis-phoenix 0.2.0.
|
||||
|
||||
[0.2.0]: https://github.com/owncloud/ocis-phoenix/compare/v0.3.0...v0.2.0
|
||||
|
||||
## Summary
|
||||
|
||||
* Bugfix - Config file value not being read: [#45](https://github.com/owncloud/ocis-phoenix/pull/45)
|
||||
* Enhancement - Update to Phoenix v0.5.0: [#43](https://github.com/owncloud/ocis-phoenix/issues/43)
|
||||
* Enhancement - Update to Phoenix v0.6.0: [#53](https://github.com/owncloud/ocis-phoenix/pull/53)
|
||||
|
||||
## Details
|
||||
|
||||
* Bugfix - Config file value not being read: [#45](https://github.com/owncloud/ocis-phoenix/pull/45)
|
||||
|
||||
There was a bug in which phoenix config is always set to the default values and the contents of the
|
||||
config file were actually ignored.
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/issues/46
|
||||
https://github.com/owncloud/ocis-phoenix/issues/47
|
||||
https://github.com/owncloud/ocis-phoenix/pull/45
|
||||
|
||||
* Enhancement - Update to Phoenix v0.5.0: [#43](https://github.com/owncloud/ocis-phoenix/issues/43)
|
||||
|
||||
Use the latest phoenix release
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/issues/43
|
||||
|
||||
* Enhancement - Update to Phoenix v0.6.0: [#53](https://github.com/owncloud/ocis-phoenix/pull/53)
|
||||
|
||||
Use the latest phoenix release
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/53
|
||||
|
||||
# Changelog for [0.3.0] (2020-03-17)
|
||||
|
||||
The following sections list the changes in ocis-phoenix 0.3.0.
|
||||
|
||||
[0.3.0]: https://github.com/owncloud/ocis-phoenix/compare/v0.1.0...v0.3.0
|
||||
|
||||
## Summary
|
||||
|
||||
* Change - Default to running behind ocis-proxy: [#55](https://github.com/owncloud/ocis-phoenix/pull/55)
|
||||
|
||||
## Details
|
||||
|
||||
* Change - Default to running behind ocis-proxy: [#55](https://github.com/owncloud/ocis-phoenix/pull/55)
|
||||
|
||||
We changed the default configuration to integrate better with ocis.
|
||||
|
||||
Clients are supposed to use the ocis-proxy endpoint `https://localhost:9200`
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/55
|
||||
|
||||
# Changelog for [0.1.0] (2020-02-03)
|
||||
|
||||
The following sections list the changes in ocis-phoenix 0.1.0.
|
||||
|
||||
[0.1.0]: https://github.com/owncloud/ocis-phoenix/compare/432c57c406a8421a20ba596818d95f816e2ef9c7...v0.1.0
|
||||
|
||||
## Summary
|
||||
|
||||
* Change - Initial release of basic version: [#3](https://github.com/owncloud/ocis-phoenix/issues/3)
|
||||
|
||||
## Details
|
||||
|
||||
* Change - Initial release of basic version: [#3](https://github.com/owncloud/ocis-phoenix/issues/3)
|
||||
|
||||
Just prepared an initial basic version to serve Phoenix for the ownCloud Infinite Scale
|
||||
project. It just provides a minimal viable product to demonstrate the microservice pattern.
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/issues/3
|
||||
|
||||
202
phoenix/LICENSE
Normal file
202
phoenix/LICENSE
Normal file
@@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
198
phoenix/Makefile
Normal file
198
phoenix/Makefile
Normal file
@@ -0,0 +1,198 @@
|
||||
SHELL := bash
|
||||
NAME := ocis-phoenix
|
||||
IMPORT := github.com/owncloud/$(NAME)
|
||||
BIN := bin
|
||||
DIST := dist
|
||||
HUGO := hugo
|
||||
PHOENIX_ASSETS_VERSION = v0.16.0
|
||||
|
||||
ifeq ($(OS), Windows_NT)
|
||||
EXECUTABLE := $(NAME).exe
|
||||
UNAME := Windows
|
||||
else
|
||||
EXECUTABLE := $(NAME)
|
||||
UNAME := $(shell uname -s)
|
||||
endif
|
||||
|
||||
ifeq ($(UNAME), Darwin)
|
||||
GOBUILD ?= go build -i
|
||||
else
|
||||
GOBUILD ?= go build
|
||||
endif
|
||||
|
||||
PACKAGES ?= $(shell go list ./...)
|
||||
SOURCES ?= $(shell find . -name "*.go" -type f -not -path "./node_modules/*")
|
||||
GENERATE ?= $(PACKAGES)
|
||||
|
||||
TAGS ?=
|
||||
|
||||
ifndef OUTPUT
|
||||
ifneq ($(DRONE_TAG),)
|
||||
OUTPUT ?= $(subst v,,$(DRONE_TAG))
|
||||
else
|
||||
OUTPUT ?= testing
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef VERSION
|
||||
ifneq ($(DRONE_TAG),)
|
||||
VERSION ?= $(subst v,,$(DRONE_TAG))
|
||||
else
|
||||
VERSION ?= $(shell git rev-parse --short HEAD)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef DATE
|
||||
DATE := $(shell date -u '+%Y%m%d')
|
||||
endif
|
||||
|
||||
LDFLAGS += -s -w -X "$(IMPORT)/pkg/version.String=$(VERSION)" -X "$(IMPORT)/pkg/version.Date=$(DATE)"
|
||||
GCFLAGS += all=-N -l
|
||||
|
||||
.PHONY: all
|
||||
all: build
|
||||
|
||||
.PHONY: sync
|
||||
sync:
|
||||
go mod download
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
go clean -i ./...
|
||||
rm -rf $(BIN) $(DIST) $(HUGO) assets
|
||||
|
||||
.PHONY: fmt
|
||||
fmt:
|
||||
gofmt -s -w $(SOURCES)
|
||||
|
||||
.PHONY: vet
|
||||
vet:
|
||||
go vet $(PACKAGES)
|
||||
|
||||
.PHONY: staticcheck
|
||||
staticcheck:
|
||||
go run honnef.co/go/tools/cmd/staticcheck -tags '$(TAGS)' $(PACKAGES)
|
||||
|
||||
.PHONY: lint
|
||||
lint:
|
||||
for PKG in $(PACKAGES); do go run golang.org/x/lint/golint -set_exit_status $$PKG || exit 1; done;
|
||||
|
||||
.PHONY: generate
|
||||
generate: assets
|
||||
go generate $(GENERATE)
|
||||
|
||||
.PHONY: changelog
|
||||
changelog:
|
||||
go run github.com/restic/calens >| CHANGELOG.md
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
go run github.com/haya14busa/goverage -v -coverprofile coverage.out $(PACKAGES)
|
||||
|
||||
.PHONY: install
|
||||
install: $(SOURCES)
|
||||
go install -v -tags '$(TAGS)' -ldflags '$(LDFLAGS)' ./cmd/$(NAME)
|
||||
|
||||
.PHONY: build
|
||||
build: $(BIN)/$(EXECUTABLE) $(BIN)/$(EXECUTABLE)-debug
|
||||
|
||||
$(BIN)/$(EXECUTABLE): $(SOURCES)
|
||||
$(GOBUILD) -v -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -o $@ ./cmd/$(NAME)
|
||||
|
||||
$(BIN)/$(EXECUTABLE)-debug: $(SOURCES)
|
||||
$(GOBUILD) -v -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -gcflags '$(GCFLAGS)' -o $@ ./cmd/$(NAME)
|
||||
|
||||
.PHONY: release
|
||||
release: release-dirs release-linux release-windows release-darwin release-copy release-check
|
||||
|
||||
.PHONY: release-dirs
|
||||
release-dirs:
|
||||
mkdir -p $(DIST)/binaries $(DIST)/release
|
||||
|
||||
.PHONY: release-linux
|
||||
release-linux: release-dirs
|
||||
go run github.com/mitchellh/gox -tags 'netgo $(TAGS)' -ldflags '-extldflags "-static" $(LDFLAGS)' -os 'linux' -arch 'amd64 386 arm64 arm' -output '$(DIST)/binaries/$(EXECUTABLE)-$(OUTPUT)-{{.OS}}-{{.Arch}}' ./cmd/$(NAME)
|
||||
|
||||
.PHONY: release-windows
|
||||
release-windows: release-dirs
|
||||
go run github.com/mitchellh/gox -tags 'netgo $(TAGS)' -ldflags '-extldflags "-static" $(LDFLAGS)' -os 'windows' -arch 'amd64' -output '$(DIST)/binaries/$(EXECUTABLE)-$(OUTPUT)-{{.OS}}-{{.Arch}}' ./cmd/$(NAME)
|
||||
|
||||
.PHONY: release-darwin
|
||||
release-darwin: release-dirs
|
||||
go run github.com/mitchellh/gox -tags 'netgo $(TAGS)' -ldflags '$(LDFLAGS)' -os 'darwin' -arch 'amd64' -output '$(DIST)/binaries/$(EXECUTABLE)-$(OUTPUT)-{{.OS}}-{{.Arch}}' ./cmd/$(NAME)
|
||||
|
||||
.PHONY: release-copy
|
||||
release-copy:
|
||||
$(foreach file,$(wildcard $(DIST)/binaries/$(EXECUTABLE)-*),cp $(file) $(DIST)/release/$(notdir $(file));)
|
||||
|
||||
.PHONY: release-check
|
||||
release-check:
|
||||
cd $(DIST)/release; $(foreach file,$(wildcard $(DIST)/release/$(EXECUTABLE)-*),sha256sum $(notdir $(file)) > $(notdir $(file)).sha256;)
|
||||
|
||||
.PHONY: release-finish
|
||||
release-finish: release-copy release-check
|
||||
|
||||
.PHONY: docs-copy
|
||||
docs-copy:
|
||||
mkdir -p $(HUGO); \
|
||||
mkdir -p $(HUGO)/content/extensions; \
|
||||
cd $(HUGO); \
|
||||
git init; \
|
||||
git remote rm origin; \
|
||||
git remote add origin https://github.com/owncloud/owncloud.github.io; \
|
||||
git fetch; \
|
||||
git checkout origin/source -f; \
|
||||
rsync --delete -ax ../docs/ content/extensions/$(NAME)
|
||||
|
||||
.PHONY: docs-build
|
||||
docs-build:
|
||||
cd $(HUGO); hugo
|
||||
|
||||
.PHONY: docs
|
||||
docs: docs-copy docs-build
|
||||
|
||||
.PHONY: watch
|
||||
watch:
|
||||
go run github.com/cespare/reflex -c reflex.conf
|
||||
|
||||
# $(GOPATH)/bin/protoc-gen-go:
|
||||
# GO111MODULE=off go get -v github.com/golang/protobuf/protoc-gen-go
|
||||
|
||||
# $(GOPATH)/bin/protoc-gen-micro:
|
||||
# GO111MODULE=off go get -v github.com/micro/protoc-gen-micro
|
||||
|
||||
# $(GOPATH)/bin/protoc-gen-microweb:
|
||||
# GO111MODULE=off go get -v github.com/webhippie/protoc-gen-microweb
|
||||
|
||||
# $(GOPATH)/bin/protoc-gen-swagger:
|
||||
# GO111MODULE=off go get -v github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
|
||||
|
||||
# pkg/proto/v0/example.pb.go: pkg/proto/v0/example.proto
|
||||
# protoc \
|
||||
# -I=third_party/ \
|
||||
# -I=pkg/proto/v0/ \
|
||||
# --go_out=pkg/proto/v0 example.proto
|
||||
|
||||
# pkg/proto/v0/example.pb.micro.go: pkg/proto/v0/example.proto
|
||||
# protoc \
|
||||
# -I=third_party/ \
|
||||
# -I=pkg/proto/v0/ \
|
||||
# --micro_out=pkg/proto/v0 example.proto
|
||||
|
||||
# pkg/proto/v0/example.pb.web.go: pkg/proto/v0/example.proto
|
||||
# protoc \
|
||||
# -I=third_party/ \
|
||||
# -I=pkg/proto/v0/ \
|
||||
# --microweb_out=pkg/proto/v0 example.proto
|
||||
|
||||
# pkg/proto/v0/example.swagger.json: pkg/proto/v0/example.proto
|
||||
# protoc \
|
||||
# -I=third_party/ \
|
||||
# -I=pkg/proto/v0/ \
|
||||
# --swagger_out=pkg/proto/v0 example.proto
|
||||
|
||||
# .PHONY: protobuf
|
||||
# protobuf: $(GOPATH)/bin/protoc-gen-go $(GOPATH)/bin/protoc-gen-micro $(GOPATH)/bin/protoc-gen-microweb $(GOPATH)/bin/protoc-gen-swagger pkg/proto/v0/example.pb.go pkg/proto/v0/example.pb.micro.go pkg/proto/v0/example.pb.web.go pkg/proto/v0/example.swagger.json
|
||||
|
||||
assets:
|
||||
mkdir assets/ && curl -slL -o- https://github.com/owncloud/phoenix/releases/download/$(PHOENIX_ASSETS_VERSION)/phoenix.tar.gz | tar xvzf - -C assets/
|
||||
45
phoenix/README.md
Normal file
45
phoenix/README.md
Normal file
@@ -0,0 +1,45 @@
|
||||
# ownCloud Infinite Scale: Phoenix
|
||||
|
||||
[](https://cloud.drone.io/owncloud/ocis-phoenix)
|
||||
[](https://gitter.im/cs3org/reva)
|
||||
[](https://www.codacy.com/app/owncloud/ocis-phoenix?utm_source=github.com&utm_medium=referral&utm_content=owncloud/ocis-phoenix&utm_campaign=Badge_Grade)
|
||||
[](http://godoc.org/github.com/owncloud/ocis-phoenix)
|
||||
[](http://goreportcard.com/report/github.com/owncloud/ocis-phoenix)
|
||||
[](http://microbadger.com/images/owncloud/ocis-phoenix "Get your own image badge on microbadger.com")
|
||||
|
||||
**This project is under heavy development, it's not in a working state yet!**
|
||||
|
||||
## Install
|
||||
|
||||
You can download prebuilt binaries from the GitHub releases or from our [download mirrors](http://download.owncloud.com/ocis/phoenix/). For instructions how to install this on your platform you should take a look at our [documentation](https://owncloud.github.io/extensions/ocis_phoenix/)
|
||||
|
||||
## 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.12. 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.
|
||||
|
||||
```console
|
||||
git clone https://github.com/owncloud/ocis-phoenix.git
|
||||
cd ocis-phoenix
|
||||
|
||||
make generate build
|
||||
|
||||
./bin/ocis-phoenix -h
|
||||
```
|
||||
|
||||
## Security
|
||||
|
||||
If you find a security issue please contact security@owncloud.com first.
|
||||
|
||||
## Contributing
|
||||
|
||||
Fork -> Patch -> Push -> Pull Request
|
||||
|
||||
## License
|
||||
|
||||
Apache-2.0
|
||||
|
||||
## Copyright
|
||||
|
||||
```console
|
||||
Copyright (c) 2020 ownCloud GmbH <https://owncloud.com>
|
||||
```
|
||||
7
phoenix/changelog/0.1.0_2020-02-03/initial-release.md
Normal file
7
phoenix/changelog/0.1.0_2020-02-03/initial-release.md
Normal file
@@ -0,0 +1,7 @@
|
||||
Change: Initial release of basic version
|
||||
|
||||
Just prepared an initial basic version to serve Phoenix for the ownCloud
|
||||
Infinite Scale project. It just provides a minimal viable product to
|
||||
demonstrate the microservice pattern.
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/issues/3
|
||||
5
phoenix/changelog/0.10.0_2020-07-17/update-phoenix
Normal file
5
phoenix/changelog/0.10.0_2020-07-17/update-phoenix
Normal file
@@ -0,0 +1,5 @@
|
||||
Change: update Phoenix
|
||||
|
||||
Updated phoenix from v0.12.0 to v0.13.0
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/72
|
||||
@@ -0,0 +1,10 @@
|
||||
Bugfix: exit when assets or config are not found
|
||||
|
||||
When a non-existing assets folder is specified, there was only a warning log statement and the service served
|
||||
the builtin assets instead. It is safe to exit the service in such a scenario, instead of serving other assets
|
||||
than specified. We changed the log level to `Fatal` on non-existing assets.
|
||||
Similar for the web config, it was not failing on service level, but only showing an error in the web ui, wenn
|
||||
the specified config file could not be found. We changed the log level to `Fatal` as well.
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/76
|
||||
https://github.com/owncloud/ocis-phoenix/pull/77
|
||||
6
phoenix/changelog/0.11.0_2020-08-17/hide-searchbar.md
Normal file
6
phoenix/changelog/0.11.0_2020-08-17/hide-searchbar.md
Normal file
@@ -0,0 +1,6 @@
|
||||
Change: hide searchbar by default
|
||||
|
||||
Since file search is not working at the moment we decided to hide the search bar by default.
|
||||
|
||||
https://github.com/owncloud/product/issues/116
|
||||
https://github.com/owncloud/ocis-phoenix/pull/74
|
||||
5
phoenix/changelog/0.11.0_2020-08-17/update-phoenix.md
Normal file
5
phoenix/changelog/0.11.0_2020-08-17/update-phoenix.md
Normal file
@@ -0,0 +1,5 @@
|
||||
Change: update Phoenix
|
||||
|
||||
Updated phoenix from v0.13.0 to v0.14.0
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/78
|
||||
5
phoenix/changelog/0.11.0_2020-08-17/use-alpine-latest.md
Normal file
5
phoenix/changelog/0.11.0_2020-08-17/use-alpine-latest.md
Normal file
@@ -0,0 +1,5 @@
|
||||
Bugfix: build docker images with alpine:latest instead of alpine:edge
|
||||
|
||||
ARM builds were failing when built on alpine:edge, so we switched to alpine:latest instead.
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/73
|
||||
@@ -0,0 +1,5 @@
|
||||
Change: enable Settings and Accounts apps by default
|
||||
|
||||
The default ocis-web config now adds the frontend of ocis-accounts and ocis-settings to the builtin web config.
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/80
|
||||
6
phoenix/changelog/0.12.0_2020-08-19/update-phoenix.md
Normal file
6
phoenix/changelog/0.12.0_2020-08-19/update-phoenix.md
Normal file
@@ -0,0 +1,6 @@
|
||||
Change: update Phoenix
|
||||
|
||||
Updated phoenix from v0.14.0 to v0.15.0
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/79
|
||||
https://github.com/owncloud/phoenix/releases/tag/v0.15.0
|
||||
6
phoenix/changelog/0.13.0_2020-08-25/update-phoenix
Normal file
6
phoenix/changelog/0.13.0_2020-08-25/update-phoenix
Normal file
@@ -0,0 +1,6 @@
|
||||
Change: update Phoenix
|
||||
|
||||
Updated phoenix from v0.15.0 to v0.16.0
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/81
|
||||
https://github.com/owncloud/phoenix/releases/tag/v0.16.0
|
||||
@@ -0,0 +1,7 @@
|
||||
Bugfix: Config file value not being read
|
||||
|
||||
There was a bug in which phoenix config is always set to the default values and the contents of the config file were actually ignored.
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/45
|
||||
https://github.com/owncloud/ocis-phoenix/issues/46
|
||||
https://github.com/owncloud/ocis-phoenix/issues/47
|
||||
5
phoenix/changelog/0.2.0_2020-03-17/issue-43.md
Normal file
5
phoenix/changelog/0.2.0_2020-03-17/issue-43.md
Normal file
@@ -0,0 +1,5 @@
|
||||
Enhancement: update to Phoenix v0.5.0
|
||||
|
||||
Use the latest phoenix release
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/issues/43
|
||||
5
phoenix/changelog/0.2.0_2020-03-17/phoenix-0.6.0
Normal file
5
phoenix/changelog/0.2.0_2020-03-17/phoenix-0.6.0
Normal file
@@ -0,0 +1,5 @@
|
||||
Enhancement: update to Phoenix v0.6.0
|
||||
|
||||
Use the latest phoenix release
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/53
|
||||
7
phoenix/changelog/0.3.0_2020-03-17/new-ocis-config.md
Normal file
7
phoenix/changelog/0.3.0_2020-03-17/new-ocis-config.md
Normal file
@@ -0,0 +1,7 @@
|
||||
Change: default to running behind ocis-proxy
|
||||
|
||||
We changed the default configuration to integrate better with ocis.
|
||||
|
||||
Clients are supposed to use the ocis-proxy endpoint `https://localhost:9200`
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/55
|
||||
5
phoenix/changelog/0.4.0_2020-03-31/config.md
Normal file
5
phoenix/changelog/0.4.0_2020-03-31/config.md
Normal file
@@ -0,0 +1,5 @@
|
||||
Enhancement: Configuration
|
||||
|
||||
Extensions should be responsible of configuring themselves. We use Viper for config loading from default paths. Environment variables **WILL** take precedence over config files.
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/57
|
||||
5
phoenix/changelog/0.4.0_2020-03-31/update-phoenix
Normal file
5
phoenix/changelog/0.4.0_2020-03-31/update-phoenix
Normal file
@@ -0,0 +1,5 @@
|
||||
Change: update Phoenix
|
||||
|
||||
Updated phoenix from v0.6.0 to v0.7.0
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/60
|
||||
5
phoenix/changelog/0.4.1_2020-04-01/fix-tag
Normal file
5
phoenix/changelog/0.4.1_2020-04-01/fix-tag
Normal file
@@ -0,0 +1,5 @@
|
||||
Bugfix: Create a new tag to fix v0.4.0
|
||||
|
||||
Release v0.4.0 is using the wrong assets. We fixed that by creating a new release.
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/62
|
||||
5
phoenix/changelog/0.5.0_2020-04-14/update-phoenix
Normal file
5
phoenix/changelog/0.5.0_2020-04-14/update-phoenix
Normal file
@@ -0,0 +1,5 @@
|
||||
Change: update Phoenix
|
||||
|
||||
Updated phoenix from v0.7.0 to v0.8.0
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/63
|
||||
5
phoenix/changelog/0.6.0_2020-04-28/update-phoenix
Normal file
5
phoenix/changelog/0.6.0_2020-04-28/update-phoenix
Normal file
@@ -0,0 +1,5 @@
|
||||
Change: update Phoenix
|
||||
|
||||
Updated phoenix from v0.8.0 to v0.9.0
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/65
|
||||
5
phoenix/changelog/0.7.0_2020-05-26/update-phoenix
Normal file
5
phoenix/changelog/0.7.0_2020-05-26/update-phoenix
Normal file
@@ -0,0 +1,5 @@
|
||||
Change: update Phoenix
|
||||
|
||||
Updated phoenix from v0.9.0 to v0.10.0
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/66
|
||||
5
phoenix/changelog/0.8.0_2020-06-26/update-phoenix
Normal file
5
phoenix/changelog/0.8.0_2020-06-26/update-phoenix
Normal file
@@ -0,0 +1,5 @@
|
||||
Change: update Phoenix
|
||||
|
||||
Updated phoenix from v0.10.0 to v0.11.0
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/67
|
||||
5
phoenix/changelog/0.8.1_2020-06-29/update-phoenix
Normal file
5
phoenix/changelog/0.8.1_2020-06-29/update-phoenix
Normal file
@@ -0,0 +1,5 @@
|
||||
Change: update Phoenix
|
||||
|
||||
Updated phoenix from v0.11.0 to v0.11.1
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/68
|
||||
@@ -0,0 +1,6 @@
|
||||
Bugfix: allow silent refresh of access token
|
||||
|
||||
Sets the `X-Frame-Options` header to `SAMEORIGIN` so the oidc client can refresh the token in an iframe.
|
||||
|
||||
https://github.com/owncloud/ocis-konnectd/issues/69
|
||||
https://github.com/owncloud/ocis-phoenix/pull/69
|
||||
5
phoenix/changelog/0.9.0_2020-07-10/update-phoenix
Normal file
5
phoenix/changelog/0.9.0_2020-07-10/update-phoenix
Normal file
@@ -0,0 +1,5 @@
|
||||
Change: update Phoenix
|
||||
|
||||
Updated phoenix from v0.11.1 to v0.12.0
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/70
|
||||
52
phoenix/changelog/CHANGELOG.tmpl
Normal file
52
phoenix/changelog/CHANGELOG.tmpl
Normal file
@@ -0,0 +1,52 @@
|
||||
{{ $allVersions := . }}
|
||||
{{- range $index, $changes := . }}{{ with $changes -}}
|
||||
{{ if gt (len $allVersions) 1 -}}
|
||||
# Changelog for [{{ .Version }}] ({{ .Date }})
|
||||
|
||||
The following sections list the changes in ocis-phoenix {{ .Version }}.
|
||||
|
||||
{{/* creating version compare links */ -}}
|
||||
{{ $next := add1 $index -}}
|
||||
{{ if ne (len $allVersions) $next -}}
|
||||
{{ $previousVersion := (index $allVersions $next).Version -}}
|
||||
{{ if eq .Version "unreleased" -}}
|
||||
[{{ .Version }}]: https://github.com/owncloud/ocis-phoenix/compare/v{{ $previousVersion }}...master
|
||||
|
||||
{{ else -}}
|
||||
[{{ .Version }}]: https://github.com/owncloud/ocis-phoenix/compare/v{{ $previousVersion }}...v{{ .Version }}
|
||||
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{- /* last version managed by calens, end of the loop */ -}}
|
||||
{{ if eq .Version "0.1.0" -}}
|
||||
[{{ .Version }}]: https://github.com/owncloud/ocis-phoenix/compare/432c57c406a8421a20ba596818d95f816e2ef9c7...v{{ .Version }}
|
||||
|
||||
{{ end -}}
|
||||
{{ else -}}
|
||||
# Changes in {{ .Version }}
|
||||
|
||||
{{ end -}}
|
||||
|
||||
## Summary
|
||||
{{ range $entry := .Entries }}{{ with $entry }}
|
||||
* {{ .Type }} - {{ .Title }}: [#{{ .PrimaryID }}]({{ .PrimaryURL }})
|
||||
{{- end }}{{ end }}
|
||||
|
||||
## Details
|
||||
{{ range $entry := .Entries }}{{ with $entry }}
|
||||
* {{ .Type }} - {{ .Title }}: [#{{ .PrimaryID }}]({{ .PrimaryURL }})
|
||||
{{ range $par := .Paragraphs }}
|
||||
{{ wrapIndent $par 80 3 }}
|
||||
{{ end -}}
|
||||
{{ range $url := .IssueURLs }}
|
||||
{{ $url -}}
|
||||
{{ end -}}
|
||||
{{ range $url := .PRURLs }}
|
||||
{{ $url -}}
|
||||
{{ end -}}
|
||||
{{ range $url := .OtherURLs }}
|
||||
{{ $url -}}
|
||||
{{ end }}
|
||||
{{ end }}{{ end }}
|
||||
{{ end }}{{ end -}}
|
||||
6
phoenix/changelog/README.md
Normal file
6
phoenix/changelog/README.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# Changelog
|
||||
|
||||
We are using [calens](https://github.com/restic/calens) to properly generate a
|
||||
changelog before we are tagging a new release. To get an idea how this could
|
||||
look like <https://github.com/restic/restic/tree/master/changelog> would be the
|
||||
best reference.
|
||||
11
phoenix/changelog/TEMPLATE
Normal file
11
phoenix/changelog/TEMPLATE
Normal file
@@ -0,0 +1,11 @@
|
||||
Bugfix: Fix behavior for foobar (in present tense)
|
||||
|
||||
We've fixed the behavior for foobar, a long-standing annoyance for users. The
|
||||
text should be wrapped at 80 characters length.
|
||||
|
||||
The text in the paragraphs is written in past tense. The last section is a list
|
||||
of issue URLs, PR URLs and other URLs. The first issue ID (or the first PR ID,
|
||||
in case there aren't any issue links) is used as the primary ID.
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/issues/1234
|
||||
https://github.com/owncloud/ocis-phoenix/pull/55555
|
||||
0
phoenix/changelog/unreleased/.keep
Normal file
0
phoenix/changelog/unreleased/.keep
Normal file
6
phoenix/changelog/unreleased/fix-external-app-urls
Normal file
6
phoenix/changelog/unreleased/fix-external-app-urls
Normal file
@@ -0,0 +1,6 @@
|
||||
Bugfix: Fix external app URLs
|
||||
|
||||
The URLs for the default set of external apps was hardcoded to localhost:9200. We fixed that by using relative paths instead.
|
||||
|
||||
https://github.com/owncloud/product/issues/218
|
||||
https://github.com/owncloud/ocis-phoenix/pull/83
|
||||
5
phoenix/changelog/unreleased/remove-pdf-viewer.md
Normal file
5
phoenix/changelog/unreleased/remove-pdf-viewer.md
Normal file
@@ -0,0 +1,5 @@
|
||||
Change: Remove pdf-viewer from default apps
|
||||
|
||||
oCIS-web doesn't have a dedicated pdf-viewer app anymore but instead uses the default browser behaviour for PDFs. We removed pdf-viewer from the set of default apps.
|
||||
|
||||
https://github.com/owncloud/ocis-phoenix/pull/85
|
||||
13
phoenix/cmd/ocis-phoenix/main.go
Normal file
13
phoenix/cmd/ocis-phoenix/main.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/owncloud/ocis-phoenix/pkg/command"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if err := command.Execute(); err != nil {
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
3
phoenix/config/.gitignore
vendored
Normal file
3
phoenix/config/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
*
|
||||
!example.json
|
||||
!example.yml
|
||||
24
phoenix/config/example.json
Normal file
24
phoenix/config/example.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"debug": {
|
||||
"addr": "0.0.0.0:9104",
|
||||
"token": "",
|
||||
"pprof": false,
|
||||
"zpages": false
|
||||
},
|
||||
"http": {
|
||||
"addr": "0.0.0.0:9100"
|
||||
},
|
||||
"tracing": {
|
||||
"enabled": false,
|
||||
"type": "jaeger",
|
||||
"endpoint": "localhost:6831",
|
||||
"collector": "http://localhost:14268/api/traces",
|
||||
"service": "phoenix"
|
||||
},
|
||||
"asset": {
|
||||
"path": ""
|
||||
},
|
||||
"config": {
|
||||
"file": ""
|
||||
}
|
||||
}
|
||||
24
phoenix/config/example.yml
Normal file
24
phoenix/config/example.yml
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
debug:
|
||||
addr: 0.0.0.0:9104
|
||||
token:
|
||||
pprof: false
|
||||
zpages: false
|
||||
|
||||
http:
|
||||
addr: 0.0.0.0:9100
|
||||
|
||||
tracing:
|
||||
enabled: false
|
||||
type: jaeger
|
||||
endpoint: localhost:6831
|
||||
collector: http://localhost:14268/api/traces
|
||||
service: phoenix
|
||||
|
||||
asset:
|
||||
path:
|
||||
|
||||
config:
|
||||
file:
|
||||
|
||||
...
|
||||
19
phoenix/docker/Dockerfile.linux.amd64
Normal file
19
phoenix/docker/Dockerfile.linux.amd64
Normal file
@@ -0,0 +1,19 @@
|
||||
FROM amd64/alpine:latest
|
||||
|
||||
RUN apk update && \
|
||||
apk upgrade && \
|
||||
apk add ca-certificates mailcap && \
|
||||
rm -rf /var/cache/apk/* && \
|
||||
echo 'hosts: files dns' >| /etc/nsswitch.conf
|
||||
|
||||
LABEL maintainer="ownCloud GmbH <devops@owncloud.com>" \
|
||||
org.label-schema.name="oCIS Phoenix" \
|
||||
org.label-schema.vendor="ownCloud GmbH" \
|
||||
org.label-schema.schema-version="1.0"
|
||||
|
||||
EXPOSE 9100 9104
|
||||
|
||||
ENTRYPOINT ["/usr/bin/ocis-phoenix"]
|
||||
CMD ["server"]
|
||||
|
||||
COPY bin/ocis-phoenix /usr/bin/ocis-phoenix
|
||||
19
phoenix/docker/Dockerfile.linux.arm
Normal file
19
phoenix/docker/Dockerfile.linux.arm
Normal file
@@ -0,0 +1,19 @@
|
||||
FROM arm32v6/alpine:latest
|
||||
|
||||
RUN apk update && \
|
||||
apk upgrade && \
|
||||
apk add ca-certificates mailcap && \
|
||||
rm -rf /var/cache/apk/* && \
|
||||
echo 'hosts: files dns' >| /etc/nsswitch.conf
|
||||
|
||||
LABEL maintainer="ownCloud GmbH <devops@owncloud.com>" \
|
||||
org.label-schema.name="oCIS Phoenix" \
|
||||
org.label-schema.vendor="ownCloud GmbH" \
|
||||
org.label-schema.schema-version="1.0"
|
||||
|
||||
EXPOSE 9100 9104
|
||||
|
||||
ENTRYPOINT ["/usr/bin/ocis-phoenix"]
|
||||
CMD ["server"]
|
||||
|
||||
COPY bin/ocis-phoenix /usr/bin/ocis-phoenix
|
||||
19
phoenix/docker/Dockerfile.linux.arm64
Normal file
19
phoenix/docker/Dockerfile.linux.arm64
Normal file
@@ -0,0 +1,19 @@
|
||||
FROM arm64v8/alpine:latest
|
||||
|
||||
RUN apk update && \
|
||||
apk upgrade && \
|
||||
apk add ca-certificates mailcap && \
|
||||
rm -rf /var/cache/apk/* && \
|
||||
echo 'hosts: files dns' >| /etc/nsswitch.conf
|
||||
|
||||
LABEL maintainer="ownCloud GmbH <devops@owncloud.com>" \
|
||||
org.label-schema.name="oCIS Phoenix" \
|
||||
org.label-schema.vendor="ownCloud GmbH" \
|
||||
org.label-schema.schema-version="1.0"
|
||||
|
||||
EXPOSE 9100 9104
|
||||
|
||||
ENTRYPOINT ["/usr/bin/ocis-phoenix"]
|
||||
CMD ["server"]
|
||||
|
||||
COPY bin/ocis-phoenix /usr/bin/ocis-phoenix
|
||||
22
phoenix/docker/manifest.tmpl
Normal file
22
phoenix/docker/manifest.tmpl
Normal file
@@ -0,0 +1,22 @@
|
||||
image: owncloud/ocis-phoenix:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
|
||||
{{#if build.tags}}
|
||||
tags:
|
||||
{{#each build.tags}}
|
||||
- {{this}}
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
manifests:
|
||||
- image: owncloud/ocis-phoenix:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
|
||||
platform:
|
||||
architecture: amd64
|
||||
os: linux
|
||||
- image: owncloud/ocis-phoenix:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
|
||||
platform:
|
||||
architecture: arm64
|
||||
variant: v8
|
||||
os: linux
|
||||
- image: owncloud/ocis-phoenix:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
|
||||
platform:
|
||||
architecture: arm
|
||||
variant: v6
|
||||
os: linux
|
||||
10
phoenix/docs/_index.md
Normal file
10
phoenix/docs/_index.md
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: "Phoenix"
|
||||
date: 2018-05-02T00:00:00+00:00
|
||||
weight: 10
|
||||
geekdocRepo: https://github.com/owncloud/ocis-phoenix
|
||||
geekdocEditPath: edit/master/docs
|
||||
geekdocFilePath: _index.md
|
||||
---
|
||||
|
||||
This service embeds [Phoenix](https://github.com/owncloud/phoenix) to provide a UI for ownCloud Infinite Scale.
|
||||
26
phoenix/docs/building.md
Normal file
26
phoenix/docs/building.md
Normal file
@@ -0,0 +1,26 @@
|
||||
---
|
||||
title: "Building"
|
||||
date: 2018-05-02T00:00:00+00:00
|
||||
weight: 30
|
||||
geekdocRepo: https://github.com/owncloud/ocis-phoenix
|
||||
geekdocEditPath: edit/master/docs
|
||||
geekdocFilePath: building.md
|
||||
---
|
||||
|
||||
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-phoenix.git
|
||||
cd ocis-phoenix
|
||||
{{< / 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 >}}
|
||||
|
||||
The above commands will download a [Phoenix](https://github.com/owncloud/phoenix) release and embed it into the binary. Finally you should have the binary within the `bin/` folder now, give it a try with `./bin/ocis-phoenix -h` to see all available options.
|
||||
339
phoenix/docs/getting-started.md
Normal file
339
phoenix/docs/getting-started.md
Normal file
@@ -0,0 +1,339 @@
|
||||
---
|
||||
title: "Getting Started"
|
||||
date: 2018-05-02T00:00:00+00:00
|
||||
weight: 20
|
||||
geekdocRepo: https://github.com/owncloud/ocis-phoenix
|
||||
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
|
||||
|
||||
PHOENIX_CONFIG_FILE
|
||||
: Path to config file, empty default value
|
||||
|
||||
PHOENIX_LOG_LEVEL
|
||||
: Set logging level, defaults to `info`
|
||||
|
||||
PHOENIX_LOG_COLOR
|
||||
: Enable colored logging, defaults to `true`
|
||||
|
||||
PHOENIX_LOG_PRETTY
|
||||
: Enable pretty logging, defaults to `true`
|
||||
|
||||
#### Server
|
||||
|
||||
PHOENIX_TRACING_ENABLED
|
||||
: Enable sending traces, defaults to `false`
|
||||
|
||||
PHOENIX_TRACING_TYPE
|
||||
: Tracing backend type, defaults to `jaeger`
|
||||
|
||||
PHOENIX_TRACING_ENDPOINT
|
||||
: Endpoint for the agent, empty default value
|
||||
|
||||
PHOENIX_TRACING_COLLECTOR
|
||||
: Endpoint for the collector, empty default value
|
||||
|
||||
PHOENIX_TRACING_SERVICE
|
||||
: Service name for tracing, defaults to `phoenix`
|
||||
|
||||
PHOENIX_DEBUG_ADDR
|
||||
: Address to bind debug server, defaults to `0.0.0.0:9104`
|
||||
|
||||
PHOENIX_DEBUG_TOKEN
|
||||
: Token to grant metrics access, empty default value
|
||||
|
||||
PHOENIX_DEBUG_PPROF
|
||||
: Enable pprof debugging, defaults to `false`
|
||||
|
||||
PHOENIX_DEBUG_ZPAGES
|
||||
: Enable zpages debugging, defaults to `false`
|
||||
|
||||
PHOENIX_HTTP_ADDR
|
||||
: Address to bind http server, defaults to `0.0.0.0:9100`
|
||||
|
||||
PHOENIX_HTTP_ROOT
|
||||
: Root path of http server, defaults to `/`
|
||||
|
||||
PHOENIX_ASSET_PATH
|
||||
: Path to custom assets, empty default value
|
||||
|
||||
PHOENIX_WEB_CONFIG
|
||||
: Path to phoenix config, empty default value
|
||||
|
||||
PHOENIX_WEB_CONFIG_SERVER
|
||||
: Server URL, defaults to `http://localhost:9135`
|
||||
|
||||
PHOENIX_WEB_CONFIG_THEME
|
||||
: Theme, defaults to `owncloud`
|
||||
|
||||
PHOENIX_WEB_CONFIG_VERSION
|
||||
: Version, defaults to `0.1.0`
|
||||
|
||||
PHOENIX_APPS
|
||||
: Use multiple times to provide multiple apps
|
||||
|
||||
PHOENIX_EXTERNAL_APPS
|
||||
: Not supported yet, specify a config.json file via `PHOENIX_WEB_CONFIG`
|
||||
|
||||
PHOENIX_OIDC_METADATA_URL
|
||||
: OpenID Connect metadata URL, defaults to `http://localhost:9130/.well-known/openid-configuration`
|
||||
|
||||
PHOENIX_OIDC_AUTHORITY
|
||||
: OpenID Connect authority, defaults to `http://localhost:9130`
|
||||
|
||||
PHOENIX_OIDC_CLIENT_ID
|
||||
: OpenID Connect client ID, defaults to `phoenix`
|
||||
|
||||
PHOENIX_OIDC_RESPONSE_TYPE
|
||||
: OpenID Connect response type, defaults to `code`
|
||||
|
||||
PHOENIX_OIDC_SCOPE
|
||||
: OpenID Connect scope, defaults to `openid profile email`
|
||||
|
||||
In case you want to render any additional properties in the config.json you can provide a custom config.json using eg. `PHOENIX_WEB_CONFIG=/path/to/config.json ocis-phoenix server`
|
||||
|
||||
#### Health
|
||||
|
||||
PHOENIX_DEBUG_ADDR
|
||||
: Address to debug endpoint, defaults to `0.0.0.0:9104`
|
||||
|
||||
### 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 `phoenix`
|
||||
|
||||
--debug-addr
|
||||
: Address to bind debug server, defaults to `0.0.0.0:9104`
|
||||
|
||||
--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:9100`
|
||||
|
||||
--http-root
|
||||
: Root path of http server, defaults to `/`
|
||||
|
||||
--asset-path
|
||||
: Path to custom assets, empty default value
|
||||
|
||||
--web-config
|
||||
: Path to phoenix config, empty default value
|
||||
|
||||
--web-config-server
|
||||
: Server URL, defaults to `http://localhost:9135`
|
||||
|
||||
--web-config-theme
|
||||
: Theme, defaults to `owncloud`
|
||||
|
||||
--web-config-version
|
||||
: Version, defaults to `0.1.0`
|
||||
|
||||
--web-config-app
|
||||
: Provide multiple apps, defaults to `""`. Usage: `phoenix --web-config-app files --web-config-app pdf-viewer`
|
||||
|
||||
--oidc-metadata-url
|
||||
: OpenID Connect metadata URL, defaults to `http://localhost:9130/.well-known/openid-configuration`
|
||||
|
||||
--oidc-authority
|
||||
: OpenID Connect authority, defaults to `http://localhost:9130`
|
||||
|
||||
--oidc-client-id
|
||||
: OpenID Connect client ID, defaults to `phoenix`
|
||||
|
||||
--oidc-response-type
|
||||
: OpenID Connect response type, defaults to `code`
|
||||
|
||||
--oidc-scope
|
||||
: OpenID Connect scope, defaults to `openid profile email`
|
||||
|
||||
In case you want to render any additional properties in the config.json you can provide a custom config.json using eg. `ocis-phoenix server --web-config=/path/to/config.json`
|
||||
|
||||
#### Health
|
||||
|
||||
--debug-addr
|
||||
: Address to debug endpoint, defaults to `0.0.0.0:9104`
|
||||
|
||||
### 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-phoenix/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/phoenix.yml`, `${HOME}/.ocis/phoenix.yml` or `$(pwd)/config/phoenix.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-phoenix --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-phoenix 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-phoenix 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 `PHOENIX_DEBUG_TOKEN` mentioned above. By default the metrics endpoint is bound to `http://0.0.0.0:9104/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
|
||||
10
phoenix/docs/license.md
Normal file
10
phoenix/docs/license.md
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: "License"
|
||||
date: 2018-05-02T00:00:00+00:00
|
||||
weight: 50
|
||||
geekdocRepo: https://github.com/owncloud/ocis-phoenix
|
||||
geekdocEditPath: edit/master/docs
|
||||
geekdocFilePath: license.md
|
||||
---
|
||||
|
||||
This project is licensed under the [Apache 2.0](https://github.com/owncloud/ocis-phoenix/blob/master/LICENSE) license. For the license of the used libraries you have to check the respective sources.
|
||||
47
phoenix/docs/releasing.md
Normal file
47
phoenix/docs/releasing.md
Normal file
@@ -0,0 +1,47 @@
|
||||
---
|
||||
title: "Releasing"
|
||||
weight: 40
|
||||
geekdocRepo: https://github.com/owncloud/ocis-phoenix
|
||||
geekdocEditPath: edit/master/docs
|
||||
geekdocFilePath: releasing.md
|
||||
---
|
||||
|
||||
{{< toc >}}
|
||||
|
||||
## Releasing
|
||||
|
||||
The next generation Web Frontend is shipped as an ocis Extension. The `ocis-phoenix` extension is also embedded in the single binary and part of the `ocis server` command.
|
||||
|
||||
To update this package within all the deliveries, we need to update the package in the following chain from the bottom to the top.
|
||||
|
||||
### Package Hierarchy
|
||||
|
||||
- [ocis](https://githug.com/owncloud/ocis)
|
||||
- [ocis-phoenix](https://github.com/owncloud/ocis-phoenix)
|
||||
- [ocis-pkg](https://github.com/owncloud/ocis-pkg)
|
||||
- [phoenix](https://github.com/owncloud/phoenix)
|
||||
|
||||
#### Prerequisites
|
||||
|
||||
Before updating the assets, make sure that [Phoenix](https://github.com/owncloud/phoenix) has been released first
|
||||
and take note of its release tag name.
|
||||
|
||||
#### Updating ocis-phoenix
|
||||
|
||||
1. Create a branch `release-$version`. in <https://github.com/owncloud/ocis-phoenix>
|
||||
2. Create a Folder in `changelog` for the release version and date `mkdir $major.$minor.$patchVersion_YYYY-MM-DD`.
|
||||
3. Move all changelog items from the `changelog/unreleased/` folder to the `$major.$minor.$patchVersion_YYYY-MM-DD` folder.
|
||||
4. Update the go module `ocis-pkg` to the latest version <https://blog.golang.org/using-go-modules> .
|
||||
5. Update the phoenix asset by adjusting the value of `PHOENIX_ASSETS_VERSION` at the top of the Makefile and specify the tag name of the latest [Phoenix release](https://github.com/owncloud/phoenix/tags).
|
||||
6. Run `make clean generate`.
|
||||
7. Create a changelog item for the update in the `changelog/$major.$minor.$patchVersion_YYYY-MM-DD` folder.
|
||||
8. Commit your changes.
|
||||
9. After merging, wait for the CI to run on the merge commit.
|
||||
10. Go to "Releases" in GH click "Draft a new Release".
|
||||
11. Use `v$major.$minor.$patch` as a tag (the `v` prefix is important) and publish it.
|
||||
12. The tag and the Release artifacts will be created automatically.
|
||||
|
||||
#### Next steps
|
||||
|
||||
Next steps is usually updating the ocis-phoenix version in the [ocis](https://githug.com/owncloud/ocis) repository.
|
||||
|
||||
27
phoenix/go.mod
Normal file
27
phoenix/go.mod
Normal file
@@ -0,0 +1,27 @@
|
||||
module github.com/owncloud/ocis-phoenix
|
||||
|
||||
go 1.13
|
||||
|
||||
require (
|
||||
contrib.go.opencensus.io/exporter/jaeger v0.2.1
|
||||
contrib.go.opencensus.io/exporter/ocagent v0.6.0
|
||||
contrib.go.opencensus.io/exporter/zipkin v0.1.1
|
||||
github.com/UnnoTed/fileb0x v1.1.4
|
||||
github.com/go-chi/chi v4.1.2+incompatible
|
||||
github.com/go-playground/universal-translator v0.17.0 // indirect
|
||||
github.com/mholt/certmagic v0.9.1 // indirect
|
||||
github.com/micro/cli/v2 v2.1.2
|
||||
github.com/micro/go-micro v1.18.0 // indirect
|
||||
github.com/oklog/run v1.0.0
|
||||
github.com/openzipkin/zipkin-go v0.2.2
|
||||
github.com/owncloud/ocis-pkg v1.3.0 // indirect
|
||||
github.com/owncloud/ocis-pkg/v2 v2.3.0
|
||||
github.com/restic/calens v0.2.0
|
||||
github.com/spf13/viper v1.6.1
|
||||
go.opencensus.io v0.22.4
|
||||
golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2
|
||||
google.golang.org/grpc/examples v0.0.0-20200824180931-410880dd7d91 // indirect
|
||||
gopkg.in/go-playground/validator.v9 v9.31.0 // indirect
|
||||
)
|
||||
|
||||
replace google.golang.org/grpc => google.golang.org/grpc v1.26.0
|
||||
1772
phoenix/go.sum
Normal file
1772
phoenix/go.sum
Normal file
File diff suppressed because it is too large
Load Diff
61
phoenix/pkg/assets/assets.go
Normal file
61
phoenix/pkg/assets/assets.go
Normal file
@@ -0,0 +1,61 @@
|
||||
package assets
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"github.com/owncloud/ocis-phoenix/pkg/config"
|
||||
"github.com/owncloud/ocis-pkg/v2/log"
|
||||
)
|
||||
|
||||
//go:generate go run github.com/UnnoTed/fileb0x embed.yml
|
||||
|
||||
// assets gets initialized by New and provides the handler.
|
||||
type assets struct {
|
||||
logger log.Logger
|
||||
config *config.Config
|
||||
}
|
||||
|
||||
// Open just implements the HTTP filesystem interface.
|
||||
func (a assets) Open(original string) (http.File, error) {
|
||||
if a.config.Asset.Path != "" {
|
||||
if stat, err := os.Stat(a.config.Asset.Path); err == nil && stat.IsDir() {
|
||||
custom := path.Join(
|
||||
a.config.Asset.Path,
|
||||
original,
|
||||
)
|
||||
|
||||
if _, err := os.Stat(custom); !os.IsNotExist(err) {
|
||||
f, err := os.Open(custom)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return f, nil
|
||||
}
|
||||
} else {
|
||||
a.logger.Fatal().
|
||||
Str("path", a.config.Asset.Path).
|
||||
Msg("assets directory doesn't exist")
|
||||
}
|
||||
}
|
||||
|
||||
return FS.OpenFile(
|
||||
CTX,
|
||||
original,
|
||||
os.O_RDONLY,
|
||||
0644,
|
||||
)
|
||||
}
|
||||
|
||||
// New returns a new http filesystem to serve assets.
|
||||
func New(opts ...Option) http.FileSystem {
|
||||
options := newOptions(opts...)
|
||||
|
||||
return assets{
|
||||
logger: options.Logger,
|
||||
config: options.Config,
|
||||
}
|
||||
}
|
||||
9
phoenix/pkg/assets/dummy.go
Normal file
9
phoenix/pkg/assets/dummy.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package assets
|
||||
|
||||
import (
|
||||
// Fake the import to make the dep tree happy.
|
||||
_ "golang.org/x/net/context"
|
||||
|
||||
// Fake the import to make the dep tree happy.
|
||||
_ "golang.org/x/net/webdav"
|
||||
)
|
||||
1171
phoenix/pkg/assets/embed.go
Normal file
1171
phoenix/pkg/assets/embed.go
Normal file
File diff suppressed because one or more lines are too long
23
phoenix/pkg/assets/embed.yml
Normal file
23
phoenix/pkg/assets/embed.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
pkg: "assets"
|
||||
dest: "."
|
||||
output: "embed.go"
|
||||
fmt: true
|
||||
noprefix: true
|
||||
|
||||
compression:
|
||||
compress: true
|
||||
|
||||
custom:
|
||||
- files:
|
||||
- "../../assets/"
|
||||
base: "../../assets/"
|
||||
prefix: ""
|
||||
exclude:
|
||||
- "appinfo/**"
|
||||
- "LICENSE/**"
|
||||
- "CHANGELOG.md"
|
||||
- "README.md"
|
||||
- "config.json"
|
||||
|
||||
...
|
||||
40
phoenix/pkg/assets/option.go
Normal file
40
phoenix/pkg/assets/option.go
Normal file
@@ -0,0 +1,40 @@
|
||||
package assets
|
||||
|
||||
import (
|
||||
"github.com/owncloud/ocis-phoenix/pkg/config"
|
||||
"github.com/owncloud/ocis-pkg/v2/log"
|
||||
)
|
||||
|
||||
// Option defines a single option function.
|
||||
type Option func(o *Options)
|
||||
|
||||
// Options defines the available options for this package.
|
||||
type Options struct {
|
||||
Logger log.Logger
|
||||
Config *config.Config
|
||||
}
|
||||
|
||||
// newOptions initializes the available default options.
|
||||
func newOptions(opts ...Option) Options {
|
||||
opt := Options{}
|
||||
|
||||
for _, o := range opts {
|
||||
o(&opt)
|
||||
}
|
||||
|
||||
return opt
|
||||
}
|
||||
|
||||
// Logger provides a function to set the logger option.
|
||||
func Logger(val log.Logger) Option {
|
||||
return func(o *Options) {
|
||||
o.Logger = val
|
||||
}
|
||||
}
|
||||
|
||||
// Config provides a function to set the config option.
|
||||
func Config(val *config.Config) Option {
|
||||
return func(o *Options) {
|
||||
o.Config = val
|
||||
}
|
||||
}
|
||||
49
phoenix/pkg/command/health.go
Normal file
49
phoenix/pkg/command/health.go
Normal file
@@ -0,0 +1,49 @@
|
||||
package command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/micro/cli/v2"
|
||||
"github.com/owncloud/ocis-phoenix/pkg/config"
|
||||
"github.com/owncloud/ocis-phoenix/pkg/flagset"
|
||||
)
|
||||
|
||||
// Health is the entrypoint for the health command.
|
||||
func Health(cfg *config.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "health",
|
||||
Usage: "Check health status",
|
||||
Flags: flagset.HealthWithConfig(cfg),
|
||||
Action: func(c *cli.Context) error {
|
||||
logger := NewLogger(cfg)
|
||||
|
||||
resp, err := http.Get(
|
||||
fmt.Sprintf(
|
||||
"http://%s/healthz",
|
||||
cfg.Debug.Addr,
|
||||
),
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
logger.Fatal().
|
||||
Err(err).
|
||||
Msg("Failed to request health check")
|
||||
}
|
||||
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != 200 {
|
||||
logger.Fatal().
|
||||
Int("code", resp.StatusCode).
|
||||
Msg("Health seems to be in bad state")
|
||||
}
|
||||
|
||||
logger.Debug().
|
||||
Int("code", resp.StatusCode).
|
||||
Msg("Health got a good state")
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
}
|
||||
108
phoenix/pkg/command/root.go
Normal file
108
phoenix/pkg/command/root.go
Normal file
@@ -0,0 +1,108 @@
|
||||
package command
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/micro/cli/v2"
|
||||
"github.com/owncloud/ocis-phoenix/pkg/config"
|
||||
"github.com/owncloud/ocis-phoenix/pkg/flagset"
|
||||
"github.com/owncloud/ocis-phoenix/pkg/version"
|
||||
"github.com/owncloud/ocis-pkg/v2/log"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
// Execute is the entry point for the ocis-phoenix command.
|
||||
func Execute() error {
|
||||
cfg := config.New()
|
||||
|
||||
app := &cli.App{
|
||||
Name: "ocis-phoenix",
|
||||
Version: version.String,
|
||||
Usage: "Serve Phoenix for oCIS",
|
||||
Compiled: version.Compiled(),
|
||||
|
||||
Authors: []*cli.Author{
|
||||
{
|
||||
Name: "ownCloud GmbH",
|
||||
Email: "support@owncloud.com",
|
||||
},
|
||||
},
|
||||
|
||||
Flags: flagset.RootWithConfig(cfg),
|
||||
|
||||
Before: func(c *cli.Context) error {
|
||||
return ParseConfig(c, cfg)
|
||||
},
|
||||
|
||||
Commands: []*cli.Command{
|
||||
Server(cfg),
|
||||
Health(cfg),
|
||||
},
|
||||
}
|
||||
|
||||
cli.HelpFlag = &cli.BoolFlag{
|
||||
Name: "help,h",
|
||||
Usage: "Show the help",
|
||||
}
|
||||
|
||||
cli.VersionFlag = &cli.BoolFlag{
|
||||
Name: "version,v",
|
||||
Usage: "Print the version",
|
||||
}
|
||||
|
||||
return app.Run(os.Args)
|
||||
}
|
||||
|
||||
// NewLogger initializes a service-specific logger instance.
|
||||
func NewLogger(cfg *config.Config) log.Logger {
|
||||
return log.NewLogger(
|
||||
log.Name("phoenix"),
|
||||
log.Level(cfg.Log.Level),
|
||||
log.Pretty(cfg.Log.Pretty),
|
||||
log.Color(cfg.Log.Color),
|
||||
)
|
||||
}
|
||||
|
||||
// ParseConfig loads proxy configuration from Viper known paths.
|
||||
func ParseConfig(c *cli.Context, cfg *config.Config) error {
|
||||
logger := NewLogger(cfg)
|
||||
|
||||
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
|
||||
viper.SetEnvPrefix("PHOENIX")
|
||||
viper.AutomaticEnv()
|
||||
|
||||
if c.IsSet("config-file") {
|
||||
viper.SetConfigFile(c.String("config-file"))
|
||||
} else {
|
||||
viper.SetConfigName("phoenix")
|
||||
|
||||
viper.AddConfigPath("/etc/ocis")
|
||||
viper.AddConfigPath("$HOME/.ocis")
|
||||
viper.AddConfigPath("./config")
|
||||
}
|
||||
|
||||
if err := viper.ReadInConfig(); err != nil {
|
||||
switch err.(type) {
|
||||
case viper.ConfigFileNotFoundError:
|
||||
logger.Info().
|
||||
Msg("Continue without config")
|
||||
case viper.UnsupportedConfigError:
|
||||
logger.Fatal().
|
||||
Err(err).
|
||||
Msg("Unsupported config type")
|
||||
default:
|
||||
logger.Fatal().
|
||||
Err(err).
|
||||
Msg("Failed to read config")
|
||||
}
|
||||
}
|
||||
|
||||
if err := viper.Unmarshal(&cfg); err != nil {
|
||||
logger.Fatal().
|
||||
Err(err).
|
||||
Msg("Failed to parse config")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
240
phoenix/pkg/command/server.go
Normal file
240
phoenix/pkg/command/server.go
Normal file
@@ -0,0 +1,240 @@
|
||||
package command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/signal"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"contrib.go.opencensus.io/exporter/jaeger"
|
||||
"contrib.go.opencensus.io/exporter/ocagent"
|
||||
"contrib.go.opencensus.io/exporter/zipkin"
|
||||
"github.com/micro/cli/v2"
|
||||
"github.com/oklog/run"
|
||||
openzipkin "github.com/openzipkin/zipkin-go"
|
||||
zipkinhttp "github.com/openzipkin/zipkin-go/reporter/http"
|
||||
"github.com/owncloud/ocis-phoenix/pkg/config"
|
||||
"github.com/owncloud/ocis-phoenix/pkg/flagset"
|
||||
"github.com/owncloud/ocis-phoenix/pkg/metrics"
|
||||
"github.com/owncloud/ocis-phoenix/pkg/server/debug"
|
||||
"github.com/owncloud/ocis-phoenix/pkg/server/http"
|
||||
"go.opencensus.io/stats/view"
|
||||
"go.opencensus.io/trace"
|
||||
)
|
||||
|
||||
// Server is the entrypoint for the server command.
|
||||
func Server(cfg *config.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "server",
|
||||
Usage: "Start integrated server",
|
||||
Flags: flagset.ServerWithConfig(cfg),
|
||||
Before: func(c *cli.Context) error {
|
||||
if cfg.HTTP.Root != "/" {
|
||||
cfg.HTTP.Root = strings.TrimSuffix(cfg.HTTP.Root, "/")
|
||||
}
|
||||
|
||||
cfg.Phoenix.Config.Apps = c.StringSlice("web-config-app")
|
||||
|
||||
return ParseConfig(c, cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logger := NewLogger(cfg)
|
||||
|
||||
if cfg.Tracing.Enabled {
|
||||
switch t := cfg.Tracing.Type; t {
|
||||
case "agent":
|
||||
exporter, err := ocagent.NewExporter(
|
||||
ocagent.WithReconnectionPeriod(5*time.Second),
|
||||
ocagent.WithAddress(cfg.Tracing.Endpoint),
|
||||
ocagent.WithServiceName(cfg.Tracing.Service),
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
logger.Error().
|
||||
Err(err).
|
||||
Str("endpoint", cfg.Tracing.Endpoint).
|
||||
Str("collector", cfg.Tracing.Collector).
|
||||
Msg("Failed to create agent tracing")
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
trace.RegisterExporter(exporter)
|
||||
view.RegisterExporter(exporter)
|
||||
|
||||
case "jaeger":
|
||||
exporter, err := jaeger.NewExporter(
|
||||
jaeger.Options{
|
||||
AgentEndpoint: cfg.Tracing.Endpoint,
|
||||
CollectorEndpoint: cfg.Tracing.Collector,
|
||||
ServiceName: cfg.Tracing.Service,
|
||||
},
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
logger.Error().
|
||||
Err(err).
|
||||
Str("endpoint", cfg.Tracing.Endpoint).
|
||||
Str("collector", cfg.Tracing.Collector).
|
||||
Msg("Failed to create jaeger tracing")
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
trace.RegisterExporter(exporter)
|
||||
|
||||
case "zipkin":
|
||||
endpoint, err := openzipkin.NewEndpoint(
|
||||
cfg.Tracing.Service,
|
||||
cfg.Tracing.Endpoint,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
logger.Error().
|
||||
Err(err).
|
||||
Str("endpoint", cfg.Tracing.Endpoint).
|
||||
Str("collector", cfg.Tracing.Collector).
|
||||
Msg("Failed to create zipkin tracing")
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
exporter := zipkin.NewExporter(
|
||||
zipkinhttp.NewReporter(
|
||||
cfg.Tracing.Collector,
|
||||
),
|
||||
endpoint,
|
||||
)
|
||||
|
||||
trace.RegisterExporter(exporter)
|
||||
|
||||
default:
|
||||
logger.Warn().
|
||||
Str("type", t).
|
||||
Msg("Unknown tracing backend")
|
||||
}
|
||||
|
||||
trace.ApplyConfig(
|
||||
trace.Config{
|
||||
DefaultSampler: trace.AlwaysSample(),
|
||||
},
|
||||
)
|
||||
} else {
|
||||
logger.Debug().
|
||||
Msg("Tracing is not enabled")
|
||||
}
|
||||
|
||||
// actually read the contents of the config file and override defaults
|
||||
if cfg.File != "" {
|
||||
contents, err := ioutil.ReadFile(cfg.File)
|
||||
if err != nil {
|
||||
logger.Err(err).Msg("error opening config file")
|
||||
return err
|
||||
}
|
||||
json.Unmarshal(contents, &cfg.Phoenix.Config)
|
||||
}
|
||||
|
||||
var (
|
||||
gr = run.Group{}
|
||||
ctx, cancel = context.WithCancel(context.Background())
|
||||
metrics = metrics.New()
|
||||
)
|
||||
|
||||
defer cancel()
|
||||
|
||||
{
|
||||
server, err := http.Server(
|
||||
http.Logger(logger),
|
||||
http.Context(ctx),
|
||||
http.Namespace(cfg.HTTP.Namespace),
|
||||
http.Config(cfg),
|
||||
http.Metrics(metrics),
|
||||
http.Flags(flagset.RootWithConfig(config.New())),
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
logger.Info().
|
||||
Err(err).
|
||||
Str("transport", "http").
|
||||
Msg("Failed to initialize server")
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
gr.Add(func() error {
|
||||
err := server.Run()
|
||||
if err != nil {
|
||||
logger.Error().
|
||||
Err(err).
|
||||
Str("transport", "http").
|
||||
Msg("Failed to start server")
|
||||
}
|
||||
return err
|
||||
}, func(_ error) {
|
||||
logger.Info().
|
||||
Str("transport", "http").
|
||||
Msg("Shutting down server")
|
||||
|
||||
cancel()
|
||||
})
|
||||
}
|
||||
|
||||
{
|
||||
server, err := debug.Server(
|
||||
debug.Logger(logger),
|
||||
debug.Context(ctx),
|
||||
debug.Config(cfg),
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
logger.Info().
|
||||
Err(err).
|
||||
Str("transport", "debug").
|
||||
Msg("Failed to initialize server")
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
gr.Add(func() error {
|
||||
return server.ListenAndServe()
|
||||
}, func(_ error) {
|
||||
ctx, timeout := context.WithTimeout(ctx, 5*time.Second)
|
||||
|
||||
defer timeout()
|
||||
defer cancel()
|
||||
|
||||
if err := server.Shutdown(ctx); err != nil {
|
||||
logger.Info().
|
||||
Err(err).
|
||||
Str("transport", "debug").
|
||||
Msg("Failed to shutdown server")
|
||||
} else {
|
||||
logger.Info().
|
||||
Str("transport", "debug").
|
||||
Msg("Shutting down server")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
{
|
||||
stop := make(chan os.Signal, 1)
|
||||
|
||||
gr.Add(func() error {
|
||||
signal.Notify(stop, os.Interrupt)
|
||||
|
||||
<-stop
|
||||
|
||||
return nil
|
||||
}, func(err error) {
|
||||
close(stop)
|
||||
cancel()
|
||||
})
|
||||
}
|
||||
|
||||
return gr.Run()
|
||||
},
|
||||
}
|
||||
}
|
||||
100
phoenix/pkg/config/config.go
Normal file
100
phoenix/pkg/config/config.go
Normal file
@@ -0,0 +1,100 @@
|
||||
package config
|
||||
|
||||
// Log defines the available logging configuration.
|
||||
type Log struct {
|
||||
Level string
|
||||
Pretty bool
|
||||
Color bool
|
||||
}
|
||||
|
||||
// Debug defines the available debug configuration.
|
||||
type Debug struct {
|
||||
Addr string
|
||||
Token string
|
||||
Pprof bool
|
||||
Zpages bool
|
||||
}
|
||||
|
||||
// HTTP defines the available http configuration.
|
||||
type HTTP struct {
|
||||
Addr string
|
||||
Root string
|
||||
Namespace string
|
||||
}
|
||||
|
||||
// Tracing defines the available tracing configuration.
|
||||
type Tracing struct {
|
||||
Enabled bool
|
||||
Type string
|
||||
Endpoint string
|
||||
Collector string
|
||||
Service string
|
||||
}
|
||||
|
||||
// Asset defines the available asset configuration.
|
||||
type Asset struct {
|
||||
Path string
|
||||
}
|
||||
|
||||
// PhoenixConfig defines the available phoenix configuration for a dynamically rendered config.json.
|
||||
type PhoenixConfig struct {
|
||||
Server string `json:"server,omitempty"`
|
||||
Theme string `json:"theme,omitempty"`
|
||||
Version string `json:"version,omitempty"` // TODO what is version used for?
|
||||
OpenIDConnect OIDC `json:"openIdConnect,omitempty"`
|
||||
Apps []string `json:"apps"` // TODO add nilasempty when https://go-review.googlesource.com/c/go/+/205897/ is released
|
||||
ExternalApps []ExternalApp `json:"external_apps,omitempty"`
|
||||
Options map[string]interface{} `json:"options,omitempty"`
|
||||
}
|
||||
|
||||
// OIDC defines the available oidc configuration
|
||||
type OIDC struct {
|
||||
MetadataURL string `json:"metadata_url,omitempty"`
|
||||
Authority string `json:"authority,omitempty"`
|
||||
ClientID string `json:"client_id,omitempty"`
|
||||
ResponseType string `json:"response_type,omitempty"`
|
||||
Scope string `json:"scope,omitempty"`
|
||||
}
|
||||
|
||||
// ExternalApp defines an external phoenix app.
|
||||
// {
|
||||
// "name": "hello",
|
||||
// "path": "http://localhost:9105/hello.js",
|
||||
// "config": {
|
||||
// "url": "http://localhost:9105"
|
||||
// }
|
||||
// }
|
||||
type ExternalApp struct {
|
||||
ID string `json:"id,omitempty"`
|
||||
Path string `json:"path,omitempty"`
|
||||
// Config is completely dynamic, because it depends on the extension
|
||||
Config map[string]interface{} `json:"config,omitempty"`
|
||||
}
|
||||
|
||||
// ExternalAppConfig defines an external phoenix app configuration.
|
||||
type ExternalAppConfig struct {
|
||||
URL string `json:"url,omitempty"`
|
||||
}
|
||||
|
||||
// Phoenix defines the available phoenix configuration.
|
||||
type Phoenix struct {
|
||||
Path string
|
||||
Config PhoenixConfig
|
||||
}
|
||||
|
||||
// Config combines all available configuration parts.
|
||||
type Config struct {
|
||||
File string
|
||||
Log Log
|
||||
Debug Debug
|
||||
HTTP HTTP
|
||||
Tracing Tracing
|
||||
Asset Asset
|
||||
OIDC OIDC
|
||||
Phoenix Phoenix
|
||||
}
|
||||
|
||||
// New initializes a new configuration with or without defaults.
|
||||
func New() *Config {
|
||||
return &Config{}
|
||||
}
|
||||
216
phoenix/pkg/flagset/flagset.go
Normal file
216
phoenix/pkg/flagset/flagset.go
Normal file
@@ -0,0 +1,216 @@
|
||||
package flagset
|
||||
|
||||
import (
|
||||
"github.com/micro/cli/v2"
|
||||
"github.com/owncloud/ocis-phoenix/pkg/config"
|
||||
)
|
||||
|
||||
// RootWithConfig applies cfg to the root flagset
|
||||
func RootWithConfig(cfg *config.Config) []cli.Flag {
|
||||
return []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "config-file",
|
||||
Value: "",
|
||||
Usage: "Path to config file",
|
||||
EnvVars: []string{"PHOENIX_CONFIG_FILE"},
|
||||
Destination: &cfg.File,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "log-level",
|
||||
Value: "info",
|
||||
Usage: "Set logging level",
|
||||
EnvVars: []string{"PHOENIX_LOG_LEVEL"},
|
||||
Destination: &cfg.Log.Level,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "log-pretty",
|
||||
Value: true,
|
||||
Usage: "Enable pretty logging",
|
||||
EnvVars: []string{"PHOENIX_LOG_PRETTY"},
|
||||
Destination: &cfg.Log.Pretty,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "log-color",
|
||||
Value: true,
|
||||
Usage: "Enable colored logging",
|
||||
EnvVars: []string{"PHOENIX_LOG_COLOR"},
|
||||
Destination: &cfg.Log.Color,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// HealthWithConfig applies cfg to the root flagset
|
||||
func HealthWithConfig(cfg *config.Config) []cli.Flag {
|
||||
return []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "debug-addr",
|
||||
Value: "0.0.0.0:9104",
|
||||
Usage: "Address to debug endpoint",
|
||||
EnvVars: []string{"PHOENIX_DEBUG_ADDR"},
|
||||
Destination: &cfg.Debug.Addr,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// ServerWithConfig applies cfg to the root flagset
|
||||
func ServerWithConfig(cfg *config.Config) []cli.Flag {
|
||||
return []cli.Flag{
|
||||
&cli.BoolFlag{
|
||||
Name: "tracing-enabled",
|
||||
Usage: "Enable sending traces",
|
||||
EnvVars: []string{"PHOENIX_TRACING_ENABLED"},
|
||||
Destination: &cfg.Tracing.Enabled,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tracing-type",
|
||||
Value: "jaeger",
|
||||
Usage: "Tracing backend type",
|
||||
EnvVars: []string{"PHOENIX_TRACING_TYPE"},
|
||||
Destination: &cfg.Tracing.Type,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tracing-endpoint",
|
||||
Value: "",
|
||||
Usage: "Endpoint for the agent",
|
||||
EnvVars: []string{"PHOENIX_TRACING_ENDPOINT"},
|
||||
Destination: &cfg.Tracing.Endpoint,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tracing-collector",
|
||||
Value: "",
|
||||
Usage: "Endpoint for the collector",
|
||||
EnvVars: []string{"PHOENIX_TRACING_COLLECTOR"},
|
||||
Destination: &cfg.Tracing.Collector,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tracing-service",
|
||||
Value: "phoenix",
|
||||
Usage: "Service name for tracing",
|
||||
EnvVars: []string{"PHOENIX_TRACING_SERVICE"},
|
||||
Destination: &cfg.Tracing.Service,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "debug-addr",
|
||||
Value: "0.0.0.0:9104",
|
||||
Usage: "Address to bind debug server",
|
||||
EnvVars: []string{"PHOENIX_DEBUG_ADDR"},
|
||||
Destination: &cfg.Debug.Addr,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "debug-token",
|
||||
Value: "",
|
||||
Usage: "Token to grant metrics access",
|
||||
EnvVars: []string{"PHOENIX_DEBUG_TOKEN"},
|
||||
Destination: &cfg.Debug.Token,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "debug-pprof",
|
||||
Usage: "Enable pprof debugging",
|
||||
EnvVars: []string{"PHOENIX_DEBUG_PPROF"},
|
||||
Destination: &cfg.Debug.Pprof,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "debug-zpages",
|
||||
Usage: "Enable zpages debugging",
|
||||
EnvVars: []string{"PHOENIX_DEBUG_ZPAGES"},
|
||||
Destination: &cfg.Debug.Zpages,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "http-addr",
|
||||
Value: "0.0.0.0:9100",
|
||||
Usage: "Address to bind http server",
|
||||
EnvVars: []string{"PHOENIX_HTTP_ADDR"},
|
||||
Destination: &cfg.HTTP.Addr,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "http-root",
|
||||
Value: "/",
|
||||
Usage: "Root path of http server",
|
||||
EnvVars: []string{"PHOENIX_HTTP_ROOT"},
|
||||
Destination: &cfg.HTTP.Root,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "http-namespace",
|
||||
Value: "com.owncloud.web",
|
||||
Usage: "Set the base namespace for the http namespace",
|
||||
EnvVars: []string{"PHOENIX_NAMESPACE"},
|
||||
Destination: &cfg.HTTP.Namespace,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "asset-path",
|
||||
Value: "",
|
||||
Usage: "Path to custom assets",
|
||||
EnvVars: []string{"PHOENIX_ASSET_PATH"},
|
||||
Destination: &cfg.Asset.Path,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "web-config",
|
||||
Value: "",
|
||||
Usage: "Path to phoenix config",
|
||||
EnvVars: []string{"PHOENIX_WEB_CONFIG"},
|
||||
Destination: &cfg.Phoenix.Path,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "web-config-server",
|
||||
Value: "https://localhost:9200",
|
||||
Usage: "Server URL",
|
||||
EnvVars: []string{"PHOENIX_WEB_CONFIG_SERVER"},
|
||||
Destination: &cfg.Phoenix.Config.Server,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "web-config-theme",
|
||||
Value: "owncloud",
|
||||
Usage: "Theme",
|
||||
EnvVars: []string{"PHOENIX_WEB_CONFIG_THEME"},
|
||||
Destination: &cfg.Phoenix.Config.Theme,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "web-config-version",
|
||||
Value: "0.1.0",
|
||||
Usage: "Version",
|
||||
EnvVars: []string{"PHOENIX_WEB_CONFIG_VERSION"},
|
||||
Destination: &cfg.Phoenix.Config.Version,
|
||||
},
|
||||
&cli.StringSliceFlag{
|
||||
Name: "web-config-app",
|
||||
Value: cli.NewStringSlice("files", "draw-io", "markdown-editor", "media-viewer"),
|
||||
Usage: `--web-config-app files [--web-config-app draw-io]`,
|
||||
EnvVars: []string{"PHOENIX_WEB_CONFIG_APPS"},
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "oidc-metadata-url",
|
||||
Value: "https://localhost:9200/.well-known/openid-configuration",
|
||||
Usage: "OpenID Connect metadata URL",
|
||||
EnvVars: []string{"PHOENIX_OIDC_METADATA_URL"},
|
||||
Destination: &cfg.Phoenix.Config.OpenIDConnect.MetadataURL,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "oidc-authority",
|
||||
Value: "https://localhost:9200",
|
||||
Usage: "OpenID Connect authority", // TODO rename to Issuer
|
||||
EnvVars: []string{"PHOENIX_OIDC_AUTHORITY"},
|
||||
Destination: &cfg.Phoenix.Config.OpenIDConnect.Authority,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "oidc-client-id",
|
||||
Value: "phoenix",
|
||||
Usage: "OpenID Connect client ID",
|
||||
EnvVars: []string{"PHOENIX_OIDC_CLIENT_ID"},
|
||||
Destination: &cfg.Phoenix.Config.OpenIDConnect.ClientID,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "oidc-response-type",
|
||||
Value: "code",
|
||||
Usage: "OpenID Connect response type",
|
||||
EnvVars: []string{"PHOENIX_OIDC_RESPONSE_TYPE"},
|
||||
Destination: &cfg.Phoenix.Config.OpenIDConnect.ResponseType,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "oidc-scope",
|
||||
Value: "openid profile email",
|
||||
Usage: "OpenID Connect scope",
|
||||
EnvVars: []string{"PHOENIX_OIDC_SCOPE"},
|
||||
Destination: &cfg.Phoenix.Config.OpenIDConnect.Scope,
|
||||
},
|
||||
}
|
||||
}
|
||||
32
phoenix/pkg/metrics/metrics.go
Normal file
32
phoenix/pkg/metrics/metrics.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package metrics
|
||||
|
||||
var (
|
||||
// Namespace defines the namespace for the defines metrics.
|
||||
Namespace = "ocis"
|
||||
|
||||
// Subsystem defines the subsystem for the defines metrics.
|
||||
Subsystem = "phoenix"
|
||||
)
|
||||
|
||||
// Metrics defines the available metrics of this service.
|
||||
type Metrics struct {
|
||||
// Counter *prometheus.CounterVec
|
||||
}
|
||||
|
||||
// New initializes the available metrics.
|
||||
func New() *Metrics {
|
||||
m := &Metrics{
|
||||
// Counter: prometheus.NewCounterVec(prometheus.CounterOpts{
|
||||
// Namespace: Namespace,
|
||||
// Subsystem: Subsystem,
|
||||
// Name: "greet_total",
|
||||
// Help: "How many greeting requests processed",
|
||||
// }, []string{}),
|
||||
}
|
||||
|
||||
// prometheus.Register(
|
||||
// m.Counter,
|
||||
// )
|
||||
|
||||
return m
|
||||
}
|
||||
13
phoenix/pkg/middleware/silentrefresh.go
Normal file
13
phoenix/pkg/middleware/silentrefresh.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// SilentRefresh allows the oidc client lib to silently refresh the token in an iframe
|
||||
func SilentRefresh(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("X-Frame-Options", "SAMEORIGIN")
|
||||
next.ServeHTTP(w, r)
|
||||
})
|
||||
}
|
||||
50
phoenix/pkg/server/debug/option.go
Normal file
50
phoenix/pkg/server/debug/option.go
Normal file
@@ -0,0 +1,50 @@
|
||||
package debug
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/owncloud/ocis-phoenix/pkg/config"
|
||||
"github.com/owncloud/ocis-pkg/v2/log"
|
||||
)
|
||||
|
||||
// Option defines a single option function.
|
||||
type Option func(o *Options)
|
||||
|
||||
// Options defines the available options for this package.
|
||||
type Options struct {
|
||||
Logger log.Logger
|
||||
Context context.Context
|
||||
Config *config.Config
|
||||
}
|
||||
|
||||
// newOptions initializes the available default options.
|
||||
func newOptions(opts ...Option) Options {
|
||||
opt := Options{}
|
||||
|
||||
for _, o := range opts {
|
||||
o(&opt)
|
||||
}
|
||||
|
||||
return opt
|
||||
}
|
||||
|
||||
// Logger provides a function to set the logger option.
|
||||
func Logger(val log.Logger) Option {
|
||||
return func(o *Options) {
|
||||
o.Logger = val
|
||||
}
|
||||
}
|
||||
|
||||
// Context provides a function to set the context option.
|
||||
func Context(val context.Context) Option {
|
||||
return func(o *Options) {
|
||||
o.Context = val
|
||||
}
|
||||
}
|
||||
|
||||
// Config provides a function to set the config option.
|
||||
func Config(val *config.Config) Option {
|
||||
return func(o *Options) {
|
||||
o.Config = val
|
||||
}
|
||||
}
|
||||
51
phoenix/pkg/server/debug/server.go
Normal file
51
phoenix/pkg/server/debug/server.go
Normal file
@@ -0,0 +1,51 @@
|
||||
package debug
|
||||
|
||||
import (
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/owncloud/ocis-phoenix/pkg/config"
|
||||
"github.com/owncloud/ocis-phoenix/pkg/version"
|
||||
"github.com/owncloud/ocis-pkg/v2/service/debug"
|
||||
)
|
||||
|
||||
// Server initializes the debug service and server.
|
||||
func Server(opts ...Option) (*http.Server, error) {
|
||||
options := newOptions(opts...)
|
||||
|
||||
return debug.NewService(
|
||||
debug.Logger(options.Logger),
|
||||
debug.Name("phoenix"),
|
||||
debug.Version(version.String),
|
||||
debug.Address(options.Config.Debug.Addr),
|
||||
debug.Token(options.Config.Debug.Token),
|
||||
debug.Pprof(options.Config.Debug.Pprof),
|
||||
debug.Zpages(options.Config.Debug.Zpages),
|
||||
debug.Health(health(options.Config)),
|
||||
debug.Ready(ready(options.Config)),
|
||||
), nil
|
||||
}
|
||||
|
||||
// health implements the health check.
|
||||
func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "text/plain")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
|
||||
// TODO(tboerger): check if services are up and running
|
||||
|
||||
io.WriteString(w, http.StatusText(http.StatusOK))
|
||||
}
|
||||
}
|
||||
|
||||
// ready implements the ready check.
|
||||
func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "text/plain")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
|
||||
// TODO(tboerger): check if services are up and running
|
||||
|
||||
io.WriteString(w, http.StatusText(http.StatusOK))
|
||||
}
|
||||
}
|
||||
76
phoenix/pkg/server/http/option.go
Normal file
76
phoenix/pkg/server/http/option.go
Normal file
@@ -0,0 +1,76 @@
|
||||
package http
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/micro/cli/v2"
|
||||
"github.com/owncloud/ocis-phoenix/pkg/config"
|
||||
"github.com/owncloud/ocis-phoenix/pkg/metrics"
|
||||
"github.com/owncloud/ocis-pkg/v2/log"
|
||||
)
|
||||
|
||||
// Option defines a single option function.
|
||||
type Option func(o *Options)
|
||||
|
||||
// Options defines the available options for this package.
|
||||
type Options struct {
|
||||
Logger log.Logger
|
||||
Context context.Context
|
||||
Config *config.Config
|
||||
Metrics *metrics.Metrics
|
||||
Flags []cli.Flag
|
||||
Namespace string
|
||||
}
|
||||
|
||||
// newOptions initializes the available default options.
|
||||
func newOptions(opts ...Option) Options {
|
||||
opt := Options{}
|
||||
|
||||
for _, o := range opts {
|
||||
o(&opt)
|
||||
}
|
||||
|
||||
return opt
|
||||
}
|
||||
|
||||
// Logger provides a function to set the logger option.
|
||||
func Logger(val log.Logger) Option {
|
||||
return func(o *Options) {
|
||||
o.Logger = val
|
||||
}
|
||||
}
|
||||
|
||||
// Context provides a function to set the context option.
|
||||
func Context(val context.Context) Option {
|
||||
return func(o *Options) {
|
||||
o.Context = val
|
||||
}
|
||||
}
|
||||
|
||||
// Config provides a function to set the config option.
|
||||
func Config(val *config.Config) Option {
|
||||
return func(o *Options) {
|
||||
o.Config = val
|
||||
}
|
||||
}
|
||||
|
||||
// Metrics provides a function to set the metrics option.
|
||||
func Metrics(val *metrics.Metrics) Option {
|
||||
return func(o *Options) {
|
||||
o.Metrics = val
|
||||
}
|
||||
}
|
||||
|
||||
// Flags provides a function to set the flags option.
|
||||
func Flags(val []cli.Flag) Option {
|
||||
return func(o *Options) {
|
||||
o.Flags = append(o.Flags, val...)
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace provides a function to set the Namespace option.
|
||||
func Namespace(val string) Option {
|
||||
return func(o *Options) {
|
||||
o.Namespace = val
|
||||
}
|
||||
}
|
||||
58
phoenix/pkg/server/http/server.go
Normal file
58
phoenix/pkg/server/http/server.go
Normal file
@@ -0,0 +1,58 @@
|
||||
package http
|
||||
|
||||
import (
|
||||
phoenixmid "github.com/owncloud/ocis-phoenix/pkg/middleware"
|
||||
svc "github.com/owncloud/ocis-phoenix/pkg/service/v0"
|
||||
"github.com/owncloud/ocis-phoenix/pkg/version"
|
||||
"github.com/owncloud/ocis-pkg/v2/middleware"
|
||||
"github.com/owncloud/ocis-pkg/v2/service/http"
|
||||
)
|
||||
|
||||
// Server initializes the http service and server.
|
||||
func Server(opts ...Option) (http.Service, error) {
|
||||
options := newOptions(opts...)
|
||||
|
||||
service := http.NewService(
|
||||
http.Logger(options.Logger),
|
||||
http.Namespace(options.Namespace),
|
||||
http.Name("phoenix"),
|
||||
http.Version(version.String),
|
||||
http.Address(options.Config.HTTP.Addr),
|
||||
http.Context(options.Context),
|
||||
http.Flags(options.Flags...),
|
||||
)
|
||||
|
||||
handle := svc.NewService(
|
||||
svc.Logger(options.Logger),
|
||||
svc.Config(options.Config),
|
||||
svc.Middleware(
|
||||
middleware.RealIP,
|
||||
middleware.RequestID,
|
||||
middleware.Cache,
|
||||
middleware.Cors,
|
||||
middleware.Secure,
|
||||
phoenixmid.SilentRefresh,
|
||||
middleware.Version(
|
||||
"phoenix",
|
||||
version.String,
|
||||
),
|
||||
middleware.Logger(
|
||||
options.Logger,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
{
|
||||
handle = svc.NewInstrument(handle, options.Metrics)
|
||||
handle = svc.NewLogging(handle, options.Logger)
|
||||
handle = svc.NewTracing(handle)
|
||||
}
|
||||
|
||||
service.Handle(
|
||||
"/",
|
||||
handle,
|
||||
)
|
||||
|
||||
service.Init()
|
||||
return service, nil
|
||||
}
|
||||
30
phoenix/pkg/service/v0/instrument.go
Normal file
30
phoenix/pkg/service/v0/instrument.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package svc
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/owncloud/ocis-phoenix/pkg/metrics"
|
||||
)
|
||||
|
||||
// NewInstrument returns a service that instruments metrics.
|
||||
func NewInstrument(next Service, metrics *metrics.Metrics) Service {
|
||||
return instrument{
|
||||
next: next,
|
||||
metrics: metrics,
|
||||
}
|
||||
}
|
||||
|
||||
type instrument struct {
|
||||
next Service
|
||||
metrics *metrics.Metrics
|
||||
}
|
||||
|
||||
// ServeHTTP implements the Service interface.
|
||||
func (i instrument) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
i.next.ServeHTTP(w, r)
|
||||
}
|
||||
|
||||
// Config implements the Service interface.
|
||||
func (i instrument) Config(w http.ResponseWriter, r *http.Request) {
|
||||
i.next.Config(w, r)
|
||||
}
|
||||
30
phoenix/pkg/service/v0/logging.go
Normal file
30
phoenix/pkg/service/v0/logging.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package svc
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/owncloud/ocis-pkg/v2/log"
|
||||
)
|
||||
|
||||
// NewLogging returns a service that logs messages.
|
||||
func NewLogging(next Service, logger log.Logger) Service {
|
||||
return logging{
|
||||
next: next,
|
||||
logger: logger,
|
||||
}
|
||||
}
|
||||
|
||||
type logging struct {
|
||||
next Service
|
||||
logger log.Logger
|
||||
}
|
||||
|
||||
// ServeHTTP implements the Service interface.
|
||||
func (l logging) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
l.next.ServeHTTP(w, r)
|
||||
}
|
||||
|
||||
// Config implements the Service interface.
|
||||
func (l logging) Config(w http.ResponseWriter, r *http.Request) {
|
||||
l.next.Config(w, r)
|
||||
}
|
||||
50
phoenix/pkg/service/v0/option.go
Normal file
50
phoenix/pkg/service/v0/option.go
Normal file
@@ -0,0 +1,50 @@
|
||||
package svc
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/owncloud/ocis-phoenix/pkg/config"
|
||||
"github.com/owncloud/ocis-pkg/v2/log"
|
||||
)
|
||||
|
||||
// Option defines a single option function.
|
||||
type Option func(o *Options)
|
||||
|
||||
// Options defines the available options for this package.
|
||||
type Options struct {
|
||||
Logger log.Logger
|
||||
Config *config.Config
|
||||
Middleware []func(http.Handler) http.Handler
|
||||
}
|
||||
|
||||
// newOptions initializes the available default options.
|
||||
func newOptions(opts ...Option) Options {
|
||||
opt := Options{}
|
||||
|
||||
for _, o := range opts {
|
||||
o(&opt)
|
||||
}
|
||||
|
||||
return opt
|
||||
}
|
||||
|
||||
// Logger provides a function to set the logger option.
|
||||
func Logger(val log.Logger) Option {
|
||||
return func(o *Options) {
|
||||
o.Logger = val
|
||||
}
|
||||
}
|
||||
|
||||
// Config provides a function to set the config option.
|
||||
func Config(val *config.Config) Option {
|
||||
return func(o *Options) {
|
||||
o.Config = val
|
||||
}
|
||||
}
|
||||
|
||||
// Middleware provides a function to set the middleware option.
|
||||
func Middleware(val ...func(http.Handler) http.Handler) Option {
|
||||
return func(o *Options) {
|
||||
o.Middleware = val
|
||||
}
|
||||
}
|
||||
167
phoenix/pkg/service/v0/service.go
Normal file
167
phoenix/pkg/service/v0/service.go
Normal file
@@ -0,0 +1,167 @@
|
||||
package svc
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/go-chi/chi"
|
||||
"github.com/owncloud/ocis-phoenix/pkg/assets"
|
||||
"github.com/owncloud/ocis-phoenix/pkg/config"
|
||||
"github.com/owncloud/ocis-pkg/v2/log"
|
||||
)
|
||||
|
||||
var (
|
||||
// ErrConfigInvalid is returned when the config parse is invalid.
|
||||
ErrConfigInvalid = `Invalid or missing config`
|
||||
)
|
||||
|
||||
// Service defines the extension handlers.
|
||||
type Service interface {
|
||||
ServeHTTP(http.ResponseWriter, *http.Request)
|
||||
Config(http.ResponseWriter, *http.Request)
|
||||
}
|
||||
|
||||
// NewService returns a service implementation for Service.
|
||||
func NewService(opts ...Option) Service {
|
||||
options := newOptions(opts...)
|
||||
|
||||
m := chi.NewMux()
|
||||
m.Use(options.Middleware...)
|
||||
|
||||
svc := Phoenix{
|
||||
logger: options.Logger,
|
||||
config: options.Config,
|
||||
mux: m,
|
||||
}
|
||||
|
||||
m.Route(options.Config.HTTP.Root, func(r chi.Router) {
|
||||
r.Get("/config.json", svc.Config)
|
||||
r.Mount("/", svc.Static())
|
||||
})
|
||||
|
||||
return svc
|
||||
}
|
||||
|
||||
// Phoenix defines implements the business logic for Service.
|
||||
type Phoenix struct {
|
||||
logger log.Logger
|
||||
config *config.Config
|
||||
mux *chi.Mux
|
||||
}
|
||||
|
||||
// ServeHTTP implements the Service interface.
|
||||
func (p Phoenix) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
p.mux.ServeHTTP(w, r)
|
||||
}
|
||||
|
||||
func (p Phoenix) getPayload() (payload []byte, err error) {
|
||||
|
||||
if p.config.Phoenix.Path == "" {
|
||||
// render dynamically using config
|
||||
|
||||
// provide default ocis-web options
|
||||
if p.config.Phoenix.Config.Options == nil {
|
||||
p.config.Phoenix.Config.Options = make(map[string]interface{})
|
||||
p.config.Phoenix.Config.Options["hideSearchBar"] = true
|
||||
}
|
||||
|
||||
if p.config.Phoenix.Config.ExternalApps == nil {
|
||||
p.config.Phoenix.Config.ExternalApps = []config.ExternalApp{
|
||||
{
|
||||
ID: "accounts",
|
||||
Path: "/accounts.js",
|
||||
},
|
||||
{
|
||||
ID: "settings",
|
||||
Path: "/settings.js",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// make apps render as empty array if it is empty
|
||||
// TODO remove once https://github.com/golang/go/issues/27589 is fixed
|
||||
if len(p.config.Phoenix.Config.Apps) == 0 {
|
||||
p.config.Phoenix.Config.Apps = make([]string, 0)
|
||||
}
|
||||
|
||||
return json.Marshal(p.config.Phoenix.Config)
|
||||
}
|
||||
|
||||
// try loading from file
|
||||
if _, err = os.Stat(p.config.Phoenix.Path); os.IsNotExist(err) {
|
||||
p.logger.Fatal().
|
||||
Err(err).
|
||||
Str("config", p.config.Phoenix.Path).
|
||||
Msg("phoenix config doesn't exist")
|
||||
}
|
||||
|
||||
payload, err = ioutil.ReadFile(p.config.Phoenix.Path)
|
||||
|
||||
if err != nil {
|
||||
p.logger.Fatal().
|
||||
Err(err).
|
||||
Str("config", p.config.Phoenix.Path).
|
||||
Msg("failed to read custom config")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Config implements the Service interface.
|
||||
func (p Phoenix) Config(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
payload, err := p.getPayload()
|
||||
if err != nil {
|
||||
http.Error(w, ErrConfigInvalid, http.StatusUnprocessableEntity)
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
w.Write(payload)
|
||||
}
|
||||
|
||||
// Static simply serves all static files.
|
||||
func (p Phoenix) Static() http.HandlerFunc {
|
||||
rootWithSlash := p.config.HTTP.Root
|
||||
|
||||
if !strings.HasSuffix(rootWithSlash, "/") {
|
||||
rootWithSlash = rootWithSlash + "/"
|
||||
}
|
||||
|
||||
static := http.StripPrefix(
|
||||
rootWithSlash,
|
||||
http.FileServer(
|
||||
assets.New(
|
||||
assets.Logger(p.logger),
|
||||
assets.Config(p.config),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if rootWithSlash != "/" && r.URL.Path == p.config.HTTP.Root {
|
||||
http.Redirect(
|
||||
w,
|
||||
r,
|
||||
rootWithSlash,
|
||||
http.StatusMovedPermanently,
|
||||
)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
if r.URL.Path != rootWithSlash && strings.HasSuffix(r.URL.Path, "/") {
|
||||
http.NotFound(
|
||||
w,
|
||||
r,
|
||||
)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
static.ServeHTTP(w, r)
|
||||
})
|
||||
}
|
||||
26
phoenix/pkg/service/v0/tracing.go
Normal file
26
phoenix/pkg/service/v0/tracing.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package svc
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// NewTracing returns a service that instruments traces.
|
||||
func NewTracing(next Service) Service {
|
||||
return tracing{
|
||||
next: next,
|
||||
}
|
||||
}
|
||||
|
||||
type tracing struct {
|
||||
next Service
|
||||
}
|
||||
|
||||
// ServeHTTP implements the Service interface.
|
||||
func (t tracing) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
t.next.ServeHTTP(w, r)
|
||||
}
|
||||
|
||||
// Config implements the Service interface.
|
||||
func (t tracing) Config(w http.ResponseWriter, r *http.Request) {
|
||||
t.next.Config(w, r)
|
||||
}
|
||||
19
phoenix/pkg/version/version.go
Normal file
19
phoenix/pkg/version/version.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
// String gets defined by the build system.
|
||||
String = "0.0.0"
|
||||
|
||||
// Date indicates the build date.
|
||||
Date = "00000000"
|
||||
)
|
||||
|
||||
// Compiled returns the compile time of this service.
|
||||
func Compiled() time.Time {
|
||||
t, _ := time.Parse("20060102", Date)
|
||||
return t
|
||||
}
|
||||
2
phoenix/reflex.conf
Normal file
2
phoenix/reflex.conf
Normal file
@@ -0,0 +1,2 @@
|
||||
# backend
|
||||
-r '^(cmd|pkg)/.*\.go$' -R '^node_modules/' -s -- sh -c 'make bin/ocis-phoenix-debug && bin/ocis-phoenix-debug --log-level debug server --debug-pprof --debug-zpages --asset-path assets/'
|
||||
8
phoenix/tools.go
Normal file
8
phoenix/tools.go
Normal file
@@ -0,0 +1,8 @@
|
||||
// +build tools
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "github.com/UnnoTed/fileb0x"
|
||||
_ "github.com/restic/calens"
|
||||
)
|
||||
Reference in New Issue
Block a user