Commit 9c884e2a authored by James Pic's avatar James Pic
Browse files

Merge pull request #47 from political-memory/pr

Release
parents de0af789 832e7e33
{
"directory": "static/libs"
}
*.sqlite3 *.sqlite3
celerybeat-* celerybeat-*
core/static/libs/* core/static/libs/*
deploy
# libs # libs
static/libs static/libs
node_modules
# compiled css
static/stylesheets/*.min.css
# settings # settings
memopol/config.json memopol/config.json
...@@ -21,3 +15,6 @@ __pycache__/ ...@@ -21,3 +15,6 @@ __pycache__/
# Installer logs # Installer logs
pip-log.txt pip-log.txt
pip-delete-this-directory.txt pip-delete-this-directory.txt
.dpl
db.sqlite
log/
The OpenShift `python` cartridge documentation can be found at:
http://openshift.github.io/documentation/oo_cartridge_guide.html#python
For information about .openshift directory, consult the documentation:
http://openshift.github.io/documentation/oo_user_guide.html#the-openshift-directory
For information about action hooks, consult the documentation:
http://openshift.github.io/documentation/oo_user_guide.html#action-hooks
export OPENSHIFT_PYTHON_WSGI_APPLICATION=memopol/wsgi.py
#!/bin/bash
# This deploy hook gets executed after dependencies are resolved and the
# build hook has been run but before the application has been started back
# up again. This script gets executed directly, so it could be python, php,
# ruby, etc.
set -xe
source ${OPENSHIFT_HOMEDIR}app-root/runtime/dependencies/python/virtenv/bin/activate
pip install -U pip
pip install -Ue ${OPENSHIFT_REPO_DIR}
# We don't have sentry yet
# python ${OPENSHIFT_REPO_DIR}manage.py raven test
python ${OPENSHIFT_REPO_DIR}manage.py migrate --noinput
pushd ${OPENSHIFT_REPO_DIR}
if [ -f ${OPENSHIFT_DATA_DIR}sentry ]; then
pip install raven
./manage.py raven test
else
echo ${OPENSHIFT_DATA_DIR}sentry does not exist, not setting up raven.
fi
PATH="${OPENSHIFT_DATA_DIR}node/bin:$PATH"
HOME=$OPENSHIFT_DATA_DIR
CI=true
bin/install_client_deps.sh
mkdir -p wsgi
./manage.py collectstatic --noinput
./manage.py compress
popd
mkdir -p ${OPENSHIFT_DATA_DIR}media
mkdir -p ${OPENSHIFT_REPO_DIR}wsgi/static/media
ln -sf ${OPENSHIFT_DATA_DIR}media ${OPENSHIFT_REPO_DIR}wsgi/static/media
ln -sf ${OPENSHIFT_DATA_DIR}compress/CACHE ${OPENSHIFT_REPO_DIR}wsgi/static/collected/CACHE
Run scripts or jobs on a periodic basis
=======================================
Any scripts or jobs added to the minutely, hourly, daily, weekly or monthly
directories will be run on a scheduled basis (frequency is as indicated by the
name of the directory) using run-parts.
run-parts ignores any files that are hidden or dotfiles (.*) or backup
files (*~ or *,) or named *.{rpmsave,rpmorig,rpmnew,swp,cfsaved}
The presence of two specially named files jobs.deny and jobs.allow controls
how run-parts executes your scripts/jobs.
jobs.deny ===> Prevents specific scripts or jobs from being executed.
jobs.allow ===> Only execute the named scripts or jobs (all other/non-named
scripts that exist in this directory are ignored).
The principles of jobs.deny and jobs.allow are the same as those of cron.deny
and cron.allow and are described in detail at:
http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/ch-Automating_System_Tasks.html#s2-autotasks-cron-access
See: man crontab or above link for more details and see the the weekly/
directory for an example.
PLEASE NOTE: The Cron cartridge must be installed in order to run the configured jobs.
For more information about cron, consult the documentation:
http://openshift.github.io/documentation/oo_cartridge_guide.html#cron
http://openshift.github.io/documentation/oo_user_guide.html#cron
#!/bin/bash
set -x
cmd=$1
cd $OPENSHIFT_REPO_DIR
export CLEAN=1
nohup bin/update_all > $OPENSHIFT_LOG_DIR/update_all.log 2>&1 &
Run scripts or jobs on a weekly basis
=====================================
Any scripts or jobs added to this directory will be run on a scheduled basis
(weekly) using run-parts.
run-parts ignores any files that are hidden or dotfiles (.*) or backup
files (*~ or *,) or named *.{rpmsave,rpmorig,rpmnew,swp,cfsaved} and handles
the files named jobs.deny and jobs.allow specially.
In this specific example, the chronograph script is the only script or job file
executed on a weekly basis (due to white-listing it in jobs.allow). And the
README and chrono.dat file are ignored either as a result of being black-listed
in jobs.deny or because they are NOT white-listed in the jobs.allow file.
For more details, please see ../README.cron file.
Time And Relative D...n In Execution (Open)Shift!
#!/bin/bash
echo "`date`: `cat $(dirname \"$0\")/chrono.dat`"
#
# Script or job files listed in here (one entry per line) will be
# executed on a weekly-basis.
#
# Example: The chronograph script will be executed weekly but the README
# and chrono.dat files in this directory will be ignored.
#
# The README file is actually ignored due to the entry in the
# jobs.deny which is checked before jobs.allow (this file).
#
chronograph
#
# Any script or job files listed in here (one entry per line) will NOT be
# executed (read as ignored by run-parts).
#
README
For information about markers, consult the documentation:
http://openshift.github.io/documentation/oo_user_guide.html#markers
sudo: false sudo: false
env:
- DJANGO_DEBUG=True DJANGO_SETTINGS_MODULE=memopol.settings
language: python language: python
python: python:
- "2.7" - '2.7'
before_install:
- pip install codecov
install: install:
- pip install django - pip install -e .[testing]
- pip install -U pip
- pip install -r requirements.txt
- cp memopol/config.json.sample memopol/config.json
before_script: before_script:
- npm install -g bower - bin/install_client_deps.sh
- bower install
- npm install
script: script:
- ./manage.py migrate - bash -c '! lesscpy -N static/less/base.less 2>&1 | grep Error'
- node_modules/gulp/bin/gulp.js less - flake8 . --exclude '*/migrations,docs,static' --ignore E128
- py.test memopol representatives_positions representatives_recommendations
- rm -rf db.sqlite
- django-admin migrate
- django-admin update_score
after_success:
- codecov
deploy:
- provider: openshift
user: jamespic@gmail.com
password:
secure: W7hQDKAtmpOfwLjBuss6NEKqPSrRhsbgH8a8eV+/Oo6HZxMi1mbNFSi+6WRNSs3Cil0ZZV+awoqC61jIzV4oTwEYcy5bv9NWNSY1QO34DECMS5sY00wA0zKhkdsdTr9Pc3TLRp1cw6x2KNCF356FKZojFTRbjtfJ79rqBc5k5ww=
app: master
domain: memopol
skip_cleanup: true
deployment_branch: master
on:
repo: political-memory/political_memory
branch: master
- provider: openshift
user: jamespic@gmail.com
password:
secure: W7hQDKAtmpOfwLjBuss6NEKqPSrRhsbgH8a8eV+/Oo6HZxMi1mbNFSi+6WRNSs3Cil0ZZV+awoqC61jIzV4oTwEYcy5bv9NWNSY1QO34DECMS5sY00wA0zKhkdsdTr9Pc3TLRp1cw6x2KNCF356FKZojFTRbjtfJ79rqBc5k5ww=
app: lqdn
domain: memopol
skip_cleanup: true
deployment_branch: lqdn
on:
repo: political-memory/political_memory
branch: lqdn
- provider: openshift
user: jamespic@gmail.com
password:
secure: W7hQDKAtmpOfwLjBuss6NEKqPSrRhsbgH8a8eV+/Oo6HZxMi1mbNFSi+6WRNSs3Cil0ZZV+awoqC61jIzV4oTwEYcy5bv9NWNSY1QO34DECMS5sY00wA0zKhkdsdTr9Pc3TLRp1cw6x2KNCF356FKZojFTRbjtfJ79rqBc5k5ww=
app: pr
domain: memopol
skip_cleanup: true
deployment_branch: pr
on:
repo: political-memory/political_memory
branch: pr
How to install memopol
1. Create a directory containing the whole project (say ~memopol)
2. Create a python virtualenv in ~memopol : ~memopol/ve
3. Clone memopol main repository (http://git.laquadrature.net/memopol/memopol_political_memory) in ~memopol/memopol_political_memory
4. Clone django-representative directory (http://git.laquadrature.net/memopol/compotista_django-representatives) in ~memopol/django-representatives
5. Clone the last version of django-chronograph (https://bitbucket.org/wnielson/django-chronograph) in ~memopol/django-chronograph
(It seems that the version in pip is not up to date…)
6. Symlink ~memopol/memopol_political_memory/representatives -> ~memopol/django-representatives/representatives
7. Symlink ~memopol/memopol_political_memory/chronograph -> ~memopol/django-chronograph/chronograph
8. Install requierements in the virtualenv with pip install -r ~memopol//memopol_political_memory/requierements
9. Config your database in ~memopol/memopol_political_memory/settings.py
10. Sync the database python manage.py syncdb
11. Import mep from a compotista instance : python manage.py update update_eu_mps
12. Run the server
Supports Markdown
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