$ 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
---
'Python' 카테고리의 다른 글
macOS, 파이썬 API 마인크래프트 서버 설치 (0) | 2018.05.27 |
---|---|
구름IDE 무료계정으로 Python, Flask+UWSGI+Supervisor, MySQL 연동하기 (3) (0) | 2018.05.07 |
구름IDE 무료계정으로 Python, Flask+UWSGI+Supervisor, MySQL 연동하기 (1) (0) | 2018.05.04 |
ubuntu, goormide nginx+uwsgi (0) | 2018.03.11 |
heroku 설정 방법 (0) | 2018.03.07 |