Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
1d4ed68
CH-151 Refactor merge configuration directories to improve readability
condar-metacell Sep 30, 2024
10114cd
CH-151 Add postgres db as another base template of the django app
condar-metacell Sep 30, 2024
4925ec5
CH-151 Update django app dockerfile to use yarn instead of npm
condar-metacell Sep 30, 2024
47a7eb1
CH-151 Add initial install of yarn dependencies to harness-application
condar-metacell Oct 3, 2024
230adba
CH-151 Refactor harness-generate
condar-metacell Oct 3, 2024
7044fc0
CH-151 Refactor harness-generate
condar-metacell Oct 3, 2024
618d064
CH-151 Refactor merge_configuration_directories to use pathlib
condar-metacell Oct 3, 2024
55fd63d
CH-151 Refactor harness-generate to use pathlib glob
condar-metacell Oct 3, 2024
9a1148a
CH-151 Refactor harness-application to only use pathlib over os.path
condar-metacell Oct 4, 2024
a334992
CH-151 Refactor replace_in_file to work with pathlib
condar-metacell Oct 4, 2024
94f12de
CH-151 Add missing method calls for checking path existance
condar-metacell Oct 4, 2024
87d2cb7
CH-151 Refactor openapi functions to use pathlib and directly call fa…
condar-metacell Oct 4, 2024
15618cb
CH-151 Replace --server option with --app_name option in harness-gene…
condar-metacell Oct 4, 2024
7e194ac
CH-151 Refactor to add in a specific generate_models method for other…
condar-metacell Oct 4, 2024
e379273
CH-151 Update the harness-generate command line arguments to allow fo…
condar-metacell Oct 4, 2024
e4ef0ae
CH-151 Add flags to control which client types are generated by harne…
condar-metacell Oct 7, 2024
da8556c
CH-151 Remove dependency on os.path in harness-generate
condar-metacell Oct 7, 2024
6bc98a5
CH-151 Refactor harness-generate options to use flag enum for generat…
condar-metacell Oct 7, 2024
98eec41
CH-151 Create .ch-manifest file when creating a harness application
condar-metacell Oct 7, 2024
8d56b89
CH-151 Add cloud harness manifest support to harness-generate
condar-metacell Oct 7, 2024
f689061
CH-151 Update genapi.sh to call harness-generate
condar-metacell Oct 8, 2024
38bbc1b
CH-151 Move dependency installation and client generation to after te…
condar-metacell Oct 8, 2024
90f8454
CH-151 Call harness-generate after application harnessing
condar-metacell Oct 8, 2024
f5725a5
CH-151 Refactor to clean up some loose ends
condar-metacell Oct 8, 2024
8da4f16
CH-151 Update documentation
condar-metacell Oct 8, 2024
1756efc
CH-151 Fix linting issues
condar-metacell Oct 8, 2024
c6227cf
Merge branch 'feature/ch-151' of github.com:MetaCell/cloud-harness in…
filippomc Oct 9, 2024
3ca70a3
CH-151 Fix bugs in normalize templates function
condar-metacell Oct 9, 2024
20ac160
Merge branch 'feature/ch-151' of github.com:MetaCell/cloud-harness in…
filippomc Oct 9, 2024
689e23b
Merge pull request #778 from MetaCell/feature/ch-151
filippomc Oct 10, 2024
c362ece
Merge branch 'develop' of github.com:MetaCell/cloud-harness into develop
filippomc Oct 11, 2024
8dbce23
Fix backwards compatibility with Python 3.9
filippomc Oct 11, 2024
2c11b31
Reduce linting checks
filippomc Oct 15, 2024
d671a28
CH-157 Move harness-application builder steps to a more structured pi…
condar-metacell Oct 31, 2024
ad10cd8
CH-157 Rename template from django-app to django-fastapi
condar-metacell Nov 1, 2024
85b863a
CH-157 Add app builder for django-ninja applications using a shared b…
condar-metacell Nov 1, 2024
5b79044
CH-157 Add specific debug templates for the two different djano templ…
condar-metacell Nov 1, 2024
025d5c8
CH-157 Fix errors in django-ninja template
condar-metacell Nov 1, 2024
4648823
CH-157 Add utility method to run djano-ninja openapi export
condar-metacell Nov 1, 2024
9febcd6
CH-157 Fix bug with django ninja not considered a django template
condar-metacell Nov 1, 2024
33d9803
CH-157 Fix bug with incorrectly named field in derived app builders
condar-metacell Nov 1, 2024
dca0eae
CH-157 Update harness-generate to leverage django-ninja schema genera…
condar-metacell Nov 1, 2024
4b768ef
CH-157 Move manifest management code into its own file
condar-metacell Nov 1, 2024
11590ba
CH-157 Fix linting issues
condar-metacell Nov 4, 2024
6c85656
CH-158 option to edit user on django
filippomc Nov 5, 2024
b27916f
CH-162 fix random values generation
filippomc Nov 6, 2024
d938c97
CH-162 support for dynamic random secrets
filippomc Nov 6, 2024
fa4c3fe
Django: Improve db coherence on user sync issues
filippomc Nov 6, 2024
9be9c96
Django: Fix: Improve db coherence on user sync issues
filippomc Nov 6, 2024
b4e4102
CH-162 fix for non string secrets
filippomc Nov 6, 2024
49bc099
CH-162 fix for non string secrets +1
filippomc Nov 8, 2024
82b44da
CH-157 Fix typo in django template readme files
condar-metacell Nov 12, 2024
de3f097
CH-163 Gatekeeper version update
filippomc Nov 12, 2024
c463081
Merge pull request #783 from MetaCell/feature/CH-163
filippomc Nov 12, 2024
a0302fc
Fix secrets update
filippomc Nov 18, 2024
ecca698
CH-162 fix for secrets controls
filippomc Nov 22, 2024
f8cf3ba
CH-162 fix empty secrets gen
filippomc Nov 22, 2024
3461199
CH-162 fix empty secrets gen
filippomc Nov 22, 2024
663a7e8
CH-162 fix empty secrets gen
filippomc Nov 22, 2024
7ce854d
attempt fix codefresh deployment issues
filippomc Nov 22, 2024
4466edd
CH-162 add failsafe value
filippomc Nov 22, 2024
8ea73a8
CH-162 add failsafe value fix
filippomc Nov 22, 2024
c4989d4
CH-162 fix comments
filippomc Nov 22, 2024
1447db6
CH-162 another helm fix attempt
filippomc Nov 22, 2024
cd42d55
CH-163 fix template
filippomc Nov 22, 2024
81f5dfb
CH-157 Fixed typo in asgi and wsgi
condar-metacell Dec 9, 2024
a441b95
CH-157 Fixed issue with incorrect django settings module for asgi
condar-metacell Dec 9, 2024
23a6fed
CH-157 Change name of frontend build stage to be more generic
condar-metacell Dec 9, 2024
4dd9656
Merge pull request #787 from MetaCell/fix/CH-166
filippomc Dec 12, 2024
46188bb
Merge branch 'fix/CH-166' of github.com:MetaCell/cloud-harness into d…
filippomc Dec 19, 2024
2a4bd6e
CH-166 fix syntax issue
filippomc Jan 7, 2025
55f6362
Merge branch 'fix/CH-166' into develop
filippomc Jan 8, 2025
6e1dee3
CH-170 fix secrets upgrade
filippomc Jan 14, 2025
04aa612
CH-170 fix secrets upgrade -- bad push
filippomc Jan 14, 2025
b101e44
CH-170 fix secrets upgrade -- bad push
filippomc Jan 15, 2025
53d68ee
CH-170 fix secrets upgrade possible reset
filippomc Jan 15, 2025
77852b7
CH-170 fix for empty secrets reset
filippomc Jan 16, 2025
80c7236
Fix e2e tests run
filippomc Jan 16, 2025
b8ca1e3
CH-170 fix secrets upgrade error
filippomc Jan 16, 2025
afd7c80
Merge branch 'feature/ch-157' of github.com:MetaCell/cloud-harness in…
filippomc Jan 20, 2025
5432c84
CH-157 refactor, small fixes
filippomc Jan 21, 2025
8176368
Update version numbers
filippomc Jan 21, 2025
6a6b5f3
Add app manifests, update versions
filippomc Jan 21, 2025
c5a64e9
Add app manifests, update versions
filippomc Jan 21, 2025
2af2217
CH-157 refactor, docs, enhancements
filippomc Jan 21, 2025
0801787
Fix puppeteer not working in codefresh
filippomc Jan 21, 2025
5bd4b73
#792 Small code style tweaks
filippomc Jan 24, 2025
08b3716
CH-169 implement application build exclusion based on image param
filippomc Jan 24, 2025
4cae093
CH-169 tests and fixes
filippomc Jan 31, 2025
8e4f088
CH-134 remove nfs build
filippomc Jan 31, 2025
116ba73
Test pipeline tweak
filippomc Jan 31, 2025
67fdf62
Test pipeline tweak
filippomc Jan 31, 2025
60cded6
#792 fix template description
filippomc Feb 12, 2025
33c6e2b
bumping versions up
ddelpiano Mar 12, 2025
b073811
small refactoring for harness-generate
ddelpiano Mar 13, 2025
2d03fd8
documentation review and changes
ddelpiano Mar 13, 2025
6eeaf32
documentation edits
ddelpiano Mar 13, 2025
21b19bd
Merge pull request #795 from MetaCell/feature/CH-174
filippomc Mar 13, 2025
423145a
CH-169 try fix keycloak starting issue
filippomc Mar 14, 2025
169de78
CH-169 try fix keycloak starting issue
filippomc Mar 14, 2025
29d9cef
CH-169 try fix keycloak starting issue
filippomc Mar 14, 2025
ec5b8c1
CH-169 try fix keycloak starting issue
filippomc Mar 14, 2025
14af0b6
CH-169 try fix keycloak starting issue
filippomc Mar 15, 2025
c882f43
Merge pull request #794 from MetaCell/feature/CH-169
filippomc Mar 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/lint-check.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: Lint Check

on:
push
pull_request:
# The branches below must be a subset of the branches above
branches: [ develop ]

jobs:
lint:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ node_modules
*.DS_Store
deployment/helm
deployment/compose
docker-compose.yaml
/docker-compose.yaml
*.egg-info
*.idea
/build
Expand Down
69 changes: 42 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ Can scaffold and maintain your cloud solution on top of Cloudharness without wri
Kubernetes templates, with in place common utilities and applications already configured for you.

What building your cloud solution with CloudHarness gives to you:

- Common framework and utilities to develop and deploy micro-service application

- Helm chart automatic generation
- deployments
- services
Expand All @@ -23,11 +25,13 @@ What building your cloud solution with CloudHarness gives to you:
- databases (postgreql)
- access gatekeepers configuration
- secrets and configmaps

* Automatic build and push of images
* REST-API scaffolding building based on OpenApi
* Continuous deployment script generation
* Debug backend applications running on Kubernetes
* Python cluster access utilities

* Prebuilt support applications and shared library to:
* Log in and user management - based on Keycloak
* Submit batch and asynchronous workflows - based on Argo
Expand All @@ -43,17 +47,18 @@ What building your cloud solution with CloudHarness gives to you:

The microservice architecture is a great to get code separation and flexible development, but may not be of easy implementation, especially for small development teams/projects.
In particular, these questions may rise:
- How do I create a deployment for my microservices?
- How do I orchestrate my microservices?
- How to create consistent api documentation?
- Do I need to be an experienced devops to create a micro-service based application?
- Wouldn't it be nice to develop a plain database/backend/frontend application without infrastructure boilerplate but still be able to configure everything I want when needed?
- How to run batch operations like ETL processes easily and efficiently in a cloud environment?
- How to manage databases without being locked to a specific vendor solution?
- How to perform database backups?
- How to manage secret data?
- What about having a precounfigured account management application?
- Sooner rather than later I'll need an orchestration queue. Why not have that just ready to use?

- How do I create a deployment for my microservices?
- How do I orchestrate my microservices?
- How to create consistent api documentation?
- Do I need to be an experienced devops to create a micro-service based application?
- Wouldn't it be nice to develop a plain database/backend/frontend application without infrastructure boilerplate but still be able to configure everything I want when needed?
- How to run batch operations like ETL processes easily and efficiently in a cloud environment?
- How to manage databases without being locked to a specific vendor solution?
- How to perform database backups?
- How to manage secret data?
- What about having a precounfigured account management application?
- Sooner rather than later I'll need an orchestration queue. Why not have that just ready to use?

# Command line tools

Expand All @@ -63,30 +68,34 @@ CloudHarness provides the following command line tools to help application scaff
* `harness-application` - create a new CloudHarness REST application.
* `harness-generate` - generates server and client code for all CloudHarness REST applications.
* `harness-test` - run end to end tests

# Get started

## Prerequisites

### Operative system

Cloudharness can be used on all major operative systems.

- Linux: supported and tested
- MacOS: supported and tested
- Windows/WSL2: supported and tested
- Windows native: mostly working, unsupported

### Python
Python 3.9 must be installed.

Python 3.10+ must be installed.

It is recommended to setup a virtual environment.
With conda:

```bash
conda create --name ch python=3.12
conda activate ch
```

### Docker

[Docker](https://www.docker.com) is required to build locally.

### Kubernetes command line client
Expand All @@ -110,6 +119,7 @@ conda activate ch
A node environment with npm is required for developing web applications and to run end to end tests.

Recommended:

- node >= v14.0.0
- npm >= 8.0.0

Expand All @@ -120,26 +130,31 @@ A JRE is needed to run the code generators based on openapi-generator.
For more info, see [here](https://openapi-generator.tech/docs/installation).

## CloudHarness command line tools

To use the cli tools, install requirements first:

```bash
bash install.sh
```
### Generate deployment

To generate a deployment, run `harness-deployment`. See [below](#Deployment) for more.
### Create a new REST application

### Create new REST application
To create a new REST application, run `harness-application` from the root of your solution.
`harness-application` is a command-line tool used to create new applications based on predefined code templates. It allows users to quickly scaffold applications with backend, frontend, and database configurations.
More information can be found [here](./docs/applications/harness-application.md).

### Generate server and client code from openapi
To (re)generate the code for your applications, run `harness-generate` from the root.
The script will look for all openapi applications, and regenerate the Flask server code and documentation.
Note: the script will eventually override any manually modified file. To avoid that, define a file openapi-generator-ignore.

To (re)generate the code for your applications, run `harness-generate`.
`harness-generate` is a command-line tool used to generate client code, server stubs, and model libraries for applications.
More information can be found [here](./docs/applications/harness-generate.md)

### Generate deployment

To generate a deployment, run `harness-deployment`. See [below](#build-and-deploy) for more information.

# Extend CloudHarness to build your project

CloudHarness is born to be extended.
CloudHarness is born to be extended.

The quickest way to start is to install Cloud Harness, copy the *blueprint* folder and build from that with the cli tools, such as
`harness-application`, `harness-generate`, `harness-deployment`.
Expand All @@ -150,10 +165,11 @@ See the [developers documentation](docs/dev.md#start-your-project) for more info

The script `harness-deployment` scans your applications and configurations to create the build and deploy artifacts.
Created artifacts include:
- Helm chart (or docker compose configuration file)
- Skaffold build and run configuration
- Visual Studio Code debug and run configuration
- Codefresh pipeline yaml specification (optional)

- Helm chart (or docker compose configuration file)
- Skaffold build and run configuration
- Visual Studio Code debug and run configuration
- Codefresh pipeline yaml specification (optional)

With your project folder structure looking like

Expand Down Expand Up @@ -193,5 +209,4 @@ Then, you can selectively add files related to configuration that you want to pe

For more information about how to configure a deployment, see [here](./build-deploy/helm-configuration.md)


[![Codefresh build status]( https://g.codefresh.io/api/badges/pipeline/tarelli/Cloudharness%2Funittests?type=cf-1&key=eyJhbGciOiJIUzI1NiJ9.NWFkNzMyNDIzNjQ1YWMwMDAxMTJkN2Rl.-gUEkJxH6NCCIRgSIgEikVDte-Q0BsGZKEs4uahgpzs)]( https://g.codefresh.io/pipelines/edit/new/builds?id=6034cfce1036693697cd602b&pipeline=unittests&projects=Cloudharness&projectId=6034cfb83bb11c399e85c71b)
[![Codefresh build status](https://g.codefresh.io/api/badges/pipeline/tarelli/Cloudharness%2Funittests?type=cf-1&key=eyJhbGciOiJIUzI1NiJ9.NWFkNzMyNDIzNjQ1YWMwMDAxMTJkN2Rl.-gUEkJxH6NCCIRgSIgEikVDte-Q0BsGZKEs4uahgpzs)](https://g.codefresh.io/pipelines/edit/new/builds?id=6034cfce1036693697cd602b&pipeline=unittests&projects=Cloudharness&projectId=6034cfb83bb11c399e85c71b)
6 changes: 0 additions & 6 deletions application-templates/django-app/api/genapi.sh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from django.core.asgi import get_asgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "__APP_NAME__.settings")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_baseapp.settings")

application = get_asgi_application()

Expand All @@ -21,6 +21,6 @@
init_services()

# start the kafka event listener
from cloudharness_django.services.events import init_listner # noqa E402
from cloudharness_django.services.events import init_listener # noqa E402

init_listner()
init_listener()
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
init_services()

# start the kafka event listener
from cloudharness_django.services.events import init_listner # noqa E402
from cloudharness_django.services.events import init_listener # noqa E402

init_listner()
init_listener()
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ ENV APP_DIR=/app

WORKDIR ${APP_DIR}
COPY frontend/package.json ${APP_DIR}
COPY frontend/package-lock.json ${APP_DIR}
RUN npm ci
COPY frontend/yarn.lock ${APP_DIR}
RUN yarn install --frozen-lockfile --timeout 60000

COPY frontend ${APP_DIR}
RUN npm run build
RUN yarn build

#####

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ See [backend/README.md#Develop]

### Frontend

Backend code is inside the *frontend* directory.
Frontend code is inside the *frontend* directory.

Frontend is by default generated as a React web application, but no constraint about this specific technology.

Expand Down
4 changes: 4 additions & 0 deletions application-templates/django-fastapi/api/genapi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

ROOT_PATH=$(realpath "$(dirname "$BASH_SOURCE")/../../..")
harness-generate servers --app-name "__APP_NAME__" "$ROOT_PATH"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""MNP Checkout URL Configuration
"""URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.2/topics/http/urls/
Expand Down
35 changes: 35 additions & 0 deletions application-templates/django-ninja/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
ARG CLOUDHARNESS_FRONTEND_BUILD
ARG CLOUDHARNESS_DJANGO

FROM $CLOUDHARNESS_FRONTEND_BUILD AS frontend

ARG APP_DIR=/app

WORKDIR ${APP_DIR}
COPY frontend/package.json .
COPY frontend/yarn.lock .
RUN yarn install --timeout 60000

COPY frontend .
RUN yarn build

#####

FROM $CLOUDHARNESS_DJANGO

WORKDIR ${APP_DIR}
RUN mkdir -p ${APP_DIR}/static/www

COPY backend/requirements.txt ${APP_DIR}
RUN --mount=type=cache,target=/root/.cache python -m pip install --upgrade pip &&\
pip3 install --no-cache-dir -r requirements.txt --prefer-binary

COPY backend/requirements.txt backend/setup.py ${APP_DIR}
RUN python3 -m pip install -e .

COPY backend ${APP_DIR}
RUN python3 manage.py collectstatic --noinput

COPY --from=frontend /app/dist ${APP_DIR}/static/www

ENTRYPOINT uvicorn --workers ${WORKERS} --host 0.0.0.0 --port ${PORT} django_baseapp.asgi:application
Loading