Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
NGINX_IMAGE=nginx:stable-alpine

# Backend
APP_IMAGE=split-fairly-dev:0.1.1
APP_IMAGE=split-fairly-dev:0.1.2
APP_NAME=split-fairly
APP_VERSION=0.1.1
APP_VERSION=0.1.2
APP_ENV=dev
ADMIN_EMAIL=admin@example.com
ADMIN_PASSWORD=secret
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
APP_NAME = split-fairly
VERSION = 0.1.1
VERSION = 0.1.2

.DEFAULT_GOAL := help

.PHONY: build prod start

help:
@echo "📋 Available targets:\n"
@echo "🏗️ Build & Setup:"
Expand Down
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,22 +91,19 @@ Visit `http://localhost:8000` in your browser.
# Build production images
make prod

# Deploy to cluster
helm install app ./helm
# Deploy with 3 app pods + 2 worker pods
helm install app ./helm --set replicaCount.app=3 --set replicaCount.worker=2
# or:
helm upgrade --install app ./helm

# Watch pods come up
kubectl get pods -w

# View logs for all pods with the PHP label (app + worker)
kubectl logs -f -l technology=php

# Access the application via NodePort:
# Link: http://localhost:30190
# Or configure port forwarding via:
kubectl port-forward svc/app-split-fairly-web 8080:80
# Link: http://localhost:8080

# View logs for all pods with the PHP label (app + worker)
kubectl logs -f -l technology=php
```

### Kubernetes Architecture
Expand Down
6 changes: 6 additions & 0 deletions backend/public/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 29 additions & 4 deletions backend/src/Controller/Admin/EventCrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

namespace App\Controller\Admin;

use App\Entity\Event;
use App\Entity\Event as EventEntity;
use App\Form\DataTransformer\JsonToStringTransformer;
use App\SplitFairly\EventStoreInterface;
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
Expand All @@ -16,9 +17,11 @@
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\Security\Http\Attribute\IsGranted;

/**
* @extends AbstractCrudController<Event>
* @extends AbstractCrudController<EventEntity>
*
* Admin interface for viewing and managing domain events stored in event sourcing.
* Most event fields are immutable (id, createdAt, createdBy, subjectType, subjectId, eventType),
Expand All @@ -28,7 +31,11 @@ class EventCrudController extends AbstractCrudController
{
public static function getEntityFqcn(): string
{
return Event::class;
return EventEntity::class;
}

public function __construct(private EventStoreInterface $eventRepository)
{
}

public function configureCrud(Crud $crud): Crud
Expand All @@ -45,9 +52,14 @@ public function configureCrud(Crud $crud): Crud

public function configureActions(Actions $actions): Actions
{
$wipe = Action::new('wipeEvents', 'Wipe Events', 'fa fa-trash')
->addCssClass('btn btn-danger')
->linkToCrudAction('wipeEvents');

return $actions
->remove(Crud::PAGE_INDEX, Action::NEW)
->add(Crud::PAGE_INDEX, Action::DETAIL);
->add(Crud::PAGE_INDEX, Action::DETAIL)
->add(Crud::PAGE_INDEX, $wipe);
}

public function configureFields(string $pageName): iterable
Expand Down Expand Up @@ -113,4 +125,17 @@ private function addPayloadField(FormBuilderInterface $builder): void

$builder->get('payload')->addModelTransformer(new JsonToStringTransformer());
}

/** @param AdminContext<EventEntity> $context */
#[IsGranted('ROLE_ADMIN')]
public function wipeEvents(AdminContext $context): RedirectResponse
{
$this->eventRepository->reset();
$this->addFlash('success', 'All events have been deleted.');

$referrer = $context->getRequest()->headers->get('referer');
$route = $referrer ?? $this->generateUrl('admin_event_index');

return $this->redirect($route);
}
}
1 change: 1 addition & 0 deletions backend/templates/base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<meta charset="UTF-8">
<title>{% block title %}Split Fairly{% endblock %}</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
{% block stylesheets %}
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9ndCyUaIbzAi2FUarbnLtQihNWI9YFSVjwApmCsAWV2nDfq6uTnAowIPqC7uNu7Su" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" integrity="sha512-iecdLmaskl7CVJkEzyD6lkDNlzVFlZFt6jaSXv2MM+PIZ0nDvltbtMhx60//Z5conn7j+l8ukuyS7NvHa9Uc3w==" crossorigin="anonymous" referrerpolicy="no-referrer" />
Expand Down
2 changes: 1 addition & 1 deletion build/php/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ WORKDIR /var/www/project

RUN apk add --no-cache --virtual .build-deps \
build-base autoconf icu-dev libzip-dev \
&& apk add --no-cache libintl git zip icu-libs \
&& apk add --no-cache libintl git zip libzip icu-libs \
&& docker-php-ext-configure intl \
&& docker-php-ext-install intl pdo opcache pdo_mysql zip \
&& pecl install opentelemetry redis \
Expand Down
6 changes: 6 additions & 0 deletions frontend/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<meta name="apple-mobile-web-app-status-bar-style" content="default" />
<meta name="apple-mobile-web-app-title" content="Split Fairly" />
<title>💰 Split Fairly</title>
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
</head>
<body>
<div id="root"></div>
Expand Down
4 changes: 2 additions & 2 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v2
name: split-fairly
description: Helm chart for the split-fairly application
type: application
version: 0.1.0
appVersion: "0.1.1"
version: 0.1.2
appVersion: "0.1.2"
keywords:
- split-fairly
- web
Expand Down
6 changes: 3 additions & 3 deletions helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ replicaCount:
image:
app:
repository: "split-fairly"
tag: "0.1.1"
tag: "0.1.2"
pullPolicy: IfNotPresent
web:
repository: "split-fairly-web"
tag: "0.1.1"
tag: "0.1.2"
pullPolicy: IfNotPresent
mysql:
repository: "mysql"
Expand Down Expand Up @@ -42,7 +42,7 @@ resources:
env:
APP_SECRET: "F3E46580-5F9A-4524-B218-90490B033192"
APP_ENV: "prod"
APP_VERSION: "0.1.1"
APP_VERSION: "0.1.2"
DATABASE_URL: "mysql://{{ .Values.mysql.user }}:{{ .Values.mysql.password }}@{{ include \"split-fairly.fullname\" . }}-db:{{ .Values.service.mysql.port }}/{{ default \"app\" .Values.mysql.database }}?serverVersion=8.0.31&charset=utf8mb4"
ADMIN_EMAIL: "admin@example.com"
ADMIN_PASSWORD: "secret"
Expand Down