Skip to main content

Github Action Deployment to Cpanel for Nodejs Apps

Comments

4 comments

  • cPRex Jurassic Moderator
    Hey there! I think there may be two issues happening here. The first issue is that you likely do not have the correct entries in the cpanel.yml file. Do you have the first line of "---" in the file? The second issue is that your "ps" command is getting the "illegal" output because it shows many processes that aren't controlled by that user. Can you run that command as the user over SSH outside of Git? I'm guessing you'll also get errors there. I'm wondering if these tools would be better handled in a Bash script as part of a Cron job, as adding Git to this type of work just seems to add another layer of confusion.
    0
  • mssadewa
    Hi cPRex, Thank you. The .cpanel.yml actually valid, sorry for not include that dash. --- deployment: tasks: - /bin/kill -9 $(ps -ef | egrep -i api.sayap.co.id | egrep -i server.js |awk {'print'}) 2> /dev/null
    for ps, I can execute it over ssh and result with no errors. Yeah you right. Just trying with bash script. Here is my currently .cpanel.yml --- deployment: tasks: - cd /home/user/my-repo-path/ - git fetch && git pull - /bin/bash ../mssadewa.sh > /dev/null
    Here is the mssadewa.sh #!/bin/bash /bin/kill -9 $(ps -ef | egrep -i api.sayap.co.id | egrep -i server.js |awk {'print'}) 2> /dev/null source /home/user/nodevenv/api.sayap.co.id/16/bin/activate && cd /home/user/api.sayap.co.id npm i && npm start &
    with above setup, I got an polling iteration in github action. Any idea?
    0
  • cPRex Jurassic Moderator
    I honestly don't have any other ideas about the Git side of things. If you'd like to make a ticket with our team (assuming you have root access to the server) we'd be happy to do some testing with that.
    0
  • mssadewa
    I honestly don't have any other ideas about the Git side of things. If you'd like to make a ticket with our team (assuming you have root access to the server) we'd be happy to do some testing with that.

    Since I'm not the owner, I don't have root access. It's okay, I'll trying to get it work with another way. btw somehow I find you replay mentioning nodejs autostart and register it in application manager
    0

Please sign in to leave a comment.