#15 Add Container
Closed 2 years ago by hhlp. Opened 2 years ago by hhlp.
Unknown source master  into  master

@@ -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"]

@@ -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 @@

  * 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

@@ -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"

@@ -0,0 +1,3 @@

+ requests==2.22.0

+ python_dateutil==2.8.1

+ python_fedora==0.10.0