exposed SERVICEBOOK to the docker image
This commit is contained in:
Родитель
2af2dcdab8
Коммит
b5272bddec
6
Makefile
6
Makefile
|
@ -24,9 +24,3 @@ test_dependencies:
|
|||
|
||||
test: build test_dependencies
|
||||
$(BIN)/tox
|
||||
|
||||
docker-build:
|
||||
docker build -t serviceweb/dev:latest .
|
||||
|
||||
docker-run:
|
||||
docker run -i -p 5000:5000 serviceweb/dev:latest
|
||||
|
|
|
@ -21,8 +21,7 @@ COPY global-nginx.conf /etc/nginx/nginx.conf
|
|||
|
||||
COPY supervisor.conf /etc/supervisor/conf.d/
|
||||
COPY version.json /app/version.json
|
||||
COPY init_db.py /app/init_db.py
|
||||
|
||||
ADD . /app
|
||||
EXPOSE 80
|
||||
CMD python init_db.py; supervisord -n
|
||||
CMD supervisord -n
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
.PHONY: build run
|
||||
|
||||
SERVICEBOOK = http://192.168.1.101:5001/api
|
||||
|
||||
build:
|
||||
docker build -t serviceweb/dev:latest .
|
||||
|
||||
run:
|
||||
docker run -p 127.0.0.1:5000:80 serviceweb/dev
|
||||
docker run -p 127.0.0.1:5000:80 -e SERVICEBOOK=$(SERVICEBOOK) serviceweb/dev
|
||||
|
||||
attach:
|
||||
docker exec -i -t $(ID) /bin/bash
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
import os
|
||||
from servicebook.db import main
|
||||
|
||||
|
||||
sqluri = os.environ.get('SQLURI')
|
||||
|
||||
if sqluri is not None and sqluri.startswith('sqlite:///'):
|
||||
filename = sqluri.split('sqlite:///')[-1]
|
||||
if not os.path.exists(filename):
|
||||
main(['--sqluri', sqluri])
|
|
@ -7,15 +7,6 @@ server {
|
|||
charset utf-8;
|
||||
client_max_body_size 75M;
|
||||
|
||||
location /api {
|
||||
proxy_pass http://127.0.0.1:5001;
|
||||
proxy_redirect off;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Host $server_name;
|
||||
}
|
||||
|
||||
location / {
|
||||
include uwsgi_params;
|
||||
uwsgi_pass uwsgicluster;
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
[program:servicebook]
|
||||
command = /usr/local/bin/uwsgi --ini /app/uwsgi-servicebook.ini
|
||||
|
||||
[program:serviceweb]
|
||||
command = /usr/local/bin/uwsgi --ini /app/uwsgi-serviceweb.ini
|
||||
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
[uwsgi]
|
||||
debug = true
|
||||
master = true
|
||||
processes = 5
|
||||
http-socket = :5001
|
||||
vacuum = true
|
||||
module = wsgiapp-book
|
|
@ -1,13 +0,0 @@
|
|||
import site
|
||||
import sys
|
||||
import os
|
||||
import codecs
|
||||
from servicebook.server import create_app
|
||||
|
||||
|
||||
ini = os.path.join(os.path.dirname(__file__), 'serviceweb.ini')
|
||||
application = create_app(ini_file=ini)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
application.run(host='0.0.0.0')
|
|
@ -42,8 +42,12 @@ def create_app(ini_file=DEFAULT_INI_FILE):
|
|||
app.register_blueprint(bp)
|
||||
bp.app = app
|
||||
|
||||
app.db = Client(app.config['common']['service_book'])
|
||||
app.search = Search(app.config['common']['service_book'])
|
||||
service_book = os.environ.get('SERVICEBOOK', None)
|
||||
if service_book is None:
|
||||
service_book = app.config['common']['service_book']
|
||||
|
||||
app.db = Client(service_book)
|
||||
app.search = Search(service_book)
|
||||
app.register_error_handler(401, unauthorized_view)
|
||||
nav.init_app(app)
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче