From 7310a3cdb5393af84d3a627db1211602484084c1 Mon Sep 17 00:00:00 2001 From: max Date: Tue, 10 Dec 2024 09:50:30 +0000 Subject: [PATCH 01/41] add dockerfile --- Dockerfile | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..01524f1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM python:3-alpine + +ARG ADMIN_PASSWORD + +WORKDIR /catask +COPY . . +RUN pip install --no-cache-dir -r requirements.txt + +RUN echo $'DB_HOST = 127.0.0.1\n\ +DB_NAME = catask\n\ +DB_USER = catask\n\ +DB_PASS = catask\n\ +DB_PORT = 3306\n\ +ADMIN_PASSWORD = $ADMIN_PASSWORD\n\ +APP_SECRET = $(python3 -c "import secrets; print(secrets.token_hex())")' > .env +COPY config.example.json config.json + +ENTRYPOINT [ "gunicorn", "-w", "4", "app:app" ] \ No newline at end of file From d8d6dfda8a7eaed0dff965452e2130286b54e231 Mon Sep 17 00:00:00 2001 From: max Date: Tue, 10 Dec 2024 10:08:59 +0000 Subject: [PATCH 02/41] change db user and password to root --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 01524f1..b10947e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,8 +8,8 @@ RUN pip install --no-cache-dir -r requirements.txt RUN echo $'DB_HOST = 127.0.0.1\n\ DB_NAME = catask\n\ -DB_USER = catask\n\ -DB_PASS = catask\n\ +DB_USER = root\n\ +DB_PASS = root\n\ DB_PORT = 3306\n\ ADMIN_PASSWORD = $ADMIN_PASSWORD\n\ APP_SECRET = $(python3 -c "import secrets; print(secrets.token_hex())")' > .env From df399bd95b4a425121b7266335e40c2fa835eb02 Mon Sep 17 00:00:00 2001 From: max Date: Tue, 10 Dec 2024 10:13:38 +0000 Subject: [PATCH 03/41] add docker compose --- docker-compose.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..d37d4ee --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,19 @@ +name: catask + +services: + mariadb: + image: mariadb + restart: always + environment: + MYSQL_DATABASE: catask + MYSQL_USER: catask + MYSQL_PASSWORD: catask + + catask: + entrypoint: | + flask init-db + gunicorn -w 4 app:app + build: + dockerfile: Dockerfile + depends_on: + - mariadb \ No newline at end of file From 20a373a7ec1c4db30d4e3a0e4faebfb04c9dc3b2 Mon Sep 17 00:00:00 2001 From: max Date: Tue, 10 Dec 2024 10:14:12 +0000 Subject: [PATCH 04/41] revert 196763057f7f531ec1df6b8bc5b62917fe6332a4 revert change db user and password to root --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index b10947e..01524f1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,8 +8,8 @@ RUN pip install --no-cache-dir -r requirements.txt RUN echo $'DB_HOST = 127.0.0.1\n\ DB_NAME = catask\n\ -DB_USER = root\n\ -DB_PASS = root\n\ +DB_USER = catask\n\ +DB_PASS = catask\n\ DB_PORT = 3306\n\ ADMIN_PASSWORD = $ADMIN_PASSWORD\n\ APP_SECRET = $(python3 -c "import secrets; print(secrets.token_hex())")' > .env From 944bb58bb35fa321043830c06dfc4b51d4dda322 Mon Sep 17 00:00:00 2001 From: max Date: Tue, 10 Dec 2024 11:19:46 +0000 Subject: [PATCH 05/41] add volumes to docker compose add admin password arg --- docker-compose.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index d37d4ee..47b19b3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,12 +8,23 @@ services: MYSQL_DATABASE: catask MYSQL_USER: catask MYSQL_PASSWORD: catask + volumes: + - db-data:/var/lib/mysql catask: entrypoint: | flask init-db gunicorn -w 4 app:app + volumes: + - catask-data:/catask/config.json + - catask-data:/catask/.env build: dockerfile: Dockerfile + args: + ADMIN_PASSWORD: changeme depends_on: - - mariadb \ No newline at end of file + - mariadb + +volumes: + db-data: + catask-data: \ No newline at end of file From 6f430a885bd082bfa29b0b848322251c7c6eec36 Mon Sep 17 00:00:00 2001 From: max Date: Tue, 10 Dec 2024 12:15:07 +0000 Subject: [PATCH 06/41] expose port 8000 in docker compose --- docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 47b19b3..747d1ff 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,6 +15,8 @@ services: entrypoint: | flask init-db gunicorn -w 4 app:app + ports: + - "8000:8000" volumes: - catask-data:/catask/config.json - catask-data:/catask/.env From e0d9d1dba030f946a9ac03d85b44d9f309728b24 Mon Sep 17 00:00:00 2001 From: max Date: Tue, 10 Dec 2024 13:31:05 +0000 Subject: [PATCH 07/41] fix example config not copying to production config in dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 01524f1..1990f1d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,6 @@ DB_PASS = catask\n\ DB_PORT = 3306\n\ ADMIN_PASSWORD = $ADMIN_PASSWORD\n\ APP_SECRET = $(python3 -c "import secrets; print(secrets.token_hex())")' > .env -COPY config.example.json config.json +COPY ./config.example.json ./config.json ENTRYPOINT [ "gunicorn", "-w", "4", "app:app" ] \ No newline at end of file From 4a1de9417a86dd7166cb9f5fa418f50220b2550a Mon Sep 17 00:00:00 2001 From: max Date: Mon, 23 Dec 2024 17:26:24 +0000 Subject: [PATCH 08/41] try to bind volume in docker compose --- docker-compose.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 747d1ff..d41f5aa 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,8 +18,12 @@ services: ports: - "8000:8000" volumes: - - catask-data:/catask/config.json - - catask-data:/catask/.env + - type: bind + source: catask-data + target: /catask/config.json + - type: bind + source: catask-data + target: /catask/.env build: dockerfile: Dockerfile args: From 1dc7d087a7f4c5e7783f1ab49fb9882cc835ca2b Mon Sep 17 00:00:00 2001 From: max Date: Mon, 23 Dec 2024 17:43:44 +0000 Subject: [PATCH 09/41] allow empty root password in mariadb in docker compose --- docker-compose.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index d41f5aa..80754a9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,9 +5,10 @@ services: image: mariadb restart: always environment: - MYSQL_DATABASE: catask - MYSQL_USER: catask - MYSQL_PASSWORD: catask + MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: 1 + MARIADB_DATABASE: catask + MARIADB_USER: catask + MARIADB_PASSWORD: catask volumes: - db-data:/var/lib/mysql From b2b90ce4f5a7f13728851f9c8cb353d316c6491c Mon Sep 17 00:00:00 2001 From: max Date: Mon, 23 Dec 2024 18:00:41 +0000 Subject: [PATCH 10/41] get catask configs from volume "subdirectory" in docker compose --- docker-compose.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 80754a9..8ffbe03 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,12 +19,16 @@ services: ports: - "8000:8000" volumes: - - type: bind + - type: volume source: catask-data target: /catask/config.json - - type: bind + volume: + subpath: . + - type: volume source: catask-data target: /catask/.env + volume: + subpath: . build: dockerfile: Dockerfile args: From 60502eca70abefabda7719bed87c277ddf3ce314 Mon Sep 17 00:00:00 2001 From: max Date: Mon, 23 Dec 2024 18:23:53 +0000 Subject: [PATCH 11/41] revert b62c3d87cb22a5550a649e450bb342a21db02b72 revert get catask configs from volume "subdirectory" in docker compose --- docker-compose.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 8ffbe03..80754a9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,16 +19,12 @@ services: ports: - "8000:8000" volumes: - - type: volume + - type: bind source: catask-data target: /catask/config.json - volume: - subpath: . - - type: volume + - type: bind source: catask-data target: /catask/.env - volume: - subpath: . build: dockerfile: Dockerfile args: From 0117e2da6207e5bd43d7286a0c6b6bad9e307de4 Mon Sep 17 00:00:00 2001 From: max Date: Mon, 23 Dec 2024 18:25:28 +0000 Subject: [PATCH 12/41] bind to proper files in docker compose --- docker-compose.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 80754a9..426ac22 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -20,10 +20,10 @@ services: - "8000:8000" volumes: - type: bind - source: catask-data + source: ./config.json target: /catask/config.json - type: bind - source: catask-data + source: ./.env target: /catask/.env build: dockerfile: Dockerfile @@ -33,5 +33,4 @@ services: - mariadb volumes: - db-data: - catask-data: \ No newline at end of file + db-data: \ No newline at end of file From 1fff70f06ce7c62d437e8189d5cc8f1942de4f55 Mon Sep 17 00:00:00 2001 From: max Date: Mon, 23 Dec 2024 18:35:02 +0000 Subject: [PATCH 13/41] remove .env and config.json file creation in dockerfile --- Dockerfile | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1990f1d..c2e7cdf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,13 +6,4 @@ WORKDIR /catask COPY . . RUN pip install --no-cache-dir -r requirements.txt -RUN echo $'DB_HOST = 127.0.0.1\n\ -DB_NAME = catask\n\ -DB_USER = catask\n\ -DB_PASS = catask\n\ -DB_PORT = 3306\n\ -ADMIN_PASSWORD = $ADMIN_PASSWORD\n\ -APP_SECRET = $(python3 -c "import secrets; print(secrets.token_hex())")' > .env -COPY ./config.example.json ./config.json - ENTRYPOINT [ "gunicorn", "-w", "4", "app:app" ] \ No newline at end of file From 49b4530a2b7b95b076b9faa7b7b7de05a37fe92d Mon Sep 17 00:00:00 2001 From: max Date: Thu, 26 Dec 2024 04:39:00 +0000 Subject: [PATCH 14/41] connect schema to mariadb container's initdb --- docker-compose.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 426ac22..cb59b66 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,12 +10,10 @@ services: MARIADB_USER: catask MARIADB_PASSWORD: catask volumes: + - ./schema.sql:/docker-entrypoint-initdb.d/1.sql - db-data:/var/lib/mysql catask: - entrypoint: | - flask init-db - gunicorn -w 4 app:app ports: - "8000:8000" volumes: From f099958fb16872390cc5cc8f0621fe3be51e62bc Mon Sep 17 00:00:00 2001 From: max Date: Thu, 26 Dec 2024 05:48:10 +0000 Subject: [PATCH 15/41] bind to `0.0.0.0:8000` in dockerfile entrypoint so that docker port exposing works properly --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index c2e7cdf..eb58331 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,4 +6,4 @@ WORKDIR /catask COPY . . RUN pip install --no-cache-dir -r requirements.txt -ENTRYPOINT [ "gunicorn", "-w", "4", "app:app" ] \ No newline at end of file +ENTRYPOINT [ "gunicorn", "-w", "4", "app:app", "--bind", "0.0.0.0:8000" ] \ No newline at end of file From 7cf9132b315ed64de62d6b75b6a633d12326d90c Mon Sep 17 00:00:00 2001 From: max Date: Thu, 26 Dec 2024 06:27:28 +0000 Subject: [PATCH 16/41] remove admin password argument in docker compose --- docker-compose.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index cb59b66..f0f8acd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -25,8 +25,6 @@ services: target: /catask/.env build: dockerfile: Dockerfile - args: - ADMIN_PASSWORD: changeme depends_on: - mariadb From a5590816392cc32b9dc962b3119d68fc9418ab10 Mon Sep 17 00:00:00 2001 From: max Date: Thu, 26 Dec 2024 06:28:02 +0000 Subject: [PATCH 17/41] remove admin password argument in dockerfile --- Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index eb58331..76bb50f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,5 @@ FROM python:3-alpine -ARG ADMIN_PASSWORD - WORKDIR /catask COPY . . RUN pip install --no-cache-dir -r requirements.txt From 0a3e4760bc1e85ab0330d7b6ccc6364ab22b5d10 Mon Sep 17 00:00:00 2001 From: max Date: Thu, 26 Dec 2024 06:39:52 +0000 Subject: [PATCH 18/41] add custom network for custom host binding --- docker-compose.yml | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index f0f8acd..08e8f42 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,18 +2,26 @@ name: catask services: mariadb: - image: mariadb - restart: always environment: MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: 1 MARIADB_DATABASE: catask MARIADB_USER: catask MARIADB_PASSWORD: catask + image: mariadb + networks: + - catask + restart: always volumes: - ./schema.sql:/docker-entrypoint-initdb.d/1.sql - db-data:/var/lib/mysql catask: + build: + dockerfile: Dockerfile + depends_on: + - mariadb + networks: + - catask ports: - "8000:8000" volumes: @@ -23,10 +31,12 @@ services: - type: bind source: ./.env target: /catask/.env - build: - dockerfile: Dockerfile - depends_on: - - mariadb + +networks: + catask: + driver: bridge + driver_opts: + com.docker.network.bridge.host_binding_ipv4: "127.0.0.1" volumes: db-data: \ No newline at end of file From 803c97fc61dabacea139ae97194c786d0d6d3116 Mon Sep 17 00:00:00 2001 From: max Date: Thu, 26 Dec 2024 07:07:48 +0000 Subject: [PATCH 19/41] add healthcheck to mariadb container wait until mariadb is fully started when starting catask container remove custom networks in docker compose --- docker-compose.yml | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 08e8f42..8cd37ac 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,9 +7,13 @@ services: MARIADB_DATABASE: catask MARIADB_USER: catask MARIADB_PASSWORD: catask + healthcheck: + test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"] + start_period: 10s + interval: 10s + timeout: 5s + retries: 3 image: mariadb - networks: - - catask restart: always volumes: - ./schema.sql:/docker-entrypoint-initdb.d/1.sql @@ -19,9 +23,8 @@ services: build: dockerfile: Dockerfile depends_on: - - mariadb - networks: - - catask + mariadb: + condition: service_healthy ports: - "8000:8000" volumes: @@ -32,11 +35,5 @@ services: source: ./.env target: /catask/.env -networks: - catask: - driver: bridge - driver_opts: - com.docker.network.bridge.host_binding_ipv4: "127.0.0.1" - volumes: db-data: \ No newline at end of file From 8a37ff27189f8c9cde015437ec6f5b90a2a0e743 Mon Sep 17 00:00:00 2001 From: max Date: Thu, 26 Dec 2024 07:19:52 +0000 Subject: [PATCH 20/41] readd networks --- docker-compose.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 8cd37ac..a6f4ae9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,6 +14,8 @@ services: timeout: 5s retries: 3 image: mariadb + networks: + - catask restart: always volumes: - ./schema.sql:/docker-entrypoint-initdb.d/1.sql @@ -25,6 +27,8 @@ services: depends_on: mariadb: condition: service_healthy + networks: + - catask ports: - "8000:8000" volumes: @@ -35,5 +39,11 @@ services: source: ./.env target: /catask/.env +networks: + catask: + driver: bridge + driver_opts: + com.docker.network.bridge.host_binding_ipv4: "127.0.0.1" + volumes: db-data: \ No newline at end of file From c14acdabe86795377d120056cda88d1459777b5c Mon Sep 17 00:00:00 2001 From: max Date: Thu, 26 Dec 2024 08:11:32 +0000 Subject: [PATCH 21/41] revert 2d35928e4a3bbb06294e0c659f6fa851b7aa675a revert readd networks --- docker-compose.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index a6f4ae9..8cd37ac 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,8 +14,6 @@ services: timeout: 5s retries: 3 image: mariadb - networks: - - catask restart: always volumes: - ./schema.sql:/docker-entrypoint-initdb.d/1.sql @@ -27,8 +25,6 @@ services: depends_on: mariadb: condition: service_healthy - networks: - - catask ports: - "8000:8000" volumes: @@ -39,11 +35,5 @@ services: source: ./.env target: /catask/.env -networks: - catask: - driver: bridge - driver_opts: - com.docker.network.bridge.host_binding_ipv4: "127.0.0.1" - volumes: db-data: \ No newline at end of file From 7727c6eeb2b1c91d187f5bed79c54902ebbe723b Mon Sep 17 00:00:00 2001 From: max Date: Fri, 27 Dec 2024 18:37:30 +0000 Subject: [PATCH 22/41] use short syntax for catask config binds in docker compose --- docker-compose.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 8cd37ac..fdc04e4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -28,12 +28,8 @@ services: ports: - "8000:8000" volumes: - - type: bind - source: ./config.json - target: /catask/config.json - - type: bind - source: ./.env - target: /catask/.env + - ./config.json:/catask/config.json + - ./.env:/catask/.env volumes: db-data: \ No newline at end of file From 66e1354dd7a623979df0e7bcda44be07cfc2329f Mon Sep 17 00:00:00 2001 From: max Date: Fri, 27 Dec 2024 19:20:11 +0000 Subject: [PATCH 23/41] readd networks (again) --- docker-compose.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index fdc04e4..152b6d9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,6 +14,8 @@ services: timeout: 5s retries: 3 image: mariadb + networks: + - catask restart: always volumes: - ./schema.sql:/docker-entrypoint-initdb.d/1.sql @@ -25,11 +27,16 @@ services: depends_on: mariadb: condition: service_healthy + networks: + - catask ports: - "8000:8000" volumes: - ./config.json:/catask/config.json - ./.env:/catask/.env +networks: + catask: + volumes: db-data: \ No newline at end of file From 0c4d9ff6c09cbb222b179adacedbcdba175973a2 Mon Sep 17 00:00:00 2001 From: max Date: Fri, 27 Dec 2024 19:43:24 +0000 Subject: [PATCH 24/41] expose mariadb's port `3306` as tcp --- docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 152b6d9..a1c1c1a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,6 +7,8 @@ services: MARIADB_DATABASE: catask MARIADB_USER: catask MARIADB_PASSWORD: catask + expose: + - "3306/tcp" healthcheck: test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"] start_period: 10s From 7cd936a99ee1aeb75bc3c5ff13afd9b76db43c2f Mon Sep 17 00:00:00 2001 From: max Date: Mon, 30 Dec 2024 02:00:12 +0000 Subject: [PATCH 25/41] add remote access fix config for mariadb --- helpers/docker/mariadb/remote-access-fix.cnf | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 helpers/docker/mariadb/remote-access-fix.cnf diff --git a/helpers/docker/mariadb/remote-access-fix.cnf b/helpers/docker/mariadb/remote-access-fix.cnf new file mode 100644 index 0000000..8b4d7b7 --- /dev/null +++ b/helpers/docker/mariadb/remote-access-fix.cnf @@ -0,0 +1,5 @@ +# Taken from +# https://mariadb.com/kb/en/configuring-mariadb-for-remote-client-access/#editing-the-defaults-file +[mysqld] +skip-networking=0 +skip-bind-address \ No newline at end of file From 310551227770c4e507dbe95105e4b8050d622526 Mon Sep 17 00:00:00 2001 From: max Date: Mon, 30 Dec 2024 02:02:34 +0000 Subject: [PATCH 26/41] add mariadb fix config to docker-compose --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index a1c1c1a..9a10446 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,6 +21,7 @@ services: restart: always volumes: - ./schema.sql:/docker-entrypoint-initdb.d/1.sql + - ./helpers/docker/mariadb/remote-access-fix.cnf:/etc/mysql/conf.d/1.cnf - db-data:/var/lib/mysql catask: From 482b7a939711257e8a27037c7af15a368676458d Mon Sep 17 00:00:00 2001 From: max Date: Mon, 30 Dec 2024 02:36:08 +0000 Subject: [PATCH 27/41] remove port expose declaration in docker compose as the mariadb image already has this add static ip address to catask network --- docker-compose.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 9a10446..3cf0d42 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,8 +7,6 @@ services: MARIADB_DATABASE: catask MARIADB_USER: catask MARIADB_PASSWORD: catask - expose: - - "3306/tcp" healthcheck: test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"] start_period: 10s @@ -40,6 +38,9 @@ services: networks: catask: + driver: bridge + driver_opts: + com.docker.network.bridge.host_binding_ipv4: "127.0.0.1" volumes: db-data: \ No newline at end of file From 2df2c2f6c11b7b5e4aa4b04474302fdc7dc982ee Mon Sep 17 00:00:00 2001 From: max Date: Mon, 30 Dec 2024 02:42:11 +0000 Subject: [PATCH 28/41] apply `127.0.0.1` as catask service's ipv4 address --- docker-compose.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 3cf0d42..86fa9df 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -29,7 +29,8 @@ services: mariadb: condition: service_healthy networks: - - catask + catask: + ipv4_address: 127.0.0.1 ports: - "8000:8000" volumes: @@ -40,7 +41,7 @@ networks: catask: driver: bridge driver_opts: - com.docker.network.bridge.host_binding_ipv4: "127.0.0.1" + com.docker.network.bridge.host_binding_ipv4: 127.0.0.1 volumes: db-data: \ No newline at end of file From 245f0df6eb6114cdd617b9b00609a79bbc26bbf0 Mon Sep 17 00:00:00 2001 From: max Date: Mon, 30 Dec 2024 02:53:52 +0000 Subject: [PATCH 29/41] configure ipam in networks --- docker-compose.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 86fa9df..2a9f308 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -39,9 +39,10 @@ services: networks: catask: - driver: bridge - driver_opts: - com.docker.network.bridge.host_binding_ipv4: 127.0.0.1 + ipam: + driver: bridge + config: + - subnet: 255.0.0.0/24 volumes: db-data: \ No newline at end of file From 70e867c978e268b4a5be70f36a8c2cbe11cf0db4 Mon Sep 17 00:00:00 2001 From: max Date: Mon, 30 Dec 2024 02:56:55 +0000 Subject: [PATCH 30/41] remove bridge driver in ipam con fig --- docker-compose.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 2a9f308..2ee9f32 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -40,7 +40,6 @@ services: networks: catask: ipam: - driver: bridge config: - subnet: 255.0.0.0/24 From e783ef338013fd76f602c823e74f665195426a81 Mon Sep 17 00:00:00 2001 From: max Date: Mon, 30 Dec 2024 03:00:08 +0000 Subject: [PATCH 31/41] remove ipam config --- docker-compose.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 2ee9f32..4e8d38c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -29,8 +29,7 @@ services: mariadb: condition: service_healthy networks: - catask: - ipv4_address: 127.0.0.1 + - catask ports: - "8000:8000" volumes: @@ -39,9 +38,6 @@ services: networks: catask: - ipam: - config: - - subnet: 255.0.0.0/24 volumes: db-data: \ No newline at end of file From 539625fead72a8e3a7d958ee5a7da4ef6795172a Mon Sep 17 00:00:00 2001 From: max Date: Mon, 30 Dec 2024 03:07:12 +0000 Subject: [PATCH 32/41] add bridge driver to catask network --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index 4e8d38c..d1261a5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -38,6 +38,7 @@ services: networks: catask: + driver: bridge volumes: db-data: \ No newline at end of file From a0ab76a1d7f4f3dd41cfcbcdab3ee2cd6f5ecf06 Mon Sep 17 00:00:00 2001 From: max Date: Mon, 30 Dec 2024 03:38:01 +0000 Subject: [PATCH 33/41] remove remote access fix in docker compose --- docker-compose.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index d1261a5..f396570 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,7 +19,6 @@ services: restart: always volumes: - ./schema.sql:/docker-entrypoint-initdb.d/1.sql - - ./helpers/docker/mariadb/remote-access-fix.cnf:/etc/mysql/conf.d/1.cnf - db-data:/var/lib/mysql catask: From 8568df27d44451a286dffa9b4936566cfdff7be4 Mon Sep 17 00:00:00 2001 From: max Date: Mon, 30 Dec 2024 03:39:36 +0000 Subject: [PATCH 34/41] remove remote access fix --- helpers/docker/mariadb/remote-access-fix.cnf | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 helpers/docker/mariadb/remote-access-fix.cnf diff --git a/helpers/docker/mariadb/remote-access-fix.cnf b/helpers/docker/mariadb/remote-access-fix.cnf deleted file mode 100644 index 8b4d7b7..0000000 --- a/helpers/docker/mariadb/remote-access-fix.cnf +++ /dev/null @@ -1,5 +0,0 @@ -# Taken from -# https://mariadb.com/kb/en/configuring-mariadb-for-remote-client-access/#editing-the-defaults-file -[mysqld] -skip-networking=0 -skip-bind-address \ No newline at end of file From d43b8444568747668043c092a900cf0da940bc66 Mon Sep 17 00:00:00 2001 From: max Date: Tue, 31 Dec 2024 18:57:05 +0000 Subject: [PATCH 35/41] set mariadb root host to `%` Co-authored-by: mst --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index f396570..2c7ad81 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,6 +7,7 @@ services: MARIADB_DATABASE: catask MARIADB_USER: catask MARIADB_PASSWORD: catask + MARIADB_ROOT_HOST: "%" healthcheck: test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"] start_period: 10s From e888f43ce77abc359dc46bca1bbed91ee9dcc2a6 Mon Sep 17 00:00:00 2001 From: theycallhermax Date: Fri, 28 Feb 2025 21:29:48 -0500 Subject: [PATCH 36/41] port docker compose to postgres --- config.example.json | 2 +- docker-compose.yml | 72 ++++++++++++++++++++++----------------------- requirements.txt | 2 +- 3 files changed, 38 insertions(+), 38 deletions(-) diff --git a/config.example.json b/config.example.json index 7f6ffaf..a8fa41d 100644 --- a/config.example.json +++ b/config.example.json @@ -58,7 +58,7 @@ "topic": "" }, "themeStoreUrl": "http://127.0.0.1:8000", - "username": "", + "username": "a", "trimContentAfter": "150", "charLimit": "512", "anonName": "Anonymous", diff --git a/docker-compose.yml b/docker-compose.yml index 2c7ad81..cdf3e6f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,44 +1,44 @@ name: catask services: - mariadb: - environment: - MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: 1 - MARIADB_DATABASE: catask - MARIADB_USER: catask - MARIADB_PASSWORD: catask - MARIADB_ROOT_HOST: "%" - healthcheck: - test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"] - start_period: 10s - interval: 10s - timeout: 5s - retries: 3 - image: mariadb - networks: - - catask - restart: always - volumes: - - ./schema.sql:/docker-entrypoint-initdb.d/1.sql - - db-data:/var/lib/mysql + postgres: + environment: + POSTGRES_DB: catask + POSTGRES_USER: catask + POSTGRES_PASSWORD: catask + healthcheck: + test: ["CMD", "pg_isready", "-U", "catask"] + interval: 1s + timeout: 5s + retries: 10 + image: postgres:alpine + networks: + - catask + restart: always + volumes: + - ./schema.sql:/docker-entrypoint-initdb.d/catask.sql + - db-data:/var/lib/postgresql/data - catask: - build: - dockerfile: Dockerfile - depends_on: - mariadb: - condition: service_healthy - networks: - - catask - ports: - - "8000:8000" - volumes: - - ./config.json:/catask/config.json - - ./.env:/catask/.env + catask: + build: + dockerfile: Dockerfile + depends_on: + postgres: + condition: service_healthy + networks: + - catask + ports: + - "8000:8000" + restart: always + volumes: + - emoji-data:/catask/static/emojis + - ./config.json:/catask/config.json + - ./.env:/catask/.env networks: - catask: - driver: bridge + catask: + driver: bridge volumes: - db-data: \ No newline at end of file + db-data: + emoji-data: diff --git a/requirements.txt b/requirements.txt index ad13b40..55fbc88 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ flask python-dotenv -psycopg +psycopg[binary,pool] humanize mistune bleach From dc6b4f771237734897fea60406248d65420f7934 Mon Sep 17 00:00:00 2001 From: theycallhermax Date: Fri, 28 Feb 2025 21:31:49 -0500 Subject: [PATCH 37/41] revert config.example.json changes --- config.example.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.example.json b/config.example.json index a8fa41d..7f6ffaf 100644 --- a/config.example.json +++ b/config.example.json @@ -58,7 +58,7 @@ "topic": "" }, "themeStoreUrl": "http://127.0.0.1:8000", - "username": "a", + "username": "", "trimContentAfter": "150", "charLimit": "512", "anonName": "Anonymous", From 252e9879ef67139b6d6f73cc7785677de26f675a Mon Sep 17 00:00:00 2001 From: theycallhermax Date: Sat, 1 Mar 2025 02:35:02 -0500 Subject: [PATCH 38/41] add docker instructions cleanup docker compose --- docker-compose.yml | 4 ++-- docker.md | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 docker.md diff --git a/docker-compose.yml b/docker-compose.yml index cdf3e6f..19e7f90 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -31,7 +31,7 @@ services: - "8000:8000" restart: always volumes: - - emoji-data:/catask/static/emojis + - catask-data:/catask/static/emojis - ./config.json:/catask/config.json - ./.env:/catask/.env @@ -41,4 +41,4 @@ networks: volumes: db-data: - emoji-data: + catask-data: diff --git a/docker.md b/docker.md new file mode 100644 index 0000000..abc8da2 --- /dev/null +++ b/docker.md @@ -0,0 +1,34 @@ +# CatAsk on Docker (or Podman) + +## Prerequisites + +- Docker + `docker-compose` (or Podman + `podman-compose`) + +## Steps + +Before starting CatAsk, you must copy the configuration files to their proper places first: + +```sh +cp config.example.json config.json +cp .env.example .env +``` + +Then, paste this into the `.env` file, and replace sections that are marked with `[CHANGE THIS]`. + +```env +DB_HOST = postgres +DB_NAME = catask +DB_USER = catask +DB_PASS = catask +DB_PORT = 5432 +ADMIN_PASSWORD = [CHANGE THIS] +APP_SECRET = [CHANGE THIS] +``` + +You may now start CatAsk: + +```sh +docker compose up +``` + +If you have done everything correctly, going to `http://localhost:8000` in your browser should show a question box screen. You may now log in with your admin password, and configure the instance. From 21d401f253bf5fa609b170bf38722e1ab6bb3770 Mon Sep 17 00:00:00 2001 From: theycallhermax Date: Sat, 1 Mar 2025 02:36:02 -0500 Subject: [PATCH 39/41] uncomment docker section in readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d79faf1..3f9e4e1 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,8 @@ a simple & easy to use Q&A software that makes answering questions easier ## Install Clone this repository: `git clone https://git.gay/mst/catask.git` - +### Docker +See [docker.md](https://git.gay/mst/catask/src/branch/main/docker.md) ### VPS-specific Go into the cloned repository, create a virtual environment and activate it: From db1938f95b1aefb1267c3f56860b4b74d8c7ffdd Mon Sep 17 00:00:00 2001 From: theycallhermax Date: Sat, 1 Mar 2025 23:37:33 -0500 Subject: [PATCH 40/41] fix formatting in docker compose setup file --- docker.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docker.md b/docker.md index abc8da2..8d696cb 100644 --- a/docker.md +++ b/docker.md @@ -1,11 +1,9 @@ # CatAsk on Docker (or Podman) ## Prerequisites - - Docker + `docker-compose` (or Podman + `podman-compose`) ## Steps - Before starting CatAsk, you must copy the configuration files to their proper places first: ```sh From 10369dd23c71aa1f236f993815bc08f5a3aebca7 Mon Sep 17 00:00:00 2001 From: theycallhermax Date: Sun, 2 Mar 2025 00:45:10 -0500 Subject: [PATCH 41/41] add favicons folder to catask-data volume --- docker-compose.yml | 1 + docker.md | 1 + 2 files changed, 2 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 19e7f90..ed98985 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -32,6 +32,7 @@ services: restart: always volumes: - catask-data:/catask/static/emojis + - catask-data:/catask/static/icons/favicon - ./config.json:/catask/config.json - ./.env:/catask/.env diff --git a/docker.md b/docker.md index 8d696cb..452cdec 100644 --- a/docker.md +++ b/docker.md @@ -30,3 +30,4 @@ docker compose up ``` If you have done everything correctly, going to `http://localhost:8000` in your browser should show a question box screen. You may now log in with your admin password, and configure the instance. + \ No newline at end of file