Commit d5e6d277 authored by Jens Langhammer's avatar Jens Langhammer

prepare new release 1.9, remove dh-virtualenv, instead ship vendor folder,...

prepare new release 1.9, remove dh-virtualenv, instead ship vendor folder, automatically add server FQDN to allowed hosts
parent fc6bd12e
Pipeline #3357 failed with stages
in 4 minutes and 38 seconds
......@@ -111,3 +111,8 @@ media/*
unittest.xml
media_test/
helm/pyazo/charts/*.tgz
vendor/**
debian/pyazo/**
debian/files
debian/*.substvars
pyazo (1.8.9) UNRELEASED; urgency=medium
pyazo (1.9) stable; urgency=medium
* rewrite debian packaging
* improve initial settings
* make installation easier
-- Jens Langhammer <jens.langhammer@beryju.org> Tue, 05 Mar 2019 12:38:07 +0000
pyazo (1.8.9) stable; urgency=medium
* pyazo: cleanup redundant tasks
* Revert "pyazo: cleanup redundant tasks"
......
......@@ -3,12 +3,12 @@ Section: admin
Priority: optional
Maintainer: BeryJu.org <support@beryju.org>
Uploaders: Jens Langhammer <jens@beryju.org>, BeryJu.org <support@beryju.org>
Build-Depends: debhelper (>= 9), dh-systemd (>= 1.5), dh-exec, wget, dh-virtualenv, dh-exec, python3-venv
Build-Depends: debhelper (>= 9), dh-systemd (>= 1.5), dh-exec, wget, dh-exec, python3 (>= 3.5) | python3.6 | python3.7
Standards-Version: 3.9.6
Package: pyazo-python3.5
Package: pyazo
Architecture: amd64
Recommends: mysql-server, redis-server
Replaces: pyazo
Depends: python3 (>= 3.5), python3 (<= 3.6), dbconfig-mysql | dbconfig-no-thanks, ${misc:Depends}, libmagic1
Description: Gyazo in Python/Django (Python 3.5 Package)
Depends: python3 (>= 3.5) | python3.6 | python3.7, dbconfig-mysql | dbconfig-no-thanks, ${misc:Depends}, libmagic1
Description: Image Hosting server written in Python.
Source: pyazo
Section: admin
Priority: optional
Maintainer: BeryJu.org <support@beryju.org>
Uploaders: Jens Langhammer <jens@beryju.org>, BeryJu.org <support@beryju.org>
Build-Depends: debhelper (>= 9), dh-systemd (>= 1.5), dh-exec, wget, dh-virtualenv, dh-exec, python3-venv
Standards-Version: 3.9.6
Package: pyazo-python3.6
Architecture: amd64
Recommends: mysql-server, redis-server
Replaces: pyazo
Depends: python3 (>= 3.6), dbconfig-mysql | dbconfig-no-thanks, ${misc:Depends}, libmagic1, python3-distutils
Description: Gyazo in Python/Django (Python 3.6 Package)
debug: false
admins:
- admin <admin@domain.tld>
http:
host: 0.0.0.0
port: 8000
......
......@@ -2,6 +2,7 @@ pyazo /usr/share/pyazo/
static /usr/share/pyazo/
manage.py /usr/share/pyazo/
pyazo.sh /usr/share/pyazo/
vendor /usr/share/pyazo/
debian/etc/pyazo /etc/
debian/templates/database.yml /usr/share/pyazo/
......
......@@ -12,22 +12,22 @@ dbc_generate_include_args="-o template_infile=/usr/share/pyazo/database.yml"
dbc_go pyazo "$@"
if [ -z "`getent group pyazo`" ]; then
addgroup --quiet --system pyazo
addgroup --quiet --system pyazo
fi
if [ -z "`getent passwd pyazo`" ]; then
echo " * Creating user and group pyazo..."
adduser --quiet --system --home /usr/share/pyazo --shell /bin/false --ingroup pyazo --disabled-password --disabled-login --gecos "pyazo User" pyazo
echo " * Creating user and group pyazo..."
adduser --quiet --system --home /usr/share/pyazo --shell /bin/false --ingroup pyazo --disabled-password --disabled-login --gecos "pyazo User" pyazo >> /var/log/pyazo/pyazo.log 2>&1
fi
chown -R pyazo: /var/log/pyazo/
chown -R pyazo: /usr/share/pyazo/
chown -R pyazo: /etc/pyazo/
echo " * Updating pillow install"
/usr/share/pyazo/env/bin/pip install --no-cache-dir --upgrade --force-reinstall pillow
python3 -m pip install --target=/usr/share/pyazo/vendor/ --no-cache-dir --upgrade --force-reinstall pillow >> /var/log/pyazo/pyazo.log 2>&1
if [ ! -f '/etc/pyazo/secret_key' ]; then
echo " * Generating Secret Key"
python -c 'import random; result = "".join([random.choice("abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)") for i in range(50)]); print(result)' > /etc/pyazo/secret_key 2> /dev/null
echo " * Generating Secret Key"
python3 -c 'import random; result = "".join([random.choice("abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)") for i in range(50)]); print(result)' > /etc/pyazo/secret_key 2> /dev/null
fi
chmod 440 /etc/pyazo/secret_key
chown -R pyazo: /var/log/pyazo/
echo " * Running Database Migration"
/usr/share/pyazo/pyazo.sh migrate
echo " * Restarting services..."
......
......@@ -13,8 +13,8 @@ fi
if [ "$1" = "purge" ]; then
if which ucf >/dev/null 2>&1; then
ucf --purge /etc/pyazo/config.d/database.yml
ucfr --purge pyazo /etc/pyazo/config.d/database.yml
ucf --purge /etc/pyazo/config.d/database.yml
ucfr --purge pyazo /etc/pyazo/config.d/database.yml
fi
rm -rf /etc/pyazo/
fi
......
[Unit]
Description=pyazo - Opensource Gyazo-compatible Imageserver (Background worker)
Description=pyazo - Open-Source Imageserver (Background worker)
After=syslog.target network.target
Requires=network.target
......
[Unit]
Description=pyazo - Opensource Gyazo-compatible Imageserver
Description=pyazo - Open-Source Imageserver
After=syslog.target network.target
Requires=network.target
......
......@@ -2,25 +2,29 @@
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
export DH_VIRTUALENV_INSTALL_ROOT=/usr/share/pyazo/
export DH_VIRTUALENV_INSTALL_SUFFIX=env
PYTHON=$(shell python3 -c "import sys;print('%d.%d' % sys.version_info[:2])")
# export DH_VIRTUALENV_INSTALL_ROOT=/usr/share/pyazo/
# export DH_VIRTUALENV_INSTALL_SUFFIX=env
# PYTHON=$(shell python3 -c "import sys;print('%d.%d' % sys.version_info[:2])")
%:
dh $@ --with=systemd --with=python-virtualenv
dh $@ --with=systemd
# --with=python-virtualenv
build-arch:
python3 -m pip install --target=vendor/ -r requirements.txt
override_dh_shlibdeps:
dh_shlibdeps -l$(shell pwd)/debian/pyazo-python$(PYTHON)/usr/share/pyazo/env/lib/python$(PYTHON)/site-packages/PIL/.libs/
dh_shlibdeps -l$(shell pwd)/debian/pyazo/usr/share/pyazo/vendor/PIL/.libs/
override_dh_virtualenv:
dh_virtualenv \
--python /usr/bin/python3 \
--skip-instal \
--upgrade-pip \
--builtin-venv \
--install-suffix env \
--extra-pip-arg --no-binary \
--extra-pip-arg --no-compile
# override_dh_virtualenv:
# dh_virtualenv \
# --python /usr/bin/python3 \
# --skip-instal \
# --upgrade-pip \
# --builtin-venv \
# --install-suffix env \
# --extra-pip-arg --no-binary \
# --extra-pip-arg --no-compile
override_dh_installinit:
dh_installinit --name=pyazo
......
......@@ -6,6 +6,3 @@ databases:
password: _DBC_DBPASS_
host: _DBC_DBSERVER_
port: _DBC_DBPORT_
options:
charset: UTF8MB4
sql_mode: STRICT_TRANS_TABLES,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO
# Register interest in Python interpreter changes and
# don't make the Python package dependent on the virtualenv package
# processing (noawait)
interest-noawait /usr/bin/python3.5
interest-noawait /usr/bin/python3.6
interest-noawait /usr/bin/python3.7
# Also provide a symbolic trigger for all dh-virtualenv packages
interest dh-virtualenv-interpreter-update
#!/bin/bash
PACKAGED=false
# Check if this file is a symlink, if so, read real base dir
BASE_DIR=$(dirname $(readlink -f ${BASH_SOURCE[0]}))
if [ $? -eq 0 ] && [ "$BASE_DIR" != $(pwd) ]; then
PACKAGED=true
fi
COMMAND="python manage.py $@"
if [ $PACKAGED == true ]; then
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
/bin/su -s /bin/bash -c "cd $BASE_DIR && source env/bin/activate && $COMMAND && deactivate" pyazo
else
cd $BASE_DIR
source env/bin/activate
$COMMAND
deactivate
fi
cd $BASE_DIR
PYTHONPATH="${BASE_DIR}/vendor/" python3 manage.py $@
......@@ -13,6 +13,7 @@ https://docs.djangoproject.com/en/1.11/ref/settings/
import logging
import os
import sys
import socket
from urllib.parse import urlparse
from pyazo import __version__
......@@ -35,7 +36,12 @@ DEBUG = CONFIG.get('debug')
CORS_ORIGIN_ALLOW_ALL = DEBUG
# config's external_url is a full URL, so we have to parse it to get the host
ALLOWED_HOSTS = [urlparse(CONFIG.get('external_url')).netloc]
# Also allow server's hostname and server's fqdn
ALLOWED_HOSTS = set([
urlparse(CONFIG.get('external_url')).netloc,
socket.getfqdn(),
socket.gethostname()
])
LOGIN_REDIRECT_URL = 'index'
# Application definition
......
......@@ -45,8 +45,3 @@ external_auth_only: false
# If this is true, images are automatically claimed if the windows user exists
# in django
auto_claim_enabled: true
# If you run pyazo behind a reverse-proxy which does SSL, uncomment this.
# The Header `X-Forwarded-Proto` should be set to `https` in your webserver.
# secure_proxy_header:
# HTTP_X_FORWARDED_PROTO: https
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment