Skip to content

Commit

Permalink
Merge branch 'develop' into expert-contact-newbackend
Browse files Browse the repository at this point in the history
  • Loading branch information
nutfdt committed Jun 10, 2024
2 parents a1b2068 + 511a7b4 commit c76a925
Show file tree
Hide file tree
Showing 150 changed files with 2,987 additions and 2,860 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-filebeat-rootless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ jobs:
with:
file: ./infra/filebeat.Dockerfile
push: true
tags: ghcr.io/datalab-mi/basegun/filebeat-rootless:6.5.4
tags: ghcr.io/dnum-mi/basegun/filebeat-rootless:6.5.4
98 changes: 0 additions & 98 deletions .github/workflows/deploy.yml

This file was deleted.

9 changes: 3 additions & 6 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ jobs:
with:
context: ./backend
push: true
tags: ghcr.io/datalab-mi/basegun/basegun-backend:${{ github.head_ref }}
target: dev
tags: ghcr.io/dnum-mi/basegun/basegun-backend:${{ github.head_ref }}

build-frontend:
name: Build Frontend
Expand All @@ -54,17 +53,15 @@ jobs:
with:
context: ./frontend
push: true
tags: ghcr.io/datalab-mi/basegun/basegun-frontend:${{ github.head_ref }}
target: prod
tags: ghcr.io/dnum-mi/basegun/basegun-frontend:${{ github.head_ref }}

test-backend:
name: Test Backend
needs: build-backend
runs-on: ubuntu-latest
container:
image: ghcr.io/datalab-mi/basegun/basegun-backend:${{ github.head_ref }}
image: ghcr.io/dnum-mi/basegun/basegun-backend:${{ github.head_ref }}
env:
WORKSPACE: dev
AWS_REGION: gra
AWS_DEFAULT_REGION: gra
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/preprod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ jobs:
uses: vlaurin/action-ghcr-prune@main
with:
token: ${{ secrets.PERSO_ACCESS_TOKEN }}
organization: datalab-mi
organization: dnum-mi
container: basegun/basegun-backend
dry-run: false
prune-untagged: true
- name: Delete untagged images
uses: vlaurin/action-ghcr-prune@main
with:
token: ${{ secrets.PERSO_ACCESS_TOKEN }}
organization: datalab-mi
organization: dnum-mi
container: basegun/basegun-frontend
dry-run: false
prune-untagged: true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ jobs:
uses: vlaurin/action-ghcr-prune@main
with:
token: ${{ secrets.PERSO_ACCESS_TOKEN }}
organization: datalab-mi
organization: dnum-mi
container: basegun/basegun-backend
dry-run: false
untagged: true
- name: Delete untagged images
uses: vlaurin/action-ghcr-prune@main
with:
token: ${{ secrets.PERSO_ACCESS_TOKEN }}
organization: datalab-mi
organization: dnum-mi
container: basegun/basegun-frontend
dry-run: false
untagged: true
Expand Down
20 changes: 5 additions & 15 deletions .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,12 @@ jobs:

- name: Start stack using docker compose
run: docker compose up -d

- name: Setup nodejs (for cypress)
uses: actions/setup-node@v3
with:
node-version: 18
check-latest: true
cache: "npm"
cache-dependency-path: "frontend/package-lock.json"

- name: Install npm packages (for cypress)
run: npm ci
working-directory: ./frontend

- name: Test end to end (cypress)
run: FRONTEND_HOST=localhost FRONTEND_PORT=3000 npm run test:e2e-ci
working-directory: ./frontend
- name: Cypress run
uses: cypress-io/github-action@v6
with:
working-directory: ./frontend
command: npm run test:e2e-ci

- name: Send artifacts
uses: actions/upload-artifact@v3
Expand Down
20 changes: 8 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
SHELL := /bin/bash
DOCKER := $(shell type -p docker)
DC := $(shell type -p docker-compose)
DC := ${DOCKER} compose
TAG := 3.3
APP_NAME := basegun
REG := ghcr.io
ORG := datalab-mi
ORG := dnum-mi

export

Expand All @@ -29,14 +29,10 @@ check-dc-config-%: check-prerequisites ## Check docker-compose syntax
${DC} config -q

build: check-dc-config-%
TAG=${TAG} ${DC} build
${DC} build

up: check-dc-config-%
ifeq ("$(WORKSPACE)","preprod")
TAG=${TAG} PORT_PROD=8080 ${DC} up -d
else
TAG=${TAG} ${DC} up -d
endif
${DC} up -d

down:
${DC} down
Expand All @@ -58,9 +54,9 @@ pull-%:
push: push-${TAG}

push-%:
docker tag basegun-frontend:${TAG}-prod ghcr.io/datalab-mi/basegun/basegun-frontend:$*
docker tag basegun-backend:${TAG}-prod ghcr.io/datalab-mi/basegun/basegun-backend:$*
docker push ghcr.io/datalab-mi/basegun/basegun-frontend:$*
docker push ghcr.io/datalab-mi/basegun/basegun-backend:$*
docker tag basegun-frontend:${TAG}-prod ghcr.io/dnum-mi/basegun/basegun-frontend:$*
docker tag basegun-backend:${TAG}-prod ghcr.io/dnum-mi/basegun/basegun-backend:$*
docker push ghcr.io/dnum-mi/basegun/basegun-frontend:$*
docker push ghcr.io/dnum-mi/basegun/basegun-backend:$*

deploy-prod: pull up-prod
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Dependancies:
* docker
* docker-compose

See also [Debugging](https://github.com/datalab-mi/Basegun/blob/develop/backend/README.md#debugging) section for all the env variables needed for the website to work fully operationally.
See also [Debugging](https://github.com/dnum-mi/Basegun/blob/develop/backend/README.md#debugging) section for all the env variables needed for the website to work fully operationally.
### Install

```bash
Expand Down Expand Up @@ -52,15 +52,15 @@ Try to find error log
* In terminal, run `docker logs basegun-backend`
* If you cannot access terminal or don't see anything, go to `localhost:5000/logs` or `preprod.basegun.fr/logs` to see latest logs.

=> ErrorPage "missing model": Download model from the url specified in the [backend Dockerfile](https://github.com/datalab-mi/Basegun/blob/develop/backend/Dockerfile).
=> ErrorPage "missing model": Download model from the url specified in the [backend Dockerfile](https://github.com/dnum-mi/Basegun/blob/develop/backend/Dockerfile).

### The website runs the analysis, but no image shows up
Use browser html inspector to find the url given in the image src.
* If it starts with `https://storage.gra.cloud.ovh.net` then the website tried to upload the input image to OVH but it failed. Have you set properly in your env the variables OS_USERNAME, OS_PASSWORD and OS_PROJECT ?
* If it starts with `https://localhost` then the website tried to store the input image locally. Have you synchronised the mounts for frontend and backend in [docker-compose](https://github.com/datalab-mi/Basegun/blob/develop/backend/docker-compose.yml) ? (uncomment the `/tmp/basegun` lines in the volumes sections)
* If it starts with `https://localhost` then the website tried to store the input image locally. Have you synchronised the mounts for frontend and backend in [docker-compose](https://github.com/dnum-mi/Basegun/blob/develop/backend/docker-compose.yml) ? (uncomment the `/tmp/basegun` lines in the volumes sections)

### Logs are not sent to the endpoint
The variables `X_OVH_TOKEN` and `API_OVH_TOKEN` must en set in your env. See [Infra README](https://github.com/datalab-mi/Basegun/blob/develop/infra/README.md) for more details.
The variables `X_OVH_TOKEN` and `API_OVH_TOKEN` must en set in your env. See [Infra README](https://github.com/dnum-mi/Basegun/blob/develop/infra/README.md) for more details.

## Release an official version of code
1. Update tag in Makefile
Expand Down
Empty file removed apple-touch-icon.png
Empty file.
12 changes: 2 additions & 10 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN apt update && apt install -y \
gcc \
&& rm -rf /var/lib/apt/lists/*

# install python libraries (except torch)
# install python libraries
COPY requirements.txt .
ENV PIP_CERT=$CACERT_LOCATION
RUN pip --default-timeout=300 install --upgrade pip \
Expand All @@ -22,12 +22,4 @@ RUN pip --default-timeout=300 install --upgrade pip \

ARG VERSION
ENV SSL_CERT_FILE=$CACERT_LOCATION
COPY src/ src/
COPY model.pt .

FROM base as dev
COPY tests/ tests/

FROM base as prod
RUN pip install --extra-index-url https://download.pytorch.org/whl/cpu \
torch==2.1.1+cpu torchvision==0.16.1+cpu && rm -r /root/.cache
COPY . .
7 changes: 4 additions & 3 deletions backend/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ gelf-formatter==0.2.1
pyyaml>=5.4.1
user-agents==2.2.0
boto3==1.28.39
torch==2.1.1
torchvision==0.16.1
ultralytics==8.1.2
autodynatrace==2.0.0
# ML
ultralytics==8.1.2
opencv-python==4.9.0.80
onnxruntime==1.17.1
# Dev
pytest==7.4.3
coverage==7.3.2
Loading

0 comments on commit c76a925

Please sign in to comment.