Skip to content

Commit

Permalink
3.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
cdhigh committed Jul 7, 2024
1 parent 79da890 commit 3b00c16
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 4 deletions.
5 changes: 3 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,16 @@ RUN mkdir -p /usr/kindleear /data
WORKDIR /usr/kindleear
COPY --from=builder /usr/kindleear/config.py /usr/kindleear/requirements.txt ./
COPY --from=builder /usr/kindleear/tools/mp3cat /usr/local/bin/mp3cat
COPY ./docker/run_docker.sh /usr/local/bin/run_docker.sh
COPY ./docker/gunicorn.conf.py ./main.py ./

#apk add libstdc++ && \
RUN pip install --upgrade pip && \
pip install --no-cache-dir -r requirements.txt && \
chmod +x /usr/local/bin/mp3cat
chmod +x /usr/local/bin/mp3cat /usr/local/bin/run_docker.sh

COPY ./application/ ./application/

EXPOSE 8000

CMD ["/usr/local/bin/gunicorn", "-c", "/usr/kindleear/gunicorn.conf.py", "main:app"]
CMD ["/usr/local/bin/run_docker.sh"]
18 changes: 17 additions & 1 deletion docker/run_docker.sh
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
sudo docker run -d -p 80:8000 -v /data:/data --restart always kindleear/kindleear
#!/bin/sh

if command -v hexdump > /dev/null 2>&1; then
export SECRET_KEY=$(hexdump -n 12 -v -e '/1 "%02x"' /dev/urandom)
elif command -v od > /dev/null 2>&1; then
export SECRET_KEY=$(od -N 12 -A n -t x1 /dev/urandom | tr -d ' \n')
elif command -v xxd > /dev/null 2>&1; then
export SECRET_KEY=$(xxd -l 12 -p /dev/urandom)
else
echo "No command found for SECRET_KEY, using default."
fi

if [ -z "$TZ" ]; then
export TZ=Etc/GMT+0
fi

exec /usr/local/bin/gunicorn -c /usr/kindleear/gunicorn.conf.py main:app
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Visit <https://github.com/cdhigh/KindleEar> for the latest version
# Author: cdhigh <https://github.com/cdhigh>

__Version__ = '3.1.4'
__Version__ = '3.1.5'

import os, sys, builtins, logging
from application.lib import clogging
Expand Down
44 changes: 44 additions & 0 deletions tools/serv00_deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash
echo ""
read -p "Please input your serv00 id: " SERV00_USER
if [ -z "$SERV00_USER" ]; then
echo "Error: Project ID cannot be empty."
exit 1
fi

DOMAIN="${SERV00_USER}.serv00.net"
VENV_DIR="/usr/home/${SERV00_USER}/.virtualenvs"
SITE_DIR="/usr/home/${SERV00_USER}/domains/${DOMAIN}/public_python"
export SERV00_USER
export VENV_DIR
export SITE_DIR

echo "Creating virtual env..."
mkdir $VENV_DIR
cd $VENV_DIR
virtualenv ke
source ${VENV_DIR}/ke/bin/activate

#split into small batches to avoid serv00 memory limit
pip install lxml~=5.2.0 #failed
pip install requests~=2.32.0 chardet~=5.2.0 pillow~=10.3.0 lxml_html_clean~=0.1.1
pip install sendgrid~=6.11.0 mailjet_rest~=1.3.4 python-dateutil~=2.9.0 css_parser~=1.0.10
pip install beautifulsoup4~=4.12.2 html2text~=2024.2.26 html5lib~=1.1 Flask~=3.0.3 flask-babel~=4.0.0
pip install six~=1.16.0 feedparser~=6.0.11 qrcode~=7.4.2 gtts~=2.5.1 edge-tts~=6.1.11 justext~=3.0.1
pip install peewee~=3.17.1 flask-apscheduler~=1.13.1 marisa_trie~=1.2.0 indexed-gzip~=1.8.7
wget https://github.com/cdhigh/chunspell/releases/download/2.0.4/chunspell-2.0.4-freebsd-amd64.zip
unzip -y -d ./chunspell_whl/ chunspell-2.0.4-freebsd-amd64.zip
pip install chunspell --no-index --find-links=./chunspell_whl/.
rm -rf ./chunspell_whl

devil www add $DOMAIN python ${VENV_DIR}/ke/bin/python production
cd ${SITE_DIR}
echo "import sys, os\nsys.path.append(os.getcwd())\nfrom kindleear import app as application" > ${SITE_DIR}/passenger_wsgi.py
rm -f ${SITE_DIR}/public/index.html
rm -rf ${SITE_DIR}/kindleear
git clone --depth 1 https://github.com/cdhigh/kindleear.git

#TODO: change config.py
#TODO: add cron

devil www restart $DOMAIN

0 comments on commit 3b00c16

Please sign in to comment.