Skip to content

Commit adf3f63

Browse files
authored
Merge pull request #5 from bcdev/yogesh-improve-part-2
Improve gaiaflow cookiecutter
2 parents 07dd134 + 366c57e commit adf3f63

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+347
-3627
lines changed

.github/workflows/gh_deploy.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,4 @@ cython_debug/
159159
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
160160
# and can be added to the global gitignore or merged into this file. For a more nuclear
161161
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
162-
#.idea/
162+
.idea/

README.md

Lines changed: 127 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,15 @@ is available [here](https://bcdev.github.io/gaiaflow/)
3030
The architecture below describes what we want to achieve as our MLOps framework.
3131
This is taken from the [Google Cloud Architecture Centre](https://cloud.google.com/architecture/mlops-continuous-delivery-and-automation-pipelines-in-machine-learning#mlops_level_2_cicd_pipeline_automation)
3232

33-
Currently what we support is the shown as green ticks.
33+
[//]: # (Currently what we support is the shown as green ticks.)
3434

35-
![Current Local MLOps Architecture](assets/mlops_arch.png)
35+
[//]: # ()
36+
[//]: # (![Current Local MLOps Architecture](assets/mlops_arch.png))
3637

3738
**Please note**:
38-
This framework has only been tested on Linux Ubuntu and Windows 11 and it works
39+
This framework has only been tested on Linux Ubuntu and Windows 11 using WSL2 and it works
3940
as expected.
40-
As we have not tested it yet on MacOS, we are not sure if it works in there.
41+
As we have not tested it yet on MacOS and directly on Windows, we are not sure if it works in there.
4142

4243
# Table of Contents
4344
- [Overview](#overview)
@@ -72,10 +73,6 @@ BC, integrating essential MLOps tools:
7273
You will get the following project when you use this template to get started with
7374
your ML project.
7475

75-
Any files or folders marked with `*` are off-limits—no need to change, modify,
76-
or even worry about them. Just focus on the ones without the mark!
77-
78-
Any files or folders marked with `^` can be extended, but carefully.
7976
```
8077
├── .github/ # GitHub Actions workflows (you are provided with a starter CI)
8178
├── dags/ # Airflow DAG definitions
@@ -97,18 +94,9 @@ Any files or folders marked with `^` can be extended, but carefully.
9794
├── README.md # Its a readme. Feel to change it!
9895
├── CHANGES.md # You put your changelog for every version here.
9996
├── pyproject.toml # Config file containing your package's build information and its metadata
100-
├── .env * ^ # Your environment variables that docker compose and python scripts can use (already added to .gitignore)
101-
├── .gitignore * ^ # Files to ignore when pushing to git.
102-
├── environment.yml # Libraries required for local mlops and your project
103-
├── mlops_manager.py * # Manager to manage the mlops services locally
104-
├── minikube_manager.py *# Manager to manage the kubernetes cluster locally
105-
├── docker-compose.yml * # Docker compose that spins up all services locally for MLOps
106-
├── utils.py * # Utility function to get the minikube gateway IP required for testing.
107-
├── docker_config.py * # Utility function to get the docker image name based on your project.
108-
├── kube_config_inline * # This file is needed for Airflow to communicate with Minikube when testing locally in a prod env.
109-
├── airflow_test.cfg * # This file is needed for testing your airflow dags.
110-
├── Dockerfile ^ # Dockerfile for your package.
111-
└── dockerfiles/ * # Dockerfiles required by Docker compose
97+
├── .env # Your environment variables that docker compose and python scripts can use (already added to .gitignore)
98+
├── .gitignore # Files to ignore when pushing to git.
99+
└── environment.yml # Libraries required for local mlops and your project
112100
```
113101

114102

@@ -211,32 +199,128 @@ have been tried and tested.
211199

212200
If you face any issues, please check out the [troubleshooting section](#troubleshooting)
213201

202+
203+
---
214204
### Prerequisites
215205

216-
- Docker and Docker Compose
217-
- [Mamba](https://github.com/conda-forge/miniforge) - Please make sure you
218-
install `Python 3.12` as this repository has been tested with that version.
219-
- [Minikube on Linux](https://minikube.sigs.k8s.io/docs/start/?arch=%2Flinux%2Fx86-64%2Fstable%2Fbinary+download)
220-
- [Minikube on Windows](https://minikube.sigs.k8s.io/docs/start/?arch=%2Fwindows%2Fx86-64%2Fstable%2F.exe+download)
206+
> **Note:** These steps are required only once during setup. You may need to update individual components later, but you won’t need to repeat the full installation process.
221207
222-
#### Docker and Docker compose plugin Installation
208+
- Docker and Docker Compose
209+
- [Mamba](https://github.com/conda-forge/miniforge) – Please make sure you install **Python 3.12**, as this repository has been tested with that version.
210+
- [Minikube on Linux](https://minikube.sigs.k8s.io/docs/start/?arch=%2Flinux%2Fx86-64%2Fstable%2Fbinary+download)
211+
- [Minikube on Windows](https://minikube.sigs.k8s.io/docs/start/?arch=%2Fwindows%2Fx86-64%2Fstable%2F.exe+download)
223212

224-
For Linux users: please follow the steps mentioned in this [link](https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository)
213+
---
225214

226-
For Windows users: please follow the steps mentioned in this [link](https://docs.docker.com/desktop/setup/install/windows-install/)
215+
#### Docker and Docker Compose Plugin Installation
227216

228-
This should install both Docker and Docker compose plugin.
229-
You can verify the installation by these commands
230-
```bash
231-
docker --version
232-
docker compose version
233-
```
234-
and output would be something like:
235-
```commandline
236-
Docker version 27.5.1, build 9f9e405
237-
Docker Compose version v2.32.4
238-
```
239-
This means now you have successfully installed Docker.
217+
**For Linux users:** Follow the steps in the official Docker guide:
218+
https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository
219+
220+
**For Windows users:** Follow the steps in the official Docker Desktop guide:
221+
https://docs.docker.com/desktop/setup/install/windows-install/
222+
223+
- On Windows, make sure to use the **WSL2 version** in the system requirements.
224+
- This installation will also include the **Docker Compose plugin**.
225+
226+
Verify the installation by running:
227+
228+
docker --version
229+
docker compose version
230+
231+
Expected output will look similar to:
232+
233+
Docker version 27.5.1, build 9f9e405
234+
Docker Compose version v2.32.4
235+
236+
If you see something like the above, Docker is successfully installed.
237+
238+
---
239+
240+
#### Install WSL2 (Windows only)
241+
242+
Follow the official Microsoft instructions:
243+
https://learn.microsoft.com/en-us/windows/wsl/install
244+
245+
Run the following command in **PowerShell (Admin mode):**
246+
247+
wsl --install
248+
249+
After installation, log in to Ubuntu with:
250+
251+
wsl.exe -d Ubuntu
252+
253+
254+
NOTE: If there are any issues installing WSL2, see if this guide helps,
255+
if not contact us.
256+
https://allthings.how/how-to-install-virtual-machine-platform-in-optional-windows-features-on-windows-11/
257+
258+
---
259+
260+
#### Install Mamba (Miniforge) inside WSL2 / Linux
261+
262+
Follow instructions here:
263+
https://github.com/conda-forge/miniforge
264+
265+
Run inside your terminal:
266+
267+
curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
268+
269+
bash Miniforge3-$(uname)-$(uname -m).sh
270+
---
271+
272+
#### Install Minikube inside WSL2 / Linux
273+
274+
Official guide:
275+
https://minikube.sigs.k8s.io/docs/start/?arch=%2Flinux%2Fx86-64%2Fstable%2Fbinary+download
276+
277+
Run inside your terminal:
278+
279+
curl -LO https://github.com/kubernetes/minikube/releases/latest/download/minikube-linux-amd64
280+
sudo install minikube-linux-amd64 /usr/local/bin/minikube
281+
rm minikube-linux-amd64
282+
283+
---
284+
285+
#### Verify Installations
286+
287+
Inside your terminal (Linux or WSL2), check:
288+
289+
docker # should print Docker help page
290+
minikube # should print Minikube help page
291+
mamba # should print Mamba help page
292+
ls -la /var/run/docker.sock # should print socket permissions
293+
294+
If `/var/run/docker.sock` does not appear or has wrong permissions, adjust Docker Desktop settings (Windows only):
295+
- **Settings → General → Use WSL**
296+
- **Settings → Resources → WSL Integration → Enable Ubuntu**
297+
298+
---
299+
300+
#### Configure Docker Permissions inside WSL2
301+
302+
Add your user to the docker group:
303+
304+
sudo usermod -aG docker $USER
305+
306+
Apply the group changes immediately:
307+
308+
newgrp docker
309+
310+
Alternatively, log out and back into your terminal session:
311+
312+
exit
313+
wsl -d Ubuntu-20.04 # Windows only
314+
315+
---
316+
317+
#### Fix Docker Socket Permissions (if needed)
318+
319+
If necessary, run:
320+
321+
sudo chmod 777 /var/run/docker.sock
322+
323+
---
240324

241325

242326
Once the pre-requisites are done, you can go ahead with the project creation:
@@ -255,7 +339,9 @@ Once the pre-requisites are done, you can go ahead with the project creation:
255339
When prompted for input, enter the details requested. If you dont provide any
256340
input for a given choice, the first choice from the list is taken as the default.
257341

258-
Once the project is created, please read the [user guide](https://bcdev.github.io/gaiaflow/dev/).
342+
Once the project is created, please read the [user guide](https://bcdev.github.io/gaiaflow/dev_guide/).
343+
344+
---
259345

260346

261347
## Troubleshooting
@@ -332,20 +418,3 @@ If you face any other problems not mentioned above, please reach out to us.
332418
- [Minio](https://min.io/docs/minio/container/index.html)
333419
- [JupyterLab](https://jupyterlab.readthedocs.io/)
334420
- [Minikube](https://minikube.sigs.k8s.io/docs/)
335-
336-
337-
### TODO:
338-
339-
Make ECR work. How to add credentials?
340-
341-
S3 credentials access?
342-
343-
Add sensor based DAGs
344-
345-
Update CI to use ECR credentials.
346-
347-
How to share Secrets?
348-
349-
Monitoring Airflow
350-
351-
MLFlow Deployment

docs/assets/airflow_dev_mode.png

-15.5 KB
Binary file not shown.
-16.4 KB
Binary file not shown.

docs/assets/dev.png

-138 KB
Binary file not shown.

docs/assets/gaiaflow.png

-1.3 MB
Binary file not shown.

docs/assets/prod.png

-134 KB
Binary file not shown.

docs/assets/prod_local.png

-141 KB
Binary file not shown.

0 commit comments

Comments
 (0)