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 FROM cjvt-python-env
RUN pip3 install gunicorn
RUN mkdir -p /project/src/backend_flask RUN mkdir -p /project/src/backend_flask
RUN mkdir -p /project/src/pkg RUN mkdir -p /project/src/pkg
RUN mkdir -p /project/data RUN mkdir -p /project/data

View File

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

View File

@ -20,6 +20,7 @@ RUN pip3 install \
flask \ flask \
flask_cors \ flask_cors \
pymongo \ pymongo \
flask-pymongo flask-pymongo \
gunicorn
ENV PYTHONIOENCODING UTF-8 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

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

View File

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

View File

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