#random - September 2019

159 messages

A place for non-work-related flimflam, faffing, hodge-podge or jibber-jabber you’d prefer to keep out of more focused work-related channels.
Archive: https://archive.sweetops.com/random/

September 2019
Maciek Strömich
Maciek Strömichabout 7 years ago
https://www.youtube.com/watch?v=uDi3zqb3gAA quite old but still worth a watch about how a missing IAM key led to circleCI’s biggest security incident caused by 3rd party provider
oscar
oscarabout 7 years ago
loren
lorenabout 7 years ago(edited)
anyone use mergify? looks pretty slick... https://mergify.io/
oscar
oscarabout 7 years ago
No but have used individual things together to create a similar workflow
Maciek Strömich
Maciek Strömichabout 7 years ago
so… you still need to have tests, you still need to expose coverage, you still need to provide codestyle
Maciek Strömich
Maciek Strömichabout 7 years ago
so why not to utilize github protected branching with checks
Maciek Strömich
Maciek Strömichabout 7 years ago
run all those things in your CI and ask PR to be mergeable only after at least some number of people reviewed the change and all the created tests are passing
oscar
oscarabout 7 years ago
^ basically what I had happening.
There’s then this github tool you can use that checks if all Statuses have passed and if so merge
oscar
oscarabout 7 years ago
Seems like mergify is convenient but you sacrifice ability to perhaps use other tools?
Maciek Strömich
Maciek Strömichabout 7 years ago
for me it’s a question of do i really want another 3rd party service to access my sourcecode
Maciek Strömich
Maciek Strömichabout 7 years ago
github.com ok, my ci of choice ok, but github apps doing security scanning, some merge helper tools it’s questionable
loren
lorenabout 7 years ago(edited)
we've been using dependabot to create prs to test new versions of dependencies. it gets to be a lot of prs. the CI does run all such tests on all such PRs and marks the commit with the status, but then we still have to go in and mark it approved and merge it. just looking for a way to automate that workflow for specific conditions
loren
lorenabout 7 years ago(edited)
we mostly just have public projects, so not especially concerned about read access (they already have it). the write access required is a concern though, would be great if github had more granular repo permissions
Maciek Strömich
Maciek Strömichabout 7 years ago(edited)
a scheduled job in you ci which pulls the list of open prs and goes through them to check whether or not it was approved and merge the ones which have tests passed and been approved seems like few liner in python
Maciek Strömich
Maciek Strömichabout 7 years ago
especially that you can set github in a way that it prevents merging if a pr was not approved by a certain number of people
loren
lorenabout 7 years ago
Yeah sure, just nice to build on something used by a wider community. Decisions around config names and structures get paralyzing, and there are a lot of unknown unknowns for any one person. Having input from lots of users and use cases is huge
Maciek Strömich
Maciek Strömichabout 7 years ago
in some projects we use whitesource bolt for github to keep an eye on vulns in our dependencies, and the way they do writes to our projects is by creating PRs that are reviewed by us
johntellsall
johntellsallabout 7 years ago
Los Angeles: hi all! I hope you will join us this Wednesday at the TestableLA meetup. This time we're talking about testing Machine Learning, and testing DevOps! https://www.meetup.com/testable/events/wmkmdqyzmbpb/
Nikola Velkovski
Nikola Velkovskiabout 7 years ago
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)about 7 years ago
Hilarious
Alex Siegman
Alex Siegmanabout 7 years ago
Man, if I had an office I'd totally build daytripper~ lol
casey
caseyabout 7 years ago(edited)
Anyone have experience/know of a framework (i’m thinking of something like an API gateway) that allows you to combine responses from 2 different microservices and return to client as a unified response?

An example is having a Post microservice, and a analytics microservice.
-The post service returns post information for each post (text, author, title, description … etc)
-Analytics service has a different DB and hold analytics related info for each post, e.g. (views, likes, .. etc)

I’m looking for a way, to have a single request from a client to then request information from analytics and post service, join the responses and return to client as aggregate response

I have done some research and found KrakenD but have never heard of it before.
mrhen
mrhenabout 7 years ago
Essentially an api / endpoint that hits two different endpoints and maps the results?
casey
caseyabout 7 years ago
yeah
mrhen
mrhenabout 7 years ago
Smells more like a data mapping problem than something a whole framework would do
casey
caseyabout 7 years ago
what are common approaches to solving that problem?
mrhen
mrhenabout 7 years ago
I’ve used a few different libraries for mapping data
mrhen
mrhenabout 7 years ago
but haven’t been super happy with any of them
mrhen
mrhenabout 7 years ago
but it isn’t too hard to roll your own
casey
caseyabout 7 years ago
the simplest approach is to call analytics service from post service, but it would be slower
mrhen
mrhenabout 7 years ago
Well, that’s kind of an interesting question. Is this “middle” layer part of one of the other microservices or is it its own service?
mrhen
mrhenabout 7 years ago(edited)
The other question worth asking is why not have the client send two API calls?
casey
caseyabout 7 years ago
^^ true
mrhen
mrhenabout 7 years ago
what language or API framework do the microservices currently use?
casey
caseyabout 7 years ago
what do you mean middle layer?
mrhen
mrhenabout 7 years ago
client -> middle -> Post, Analytics
mrhen
mrhenabout 7 years ago
the client has to hit some api
casey
caseyabout 7 years ago
okay gotcha
mrhen
mrhenabout 7 years ago
It sounds like that API should hit the other two APIs
casey
caseyabout 7 years ago
the frameworks we currently have are java/spring-boot and python/django
mrhen
mrhenabout 7 years ago
so, Django Rest Framework has pretty good mapping support
mrhen
mrhenabout 7 years ago
it can get pretty complicated though
mrhen
mrhenabout 7 years ago
but I’ve set up “remote api” serializers using it
mrhen
mrhenabout 7 years ago
so client -> API 1 -> API 2
mrhen
mrhenabout 7 years ago
we used it to migrate the client over to API 2 with no disruption
mrhen
mrhenabout 7 years ago
but you could use it to do what you are talking about
mrhen
mrhenabout 7 years ago
it’s not out of the box, though
casey
caseyabout 7 years ago
so in your example above, all requests go through API 1 ?
mrhen
mrhenabout 7 years ago
yeah
mrhen
mrhenabout 7 years ago
your example would add a second call
mrhen
mrhenabout 7 years ago
client -> API 1 -> API 2 + API 3
mrhen
mrhenabout 7 years ago
where API 1 is calling both 2 and 3
casey
caseyabout 7 years ago
and then join everything together in API 1?
mrhen
mrhenabout 7 years ago
yeah
mrhen
mrhenabout 7 years ago
that’s a way to do it
mrhen
mrhenabout 7 years ago
but it worked well enough
mrhen
mrhenabout 7 years ago
can you see that link?
mrhen
mrhenabout 7 years ago
that’s the code we used for the the base remote serializer
mrhen
mrhenabout 7 years ago
that works with Django Rest Framework
casey
caseyabout 7 years ago
yeah i see that, thank you
mrhen
mrhenabout 7 years ago
but if you aren’t used to DRF
mrhen
mrhenabout 7 years ago
it might not be obvious how to get it all hooked up
mrhen
mrhenabout 7 years ago
but you can see the AuthClient bit at the top
mrhen
mrhenabout 7 years ago
that is API 1's interaction class for talking to API 2
casey
caseyabout 7 years ago
ah I see
casey
caseyabout 7 years ago
does managing api changes become difficult?
mrhen
mrhenabout 7 years ago
yes
mrhen
mrhenabout 7 years ago
you are explicitly coupling API 1 to API 2 and 3
mrhen
mrhenabout 7 years ago
and the the client gets coupled to API 1
mrhen
mrhenabout 7 years ago
so going back to asking the question, why not two calls?
casey
caseyabout 7 years ago
i dont know
mrhen
mrhenabout 7 years ago
if the client already knows about API 2 and 3
casey
caseyabout 7 years ago
i didnt think of that
mrhen
mrhenabout 7 years ago
then it probably isn’t worth it to try and combine the calls
mrhen
mrhenabout 7 years ago
unless you are making thousands of them a minute
mrhen
mrhenabout 7 years ago
here’s how you’d end up using the RemoteSerializer: https://gist.github.com/MrHen/6e96f2aa2729446c15ed4ef4189a087b#file-serializers-py
casey
caseyabout 7 years ago
okay so maybe some background. We are somewhat in the phase of migrating to microservices. So authentication is handled by one of those microservices. In the case of 2 requests would we have to have a centralized authentication?
mrhen
mrhenabout 7 years ago
ah, yeah, okay
mrhen
mrhenabout 7 years ago
so you’ll probably want to add the auth calls
mrhen
mrhenabout 7 years ago
directly to the previously existing api
mrhen
mrhenabout 7 years ago
and then once hte auth microservice is up and running
mrhen
mrhenabout 7 years ago
switch the client to hit the auth service
mrhen
mrhenabout 7 years ago
then remove the call between the existing api and the auth service
mrhen
mrhenabout 7 years ago
but if you need to do backend permissions / validation
mrhen
mrhenabout 7 years ago
you might always have a call between the existing api and the auth service
mrhen
mrhenabout 7 years ago
it really depends on the details
mrhen
mrhenabout 7 years ago
but I would say that the end shape should probably be the client making two calls
mrhen
mrhenabout 7 years ago
but that’s just my opinion
mrhen
mrhenabout 7 years ago
we recently made the exact same change in our platform
mrhen
mrhenabout 7 years ago
the RemoteSerializer from above was used to start migrating calls over to the new api
casey
caseyabout 7 years ago(edited)
okay so youre saying, (I’m assuming there are 2 APIs: API1 and API2) if API1 handles authentication and API2 does not, then call the auth endpoints from API2 -> API1 when receiving request on API2
casey
caseyabout 7 years ago
?
casey
caseyabout 7 years ago(edited)
and if authentication is separated into its own service then API1 would call auth service (API3) and API2 would also call auth service(API3)
mrhen
mrhenabout 7 years ago
yeah, something like that
mrhen
mrhenabout 7 years ago
the details vary case by case
mrhen
mrhenabout 7 years ago
but hopefully that helps a bit
mrhen
mrhenabout 7 years ago
I don’t know that you are going to find a dedicated backend framework that will hook all this up
mrhen
mrhenabout 7 years ago
I do know that Django has some remote auth functionality
casey
caseyabout 7 years ago
Well i found KrakenD which seems to aggregate responses from multiple services
casey
caseyabout 7 years ago
and using a config file for rules
casey
caseyabout 7 years ago
have you ever heard of that?
mrhen
mrhenabout 7 years ago
I haven’t
casey
caseyabout 7 years ago
and also yes, this is very helpful. Thanks
mrhen
mrhenabout 7 years ago
oh, actually, I have seen some stuff like this
mrhen
mrhenabout 7 years ago
usually it’s integrating with external apis
mrhen
mrhenabout 7 years ago
KrakenD seems kind of interesting
mrhen
mrhenabout 7 years ago
I’m not sure I’d want to bake in that dependency though
casey
caseyabout 7 years ago(edited)
yeah it seems to do exactly what I want, but i’m worried it could stop being developed
mrhen
mrhenabout 7 years ago
yeah, tough call
casey
caseyabout 7 years ago
like this is the main functionality i really like about it
casey
caseyabout 7 years ago
mrhen
mrhenabout 7 years ago
yeah, looks kind of interesting
mrhen
mrhenabout 7 years ago
I think people tend to be a little too eager to combine api calls, though
mrhen
mrhenabout 7 years ago
I think making multiple calls can be totally fine
mrhen
mrhenabout 7 years ago
it depends on the situation
mrhen
mrhenabout 7 years ago(edited)
the best argument for combining calls is related to things like VPCs or protected / hidden endpoints
mrhen
mrhenabout 7 years ago(edited)
the best argument against combining calls is that a change to API A will require a change to the client and your KrakenD config
casey
caseyabout 7 years ago
here is the exact situation, which maybe would make sense for a combined call or not. Let me know what you think.

- request to API1 get most recent posts (so you dont know postIds when making initial call from client)
- client has to wait for response (post Ids) from API1 in order to make the call to API2
casey
caseyabout 7 years ago
I do like the 2 requests approach though…. I just dont want it to be too slow
mrhen
mrhenabout 7 years ago
it won’t be slower than combining the two calls
mrhen
mrhenabout 7 years ago
since both calls still have to happen
mrhen
mrhenabout 7 years ago
do you send a single request to API 2 with the post ids?
mrhen
mrhenabout 7 years ago
or are you looping over each post id and calling API 2 for each id?
casey
caseyabout 7 years ago
yeah single request
casey
caseyabout 7 years ago
but when combining you could do them asynchrounously
casey
caseyabout 7 years ago
i guess not a huge gain
mrhen
mrhenabout 7 years ago
you still need the post ids for the second call, right?
casey
caseyabout 7 years ago
yeah you needs post ids for second call
mrhen
mrhenabout 7 years ago
so you still have to wait for the post ids to “resolve”
mrhen
mrhenabout 7 years ago
which is going to be the longest part of the call
casey
caseyabout 7 years ago
ahh yeah youre right
mrhen
mrhenabout 7 years ago
I’d start by trying two calls from the client
mrhen
mrhenabout 7 years ago
and measure how long it takes
mrhen
mrhenabout 7 years ago
since it would be the simplest approach
casey
caseyabout 7 years ago
Awesome, yeah i’m going to start with that.
mrhen
mrhenabout 7 years ago
and if you run into trouble, you’ve already got a couple good options as backup
casey
caseyabout 7 years ago
thanks for your help
mrhen
mrhenabout 7 years ago
no problem!
mrhen
mrhenabout 7 years ago
good luck!
casey
caseyabout 7 years ago
thanks!!
jetstreamin
jetstreaminabout 7 years ago
anyone ever try this out?
jetstreamin
jetstreaminabout 7 years ago
jetstreamin
jetstreaminabout 7 years ago
I like what they are preaching over there
jetstreamin
jetstreaminabout 7 years ago
the docs are amazing, https://vertx.io/docs/
Andrew Roth
Andrew Rothabout 7 years ago
Just in case even 1 person in the 1,411 people here don't know it: Python 2 end of life is January 1.

Tell your friends. Tell your coworkers at the water cooler. Tell your mailman. Tell your customer you've had for 10 years who doesn't want to change anything. Tell your dog 🐶.

Friends don't let friends use python 2.

https://www.python.org/doc/sunset-python-2/

https://pythonclock.org/
Doug Farrell
Doug Farrellabout 7 years ago
@Doug Farrell has joined the channel
Rajesh Babu Gangula
Rajesh Babu Gangulaabout 7 years ago
@Rajesh Babu Gangula has joined the channel
Sebastian Cavedale
Sebastian Cavedaleabout 7 years ago
@Sebastian Cavedale has joined the channel
jacob
jacobabout 7 years ago
@jacob has joined the channel
Nick S
Nick Sabout 7 years ago
@Nick S has joined the channel
Daniel Õbrink
Daniel Õbrinkabout 7 years ago
@Daniel Õbrink has joined the channel
Corey Carvalho
Corey Carvalhoabout 7 years ago
@Corey Carvalho has joined the channel
Manuel Urbano
Manuel Urbanoabout 7 years ago
@Manuel Urbano has joined the channel
Walter Heck
Walter Heckabout 7 years ago
@Walter Heck has joined the channel
Ognen Mitev
Ognen Mitevabout 7 years ago
@Ognen Mitev has joined the channel
Dipesh Patel
Dipesh Patelabout 7 years ago
@Dipesh Patel has joined the channel