|
1 | 1 | ## Introduction
|
2 | 2 |
|
3 |
| -Cet outil est conçu pour synchroniser les données entre une base de données Postgresql et Elasticsearch. Il utilise un |
4 |
| -système de trigger avec un mécanisme de pub/sub pour surveiller les changements en temps réel dans la base de données et |
5 |
| -les indexer dans Elasticsearch. |
| 3 | +This tool is designed to synchronize data between a Postgresql database and Elasticsearch. It uses a trigger system with a pub/sub mechanism to monitor real-time changes in the database and index them in Elasticsearch. |
6 | 4 |
|
7 |
| -## Prérequis |
8 | 5 |
|
9 |
| -- Docker |
10 |
| -- Docker Compose |
11 | 6 |
|
12 |
| -## Installation et configuration |
| 7 | +## Installation and Configuration |
13 | 8 |
|
14 |
| -1. Cloner ce repository: `git clone https://github.com/alancolant/pg_el_sync pgsync` |
15 |
| -2. Aller dans le répertoire `pgsync`: `cd pgsync` |
16 |
| -3. Copier le fichier `config.example.yaml` vers `config.yaml`: `cp config.example.yaml config.yaml` |
17 |
| -3. Modifier le fichier de configuration `config.yml` pour spécifier les détails de connexion à Postgresql et |
18 |
| - Elasticsearch, ainsi que les tables à synchroniser et leurs relations. |
19 |
| -4. Lancer le service Docker-Compose: `docker compose up -d` |
| 9 | +### Using Docker |
20 | 10 |
|
21 |
| -## Utilisation |
| 11 | +- Pull the Docker image from the GitHub Container Registry: |
| 12 | + ```bash |
| 13 | + docker pull ghcr.io/quix-labs/pg-el-sync:latest |
| 14 | + ``` |
22 | 15 |
|
23 |
| -Une fois que le service Docker Compose est lancé, vous pouvez utiliser les commandes suivantes pour synchroniser les |
24 |
| -données: |
| 16 | +### Using Go |
25 | 17 |
|
26 |
| -- `docker compose up -d prod`: Cette commande surveille la base de données en temps réel et synchronise les données dès |
27 |
| - qu'il y a des changements. |
28 |
| -- `docker compose exec prod pgsync index`: Cette commande indexe toutes les tables spécifiées dans la configuration. |
| 18 | +- Install the tool using Go: |
| 19 | + ```bash |
| 20 | + go install github.com/quix-labs/pg-el-sync@latest |
| 21 | + ``` |
| 22 | + |
| 23 | +### Using prebuilt assets |
| 24 | + |
| 25 | +You can also install the tool using release assets such as `.deb`, `.apk`, or others. |
| 26 | + |
| 27 | +Download the appropriate package from the [Releases page](https://github.com/quix-labs/pg-el-sync/releases), and then follow the instructions provided for your specific platform. |
| 28 | + |
| 29 | + |
| 30 | +## Usage |
| 31 | + |
| 32 | +The tool provides two main commands for usage: |
| 33 | + |
| 34 | +- `pg-el-sync listen`: Start listening to the PostgreSQL database for real-time changes and sync them with Elasticsearch. |
| 35 | +- `pg-el-sync index`: Index all tables from the PostgreSQL database into Elasticsearch. |
| 36 | + |
| 37 | + |
| 38 | +### Using Docker |
| 39 | + |
| 40 | +#### Listen Command |
| 41 | +```bash |
| 42 | +docker run -v /path/to/config.yaml:/app/config.yaml ghcr.io/quix-labs/pg-el-sync:latest pg-el-sync listen |
| 43 | +``` |
| 44 | + |
| 45 | +#### Index Command |
| 46 | +```bash |
| 47 | +docker run --rm -v /path/to/config.yaml:/app/config.yaml ghcr.io/quix-labs/pg-el-sync:latest pg-el-sync index |
| 48 | +``` |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | +## Supervisord Configuration |
| 54 | + |
| 55 | +To manage the `pg-el-sync listen` command with Supervisord, you can use the following configuration: |
| 56 | + |
| 57 | +```ini |
| 58 | +[program:pg-el-sync] |
| 59 | +command=path/to/pg-el-sync listen |
| 60 | +autostart=true |
| 61 | +autorestart=true |
| 62 | +startsecs=10 |
| 63 | +startretries=3 |
| 64 | +stdout_logfile=/var/log/pg-el-sync-listen.log |
| 65 | +stderr_logfile=/var/log/pg-el-sync-listen.err.log |
| 66 | +``` |
| 67 | + |
| 68 | +Make sure to replace `/path/to/pg-el-sync` with the absolute path to your `pg-el-sync` installation. |
| 69 | + |
| 70 | +You can also adjust other settings according to your needs, such as log file paths and startup parameters. |
| 71 | + |
| 72 | + |
| 73 | +## Local Development |
| 74 | + |
| 75 | +To set up the environment for local development, follow these steps: |
| 76 | + |
| 77 | +1. Clone this repository: |
| 78 | + ```bash |
| 79 | + git clone https://github.com/quix-labs/pg-el-sync |
| 80 | + ``` |
| 81 | +2. Navigate to the `pg-el-sync` directory: |
| 82 | + ```bash |
| 83 | + cd pg-el-sync |
| 84 | + ``` |
| 85 | +3. Copy the `config.example.yaml` file to `config.yaml` and configure it according to your environment: |
| 86 | + ```bash |
| 87 | + cp config.example.yaml config.yaml |
| 88 | + ``` |
| 89 | + |
| 90 | +4. Run the tool in development mode: |
| 91 | + ```bash |
| 92 | + go run . |
| 93 | + ``` |
| 94 | + |
| 95 | + |
| 96 | +## Credits |
| 97 | + |
| 98 | +- [COLANT Alan](https://github.com/alancolant) |
| 99 | +- [All Contributors](../../contributors) |
| 100 | + |
| 101 | +## License |
| 102 | + |
| 103 | +This project is licensed under the [MIT License](LICENCE.md). |
0 commit comments