{"id":25743843,"url":"https://github.com/leoho0722/mnist-openfaas-example","last_synced_at":"2026-04-09T20:50:29.878Z","repository":{"id":225311679,"uuid":"765623305","full_name":"leoho0722/mnist-openfaas-example","owner":"leoho0722","description":"Example for MLOps Pipeline using OpenFaaS Functions and MNIST handwritten CNN model","archived":false,"fork":false,"pushed_at":"2024-04-13T12:22:18.000Z","size":84,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-04-14T02:28:27.837Z","etag":null,"topics":["kubernetes","mlops","mnist","openfaas","openfaas-function","pipeline"],"latest_commit_sha":null,"homepage":"https://leoho0722.github.io/docs-repo/mnist-openfaas-example.html","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leoho0722.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-03-01T09:41:49.000Z","updated_at":"2024-04-13T12:20:19.000Z","dependencies_parsed_at":"2024-03-28T12:45:41.454Z","dependency_job_id":"95a88237-a3eb-472f-90f0-ec118c50b325","html_url":"https://github.com/leoho0722/mnist-openfaas-example","commit_stats":null,"previous_names":["leoho0722/mnist-openfaas-example"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leoho0722%2Fmnist-openfaas-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leoho0722%2Fmnist-openfaas-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leoho0722%2Fmnist-openfaas-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leoho0722%2Fmnist-openfaas-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leoho0722","download_url":"https://codeload.github.com/leoho0722/mnist-openfaas-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240834207,"owners_count":19865281,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["kubernetes","mlops","mnist","openfaas","openfaas-function","pipeline"],"created_at":"2025-02-26T10:30:57.458Z","updated_at":"2026-04-09T20:50:24.844Z","avatar_url":"https://github.com/leoho0722.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mnist-openfaas-example\n\n## Environment Install\n\n### Docker\n\n[Docker Official Documentation](https://docs.docker.com/engine/install/ubuntu/)\n\n#### Install Docker Engine on Ubuntu\n\n* Step 1: Set up Docker's apt repository.\n\n```shell\n# Add Docker's official GPG key:\nsudo apt-get update\nsudo apt-get install ca-certificates curl\nsudo install -m 0755 -d /etc/apt/keyrings\nsudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc\nsudo chmod a+r /etc/apt/keyrings/docker.asc\n\n# Add the repository to Apt sources:\necho \\\n  \"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \\\n  $(. /etc/os-release \u0026\u0026 echo \"$VERSION_CODENAME\") stable\" | \\\n  sudo tee /etc/apt/sources.list.d/docker.list \u003e /dev/null\nsudo apt-get update\n```\n\n* Step 2: Install the Docker packages.\n\n```shell\nsudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin\n```\n\n### OpenFaaS\n\nSee [openfaas-example README.md](https://github.com/leoho0722/openfaas-example/blob/main/README.md)\n\n#### OpenFaaS Command Line Tool (faas-cli)\n\n* macOS\n  * ```brew install faas-cli```\n* Ubuntu\n  * Root user\n    * ```curl -sSL https://cli.openfaas.com | sudo -E sh```\n  * Non root user\n    * ```curl -sSL https://cli.openfaas.com | sh```\n\n#### Kubernetes\n\n* Step 1: Create Kubernetes Namespace\n\n    ```shell\n    kubectl apply -f https://raw.githubusercontent.com/openfaas/faas-netes/master/namespaces.yml\n    ```\n\n* Step 2: Helm charts\n\n    ```shell\n    helm repo add openfaas https://openfaas.github.io/faas-netes/\n    helm repo update\n    helm upgrade openfaas --install openfaas/openfaas --namespace openfaas\n    ```\n\n* (**Optional**) Step 3: Expose OpenFaaS Gateway Service to LoadBalancer\n\n    ```shell\n    kubectl patch svc gateway-external -n openfaas -p '{\"spec\":{\"type\": \"LoadBalancer\"}}'\n    ```\n\n* Step 4: Get OpenFaaS admin Password\n\n    ```shell\n    PASSWORD=$(kubectl -n openfaas get secret basic-auth -o jsonpath=\"{.data.basic-auth-password}\" | base64 --decode) \u0026\u0026 \\\n    echo \"OpenFaaS admin password: $PASSWORD\"\n    ```\n\n* Step 5: Login OpenFaaS WebUI via credential\n\n    ```shell\n    # Default gateway endpoint is http://127.0.0.1:8080\n    faas-cli login -u admin -p $PASSWORD\n\n    # Specify gateway endpoint, for example http://10.0.0.156:31112\n    faas-cli login -u admin -p $PASSWORD -g http://10.0.0.156:31112\n    ```\n\n### MinIO Server\n\n[MinIO Official Documentation](https://min.io/docs/minio/linux/index.html)\n\n#### Install\n\n* Ubuntu\n\n  ```shell\n  wget https://dl.min.io/server/minio/release/linux-amd64/archive/minio_20240305044844.0.0_amd64.deb -O minio.deb\n  sudo dpkg -i minio.deb\n  ```\n\n#### Launch\n\n```shell\nmkdir ~/minio\nminio server ~/minio --console-address :9001\n```\n\n#### Connect browser to MinIO Server\n\nMinIO WebUI default account: minioadmin\nMinIO WebUI default password: minioadmin\n\n```text\nhttp://\u003cHOST_IP\u003e:9001\n\n# Example\n# http://10.0.0.156:9001\n```\n\n### MinIO Client\n\n[MinIO Official Documentation](https://min.io/docs/minio/linux/index.html)\n\n#### Install\n\n```shell\nwget https://dl.min.io/client/mc/release/linux-amd64/mc\nchmod +x mc\nsudo mv mc /usr/local/bin/mc\n```\n\n#### Config\n\n```shell\nmc alias set \u003cALIAS_NAME\u003e http://\u003cHOST_IP\u003e:9000 \u003cACCESS_KEY\u003e \u003cSECRET_KEY\u003e \nmc admin info \u003cALIAS_NAME\u003e\n\n# Example\n# mc alias set local http://10.0.0.156:9000 minioadmin minioadmin\n# mc admin info local\n```\n\n##### Python Client API\n\n[MinIO Python Client API Official Documentation](https://min.io/docs/minio/linux/developers/python/API.html)\n\n```python\nfrom minio import Minio\n\ndef connect_minio():\n    \"\"\"Connect to MinIO Server\"\"\"\n\n    MINIO_API_ENDPOINT = os.environ[\"minio_api_endpoint\"]\n    MINIO_ACCESS_KEY = os.environ[\"minio_access_key\"]\n    MINIO_SECRET_KEY = os.environ[\"minio_secret_key\"]\n\n    return Minio(\n        MINIO_API_ENDPOINT,\n        access_key=MINIO_ACCESS_KEY,\n        secret_key=MINIO_SECRET_KEY,\n        secure=False # Disable HTTPS\n    )\n```\n\n## Build, Push, Deploy, Remove OpenFaaS Functions\n\n### One-key to build, push, deploy (**Recommand**)\n\n```shell\n# Default architecture is amd64\nmake faas-up\n\n# Specify architecture, for example arm64\nmake faas-up ARCH=arm64\n```\n\n### Manual\n\n* Build\n\n    ```shell\n    # Default architecture is amd64\n    make faas-build\n\n    # Specify architecture, for example arm64\n    make faas-build ARCH=arm64\n    ```\n\n* Push\n\n    ```shell\n    # Default architecture is amd64\n    make faas-push\n\n    # Specify architecture, for example arm64\n    make faas-push ARCH=arm64\n    ```\n\n* Deploy\n\n    ```shell\n    # Default architecture is amd64\n    make faas-deploy\n\n    # Specify architecture, for example arm64\n    make faas-deploy ARCH=arm64\n    ```\n\n* Remove\n\n    ```shell\n    # Default architecture is amd64\n    make faas-remove\n\n    # Specify architecture, for example arm64\n    make faas-remove ARCH=arm64\n    ```\n\n## References\n\n1. \u003chttps://neptune.ai/blog/saving-trained-model-in-python\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleoho0722%2Fmnist-openfaas-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleoho0722%2Fmnist-openfaas-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleoho0722%2Fmnist-openfaas-example/lists"}