Commit 0bc8954b authored by Michal Čihař's avatar Michal Čihař

Merge pull request #708 from dtschan/openshift

Openshift
parents 363cc8de a955ff83
...@@ -19,14 +19,12 @@ ...@@ -19,14 +19,12 @@
# #
# Don't let OpenShift install weblate and its dependencies directly as this leads to timeouts during gear creation and deploys # Don't let OpenShift install weblate and its dependencies directly as this leads to timeouts during gear creation and deploys
export OPENSHIFT_PYTHON_REQUIREMENTS_PATH=no_such_file
if [ -e $OPENSHIFT_REPO_DIR/setup.py ]; then if [ -e $OPENSHIFT_REPO_DIR/setup.py ]; then
mv $OPENSHIFT_REPO_DIR/setup.py $OPENSHIFT_REPO_DIR/setup_weblate.py mv $OPENSHIFT_REPO_DIR/setup.py $OPENSHIFT_REPO_DIR/setup_weblate.py
fi fi
if [ -e $OPENSHIFT_REPO_DIR/requirements.txt ]; then
mv $OPENSHIFT_REPO_DIR/requirements.txt $OPENSHIFT_REPO_DIR/requirements-mandatory.txt
fi
# Show install/update page, will be replaced with app by install.sh # Show install/update page, will be replaced with app by install.sh
# Link sources below $OPENSHIFT_REPO_DIR must be relative or they will be invalid after restore/clone operations # Link sources below $OPENSHIFT_REPO_DIR must be relative or they will be invalid after restore/clone operations
mkdir -p $OPENSHIFT_REPO_DIR/wsgi mkdir -p $OPENSHIFT_REPO_DIR/wsgi
......
...@@ -51,20 +51,20 @@ source $OPENSHIFT_HOMEDIR/python/virtenv/bin/activate ...@@ -51,20 +51,20 @@ source $OPENSHIFT_HOMEDIR/python/virtenv/bin/activate
cd ${OPENSHIFT_REPO_DIR} cd ${OPENSHIFT_REPO_DIR}
sh "python ${OPENSHIFT_REPO_DIR}/setup_weblate.py develop" # Pin Django version to 1.8 to avoid surprises when 1.9 comes out.
sed -e 's/Django[<>=]\+.*/Django>=1.8,<1.9/' $OPENSHIFT_REPO_DIR/requirements.txt >/tmp/requirements.txt
# Pin Django version to 1.7 to avoid surprises when 1.8 comes out.
sed -e 's/Django[<>=]\+.*/Django>1.7,<1.8/' $OPENSHIFT_REPO_DIR/requirements-mandatory.txt >/tmp/requirements.txt
sh "pip install -r /tmp/requirements.txt" sh "pip install -U -r /tmp/requirements.txt"
# Install optional dependencies without failing if some can't be installed. # Install optional dependencies without failing if some can't be installed.
while read line; do while read line; do
if [[ $line != -r* ]]; then if [[ $line != -r* ]] && [[ $line != \#* ]]; then
sh "pip install $line" || true sh "pip install $line" || true
fi fi
done < $OPENSHIFT_REPO_DIR/requirements-optional.txt done < $OPENSHIFT_REPO_DIR/requirements-optional.txt
sh "python ${OPENSHIFT_REPO_DIR}/setup_weblate.py develop"
if [ ! -s $OPENSHIFT_DATA_DIR/weblate.db ]; then if [ ! -s $OPENSHIFT_DATA_DIR/weblate.db ]; then
rm -f ${OPENSHIFT_DATA_DIR}/.credentials rm -f ${OPENSHIFT_DATA_DIR}/.credentials
fi fi
...@@ -100,7 +100,7 @@ sh "python ${OPENSHIFT_REPO_DIR}/openshift/manage.py collectstatic --noinput" ...@@ -100,7 +100,7 @@ sh "python ${OPENSHIFT_REPO_DIR}/openshift/manage.py collectstatic --noinput"
if [ ! -s $OPENSHIFT_DATA_DIR/.credentials ]; then if [ ! -s $OPENSHIFT_DATA_DIR/.credentials ]; then
echo "Generating Weblate admin credentials and writing them to ${OPENSHIFT_DATA_DIR}/.credentials" echo "Generating Weblate admin credentials and writing them to ${OPENSHIFT_DATA_DIR}/.credentials"
sh "python ${OPENSHIFT_REPO_DIR}/openshift/manage.py createadmin" sh "python ${OPENSHIFT_REPO_DIR}/openshift/manage.py createadmin"
sh "python ${OPENSHIFT_REPO_DIR}/openshift/secure_db.py | tee ${OPENSHIFT_DATA_DIR}/.credentials" DJANGO_SETTINGS_MODULE='weblate.settings_openshift' sh "python ${OPENSHIFT_REPO_DIR}/openshift/secure_db.py | tee ${OPENSHIFT_DATA_DIR}/.credentials"
fi fi
if find_script_dir; then if find_script_dir; then
......
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from django.conf import settings
import os import os
import sqlite3 import sqlite3
from openshift.openshiftlibs import make_secure_key, get_openshift_secret_token from openshift.openshiftlibs import make_secure_key, get_openshift_secret_token
...@@ -29,9 +27,6 @@ from django.contrib.auth.hashers import make_password ...@@ -29,9 +27,6 @@ from django.contrib.auth.hashers import make_password
def secure_db(): def secure_db():
# Use default Django settings
settings.configure()
new_pass = make_secure_key({ new_pass = make_secure_key({
'hash': sha256(get_openshift_secret_token()).hexdigest(), 'hash': sha256(get_openshift_secret_token()).hexdigest(),
'original': '0' * 12, 'original': '0' * 12,
......
-r requirements.txt -r requirements.txt
#pyuca #pyuca
https://github.com/SmileyChris/pyuca/archive/master.zip git+https://github.com/SmileyChris/pyuca@555292b
pyLibravatar pyLibravatar
pydns pydns
babel babel
......
...@@ -94,12 +94,13 @@ setup( ...@@ -94,12 +94,13 @@ setup(
download_url='https://github.com/nijel/weblate', download_url='https://github.com/nijel/weblate',
author='Michal Čihař', author='Michal Čihař',
author_email='michal@cihar.com', author_email='michal@cihar.com',
dependency_links=[
'git+https://github.com/SmileyChris/pyuca@555292b#egg=pyuca-1.0',
],
install_requires=REQUIRES, install_requires=REQUIRES,
extras_require={ extras_require={
'Mercurial': ['Mercurial>=2.8'], 'Mercurial': ['Mercurial>=2.8'],
'Unicode': [ 'Unicode': ['pyuca==1.0'],
'https://github.com/SmileyChris/pyuca/archive/master.zip'
],
'Avatars': ['pyLibravatar', 'pydns'], 'Avatars': ['pyLibravatar', 'pydns'],
'Android': ['babel'], 'Android': ['babel'],
}, },
......
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