Compare commits

...

10 Commits

Author SHA1 Message Date
a8289ceadc add logs 2025-02-13 19:26:08 +03:00
d8f693651d kek 2025-02-13 18:32:17 +03:00
4ae36306aa )) 2025-02-13 18:25:14 +03:00
0a94936389 aaaa 2025-02-13 18:23:49 +03:00
ac7e8d846b sosi2 2025-02-13 16:38:39 +03:00
39630c926e sosi 2025-02-13 15:47:22 +03:00
44d9f95193 gitin
Some checks failed
CI / Tests (push) Has been cancelled
CI / Docker Lint (push) Has been cancelled
2025-02-13 15:30:19 +03:00
02a85c265d ok
Some checks are pending
CI / Tests (push) Waiting to run
CI / Docker Lint (push) Waiting to run
2025-02-13 15:17:38 +03:00
4c35e31454 bruuuh
Some checks are pending
CI / Tests (push) Waiting to run
CI / Docker Lint (push) Waiting to run
2025-02-13 15:16:56 +03:00
ee808787a9 bruuug
Some checks are pending
CI / Tests (push) Waiting to run
CI / Docker Lint (push) Waiting to run
2025-02-13 14:19:54 +03:00
10 changed files with 95 additions and 85 deletions

13
.env Normal file
View File

@@ -0,0 +1,13 @@
APP_ENV=dev
APP_SECRET=1b2b121bb212b12
SERVER_NAME=:80
#forum.lisoveliy.su
HTTP_PORT=12000
HTTPS_PORT=12001
HTTP3_PORT=12002
DATABASE_URL=postgresql://app:app@database:5432/app?serverVersion=16&charset=utf8
MERCURE_URL=https://forum.lisoveliy.su/.well-known/mercure
MERCURE_PUBLIC_URL=https://forum.lisoveliy.su/.well-known/mercure
MERCURE_JWT_SECRET="!ChangeThisMercureHubJWTSecretKey!"
CADDY_MERCURE_JWT_SECRET="1212121212123kkk322k3k"

View File

@@ -1,76 +0,0 @@
name: CI
on:
push:
branches:
- main
pull_request: ~
workflow_dispatch: ~
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build Docker images
uses: docker/bake-action@v6
with:
pull: true
load: true
files: |
compose.yaml
compose.override.yaml
set: |
*.cache-from=type=gha,scope=${{github.ref}}
*.cache-from=type=gha,scope=refs/heads/main
*.cache-to=type=gha,scope=${{github.ref}},mode=max
-
name: Start services
run: docker compose up --wait --no-build
-
name: Check HTTP reachability
run: curl -v --fail-with-body http://localhost
-
name: Check HTTPS reachability
if: false # Remove this line when the homepage will be configured, or change the path to check
run: curl -vk --fail-with-body https://localhost
-
name: Check Mercure reachability
run: curl -vkI --fail-with-body https://localhost/.well-known/mercure?topic=test
-
name: Create test database
if: false # Remove this line if Doctrine ORM is installed
run: docker compose exec -T php bin/console -e test doctrine:database:create
-
name: Run migrations
if: false # Remove this line if Doctrine Migrations is installed
run: docker compose exec -T php bin/console -e test doctrine:migrations:migrate --no-interaction
-
name: Run PHPUnit
if: false # Remove this line if PHPUnit is installed
run: docker compose exec -T php bin/phpunit
-
name: Doctrine Schema Validator
if: false # Remove this line if Doctrine ORM is installed
run: docker compose exec -T php bin/console -e test doctrine:schema:validate
lint:
name: Docker Lint
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Lint Dockerfile
uses: hadolint/hadolint-action@v3.1.0

18
.gitignore vendored Normal file
View File

@@ -0,0 +1,18 @@
###> symfony/framework-bundle ###
/.env.local
/.env.local.php
/.env.*.local
.env.dev
.env
/config/secrets/prod/prod.decrypt.private.php
/public/bundles/
/var/
/vendor/
.idea
###< symfony/framework-bundle ###
###> symfony/asset-mapper ###
/public/assets/
/assets/vendor/
###< symfony/asset-mapper ###

8
.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@@ -95,4 +95,5 @@ RUN set -eux; \
composer dump-autoload --classmap-authoritative --no-dev; \ composer dump-autoload --classmap-authoritative --no-dev; \
composer dump-env prod; \ composer dump-env prod; \
composer run-script --no-dev post-install-cmd; \ composer run-script --no-dev post-install-cmd; \
chmod +x bin/console; sync; chmod +x bin/console; \
sync;

View File

@@ -1,19 +1,53 @@
:root { :root {
--primary-color: #f6cd26; --primary-color: #f6cd26;
--second-color: black;
--line-width: 2px;
--space: 12px;
} }
body { body {
background-color: black; background-color: var(--second-color);
color: var(--primary-color); color: var(--primary-color);
} }
.block { .block {
border: solid var(--primary-color) 2px; border: solid var(--primary-color) var(--line-width);
padding: 12px; padding: var(--space);
} }
.list { .list {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 12px; gap: var(--space);
} }
a:visited, a:hover {
color: var(--primary-color);
}
button {
align-items: center;
padding: var(--space);
background: var(--second-color);
color: var(--primary-color);
border: solid var(--primary-color) var(--line-width);
}
button:hover,
button:focus {
background: var(--primary-color);
color: black;
cursor: pointer;
border: solid var(--second-color) var(--line-width);
outline: calc(var(--line-width) * 2) var(--primary-color);
}
textarea {
padding: var(--space);
color: var(--primary-color);
background-color: var(--second-color);
border: solid var(--primary-color) var(--line-width);
}

View File

@@ -6,8 +6,6 @@ services:
SERVER_NAME: ${SERVER_NAME:-localhost}, php:80 SERVER_NAME: ${SERVER_NAME:-localhost}, php:80
MERCURE_PUBLISHER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!} MERCURE_PUBLISHER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!}
MERCURE_SUBSCRIBER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!} MERCURE_SUBSCRIBER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!}
# Run "composer require symfony/orm-pack" to install and configure Doctrine ORM
DATABASE_URL: postgresql://${POSTGRES_USER:-app}:${POSTGRES_PASSWORD:-app}@database:5432/${POSTGRES_DB:-app}?serverVersion=${POSTGRES_VERSION:-16}&charset=${POSTGRES_CHARSET:-utf8}
# Run "composer require symfony/mercure-bundle" to install and configure the Mercure integration # Run "composer require symfony/mercure-bundle" to install and configure the Mercure integration
MERCURE_URL: ${CADDY_MERCURE_URL:-http://php/.well-known/mercure} MERCURE_URL: ${CADDY_MERCURE_URL:-http://php/.well-known/mercure}
MERCURE_PUBLIC_URL: ${CADDY_MERCURE_PUBLIC_URL:-https://${SERVER_NAME:-localhost}:${HTTPS_PORT:-443}/.well-known/mercure} MERCURE_PUBLIC_URL: ${CADDY_MERCURE_PUBLIC_URL:-https://${SERVER_NAME:-localhost}:${HTTPS_PORT:-443}/.well-known/mercure}

View File

@@ -63,6 +63,7 @@
"scripts": { "scripts": {
"auto-scripts": { "auto-scripts": {
"cache:clear": "symfony-cmd", "cache:clear": "symfony-cmd",
"asset-map:compile": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd", "assets:install %PUBLIC_DIR%": "symfony-cmd",
"importmap:install": "symfony-cmd" "importmap:install": "symfony-cmd"
}, },

View File

@@ -0,0 +1,4 @@
# config/routes/easyadmin.yaml
easyadmin:
resource: .
type: easyadmin.routes

View File

@@ -6,6 +6,7 @@ use App\Entity\Branch;
use App\Entity\Message; use App\Entity\Message;
use App\Form\CreateMessageType; use App\Form\CreateMessageType;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
@@ -14,8 +15,10 @@ use Symfony\Component\Routing\Attribute\Route;
#[Route('/branches')] #[Route('/branches')]
final class BranchController extends AbstractController final class BranchController extends AbstractController
{ {
public function __construct(private readonly EntityManagerInterface $entityManager) public function __construct(
{ private readonly EntityManagerInterface $entityManager,
private readonly LoggerInterface $logger,
) {
} }
#[Route('/{id}', name: 'branch', methods: ['GET'])] #[Route('/{id}', name: 'branch', methods: ['GET'])]
@@ -39,6 +42,12 @@ final class BranchController extends AbstractController
$this->entityManager->persist($message); $this->entityManager->persist($message);
$this->entityManager->flush(); $this->entityManager->flush();
$this->logger->info('Created message with id {messageId}', ['messageId' => $message->getId()]);
} else {
$this->logger->warning('Cant create message', [
'isFormSubmitted' => $form->isSubmitted(),
'isFormValid' => $form->isValid(),
]);
} }
return $this->redirectToRoute('branch', ['id' => $branch->getId()]); return $this->redirectToRoute('branch', ['id' => $branch->getId()]);