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

Continuing cleanup for newer OTP's #22

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,14 @@ ENV COOKIE=service_discovery \
RELX_OUT_FILE_PATH=/tmp \
# service_discovery specific env variables to act as defaults
DB_HOST=127.0.0.1 \
LOGGER_LEVEL=debug \
SCHEDULERS=1
LOGGER_LEVEL=debug

RUN rm -f /etc/apt/apt.conf.d/docker-clean

# openssl needed by the crypto app
RUN --mount=target=/var/lib/apt/lists,id=apt-lists,type=cache,sharing=locked \
--mount=type=cache,id=apt,sharing=locked,target=/var/cache/apt \
apt install --no-install-recommends -y openssl ncurses-bin
apt update && apt install --no-install-recommends -y openssl ncurses-bin

COPY --from=releaser /opt/rel .

Expand Down
9 changes: 1 addition & 8 deletions apps/service_discovery_http/src/sdh_handler.erl
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,8 @@
handle(Req, _Args) ->
handle(Req#req.method, elli_request:path(Req), Req).

handle('GET', [<<"healthz">>], _Req) ->
{ok, [], <<>>};
handle('GET', [<<"ready">>], _Req) ->
case service_discovery_http_app:is_shutting_down() of
true ->
{503, [], <<>>};
_ ->
{ok, [], <<>>}
end;
{ok, [], <<>>};

handle('GET', [<<"services">>], Req) ->
Services = service_discovery:list(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
service_discovery,
jsx,
acceptor_pool,
elli
elli,
uuid
]},
{env,[]},
{modules, []},
Expand Down
11 changes: 0 additions & 11 deletions apps/service_discovery_http/src/service_discovery_http_app.erl
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,12 @@
-behavior(application).

-export([start/2,
prep_stop/1,
stop/1]).

-export([is_shutting_down/0]).

-define(IS_SHUTTING_DOWN, {?MODULE, is_shutting_down}).

start(_, _) ->
Env = application:get_all_env(service_discovery_http),
service_discovery_http_sup:start_link(Env).

prep_stop(State) ->
persistent_term:put(?IS_SHUTTING_DOWN, true),
State.

stop(_) ->
ok.

is_shutting_down() ->
persistent_term:get(?IS_SHUTTING_DOWN, false).
2 changes: 0 additions & 2 deletions config/dev_sys.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
password => "password",
database => "discovery"}}]},


{service_discovery_grpc,
[{server, #{grpc_opts => #{service_protos => [sdg_discovery_pb,
grpcbox_health_pb,
Expand All @@ -20,7 +19,6 @@
listen_opts => #{port => 8081,
ip => {0,0,0,0}}}}]},


{erldns,
[%% DB Config
{storage,
Expand Down
2 changes: 0 additions & 2 deletions config/dev_vm.args
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

-setcookie service_discovery_cookie

+S 1

+C multi_time_warp

+sbwt none
Expand Down
19 changes: 10 additions & 9 deletions config/sys.config.src
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@
user => "discovery",
password => "password",
database => "discovery"}}]},

{service_discovery_grpc,
[{server, #{grpc_opts => #{service_protos => [sdg_discovery_pb,
grpcbox_health_pb,
grpcbox_reflection_pb],
services => #{'sd.DiscoveryService' => sdg_service,
'grpc.health.v1.Health' => grpcbox_health_service,
'grpc.reflection.v1alpha.ServerReflection' =>
grpcbox_reflection_service}},
grpcbox_health_pb,
grpcbox_reflection_pb],
services => #{'sd.DiscoveryService' => sdg_service,
'grpc.health.v1.Health' => grpcbox_health_service,
'grpc.reflection.v1alpha.ServerReflection' =>
grpcbox_reflection_service}},

listen_opts => #{port => 8081,
ip => {0,0,0,0}}}}]},
listen_opts => #{port => 8081,
ip => {0,0,0,0}}}}]},

{erldns,
[%% DB Config
Expand All @@ -43,6 +44,6 @@
]},

{kernel, [{logger, [{handler, default, logger_std_h,
#{level => ${LOGGER_LEVEL},
#{level => '${LOGGER_LEVEL}',
formatter => {logger_formatter, #{single_line => true}}}}]}]}
].
2 changes: 0 additions & 2 deletions config/vm.args.src
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

-setcookie service_discovery_cookie

+S ${SCHEDULERS}

+C multi_time_warp

+sbwt none
Expand Down
1 change: 0 additions & 1 deletion deployment/base/default.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
LOGGER_LEVEL=debug
SCHEDULERS=1
DB_HOST=127.0.0.1
19 changes: 4 additions & 15 deletions deployment/base/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,8 @@ spec:
env:
- name: DB_HOST
value: POSTGRES_SERVICE
- name: SCHEDULERS
valueFrom:
resourceFieldRef:
containerName: service-discovery
resource: limits.cpu
divisor: 1
- name: ERL_DIST_PORT
value: "5555"
envFrom:
- configMapRef:
name: configmap
Expand All @@ -42,12 +38,5 @@ spec:
httpGet:
path: /ready
port: http
initialDelaySeconds: 3
periodSeconds: 5

livenessProbe:
httpGet:
path: /healthz
port: http
initialDelaySeconds: 3
periodSeconds: 15
initialDelaySeconds: 1
periodSeconds: 10