updated plugins dir location

This commit is contained in:
Luka Kavčič 2024-01-10 11:45:21 +01:00
parent 23414b6d8b
commit e028344b97
5 changed files with 9 additions and 9 deletions

View File

@ -8,12 +8,14 @@ RUN apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python
RUN python3 -m ensurepip RUN python3 -m ensurepip
RUN pip3 install --no-cache --upgrade pip setuptools RUN pip3 install --no-cache --upgrade pip setuptools
ADD . /var/www/plugin-server ADD ./plugin-server.py /var/www/plugin-server/plugin-server.py
ADD ./plugin-loader.js /var/www/plugin-server/plugin-loader.js
ADD ./requirements.txt /var/www/plugin-server/requirements.txt
WORKDIR /var/www/plugin-server/ WORKDIR /var/www/plugin-server/
RUN pip install -r requirements.txt RUN pip install -r requirements.txt
RUN ln -s /var/www/plugins ./plugins RUN ln -s /var/www/plugins/ ./
CMD sh start.sh CMD /usr/bin/redis-server & python plugin-server.py

View File

@ -36,7 +36,7 @@ Then you can run [flask server](plugin-server.py) on a server.
## Example ## Example
Let's say you are hosting plugins on lexonomyplugins.example.com and that there is a plugin (a folder) called myplugin in `CWD` of the server python process. You need to set: Let's say you are hosting plugins on lexonomyplugins.example.com and that there is a plugin (a folder) called myplugin in `CWD/plugins/` of the server python process. You need to set:
* `plugin: "//lexonomyplugins.example.com/myplugin"` in javascript loader, * `plugin: "//lexonomyplugins.example.com/myplugin"` in javascript loader,
* `URL = "//lexonomyplugins.example.com/myplugin"` in python server, * `URL = "//lexonomyplugins.example.com/myplugin"` in python server,

View File

@ -7,6 +7,6 @@ services:
dockerfile: Dockerfile dockerfile: Dockerfile
restart: always restart: always
volumes: volumes:
- /home/ozbolt/plugins:/var/www/plugins - ./plugins:/var/www/plugins
ports: ports:
- "8085:5000" - "8085:5000"

View File

@ -25,6 +25,7 @@ redis = redis.Redis(host='localhost', port=6379, db=0)
URL = "https://plugins.lexonomy.cjvt.si" URL = "https://plugins.lexonomy.cjvt.si"
REPLACE_STRING = "$LOCATION$" REPLACE_STRING = "$LOCATION$"
PLUGINS_DIR = os.environ.get("PLUGINS_DIR_PATH", "plugins")
def check_cache(full_path): def check_cache(full_path):
@ -49,6 +50,7 @@ def generate_etag(N=12):
def return_file(path, plugin=None): def return_file(path, plugin=None):
full_path = path if plugin is None else"{}/{}".format(plugin, path) full_path = path if plugin is None else"{}/{}".format(plugin, path)
full_path = f"{PLUGINS_DIR}/{full_path}"
if not os.path.isfile(full_path): if not os.path.isfile(full_path):
return "File not found", 404 return "File not found", 404

View File

@ -1,4 +0,0 @@
#!/bin/sh
/usr/bin/redis-server &
python plugin-server.py