1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Merge branch 'master' into feature-webedit

This commit is contained in:
krateng 2022-04-25 02:53:43 +02:00
commit 3b156a73ff
13 changed files with 96 additions and 79 deletions

76
.github/workflows/docker.yml vendored Normal file
View File

@ -0,0 +1,76 @@
name: Build and release docker image
on:
push:
tags:
- 'v*'
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
- name: Log in to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@dd4fa0671be5250ee6f50aedf4cb05514abda2c7
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@f2a13332ac1ce8c0a71aeac48a150dbb1838ab67
with:
images: |
${{ github.repository_owner }}/maloja
# generate Docker tags based on the following events/attributes
tags: |
type=semver,pattern={{version}}
flavor: |
latest=true
- name: Set up QEMU
uses: docker/setup-qemu-action@27d0a4f181a40b142cce983c5393082c365d1480
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@94ab11c41e45d028884a99163086648e898eed25
- name: Cache Docker layers
uses: actions/cache@48af2dc4a9e8278b89d7fa154b955c30c6aaab09
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build and push Docker image
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
with:
context: .
file: Containerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Update Readme and short description
uses: peter-evans/dockerhub-description@836d7e6aa8f6f32dce26f5a1dd46d3dc24997eae
continue-on-error: true
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
repository: krateng/maloja
short-description: ${{ github.event.repository.description }}

View File

@ -1,51 +0,0 @@
name: Publish to Dockerhub
on:
push:
tags:
- 'v*'
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
- name: Log in to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@e5622373a38e60fb6d795a4421e56882f2d7a681
with:
images: krateng/maloja
# generate Docker tags based on the following events/attributes
tags: |
type=semver,pattern={{version}}
flavor: |
latest=true
- name: Build and push Docker image
uses: docker/build-push-action@7f9d37fa544684fb73bfe4835ed7214c255ce02b
with:
context: .
file: Containerfile
#platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Update Readme and short description
uses: peter-evans/dockerhub-description@1cf9afbac3c5d2fdc66416a464c2c38260cb6f8d
continue-on-error: true
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
repository: krateng/maloja
short-description: ${{ github.event.repository.description }}

View File

@ -6,7 +6,7 @@ FROM alpine:3.15
WORKDIR /usr/src/app WORKDIR /usr/src/app
# Install run dependencies first # Install run dependencies first
RUN apk add --no-cache python3 tzdata RUN apk add --no-cache python3 py3-lxml tzdata
# system pip could be removed after build, but apk then decides to also remove all its # system pip could be removed after build, but apk then decides to also remove all its
# python dependencies, even if they are explicitly installed as python packages # python dependencies, even if they are explicitly installed as python packages
@ -15,16 +15,7 @@ RUN \
apk add py3-pip && \ apk add py3-pip && \
pip install wheel pip install wheel
# these are more static than the real requirements, which means caching
COPY ./requirements_pre.txt ./requirements_pre.txt
RUN \
apk add --no-cache --virtual .build-deps gcc g++ python3-dev libxml2-dev libxslt-dev libffi-dev libc-dev py3-pip linux-headers && \
pip install --no-cache-dir -r requirements_pre.txt && \
apk del .build-deps
# less likely to be cached
COPY ./requirements.txt ./requirements.txt COPY ./requirements.txt ./requirements.txt
RUN \ RUN \

View File

@ -33,3 +33,12 @@ minor_release_name: "Yeonhee"
notes: notes:
- "[Feature] Added notification system for web interface" - "[Feature] Added notification system for web interface"
- "[Bugfix] Fixed crash when encountering error in Lastfm import" - "[Bugfix] Fixed crash when encountering error in Lastfm import"
3.0.6:
commit: "b3d4cb7a153845d1f5a5eef67a6508754e338f2f"
notes:
- "[Performance] Implemented search in database"
- "[Bugfix] Better parsing of featuring artists"
- "[Bugfix] Fixed buffered output in Docker"
- "[Bugfix] Fixed importing a Spotify file without path"
- "[Bugfix] No longer releasing database lock during scrobble creation"
- "[Distribution] Experimental arm64 image"

View File

@ -15,16 +15,7 @@ RUN \
apk add py3-pip && \ apk add py3-pip && \
pip install wheel pip install wheel
# these are more static than the real requirements, which means caching
COPY ./requirements_pre.txt ./requirements_pre.txt
RUN \
apk add --no-cache --virtual .build-deps {{ tool.osreqs.alpine.build | join(' ') }} && \
pip install --no-cache-dir -r requirements_pre.txt && \
apk del .build-deps
# less likely to be cached
COPY ./requirements.txt ./requirements.txt COPY ./requirements.txt ./requirements.txt
RUN \ RUN \

View File

@ -43,7 +43,7 @@ for version in releases:
try: try:
prev_tag = sp.check_output(["git","show",f'v{maj}.{min}.{hot}']).decode() prev_tag = sp.check_output(["git","show",f'v{maj}.{min}.{hot}']).decode()
prev_tag_commit = prev_tag.split('\n')[6].split(" ")[1] prev_tag_commit = prev_tag.split('\n')[6].split(" ")[1]
except: except Exception:
pass pass
else: else:
assert prev_tag_commit == info['commit'] assert prev_tag_commit == info['commit']

View File

@ -11,6 +11,7 @@ apk add \
py3-pip \ py3-pip \
linux-headers \ linux-headers \
python3 \ python3 \
py3-lxml \
tzdata \ tzdata \
vips vips

View File

@ -11,5 +11,6 @@ apk add \
py3-pip \ py3-pip \
linux-headers \ linux-headers \
python3 \ python3 \
py3-lxml \
tzdata \ tzdata \
vips vips

View File

@ -4,7 +4,7 @@
# you know what f*ck it # you know what f*ck it
# this is hardcoded for now because of that damn project / package name discrepancy # this is hardcoded for now because of that damn project / package name discrepancy
# i'll fix it one day # i'll fix it one day
VERSION = "3.0.5" VERSION = "3.0.6"
HOMEPAGE = "https://github.com/krateng/maloja" HOMEPAGE = "https://github.com/krateng/maloja"

View File

@ -320,7 +320,8 @@ class MTRangeComposite(MTRangeGeneric):
if self.since is None: return FIRST_SCROBBLE if self.since is None: return FIRST_SCROBBLE
else: return self.since.first_stamp() else: return self.since.first_stamp()
def last_stamp(self): def last_stamp(self):
if self.to is None: return int(datetime.utcnow().replace(tzinfo=timezone.utc).timestamp()) #if self.to is None: return int(datetime.utcnow().replace(tzinfo=timezone.utc).timestamp())
if self.to is None: return today().last_stamp()
else: return self.to.last_stamp() else: return self.to.last_stamp()
def next(self,step=1): def next(self,step=1):

View File

@ -149,8 +149,8 @@ malojaconfig = Configuration(
"cache_expire_positive":(tp.Integer(), "Image Cache Expiration", 60, "Days until images are refetched"), "cache_expire_positive":(tp.Integer(), "Image Cache Expiration", 60, "Days until images are refetched"),
"cache_expire_negative":(tp.Integer(), "Image Cache Negative Expiration", 5, "Days until failed image fetches are reattempted"), "cache_expire_negative":(tp.Integer(), "Image Cache Negative Expiration", 5, "Days until failed image fetches are reattempted"),
"db_max_memory":(tp.Integer(min=0,max=100), "RAM Percentage soft limit", 80, "RAM Usage in percent at which Maloja should no longer increase its database cache."), "db_max_memory":(tp.Integer(min=0,max=100), "RAM Percentage soft limit", 80, "RAM Usage in percent at which Maloja should no longer increase its database cache."),
"use_request_cache":(tp.Boolean(), "Use request-local DB Cache", True), "use_request_cache":(tp.Boolean(), "Use request-local DB Cache", False),
"use_global_cache":(tp.Boolean(), "Use global DB Cache", True) "use_global_cache":(tp.Boolean(), "Use global DB Cache", False)
}, },
"Fluff":{ "Fluff":{
"scrobbles_gold":(tp.Integer(), "Scrobbles for Gold", 250, "How many scrobbles a track needs to be considered 'Gold' status"), "scrobbles_gold":(tp.Integer(), "Scrobbles for Gold", 250, "How many scrobbles a track needs to be considered 'Gold' status"),

View File

@ -1,6 +1,6 @@
[project] [project]
name = "malojaserver" name = "malojaserver"
version = "3.0.5" version = "3.0.6"
description = "Self-hosted music scrobble database" description = "Self-hosted music scrobble database"
readme = "./README.md" readme = "./README.md"
requires-python = ">=3.7" requires-python = ">=3.7"
@ -62,6 +62,7 @@ build =[
] ]
run = [ run = [
"python3", "python3",
"py3-lxml",
"tzdata" "tzdata"
] ]
opt = [ opt = [

View File

@ -1,3 +0,0 @@
# this is a more static file that enables container images to be cached
# it should contain packages that take long to build and don't change frequently
lxml