![](/img/trans.png)
[英]Datajoint scientific pipeline: how to efficiently store data and design pipeline when attributes can change and data come from arrays
[英]Datajoint LabBook - how to change ports
I am running Datajoint LabBook through the provided docker container ( https://datajoint.github.io/datajoint-labbook/user.html#installation ) and wondered whether there is a way to move it away from the (default?) port ( 80?)。 我不確定我是否理解.yaml(docker-compose-deploy.yaml)中的說明,在我看來,有一個pharus端點(5000)然后有兩個端口定義(443:443、80:80 ) 再向下。 我不確定那些指的是什么。
是的,您可以將 DataJoint LabBook 服務移動到不同的端口,但是,需要對其進行一些更改才能正確地更改為 function。
假設您在本地訪問 DataJoint LabBook,請執行以下步驟:
127.0.0.1 fakeservices.datajoint.io
添加到您的hosts
文件中。 驗證文件系統中的hosts
文件位置。docker-compose-deploy.yaml
中的ports
配置為:ports:
- "3000:443" # replace 3000 with the port of your choosing
#- "80:80" # disables HTTP -> HTTPS redirect
https://fakeservices.datajoint.io:3000
讓我先談談架構,然后描述一下我們 go 的相關變化。
以下是文檔中提供的Docker Compose 文件。 我會假設您正在嘗試在本地運行它。
# PHARUS_VERSION=0.1.0 DJLABBOOK_VERSION=0.1.0 docker-compose -f docker-compose-deploy.yaml pull
# PHARUS_VERSION=0.1.0 DJLABBOOK_VERSION=0.1.0 docker-compose -f docker-compose-deploy.yaml up -d
#
# Intended for production deployment.
# Note: You must run both commands above for minimal outage.
# Make sure to add an entry into your /etc/hosts file as `127.0.0.1 fakeservices.datajoint.io`
# This serves as an alias for the domain to resolve locally.
# With this config and the configuration below in NGINX, you should be able to verify it is
# running properly by navigating in your browser to `https://fakeservices.datajoint.io`.
# If you don't update your hosts file, you will still have access at `https://localhost`
# however it should simply display 'Not secure' since the cert will be invalid.
version: "2.4"
x-net: &net
networks:
- main
services:
pharus:
<<: *net
image: datajoint/pharus:${PHARUS_VERSION}
environment:
- PHARUS_PORT=5000
fakeservices.datajoint.io:
<<: *net
image: datajoint/nginx:v0.0.16
environment:
- ADD_zlabbook_TYPE=STATIC
- ADD_zlabbook_PREFIX=/
- ADD_pharus_TYPE=REST
- ADD_pharus_ENDPOINT=pharus:5000
- ADD_pharus_PREFIX=/api
- HTTPS_PASSTHRU=TRUE
entrypoint: sh
command:
- -c
- |
rm -R /usr/share/nginx/html
curl -L $$(echo "https://github.com/datajoint/datajoint-labbook/releases/download/\
${DJLABBOOK_VERSION}/static-djlabbook-${DJLABBOOK_VERSION}.zip" | tr -d '\n' | \
tr -d '\t') -o static.zip
unzip static.zip -d /usr/share/nginx
mv /usr/share/nginx/build /usr/share/nginx/html
rm static.zip
/entrypoint.sh
ports:
- "443:443"
- "80:80"
depends_on:
pharus:
condition: service_healthy
networks:
main:
首先,上面 header 評論中的Note
很重要,似乎在 DataJoint LabBook 文檔中被遺漏了(我已提交此問題以更新它)。 確保遵循注釋中的Note
,因為需要從 pharus進行“安全”訪問(更多內容見下文)。
從 Docker Compose 文件中,您會注意到 2 個服務:
pharus
-DataJoint REST API 后端服務。 該服務被配置為偵聽端口5000
,但是,它實際上並未暴露給主機。 這意味着它不會發生沖突並且不需要任何更改,因為它完全包含在本地虛擬 docker 網絡中。
fakeservices.datajoint.io
- 向主機公開的代理服務,因此可以本地和公開訪問主機。 其主要目的是:
a) 將以/api
開頭的請求轉發到pharus
,或
b) 解決對 DataJoint LabBook GUI 的其他請求。
DataJoint LabBook 的 GUI 是一個 static web 應用程序,這意味着它可以用作不安全(HTTP,通常是端口80
)和安全(HTTPS,通常是端口443
)。 由於pharus
的安全要求,對端口80
的請求被簡單地重定向到443
並為了方便而暴露。 因此,如果我們想將 DataJoint LabBook 移動到新端口,我們只需將443
映射更改為主機上的新端口並禁用80 -> 443
重定向。 因此,端口更新將如下所示:
ports:
- "3000:443" # replace 3000 with the port of your choosing
#- "80:80" # disables HTTP -> HTTPS redirect
最后,在配置和啟動服務之后,您應該能夠通過在 Google Chrome 瀏覽器中導航到https://fakerservices.datajoint.io:3000
來確認端口更改。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.