# Setup Sbert\_eduplex

## Setup Sbert\_eduplex

### Directory structure:

* The file called `server.py` is the main file to run the application
* `.env` should be used to write down the initial parameters of the application. Logs should be automatically created.
* `requirements.txt` contains the requirements

### How to develop sbert with docker

* Run `docker-compose-socket-sbert.yml` (change the image version to force a rebuild)
* This will make the service available in [localhost:5000](http://localhost:5000/sbert_en/query=Examine%20images%20taken%20by%20telescopes%20in%20order%20to%20study%20phenomena%20and%20objects%20outside%20Earth%20atmosphere) without SSL

#### How to build sbert service for production

* Change the image version in `docker-compose-sbert.yml` (optionally use dockerfile `docker/child/Dockerfile` for a quick build without updating pip dependencies or `docker/Dockerfile` for a slower build from empty image)
* Run **docker-compose up** will create a new version tagged image
* Login to AWS ECR `aws ecr-public get-login-password --region us-east-1 --profile prdedupl | docker login --username AWS --password-stdin public.ecr.aws/eduplex_api` (change `prdedupl` with the name of your aws cli or `default` if you do not have many profiles)
* Push the image `docker push <image_tag>` (image\_tag from yml file)

## technical notes

* in pycharm there may be problems with dockers permissions, after locally installing Dockers and pycharm plugin, the following may be needed:

```
sudo chmod a+rwx /var/run/docker.sock
sudo chmod a+rwx /var/run/docker.pid
```
