Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where should custom hubot scripts go in a snap installation? #5771

Closed
cit opened this issue Jan 25, 2017 · 14 comments
Closed

Where should custom hubot scripts go in a snap installation? #5771

cit opened this issue Jan 25, 2017 · 14 comments

Comments

@cit
Copy link

cit commented Jan 25, 2017

Hey,

I installed rocket.chat 0.50.1 via snap on Ubuntu 16.04.1 TLS and enabled hubot. It is awesome! Now we would like to add custom hubot scripts to rocket.chat. However, in snap the directory /snap/ is mounted as readonly, so I can't just put new scripts in the hubot-scripts folder. I also tried to put scripts into /var/snap/rocketchat-server/common but this gave me of course the following error:

Jan 25 10:29:09 hostname snap[25485]: can't load lunch.coffee
Jan 25 10:29:09 hostname snap[25485]: { [Error: Cannot find module '/snap/rocketchat-server/451/programs/server/npm/node_modules/meteor/rocketchat_internal-hubot/node_modules/hubot-scripts/src/scripts/lunch.coffee'] code: 'MODULE_NOT_FOUND' }

So, my question is where should custom hubot script go in snap installation? Thanks in advance!

@engelgabriel
Copy link
Member

Good point, we need to also look at this on Docker. @graywolf336 @rodrigok any ideas?

@engelgabriel
Copy link
Member

@geekgonecrazy any idea on how to do on snaps?

@geekgonecrazy
Copy link
Contributor

@engelgabriel

For snaps anywhere relative to the code execution is read only. So if we can't change the path in settings or via environment variable then they couldnt write new files.

These changes would be helpful for Docker as well.

@engelgabriel
Copy link
Member

engelgabriel commented Jan 29, 2017

Should we put it inside the uploads folder?

@cit
Copy link
Author

cit commented Jan 29, 2017

At least from a user perspective the upload folder was my first thought. However, maybe to avoid that the common directory gets too messy, I would like to recommend something like this: /var/snap/rocketchat-server/common/hotbot-scripts/

@maxdwit
Copy link

maxdwit commented Jan 30, 2017

Maybe it would be helpful to have a filestructur similar to the mounted snap folders, which could externd/overwrite files from the mounted folder?

@ghost
Copy link

ghost commented Feb 7, 2017

For docker one can add custom scripts with docker cp into the location inside the rocketchat container, but these get deleted with every update via docker pull rocketchat/rocketchat:latest
It would be very convenient to be able to store them somewhere more persistent.

@geekgonecrazy
Copy link
Contributor

ref: #7095 as soon as this is merged we can add a folder in snaps for this.

@apiontek
Copy link

Is there an update on this? I'm unclear how to do this on 0.57.3

I created a folder /var/snap/rocketchat-server/common/scripts and placed an "example.coffee" in there that should respond to "test" I think.

If I put "example.script" in the scripts field, and then try "test" in a channel with the bot, or @thebot, nothing happens. If I @thebot help I get the basic help text.

If I specify "Folder to load the scripts" as "scripts/" or "common/scripts/" or "/var/snap/rocketchat-server/common/scripts" then the logs complain about not being able to locate example.script.

Where would /var/snap/rocketchat-server/common/scripts be mounted relative to the rocketchat-server snap?

@DannyHeal
Copy link

Hello, I'm running into the same issue where I am not able to add Hubot or GifReply

name: rocketchat-server
summary: "Group chat server for 100s, installed in seconds."
publisher: rocketchat
contact: https://demo.rocket.chat/channel/ubuntu-snap
description: |
Slack-like online chat server for your office, group or family. Up and running
in seconds. Supports file sharing, video conference, geolocation, and much
more. Web and mobile client. MIT licensed Open Source project. List of
features at https://rocket.chat/ , MIT licensed source code at
https://github.com/RocketChat/Rocket.Chat , 24 x 7 community support and demo
server at https://demo.rocket.chat/
commands:

  • rocketchat-server.backupdb
  • rocketchat-server.initcaddy
  • rocketchat-server.mongo
  • rocketchat-server.restoredb
    tracking: stable
    installed: 0.58.2 (943) 163MB -
    refreshed: 2017-08-23 04:19:37 +0000 UTC
    channels:
    stable: 0.58.2 (943) 163MB -
    candidate: 0.59.0-rc.3 (1012) 174MB -
    beta: ↑
    edge: 0.59.0-develop (1018) 174MB -

@ttpars
Copy link

ttpars commented Sep 12, 2017

I am having the same issue, I cannot get internal-hubot to load custom scripts, or scripts I have modified from the github repository.

@wemu
Copy link

wemu commented Sep 15, 2017

I'm running 0.58.2 and I think I already works since 0.58.0 or earlier. The snaps seem to have security first in mind so there are some restrictions. The directories available are listed here: https://snapcraft.io/docs/reference/confinement
So what I've done is to set: Folder to load the scripts: /var/snap/rocketchat-server/hubot/
and put the modified scripts in there. That works for me. (no path given for the scripts, ex: "countdown.coffee,gif-me.coffee,zen.coffee"
The logs (/admin/view-logs) show if a script cannot be loaded.
It seems the internal Hubot comes with some restrictions or drawbacks. The chat pointed me to https://github.com/RocketChat/botswana-snap - which also looks quite interesting.

@DannyHeal
Copy link

DannyHeal commented Sep 15, 2017 via email

@timkinnane
Copy link
Contributor

Will close this because the referenced PR has been merged and any further updates to the internal hubot script loading can be tracked under #6640.

@theorenck theorenck removed this from the Short-term milestone Apr 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests