Unitech / Unitech/pm2

Github workflow action timeout error, continues log streamed to console

Open
#5,172 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
43.3k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

What's going wrong?

Executing pm2 restart --no-daemon using ssh from github action caused continues log stream and github action exits with Run Command Timeout! error.

How could we reproduce this issue?

I have simple GitHub action that connects to the server using ssh. I'm running the pm2 restart --no-daemon from github action and it ends up with continuous pm2 logs stream causing timeout from github action itself.

Supporting information

Here is the workflow action for deployment

name: Continuous Integration Custimonial Production

on:
  push:
    branches: [master]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Deploy NodeJS app
        uses: appleboy/ssh-action@v0.1.2
        with:
          host: ${{secrets.SSH_HOST}}
          key: ${{secrets.SSH_KEY}}
          username: ${{ secrets.SSH_USER }}

          script: |
            cd ~/demo/demo
            git pull
            npm install --production
            pm2 kill demo
            NODE_ENV=production && pm2 start ecosystem.config.json --no-daemon
            echo 'Deployment successful to digital ocean'

Here is the ecosystem config file

{
  "apps": [
    {
      "name": "demo",
      "script": "src/index.js",
      "instances": 1,
      "autorestart": true,
      "watch": false,
      "time": true,
      "env": {
        "NODE_ENV": "production"
      }
    }
  ]
}

This is the error log at the end of github action log

err: Run Command Timeout!
2021/09/09 08:51:03 Error: command timeout

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided GitHub Actions deployment workflow and ecosystem.config.json, reproducing the remote pm2 restart/start command through appleboy/ssh-action. Compare the command's log behavior with the action's timeout; done means the deployment command exits and the workflow reaches its success message without a continuous log stream.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, javascript, nodejs
Domain
cli, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.