Tweaks to working state

This commit is contained in:
Reid 'arrdem' McKenzie 2022-11-26 20:05:35 -07:00
parent e5b9b133fc
commit e90ce6b8ef
5 changed files with 11 additions and 8 deletions

View file

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

0
projects/activitypub_relay/deploy.sh Normal file → Executable file
View file

View file

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

View file

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

View file

@ -25,7 +25,7 @@ def register_route(method, path):
@register_route("GET", "/")
async def home(request):
targets = "<br>".join(request.app.database.hostnames)
targets = "<ul>" + "\n".join(f"<li>{it}</li>" for it in request.app.database.hostnames) + "</ul>"
note = request.app.config.note
count = len(request.app.database.hostnames)
host = request.app.config.host
@ -44,7 +44,7 @@ a:hover {{ color: #8AF; }}
<body>
<p>This is an Activity Relay for fediverse instances.</p>
<p>{note}</p>
<p>To host your own relay, you may download the code at this address: <a href="https://git.pleroma.social/pleroma/relay">https://git.pleroma.social/pleroma/relay</a></p>
<p>To host your own relay, you may download the code at this address: <a href="https://git.arrdem.com/arrdem/source/src/branch/trunk/projects/activitypub_relay">https://git.arrdem.com/arrdem/source/src/branch/trunk/projects/activitypub_relay</a></p>
<br><p>List of {count} registered instances:<br>{targets}</p>
</body></html>"""