diff --git a/.env b/.env index ac9c422..d3198e4 100644 --- a/.env +++ b/.env @@ -23,7 +23,7 @@ APP_SECRET= # Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url # IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml # -DATABASE_URL="sqlite:///%kernel.project_dir%/var/data_%kernel.environment%.db" +DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db" # DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4" # DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4" # DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=16&charset=utf8" diff --git a/.forgejo/workflows/pull_request.yml b/.forgejo/workflows/pull_request.yml new file mode 100644 index 0000000..dbe282e --- /dev/null +++ b/.forgejo/workflows/pull_request.yml @@ -0,0 +1,37 @@ +on: [pull_request] +jobs: + ls: + runs-on: docker + container: + image: git.php.fail/lubiana/container/php:8.4.8-ci + steps: + - name: Manually checkout + env: + REPO: '${{ github.repository }}' + TOKEN: '${{ secrets.GITHUB_TOKEN }}' + GIT_SERVER: 'git.hannover.ccc.de' + run: | + git clone --branch $GITHUB_HEAD_REF https://${TOKEN}@${GIT_SERVER}/${REPO}.git . + git fetch + git checkout $GITHUB_HEAD_REF + - name: composer install + env: + COMPOSER_CACHE_DIR: /opt/hostedtoolcache/.composer/cache/files + run: | + mkdir -p ${{ env.COMPOSER_CACHE_DIR }} + composer install + - name: lint + run: composer lint + - name: test + run: composer test + - name: GIT commit and push all changed files + env: + CI_COMMIT_MESSAGE: Continuous Integration Fixes + CI_COMMIT_AUTHOR: Continuous Integration + run: | + if [[ -n "$(git status -s)" ]]; then + git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}" + git config --global user.email "gitbot@users.noreply.php.fail" + git commit -am "${{ env.CI_COMMIT_MESSAGE }}" + git push + fi diff --git a/.forgejo/workflows/push.yml b/.forgejo/workflows/push.yml new file mode 100644 index 0000000..96d898a --- /dev/null +++ b/.forgejo/workflows/push.yml @@ -0,0 +1,41 @@ +on: + push: + branches: + - 'main' +jobs: + ls: + runs-on: docker + container: + image: git.php.fail/lubiana/container/php:8.4.8-ci + steps: + - name: Manually checkout + env: + REPO: '${{ github.repository }}' + TOKEN: '${{ secrets.GITHUB_TOKEN }}' + BRANCH: '${{ env.GITHUB_REF_NAME }}' + GIT_SERVER: 'git.hannover.ccc.de' + run: | + git clone --branch $GITHUB_REF_NAME https://${TOKEN}@${GIT_SERVER}/${REPO}.git . + git fetch + git checkout ${{ github.head_ref }} + - name: composer install + env: + COMPOSER_CACHE_DIR: /opt/hostedtoolcache/.composer/cache/files + run: | + mkdir -p ${{ env.COMPOSER_CACHE_DIR }} + composer install + - name: lint + run: composer lint + - name: test + run: composer test + - name: GIT commit and push all changed files + env: + CI_COMMIT_MESSAGE: Continuous Integration Fixes + CI_COMMIT_AUTHOR: Continuous Integration + run: | + if [[ -n "$(git status -s)" ]]; then + git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}" + git config --global user.email "gitbot@users.noreply.php.fail" + git commit -am "${{ env.CI_COMMIT_MESSAGE }}" + git push + fi diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml new file mode 100644 index 0000000..a42f7fc --- /dev/null +++ b/.forgejo/workflows/release.yml @@ -0,0 +1,49 @@ +on: + release +jobs: + ls: + runs-on: docker + container: + image: git.php.fail/lubiana/container/php:8.4.8-ci + steps: + - name: Manually checkout + env: + REPO: '${{ github.repository }}' + TOKEN: '${{ secrets.GITHUB_TOKEN }}' + BRANCH: '${{ env.GITHUB_REF_NAME }}' + GIT_SERVER: 'hannover.ccc.de/gitlab' + run: | + git clone --branch $GITHUB_REF_NAME https://${TOKEN}@${GIT_SERVER}/${REPO}.git . + git fetch + git checkout ${{ github.head_ref }} + - name: prepare deploy + run: sh ./deploy/prepare-deploy.sh + - name: deploy + env: + HOST: 'web.server.c3h' + USERNAME: 'c3h-futtern' + TARGETDIR: '/home/c3h-futtern/saufen' + HOMEDIR: '/home/c3h-futtern' + SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} + run: | + mkdir -p ~/.ssh/ + # Print the SSH key, replacing newline characters with actual new lines + echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa + # Set appropriate permissions for the SSH key + chmod 600 ~/.ssh/id_rsa + # Add the remote host's key to the known_hosts file to avoid authenticity confirmation + ssh-keyscan -H $HOST >> ~/.ssh/known_hosts + # stop services + ssh ${USERNAME}@${HOST} systemctl --user stop pod-saufen + # backup database + ssh ${USERNAME}@${HOST} "cp ${HOMEDIR}/saufen/app/var/data.db ${HOMEDIR}/backup/data-saufen.db-$(date +\"%Y%m%d%H%M%S\")" + # only keep last 10 backupts + ssh ${USERNAME}@${HOST} "find ${HOMEDIR}/backup/ -type f | sort | head -n -10 | xargs rm -f" + # SCP files to the remote host + rsync -avz --delete deploy/ ${USERNAME}@${HOST}:${TARGETDIR} --exclude=var + # run update script + ssh ${USERNAME}@${HOST} /home/c3h-futtern/saufen/update.sh + + + + diff --git a/.forgejo/workflows/test.yaml b/.forgejo/workflows/test.yaml deleted file mode 100644 index 2f3fce7..0000000 --- a/.forgejo/workflows/test.yaml +++ /dev/null @@ -1,18 +0,0 @@ -name: Build -run-name: ${{ gitea.actor }} Builder -on: - push: - branches: - - main - -jobs: - hello_world_job: - runs-on: docker - name: A job to say hello - steps: - - uses: actions/checkout@v4 - - name: ls - run: ls -lisa - - name: Hello world action step - id: build-container - run: podman build -t franky -f podman/Containerfile . diff --git a/composer.json b/composer.json index 77a6ce6..151aac7 100644 --- a/composer.json +++ b/composer.json @@ -7,16 +7,15 @@ "php": ">=8.4", "ext-ctype": "*", "ext-iconv": "*", - "doctrine/dbal": "^3", + "doctrine/dbal": "^3.9.4", "doctrine/doctrine-bundle": "^2.14", - "doctrine/doctrine-migrations-bundle": "^3.4", - "doctrine/orm": "^3.3", - "runtime/frankenphp-symfony": "^0.2.0", + "doctrine/doctrine-migrations-bundle": "^3.4.2", + "doctrine/orm": "^3.4", "symfony/asset": "7.3.*", "symfony/asset-mapper": "7.3.*", "symfony/console": "7.3.*", "symfony/dotenv": "7.3.*", - "symfony/flex": "^2", + "symfony/flex": "^2.7.1", "symfony/form": "7.3.*", "symfony/framework-bundle": "7.3.*", "symfony/runtime": "7.3.*", @@ -25,12 +24,12 @@ "symfony/validator": "7.3.*", "symfony/web-link": "7.3.*", "symfony/yaml": "7.3.*", - "twig/extra-bundle": "^2.12|^3.0", - "twig/twig": "^2.12|^3.0" + "twig/extra-bundle": "^2.12|^3.21", + "twig/twig": "^2.12|^3.21.1" }, "require-dev": { - "pestphp/pest": "^3.8", - "rector/rector": "^2.0", + "pestphp/pest": "^3.8.2", + "rector/rector": "^2.0.18", "symfony/browser-kit": "^7.3", "symfony/css-selector": "7.3.*", "symfony/dom-crawler": "7.3.*", @@ -38,7 +37,7 @@ "symfony/stopwatch": "7.3.*", "symfony/web-profiler-bundle": "7.3.*", "symplify/config-transformer": "^12.4", - "symplify/easy-coding-standard": "^12.5" + "symplify/easy-coding-standard": "^12.5.20" }, "config": { "allow-plugins": { diff --git a/composer.lock b/composer.lock index 50db31c..32fe8cd 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0171698e06036913d5ba729e28df03c7", + "content-hash": "1fe9f53b59a2962c86116a6fed3b749e", "packages": [ { "name": "composer/semver", @@ -1066,16 +1066,16 @@ }, { "name": "doctrine/orm", - "version": "3.3.3", + "version": "3.4.0", "source": { "type": "git", "url": "https://github.com/doctrine/orm.git", - "reference": "1f1891d3e20ef9881e81c2f32c53e9dc88dfc9a7" + "reference": "4664373bd0668d71b40cc368b950de95e1dba2f8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/orm/zipball/1f1891d3e20ef9881e81c2f32c53e9dc88dfc9a7", - "reference": "1f1891d3e20ef9881e81c2f32c53e9dc88dfc9a7", + "url": "https://api.github.com/repos/doctrine/orm/zipball/4664373bd0668d71b40cc368b950de95e1dba2f8", + "reference": "4664373bd0668d71b40cc368b950de95e1dba2f8", "shasum": "" }, "require": { @@ -1150,9 +1150,9 @@ ], "support": { "issues": "https://github.com/doctrine/orm/issues", - "source": "https://github.com/doctrine/orm/tree/3.3.3" + "source": "https://github.com/doctrine/orm/tree/3.4.0" }, - "time": "2025-05-02T17:42:51+00:00" + "time": "2025-06-14T11:47:14+00:00" }, { "name": "doctrine/persistence", @@ -1562,58 +1562,6 @@ }, "time": "2024-09-11T13:17:53+00:00" }, - { - "name": "runtime/frankenphp-symfony", - "version": "0.2.0", - "source": { - "type": "git", - "url": "https://github.com/php-runtime/frankenphp-symfony.git", - "reference": "56822c3631d9522a3136a4c33082d006bdfe4bad" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-runtime/frankenphp-symfony/zipball/56822c3631d9522a3136a4c33082d006bdfe4bad", - "reference": "56822c3631d9522a3136a4c33082d006bdfe4bad", - "shasum": "" - }, - "require": { - "php": ">=8.1", - "symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0", - "symfony/http-kernel": "^5.4 || ^6.0 || ^7.0", - "symfony/runtime": "^5.4 || ^6.0 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.5" - }, - "type": "library", - "autoload": { - "psr-4": { - "Runtime\\FrankenPhpSymfony\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Kévin Dunglas", - "email": "kevin@dunglas.dev" - } - ], - "description": "FrankenPHP runtime for Symfony", - "support": { - "issues": "https://github.com/php-runtime/frankenphp-symfony/issues", - "source": "https://github.com/php-runtime/frankenphp-symfony/tree/0.2.0" - }, - "funding": [ - { - "url": "https://github.com/nyholm", - "type": "github" - } - ], - "time": "2023-12-12T12:06:11+00:00" - }, { "name": "symfony/asset", "version": "v7.3.0", @@ -5735,16 +5683,16 @@ }, { "name": "filp/whoops", - "version": "2.18.1", + "version": "2.18.2", "source": { "type": "git", "url": "https://github.com/filp/whoops.git", - "reference": "8fcc6a862f2e7b94eb4221fd0819ddba3d30ab26" + "reference": "89dabca1490bc77dbcab41c2b20968c7e44bf7c3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filp/whoops/zipball/8fcc6a862f2e7b94eb4221fd0819ddba3d30ab26", - "reference": "8fcc6a862f2e7b94eb4221fd0819ddba3d30ab26", + "url": "https://api.github.com/repos/filp/whoops/zipball/89dabca1490bc77dbcab41c2b20968c7e44bf7c3", + "reference": "89dabca1490bc77dbcab41c2b20968c7e44bf7c3", "shasum": "" }, "require": { @@ -5794,7 +5742,7 @@ ], "support": { "issues": "https://github.com/filp/whoops/issues", - "source": "https://github.com/filp/whoops/tree/2.18.1" + "source": "https://github.com/filp/whoops/tree/2.18.2" }, "funding": [ { @@ -5802,7 +5750,7 @@ "type": "github" } ], - "time": "2025-06-03T18:56:14+00:00" + "time": "2025-06-11T20:42:19+00:00" }, { "name": "jean85/pretty-package-versions", @@ -6051,23 +5999,23 @@ }, { "name": "nunomaduro/collision", - "version": "v8.8.0", + "version": "v8.8.1", "source": { "type": "git", "url": "https://github.com/nunomaduro/collision.git", - "reference": "4cf9f3b47afff38b139fb79ce54fc71799022ce8" + "reference": "44ccb82e3e21efb5446748d2a3c81a030ac22bd5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nunomaduro/collision/zipball/4cf9f3b47afff38b139fb79ce54fc71799022ce8", - "reference": "4cf9f3b47afff38b139fb79ce54fc71799022ce8", + "url": "https://api.github.com/repos/nunomaduro/collision/zipball/44ccb82e3e21efb5446748d2a3c81a030ac22bd5", + "reference": "44ccb82e3e21efb5446748d2a3c81a030ac22bd5", "shasum": "" }, "require": { - "filp/whoops": "^2.18.0", - "nunomaduro/termwind": "^2.3.0", + "filp/whoops": "^2.18.1", + "nunomaduro/termwind": "^2.3.1", "php": "^8.2.0", - "symfony/console": "^7.2.5" + "symfony/console": "^7.3.0" }, "conflict": { "laravel/framework": "<11.44.2 || >=13.0.0", @@ -6075,15 +6023,15 @@ }, "require-dev": { "brianium/paratest": "^7.8.3", - "larastan/larastan": "^3.2", - "laravel/framework": "^11.44.2 || ^12.6", - "laravel/pint": "^1.21.2", - "laravel/sail": "^1.41.0", - "laravel/sanctum": "^4.0.8", + "larastan/larastan": "^3.4.2", + "laravel/framework": "^11.44.2 || ^12.18", + "laravel/pint": "^1.22.1", + "laravel/sail": "^1.43.1", + "laravel/sanctum": "^4.1.1", "laravel/tinker": "^2.10.1", - "orchestra/testbench-core": "^9.12.0 || ^10.1", - "pestphp/pest": "^3.8.0", - "sebastian/environment": "^7.2.0 || ^8.0" + "orchestra/testbench-core": "^9.12.0 || ^10.4", + "pestphp/pest": "^3.8.2", + "sebastian/environment": "^7.2.1 || ^8.0" }, "type": "library", "extra": { @@ -6146,7 +6094,7 @@ "type": "patreon" } ], - "time": "2025-04-03T14:33:09+00:00" + "time": "2025-06-11T01:04:21+00:00" }, { "name": "nunomaduro/termwind", @@ -7434,16 +7382,16 @@ }, { "name": "rector/rector", - "version": "2.0.17", + "version": "2.0.18", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "caa4ffda1d48bde44434e6ba95d132ec32e7fd40" + "reference": "be3a452085b524a04056e3dfe72d861948711062" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/caa4ffda1d48bde44434e6ba95d132ec32e7fd40", - "reference": "caa4ffda1d48bde44434e6ba95d132ec32e7fd40", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/be3a452085b524a04056e3dfe72d861948711062", + "reference": "be3a452085b524a04056e3dfe72d861948711062", "shasum": "" }, "require": { @@ -7481,7 +7429,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/2.0.17" + "source": "https://github.com/rectorphp/rector/tree/2.0.18" }, "funding": [ { @@ -7489,7 +7437,7 @@ "type": "github" } ], - "time": "2025-05-30T10:59:08+00:00" + "time": "2025-06-11T11:19:37+00:00" }, { "name": "sebastian/cli-parser", diff --git a/deploy/etc/caddy/Caddyfile b/deploy/etc/caddy/Caddyfile new file mode 100644 index 0000000..7dfd1c4 --- /dev/null +++ b/deploy/etc/caddy/Caddyfile @@ -0,0 +1,7 @@ +:8090 { + log + root * /var/www/html/public + php_fastcgi localhost:9001 + file_server + encode zstd gzip +} diff --git a/deploy/etc/php84/php-fpm.d/www.conf b/deploy/etc/php84/php-fpm.d/www.conf new file mode 100644 index 0000000..e5a895d --- /dev/null +++ b/deploy/etc/php84/php-fpm.d/www.conf @@ -0,0 +1,13 @@ +[www] + +user = root +group = root +listen = 9001 +pm = dynamic +pm.max_children = 5 +pm.start_servers = 2 +pm.min_spare_servers = 1 +pm.max_spare_servers = 3 +env[APP_ENV]=$APP_ENV +env[APP_SECRET]=$APP_SECRET +catch_workers_output = yes diff --git a/deploy/local-deploy.sh b/deploy/local-deploy.sh new file mode 100755 index 0000000..576ed18 --- /dev/null +++ b/deploy/local-deploy.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env sh + +export HOMEDIR='/home/c3h-futtern/' + +. ./deploy/prepare-deploy.sh +ssh leitstelle-futtern 'systemctl --user stop pod-futtern' +ssh leitstelle-futtern "cp ${HOMEDIR}/saufen/app/var/data.db ${HOMEDIR}/backup/dat-saufena.db-$(date +\"%Y%m%d%H%M%S\")" +ssh leitstelle-futtern "find ${HOMEDIR}/backup/ -type f | sort | head -n -10 | xargs rm -f" +rsync -avz --delete deploy/ leitstelle-futtern:saufen --exclude=var +ssh leitstelle-futtern '/home/c3h-futtern/saufen/update.sh' diff --git a/deploy/prepare-deploy.sh b/deploy/prepare-deploy.sh new file mode 100755 index 0000000..b57c20c --- /dev/null +++ b/deploy/prepare-deploy.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env sh + +TARGETDIR='deploy/app' + +if [ -d $TARGETDIR ]; then + rm -rf $TARGETDIR +fi +mkdir $TARGETDIR +cd $TARGETDIR || return + +pathsToCopy="assets public bin config migrations src templates composer.json composer.lock symfony.lock .env importmap.php" + +for path in $pathsToCopy +do + cp -r ../../"$path" ./ +done + +APP_ENV=prod composer install --no-dev -a +rm -rf ./var/cache + +cd - + diff --git a/deploy/systemd/container-saufen-caddy.service b/deploy/systemd/container-saufen-caddy.service new file mode 100644 index 0000000..1d421a1 --- /dev/null +++ b/deploy/systemd/container-saufen-caddy.service @@ -0,0 +1,43 @@ +# container-futtern-caddy.service +# autogenerated by Podman 4.3.1 +# Sun Jun 23 05:33:51 UTC 2024 + +[Unit] +Description=Podman container-futtern-caddy.service +Documentation=man:podman-generate-systemd(1) +Wants=network-online.target +After=network-online.target +RequiresMountsFor=%t/containers +BindsTo=pod-saufen.service +After=pod-saufen.service + +[Service] +Environment=PODMAN_SYSTEMD_UNIT=%n +Restart=on-failure +TimeoutStopSec=70 +ExecStartPre=/bin/rm \ + -f %t/%n.ctr-id +ExecStart=/usr/bin/podman run \ + --cidfile=%t/%n.ctr-id \ + --cgroups=no-conmon \ + --rm \ + --pod-id-file %t/pod-futtern.pod-id \ + --sdnotify=conmon \ + --replace \ + -d \ + --name futtern-caddy \ + --volume %h/saufen/etc/caddy/Caddyfile:/etc/caddy/Caddyfile \ + --volume %h/saufen/app:/var/www/html \ + --volume caddy_data:/data docker.io/caddy/caddy:alpine +ExecStop=/usr/bin/podman stop \ + --ignore -t 10 \ + --cidfile=%t/%n.ctr-id +ExecStopPost=/usr/bin/podman rm \ + -f \ + --ignore -t 10 \ + --cidfile=%t/%n.ctr-id +Type=notify +NotifyAccess=all + +[Install] +WantedBy=default.target diff --git a/deploy/systemd/container-saufen-php.service b/deploy/systemd/container-saufen-php.service new file mode 100644 index 0000000..8701c04 --- /dev/null +++ b/deploy/systemd/container-saufen-php.service @@ -0,0 +1,46 @@ +# container-futtern-php.service +# autogenerated by Podman 4.3.1 +# Sun Jun 23 05:33:51 UTC 2024 + +[Unit] +Description=Podman container-futtern-php.service +Documentation=man:podman-generate-systemd(1) +Wants=network-online.target +After=network-online.target +RequiresMountsFor=%t/containers +BindsTo=pod-futtern.service +After=pod-futtern.service + +[Service] +Environment=PODMAN_SYSTEMD_UNIT=%n +Restart=on-failure +TimeoutStopSec=70 +ExecStartPre=/bin/rm \ + -f %t/%n.ctr-id +ExecStart=/usr/bin/podman run \ + --cidfile=%t/%n.ctr-id \ + --cgroups=no-conmon \ + --rm \ + --pod-id-file %t/pod-futtern.pod-id \ + --sdnotify=conmon \ + --replace \ + -d \ + --name futtern-php \ + --volume %h/futtern/etc/php84/php-fpm.d/www.conf:/etc/php84/php-fpm.d/www.conf \ + --volume %h/futtern/app:/var/www/html \ + --volume %h/futtern/app/var:/var/www/html/var \ + --env APP_ENV=prod \ + --env APP_SECRET=UwUtHiSisNotSecurePlZcHanGeMe \ + git.php.fail/lubiana/container/php:8.4-fpm +ExecStop=/usr/bin/podman stop \ + --ignore -t 10 \ + --cidfile=%t/%n.ctr-id +ExecStopPost=/usr/bin/podman rm \ + -f \ + --ignore -t 10 \ + --cidfile=%t/%n.ctr-id +Type=notify +NotifyAccess=all + +[Install] +WantedBy=default.target diff --git a/deploy/systemd/pod-saufen.service b/deploy/systemd/pod-saufen.service new file mode 100644 index 0000000..10a8fb0 --- /dev/null +++ b/deploy/systemd/pod-saufen.service @@ -0,0 +1,42 @@ +# pod-futtern.service +# autogenerated by Podman 4.3.1 +# Sun Jun 23 05:33:51 UTC 2024 + +[Unit] +Description=Podman pod-futtern.service +Documentation=man:podman-generate-systemd(1) +Wants=network-online.target +After=network-online.target +RequiresMountsFor=/run/user/%U/containers +Wants=container-futtern-caddy.service container-futtern-php.service +Before=container-futtern-caddy.service container-futtern-php.service + +[Service] +Environment=PODMAN_SYSTEMD_UNIT=%n +Restart=on-failure +TimeoutStopSec=70 +ExecStartPre=/bin/rm \ + -f %t/pod-futtern.pid %t/pod-futtern.pod-id +ExecStartPre=/usr/bin/podman pod create \ + --infra-conmon-pidfile %t/pod-futtern.pid \ + --pod-id-file %t/pod-futtern.pod-id \ + --exit-policy=stop \ + --label io.containers.autoupdate=registry \ + --name futtern \ + -p 8087:8087 \ + --replace +ExecStart=/usr/bin/podman pod start \ + --pod-id-file %t/pod-futtern.pod-id +ExecStop=/usr/bin/podman pod stop \ + --ignore \ + --pod-id-file %t/pod-futtern.pod-id \ + -t 10 +ExecStopPost=/usr/bin/podman pod rm \ + --ignore \ + -f \ + --pod-id-file %t/pod-futtern.pod-id +PIDFile=%t/pod-futtern.pid +Type=forking + +[Install] +WantedBy=default.target diff --git a/deploy/update.sh b/deploy/update.sh new file mode 100755 index 0000000..a03c457 --- /dev/null +++ b/deploy/update.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env sh + +systemctl --user stop pod-saufen +systemctl --user start pod-saufen +sleep 2 +podman exec -it saufen-php /var/www/html/bin/console cache:clear +podman exec -it saufen-php /var/www/html/bin/console cache:warmup +echo 'yes' | podman exec -it saufen-php /var/www/html/bin/console doctrine:migrations:migrate diff --git a/podman/Containerfile b/podman/Containerfile deleted file mode 100644 index b30f2c0..0000000 --- a/podman/Containerfile +++ /dev/null @@ -1,46 +0,0 @@ -FROM dunglas/frankenphp - -RUN install-php-extensions \ - intl \ - zip \ - opcache - - -ENV FRANKENPHP_CONFIG="worker ./public/index.php" -ENV APP_ENV=prod -ENV APP_DEBUG=0 - -WORKDIR /app - -COPY ../assets ./assets -COPY ../public ./public -COPY ../bin ./bin -COPY ../config ./config -COPY ../migrations ./migrations -COPY ../src ./src -COPY ../templates ./templates -COPY ../.env ./.env -COPY ../composer.json ./composer.json -COPY ../composer.lock ./composer.lock -COPY ../importmap.php ./importmap.php -COPY ../symfony.lock ./symfony.lock - -COPY --from=composer /usr/bin/composer /usr/bin/composer - -RUN composer install --no-dev --optimize-autoloader -RUN rm /usr/bin/composer - -ARG USER=appuser - -RUN \ - # Use "adduser -D ${USER}" for alpine based distros - useradd ${USER}; \ - # Remove default capability - setcap -r /usr/local/bin/frankenphp; \ - # Give write access to /data/caddy and /config/caddy - chown -R ${USER}:${USER} /data/caddy && chown -R ${USER}:${USER} /config/caddy - -USER ${USER} - -RUN ls -lisa . -