Compare commits

..

4 Commits

Author SHA1 Message Date
gitea-actions
1904c999ec chore: bump version to v0.1.25
All checks were successful
Auto Tag Develop / tag (push) Successful in 5s
Build & Push Docker Image / build (push) Successful in 18s
2026-04-07 13:25:29 +00:00
Matthieu
81266dd64b fix(infra) : update proxy port to 8086 and add maintenance mode
All checks were successful
Auto Tag Develop / tag (push) Successful in 6s
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 15:25:23 +02:00
gitea-actions
c5e2800e4c chore: bump version to v0.1.24
All checks were successful
Auto Tag Develop / tag (push) Successful in 5s
Build & Push Docker Image / build (push) Successful in 18s
2026-04-07 13:09:32 +00:00
Matthieu
ef1c14f8da feat : add app:create-user console command
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 15:09:23 +02:00
5 changed files with 77 additions and 2 deletions

View File

@@ -1,2 +1,2 @@
parameters:
app.version: '0.1.23'
app.version: '0.1.25'

View File

@@ -68,6 +68,9 @@ COPY --from=backend-build /app /var/www/html
# Frontend from stage 2
COPY --from=frontend-build /app/frontend/.output/public /var/www/html/frontend/.output/public
# Maintenance page
COPY infra/prod/maintenance.html /var/www/html/public/maintenance.html
# Symfony needs a .env file to boot (variables are overridden by env_file in docker-compose)
RUN echo "APP_ENV=prod" > /var/www/html/.env

View File

@@ -21,7 +21,7 @@ server {
}
location / {
proxy_pass http://127.0.0.1:8083;
proxy_pass http://127.0.0.1:8086;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

View File

@@ -10,6 +10,16 @@ server {
access_log /dev/stdout;
error_log /dev/stderr;
# Mode maintenance : créer /var/www/html/maintenance.on pour activer
if (-f /var/www/html/maintenance.on) {
return 503;
}
error_page 503 @maintenance;
location @maintenance {
root /var/www/html/public;
rewrite ^(.*)$ /maintenance.html break;
}
location ^~ /api/ {
root /var/www/html/public;
try_files $uri /index.php?$query_string;

View File

@@ -0,0 +1,62 @@
<?php
declare(strict_types=1);
namespace App\Command;
use App\Entity\User;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
#[AsCommand(
name: 'app:create-user',
description: 'Create a new user',
)]
class CreateUserCommand extends Command
{
public function __construct(
private readonly EntityManagerInterface $em,
private readonly UserPasswordHasherInterface $passwordHasher,
) {
parent::__construct();
}
protected function configure(): void
{
$this
->addArgument('username', InputArgument::REQUIRED, 'Username')
->addArgument('password', InputArgument::REQUIRED, 'Plain password')
->addOption('admin', null, InputOption::VALUE_NONE, 'Grant ROLE_ADMIN')
;
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
$username = $input->getArgument('username');
$plainPassword = $input->getArgument('password');
$user = new User();
$user->setUsername($username);
$user->setPassword($this->passwordHasher->hashPassword($user, $plainPassword));
if ($input->getOption('admin')) {
$user->setRoles(['ROLE_ADMIN']);
}
$this->em->persist($user);
$this->em->flush();
$io->success(sprintf('User "%s" created%s.', $username, $input->getOption('admin') ? ' with ROLE_ADMIN' : ''));
return Command::SUCCESS;
}
}