Home > Software engineering >  .net core site not updating after redployment on ubuntu
.net core site not updating after redployment on ubuntu

Time:11-09

I have a .net core 3.1 site deployed to ubuntu and using nginx.

I have a github action that does the deployment to the server.

I have noticed after the deployment the site still uses the old backend/dll..

The only way to get the latest backend changes is to log in to server and run sudo systemctl restart myapp.service

How can i ensure the latest dll is loaded after a deployment?

CodePudding user response:

Three steps needed, added the ssh command to the yaml,

- name: restart service
  uses: fifsky/ssh-action@master
  with: 
    command: |
      pwd
      echo restarting service
      sudo systemctl restart myapp.service
    host: ${{ secrets.SERVER_IP }}
    user: ${{ secrets.USER }}
    key: ${{ secrets.KEY}}

On the server had to do

sudo visudo

And add this to the bottom (replace username)

 username ALL = NOPASSWD: /bin/systemctl
  • Related