From 0bd2b1529c0b483efb5290a61146024ec110fb0c Mon Sep 17 00:00:00 2001 From: Héctor Louzao Date: Dec 07 2019 13:28:06 +0000 Subject: Add Container --- diff --git a/scripts/checkstatus/Dockerfile b/scripts/checkstatus/Dockerfile new file mode 100644 index 0000000..048cbae --- /dev/null +++ b/scripts/checkstatus/Dockerfile @@ -0,0 +1,23 @@ +FROM python:3.7 + +COPY . /code +WORKDIR /code + +ARG FOWN +ARG FPSWD + +RUN pip install -r requirements.txt + +RUN mv myconfig.cfg.example myconfig.cfg + +RUN sed -i "s/fasuser/${FOWN}/g" myconfig.cfg +RUN sed -i "s/faspassword/${FPSWD}/g" myconfig.cfg + +EXPOSE 3333 + +ARG FSEARCH +ENV FSEARCH_TXT=$FSEARCH +ARG DAYS +ENV TOTAL_DAYS=$DAYS + +CMD ["sh", "-c", "python check.py $FSEARCH_TXT $TOTAL_DAYS > search.txt"] diff --git a/scripts/checkstatus/README.md b/scripts/checkstatus/README.md index 32d8280..c307ab5 100644 --- a/scripts/checkstatus/README.md +++ b/scripts/checkstatus/README.md @@ -1,15 +1,18 @@ Check FAS user status. ## Configuration: + rename `myconfig.cfg.example` to `myconfig.cfg` and edit it accordingly (it contains your FAS credentials). ## Syntax: + `python3 check.py username days` Where `username` is the FAS user to check and `days` is the number of days to check on datagrepper in order to get a list of activities logged from the fedmsg bus. ## Results + The script output is as follow: * Username @@ -21,3 +24,47 @@ The script output is as follow: * Activities in the last X days: * a list of activity topics grabbed from datagrepper * total number of activities + +## Using Container + +Install the following packed: + +` +sudo dnf install podman podman-compose +` + +Edit the following file: + +` +docker-compose.yml +` + +- FOWN=${USER} # your _FAS_ User, in the case you Linux user math with your _FAS_ +- FPSWD=password # your _FAS_ password +- FSEARCH=search # User to search +- DAYS=nn # Number of Days + +then build and execute the images: + +` +podman-compose up -d +podman logs image +` + +then copy the result from your images to your box. + +` +podman cp image:/code/search.txt search.txt +podman-compose down +` + +NOTE: images see podman pod create --name to see the image filename + + +find another user: + +* Edit `docker-compose-file.yml` as explain it before +* Execute `podman-compose build` +* Execute `podman-compose down` +* Execute `podman-compose up -d` +* Copy the file diff --git a/scripts/checkstatus/docker-compose.yml b/scripts/checkstatus/docker-compose.yml new file mode 100644 index 0000000..752759c --- /dev/null +++ b/scripts/checkstatus/docker-compose.yml @@ -0,0 +1,16 @@ +version: '2' + +services: + web: + build: + context: . + dockerfile: Dockerfile + args: + - FOWN=${USER} + - FPSWD=yourfaspassword + - FSEARCH=usersearch + - DAYS=number + image: fas + ports: + - "8080:3333" + network_mode: "host" diff --git a/scripts/checkstatus/requirements.txt b/scripts/checkstatus/requirements.txt new file mode 100644 index 0000000..8b3efc2 --- /dev/null +++ b/scripts/checkstatus/requirements.txt @@ -0,0 +1,3 @@ +requests==2.22.0 +python_dateutil==2.8.1 +python_fedora==0.10.0