mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Bugfixes and Docker dev test script
This commit is contained in:
parent
0f473599a7
commit
d3258a7e63
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,6 +7,7 @@
|
|||||||
/*.yml
|
/*.yml
|
||||||
/pylintrc
|
/pylintrc
|
||||||
.venv/*
|
.venv/*
|
||||||
|
/testdata
|
||||||
|
|
||||||
# build
|
# build
|
||||||
/dist
|
/dist
|
||||||
|
@ -24,6 +24,7 @@ RUN \
|
|||||||
|
|
||||||
# expected behavior for a default setup is for maloja to "just work"
|
# expected behavior for a default setup is for maloja to "just work"
|
||||||
ENV MALOJA_SKIP_SETUP=yes
|
ENV MALOJA_SKIP_SETUP=yes
|
||||||
|
ENV MALOJA_HOST=0.0.0.0
|
||||||
|
|
||||||
EXPOSE 42010
|
EXPOSE 42010
|
||||||
# use exec form for better signal handling https://docs.docker.com/engine/reference/builder/#entrypoint
|
# use exec form for better signal handling https://docs.docker.com/engine/reference/builder/#entrypoint
|
||||||
|
33
Dockerfile-dev
Normal file
33
Dockerfile-dev
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
FROM python:3-alpine
|
||||||
|
|
||||||
|
# Based on the work of Jonathan Boeckel <jonathanboeckel1996@gmail.com>
|
||||||
|
# https://gitlab.com/Joniator/docker-maloja
|
||||||
|
# https://github.com/Joniator
|
||||||
|
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
|
|
||||||
|
# Copy project into dir
|
||||||
|
COPY ./install ./install
|
||||||
|
COPY ./requirements.txt ./requirements.txt
|
||||||
|
|
||||||
|
|
||||||
|
# Build dependencies (This will pipe all packages from the file)
|
||||||
|
RUN sed 's/#.*//' ./install/dependencies_build.txt | xargs apk add --no-cache --virtual .build-deps
|
||||||
|
# Runtime dependencies (Same)
|
||||||
|
RUN sed 's/#.*//' ./install/dependencies_run.txt | xargs apk add --no-cache
|
||||||
|
# Python dependencies
|
||||||
|
RUN pip3 install --no-cache-dir -r requirements.txt
|
||||||
|
# Local project install
|
||||||
|
COPY . .
|
||||||
|
RUN pip3 install /usr/src/app
|
||||||
|
# Remove build dependencies
|
||||||
|
RUN apk del .build-deps
|
||||||
|
|
||||||
|
# expected behavior for a default setup is for maloja to "just work"
|
||||||
|
ENV MALOJA_SKIP_SETUP=yes
|
||||||
|
ENV MALOJA_HOST=0.0.0.0
|
||||||
|
|
||||||
|
EXPOSE 42010
|
||||||
|
# use exec form for better signal handling https://docs.docker.com/engine/reference/builder/#entrypoint
|
||||||
|
ENTRYPOINT ["maloja", "run"]
|
2
dockertest.sh
Normal file
2
dockertest.sh
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
docker build -t maloja-dev . -f Dockerfile-dev
|
||||||
|
docker run -p 42010:42010 -v $PWD/testdata:/mlj -e MALOJA_DATA_DIRECTORY=/mlj maloja-dev
|
@ -462,8 +462,12 @@ def start_db():
|
|||||||
dbstatus['healthy'] = True
|
dbstatus['healthy'] = True
|
||||||
|
|
||||||
# inform time module about begin of scrobbling
|
# inform time module about begin of scrobbling
|
||||||
|
try:
|
||||||
firstscrobble = sqldb.get_scrobbles()[0]
|
firstscrobble = sqldb.get_scrobbles()[0]
|
||||||
register_scrobbletime(firstscrobble['time'])
|
register_scrobbletime(firstscrobble['time'])
|
||||||
|
except IndexError:
|
||||||
|
register_scrobbletime(int(datetime.datetime.now().timestamp()))
|
||||||
|
|
||||||
|
|
||||||
# create cached information
|
# create cached information
|
||||||
cached.update_medals()
|
cached.update_medals()
|
||||||
|
@ -68,11 +68,12 @@ def setup():
|
|||||||
newpw = prompt("Please set a password for web backend access. Leave this empty to generate a random password.",skip=SKIP,secret=True)
|
newpw = prompt("Please set a password for web backend access. Leave this empty to generate a random password.",skip=SKIP,secret=True)
|
||||||
if newpw is None:
|
if newpw is None:
|
||||||
newpw = randomstring(32)
|
newpw = randomstring(32)
|
||||||
|
newpw_repeat = newpw
|
||||||
print("Generated password:",col["yellow"](newpw))
|
print("Generated password:",col["yellow"](newpw))
|
||||||
else:
|
else:
|
||||||
newpw_repeat = prompt("Please type again to confirm.",skip=SKIP,secret=True)
|
newpw_repeat = prompt("Please type again to confirm.",skip=SKIP,secret=True)
|
||||||
if newpw != newpw_repeat: print("Passwords do not match!")
|
if newpw != newpw_repeat: print("Passwords do not match!")
|
||||||
else: auth.defaultuser.setpw(newpw)
|
auth.defaultuser.setpw(newpw)
|
||||||
|
|
||||||
if malojaconfig["SEND_STATS"] is None:
|
if malojaconfig["SEND_STATS"] is None:
|
||||||
answer = ask("I would like to know how many people use Maloja. Would it be okay to send a daily ping to my server (this contains no data that isn't accessible via your web interface already)?",default=True,skip=SKIP)
|
answer = ask("I would like to know how many people use Maloja. Would it be okay to send a daily ping to my server (this contains no data that isn't accessible via your web interface already)?",default=True,skip=SKIP)
|
||||||
|
@ -284,6 +284,7 @@ def run_server():
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
#run(webserver, host=HOST, port=MAIN_PORT, server='waitress')
|
#run(webserver, host=HOST, port=MAIN_PORT, server='waitress')
|
||||||
|
log(f"Listening on {HOST}:{PORT}")
|
||||||
waitress.serve(webserver, host=HOST, port=PORT, threads=THREADS)
|
waitress.serve(webserver, host=HOST, port=PORT, threads=THREADS)
|
||||||
except OSError:
|
except OSError:
|
||||||
log("Error. Is another Maloja process already running?")
|
log("Error. Is another Maloja process already running?")
|
||||||
|
Loading…
Reference in New Issue
Block a user