From a761e26ac2f1a250da33b800e44aee6a7f2fdffb Mon Sep 17 00:00:00 2001 From: Ethan O'Brien Date: Mon, 23 Sep 2024 09:17:49 -0500 Subject: [PATCH] Initial commit --- Dockerfile | 18 ++++++++++++++++++ docker-compose.yml | 28 ++++++++++++++++++++++++++++ start.sh | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 start.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4c30945 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM docker.io/library/node:bookworm-slim + +RUN apt update && apt install git -y + +RUN mkdir -p /root/ooye/ + +RUN git clone https://gitdab.com/cadence/out-of-your-element.git /root/ooye/ +#RUN cd /root/ooye/ && git checkout v2.3 + +#COPY ./out-of-your-element/ /root/ooye/ + +RUN apt remove git -y && apt autoremove -y + +COPY ./start.sh /root/ooye/start.sh + +RUN chmod +x /root/ooye/start.sh + +ENTRYPOINT ["/root/ooye/start.sh"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..94d1ef1 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,28 @@ +services: + matrix: +# command: +# - migrate_config + image: matrixdotorg/synapse + ports: + - "5070:8008/tcp" + environment: + SYNAPSE_SERVER_NAME: a.website.com + SYNAPSE_REPORT_STATS: no + SYNAPSE_HTTP_PORT: 8008 + restart: unless-stopped + volumes: + - ./data:/data + ooye: + container_name: ooye + build: + dockerfile: "./Dockerfile" + ports: + - 6693:6693 + volumes: + - ./data-ooye:/data + - ./data:/matrix + depends_on: + matrix: + condition: service_healthy + restart: true + restart: unless-stopped diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..d1bf7a8 --- /dev/null +++ b/start.sh @@ -0,0 +1,32 @@ +#!/bin/bash +set -e +directory="${DIRECTORY:-/data/}" + +cd /root/ooye/ + +export OOYE_DOCKER=1 + +npm i + +cd $directory + +if [ ! -d ./docs ]; then + cp -r /root/ooye/docs/ ./ +fi + + +if [ ! -f ooye.db ] && [ -f /data/registration.yaml ] && [ -d /matrix ]; then + cp /data/registration.yaml /matrix/registration.yaml + if [ ! $(grep -q "app_service_config_files" /matrix/homeserver.yaml) ]; then + echo "app_service_config_files:" >> /matrix/homeserver.yaml + echo " - \"/data/registration.yaml\"" >> /matrix/homeserver.yaml + fi +fi + +if [ -f ooye.db ] && [ -f /data/registration.yaml ]; then + node /root/ooye/addbot.js +else + echo "Detected incomplete out-of-your-element registration. Please run \`docker exec -it ooye su\` to open a shell, then run \`cd $directory && OOYE_DOCKER=1 node /root/ooye/scripts/seed.js\`. Then, restart your docker container." +fi + +node /root/ooye/start.js