Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert docs from reStructuredText to MyST markdown #2980

Merged
merged 3 commits into from
Jan 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions docs/convert/compare_screenshots.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env sh

import subprocess
import os

output = subprocess.check_output(['find', 'screenshots', '-name', '*_dev.png']).decode('utf8')

for dev in output.splitlines():
ref = dev.replace('_dev.png', '_ref.png')
if os.path.exists(dev) and os.path.exists(ref):
print(dev)
cmd = ['compare', '-compose', 'src', dev, ref, dev.replace('_dev.png', '_diff.png')]
print(cmd)
subprocess.run(cmd)
else:
print(f'Cannot compare {dev}')
1 change: 1 addition & 0 deletions docs/convert/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
colon_fences: false
1 change: 1 addition & 0 deletions docs/convert/conversions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sphinx.domains.std.Glossary: eval_rst
12 changes: 12 additions & 0 deletions docs/convert/convert.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
#
set -e
# shellcheck disable=SC2044,SC3010
for f in $(find . -type f -name '*.rst'); do
if [[ "$f" == */includes/* ]]; then
echo skipping "$f"
continue
fi
rst2myst convert -c convert/conversions.yaml --no-colon-fences "$f"
rm -f "$f"
done
4 changes: 4 additions & 0 deletions docs/convert/revert.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh

git checkout src
git clean src -f
47 changes: 47 additions & 0 deletions docs/convert/screenshots.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env python3

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
import subprocess
import os.path

def sanitize_name(name):
r = ''
for c in name:
if c.isalpha():
r += c
else:
r += '_'
return r

driver = webdriver.Firefox()

output = subprocess.check_output(['find', 'build', '-name', '*.html']).decode('utf8')
for i, p in enumerate(output.splitlines()):
n = os.path.relpath(p, 'build')
url_dev = f'http://localhost:3000/{n}'
url_ref = f'https://docs.wire.com/{n}'
img_basename = sanitize_name(n) + '_' + str(i)

try:
print(f'./screenshots/{i:03}-{img_basename}_dev.png')
driver.get(url_dev)
driver.get_full_page_screenshot_as_file(f'./screenshots/{i:03}-{img_basename}_dev.png')
print(url_ref)
driver.get(url_ref)
driver.get_full_page_screenshot_as_file(f'./screenshots/{i:03}-{img_basename}_ref.png')
except:
pass

driver.close()



# assert "Python" in driver.title
# elem = driver.find_element(By.NAME, "q")
# elem.clear()
# elem.send_keys("pycon")
# elem.send_keys(Keys.RETURN)
# assert "No results found." not in driver.page_source
#
17 changes: 17 additions & 0 deletions docs/convert/shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{ pkgs ? import <nixpkgs> {} }:
(pkgs.buildFHSUserEnv {
name = "pipzone";
targetPkgs = pkgs: (with pkgs; [
python3
python3Packages.pip
python3Packages.virtualenv
]);
runScript = "bash";
}).env

# then
# virtualenv venv
# pip install rst-to-myst
# Fix this bug locally: https://github.com/executablebooks/rst-to-myst/issues/49
# pip install sphinx-reredirects
# pip install sphinx-multiversion
3 changes: 1 addition & 2 deletions docs/src/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,5 @@
"security-responses/log4shell": "2021-12-15_log4shell.html",
"security-responses/cve-2021-44521": "2022-02-21_cve-2021-44521.html",
"security-responses/2022-05_website_outage": "2022-05-23_website_outage.html",
"how-to/single-sign-on/index": "../../understand/single-sign-on/main.html#setting-up-sso-externally",
"how-to/scim/index": "../../understand/single-sign-on/main.html#user-provisioning",
"how-to/scim/index": "../../understand/single-sign-on/main.html#user-provisioning"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These links are for people who may have bookmarked old URLs, they then get a redirect and the old links still work.
I'm not sure how important this is; but it's certainly nice user experience if previous links someone may have saved/bookmarked still work. Perhaps we should add a comment here for the next person stumbling over this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about this, since how-to-/single-sign-on/index now points to https://docs.wire.com/how-to/single-sign-on/index.html which is a nice index of all thing sso I thought it's okay enough

}
10 changes: 10 additions & 0 deletions docs/src/developer/developer/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Developer

```{toctree}
:caption: 'Contents:'
:glob: true
:numbered: true
:titlesonly: true

**
```
10 changes: 0 additions & 10 deletions docs/src/developer/developer/index.rst

This file was deleted.

20 changes: 10 additions & 10 deletions docs/src/developer/index.rst → docs/src/developer/index.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
Notes for developers
====================
# Notes for developers

If you are an on-premise operator (administrating your own self-hosted installation of wire-server), you may want to go back to `docs.wire.com <https://docs.wire.com/>`_ and ignore this section of the docs.
If you are an on-premise operator (administrating your own self-hosted installation of wire-server), you may want to go back to [docs.wire.com](https://docs.wire.com/) and ignore this section of the docs.

If you are a wire end-user, please check out our `support pages <https://support.wire.com/>`_.
If you are a wire end-user, please check out our [support pages](https://support.wire.com/).

What you need to know as a user of the Wire backend: concepts, features,
and API. We want to keep these up to date. They could benefit from some
re-ordering, and they are far from complete, but we hope they will still
help you.

.. toctree::
:titlesonly:
:caption: Contents:
:glob:
```{toctree}
:caption: 'Contents:'
:glob: true
:titlesonly: true

developer/index.rst
reference/index.rst
developer/index.rst
reference/index.rst
```
10 changes: 10 additions & 0 deletions docs/src/developer/reference/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Reference

```{toctree}
:caption: 'Contents:'
:glob: true
:numbered: true
:titlesonly: true

**
```
10 changes: 0 additions & 10 deletions docs/src/developer/reference/index.rst

This file was deleted.

2 changes: 1 addition & 1 deletion docs/src/developer/reference/spar-braindump.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export IDP_ID=...

Copy the new metadata file to one of your spar instances.

Ssh into it. If you can't, [the sso docs](../../understand/single-sign-on/main.rst) explain how you can create a
Ssh into it. If you can't, [the sso docs](../../how-to/single-sign-on/understand/main.rst) explain how you can create a
bearer token if you have the admin's login credentials. If you follow
that approach, you need to replace all mentions of `-H'Z-User ...'`
with `-H'Authorization: Bearer ...'` in the following, and you won't need
Expand Down
63 changes: 63 additions & 0 deletions docs/src/how-to/administrate/cassandra.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Cassandra

```{eval-rst}
.. include:: includes/intro.rst
```

This section only covers the bare minimum, for more information, see the [cassandra
documentation](https://cassandra.apache.org/doc/latest/)

(check-the-health-of-a-cassandra-node)=

## Check the health of a Cassandra node

To check the health of a Cassandra node, run the following command:

```sh
ssh <ip of cassandra node> /opt/cassandra/bin/nodetool status
```

or if you are running a newer version of wire-server (altough it should be backwards compatibile)

```sh
ssh <ip of cassandra node> /opt/cassandra/bin/nodetool -h ::FFFF:127.0.0.1 status
```

You should see a list of nodes like this:

```sh
Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address Load Tokens Owns (effective) Host ID Rack
UN 192.168.220.13 9.51MiB 256 100.0% 3dba71c8-eea7-4e35-8f35-4386e7944894 rack1
UN 192.168.220.23 9.53MiB 256 100.0% 3af56f1f-7685-4b5b-b73f-efdaa371e96e rack1
UN 192.168.220.33 9.55MiB 256 100.0% RANDOMLY-MADE-UUID-GOES-INTHISPLACE! rack1
```

A `UN` at the begginng of the line, refers to a node that is `Up` and `Normal`.

## How to inspect tables and data manually

```sh
cqlsh
# from the cqlsh shell
describe keyspaces
use <keyspace>;
describe tables;
select * from <tablename> WHERE <primarykey>=<some-value> LIMIT 10;
```

## How to rolling-restart a cassandra cluster

For maintenance you may need to restart the cluster.

On each server one by one:

1. check your cluster is healthy: `nodetool status` or `nodetool -h ::FFFF:127.0.0.1 status` (in newer versions)
2. `nodetool drain && systemctl stop cassandra` (to stop accepting writes and flush data to disk; then stop the process)
3. do any operation you need, if any
4. Start the cassandra daemon process: `systemctl start cassandra`
5. Wait for your cluster to be healthy again.
6. Do the same on the next server.
65 changes: 0 additions & 65 deletions docs/src/how-to/administrate/cassandra.rst

This file was deleted.

Loading