Compare commits

..

1 commit

Author SHA1 Message Date
Izalia Mae 8fb966f02c Merge branch 'dev' into 'main'
version 0.3.1

See merge request pleroma/relay!58
2024-04-01 17:10:02 +00:00
9 changed files with 93 additions and 95 deletions

2
.gitignore vendored
View file

@ -12,7 +12,7 @@ __pycache__/
env/ env/
build/ build/
develop-eggs/ develop-eggs/
dist*/ dist/
downloads/ downloads/
eggs/ eggs/
.eggs/ .eggs/

View file

@ -1,20 +1,28 @@
FROM python:3.12-alpine FROM python:3-alpine
# install build deps for pycryptodome and other c-based python modules
RUN apk add alpine-sdk autoconf automake libtool gcc
# add env var to let the relay know it's in a container # add env var to let the relay know it's in a container
ENV DOCKER_RUNNING=true ENV DOCKER_RUNNING=true
# setup various container properties # setup various container properties
VOLUME ["/data"] VOLUME ["/data"]
CMD ["python3", "-m", "relay"] CMD ["python", "-m", "relay"]
EXPOSE 8080/tcp EXPOSE 8080/tcp
WORKDIR /opt/activityrelay WORKDIR /opt/activityrelay
# only copy necessary files
COPY relay ./relay
COPY pyproject.toml ./
# install and update important python modules # install and update important python modules
RUN pip3 install -U setuptools wheel pip RUN pip3 install -U setuptools wheel pip
# only copy necessary files
COPY relay ./relay
COPY LICENSE .
COPY README.md .
COPY requirements.txt .
COPY setup.cfg .
COPY setup.py .
COPY .git ./.git
# install relay deps # install relay deps
RUN pip3 install `python3 -c "import tomllib; print(' '.join(dep.replace(' ', '') for dep in tomllib.load(open('pyproject.toml', 'rb'))['project']['dependencies']))"` RUN pip3 install -r requirements.txt

6
dev-requirements.txt Normal file
View file

@ -0,0 +1,6 @@
flake8 == 7.0.0
mypy == 1.9.0
pyinstaller == 6.3.0
watchdog == 4.0.0
typing_extensions >= 4.10.0; python_version < '3.11.0'

View file

@ -54,7 +54,6 @@ case $1 in
COLS="%-22s %s\n" COLS="%-22s %s\n"
echo "Valid commands:" echo "Valid commands:"
printf "$COLS" "- start" "Run the relay in the background" printf "$COLS" "- start" "Run the relay in the background"
printf "$COLS" "- stop" "Stop the relay" printf "$COLS" "- stop" "Stop the relay"
printf "$COLS" "- manage <cmd> [args]" "Run a relay management command" printf "$COLS" "- manage <cmd> [args]" "Run a relay management command"
@ -63,8 +62,5 @@ case $1 in
printf "$COLS" "- rescue" "Drop into a bash shell on a temp container with the data volume mounted" printf "$COLS" "- rescue" "Drop into a bash shell on a temp container with the data volume mounted"
printf "$COLS" "- install" "Build the image, create a new container and volume, and run relay setup" printf "$COLS" "- install" "Build the image, create a new container and volume, and run relay setup"
printf "$COLS" "- uninstall" "Delete the relay image, container, and volume" printf "$COLS" "- uninstall" "Delete the relay image, container, and volume"
echo ""
echo "Note: This script may not work. It is recommended to manually install and manage the container if you know what you're doing."
;; ;;
esac esac

View file

@ -1,82 +1,7 @@
[build-system] [build-system]
requires = ["setuptools>=61.2"] requires = ["setuptools","wheel"]
build-backend = "setuptools.build_meta" build-backend = 'setuptools.build_meta'
[project]
name = "ActivityRelay"
description = "Generic LitePub relay (works with all LitePub consumers and Mastodon)"
license = {text = "AGPLv3"}
classifiers = [
"Environment :: Console",
"License :: OSI Approved :: GNU Affero General Public License v3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
dependencies = [
"activitypub-utils == 0.2.1",
"aiohttp >= 3.9.1",
"aiohttp-swagger[performance] == 1.0.16",
"argon2-cffi == 23.1.0",
"barkshark-sql == 0.1.2",
"click >= 8.1.2",
"hiredis == 2.3.2",
"jinja2-haml == 0.3.5",
"markdown == 3.5.2",
"platformdirs == 4.2.0",
"pyyaml >= 6.0",
"redis == 5.0.1",
"importlib_resources == 6.1.1; python_version < '3.9'"
]
requires-python = ">=3.8"
dynamic = ["version"]
[project.readme]
file = "README.md"
content-type = "text/markdown; charset=UTF-8"
[project.urls]
Documentation = "https://git.pleroma.social/pleroma/relay/-/blob/main/docs/index.md"
Source = "https://git.pleroma.social/pleroma/relay"
Tracker = "https://git.pleroma.social/pleroma/relay/-/issues"
[project.scripts]
activityrelay = "relay.manage:main"
[project.optional-dependencies]
dev = [
"flake8 == 7.0.0",
"mypy == 1.9.0",
"pyinstaller == 6.3.0",
"watchdog == 4.0.0",
"typing_extensions >= 4.10.0; python_version < '3.11.0'"
]
[tool.setuptools]
zip-safe = false
packages = [
"relay",
"relay.database",
"relay.views",
]
include-package-data = true
license-files = ["LICENSE"]
[tool.setuptools.package-data]
relay = [
"data/*",
"frontend/*",
"frontend/page/*",
"frontend/static/*"
]
[tool.setuptools.dynamic]
version = {attr = "relay.__version__"}
[tool.setuptools.dynamic.optional-dependencies]
dev = {file = ["dev-requirements.txt"]}
[tool.mypy] [tool.mypy]
show_traceback = true show_traceback = true

14
requirements.txt Normal file
View file

@ -0,0 +1,14 @@
activitypub-utils == 0.2.1
aiohttp >= 3.9.1
aiohttp-swagger[performance] == 1.0.16
argon2-cffi == 23.1.0
barkshark-sql @ https://git.barkshark.xyz/barkshark/bsql/archive/0.1.2.tar.gz
click >= 8.1.2
hiredis == 2.3.2
jinja2-haml == 0.3.5
markdown == 3.5.2
platformdirs == 4.2.0
pyyaml >= 6.0
redis == 5.0.1
importlib_resources == 6.1.1; python_version < '3.9'

51
setup.cfg Normal file
View file

@ -0,0 +1,51 @@
[metadata]
name = relay
version = attr: relay.__version__
description = Generic LitePub relay (works with all LitePub consumers and Mastodon)
long_description = file: README.md
long_description_content_type = text/markdown; charset=UTF-8
url = https://git.pleroma.social/pleroma/relay
license = AGPLv3
license_file = LICENSE
classifiers =
Environment :: Console
License :: OSI Approved :: GNU Affero General Public License v3
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
project_urls =
Source = https://git.pleroma.social/pleroma/relay
Tracker = https://git.pleroma.social/pleroma/relay/-/issues
[options]
zip_safe = False
packages =
relay
relay.database
relay.views
include_package_data = true
install_requires = file: requirements.txt
python_requires = >=3.8
[options.extras_require]
dev = file: dev-requirements.txt
[options.package_data]
relay =
data/*
frontend/*
frontend/page/*
[options.entry_points]
console_scripts =
activityrelay = relay.manage:main
[flake8]
extend-ignore = E128,E251,E261,E303,W191
max-line-length = 100
indent-size = 4
per-file-ignores =
__init__.py: F401

4
setup.py Normal file
View file

@ -0,0 +1,4 @@
import setuptools
if __name__ == "__main__":
setuptools.setup()

View file

@ -1,6 +0,0 @@
[flake8]
extend-ignore = E128,E251,E261,E303,W191
max-line-length = 100
indent-size = 4
per-file-ignores =
__init__.py: F401