Please see Getting Started
If you find a security issue please contact [email protected] first
Fork -> Patch -> Push -> Pull Request
Apache-2.0
Copyright (c) 2021 ownCloud GmbH <https://owncloud.com>
:atom_symbol: Example extension for oCIS
Home Page: https://owncloud.dev/extensions/ocis_hello/
License: Apache License 2.0
Please see Getting Started
If you find a security issue please contact [email protected] first
Fork -> Patch -> Push -> Pull Request
Apache-2.0
Copyright (c) 2021 ownCloud GmbH <https://owncloud.com>
We need to provide a basic example which simply servers a hello world API and a frontend hooked into Phoenix in the context of the ownCloud Infinite Scale project.
make generate build
failing on fresh install with:
GO111MODULE=off go get -v github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
github.com/grpc-ecosystem/grpc-gateway (download)
cannot find package "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger" in any of:
/usr/local/go/src/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger (from $GOROOT)
/Users/****/go/src/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger (from $GOPATH)
MacOSX Catalina: 10.15.6
GO Version: 1.15.3 darwin/amd64
Quickfix was to set: GO111MODULE=on go get -v github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger in Makefile
We need to initialize go-micro with another registry than mdns (because it doesn't work in docker). Similar reference: https://github.com/owncloud/ocis-proxy/issues/38
make generate build
Successful build.
± % make generate build
GO111MODULE=off go get -v github.com/golang/protobuf/protoc-gen-go
GO111MODULE=off go get -v github.com/micro/protoc-gen-micro
GO111MODULE=off go get -v github.com/webhippie/protoc-gen-microweb
GO111MODULE=off go get -v github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
go generate github.com/owncloud/ocis-hello/pkg/assets
2019/12/20 11:58:14 fileb0x: took [29ms] to write [./embed.go] from config file [embed.yml] at [2019-12-20 11:58:14.805823954 +0100 CET m=+0.031700786]
go build -v -tags '' -ldflags '-s -w -X "github.com/owncloud/ocis-hello/pkg/version.String=6f36c06" -X "github.com/owncloud/ocis-hello/pkg/version.Date=20191220"' -o bin/ocis-hello ./cmd/ocis-hello
build github.com/owncloud/ocis-hello/cmd/ocis-hello: cannot load crypto/ed25519: cannot find module providing package crypto/ed25519
make: *** [Makefile:98: bin/ocis-hello] Error 1
This is on master (6f36c06)
Additionally I find it strange that the build process is modifying files that are in VCS:
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: go.mod
modified: pkg/assets/embed.go
± % make generate build
go generate github.com/owncloud/ocis-hello/pkg/assets
panic: No files found
goroutine 1 [running]:
main.main()
/home/vincent/go/pkg/mod/github.com/!unno!ted/[email protected]/main.go:101 +0x26d4
exit status 2
pkg/assets/assets.go:11: running "go": exit status 1
make: *** [Makefile:71: generate] Error 1
This is with go1.12-1.12.9-1.1.x86_64 from openSUSE Tumbleweed
We want to look into
a) using the API Gateway for proper endpoints, instead of using protoc-gen-microweb
for web endpoint code generation https://micro.mu/docs/api.html#rpc-resolver
b) being able to run the service standalone, without the gateway. With proper protobuf endpoint annotations, we might be able to use the generated api.Endpoint
s without the gateway.
120 | protoc \
121 | -I=third_party/ \
122 | -I=pkg/proto/v0/ \
123 | --go_out=logtostderr=true:pkg/proto/v0 hello.proto
124 | protoc-gen-go: no such flag -logtostderr
125 | --go_out: protoc-gen-go: Plugin failed with status code 1.
occured in
note that during the same build it always fails in the generate step but not always ... and not always in the same architecture... which makes no sense because if the lib does not know the logtostderr=true
flag on one architecture ... it should not know it on others as well 😵
AFAICT we may run into this in every ocis repo ... my google fu does not find a good issue with the above error message protoc-gen-go: no such flag -logtostderr
... it might be part of glog: https://pkg.go.dev/github.com/golang/glog?tab=doc
Following the guide leads to a The resource from “https://localhost:9200/hello.js” was blocked due to MIME type (“text/plain”) mismatch
error for hello.js
in the console. Perhaps needs to be fixed within ocis-pkg/middleware/static.go
https://github.com/owncloud/ocis-hello/blob/master/ui/client/hello/index.js#L49 checks if the parameters contain a body
property, but it is not provided by the call in https://github.com/owncloud/ocis-hello/blob/master/ui/store.js#L19-L22
Needs retesting when we have a flag based build that starts hello, phoenix and an idp.
core.bundle.js:13 TypeError: Cannot read property 'url' of null
at c.submitName (hello.js:7)
at Array.<anonymous> (core.bundle.js:1)
at c.dispatch (core.bundle.js:7)
at c.dispatch (core.bundle.js:1)
at c.i.dispatch (core.bundle.js:1)
at s.x.forEach.r.<computed> (hello.js:7)
at submit (hello.js:14)
at Bt (core.bundle.js:13)
at HTMLFormElement.n (core.bundle.js:13)
at HTMLFormElement.Zr.o._wrapper (core.bundle.js:13)
While designing a Protobuf API taking into consideration Javascript consumers we need to mind that the generated js client will make use of define endpoints on the protobuf file. As a way of easing development and not having the overhead of writing new Encoder / Decoders and leveraging the use of reflection, requests that make use of the JS generated client MUST be defined as POST
.
This is due to RPC and REST are different API design, and as we're designing for RPC and not Restful endpoints, our generated swagger client needs to be aware of this design choice and not get into the nitty-gritty of understanding REST routes, but only Marshal / Unmarshal JSON on the request body.
This design choice was made taking into consideration the HTTP Spec, which recommends GET
requests not to contain a body and Swagger enforces this:
GET, DELETE and HEAD are no longer allowed to have request body because it does not have defined semantics as per RFC 7231.
This causes our generation to panic on GET
requests.
Root causes: JS clients does not currently support gRPC (at the moment of this writing).
So far we are using opencensus for traces and metrics, we should start adding metrics as examples. This snippet starts to add a up
metrics:
import (
"context"
"go.opencensus.io/stats"
"go.opencensus.io/stats/view"
)
Up := stats.Float64("up", "Demo to show it's up", "")
UpView := &view.View{
Name: "up",
Measure: Up,
Description: "View for up metric",
Aggregation: view.Count(),
}
if err := view.Register(UpView); err != nil {
return err
}
stats.Record(context.Background(), Up.M(1.0))
This will give this metric within the prometheus exporter:
# HELP hello_up View for up metric
# TYPE hello_up counter
hello_up 1
clean clone and build ...
Fetching https://golang.org/x/sync?go-get=1
Parsing meta tags from https://golang.org/x/sync?go-get=1 (status code 200)
get "golang.org/x/sync": found meta tag get.metaImport{Prefix:"golang.org/x/sync", VCS:"git", RepoRoot:"https://go.googlesource.com/sync"} at https://golang.org/x/sync?go-get=1
go: extracting golang.org/x/sync v0.0.0-20190423024810-112230192c58
build github.com/owncloud/ocis-hello/cmd/ocis-hello: cannot load crypto/ed25519: cannot find module providing package crypto/ed25519
make: *** [bin/ocis-hello] Error 1
Famous projects are using the gogo protobuf definition, maybe we should consider and evaluate if we also want to use that for our oCIS services. For reference take a look at https://github.com/gogo/protobuf.
Couldn't config ocis-hello
extension with ocis by following steps in ocis extension document https://owncloud.dev/extensions/ocis_hello/running . I think the documentation needs some refactoring.
Can't find proxy-example.json
file in ocis as mentioned in doc https://github.com/owncloud/ocis-hello/blob/edc8ef1d4b79dba29321cc70a3f6a20373d30f65/docs/extensions/hello/running.md?plain=1#L53
Did I miss something?
The code base of ocis-hello seems to be working when started, but it's code base is outdated. It still refers to ocis-pkg/v2
and ocis-settings
. The UI renders correctly when configured in oC Web. But trying to send something to its greeter API via its web form the request fails with 405 (Method Not Allowed)
. This needs an overhaul.
Steps to reproduce the behavior:
/api/v0/greet
pointing to http://localhost:9105
and /hello.js
pointing to http://localhost:9105
, b) config.json for oC Web having hello
fetched from /hello.js
in the list of external_apps
.Hello
in the app switcherShows a response in the UI.
Shows a 405 in the JS console / Network tab.
It is possible that latest changes to the way the top bar and navigation works might break some things in ocis-hello.
So I followed the guide along and I experienced that it is a little bit hard to follow. So I want to help to improve it a little bit from a beginners view.
I recognized that LDAP is not necessary at all, because Kopano was added now in the main ocis repro.
This would bring down the complexity of this part of the guide a lot. I wanted to ask before I submit changes.
Write documentation on how to register settings bundles with the settings service
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.