Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deployment #211

Closed
samhstn opened this issue Aug 4, 2017 · 28 comments
Closed

Deployment #211

samhstn opened this issue Aug 4, 2017 · 28 comments

Comments

@samhstn
Copy link
Member

samhstn commented Aug 4, 2017

We will need to run the seed file on heroku when deploying and simultaneously set up webhooks on all dwyl repos.

All the logic for this has been built and tested as of #201

@samhstn
Copy link
Member Author

samhstn commented Aug 6, 2017

Will also need to ensure to clean up webhooks attached to repos and ensure there is space for the new ones

@samhstn
Copy link
Member Author

samhstn commented Aug 8, 2017

@nelsonic should we deploy now to be able to use the app or should we wait for #197 (comment) to be addressed (it will still be very useable without this)?

@iteles
Copy link
Member

iteles commented Aug 18, 2017

@Shouston3 Yes, let's definitely deploy what we have please 😊
Can't do internal user testing without it!
Can we simultaneously also update the readme to explain the current limitations and refer to the issues?

@iteles iteles assigned samhstn and unassigned nelsonic Aug 18, 2017
@samhstn
Copy link
Member Author

samhstn commented Aug 18, 2017

Will do 👍

@samhstn samhstn assigned Jbarget and unassigned samhstn Aug 18, 2017
@samhstn
Copy link
Member Author

samhstn commented Aug 18, 2017

@Jbarget has made progress with the deployment. Just need to remove the other hooks on the dwyl repos and run the seed file with the new hooks

@samhstn
Copy link
Member Author

samhstn commented Aug 29, 2017

@ZooeyMiller @finnhodgkin Steps to deploy the app are roughly as follows:

You'll first need to run some things from the IEx shell (iex -S mix) locally, run something like

alias Tudo.{GithubApi, Hook}
"dwyl" |> GithubApi.get_repos |> Enum.filter(some_filter) |>  Hook.delete(some_url)

Essentially remove all the webhooks that are pointing at a ngrok server and instead add hooks that point to the heroku app instead.
Check out how to do that in this file: https://github.com/dwyl/tudo/blob/master/web/github/hook.ex
and here: https://github.com/dwyl/tudo/blob/master/web/github/github_api.ex#L43
Also when you manage that, could you update the readme with how to do this #213

Let me know how you get on and post any questions here if they pop up

@finnhodgkin
Copy link
Collaborator

Thanks Sam, sounds clear enough! We'll have a go now 👍

@samhstn
Copy link
Member Author

samhstn commented Aug 29, 2017

From this question:

We tried accessing it using the env variables saved on the heroku app but they're
giving us non-responses from github
({"documentation_url", "https://developer.github.com/v3"}).
Maybe we're doing something else wrong, or the heroku setup is out of date.
Should we just make our own temporary ones (didn't seem to work) or
are there some working env vars with appropriate permissions?

You might need to ensure that your github account has the appropriate access and that your personal access token also has the appropriate access.

Can you provide example requests that you are sending which should be working, but aren't. E.g.

curl https://api.github.com/orgs/dwyl/repos\?page_results\=100\&page\=2 # gives us 404 ?

@finnhodgkin
Copy link
Collaborator

Pretty sure the Heroku access_token has been revoked and Zooey and I don't have permissions for dwyl github things.

It works perfectly on my own repos 👍

@samhstn
Copy link
Member Author

samhstn commented Aug 29, 2017

I see, you'll need to get 2 factor auth and approved by @iteles or @nelsonic to be allowed to have write access to dwyl repos. I'll share one of my pa keys for now so you can continue.

@samhstn
Copy link
Member Author

samhstn commented Aug 30, 2017

It does seem like a permissions issue as for the repositories which I am getting this response

screen shot 2017-08-30 at 14 00 21

I also don't have a settings tab in the github navbar.

screen shot 2017-08-30 at 14 01 55

Whereas I have a settings bar for repos which I can access the webhooks for.

One strange thing is that we are getting a 404 error and not 401 unauthorised error

@nelsonic @iteles @markwilliamfirth could one of you try sending the exact same postman request but with your username and personal access token as the password and see if you get a different response (or anyone else with admin access or a settings tab on dwyl/learn-tdd @SimonLab?).

@samhstn samhstn assigned nelsonic, iteles and ghost and unassigned ZooeyMiller and finnhodgkin Aug 30, 2017
@samhstn
Copy link
Member Author

samhstn commented Aug 30, 2017

Nice spot btw @finnhodgkin @ZooeyMiller

@Danwhy
Copy link
Member

Danwhy commented Nov 10, 2017

It looks like webhooks need admin access to repos: https://developer.github.com/v3/orgs/hooks/, and it also looks like the core dwyl team doesn't have admin access to all repos: https://github.com/orgs/dwyl/teams/core/repositories. This would make sense of the problems @finnhodgkin was having (the core team only have write access to learn-tdd and learn-tape, but admin access tolearn-redux).

So to fix this permissions issue we'd need to use an access token from either an owner of the dwyl organisation, or somebody with admin access to all of the repos

@iteles
Copy link
Member

iteles commented Nov 10, 2017

Thanks for the summary @Danwhy! Agreed that an owner token probably makes more sense as Nelson and I for example will (hopefully) be a constant and we won't need to keep swapping them around. Let's work to get you what you need (as long as we limit the access to the minimum set and if tudo is hacked they can't go deleting all our repos)!

@iteles iteles unassigned nelsonic and ghost Nov 10, 2017
@iteles
Copy link
Member

iteles commented Nov 10, 2017

Done for the following & sent to @Danwhy :
screen shot 2017-11-10 at 12 11 08

@iteles iteles assigned Danwhy and unassigned iteles Nov 10, 2017
@Danwhy
Copy link
Member

Danwhy commented Nov 10, 2017

I think we'd just need access to repo hooks and org hooks. That shouldn't be a security issue as webhooks just send information to us, and don't allow any write access.

@Shouston3, @finnhodgkin, @ZooeyMiller, @Jbarget Can you confirm those are the only permissions we need?

@samhstn
Copy link
Member Author

samhstn commented Nov 10, 2017

@Danwhy I think those permissions will be all we need

@iteles
Copy link
Member

iteles commented Nov 10, 2017

Thank you both! (hai @Shouston3 👋 Hope you're well!)

@Danwhy
Copy link
Member

Danwhy commented Nov 10, 2017

All current repos now have the webhook attached to them, and the database should be completely up to date with all of the current issues

@Danwhy Danwhy removed their assignment Nov 10, 2017
@samhstn
Copy link
Member Author

samhstn commented Nov 11, 2017

All looking deployed to me, nice @Danwhy 👍

Tested on https://tudo-app.herokuapp.com

@samhstn samhstn closed this as completed Nov 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants