Skip to content

Commit

Permalink
start French translation of the documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
KtorZ committed May 14, 2022
1 parent 5f33cd5 commit ac73866
Show file tree
Hide file tree
Showing 10 changed files with 517 additions and 12 deletions.
37 changes: 25 additions & 12 deletions docs/README.md
Expand Up @@ -14,21 +14,21 @@ Our setup here _hijack_ the blog posts for showing [architectural decision recor

#### Installation

```
```console
$ yarn
```

#### Local Development

```
```console
$ yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

#### Build

```
```console
$ yarn build
```

Expand All @@ -39,16 +39,29 @@ This command generates static content into the `build` directory and can be serv

Translations of the documentation are provided in the `i18n/{lang}` folder (for example `i18n/fr` for French). Translations of both the content and the various website elements (such as buttons, headers etc...) are needed. To initialize a new language translation (e.g. `fr`), run the following command:

```console
$ yarn write-translations --locale fr
```
yarn write-translations --locale fr

This command will pre-generate all the website elements which need to be translated into French (locale `fr`) in JSON files. Translations have to be provided for each items in generated JSON files, mapping ids to messages as such:

```json
{
"theme.TOCCollapsible.toggleButtonLabel": {
"message": "Sur cette page",
"description": "The label used by the button on the collapsible TOC component"
}
}
```

This command will pre-generate all the website elements which need to be translated into French (locale `fr`) in JSON files. Content files themselves then to be copied under their respective directories, and then translated. Here is a table that summarizes the correspondence between the default website structure and their localized versions:
> Note that only the value of the key `message` needs to be translated, the `description` simply provides context regarding the translated element and is automatically generated.
In addition content files themselves (markdown) need to be copied under their respective directories, and then translated. Here is a table that summarizes the correspondence between the default website structure and their localized versions:

| default | translations |
| ----- | ----- |
| `docs/` | `i18n/{lang}/docusaurus-plugin-content-docs/` |
| `benchmarks/` | `i18n/{lang}/docusaurus-plugin-content-docs-benchmarks/` |
| `core-concepts/` | `i18n/{lang}/docusaurus-plugin-content-docs-core-concepts/` |
| `topologies/` | `i18n/{lang}/docusaurus-plugin-content-docs-topologies/` |
| `adr/` | `i18n/{lang}/docusaurus-plugin-content-blog/` |
| default | translations |
| ----- | ----- |
| `docs/` | `i18n/{lang}/docusaurus-plugin-content-docs/current/` |
| `benchmarks/` | `i18n/{lang}/docusaurus-plugin-content-docs-benchmarks/current/` |
| `core-concepts/` | `i18n/{lang}/docusaurus-plugin-content-docs-core-concepts/current/` |
| `topologies/` | `i18n/{lang}/docusaurus-plugin-content-docs-topologies/current/` |
| `adr/` | `i18n/{lang}/docusaurus-plugin-content-blog/current/` |
@@ -0,0 +1,4 @@
{
"label": "Démarrage rapide",
"position": 1
}
@@ -0,0 +1,4 @@
{
"label": "Démo",
"position": 4
}
@@ -0,0 +1,20 @@
---
sidebar_position: 1
---

# Démo

```mdx-code-block
import DocCardList from '@theme/DocCardList';
import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
<DocCardList items={useCurrentSidebarCategory().items}/>
```

<iframe style={{width: '100%', height: '480px'}} src="https://www.youtube.com/embed/dJk5_kB3BM4" title="Hydra Head Demo" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="true"></iframe>

<br/><br/>

:::caution Avant-propos
Cette vidéo montre une interface utilisateur au sein d'un terminal. En coulisse, l'application cliente se connecte à un noeud Hydra local au moyen d'une WebSocket comme n'importe quelle application cliente souhaitant intéragir avec un noeud Hydra le ferait. Autrement dit, bien qu'il ne s'agisse pas d'un exemple des plus palpitants, c'est néanmoins un exemple possible et plausible d'application cliente.
:::
@@ -0,0 +1,83 @@
---
sidebar_position: 2
---

# Via Docker

```mdx-code-block
import TerminalWindow from '@site/src/components/TerminalWindow';
```

> Ce document détaille les étapes nécessaires pour faire tourner une Hydra Head dans un environment de démo, avec Docker.
La démo comprend:

- Un cluster de trois noeuds Hydra, connectés point-à-point, et ayant chacun une identité (`alice`, `bob`, `carol`) associée à une paire de clés publique/privée;
- Un noeud Cardano, en mode BFT, produisant des blocs et formant a lui seul un réseau local de développement;
- Un serveur Prometheus pour des métriques;
- Une interface utilisateur dans le terminal pour se connecter et opérer chaque noeud Hydra.

:::caution Avertissement!
Le noeud Cardano créé un "réseau" privé et local qui démarre depuis un bloc genesis. Pour démarrer, la configuration du noeud doit être à jour (comprendre, récente). Si au démarrage, le noeud Cardano retourne `LedgerNoView`, alors c'est que l'heure de démarrage indiquée dans la configuration génésis est trop loin dans le passé: il faut en ce cas générer la configuration à nouveau via `prepare-devnet.sh`.
:::

## Mise en place du réseau

Nous utiliserons [Docker](https://www.docker.com/get-started) et [compose](https://www.docker.com/get-started) pour cette démo, assurez-vous de les avoir accessibles. Si vous ne souhaitez pas utiliser / installer Docker, vous pouvez directement vous rendre sur [Démo: Sans Docker](/docs/getting-started/demo/without-docker) et mettre les mains dans le cambouis.

:::info Contexte
Toutes les commandes ci-dessous supposent qu'elles sont éxécutées depuis le dossier `demo/`, à la racine du dépôt. Vous aurez donc besoin de cloner le dépôt et de `cd demo` avant d'aller plus loin.
:::

:::warning (in)compatibilité du système d'exploitation
Les instructions fournies ci-après ont été testées pour des environnements Linux récents (Ubuntu, ArchLinux, NixOS...). Si vous êtes sur Windows ou MacOS vous aurez sans doute besoin d'ajuster certaines commandes liées aux [volumes](https://docs.docker.com/storage/volumes/).
:::

Pour commencer, récupérez les images des différents services définis dans le fichier compose:

```mdx-code-block
<TerminalWindow>
docker-compose --profile tui pull
</TerminalWindow>
```

D'ici, vous pouvez exécuter le script `./prepare-devnet.sh` pour créer les fichiers nécessaires à la configuration du réseau local (a.k.a devnet). Le script génère une configuration génésis Cardano (qui fixe les paramètres du protocole). Notez que dans le cadre de cette démo, la configuration du réseau n'utilise pas de stake pool et ne requiert qu'un unique noeud pour fonctionner.

```mdx-code-block
<TerminalWindow>
./prepare-devnet.sh
</TerminalWindow>
```

C'est tout. Il est maintenant possible de démarrer le réseau via:

```mdx-code-block
<TerminalWindow>
docker-compose up -d
</TerminalWindow>
```

Toutes ces étapes peuvent être effectuées sont combinées dans un unique script `./run-docker.sh`. Ce script contient aussi quelques petites vérifications pour éviter de vous évitez de vous tirer une balle dans le pied avec certaines commandes.

## Générer des fonds

En l'état actuel, les noeuds Hydra requièrent des UTxO dans une forme assez spécifique afin de pouvoir payer les transactions nécessaires au protocole (on appelle ces UTxO: "carburant"), ainsi que des fonds à bloquer dans le contrat pour chaque participant. Parmi les fichiers, vous trouverez un script `./seed-devnet.sh` qui s'occupe de générer ces UTxOs pour chaque participant en utilisant la `cardano-cli`.

:::info
Il n'y a rien d'intrinsèquement particulier au sujet des transactions générées par `seed-devnet.sh`. Toutefois si vous deviez les générer vous-même, assurez vous que pour chaque addresse générée à partir de la paire publique/privée associée à l'option `--cardano-signing-key` de chaque participant est envoyée deux UTxOs:

- Un UTxO simple, contenant des Ada ou actifs natifs;
- Un UTxO ne contenant que des Ada et avec le datum hash suivant: `a654fb60d21c1fed48db2c320aa6df9737ec0204c0ba53b9b94a09fb40e757f3` (ce datum identifie les UTxOs réservés au "carburant").
:::

## Utiliser l'interface client

À l'aide de compose, vous pouvez démarrer les interfaces clientes (a.k.a `hydra-tui`) pour interagir avec chaque noeud Hydra. Le fichier compose contient déjà trois services pré-configurés: `hydra-tui-1`, `hydra-tui-2`, and `hydra-tui-3`. Pour démarrer le premier client, utilisez simplement:

```mdx-code-block
<TerminalWindow>
docker-compose --profile tui run hydra-tui-1
</TerminalWindow>
```

Cette commande lance une interface utilisateur dans le terminal, configurée avec les clés du premier noeud (i.e. Alice). Dans d'autres terminaux, vous pouvez lancer de la même façon `hydra-tui-2` et `hydra-tui-3`.
@@ -0,0 +1,153 @@
---
sidebar_position: 3
---

# Sans Docker

```mdx-code-block
import TerminalWindow from '@site/src/components/TerminalWindow';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
```

> Running the demo without Docker containers, but with plain executables and scripts.
:::info Context
All commands below are written as if executed from the `demo` folder in the project repository, so make sure to clone the repository and `cd demo` before doing anything.
:::

# Setting-up The Network

One needs to prepare a `cardano-node` (devnet) and a `hydra-node` "manually". These instructions assume you have both built and in scope for `cabal exec`.

First, let's prepare and start an ad-hoc, single `cardano-node` devnet using our configuration. Note that this will create a `devnet` directory in your current working directory:

````mdx-code-block
<TerminalWindow>
```
./prepare-devnet.sh
cd devnet
mkdir ipc
cabal exec cardano-node -- run \
--config cardano-node.json \
--topology topology.json \
--database-path db \
--socket-path ipc/node.socket \
--shelley-operational-certificate credentials/opcert1.cert \
--shelley-kes-key credentials/delegate1.kes.skey \
--shelley-vrf-key credentials/delegate1.vrf.skey
```
</TerminalWindow>
````

Then, in 3 different terminals, start 3 Hydra nodes from the `demo/` directory:

````mdx-code-block
<Tabs>
<TabItem value="Alice">
<TerminalWindow>
```
cabal exec hydra-node -- \
--node-id 1 --port 5001 --api-port 4001 --monitoring-port 6001 \
--peer localhost:5002 \
--peer localhost:5003 \
--hydra-signing-key alice.sk \
--hydra-verification-key bob.vk \
--hydra-verification-key carol.vk \
--cardano-signing-key devnet/credentials/alice.sk \
--cardano-verification-key devnet/credentials/bob.vk \
--cardano-verification-key devnet/credentials/carol.vk \
--ledger-genesis devnet/genesis-shelley.json \
--ledger-protocol-parameters devnet/protocol-parameters.json \
--network-id 42 \
--node-socket devnet/ipc/node.socket
```
</TerminalWindow>
</TabItem>
<TabItem value="Bob">
<TerminalWindow>
```
cabal exec hydra-node -- \
--node-id 2 --port 5002 --api-port 4002 --monitoring-port 6002 \
--peer localhost:5001 \
--peer localhost:5003 \
--hydra-signing-key bob.sk \
--hydra-verification-key alice.vk \
--hydra-verification-key carol.vk \
--cardano-signing-key devnet/credentials/bob.sk \
--cardano-verification-key devnet/credentials/alice.vk \
--cardano-verification-key devnet/credentials/carol.vk \
--ledger-genesis devnet/genesis-shelley.json \
--ledger-protocol-parameters devnet/protocol-parameters.json \
--network-id 42 \
--node-socket devnet/ipc/node.socket
```
</TerminalWindow>
</TabItem>
<TabItem value="Carol">
<TerminalWindow>
```
cabal exec hydra-node -- \
--node-id 3 --port 5003 --api-port 4003 --monitoring-port 6003 \
--peer localhost:5001 \
--peer localhost:5002 \
--hydra-signing-key carol.sk \
--hydra-verification-key alice.vk \
--hydra-verification-key bob.vk \
--cardano-signing-key devnet/credentials/carol.sk \
--cardano-verification-key devnet/credentials/alice.vk \
--cardano-verification-key devnet/credentials/bob.vk \
--ledger-genesis devnet/genesis-shelley.json \
--ledger-protocol-parameters devnet/protocol-parameters.json \
--network-id 42 \
--node-socket devnet/ipc/node.socket
```
</TerminalWindow>
</TabItem>
</Tabs>
````

If things go well, the nodes should start logging once connected to the chain.

# Seeding The Network

You can use the `seed-devnet.sh` script by passing it the path to a cardano-cli executable to use, instead of having it using the Docker container. For example:


```mdx-code-block
<TerminalWindow>
./seed-devnet.sh $(which cardano-cli)
</TerminalWindow>
```

Running The Clients
Connect to the nodes using hydra-tui. For example, to use Alice's hydra-node and her on-chain credentials:

````mdx-code-block
<TerminalWindow>
```
cabal exec hydra-tui -- \
--connect 0.0.0.0:4001 \
--cardano-signing-key devnet/credentials/alice.sk \
--network-id 42 \
--node-socket devnet/ipc/node.socket
```
</TerminalWindow>
````

Replace port `4001` with `4002` or `4003` to connect to the other 2 nodes and `alice.sk` with `bob.sk` or `carol.sk` respectively.
@@ -0,0 +1,12 @@
---
sidebar_position: 1
---

# Démarrage rapide

```mdx-code-block
import DocCardList from '@theme/DocCardList';
import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
<DocCardList items={useCurrentSidebarCategory().items}/>
```

0 comments on commit ac73866

Please sign in to comment.