ansible / awx

AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is one of the upstream projects for Red Hat Ansible Automation Platform.
Other
13.54k stars 3.35k forks source link

Job output not refreshing automatically in AWX 18.0.0 #9747

Open dimovstanimir opened 3 years ago

dimovstanimir commented 3 years ago
ISSUE TYPE
SUMMARY

Job output not refreshing automatically in AWX 18.0.0. I need to manually hit F5 or refresh from the browser so I could see what is happening during the job execution.

ENVIRONMENT
jakemcdermott commented 3 years ago

Hello. Thanks for creating this issue.

I haven't been successful at reproducing this on devel:

job_refresh

Do you see any websocket events in the network tab? And are sockets generally working in other places, like on job and project lists where the status icons are supposed to update?

dimovstanimir commented 3 years ago

If you have some long playbook to be executed such as mines where I have playbooks taking more than 20 minutes I am only seeing blank output windows until the playbook has finished. So I am waiting around 20 minutes to see the whole log output in a second. Isn't it possible to see all the steps while they are executed and not wait for when the whole playbook has been finished so I would be able to see the whole log dumped at the end?

amg-web commented 3 years ago

same problem. (existed on v16 and v17) v.15 worked great. need to refresh page to get it updated again and again

for v18 reinstalled from scratch with minikube

I see websocket connection error

Ansible AWX - Opera 09 04 2021 17_47_47

dimovstanimir commented 3 years ago

same problem. (existed on v16 and v17) v.15 worked great. need to refresh page to get it updated again and again

for v18 reinstalled from scratch with minikube

I see websocket connection error

Ansible AWX - Opera 09 04 2021 17_47_47

I totaly agree with @amg-web . But how hard could it be for this to be fixed. It has been 4 major releases till now in which this has not been fixed and this functionality is truly needed.

ryanpetrello commented 3 years ago

But how hard could it be for this to be fixed.

Hey @dimovstanimir,

PRs are encouraged and welcome - let us know what you find!

jakemcdermott commented 3 years ago

:wave: Hi folks

Any comment on my question above? Specifically, I'd like to know if any of our socket-driven features appear to be working for you on any of the other pages (updating status icons on job lists, etc.). It'll help isolate the problem for when we work on addressing the bug.

Do you see any websocket events in the network tab? And are sockets generally working in other places, like on job and project lists where the status icons are supposed to update?

dimovstanimir commented 3 years ago

But how hard could it be for this to be fixed.

Hey @dimovstanimir,

PRs are encouraged and welcome - let us know what you find!

This thing was workin

But how hard could it be for this to be fixed.

Hey @dimovstanimir,

PRs are encouraged and welcome - let us know what you find!

@ryanpetrello this thing was working 4 versions ago and someone broke it. Why should I be the one fixing it? Just find who broke it and who approved the PR request. Everything is in git.

ryanpetrello commented 3 years ago

@dimovstanimir

Why should I be the one fixing it? Just find who broke it and who approved the PR request. Everything is in git.

I mean, why should anyone be obligated to fix it? It's open source software, and it's provided for free. While our team of maintainers tries their best to address reports of issues, this software - like much open source software - is provided as-is.

It sounds like that there might be a legitimate regression here, but until someone finds the time to look into it and address it (which I'm sure they will at some point), you (or anyone else) is free to pitch in (or exercise some patience and wait).

@jakemcdermott asked some questions above to clarify:

https://github.com/ansible/awx/issues/9747#issuecomment-811167381 https://github.com/ansible/awx/issues/9747#issuecomment-816789508

Do you know if you're seeing this on other pages that make use of websockets, or just this one?

dimovstanimir commented 3 years ago

@ryanpetrello I don't want to blame people and etc. but If it was you, would you approve 4 new releases before having such a major functionality fixed after knewing that prior that it was crippled? I know I wouldn't.

jakemcdermott commented 3 years ago

@dimovstanimir Do sockets and status icon updates work for you on other pages, such as the jobs and project list?

jakemcdermott commented 3 years ago

@dimovstanimir

I'm talking about these status icons, on a different page:

jobsockets

On your installation, do their statuses update without a refresh?

amg-web commented 3 years ago

@jakemcdermott I'm talking about these status icons, on a different page: On your installation, do their statuses update without a refresh?

no. no status updates. I saw 404 in Firefox for a short time, after it changed to 'finished'

jakemcdermott commented 3 years ago

Good info, thank you. @amg-web

@dimovstanimir To help us isolate the problem, can you please comment on this as well? https://github.com/ansible/awx/issues/9747#issuecomment-816896536

dimovstanimir commented 3 years ago

@jakemcdermott I've just checked and the status icons on the Jobs page are refreshing normally without the need of me hitting the refresh button. Unfortunately when I start a job template and when I want to see some output I am not getting any. I am waiting for about 5 to 20 minutes depending on the playbook and when it finishes it dumps all the stages/steps at once and shows also how much time did it take to run with all relevant details from the dump but the output happens by itself ONLY after the whole playbook has run till the very end.

amg-web commented 3 years ago

if start job and go Jobs I see animations, but it's endless. It does not update state. I have to make page refresh

DenisMedeirosBBD commented 3 years ago

Also having the same issue (used to work before but now it's broken after updating AWX).

Some notes:

  1. On Google Chrome console, it shows a few messages like WebSocket is already in CLOSING or CLOSED state..

  2. When I launch a job template, the Output screen opens but nothing happens (even the timer does not start to run). Then, after a few minutes (when the run is finished), the screen is updated automatically with the whole output and the timer with the total elapsed time.

dimovstanimir commented 3 years ago

Also having the same issue (used to work before but now it's broken after updating AWX).

Some notes:

  1. On Google Chrome console, it shows a few messages like WebSocket is already in CLOSING or CLOSED state..
  2. When I launch a job template, the Output screen opens but nothing happens (even the timer does not start to run). Then, after a few minutes (when the run is finished), the screen is updated automatically with the whole output and the timer with the total elapsed time.

This is the most acurate explanation and this is the very same behavior which is happening in my installation.

eschek87 commented 3 years ago

AWX 19.0.0 affected, too.

amg-web commented 3 years ago

I manage to fix it by correcting nginx proxy config. Config I used described here: https://www.linkedin.com/pulse/how-use-nginx-reverse-proxy-https-wss-self-signed-ramos-da-silva?articleId=6678584723419226112

eschek87 commented 3 years ago

I manage to fix it by correcting nginx proxy config. Config I used described here: https://www.linkedin.com/pulse/how-use-nginx-reverse-proxy-https-wss-self-signed-ramos-da-silva?articleId=6678584723419226112

And what of the described settings helped?

dimovstanimir commented 3 years ago

I manage to fix it by correcting nginx proxy config. Config I used described here: https://www.linkedin.com/pulse/how-use-nginx-reverse-proxy-https-wss-self-signed-ramos-da-silva?articleId=6678584723419226112

@amg-web can you make a short video and show us how it looks when being fixed and working?

Thanks in advance

amg-web commented 3 years ago

And what of the described settings helped?

about websocket proxy config. This is not the only place. You can search a lot of manuals about websocket proxy configs

can you make a short video and show us how it looks when being fixed and working?

All animations is working.

Ansible AWX - Opera 03 05 2021 15_41_42

amg-web commented 3 years ago

But there is another error in browser debug as you can see. useWebsocket.js:20 WebSocket is already in CLOSING or CLOSED state. t @ useWebsocket.js:20 (anonymous) @ useWebsocket.js:37 setTimeout (async) Kn.c.current.onclose @ useWebsocket.js:36

amg-web commented 3 years ago

I think here we can check best working config: https://github.com/ansible/awx/blob/15.0.1/tools/docker-compose/nginx.vh.default.conf

amg-web commented 3 years ago

@jakemcdermott how do you use it? Which nginx or apache config is in use? my current config does not update time counter and have some errors in browser debug window

garnser commented 3 years ago

@amg-web I've given the suggested configuration a spin, although most animations are working the auto-update during a template runtime is still hanging until the play is finished. Is this resolved for you as well?

I'm getting the same issues in the console as you're describing useWebsocket.js:20 WebSocket is already in CLOSING or CLOSED state. t @ useWebsocket.js:20 (anonymous) @ useWebsocket.js:37 setTimeout (async) Kn.c.current.onclose @ useWebsocket.js:36

passe4wedo commented 2 years ago

Are there any news about this issue?

lumarel commented 2 years ago

I finally was able to upgrade to a recent version, and have to report, this problem is unfortunately still there in:

Ansible AWX version: 19.3.0
Ingress controller: Contour in default config
fabfabbar commented 2 years ago

I finally was able to upgrade to a recent version, and have to report, this problem is unfortunately still there in:

Ansible AWX version: 19.3.0
Ingress controller: Contour in default config

+1

jdi1983 commented 2 years ago

If you have some long playbook to be executed such as mines where I have playbooks taking more than 20 minutes I am only seeing blank output windows until the playbook has finished. So I am waiting around 20 minutes to see the whole log output in a second. Isn't it possible to see all the steps while they are executed and not wait for when the whole playbook has been finished so I would be able to see the whole log dumped at the end?

We have the Same Issue and are running AWX 13.0.0 Role Ansible Juniper 2.9.10 Some PB need to wait about 10 to 30 minutes sometimes that the action is finished (systeme snapshot or reload) It's all the more difficult to use as we have approval windows in the WorkFlow ....

jdi1983 commented 2 years ago

Hello. Thanks for creating this issue.

I haven't been successful at reproducing this on devel:

job_refresh

Do you see any websocket events in the network tab? And are sockets generally working in other places, like on job and project lists where the status icons are supposed to update?

Can you explain what do you call network tab ? I suppose you are talking about the browser's one ? here is a screenshot at the bottom of FireFox image

amg-web commented 2 years ago

select All (left on HTML), and refresh the page

lumarel commented 2 years ago

This is how all websockets end here: image It doesn't exchange any message via websocket.

jdi1983 commented 2 years ago

Do there is a recommanded Web Browser for AWX ? I'm using FireFox 78.14.0esr

AdamMack2007 commented 2 years ago

This is affecting Automation Controller 4.1.0 (AAP 2.1) as well in both Firefox 78.15.0esr and Chrome 96.0.4664.93

Inventory syncs, projects and templates/workflows all hang and will show no activity until I refresh or after a certain duration 2+ minutes.

Screen Shot 2021-12-08 at 5 15 46 PM

This was done from a Tower 3.8.3 single node cluster upgraded to AAP 2.1

ffirg commented 2 years ago

related? #9085

diptajeet commented 2 years ago

Is there any updates on this? I am facing similar issues - No refresh of Job Outputs till its done forcefully using the browser. After reading several threads on similar issues, it seems that this issue is pertinent on most of the versions, not just on v18

pslencinas commented 2 years ago

Hi Guys. I'm having the same issue. Do you have any update about it?

AWX: 17.1.0 Docker installation Ubuntu 20

coreydeli commented 2 years ago

I have this exact same issue in version 20 on microk8s on Ubuntu 20.04.4 LTS.

Donny-Ta commented 2 years ago

Hi,

I am also experiencing this issue.

AWX: 21.0.1 (dev) Docker installation Centos 8.0

It seems like the websocket hangs maybe?

Below is the network traffic of a run where I am stuck with the job constantly saying "running" but nothing ever shows up and "running" never turns into "succeeded"

running

And this is of a run where the job jumps from "running" to "succeeded" but you can see that nothing showed up in the panel once again

succeeded

If I navigate to the Details tab and then back to Output, the output box does refresh with new data in it.

xBr0th3rx commented 2 years ago

Hello, everyone,

does anyone have an update on this topic?

We also have the same problem, the result is only displayed after the job has been completed or I have to keep refreshing the page.

I don't see an error in the network tab no-error-in-network-ansible

But in the console tab I get "Websocket Connection ... Failed ... JobOutput". error-in-console-ansible

amg-web commented 2 years ago

I think here we can check best working config: https://github.com/ansible/awx/blob/15.0.1/tools/docker-compose/nginx.vh.default.conf

@xBr0th3rx , @Donny-Ta all working config was published a long time ago.

here is the latest version https://github.com/ansible/awx/blob/17.0.1/tools/docker-compose/nginx.vh.default.conf

my working config:

map $http_upgrade $connection_upgrade {
    default upgrade;
    ''      close;
}

upstream minikube {
    server 192.168.49.2:30080;
}

server {
    listen 80;
    listen [::]:80;
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name awx.example.com;
    keepalive_timeout 65;

    location ~ /.well-known {
        auth_basic off;
        allow all;
    }

    if ($scheme != "https") {
        rewrite ^ https://$host$uri permanent;
    }

    ssl_session_timeout 1d;
    ssl_session_cache shared:MozSSL:10m;
    ssl_session_tickets off;
    ssl_protocols TLSv1.3;
    ssl_prefer_server_ciphers off;
    add_header Strict-Transport-Security "max-age=63072000" always;

    # OCSP stapling
 #   ssl_stapling on;
 #   ssl_stapling_verify on;

    ssl_certificate /etc/letsencrypt/live/awx.example.com/fullchain.pem; 
    ssl_certificate_key /etc/letsencrypt/live/awx.example.com/privkey.pem; 

    # HSTS (ngx_http_headers_module is required) (15768000 seconds = 6 months)
    add_header Strict-Transport-Security max-age=15768000;

    location / {
        proxy_set_header        Host $host;
        proxy_set_header        X-Real-IP $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header        X-Forwarded-Proto $scheme;
        proxy_pass              http://minikube;
        proxy_read_timeout      90;
    }

    location ~ ^/websocket {
        # Pass request to the upstream alias
        proxy_pass http://minikube;
        # Require http version 1.1 to allow for upgrade requests
        proxy_http_version 1.1;
        # We want proxy_buffering off for proxying to websockets.
        proxy_buffering off;
        # http://en.wikipedia.org/wiki/X-Forwarded-For
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        # enable this if you use HTTPS:
        proxy_set_header X-Forwarded-Proto https;
        # pass the Host: header from the client for the sake of redirects
        proxy_set_header Host $http_host;
        # We've set the Host header, so we don't need Nginx to muddle about with redirects
        proxy_redirect off;
        # Depending on the request value, set the Upgrade and connection headers
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
    }
}
xBr0th3rx commented 2 years ago

I think here we can check best working config: https://github.com/ansible/awx/blob/15.0.1/tools/docker-compose/nginx.vh.default.conf

@xBr0th3rx , @Donny-Ta all working config was published a long time ago.

here is the latest version https://github.com/ansible/awx/blob/17.0.1/tools/docker-compose/nginx.vh.default.conf

my working config:

map $http_upgrade $connection_upgrade {
    default upgrade;
    ''      close;
}

upstream minikube {
    server 192.168.49.2:30080;
}

server {
    listen 80;
    listen [::]:80;
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name awx.example.com;
    keepalive_timeout 65;

    location ~ /.well-known {
        auth_basic off;
        allow all;
    }

    if ($scheme != "https") {
        rewrite ^ https://$host$uri permanent;
    }

    ssl_session_timeout 1d;
    ssl_session_cache shared:MozSSL:10m;
    ssl_session_tickets off;
    ssl_protocols TLSv1.3;
    ssl_prefer_server_ciphers off;
    add_header Strict-Transport-Security "max-age=63072000" always;

    # OCSP stapling
 #   ssl_stapling on;
 #   ssl_stapling_verify on;

    ssl_certificate /etc/letsencrypt/live/awx.example.com/fullchain.pem; 
    ssl_certificate_key /etc/letsencrypt/live/awx.example.com/privkey.pem; 

    # HSTS (ngx_http_headers_module is required) (15768000 seconds = 6 months)
    add_header Strict-Transport-Security max-age=15768000;

    location / {
        proxy_set_header        Host $host;
        proxy_set_header        X-Real-IP $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header        X-Forwarded-Proto $scheme;
        proxy_pass              http://minikube;
        proxy_read_timeout      90;
    }

    location ~ ^/websocket {
        # Pass request to the upstream alias
        proxy_pass http://minikube;
        # Require http version 1.1 to allow for upgrade requests
        proxy_http_version 1.1;
        # We want proxy_buffering off for proxying to websockets.
        proxy_buffering off;
        # http://en.wikipedia.org/wiki/X-Forwarded-For
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        # enable this if you use HTTPS:
        proxy_set_header X-Forwarded-Proto https;
        # pass the Host: header from the client for the sake of redirects
        proxy_set_header Host $http_host;
        # We've set the Host header, so we don't need Nginx to muddle about with redirects
        proxy_redirect off;
        # Depending on the request value, set the Upgrade and connection headers
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
    }
}

Hey thanks for the Answer

In which Docker i must set this?

amg-web commented 2 years ago

docker has it. it's for nginx if you use it as a proxy

lumarel commented 2 years ago

I spent some time with that topic again now, and in case of Contour it looks like the Websocket support has to be explicitly enabled. https://projectcontour.io/docs/v1.21.0/config/websockets/

Furthermore it looks to me like it can be enabled via annotations, but I didn't have luck up to now by just adding it to the / rule. https://github.com/projectcontour/contour/issues/3461#issuecomment-800609663

Maybe its the same issue also for other Ingress Controllers.

Donny-Ta commented 2 years ago

@amg-web, I am using the docker deployment with 2 control nodes and that spins up HAProxy. The internal nginx config is the same as the one you posted though, but there's a disconnect with the HAProxy config, I suppose?

amg-web commented 2 years ago

I'm just started with k8s so use simple config

spec:
  service_type: nodeport
  nodeport_port: 30080

it works behind nginx

arodriguezd commented 1 year ago

Hello everyone, I also had this problem, but it only happened when I was behind a Haproxy, if I connected directly to the machine it didn't give me that problem. The configuration I made was based on this repo at https://github.com/kurokobo/awx-on-k3s thanks to kurokobo x his repo is very complete.

When I wanted to pass it through a Haproxy it showed me the websocket error, so I had to make a configuration, based on this issue https://github.com/dani-garcia/vaultwarden/issues/750 , which although it has nothing to do with awx, it can help you, in my case it helped me and now it no longer shows me the websocket error when it goes through the Haproxy

I hope it helps you Good luck

tarmael commented 1 year ago

Same problem on Red Hat Automation Platform 2.2.1 No idea what version of AWX that's based on

rooso commented 1 year ago

I spent some time with that topic again now, and in case of Contour it looks like the Websocket support has to be explicitly enabled. https://projectcontour.io/docs/v1.21.0/config/websockets/

Furthermore it looks to me like it can be enabled via annotations, but I didn't have luck up to now by just adding it to the / rule. projectcontour/contour#3461 (comment)

Maybe its the same issue also for other Ingress Controllers.

Thanks @lumarel for that hint. Was able to resolve it with the annotation projectcontour.io/websocket-routes: "/websocket" and an additional ingress rule for that path (/websocket). Here an example:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    projectcontour.io/websocket-routes: "/websocket"
    kubernetes.io/ingress.class: contour
  name: awx-ingress
spec:
  rules:
    - host: awx.cluster.io
      http:
        paths:
          - backend:
              service:
                name: awx-service
                port:
                  number: 80
            path: /
            pathType: Prefix
          - backend:
              service:
                name: awx-service
                port:
                  number: 80
            path: /websocket
            pathType: Prefix
  tls:
    - hosts:
        - awx.cluster.io
      secretName: my-secret-name