Environmental Science :

Centos 7

already installed .Net core 2.0.0  .Net core 1.1.2

1,Supervisor install

* yum install
yum install supervisor

( Alicloud passed the verification )


* easy_install install
  If yum Setup cannot find resources , Through easy_install

wget --no-check-certificate https://bootstrap.pypa.io/ez_setup.py -O - | sudo

install supervisor

easy_install supervisor



2, to configure supervisor

* stay etc Create directory under , And give authority
              mkdir -m 700 -p /etc/supervisor

* In the catalog “ /etc/supervisor” Create profile under
              echo_supervisord_conf > /etc/supervisor/supervisord.conf

* Modify profile
               vim /etc/supervisor/supervisord.conf

           Add at the end of the file , Note that there is no space between the beginning and the end , Topless lattice
* In the catalog “/etc/supervisor” Create below dotnet core Process profile storage directory “conf.d”
            mkdir -m 700 /etc/supervisor/conf.d



3, Create process profile

  vim /etc/supervisor/conf.d/MyDotNetName.conf

"MyDotNetName" Can be dotnet core entrance dll File name , Insert content , Note that there is no space between the beginning and the end , Topless lattice :
[program:MyDotNetName] command=/bin/bash -c "dotnet MyDotNetName.dll" directory
stderr_logfile=/var/log/MyDotNetName.error.log stdout_logfile=/var
stopsignal=INT autostart=true
autorestart=true startsecs=3 [program:MyDotNetName] ; Display name command=/bin/bash -c
"dotnet MyDotNetName.dll" ; Run command , start-up dotnet process directory=/usr/PublishOutput/
;MyDotNetName catalog stderr_logfile=/var/log/MyDotNetName.error.log ; Error log file
stdout_logfile=/var/log/MyDotNetName.stdout.log ; log file
environment=ASPNETCORE_ENVIRONMENT=Production ; Process environment variable user=root ; Process execution user
autostart=true ; Auto start autorestart=true   ; Whether to restart automatically startsecs=3 ; Automatic restart interval

4, establish supervisor Self starting service

vim /etc/systemd/system/supervisor.service

Edit content :
[Unit] Description=supervisor [Service] Type=forking ExecStart
=/usr/bin/supervisord -c /etc/supervisor/supervisord.conf ExecStop=/usr/bin/
supervisorctl shutdown ExecReload=/usr/bin/supervisorctl reload KillMode=
process Restart=on-failure RestartSec=42s [Install] WantedBy=multi-user.target
Make configuration effective

systemctl daemon-reload

Set service startup , I.e. settings enable

systemctl enable supervisor.service

Start service

systemctl start supervisor.service


5, verification dotnet Whether the process starts

Using commands “ps -ef | grep dotnet” see dotnet Run or not
[[email protected] ~]# ps -ef | grep dotnet root 2281 2280 0 15:27 ? 00:00:00
dotnet MyDotNetName.dll root2302 2217 0 15:30 pts/0 00:00:00 grep --color=auto

6,supervisor Remote management

Using commands “vim /etc/supervisor/supervisord.conf” Modify profile , The following settings
;[inet_http_server] ; inet (TCP) server disabled by default ;port=
9001 ; (ip_address:port specifier, *:port for all iface) ;username=user ; (
default is no username (open server)) ;password=123 ; (default is no password
(open server))
; The following is on http service [inet_http_server] port= ;ip Add port username=admin
; Login account , Can not set password=123456 ; Login account , Can not set
Restart service , You can access it

Pay attention to whether the firewall is to the port 9001 exception


Possible problems :

supervisor start-up dotnet.core newspaper “ too many start retries too quickly”