Skip to content

Commit

Permalink
Frontend configurable gateway endpoint (#704)
Browse files Browse the repository at this point in the history
Co-authored-by: alabdao <139594838+alabdao@users.noreply.github.com>
Co-authored-by: The Technocrat <josh.mcmenemy@openzyme.bio>
  • Loading branch information
3 people authored Oct 18, 2023
1 parent 78d9acb commit 7243d1e
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 13 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ jobs:
docker:
strategy:
matrix:
backends: [{ env: stg, url: 'https://api.stg.labdao.xyz'}, { env: prod, url: 'https://api.prod.labdao.xyz'}, { env: local, url: 'http://localhost:8080'}]
backends: [
{ env: stg, url: 'https://api.stg.labdao.xyz', gateway: 'http://bacalhau.stg.labdao.xyz:8080/ipfs/'},
{ env: prod, url: 'https://api.prod.labdao.xyz', gateway: 'http://bacalhau.prod.labdao.xyz:8080/ipfs/'},
{ env: local, url: 'http://localhost:8080', gateway: 'http://bacalhau.labdao.xyz:8080/ipfs/'}
]
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
Expand Down Expand Up @@ -61,11 +65,13 @@ jobs:
- name: Build and push
env:
NEXT_PUBLIC_PRIVY_APP_ID: ${{ secrets.NEXT_PUBLIC_PRIVY_APP_ID }}
NEXT_PUBLIC_IPFS_GATEWAY_ENDPOINT: ${{ matrix.backends.gateway }}
uses: docker/build-push-action@v5
with:
build-args: |
NEXT_PUBLIC_BACKEND_URL=${{ matrix.backends.url }}
NEXT_PUBLIC_PRIVY_APP_ID
NEXT_PUBLIC_IPFS_GATEWAY_ENDPOINT
push: true
context: frontend/
tags: ${{ steps.meta.outputs.tags }}
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ services:
- quay.io/labdao/frontend:latest
args:
NEXT_PUBLIC_PRIVY_APP_ID: $NEXT_PUBLIC_PRIVY_APP_ID
NEXT_PUBLIC_BACKEND_URL: http://localhost:8080
NEXT_PUBLIC_BACKEND_URL: ${NEXT_PUBLIC_BACKEND_URL:-http://localhost:8080}
NEXT_PUBLIC_IPFS_GATEWAY_ENDPOINT: ${NEXT_PUBLIC_IPFS_GATEWAY_ENDPOINT:-http://localhost:8080/ipfs/}
environment:
NODE_ENV: 'production'
ports:
Expand Down
4 changes: 1 addition & 3 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ FROM node:18-alpine AS base
# Include NEXT_PUBLIC_BACKEND_URL and NEXT_PUBLIC_PRIVY_APP_ID
ARG NEXT_PUBLIC_BACKEND_URL=http://localhost:8080
ARG NEXT_PUBLIC_PRIVY_APP_ID

ENV NEXT_PUBLIC_BACKEND_URL=$NEXT_PUBLIC_BACKEND_URL
ENV NEXT_PUBLIC_PRIVY_APP_ID=$NEXT_PUBLIC_PRIVY_APP_ID
ARG NEXT_PUBLIC_IPFS_GATEWAY_ENDPOINT

# Install dependencies only when needed
FROM base AS deps
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/datafile/list/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default function ListDataFiles() {
{datafiles.map((datafile, index) => (
<TableRow key={index}>
<TableCell>
<a href={`http://bacalhau.labdao.xyz:8080/ipfs/${datafile.CID}/`}>
<a href={`${process.env.NEXT_PUBLIC_IPFS_GATEWAY_ENDPOINT}${datafile.CID}/`}>
{datafile.CID}
</a>
</TableCell>
Expand Down
6 changes: 3 additions & 3 deletions frontend/app/flow/detail/[cid]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ export default function FlowDetail() {
return (
<Box maxWidth={800} margin="auto">
<Typography gutterBottom>
<a href={`http://bacalhau.labdao.xyz:8080/ipfs/${flow.CID}/`}>
<a href={`${process.env.NEXT_PUBLIC_IPFS_GATEWAY_ENDPOINT}${flow.CID}/`}>
Name: {flow.Name}
</a>
</Typography>
<Typography gutterBottom>
<a href={`http://bacalhau.labdao.xyz:8080/ipfs/${flow.CID}/`}>
<a href={`${process.env.NEXT_PUBLIC_IPFS_GATEWAY_ENDPOINT}${flow.CID}/`}>
CID: {flow.CID}
</a>
</Typography>
Expand Down Expand Up @@ -90,7 +90,7 @@ export default function FlowDetail() {
</TableCell>
<TableCell>{job.Tool.Name}</TableCell>
<TableCell>
<a href={`http://bacalhau.labdao.xyz:8080/ipfs/${job.Tool.CID}/`}>
<a href={`${process.env.NEXT_PUBLIC_IPFS_GATEWAY_ENDPOINT}${job.Tool.CID}/`}>
{job.Tool.CID}
</a>
</TableCell>
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/flow/list/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function ListToolFiles() {
</Link>
</TableCell>
<TableCell>
<a href={`http://bacalhau.labdao.xyz:8080/ipfs/${flow.CID}/`}>
<a href={`${process.env.NEXT_PUBLIC_IPFS_GATEWAY_ENDPOINT}${flow.CID}/`}>
{flow.CID}
</a>
</TableCell>
Expand Down
4 changes: 2 additions & 2 deletions frontend/app/job/detail/[jobID]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default function JobDetail() {
{job.Inputs.map((inputDatafile, index) => (
<TableRow key={index}>
<TableCell>
<a href={`http://bacalhau.labdao.xyz:8080/ipfs/${inputDatafile.CID}/`}>
<a href={`${process.env.NEXT_PUBLIC_IPFS_GATEWAY_ENDPOINT}${inputDatafile.CID}/`}>
{inputDatafile.CID}
</a>
</TableCell>
Expand All @@ -113,7 +113,7 @@ export default function JobDetail() {
{job.Outputs.map((outputDatafile, index) => (
<TableRow key={index}>
<TableCell>
<a href={`http://bacalhau.labdao.xyz:8080/ipfs/${outputDatafile.CID}/`}>
<a href={`${process.env.NEXT_PUBLIC_IPFS_GATEWAY_ENDPOINT}${outputDatafile.CID}/`}>
{outputDatafile.CID}
</a>
</TableCell>
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/tool/list/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default function ListToolFiles() {
<TableRow key={index}>
<TableCell>{tool.Name}</TableCell>
<TableCell>
<a href={`http://bacalhau.labdao.xyz:8080/ipfs/${tool.CID}/`}>
<a href={`${process.env.NEXT_PUBLIC_IPFS_GATEWAY_ENDPOINT}${tool.CID}/`}>
{tool.CID}
</a>
</TableCell>
Expand Down

0 comments on commit 7243d1e

Please sign in to comment.