Formatting fixup

This commit is contained in:
Greyscale 2024-08-07 13:30:30 +02:00
parent 702fab1301
commit f1cae7e4a1
8 changed files with 111 additions and 106 deletions

View file

@ -53,7 +53,6 @@ jobs:
docker_hub_token: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: "Setup: Login to Private Registry"
if: secrets.PRIVATE_REGISTRY
uses: docker/login-action@v3
with:
registry: ${{ secrets.PRIVATE_REGISTRY }}

View file

@ -1,3 +1,4 @@
# checkov:skip=CKV_DOCKER_3 If its good enough for upstream mariadb, its good enough for me.
ARG MARIADB_VERSION
FROM mariadb:$MARIADB_VERSION AS mariadb

View file

@ -1,3 +1,4 @@
# checkov:skip=CKV_DOCKER_3 If its good enough for upstream postgres, its good enough for me.
ARG PGSQL_VERSION
FROM postgres:$PGSQL_VERSION-alpine AS postgres
@ -13,42 +14,47 @@ RUN apk add --no-cache runit && \
# Current packages don't exist in other repositories
libavif \
&& \
apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/ --allow-untrusted gnu-libiconv \
# Packages \
nano \
curl \
tini \
php83 \
php83-dev \
php83-common \
php83-gd \
php83-xmlreader \
php83-bcmath \
php83-ctype \
php83-curl \
php83-exif \
php83-iconv \
php83-intl \
php83-mbstring \
php83-opcache \
php83-openssl \
php83-pcntl \
php83-phar \
php83-session \
php83-xml \
php83-xsl \
php83-zip \
php83-zlib \
php83-dom \
php83-fpm \
php83-sodium \
php83-tokenizer \
php83-fileinfo \
php83-simplexml \
# Iconv Fix
php83-pecl-apcu \
ncurses \
xz \
apk \
--no-cache \
--repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/ \
#--allow-untrusted \
add \
# Packages \
gnu-libiconv \
nano \
curl \
tini \
php83 \
php83-dev \
php83-common \
php83-gd \
php83-xmlreader \
php83-bcmath \
php83-ctype \
php83-curl \
php83-exif \
php83-iconv \
php83-intl \
php83-mbstring \
php83-opcache \
php83-openssl \
php83-pcntl \
php83-phar \
php83-session \
php83-xml \
php83-xsl \
php83-zip \
php83-zlib \
php83-dom \
php83-fpm \
php83-sodium \
php83-tokenizer \
php83-fileinfo \
php83-simplexml \
# Iconv Fix
php83-pecl-apcu \
ncurses \
xz \
&& ln -sf /usr/bin/php83 /usr/bin/php
RUN curl https://getcomposer.org/composer-stable.phar --output /usr/local/bin/composer && \
chmod +x /usr/local/bin/composer

View file

@ -1,3 +1,4 @@
# checkov:skip=CKV_DOCKER_3 user cannot be determined at this stage.
FROM ubuntu:jammy AS mariadb-traptest
LABEL maintainer="Matthew Baggett <matthew@baggett.me>" \
@ -8,4 +9,5 @@ COPY traptest.sh /usr/local/bin/traptest
RUN chmod +x /usr/local/bin/traptest
ENTRYPOINT ["/usr/local/bin/traptest"]
CMD []
HEALTHCHECK NONE # Healthchecks are not relevant for this image
STOPSIGNAL SIGINT

View file

@ -1,39 +1,41 @@
# S3 backed Maria & Postgres Databases
This project comes out of frustration with ephemeral services not providing a trivial database for non-critical services
This project comes out of frustration with ephemeral services not providing a trivial database for non-critical services
that can be persisted beyond a restart.
This system starts and checks an s3 bucket for database dumps, downloads loads the most recent one and resets the database to that state.
Every 600 seconds after that, it dumps the database and persists it to s3 if there have been any changes.
This is extremely not meant for production workloads or anything you want to keep. QA systems, silly side projects, anything you don't want to pay Bezos for RDS for.
This is extremely not meant for production workloads or anything you want to keep. QA systems, silly side projects, anything you don't want to pay Bezos for RDS for.
On that note, please consider using Minio or any other S3 provider than AWS.
## Configuration:
## Configuration
### MariaDB
```yaml
MARIADB_RANDOM_ROOT_PASSWORD: "yes"
MARIADB_USER: example
MARIADB_PASSWORD: changeme
MARIADB_DATABASE: s3db
S3_ENDPOINT: http://minio:9000/
S3_API_KEY: <<secret>>
S3_API_SECRET: <<secret>>
S3_USE_PATH_STYLE_ENDPOINT: "yes" # This is only strictly neccisary with Minio, maybe others.
S3_BUCKET: "s3db"
S3_PREFIX: "test/mariadb/"
MARIADB_RANDOM_ROOT_PASSWORD: "yes"
MARIADB_USER: example
MARIADB_PASSWORD: changeme
MARIADB_DATABASE: s3db
S3_ENDPOINT: http://minio:9000/
S3_API_KEY: <<secret>>
S3_API_SECRET: <<secret>>
S3_USE_PATH_STYLE_ENDPOINT: "yes" # This is only strictly neccisary with Minio, maybe others.
S3_BUCKET: "s3db"
S3_PREFIX: "test/mariadb/"
```
### Postgres
```yaml
POSTGRES_USER: example
POSTGRES_PASSWORD: changeme
S3_ENDPOINT: http://minio:9000/
S3_API_KEY: <<secret>>
S3_API_SECRET: <<secret>>
S3_USE_PATH_STYLE_ENDPOINT: "yes" # This is only strictly neccisary with Minio, maybe others.
S3_BUCKET: "s3db"
S3_PREFIX: "test/postgres/"
```
POSTGRES_USER: example
POSTGRES_PASSWORD: changeme
S3_ENDPOINT: http://minio:9000/
S3_API_KEY: <<secret>>
S3_API_SECRET: <<secret>>
S3_USE_PATH_STYLE_ENDPOINT: "yes" # This is only strictly neccisary with Minio, maybe others.
S3_BUCKET: "s3db"
S3_PREFIX: "test/postgres/"
```

View file

@ -1,5 +0,0 @@
All:
PostgreSQL:
MariaDB:

View file

@ -1,42 +1,42 @@
{
"name": "matthewbaggett/s3db",
"type": "project",
"require": {
"php": ">8.1",
"ext-curl": "*",
"ext-json": "*",
"adambrett/shell-wrapper": "dev-master",
"bramus/monolog-colored-line-formatter": "~3.0",
"jimmiw/php-time-ago": "^3.2",
"kint-php/kint": "^3",
"league/flysystem": "^3.2",
"league/flysystem-aws-s3-v3": "^3.2",
"matthewbaggett/wait-for-mysql": "dev-main",
"monolog/monolog": "^2.2",
"nesbot/carbon": "^2.62",
"rych/bytesize": "^1.0",
"spatie/emoji": "^2.3",
"vanilla/garden-cli": "~2.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.0"
},
"license": "GPL",
"autoload": {
"psr-4": {
"S3DB\\Sync\\": "syncer/"
}
},
"authors": [
{
"name": "Matthew Baggett",
"email": "matthew@baggett.me"
}
],
"config": {
"sort-packages": true,
"preferred-install": {
"*": "dist"
}
"name": "matthewbaggett/s3db",
"type": "project",
"require": {
"php": ">8.1",
"ext-curl": "*",
"ext-json": "*",
"adambrett/shell-wrapper": "dev-master",
"bramus/monolog-colored-line-formatter": "~3.0",
"jimmiw/php-time-ago": "^3.2",
"kint-php/kint": "^3",
"league/flysystem": "^3.2",
"league/flysystem-aws-s3-v3": "^3.2",
"matthewbaggett/wait-for-mysql": "dev-main",
"monolog/monolog": "^2.2",
"nesbot/carbon": "^2.62",
"rych/bytesize": "^1.0",
"spatie/emoji": "^2.3",
"vanilla/garden-cli": "~2.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.0"
},
"license": "GPL",
"autoload": {
"psr-4": {
"S3DB\\Sync\\": "syncer/"
}
},
"authors": [
{
"name": "Matthew Baggett",
"email": "matthew@baggett.me"
}
],
"config": {
"sort-packages": true,
"preferred-install": {
"*": "dist"
}
}
}

View file

@ -11,10 +11,10 @@ services:
- 9000
- 9001
environment:
MINIO_ROOT_USER: &s3_key minio
MINIO_ROOT_PASSWORD: &s3_secret changeme
MINIO_ROOT_USER: &s3_key minio
MINIO_ROOT_PASSWORD: &s3_secret changeme
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:9000/minio/health/live" ]
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3