Git Product home page Git Product logo

ocis-hello's Introduction

oCIS Hello: an example extension for ownCloud Infinite Scale

Rocket chat Build Status Security Rating Coverage Go Report Go Doc oCIS Hello docker image

Run oCIS Hello

Please see Getting Started

Security

If you find a security issue please contact [email protected] first

Contributing

Fork -> Patch -> Push -> Pull Request

License

Apache-2.0

Copyright

Copyright (c) 2021 ownCloud GmbH <https://owncloud.com>

ocis-hello's People

Contributors

butonic avatar c0rby avatar deepdiver1975 avatar dependabot[bot] avatar dpakach avatar dschmidt avatar fossabot avatar individual-it avatar kulmann avatar lukashirt avatar micbar avatar mmattel avatar pascalwengerter avatar phil-davis avatar refs avatar settermjd avatar tboerger avatar wkloucek avatar xoxys avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ocis-hello's Issues

Provide a minimal version to get started

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.

create API tests

  • find appropriate API testing tools
  • create example tests for ocis-hello
  • run tests in drone

fresh install along readme fails to find package grpc-ecosystem/grpc-gateway/protoc-gen-swagger

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

Build errors

Steps

  1. make generate build

Expected result

Successful build.

Actual result

± % 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

Version

This is on master (6f36c06)

Setup

  • openSUSE Tumbleweed 20191204
  • go version go1.12.12 linux/amd64

Notes

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

Build issues with filebox dependency

± % 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

make generate fails randomly?

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

Runnig ocis-hello from example guide broken

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

create UI tests

  • find a selenium - gherkin - go stack #76
  • implement a starting point for UI tests #76
  • run tests in drone WIP #75

Error when clicking the button in the ui

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)

[WIP | Spec] Protobuf File

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).

Add some basic metrics

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

build issues with crypto/ed25519 dependency

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

Documentation need update

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?

ocis-hello outdated and greeter API fails with 405

Describe the bug

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

Steps to reproduce the behavior:

  1. Start ocis, with a) proxy.json having endpoints /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.
  2. Start ocis-hello from master
  3. Login to the web ui
  4. Choose Hello in the app switcher
  5. Send the request

Expected behavior

Shows a response in the UI.

Actual behavior

Shows a 405 in the JS console / Network tab.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.