Deploy .NET Core app on Ubuntu

check if it runs

dotnet run

Deploy in a build directory

dotnet publish --output “ /var/www/build” --configuration release

Go to the build directory and run the application

dotnet ForExample.dll

Create the service file

sudo nano /etc/systemd/system/kestrel-ForExample-test.service
[Unit]
Description=Example .NET Web API App running on Ubuntu
[Service]
WorkingDirectory=/var/www/ForExample/ForExample
ExecStart=/usr/bin/dotnet /var/www/build/ForExample.dll
Restart=always
# Restart service after 10 seconds if the dotnet service crashes:
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=dotnet-example
User=www-data
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false
[Install]
WantedBy=multi-user.t

Register the service

sudo systemctl enable kestrel-ForExample-test.service

Start the service and verify that it’s running.

sudo systemctl start kestrel-mebgispanel-test.service
sudo systemctl status kestrel-mebgispanel-test.service

Check the server logs

sudo journalctl -fu kestrel-helloapp.service

References
https://medium.com/faun/ubuntu-servers-and-asp-net-core-project-deployment-using-nginx-d9a3a1f6ac82

Tmux Cheat Sheet & Quick Reference

Start a new session

tmux
tmux new
tmux new-session

Start a new session with the name mysession

tmux new -s mysession

kill/delete session mysession

tmux kill-session -t mysession

kill/delete all sessions but the current

tmux kill-session -a

kill/delete all sessions but mysession

tmux kill-session -a -t mysession

Show all sessions

tmux ls
tmux list-sessions

Attach to a session with the name mysession

tmux a -t mysession
tmux at -t mysession
tmux attach -t mysession
tmux attach-session -t mysession

Rename session

Ctrl + b $

Detach from session

Ctrl + b d

Create window

Ctrl + b c

Rename current window

Ctrl + b ,

Close current window

Ctrl + b &

Previous window

Ctrl + b p

Next window

Ctrl + b n

Switch/select window by number

Ctrl + b 0 ... 9

Scroll

Ctrl-b [
# Press q to quit scroll mode
Ctrl-b PgUp

References
https://tmuxcheatsheet.com/
https://gist.github.com/MohamedAlaa/2961058