vmware-archive / postfacto

Self-hosted retro tool aimed at helping remote teams
GNU Affero General Public License v3.0
9 stars 23 forks source link

Google OAuth local development needs documentation #63

Open sshariff01 opened 6 years ago

sshariff01 commented 6 years ago

I can't seem to get it running, tried running it directly on my machine, as well as on docker (exposing -p 3000:3000 -p 4000:4000).

Initially, it appeared that the web socket connection failed to establish. However, upon closer inspection I saw this in my browser (Google Chrome)'s console log:

GET https://freegeoip.net/json/ 403 ()
Failed to load https://freegeoip.net/json/: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:3000' is therefore not allowed access. The response had HTTP status code 403. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

I removed the call to freegeoip and was able to actually get the server to render a page. However, it just renders a page that looks like the one attached, and I can't actually create a retro board or do anything.

postfacto-help-screen

Update: I believe it is in fact running. I was able to run the server separately by removing api-server from the local-run gulp task, and then doing:

  1. ./run.sh
  2. bundle exec rails s -b 0.0.0.0 -p 4000 in an adjacent tmux window

I still can't actually do anything, any of the routes I try (grabbed from the React router.js file), I am redirected to the home page, which looks like what is in the above screenshot.

I believe what's missing is an access token, as per: https://github.com/Pivotal/postfacto/blob/master/web/app/components/router.js#L186

which I don't understand how to obtain.

Any help would be immensely appreciated.

sshariff01 commented 6 years ago

Sheesh, I got it working. Ultimately it was failing because there isn't really a fake local Google OAuth that works for this (at least I couldn't get it to work that way). I had to:

  1. Create an actual project in my Google account, register it for OAuth, grab the clientId, pop it into in development.json, i.e.
google_oauth_client_id: <Client ID from Google>
  1. Hardcode this value to false: https://github.com/Pivotal/postfacto/blob/master/web/server/react-server.js#L51

Then a "Sign in with Google" button appears on the home page from which I can sign in.

  1. Add config.action_controller.allow_forgery_protection = false to my Rails config/environments/development.rb file

And then it works.

This is far from ideal. I'd love to learn the more correct way to get this working locally.

leungandrew commented 6 years ago

Take a look at https://github.com/Pivotal/postfacto/blob/master/DEPLOYMENT.md#optional-setup for setting up Google OAuth. For those that don't want to have Google OAuth setup, you can use the Rails admin portal to create retros. Google OAuth is off by default.

seadowg commented 6 years ago

@sshariff01 sorry for this being confusing. We've focused on getting docs up to date for people installing and setting up their own instances and so the documentation on local development is pretty lax right now. You can set it up to do "mock" google auth locally and I'll leave this open until we've documented that.

Good to clarify though that Google OAuth is now an optional feature (as @leungandrew points out). The default is to have retros created through the admin interface.

sshariff01 commented 6 years ago

I decided to try pushing it to PWS and see how it works there. The /admin endpoint doesn't appear to work there either. How do I access the admin portal?

screen shot 2018-07-11 at 7 49 02 pm
seadowg commented 6 years ago

The admin interface is available at your-api-url/admin not at the the front end. This is specified in the setup instructions ( https://github.com/Pivotal/postfacto/blob/master/deployment/INSTRUCTIONS.md) that come with the release.

We definitely could in the future have it forward from that URL to the backend though to make it more discoverable.

On Thu, 12 Jul 2018, 03:49 Shoabe Shariff, notifications@github.com wrote:

I decided to try pushing it to PWS and see how it works there. The /admin endpoint doesn't appear to work there either. How do I access the admin portal?

[image: screen shot 2018-07-11 at 7 49 02 pm] https://user-images.githubusercontent.com/2038511/42609846-81f01f0c-8543-11e8-8a10-4cffdba2457a.png

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/Pivotal/postfacto/issues/63#issuecomment-404372698, or mute the thread https://github.com/notifications/unsubscribe-auth/AAh8-B5GnCsjzuBq5scMuWHeN_Xj-eY-ks5uFrk0gaJpZM4VFxsh .

sshariff01 commented 6 years ago

I see. My bad. Thanks 😳.