Skip to content

Commit fa04451

Browse files
committed
Used BioNGFF Viewer instead of Vizarr
1 parent 1b32981 commit fa04451

File tree

8 files changed

+71
-51
lines changed

8 files changed

+71
-51
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ PORT=3000
22
BIND_ADDRESS=0.0.0.0
33
FRACTAL_SERVER_URL=http://localhost:8000
44
BASE_PATH=/data
5-
VIZARR_STATIC_FILES_PATH=/path/to/vizarr/dist
5+
VIEWER_STATIC_FILES_PATH=/path/to/biongff-viewer/sites/app/dist
66
AUTHORIZATION_SCHEME=fractal-server
77
CACHE_EXPIRATION_TIME=60

.github/workflows/github_release.yaml

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
- 'v[0-9]+.[0-9]+.[0-9]+rc[0-9]+'
1111

1212
jobs:
13-
build-vizarr:
13+
build-viewer:
1414
runs-on: ubuntu-latest
1515

1616
steps:
@@ -23,33 +23,35 @@ jobs:
2323
node-version: 20
2424
cache: npm
2525

26-
- name: Clone vizarr
27-
run: git clone https://github.com/fractal-analytics-platform/vizarr.git
26+
- name: Clone BioNGFF Viewer
27+
run: git clone https://github.com/BioNGFF/biongff-viewer.git
2828

29-
- name: Checkout vizarr commit
29+
- name: Init git submodules
3030
run: |
31-
cd vizarr
32-
git checkout a04555b6557a42f4ee627850bad4e6b3fe8c8fe1
33-
34-
- name: Install dependencies
35-
run: |
36-
cd vizarr
37-
npx -y pnpm install
31+
cd biongff-viewer
32+
sed -i 's|hms-dbmi|fractal-analytics-platform|g' .gitmodules
33+
printf "\tbranch = workaround-labels-bug\n" >> .gitmodules
34+
git submodule init
35+
git submodule update
3836
3937
- name: Generate build artifacts
4038
run: |
41-
cd vizarr
42-
npx pnpm run build
39+
cd biongff-viewer
40+
npx pnpm install
41+
npx pnpm --filter viewer run build
42+
npx pnpm --filter anndata-zarr run build
43+
npx pnpm --filter app run build --base /data/viewer
4344
4445
- name: Generate the package
4546
run: |
46-
cd vizarr
47-
tar -czpf fractal-vizarr-${{ github.ref_name }}.tar.gz dist LICENSE
47+
cd biongff-viewer
48+
mv sites/app/dist .
49+
tar -czpf fractal-viewer-${{ github.ref_name }}.tar.gz dist LICENSE
4850
4951
- name: Release
5052
uses: softprops/[email protected]
5153
with:
52-
files: vizarr/fractal-vizarr-${{ github.ref_name }}.tar.gz
54+
files: biongff-viewer/fractal-viewer-${{ github.ref_name }}.tar.gz
5355

5456
build-server:
5557
runs-on: ubuntu-latest

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Note: Numbers like (#123) point to closed Pull Requests on the fractal-vizarr-vi
22

33
# Unreleased
44

5+
* Used BioNGFF Viewer instead of Vizarr (\#69).
56
* Added workaround to fix labels bug in most recent Chrome versions (\#68);
67

78
# 0.4.0

Dockerfile

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,20 @@ FROM node:20
22

33
WORKDIR /
44

5-
RUN git clone https://github.com/hms-dbmi/vizarr.git
6-
WORKDIR /vizarr
5+
RUN git clone https://github.com/BioNGFF/biongff-viewer.git
6+
WORKDIR /biongff-viewer
7+
8+
# modifying .gitmodules to use our vizarr fork
9+
RUN sed -i 's|hms-dbmi|fractal-analytics-platform|g' .gitmodules
10+
RUN printf "\tbranch = workaround-labels-bug\n" >> .gitmodules
11+
12+
RUN git submodule init
13+
RUN git submodule update
714

8-
RUN git checkout eb2b77fed92a08c78c5770144bc7ccf19e9c7658
915
RUN npx -y pnpm install
10-
RUN npx pnpm run build
16+
RUN npx pnpm --filter viewer run build
17+
RUN npx pnpm --filter anndata-zarr run build
18+
RUN npx pnpm --filter app run build --base /data/viewer
1119

1220
RUN mkdir /fractal-data
1321

@@ -20,6 +28,6 @@ ADD tsconfig.json .
2028
RUN npm install
2129
RUN npm run build
2230

23-
ENV VIZARR_STATIC_FILES_PATH=/vizarr/dist
31+
ENV VIEWER_STATIC_FILES_PATH=/biongff-viewer/sites/app/dist
2432

2533
CMD ["node", "/fractal-data/dist/app.js"]

README.md

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ The application has 3 endpoints:
88

99
- the endpoint `/files/{path-to-zarr}`, that serves the content of Zarr files checking user authorization.
1010
- the endpoint `/alive`, that returns the status of the service.
11-
- the optional endpoint `/vizarr`, that serves vizarr static files when the `VIZARR_STATIC_FILES_PATH` environment variable is set.
11+
- the optional endpoint `/viewer`, that serves [BioNGFF Viewer](https://github.com/BioNGFF/biongff-viewer) static files when the `VIEWER_STATIC_FILES_PATH` environment variable is set.
1212

13-
> To run fractal-data you need to have an active instance of `fractal-server` and an active instance of `fractal-web`. You need to log-in to `fractal-web` from the browser using a user that has been authorized to see the vizarr files. Details about authorization are explained in the next section.
13+
> To run fractal-data you need to have an active instance of `fractal-server` and an active instance of `fractal-web`. You need to log-in to `fractal-web` from the browser using a user that has been authorized to see the viewer files. Details about authorization are explained in the next section.
1414
1515
## How it works
1616

@@ -36,25 +36,25 @@ If different subdomains are used for fractal-web and fractal-data, the fractal-w
3636

3737
Example: if fractal-data is served on `fractal-data.mydomain.net` and fractal-web is served on `fractal-web.mydomain.net`, then `AUTH_COOKIE_DOMAIN` must be set to `mydomain.net`.
3838

39-
If we need to serve these services on different domains a different authentication strategy has to be chosen, for example something token-based. That results in a more complicated setup, possibly involving some extra changes on the vizarr code.
39+
If we need to serve these services on different domains a different authentication strategy has to be chosen, for example something token-based. That results in a more complicated setup, possibly involving some extra changes on the viewer code.
4040

4141
## Install fractal-data from release packages
4242

43-
The release packages include the Node.js server and the Vizarr static files. Starting from version 0.1.3, fractal-data releases provide tar.gz files containing built Vizarr static files and a package of built files for each supported node version.
43+
The release packages include the Node.js server and the BioNGFF Viewer static files. Starting from version 0.1.3, fractal-data releases provide tar.gz files containing built BioNGFF Viewer static files and a package of built files for each supported node version.
4444

45-
### Install Vizarr static files
45+
### Install BioNGFF Viewer static files
4646

47-
Vizarr static files can be served using any server like Apache or Ngnix.
47+
BioNGFF Viewer static files can be served using any server like Apache or Ngnix.
4848

49-
Create a dedicated folder for vizarr on your server. For Apache, it could be `/var/www/html/vizarr`.
49+
Create a dedicated folder for the viewer on your server. For Apache, it could be `/var/www/html/viewer`.
5050

51-
Navigate to the directory and extract the Vizarr static files:
51+
Navigate to the directory and extract the BioNGFF Viewer static files:
5252

5353
```
54-
FRACTAL_DATA_VERSION=0.4.0 && wget -qO- "https://github.com/fractal-analytics-platform/fractal-data/releases/download/v${FRACTAL_DATA_VERSION}/fractal-vizarr-v${FRACTAL_DATA_VERSION}.tar.gz" | tar -xz
54+
FRACTAL_DATA_VERSION=0.4.0 && wget -qO- "https://github.com/fractal-analytics-platform/fractal-data/releases/download/v${FRACTAL_DATA_VERSION}/fractal-viewer-v${FRACTAL_DATA_VERSION}.tar.gz" | tar -xz
5555
```
5656

57-
**Note**: this will unpack in the current working directory the vizarr `dist` folder.
57+
**Note**: this will unpack in the current working directory the viewer `dist` folder.
5858

5959
### Install fractal-data Node.js server files
6060

@@ -73,7 +73,7 @@ To start the application installed in this way see the section [Run fractal-data
7373
- `PORT`: the port where fractal-data app is served;
7474
- `BIND_ADDRESS`: specifies the IP address for the server to bind to; use `0.0.0.0` (IPv4) or `::` (IPv6) to listen on all interfaces, `127.0.0.1` (IPv4) or `::1` (IPv6) for localhost only; the default value is `0.0.0.0`;
7575
- `FRACTAL_SERVER_URL`: the base URL of fractal-server;
76-
- `VIZARR_STATIC_FILES_PATH`: path to the files generated running `npm run build` in Vizarr source folder; this variable is optional and, if present, it will be used to serve Vizarr static files from the `/vizarr` endpoint;
76+
- `VIEWER_STATIC_FILES_PATH`: path to the files generated by building the BioNGFF Viewer; this variable is optional and, if present, it will be used to serve the BioNGFF Viewer static files from the `/viewer` endpoint;
7777
- `BASE_PATH`: base path of fractal-data application;
7878
- `AUTHORIZATION_SCHEME`: defines how the service verifies user authorization. The following options are available:
7979
- `fractal-server`: the paths that can be accessed by each user are retrieved calling fractal-server API.
@@ -189,25 +189,34 @@ npm install
189189

190190
Copy the file `.env.example` to `.env` and customize values for the environment variables.
191191

192-
### Vizarr setup
192+
### BioNGFF Viewer setup
193193

194-
In order to display a proper error message related to the missing authorization it is necessary to use a modified version of vizarr.
194+
BioNGFF Viewer depends on Vizarr and we are using a custom fork of Vizarr, to fix some issues. The .gitmodules file of the BioNGFF Viewer needs to be changed to reference our Vizarr fork.
195195

196-
> Note: for simplicity, we assume that `fractal-data` and `vizarr` are subfolders of the same folder:
196+
> Note: for simplicity, we assume that `fractal-data` and `biongff-viewer` are subfolders of the same folder:
197197
198198
```bash
199-
git clone https://github.com/hms-dbmi/vizarr.git
200-
cd vizarr
201-
git checkout eb2b77fed92a08c78c5770144bc7ccf19e9c7658
199+
git clone https://github.com/BioNGFF/biongff-viewer.git
200+
cd biongff-viewer
201+
202+
# modifying .gitmodules to use our vizarr fork
203+
sed -i 's|hms-dbmi|fractal-analytics-platform|g' .gitmodules
204+
printf "\tbranch = workaround-labels-bug\n" >> .gitmodules
205+
206+
git submodule init
207+
git submodule update
208+
202209
npx pnpm install
203-
npx pnpm run build
210+
npx pnpm --filter viewer run build
211+
npx pnpm --filter anndata-zarr run build
212+
npx pnpm --filter app run build --base /data/viewer
204213
```
205214

206-
The output is located in the `dist` folder.
215+
The output is located in the `sites/app/dist` folder.
207216

208217
### Run fractal-data
209218

210-
Then go back to fractal-data folder and run `npm run start` to start the project. The server will start on port 3000. Remember to set the `VIZARR_STATIC_FILES_PATH`, to serve Vizarr static files from the `/vizarr` endpoint. Vizarr static files need to be served from the same port and domain of the fractal-data service, otherwise you will encounter CORS issues.
219+
Then go back to fractal-data folder and run `npm run start` to start the project. The server will start on port 3000. Remember to set the `VIEWER_STATIC_FILES_PATH`, to serve BioNGFF Viewer static files from the `/viewer` endpoint. BioNGFF Viewer static files need to be served from the same port and domain of the fractal-data service, otherwise you will encounter CORS issues.
211220

212221
### Alive endpoint
213222

src/app.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ app.use(`${config.basePath}alive`, async function (req, res) {
2929
await aliveEndpoint(req, res);
3030
});
3131

32-
// Serving Vizarr static files
33-
if (config.vizarrStaticFilesPath) {
32+
// Serving viewer static files
33+
if (config.viewerStaticFilesPath) {
3434
app.use(
35-
`${config.basePath}vizarr`,
36-
express.static(config.vizarrStaticFilesPath)
35+
`${config.basePath}viewer`,
36+
express.static(config.viewerStaticFilesPath)
3737
);
3838
}
3939

src/config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function loadConfig(): Config {
5959
basePath += "/";
6060
}
6161

62-
const vizarrStaticFilesPath = process.env.VIZARR_STATIC_FILES_PATH;
62+
const viewerStaticFilesPath = process.env.VIEWER_STATIC_FILES_PATH;
6363

6464
logger.debug("PORT: %s", port);
6565
logger.debug("BIND_ADDRESS: %s", bindAddress);
@@ -68,8 +68,8 @@ function loadConfig(): Config {
6868
logger.debug("AUTHORIZATION_SCHEME: %s", authorizationScheme);
6969
logger.debug("CACHE_EXPIRATION_TIME: %d", cacheExpirationTime);
7070

71-
if (vizarrStaticFilesPath) {
72-
logger.debug("VIZARR_STATIC_FILES_PATH: %s", vizarrStaticFilesPath);
71+
if (viewerStaticFilesPath) {
72+
logger.debug("VIEWER_STATIC_FILES_PATH: %s", viewerStaticFilesPath);
7373
}
7474

7575
return {
@@ -81,7 +81,7 @@ function loadConfig(): Config {
8181
cacheExpirationTime,
8282
testingUsername,
8383
testingPassword,
84-
vizarrStaticFilesPath,
84+
viewerStaticFilesPath,
8585
};
8686
}
8787

src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export type Config = {
1212
cacheExpirationTime: number;
1313
testingUsername: string | null;
1414
testingPassword: string | null;
15-
vizarrStaticFilesPath: string | undefined;
15+
viewerStaticFilesPath: string | undefined;
1616
};
1717

1818
export type User = {

0 commit comments

Comments
 (0)