Commit 5cebd158 authored by Sebastien Merle's avatar Sebastien Merle
Browse files

Add TE service skeleton

parent f4e0a2ac
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -168,5 +168,8 @@ delete_local_deployment.sh
local_docker_deployment.sh
local_k8s_deployment.sh

# asdf configuration
.tool-versions

# Other logs
**/logs/*.log.*
+79 −0
Original line number Diff line number Diff line
# Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: teservice
spec:
  selector:
    matchLabels:
      app: teservice
  template:
    metadata:
      labels:
        app: teservice
    spec:
      terminationGracePeriodSeconds: 5
      shareProcessNamespace: true
      containers:
      - name: server
        image: registry.gitlab.com/teraflow-h2020/controller/te:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 11010
        env:
        - name: ERLANG_LOGGER_LEVEL
          value: "debug"
        - name: ERLANG_COOKIE
          value: "tfte-unsafe-cookie"
        - name: ERLANG_NODE_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: ERLANG_NODE_IP
          valueFrom:
            fieldRef:
              fieldPath: status.podIP
        readinessProbe:
          initialDelaySeconds: 10
          periodSeconds: 10
          exec:
            command: ["/tfte/bin/tfte", "status"]
        livenessProbe:
          initialDelaySeconds: 10
          periodSeconds: 10
          exec:
            command: ["/tfte/bin/tfte", "status"]
        resources:
          requests:
            cpu: 250m
            memory: 512Mi
          limits:
            cpu: 700m
            memory: 1024Mi
---
apiVersion: v1
kind: Service
metadata:
  name: teservice
spec:
  type: ClusterIP
  selector:
    app: teservice
  ports:
  - name: grpc
    protocol: TCP
    port: 11010
    targetPort: 11010

src/te/.dockerignore

0 → 100644
+4 −0
Original line number Diff line number Diff line
Dockerfile
_build
README.md
.tool-versions

src/te/.gitignore

0 → 100644
+21 −0
Original line number Diff line number Diff line
.tool-versions
.rebar3
_*
.eunit
*.o
*.beam
*.plt
*.swp
*.swo
.erlang.cookie
ebin
log
erl_crash.dump
.rebar
logs
_build
.idea
*.iml
rebar3.crashdump
*~
config/dev.config

src/te/Dockerfile

0 → 100644
+55 −0
Original line number Diff line number Diff line
# Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Multi-stage Docker image build

# Build stage 0
FROM erlang:24.3-alpine

RUN mkdir /buildroot
WORKDIR /buildroot

# Copy our Erlang application
COPY . tfte

# And build the release
WORKDIR tfte
RUN rebar3 as prod release

# Build stage 1
FROM alpine

# Install some libs
RUN apk add --no-cache libgcc libstdc++ && \
    apk add --no-cache openssl && \
    apk add --no-cache ncurses-libs

# Install the released application
COPY --from=0 /buildroot/tfte/_build/prod/rel/tfte /tfte

# Expose relevant ports
#EXPOSE ????

ARG ERLANG_LOGGER_LEVEL_DEFAULT=debug
ARG ERLANG_COOKIE_DEFAULT=tfte-unsafe-cookie
ARG ERLANG_NODE_IP_DEFAULT=127.0.0.1
ARG ERLANG_NODE_NAME_DEFAULT=tfte

ENV ERLANG_LOGGER_LEVEL=$ERLANG_LOGGER_LEVEL_DEFAULT
ENV ERLANG_COOKIE=$ERLANG_COOKIE_DEFAULT
ENV ERLANG_NODE_IP=$ERLANG_NODE_IP_DEFAULT
ENV ERLANG_NODE_NAME=$ERLANG_NODE_NAME_DEFAULT

ENTRYPOINT ["/tfte/bin/tfte"]
CMD ["foreground"]
Loading