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 }} docker_hub_token: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: "Setup: Login to Private Registry" - name: "Setup: Login to Private Registry"
if: secrets.PRIVATE_REGISTRY
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
registry: ${{ secrets.PRIVATE_REGISTRY }} 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 ARG MARIADB_VERSION
FROM mariadb:$MARIADB_VERSION AS mariadb 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 ARG PGSQL_VERSION
FROM postgres:$PGSQL_VERSION-alpine AS postgres 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 # Current packages don't exist in other repositories
libavif \ libavif \
&& \ && \
apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/ --allow-untrusted gnu-libiconv \ apk \
# Packages \ --no-cache \
nano \ --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/ \
curl \ #--allow-untrusted \
tini \ add \
php83 \ # Packages \
php83-dev \ gnu-libiconv \
php83-common \ nano \
php83-gd \ curl \
php83-xmlreader \ tini \
php83-bcmath \ php83 \
php83-ctype \ php83-dev \
php83-curl \ php83-common \
php83-exif \ php83-gd \
php83-iconv \ php83-xmlreader \
php83-intl \ php83-bcmath \
php83-mbstring \ php83-ctype \
php83-opcache \ php83-curl \
php83-openssl \ php83-exif \
php83-pcntl \ php83-iconv \
php83-phar \ php83-intl \
php83-session \ php83-mbstring \
php83-xml \ php83-opcache \
php83-xsl \ php83-openssl \
php83-zip \ php83-pcntl \
php83-zlib \ php83-phar \
php83-dom \ php83-session \
php83-fpm \ php83-xml \
php83-sodium \ php83-xsl \
php83-tokenizer \ php83-zip \
php83-fileinfo \ php83-zlib \
php83-simplexml \ php83-dom \
# Iconv Fix php83-fpm \
php83-pecl-apcu \ php83-sodium \
ncurses \ php83-tokenizer \
xz \ php83-fileinfo \
php83-simplexml \
# Iconv Fix
php83-pecl-apcu \
ncurses \
xz \
&& ln -sf /usr/bin/php83 /usr/bin/php && ln -sf /usr/bin/php83 /usr/bin/php
RUN curl https://getcomposer.org/composer-stable.phar --output /usr/local/bin/composer && \ RUN curl https://getcomposer.org/composer-stable.phar --output /usr/local/bin/composer && \
chmod +x /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 FROM ubuntu:jammy AS mariadb-traptest
LABEL maintainer="Matthew Baggett <matthew@baggett.me>" \ 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 RUN chmod +x /usr/local/bin/traptest
ENTRYPOINT ["/usr/local/bin/traptest"] ENTRYPOINT ["/usr/local/bin/traptest"]
CMD [] CMD []
HEALTHCHECK NONE # Healthchecks are not relevant for this image
STOPSIGNAL SIGINT STOPSIGNAL SIGINT

View file

@ -1,39 +1,41 @@
# S3 backed Maria & Postgres Databases # 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. 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. 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. 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. On that note, please consider using Minio or any other S3 provider than AWS.
## Configuration: ## Configuration
### MariaDB ### MariaDB
```yaml ```yaml
MARIADB_RANDOM_ROOT_PASSWORD: "yes" MARIADB_RANDOM_ROOT_PASSWORD: "yes"
MARIADB_USER: example MARIADB_USER: example
MARIADB_PASSWORD: changeme MARIADB_PASSWORD: changeme
MARIADB_DATABASE: s3db MARIADB_DATABASE: s3db
S3_ENDPOINT: http://minio:9000/ S3_ENDPOINT: http://minio:9000/
S3_API_KEY: <<secret>> S3_API_KEY: <<secret>>
S3_API_SECRET: <<secret>> S3_API_SECRET: <<secret>>
S3_USE_PATH_STYLE_ENDPOINT: "yes" # This is only strictly neccisary with Minio, maybe others. S3_USE_PATH_STYLE_ENDPOINT: "yes" # This is only strictly neccisary with Minio, maybe others.
S3_BUCKET: "s3db" S3_BUCKET: "s3db"
S3_PREFIX: "test/mariadb/" S3_PREFIX: "test/mariadb/"
``` ```
### Postgres ### Postgres
```yaml ```yaml
POSTGRES_USER: example POSTGRES_USER: example
POSTGRES_PASSWORD: changeme POSTGRES_PASSWORD: changeme
S3_ENDPOINT: http://minio:9000/ S3_ENDPOINT: http://minio:9000/
S3_API_KEY: <<secret>> S3_API_KEY: <<secret>>
S3_API_SECRET: <<secret>> S3_API_SECRET: <<secret>>
S3_USE_PATH_STYLE_ENDPOINT: "yes" # This is only strictly neccisary with Minio, maybe others. S3_USE_PATH_STYLE_ENDPOINT: "yes" # This is only strictly neccisary with Minio, maybe others.
S3_BUCKET: "s3db" S3_BUCKET: "s3db"
S3_PREFIX: "test/postgres/" S3_PREFIX: "test/postgres/"
``` ```

View file

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

View file

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

View file

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