-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create morpheus-data to handle all related with data
- add building for morpheus-data - include morpheus-data wheels in morpheus-server build process - move all repositories to morpheus_data - add morpheus-data installation in ci-backend - add morpheus-data instructions in readme - move lora information in models and schemas to morpheus-data - add morpheus-data to monorepo cicd pipeline - create requierements and install it in morpheus-data to allow the use of alembic - include rust to fix build error for safetensors - update migration in cd-api to use morpheus-data image - update and add README
- Loading branch information
Showing
75 changed files
with
921 additions
and
434 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
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,14 @@ | ||
name: CI Test and deploy Frontend | ||
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
env: | ||
MAX_LINE_LENGTH: 120 | ||
WORKING_DIR: morpheus-data | ||
jobs: | ||
ci-data: | ||
uses: ./.github/workflows/ci-data.yaml | ||
with: | ||
called: true | ||
secrets: inherit | ||
|
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,70 @@ | ||
name: CI data library | ||
on: | ||
workflow_call: | ||
inputs: | ||
called: | ||
required: false | ||
type: string | ||
workflow_dispatch: | ||
inputs: | ||
called: | ||
required: false | ||
type: string | ||
env: | ||
MAX_LINE_LENGTH: 120 | ||
WORKING_DIR: morpheus-data | ||
jobs: | ||
linters: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: ${{ env.WORKING_DIR }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v4 | ||
id: python-cache | ||
with: | ||
python-version: '3.10' | ||
cache: pip | ||
cache-dependency-path: ./${{ env.WORKING_DIR }}/requirements.lint.txt | ||
- name: Install packages | ||
run: | | ||
pip install -r requirements.lint.txt | ||
- name: Black | ||
run: | | ||
black --line-length $MAX_LINE_LENGTH --exclude morpheus_data/migrations/ . | ||
- name: Flake8 | ||
run: | | ||
flake8 --max-line-length $MAX_LINE_LENGTH --exclude morpheus_data/migrations/ . | ||
ci-data-library: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: ${{ env.WORKING_DIR }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- | ||
name: Set up QEMU | ||
if: ${{ inputs.called == 'true' }} | ||
uses: docker/setup-qemu-action@v2 | ||
- | ||
name: Set up Docker Buildx | ||
if: ${{ inputs.called == 'true' }} | ||
uses: docker/setup-buildx-action@v2 | ||
- | ||
name: Login to DockerHub | ||
if: ${{ inputs.called == 'true' }} | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USER }} | ||
password: ${{ secrets.DOCKER_HUB_TOKEN }} | ||
- | ||
name: Build and push | ||
if: ${{ inputs.called == 'true' }} | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: "{{defaultContext}}:morpheus-data" | ||
build-args: | | ||
BUILD_ENV=copy | ||
push: true | ||
tags: monadicalsas/morpheus-data:latest |
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 |
---|---|---|
|
@@ -261,13 +261,15 @@ docker compose run --rm api pytest tests/test_module.py::test_function | |
``` | ||
|
||
### Running the migrations | ||
To use morpheus-data image to run the migrations, you need to create a secrets.env file in the morpheus-server | ||
directory. For more information, you can read the morpheus-data [README](./morpheus-data/README.md). | ||
|
||
```shell | ||
# Create migration | ||
docker-compose run --rm api alembic revision --autogenerate -m "Initial migration" | ||
docker-compose run --rm datalib alembic revision --autogenerate -m "Initial migration" | ||
|
||
# Migrate / Update the head | ||
docker-compose run --rm api alembic upgrade head | ||
docker-compose run --rm datalib alembic upgrade head | ||
``` | ||
|
||
### PG admin | ||
|
@@ -282,9 +284,41 @@ [email protected] | |
PGADMIN_DEFAULT_PASSWORD=password | ||
``` | ||
|
||
### Implement changes in morpheus-data | ||
|
||
`morpheus-data` works as a package to have a transverse Python library to manage all ORM-related operations in Morpheus. | ||
Other Morpheus microservices can import into them and use it. | ||
|
||
To run Morpheus locally using morpheus-data as a library, you need to do this: | ||
|
||
```bash | ||
|
||
# Building in separate steps | ||
#--------------------------------------------- | ||
# build morpheus-data wheel | ||
docker compose build datalib | ||
|
||
# build morpheus-server api | ||
docker compose build api | ||
|
||
# Building alltogether | ||
#--------------------------------------------- | ||
docker compose --profile <local|staging|manage> build | ||
|
||
# Run | ||
#--------------------------------------------- | ||
docker compose --profile <local|staging> up | ||
``` | ||
|
||
**Note**: You need to build `morpheus-data` and `morpheus-server` API service (or any other microservice that uses it) | ||
every time you make a change inside `morpheus-data`. This build is necessary because you need to build the wheel | ||
file again and install it in the `morpheus-server` API service or any other service that uses it | ||
For more information, you can read the morpheus-data [README](./morpheus-data/README.md). | ||
|
||
|
||
### Adding a new dependency to the backend | ||
|
||
1. Add the new dependency directly to the respective requirements.txt file | ||
1. Add the new dependency directly to the respective `requirements.txt` file | ||
2. Update the docker image | ||
```shell | ||
docker-compose build api | ||
|
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,4 @@ | ||
secrets.env | ||
build | ||
dist | ||
*.egg-info |
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,4 @@ | ||
build | ||
dist | ||
*.egg-info | ||
*.env |
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,28 @@ | ||
FROM python:3.10 AS builder | ||
|
||
WORKDIR /app | ||
|
||
# Install dependencies | ||
RUN apt-get update && apt-get install -y curl build-essential && rm -rf /var/lib/apt/lists/* | ||
|
||
# Install dependencies | ||
RUN pip install --upgrade pip | ||
RUN pip install --upgrade build pip-tools | ||
|
||
# Copy over pyproject.toml | ||
COPY pyproject.toml ./ | ||
|
||
# Generate requirements.txt from pyproject.toml | ||
RUN pip-compile --output-file=requirements.txt pyproject.toml | ||
|
||
# Install dependencies | ||
RUN pip install -r requirements.txt | ||
|
||
# Copy over the rest of your project files | ||
COPY . . | ||
|
||
# Build the wheel | ||
RUN python -m build --wheel && mkdir /wheels | ||
|
||
# Copy the built wheel to a volume | ||
RUN cp dist/*.whl /wheels/ |
Oops, something went wrong.