From 251000beb87147130f39f8fab211c18a0518b5ac Mon Sep 17 00:00:00 2001 From: Kevin Koech Date: Tue, 26 Nov 2024 12:48:04 +0300 Subject: [PATCH 1/2] Updates Readme on instructions to run pesacheck_meedan_bridge --- pesacheck_meedan_bridge/README.md | 42 ++++++++++++++++++++++++++++-- pesacheck_meedan_bridge/py/VERSION | 2 +- 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/pesacheck_meedan_bridge/README.md b/pesacheck_meedan_bridge/README.md index ff4c6b1b..cde0bb53 100644 --- a/pesacheck_meedan_bridge/README.md +++ b/pesacheck_meedan_bridge/README.md @@ -1,3 +1,41 @@ -# PesaCheck Meedan Bridge +# Pesacheck Meedan Bridge -A simple service to pull articles from PesaCheck and post them to Meedan Check +A simple service to pull articles from PesaCheck and post them to Meedan Check using Meedan Graphql API. This service acts as a bridge between PesaCheck and Meedan Check, allowing for seamless transfer of articles from one platform to another. + +## Getting Started + +First create `.env` file in the app directory. From project root directory, + +```sh +cp pesacheck_meedan_bridge/.env.example pesacheck_meedan_bridge/.env +``` + +and modify the `.env` file according to your needs. + +## Build + +To build a `pex` binary, run: + +```sh +pants package pesacheck_meedan_bridge/py:pesacheck_meedan_bridge +``` + +To build the docker image, run: + +```sh +VERSION=$(cat pesacheck_meedan_bridge/py/VERSION) pants package pesacheck_meedan_bridge/docker:pesacheck_meedan_bridge +``` + +## Run + +To run the built docker image, execute: + +```sh +docker compose --env-file ./pesacheck_meedan_bridge/.env up pesacheck_meedan_bridge +``` + +To run `pex` binary, execute: + +```sh +docker exec -it ${container_name} ./pex +``` diff --git a/pesacheck_meedan_bridge/py/VERSION b/pesacheck_meedan_bridge/py/VERSION index 0e24a92f..04c5555c 100644 --- a/pesacheck_meedan_bridge/py/VERSION +++ b/pesacheck_meedan_bridge/py/VERSION @@ -1 +1 @@ -0.1.12 +0.1.17 From a361f2f42cc8f5047bb3a20446982c48ae9dada7 Mon Sep 17 00:00:00 2001 From: Kevin Koech Date: Tue, 26 Nov 2024 14:01:26 +0300 Subject: [PATCH 2/2] Add script to get container id from running docker-compose --- pesacheck_meedan_bridge/README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pesacheck_meedan_bridge/README.md b/pesacheck_meedan_bridge/README.md index cde0bb53..6baa1215 100644 --- a/pesacheck_meedan_bridge/README.md +++ b/pesacheck_meedan_bridge/README.md @@ -33,9 +33,12 @@ To run the built docker image, execute: ```sh docker compose --env-file ./pesacheck_meedan_bridge/.env up pesacheck_meedan_bridge ``` - +To get container ID of this script, execute: +```sh +container_id=$(docker ps --filter "ancestor=codeforafrica/pesacheck_meedan_bridge:latest" --format "{{.ID}}" | head -n 1) && [ -z "$container_id" ] && echo "No running container found for the image codeforafrica/pesacheck_meedan_bridge:latest" +``` To run `pex` binary, execute: ```sh -docker exec -it ${container_name} ./pex +docker exec -it $container_id ./pex ```