$ apt-get update
$ apt-get install mysql-server

 

$ mysql -uroot -p

 

use mysql;
create database dbname default character set utf8;
grant all privileges on dbname* to userid@localhost identified by 'password';
flush privileges;
quit;

create table status_log (
seq int(11) not null auto_increment,

status varchar(50) not null,

name varchar(50) not null,
primary key(seq)
)charset=utf8;

insert into status_log(status,name) values('check','gyunseul9');

 

 

$ cd /workspacce

 

$ mkdir env

$ cd ..

$ mkdir log

$ cd log

$ mkdir uwsgi

$ vi ./env/uwsgi_servie.ini
---
[uwsgi]
chdir=/home/service/service_flask
chmod-socket=666
callable=app
module=api
socket=/tmp/uwsgi_service.sock
virtualenv=/workspace/service_flask

master=true
processes=5
max-requests=1000
harakiri=10
lazy-apps=true
logto=/workspace/service_flask/log/uwsgi/uwsgi_service.log
enable-threads = true
---

 

$ cd /workspace

$ chmod +x run.sh



$ vi /etc/nginx/sites-available/default
---
server {
listen 80;

server_name 0.0.0.0;

location / {
try_files $uri @app;
}
location @ap {
include uwsgi_params;
uwsgi_pass unix:/tmp/service_api.sock;
}
}
---

 

$ vi /etc/supervisor/conf.d/service.conf
---
[program:service]
command=/workspace/service_flask/run.sh
environment=HOME='/workspace',USER='root'
directory=/workspace/service_flask
autostart=true
autorestart=true
startretries=3
---

Posted by 앤비
,