init
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.env
|
||||||
14
README.md
Normal file
14
README.md
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# Crispi Docker template
|
||||||
|
|
||||||
|
|
||||||
|
# Einrichten
|
||||||
|
```
|
||||||
|
echo "MYSQL_ROOT_PASSWORD=$( openssl rand -hex 16 )" > .env
|
||||||
|
MYSQL_DATABASE=wordpress >> .env
|
||||||
|
MYSQL_USER=wordpress >> .env
|
||||||
|
echo "MYSQL_PASSWORD=$( openssl rand -hex 16 )" >> .env
|
||||||
|
```
|
||||||
|
|
||||||
|
## Cron
|
||||||
|
|
||||||
|
Backup script in Cron einbinden nicht vergessen
|
||||||
33
backup.sh
Executable file
33
backup.sh
Executable file
@@ -0,0 +1,33 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# stop on error
|
||||||
|
set -e
|
||||||
|
|
||||||
|
DATE=$(date +"%Y-%m-%d")
|
||||||
|
BACKUP_NAME="${DATE}.tar.gz"
|
||||||
|
|
||||||
|
# dir of this script that will also work when called from elsewhere
|
||||||
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
cd "$DIR" || exit 1
|
||||||
|
|
||||||
|
# load .env variables
|
||||||
|
if [ -f "$DIR/.env" ]; then
|
||||||
|
export $(grep -v '^#' "$DIR/.env" | xargs)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# --- PREPARE ---
|
||||||
|
mkdir -p "${DIR}/backups"
|
||||||
|
|
||||||
|
echo "Creating DB dump..."
|
||||||
|
docker compose exec db mariadb-dump --no-tablespaces -u"$MYSQL_USER" -p"$MYSQL_PASSWORD" "$MYSQL_DATABASE" > "db_dump_${DATE}.sql"
|
||||||
|
|
||||||
|
echo "Creating tar.gz archive..."
|
||||||
|
tar -czf "${DIR}/backups/${BACKUP_NAME}" --exclude='db' --exclude='.git' --exclude='static' --exclude='backups' --exclude='db_import' "." "db_dump_${DATE}.sql"
|
||||||
|
|
||||||
|
echo "Cleaning up temp SQL dump..."
|
||||||
|
rm "db_dump_${DATE}.sql"
|
||||||
|
|
||||||
|
echo "Cleaning up local backups older than 7 days..."
|
||||||
|
find "${DIR}/backups" -name "*.tar.gz" -type f -mtime +7 -delete
|
||||||
|
|
||||||
|
echo "✅ Backup complete: ${DIR}/backups/${BACKUP_NAME}"
|
||||||
2
backups/.gitignore
vendored
Normal file
2
backups/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
||||||
34
compose.yml
Normal file
34
compose.yml
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
services:
|
||||||
|
db:
|
||||||
|
image: mariadb:12-noble
|
||||||
|
command: '--default-authentication-plugin=mysql_native_password'
|
||||||
|
volumes:
|
||||||
|
- ./db:/var/lib/mysql
|
||||||
|
- ./db_import:/docker-entrypoint-initdb.d
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
|
||||||
|
- MYSQL_DATABASE=${MYSQL_DATABASE}
|
||||||
|
- MYSQL_USER=${MYSQL_USER}
|
||||||
|
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
|
||||||
|
wordpress:
|
||||||
|
image: wordpress:latest
|
||||||
|
volumes:
|
||||||
|
- ./wp:/var/www/html
|
||||||
|
- ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
|
||||||
|
- ./static:/export
|
||||||
|
ports:
|
||||||
|
- 8080:80
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
- WORDPRESS_DB_HOST=db
|
||||||
|
- WORDPRESS_DB_USER=${MYSQL_USER}
|
||||||
|
- WORDPRESS_DB_PASSWORD=${MYSQL_PASSWORD}
|
||||||
|
- WORDPRESS_DB_NAME=${MYSQL_DATABASE}
|
||||||
|
static:
|
||||||
|
image: caddy:latest
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- ./static:/usr/share/caddy
|
||||||
|
ports:
|
||||||
|
- 8081:80
|
||||||
2
db/.gitignore
vendored
Normal file
2
db/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
||||||
2
db_import/.gitignore
vendored
Normal file
2
db_import/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
||||||
4
example.env
Normal file
4
example.env
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
MYSQL_ROOT_PASSWORD=$( openssl rand -hex 16 )
|
||||||
|
MYSQL_DATABASE=wordpress
|
||||||
|
MYSQL_USER=wordpress
|
||||||
|
MYSQL_PASSWORD=$( openssl rand -hex 16 )
|
||||||
2
static/.gitignore
vendored
Normal file
2
static/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
||||||
5
uploads.ini
Normal file
5
uploads.ini
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
file_uploads = On
|
||||||
|
memory_limit = 500M
|
||||||
|
upload_max_filesize = 500M
|
||||||
|
post_max_size = 500M
|
||||||
|
max_execution_time = 600
|
||||||
2
wp/.gitignore
vendored
Normal file
2
wp/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
||||||
Reference in New Issue
Block a user