GithubHelp home page GithubHelp logo

mattermost-app-nextcloud's Introduction

Nextcloud App

A Nextcloud app for Mattermost.

First steps

Setting up

  1. Run Mattermost server https://github.com/mattermost/mattermost-server/blob/master/README.md
  2. Install/Enable Apps plugin https://github.com/mattermost/mattermost-plugin-apps
  3. Run NC server docker run -d -p 8081:80 nextcloud:latest
  4. Crete NC admin account via opening NC link http://localhost:8081
    Note: After user creation install recommended apps
  5. Inside docker container find config.php and add NC ngrok url to trusted domains

docker exec -it %NEXTCLOUD_SERVER_DOCKER_CONTAINER_ID% /bin/sh
cd config
apt-get update
apt-get install nano
nano config.php

'trusted_domains' =>
array (
0 => 'localhost:8081',
1 => '%YOUR_NC_DOMAIN%.ngrok.io',
),

Note: For HTTPS connection add to config.php

'overwriteprotocol' => 'https',

  1. Register a NC app - http(s)://YOUR_NC_URL/settings/admin/security
    • as a callback url use - http(s)://YOUR_MM_SERVER/plugins/com.mattermost.apps/apps/nextcloud/oauth2/remote/complete
    • Copy the client secret for a future step
  2. Run Nextcloud integration server app
    • Run docker-compose up in the root of the Nextcloud App repository
  3. In mattermost channel run /apps install http http://localhost:8082/manifest.json
    Note: For http deploy type JWT_SECRET env variable contains value for Outgoing JWT Secret field

Link MM account with Nextcloud

  1. Run command /nextcloud configure and provide Nextcloud instance url ,client id and client secret from register a Nextcloud app step http://YOUR_NC_URL/settings/YOUR_ADMIN_USER/security
  2. Run command /nextcloud connect and open link from bot response for linking mm with Nextcloud account

Usage

  1. /nextcloud share - share public link for user file in MM channel
  2. /nextcloud calendars - show user calendars
  3. Message actions - Upload file to Nextcloud

Building aws bundle

In project root run command make dist-aws

Deploy aws bundle with appsctl

https://developers.mattermost.com/integrate/apps/deploy/deploy-aws/

go run ./cmd/appsctl aws deploy -v bundle-aws.zip

Lambda configuration

Increase RAM and timeout ( Lambda -> Configuration -> General Configuration)

Add environmental variables:
( Lambda-> Configuration -> Environment variables)
CHUNK_FILE_SIZE_MB
MAX_FILE_SIZE_MB
MAX_FILES_SIZE_MB
GIN_MODE=release
MAX_REQUEST_RETRIES=3

HTTP configuration

Add environmental variables:
JWT_SECRET=secret
STATIC_FOLDER=static
APP_TYPE=HTTP
CHUNK_FILE_SIZE_MB=15
MAX_FILE_SIZE_MB=25
MAX_FILES_SIZE_MB=50
APP_URL=http://localhost:8082
PORT=8082
GIN_MODE=release
MAX_REQUEST_RETRIES=3

mattermost-app-nextcloud's People

Contributors

hanzei avatar ostapmelnychuk avatar

Stargazers

Saturnino Abril avatar Leora avatar Sergio Sánchez Ramírez avatar  avatar Guillaume avatar YANO Tetsuro avatar Jared Knowles avatar Chen-I Lim avatar Jan avatar

Watchers

Jesús Espino avatar Pantelis Vratsalis avatar Maria A Nunez avatar Christopher Poile avatar Agniva De Sarker avatar Daniel Espino García avatar Stavros Foteinopoulos avatar William Gathoye avatar Gabe Jackson avatar Mir Shahriar Sabuj avatar Doug Lauder avatar Elias Nahum avatar Corey R avatar Tanmay Singh avatar Pablo Vélez avatar Asaad Mahmood avatar Mario Vitale avatar Caleb Roseland avatar Scott Bishel avatar Nathaniel Allred avatar  avatar na avatar Maxwell Power avatar  avatar

mattermost-app-nextcloud's Issues

Can this be served via Reverse Proxy?

I got this successfully completed but get this error when trying to use the "upload file to Nextcloud" through the message action:
image

but I get this error when trying to actual perform the action: "upstream call failed: failed to invoke via http: Post "http:///file-upload-form"
image

My Nextcloud and Mattermost instances are running via Cloudflare reverse proxies are installed on separate machines. Even if I were to re-install my Mattermost instance on the same machine running Nextcloud, I am not sure if this would still work through a reverse proxy.

Is this meant to only run locally? I feel like I am so close! Let me know if you need any other information. Thank you!

Error on configuration

Hey guys!

I am currently trying to use your app to connect my nextcloud with mattermost.
So far so good.
When I try to submit my configuration after calling "/apps install...." I get the following error: "failed to install App: failed to install, /ping path is not accessible: failed to call /ping endpoint: failed to invoke via HTTP: {"type":"error","text":"signature is invalid"}{"type":"ok","text":"PONG"}".

Is there maybe something I did wrong? I don't get it. Followed your instructions and stuck here now for hours.

Thank you guys!

Sincerely,
René

Permission Error

I have a new issue after finally getting the plugin to work. I am able to go to 'more actions' and select the 'Upload to Nextcloud' option but am getting a permission error (see screenshot). Does anyone have any suggestions for how to fix this? I have successfully configured the nextcloud bot with the /nextcloud configure and entered in the ID, client secret and url and then did the /nextcloud connect, was directed to my Nextcloud instance to login/grant access. When selecting the Upload to Nextcloud a dialogue box pops up and does allow me to select the folder I want to send the file to but alas I get a permission error.
permission error

App is crashing when trying to use the connect option

We have successfully completed till /nextcloud configure step but as and when we try to proceed with the /nextcloud connect step it is giving the below error.

[GIN] 2023/09/13 - 07:22:59 | 500 | 70.201415ms | 172.25.0.2 | POST "/oauth2/complete"

2023/09/13 07:22:59 [Recovery] 2023/09/13 - 07:22:59 panic recovered:
POST /oauth2/complete HTTP/1.1
Host: 10.22.0.186:8082
Accept-Encoding: gzip
Content-Length: 961
Content-Type: application/json
Mattermost-App-Authorization: Bearer eyJhbGciOiJIUzI1CI6Ikpl9.vo4YLLb2cDFCNF90XxR-2J5j_
User-Agent: Mattermost-Bot/1.1

runtime error: invalid memory address or nil pointer dereference
/usr/local/go/src/runtime/panic.go:220 (0x44b71c)
panicmem: panic(memoryError)
/usr/local/go/src/runtime/signal_unix.go:818 (0x44b6ec)
sigpanic: panicmem()
/opt/app/function/oauth/mm_app_oauth_controller.go:66 (0x115b325)
Oauth2Complete: asBot.KVSet("", fmt.Sprintf("nc-user-%s", resp.UserID), creq.Context.ActingUser.Id)
/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:173 (0x92c9c1)
(*Context).Next: c.handlersc.index
/go/pkg/mod/github.com/gin-gonic/[email protected]/recovery.go:101 (0x92c9ac)
CustomRecoveryWithWriter.func1: c.Next()
/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:173 (0x92baa6)
(*Context).Next: c.handlersc.index
/go/pkg/mod/github.com/gin-gonic/[email protected]/logger.go:240 (0x92ba89)
LoggerWithConfig.func1: c.Next()
/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:173 (0x92ab70)
(*Context).Next: c.handlersc.index
/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:616 (0x92a7d8)
(*Engine).handleHTTPRequest: c.Next()
/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:572 (0x92a31c)
(*Engine).ServeHTTP: engine.handleHTTPRequest(c)
/usr/local/go/src/net/http/server.go:2916 (0x6f6c1a)
serverHandler.ServeHTTP: handler.ServeHTTP(rw, req)
/usr/local/go/src/net/http/server.go:1966 (0x6f1c16)
(*conn).serve: serverHandler{c.server}.ServeHTTP(w, w.req)
/usr/local/go/src/runtime/asm_amd64.s:1571 (0x466300)
goexit: BYTE $0x90 // NOP

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.