Hubs-Foundation / hubs-cloud

Resources for self hosted Hubs Cloud instances
Mozilla Public License 2.0
155 stars 99 forks source link

Hubs Cloud discord bot is unreliable + difficult to setup + restart after problem #128

Open robinkwilson opened 3 years ago

robinkwilson commented 3 years ago

Investigate Discord bot issues when deployed on Hubs Cloud.

We've heard reports:

┆Issue is synchronized with this Jira Task

robinkwilson commented 3 years ago

https://github.com/mozilla/hubs/discussions/3303

ConstantChange commented 3 years ago

Happy to test this with you when you are ready. This goes way back to April where we gave this a really good try.

klercke commented 3 years ago

Robin, I'm in the process of making a Discord bot for our event as mentioned in mozilla/hubs#3303. I figured I may as well try to copy over the functionality we need from the official bot (primarily the chat features). Is there an "easy" way to get the chat from a room without having to be present in it? Sorry if this isn't the right place to be asking.

joone-org commented 3 years ago

Is this fixed? Or... could we still access the instructions at our own risk?

ghost commented 3 years ago

Is this fixed? Or... could we still access the instructions at our own risk?

Guess not

Ronald-MannMade commented 3 years ago

Happy to test out anything as well

blairmacintyre commented 3 years ago

Any update on this? We're about to try setting up a discord bot on our hubs cloud instance, wanted to know what the status is.

robinkwilson commented 3 years ago

I'm afraid we haven't had the resources to complete any additional work on the discord bot for HC unfortunately. We've been focused on core platform performance issues and the new UI.

This issue is still open as is.

blairmacintyre commented 3 years ago

hmmm, that's a shame. Are any of the integrations (slack, discord, whatever) working with hubs cloud?

botissues commented 3 years ago

Hello, I see this is a bit of a dead thread. has there been any updates made?

tokyoronin commented 3 years ago

still not working

botissues commented 3 years ago

still not working

Yes, is there any known alternatives, I really need this feature.

joone-org commented 3 years ago

Use this: https://github.com/MozillaReality/hubs-docs/commit/f5cfb537d8b09b74488ecdbd7407723bc718947b

botissues commented 3 years ago

Use this: MozillaReality/hubs-docs@f5cfb53

Thank you so much! I am trying to do this now but I am having trouble SSH into the AWS server, is there a guide for this or can anyone point me in the right direction.

pattersonbl2 commented 3 years ago

Update: We may have found a possible fix anybody willing to test this adding the bot using this https://docs.google.com/document/d/1wDc-Dd8oiYR0SiNiPDQtgtH1OlKbKQP2Tr5pKKq25KU

blairmacintyre commented 3 years ago

The doc is locked ...

pattersonbl2 commented 3 years ago

should be unlocked now.

botissues commented 3 years ago

you also have to ssh into the ec2 instance. I got it working. using the guide from @yoshway

smakhtin commented 2 years ago

Is it works for anyone? After setup i can create a room via bot, but can't login to this room, Hubs Cloud says that i don't have correct permissions to access the room.

smakhtin commented 2 years ago

For those who interested, i found solution - version of Reticulum that shipped with Hubs Cloud has a bug. If you update Reticulum from stable channel by hands this problem disappears. Tested on mozillareality/reticulum/1.0.1/20220126003355 - works, but mozillareality/reticulum/1.0.1/20210618144438 don't - always blocks login through Discord.

drtidcom commented 2 years ago

For those who interested, i found solution - version of Reticulum that shipped with Hubs Cloud has a bug. If you update Reticulum from stable channel by hands this problem disappears. Tested on mozillareality/reticulum/1.0.1/20220126003355 - works, but mozillareality/reticulum/1.0.1/20210618144438 don't - always blocks login through Discord.

Quite Interested although I am still a noob and using the AMS out of the box...

Being such a noob, do you know or could you direct me in updating to the working version?

Thanks in advance!

smakhtin commented 2 years ago

@drtidcom you need to check Chef Habitat documentation - https://docs.chef.io/habitat/.

drtidcom commented 2 years ago

Thank you, on it!

thislooksrare commented 2 years ago

@smakhtin @drtidcom can you share your solution? How can I upgrade this on a running AWS installation? Can I somehow just run bio svc load with some parameters to update this reticulum to the newest build? Would apprechiate any help here

Bruguera-cbcat commented 2 years ago

@smakhtin @drtidcom can you share your solution? How can I upgrade this on a running AWS installation? Can I somehow just run bio svc load with some parameters to update this reticulum to the newest build? Would apprechiate any help here

You probably have a newest version running, you can check with "sudo bio sup status" in the app server. I get the discord bot working but I can't log in trough discord, someone found a solution?

johnshaughnessy commented 2 years ago

https://github.com/mozilla/hubs-cloud/issues/128#issuecomment-1031215362

For those who interested, i found solution - version of Reticulum that shipped with Hubs Cloud has a bug. If you update Reticulum from stable channel by hands this problem disappears. Tested on mozillareality/reticulum/1.0.1/20220126003355 - works, but mozillareality/reticulum/1.0.1/20210618144438 don't - always blocks login through Discord.

Hello, I've just become aware of this issue. Sorry to have missed it until now.

It seems that the recent Hubs Cloud update may have introduced a regression with Discord Auth in reticulum. The regression was fixed a while ago on HMC, but the code that was shipped to Hubs Cloud in February did not include that fix: https://github.com/mozilla/reticulum/pull/531

A new reticulum package that includes the fix can be used on your hubs cloud instance now, but it includes other changes that have not been tested on Hubs Cloud instances, so I can't guarantee it won't break in new, unpleasant ways.

If Discord Auth is a critical feature for you and you accept the risks of using an untested package, I believe you can (ssh into your server and) run: bio svc load mozillareality/reticulum/1.0.1/20220311205847 --force as root to load the (untested) package that includes the fix.

Note however -- This will lock your edit your hubs cloud reticulum package config to lock you to this package. To undo that, you will want to immediately restore your config file (/hab/sup/default/specs/reticulum.spec) back to normal:

ident = "mozillareality/reticulum"
group = "default"
bldr_url = "https://bldr.habitat.sh"
channel = "polycosm-stable-a"
topology = "standalone"
update_strategy = "none"
binds = []
binding_mode = "strict"
desired_state = "up"

[health_check_interval]
secs = 30
nanos = 0

If done correctly, this will fast-forward your hubs cloud instance to that reticulum package version, but you will still automatically download stable packages once they are available. After the next hubs cloud release, you should confirm everything looks normal.

Testing for this package commences next week and we aim to ship it (or a variant with any bugfixes) by April 1. If you can wait for Discord Auth that long, you do not need to take the steps above.

aziliak commented 2 years ago

@johnshaughnessy

Did this ever get tested/shipped? Having the Discord bot would be critical to several projects I am hoping to start working on.

Bruguera-cbcat commented 2 years ago

@aziliak I tested it and I get it working but I'm stuck to autentificate from discord.

JUGERNAUTUS commented 2 years ago

Hy folks. So I am in the same boat and am trying to debug. I was able to find somethind (I think) but I need a little help with the resolution since Im new to hubs (reticulum specifically and elixir) and a bit green with AWS.

TL:DR Does anyone know how I can see reticulum logs in debug mode or monitor request/response to the public internet on AWS>

Basically when you click on the room link generated by the bot and then it asks for a discord authentication, after you authorize, discord sends a code and state params to your hubs cloud API server. Reticulum is expected to swap this code for an access token by hitting the discord token URL endpoint and replace this for an access token (https://discord.com/developers/docs/topics/oauth2). This access token is then supposed to be included in the header of all page requests to your hubs.

This functionality works fine for the mozilla hubs (hubs.mozilla.com) setup. The user is able to do a discord authentication and sign in using the Hubs Mozilla bot and if you check the request header, it contains an access token after you are redirected from the Mozilla Hubs API server.

Unfortunately if you are running a personal implementation of Hubs Cloud, the App server API endpoint seems to be unable to receive an access token. If you check the rerouting to the Hubs page after you authorize discord, the access token is missing in the header, hence hubs cloud again asks you to authorize and authenticate with discord

I can see that reticulum is making the request to discord in the syslog to swap the code for the access token. I can also see that the code has been swapped on discord's end, because if you try to do the swap with postman, it says 'invalid code' (it has been already swapped). Im not sure if reticulum is actually receiving the access token, and if it is, why it is not including it in the re routing request to the hubs page. Any suggestions ?

JUGERNAUTUS commented 2 years ago

Hy folks. So I am in the same boat and am trying to debug. I was able to find somethind (I think) but I need a little help with the resolution since Im new to hubs (reticulum specifically and elixir) and a bit green with AWS.

TL:DR Does anyone know how I can see reticulum logs in debug mode or monitor request/response to the public internet on AWS>

Basically when you click on the room link generated by the bot and then it asks for a discord authentication, after you authorize, discord sends a code and state params to your hubs cloud API server. Reticulum is expected to swap this code for an access token by hitting the discord token URL endpoint and replace this for an access token (https://discord.com/developers/docs/topics/oauth2). This access token is then supposed to be included in the header of all page requests to your hubs.

This functionality works fine for the mozilla hubs (hubs.mozilla.com) setup. The user is able to do a discord authentication and sign in using the Hubs Mozilla bot and if you check the request header, it contains an access token after you are redirected from the Mozilla Hubs API server.

Unfortunately if you are running a personal implementation of Hubs Cloud, the App server API endpoint seems to be unable to receive an access token. If you check the rerouting to the Hubs page after you authorize discord, the access token is missing in the header, hence hubs cloud again asks you to authorize and authenticate with discord

I can see that reticulum is making the request to discord in the syslog to swap the code for the access token. I can also see that the code has been swapped on discord's end, because if you try to do the swap with postman, it says 'invalid code' (it has been already swapped). Im not sure if reticulum is actually receiving the access token, and if it is, why it is not including it in the re routing request to the hubs page. Any suggestions ?

Guys, please check the below link. This resolution worked for me. Please see if it works for you as well

https://github.com/mozilla/hubs-cloud/issues/302