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

app-launcher draft #335

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
9 changes: 9 additions & 0 deletions dev-env/config/deps.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@
"logger"
]
},
"app-launcher" : {
"lib": [
"shared"
],
"build": {},
"run": [
"logger"
]
},
"email": {
"lib": [
"shared"
Expand Down
12 changes: 8 additions & 4 deletions dev-env/config/groups.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"terminal",
"user",
"user-files",
"user-storage"
"user-storage",
"app-launcher"
],
"process": [
"gateway",
Expand All @@ -26,7 +27,8 @@
"mysql",
"rabbitmq",
"sepal-server",
"user"
"user",
"app-launcher"
],
"apps": [
"app-manager",
Expand All @@ -39,7 +41,8 @@
"sepal-server",
"ssh-gateway",
"terminal",
"user"
"user",
"app-launcher"
],
"node": [
"app-manager",
Expand All @@ -53,6 +56,7 @@
"task",
"terminal",
"user-files",
"user-storage"
"user-storage",
"app-launcher"
]
}
68 changes: 68 additions & 0 deletions modules/app-launcher/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
FROM node:20-bookworm

EXPOSE 5011

ENV MODULE_NAME app-launcher
ENV MODULE /usr/local/src/sepal/modules/${MODULE_NAME}
ENV SHARED /usr/local/src/sepal/lib/js/shared

RUN npm install -g nodemon

RUN apt-get update && apt-get install -y \
apt-utils \
git \
curl \
cmake \
ca-certificates \
gnupg \
inetutils-ping \
lsb-release \
nano \
unzip \
zip \
sudo

RUN adduser node sudo && echo 'node ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers

# Set bash prompt
RUN echo "export PS1='[\[\033[1;34m\]\u@${MODULE_NAME}\[\033[0m\]:\w]\$ '" >> /home/node/.bashrc
RUN echo "export PS1='[\[\033[1;34m\]\u@${MODULE_NAME}\[\033[0m\]:\w]\$ '" >> /root/.bashrc

# Install docker-cli (as we do in dev-env)

RUN curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

RUN echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null

RUN apt-get update && apt-get install -y docker-ce-cli

# Install docker compose

RUN mkdir -p /usr/local/lib/docker/cli-plugins
RUN curl -SL https://github.com/docker/compose/releases/download/v2.29.2/docker-compose-linux-x86_64 -o /usr/local/lib/docker/cli-plugins/docker-compose
RUN chmod +x /usr/local/lib/docker/cli-plugins/docker-compose


# ADD lib/js/shared ${SHARED}
# WORKDIR ${SHARED}/js/shared
# USER root
# RUN chown -R node: ${SHARED}
# USER node
# RUN npm install

ADD modules/${MODULE_NAME}/package.json ${MODULE}/
ADD modules/${MODULE_NAME}/package-lock.json ${MODULE}/
WORKDIR ${MODULE}
USER root
RUN mkdir src && chown -R node: ${MODULE}
USER node
RUN npm install

ADD modules/${MODULE_NAME}/src ${MODULE}/src
ADD modules/${MODULE_NAME}/config ${MODULE}/config
ADD modules/${MODULE_NAME}/start.sh /usr/local/bin
ADD modules/${MODULE_NAME}/update-app.sh /usr/local/bin/update-app

CMD start.sh
7 changes: 7 additions & 0 deletions modules/app-launcher/config/log.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"port": 5104,
"categories": {
"main": "info",
"terminal": "debug"
}
}
13 changes: 13 additions & 0 deletions modules/app-launcher/docker-compose.override.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
services:
app-launcher:
extends:
file: ../docker-compose.logger.override.yml
service: logger
environment:
SEPAL_HOST_PROJECT_DIR: "${SEPAL_PROJECT_DIR}"
extra_hosts:
- 'host.docker.internal:host-gateway'
volumes: # To allow dynamic reloading in dev
- ${SEPAL_PROJECT_DIR}/lib/js/shared:/usr/local/src/sepal/lib/js/shared
- ${SEPAL_PROJECT_DIR}/modules/app-launcher:/usr/local/src/sepal/modules/app-launcher
- ${SEPAL_PROJECT_DIR}/modules/app-launcher/update-app.sh:/usr/local/bin/update-app
46 changes: 46 additions & 0 deletions modules/app-launcher/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
services:
app-launcher:
extends:
file: ../docker-compose.logger.yml
service: logger
build:
context: ../..
dockerfile: ./modules/app-launcher/Dockerfile
ulimits:
nofile:
soft: 65536
hard: 65536
image: "${DOCKER_REGISTRY_HOST:-localhost}/openforis/app-launcher:${SEPAL_VERSION:-latest}"
container_name: app-launcher
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- "${SEPAL_DATA_DIR}/sepal/home:/sepalUsers"
- "${SEPAL_DATA_DIR}/app-manager/apps.json:/var/lib/sepal/app-manager/apps.json"
- "${SEPAL_DATA_DIR}/sepal/shared/apps:/var/lib/sepal/app-manager/apps"
- "${SEPAL_DATA_DIR}/app-launcher:/var/lib/sepal/app-launcher"
init: true
environment:
USERS_HOME_PATH: "${SEPAL_DATA_DIR}/sepal/home"
EE_CREDENTIALS_PATH: "${SEPAL_DATA_DIR}/app-launcher/service-account-credentials.json"
DOCKER_REGISTRY_HOST: "${DOCKER_REGISTRY_HOST}"
SEPAL_DATA_DIR: "${SEPAL_DATA_DIR}"
DEPLOY_ENVIRONMENT : "${DEPLOY_ENVIRONMENT}"
EE_ACCOUNT: "${EE_ACCOUNT}"
EE_PRIVATE_KEY: "${EE_PRIVATE_KEY}"
GOOGLE_PROJECT_ID: "${GOOGLE_PROJECT_ID}"
GOOGLE_MAPS_API_KEY: "${GOOGLE_MAPS_API_KEY}"
NICFI_PLANET_API_KEY: "${NICFI_PLANET_API_KEY}"
# healthcheck:
# test: bash -c "exec 6<> /dev/tcp/localhost/5011"
# timeout: 60s
# interval: 1s
# retries: 60
networks:
- sepal
restart: always
ulimits:
core: 0

networks:
sepal:
external: true
Loading