Skip to content

Installation instructions v 2.x

slauriere edited this page Feb 21, 2019 · 90 revisions

These instructions explain how to install wikidemarches (nosdemarches), versions 2.x.

This project is built to run on top of XWiki Standard , version 9.11.3 - see http://www.xwiki.org .

Build

Build the code of this repo using maven (set up as explained in http://dev.xwiki.org/xwiki/bin/view/Community/Building/#HInstallingMaven ), with

mvn clean install

then use the built artefacts to install as described under.

Installation

WAR setup

XWiki standard war, version 9.11.3, which can be downloaded from here: http://maven.xwiki.org/releases/org/xwiki/platform/xwiki-platform-web/9.11.3/ .

The following additional settings are required by the project:

  • Only for migration from 1.x : before configuring the war as described below, modify the wiki aliases on the wiki, as follows (in the configuration of the wikis, accessible from the wikis index):

    • main wiki needs to have the URL of the server as alias (e.g. nosdemarches.gouv.fr or wikidemarches.devxwiki.com)
    • all subwikis (wikidemarches and wikidemat) need to have their subwiki id as alias
  • Deploy XWiki to the webapps/ROOT instead of webapps/xwiki and copy xwiki.cfg, xwiki.properties and urlrewrite.xml from the sources from web/src/main/webapp/WEB-INF into the WEB-INF folder of the deployment. Then perform the following configurations:

    • for the first install of a 2.5+ version:
      • install OpenId authenticator extension first, see "Extensions to be installed on main wiki" lower in this document
      • for all user accounts that need to be preserved between the current server and the Open Id provider server that will be configured in xwiki.properties, an object of type XWiki.OIDC.UserClass should be added in the user profile, with property subject set to the fullname of the corresponding user on the OpenId provider server and the field issuer set to the URL of the OpenId provider server address
    • in xwiki.cfg :
      • set xwiki.authentication.validationKey and xwiki.authentication.encryptionKey to safely generated random keys
    • in xwiki.properties :
      • set environment.permanentDirectory to the value corresponding to the current instance
      • set openoffice.homePath to the value corresponding to the current instance
      • configure the Open Id authentication provider in property oidc.xwikiprovider
        • make sure that there is a group called NosdemarchesMinisteresGroup on the Open Id authentication provider server, and that it's filled with all users that have the role "Ministeres". If this group is called otherwise on the provider server, the oidc groups mapping should be updated.
  • Deploy xwiki-platform-legacy-oldcore-DINSICDEMA9.11.3-b55fe5c5c2fb453bb4154999f94de7e014b7fa58.jar as follows:

    • Checkout xwiki-platform-legacy-oldcore-DINSICDEMA9.11.3-b55fe5c5c2fb453bb4154999f94de7e014b7fa58.jar from the bin folder of the wikidemarches git repository
    • Copy and paste this jar into the WEB-INF/lib folder of the webapp
    • Remove xwiki-platform-legacy-oldcore-9.11.3.jar from the same folder
    • Restart the server (once the operations below are done as well)
  • Deploy xwiki-platform-search-solr-api-DINSICDEMA9.11.3-45ad9b0e084d555ea5dc1361eb7edb41d61e30d0.jar as follows:

    • Checkout the jar from the bin folder of the wikidemarches git repository
    • Copy and paste this jar into the WEB-INF/lib folder of the webapp
    • Remove xwiki-platorm-search-solr-api-9.11.3.jar from that folder
  • Deploy the tools-api-.jar, built or released from module extensions/tools/tools-api in WEB-INF/lib

    • for first install of a 2.4+ version: remove the avis-stats jar from WEB-INF/lib
  • Deploy the excel plugin in WEB-INF/lib as follows:

Apache configuration

  • This project runs on a standard Apache configuration, which needs to serve the file from robots-public.txt as robots.txt .
  • Deactivate the redirection from "/Main/" to "/" before the execution of the steps below (and reactivate it once done, as mentioned below).
  • The Apache configuration should pass requests to tomcat for / and should include some specific redirections described below
    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^nosdemarches.gouv.fr
    RewriteRule ^/?(.*) https://nosdemarches.gouv.fr/$1 [R,L]

    RewriteRule "/robots.txt$" "/robots-public.txt" [L,PT]
    RewriteRule "^/$" "/bin/view/Main/" [L,PT]
    RewriteRule "^/bin/view/Main/$" "/" [L,R]
    RewriteRule "^/bin/Main/$" "/" [L,R]
    RewriteRule "^/Main/$" "/" [L,R]
  • The Apache ProxyTimeout parameter should be set to 600 seconds or more (otherwise, long requests fired by livetable downloads will result in a server timeout error):
ProxyTimeout 600

Main wiki

Important note about user management : For all users created on the main wiki, only XWikiAllGroup and the user itself must have view access on the user profile page (to prevent guest from viewing). A script to automatize this for already created users is available, starting with version 2.0, in Administration.RestrictUsersRights .

Migration from 1.x (if necessary)

If this is the first install of the 2.x version and it is an upgrade of an 1.x version, follow the Migration instructions 1.x -> 2.0 before following the instructions under.

Extensions to be installed:

  • XWiki Livetable Exporter Macro, version 3.0 (extension id: org.xwiki.contrib:xwiki-livetable-exporter-macro)
  • UIN Script Service (for creating new Avis): org.xwiki.contrib:api-uin-scriptservice version 2.0
  • Open Sans font as webjar: Using advanced search, install the following extension org.webjars.bower:open-sans version 1.1.0
  • Query Generator and Query Macro, version 1.4.1 (extension id: org.xwiki.contrib:application-querygenerator )
    • edit rights on page Macros.QueryGenerator and give 'view' right only to Admin group (local admin group)
  • AppWithin Minutes Charts and Data, version 1.2.2 (extension id: org.xwiki.contrib:appwithinminutes-charts
  • OpenCSV (for exporting data in CSV): com.opencsv:opencsv version 3.10
  • Chart.js Integration ( org.xwiki.contrib:application-chartjs-ui ), version 1.1.6
  • for versions 2.5+: OpenID Connect Authenticator (org.xwiki.contrib.oidc:oidc-authenticator) version 1.12

Custom code:

Note that for the migration from 1.x to 2.0, the "First install" instructions need to be applied.

First install

  • Delete the french translation of the Main.WebHome page, as follows:
    • Go to wiki administration
    • Enable multilanguage, setup english and french as available languages
    • Save
    • Go on the main page, in french language, and manually change the url the delete action URL with parameter ?language=fr (/xwiki/bin/delete/Main/WebHome?language=fr)
    • Confirm delete, accept to delete pages from the extension "XWiki Platform - Distribution - Flavor - Common" (click "sélectionner tout", there's a bug in the platform)
    • Restore the wiki in French language only
  • Uninstall the following extensions: Help Center Application 1.2, Sandbox application 9.11.3, Help Application 9.11.3
  • Import xwiki-dinsic-wikidemarches-wikis-main-.xar

Upgrade from a previous version

  • Using Administration->Content->Import, import the artifact xwiki-dinsic-wikidemarches-wikis-main-upgrade-.xar
  • Manually remove from the wiki the pages that were deleted from the repo since the last install
  • Manually upgrade the non-upgradable pages that were modified since last install
    • Only for versions <= 2.1 If TableauDeBord.WebHome is upgraded re-generate the attached demarches.csv file by exporting in excel, removing the last 2 columns, saving as csv (tab separated, encoding UTF-16) and then resaving with encoding "UTF-16 LE with BOM"
  • For the first upgrade to a version >= 2.1: compute the demarches stats cache by accessing the page Avis.Code.AvisStatsManager and clicking on "Initialiser les statistiques pour toutes les demarches"
    • before launching, de-activate autowatch for users Admin and slauriere
    • in order to follow the logs of this operation, activate "Debug" log level (from Administration -> Journalisation) for the class com.xwiki.projects.dinsic.wikidemarches.extensions.tools.DefaultAvisStatsManager .

Migration from 1.x (if necessary)

UIN

If this is the first install of the 2.x version and it is an upgrade of an 1.x version, copy the current UIN and increment values from the wikidemarches and wikidemat subwikis into the main wiki, as follows:

  • wikidemat uin -> copied as named "demarches" uin config
  • wikidemarches uin -> copied as named "avis" uin config

The UIN config is available in a dedicated administration subsection (in section "Other").

User rigths migration

  • Use the script in Administration.RestrictUsersRights with a date parameter at the beginning of the year (e.g. 2018-01-01 00:00 ) to add rights on all user profiles so that they are not visible to guest: add ?fromDate=2018-01-01 00:00 to the page URL.

Handling non-upgradable pages:

  • Rollback the TableauDeBord.WebHome page to the previous version
  • Rollback the XWiki.XWikiAdminGroup page to its previous version, and add explicit view rights on it to group XWiki.XWikiAllGroup

Data reindexation

  • It is necessary to launch a reindexing of all the wiki data: head to the administration, select "Reindex", "Main wiki".

Apache configuration

  • Reactivate the redirection from "/Main/" to "/".