From 19afa660dada2c2b935bd3c7764928404fb66a2c Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 02:10:52 +0200 Subject: [PATCH 01/61] Fix form border --- .../js/components/Display/InlineForm.tsx | 91 ++++++++++--------- resources/js/components/Display/StatsBox.tsx | 10 +- resources/js/components/ui/ComponentTitle.tsx | 15 +++ resources/js/pages/dashboard.tsx | 37 ++++---- 4 files changed, 85 insertions(+), 68 deletions(-) create mode 100644 resources/js/components/ui/ComponentTitle.tsx diff --git a/resources/js/components/Display/InlineForm.tsx b/resources/js/components/Display/InlineForm.tsx index 9d6b693..fe189bc 100644 --- a/resources/js/components/Display/InlineForm.tsx +++ b/resources/js/components/Display/InlineForm.tsx @@ -3,6 +3,7 @@ import AddPurchaseForm from '@/components/Transactions/AddPurchaseForm'; import UpdatePriceForm from '@/components/Pricing/UpdatePriceForm'; import { cn } from '@/lib/utils'; import { X } from 'lucide-react'; +import ComponentTitle from '@/components/ui/ComponentTitle'; interface InlineFormProps { type: 'purchase' | 'milestone' | 'price' | null; @@ -13,66 +14,66 @@ interface InlineFormProps { className?: string; } -export default function InlineForm({ - type, - onClose, +export default function InlineForm({ + type, + onClose, onPurchaseSuccess, onMilestoneSuccess, onPriceSuccess, - className + className }: InlineFormProps) { if (!type) return null; const title = type === 'purchase' ? 'ADD PURCHASE' : type === 'milestone' ? 'ADD MILESTONE' : 'UPDATE PRICE'; return ( -
{/* Header */} -
-

- {title} -

- -
+
+
+ {title} - {/* Form Content */} -
- {type === 'purchase' ? ( - { - if (onPurchaseSuccess) onPurchaseSuccess(); - onClose(); - }} - /> - ) : type === 'milestone' ? ( - { - if (onMilestoneSuccess) onMilestoneSuccess(); - onClose(); - }} - /> - ) : ( - { - if (onPriceSuccess) onPriceSuccess(); - onClose(); - }} - /> - )} + +
+ + {/* Form Content */} +
+ {type === 'purchase' ? ( + { + if (onPurchaseSuccess) onPurchaseSuccess(); + onClose(); + }} + /> + ) : type === 'milestone' ? ( + { + if (onMilestoneSuccess) onMilestoneSuccess(); + onClose(); + }} + /> + ) : ( + { + if (onPriceSuccess) onPriceSuccess(); + onClose(); + }} + /> + )} +
); -} \ No newline at end of file +} diff --git a/resources/js/components/Display/StatsBox.tsx b/resources/js/components/Display/StatsBox.tsx index eafa4aa..1fc6a23 100644 --- a/resources/js/components/Display/StatsBox.tsx +++ b/resources/js/components/Display/StatsBox.tsx @@ -1,6 +1,7 @@ import { cn } from '@/lib/utils'; import { Plus, ChevronRight } from 'lucide-react'; import { useState } from 'react'; +import ComponentTitle from '@/components/ui/ComponentTitle'; interface Milestone { target: number; @@ -72,9 +73,8 @@ export default function StatsBox({
{/* STATS Title and Current Price */}
-

- STATS -

+ Stats +
{stats.currentPrice && (
@@ -185,8 +185,8 @@ export default function StatsBox({ key={index} className={cn( isSelectedMilestone - ? "text-red-500 font-bold" - : "bg-red-500 text-black" + ? "bg-red-500 text-black" + : "text-red-500 font-bold" )} > diff --git a/resources/js/components/ui/ComponentTitle.tsx b/resources/js/components/ui/ComponentTitle.tsx new file mode 100644 index 0000000..7c39a62 --- /dev/null +++ b/resources/js/components/ui/ComponentTitle.tsx @@ -0,0 +1,15 @@ +import { FC, ReactNode } from 'react'; + +interface ComponentTitleProps { + children: ReactNode; +} + +const ComponentTitle: FC = ({ children }) => { + return ( +

+ { children } +

+ ) +} + +export default ComponentTitle diff --git a/resources/js/pages/dashboard.tsx b/resources/js/pages/dashboard.tsx index 6753014..23c7449 100644 --- a/resources/js/pages/dashboard.tsx +++ b/resources/js/pages/dashboard.tsx @@ -27,11 +27,11 @@ export default function Dashboard() { total_investment: 0, average_cost_per_share: 0, }); - + const [priceData, setPriceData] = useState({ current_price: null, }); - + const [milestones, setMilestones] = useState([]); const [selectedMilestoneIndex, setSelectedMilestoneIndex] = useState(0); const [showProgressBar, setShowProgressBar] = useState(false); @@ -121,14 +121,14 @@ export default function Dashboard() { // Calculate portfolio stats - const currentValue = priceData.current_price - ? purchaseData.total_shares * priceData.current_price + const currentValue = priceData.current_price + ? purchaseData.total_shares * priceData.current_price : undefined; - - const profitLoss = currentValue - ? currentValue - purchaseData.total_investment + + const profitLoss = currentValue + ? currentValue - purchaseData.total_investment : undefined; - + const profitLossPercentage = profitLoss && purchaseData.total_investment > 0 ? (profitLoss / purchaseData.total_investment) * 100 : undefined; @@ -168,36 +168,37 @@ export default function Dashboard() { const handleProgressClick = () => { setShowStatsBox(!showStatsBox); + setActiveForm(null) }; return ( <> - + {/* Stacked Layout */}
{/* Box 1: LED Number Display - Fixed position from top */}
-
- + {/* Box 2: Progress Bar (toggleable) */} -
- +
- + {/* Box 3: Stats Box (toggleable) */} -
- + setActiveForm('price')} />
- + {/* Box 4: Forms (only when active form is set) */} -
+
setActiveForm(null)} -- 2.45.2 From c4c21f689c4934b46360c473d518ef1d6c346559 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 04:06:37 +0200 Subject: [PATCH 02/61] Style forms --- resources/css/app.css | 9 +++ .../js/components/Display/InlineForm.tsx | 17 ++---- .../js/components/Display/ProgressBar.tsx | 2 +- resources/js/components/Display/StatsBox.tsx | 2 +- .../Milestones/AddMilestoneForm.tsx | 45 +++++++++----- .../js/components/Pricing/UpdatePriceForm.tsx | 59 +++++++++++-------- .../Transactions/AddPurchaseForm.tsx | 59 ++++++++++++------- 7 files changed, 118 insertions(+), 75 deletions(-) diff --git a/resources/css/app.css b/resources/css/app.css index 912a683..1760079 100644 --- a/resources/css/app.css +++ b/resources/css/app.css @@ -16,6 +16,15 @@ .font-digital { font-family: '7Segment', monospace; } +.glow-red { + box-shadow: 0 0 20px rgba(239, 68, 68, 0.4); + transition: box-shadow 300ms ease; +} + +.glow-red:hover { + box-shadow: 0 0 25px rgba(239, 68, 68, 0.6); +} + @custom-variant dark (&:is(.dark *)); @theme { diff --git a/resources/js/components/Display/InlineForm.tsx b/resources/js/components/Display/InlineForm.tsx index fe189bc..7dd4ca8 100644 --- a/resources/js/components/Display/InlineForm.tsx +++ b/resources/js/components/Display/InlineForm.tsx @@ -2,7 +2,6 @@ import AddMilestoneForm from '@/components/Milestones/AddMilestoneForm'; import AddPurchaseForm from '@/components/Transactions/AddPurchaseForm'; import UpdatePriceForm from '@/components/Pricing/UpdatePriceForm'; import { cn } from '@/lib/utils'; -import { X } from 'lucide-react'; import ComponentTitle from '@/components/ui/ComponentTitle'; interface InlineFormProps { @@ -35,18 +34,7 @@ export default function InlineForm({ )} > {/* Header */} -
-
- {title} - - -
+
{/* Form Content */}
@@ -56,6 +44,7 @@ export default function InlineForm({ if (onPurchaseSuccess) onPurchaseSuccess(); onClose(); }} + onCancel={onClose} /> ) : type === 'milestone' ? ( ) : ( )}
diff --git a/resources/js/components/Display/ProgressBar.tsx b/resources/js/components/Display/ProgressBar.tsx index 05fdf7e..4343cb5 100644 --- a/resources/js/components/Display/ProgressBar.tsx +++ b/resources/js/components/Display/ProgressBar.tsx @@ -43,7 +43,7 @@ export default function ProgressBar({ {/* Progress Bar Container */}
{/* Old-school progress bar with overlaid text */} -
+
{/* Inner container */}
{/* Progress fill */} diff --git a/resources/js/components/Display/StatsBox.tsx b/resources/js/components/Display/StatsBox.tsx index 1fc6a23..4d5a59f 100644 --- a/resources/js/components/Display/StatsBox.tsx +++ b/resources/js/components/Display/StatsBox.tsx @@ -70,7 +70,7 @@ export default function StatsBox({ className )} > -
+
{/* STATS Title and Current Price */}
Stats diff --git a/resources/js/components/Milestones/AddMilestoneForm.tsx b/resources/js/components/Milestones/AddMilestoneForm.tsx index 629831f..8433bf0 100644 --- a/resources/js/components/Milestones/AddMilestoneForm.tsx +++ b/resources/js/components/Milestones/AddMilestoneForm.tsx @@ -5,6 +5,7 @@ import InputError from '@/components/InputError'; import { useForm } from '@inertiajs/react'; import { LoaderCircle } from 'lucide-react'; import { FormEventHandler } from 'react'; +import ComponentTitle from '@/components/ui/ComponentTitle'; interface MilestoneFormData { target: string; @@ -14,9 +15,10 @@ interface MilestoneFormData { interface AddMilestoneFormProps { onSuccess?: () => void; + onCancel?: () => void; } -export default function AddMilestoneForm({ onSuccess }: AddMilestoneFormProps) { +export default function AddMilestoneForm({ onSuccess, onCancel }: AddMilestoneFormProps) { const { data, setData, post, processing, errors, reset } = useForm({ target: '', description: '', @@ -36,11 +38,12 @@ export default function AddMilestoneForm({ onSuccess }: AddMilestoneFormProps) { }; return ( -
+
+ ADD MILESTONE
- + setData('target', e.target.value)} - className="bg-black border-red-500/30 text-red-400 focus:border-red-400 placeholder:text-red-400/30" + className="bg-black border-red-500 text-red-400 focus:border-red-300 font-mono text-sm rounded-none border-2 focus:ring-0 focus:outline-none placeholder:text-red-400/40 transition-all glow-red" />
- + setData('description', e.target.value)} - className="bg-black border-red-500/30 text-red-400 focus:border-red-400 placeholder:text-red-400/30" + className="bg-black border-red-500 text-red-400 focus:border-red-300 font-mono text-sm rounded-none border-2 focus:ring-0 focus:outline-none placeholder:text-red-400/40 transition-all glow-red" />
- +
+ + {onCancel && ( + + )} +
); -} \ No newline at end of file +} diff --git a/resources/js/components/Pricing/UpdatePriceForm.tsx b/resources/js/components/Pricing/UpdatePriceForm.tsx index bd18cb9..fe99e3b 100644 --- a/resources/js/components/Pricing/UpdatePriceForm.tsx +++ b/resources/js/components/Pricing/UpdatePriceForm.tsx @@ -1,11 +1,11 @@ import { Button } from '@/components/ui/button'; -import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import InputError from '@/components/InputError'; import { useForm } from '@inertiajs/react'; import { LoaderCircle } from 'lucide-react'; import { FormEventHandler } from 'react'; +import ComponentTitle from '@/components/ui/ComponentTitle'; interface PriceUpdateFormData { date: string; @@ -17,9 +17,10 @@ interface UpdatePriceFormProps { currentPrice?: number; className?: string; onSuccess?: () => void; + onCancel?: () => void; } -export default function UpdatePriceForm({ currentPrice, className, onSuccess }: UpdatePriceFormProps) { +export default function UpdatePriceForm({ currentPrice, className, onSuccess, onCancel }: UpdatePriceFormProps) { const { data, setData, post, processing, errors } = useForm({ date: new Date().toISOString().split('T')[0], // Today's date in YYYY-MM-DD format price: currentPrice?.toString() || '', @@ -38,31 +39,30 @@ export default function UpdatePriceForm({ currentPrice, className, onSuccess }: }; return ( - - - Update Asset Price +
+
+ UPDATE PRICE {currentPrice && ( -

- Current price: €{currentPrice.toFixed(4)} +

+ [CURRENT] €{currentPrice.toFixed(4)}

)} - -
- + setData('date', e.target.value)} max={new Date().toISOString().split('T')[0]} + className="bg-black border-red-500 text-red-400 focus:border-red-300 font-mono text-sm rounded-none border-2 focus:ring-0 focus:outline-none transition-all glow-red" />
- + setData('price', e.target.value)} + className="bg-black border-red-500 text-red-400 focus:border-red-300 font-mono text-sm rounded-none border-2 focus:ring-0 focus:outline-none focus:shadow-[0_0_10px_rgba(239,68,68,0.5)] placeholder:text-red-400/40 transition-all" /> -

- Price per unit/share of the asset +

+ [UNIT] price per share

- +
+ + {onCancel && ( + + )} +
-
- +
+
); } diff --git a/resources/js/components/Transactions/AddPurchaseForm.tsx b/resources/js/components/Transactions/AddPurchaseForm.tsx index 68732b2..c360177 100644 --- a/resources/js/components/Transactions/AddPurchaseForm.tsx +++ b/resources/js/components/Transactions/AddPurchaseForm.tsx @@ -5,6 +5,7 @@ import InputError from '@/components/InputError'; import { useForm } from '@inertiajs/react'; import { LoaderCircle } from 'lucide-react'; import { FormEventHandler, useEffect } from 'react'; +import ComponentTitle from '@/components/ui/ComponentTitle'; interface PurchaseFormData { date: string; @@ -16,9 +17,10 @@ interface PurchaseFormData { interface AddPurchaseFormProps { onSuccess?: () => void; + onCancel?: () => void; } -export default function AddPurchaseForm({ onSuccess }: AddPurchaseFormProps) { +export default function AddPurchaseForm({ onSuccess, onCancel }: AddPurchaseFormProps) { const { data, setData, post, processing, errors, reset } = useForm({ date: new Date().toISOString().split('T')[0], // Today's date in YYYY-MM-DD format shares: '', @@ -31,7 +33,7 @@ export default function AddPurchaseForm({ onSuccess }: AddPurchaseFormProps) { if (data.shares && data.price_per_share) { const shares = parseFloat(data.shares); const pricePerShare = parseFloat(data.price_per_share); - + if (!isNaN(shares) && !isNaN(pricePerShare)) { const totalCost = (shares * pricePerShare).toFixed(2); setData('total_cost', totalCost); @@ -54,24 +56,25 @@ export default function AddPurchaseForm({ onSuccess }: AddPurchaseFormProps) { }; return ( -
+
+ ADD PURCHASE
- + setData('date', e.target.value)} max={new Date().toISOString().split('T')[0]} - className="bg-black border-red-500/30 text-red-400 focus:border-red-400" + className="bg-black border-red-500 text-red-400 focus:border-red-300 font-mono text-sm rounded-none border-2 focus:ring-0 focus:outline-none transition-all glow-red" />
- + setData('shares', e.target.value)} - className="bg-black border-red-500/30 text-red-400 focus:border-red-400 placeholder:text-red-400/30" + className="bg-black border-red-500 text-red-400 focus:border-red-300 font-mono text-sm rounded-none border-2 focus:ring-0 focus:outline-none placeholder:text-red-400/40 transition-all glow-red" />
- + setData('price_per_share', e.target.value)} - className="bg-black border-red-500/30 text-red-400 focus:border-red-400 placeholder:text-red-400/30" + className="bg-black border-red-500 text-red-400 focus:border-red-300 font-mono text-sm rounded-none border-2 focus:ring-0 focus:outline-none placeholder:text-red-400/40 transition-all glow-red" />
- + setData('total_cost', e.target.value)} - className="bg-black border-red-500/30 text-red-400 focus:border-red-400 placeholder:text-red-400/30" + className="bg-black border-red-500 text-red-400 focus:border-red-300 font-mono text-sm rounded-none border-2 focus:ring-0 focus:outline-none placeholder:text-red-400/40 transition-all glow-red" /> -

- Auto-calculated from shares × price +

+ [AUTO-CALC] shares × price

- +
+ + {onCancel && ( + + )} +
); -} \ No newline at end of file +} -- 2.45.2 From 1fd3fa3f1893a8676869ad483bc3976b246b70a5 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 12:10:09 +0200 Subject: [PATCH 03/61] Containerize application --- docker/Dockerfile | 84 +++++++++++++++++++++++++++++++++++++++ docker/docker-compose.yml | 65 ++++++++++++++++++++++++++++++ docker/nginx.conf | 26 ++++++++++++ 3 files changed, 175 insertions(+) create mode 100644 docker/Dockerfile create mode 100644 docker/docker-compose.yml create mode 100644 docker/nginx.conf diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..9d46aca --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,84 @@ +# Multi-stage build for Laravel + React application +FROM node:20-alpine AS frontend-builder + +WORKDIR /app + +# Copy package files +COPY package*.json ./ + +# Install Node dependencies +RUN npm ci --only=production + +# Copy frontend source +COPY resources/ resources/ +COPY public/ public/ +COPY vite.config.ts ./ +COPY tsconfig.json ./ +COPY components.json ./ +COPY eslint.config.js ./ + +# Build frontend assets +RUN npm run build + +# PHP runtime stage +FROM php:8.2-fpm-alpine + +# Install system dependencies +RUN apk add --no-cache \ + git \ + curl \ + libpng-dev \ + libxml2-dev \ + zip \ + unzip \ + oniguruma-dev \ + mysql-client + +# Install PHP extensions +RUN docker-php-ext-install \ + pdo_mysql \ + mbstring \ + exif \ + pcntl \ + bcmath \ + gd + +# Install Composer +COPY --from=composer:latest /usr/bin/composer /usr/bin/composer + +# Set working directory +WORKDIR /var/www/html + +# Copy application code first +COPY . . + +# Install PHP dependencies after copying all files +RUN composer install --no-dev --optimize-autoloader --no-interaction + +# Copy built frontend assets from builder stage +COPY --from=frontend-builder /app/public/build/ ./public/build/ + +# Set proper permissions +RUN chown -R www-data:www-data /var/www/html \ + && chmod -R 755 /var/www/html/storage \ + && chmod -R 755 /var/www/html/bootstrap/cache + +# Create a startup script +RUN echo '#!/bin/sh' > /usr/local/bin/start-app \ + && echo 'cp -r /var/www/html/public/. /var/www/html/public_shared/ 2>/dev/null || true' >> /usr/local/bin/start-app \ + && echo 'php artisan config:cache' >> /usr/local/bin/start-app \ + && echo 'php artisan route:cache' >> /usr/local/bin/start-app \ + && echo 'php artisan view:cache' >> /usr/local/bin/start-app \ + && echo 'php artisan migrate --force' >> /usr/local/bin/start-app \ + && echo 'php-fpm' >> /usr/local/bin/start-app \ + && chmod +x /usr/local/bin/start-app + +# Expose port 9000 for PHP-FPM +EXPOSE 9000 + +# Health check +HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ + CMD php artisan --version || exit 1 + +# Start the application +CMD ["/usr/local/bin/start-app"] \ No newline at end of file diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000..a133062 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,65 @@ +version: '3.8' + +services: + app: + image: codeberg.org/lvl0/incr:v0.1.0-alpha-1 + # build: + # context: ../ + # dockerfile: docker/Dockerfile + container_name: incr-app + restart: unless-stopped + working_dir: /var/www/html + environment: + - APP_ENV=production + - APP_DEBUG=false + - DB_CONNECTION=mysql + - DB_HOST=db + - DB_PORT=3306 + - DB_DATABASE=incr + - DB_USERNAME=incr_user + - DB_PASSWORD=incr_password + volumes: + - ../storage:/var/www/html/storage + - ../public:/var/www/html/public + depends_on: + - db + networks: + - incr-network + + db: + image: mysql:8.0 + container_name: incr-db + restart: unless-stopped + environment: + - MYSQL_DATABASE=incr + - MYSQL_USER=incr_user + - MYSQL_PASSWORD=incr_password + - MYSQL_ROOT_PASSWORD=root_password + volumes: + - db_data:/var/lib/mysql + ports: + - "3306:3306" + networks: + - incr-network + + nginx: + image: nginx:alpine + container_name: incr-nginx + restart: unless-stopped + ports: + - "80:80" + volumes: + - ../public:/var/www/html/public:ro + - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro + depends_on: + - app + networks: + - incr-network + +networks: + incr-network: + driver: bridge + +volumes: + db_data: + driver: local \ No newline at end of file diff --git a/docker/nginx.conf b/docker/nginx.conf new file mode 100644 index 0000000..3877706 --- /dev/null +++ b/docker/nginx.conf @@ -0,0 +1,26 @@ +server { + listen 80; + server_name localhost; + root /var/www/html/public; + index index.php index.html; + + location / { + try_files $uri $uri/ /index.php?$query_string; + } + + location ~ \.php$ { + fastcgi_pass app:9000; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; + include fastcgi_params; + } + + location ~ /\.ht { + deny all; + } + + location ~* \.(css|js|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { + expires 1y; + add_header Cache-Control "public, immutable"; + } +} \ No newline at end of file -- 2.45.2 From fb5ea6a2dcbc3ce72e7874b494dcd4c83c8c197a Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 12:18:58 +0200 Subject: [PATCH 04/61] Add codeberg CI instructions --- .forgejo/workflows/docker-build.yml | 43 +++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .forgejo/workflows/docker-build.yml diff --git a/.forgejo/workflows/docker-build.yml b/.forgejo/workflows/docker-build.yml new file mode 100644 index 0000000..6b0bf0a --- /dev/null +++ b/.forgejo/workflows/docker-build.yml @@ -0,0 +1,43 @@ +name: Build and Push Docker Image + +on: + push: + tags: [v*] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Codeberg Container Registry + uses: docker/login-action@v3 + with: + registry: codeberg.org + username: ${{ secrets.CODEBERG_USERNAME }} + password: ${{ secrets.CODEBERG_TOKEN }} + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: codeberg.org/lvl0/incr + tags: | + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=raw,value=latest + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max \ No newline at end of file -- 2.45.2 From 6196668d8368cf18a72504f7a11015770a511e34 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 12:21:01 +0200 Subject: [PATCH 05/61] Add manual dispatch --- .forgejo/workflows/docker-build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.forgejo/workflows/docker-build.yml b/.forgejo/workflows/docker-build.yml index 6b0bf0a..46f554d 100644 --- a/.forgejo/workflows/docker-build.yml +++ b/.forgejo/workflows/docker-build.yml @@ -3,6 +3,7 @@ name: Build and Push Docker Image on: push: tags: [v*] + workflow_dispatch: jobs: build: -- 2.45.2 From 269c65b8c2bb3aa7a0d37d79852adf940ef6b805 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 12:24:29 +0200 Subject: [PATCH 06/61] Fix codeberg runner issue --- .forgejo/workflows/docker-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/docker-build.yml b/.forgejo/workflows/docker-build.yml index 46f554d..bb3e1d4 100644 --- a/.forgejo/workflows/docker-build.yml +++ b/.forgejo/workflows/docker-build.yml @@ -7,7 +7,7 @@ on: jobs: build: - runs-on: ubuntu-latest + runs-on: codeberg-small steps: - name: Checkout code uses: actions/checkout@v4 -- 2.45.2 From 899c1efc1544a00e3724a7740313dc1db819ad3d Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 12:31:07 +0200 Subject: [PATCH 07/61] Switch to podman --- .forgejo/workflows/docker-build.yml | 51 ++++++++++++++--------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/.forgejo/workflows/docker-build.yml b/.forgejo/workflows/docker-build.yml index bb3e1d4..8a6e2a3 100644 --- a/.forgejo/workflows/docker-build.yml +++ b/.forgejo/workflows/docker-build.yml @@ -12,33 +12,32 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Log in to Codeberg Container Registry - uses: docker/login-action@v3 - with: - registry: codeberg.org - username: ${{ secrets.CODEBERG_USERNAME }} - password: ${{ secrets.CODEBERG_TOKEN }} + run: | + echo "${{ secrets.CODEBERG_TOKEN }}" | podman login --username "${{ secrets.CODEBERG_USERNAME }}" --password-stdin codeberg.org - - name: Extract metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: codeberg.org/lvl0/incr - tags: | - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=raw,value=latest + - name: Extract version + id: version + run: | + if [[ "${{ github.ref }}" == refs/tags/* ]]; then + VERSION=${GITHUB_REF#refs/tags/v} + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "major_minor=$(echo $VERSION | cut -d. -f1-2)" >> $GITHUB_OUTPUT + else + echo "version=latest" >> $GITHUB_OUTPUT + echo "major_minor=latest" >> $GITHUB_OUTPUT + fi - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: . - file: ./docker/Dockerfile - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max \ No newline at end of file + run: | + if [[ "${{ github.ref }}" == refs/tags/* ]]; then + podman build -f docker/Dockerfile -t codeberg.org/lvl0/incr:${{ steps.version.outputs.version }} . + podman build -f docker/Dockerfile -t codeberg.org/lvl0/incr:${{ steps.version.outputs.major_minor }} . + podman build -f docker/Dockerfile -t codeberg.org/lvl0/incr:latest . + podman push codeberg.org/lvl0/incr:${{ steps.version.outputs.version }} + podman push codeberg.org/lvl0/incr:${{ steps.version.outputs.major_minor }} + podman push codeberg.org/lvl0/incr:latest + else + podman build -f docker/Dockerfile -t codeberg.org/lvl0/incr:latest . + podman push codeberg.org/lvl0/incr:latest + fi \ No newline at end of file -- 2.45.2 From 421cd4b5c0eb5b25a89f4506e3e96d57767b5d77 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 12:49:56 +0200 Subject: [PATCH 08/61] Remove CI --- .forgejo/workflows/docker-build.yml | 43 ----------------------------- 1 file changed, 43 deletions(-) delete mode 100644 .forgejo/workflows/docker-build.yml diff --git a/.forgejo/workflows/docker-build.yml b/.forgejo/workflows/docker-build.yml deleted file mode 100644 index 8a6e2a3..0000000 --- a/.forgejo/workflows/docker-build.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Build and Push Docker Image - -on: - push: - tags: [v*] - workflow_dispatch: - -jobs: - build: - runs-on: codeberg-small - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Log in to Codeberg Container Registry - run: | - echo "${{ secrets.CODEBERG_TOKEN }}" | podman login --username "${{ secrets.CODEBERG_USERNAME }}" --password-stdin codeberg.org - - - name: Extract version - id: version - run: | - if [[ "${{ github.ref }}" == refs/tags/* ]]; then - VERSION=${GITHUB_REF#refs/tags/v} - echo "version=$VERSION" >> $GITHUB_OUTPUT - echo "major_minor=$(echo $VERSION | cut -d. -f1-2)" >> $GITHUB_OUTPUT - else - echo "version=latest" >> $GITHUB_OUTPUT - echo "major_minor=latest" >> $GITHUB_OUTPUT - fi - - - name: Build and push Docker image - run: | - if [[ "${{ github.ref }}" == refs/tags/* ]]; then - podman build -f docker/Dockerfile -t codeberg.org/lvl0/incr:${{ steps.version.outputs.version }} . - podman build -f docker/Dockerfile -t codeberg.org/lvl0/incr:${{ steps.version.outputs.major_minor }} . - podman build -f docker/Dockerfile -t codeberg.org/lvl0/incr:latest . - podman push codeberg.org/lvl0/incr:${{ steps.version.outputs.version }} - podman push codeberg.org/lvl0/incr:${{ steps.version.outputs.major_minor }} - podman push codeberg.org/lvl0/incr:latest - else - podman build -f docker/Dockerfile -t codeberg.org/lvl0/incr:latest . - podman push codeberg.org/lvl0/incr:latest - fi \ No newline at end of file -- 2.45.2 From 22f18f6f6b07fbfd677bc709b268f88b9a9a4c28 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 12:56:16 +0200 Subject: [PATCH 09/61] Clean up --- LICENSE | 674 ++++++++++++++++++++++++++++++++++++++ README.md | 68 ++++ docker-compose.yml | 55 ---- docker/docker-compose.yml | 2 +- 4 files changed, 743 insertions(+), 56 deletions(-) create mode 100644 LICENSE create mode 100644 README.md delete mode 100644 docker-compose.yml diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..27d7354 --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/README.md b/README.md new file mode 100644 index 0000000..9e0bff9 --- /dev/null +++ b/README.md @@ -0,0 +1,68 @@ +# incr + +A minimalist one-page Laravel + React application for tracking VWCE shares with milestone reinforcement and optional financial insights. + +## Features + +- **LED-style display**: Large red digital counter showing current share count +- **Progress tracking**: Visual progress bar toward configurable milestones +- **Purchase management**: Add and track share purchases with historical data +- **Financial insights**: Portfolio value and withdrawal estimates +- **Milestone cycling**: Track progress toward multiple investment goals (1500→3000→4500→6000) + +## Tech Stack + +- **Backend**: Laravel 12 (PHP 8.2+) with MySQL database +- **Frontend**: React 19 + TypeScript with Inertia.js +- **Styling**: Tailwind CSS 4 with shadcn/ui components +- **Deployment**: Docker with multi-stage builds + +## Quick Start (Production) + +Run the application using Docker Compose: + +```bash +# Clone the repository +git clone https://codeberg.org/lvl0/incr.git +cd incr + +# Start the application +docker compose -f docker/docker-compose.yml up -d +``` + +The application will be available at `http://localhost`. + +**Default credentials**: You'll need to register a new account on first visit. + +## Development Setup + +For local development with Laravel Sail: + +```bash +# Install Laravel Sail +composer install +sail artisan sail:install + +# Start development environment +sail up -d + +# Install frontend dependencies and build assets +npm install +npm run dev + +# Run migrations +sail artisan migrate +``` + +The development server will be available at `http://localhost` with hot reload enabled. + +## Project Structure + +- `app/` - Laravel backend (controllers, models, services) +- `resources/js/` - React frontend components and pages +- `docker/` - Production Docker configuration +- `database/migrations/` - Database schema definitions + +## License + +GPLv3 License. See LICENSE file for details. \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 6114e5a..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,55 +0,0 @@ -services: - laravel.test: - build: - context: './vendor/laravel/sail/runtimes/8.4' - dockerfile: Dockerfile - args: - WWWGROUP: '${WWWGROUP}' - image: 'sail-8.4/app' - extra_hosts: - - 'host.docker.internal:host-gateway' - ports: - - '${APP_PORT:-80}:80' - - '${VITE_PORT:-5173}:${VITE_PORT:-5173}' - environment: - WWWUSER: '${WWWUSER}' - LARAVEL_SAIL: 1 - XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}' - XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}' - IGNITION_LOCAL_SITES_PATH: '${PWD}' - volumes: - - '.:/var/www/html' - networks: - - sail - depends_on: - - mysql - mysql: - image: 'mysql/mysql-server:8.0' - ports: - - '${FORWARD_DB_PORT:-3306}:3306' - environment: - MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}' - MYSQL_ROOT_HOST: '%' - MYSQL_DATABASE: '${DB_DATABASE}' - MYSQL_USER: '${DB_USERNAME}' - MYSQL_PASSWORD: '${DB_PASSWORD}' - MYSQL_ALLOW_EMPTY_PASSWORD: 1 - volumes: - - 'sail-mysql:/var/lib/mysql' - - './vendor/laravel/sail/database/mysql/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh' - networks: - - sail - healthcheck: - test: - - CMD - - mysqladmin - - ping - - '-p${DB_PASSWORD}' - retries: 3 - timeout: 5s -networks: - sail: - driver: bridge -volumes: - sail-mysql: - driver: local diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index a133062..173e35d 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -2,7 +2,7 @@ version: '3.8' services: app: - image: codeberg.org/lvl0/incr:v0.1.0-alpha-1 + image: codeberg.org/lvl0/incr:0.1.0 # build: # context: ../ # dockerfile: docker/Dockerfile -- 2.45.2 From c9b335d1568a9cb633d3725331bf4559bfcbc31d Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 19:30:31 +0200 Subject: [PATCH 10/61] Add woodpecker CI --- .woodpecker.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .woodpecker.yml diff --git a/.woodpecker.yml b/.woodpecker.yml new file mode 100644 index 0000000..d950677 --- /dev/null +++ b/.woodpecker.yml @@ -0,0 +1,11 @@ +when: + event: tag + +steps: + build: + image: docker:cli + commands: + - docker build -f docker/Dockerfile -t incr:${CI_COMMIT_TAG} . + - docker tag incr:${CI_COMMIT_TAG} incr:latest + volumes: + - /var/run/docker.sock:/var/run/docker.sock \ No newline at end of file -- 2.45.2 From fbc1f41f278258e9da95daee7ff52f05a191acf8 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 19:39:49 +0200 Subject: [PATCH 11/61] Push image to Codeberg registry --- .woodpecker.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index d950677..c0bbf1c 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -8,4 +8,15 @@ steps: - docker build -f docker/Dockerfile -t incr:${CI_COMMIT_TAG} . - docker tag incr:${CI_COMMIT_TAG} incr:latest volumes: - - /var/run/docker.sock:/var/run/docker.sock \ No newline at end of file + - /var/run/docker.sock:/var/run/docker.sock + + push: + image: docker:cli + commands: + - echo "$${REGISTRY_PASSWORD}" | docker login codeberg.org -u "$${REGISTRY_USERNAME}" --password-stdin + - docker tag incr:${CI_COMMIT_TAG} codeberg.org/YOUR_USERNAME/YOUR_REPO:latest + - docker tag incr:${CI_COMMIT_TAG} codeberg.org/YOUR_USERNAME/YOUR_REPO:${CI_COMMIT_TAG} + - docker push codeberg.org/YOUR_USERNAME/YOUR_REPO:latest + - docker push codeberg.org/YOUR_USERNAME/YOUR_REPO:${CI_COMMIT_TAG} + volumes: + - /var/run/docker.sock:/var/run/docker.sock -- 2.45.2 From 17cfb7dfd7bbd2851d12da9f4e7a0f804fa8499d Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 19:43:35 +0200 Subject: [PATCH 12/61] Fix woodpecker config --- .woodpecker.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index c0bbf1c..de6b191 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -1,9 +1,8 @@ -when: - event: tag - steps: build: image: docker:cli + when: + event: tag commands: - docker build -f docker/Dockerfile -t incr:${CI_COMMIT_TAG} . - docker tag incr:${CI_COMMIT_TAG} incr:latest @@ -12,6 +11,8 @@ steps: push: image: docker:cli + when: + event: tag commands: - echo "$${REGISTRY_PASSWORD}" | docker login codeberg.org -u "$${REGISTRY_USERNAME}" --password-stdin - docker tag incr:${CI_COMMIT_TAG} codeberg.org/YOUR_USERNAME/YOUR_REPO:latest -- 2.45.2 From dcf33f56cfd16424678732e4f82a5e51fa4e6e92 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 19:50:56 +0200 Subject: [PATCH 13/61] Optimize chown --- docker/Dockerfile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 9d46aca..eed5510 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -59,9 +59,8 @@ RUN composer install --no-dev --optimize-autoloader --no-interaction COPY --from=frontend-builder /app/public/build/ ./public/build/ # Set proper permissions -RUN chown -R www-data:www-data /var/www/html \ - && chmod -R 755 /var/www/html/storage \ - && chmod -R 755 /var/www/html/bootstrap/cache +RUN chown -R www-data:www-data storage bootstrap/cache public/build \ + && chmod -R 755 storage bootstrap/cache # Create a startup script RUN echo '#!/bin/sh' > /usr/local/bin/start-app \ @@ -81,4 +80,4 @@ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD php artisan --version || exit 1 # Start the application -CMD ["/usr/local/bin/start-app"] \ No newline at end of file +CMD ["/usr/local/bin/start-app"] -- 2.45.2 From dcbf304477ecf352b404e585518513cd834ba7c5 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 19:52:50 +0200 Subject: [PATCH 14/61] Fix issues in push stage --- .woodpecker.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index de6b191..486521b 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -15,9 +15,9 @@ steps: event: tag commands: - echo "$${REGISTRY_PASSWORD}" | docker login codeberg.org -u "$${REGISTRY_USERNAME}" --password-stdin - - docker tag incr:${CI_COMMIT_TAG} codeberg.org/YOUR_USERNAME/YOUR_REPO:latest - - docker tag incr:${CI_COMMIT_TAG} codeberg.org/YOUR_USERNAME/YOUR_REPO:${CI_COMMIT_TAG} - - docker push codeberg.org/YOUR_USERNAME/YOUR_REPO:latest - - docker push codeberg.org/YOUR_USERNAME/YOUR_REPO:${CI_COMMIT_TAG} + - docker tag incr:${CI_COMMIT_TAG} codeberg.org/lvl0/incr:latest + - docker tag incr:${CI_COMMIT_TAG} codeberg.org/lvl0/incr:${CI_COMMIT_TAG} + - docker push codeberg.org/lvl0/incr:latest + - docker push codeberg.org/lvl0/incr:${CI_COMMIT_TAG} volumes: - /var/run/docker.sock:/var/run/docker.sock -- 2.45.2 From 871b5f6d579f2e50b21284696dde46d53d7f9b07 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 19:59:40 +0200 Subject: [PATCH 15/61] Debug woodpecker --- .woodpecker.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.woodpecker.yml b/.woodpecker.yml index 486521b..da95c0b 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -9,6 +9,16 @@ steps: volumes: - /var/run/docker.sock:/var/run/docker.sock + debug-env: + image: alpine + when: + event: tag + commands: + - echo "🔍 DEBUG: REGISTRY_USERNAME = $${REGISTRY_USERNAME}" + - echo "🔍 DEBUG: REGISTRY_PASSWORD = $${REGISTRY_PASSWORD}" + - echo "🔍 DEBUG: Environment:" + - env + push: image: docker:cli when: -- 2.45.2 From 2da1bc65711f17a63ff86a1bad87c6e3443520d8 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 20:02:19 +0200 Subject: [PATCH 16/61] Debug woodpecker --- .woodpecker.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index da95c0b..1dd2b0b 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -14,9 +14,8 @@ steps: when: event: tag commands: - - echo "🔍 DEBUG: REGISTRY_USERNAME = $${REGISTRY_USERNAME}" - - echo "🔍 DEBUG: REGISTRY_PASSWORD = $${REGISTRY_PASSWORD}" - - echo "🔍 DEBUG: Environment:" + - echo "DEBUG: REGISTRY_USERNAME = $${REGISTRY_USERNAME}" + - echo "DEBUG: REGISTRY_PASSWORD = $${REGISTRY_PASSWORD}" - env push: -- 2.45.2 From acf2a6490fd56ac898dbe27a1ba0277dfeab2ff4 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 20:03:31 +0200 Subject: [PATCH 17/61] Debug woodpecker --- .woodpecker.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 1dd2b0b..f9fa230 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -14,8 +14,8 @@ steps: when: event: tag commands: - - echo "DEBUG: REGISTRY_USERNAME = $${REGISTRY_USERNAME}" - - echo "DEBUG: REGISTRY_PASSWORD = $${REGISTRY_PASSWORD}" + - "echo \"🔍 DEBUG: REGISTRY_USERNAME = ${REGISTRY_USERNAME}\"" + - "echo \"🔍 DEBUG: REGISTRY_PASSWORD = ${REGISTRY_PASSWORD}\"" - env push: @@ -23,10 +23,10 @@ steps: when: event: tag commands: - - echo "$${REGISTRY_PASSWORD}" | docker login codeberg.org -u "$${REGISTRY_USERNAME}" --password-stdin - - docker tag incr:${CI_COMMIT_TAG} codeberg.org/lvl0/incr:latest - - docker tag incr:${CI_COMMIT_TAG} codeberg.org/lvl0/incr:${CI_COMMIT_TAG} - - docker push codeberg.org/lvl0/incr:latest - - docker push codeberg.org/lvl0/incr:${CI_COMMIT_TAG} + - "echo \"${REGISTRY_PASSWORD}\" | docker login codeberg.org -u \"${REGISTRY_USERNAME}\" --password-stdin" + - "docker tag incr:${CI_COMMIT_TAG} codeberg.org/lvl0/incr:latest" + - "docker tag incr:${CI_COMMIT_TAG} codeberg.org/lvl0/incr:${CI_COMMIT_TAG}" + - "docker push codeberg.org/lvl0/incr:latest" + - "docker push codeberg.org/lvl0/incr:${CI_COMMIT_TAG}" volumes: - /var/run/docker.sock:/var/run/docker.sock -- 2.45.2 From 4cb31a43d7a9bf0b86f3dbdf82bcef62f0ed7a83 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 20:18:25 +0200 Subject: [PATCH 18/61] Debug woodpecker --- .woodpecker.yml | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index f9fa230..53d1144 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -1,32 +1,8 @@ steps: - build: - image: docker:cli - when: - event: tag - commands: - - docker build -f docker/Dockerfile -t incr:${CI_COMMIT_TAG} . - - docker tag incr:${CI_COMMIT_TAG} incr:latest - volumes: - - /var/run/docker.sock:/var/run/docker.sock - - debug-env: + debug-secrets: image: alpine when: event: tag commands: - - "echo \"🔍 DEBUG: REGISTRY_USERNAME = ${REGISTRY_USERNAME}\"" - - "echo \"🔍 DEBUG: REGISTRY_PASSWORD = ${REGISTRY_PASSWORD}\"" - - env - - push: - image: docker:cli - when: - event: tag - commands: - - "echo \"${REGISTRY_PASSWORD}\" | docker login codeberg.org -u \"${REGISTRY_USERNAME}\" --password-stdin" - - "docker tag incr:${CI_COMMIT_TAG} codeberg.org/lvl0/incr:latest" - - "docker tag incr:${CI_COMMIT_TAG} codeberg.org/lvl0/incr:${CI_COMMIT_TAG}" - - "docker push codeberg.org/lvl0/incr:latest" - - "docker push codeberg.org/lvl0/incr:${CI_COMMIT_TAG}" - volumes: - - /var/run/docker.sock:/var/run/docker.sock + - echo "🔍 REGISTRY_USERNAME = ${REGISTRY_USERNAME}" + - echo "🔍 REGISTRY_PASSWORD = ${REGISTRY_PASSWORD:+*** set ***}" -- 2.45.2 From 8b270da41fb0835147920bd3f903acb8b9152dfb Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 20:21:36 +0200 Subject: [PATCH 19/61] Debug woodpecker --- .woodpecker.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 53d1144..d440821 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -1,8 +1,7 @@ steps: - debug-secrets: + debug-env: image: alpine - when: - event: tag commands: - - echo "🔍 REGISTRY_USERNAME = ${REGISTRY_USERNAME}" - - echo "🔍 REGISTRY_PASSWORD = ${REGISTRY_PASSWORD:+*** set ***}" + - echo "🔍 REGISTRY_USERNAME = ${registry_username}" + - echo "🔍 REGISTRY_PASSWORD = *** set ***" + - env -- 2.45.2 From 594bf825cb065161d1d1f24633087a3c3e1ba130 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 20:26:02 +0200 Subject: [PATCH 20/61] Debug woodpecker --- .woodpecker.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index d440821..4c286e3 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -3,5 +3,4 @@ steps: image: alpine commands: - echo "🔍 REGISTRY_USERNAME = ${registry_username}" - - echo "🔍 REGISTRY_PASSWORD = *** set ***" - - env + - echo "🔍 REGISTRY_PASSWORD = ${REGISTRY_PASSWORD}" -- 2.45.2 From 26edf5e03622c3ab2589216bb162bc02cd13698f Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 20:29:05 +0200 Subject: [PATCH 21/61] Debug woodpecker --- .woodpecker.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 4c286e3..439042f 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -1,6 +1,11 @@ steps: debug-env: image: alpine + environment: + REGISTRY_USERNAME: + from_secret: registry_username + REGISTRY_PASSWORD: + from_secret: REGISTRY_PASSWORD commands: - - echo "🔍 REGISTRY_USERNAME = ${registry_username}" + - echo "🔍 REGISTRY_USERNAME = ${REGISTRY_USERNAME}" - echo "🔍 REGISTRY_PASSWORD = ${REGISTRY_PASSWORD}" -- 2.45.2 From 70e8d9f188a3df61a869066c4d152be2c46037e8 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 20:30:16 +0200 Subject: [PATCH 22/61] Debug woodpecker --- .woodpecker.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 439042f..504084b 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -1,11 +1,11 @@ steps: debug-env: image: alpine - environment: - REGISTRY_USERNAME: - from_secret: registry_username - REGISTRY_PASSWORD: - from_secret: REGISTRY_PASSWORD + secrets: + - source: registry_username + target: REGISTRY_USERNAME + - source: REGISTRY_PASSWORD + target: REGISTRY_PASSWORD commands: - echo "🔍 REGISTRY_USERNAME = ${REGISTRY_USERNAME}" - echo "🔍 REGISTRY_PASSWORD = ${REGISTRY_PASSWORD}" -- 2.45.2 From 2f5c50efc830b1168396639609ca40f71ddd777d Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 20:30:58 +0200 Subject: [PATCH 23/61] Debug woodpecker --- .woodpecker.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 504084b..439042f 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -1,11 +1,11 @@ steps: debug-env: image: alpine - secrets: - - source: registry_username - target: REGISTRY_USERNAME - - source: REGISTRY_PASSWORD - target: REGISTRY_PASSWORD + environment: + REGISTRY_USERNAME: + from_secret: registry_username + REGISTRY_PASSWORD: + from_secret: REGISTRY_PASSWORD commands: - echo "🔍 REGISTRY_USERNAME = ${REGISTRY_USERNAME}" - echo "🔍 REGISTRY_PASSWORD = ${REGISTRY_PASSWORD}" -- 2.45.2 From fd3fc61de43c4c307e8ecc08e06a516df4529a23 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 20:33:06 +0200 Subject: [PATCH 24/61] Debug woodpecker --- .woodpecker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 439042f..b2c7121 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -3,7 +3,7 @@ steps: image: alpine environment: REGISTRY_USERNAME: - from_secret: registry_username + from_secret: REGISTRY_USERNAME REGISTRY_PASSWORD: from_secret: REGISTRY_PASSWORD commands: -- 2.45.2 From fe75beba78f26af64d57a85481fb74c0c3cefd37 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 20:36:56 +0200 Subject: [PATCH 25/61] Debug woodpecker --- .woodpecker.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.woodpecker.yml b/.woodpecker.yml index b2c7121..63c2734 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -1,3 +1,6 @@ +when: + event: tag + steps: debug-env: image: alpine -- 2.45.2 From e3f04f0e7777455c9ea478ff73a8de0b3f1584b0 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 20:38:24 +0200 Subject: [PATCH 26/61] Debug woodpecker --- .woodpecker.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 63c2734..b25383a 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -1,6 +1,3 @@ -when: - event: tag - steps: debug-env: image: alpine @@ -12,3 +9,6 @@ steps: commands: - echo "🔍 REGISTRY_USERNAME = ${REGISTRY_USERNAME}" - echo "🔍 REGISTRY_PASSWORD = ${REGISTRY_PASSWORD}" + when: + event: + - tag -- 2.45.2 From 30d1deb18bd8f57e0e995c535bcb40f2a229626b Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 20:45:23 +0200 Subject: [PATCH 27/61] Debug woodpecker --- .woodpecker.yml | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index b25383a..b60e247 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -1,14 +1,19 @@ +when: + event: tag + steps: - debug-env: - image: alpine - environment: - REGISTRY_USERNAME: - from_secret: REGISTRY_USERNAME - REGISTRY_PASSWORD: - from_secret: REGISTRY_PASSWORD + build-image: + image: docker + volumes: + - /var/run/docker.sock:/var/run/docker.sock commands: - - echo "🔍 REGISTRY_USERNAME = ${REGISTRY_USERNAME}" - - echo "🔍 REGISTRY_PASSWORD = ${REGISTRY_PASSWORD}" - when: - event: - - tag + - echo "⚙️ Building Docker image for ${CI_COMMIT_TAG}" + - docker build -t codeberg.org/${CI_REPO}:${CI_COMMIT_TAG} . + + push-image: + image: docker + volumes: + - /var/run/docker.sock:/var/run/docker.sock + commands: + - echo "📤 Pushing image codeberg.org/${CI_REPO}:${CI_COMMIT_TAG}" + - docker push codeberg.org/${CI_REPO}:${CI_COMMIT_TAG} -- 2.45.2 From da3872db6e61be34ba256bd128faadc35145ab7f Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 21:08:51 +0200 Subject: [PATCH 28/61] Debug woodpecker --- .woodpecker.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index b60e247..b890e9a 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -2,15 +2,17 @@ when: event: tag steps: - build-image: + build: image: docker + environment: + - DOCKER_BUILDKIT=1 volumes: - /var/run/docker.sock:/var/run/docker.sock commands: - echo "⚙️ Building Docker image for ${CI_COMMIT_TAG}" - - docker build -t codeberg.org/${CI_REPO}:${CI_COMMIT_TAG} . + - docker build -f docker/Dockerfile -t codeberg.org/${CI_REPO}:${CI_COMMIT_TAG} . - push-image: + push: image: docker volumes: - /var/run/docker.sock:/var/run/docker.sock -- 2.45.2 From 7c0d747e6038c1bab7e9bcbff27ce2e3eb78dca8 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 21:09:25 +0200 Subject: [PATCH 29/61] Debug woodpecker --- .woodpecker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index b890e9a..1549a39 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -5,7 +5,7 @@ steps: build: image: docker environment: - - DOCKER_BUILDKIT=1 + DOCKER_BUILDKIT: "1" volumes: - /var/run/docker.sock:/var/run/docker.sock commands: -- 2.45.2 From 17d2add19027beb2cd887f86afabc93c0c4ee690 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 21:12:20 +0200 Subject: [PATCH 30/61] Debug woodpecker --- .woodpecker.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.woodpecker.yml b/.woodpecker.yml index 1549a39..a8e558b 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -14,8 +14,15 @@ steps: push: image: docker + environment: + REGISTRY_USERNAME: + from_secret: REGISTRY_USERNAME + REGISTRY_PASSWORD: + from_secret: REGISTRY_PASSWORD volumes: - /var/run/docker.sock:/var/run/docker.sock commands: + - echo "🔐 Logging into codeberg.org as ${REGISTRY_USERNAME}" + - echo "${REGISTRY_PASSWORD}" | docker login codeberg.org -u "${REGISTRY_USERNAME}" --password-stdin - echo "📤 Pushing image codeberg.org/${CI_REPO}:${CI_COMMIT_TAG}" - docker push codeberg.org/${CI_REPO}:${CI_COMMIT_TAG} -- 2.45.2 From 3e61c804bde8e0ccc06ea527f8f75a563418d721 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 21:14:23 +0200 Subject: [PATCH 31/61] Debug woodpecker --- .woodpecker.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index a8e558b..1549a39 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -14,15 +14,8 @@ steps: push: image: docker - environment: - REGISTRY_USERNAME: - from_secret: REGISTRY_USERNAME - REGISTRY_PASSWORD: - from_secret: REGISTRY_PASSWORD volumes: - /var/run/docker.sock:/var/run/docker.sock commands: - - echo "🔐 Logging into codeberg.org as ${REGISTRY_USERNAME}" - - echo "${REGISTRY_PASSWORD}" | docker login codeberg.org -u "${REGISTRY_USERNAME}" --password-stdin - echo "📤 Pushing image codeberg.org/${CI_REPO}:${CI_COMMIT_TAG}" - docker push codeberg.org/${CI_REPO}:${CI_COMMIT_TAG} -- 2.45.2 From 3ccbc656b4d1c7f33fc73a1d51522e392b879f59 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 21:19:14 +0200 Subject: [PATCH 32/61] Debug woodpecker --- .woodpecker.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.woodpecker.yml b/.woodpecker.yml index 1549a39..dd5d49c 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -14,8 +14,15 @@ steps: push: image: docker + environment: + REGISTRY_USERNAME: + from_secret: REGISTRY_USERNAME + REGISTRY_PASSWORD: + from_secret: REGISTRY_PASSWORD volumes: - /var/run/docker.sock:/var/run/docker.sock commands: + - echo "🔐 Logging into registry" + - echo "${REGISTRY_PASSWORD}" | docker login codeberg.org -u "${REGISTRY_USERNAME}" --password-stdin - echo "📤 Pushing image codeberg.org/${CI_REPO}:${CI_COMMIT_TAG}" - docker push codeberg.org/${CI_REPO}:${CI_COMMIT_TAG} -- 2.45.2 From a1cf0cf5d4c08ecc4fd887c647c2f044d3017b50 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 21:21:10 +0200 Subject: [PATCH 33/61] Debug woodpecker --- .woodpecker.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.woodpecker.yml b/.woodpecker.yml index dd5d49c..0f17bf1 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -2,6 +2,19 @@ when: event: tag steps: + test-secrets: + image: alpine + environment: + REGISTRY_USERNAME: + from_secret: REGISTRY_USERNAME + REGISTRY_PASSWORD: + from_secret: REGISTRY_PASSWORD + commands: + - echo "Username length: ${#REGISTRY_USERNAME}" + - echo "Password length: ${#REGISTRY_PASSWORD}" + - if [ -z "$REGISTRY_USERNAME" ]; then echo "USERNAME IS EMPTY"; exit 1; fi + - if [ -z "$REGISTRY_PASSWORD" ]; then echo "PASSWORD IS EMPTY"; exit 1; fi + build: image: docker environment: -- 2.45.2 From d1bf803df2d6dafd02dbb408c440aff0d782e8c6 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 21:21:44 +0200 Subject: [PATCH 34/61] Debug woodpecker --- .woodpecker.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 0f17bf1..c309404 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -10,10 +10,10 @@ steps: REGISTRY_PASSWORD: from_secret: REGISTRY_PASSWORD commands: - - echo "Username length: ${#REGISTRY_USERNAME}" - - echo "Password length: ${#REGISTRY_PASSWORD}" - - if [ -z "$REGISTRY_USERNAME" ]; then echo "USERNAME IS EMPTY"; exit 1; fi - - if [ -z "$REGISTRY_PASSWORD" ]; then echo "PASSWORD IS EMPTY"; exit 1; fi + - echo "Testing secrets..." + - test -n "$REGISTRY_USERNAME" || (echo "USERNAME IS EMPTY" && exit 1) + - test -n "$REGISTRY_PASSWORD" || (echo "PASSWORD IS EMPTY" && exit 1) + - echo "Secrets OK" build: image: docker -- 2.45.2 From 6256d92ca8c479419da63f46471715affdf2d000 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 21:26:36 +0200 Subject: [PATCH 35/61] Debug woodpecker --- .woodpecker.yml | 45 ++++++++++----------------------------------- 1 file changed, 10 insertions(+), 35 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index c309404..23e991d 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -2,40 +2,15 @@ when: event: tag steps: - test-secrets: - image: alpine - environment: - REGISTRY_USERNAME: + publish: + image: woodpeckerci/plugin-docker-buildx + settings: + registry: codeberg.org + repo: lvl0/incr + tags: "${CI_COMMIT_TAG}" + dockerfile: docker/Dockerfile + context: . + username: from_secret: REGISTRY_USERNAME - REGISTRY_PASSWORD: + password: from_secret: REGISTRY_PASSWORD - commands: - - echo "Testing secrets..." - - test -n "$REGISTRY_USERNAME" || (echo "USERNAME IS EMPTY" && exit 1) - - test -n "$REGISTRY_PASSWORD" || (echo "PASSWORD IS EMPTY" && exit 1) - - echo "Secrets OK" - - build: - image: docker - environment: - DOCKER_BUILDKIT: "1" - volumes: - - /var/run/docker.sock:/var/run/docker.sock - commands: - - echo "⚙️ Building Docker image for ${CI_COMMIT_TAG}" - - docker build -f docker/Dockerfile -t codeberg.org/${CI_REPO}:${CI_COMMIT_TAG} . - - push: - image: docker - environment: - REGISTRY_USERNAME: - from_secret: REGISTRY_USERNAME - REGISTRY_PASSWORD: - from_secret: REGISTRY_PASSWORD - volumes: - - /var/run/docker.sock:/var/run/docker.sock - commands: - - echo "🔐 Logging into registry" - - echo "${REGISTRY_PASSWORD}" | docker login codeberg.org -u "${REGISTRY_USERNAME}" --password-stdin - - echo "📤 Pushing image codeberg.org/${CI_REPO}:${CI_COMMIT_TAG}" - - docker push codeberg.org/${CI_REPO}:${CI_COMMIT_TAG} -- 2.45.2 From 1d9a573df4d570671b7b7dcf61abeeda19929709 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 21:29:21 +0200 Subject: [PATCH 36/61] Debug woodpecker --- .woodpecker.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 23e991d..8d814af 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -2,12 +2,11 @@ when: event: tag steps: - publish: + docker: image: woodpeckerci/plugin-docker-buildx settings: - registry: codeberg.org - repo: lvl0/incr - tags: "${CI_COMMIT_TAG}" + repo: codeberg.org/${CI_REPO} + tags: ${CI_COMMIT_TAG} dockerfile: docker/Dockerfile context: . username: -- 2.45.2 From 9eda6895c55ee4765ab1eb693d98839cdd664416 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 21:30:46 +0200 Subject: [PATCH 37/61] Debug woodpecker --- .woodpecker.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.woodpecker.yml b/.woodpecker.yml index 8d814af..1cc0449 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -4,6 +4,7 @@ when: steps: docker: image: woodpeckerci/plugin-docker-buildx + privileged: true settings: repo: codeberg.org/${CI_REPO} tags: ${CI_COMMIT_TAG} -- 2.45.2 From 478f8a473faa083a1940a878203a1def46477a86 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 21:34:38 +0200 Subject: [PATCH 38/61] Debug woodpecker --- .woodpecker.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 1cc0449..96f38b5 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -6,7 +6,8 @@ steps: image: woodpeckerci/plugin-docker-buildx privileged: true settings: - repo: codeberg.org/${CI_REPO} + registry: codeberg.org + repo: codeberg.org/lvl0/incr tags: ${CI_COMMIT_TAG} dockerfile: docker/Dockerfile context: . -- 2.45.2 From 01fd62318963b0ccb257cab5449cb6e308ac6608 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 21:51:56 +0200 Subject: [PATCH 39/61] Use Jenkins instead --- .woodpecker.yml | 17 --------------- Jenkinsfile | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 17 deletions(-) delete mode 100644 .woodpecker.yml create mode 100644 Jenkinsfile diff --git a/.woodpecker.yml b/.woodpecker.yml deleted file mode 100644 index 96f38b5..0000000 --- a/.woodpecker.yml +++ /dev/null @@ -1,17 +0,0 @@ -when: - event: tag - -steps: - docker: - image: woodpeckerci/plugin-docker-buildx - privileged: true - settings: - registry: codeberg.org - repo: codeberg.org/lvl0/incr - tags: ${CI_COMMIT_TAG} - dockerfile: docker/Dockerfile - context: . - username: - from_secret: REGISTRY_USERNAME - password: - from_secret: REGISTRY_PASSWORD diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..d0a292d --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,55 @@ +pipeline { + agent any + + environment { + REGISTRY = 'codeberg.org/lvl0/incr' + IMAGE_TAG = "${env.GIT_TAG_NAME ?: 'latest'}" + } + + triggers { + pollSCM('H/5 * * * *') // Replace with webhook later + } + + stages { + stage('Check Tag') { + when { + expression { + return env.GIT_TAG_NAME != null + } + } + steps { + echo "🕵️ Detected tag: ${env.GIT_TAG_NAME}" + } + } + + stage('Build Docker Image') { + when { + expression { + return env.GIT_TAG_NAME != null + } + } + steps { + sh """ + echo "⚙️ Building Docker image for ${IMAGE_TAG}" + docker build -f docker/Dockerfile -t ${REGISTRY}:${IMAGE_TAG} . + """ + } + } + + stage('Push to Registry') { + when { + expression { + return env.GIT_TAG_NAME != null + } + } + steps { + withCredentials([usernamePassword(credentialsId: 'codeberg-registry', usernameVariable: 'REGISTRY_USER', passwordVariable: 'REGISTRY_PASS')]) { + sh """ + echo "$REGISTRY_PASS" | docker login ${REGISTRY} -u "$REGISTRY_USER" --password-stdin + docker push ${REGISTRY}:${IMAGE_TAG} + """ + } + } + } + } +} -- 2.45.2 From 9a8f8b770b68809cc907f77a93fafc9f493316eb Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 21:53:58 +0200 Subject: [PATCH 40/61] Debug Jenkins --- Jenkinsfile | 80 +++++++++++++++++++++-------------------------------- 1 file changed, 31 insertions(+), 49 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d0a292d..742ae93 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,55 +1,37 @@ pipeline { - agent any + agent any - environment { - REGISTRY = 'codeberg.org/lvl0/incr' - IMAGE_TAG = "${env.GIT_TAG_NAME ?: 'latest'}" + environment { + REGISTRY = 'codeberg.org' + IMAGE_NAME = "${REGISTRY}/lvl0/incr" + DOCKER_CREDENTIALS_ID = 'codeberg-registry' // Jenkins credential ID + } + + stages { + stage('Detect Tag') { + steps { + script { + def tag = sh(script: 'git describe --tags --exact-match || true', returnStdout: true).trim() + if (tag) { + env.GIT_TAG = tag + echo "✅ Detected tag: ${tag}" + } else { + echo "⛔ No tag detected — skipping build" + currentBuild.result = 'SUCCESS' + error("Skipping non-tag build") + } + } + } } - triggers { - pollSCM('H/5 * * * *') // Replace with webhook later + stage('Build Docker Image') { + steps { + echo "⚙️ Building Docker image: ${IMAGE_NAME}:${GIT_TAG}" + sh "docker build -f docker/Dockerfile -t ${IMAGE_NAME}:${GIT_TAG} ." + } } - stages { - stage('Check Tag') { - when { - expression { - return env.GIT_TAG_NAME != null - } - } - steps { - echo "🕵️ Detected tag: ${env.GIT_TAG_NAME}" - } - } - - stage('Build Docker Image') { - when { - expression { - return env.GIT_TAG_NAME != null - } - } - steps { - sh """ - echo "⚙️ Building Docker image for ${IMAGE_TAG}" - docker build -f docker/Dockerfile -t ${REGISTRY}:${IMAGE_TAG} . - """ - } - } - - stage('Push to Registry') { - when { - expression { - return env.GIT_TAG_NAME != null - } - } - steps { - withCredentials([usernamePassword(credentialsId: 'codeberg-registry', usernameVariable: 'REGISTRY_USER', passwordVariable: 'REGISTRY_PASS')]) { - sh """ - echo "$REGISTRY_PASS" | docker login ${REGISTRY} -u "$REGISTRY_USER" --password-stdin - docker push ${REGISTRY}:${IMAGE_TAG} - """ - } - } - } - } -} + stage('Push to Registry') { + steps { + echo "📤 Pushing Docker image: ${IMAGE_NAME}:${GIT_TAG}" + withCredentials([usernamePassword(credentialsId: "${DOCKER_CREDENTIALS_ID}", usernam]() -- 2.45.2 From df34ebbc1f847af4ff002251f812be465989e502 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 13 Jul 2025 21:55:03 +0200 Subject: [PATCH 41/61] Debug Jenkins --- Jenkinsfile | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 742ae93..c52438a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,7 +4,7 @@ pipeline { environment { REGISTRY = 'codeberg.org' IMAGE_NAME = "${REGISTRY}/lvl0/incr" - DOCKER_CREDENTIALS_ID = 'codeberg-registry' // Jenkins credential ID + DOCKER_CREDENTIALS_ID = 'codeberg-registry' // Jenkins credentials ID } stages { @@ -34,4 +34,19 @@ pipeline { stage('Push to Registry') { steps { echo "📤 Pushing Docker image: ${IMAGE_NAME}:${GIT_TAG}" - withCredentials([usernamePassword(credentialsId: "${DOCKER_CREDENTIALS_ID}", usernam]() + withCredentials([ + usernamePassword( + credentialsId: DOCKER_CREDENTIALS_ID, + usernameVariable: 'USERNAME', + passwordVariable: 'PASSWORD' + ) + ]) { + sh """ + echo "${PASSWORD}" | docker login ${REGISTRY} -u "${USERNAME}" --password-stdin + docker push ${IMAGE_NAME}:${GIT_TAG} + """ + } + } + } + } +} -- 2.45.2 From 3eea28979e6bf02dbbea5dd1c905c5bc0bf3677c Mon Sep 17 00:00:00 2001 From: myrmidex Date: Mon, 14 Jul 2025 20:11:52 +0200 Subject: [PATCH 42/61] Add Jenkins SCM webhook --- Jenkinsfile | 48 ++++++++++++++++++++---------------------------- 1 file changed, 20 insertions(+), 28 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c52438a..7fa336a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,49 +1,41 @@ pipeline { agent any + triggers { + githubPush() // Enables webhook support via GitHub-style POST + } + environment { REGISTRY = 'codeberg.org' IMAGE_NAME = "${REGISTRY}/lvl0/incr" - DOCKER_CREDENTIALS_ID = 'codeberg-registry' // Jenkins credentials ID + DOCKER_CREDENTIALS_ID = 'codeberg-registry' } stages { - stage('Detect Tag') { + stage('Tag Check') { steps { script { - def tag = sh(script: 'git describe --tags --exact-match || true', returnStdout: true).trim() - if (tag) { - env.GIT_TAG = tag - echo "✅ Detected tag: ${tag}" - } else { - echo "⛔ No tag detected — skipping build" - currentBuild.result = 'SUCCESS' - error("Skipping non-tag build") + def isTag = sh(script: 'git describe --tags --exact-match || echo "nope"', returnStdout: true).trim() + if (isTag == "nope") { + echo "Not a tag. Skipping build." + currentBuild.result = 'NOT_BUILT' + return } } } } - - stage('Build Docker Image') { - steps { - echo "⚙️ Building Docker image: ${IMAGE_NAME}:${GIT_TAG}" - sh "docker build -f docker/Dockerfile -t ${IMAGE_NAME}:${GIT_TAG} ." + stage('Build & Push Docker Image') { + when { + expression { + return env.GIT_COMMIT && env.GIT_COMMIT != "" + } } - } - - stage('Push to Registry') { steps { - echo "📤 Pushing Docker image: ${IMAGE_NAME}:${GIT_TAG}" - withCredentials([ - usernamePassword( - credentialsId: DOCKER_CREDENTIALS_ID, - usernameVariable: 'USERNAME', - passwordVariable: 'PASSWORD' - ) - ]) { + sh 'docker build -t $IMAGE_NAME:$GIT_COMMIT .' + withCredentials([usernamePassword(credentialsId: "$DOCKER_CREDENTIALS_ID", usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) { sh """ - echo "${PASSWORD}" | docker login ${REGISTRY} -u "${USERNAME}" --password-stdin - docker push ${IMAGE_NAME}:${GIT_TAG} + echo "$PASSWORD" | docker login $REGISTRY -u "$USERNAME" --password-stdin + docker push $IMAGE_NAME:$GIT_COMMIT """ } } -- 2.45.2 From 2967dc22a78e42db6aad9326694c6215ceaba820 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Mon, 14 Jul 2025 20:38:53 +0200 Subject: [PATCH 43/61] Fix webhook --- Jenkinsfile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7fa336a..6d5210a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,7 +2,14 @@ pipeline { agent any triggers { - githubPush() // Enables webhook support via GitHub-style POST + genericTrigger( + causeString: 'Triggered on tag push', + token: 'tag-trigger-secret', + printContributedVariables: true, + printPostContent: true, + regexpFilterExpression: 'ref=refs/tags/.*', + regexpFilterText: '$ref' + ) } environment { @@ -31,7 +38,7 @@ pipeline { } } steps { - sh 'docker build -t $IMAGE_NAME:$GIT_COMMIT .' + sh 'docker build -t $IMAGE_NAME:$GIT_COMMIT -f docker/Dockerfile .' withCredentials([usernamePassword(credentialsId: "$DOCKER_CREDENTIALS_ID", usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) { sh """ echo "$PASSWORD" | docker login $REGISTRY -u "$USERNAME" --password-stdin -- 2.45.2 From a60ea83563dc371eb1eac34a216588adb8e36de0 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Mon, 14 Jul 2025 20:40:07 +0200 Subject: [PATCH 44/61] Fix webhook --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6d5210a..3b65707 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,7 +2,7 @@ pipeline { agent any triggers { - genericTrigger( + GenericTrigger( causeString: 'Triggered on tag push', token: 'tag-trigger-secret', printContributedVariables: true, -- 2.45.2 From 861a18f24a328ef8fabb3e166708576c8c59efab Mon Sep 17 00:00:00 2001 From: myrmidex Date: Mon, 14 Jul 2025 20:45:30 +0200 Subject: [PATCH 45/61] Limit to tag pushes --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3b65707..9357601 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,12 +3,12 @@ pipeline { triggers { GenericTrigger( - causeString: 'Triggered on tag push', + causeString: 'Triggered on tag push only', token: 'tag-trigger-secret', printContributedVariables: true, printPostContent: true, - regexpFilterExpression: 'ref=refs/tags/.*', - regexpFilterText: '$ref' + regexpFilterExpression: 'ref=refs/tags/.*\nafter=(?!0{40}).*', + regexpFilterText: '$ref\n$after' ) } -- 2.45.2 From 2fed772e47210f1e8d858c0478261f3da510e12b Mon Sep 17 00:00:00 2001 From: myrmidex Date: Mon, 14 Jul 2025 20:50:34 +0200 Subject: [PATCH 46/61] Fix filter matching --- Jenkinsfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9357601..e47db87 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,12 +3,16 @@ pipeline { triggers { GenericTrigger( - causeString: 'Triggered on tag push only', + causeString: 'Triggered on tag push', token: 'tag-trigger-secret', printContributedVariables: true, printPostContent: true, regexpFilterExpression: 'ref=refs/tags/.*\nafter=(?!0{40}).*', - regexpFilterText: '$ref\n$after' + regexpFilterText: '$ref\n$after', + genericVariables: [ + [key: 'ref', value: '$.ref'], + [key: 'after', value: '$.after'] + ] ) } -- 2.45.2 From 53bcce2b98dd0938b3e23bdbf0f258cc677d4067 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Mon, 14 Jul 2025 21:01:41 +0200 Subject: [PATCH 47/61] Fix tag matching --- Jenkinsfile | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index e47db87..293690e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,12 +3,10 @@ pipeline { triggers { GenericTrigger( - causeString: 'Triggered on tag push', + causeString: 'Triggered by push event', token: 'tag-trigger-secret', printContributedVariables: true, printPostContent: true, - regexpFilterExpression: 'ref=refs/tags/.*\nafter=(?!0{40}).*', - regexpFilterText: '$ref\n$after', genericVariables: [ [key: 'ref', value: '$.ref'], [key: 'after', value: '$.after'] @@ -23,22 +21,30 @@ pipeline { } stages { - stage('Tag Check') { + stage('Tag Push Filter') { steps { script { - def isTag = sh(script: 'git describe --tags --exact-match || echo "nope"', returnStdout: true).trim() - if (isTag == "nope") { - echo "Not a tag. Skipping build." + if (!env.ref?.startsWith('refs/tags/')) { + echo "Not a tag push (ref = ${env.ref}). Skipping build." currentBuild.result = 'NOT_BUILT' return } + + if (env.after == null || env.after ==~ /^0{40}$/) { + echo "After SHA is null or zeroed (after = ${env.after}). Skipping build." + currentBuild.result = 'NOT_BUILT' + return + } + + echo "Valid tag push detected: ${env.ref} (${env.after})" } } } + stage('Build & Push Docker Image') { when { expression { - return env.GIT_COMMIT && env.GIT_COMMIT != "" + return env.ref?.startsWith('refs/tags/') && env.GIT_COMMIT && env.GIT_COMMIT != "" } } steps { -- 2.45.2 From cbd3b0fcb17b28893d5549045b2c47ae1747944a Mon Sep 17 00:00:00 2001 From: myrmidex Date: Mon, 14 Jul 2025 21:11:57 +0200 Subject: [PATCH 48/61] Fix image tagging --- Jenkinsfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 293690e..975b4a9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -48,11 +48,12 @@ pipeline { } } steps { - sh 'docker build -t $IMAGE_NAME:$GIT_COMMIT -f docker/Dockerfile .' + def tagName = env.ref?.replaceFirst(/^refs\/tags\//, '') + sh "docker build -t $IMAGE_NAME:${tagName} -f docker/Dockerfile ." withCredentials([usernamePassword(credentialsId: "$DOCKER_CREDENTIALS_ID", usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) { sh """ echo "$PASSWORD" | docker login $REGISTRY -u "$USERNAME" --password-stdin - docker push $IMAGE_NAME:$GIT_COMMIT + docker push $IMAGE_NAME:${tagName} """ } } -- 2.45.2 From 0d4706105d41810ff81bf35582fc5139478985ea Mon Sep 17 00:00:00 2001 From: myrmidex Date: Mon, 14 Jul 2025 21:13:31 +0200 Subject: [PATCH 49/61] Fix image tagging --- Jenkinsfile | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 975b4a9..6250e79 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -48,13 +48,16 @@ pipeline { } } steps { - def tagName = env.ref?.replaceFirst(/^refs\/tags\//, '') - sh "docker build -t $IMAGE_NAME:${tagName} -f docker/Dockerfile ." - withCredentials([usernamePassword(credentialsId: "$DOCKER_CREDENTIALS_ID", usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) { - sh """ - echo "$PASSWORD" | docker login $REGISTRY -u "$USERNAME" --password-stdin - docker push $IMAGE_NAME:${tagName} - """ + script { + def tagName = env.ref?.replaceFirst(/^refs\/tags\//, '') + sh "docker build -t $IMAGE_NAME:${tagName} -f docker/Dockerfile ." + + withCredentials([usernamePassword(credentialsId: "$DOCKER_CREDENTIALS_ID", usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) { + sh """ + echo "$PASSWORD" | docker login $REGISTRY -u "$USERNAME" --password-stdin + docker push $IMAGE_NAME:${tagName} + """ + } } } } -- 2.45.2 From f02cace731ac7afcb33e548aa2130e95ff85df35 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Mon, 14 Jul 2025 21:17:31 +0200 Subject: [PATCH 50/61] Also tag as latest --- Jenkinsfile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6250e79..fa4b705 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -44,18 +44,24 @@ pipeline { stage('Build & Push Docker Image') { when { expression { - return env.ref?.startsWith('refs/tags/') && env.GIT_COMMIT && env.GIT_COMMIT != "" + return env.ref?.startsWith('refs/tags/') && env.after !=~ /^0{40}$/ } } steps { script { def tagName = env.ref?.replaceFirst(/^refs\/tags\//, '') - sh "docker build -t $IMAGE_NAME:${tagName} -f docker/Dockerfile ." + echo "Building image for tag: ${tagName}" + + // Build both the tag and latest + sh """ + docker build -t $IMAGE_NAME:${tagName} -t $IMAGE_NAME:latest -f docker/Dockerfile . + """ withCredentials([usernamePassword(credentialsId: "$DOCKER_CREDENTIALS_ID", usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) { sh """ echo "$PASSWORD" | docker login $REGISTRY -u "$USERNAME" --password-stdin docker push $IMAGE_NAME:${tagName} + docker push $IMAGE_NAME:latest """ } } -- 2.45.2 From 9ef05f9f576959aefe1ba7c5d23e770fb038f29f Mon Sep 17 00:00:00 2001 From: myrmidex Date: Mon, 14 Jul 2025 21:24:18 +0200 Subject: [PATCH 51/61] Drop v prefix from docker image tags --- Jenkinsfile | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index fa4b705..4074927 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,10 +3,12 @@ pipeline { triggers { GenericTrigger( - causeString: 'Triggered by push event', + causeString: 'Triggered on tag push', token: 'tag-trigger-secret', printContributedVariables: true, printPostContent: true, + regexpFilterExpression: 'ref=refs/tags/.*\nafter=(?!0{40}).*', + regexpFilterText: '$ref\n$after', genericVariables: [ [key: 'ref', value: '$.ref'], [key: 'after', value: '$.after'] @@ -29,14 +31,6 @@ pipeline { currentBuild.result = 'NOT_BUILT' return } - - if (env.after == null || env.after ==~ /^0{40}$/) { - echo "After SHA is null or zeroed (after = ${env.after}). Skipping build." - currentBuild.result = 'NOT_BUILT' - return - } - - echo "Valid tag push detected: ${env.ref} (${env.after})" } } } @@ -44,23 +38,21 @@ pipeline { stage('Build & Push Docker Image') { when { expression { - return env.ref?.startsWith('refs/tags/') && env.after !=~ /^0{40}$/ + return env.ref?.startsWith('refs/tags/') && env.after != null && env.after != "0000000000000000000000000000000000000000" } } steps { script { - def tagName = env.ref?.replaceFirst(/^refs\/tags\//, '') - echo "Building image for tag: ${tagName}" + def tagName = env.ref.replaceFirst(/^refs\/tags\//, '') + def cleanedTag = tagName.replaceFirst(/^v/, '') - // Build both the tag and latest - sh """ - docker build -t $IMAGE_NAME:${tagName} -t $IMAGE_NAME:latest -f docker/Dockerfile . - """ + sh "docker build -t $IMAGE_NAME:$cleanedTag -f docker/Dockerfile ." withCredentials([usernamePassword(credentialsId: "$DOCKER_CREDENTIALS_ID", usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) { sh """ echo "$PASSWORD" | docker login $REGISTRY -u "$USERNAME" --password-stdin - docker push $IMAGE_NAME:${tagName} + docker push $IMAGE_NAME:$cleanedTag + docker tag $IMAGE_NAME:$cleanedTag $IMAGE_NAME:latest docker push $IMAGE_NAME:latest """ } -- 2.45.2 From e82dfb03fc479b7b44d2bb1e905a87949767f5ce Mon Sep 17 00:00:00 2001 From: myrmidex Date: Tue, 15 Jul 2025 20:36:49 +0200 Subject: [PATCH 52/61] Consolidate containers --- docker/Dockerfile | 24 +++++++++++------------- docker/docker-compose.yml | 23 ++++------------------- docker/nginx.conf | 2 +- docker/start-app.sh | 13 +++++++++++++ docker/supervisord.conf | 21 +++++++++++++++++++++ 5 files changed, 50 insertions(+), 33 deletions(-) create mode 100644 docker/start-app.sh create mode 100644 docker/supervisord.conf diff --git a/docker/Dockerfile b/docker/Dockerfile index eed5510..2cc673a 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -32,7 +32,9 @@ RUN apk add --no-cache \ zip \ unzip \ oniguruma-dev \ - mysql-client + mysql-client \ + nginx \ + supervisor # Install PHP extensions RUN docker-php-ext-install \ @@ -58,22 +60,18 @@ RUN composer install --no-dev --optimize-autoloader --no-interaction # Copy built frontend assets from builder stage COPY --from=frontend-builder /app/public/build/ ./public/build/ +# Copy nginx and supervisor configurations +COPY docker/nginx.conf /etc/nginx/http.d/default.conf +COPY docker/supervisord.conf /etc/supervisord.conf +COPY docker/start-app.sh /usr/local/bin/start-app + # Set proper permissions RUN chown -R www-data:www-data storage bootstrap/cache public/build \ - && chmod -R 755 storage bootstrap/cache - -# Create a startup script -RUN echo '#!/bin/sh' > /usr/local/bin/start-app \ - && echo 'cp -r /var/www/html/public/. /var/www/html/public_shared/ 2>/dev/null || true' >> /usr/local/bin/start-app \ - && echo 'php artisan config:cache' >> /usr/local/bin/start-app \ - && echo 'php artisan route:cache' >> /usr/local/bin/start-app \ - && echo 'php artisan view:cache' >> /usr/local/bin/start-app \ - && echo 'php artisan migrate --force' >> /usr/local/bin/start-app \ - && echo 'php-fpm' >> /usr/local/bin/start-app \ + && chmod -R 755 storage bootstrap/cache \ && chmod +x /usr/local/bin/start-app -# Expose port 9000 for PHP-FPM -EXPOSE 9000 +# Expose port 80 for nginx +EXPOSE 80 # Health check HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 173e35d..1b0e27d 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -2,10 +2,7 @@ version: '3.8' services: app: - image: codeberg.org/lvl0/incr:0.1.0 - # build: - # context: ../ - # dockerfile: docker/Dockerfile + image: codeberg.org/lvl0/incr:0.1.14 container_name: incr-app restart: unless-stopped working_dir: /var/www/html @@ -21,6 +18,8 @@ services: volumes: - ../storage:/var/www/html/storage - ../public:/var/www/html/public + ports: + - "80:80" depends_on: - db networks: @@ -42,24 +41,10 @@ services: networks: - incr-network - nginx: - image: nginx:alpine - container_name: incr-nginx - restart: unless-stopped - ports: - - "80:80" - volumes: - - ../public:/var/www/html/public:ro - - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro - depends_on: - - app - networks: - - incr-network - networks: incr-network: driver: bridge volumes: db_data: - driver: local \ No newline at end of file + driver: local diff --git a/docker/nginx.conf b/docker/nginx.conf index 3877706..b462ad6 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf @@ -9,7 +9,7 @@ server { } location ~ \.php$ { - fastcgi_pass app:9000; + fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; include fastcgi_params; diff --git a/docker/start-app.sh b/docker/start-app.sh new file mode 100644 index 0000000..d0db65d --- /dev/null +++ b/docker/start-app.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +# Copy public files to shared volume if needed +cp -r /var/www/html/public/. /var/www/html/public_shared/ 2>/dev/null || true + +# Laravel optimizations +php artisan config:cache +php artisan route:cache +php artisan view:cache +php artisan migrate --force + +# Start supervisor to manage nginx and php-fpm +supervisord -c /etc/supervisord.conf \ No newline at end of file diff --git a/docker/supervisord.conf b/docker/supervisord.conf new file mode 100644 index 0000000..8a7a5b6 --- /dev/null +++ b/docker/supervisord.conf @@ -0,0 +1,21 @@ +[supervisord] +nodaemon=true +user=root + +[program:nginx] +command=nginx -g "daemon off;" +autostart=true +autorestart=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:php-fpm] +command=php-fpm --nodaemonize +autostart=true +autorestart=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 \ No newline at end of file -- 2.45.2 From 9aaae974d654bc03a8da848a65dc6edf47926cb8 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 27 Jul 2025 11:37:53 +0200 Subject: [PATCH 53/61] Re-structure file --- README.md | 59 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 53 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 9e0bff9..3e54154 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,29 @@ -# incr +
-A minimalist one-page Laravel + React application for tracking VWCE shares with milestone reinforcement and optional financial insights. +# 📈 incr + +**A minimalist investment tracker for VWCE shares with milestone-driven progress** + +*Track your portfolio growth with visual progress indicators and milestone reinforcement* + +[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) +[![Docker](https://img.shields.io/badge/Docker-Ready-2496ED?logo=docker&logoColor=white)](https://www.docker.com/) +[![Laravel](https://img.shields.io/badge/Laravel-12-FF2D20?logo=laravel&logoColor=white)](https://laravel.com/) +[![React](https://img.shields.io/badge/React-19-61DAFB?logo=react&logoColor=black)](https://reactjs.org/) + +--- + +**[Introduction](#introduction) • [Features](#features) • [Tech Stack](#tech-stack) • [Getting Started](#getting-started) • [Development](#development) • [Contributing](#contributing) • [License](#license)** + +--- + +
+ +## Introduction + +Incr is a minimalist, one-page investment tracking application designed specifically for VWCE (Vanguard FTSE All-World UCITS ETF) shareholders. It combines the satisfaction of visual progress tracking with practical portfolio management, featuring a distinctive LED-style digital display and milestone-based goal setting. + +The application emphasizes simplicity and focus, providing just what you need to track your investment journey without overwhelming complexity. ## Features @@ -17,7 +40,9 @@ ## Tech Stack - **Styling**: Tailwind CSS 4 with shadcn/ui components - **Deployment**: Docker with multi-stage builds -## Quick Start (Production) +## Getting Started + +### Quick Start (Production) Run the application using Docker Compose: @@ -34,7 +59,9 @@ # Start the application **Default credentials**: You'll need to register a new account on first visit. -## Development Setup +## Development + +### Local Development Setup For local development with Laravel Sail: @@ -56,13 +83,33 @@ # Run migrations The development server will be available at `http://localhost` with hot reload enabled. -## Project Structure +### Project Structure - `app/` - Laravel backend (controllers, models, services) - `resources/js/` - React frontend components and pages - `docker/` - Production Docker configuration - `database/migrations/` - Database schema definitions +## Contributing + +We welcome contributions to incr! Whether you're reporting bugs, suggesting features, or submitting pull requests, your input helps make this project better. + +### How to Contribute + +1. Fork the repository +2. Create a feature branch (`git checkout -b feature/amazing-feature`) +3. Commit your changes (`git commit -m 'Add some amazing feature'`) +4. Push to the branch (`git push origin feature/amazing-feature`) +5. Open a Pull Request + +### Bug Reports + +If you find a bug, please create an issue with: +- A clear description of the problem +- Steps to reproduce the issue +- Expected vs actual behavior +- Your environment details + ## License -GPLv3 License. See LICENSE file for details. \ No newline at end of file +This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details. \ No newline at end of file -- 2.45.2 From 861d4690826158ff9b948b3fcde154a031d31a62 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 27 Jul 2025 16:23:56 +0200 Subject: [PATCH 54/61] Add compose file as production instruction --- README.md | 72 ++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 61 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 3e54154..a3de9c7 100644 --- a/README.md +++ b/README.md @@ -44,24 +44,74 @@ ## Getting Started ### Quick Start (Production) -Run the application using Docker Compose: +#### Docker + +Create a `docker-compose.yml` file: + +```yaml +services: + app: + image: codeberg.org/lvl0/incr:0.1.14 + container_name: incr-app + restart: unless-stopped + working_dir: /var/www/html + environment: + - APP_ENV=production + - APP_DEBUG=false + - DB_CONNECTION=mysql + - DB_HOST=db + - DB_PORT=3306 + - DB_DATABASE=incr + - DB_USERNAME=incr_user + - DB_PASSWORD=incr_password + volumes: + - ./storage:/var/www/html/storage + - ./public:/var/www/html/public + ports: + - "80:80" + depends_on: + - db + networks: + - incr-network + + db: + image: mysql:8.0 + container_name: incr-db + restart: unless-stopped + environment: + - MYSQL_DATABASE=incr + - MYSQL_USER=incr_user + - MYSQL_PASSWORD=incr_password + - MYSQL_ROOT_PASSWORD=root_password + volumes: + - db_data:/var/lib/mysql + ports: + - "3306:3306" + networks: + - incr-network + +networks: + incr-network: + driver: bridge + +volumes: + db_data: + driver: local +``` + +Then run: ```bash -# Clone the repository -git clone https://codeberg.org/lvl0/incr.git -cd incr - -# Start the application -docker compose -f docker/docker-compose.yml up -d +docker compose up -d ``` The application will be available at `http://localhost`. **Default credentials**: You'll need to register a new account on first visit. -## Development +### Development -### Local Development Setup +#### Local Development Setup For local development with Laravel Sail: @@ -83,7 +133,7 @@ # Run migrations The development server will be available at `http://localhost` with hot reload enabled. -### Project Structure +## Project Structure - `app/` - Laravel backend (controllers, models, services) - `resources/js/` - React frontend components and pages @@ -112,4 +162,4 @@ ### Bug Reports ## License -This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details. \ No newline at end of file +This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details. -- 2.45.2 From 502d84cc375e4b886dc806b0d4c1cd65abf749ff Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 27 Jul 2025 21:08:23 +0200 Subject: [PATCH 55/61] Fix compose file --- .env.example | 12 +++---- README.md | 70 ++++++++------------------------------- docker/docker-compose.yml | 22 ++++++++---- docker/start-app.sh | 16 +++++++++ 4 files changed, 50 insertions(+), 70 deletions(-) diff --git a/.env.example b/.env.example index 35db1dd..1625c64 100644 --- a/.env.example +++ b/.env.example @@ -20,12 +20,12 @@ LOG_STACK=single LOG_DEPRECATIONS_CHANNEL=null LOG_LEVEL=debug -DB_CONNECTION=sqlite -# DB_HOST=127.0.0.1 -# DB_PORT=3306 -# DB_DATABASE=laravel -# DB_USERNAME=root -# DB_PASSWORD= +DB_CONNECTION=mysql +DB_HOST=db +DB_PORT=3306 +DB_DATABASE=incr +DB_USERNAME=incr_user +DB_PASSWORD=incr_password SESSION_DRIVER=database SESSION_LIFETIME=120 diff --git a/README.md b/README.md index a3de9c7..0f88733 100644 --- a/README.md +++ b/README.md @@ -46,68 +46,24 @@ ### Quick Start (Production) #### Docker -Create a `docker-compose.yml` file: - -```yaml -services: - app: - image: codeberg.org/lvl0/incr:0.1.14 - container_name: incr-app - restart: unless-stopped - working_dir: /var/www/html - environment: - - APP_ENV=production - - APP_DEBUG=false - - DB_CONNECTION=mysql - - DB_HOST=db - - DB_PORT=3306 - - DB_DATABASE=incr - - DB_USERNAME=incr_user - - DB_PASSWORD=incr_password - volumes: - - ./storage:/var/www/html/storage - - ./public:/var/www/html/public - ports: - - "80:80" - depends_on: - - db - networks: - - incr-network - - db: - image: mysql:8.0 - container_name: incr-db - restart: unless-stopped - environment: - - MYSQL_DATABASE=incr - - MYSQL_USER=incr_user - - MYSQL_PASSWORD=incr_password - - MYSQL_ROOT_PASSWORD=root_password - volumes: - - db_data:/var/lib/mysql - ports: - - "3306:3306" - networks: - - incr-network - -networks: - incr-network: - driver: bridge - -volumes: - db_data: - driver: local -``` - -Then run: +Clone the repository and run with Docker Compose: ```bash -docker compose up -d +git clone https://github.com/your-username/incr.git +cd incr ``` -The application will be available at `http://localhost`. +Run the application using the provided docker-compose configuration: -**Default credentials**: You'll need to register a new account on first visit. +```bash +# Using Docker Compose +docker-compose -f docker/docker-compose.yml up --build + +# Or using Podman Compose +podman-compose -f docker/docker-compose.yml up --build +``` + +The application will be available at `http://localhost:5001`. ### Development diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 1b0e27d..cb2e0ac 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -2,7 +2,10 @@ version: '3.8' services: app: - image: codeberg.org/lvl0/incr:0.1.14 +# image: codeberg.org/lvl0/incr:latest + build: + context: .. + dockerfile: docker/Dockerfile container_name: incr-app restart: unless-stopped working_dir: /var/www/html @@ -15,18 +18,17 @@ services: - DB_DATABASE=incr - DB_USERNAME=incr_user - DB_PASSWORD=incr_password - volumes: - - ../storage:/var/www/html/storage - - ../public:/var/www/html/public + volumes: [] ports: - - "80:80" + - "5001:80" depends_on: - - db + db: + condition: service_healthy networks: - incr-network db: - image: mysql:8.0 + image: docker.io/library/mysql:8.0 container_name: incr-db restart: unless-stopped environment: @@ -38,6 +40,12 @@ services: - db_data:/var/lib/mysql ports: - "3306:3306" + healthcheck: + test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "incr_user", "-pincr_password"] + timeout: 10s + retries: 10 + interval: 10s + start_period: 10s networks: - incr-network diff --git a/docker/start-app.sh b/docker/start-app.sh index d0db65d..d617f29 100644 --- a/docker/start-app.sh +++ b/docker/start-app.sh @@ -3,6 +3,22 @@ # Copy public files to shared volume if needed cp -r /var/www/html/public/. /var/www/html/public_shared/ 2>/dev/null || true +# Create .env file if it doesn't exist +if [ ! -f /var/www/html/.env ]; then + cp /var/www/html/.env.example /var/www/html/.env 2>/dev/null || touch /var/www/html/.env +fi + +# Wait for database to be ready +echo "Waiting for database..." +until php artisan tinker --execute="DB::connection()->getPdo();" 2>/dev/null; do + echo "Database not ready, waiting..." + sleep 2 +done +echo "Database is ready!" + +# Generate app key if not set +php artisan key:generate --force + # Laravel optimizations php artisan config:cache php artisan route:cache -- 2.45.2 From d0f54fcf9ca44b166da8787c8267f24ee2ebf275 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Tue, 29 Jul 2025 21:02:54 +0200 Subject: [PATCH 56/61] Fix compose file --- README.md | 2 +- docker/docker-compose.yml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0f88733..21b067a 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ # Or using Podman Compose ### Development #### Local Development Setup - +I snoone diffone For local development with Laravel Sail: ```bash diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index cb2e0ac..7a4ed23 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -2,10 +2,10 @@ version: '3.8' services: app: -# image: codeberg.org/lvl0/incr:latest - build: - context: .. - dockerfile: docker/Dockerfile + image: codeberg.org/lvl0/incr:latest +# build: +# context: .. +# dockerfile: docker/Dockerfile container_name: incr-app restart: unless-stopped working_dir: /var/www/html -- 2.45.2 From 24143d53aca382b687db441ee8ebd16994b74dbe Mon Sep 17 00:00:00 2001 From: myrmidex Date: Tue, 29 Jul 2025 21:27:19 +0200 Subject: [PATCH 57/61] Dev server via podman --- README.md | 44 +++++++++++-- docker/dev/podman/Dockerfile | 52 ++++++++++++++++ docker/dev/podman/docker-compose.yml | 72 ++++++++++++++++++++++ docker/dev/podman/podman-sail-alias.sh | 26 ++++++++ docker/dev/podman/start-dev.sh | 52 ++++++++++++++++ docker/{ => production}/Dockerfile | 0 docker/{ => production}/docker-compose.yml | 0 docker/{ => production}/nginx.conf | 0 docker/{ => production}/start-app.sh | 0 docker/{ => production}/supervisord.conf | 0 10 files changed, 242 insertions(+), 4 deletions(-) create mode 100644 docker/dev/podman/Dockerfile create mode 100644 docker/dev/podman/docker-compose.yml create mode 100644 docker/dev/podman/podman-sail-alias.sh create mode 100644 docker/dev/podman/start-dev.sh rename docker/{ => production}/Dockerfile (100%) rename docker/{ => production}/docker-compose.yml (100%) rename docker/{ => production}/nginx.conf (100%) rename docker/{ => production}/start-app.sh (100%) rename docker/{ => production}/supervisord.conf (100%) diff --git a/README.md b/README.md index 21b067a..a7eb0fa 100644 --- a/README.md +++ b/README.md @@ -57,10 +57,10 @@ #### Docker ```bash # Using Docker Compose -docker-compose -f docker/docker-compose.yml up --build +docker-compose -f docker/production/docker-compose.yml up --build # Or using Podman Compose -podman-compose -f docker/docker-compose.yml up --build +podman-compose -f docker/production/docker-compose.yml up --build ``` The application will be available at `http://localhost:5001`. @@ -68,7 +68,9 @@ # Or using Podman Compose ### Development #### Local Development Setup -I snoone diffone + +**Option 1: Laravel Sail (Docker)** + For local development with Laravel Sail: ```bash @@ -87,13 +89,47 @@ # Run migrations sail artisan migrate ``` +**Option 2: Podman Development** + +For Fedora Atomic or other Podman-based systems: + +```bash +# Quick start with helper script +bash docker/dev/podman/start-dev.sh + +# Or manually: +# Install podman-compose if not available +pip3 install --user podman-compose + +# Start development environment +podman-compose -f docker/dev/podman/docker-compose.yml up -d + +# Run migrations +podman exec incr-dev-app php artisan migrate +``` + +**Option 3: Sail with Podman (Compatibility Layer)** + +To use Laravel Sail commands with Podman: + +```bash +# Source the alias script +source docker/dev/podman/podman-sail-alias.sh + +# Now you can use sail commands as normal +sail up -d +sail artisan migrate +sail npm run dev +``` + The development server will be available at `http://localhost` with hot reload enabled. ## Project Structure - `app/` - Laravel backend (controllers, models, services) - `resources/js/` - React frontend components and pages -- `docker/` - Production Docker configuration +- `docker/production/` - Production Docker configuration +- `docker/dev/podman/` - Development Podman configuration - `database/migrations/` - Database schema definitions ## Contributing diff --git a/docker/dev/podman/Dockerfile b/docker/dev/podman/Dockerfile new file mode 100644 index 0000000..98a340c --- /dev/null +++ b/docker/dev/podman/Dockerfile @@ -0,0 +1,52 @@ +FROM docker.io/library/php:8.2-fpm + +# Install system dependencies +RUN apt-get update && apt-get install -y \ + git \ + curl \ + libpng-dev \ + libonig-dev \ + libxml2-dev \ + zip \ + unzip \ + nodejs \ + npm \ + default-mysql-client \ + && docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd + +# Install Composer +COPY --from=composer:latest /usr/bin/composer /usr/bin/composer + +# Set working directory +WORKDIR /var/www/html + +# Install Node.js 20.x (for better compatibility) +RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ + && apt-get install -y nodejs + +# Copy composer files and install PHP dependencies +COPY composer.json composer.lock ./ +RUN composer install --no-dev --optimize-autoloader --no-scripts + +# Copy package.json and install Node dependencies +COPY package*.json ./ +RUN npm ci + +# Copy application code +COPY . . + +# Set permissions +RUN chown -R www-data:www-data /var/www/html \ + && chmod -R 755 /var/www/html/storage \ + && chmod -R 755 /var/www/html/bootstrap/cache + +# Create start script +RUN echo '#!/bin/bash\n\ +php artisan serve --host=0.0.0.0 --port=8000 &\n\ +npm run dev -- --host 0.0.0.0\n\ +wait' > /usr/local/bin/start-dev.sh \ + && chmod +x /usr/local/bin/start-dev.sh + +EXPOSE 8000 5173 + +CMD ["/usr/local/bin/start-dev.sh"] \ No newline at end of file diff --git a/docker/dev/podman/docker-compose.yml b/docker/dev/podman/docker-compose.yml new file mode 100644 index 0000000..e874056 --- /dev/null +++ b/docker/dev/podman/docker-compose.yml @@ -0,0 +1,72 @@ +version: '3.8' + +services: + app: + build: + context: ../../.. + dockerfile: docker/dev/podman/Dockerfile + container_name: incr-dev-app + restart: unless-stopped + working_dir: /var/www/html + environment: + - APP_ENV=local + - APP_DEBUG=true + - APP_KEY=base64:YOUR_APP_KEY_HERE + - DB_CONNECTION=mysql + - DB_HOST=db + - DB_PORT=3306 + - DB_DATABASE=incr_dev + - DB_USERNAME=incr_user + - DB_PASSWORD=incr_password + - VITE_PORT=5173 + volumes: + - ../../../:/var/www/html:Z + - /var/www/html/node_modules + - /var/www/html/vendor + ports: + - "8000:8000" + - "5173:5173" + depends_on: + db: + condition: service_healthy + networks: + - incr-dev-network + + db: + image: docker.io/library/mysql:8.0 + container_name: incr-dev-db + restart: unless-stopped + environment: + - MYSQL_DATABASE=incr_dev + - MYSQL_USER=incr_user + - MYSQL_PASSWORD=incr_password + - MYSQL_ROOT_PASSWORD=root_password + volumes: + - db_data:/var/lib/mysql + ports: + - "3307:3306" + healthcheck: + test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "incr_user", "-pincr_password"] + timeout: 10s + retries: 10 + interval: 10s + start_period: 10s + networks: + - incr-dev-network + + redis: + image: docker.io/library/redis:7-alpine + container_name: incr-dev-redis + restart: unless-stopped + ports: + - "6379:6379" + networks: + - incr-dev-network + +networks: + incr-dev-network: + driver: bridge + +volumes: + db_data: + driver: local \ No newline at end of file diff --git a/docker/dev/podman/podman-sail-alias.sh b/docker/dev/podman/podman-sail-alias.sh new file mode 100644 index 0000000..abd4463 --- /dev/null +++ b/docker/dev/podman/podman-sail-alias.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# Podman aliases for Laravel Sail compatibility +# Source this file to use Sail commands with Podman +# Usage: source docker/dev/podman/podman-sail-alias.sh + +# Create docker alias pointing to podman +alias docker='podman' + +# Create docker-compose alias pointing to podman-compose +alias docker-compose='podman-compose' + +# Sail wrapper function that uses podman-compose +sail() { + if [[ -f docker/dev/podman/docker-compose.yml ]]; then + podman-compose -f docker/dev/podman/docker-compose.yml "$@" + else + echo "❌ Podman compose file not found at docker/dev/podman/docker-compose.yml" + return 1 + fi +} + +echo "✅ Podman aliases set up for Laravel Sail compatibility" +echo "🐳 'docker' → 'podman'" +echo "🔧 'docker-compose' → 'podman-compose'" +echo "⛵ 'sail' → uses podman-compose with dev configuration" \ No newline at end of file diff --git a/docker/dev/podman/start-dev.sh b/docker/dev/podman/start-dev.sh new file mode 100644 index 0000000..a997713 --- /dev/null +++ b/docker/dev/podman/start-dev.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +# Podman development environment startup script for incr + +set -e + +echo "🚀 Starting incr development environment with Podman..." + +# Check if .env exists +if [ ! -f .env ]; then + echo "📋 Creating .env file from .env.example..." + cp .env.example .env + echo "⚠️ Please update your .env file with appropriate values, especially APP_KEY" +fi + +# Check if podman-compose is available +if ! command -v podman-compose &> /dev/null; then + echo "❌ podman-compose not found. Installing..." + pip3 install --user podman-compose + echo "✅ podman-compose installed" +fi + +# Start services +echo "🔧 Starting services..." +podman-compose -f docker/dev/podman/docker-compose.yml up -d + +# Wait for database to be ready +echo "⏳ Waiting for database to be ready..." +sleep 10 + +# Check if APP_KEY is set +if grep -q "APP_KEY=base64:YOUR_APP_KEY_HERE" .env || grep -q "APP_KEY=$" .env; then + echo "🔑 Generating application key..." + podman exec incr-dev-app php artisan key:generate +fi + +# Run migrations +echo "🗃️ Running database migrations..." +podman exec incr-dev-app php artisan migrate + +# Install/update dependencies if needed +echo "📦 Installing dependencies..." +podman exec incr-dev-app composer install +podman exec incr-dev-app npm install + +echo "✅ Development environment is ready!" +echo "🌐 Application: http://localhost:8000" +echo "🔥 Vite dev server: http://localhost:5173" +echo "💾 Database: localhost:3307" +echo "" +echo "To stop: podman-compose -f docker/dev/podman/docker-compose.yml down" +echo "To view logs: podman-compose -f docker/dev/podman/docker-compose.yml logs -f" \ No newline at end of file diff --git a/docker/Dockerfile b/docker/production/Dockerfile similarity index 100% rename from docker/Dockerfile rename to docker/production/Dockerfile diff --git a/docker/docker-compose.yml b/docker/production/docker-compose.yml similarity index 100% rename from docker/docker-compose.yml rename to docker/production/docker-compose.yml diff --git a/docker/nginx.conf b/docker/production/nginx.conf similarity index 100% rename from docker/nginx.conf rename to docker/production/nginx.conf diff --git a/docker/start-app.sh b/docker/production/start-app.sh similarity index 100% rename from docker/start-app.sh rename to docker/production/start-app.sh diff --git a/docker/supervisord.conf b/docker/production/supervisord.conf similarity index 100% rename from docker/supervisord.conf rename to docker/production/supervisord.conf -- 2.45.2 From 2adb690d28f7644ea14367b0ca09c7773a572fc7 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Fri, 1 Aug 2025 00:03:50 +0200 Subject: [PATCH 58/61] Fix dev container --- docker/dev/podman/Dockerfile | 11 ++++------- docker/dev/podman/container-start.sh | 28 ++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 7 deletions(-) create mode 100644 docker/dev/podman/container-start.sh diff --git a/docker/dev/podman/Dockerfile b/docker/dev/podman/Dockerfile index 98a340c..49d2834 100644 --- a/docker/dev/podman/Dockerfile +++ b/docker/dev/podman/Dockerfile @@ -40,13 +40,10 @@ RUN chown -R www-data:www-data /var/www/html \ && chmod -R 755 /var/www/html/storage \ && chmod -R 755 /var/www/html/bootstrap/cache -# Create start script -RUN echo '#!/bin/bash\n\ -php artisan serve --host=0.0.0.0 --port=8000 &\n\ -npm run dev -- --host 0.0.0.0\n\ -wait' > /usr/local/bin/start-dev.sh \ - && chmod +x /usr/local/bin/start-dev.sh +# Copy and set up container start script +COPY docker/dev/podman/container-start.sh /usr/local/bin/container-start.sh +RUN chmod +x /usr/local/bin/container-start.sh EXPOSE 8000 5173 -CMD ["/usr/local/bin/start-dev.sh"] \ No newline at end of file +CMD ["/usr/local/bin/container-start.sh"] \ No newline at end of file diff --git a/docker/dev/podman/container-start.sh b/docker/dev/podman/container-start.sh new file mode 100644 index 0000000..4cfc0f6 --- /dev/null +++ b/docker/dev/podman/container-start.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# Create .env file if it doesn't exist +if [ ! -f /var/www/html/.env ]; then + cp /var/www/html/.env.example /var/www/html/.env 2>/dev/null || touch /var/www/html/.env +fi + +# Fix database name to match compose file +sed -i 's/DB_DATABASE=incr$/DB_DATABASE=incr_dev/' /var/www/html/.env + +# Generate app key if not set or empty +if ! grep -q "APP_KEY=base64:" /var/www/html/.env; then + # Generate a new key and set it directly + NEW_KEY=$(php -r "echo 'base64:' . base64_encode(random_bytes(32));") + sed -i "s/APP_KEY=/APP_KEY=$NEW_KEY/" /var/www/html/.env +fi + +# Run migrations +php artisan migrate --force + +# Start Laravel development server in background +php artisan serve --host=0.0.0.0 --port=8000 & + +# Start Vite development server +npm run dev -- --host 0.0.0.0 + +# Wait for background processes +wait \ No newline at end of file -- 2.45.2 From 17b7ea4aead301875cf6015e587fbd724550ee77 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Fri, 1 Aug 2025 00:36:05 +0200 Subject: [PATCH 59/61] Onboarding backend --- app/Http/Controllers/AssetController.php | 97 +++++++++++++++++++ .../Controllers/Pricing/PricingController.php | 23 ++++- app/Models/Asset.php | 67 +++++++++++++ app/Models/Pricing/AssetPrice.php | 44 +++++++-- app/Models/User.php | 33 ++++++- .../0001_01_01_000000_create_users_table.php | 3 + ...07_10_152716_create_asset_prices_table.php | 4 +- .../2025_07_31_222423_create_assets_table.php | 25 +++++ routes/web.php | 11 +++ 9 files changed, 287 insertions(+), 20 deletions(-) create mode 100644 app/Http/Controllers/AssetController.php create mode 100644 app/Models/Asset.php create mode 100644 database/migrations/2025_07_31_222423_create_assets_table.php diff --git a/app/Http/Controllers/AssetController.php b/app/Http/Controllers/AssetController.php new file mode 100644 index 0000000..3880b94 --- /dev/null +++ b/app/Http/Controllers/AssetController.php @@ -0,0 +1,97 @@ +get(); + + return response()->json($assets); + } + + public function current(): JsonResponse + { + $user = Auth::user(); + $asset = $user->asset; + + return response()->json([ + 'asset' => $asset, + ]); + } + + public function setCurrent(Request $request): JsonResponse + { + $validated = $request->validate([ + 'symbol' => 'required|string|max:10', + 'full_name' => 'nullable|string|max:255', + ]); + + $asset = Asset::findOrCreateBySymbol( + $validated['symbol'], + $validated['full_name'] ?? null + ); + + $user = Auth::user(); + $user->update(['asset_id' => $asset->id]); + + return response()->json([ + 'success' => true, + 'message' => 'Asset set successfully!', + 'asset' => $asset, + ]); + } + + public function store(Request $request): JsonResponse + { + $validated = $request->validate([ + 'symbol' => 'required|string|max:10|unique:assets,symbol', + 'full_name' => 'nullable|string|max:255', + ]); + + $asset = Asset::create([ + 'symbol' => strtoupper($validated['symbol']), + 'full_name' => $validated['full_name'], + ]); + + return response()->json([ + 'success' => true, + 'message' => 'Asset created successfully!', + 'asset' => $asset, + ], 201); + } + + public function show(Asset $asset): JsonResponse + { + $asset->load('assetPrices'); + $currentPrice = $asset->currentPrice(); + + return response()->json([ + 'asset' => $asset, + 'current_price' => $currentPrice, + ]); + } + + public function search(Request $request): JsonResponse + { + $query = $request->get('q'); + + if (!$query) { + return response()->json([]); + } + + $assets = Asset::where('symbol', 'like', "%{$query}%") + ->orWhere('full_name', 'like', "%{$query}%") + ->orderBy('symbol') + ->limit(10) + ->get(); + + return response()->json($assets); + } +} \ No newline at end of file diff --git a/app/Http/Controllers/Pricing/PricingController.php b/app/Http/Controllers/Pricing/PricingController.php index bb07156..8dba55f 100644 --- a/app/Http/Controllers/Pricing/PricingController.php +++ b/app/Http/Controllers/Pricing/PricingController.php @@ -11,7 +11,10 @@ class PricingController extends Controller { public function current(): JsonResponse { - $price = AssetPrice::current(); + $user = auth()->user(); + $assetId = $user->asset_id; + + $price = AssetPrice::current($assetId); return response()->json([ 'current_price' => $price, @@ -25,22 +28,34 @@ public function update(Request $request) 'price' => 'required|numeric|min:0.0001', ]); - $assetPrice = AssetPrice::updatePrice($validated['date'], $validated['price']); + $user = auth()->user(); + + if (!$user->asset_id) { + return back()->withErrors(['asset' => 'Please set an asset first.']); + } + + $assetPrice = AssetPrice::updatePrice($user->asset_id, $validated['date'], $validated['price']); return back()->with('success', 'Asset price updated successfully!'); } public function history(Request $request): JsonResponse { + $user = auth()->user(); + $assetId = $user->asset_id; + $limit = $request->get('limit', 30); - $history = AssetPrice::history($limit); + $history = AssetPrice::history($assetId, $limit); return response()->json($history); } public function forDate(Request $request, string $date): JsonResponse { - $price = AssetPrice::forDate($date); + $user = auth()->user(); + $assetId = $user->asset_id; + + $price = AssetPrice::forDate($date, $assetId); return response()->json([ 'date' => $date, diff --git a/app/Models/Asset.php b/app/Models/Asset.php new file mode 100644 index 0000000..88fe97a --- /dev/null +++ b/app/Models/Asset.php @@ -0,0 +1,67 @@ + 'string', + 'full_name' => 'string', + ]; + + public function assetPrices(): HasMany + { + return $this->hasMany(Pricing\AssetPrice::class); + } + + public function users(): HasMany + { + return $this->hasMany(User::class); + } + + public function currentPrice(): ?float + { + $latestPrice = $this->assetPrices()->latest('date')->first(); + + return $latestPrice ? $latestPrice->price : null; + } + + public static function findBySymbol(string $symbol): ?self + { + return static::where('symbol', strtoupper($symbol))->first(); + } + + public static function findOrCreateBySymbol(string $symbol, ?string $fullName = null): self + { + $asset = static::findBySymbol($symbol); + + if (! $asset) { + $asset = static::create([ + 'symbol' => strtoupper($symbol), + 'full_name' => $fullName, + ]); + } + + return $asset; + } +} diff --git a/app/Models/Pricing/AssetPrice.php b/app/Models/Pricing/AssetPrice.php index 2d3b6cf..e3f5d04 100644 --- a/app/Models/Pricing/AssetPrice.php +++ b/app/Models/Pricing/AssetPrice.php @@ -5,6 +5,7 @@ use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Support\Carbon; /** @@ -20,6 +21,7 @@ class AssetPrice extends Model use HasFactory; protected $fillable = [ + 'asset_id', 'date', 'price', ]; @@ -29,32 +31,54 @@ class AssetPrice extends Model 'price' => 'decimal:4', ]; - public static function current(): ?float + public function asset(): BelongsTo { - $latestPrice = static::latest('date')->first(); + return $this->belongsTo(\App\Models\Asset::class); + } + + public static function current(int $assetId = null): ?float + { + $query = static::latest('date'); + + if ($assetId) { + $query->where('asset_id', $assetId); + } + + $latestPrice = $query->first(); return $latestPrice ? $latestPrice->price : null; } - public static function forDate(string $date): ?float + public static function forDate(string $date, int $assetId = null): ?float { - $price = static::where('date', '<=', $date) - ->orderBy('date', 'desc') - ->first(); + $query = static::where('date', '<=', $date) + ->orderBy('date', 'desc'); + + if ($assetId) { + $query->where('asset_id', $assetId); + } + + $price = $query->first(); return $price ? $price->price : null; } - public static function updatePrice(string $date, float $price): self + public static function updatePrice(int $assetId, string $date, float $price): self { return static::updateOrCreate( - ['date' => $date], + ['asset_id' => $assetId, 'date' => $date], ['price' => $price] ); } - public static function history(int $limit = 30): Collection + public static function history(int $assetId = null, int $limit = 30): Collection { - return static::orderBy('date', 'desc')->limit($limit)->get(); + $query = static::orderBy('date', 'desc')->limit($limit); + + if ($assetId) { + $query->where('asset_id', $assetId); + } + + return $query->get(); } } diff --git a/app/Models/User.php b/app/Models/User.php index 749c7b7..e8d3f00 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -4,9 +4,13 @@ // use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Database\Eloquent\Factories\HasFactory; +use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; +/** + * @property int $asset_id + */ class User extends Authenticatable { /** @use HasFactory<\Database\Factories\UserFactory> */ @@ -21,6 +25,7 @@ class User extends Authenticatable 'name', 'email', 'password', + 'asset_id', ]; /** @@ -33,11 +38,6 @@ class User extends Authenticatable 'remember_token', ]; - /** - * Get the attributes that should be cast. - * - * @return array - */ protected function casts(): array { return [ @@ -45,4 +45,27 @@ protected function casts(): array 'password' => 'hashed', ]; } + + public function asset(): BelongsTo + { + return $this->belongsTo(Asset::class); + } + + public function hasCompletedOnboarding(): bool + { + // Check if user has asset, purchases, and milestones + return $this->asset_id !== null + && $this->hasPurchases() + && $this->hasMilestones(); + } + + public function hasPurchases(): bool + { + return \App\Models\Transactions\Purchase::totalShares() > 0; + } + + public function hasMilestones(): bool + { + return \App\Models\Milestone::count() > 0; + } } diff --git a/database/migrations/0001_01_01_000000_create_users_table.php b/database/migrations/0001_01_01_000000_create_users_table.php index 05fb5d9..9cb9538 100644 --- a/database/migrations/0001_01_01_000000_create_users_table.php +++ b/database/migrations/0001_01_01_000000_create_users_table.php @@ -17,8 +17,11 @@ public function up(): void $table->string('email')->unique(); $table->timestamp('email_verified_at')->nullable(); $table->string('password'); + $table->foreignId('asset_id')->nullable()->constrained()->onDelete('set null'); $table->rememberToken(); $table->timestamps(); + + $table->index('asset_id'); }); Schema::create('password_reset_tokens', function (Blueprint $table) { diff --git a/database/migrations/2025_07_10_152716_create_asset_prices_table.php b/database/migrations/2025_07_10_152716_create_asset_prices_table.php index 94ebab3..36653db 100644 --- a/database/migrations/2025_07_10_152716_create_asset_prices_table.php +++ b/database/migrations/2025_07_10_152716_create_asset_prices_table.php @@ -10,11 +10,13 @@ public function up(): void { Schema::create('asset_prices', function (Blueprint $table) { $table->id(); + $table->foreignId('asset_id')->constrained()->onDelete('cascade'); $table->date('date'); $table->decimal('price', 10, 4); $table->timestamps(); - $table->unique('date'); + $table->unique(['asset_id', 'date']); + $table->index('asset_id'); $table->index('date'); }); } diff --git a/database/migrations/2025_07_31_222423_create_assets_table.php b/database/migrations/2025_07_31_222423_create_assets_table.php new file mode 100644 index 0000000..a27ba44 --- /dev/null +++ b/database/migrations/2025_07_31_222423_create_assets_table.php @@ -0,0 +1,25 @@ +id(); + $table->string('symbol')->unique(); + $table->string('full_name')->nullable(); + $table->timestamps(); + + $table->index('symbol'); + }); + } + + public function down(): void + { + Schema::dropIfExists('assets'); + } +}; diff --git a/routes/web.php b/routes/web.php index 3ee6392..9cb1e25 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,5 +1,6 @@ name('dashboard'); +// Asset routes +Route::prefix('assets')->name('assets.')->group(function () { + Route::get('/', [AssetController::class, 'index'])->name('index'); + Route::post('/', [AssetController::class, 'store'])->name('store'); + Route::get('/current', [AssetController::class, 'current'])->name('current'); + Route::post('/set-current', [AssetController::class, 'setCurrent'])->name('set-current'); + Route::get('/search', [AssetController::class, 'search'])->name('search'); + Route::get('/{asset}', [AssetController::class, 'show'])->name('show'); +}); + // Purchase routes Route::prefix('purchases')->name('purchases.')->group(function () { Route::get('/', [PurchaseController::class, 'index'])->name('index'); -- 2.45.2 From 5e7032c270b5c03ccd51320e0017c903a6f4277d Mon Sep 17 00:00:00 2001 From: myrmidex Date: Fri, 1 Aug 2025 00:56:26 +0200 Subject: [PATCH 60/61] Onboarding frontend --- app/Http/Controllers/AssetController.php | 29 ++- .../Controllers/Pricing/PricingController.php | 20 +- .../Transactions/PurchaseController.php | 7 +- ...0001_01_01_000000_create_assets_table.php} | 0 ... 0001_01_01_000001_create_users_table.php} | 0 ... 0001_01_01_000002_create_cache_table.php} | 0 ...> 0001_01_01_000003_create_jobs_table.php} | 0 .../js/components/Assets/AssetSetupForm.tsx | 156 ++++++++++++ .../components/Onboarding/OnboardingFlow.tsx | 234 ++++++++++++++++++ .../js/components/Pricing/UpdatePriceForm.tsx | 9 +- .../Transactions/AddPurchaseForm.tsx | 32 ++- resources/js/pages/dashboard.tsx | 87 ++++++- 12 files changed, 546 insertions(+), 28 deletions(-) rename database/migrations/{2025_07_31_222423_create_assets_table.php => 0001_01_01_000000_create_assets_table.php} (100%) rename database/migrations/{0001_01_01_000000_create_users_table.php => 0001_01_01_000001_create_users_table.php} (100%) rename database/migrations/{0001_01_01_000001_create_cache_table.php => 0001_01_01_000002_create_cache_table.php} (100%) rename database/migrations/{0001_01_01_000002_create_jobs_table.php => 0001_01_01_000003_create_jobs_table.php} (100%) create mode 100644 resources/js/components/Assets/AssetSetupForm.tsx create mode 100644 resources/js/components/Onboarding/OnboardingFlow.tsx diff --git a/app/Http/Controllers/AssetController.php b/app/Http/Controllers/AssetController.php index 3880b94..16adc1b 100644 --- a/app/Http/Controllers/AssetController.php +++ b/app/Http/Controllers/AssetController.php @@ -18,15 +18,16 @@ public function index(): JsonResponse public function current(): JsonResponse { - $user = Auth::user(); - $asset = $user->asset; + // Get the first/default user (since no auth) + $user = \App\Models\User::first(); + $asset = $user ? $user->asset : null; return response()->json([ 'asset' => $asset, ]); } - public function setCurrent(Request $request): JsonResponse + public function setCurrent(Request $request) { $validated = $request->validate([ 'symbol' => 'required|string|max:10', @@ -38,14 +39,22 @@ public function setCurrent(Request $request): JsonResponse $validated['full_name'] ?? null ); - $user = Auth::user(); - $user->update(['asset_id' => $asset->id]); + // Get or create the first/default user (since no auth) + $user = \App\Models\User::first(); + + if (!$user) { + // Create a default user if none exists + $user = \App\Models\User::create([ + 'name' => 'Default User', + 'email' => 'user@example.com', + 'password' => 'password', // This will be hashed automatically + 'asset_id' => $asset->id, + ]); + } else { + $user->update(['asset_id' => $asset->id]); + } - return response()->json([ - 'success' => true, - 'message' => 'Asset set successfully!', - 'asset' => $asset, - ]); + return back()->with('success', 'Asset set successfully!'); } public function store(Request $request): JsonResponse diff --git a/app/Http/Controllers/Pricing/PricingController.php b/app/Http/Controllers/Pricing/PricingController.php index 8dba55f..2a484be 100644 --- a/app/Http/Controllers/Pricing/PricingController.php +++ b/app/Http/Controllers/Pricing/PricingController.php @@ -11,8 +11,9 @@ class PricingController extends Controller { public function current(): JsonResponse { - $user = auth()->user(); - $assetId = $user->asset_id; + // Get the first/default user (since no auth) + $user = \App\Models\User::first(); + $assetId = $user ? $user->asset_id : null; $price = AssetPrice::current($assetId); @@ -28,9 +29,10 @@ public function update(Request $request) 'price' => 'required|numeric|min:0.0001', ]); - $user = auth()->user(); + // Get the first/default user (since no auth) + $user = \App\Models\User::first(); - if (!$user->asset_id) { + if (!$user || !$user->asset_id) { return back()->withErrors(['asset' => 'Please set an asset first.']); } @@ -41,8 +43,9 @@ public function update(Request $request) public function history(Request $request): JsonResponse { - $user = auth()->user(); - $assetId = $user->asset_id; + // Get the first/default user (since no auth) + $user = \App\Models\User::first(); + $assetId = $user ? $user->asset_id : null; $limit = $request->get('limit', 30); $history = AssetPrice::history($assetId, $limit); @@ -52,8 +55,9 @@ public function history(Request $request): JsonResponse public function forDate(Request $request, string $date): JsonResponse { - $user = auth()->user(); - $assetId = $user->asset_id; + // Get the first/default user (since no auth) + $user = \App\Models\User::first(); + $assetId = $user ? $user->asset_id : null; $price = AssetPrice::forDate($date, $assetId); diff --git a/app/Http/Controllers/Transactions/PurchaseController.php b/app/Http/Controllers/Transactions/PurchaseController.php index b0bd1a1..648e304 100644 --- a/app/Http/Controllers/Transactions/PurchaseController.php +++ b/app/Http/Controllers/Transactions/PurchaseController.php @@ -17,7 +17,7 @@ public function index(): JsonResponse return response()->json($purchases); } - public function store(Request $request): JsonResponse + public function store(Request $request) { $validated = $request->validate([ 'date' => 'required|date|before_or_equal:today', @@ -41,10 +41,7 @@ public function store(Request $request): JsonResponse 'total_cost' => $validated['total_cost'], ]); - return response()->json([ - 'success' => true, - 'message' => 'Purchase added successfully!', - ]); + return back()->with('success', 'Purchase added successfully!'); } public function summary() diff --git a/database/migrations/2025_07_31_222423_create_assets_table.php b/database/migrations/0001_01_01_000000_create_assets_table.php similarity index 100% rename from database/migrations/2025_07_31_222423_create_assets_table.php rename to database/migrations/0001_01_01_000000_create_assets_table.php diff --git a/database/migrations/0001_01_01_000000_create_users_table.php b/database/migrations/0001_01_01_000001_create_users_table.php similarity index 100% rename from database/migrations/0001_01_01_000000_create_users_table.php rename to database/migrations/0001_01_01_000001_create_users_table.php diff --git a/database/migrations/0001_01_01_000001_create_cache_table.php b/database/migrations/0001_01_01_000002_create_cache_table.php similarity index 100% rename from database/migrations/0001_01_01_000001_create_cache_table.php rename to database/migrations/0001_01_01_000002_create_cache_table.php diff --git a/database/migrations/0001_01_01_000002_create_jobs_table.php b/database/migrations/0001_01_01_000003_create_jobs_table.php similarity index 100% rename from database/migrations/0001_01_01_000002_create_jobs_table.php rename to database/migrations/0001_01_01_000003_create_jobs_table.php diff --git a/resources/js/components/Assets/AssetSetupForm.tsx b/resources/js/components/Assets/AssetSetupForm.tsx new file mode 100644 index 0000000..315d72b --- /dev/null +++ b/resources/js/components/Assets/AssetSetupForm.tsx @@ -0,0 +1,156 @@ +import { Button } from '@/components/ui/button'; +import { Input } from '@/components/ui/input'; +import { Label } from '@/components/ui/label'; +import InputError from '@/components/InputError'; +import { useForm } from '@inertiajs/react'; +import { LoaderCircle } from 'lucide-react'; +import { FormEventHandler, useState, useEffect } from 'react'; +import ComponentTitle from '@/components/ui/ComponentTitle'; + +interface AssetFormData { + symbol: string; + full_name: string; + [key: string]: string; +} + +interface AssetSetupFormProps { + onSuccess?: () => void; + onCancel?: () => void; +} + +export default function AssetSetupForm({ onSuccess, onCancel }: AssetSetupFormProps) { + const { data, setData, post, processing, errors } = useForm({ + symbol: '', + full_name: '', + }); + + // Load existing asset data on mount + useEffect(() => { + const fetchCurrentAsset = async () => { + try { + const response = await fetch('/assets/current'); + if (response.ok) { + const assetData = await response.json(); + if (assetData.asset) { + setData({ + symbol: assetData.asset.symbol || '', + full_name: assetData.asset.full_name || '', + }); + } + } + } catch (error) { + console.error('Failed to fetch current asset:', error); + } + }; + + fetchCurrentAsset(); + }, []); + + const [suggestions] = useState([ + { symbol: 'VWCE', full_name: 'Vanguard FTSE All-World UCITS ETF' }, + { symbol: 'VTI', full_name: 'Vanguard Total Stock Market ETF' }, + { symbol: 'SPY', full_name: 'SPDR S&P 500 ETF Trust' }, + { symbol: 'QQQ', full_name: 'Invesco QQQ Trust' }, + { symbol: 'IWDA', full_name: 'iShares Core MSCI World UCITS ETF' }, + ]); + + const submit: FormEventHandler = (e) => { + e.preventDefault(); + + post(route('assets.set-current'), { + onSuccess: () => { + if (onSuccess) onSuccess(); + }, + }); + }; + + const handleSuggestionClick = (suggestion: { symbol: string; full_name: string }) => { + setData({ + symbol: suggestion.symbol, + full_name: suggestion.full_name, + }); + }; + + return ( +
+
+ SET ASSET +

+ [SYSTEM] Specify the asset you want to track +

+ + {/* Quick suggestions */} +
+ +
+ {suggestions.map((suggestion) => ( + + ))} +
+
+ +
+
+ + setData('symbol', e.target.value.toUpperCase())} + className="bg-black border-red-500 text-red-400 focus:border-red-300 font-mono text-sm rounded-none border-2 focus:ring-0 focus:outline-none focus:shadow-[0_0_10px_rgba(239,68,68,0.5)] placeholder:text-red-400/40 transition-all" + /> +

+ [REQUIRED] ticker symbol (e.g. VWCE, VTI, SPY) +

+ +
+ +
+ + setData('full_name', e.target.value)} + className="bg-black border-red-500 text-red-400 focus:border-red-300 font-mono text-sm rounded-none border-2 focus:ring-0 focus:outline-none focus:shadow-[0_0_10px_rgba(239,68,68,0.5)] placeholder:text-red-400/40 transition-all" + /> +

+ [OPTIONAL] human-readable asset name +

+ +
+ +
+ + {onCancel && ( + + )} +
+
+
+
+ ); +} \ No newline at end of file diff --git a/resources/js/components/Onboarding/OnboardingFlow.tsx b/resources/js/components/Onboarding/OnboardingFlow.tsx new file mode 100644 index 0000000..e80f825 --- /dev/null +++ b/resources/js/components/Onboarding/OnboardingFlow.tsx @@ -0,0 +1,234 @@ +import { useState, useEffect } from 'react'; +import AssetSetupForm from '@/components/Assets/AssetSetupForm'; +import AddPurchaseForm from '@/components/Transactions/AddPurchaseForm'; +import AddMilestoneForm from '@/components/Milestones/AddMilestoneForm'; +import UpdatePriceForm from '@/components/Pricing/UpdatePriceForm'; + +interface OnboardingStep { + id: string; + title: string; + description: string; + completed: boolean; + required: boolean; +} + +interface OnboardingFlowProps { + onComplete?: () => void; +} + +export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) { + const [currentStep, setCurrentStep] = useState(0); + const [steps, setSteps] = useState([ + { + id: 'asset', + title: 'SET ASSET', + description: 'Choose the asset you want to track', + completed: false, + required: true, + }, + { + id: 'purchases', + title: 'ADD PURCHASES', + description: 'Enter your current holdings', + completed: false, + required: true, + }, + { + id: 'milestones', + title: 'SET MILESTONES', + description: 'Define your investment goals', + completed: false, + required: true, + }, + { + id: 'price', + title: 'CURRENT PRICE', + description: 'Set current asset price', + completed: false, + required: true, + }, + ]); + + // Check onboarding status on mount + useEffect(() => { + checkOnboardingStatus(); + }, []); + + const checkOnboardingStatus = async () => { + try { + // Check asset + const assetResponse = await fetch('/assets/current'); + const assetData = await assetResponse.json(); + const hasAsset = !!assetData.asset; + + // Check purchases + const purchaseResponse = await fetch('/purchases/summary'); + const purchaseData = await purchaseResponse.json(); + const hasPurchases = purchaseData.total_shares > 0; + + // Check milestones + const milestonesResponse = await fetch('/milestones'); + const milestonesData = await milestonesResponse.json(); + const hasMilestones = milestonesData.length > 0; + + // Check current price + const priceResponse = await fetch('/pricing/current'); + const priceData = await priceResponse.json(); + const hasPrice = !!priceData.current_price; + + setSteps(prev => prev.map(step => ({ + ...step, + completed: + (step.id === 'asset' && hasAsset) || + (step.id === 'purchases' && hasPurchases) || + (step.id === 'milestones' && hasMilestones) || + (step.id === 'price' && hasPrice) + }))); + + // Find first incomplete required step + const firstIncompleteStep = steps.findIndex(step => + step.required && !step.completed + ); + + if (firstIncompleteStep !== -1) { + setCurrentStep(firstIncompleteStep); + } else { + // All required steps complete, check if we should call onComplete + const allRequiredComplete = steps.filter(s => s.required).every(s => s.completed); + if (allRequiredComplete && onComplete) { + onComplete(); + } + } + } catch (error) { + console.error('Failed to check onboarding status:', error); + } + }; + + const handleStepComplete = async () => { + // Mark current step as completed + setSteps(prev => prev.map((step, index) => + index === currentStep ? { ...step, completed: true } : step + )); + + // Refresh onboarding status + await checkOnboardingStatus(); + + // Move to next incomplete step or complete onboarding + const nextIncompleteStep = steps.findIndex((step, index) => + index > currentStep && step.required && !step.completed + ); + + if (nextIncompleteStep !== -1) { + setCurrentStep(nextIncompleteStep); + } else { + // All required steps complete + const allRequiredComplete = steps.filter(s => s.required).every(s => s.completed); + if (allRequiredComplete && onComplete) { + onComplete(); + } + } + }; + + const handleStepSelect = (stepIndex: number) => { + setCurrentStep(stepIndex); + }; + + const renderStepContent = () => { + const step = steps[currentStep]; + + switch (step.id) { + case 'asset': + return ( + + ); + case 'purchases': + return ( + + ); + case 'milestones': + return ( + + ); + case 'price': + return ( + + ); + default: + return null; + } + }; + + return ( +
+
+ {/* Terminal-style border with red glow */} +
+ {/* Header */} +
+

+ [SYSTEM] ONBOARDING SEQUENCE +

+

+ Initialize your asset tracking system +

+
+ + {/* Progress indicator */} +
+
+ {steps.map((step, index) => ( + + ))} +
+ +
+

+ {steps[currentStep].description} +

+

+ STEP {currentStep + 1}/{steps.length} +

+
+
+ + {/* Step content */} +
+ {renderStepContent()} +
+ + {/* Status footer */} +
+
+

+ [STATUS] {steps.filter(s => s.completed).length}/{steps.length} STEPS COMPLETE +

+

+ {steps.filter(s => s.required && !s.completed).length} REQUIRED REMAINING +

+
+
+
+
+
+ ); +} \ No newline at end of file diff --git a/resources/js/components/Pricing/UpdatePriceForm.tsx b/resources/js/components/Pricing/UpdatePriceForm.tsx index fe99e3b..8a99c2b 100644 --- a/resources/js/components/Pricing/UpdatePriceForm.tsx +++ b/resources/js/components/Pricing/UpdatePriceForm.tsx @@ -23,7 +23,7 @@ interface UpdatePriceFormProps { export default function UpdatePriceForm({ currentPrice, className, onSuccess, onCancel }: UpdatePriceFormProps) { const { data, setData, post, processing, errors } = useForm({ date: new Date().toISOString().split('T')[0], // Today's date in YYYY-MM-DD format - price: currentPrice?.toString() || '', + price: currentPrice?.toString() || '100.00', }); const submit: FormEventHandler = (e) => { @@ -33,8 +33,13 @@ export default function UpdatePriceForm({ currentPrice, className, onSuccess, on onSuccess: () => { // Keep the date, reset only price if needed // User might want to update same day multiple times - if (onSuccess) onSuccess(); + if (onSuccess) { + onSuccess(); + } }, + onError: (errors) => { + console.error('Price update failed:', errors); + } }); }; diff --git a/resources/js/components/Transactions/AddPurchaseForm.tsx b/resources/js/components/Transactions/AddPurchaseForm.tsx index c360177..94c254b 100644 --- a/resources/js/components/Transactions/AddPurchaseForm.tsx +++ b/resources/js/components/Transactions/AddPurchaseForm.tsx @@ -4,7 +4,7 @@ import { Label } from '@/components/ui/label'; import InputError from '@/components/InputError'; import { useForm } from '@inertiajs/react'; import { LoaderCircle } from 'lucide-react'; -import { FormEventHandler, useEffect } from 'react'; +import { FormEventHandler, useEffect, useState } from 'react'; import ComponentTitle from '@/components/ui/ComponentTitle'; interface PurchaseFormData { @@ -20,6 +20,12 @@ interface AddPurchaseFormProps { onCancel?: () => void; } +interface PurchaseSummary { + total_shares: number; + total_investment: number; + average_cost_per_share: number; +} + export default function AddPurchaseForm({ onSuccess, onCancel }: AddPurchaseFormProps) { const { data, setData, post, processing, errors, reset } = useForm({ date: new Date().toISOString().split('T')[0], // Today's date in YYYY-MM-DD format @@ -28,6 +34,25 @@ export default function AddPurchaseForm({ onSuccess, onCancel }: AddPurchaseForm total_cost: '', }); + const [currentHoldings, setCurrentHoldings] = useState(null); + + // Load existing holdings data on mount + useEffect(() => { + const fetchCurrentHoldings = async () => { + try { + const response = await fetch('/purchases/summary'); + if (response.ok) { + const summary = await response.json(); + setCurrentHoldings(summary); + } + } catch (error) { + console.error('Failed to fetch current holdings:', error); + } + }; + + fetchCurrentHoldings(); + }, []); + // Auto-calculate total cost when shares or price changes useEffect(() => { if (data.shares && data.price_per_share) { @@ -59,6 +84,11 @@ export default function AddPurchaseForm({ onSuccess, onCancel }: AddPurchaseForm
ADD PURCHASE + {currentHoldings && currentHoldings.total_shares > 0 && ( +

+ [CURRENT] {currentHoldings.total_shares.toFixed(6)} shares • €{currentHoldings.total_investment.toFixed(2)} invested +

+ )}
diff --git a/resources/js/pages/dashboard.tsx b/resources/js/pages/dashboard.tsx index 23c7449..deb9369 100644 --- a/resources/js/pages/dashboard.tsx +++ b/resources/js/pages/dashboard.tsx @@ -2,6 +2,7 @@ import LedDisplay from '@/components/Display/LedDisplay'; import InlineForm from '@/components/Display/InlineForm'; import ProgressBar from '@/components/Display/ProgressBar'; import StatsBox from '@/components/Display/StatsBox'; +import OnboardingFlow from '@/components/Onboarding/OnboardingFlow'; import { Head } from '@inertiajs/react'; import { useEffect, useState } from 'react'; @@ -38,15 +39,18 @@ export default function Dashboard() { const [showStatsBox, setShowStatsBox] = useState(false); const [activeForm, setActiveForm] = useState<'purchase' | 'milestone' | 'price' | null>(null); const [loading, setLoading] = useState(true); + const [needsOnboarding, setNeedsOnboarding] = useState(false); + const [currentAsset, setCurrentAsset] = useState(null); - // Fetch purchase summary, current price, and milestones + // Fetch purchase summary, current price, milestones, and check onboarding useEffect(() => { const fetchData = async () => { try { - const [purchaseResponse, priceResponse, milestonesResponse] = await Promise.all([ + const [purchaseResponse, priceResponse, milestonesResponse, assetResponse] = await Promise.all([ fetch('/purchases/summary'), fetch('/pricing/current'), fetch('/milestones'), + fetch('/assets/current'), ]); if (purchaseResponse.ok) { @@ -63,6 +67,14 @@ export default function Dashboard() { const milestonesData = await milestonesResponse.json(); setMilestones(milestonesData); } + + if (assetResponse.ok) { + const assetData = await assetResponse.json(); + setCurrentAsset(assetData.asset); + } + + // Check if onboarding is needed after all data is loaded + await checkOnboardingStatus(); } catch (error) { console.error('Failed to fetch data:', error); } finally { @@ -73,6 +85,33 @@ export default function Dashboard() { fetchData(); }, []); + // Check if user needs onboarding + const checkOnboardingStatus = async () => { + try { + const [assetResponse, purchaseResponse, milestonesResponse] = await Promise.all([ + fetch('/assets/current'), + fetch('/purchases/summary'), + fetch('/milestones'), + ]); + + const assetData = await assetResponse.json(); + const purchaseData = await purchaseResponse.json(); + const milestonesData = await milestonesResponse.json(); + + const hasAsset = !!assetData.asset; + const hasPurchases = purchaseData.total_shares > 0; + const hasMilestones = milestonesData.length > 0; + + // User needs onboarding if any required step is missing + const needsOnboarding = !hasAsset || !hasPurchases || !hasMilestones; + setNeedsOnboarding(needsOnboarding); + } catch (error) { + console.error('Failed to check onboarding status:', error); + // If we can't check, assume onboarding is needed + setNeedsOnboarding(true); + } + }; + // Refresh data after successful purchase const handlePurchaseSuccess = async () => { try { @@ -171,6 +210,50 @@ export default function Dashboard() { setActiveForm(null) }; + // Handle onboarding completion + const handleOnboardingComplete = async () => { + // Refresh all data and check onboarding status + await checkOnboardingStatus(); + + // Refresh individual data sets + const [purchaseResponse, priceResponse, milestonesResponse, assetResponse] = await Promise.all([ + fetch('/purchases/summary'), + fetch('/pricing/current'), + fetch('/milestones'), + fetch('/assets/current'), + ]); + + if (purchaseResponse.ok) { + const purchases = await purchaseResponse.json(); + setPurchaseData(purchases); + } + + if (priceResponse.ok) { + const price = await priceResponse.json(); + setPriceData(price); + } + + if (milestonesResponse.ok) { + const milestonesData = await milestonesResponse.json(); + setMilestones(milestonesData); + } + + if (assetResponse.ok) { + const assetData = await assetResponse.json(); + setCurrentAsset(assetData.asset); + } + }; + + // Show onboarding if needed + if (needsOnboarding) { + return ( + <> + + + + ); + } + return ( <> -- 2.45.2 From 7c1968415951d4e6914770417624fc84d44732a9 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Fri, 1 Aug 2025 01:12:21 +0200 Subject: [PATCH 61/61] Make proper spinner --- .../js/components/ui/TerminalSpinner.tsx | 57 +++++++++++++++++++ resources/js/pages/dashboard.tsx | 7 +-- 2 files changed, 59 insertions(+), 5 deletions(-) create mode 100644 resources/js/components/ui/TerminalSpinner.tsx diff --git a/resources/js/components/ui/TerminalSpinner.tsx b/resources/js/components/ui/TerminalSpinner.tsx new file mode 100644 index 0000000..98c5169 --- /dev/null +++ b/resources/js/components/ui/TerminalSpinner.tsx @@ -0,0 +1,57 @@ +import { useEffect, useState } from 'react'; + +interface TerminalSpinnerProps { + text?: string; + size?: 'sm' | 'md' | 'lg'; + fullScreen?: boolean; +} + +export default function TerminalSpinner({ + text = 'LOADING', + size = 'md', + fullScreen = false +}: TerminalSpinnerProps) { + const [dots, setDots] = useState(0); + + useEffect(() => { + const interval = setInterval(() => { + setDots(prev => (prev + 1) % 4); + }, 500); + + return () => clearInterval(interval); + }, []); + + const getDots = () => { + switch (dots) { + case 0: return ' '; + case 1: return '. '; + case 2: return '.. '; + case 3: return '...'; + default: return ' '; + } + }; + + const sizeClasses = { + sm: 'text-sm', + md: 'text-lg', + lg: 'text-xl' + }; + + const spinner = ( +
+ + [SYSTEM] {text}{getDots()} + +
+ ); + + if (fullScreen) { + return ( +
+ {spinner} +
+ ); + } + + return spinner; +} \ No newline at end of file diff --git a/resources/js/pages/dashboard.tsx b/resources/js/pages/dashboard.tsx index deb9369..3abea13 100644 --- a/resources/js/pages/dashboard.tsx +++ b/resources/js/pages/dashboard.tsx @@ -3,6 +3,7 @@ import InlineForm from '@/components/Display/InlineForm'; import ProgressBar from '@/components/Display/ProgressBar'; import StatsBox from '@/components/Display/StatsBox'; import OnboardingFlow from '@/components/Onboarding/OnboardingFlow'; +import TerminalSpinner from '@/components/ui/TerminalSpinner'; import { Head } from '@inertiajs/react'; import { useEffect, useState } from 'react'; @@ -186,11 +187,7 @@ export default function Dashboard() { return ( <> -
-
- LOADING... -
-
+ ); } -- 2.45.2