Changes made for out Project

This commit is contained in:
sotos
2025-12-08 09:09:48 +01:00
parent 23be1e4059
commit 508f1a46b2
16 changed files with 95 additions and 262 deletions

View File

@@ -1,27 +1,14 @@
version: '3.8'
services:
wordpress:
image: wordpress:latest
snake:
build: .
ports:
- "1337:80"
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
WORDPRESS_DB_NAME: wordpress
depends_on:
- db
volumes:
- ./wordpress_data:/data
- "8080:80" # Snake game
- "81:81" # Nginx metrics
networks:
- snake_net
restart: unless-stopped
db:
image: mysql:latest
restart: always
environment:
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
MYSQL_ROOT_PASSWORD: rootpassword
volumes:
- ./db_data:/var/lib/mysql
networks:
snake_net:
driver: bridge

Binary file not shown.

3
fonts/.gitignore vendored
View File

@@ -1,3 +0,0 @@
# Ignore fontconfig .uuid files
.uuid
.DS_Store

View File

@@ -1,98 +0,0 @@
Powerline fonts
===============
This repository contains pre-patched and adjusted fonts for usage with
the `Powerline <https://github.com/powerline/powerline>`_ statusline plugin.
Installation
------------
Run ``./install.sh`` to install all Powerline Fonts or see the documentation_ for details.
.. _documentation: https://powerline.readthedocs.org/en/latest/installation/linux.html#fonts-installation
Quick installation
------------------
If you are running a Debian or Ubuntu based Linux distribution, there should
be a package available to install the Powerline Fonts with the following command:
::
sudo apt-get install fonts-powerline
For fedora (tested on 28) or redhat based Linux distribution, there should also be a package available to install with the following command:
::
sudo dnf install powerline-fonts
On other environments, you can copy and paste these commands to your terminal. Comments are fine too.
::
# clone
git clone https://github.com/powerline/fonts.git --depth=1
# install
cd fonts
./install.sh
# clean-up a bit
cd ..
rm -rf fonts
Uninstall
---------
Run ``./uninstall.sh`` to uninstall all Powerline Fonts. You can also copy
the quick installation commands changing only the line ``./install.sh`` to
``./uninstall.sh``.
In both cases, please make sure you are working with the exact same version
of Powerline fonts you had checked out while installing.
Font Families
-------------
======================================= ========================= ====================================
Powerline Font Family Formerly Known As License
======================================= ========================= ====================================
3270 3270 BSD/CCAS 3.0
Anonymice Powerline Anonymous Pro SIL Open Font License, Version 1.1
Arimo Powerline Arimo Apache License, Version 2.0
Cousine Powerline Cousine Apache License, Version 2.0
CPMono_v07 CPMono_v07 Attribution 3.0 Germany (CC BY 3.0 DE)
D2Coding for Powerline D2Coding SIL Open Font License, Version 1.1
DejaVu Sans Mono for Powerline DejaVu Sans Mono DejaVu Fonts License, Version 1.0
Droid Sans Mono for Powerline Droid Sans Mono Apache License, Version 2.0
Droid Sans Mono Dotted for Powerline Droid Sans Mono Dotted Apache License, Version 2.0
Droid Sans Mono Slashed for Powerline Droid Sans Mono Slashed Apache License, Version 2.0
Fira Mono for Powerline Fira Mono SIL OPEN FONT LICENSE Version 1.1
Go Mono for Powerline Go Mono Go's License
Hack Hack SIL OFL, v1.1 + Bitstream License
Inconsolata for Powerline Inconsolata SIL Open Font License, Version 1.0
Inconsolata-dz for Powerline Inconsolata-dz SIL Open Font License, Version 1.0
Inconsolata-g for Powerline Inconsolata-g SIL Open Font License, Version 1.0
Input Mono Input Mono `Inputs license <http://input.fontbureau.com/license/>`_
Liberation Mono Powerline Liberation Mono SIL Open Font License, Version 1.1
ProFontWindows ProFont for Powerline MIT License
Meslo for Powerline Meslo Apache License, Version 2.0
Source Code Pro for Powerline Source Code Pro SIL Open Font License, Version 1.1
Meslo Dotted for Powerline Meslo Dotted Apache License, Version 2.0
Meslo Slashed for Powerline Meslo Dotted Apache License, Version 2.0
Monofur for Powerline Monofur Freeware
Noto Mono for Powerline Noto Mono SIL Open Font License, Version 1.1
Roboto Mono for Powerline Roboto Mono Apache License, Version 2.0
Symbol Neu Powerline Symbol Neu Apache License, Version 2.0
Terminess Powerline Terminus SIL Open Font License, Version 1.1
Tinos Powerline Tinos Apache License, Version 2.0
Ubuntu Mono derivative Powerline Ubuntu Mono Ubuntu Font License, Version 1.0
Space Mono for Powerline Space Mono SIL Open Font License, Version 1.1
======================================= ========================= ====================================
iTerm2 users need to set both the Regular font and the Non-ASCII Font in
"iTerm > Preferences > Profiles > Text" to use a patched font (per `this issue`__).
__ https://github.com/Lokaltog/powerline-fonts/issues/44
Fontconfig
----------
In some distributions, Terminess Powerline is ignored by default and must be
explicitly allowed. A fontconfig file is provided which enables it. Copy `this
file <https://github.com/powerline/fonts/blob/master/fontconfig/50-enable-terminess-powerline.conf>`_
from the fontconfig directory to your home folder under ``~/.config/fontconfig/conf.d``
(create it if it doesn't exist) and re-run ``fc-cache -vf``.

View File

@@ -1,41 +0,0 @@
<#
.SYNOPSIS
Installs the provided fonts.
.DESCRIPTION
Installs all the provided fonts by default. The FontName
parameter can be used to pick a subset of fonts to install.
.EXAMPLE
C:\PS> ./install.ps1
Installs all the fonts located in the Git repository.
.EXAMPLE
C:\PS> ./install.ps1 furamono-, hack-*
Installs all the FuraMono and Hack fonts.
.EXAMPLE
C:\PS> ./install.ps1 d* -WhatIf
Shows which fonts would be installed without actually installing the fonts.
Remove the "-WhatIf" to install the fonts.
#>
[CmdletBinding(SupportsShouldProcess)]
param(
# Specifies the font name to install. Default value will install all fonts.
[Parameter(Position=0)]
[string[]]
$FontName = '*'
)
$fontFiles = New-Object 'System.Collections.Generic.List[System.IO.FileInfo]'
foreach ($aFontName in $FontName) {
Get-ChildItem $PSScriptRoot -Filter "${aFontName}.ttf" -Recurse | Foreach-Object {$fontFiles.Add($_)}
Get-ChildItem $PSScriptRoot -Filter "${aFontName}.otf" -Recurse | Foreach-Object {$fontFiles.Add($_)}
}
$fonts = $null
foreach ($fontFile in $fontFiles) {
if ($PSCmdlet.ShouldProcess($fontFile.Name, "Install Font")) {
if (!$fonts) {
$shellApp = New-Object -ComObject shell.application
$fonts = $shellApp.NameSpace(0x14)
}
$fonts.CopyHere($fontFile.FullName)
}
}

View File

@@ -1,28 +0,0 @@
#!/bin/sh
# Set source and target directories
powerline_fonts_dir="$( cd "$( dirname "$0" )" && pwd )"
# if an argument is given it is used to select which fonts to install
prefix="$1"
if test "$(uname)" = "Darwin" ; then
# MacOS
font_dir="$HOME/Library/Fonts"
else
# Linux
font_dir="$HOME/.local/share/fonts"
mkdir -p $font_dir
fi
# Copy all fonts to user fonts directory
echo "Copying fonts..."
find "$powerline_fonts_dir" \( -name "$prefix*.[ot]tf" -or -name "$prefix*.pcf.gz" \) -type f -print0 | xargs -0 -n1 -I % cp "%" "$font_dir/"
# Reset font cache on Linux
if which fc-cache >/dev/null 2>&1 ; then
echo "Resetting font cache, this may take a moment..."
fc-cache -f "$font_dir"
fi
echo "Powerline fonts installed to $font_dir"

View File

@@ -1,31 +0,0 @@
#!/bin/sh
# Set source and target directories
powerline_fonts_dir="$( cd "$( dirname "$0" )" && pwd )"
# if an argument is given it is used to select which fonts to uninstall
prefix="$1"
if test "$(uname)" = "Darwin" ; then
# MacOS
font_dir="$HOME/Library/Fonts"
else
# Linux
font_dir="$HOME/.local/share/fonts"
if test ! -d "$font_dir" ; then
echo "It seems there are no powerline fonts installed on your system. Uninstall not needed."
exit 0
fi
fi
# Remove all fonts from user fonts directory
echo "Removing fonts..."
find "$powerline_fonts_dir" \( -name "$prefix*.[ot]tf" -or -name "$prefix*.pcf.gz" \) -type f -print0 | xargs -n1 -0 -I % sh -c "rm -f \"\$0/\${1##*/}\"" "$font_dir" %
# Reset font cache on Linux
if which fc-cache >/dev/null 2>&1 ; then
echo "Resetting font cache, this may take a moment..."
fc-cache -f "$font_dir"
fi
echo "Powerline fonts uninstalled from $font_dir"

View File

View File

View File

@@ -0,0 +1,42 @@
version: '3.8'
services:
prometheus:
image: prom/prometheus:latest
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus_data:/prometheus
ports:
- "9090:9090"
networks:
- webnet
restart: unless-stopped
grafana:
image: grafana/grafana:9.0.0
user: "472"
volumes:
- grafana_data:/var/lib/grafana
- ./grafana/provisioning:/etc/grafana/provisioning:ro
environment:
GF_SECURITY_ADMIN_PASSWORD: "admin"
ports:
- "3000:3000"
networks:
- webnet
restart: unless-stopped
nginx_exporter:
image: nginx/nginx-prometheus-exporter:0.9.0
environment:
SCRAPE_URI: http://snake:80/nginx_status
networks:
- webnet
restart: unless-stopped
volumes:
prometheus_data:
grafana_data:
networks:
webnet:
external: true

View File

43
snake/index.html Normal file
View File

@@ -0,0 +1,43 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Snake Game</title>
<style>
body { display:flex; height:100vh; align-items:center; justify-content:center; }
canvas { border:1px solid #333; }
</style>
</head>
<body>
<canvas id="game" width="300" height="300"></canvas>
<script>
const canvas = document.getElementById('game');
const ctx = canvas.getContext('2d');
const size = 10;
let dir = 'right';
let snake = [{x:2,y:0},{x:1,y:0},{x:0,y:0}];
let food = {x:8,y:8};
document.addEventListener('keydown', e => {
if (e.key.includes('Arrow')) dir = e.key.replace('Arrow','').toLowerCase();
});
function draw(){
ctx.fillStyle = '#fff'; ctx.fillRect(0,0,300,300);
ctx.fillStyle = '#f00'; ctx.fillRect(food.x*size,food.y*size,size,size);
ctx.fillStyle = '#000';
snake.forEach(s => ctx.fillRect(s.x*size,s.y*size,size,size));
}
function update(){
const head = {...snake[0]};
if (dir==='right') head.x++;
if (dir==='left') head.x--;
if (dir==='up') head.y--;
if (dir==='down') head.y++;
if (head.x===food.x && head.y===food.y){ snake.unshift(head); food = {x:Math.floor(Math.random()*30), y:Math.floor(Math.random()*30)} }
else { snake.pop(); snake.unshift(head); }
snake[0].x = (snake[0].x+30)%30;
snake[0].y = (snake[0].y+30)%30;
}
setInterval(()=>{ update(); draw(); }, 120);
</script>
</body>
</html>

View File

@@ -1,38 +0,0 @@
#!/bin/sh
set -e
# Download WordPress files if missing
if [ ! -f /data/index.php ]; then
echo "[INFO] WordPress core files fehlen, lade sie herunter..."
curl -o /tmp/wordpress.tar.gz https://wordpress.org/latest.tar.gz
tar -xzf /tmp/wordpress.tar.gz -C /tmp
cp -r /tmp/wordpress/* /data/
rm -rf /tmp/wordpress /tmp/wordpress.tar.gz
chown -R 101:101 /data
fi
# Generiere wp-config.php if missing
if [ ! -f /data/wp-config.php ]; then
echo "[INFO] wp-config.php wird generiert"
cat > /data/wp-config.php <<EOF
<?php
define( 'DB_NAME', '${WORDPRESS_DB_NAME}' );
define( 'DB_USER', '${WORDPRESS_DB_USER}' );
define( 'DB_PASSWORD', '${WORDPRESS_DB_PASSWORD}' );
define( 'DB_HOST', '${WORDPRESS_DB_HOST}' );
define( 'DB_CHARSET', 'utf8mb4' );
define( 'DB_COLLATE', '' );
$(curl -s https://api.wordpress.org/secret-key/1.1/salt/)
\$table_prefix = 'wp_';
define( 'WP_DEBUG', false );
if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', __DIR__ . '/' );
}
require_once ABSPATH . 'wp-settings.php';
EOF
chown 101:101 /data/wp-config.php
fi
# Start services
php-fpm82 --nodaemonize &
nginx -g "daemon off;"