-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/implement feather client (#5)
* add builders * add feathers client and socket io connection * Update Notebook.js * Update gatsby-node.js * Update NotebookCard.js * Update UserArea.js
- Loading branch information
1 parent
5121f02
commit 448f38f
Showing
13 changed files
with
566 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Build and publish latest Docker image | ||
on: | ||
# Trigger the workflow on push or pull request, | ||
# for the develop branch and all new tags | ||
push: | ||
branches: | ||
- master | ||
workflow_dispatch: | ||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: get env variables for GIT related info | ||
run: | | ||
echo "GIT_COMMIT_SHA=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV | ||
echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV | ||
echo "GIT_BRANCH=$(echo $GITHUB_REF | sed 's/refs\/heads\///')" >> $GITHUB_ENV | ||
echo "GIT_REMOTE=$(git config --get remote.origin.url)" >> $GITHUB_ENV | ||
echo "GIT_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
push: true | ||
tags: impresso/impresso-datalab:latest | ||
build-args: | | ||
VERSION=latest | ||
GIT_COMMIT_SHA=${{ env.GIT_COMMIT_SHA }} | ||
BUILD_DATE=${{ env.BUILD_DATE }} | ||
GIT_BRANCH=${{ env.GIT_BRANCH }} | ||
GIT_REMOTE=${{ env.GIT_REMOTE }} | ||
GIT_TAG=${{ env.GIT_TAG }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,18 @@ | ||
name: Update Notebooks if needed | ||
on: | ||
schedule: | ||
- cron: "0 0 * * *" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
updateNotebooks: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Setup Python | ||
uses: actions/setup-python@v2 | ||
uses: actions/checkout@v4 | ||
- name: Setup Nodejs | ||
uses: actions/setup-node@v4 | ||
with: | ||
python-version: "3.x" | ||
node-version: 22 | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
run: yarn | ||
- name: Update Notebooks | ||
run: | | ||
python updateNotebooks.py | ||
run: node updateNotebooks.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
FROM node:22.2.0-alpine3.20 AS gatsby | ||
|
||
# docker build --no-cache --progress=plain -t impresso/impresso-datalab:${BUILD_TAG} \ | ||
# --build-arg GIT_REVISION=$(shell git rev-parse --short HEAD) \ | ||
# --build-arg GIT_TAG=$(shell git describe --tags --abbrev=0 HEAD) \ | ||
# --build-arg GIT_BUILD_TAG=${BUILD_TAG} \ | ||
# --build-arg GIT_BRANCH=$(shell git rev-parse --abbrev-ref HEAD) \ | ||
# --build-arg BUILD_DATE=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ') \ | ||
# --build-arg GIT_REPO=$(shell git config --get remote.origin.url) . | ||
|
||
ARG GIT_REVISION | ||
ARG GIT_TAG | ||
ARG GIT_BUILD_TAG | ||
ARG GIT_BRANCH | ||
ARG BUILD_DATE | ||
ARG GIT_REPO | ||
|
||
WORKDIR /app | ||
|
||
COPY package.json . | ||
COPY yarn.lock . | ||
|
||
RUN yarn install | ||
|
||
COPY src /app/src | ||
COPY static /app/static | ||
COPY utils /app/utils | ||
|
||
COPY createfontscss.js /app/createfontscss.js | ||
COPY updatenotebooks.js /app/updatenotebooks.js | ||
COPY gatsby-config.js /app/gatsby-config.js | ||
COPY gatsby-node.js /app/gatsby-node.js | ||
COPY gatsby-ssr.js /app/gatsby-ssr.js | ||
COPY gatsby-browser.js /app/gatsby-browser.js | ||
|
||
ENV GIT_REVISION=${GIT_REVISION} | ||
ENV GIT_TAG=${GIT_TAG} | ||
ENV GIT_BUILD_TAG=${GIT_BUILD_TAG} | ||
ENV GIT_BRANCH=${GIT_BRANCH} | ||
ENV BUILD_DATE=${BUILD_DATE} | ||
ENV GIT_REPO=${GIT_REPO} | ||
ENV GATSBY_PATH_PREFIX="/datalab" | ||
ENV GATSBY_IMPRESSO_API_URL="/api" | ||
|
||
RUN yarn build | ||
|
||
# Install and run pagefind | ||
RUN npx [email protected] --site /app/public --verbose | ||
|
||
# copy all files built by gatsy to busybox | ||
FROM busybox:stable | ||
WORKDIR /app | ||
COPY --from=gatsby /app/public . | ||
|
||
RUN ls -la |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { feathers } from "@feathersjs/feathers" | ||
import socketio from "@feathersjs/socketio-client" | ||
import auth from "@feathersjs/authentication-client" | ||
import io from "socket.io-client" | ||
import { usePersistentStore } from "./store" | ||
const setAuthenticatedUser = usePersistentStore.getState().setAuthenticatedUser | ||
|
||
const socket = io("", { | ||
path: "/api/socket.io/", | ||
forceNew: true, | ||
transports: ["websocket"], | ||
}) | ||
// print ut socket version | ||
const app = feathers() | ||
app.configure( | ||
auth({ | ||
storage: window.localStorage, | ||
}) | ||
) | ||
app.configure( | ||
socketio(socket, { | ||
timeout: 20000, | ||
}) | ||
) | ||
socket.on("connect_error", (err) => { | ||
console.error("[services] ocket.io connection error:", err) | ||
// reconnnect using transports | ||
socket.disconnect() | ||
}) | ||
socket.on("connect_timeout", (timeout) => { | ||
console.error("[services] socket.io connection timeout:", timeout) | ||
}) | ||
socket.on("connect", async () => { | ||
console.info("[services] socket.io connection established") | ||
|
||
await app | ||
.reAuthenticate() | ||
.then((data) => { | ||
console.info("[services] reAuthenticate", Object.keys(data)) | ||
setAuthenticatedUser(data.user, data.accessToken) | ||
}) | ||
.catch((err) => { | ||
console.error("[services] reAuthenticate", err) | ||
}) | ||
}) | ||
|
||
export const versionService = app.service("version") | ||
// export const userService = app.service("me") |
Oops, something went wrong.