From 15c9a9352cc835fa287e4508424ac048eaf1a996 Mon Sep 17 00:00:00 2001 From: Matthew Baggett <matthew@baggett.me> Date: Sun, 28 Aug 2022 13:45:10 +0200 Subject: [PATCH] Add readme --- README.md | 39 +++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 13 ++----------- 2 files changed, 41 insertions(+), 11 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..de082d1 --- /dev/null +++ b/README.md @@ -0,0 +1,39 @@ +# S3 backed Maria & Postgres Databases + +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. +On that note, please consider using Minio or any other S3 provider than AWS. + +## 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/" +``` + +### 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/" +``` \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 436186a..50424c5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -53,7 +53,7 @@ services: dockerfile: Dockerfile.mariadb args: MARIADB_VERSION: 10.9 - environment: + environment: &mariadb MARIADB_RANDOM_ROOT_PASSWORD: "yes" MARIADB_USER: example MARIADB_PASSWORD: changeme @@ -80,16 +80,7 @@ services: args: MARIADB_VERSION: 10.3 environment: - MARIADB_RANDOM_ROOT_PASSWORD: "yes" - MARIADB_USER: example - MARIADB_PASSWORD: changeme - MARIADB_DATABASE: s3db - S3_ENDPOINT: http://minio:9000/ - S3_API_KEY: *s3_key - S3_API_SECRET: *s3_secret - S3_USE_PATH_STYLE_ENDPOINT: "yes" - S3_BUCKET: "s3db" - S3_PREFIX: "test/mariadb/" + <<: *mariadb ports: - "127.0.0.127:3306:3306" depends_on: