diff --git a/projects/activitypub_relay/Dockerfile b/projects/activitypub_relay/Dockerfile index 07b8a6c..8b12ee3 100644 --- a/projects/activitypub_relay/Dockerfile +++ b/projects/activitypub_relay/Dockerfile @@ -4,14 +4,15 @@ FROM library/python:3.10 RUN pip install --upgrade pip RUN useradd -d /app app -RUN mkdir -p /app -RUN chown -R app:app /app +RUN mkdir -p /app /data +RUN chown -R app:app /app /data USER app WORKDIR /app VOLUME /data ENV DOCKER_RUNNING=true ENV PYTHONPATH="/app:${PYTHONPATH}" +ENV PYTHONUNBUFFERED=true ENV PATH="/app/.local/bin:${PATH}" ### App specific crap @@ -22,4 +23,4 @@ COPY --chown=app:app docker_relay.sh /app/relay.sh COPY --chown=app:app src/python /app/ EXPOSE 8080 -ENTRYPOINT ["/bin/sh", "/app/relay.sh"] +CMD ["/bin/sh", "/app/relay.sh"] diff --git a/projects/activitypub_relay/deploy.sh b/projects/activitypub_relay/deploy.sh old mode 100644 new mode 100755 diff --git a/projects/activitypub_relay/docker_relay.sh b/projects/activitypub_relay/docker_relay.sh index 5a08fdf..f07f85e 100644 --- a/projects/activitypub_relay/docker_relay.sh +++ b/projects/activitypub_relay/docker_relay.sh @@ -2,10 +2,12 @@ # A launcher script for the dockerized relay +set -e + # First do config init if needed if [ ! -f "/data/config.yml" ]; then - python3 -m "relay" setup + python3 -m "relay" -c "/data/config.yml" setup fi # Then run the blame thing -exec python3 -m "relay" "${@:-run}" +exec python3 -m "relay" -c "/data/config.yml" "${@:-run}" diff --git a/projects/activitypub_relay/src/python/relay/__main__.py b/projects/activitypub_relay/src/python/relay/__main__.py index 699daee..26f31cf 100644 --- a/projects/activitypub_relay/src/python/relay/__main__.py +++ b/projects/activitypub_relay/src/python/relay/__main__.py @@ -26,7 +26,7 @@ def cli(ctx, config): "error": logging.ERROR, "critical": logging.CRITICAL, "fatal": logging.FATAL, - }.get(os.getenv("LOG_LEVE", "INFO").lower(), logging.INFO) + }.get(os.getenv("LOG_LEVEL", "INFO").lower(), logging.INFO) logging.basicConfig( level=level, diff --git a/projects/activitypub_relay/src/python/relay/views.py b/projects/activitypub_relay/src/python/relay/views.py index 06b26e5..2bb698a 100644 --- a/projects/activitypub_relay/src/python/relay/views.py +++ b/projects/activitypub_relay/src/python/relay/views.py @@ -25,7 +25,7 @@ def register_route(method, path): @register_route("GET", "/") async def home(request): - targets = "
".join(request.app.database.hostnames) + targets = "" note = request.app.config.note count = len(request.app.database.hostnames) host = request.app.config.host @@ -44,7 +44,7 @@ a:hover {{ color: #8AF; }}

This is an Activity Relay for fediverse instances.

{note}

-

To host your own relay, you may download the code at this address: https://git.pleroma.social/pleroma/relay

+

To host your own relay, you may download the code at this address: https://git.arrdem.com/arrdem/source/src/branch/trunk/projects/activitypub_relay


List of {count} registered instances:
{targets}

"""