Memopol Documentation



Similar documents
django-cron Documentation

Magento OpenERP Integration Documentation

Ettema Lab Information Management System Documentation

Trytond Magento Documentation

Source Code Management for Continuous Integration and Deployment. Version 1.0 DO NOT DISTRIBUTE

AuShadha Documentation

Continuous integration with Jenkins CI

MyMoney Documentation

Using GitHub for Rally Apps (Mac Version)

DevKey Documentation. Release 0.1. Colm O Connor

Using Git for Project Management with µvision

Livezilla How to Install on Shared Hosting By: Jon Manning

Git - Working with Remote Repositories

SagePay payment gateway package for django-oscar Documentation

StriderCD Book. Release 1.4. Niall O Higgins

Python DNS Failover Documentation

Data management on HPC platforms

Module developer s tutorial

Hadoop Data Warehouse Manual

Continuous Delivery on AWS. Version 1.0 DO NOT DISTRIBUTE

The Hitchhiker s Guide to Github: SAS Programming Goes Social Jiangtang Hu d-wise Technologies, Inc., Morrisville, NC

Rapid Website Deployment With Django, Heroku & New Relic

FEEG Applied Programming 3 - Version Control and Git II

Nupic Web Application development

Working Copy 1.4 users manual

Tuskar UI Documentation

Django FTP Deploy Documentation

Whisler 1 A Graphical User Interface and Database Management System for Documenting Glacial Landmarks

Git Basics. Christopher Simpkins Chris Simpkins (Georgia Tech) CS 2340 Objects and Design CS / 22

JBoss Developer Studio 6.0

Module 11 Setting up Customization Environment

Secure Messaging Server Console... 2

Version control. with git and GitHub. Karl Broman. Biostatistics & Medical Informatics, UW Madison

Lab 1 Whatsup Watson Hands-On Lab

Django on AppEngine Documentation

Extending Remote Desktop for Large Installations. Distributed Package Installs

ALERT installation setup

MATLAB & Git Versioning: The Very Basics

MOOSE-Based Application Development on GitLab

Theorist HT Induc0on Course Lesson 1: Se6ng up your new computer (Mac OS X >= 10.6) As of 9/27/2012

TIBCO Spotfire Server Migration. Migration Manual

Chris Rosen, Technical Product Manager for IBM Containers, Lin Sun, Senior Software Engineer for IBM Containers,

5 Mistakes to Avoid on Your Drupal Website

DevShop. Drupal Infrastructure in a Box. Jon Pugh CEO, Founder ThinkDrop Consulting Brooklyn NY

Using Toaster in a Production Environment

Cloud Services ADM. Agent Deployment Guide

CPSC 491. Today: Source code control. Source Code (Version) Control. Exercise: g., no git, subversion, cvs, etc.)

IPPBX FAQ. For Firmware Version: V2.0/V

Koalix ERP. Release 0.2

Version Control! Scenarios, Working with Git!

OpenMind: Know Your Customer

Backing Up TestTrack Native Project Databases

TARGETPROCESS HELP DESK PORTAL

Open is as Open Does: Lessons from Running a Professional Open Source Company

Working with Structured Data in Microsoft Office SharePoint Server 2007 (Part1): Configuring Single Sign On Service and Database

VMTurbo Operations Manager 4.5 Installing and Updating Operations Manager

Assignment # 1 (Cloud Computing Security)

IBM Campaign Version-independent Integration with IBM Engage Version 1 Release 3 April 8, Integration Guide IBM

Developing tests for the KVM autotest framework

STABLE & SECURE BANK lab writeup. Page 1 of 21

latest Release 0.2.6

Unity Version Control

Active Directory Management. Agent Deployment Guide

Hudson configuration manual

Building a Continuous Integration Pipeline with Docker

OpenShift on you own cloud. Troy Dawson OpenShift Engineer, Red Hat November 1, 2013

VOC Documentation. Release 0.1. Russell Keith-Magee

Install guide for Websphere 7.0

Introduction to FreeNAS development

depl Documentation Release depl contributors

Data Lab System Architecture

Fermilab Central Web Service Site Owner User Manual. DocDB: CS-doc-5372

Version Control with Git. Dylan Nugent

OpenGeo Suite for Linux Release 3.0

Agenda. Success Stories with OpenShift. 11:15-11:45 am. OpenShift Tech Overview 9:40-10:30 am. Red Hat Mobile on OpenShift 10:45-11:15 am

install the extension:

Introducing Xcode Source Control

Is This Your Pipe? Hijacking the Build Pipeline

OpenShift is FanPaaStic For Java EE. By Shekhar Gulati Promo Code JUDCON.IN

Virtual Machine daloradius Administrator Guide Version 0.9-9

Setting Up a CLucene and PostgreSQL Federation

Camilyo APS package by Techno Mango Service Provide Deployment Guide Version 1.0

How to set up SQL Source Control. The short guide for evaluators

Continuous Integration (CI) and Testing - Configuring Bamboo, Hudson, and TestMaker

Lab Exercise Part II: Git: A distributed version control system

Avatier Identity Management Suite

KonyOne Server Installer - Linux Release Notes

Installing T-HUB on multiple computers

To install Multifront you need to have familiarity with Internet Information Services (IIS), Microsoft.NET Framework and SQL Server 2008.

Microsoft Project Server Integration with SharePoint 2010

Getting the most out of your new Aalto workstation An Aalto IT guide for personnel migrating to the new Aalto workstation environment

Parallels Plesk Automation

About This Document 3. About the Migration Process 4. Requirements and Prerequisites 5. Requirements... 5 Prerequisites... 5

Continuous Integration and Delivery. manage development build deploy / release

Transcription:

Memopol Documentation Release 1.0.0 Laurent Peuch, Mindiell, Arnaud Fabre January 26, 2016

Contents 1 User guide 3 1.1 Authentication in the admin backend.................................. 3 1.2 Managing representative positions.................................... 3 1.3 Managing vote recommendations.................................... 3 1.4 Data updates............................................... 3 2 Deployment on OpenShift 5 2.1 Clone the repository........................................... 5 2.2 Create an app on OpenShift....................................... 5 2.3 Add the git remote created by OpenShift................................ 6 2.4 Activate OpenShift s git post-recieve hook............................... 6 2.5 Deploy your branch........................................... 6 2.6 Data provisionning............................................ 6 3 Administrator guide 7 3.1 Authentication in the admin backend.................................. 7 3.2 User groups................................................ 7 3.3 Creating a user.............................................. 7 4 Local development tutorial 9 4.1 Make a virtual environment....................................... 9 4.2 Clone the repository........................................... 9 4.3 Install Python dependencies....................................... 10 4.4 Install client dependencies........................................ 10 4.5 Activate DJANGO_DEBUG........................................ 10 4.6 Run the development server....................................... 10 4.7 Database migrations........................................... 11 4.8 Provision with data............................................ 11 5 Hacker guide 13 5.1 Adding random recommendations.................................... 13 5.2 Creating test fixtures........................................... 13 6 Indices and tables 15 i

ii

Memopol Documentation, Release 1.0.0 Contents: Contents 1

Memopol Documentation, Release 1.0.0 2 Contents

CHAPTER 1 User guide 1.1 Authentication in the admin backend As a content-editor, you should be able to connect to the administration interface with the credentials and link that your administrator sent you. If they haven t, please email them with a request and eventually a link to Administrator guide. 1.2 Managing representative positions Our dear representatives make promises to be elected. These can be submitted by visitors on the front-end so one of your tasks is to review them and publish them if they are appropriate. In Positions -> Position -> Change (url should be /admin/positions/position/), above the list table, click the Published select box and choose the Published: No option, then click Search. Alternatively, you may bookmark /admin/positions/position/?published exact=0. Click a Position and if it s appropriate then check the Published checkbox and click Save. The position will now appear in the representative detail page. 1.3 Managing vote recommendations A recommendation represents the vote we want representatives to make on a proposal: representatives doing the recommended vote will have their score increased, others will have their score decreased. Some recommendations may be more important than others, you can change the number of score points a recommendation is worth by changing its weight (must be a positive integer). In Votes -> Recommendations -> Change (url should be /admin/votes/recommendation/), you can create, update or remove recommendations. Your change won t be visible on score as soon as you make it. 1.4 Data updates Data updates daily: representatives details are updated daily, 3

Memopol Documentation, Release 1.0.0 dossiers are synchronised daily, proposals are synchronised daily, when proposals are synchronised, they become available to use in Recommendations. votes and scores are synchronised daily for proposals which have a Recommendation, This means that if a proposal arrives today in the database, you may add a recommendation for it. The next day, votes will be imported and scores will be updated as well. 4 Chapter 1. User guide

CHAPTER 2 Deployment on OpenShift OpenShift is an Open-Source Platform-as-a-Service software by Red Hat. It is also available in its hosted version known as OpenShift Online and the first three websites ( gears ) are free. 2.1 Clone the repository You should fork the project on github and use the fork s clone url. For the sake of the demo, we ll use the main repository URL: $ git clone https://github.com/political-memory/political_memory.git Cloning into 'political_memory'... remote: Counting objects: 2516, done. remote: Compressing objects: 100% (109/109), done. remote: Total 2516 (delta 44), reused 0 (delta 0), pack-reused 2402 Receiving objects: 100% (2516/2516), 4.40 MiB 79.00 KiB/s, done. Resolving deltas: 100% (1103/1103), done. Checking connectivity... done. $ cd political_memory/ Create your own branch, ie: $ git checkout -b yourbranch origin/pr Branch yourbranch set up to track remote branch pr from origin. Switched to a new branch 'yourbranch' 2.2 Create an app on OpenShift To deploy the website, use a command like: $ rhc app-create \ python-2.7 \ cron-1.4 \ postgresql-9.2 \ -a yourappname \ -e OPENSHIFT_PYTHON_WSGI_APPLICATION=memopol/wsgi.py \ --from-code https://github.com/political-memory/political_memory.git \ --no-git 5

Memopol Documentation, Release 1.0.0 This should create an app on openshift. Other commands would deploy it at once but in this tutorial we re going to see how to manage it partly manually for development. 2.3 Add the git remote created by OpenShift Add the git remote openshift created for you, you can see it with rhc app-show, ie.: $ rhc app-show -a yourappname [snip] Git URL: ssh://569f5cf500045f6a1839a0a4@yourappname-yourdomain.rhcloud.com/~/git/yourappname. Initial Git URL: https://github.com/political-memory/political_memory.git SSH: 569f5cf500045f6a1839a0a4@yourappname-yourdomain.rhcloud.com [snip] $ git remote add oo_yourappname ssh://569f5cf500045f6a1839a0a4@yourappname-yourdomain.rhcloud.com/~/g 2.4 Activate OpenShift s git post-recieve hook Activate OpenShift s post-receive hook on your branch: $ rhc app-configure -a yourappname --deployment-branch yourbranch 2.5 Deploy your branch OpenShift will deploy when it receives commits on the deployment branch, to deploy just do: $ git push oo_yourappname yourbranch If something goes wrong and you want to retry, use the rhc app-deploy command, ie: $ rhc app-deploy yourbranch -a yourappname 2.6 Data provisionning To fill up the representatives database table, either wait for the cron script to be executed, either do it manually: $ rhc ssh -a yourappname 'cd app-root/repo/ && bin/update_all' OpenShift is fun, login with ssh and look around if you re curious, you ll be able to recreate your app without much effort if you break it anyway. Continue to Administrator guide. 6 Chapter 2. Deployment on OpenShift

CHAPTER 3 Administrator guide This guide targets the administrator who has deployed the website in production. 3.1 Authentication in the admin backend If you haven t already, create a super-administrator account with command:./manage.py createsuperuser Then use this account to authenticate in the administration backend located in /admin. 3.2 User groups You should create a user group with all permissions on: vote recommendation positions position 3.3 Creating a user To create a content administrator, create a user with: Staff status : checked, otherwise the user won t be able to authenticate in the administration backend, groups: at least the group created above. Then, send the credentials to the user along with a link to User guide. 7

Memopol Documentation, Release 1.0.0 8 Chapter 3. Administrator guide

CHAPTER 4 Local development tutorial This tutorial drives through a local installation of the project for development on Linux. It requires git, a fairly recent version of nodejs (see.openshift/action_hooks/deploy for a way to install it), python2 and virtualenv. 4.1 Make a virtual environment For the sake of the tutorial, we ll do this in the temporary directory, but you could do it anywhere: $ cd /tmp Create a python virtual environment and activate it: $ virtualenv memopol_env Using real prefix '/usr' New python executable in memopol_env/bin/python2 Also creating executable in memopol_env/bin/python Installing setuptools, pip, wheel...done. $ source memopol_env/bin/activate 4.2 Clone the repository You should fork the project on github and use the fork s clone url. For the sake of the demo, we ll use the main repository URL: $ git clone https://github.com/political-memory/political_memory.git Cloning into 'political_memory'... remote: Counting objects: 2516, done. remote: Compressing objects: 100% (109/109), done. remote: Total 2516 (delta 44), reused 0 (delta 0), pack-reused 2402 Receiving objects: 100% (2516/2516), 4.40 MiB 79.00 KiB/s, done. Resolving deltas: 100% (1103/1103), done. Checking connectivity... done. $ cd political_memory/ Create your own branch, ie: 9

Memopol Documentation, Release 1.0.0 $ git checkout -b yourbranch origin/pr Branch yourbranch set up to track remote branch pr from origin. Switched to a new branch 'yourbranch' 4.3 Install Python dependencies Then, install the package for development: $ pip install -e. Obtaining file:///tmp/political_memory Collecting django (from political-memory==0.0.1) Using cached Django-1.9-py2.py3-none-any.whl [output snipped for readability] Installing collected packages: django, sqlparse, django-debug-toolbar, django-pdb, six, django-extens Running setup.py develop for political-memory Successfully installed django-1.9 django-coffeescript-0.7.2 django-debug-toolbar-1.4 django-extension 4.4 Install client dependencies We ll also need to download client libraries: $ bin/install_client_deps.sh * Downloading jquery/jquery (2.1.4) from Github... * Downloading FortAwesome/Font-Awesome (v4.3.0) from Github... * Downloading lipis/flag-icon-css (0.7.1) from Github... * Downloading twbs/bootstrap (v3.3.5) from Github... * Done 4.5 Activate DJANGO_DEBUG DEBUG is disabled by default, the development server won t run properly by default thnen, to enable it export the DJANGO_DEBUG variable in the current shell: $ export DJANGO_DEBUG=True 4.6 Run the development server Run the development server: $./manage.py runserver Performing system checks... System check identified no issues (0 silenced). December 09, 2015-21:26:47 Django version 1.8.7, using settings 'memopol.settings' Starting development server at http://127.0.0.1:8000/ 10 Chapter 4. Local development tutorial

Memopol Documentation, Release 1.0.0 Quit the server with CONTROL-C. [09/Dec/2015 21:26:48] "GET / HTTP/1.1" 200 13294 The website is running on http://127.0.0.1:8000/. 4.7 Database migrations The repo comes with a pre-configured SQLite db with sample data so that you can start hacking right away. However, if you were to use a local postgresql database ie. with this sort of environment: export DJANGO_DATABASE_DEFAULT_NAME=memopol export DJANGO_DATABASE_DEFAULT_USER=postgres export DJANGO_DATABASE_DEFAULT_ENGINE=django.db.backends.postgresql_psycopg2 export DJANGO_DEBUG=1 export DJANGO_SETTINGS_MODULE=memopol.settings Then you could run database migrations: $./manage.py migrate Operations to perform: Synchronize unmigrated apps: django_filters, staticfiles, datetimewidget, autocomplete_light, messa Apply all migrations: legislature, votes, database, admin, positions, sessions, representatives, au Synchronizing apps without migrations: Creating tables... Running deferred SQL... Installing custom SQL... Running migrations: Rendering model states... DONE Applying contenttypes.0001_initial... OK [output snipped for readability] Applying taggit.0002_auto_20150616_2121... OK 4.8 Provision with data Again, the repo comes with a pre-configured SQLite db with sample data so that you can start hacking right away. However, you could still reload sample data: $./manage.py loaddata memopol/fixtures/small_sample.json Or actual data (takes a while): $ bin/update_all Continue to Administrator guide. 4.7. Database migrations 11

Memopol Documentation, Release 1.0.0 12 Chapter 4. Local development tutorial

CHAPTER 5 Hacker guide 5.1 Adding random recommendations $./manage.py shell In [1]: from representatives_votes.models import Proposal In [2]: from votes.models import Recommendation In [3]: import random In [4]: for p in Proposal.objects.all(): Recommendation.objects.create(proposal=p, recommendation='fo 5.2 Creating test fixtures The largest test fixtures are, the longer it takes to load them, the longer the test run is. To create test fixtures for representatives_positions, insert some Position objects, and reduce the database with:./manage.py remove_representatives_without_position./manage.py remove_groups_without_mandate./manage.py remove_countries_without_group For representatives_recommendations:./manage.py remove_proposals_without_recommendation./manage.py remove_dossiers_without_proposal./manage.py remove_representatives_without_vote./manage.py remove_groups_without_mandate./manage.py remove_countries_without_group 13

Memopol Documentation, Release 1.0.0 14 Chapter 5. Hacker guide

CHAPTER 6 Indices and tables genindex modindex search 15