diff --git a/abra.sh b/abra.sh new file mode 100644 index 0000000..2414a13 --- /dev/null +++ b/abra.sh @@ -0,0 +1,2 @@ +export SERVER_ENTRYPOINT_VERSION=2 +export BRIDGE_ENTRYPOINT_VERSION=2 diff --git a/compose.yml b/compose.yml index 362445d..1369331 100644 --- a/compose.yml +++ b/compose.yml @@ -8,12 +8,17 @@ services: - AGORA_PATH=$AGORA_PATH - AGORA_GIT=$AGORA_GIT image: git.coopcloud.tech/flancian/agora-server:latest - volumes: - - data:$AGORA_PATH + configs: + - source: server_entrypoint + target: /docker-entrypoint.sh + mode: 0555 + entrypoint: /docker-entrypoint.sh ports: - 5017:5017 networks: - proxy + volumes: + - "data:$AGORA_PATH" deploy: restart_policy: condition: on-failure @@ -35,37 +40,41 @@ services: # timeout: 10s # retries: 10 # start_period: 1m + + bridge: environment: - AGORA_USER=$AGORA_USER - AGORA_PATH=$AGORA_PATH - AGORA_GIT=$AGORA_GIT image: git.coopcloud.tech/flancian/agora-bridge:latest + configs: + - source: bridge_entrypoint + target: /docker-entrypoint.sh + mode: 0555 + entrypoint: /docker-entrypoint.sh volumes: - - data:$AGORA_PATH + - "data:$AGORA_PATH" deploy: restart_policy: - delay: 30s + condition: on-failure - # This is meant to run once at the seeding of the Agora, when the AGORA_ROOT (volume) is found empty. - # It will clone a git repository into the designated location. - bootstrap: - environment: - - AGORA_USER=$AGORA_USER - - AGORA_PATH=$AGORA_PATH - - AGORA_GIT=$AGORA_GIT - image: git.coopcloud.tech/flancian/agora-bridge:latest - command: | - bash -c - "git clone $AGORA_GIT $AGORA_PATH; - cd $AGORA_PATH && git pull" - volumes: - - data:$AGORA_PATH - networks: proxy: external: true + volumes: data: + + +configs: + server_entrypoint: + name: ${STACK_NAME}_server_entrypoint_${SERVER_ENTRYPOINT_VERSION} + file: entrypoint.server.sh.tmpl + template_driver: golang + bridge_entrypoint: + name: ${STACK_NAME}_bridge_entrypoint_${BRIDGE_ENTRYPOINT_VERSION} + file: entrypoint.bridge.sh.tmpl + template_driver: golang diff --git a/entrypoint.bridge.sh.tmpl b/entrypoint.bridge.sh.tmpl new file mode 100755 index 0000000..8e413a5 --- /dev/null +++ b/entrypoint.bridge.sh.tmpl @@ -0,0 +1,15 @@ +#!/bin/bash + +# set -eu -o pipefail + +init_root() { + git clone ${AGORA_GIT} ${AGORA_PATH} || (cd ${AGORA_PATH} && git pull) +} + +main() { + set -eu + init_root + /home/$AGORA_USER/agora-bridge/run-dev.sh +} + +main diff --git a/entrypoint.server.sh.tmpl b/entrypoint.server.sh.tmpl new file mode 100755 index 0000000..5542e2a --- /dev/null +++ b/entrypoint.server.sh.tmpl @@ -0,0 +1,17 @@ +#!/bin/bash + +set -eu -o pipefail + +init_root() { + set -eu + # nothing to do here for now? +} + +main() { + set -eu + init_root + /home/$AGORA_USER/agora-server/run-localdev.sh + # tail -f /dev/null +} + +main