Browse your Git repositories
# Simple Notes App
A simple notes application built with Python Flask that allows you to create, view, and delete notes.
## Features
- β¨ Create and delete notes
- πΎ Persistent storage with JSON file
- π¨ Beautiful gradient UI
- π REST API endpoints
- β€οΈ Health check endpoint
- π³ Fully containerized
- βΈοΈ Kubernetes-ready with Traefik ingress
## Local Development
### Prerequisites
- Python 3.11+
- pip
### Run Locally
```bash
cd notes-app
pip install -r requirements.txt
python app.py
```
Visit `http://localhost:5000`
## Docker
### Build Image
```bash
docker build -t notes-app:latest .
```
### Run Container
```bash
docker run -d \
-p 5000:5000 \
-v $(pwd)/data:/data \
--name notes-app \
notes-app:latest
```
## Kubernetes Deployment
### Prerequisites
- Kubernetes cluster
- Traefik ingress controller
- cert-manager with configured issuer
### Deploy
1. Update the domain in `kubernetes.yaml`:
- Change `notes.codeuwu.com` to your domain
2. Update the image registry:
- Change `your-registry/notes-app:latest` to your actual registry
3. Apply the manifest:
```bash
kubectl apply -f kubernetes.yaml
```
### What's Included
The Kubernetes manifest includes:
- **PersistentVolumeClaim**: 1Gi storage for notes data
- **Deployment**: Flask app with health checks
- **Service**: ClusterIP service on port 80
- **Ingress**: Traefik ingress with automatic TLS via cert-manager
## API Endpoints
- `GET /` - Web interface
- `GET /api/notes` - Get all notes (JSON)
- `POST /api/notes` - Create a note (JSON)
- `POST /add` - Add note via form
- `POST /delete/<id>` - Delete a note
- `GET /health` - Health check
## Building with Kaniko
### β οΈ Important: ARM64 Architecture
Your Kubernetes cluster is running on **ARM64** architecture. You must build images for ARM64.
### Option 1: Build in Forgejo CI/CD (Recommended)
If your Forgejo runner is ARM64, use `.forgejo/workflows/build.yaml`:
```yaml
name: Build Notes App
on: [push]
jobs:
build:
runs-on: dind # Make sure this runner is ARM64
steps:
- uses: actions/checkout@v4
- name: Create Docker config
run: |
mkdir -p $(pwd)/.docker
AUTH=$(echo -n "${{ secrets.HARBOR_USERNAME }}:${{ secrets.HARBOR_PASSWORD }}" | base64 -w 0)
echo "{\"auths\":{\"harbor.kratov.luiv.dev\":{\"auth\":\"${AUTH}\"}}}" > $(pwd)/.docker/config.json
- name: Build and push with Kaniko for ARM64
run: |
docker run --rm \
-v $(pwd)/notes-app:/workspace \
-v $(pwd)/.docker:/kaniko/.docker:ro \
martizih/kaniko:v1.26.4 \
--context /workspace \
--dockerfile /workspace/Dockerfile \
--destination harbor.kratov.luiv.dev/luna_priv/notes:latest \
--cache=true \
--custom-platform=linux/arm64
```
### Option 2: Build on x86_64 with Buildx
If you have Docker Buildx installed:
```bash
docker buildx create --use --name arm-builder
docker buildx build \
--platform linux/arm64 \
-t harbor.kratov.luiv.dev/luna_priv/notes:latest \
--push \
notes-app/
```
### Option 3: Build Directly on an ARM64 Machine
SSH into one of your Kubernetes nodes or an ARM64 machine and build there.
## Storage
Notes are stored in `/data/notes.json` as a JSON array. In Kubernetes, this is backed by a PersistentVolumeClaim to ensure data persists across pod restarts.