├── .env ├── .env.mysql ├── docker-compose.mysql.yml ├── conf ├── nginx.conf ├── nginx.ws.conf ├── config.default.xml └── config.mysql.xml ├── docker-compose.ws.yml ├── README.md └── docker-compose.yml /.env: -------------------------------------------------------------------------------- 1 | COMPOSE_PROJECT_NAME=kontext 2 | STATUS_SERVICE_URL=ws://localhost:8080/ws/ 3 | KONTEXT_CONFIG=./conf/config.default.xml -------------------------------------------------------------------------------- /.env.mysql: -------------------------------------------------------------------------------- 1 | COMPOSE_PROJECT_NAME=kontext 2 | STATUS_SERVICE_URL=ws://localhost:8080/ws/ 3 | KONTEXT_CONFIG=./conf/config.mysql.xml 4 | 5 | MYSQL_ROOT_PASSWORD=root-secret 6 | MYSQL_USER=kontext 7 | MYSQL_PASSWORD=kontext-secret -------------------------------------------------------------------------------- /docker-compose.mysql.yml: -------------------------------------------------------------------------------- 1 | version: '3.7' 2 | 3 | services: 4 | mariadb: 5 | image: czcorpus/kontext-mariadb 6 | environment: 7 | - MYSQL_PASSWORD 8 | - MYSQL_USER 9 | - MYSQL_ROOT_PASSWORD 10 | volumes: 11 | - mdbdata:/var/lib/mysql 12 | ports: 13 | - "3306:3306" 14 | networks: 15 | - databases 16 | 17 | volumes: 18 | mdbdata: {} 19 | 20 | networks: 21 | databases: {} -------------------------------------------------------------------------------- /conf/nginx.conf: -------------------------------------------------------------------------------- 1 | upstream app_server { 2 | server kontext_kontext_1:8080 fail_timeout=0; 3 | } 4 | 5 | server { 6 | listen 80; 7 | 8 | location /files/ { 9 | alias /opt/kontext/public/files/; 10 | } 11 | 12 | location / { 13 | proxy_set_header Host $http_host; 14 | proxy_redirect off; 15 | proxy_pass http://app_server/; 16 | proxy_read_timeout 120; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /docker-compose.ws.yml: -------------------------------------------------------------------------------- 1 | version: "3.7" 2 | 3 | services: 4 | kontext: 5 | environment: 6 | - STATUS_SERVICE_URL=${STATUS_SERVICE_URL} 7 | 8 | ws: 9 | image: czcorpus/kontext-ws 10 | volumes: 11 | - ${KONTEXT_CONFIG}:/opt/kontext/conf/config.xml 12 | - corpora-data:/var/lib/manatee 13 | - corpora-cache:/var/local/copora 14 | networks: 15 | - databases 16 | - kontext 17 | depends_on: 18 | - redis 19 | - kontext 20 | 21 | nginx: 22 | volumes: 23 | - ./conf/nginx.ws.conf:/etc/nginx/conf.d/default.conf 24 | depends_on: 25 | - ws 26 | 27 | volumes: 28 | corpora-data: {} 29 | corpora-cache: {} 30 | 31 | networks: 32 | databases: {} 33 | kontext: {} -------------------------------------------------------------------------------- /conf/nginx.ws.conf: -------------------------------------------------------------------------------- 1 | upstream app_server { 2 | server kontext_kontext_1:8080 fail_timeout=0; 3 | } 4 | 5 | upstream ws_server { 6 | server kontext_ws_1:8080 fail_timeout=0; 7 | } 8 | 9 | server { 10 | listen 80; 11 | 12 | location /files/ { 13 | alias /opt/kontext/public/files/; 14 | } 15 | 16 | location / { 17 | proxy_set_header Host $http_host; 18 | proxy_redirect off; 19 | proxy_pass http://app_server/; 20 | proxy_read_timeout 120; 21 | } 22 | 23 | location /ws/ { 24 | proxy_pass http://ws_server/; 25 | proxy_http_version 1.1; 26 | proxy_set_header Host $http_host; 27 | proxy_set_header Upgrade $http_upgrade; 28 | proxy_set_header Connection "Upgrade"; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # kontext-docker 2 | A minimal, production-ready KonText installer for Docker 3 | 4 | ## Usage 5 | To run basic kontext configuration use 6 | ``` 7 | $ docker-compose up 8 | ``` 9 | 10 | You can add services `mysql` and `ws` to basic configuration like this 11 | ``` 12 | $ docker-compose -f docker-compose.yml -f docker-compose.ws.yml up 13 | $ docker-compose -f docker-compose.yml -f docker-compose.mysql.yml --env-file .env.mysql up 14 | ``` 15 | or both 16 | ``` 17 | $ docker-compose -f docker-compose.yml -f docker-compose.ws.yml -f docker-compose.mysql.yml --env-file .env.mysql up 18 | ``` 19 | Note that `mysql` service requires additional configuration defined in `.env.mysql` file. 20 | 21 | ## Settings 22 | 23 | You can specify settings using environmental variables 24 | 25 | ### Basic 26 | - `KONTEXT_CONFIG` - path to kontext config file (default: `./conf/config.default.xml` or `./conf/config.mysql.xml`) 27 | 28 | ### Websocket service 29 | - `STATUS_SERVICE_URL` - specifies url to websocket service (default - for local use: `ws://localhost:8080/ws/`) 30 | 31 | ### MySQL service 32 | - `MYSQL_ROOT_PASSWORD` - mysql root password (default: `root-secret`) 33 | - `MYSQL_USER` - mysql user name (default: `kontext`) 34 | - `MYSQL_PASSWORD` - mysql user password (default: `kontext-secret`) -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3.7" 2 | 3 | services: 4 | kontext: 5 | image: czcorpus/kontext 6 | # since we are using shared volume with nginx 7 | # in case different version of kontext is used 8 | # we need to copy files into the shared volume first 9 | command: bash -c "cp -r /opt/kontext/public/files/* /opt/kontext/public/share && gunicorn -c ./scripts/install/conf/docker/gunicorn-conf.py public.app:application" 10 | environment: 11 | - STATUS_SERVICE_URL= 12 | volumes: 13 | - ${KONTEXT_CONFIG}:/opt/kontext/conf/config.xml 14 | - files:/opt/kontext/public/share 15 | - corpora-data:/var/lib/manatee 16 | - corpora-cache:/var/local/corpora 17 | networks: 18 | - databases 19 | - kontext 20 | depends_on: 21 | - redis 22 | 23 | rq-scheduler: 24 | image: czcorpus/kontext-rqscheduler 25 | command: rqscheduler --host kontext_redis_1 --db 2 -i 10 26 | networks: 27 | - databases 28 | depends_on: 29 | - redis 30 | 31 | rq-worker: 32 | image: czcorpus/kontext-rqworker 33 | volumes: 34 | - ${KONTEXT_CONFIG}:/opt/kontext/conf/config.xml 35 | - corpora-data:/var/lib/manatee 36 | - corpora-cache:/var/local/corpora 37 | networks: 38 | - databases 39 | depends_on: 40 | - redis 41 | - kontext 42 | 43 | redis: 44 | image: redis:latest 45 | networks: 46 | - databases 47 | ports: 48 | - "16379:6379" 49 | volumes: 50 | - redisdata:/data 51 | 52 | nginx: 53 | image: nginx:latest 54 | ports: 55 | - "8080:80" 56 | volumes: 57 | - ./conf/nginx.conf:/etc/nginx/conf.d/default.conf 58 | - files:/opt/kontext/public/files 59 | networks: 60 | - kontext 61 | depends_on: 62 | - kontext 63 | 64 | volumes: 65 | files: {} 66 | corpora-data: {} 67 | corpora-cache: {} 68 | redisdata: {} 69 | 70 | networks: 71 | databases: {} 72 | kontext: {} -------------------------------------------------------------------------------- /conf/config.default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | default 4 | 5 | kontext-logo.svg 6 | kontext-logo_s.svg 7 | http://localhost:5000 8 | width: 200px 9 | 10 | favicon.ico 11 | 12 | 13 | 20151031_v4 14 | 15 | 16 | 002 17 | false 18 | false 19 | 20 | 30 21 | 22 | 26 | cs-CZ 27 | en-US 28 | szl 29 | 30 | /tmp/kontext-upload 31 | /var/local/corpora/user_filter_files 32 | 99 33 | 34 | /files 35 | 0 36 | 0 37 | 38 | freqs 39 | 40 | 41 | 42 | rq 43 | 300 44 | kontext_redis_1 45 | 6379 46 | 2 47 | /var/log/rq/worker.log 48 | 49 | 50 | 51 | rq 52 | /opt/kontext/conf/rq-schedule-conf.json 53 | 54 | 55 | 56 | 57 | 58 | 59 | /var/lib/manatee/registry 60 | cs_CZ 61 | /var/local/corpora/subcorp 62 | /var/local/corpora/freqs-precalc 63 | /var/local/corpora/freqs-cache 64 | 3600 65 | 100 66 | /var/local/corpora/colls-cache 67 | 3600 68 | 50 69 | /var/local/corpora/conc 70 | 71 | susanne 72 | 73 | 74 | 75 | -- 76 | 10 77 | + 78 | 79 | ± 80 | 81 | 82 | 83 | 84 | 85 | default_auth 86 | defaultAuth 87 | 0 88 | kontext_session 89 | /user/login?continue=%s 90 | /user/logout?continue=%s 91 | 3600 92 | 93 | 94 | default_action_log 95 | 96 | 97 | default_conc_cache 98 | /var/local/corpora/cache 99 | 100 | 101 | default_query_persistence 102 | 100 103 | /var/local/corpora/query_persistence 104 | true 105 | 106 | 107 | default_corparch 108 | defaultCorparch 109 | /opt/kontext/conf/corplist.xml 110 | /corplist 111 | + 112 | 10 113 | 30 114 | 115 | 116 | redis_db 117 | kontext_redis_1 118 | 6379 119 | 1 120 | 121 | 122 | default_integration_db 123 | 125 | 126 | 127 | default_csv 128 | default_xlsx 129 | 130 | 131 | default_xlsx 132 | 133 | 134 | default_footer_bar 135 | defaultFooterBar 136 | 137 | 138 | default_getlang 139 | kontext_toolbar_lang 140 | en-US 141 | 142 | 143 | 144 | default_menu_items 145 | /opt/kontext/conf/main-menu.sample.json 146 | 147 | 148 | default_audio_provider 149 | 150 | 151 | default_query_history 152 | 10 153 | 10 154 | 155 | 156 | 157 | default_settings_storage 158 | 159 | 1 160 | 3 161 | 162 | 163 | 164 | default_sessions 165 | 14400 166 | 167 | 168 | 169 | 170 | 171 | 172 | default_user_items 173 | 15 174 | 175 | 176 | default_chart_export 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | -------------------------------------------------------------------------------- /conf/config.mysql.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | default 4 | 5 | kontext-logo.svg 6 | kontext-logo_s.svg 7 | http://localhost:5000 8 | width: 200px 9 | 10 | favicon.ico 11 | image/x-icon 12 | 13 | 14 | 20151031_v4 15 | 16 | 17 | 002 18 | false 19 | false 20 | 21 | 30 22 | 23 | 27 | cs-CZ 28 | en-US 29 | szl 30 | 31 | /tmp/kontext-upload 32 | /var/local/corpora/user_filter_files 33 | 99 34 | 35 | /files 36 | 0 37 | 0 38 | 39 | freqs 40 | 41 | 42 | 43 | rq 44 | 300 45 | kontext_redis_1 46 | 6379 47 | 2 48 | /var/log/rq/worker.log 49 | 50 | 51 | 52 | rq 53 | /opt/kontext/conf/rq-schedule-conf.json 54 | 55 | 56 | 57 | 58 | 59 | /var/lib/manatee/registry 60 | cs_CZ 61 | /var/local/corpora/subcorp 62 | /var/local/corpora/freqs-precalc 63 | /var/local/corpora/freqs-cache 64 | 3600 65 | 100 66 | /var/local/corpora/colls-cache 67 | 3600 68 | 50 69 | /var/local/corpora/conc 70 | 71 | susanne 72 | 73 | 74 | 75 | -- 76 | 10 77 | + 78 | 79 | ± 80 | 81 | 82 | 83 | 84 | 85 | mysql_auth 86 | defaultAuth 87 | 1 88 | kontext_session 89 | /user/login 90 | /user/logoutx 91 | 0 92 | 93 | 94 | default_action_log 95 | 96 | 97 | default_conc_cache 98 | /var/local/corpora/cache 99 | 100 | 101 | mysql_query_persistence 102 | 100 103 | 7 104 | arch 105 | true 106 | 107 | 108 | mysql_corparch 109 | defaultCorparch 110 | 30 111 | + 112 | 10 113 | 5 114 | 115 | 116 | redis_db 117 | kontext_redis_1 118 | 6379 119 | 1 120 | 121 | 122 | mysql_integration_db 123 | kontext_mariadb_1 124 | kontext 125 | kontext 126 | kontext-secret 127 | 3 128 | 2 129 | 5 130 | 10 131 | 132 | 133 | default_csv 134 | default_xlsx 135 | 136 | 137 | default_xlsx 138 | 139 | 140 | default_footer_bar 141 | defaultFooterBar 142 | 143 | 144 | default_getlang 145 | kontext_toolbar_lang 146 | en-US 147 | 148 | 149 | 150 | default_menu_items 151 | /opt/kontext/conf/main-menu.sample.json 152 | 153 | 154 | default_audio_provider 155 | 156 | 157 | default_query_history 158 | 10 159 | 10 160 | 161 | 162 | 163 | default_settings_storage 164 | 165 | 1 166 | 3 167 | 168 | 169 | 170 | default_sessions 171 | 14400 172 | 173 | 174 | 175 | 176 | 177 | 178 | mysql_user_items 179 | 15 180 | 181 | 182 | default_chart_export 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | --------------------------------------------------------------------------------