From 515a0f061f9aa4f0f34af70af013ffcd719f68c8 Mon Sep 17 00:00:00 2001 From: Ivan Blinkov Date: Fri, 4 Aug 2017 17:52:08 +0300 Subject: [PATCH] Work in progress on CLICKHOUSE-2720 & CLICKHOUSE-3067 (#1046) * update presentations * CLICKHOUSE-2936: redirect from clickhouse.yandex.ru and clickhouse.yandex.com * update submodule * lost files * CLICKHOUSE-2981: prefer sphinx docs over original reference * CLICKHOUSE-2981: docs styles more similar to main website + add flags to switch language links * update presentations * Less confusing directory structure (docs -> doc/reference/) * Minify sphinx docs too * Website release script: fail fast + pass docker hash on deploy * Do not underline links in docs * shorter * cleanup docker images * tune nginx config * CLICKHOUSE-3043: get rid of habrastorage links * Lost translation * CLICKHOUSE-2936: temporary client-side redirect * behaves weird in test * put redirect back * CLICKHOUSE-3047: copy docs txts to public too * move to proper file * remove old pages to avoid confusion * Remove reference redirect warning for now * Refresh README.md * Yellow buttons in docs * Use svg flags instead of unicode ones in docs * fix test website instance * Put flags to separate files * wrong flag * Copy Yandex.Metrica introduction from main page to docs * Yet another home page structure change, couple new blocks (CLICKHOUSE-3045) * Update Contacts section * CLICKHOUSE-2849: more detailed legal information * CLICKHOUSE-2978 preparation - split by files * More changes in Contacts block * Tune texts on index page * update presentations * One more benchmark * Add usage sections to index page, adapted from slides * Get the roadmap started, based on slides from last ClickHouse Meetup * CLICKHOUSE-2977: some rendering tuning * Get rid of excessive section in the end of getting started * Make headers linkable * CLICKHOUSE-2981: links to editing reference - https://github.com/yandex/ClickHouse/issues/849 * CLICKHOUSE-2981: fix mobile styles in docs * Ban crawling of duplicating docs * Open some external links in new tab * Ban old docs too * Lots of trivial fixes in english docs * Lots of trivial fixes in russian docs * Remove getting started copies in markdown * Add Yandex.Webmaster * Fix some sphinx warnings * More warnings fixed in english docs * More sphinx warnings fixed * Add code-block:: text * More code-block:: text * These headers look not that well * Better switch between documentation languages * merge use_case.rst into ya_metrika_task.rst * Edit the agg_functions.rst texts * Add lost empty lines * Lost blank lines * Add new logo sizes * update presentations * Next step in migrating to new documentation * Fix all warnings in en reference * Fix all warnings in ru reference * Re-arrange existing reference * Move operation tips to main reference * Fix typos noticed by milovidov@ * Get rid of zookeeper.md * Looks like duplicate of tutorial.html * Fix some mess with html tags in tutorial * No idea why nobody noticed this before, but it was completely not clear whet to get the data * Match code block styling between main and tutorial pages (in favor of the latter) * Get rid of some copypaste in tutorial * Normalize header styles * Move example_datasets to sphinx * Move presentations submodule to website * Move and update README.md * No point in duplicating articles from habrahabr here * Move development-related docs as is for now * doc/reference/ -> docs/ (to match the URL on website) * Adapt links to match the previous commit * Adapt development docs to rst (still lacks translation and strikethrough support) * clean on release * blacklist presentations in gulp * strikethrough support in sphinx * just copy development folder for now * fix weird introduction in style article * Style guide translation (WIP) * Finish style guide translation to English * gulp clean separately * Update year in LICENSE * Initial CONTRIBUTING.md * Fix remaining links to old docs in tutorial * Some tutorial fixes * Typo * Another typo * Update list of authors from yandex-team accoding to git log * Fix diff with master * couple fixes in en what_is_clickhouse.rst * Try different link to blog in Russian * Swap words * Slightly larger line height * CLICKHOUSE-3089: disable hyphenation in docs * update presentations * Fix copying of txt files * update submodule * CLICKHOUSE-3108: fix overflow issues in mobile version * Less weird tutorial header in mobile version * CLICKHOUSE-3073: skip sourcemaps by default * CLICKHOUSE-3067: rename item in docs navigation * fix list markup * CLICKHOUSE-3067: some documentation style tuning * CLICKHOUSE-3067: less laggy single page documentation --- docs/Makefile | 4 +- docs/_singlehtml_templates/navigation.html | 10 ---- docs/_static/custom.css | 55 ++++++++++++++++++++-- docs/_templates/layout.html | 10 +++- docs/_templates/navigation.html | 8 ++++ docs/_templates/page.html | 6 +++ docs/_templates/search.html | 50 ++++++++++++++++++++ docs/_templates/searchbox.html | 11 +++++ docs/en/conf.py | 9 +++- docs/en/query_language/queries.rst | 1 + docs/ru/conf.py | 9 +++- docs/ru/query_language/queries.rst | 1 + website/gulpfile.js | 8 +++- website/index.css | 32 ++++++++++--- website/tutorial.html | 2 +- 15 files changed, 185 insertions(+), 31 deletions(-) delete mode 100644 docs/_singlehtml_templates/navigation.html create mode 100644 docs/_templates/navigation.html create mode 100644 docs/_templates/page.html create mode 100644 docs/_templates/search.html create mode 100644 docs/_templates/searchbox.html diff --git a/docs/Makefile b/docs/Makefile index 95802e63d0..285b71a53b 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -24,8 +24,8 @@ I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) ru default: $(SPHINXBUILD) -b html $(SPHINXOPTS) ru $(BUILDDIR)/docs/ru $(SPHINXBUILD) -b html $(SPHINXOPTS) en $(BUILDDIR)/docs/en - SPHINX_TEMPLATES=../_singlehtml_templates $(SPHINXBUILD) -b singlehtml $(SPHINXOPTS) ru $(BUILDDIR)/docs/ru/single - SPHINX_TEMPLATES=../_singlehtml_templates $(SPHINXBUILD) -b singlehtml $(SPHINXOPTS) en $(BUILDDIR)/docs/en/single + $(SPHINXBUILD) -b singlehtml $(SPHINXOPTS) ru $(BUILDDIR)/docs/ru/single + $(SPHINXBUILD) -b singlehtml $(SPHINXOPTS) en $(BUILDDIR)/docs/en/single help: @echo "Please use \`make ' where is one of" diff --git a/docs/_singlehtml_templates/navigation.html b/docs/_singlehtml_templates/navigation.html deleted file mode 100644 index f98fc4161f..0000000000 --- a/docs/_singlehtml_templates/navigation.html +++ /dev/null @@ -1,10 +0,0 @@ -

{{ _('Navigation') }}

-{{ toctree(includehidden=theme_sidebar_includehidden, collapse=False) }} -{% if theme_extra_nav_links %} -
-
    - {% for text, uri in theme_extra_nav_links.items() %} -
  • {{ text }}
  • - {% endfor %} -
-{% endif %} diff --git a/docs/_static/custom.css b/docs/_static/custom.css index e9e25250dc..11b6c05856 100644 --- a/docs/_static/custom.css +++ b/docs/_static/custom.css @@ -1,23 +1,65 @@ -div.document, div.footer { +div.document { + margin: 20px auto 0 auto; +} +div.document, +div.footer { width: 1240px; } div.sphinxsidebarwrapper { padding: 2px 10px; } -div.body dd, div.body li, div.body p { +div.body p { line-height: 1.6em; } -div.body blockquote, div.body dd, div.body li, div.body p { +div.body dd, +div.body li { + line-height: 1.2em; + margin-bottom: 0.4em; +} +div.body blockquote, +div.body dd, +div.body li, +div.body p { -moz-hyphens: none; -ms-hyphens: none; -webkit-hyphens: none; hyphens: none; } +input { + padding: 2px; +} +div.sphinxsidebar #searchbox input[type="text"] { + width: 190px; +} +div.sphinxsidebar #searchbox input[type="submit"], +#search-form input[type="submit"] { + padding: 4px 8px; +} +#searchbox, #extra-nav-links { + margin: 20px 0; +} +ol ol ul, +ol ul ul, +ul ol ul, +ul ul ul, +ul ul, +ol ul, +div.sphinxsidebar ul ul, +div.sphinxsidebar ul.want-points +{ + list-style-type: disc; +} +blockquote { + line-height: 1.4em; + border-left: 4px solid #ccc; + margin: 0; + padding: 0 0 0 20px; +} div.sphinxsidebarwrapper p.logo { float: left; text-align: left; - margin: -4px 4px 0 0; + margin: -2px 6px 0 0; } div.sphinxsidebar a { @@ -26,7 +68,10 @@ div.sphinxsidebar a { } pre { - padding: 4px; + padding: 6px; +} +code { + padding: 2px; } input { diff --git a/docs/_templates/layout.html b/docs/_templates/layout.html index 0decfc367b..a79653125d 100644 --- a/docs/_templates/layout.html +++ b/docs/_templates/layout.html @@ -72,7 +72,7 @@ clickmap:true, trackLinks:true, accurateTrackBounce:true, - webvisor:true + webvisor: {% if builder != "singlehtml" %}true{% else %}false{% endif %} }); } catch(e) { } }); @@ -93,5 +93,11 @@
- +{% if builder == "singlehtml" %} + +{% endif %} {%- endblock %} diff --git a/docs/_templates/navigation.html b/docs/_templates/navigation.html new file mode 100644 index 0000000000..6a2deb8eb5 --- /dev/null +++ b/docs/_templates/navigation.html @@ -0,0 +1,8 @@ +{% if theme_extra_nav_links %} + +{% endif %} +{{ toctree(includehidden=theme_sidebar_includehidden, collapse=builder != "singlehtml") }} diff --git a/docs/_templates/page.html b/docs/_templates/page.html new file mode 100644 index 0000000000..ca1d158efa --- /dev/null +++ b/docs/_templates/page.html @@ -0,0 +1,6 @@ +{%- extends "layout.html" %} +{% block body %} +{% if builder != "singlehtml" %} +{{ body }} +{% endif %} +{% endblock %} diff --git a/docs/_templates/search.html b/docs/_templates/search.html new file mode 100644 index 0000000000..458afd627b --- /dev/null +++ b/docs/_templates/search.html @@ -0,0 +1,50 @@ +{%- extends "layout.html" %} +{% set title = _('Search') %} +{% set script_files = script_files + ['_static/searchtools.js'] %} +{% block extrahead %} + + {# this is used when loading the search index using $.ajax fails, + such as on Chrome for documents on localhost #} + + {{ super() }} +{% endblock %} +{% block body %} +

{{ _('Search') }}

+
+ +

+ {% trans %}Please activate JavaScript to enable the search + functionality.{% endtrans %} +

+
+

+ {% trans %}From here you can search these documents. Enter your search + words into the box below and click "search". Note that the search + function will automatically search for all of the words. Pages + containing fewer words won't appear in the result list.{% endtrans %} +

+
+ + + +
+ {% if search_performed %} +

{{ _('Search Results') }}

+ {% if not search_results %} +

{{ _('Your search did not match any documents. Please make sure that all words are spelled correctly and that you\'ve selected enough categories.') }}

+ {% endif %} + {% endif %} +
+ {% if search_results %} +
    + {% for href, caption, context in search_results %} +
  • {{ caption }} +
    {{ context|e }}
    +
  • + {% endfor %} +
+ {% endif %} +
+{% endblock %} diff --git a/docs/_templates/searchbox.html b/docs/_templates/searchbox.html new file mode 100644 index 0000000000..ec3564f696 --- /dev/null +++ b/docs/_templates/searchbox.html @@ -0,0 +1,11 @@ +{%- if pagename != "search" and builder != "singlehtml" %} + + +{%- endif %} diff --git a/docs/en/conf.py b/docs/en/conf.py index 5750d284d2..c58139ce77 100644 --- a/docs/en/conf.py +++ b/docs/en/conf.py @@ -128,7 +128,7 @@ html_theme_options = { ('Switch to Russian ', '#ru'), ('Single page documentation', '/docs/en/single/'), ('Website home', '/'), - ('ClickHouse repository', 'https://github.com/yandex/ClickHouse'), + ('Source code', 'https://github.com/yandex/ClickHouse'), ('Edit this page', '#edit'), ]) } @@ -174,9 +174,9 @@ html_static_path = ['../_static'] html_sidebars = { '**': [ 'about.html', + 'searchbox.html', 'navigation.html', 'relations.html', - 'searchbox.html', ] } @@ -292,5 +292,10 @@ texinfo_documents = [ # If true, do not generate a @detailmenu in the "Top" node's menu. #texinfo_no_detailmenu = False +def add_filters(app): + import json + app.builder.templates.environment.filters[str('escapejs')] = lambda x: json.dumps(unicode(x)) + def setup(app): app.add_javascript('custom.js') + app.connect(str('builder-inited'), add_filters) diff --git a/docs/en/query_language/queries.rst b/docs/en/query_language/queries.rst index 25d526358f..17896c5f6f 100644 --- a/docs/en/query_language/queries.rst +++ b/docs/en/query_language/queries.rst @@ -373,6 +373,7 @@ As an alternative, you can manually copy data from the ``/var/lib/clickhouse/dat ``ALTER TABLE ... FREEZE PARTITION`` only copies data, not table metadata. To make a backup of table metadata, copy the file ``/var/lib/clickhouse/metadata/database/table.sql`` To restore from a backup: + * Use the CREATE query to create the table if it doesn't exist. The query can be taken from an .sql file (replace ATTACH in it with CREATE). * Copy data from the ``data/database/table/`` directory inside the backup to the ``/var/lib/clickhouse/data/database/table/detached/`` directory. * Run ``ALTER TABLE ... ATTACH PARTITION YYYYMM``queries where ``YYYYMM`` is the month, for every month. diff --git a/docs/ru/conf.py b/docs/ru/conf.py index 97e513a29a..ec57feedd4 100644 --- a/docs/ru/conf.py +++ b/docs/ru/conf.py @@ -128,7 +128,7 @@ html_theme_options = { ('Switch to English ', '#en'), ('Документация на одной странице', '/docs/ru/single/'), ('Главная страница сайта', '/'), - ('Репозиторий ClickHouse', 'https://github.com/yandex/ClickHouse'), + ('Исходный код', 'https://github.com/yandex/ClickHouse'), ('Редактировать страницу', '#edit'), ]) } @@ -174,9 +174,9 @@ html_static_path = ['../_static'] html_sidebars = { '**': [ 'about.html', + 'searchbox.html', 'navigation.html', 'relations.html', - 'searchbox.html', ] } @@ -292,5 +292,10 @@ texinfo_documents = [ # If true, do not generate a @detailmenu in the "Top" node's menu. #texinfo_no_detailmenu = False +def add_filters(app): + import json + app.builder.templates.environment.filters[str('escapejs')] = lambda x: json.dumps(unicode(x)) + def setup(app): app.add_javascript('custom.js') + app.connect(str('builder-inited'), add_filters) diff --git a/docs/ru/query_language/queries.rst b/docs/ru/query_language/queries.rst index 90fbbf45d2..7a54620765 100644 --- a/docs/ru/query_language/queries.rst +++ b/docs/ru/query_language/queries.rst @@ -379,6 +379,7 @@ ALTER ``ALTER TABLE ... FREEZE PARTITION`` копирует только данные, но не метаданные таблицы. Чтобы сделать бэкап метаданных таблицы, скопируйте файл ``/var/lib/clickhouse/metadata/database/table.sql`` Для восстановления из бэкапа: + * создайте таблицу, если её нет, с помощью запроса CREATE. Запрос можно взять из .sql файла (замените в нём ``ATTACH`` на ``CREATE``); * скопируйте данные из директории data/database/table/ внутри бэкапа в директорию ``/var/lib/clickhouse/data/database/table/detached/`` * выполните запросы ``ALTER TABLE ... ATTACH PARTITION YYYYMM``, где ``YYYYMM`` - месяц, для каждого месяца. diff --git a/website/gulpfile.js b/website/gulpfile.js index d46a6ed76f..a47e286e43 100644 --- a/website/gulpfile.js +++ b/website/gulpfile.js @@ -82,7 +82,7 @@ gulp.task('htmls', ['docs', 'docstxt'], function () { .pipe(gulp.dest(outputDir)) }); -gulp.task('scripts', ['docs'], function () { +gulp.task('sourcemaps', ['docs'], function () { return gulp.src(paths.scripts) .pipe(sourcemaps.init()) .pipe(uglify()) @@ -90,6 +90,12 @@ gulp.task('scripts', ['docs'], function () { .pipe(gulp.dest(outputDir)) }); +gulp.task('scripts', ['docs'], function () { + return gulp.src(paths.scripts) + .pipe(uglify()) + .pipe(gulp.dest(outputDir)) +}); + gulp.task('styles', ['docs'], function () { return gulp.src(paths.styles) .pipe(cleanCss({inline: ['none']})) diff --git a/website/index.css b/website/index.css index 859acab3b9..bd419701f4 100644 --- a/website/index.css +++ b/website/index.css @@ -244,12 +244,6 @@ a:hover, a:active { color: #ededed; } -#ubuntu-install { - overflow: auto; - overflow-y: hidden; - -ms-overflow-y: hidden; -} - #footer { text-align: right; padding: 8px 0 0 0; @@ -266,6 +260,7 @@ pre { border-left: 5px solid #ffdb4d; padding: 5px 10px; background-color: #fff8e8; + overflow: scroll; } ul { @@ -287,6 +282,10 @@ ul.dashed > li:before { text-indent: 1em; } +img { + width: 100%; +} + .warranty { margin-top: 6em; font-size: 50%; @@ -306,6 +305,13 @@ ul.dashed > li:before { border-bottom: 1px solid #08f; } +#tutorial_logo { + float: left; + margin-right: -100%; + margin-top: 34px; + margin-left: 3px; +} + #tutorial_title { font: normal 100px 'Yandex Sans Display Web', Arial, sans-serif; margin-top: 25px; @@ -460,4 +466,18 @@ ul.dashed > li:before { width: 100%; float: none; } + + #tutorial_logo, #tutorial_title, #tutorial_subtitle { + float: none; + text-align: left; + margin: 10px 0; + padding: 0; + } + + #tutorial_title { + font-size: 75px; + } + + + } diff --git a/website/tutorial.html b/website/tutorial.html index b75c0ffe5c..a9ce64bc35 100644 --- a/website/tutorial.html +++ b/website/tutorial.html @@ -17,7 +17,7 @@
-
+