prepare deploy
All checks were successful
/ ls (pull_request) Successful in 29s
/ ls (push) Successful in 30s
/ ls (release) Successful in 5s

This commit is contained in:
Jonas 2024-06-22 21:47:23 +02:00
parent ec46bf2884
commit c252b8420b
Signed by: lubiana
SSH key fingerprint: SHA256:gkqM8DUX4Blf6P52fycW8ISTd+4eAHH+Uzu9iyc8hAM
5 changed files with 48 additions and 17 deletions

View file

@ -0,0 +1,20 @@
on:
release
jobs:
ls:
runs-on: docker
container:
image: git.php.fail/lubiana/container/php: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: list
run: ls

3
.gitignore vendored
View file

@ -20,4 +20,5 @@
###< phpunit/phpunit ### ###< phpunit/phpunit ###
.idea/ .idea/
/deploy/temp-deploy/ /deploy/futtern-app/
/deploy/var/

View file

@ -1,6 +1,7 @@
:8087 { :8087 {
log
root * /var/www/html/public root * /var/www/html/public
php_fastcgi unix//var/run/php-fpm.sock php_fastcgi localhost:9001
file_server file_server
encode zstd gzip encode zstd gzip
} }

27
deploy/install.sh Normal file → Executable file
View file

@ -1,5 +1,11 @@
#!/usr/bin/env sh #!/usr/bin/env sh
if [ ! -d "var" ]; then
mkdir var
fi
podman pod stop futtern
podman pod rm futtern
podman pod create \ podman pod create \
--label "io.containers.autoupdate=registry" \ --label "io.containers.autoupdate=registry" \
--name futtern \ --name futtern \
@ -7,20 +13,19 @@ podman pod create \
podman run -d \ podman run -d \
--pod futtern \ --pod futtern \
--name php \ --name futtern-php \
--volume $(pwd)/etc/php83/php-fpm.d/www.conf:/etc/php83/php-fpm.d/www.conf \
--volume $(pwd)/futtern-app:/var/www/html \
--volume $(pwd)/var:/var/www/html/var \
--env 'APP_ENV=prod' \
git.php.fail/lubiana/container/php:8.3-fpm git.php.fail/lubiana/container/php:8.3-fpm
podman run -d \ podman run -d \
--pod futtern \ --pod futtern \
--name caddy \ --name futtern-caddy \
--volume --volume $(pwd)/etc/caddy/Caddyfile:/etc/caddy/Caddyfile \
--volume $(pwd)/futtern-app:/var/www/html \
--volume caddy_data:/data \
docker.io/caddy/caddy:alpine docker.io/caddy/caddy:alpine
podman genereate systemd \ echo 'yes' | podman exec -it futtern-php /var/www/html/bin/console doctrine:migrations:migrate
--files \
--name futtern \
--restart-policy=always \
-t 10
mkdir -p ${HOME}/.config/systemd/user

View file

@ -1,10 +1,12 @@
#!/usr/bin/env sh #!/usr/bin/env sh
if [ -d "futter-app" ]; then TARGETDIR='futtern-app'
rm -rf futtern-app
if [ -d $TARGETDIR ]; then
rm -rf $TARGETDIR
fi fi
mkdir futtern-app mkdir $TARGETDIR
cd futtern-app || return cd $TARGETDIR || return
pathsToCopy="public bin config migrations src templates composer.json composer.lock symfony.lock .env etc" pathsToCopy="public bin config migrations src templates composer.json composer.lock symfony.lock .env etc"
@ -24,3 +26,5 @@ chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H $HOST >> ~/.ssh/known_hosts ssh-keyscan -H $HOST >> ~/.ssh/known_hosts
# SCP files to the remote host # SCP files to the remote host
rsync -avz --delete public/ ${USERNAME}@${HOST}:${TARGETDIR} rsync -avz --delete public/ ${USERNAME}@${HOST}:${TARGETDIR}