Skip to content

Commit 71b5337

Browse files
authored
fix(deploy): htsget networking (#102)
* fix(deploy): bypass proxy when using htsget with compose minio * refactor(nginx): use recommended header opts for minio * docs(deploy): note on aliasing minio host * docs: release instructions * docs(deploy): typos * fix(deploy): forward s3 host header through nginx * docs(deploy): alt opt for htsget x minio networking * docs(deploy): section on htsget-minio addressing * docs(deploy): s3 bucket style in example .env * refactor(compose): scheme always inside URL env vars
1 parent d67a40a commit 71b5337

File tree

5 files changed

+44
-10
lines changed

5 files changed

+44
-10
lines changed

deploy/.example.env

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ MINIO_SERVER_ACCESS_KEY="user"
55
MINIO_SERVER_SECRET_KEY="pass"
66
S3_BUCKET=modos-demo
77
MINIO_DEFAULT_BUCKET="${S3_BUCKET}:public"
8+
# defines s3 url format (host/bucket vs bucket.host)
9+
S3_ADDRESSING_STYLE="auto" # one of auto, path, virtual
810

911
# HTSGET
1012
HTSGET_DATA_DIR="/data"
1113

1214
# PUBLIC
13-
#URL_PREFIX="https://modos.example.com"
14-
URL_PREFIX="http://localhost"
15-
S3_PUBLIC_URL="${URL_PREFIX}/s3"
16-
HTSGET_PUBLIC_URL="${URL_PREFIX}/htsget"
15+
# URL_PREFIX="https://modos.example.org"
16+
# S3_PUBLIC_URL="${URL_PREFIX}/s3"
17+
# HTSGET_PUBLIC_URL="${URL_PREFIX}/htsget"

deploy/README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The modos-server is meant to provide remote access to the MODOs. Currently, it c
1212
- [x] list available MODO
1313
- [x] return their metadata
1414
- [x] expose a MODO directly as a client-accessible S3 bucket / folder
15-
- [ ] stream CRAM slices CRAM using htsget
15+
- [x] stream CRAM slices using htsget
1616
- [ ] manage authentication and access control
1717

1818
The MODOs are stored in an s3 (minio) bucket, and an htsget server is deployed alongside the modos-server to handle slicing and streaming of CRAM files. A REST API is exposed to the client to interact with the remote MODOs.
@@ -79,3 +79,17 @@ mv .example.env .env
7979
docker compose up --build
8080
# docker compose automatically reads the .env file
8181
```
82+
83+
### Streaming with minio
84+
85+
There are two options to use htsget streaming with the minio embedded in the compose setup:
86+
87+
1. Either manually create a host mapping from the minio service to localhost:
88+
> `echo "127.0.0.1 minio" >> /etc/hosts`
89+
90+
2. Or set `S3_PUBLIC_URL=http://<LOCAL-IP>:9000` where `<LOCAL-IP>` is your local IP address (find it using hostname -I).
91+
92+
These steps are not needed when using an external S3 server, in which case `S3_PUBLIC_URL` can just be set to the external S3 endpoint.
93+
94+
> [!NOTE]
95+
> These steps are needed because the S3 host must be available under the same name to both the client and htsget. This is because the canonical URI (incl. hostname) is used to [derive s3 signature keys](https://docs.aws.amazon.com/IAM/latest/UserGuide/create-signed-request.html).

deploy/docker-compose.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ services:
1515
volumes:
1616
- ./nginx/default.conf.template:/etc/nginx/templates/default.conf.template:ro
1717
environment:
18-
- S3_PUBLIC_URL=${S3_PUBLIC_URL:-http://localhost/s3}
18+
- S3_PUBLIC_URL=${S3_PUBLIC_URL:-http://localhost/s3/}
1919
- S3_LOCAL_URL=${S3_lOCAL_URL:-http://minio:9000}
2020
- HTSGET_PUBLIC_URL=${HTSGET_PUBLIC_URL:-http://localhost/htsget}
2121
- HTSGET_LOCAL_URL=${HTSGET_LOCAL_URL:-http://htsget:8080}
@@ -27,9 +27,8 @@ services:
2727

2828
minio:
2929
image: docker.io/bitnami/minio:2024
30-
expose:
31-
- "9000" # api
3230
ports:
31+
- "9000:9000" # api
3332
- "9001:9001" # console
3433
volumes:
3534
- minio-data:/bitnami/minio/data
@@ -56,7 +55,7 @@ services:
5655
networks:
5756
- modos-network
5857
environment:
59-
- ENDPOINT=${S3_LOCAL_URL:-http://localhost/s3}
58+
- ENDPOINT=${S3_PUBLIC_URL:-http://minio:9000}
6059
- BUCKET=${S3_BUCKET:-modos-demo}
6160
- S3_ADDRESSING_STYLE=${S3_ADDRESSING_STYLE:-auto}
6261
- AWS_ACCESS_KEY_ID=${MINIO_ROOT_USER:-minio}

deploy/nginx/default.conf.template

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
server {
44
listen 80 ;
5-
client_max_body_size 0 ;
5+
ignore_invalid_headers off;
6+
client_max_body_size 0;
7+
proxy_buffering off;
8+
proxy_request_buffering off;
69

710
# Inform client about public URLs
811
location = / {
@@ -18,6 +21,16 @@ server {
1821
location /s3 {
1922
rewrite ^/s3/(.*) /$1 break ;
2023
proxy_pass ${S3_LOCAL_URL} ;
24+
# More details on minio x nginx options at:
25+
# https://min.io/docs/minio/linux/integrations/setup-nginx-proxy-with-minio.html
26+
proxy_set_header Host $http_host;
27+
proxy_pass_request_headers off;
28+
proxy_connect_timeout 300;
29+
# Default is HTTP/1, keepalive is only enabled in HTTP/1.1
30+
proxy_http_version 1.1;
31+
proxy_set_header Connection "";
32+
chunked_transfer_encoding off;
33+
2134
}
2235
# Genomic file streaming with htsget
2336
location /htsget {

docs/development_guide.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,10 @@ you can enter a development shell with all requirements installed by doing:
1919
```shell
2020
nix develop ./nix#default
2121
```
22+
23+
## Making a release
24+
25+
Releases are deployed to pypi.org through github actions.
26+
To create a new release, create a PR named "chore: bump to X.Y.Z" where X.Y.Z is the new version. In the PR upgrade versions in the repo (sphinx config and pyproject.toml).
27+
28+
Once the PR is merged, a release can be created through the github UI on the merge commit. This will trigger corresponding release builds on PyPI and ghcr.io.

0 commit comments

Comments
 (0)