Compare commits

..

4 commits

Author SHA1 Message Date
c252b8420b
prepare deploy
All checks were successful
/ ls (pull_request) Successful in 29s
/ ls (push) Successful in 30s
/ ls (release) Successful in 5s
2024-06-22 21:47:23 +02:00
ec46bf2884
poddypodman
All checks were successful
/ ls (pull_request) Successful in 29s
2024-06-18 22:12:36 +02:00
9f5bb8ce9f
add more deployment files
All checks were successful
/ ls (pull_request) Successful in 29s
2024-06-17 22:41:47 +02:00
b4bc4dba1b
add dockerfile
All checks were successful
/ ls (pull_request) Successful in 30s
2024-06-15 22:36:31 +02:00
9 changed files with 106 additions and 4 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

2
.gitignore vendored
View file

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

View file

@ -70,11 +70,11 @@
"assets:install %PUBLIC_DIR%": "symfony-cmd" "assets:install %PUBLIC_DIR%": "symfony-cmd"
}, },
"post-install-cmd": [ "post-install-cmd": [
"@auto-scripts", "@auto-scripts"
"config-transformer switch-format config"
], ],
"post-update-cmd": [ "post-update-cmd": [
"@auto-scripts" "@auto-scripts",
"config-transformer switch-format config"
], ],
"lint": [ "lint": [
"rector", "rector",

2
deploy/Dockerfile Normal file
View file

@ -0,0 +1,2 @@
FROM git.php.fail/lubiana/container/php:8.3 as phpbuild

View file

@ -0,0 +1,7 @@
:8087 {
log
root * /var/www/html/public
php_fastcgi localhost:9001
file_server
encode zstd gzip
}

View file

@ -0,0 +1,10 @@
[www]
user = nobody
group = nobody
listen = 9001
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3

31
deploy/install.sh Executable file
View file

@ -0,0 +1,31 @@
#!/usr/bin/env sh
if [ ! -d "var" ]; then
mkdir var
fi
podman pod stop futtern
podman pod rm futtern
podman pod create \
--label "io.containers.autoupdate=registry" \
--name futtern \
-p 8087:8087
podman run -d \
--pod futtern \
--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
podman run -d \
--pod futtern \
--name futtern-caddy \
--volume $(pwd)/etc/caddy/Caddyfile:/etc/caddy/Caddyfile \
--volume $(pwd)/futtern-app:/var/www/html \
--volume caddy_data:/data \
docker.io/caddy/caddy:alpine
echo 'yes' | podman exec -it futtern-php /var/www/html/bin/console doctrine:migrations:migrate

30
deploy/prepare-deploy.sh Normal file
View file

@ -0,0 +1,30 @@
#!/usr/bin/env sh
TARGETDIR='futtern-app'
if [ -d $TARGETDIR ]; then
rm -rf $TARGETDIR
fi
mkdir $TARGETDIR
cd $TARGETDIR || return
pathsToCopy="public bin config migrations src templates composer.json composer.lock symfony.lock .env etc"
for path in $pathsToCopy
do
cp -r ../../"$path" ./
done
rm ./bin/phpunit
APP_ENV=prod composer install --no-dev -a
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
# SCP files to the remote host
rsync -avz --delete public/ ${USERNAME}@${HOST}:${TARGETDIR}

0
var/.gitkeep Normal file
View file