【5】将服务部署到本机(Ubuntu14.04)

首先,先将文件复制到指定的文件夹

我这里选择在/var下面新建一个www的文件夹来存放

复制BLOG文件夹的内容到www文件夹下

 sudo cp -r /home/jakeychen/Jakey/Blog/ /var/www/
 jakeychen@JakeyPC:/var/www/Blog$ sudo service supervisor restart
Restarting supervisor: supervisord.
jakeychen@JakeyPC:/var/www/Blog$ sudo supervisorctl
tornadoes:tornado-8000 RUNNING pid 10949, uptime 0:00:08
tornadoes:tornado-8001 RUNNING pid 10950, uptime 0:00:08
tornadoes:tornado-8002 RUNNING pid 10951, uptime 0:00:08
tornadoes:tornado-8003 RUNNING pid 10952, uptime 0:00:08
supervisor>

在conf.d目录下新建一个tornado.conf

sudo vim /etc/supervisor/conf.d/tornado.conf

tornado.conf文件内容

 [group:tornadoes]
programs=tornado-8000,tornado-8001,tornado-8002,tornado-8003 [program:tornado-8000]
command=sudo python /var/www/Blog/main.py --port=8000
directory=/var/www/Blog
user=root
autorestart=true
redirect_stderr=true
stdout_logfile=/var/www/Blog/logs/server.log
loglevel=info [program:tornado-8001]
command=sudo python /var/www/Blog/main.py --port=8001
directory=/var/www/Blog
user=root
autorestart=true
redirect_stderr=true
stdout_logfile=/var/www/Blog/logs/server.log
loglevel=info [program:tornado-8002]
command=sudo python /var/www/Blog/main.py --port=8002
directory=/var/www/Blog
user=root
autorestart=true
redirect_stderr=true
stdout_logfile=/var/www/Blog/logs/server.log
loglevel=info [program:tornado-8003]
command=sudo python /var/www/Blog/main.py --port=8003
directory=/var/www/Blog
user=root
autorestart=true
redirect_stderr=true
stdout_logfile=/var/www/Blog/logs/server.log
loglevel=info

重启服务

sudo service supervisor restart
上一篇:JVM内存结构、Java内存模型和Java对象模型


下一篇:漫谈何时从单体架构迁移到微服务?