How to deploy nodejs app to generic Server with circleCI 2.0

nodejs
docker
circle.yml

#1

Normally, I use pm2 to run nodejs app on my server at my university.
But now I want to do CI with my project I don’t know how to auto push code from GitHub to my server add restart PM2 service.

I try to do:

- deploy:        
    command: |
        scp -r * -P 6969 username@example.com:server
        chmod +x ./config/deploy.sh
        ./config/deploy.sh

with deploy.sh

#!/bin/sh
ssh -P 6969 username@ -c "cd server && npm install && pm2 restart app"

But it doesn’t work. I really don’t know how to run server automatically. Scp is just copied my project to my server. And I need to run it? Alright?


#2