Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

Instructions on how to install this with docker? #27

Open
logicalup opened this issue Jun 8, 2018 · 13 comments
Open

Instructions on how to install this with docker? #27

logicalup opened this issue Jun 8, 2018 · 13 comments

Comments

@logicalup
Copy link

Hi I followed the instructions on how to setup sentry from here:
https://github.com/getsentry/onpremise
And figured out that for email to work i need to add environment variables to the docker-compose.yml file. But just adding GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET to the same place does not work.

Do I need to download something somewhere? Or run the pip command inside a container? or how do I install it?

@logicalup
Copy link
Author

logicalup commented Jun 12, 2018

  • tried manually installing inside web container
  • tried adding inside sentry.config.py
  • tried adding RUN pip install command and COPY sentry.config.py commands inside Dockerfile
  • tried searching on google, sentry docs, asking on irc #sentry
  • tried adding to requirements file
  • tried using GOOGLE_OAUTH2_CLIENT_ID and GOOGLE_OAUTH2_CLIENT_SECRET

No luck so far. All I get is "No authentication providers are available.". The python install of Sentry is deprecated, but the Docker install doesn't seem to support this plugin. Also the official list of plugins doesn't list this one, nor does this plugin come preinstalled like others. A little instruction would go a long way.

@logicalup
Copy link
Author

logicalup commented Jun 13, 2018

Update: See this #27 (comment) for version 9.1.1

Ok I figured it out (hopefully this helps someone who is looking for docker install instructions):
After installing sentry onpremise (using docker) and it's working, to install this plugin I had to do the following (on host, not containers):
1. Add the following line to requirements.txt:
https://github.com/getsentry/sentry-auth-google/archive/52020f577f587595fea55f5d05520f1473deaad1.zip (just master didn't work)
2. Add the following two lines in docker-compose.yml under services: base: environment:
GOOGLE_CLIENT_ID: <your id from your google project>
GOOGLE_CLIENT_SECRET: <your secret from your google project>
3. Add the following code at the end of sentry.conf.py file:

if 'GOOGLE_CLIENT_ID' in os.environ:
    GOOGLE_CLIENT_ID = env('GOOGLE_CLIENT_ID')
    GOOGLE_CLIENT_SECRET = env('GOOGLE_CLIENT_SECRET')

4. Run the following 3 commands:
docker-compose down
docker-compose build (just trying make build did not work)
docker-compose up -d

@logicalup logicalup reopened this Jun 13, 2018
@logicalup
Copy link
Author

can we maybe update readme?

@jeeshofone
Copy link

yes, please update the readme. This worked for me too!

Thank you, @DevJackSmith!

@logicalup
Copy link
Author

logicalup commented Apr 23, 2019

in the newest version (9.1.1) the above solution will give you a warning. Instead, I added the following to sentry.conf.py

SENTRY_OPTIONS['auth-google.client-id'] = 'your_own_client_id_here'
SENTRY_OPTIONS['auth-google.client-secret'] = 'your_own_client_secret_here'

@silvez-dh
Copy link

For me on 9.1.0 only worked when i set on config.py:

GOOGLE_CLIENT_ID = env('GOOGLE_CLIENT_ID')
GOOGLE_CLIENT_SECRET = env('GOOGLE_CLIENT_SECRET')

@caseyduquettesc
Copy link

9.1.x using the sentry-onbuild docker image -

# Google Single Sign On
SENTRY_OPTIONS['auth-google.client-id']  = env('GOOGLE_CLIENT_ID')
SENTRY_OPTIONS['auth-google.client-secret'] = env('GOOGLE_CLIENT_SECRET')

It's DevJackSmith's solution, but passed in with environment variables.

@caseyduquettesc
Copy link

Oddly, if I install both sentry-auth-google==0.2.0 and sentry-plugins==9.1.1, then the SENTRY_OPTIONS solution no longer works, resulting in a "Missing client id" error on the Google sign in page.

After giving up trying to deduce the conflict, I started doing some trial and error. Oddly, the original instructions in the readme are the only ones that worked, meaning set GOOGLE_CLIENT_ID.

I am not sure why installing sentry-plugins voided my configuration (or maybe some would call this making it work?), but this is what I ended up using to cover all my bases with or without sentry-plugins:

# Google Single Sign On
GOOGLE_OAUTH2_CLIENT_ID = env('GOOGLE_CLIENT_ID')
GOOGLE_OAUTH2_CLIENT_SECRET = env('GOOGLE_CLIENT_SECRET')
GOOGLE_CLIENT_ID = GOOGLE_OAUTH2_CLIENT_ID
GOOGLE_CLIENT_SECRET = GOOGLE_OAUTH2_CLIENT_SECRET
SENTRY_OPTIONS['auth-google.client-id'] = GOOGLE_OAUTH2_CLIENT_ID
SENTRY_OPTIONS['auth-google.client-secret'] = GOOGLE_OAUTH2_CLIENT_SECRET

@logicalup
Copy link
Author

logicalup commented May 9, 2019

i think sentry plugins now includes google auth. So no need to install them separately. (You probably don't need 2 middle lines. The two top lines are just passing it from the environment variables into local variables and then again into local SENTRY_OPTIONS variables, so you might simplify it with just the two lines like this https://github.com/getsentry/sentry-auth-google#issuecomment-490260014 and it should still function just fine.

If readme instructions work, i'm all for closing this issue. Can someone else confirm the readme instructions work for them now?

@caseyduquettesc
Copy link

Does the plugin package include google auth? I didn't see it here https://github.com/getsentry/sentry-plugins/tree/master/src/sentry_plugins

If it's in there though, I have no problem uninstalling this package. Last I heard though, they hadn't merged the auth plugins with the rest of the plugins. I don't recall which thread I saw it in, but it sounded like the team hadn't gotten around to merging them yet.

Though what you're saying is the only answer that makes sense why installing sentry-plugins changes the behavior of sentry-auth-google.

@logicalup
Copy link
Author

You are right, i don't know if google-auth is included in sentry-plugins now, i just assumed it was since I had to remove the zip url from requirements.txt file, and I created the server from scratch without it. So it must be in there somewhere unless I missed something.

@gordcorp
Copy link

FYI I happened to see this plugin is now included in sentry core now @DevJackSmith @caseyduquettesc getsentry/sentry#11769

@okainov
Copy link

okainov commented Jul 16, 2019

I gave up... This masterpiece does not work at all. Took gitlab SSO instead https://github.com/SkyLothar/sentry-auth-gitlab which had zero update since two years and it worked out-of-the box instantly.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants