Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/release-v22' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
vhf committed Feb 24, 2017
2 parents 349c645 + ccdb3f8 commit 2c918aa
Show file tree
Hide file tree
Showing 15 changed files with 253 additions and 134 deletions.
4 changes: 2 additions & 2 deletions assets/scss/components/_search-box.scss
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@
height: 134px;

@at-root {
body.vc-clem-christmas.home .search-box::before {
body.vc-clem-christmas .search-box::before {
background-image: url('../images/home-clem-christmas.png');
}

body.vc-clem-halloween.home .search-box::before {
body.vc-clem-halloween .search-box::before {
background-image: url('../images/home-clem-halloween.png');
width: 160px;
left: -80px;
Expand Down
2 changes: 1 addition & 1 deletion assets/scss/pages/_home.scss
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@

@media only screen and #{$media-mobile-tablet} {
.home {
.home-header {
.flexpage-header {
padding-top: 10px;
padding-bottom: 10px;
margin-bottom: 0;
Expand Down
9 changes: 9 additions & 0 deletions assets/scss/pages/_search.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,13 @@
.flexpage-header {
padding-top: 50px;
}
.pagination-top {
margin-top: 30px;
}
}

@media only screen and #{$media-mobile-tablet} {
.pagination-top {
margin-top: 10px;
}
}
6 changes: 3 additions & 3 deletions doc/source/back-end-code/searchv2.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
===========================
La recherche (``search2/``)
===========================
============================
La recherche (``searchv2/``)
============================

Module situé dans ``zds/searchv2/``.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ map $http_host $robots_tag_header {
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name zestedesavoir.com;
return 301 https://$server_name$request_uri;
}

server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;

Expand Down
2 changes: 1 addition & 1 deletion doc/source/install/configs/nginx/snippets/gzip.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# GZIP compression
gzip on;
gzip_comp_level 6;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
gzip_proxied any;
gzip_vary on;
26 changes: 17 additions & 9 deletions doc/source/install/configs/settings_prod.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,21 @@

import os

from settings import ZDS_APP, INSTALLED_APPS, BASE_DIR
from raven import Client
from settings import ABSOLUTE_URL_OVERRIDES, AUTHENTICATION_BACKENDS, BASE_DIR
from settings import CORS_ALLOW_HEADERS, CORS_ALLOW_METHODS, CORS_EXPOSE_HEADERS
from settings import CORS_ORIGIN_ALLOW_ALL, CRISPY_TEMPLATE_PACK, FILE_UPLOAD_HANDLERS
from settings import GEOIP_PATH, HAYSTACK_CONNECTIONS, HAYSTACK_CUSTOM_HIGHLIGHTER
from settings import INSTALLED_APPS, LANGUAGES, LANGUAGE_CODE, LOCALE_PATHS
from settings import LOGIN_REDIRECT_URL, LOGIN_URL, MEDIA_URL, MESSAGE_TAGS
from settings import MIDDLEWARE_CLASSES, OAUTH2_PROVIDER, REST_FRAMEWORK
from settings import REST_FRAMEWORK_EXTENSIONS, ROOT_URLCONF, SERVE, SITE_ID
from settings import STATICFILES_DIRS, STATICFILES_FINDERS, STATIC_URL, SWAGGER_SETTINGS
from settings import THUMBNAIL_ALIASES, THUMBNAIL_PRESERVE_EXTENSIONS, THUMBNAIL_QUALITY
from settings import TIME_ZONE, USE_I18N, USE_TZ, WSGI_APPLICATION, ZDS_APP

##### Django settings #####

# NEVER set this True !!
from zds.utils.context_processor import get_git_version

DEBUG = False

USE_L10N = True
Expand Down Expand Up @@ -107,12 +114,9 @@
# Sentry (+ raven, the Python Client)
# https://docs.getsentry.com/hosted/clients/python/integrations/django/
RAVEN_CONFIG = {
# 'dsn': 'to-fill'
'dsn': 'to-fill',
'release': get_git_version()
'dsn': 'to-fill'
}


LOGGING = {
'version': 1,
'disable_existing_loggers': True,
Expand Down Expand Up @@ -150,7 +154,7 @@
'sentry': {
'level': 'ERROR', # For beta purpose it can be lowered to WARNING
'class': 'raven.handlers.logging.SentryHandler',
'dsn': RAVEN_CONFIG['dsn'],
'dsn': 'to-fill'
},
},
'loggers': {
Expand Down Expand Up @@ -241,6 +245,9 @@
# added in v20
ZDS_APP['site']['secure_url'] = 'https://zestedesavoir.com'

# added in v21
ZDS_APP['display_search_bar'] = False

# forum
ZDS_APP['forum']['beta_forum_id'] = 23

Expand Down Expand Up @@ -279,3 +286,4 @@
# visual changes
#ZDS_APP['visual_changes'] = ['snow', 'clem-christmas']
#ZDS_APP['visual_changes'] = ['clem-halloween']

6 changes: 5 additions & 1 deletion templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,11 @@ <h2 class="ico-after ico-articles home-heading" itemprop="name">

<div class="content-item write-tutorial">
<div class="write-tutorial-text">
<p>{% blocktrans %}Il y a {{ contents_count }}&nbsp;publication{{ contents_count|pluralize_fr }} sur&nbsp;Zeste&nbsp;de&nbsp;Savoir.{% endblocktrans %}</p>
<p>
{% blocktrans with plural=contents_count|pluralize_fr %}
Il y a {{ contents_count }}&nbsp;publication{{ plural }} sur&nbsp;Zeste&nbsp;de&nbsp;Savoir.
{% endblocktrans %}
</p>
<p class="lead">{% trans "Pourquoi pas la vôtre ?" %}</p>
</div>
<a href="{% url "content:create-tutorial" %}" class="btn btn-write-tutorial">{% trans "Commencer à rédiger" %}</a>
Expand Down
19 changes: 19 additions & 0 deletions templates/searchv2/opensearch.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>

{% load static %}

<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>{{ site_name }}</ShortName>
<Description>Rechercher sur {{ site_name}}</Description>
<InputEncoding>UTF-8</InputEncoding>
<OutputEncoding>UTF-8</OutputEncoding>
<AdultContent>false</AdultContent>
<Language>{{ language }}</Language>
<Contact>{{ email_contact }}</Contact>
<Image height="57" width="57" type="image/png">{{ site_url }}{% static "images/favicon.png" %}</Image>
<Url type="text/html" method="GET" template="{{ search_url }}">
<Param name="q" value="{searchTerms}"/>
</Url>
<Url type="application/opensearchdescription+xml" rel="self" template="{{ site_url }}{% url "search:opensearch" %}" />
</OpenSearchDescription>
66 changes: 49 additions & 17 deletions update.md
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,22 @@ A propos du logging:
Mettre à jour le `settings_prod.py` en suivant `doc/source/install/configs/settings_prod.py`.


Actions faites sur la prod avant la v22
=======================================

Mettre à jour nginx
-------------------

* Supprimer `/etc/apt/sources.list.d/nginx.list`
* `apt update`
* `systemctl stop nginx`
* `apt remove 'nginx-*'`
* `apt-get -t jessie-backports install nginx-full`
- `N or O : keep your currently-installed version`
- `rm /etc/nginx/sites-available/default`
- `dpkg --configure -a`
* `systemctl restart nginx`

Actions à faire pour l'upgrade v22
==================================

Expand All @@ -852,30 +868,37 @@ Lancer la commande de calcul du nombre de caractères des contenus publiés : `p

Maj de Raven + releases
-----------------------
Avant de faire le tag des différentes RC, s'assurer qu'un githook a été ajouté comme le propose sentry.

Mettre à jour le `settings_prod.py` :

```diff
+from raven import Client
+from zds.utils.context_processor import get_git_version
```

# NEVER set this True !!
DEBUG = False

```diff
# https://docs.getsentry.com/hosted/clients/python/integrations/django/
RAVEN_CONFIG = {
'dsn': 'to-fill',
+ 'release': get_git_version()
+ 'release': get_git_version()['name'],
}
```

```diff
'sentry': {
'level': 'ERROR', # For beta purpose it can be lowered to WARNING
'class': 'raven.handlers.logging.SentryHandler',
+ 'dsn': RAVEN_CONFIG['dsn'],
},
```

Elasticsearch (PR #4096)
------------------------

Pour installer Elasticsearch, les commandes suivantes sont à effectuer (en *root*):

+ Ajouter `deb http://ftp.fr.debian.org/debian jessie-backports` main dans `/etc/apt/sources.list`
+ Installer Java 8 :
+ S'assurer que `jessie-backports` est disponible dans `/etc/apt/sources.list`
+ S'assurer que Java 8 est disponible par défaut: `java -version`, sinon l'installer :
* `apt-get update && apt-get install openjdk-8-jdk`.
* Une fois installé, passer de Java 7 à Java 8 en le sélectionnant grâce à `update-alternatives --config java`.
+ Installer Elasticsearch ([informations issues de la documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/deb.html)):
Expand Down Expand Up @@ -909,6 +932,7 @@ Pour installer Elasticsearch, les commandes suivantes sont à effectuer (en *roo
apt install libjson-perl
```
* Suivre les instructions du [README.md](https://github.com/y-ken/munin-plugin-elasticsearch/blob/master/README.md)
* Penser à enlever le(s) plugin(s) Solr et relancer `munin-node`

Une fois Elasticsearch configuré et lancé,

Expand Down Expand Up @@ -951,6 +975,7 @@ Une fois que tout est indexé,
[Install]
WantedBy=timers.target
```

* Supprimer Solr et ajouter Elasticsearch:

```bash
Expand All @@ -963,13 +988,20 @@ Une fois que tout est indexé,
+ Désinstaller Solr :
* `pip uninstall pysolr django-haystack`
* Supprimer la base de données de Solr
+ Supprimer les tables suivantes de MySQL:

* `search_searchindexextract`
* `search_searchindexcontainer`
* `search_searchindexcontent_authors`
* `search_searchindexcontent_tags`
* `search_searchindextag`
* `search_searchindexauthors`
* `search_searchindexcontent`

+ Supprimer Solr
* `rm -rf /opt/zds/solr-*`

+ Supprimer les tables devenues inutiles dans MySQL:

* `mysql -u zds -p -B zdsdb`

```sql
DROP TABLE search_searchindexextract;
DROP TABLE search_searchindexcontainer;
DROP TABLE search_searchindexcontent_authors;
DROP TABLE search_searchindexcontent_tags;
DROP TABLE search_searchindextag;
DROP TABLE search_searchindexauthors;
DROP TABLE search_searchindexcontent;
```
15 changes: 7 additions & 8 deletions zds/forum/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,19 +393,18 @@ def get_es_mapping(cls):
es_mapping = super(Topic, cls).get_es_mapping()

es_mapping.field('title', Text(boost=1.5))
es_mapping.field('tags', Keyword(boost=2.0))
es_mapping.field('tags', Text(boost=2.0))
es_mapping.field('subtitle', Text())
es_mapping.field('is_solved', Boolean())
es_mapping.field('is_locked', Boolean())
es_mapping.field('is_sticky', Boolean())
es_mapping.field('pubdate', Date())
es_mapping.field('forum_pk', Integer())

# not analyzed:
es_mapping.field('get_absolute_url', Text(index=False))

# not indexed:
es_mapping.field('get_absolute_url', Keyword(index=False))
es_mapping.field('forum_title', Text(index=False))
es_mapping.field('forum_get_absolute_url', Text(index=False))
es_mapping.field('forum_get_absolute_url', Keyword(index=False))

return es_mapping

Expand Down Expand Up @@ -497,11 +496,11 @@ def get_es_mapping(cls):
es_mapping.field('forum_pk', Integer())
es_mapping.field('topic_pk', Integer())

# not analyzed:
es_mapping.field('get_absolute_url', Text(index=False))
# not indexed:
es_mapping.field('get_absolute_url', Keyword(index=False))
es_mapping.field('topic_title', Text(index=False))
es_mapping.field('forum_title', Text(index=False))
es_mapping.field('forum_get_absolute_url', Text(index=False))
es_mapping.field('forum_get_absolute_url', Keyword(index=False))

return es_mapping

Expand Down
77 changes: 0 additions & 77 deletions zds/forum/search_indexes.py

This file was deleted.

0 comments on commit 2c918aa

Please sign in to comment.