css fix, preparing prod

This commit is contained in:
voje 2019-05-04 18:12:05 +02:00
parent 02c0e74798
commit c96b199932
11 changed files with 79 additions and 46 deletions

View File

@ -1,7 +1,5 @@
FROM cjvt-python-env
RUN pip3 install gunicorn
RUN mkdir -p /project/src/backend_flask
RUN mkdir -p /project/src/pkg
RUN mkdir -p /project/data

View File

@ -105,6 +105,9 @@ frontend-dev:
frontend-prod:
cd src/frontend_vue/; $(MAKE) prod
frontend-build-prod:
cd src/frontend_vue/; $(MAKE) build-prod
## Backend
@ -131,7 +134,7 @@ backend-prod-old:
--appindex-json $(APPINDEX_PATH)
backend-prod:
cd ./src/backend_flask; $(MAKE) prod
cd ./src/backend_flask; $(MAKE) run
## add sskj senses to db (generated with pkg/seqparser)
sskj-senses:

View File

@ -20,6 +20,7 @@ RUN pip3 install \
flask \
flask_cors \
pymongo \
flask-pymongo
flask-pymongo \
gunicorn
ENV PYTHONIOENCODING UTF-8

9
nginx.conf Normal file
View File

@ -0,0 +1,9 @@
server {
listen 80;
server_name _;
location / {
root /frontend_fue/dist;
index index.html index.htm;
}
}

43
production.yaml Normal file
View File

@ -0,0 +1,43 @@
version: '3.1'
services:
my_mongo:
image: my-mongo
restart: always
# ports:
# - 27017:27017
expose: 27017
environment:
MONGO_INITDB_ROOT_USERNAME: ${DB_ADM_USER}
MONGO_INITDB_ROOT_PASSWORD: ${DB_ADM_PASS}
volumes:
- ${HOME}/mongo_container/data/:/data/db
network: backend
mongo_express:
image: mongo-express
restart: always
# ports:
# - 8087:8081
environment:
ME_CONFIG_BASICAUTH_USERNAME: ${MONGOEXPRESS_USER}
ME_CONFIG_BASICAUTH_PASSWORD: ${MONGOEXPRESS_PASS}
ME_CONFIG_MONGODB_ADMINUSERNAME: ${DB_ADM_USER}
ME_CONFIG_MONGODB_ADMINPASSWORD: ${DB_ADM_PASS}
ME_CONFIG_MONGODB_SERVER: my-mongo
network: backend
# backend_flask:
# image: backend-flask
# network: backend
# expose: 8084
proxy:
image: nginx
ports:
- 80:80
- 8084:8084
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
- ./src/frontend_vue/dist:/frontend_vue/dist

View File

@ -13,4 +13,4 @@ build: build-cjvt-python-env
cd ../..; docker build . -f Dockerfile-backend-flask -t $(IMG)
build-cjvt-python-env:
cd ../../dockerfiles/python-env; $(MAKE) build
cd ../../dockerfiles/python-env; $(MAKE) build

View File

@ -500,18 +500,15 @@ def prepare_app_index(appindex_json, sskj_wordlist):
def init_wsgi(app):
print("Initiating wsgi")
config = None
with Path("/project/prod_conf.yaml").open("r") as fp:
config = list(yaml.safe_load_all(fp))[0]
app.debug = False
logfile = config["logfile"]
if app.debug:
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
else:
logging.basicConfig(filename=logfile, level=logging.INFO)
logging.basicConfig(filename=logfile, level=logging.INFO)
# db login
# app index from db
with Path(config["appindex"]).open("r") as fp:
# a dirty hack but ok
@ -522,8 +519,8 @@ def init_wsgi(app):
# if we don't pass arguments, assume production environment (gunicorn)
if len(sys.argv) == 1:
init_wsgi()
if "gunicorn" in sys.argv[0]:
init_wsgi(app)
if __name__ == "__main__":

View File

@ -4,4 +4,5 @@ pip3 install -e /project/src/pkg/cjvt-corpusparser/.
pip3 install -e /project/src/pkg/valency/.
pip3 install -e /project/src/pkg/seqparser/.
sleep 10000
cd /project/src/backend_flask
gunicorn -t 2 -b 127.0.0.1:8084 app:app

View File

@ -4,4 +4,4 @@ cp ./config/config_prod.json ./config/config.json
npm install
npm run build
# http-server /src/dist
http-server /src/dist

View File

@ -3492,8 +3492,7 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"aproba": {
"version": "1.2.0",
@ -3514,14 +3513,12 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@ -3536,20 +3533,17 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"core-util-is": {
"version": "1.0.2",
@ -3666,8 +3660,7 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"ini": {
"version": "1.3.5",
@ -3679,7 +3672,6 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@ -3694,7 +3686,6 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
@ -3702,14 +3693,12 @@
"minimist": {
"version": "0.0.8",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"minipass": {
"version": "2.3.5",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
@ -3728,7 +3717,6 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
@ -3809,8 +3797,7 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"object-assign": {
"version": "4.1.1",
@ -3822,7 +3809,6 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"wrappy": "1"
}
@ -3908,8 +3894,7 @@
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"safer-buffer": {
"version": "2.1.2",
@ -3945,7 +3930,6 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@ -3965,7 +3949,6 @@
"version": "3.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@ -4009,14 +3992,12 @@
"wrappy": {
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"yallist": {
"version": "3.0.3",
"bundled": true,
"dev": true,
"optional": true
"dev": true
}
}
},

View File

@ -1,6 +1,6 @@
<template>
<nav>
<b-navbar toggleable="md" type="light" variant="light">
<b-navbar id="nav-red-bg" toggleable="md" type="light" variant="light">
<b-navbar-toggle target="nav_collapse"></b-navbar-toggle>
<!--b-navbar-brand>Vezljivostni vzorci slovenskih glagolov</b-navbar-brand-->
<b-navbar-brand class=cursorpointer v-on:click="goHome">
@ -112,7 +112,7 @@ export default {
</script>
<style>
.bg-light {
#nav-red-bg {
background-color: rgb(183,21,17,0.9) !important;
}
nav a {