-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
add featureflag service (Erlang/Elixir) #142
add featureflag service (Erlang/Elixir) #142
Conversation
I was going to remove the create, update, list and delete flag rpc's from the service but I wanted to first check if there was any reason a service that uses feature flags might need to do something besides fetching the flag status? For now those rpc's just return "unimplemented" but could be implemented easy enough, and the creation and updating of the flags must be done through the web interface. The web pages are just the default generated CRUD pages for a Phoenix project and should be re-styled to match the rest of the demo. I'm going to see if anyone in the Erlang/Elixir SIG wants to help, otherwise I'll get around to it at some point. It took a while to find time to do this much and the majority of it is generated :) |
f759a30
to
be6ec3b
Compare
HTTP interface is on port FEATURE_FLAG_SERVICE_PORT and the grpc service is run on FEATURE_FLAG_GRPC_SERVICE_PORT. Creating and updating flags is done through the web interface. The GRPC service only provides fetching of a flag by name.
be6ec3b
to
7e9b57d
Compare
I can't think of a reason that an existing application might want to modify via RPC. That said, I can see a world where we want to provision flags at runtime/build time... although, in that case it'd make more sense to do so via the DB init script. |
@tsloughter I can't build the image to test locally. I've played a bit just to try to see if the I've stopped the docker build at this step and exec into it to do some digging, and it seems that the Do we need any extra steps in the Dockerfile? |
@julianocosta89 ok, I'll try blowing away everything not committed to git and see if it fails for me and will debug from there. |
Woops, yup, |
I don't understand why it doesn't show up in git's list of untracked files... That is why I missed it. I recreated it and still doesn't show up. |
Ah. the top level |
It should work now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! builds + runs in codespaces. I went ahead and added an external port binding to the web UI for the flag service to make it more easily accessible -- we should consider putting this behind auth once that's available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good and thanks!!
It does feel like this service is quite a lot of files and maybe has some extra complexity that we can see about simplifying in the future.
@@ -55,7 +55,7 @@ def sanitycheck(pattern, allow_utf8 = False, allow_eol = (CRLF, LF), indent = 1) | |||
if c != 32: | |||
break | |||
spc_count += 1 | |||
if not indent or spc_count % indent: | |||
if not indent or (spc_count % indent and os.path.basename(filename) != 'rebar.config'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a better way to ignore files for the sanitycheck.py
script?
@@ -0,0 +1,45 @@ | |||
# This file excludes paths from the Docker build context. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to self: Review this
@@ -0,0 +1,37 @@ | |||
# The directory Mix will write compiled artifacts to. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add to top-level .gitignore
file instead
Then start Postgres with `docker compose` | ||
|
||
``` shell | ||
docker compose up |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docker compose up ffs_postgres
?
defmodule Featureflagservice.Mailer do | ||
use Swoosh.Mailer, otp_app: :featureflagservice | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Necessity?
@@ -0,0 +1,70 @@ | |||
// Licensed under the Apache License, Version 2.0 (the "License"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally this file will not be copied/duplicated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup. Issue is simply that the tool used to generate the proto modules has no option for only generating certain services or messages. I plan to remove this and use the top level demo.proto
once that is resolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tool used to generate is the normal protocol buffer compiler protoc
from Google right?
Are they adding that functionality?! That's cool and we'd likely make use in other services here too!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, na. Though I assumed protoc already supported that, haha, I've run into this enough I'm surprised. It uses https://github.com/tomas-abrahamsson/gpb/ through the plugin for grpc generation, https://github.com/tsloughter/grpcbox_plugin/
Ideally I could get gpb to also only create the encode/decode for the messages the services I need depend on, but I can at least pretty quickly have the grpc plugin only generate the service modules for the featureflag service.
@@ -0,0 +1,3 @@ | |||
#!/bin/sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are these scripts in the rel/overlays
directory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These scripts are what are used to start the Release. See the command at the end of the dockerfile. Which I now see uses CMD
instead of ENTRYPOINT
for some reason... may change that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, nm, I bet they use CMD
because the wrapper script always runs start
, so no use doing a separate entrypoint and cmd like I am used to in Erlang Releases.
%% @end | ||
%%%------------------------------------------------------------------- | ||
|
||
%% this module was generated and should not be modified manually |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^
@mic-max yup, there is a lot of extra stuff. I'm hoping to get someone who actually works with the Phoenix framework to take on removing what is unncessary (like the swoosh mail module you point out, the topbar.js, etc). I can certainly do it, but I'll miss stuff, or be spending time on trial and error removal :). I'll try again to get someone to work on this and if I don't get anyone this week I'll start whittling away. I'll comment individually on the other questions you raised. |
* add featureflag service (Erlang/Elixir) HTTP interface is on port FEATURE_FLAG_SERVICE_PORT and the grpc service is run on FEATURE_FLAG_GRPC_SERVICE_PORT. Creating and updating flags is done through the web interface. The GRPC service only provides fetching of a flag by name. * ignore space indent count if file is rebar.config * featureflagservice: add release directory to git * featureflagservice: include vendored js in git repo * Update docker-compose.yml Co-authored-by: Austin Parker <[email protected]>
* add featureflag service (Erlang/Elixir) HTTP interface is on port FEATURE_FLAG_SERVICE_PORT and the grpc service is run on FEATURE_FLAG_GRPC_SERVICE_PORT. Creating and updating flags is done through the web interface. The GRPC service only provides fetching of a flag by name. * ignore space indent count if file is rebar.config * featureflagservice: add release directory to git * featureflagservice: include vendored js in git repo * Update docker-compose.yml Co-authored-by: Austin Parker <[email protected]>
HTTP interface is on port FEATURE_FLAG_SERVICE_PORT and
the grpc service is run on FEATURE_FLAG_GRPC_SERVICE_PORT.
Creating and updating flags is done through the web interface.
The GRPC service only provides fetching of a flag by name.
Fixes #40
Changes
Please provide a brief description of the changes here.
For significant contributions please make sure you have completed the following items:
CHANGELOG.md
updated for non-trivial changes