|
| 1 | +# Installation |
| 2 | +MedCATtrainer is a docker-compose packaged Django application. |
| 3 | + |
| 4 | +## Download from Dockerhub |
| 5 | +Clone the repo, run the default docker-compose file and default env var: |
| 6 | +```shell |
| 7 | +$ git clone https://github.com/CogStack/cogstack-nlp |
| 8 | +$ cd cogstack-nlp/medcat-trainer |
| 9 | +$ docker-compose up |
| 10 | +``` |
| 11 | + |
| 12 | +This will use the pre-built docker images available on DockerHub. If your internal firewall does on permit access to DockerHub, you can build directly from source. |
| 13 | + |
| 14 | +To check logs of the MedCATtrainer running containers |
| 15 | +```bash |
| 16 | +$ docker logs <containerid> | grep "\[medcattrainer\]" |
| 17 | +$ docker logs <containerid> | grep "\[bg-process\]" |
| 18 | +$ docker logs <containerid> | grep "\[db-backup\]" |
| 19 | +``` |
| 20 | + |
| 21 | +## MedCAT v0.x models |
| 22 | +If you have MedCAT v0.x models, and want to use the trainer please use the following docker-compose file: |
| 23 | +This refences the latest built image for the trainer that is still compatible with [MedCAT v0.x.](https://pypi.org/project/medcat/0.4.0.6/) and under. |
| 24 | +```shell |
| 25 | +$ docker-compose -f docker-compose-mc0x.yml up |
| 26 | +``` |
| 27 | + |
| 28 | +## Build images from source |
| 29 | +The above commands runs the latest release of MedCATtrainer, if you'd prefer to build the Docker images from source, use |
| 30 | +```shell |
| 31 | +$ docker-compose -f docker-compose-dev.yml up |
| 32 | +``` |
| 33 | + |
| 34 | +To change environment variables, such as the exposed host ports and language of spaCy model, use: |
| 35 | +```shell |
| 36 | +$ cp .env-example .env |
| 37 | +# Set local configuration in .env |
| 38 | +``` |
| 39 | + |
| 40 | +## Troubleshooting |
| 41 | +If the build fails with an error code 137, the virtual machine running the docker |
| 42 | +daemon does not have enough memory. Increase the allocated memory to containers in the docker daemon |
| 43 | +settings CLI or associated docker GUI. |
| 44 | + |
| 45 | +On MAC: https://docs.docker.com/docker-for-mac/#memory |
| 46 | + |
| 47 | +On Windows: https://docs.docker.com/docker-for-windows/#resources |
| 48 | + |
| 49 | +### (Optional) SMTP Setup |
| 50 | + |
| 51 | +For password resets and other emailing services email environment variables are required to be set up. |
| 52 | + |
| 53 | +Personal email accounts can be set up by users to do this, or you can contact someone in CogStack for a cogstack no email credentials. |
| 54 | + |
| 55 | +The environment variables required are listed in [Environment Variables.](#(optional)-environment-variables) |
| 56 | + |
| 57 | +Environment Variables are located in envs/env or envs/env-prod, when those are set webapp/frontend/.env must change "VITE_APP_EMAIL" to 1. |
| 58 | + |
| 59 | +### (Optional) Environment Variables |
| 60 | +Environment variables are used to configure the app: |
| 61 | + |
| 62 | +|Parameter|Description| |
| 63 | +|---------|-----------| |
| 64 | +|MEDCAT_CONFIG_FILE|MedCAT config file as described [here](https://github.com/CogStack/cogstack-nlp/blob/main/medcat-v2/medcat/config/config.py)| |
| 65 | +|BEHIND_RP| If you're running MedCATtrainer, use 1, otherwise this defaults to 0 i.e. False| |
| 66 | +|MCTRAINER_PORT|The port to run the trainer app on| |
| 67 | +|EMAIL_USER|Email address which will be used to send users emails regarding password resets| |
| 68 | +|EMAIL_PASS|The password or authentication key which will be used with the email address| |
| 69 | +|EMAIL_HOST|The hostname of the SMTP server which will be used to send email (default: mail.cogstack.org)| |
| 70 | +|EMAIL_PORT|The port that the SMTP server is listening to, common numbers are 25, 465, 587 (default: 465)| |
| 71 | + |
| 72 | +Set these and re-run the docker-compose file. |
| 73 | + |
| 74 | +You'll need to `docker stop` the running containers if you have already run the install. |
0 commit comments