Repository: ssbc/go-ssb-room (language: go)

Issue:
Bootstrapping problem with Manyverse
I'm trying to bootstrap a new go-ssb-room instance, and since I'm not terribly familiar with it, I wanted to test it out using a throwaway account.  So I started with an empty Manyverse app and tried to connect to my new room.  And now I'm stuck on the "Connect via Wi-Fi/Paste invite code" step and can't figure out a way past this.  I'm not exactly sure what the best way forward is, but I figured I'd better bring this up.

Posted here, too, since I'm not sure if this would be better handled here or in Manyverse:

https://gitlab.com/staltz/manyverse/-/issues/2089


Discussion / hints:
Hey @KyleMaas can you provide some more info about your install? Sitting behind a proxy or?

Perhaps the following can help:

- https://github.com/ssbc/go-ssb-room/blob/master/docs/deployment.md#http-hosting
- https://github.com/ssbc/go-ssb-room/blob/master/docs/deployment.md#enable-tcp-ports

My first guess is that Manyverse is failing to connect to the room. Maybe the go-ssb-room logs have something also?
No, the connectivity wasn't a problem.  It's that Manyverse, when starting from empty, needs an invite code to connect to.  And go-ssb-room starts by default in Community mode, so you can't generate an invite code.  So if both are empty, you can't connect to the room using Manyverse, and you can't change the room to an open room without logging in first, which requires an SSB client.

I did eventually get it to work by connecting Manyverse to a pub, then connecting to the room, then disconnecting from the pub.  But there's got to be a better way to do that - maybe generate an initial invite code for a newly-created room?  I'm not sure the best way to go about doing this.  But I figured the experience of a newbie might help iron out the process a bit.
Ah, I think you just need to make the admin user and then you can get the log in to generate the code:

> https://github.com/ssbc/go-ssb-room/blob/master/docs/deployment.md#first-admin-user
I did create an admin user.  But the problem is, to do that, you have to have an SSB ID.  So I used a throwaway account that I had an ID and recovery phrase for.  Used the ID to add the admin user.  Went to set up that user in Manyverse so I could log in with SSB to generate an invite code.  Couldn't get past the Manyverse connection screen.  And that's where I got stuck.

Is there a way to, from the command line, generate a username and password for sign-in rather than the setup process requiring an existing SSB ID?  That would be one way to solve the problem.  Another would be if the room defaulted to open so you could generate an invite code without signing in using an existing ID.  It's a chicken-and-egg problem if you're starting with a new room and an empty Manyverse app.
You need to use the `insert-user` command to create a superuser, then login using that user's ID as username in the web frontend.

I'm at that stage, but when I create an invite and open it with Manyverse (both on desktop, and 2 different Android phones), the server shows that the user is added, but Manyverse doesn't show anything different. It still says disconnected and tells you to find a room server.
> You need to use the `insert-user` command to create a superuser, then login using that user's ID as username in the web frontend.

I tried that, but since it didn't set up a password and I couldn't sign in using Manyverse to set a password, I had no way to log into the web frontend.
I was confused by that too, you're not suppose to use `insert-user` to insert your actual user from Manyverse. You're supposed to run the shell file that is inside the `insert-user` directory and it will generate a random user id, insert that one with a password and then login to the web frontend using that user id as your username and the password. I agree this is non-trivial and they could explain it better. I also tried for a while to add my Manyverse account so that I could login with it.
Ah...that would make some sense.  Yeah, a documentation change would probably fix that.
Looking back through the code for `insert-user`, I think I may have figured out a detail I forgot.  Struggled with setup for long enough I completely forgot about this:

When I initially ran it, it asked for a password, but didn't explain what it was for (recovery passphrase for the private key?), so I left it blank thinking I could sign in using Manyverse.  Because of the bootstrapping problem I ran into, I could not.  So I tried running `insert-user` again with the same ID to see if I could set a different password, but it would not let me because the user was already in the database.

That probably explains some of the confusion.  Apologies for not including that upfront, but again, I forgot about that part of it until just now when I read through the code.
@KyleMaas perhaps a docs PR to help others who might run into this? Or we could change the help output (or output itself) of `insert-user` to signal the use of the password to avoid this bootstrapping issue? Or other ideas?

Fix patch:
diff --git a/cmd/insert-user/main.go b/cmd/insert-user/main.go
index ab7a41d6..6d703227 100644
--- a/cmd/insert-user/main.go
+++ b/cmd/insert-user/main.go
@@ -76,7 +76,7 @@ func main() {
 	check(err)
 	defer db.Close()
 
-	fmt.Fprintln(os.Stderr, "Enter Password: ")
+	fmt.Fprintln(os.Stderr, "Choose a password to be able to log into the web frontend: ")
 	bytePassword, err := terminal.ReadPassword(int(syscall.Stdin))
 	check(err)
 
diff --git a/docs/deployment.md b/docs/deployment.md
index 1f03fff0..18328cf3 100644
--- a/docs/deployment.md
+++ b/docs/deployment.md
@@ -184,5 +184,5 @@ Or if you installed go-ssb-room using the Debian package:
 sudo ./insert-user -repo "/var/lib/go-ssb-room" "@Bp5Z5TQKv6E/Y+QZn/3LiDWMPi63EP8MHsXZ4tiIb2w=.ed25519"
 ```
 
-You can now login in the web-front-end using these credentials
+It will ask you to create a password to access the web-front-end.  You can now login in the web-front-end using these credentials
 


Test patch: