diff --git a/Dockerfile b/Dockerfile index afa2e2c..ddd54a4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 . diff --git a/apps/service_discovery_http/src/sdh_handler.erl b/apps/service_discovery_http/src/sdh_handler.erl index b2ff5f6..f6ff12a 100644 --- a/apps/service_discovery_http/src/sdh_handler.erl +++ b/apps/service_discovery_http/src/sdh_handler.erl @@ -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(), diff --git a/apps/service_discovery_http/src/service_discovery_http.app.src b/apps/service_discovery_http/src/service_discovery_http.app.src index 1d9e523..d659b05 100644 --- a/apps/service_discovery_http/src/service_discovery_http.app.src +++ b/apps/service_discovery_http/src/service_discovery_http.app.src @@ -9,7 +9,8 @@ service_discovery, jsx, acceptor_pool, - elli + elli, + uuid ]}, {env,[]}, {modules, []}, diff --git a/apps/service_discovery_http/src/service_discovery_http_app.erl b/apps/service_discovery_http/src/service_discovery_http_app.erl index 5a21a38..22e4ca5 100644 --- a/apps/service_discovery_http/src/service_discovery_http_app.erl +++ b/apps/service_discovery_http/src/service_discovery_http_app.erl @@ -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). diff --git a/config/dev_sys.config b/config/dev_sys.config index e8f53a9..b821fcc 100644 --- a/config/dev_sys.config +++ b/config/dev_sys.config @@ -7,7 +7,6 @@ password => "password", database => "discovery"}}]}, - {service_discovery_grpc, [{server, #{grpc_opts => #{service_protos => [sdg_discovery_pb, grpcbox_health_pb, @@ -20,7 +19,6 @@ listen_opts => #{port => 8081, ip => {0,0,0,0}}}}]}, - {erldns, [%% DB Config {storage, diff --git a/config/dev_vm.args b/config/dev_vm.args index df27031..44b77b6 100644 --- a/config/dev_vm.args +++ b/config/dev_vm.args @@ -2,8 +2,6 @@ -setcookie service_discovery_cookie -+S 1 - +C multi_time_warp +sbwt none diff --git a/config/sys.config.src b/config/sys.config.src index 5c7c296..e897ae5 100644 --- a/config/sys.config.src +++ b/config/sys.config.src @@ -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 @@ -43,6 +44,6 @@ ]}, {kernel, [{logger, [{handler, default, logger_std_h, - #{level => ${LOGGER_LEVEL}, + #{level => '${LOGGER_LEVEL}', formatter => {logger_formatter, #{single_line => true}}}}]}]} ]. diff --git a/config/vm.args.src b/config/vm.args.src index 3d00cec..44b77b6 100644 --- a/config/vm.args.src +++ b/config/vm.args.src @@ -2,8 +2,6 @@ -setcookie service_discovery_cookie -+S ${SCHEDULERS} - +C multi_time_warp +sbwt none diff --git a/deployment/base/default.env b/deployment/base/default.env index 14d92f7..ce97c1d 100644 --- a/deployment/base/default.env +++ b/deployment/base/default.env @@ -1,3 +1,2 @@ LOGGER_LEVEL=debug -SCHEDULERS=1 DB_HOST=127.0.0.1 diff --git a/deployment/base/deployment.yaml b/deployment/base/deployment.yaml index 09c4fb6..e3b565d 100644 --- a/deployment/base/deployment.yaml +++ b/deployment/base/deployment.yaml @@ -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 @@ -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