-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swagger not working (cors) in demo deploy #3278
Comments
Best way would be to use a HTTP router like traefik or nginx to route all services through the same domain and port. Alternatively, you would need to add CORS header, for which an HTTP router would still be the best approach. |
Yes, I know how to fix this on my own, but would it not be good idea if the Swagger container worked out-of-the-box? Right now the instructions at https://github.com/keeps/roda/blob/master/deploys/standalone/README.md are not correct.
|
Changing title of issue to reflect that the request is actually to incorporate these changes in the demo/example deployment available on the github project. |
I played around with this and it seems to work ---
services:
zoo:
image: docker.io/zookeeper:3.9.2-jre-17
restart: unless-stopped
environment:
- ZOO_4LW_COMMANDS_WHITELIST=mntr,conf,ruok
volumes:
- zookeeper_data:/data
- zookeeper_datalog:/datalog
solr:
image: docker.io/solr:9.5.0
restart: unless-stopped
ports:
- "8983:8983"
environment:
SOLR_HEAP: 2g
ZK_HOST: zoo:2181
command: -c
volumes:
- solr_data:/var/solr
clamd:
image: docker.io/clamav/clamav:1.2.2
restart: unless-stopped
volumes:
- clam_data:/var/lib/clamav
- roda_data:/roda/data/
siegfried:
image: ghcr.io/keeps/siegfried:v1.11.0
restart: unless-stopped
environment:
SIEGFRIED_HOST: 0.0.0.0
SIEGFRIED_PORT: 5138
volumes:
- siegfried_data:/root/siegfried/
- roda_data:/roda/data/
swagger:
image: docker.io/swaggerapi/swagger-ui:v5.13.0
restart: on-failure
ports:
- "8081:8080"
environment:
- URL=http://localhost:8082/api/openapi.json
- DOC_EXPANSION=none
- VALIDATOR_URL=none
roda:
image: ghcr.io/keeps/roda:latest
restart: unless-stopped
ports:
- "8080:8080"
depends_on:
- solr
- clamd
- siegfried
volumes:
- roda_data:/roda/data/
environment:
# Solr Cloud configuration
- RODA_CORE_SOLR_TYPE=CLOUD
- RODA_CORE_SOLR_CLOUD_URLS=zoo:2181
- SOLR_NUM_SHARDS=4
- SOLR_REPLICATION_FACTOR=1
# Base plugin services configuration
- SIEGFRIED_SERVER_URL=http://siegfried:5138
- CLAMD_TCPADDR=clamd
- CLAMD_TCPSOCKET=3310
nginx:
image: nginx:stable-alpine
ports:
- "8082:80"
configs:
- source: nginx.conf
target: /etc/nginx/nginx.conf
volumes:
zookeeper_data:
zookeeper_datalog:
solr_data:
clam_data:
siegfried_data:
roda_data:
configs:
nginx.conf:
content: |
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$$remote_addr - $$remote_user [$$time_local] "$$request" '
'$$status $$body_bytes_sent "$$http_referer" '
'"$$http_user_agent" "$$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
proxy_set_header Host $$host;
add_header Access-Control-Allow-Origin *;
proxy_set_header X-Real-IP $$remote_addr;
proxy_pass http://roda:8080;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}
|
Hi,
The swagger container can not access the openapi.json-file due to cors
I'm using the standard
docker-compose.yaml
anddocker compose up
Error message from Swagger:
Request with curl:
docker-compose.yaml
All containers seem to be working:
The text was updated successfully, but these errors were encountered: