Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

podman pod logs enhancements: when to exit #13268

Closed
muayyad-alsadi opened this issue Feb 17, 2022 · 11 comments
Closed

podman pod logs enhancements: when to exit #13268

muayyad-alsadi opened this issue Feb 17, 2022 · 11 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. stale-issue

Comments

@muayyad-alsadi
Copy link
Contributor

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind feature

Description

a way specify for podman pod logs -f

  • to wait to containers to start (not exit directly)
  • when to exit and what exit code to return

for example --exit-code-from <MY_CNT> and --exit-with-container=all | any | <CNT1,CNT2>

this might help creating a simpler systemd unit for multi-container pod

Steps to reproduce the issue:

podman pod create --name=pod_testlogs 
podman run --name=testlogs_loop1_1 -d --pod=pod_testlogs busybox /bin/sh -c 'for i in `seq 1 10000`; do echo "loop1: $i"; sleep 1; done'
podman run --name=testlogs_loop2_1 -d --pod=pod_testlogs busybox /bin/sh -c 'for i in `seq 1 10000`; do echo "loop2: $i"; sleep 3; done'
podman pod logs --tail=100 -f pod_testlogs

and then on another screen

podman run --name=testlogs_loop3_1 -d --pod=pod_testlogs busybox /bin/sh -c 'for i in `seq 1 10000`; do echo "loop3: $i"; sleep 3; done'

Describe the results you received:

podman pod logs --tail=100 -f pod_testlogs exits instantly if run after podman pod create --name=pod_testlogs

Describe the results you expected:

it should have a way to ask it wait containers to join

related to

#13261

@openshift-ci openshift-ci bot added the kind/feature Categorizes issue or PR as related to a new feature. label Feb 17, 2022
@muayyad-alsadi
Copy link
Contributor Author

we might be able to create systemd for an entire stack, discussion here

containers/podman-compose#307

[Unit]
Description=%i rootless pod (podman-compose)

[Service]
WorkingDirectory=%h/.config/containers/compose/%i
# assert existence of pod
ExecStartPre=/usr/bin/podman-compose up --no-start
# start the pod
ExecStartPre=/usr/bin/podman pod start pod_%i
# wait
ExecStart=/usr/bin/podman pod logs -f pod_%i
# stop
ExecStop=/usr/bin/podman pod stop pod_%i

[Install]
WantedBy=default.target

and any suggestion to make it Type=simple or forking instead of Type=oneshot
and anyway to have a pid file

@Luap99
Copy link
Member

Luap99 commented Feb 17, 2022

podman pod create does not start the pod so podman logs will exit immediately because no containers are running. I think you have to run podman pod create followed by podman pod start.

@muayyad-alsadi
Copy link
Contributor Author

I need to start following before starting so that I won't miss the logs in-between

$ podman pod create --name=pod_testlogs2 --infra=false --share=
$ podman pod start pod_testlogs2 ; podman pod logs -f pod_testlogs2
Error: no containers in pod 30ec21f40d4461d250ebe25f641e5092a3186d599ea2450ac6a313549424638f have no dependencies, cannot start pod: no such container

@Luap99
Copy link
Member

Luap99 commented Feb 20, 2022

Ah I see because you have a pod without infra container it does not work.

@muayyad-alsadi
Copy link
Contributor Author

yes, I'm attaching a stack of containers for example wordpress stack (wordpress php-fpm, nginx, memcached, mysql) or awx stack

version: '2'
services:
  web:
    image: docker.io/ansible/awx:17.1.0
    container_name: awx_web
    depends_on:
      - redis
      - postgres
    hostname: awxweb
    user: root
    restart: unless-stopped
    volumes:
      - "./SECRET_KEY:/etc/tower/SECRET_KEY"
  task:
    image: docker.io/ansible/awx:17.1.0
    container_name: awx_task
    depends_on:
      - redis
      - web
      - postgres
    command: /usr/bin/launch_awx_task.sh
    hostname: awx
    user: root
    restart: unless-stopped
    volumes:
      - "./SECRET_KEY:/etc/tower/SECRET_KEY"
  redis:
    image: redis
    container_name: awx_redis
    restart: unless-stopped
    command: ["/usr/local/etc/redis/redis.conf"]
    volumes:
      - "./redis.conf:/usr/local/etc/redis/redis.conf:ro"
      - "./redis_socket:/var/run/redis/:rw"
  postgres:
    image: postgres:12
    container_name: awx_postgres
    restart: unless-stopped
    volumes:
      - "./data/pg/12/data/:/var/lib/postgresql/data:Z"
    environment:
      POSTGRES_USER: awx
      POSTGRES_DB: awx
      http_proxy: 
      https_proxy: 
      no_proxy: 

each of them have different mounts, hostname, userns stack, ...etc.
that's why I use --share=
and when we share nothing the infra pod is useless and cause the podman pod ps to show it as degared (I'm not sure if this is a bug or international)

I create the pod
then create containers with --requires (the wordpress container requires the mysql one)
then follow the logs
then start the containers

later stop the pod and start it

I hope if there is a flag to tell -f to wait for "rising containers" and only exit on first fall (after the initial rising)

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@rhatdan
Copy link
Member

rhatdan commented Apr 25, 2022

@muayyad-alsadi @Luap99 where are we on this issue? Does it still exists, or did you find a workaround?

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@rhatdan
Copy link
Member

rhatdan commented Jun 29, 2022

Since I have never heard back, I am going to guess this is no longer needed and close. Reopen if I am mistaken.

@rhatdan rhatdan closed this as completed Jun 29, 2022
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 20, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/feature Categorizes issue or PR as related to a new feature. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. stale-issue
Projects
None yet
Development

No branches or pull requests

3 participants