Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
DATA_PATH=/Users/david/Documents/data/tomo/scratch
DATA_PATH=/path/to/your/zarr/data #directory of zarr datasets served by tiled
VITE_TILED_DEFAULT_FILE_ID=your-default-dataset-id #the first file that will be automatically loaded into the viewer app

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have any way of knowing this in deployment. Is it optional or required in your app?

VITE_API_TILED_URL=http://localhost:8000/api/v1 #optional custom url for tiled
# VITE_API_TILED_URL=https://tiled-staging.computing.als.lbl.gov/api/v1
#VITE_TILED_PORT=8001 #optionally specify the tiled port (not to be used with VITE_API_TILED_URL) (will assume same hostname as browser)
VITE_TILED_PROCESSED_PATH=beamlines/bl832/processed #parent catalog path whose subfolders populate the folder dropdown (defaults to beamlines/bl832/processed)
23 changes: 20 additions & 3 deletions custom_config.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
authentication:
allow_anonymous_access: false

single_user_api_key: ${TILED_SINGLE_USER_API_KEY}
uvicorn:
host: 0.0.0.0
port: 8000
allow_origins:
- http://localhost:5173
- http://localhost:5174
- http://localhost:8082
- http://localhost:8787
- https:///tiled-staging.computing.als.lbl.gov
- http://host.docker.internal:5173
- http://host.docker.internal:5174
- http://host.docker.internal:8082
- http://host.docker.internal:8787
trees:
- path: /
tree: catalog
args:
uri: "sqlite+aiosqlite:////storage/catalog.db"
writable_storage: "/storage/data"
uri: "sqlite:////storage/catalog.db"
writable_storage:
- "/storage/data"
- "sqlite:////storage/tabular.db"
readable_storage:
- "/storage/data"
init_if_not_exists: true
79 changes: 34 additions & 45 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,62 +5,51 @@ services:
nginx:
image: nginx:stable
ports:
- "8787:80"
- "5174:80"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- ./cors.conf:/etc/nginx/cors.conf:ro
depends_on:
- tiled
- viewer
# - tiled
- react
restart: unless-stopped
networks:
- webnet

tiled:
build:
context: ./tiled
dockerfile: Dockerfile
environment:
- DATA_DIR=/storage/data
- TILED_ALLOW_ORIGINS="http://localhost:8787 http://localhost:8082 http://localhost:5174 http://localhost:8000 http://host.docker.internal:8787 http://host.docker.internal:8082 http://host.docker.internal:5174"
- TILED_SINGLE_USER_API_KEY=${TILED_SINGLE_USER_API_KEY}
- TILED_CONFIG=/deploy/config/custom_config.yml # Point to our custom config
volumes:
- ${DATA_PATH:-./data}:/storage/data # Mount data directory
- ./custom_config.yml:/deploy/config/custom_config.yml # Mount custom config
expose:
- "8000"
networks:
- webnet
command: >
sh -c "
# 1) Launch the server in the background
exec tiled serve config --host 0.0.0.0 --port 8000 --scalable &
TILED_PID=\$!

# 2) Wait up to 30s for it to become healthy
sleep 30

# 3) Register your data once the server is accepting connections
tiled register http://localhost:8000/ /storage/data --api-key=${TILED_SINGLE_USER_API_KEY} --verbose

# 4) Hand control back to the server process so docker logs still show it
wait \$TILED_PID
"
restart: unless-stopped
# tiled:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be a fan of leaving tiled in...let's treat this docker-compose as "what a developer needs to just get running"...actual deployment in the real world will be very different.

# # build:
# # context: ./tiled
# # dockerfile: Dockerfile
# image: ghcr.io/bluesky/tiled:0.2.3
# environment:
# - DATA_DIR=/storage/data
# #- TILED_ALLOW_ORIGINS='["http://localhost:8787", "http://localhost:8082", "http://localhost:5174", "http://localhost:8000", "http://host.docker.internal:8787", "http://host.docker.internal:8082", "http://host.docker.internal:5174"]'
# - TILED_SINGLE_USER_API_KEY=${TILED_SINGLE_USER_API_KEY}
# - TILED_CONFIG=/deploy/config/custom_config.yml # Point to our custom config
# volumes:
# - ${DATA_PATH:-./data}:/storage/data # Mount data directory
# - ./custom_config.yml:/deploy/config/custom_config.yml # Mount custom config
# expose:
# - "8000"
# networks:
# - webnet
# # command: >
# # sh -c "
# # # 1) Launch the server in the background
# # exec tiled serve config --host 0.0.0.0 --port 8000 --scalable &
# # TILED_PID=\$!

# # # 2) Wait up to 30s for it to become healthy
# # sleep 30

viewer:
build:
context: ./viewer
dockerfile: Dockerfile
expose:
- "8082"
networks:
- webnet
restart: unless-stopped
# # # 3) Register your data once the server is accepting connections
# # tiled register http://localhost:8000/ /storage/data --api-key=${TILED_SINGLE_USER_API_KEY} --verbose

# # # 4) Hand control back to the server process so docker logs still show it
# # wait \$TILED_PID
# # "
# command: sleep infinity
# restart: unless-stopped

react:
build:
Expand All @@ -72,4 +61,4 @@ services:
- "5174"
restart: unless-stopped
networks:
- webnet
- webnet
30 changes: 15 additions & 15 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,21 @@ http {
server {
listen 80;

location / {
proxy_pass http://tiled:8000/;
include /etc/nginx/cors.conf;

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

}
location /viewer/ {
proxy_pass http://viewer:8082/;
include /etc/nginx/cors.conf;
}
# location / {
# proxy_pass http://tiled:8000/;
# include /etc/nginx/cors.conf;

# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection "upgrade";
# proxy_set_header Host $host;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

# }
# location /viewer/ {
# proxy_pass http://viewer:8082/;
# include /etc/nginx/cors.conf;
# }
# path rewrite
location /react/ {
# Simply proxy pass without trying to rewrite paths
Expand Down
Loading