First version of multi-container Agora that actually works \o/

Running live now at link.agor.ai.
This commit is contained in:
Flancian 2023-07-29 15:16:00 +02:00
parent 4b32ca5cf7
commit 6145caf372
4 changed files with 62 additions and 19 deletions

2
abra.sh Normal file
View File

@ -0,0 +1,2 @@
export SERVER_ENTRYPOINT_VERSION=2
export BRIDGE_ENTRYPOINT_VERSION=2

View File

@ -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

15
entrypoint.bridge.sh.tmpl Executable file
View File

@ -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

17
entrypoint.server.sh.tmpl Executable file
View File

@ -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