mariusor / brutalinks

Link aggregator inspired by (old)reddit using ActivityPub federation. (mirror repository)
https://brutalinks.tech
MIT License
261 stars 12 forks source link

Registration or submission fails: Error: Post "/outbox": unsupported protocol scheme "" #38

Closed squash closed 4 years ago

squash commented 4 years ago

Call to client.ToCollection() are not including the fedbox hostname in the URL argument, resulting in http client requests failing.

littr .env:

# HOSTNAME is used as the base for the absolute URLs in the site
HOSTNAME=littr.brokedown.net
# LISTEN_PORT is the port number that the application will listen on for connections
LISTEN_PORT=3000
# LISTEN_HOST is the host/ip that the application will listen on for connections
LISTEN_HOSTNAME=littr
# ENV the environment type sets different configuration settings, valid are: DEV, QA, STAGING, PROD
ENV=DEV
# API_URL is the url of the fedbox instance that provides our C2S ActivityPub API
API_URL=http://fedbox.local
# SESS_AUTH_KEY is used for encrypting the session data
SESS_AUTH_KEY=1234567890123456
# SESS_ENC_KEY
SESS_ENC_KEY=6543210987654321
# OAUTH2_KEY the default OAuth2 key used by the frontend to connect to the C2S ActivityPub end-points
OAUTH2_KEY=8b80de04-b72b-455f-aab3-4cada26e47c5
# OAUTH2_SECRET the default OAuth2 secret used by the frontend
OAUTH2_SECRET=server
# SESSIONS_BACKEND the backend to use for session storage, valid: cookie, fs
SESSIONS_BACKEND=cookie
# DISABLE_SESSIONS setting this to true, makes the instance essentially read only, by disallowing user logins
DISABLE_SESSIONS=false
# DISABLE_DOWNVOTING disables allowing Dislike activities
DISABLE_DOWNVOTING=false
# DISABLE_VOTING disables all Like/Dislike activities
DISABLE_VOTING=false

fedbox .env:

HOSTNAME=fedbox.local
LISTEN=fedbox.local:80
ENV=dev
STORAGE=fs
STORAGE_PATH=/tmp/data/fedbox

Environment is a docker container with hosts entries for littr resolving to container's IP and others resolving to 127.0.0.1.

mariusor commented 4 years ago

This tells me that the littr.brokedown.net OAuth2 application wasn't configured.

Check the FedBOX documentation for adding an OAuth2 application and use the UUID it outputs and the password you provided as OAUTH2_KEY and OAUTH2_SECRET.

This seems to be a pain point in the docs, so I'll try to spend some time to clarify the situation.

squash commented 4 years ago

I've gone through the boottrapping and oauth2 creation (and subsequent updating of the .env file) multiple times while debugging, removing fedbox's data as well, including just now. Here's what i've done:

root@16c5aeb083ad:~/go/src/github.com/ProjectHoot/fedbox# rm -rf /tmp/data/fedbox
root@16c5aeb083ad:~/go/src/github.com/ProjectHoot/fedbox# mkdir /tmp/data/fedbox
root@16c5aeb083ad:~/go/src/github.com/ProjectHoot/fedbox# bin/ctl bootstrap
root@16c5aeb083ad:~/go/src/github.com/ProjectHoot/fedbox# ./bin/ctl --env=dev ap actor add admin
admin's pw: 
pw again: 
Added "Person" [admin]: http://fedbox.local/actors/e4e61764-d0fd-4491-8f0a-a4b9ef89379b
root@16c5aeb083ad:~/go/src/github.com/ProjectHoot/fedbox# bin/ctl --env=dev oauth client add --redirectUri http://littr.brokedown.net/auth/fedbox/callback
client's pw: 
pw again: 
Client ID: 1072a0f3-17fe-41ed-8882-b36baf5999af

then I update littr's .env file for the client ID 1072a0f3-17fe-41ed-8882-b36baf5999af and the client pw I entered in the last step

OAUTH2_KEY=1072a0f3-17fe-41ed-8882-b36baf5999af
# OAUTH2_SECRET the default OAuth2 secret used by the frontend
OAUTH2_SECRET=server
# SESSIONS_BACKEND the backend to use for session storage, valid: cookie, fs

After restarting littr and opening a new incognito window, I am able to log in with the admin user I created in the previous step. After logging in, attempts to add a new item fail as noted in the title. After logging out, registration also fails as in the title.

mariusor commented 4 years ago

OK, I think I understand better now. I'll try to reproduce on my side. Could you please confirm if the oauth2 application actor has an /outbox collection?

What do you get in the browser if you go to http://fedbox.local/actors/1072a0f3-17fe-41ed-8882-b36baf5999af/outbox ?

squash commented 4 years ago

it appears not. i've done another iteration so the ID is changed again.

ERRO[0767] Not Found                                     addr="127.0.0.1:54564" elapsed="701.76µs" id=16c5aeb083ad/bV9FoqBFXN-000040 len=8452 method=GET proto=HTTP/1.1 scheme=http status=404 ts="Tue, 14 Jul 2020 15:50:26 UTC" ua=curl/7.68.0 uri="http://fedbox.local/actors/2241cb6e-c3cf-4b66-9865-dfd9ce32c531/outbox"
curl -v http://fedbox.local/actors/2241cb6e-c3cf-4b66-9865-dfd9ce32c531/outbox
*   Trying 127.0.0.1:80...
* TCP_NODELAY set
* Connected to fedbox.local (127.0.0.1) port 80 (#0)
> GET /actors/2241cb6e-c3cf-4b66-9865-dfd9ce32c531/outbox HTTP/1.1
> Host: fedbox.local
> User-Agent: curl/7.68.0                                
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 404 Not Found
< Content-Type: application/json
< Date: Tue, 14 Jul 2020 15:50:26 GMT                    
< Transfer-Encoding: chunked
<
{"@context":"http://fedbox.local/ns#errors","errors":[{"status":404,"message":"/tmp/data/fedbox/dev/fedbox.local/actors/2241cb6e-c3cf-4b66-9865-dfd9ce32c531/outbox not found","trace":[{"file":"github.com/go-ap/errors@v0.0.0-20200610194301-39b7d0cbba26/errors.go","line":79,"calee":"github.com/go-ap/errors.wrap(0x0, 0x0, 0xc1d92e, 0xc, 0xc0000117c8, 0x1, 0x1, 0x0, 0x0, 0x0, ...)"},{"file":"github.com/go-ap/errors@v0.0.0-20200610194301-39b7d0cbba26/errors.go","line":42,"calee":"github.com/go-ap/errors.Annotatef(...)"},{"file":"github.com/go-ap/errors@v0.0.0-20200610194301-39b7d0cbba26/http.go","line":54,"calee":"github.com/go-ap/errors.wrapErr(0x0, 0x0, 0xc1d92e, 0xc, 0xc0000117c8, 0x1, 0x1, 0x0, 0x0, 0x0, ...)"},{"file":"github.com/go-ap/errors@v0.0.0-20200610194301-39b7d0cbba26/http.go","line":109,"calee":"github.com/go-ap/errors.NotFoundf(...)"},{"file":"github.com/go-ap/fedbox/storage/fs/repository.go","line":775,"calee":"github.com/go-ap/fedbox/storage/fs.repo.loadFromPath.func1(0xc0000d0180, 0x54, 0x0, 0x0, 0xd33380, 0xc0005e2060, 0x6, 0x1)"},{"file":"path/filepath/path.go","line":404,"calee":"path/filepath.Walk(0xc0000d0180, 0x54, 0xc000011a30, 0x14, 0xc4d928)"},{"file":"github.com/go-ap/fedbox/storage/fs/repository.go","line":773,"calee":"github.com/go-ap/fedbox/storage/fs.repo.loadFromPath(0xc0000a0780, 0x13, 0xc0000a0820, 0x14, 0xc4d928, 0xc4d928, 0xd327a0, 0xc0003a4600, 0xc000011b28, 0x770893, ...)"},{"file":"github.com/go-ap/fedbox/storage/fs/repository.go","line":159,"calee":"github.com/go-ap/fedbox/storage/fs.(*repo).LoadCollection(0xc000097b90, 0xd327a0, 0xc0003a4600, 0x0, 0x0, 0x0, 0x0)"},{"file":"github.com/go-ap/fedbox/app/handlers.go","line":63,"calee":"github.com/go-ap/fedbox/app.HandleCollection.func1(0xc0000c03f1, 0x6, 0xc000140b00, 0x7f4a604682f0, 0xc000097b90, 0x0, 0xc1697e, 0x1, 0x0)"},{"file":"github.com/go-ap/handlers@v0.0.0-20200630121116-d3d7a2315572/handlers.go","line":163,"calee":"github.com/go-ap/handlers.CollectionHandlerFn.ServeHTTP(0xc4d890, 0x7f4a60468068, 0xc0000a25c0, 0xc000140b00)"},{"file":"github.com/go-chi/chi@v4.1.2+incompatible/chain.go","line":31,"calee":"github.com/go-chi/chi.(*ChainHandler).ServeHTTP(0xc0000a31c0, 0x7f4a60468068, 0xc0000a25c0, 0xc000140b00)"},{"file":"github.com/go-chi/chi@v4.1.2+incompatible/mux.go","line":431,"calee":"github.com/go-chi/chi.(*Mux).routeHTTP(0xc000095200, 0x7f4a60468068, 0xc0000a25c0, 0xc000140b00)"},{"file":"net/http/server.go","line":2012,"calee":"net/http.HandlerFunc.ServeHTTP(0xc00009ac60, 0x7f4a60468068, 0xc0000a25c0, 0xc000140b00)"},{"file":"github.com/go-chi/chi@v4.1.2+incompatible/mux.go","line":70,"calee":"github.com/go-chi/chi.(*Mux).ServeHTTP(0xc000095200, 0x7f4a60468068, 0xc0000a25c0, 0xc000140b00)"},{"file":"github.com/go-chi/chi@v4.1.2+incompatible/mux.go","line":298,"calee":"github.com/go-chi/chi.(*Mux).Mount.func1(0x7f4a60468068, 0xc0000a25c0, 0xc000140b00)"},{"file":"net/http/server.go","line":2012,"calee":"net/http.HandlerFunc.ServeHTTP(0xc0002ae360, 0x7f4a60468068, 0xc0000a25c0, 0xc000140b00)"},{"file":"github.com/go-chi/chi@v4.1.2+incompatible/mux.go","line":431,"calee":"github.com/go-chi/chi.(*Mux).routeHTTP(0xc0000951a0, 0x7f4a60468068, 0xc0000a25c0, 0xc000140b00)"},{"file":"net/http/server.go","line":2012,"calee":"net/http.HandlerFunc.ServeHTTP(0xc00009ac50, 0x7f4a60468068, 0xc0000a25c0, 0xc000140b00)"},{"file":"github.com/go-chi/chi@v4.1.2+incompatible/mux.go","line":70,"calee":"github.com/go-chi/chi.(*Mux).ServeHTTP(0xc0000951a0, 0x7f4a60468068, 0xc0000a25c0, 0xc000140b00)"},{"file":"github.com/go-chi/chi@v4.1.2+incompatible/mux.go","line":298,"calee":"github.com/go-chi/chi.(*Mux).Mount.func1(0x7f4a60468068, 0xc0000a25c0, 0xc000140b00)"},{"file":"net/http/server.go","line":2012,"calee":"net/http.HandlerFunc.ServeHTTP(0xc0002ae400, 0x7f4a60468068, 0xc0000a25c0, 0xc000140b00)"},{"file":"github.com/go-chi/chi@v4.1.2+incompatible/chain.go","line":31,"calee":"github.com/go-chi/chi.(*ChainHandler).ServeHTTP(0xc0002b0a40, 0x7f4a60468068, 0xc0000a25c0, 0xc000140b00)"},{"file":"github.com/go-chi/chi@v4.1.2+incompatible/mux.go","line":431,"calee":"github.com/go-chi/chi.(*Mux).routeHTTP(0xc000095080, 0x7f4a60468068, 0xc0000a25c0, 0xc000140b00)"},{"file":"net/http/server.go","line":2012,"calee":"net/http.HandlerFunc.ServeHTTP(0xc00009ac20, 0x7f4a60468068, 0xc0000a25c0, 0xc000140b00)"},{"file":"github.com/go-chi/chi@v4.1.2+incompatible/mux.go","line":70,"calee":"github.com/go-chi/chi.(*Mux).ServeHTTP(0xc000095080, 0x7f4a60468068, 0xc0000a25c0, 0xc000140b00)"},{"file":"github.com/go-chi/chi@v4.1.2+incompatible/mux.go","line":298,"calee":"github.com/go-chi/chi.(*Mux).Mount.func1(0x7f4a60468068, 0xc0000a25c0, 0xc000140b00)"},{"file":"net/http/server.go","line":2012,"calee":"net/http.HandlerFunc.ServeHTTP(0xc0002ae4a0, 0x7f4a60468068, 0xc0000a25c0, 0xc000140b00)"},{"file":"github.com/go-chi/chi@v4.1.2+incompatible/mux.go","line":431,"calee":"github.com/go-chi/chi.(*Mux).routeHTTP(0xc000095020, 0x7f4a60468068, 0xc0000a25c0, 0xc000140b00)"},{"file":"net/http/server.go","line":2012,"calee":"net/http.HandlerFunc.ServeHTTP(0xc00009ac10, 0x7f4a60468068, 0xc0000a25c0, 0xc000140b00)"},{"file":"github.com/go-ap/fedbox/app/middleware.go","line":61,"calee":"github.com/go-ap/fedbox/app.ActorFromAuthHeader.func1.1(0x7f4a60468068, 0xc0000a25c0, 0xc000140a00)"},{"file":"net/http/server.go","line":2012,"calee":"net/http.HandlerFunc.ServeHTTP(0xc0000a3000, 0x7f4a60468068, 0xc0000a25c0, 0xc000140a00)"},{"file":"github.com/go-chi/chi@v4.1.2+incompatible/middleware/get_head.go","line":37,"calee":"github.com/go-chi/chi/middleware.GetHead.func1(0x7f4a60468068, 0xc0000a25c0, 0xc000140a00)"},{"file":"net/http/server.go","line":2012,"calee":"net/http.HandlerFunc.ServeHTTP(0xc0002ae0e0, 0x7f4a60468068, 0xc0000a25c0, 0xc000140a00)"},{"file":"github.com/go-chi/chi@v4.1.2+incompatible/middleware/realip.go","line":34,"calee":"github.com/go-chi/chi/middleware.RealIP.func1(0x7f4a60468068, 0xc0000a25c0, 0xc000140a00)"},{"file":"net/http/server.go","line":2012,"calee":"net/http.HandlerFunc.ServeHTTP(0xc0002ae100, 0x7f4a60468068, 0xc0000a25c0, 0xc000140a00)"},{"file":"github.com/go-chi/chi@v4.1.2+incompatible/mux.go","line":70,"calee":"github.com/go-chi/chi.(*Mux).ServeHTTP(0xc000095020, 0x7f4a60468068, 0xc0000a25c0, 0xc000140a00)"},{"file":"github.com/go-chi/chi@v4.1.2+incompatible/mux.go","line":298,"calee":"github.com/go-chi/chi.(*Mux).Mount.func1(0x7f4a60468068, 0xc0000a25c0, 0xc000140a00)"},{"file":"net/http/server.go","line":2012,"calee":"net/http.HandlerFunc.ServeHTTP(0xc0002ae6e0, 0x7f4a60468068, 0xc0000a25c0, 0xc000140a00)"},{"file":"github.com/go-chi/chi@v4.1.2+incompatible/mux.go","line":431,"calee":"github.com/go-chi/chi.(*Mux).routeHTTP(0xc000094900, 0x7f4a60468068, 0xc0000a25c0, 0xc000140a00)"},{"file":"net/http/server.go","line":2012,"calee":"net/http.HandlerFunc.ServeHTTP(0xc00009af00, 0x7f4a60468068, 0xc0000a25c0, 0xc000140a00)"},{"file":"github.com/go-chi/chi@v4.1.2+incompatible/middleware/logger.go","line":46,"calee":"github.com/go-chi/chi/middleware.RequestLogger.func1.1(0xd417e0, 0xc0002c41c0, 0xc000252a00)"},{"file":"net/http/server.go","line":2012,"calee":"net/http.HandlerFunc.ServeHTTP(0xc0002b4f90, 0xd417e0, 0xc0002c41c0, 0xc000252a00)"},{"file":"github.com/go-chi/chi@v4.1.2+incompatible/middleware/request_id.go","line":76,"calee":"github.com/go-chi/chi/middleware.RequestID.func1(0xd417e0, 0xc0002c41c0, 0xc000252900)"},{"file":"net/http/server.go","line":2012,"calee":"net/http.HandlerFunc.ServeHTTP(0xc0002ae700, 0xd417e0, 0xc0002c41c0, 0xc000252900)"},{"file":"github.com/go-ap/fedbox/app/middleware.go","line":21,"calee":"github.com/go-ap/fedbox/app.Repo.func1.1(0xd417e0, 0xc0002c41c0, 0xc000252800)"},{"file":"net/http/server.go","line":2012,"calee":"net/http.HandlerFunc.ServeHTTP(0xc0002b4fc0, 0xd417e0, 0xc0002c41c0, 0xc000252800)"},{"file":"github.com/go-chi/chi@v4.1.2+incompatible/mux.go","line":86,"calee":"github.com/go-chi/chi.(*Mux).ServeHTTP(0xc000094900, 0xd417e0, 0xc0002c41c0, 0xc000252700)"},{"file":"net/http/server.go","line":2807,"calee":"net/http.serverHandler.ServeHTTP(0xc0002c4000, 0xd417e0, 0xc0002c41c0, 0xc000252700)"},{"file":"net/http/server.go* Connection #0 to host fedbox.local left intact
","line":1895,"calee":"net/http.(*conn).serve(0xc0002b2d20, 0xd45e20, 0xc0002b6780)"},{"file":"net/http/server.go","line":2933,"calee":"created by net/http.(*Server).Serve"}],"location":"github.com/go-ap/errors@v0.0.0-20200610194301-39b7d0cbba26/http.go:54"}]}
mariusor commented 4 years ago

What does tree /tmp/data/fedbox/dev/fedbox.local/actors/2241cb6e-c3cf-4b66-9865-dfd9ce32c531 give you[1]? If there's a __raw.json in it, could you also paste it here?

[1] Or the corresponding path outside your docker container

squash commented 4 years ago
tree /tmp/data/fedbox/dev/fedbox.local/actors/2241cb6e-c3cf-4b66-9865-dfd9ce32c531 
/tmp/data/fedbox/dev/fedbox.local/actors/2241cb6e-c3cf-4b66-9865-dfd9ce32c531
|-- __meta_data.json
`-- __raw.json

0 directories, 2 files
cat /tmp/data/fedbox/dev/fedbox.local/actors/2241cb6e-c3cf-4b66-9865-dfd9ce32c531/__raw.json     
{"id":"http://fedbox.local/actors/2241cb6e-c3cf-4b66-9865-dfd9ce32c531","type":"Application","summary":"Generated actor","attributedTo":"http://fedbox.local","audience":["https://www.w3.org/ns/activitystreams#Public"],"generator":"http://fedbox.local","url":"http://littr.brokedown.net/auth/fedbox/callback","published":"2020-07-14T15:37:33.780982396Z","updated":"2020-07-14T15:37:33.780982396Z","preferredUsername":"oauth-client-app-2241cb6e-c3cf-4b66-9865-dfd9ce32c531"}
mariusor commented 4 years ago

Hmm, I didn't think to ask, but are you using latest master with fedbox?

The structure should be something similar to this:

tree .cache/dev/fedbox.git/actors/4f449c81-1dbb-4108-b1a3-5a83926a0fbf
├── inbox
├── __meta_data.json
├── outbox
└── __raw.json 

As a workaround you can create the two folders outbox and inbox in the folder and it should work.

squash commented 4 years ago

I am up to date with the current master, yes.

After creating the inbox and ourbox files, the curl call seems to work:

{"@context":"https://www.w3.org/ns/activitystreams","id":"http://fedbox.local/actors/2241cb6e-c3cf-4b66-9865-dfd9ce32c531/outbox","type":"OrderedCollection","totalItems":0}

However the littr app calls have the same result as before.

INFO[0009] loaded account from session                  
ERRO[0009] http://fedbox.local/actors/89717cdc-c063-48be-b0a5-1e826f035659/outbox?type=Like&type=Dislike&type=Undo: Unable to load from the AP end point: invalid status 404 
ERRO[0009] Post "/outbox": unsupported protocol scheme "" 
ERRO[0009] Error: unable to save item                    before="Post \"/outbox\": unsupported protocol scheme \"\""
INFO[0009] session saved                                
INFO[0009] OK                                            duration=3.379755ms host=littr.brokedown.net https=false id=16c5aeb083ad/Et0JoycInm-000002 length=0 met=POST proto=HTTP/1.1 status=302 uri=/submit
INFO[0009] loaded account from session                  
ERRO[0009] http://fedbox.local/actors/89717cdc-c063-48be-b0a5-1e826f035659/outbox?type=Like&type=Dislike&type=Undo: Unable to load from the AP end point: invalid status 404 
INFO[0009] session saved                                
INFO[0009] OK                                            duration=8.362144ms host=littr.brokedown.net https=false id=16c5aeb083ad/Et0JoycInm-000003 length=18950 met=GET proto=HTTP/1.1 status=200 uri=/submit

I went ahead and created inbox and outbox directories in /tmp/data/fedbox/dev/fedbox.local/actors/89717cdc-c063-48be-b0a5-1e826f035659 (the created admin user's uuid) and I'm able to perform a similar curl request successfully:

{"@context":"https://www.w3.org/ns/activitystreams","id":"http://fedbox.local/actors/89717cdc-c063-48be-b0a5-1e826f035659/outbox","type":"OrderedCollection","totalItems":0}

again this didn't change the ability to add content etc via littr.

squash commented 4 years ago

fedbox log from trying to create a post after adding the inbox/outbox for the adminuser:

INFO[0669] OK                                            addr="127.0.0.1:54616" elapsed="552.251µs" id=16c5aeb083ad/VwYgi6hH97-000048 len=971 method=GET proto=HTTP/1.1 scheme=http status=200 ts="Tue, 14 Jul 2020 16:20:00 UTC" ua=littr.brokedown.net-3fa9885-git uri="http://fedbox.local/actors?name=admin&type=Person&type=Service&type=Group&type=Application&type=Organization"
ERRO[0669] Invalid bucket fedbox.local/authorize         code=FT0LkpORRo2LFxERSr7Vag
INFO[0669] OK                                            addr="127.0.0.1:54616" elapsed="539.452µs" id=16c5aeb083ad/VwYgi6hH97-000049 len=205 method=GET proto=HTTP/1.1 scheme=http status=200 ts="Tue, 14 Jul 2020 16:20:00 UTC" ua=littr.brokedown.net-3fa9885-git uri="http://fedbox.local/actors/89717cdc-c063-48be-b0a5-1e826f035659/outbox?type=Like&type=Dislike&type=Undo"
INFO[0672] OK                                            addr="127.0.0.1:54616" elapsed="531.589µs" id=16c5aeb083ad/VwYgi6hH97-000050 len=971 method=GET proto=HTTP/1.1 scheme=http status=200 ts="Tue, 14 Jul 2020 16:20:03 UTC" ua=littr.brokedown.net-3fa9885-git uri="http://fedbox.local/actors?name=admin&type=Person&type=Service&type=Group&type=Application&type=Organization"
ERRO[0672] Invalid bucket fedbox.local/authorize         code=FT0LkpORRo2LFxERSr7Vag
INFO[0672] OK                                            addr="127.0.0.1:54616" elapsed="531.587µs" id=16c5aeb083ad/VwYgi6hH97-000051 len=205 method=GET proto=HTTP/1.1 scheme=http status=200 ts="Tue, 14 Jul 2020 16:20:03 UTC" ua=littr.brokedown.net-3fa9885-git uri="http://fedbox.local/actors/89717cdc-c063-48be-b0a5-1e826f035659/outbox?type=Like&type=Dislike&type=Undo"
INFO[0672] OK                                            addr="127.0.0.1:54616" elapsed="507.021µs" id=16c5aeb083ad/VwYgi6hH97-000052 len=971 method=GET proto=HTTP/1.1 scheme=http status=200 ts="Tue, 14 Jul 2020 16:20:03 UTC" ua=littr.brokedown.net-3fa9885-git uri="http://fedbox.local/actors?name=admin&type=Person&type=Service&type=Group&type=Application&type=Organization"
ERRO[0672] Invalid bucket fedbox.local/authorize         code=FT0LkpORRo2LFxERSr7Vag
INFO[0672] OK                                            addr="127.0.0.1:54616" elapsed="520.19µs" id=16c5aeb083ad/VwYgi6hH97-000053 len=205 method=GET proto=HTTP/1.1 scheme=http status=200 ts="Tue, 14 Jul 2020 16:20:03 UTC" ua=littr.brokedown.net-3fa9885-git uri="http://fedbox.local/actors/89717cdc-c063-48be-b0a5-1e826f035659/outbox?type=Like&type=Dislike&type=Undo"
mariusor commented 4 years ago

It seems like I was looking in the wrong direction. The problem seems to be related to the boltdb oauth storage. I still can't reproduce on my end, but maybe it's related to the docker setup.

Do you have a fedbox-local-oauth-dev.bdb file in the storage path? If so, can you tell me if you can navigate inside it using muesli/thunder and if it has the authorize bucket:


[.cache/fedbox-git-oauth-dev.bdb /] # ls /
fedbox.git/
1 keys in bucket
[.cache/fedbox-git-oauth-dev.bdb /] # ls fedbox.git/
access/
authorize/
clients/
refresh/
4 keys in bucket```
squash commented 4 years ago

There is no authorize bucket:

[fedbox-local-oauth-dev.bdb /] # ls fedbox.local
access/
clients/
refresh/
3 keys in bucket

My docker container is a ubuntu:20.04 base with go1.14.4

After creating an empty authorize bucket, littr seems to fail during starting and throws 502 errors for any requests, so i've removed it again.

mariusor commented 4 years ago

Could you please try to walk me through reproducing your setup? A docker-compose file would be great, but I can try to do it manually.

I can't think why the three buckets were created but not the authorize one. :( Nevermind, see below.

mariusor commented 4 years ago

OK, the setup is not the issue. I could reproduce on my side starting everything from scratch.

I'll ping back when I have a fix.

squash commented 4 years ago

OK standing by!

mariusor commented 4 years ago

GHey @squash I pushed a new commit to fedbox, that fixes the fact that for badger, fs and pgx storage backends the OAuth2 boltdb database wasn't being properly generated.

I could test with creating the admin user from the command line, and also by registering a user from the web interface of go-littr.

Please use this last version and let me know if it fixes the problem for you.

squash commented 4 years ago

This doesn't seem to fix the issue. I've done a clean checkout and fresh build, removed my old data dir and started from scratch.

I still don't have inbox or outbox directories created for actors. the boltdb file now has an empty authorize bucket, and the littr app is still unable to create either a user or a post.

squash commented 4 years ago

i should clarify that the littr instance is still showing the same issue as the initial post, trying to do a post request without the hostname.

mariusor commented 4 years ago

So, while I explore different ways to reproduce this, could you please help me get your docker setup working on my machine?

squash commented 4 years ago

I've created a simple (sloppy, apologies) docker setup to replicate my setup, zip file attached. You'll need to edit runcontainer.sh to set your hostname/passwords and set up proxying to port 8080 yourself of course.

test.zip

mariusor commented 4 years ago

Thank you, I'm finally making some progress, but I don't have a fix yet. I'll probably come back during the w/e with a solution. (PS. Sorry for spamming, but I'm excited that people are using my thing)

squash commented 4 years ago

Great to hear, we REALLY appreciate your support with this!

mariusor commented 4 years ago

As a side-note, both fedbox and go-littr have working independent docker configurations.

There is a docker-compose setup I started on go-littr, but I got stuck at how I pass the OAUTH credentials from the fedbox container to the go-littr container environment. If you guys are interested in using docker for your setup, you can take a look at that and maybe find way to make it work. I'll gladly accept any PR in that direction.

mariusor commented 4 years ago

OK, I think my latest changes in fedbox fixed this issue. Please give it a test and let me know.

However looking at your usage for fedbox I must warn you that in order for ActivityPub service to service functionality to work (basically that's the federated part of ActivityPub) it needs to be exposed on the internet. Go-Littr is just a client for it, it doesn't really fulfill any ActivityPub related functionality.

It's true that fedbox does not federate yet, but that's one of the things that's going to change very soon. :)

squash commented 4 years ago

I can confirm that the latest updates allow me to log in, comment, register a new user, log in as them, and reply.

mariusor commented 4 years ago

Cool. I'm glad we got this sorted, thank you.