Closed tgaudin closed 4 years ago
would this help you? http://lifescience.opensource.epam.com/indigo/service/index.html
@michal-husak a full tutorial to actually deploy the indigo service on a remote server would be appreciated.
On my side I need the full features of ketcher. I know docker and can't get my way to deploy the backend with the link you posted.
@AlexanderSavelyev any ways we can have more details on how to set the indigo service up?
Sorry for the generic ping, I need to set this up quickly.
@MichelML
Easiest way is run the following command (no need to download images)
docker run --restart=always -d -p 8002:8002 -e "INDIGO_UWSGI_RUN_PARAMETERS=--plugin python3 --py-autoreload=1"
-e "PYTHONPATH=/srv/indigo-python" -e "PYTHONDONTWRITEBYTECODE=1" --name=indigo_service
epmlsop/indigo_service:latest /bin/sh -c "supervisord -n"
and then configure nginx uwsgi according to https://lifescience.opensource.epam.com/indigo/service/index.html
if you have different web server (e.g. apache), please use the following instructions to setup the uwsgi
@AlexanderSavelyev I'm supposed to setup nginx seperately? e.g. have another docker container running for it or set it up on my remote instance? This is the part that's not clear. I see nginx no where in the docker image epmlsop/indigo_service
when I bash inside it.
an nginx image like the one you have here maybe https://github.com/epam/Indigo/tree/15605c48e9f0a8143b9c3aac87fc8d2637f36216/utils/indigo-service/nginx .
yes, nginx should be run separately. The reason for the environment with separate web server is that ketcher static files and indigo-service should be hosted on the same server and port. Otherwise REST API will not work because of CORS
One can install nginx as a docker image or separate installation. There many instructions with many examples for different OS
Could you please inform, where do you plan to host the ketcher and what web server to use? Because if you create an nginx server (e.g. port 8080) and ketcher (e.g. on port 443) you still will need to port forward to your server, so please take a look at uwsgi possibilities for your web server
Thanks @AlexanderSavelyev , I am aware of CORS, but as for ketcher static files and indigo-service should be hosted on the same server and port
- I don't think you have any checks built-in for that as far as I know.
That being said, I finally succeeded in installing and deploying the service with your instructions.
Suggestion for improvement regarding indigo service doc starting from the image from docker hub that will work out of the box:
place this docker-compose.yml file at the root of your repository:
version: '3'
services:
nginx:
image: nginx:1.17.10-alpine
ports:
- 8080:80
volumes:
- ./docker/nginx/conf.d:/etc/nginx/conf.d:ro
links:
- indigo_service
depends_on:
- indigo_service
indigo_service:
image: epmlsop/indigo_service
environment:
- PYTHONPATH=${INDIGO_SERVICE_PYTHONPATH:-/srv/indigo-python}
- INDIGO_UWSGI_RUN_PARAMETERS=--plugin python3 --py-autoreload=1
- PYTHONDONTWRITEBYTECODE=1
ports:
- 8002:8002
command: supervisord -n
and add this file under docker/nginx/conf.d/defaut.conf
server {
listen 80;
keepalive_timeout 5;
# The following configuration are related to the indigo service
# see here https://lifescience.opensource.epam.com/indigo/service/index.html
location / {
root /srv/www;
index index.html;
try_files $uri $uri/ @indigoservice;
}
location @indigoservice {
# Should be set 'always' to transfer our lovely HTTP500 errors
# see: https://epa.ms/d6u2d
# Headers could be also set by Flasgger in service/config.py
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'POST, GET, PUT, DELETE, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Accept, Content-Type' always;
add_header 'Access-Control-Max-Age' '86400' always;
include uwsgi_params;
uwsgi_pass indigo_service:8002;
}
}
then you can run docker-compose up
and you can check your service work by browsing to localhost:8080/v2/indigo/info
I deployed this on AWS Beanstalk and it works like a charm.
Yes, this might be one of possible installations, but usually nginx is used as a standalone server (which hosts not only Ketcher and indigo service) and it is better to use system network for it (not from docker). But thanks for providing docker compose config. This solution might work for some simple scenarios. I will include it into the repo as an example.
Thanks @AlexanderSavelyev and I understand your point - and agree with you 👍 . I guess once you added the example you could close this. Besides my comments it has been inactive for a while now.
Iam currently running an apache (outside of Docker) which deploys ketcher and the rest of my application. is it possible to use my already existing apache to access the container ?
Hi @jaohbib
I haven't test it but according to this document it can be possible to use apache with mod_proxy_uwsgi
It seems that after creating a docker instance on localhost:8002 the apache config can just include
ProxyPass / uwsgi://127.0.0.1:8002/
or include some other path (and change api-path in Ketcher). Please inform if it helps
Thanks Aleksandr
Currently I'm using ketcher on my own backend as I use it mainly as an input source.
It would be really nice to know what indigo service's quieries and answers look like to be able to integrate it correctly in my application.
Do you have any documentation on that?