From 4ecb8cd2ca21bc336340922901752919db49b5cb Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 25 Mar 2023 22:56:04 +0300 Subject: [PATCH] remove docker-compose build related stuff --- README.md | 2 - docker-compose.yml | 8 +- src/app/Dockerfile | 78 ------------------- src/app/backup.sh | 31 -------- src/app/build-prepare.sh | 25 ------- src/app/config.docker.php | 8 -- src/app/dcron.sh | 5 -- src/app/index.php | 3 - src/app/startup.sh | 154 -------------------------------------- src/app/updater.sh | 33 -------- src/docker-compose.yml | 17 ----- src/web-nginx/Dockerfile | 15 ---- src/web-nginx/nginx.conf | 61 --------------- 13 files changed, 4 insertions(+), 436 deletions(-) delete mode 100644 src/app/Dockerfile delete mode 100755 src/app/backup.sh delete mode 100755 src/app/build-prepare.sh delete mode 100644 src/app/config.docker.php delete mode 100755 src/app/dcron.sh delete mode 100644 src/app/index.php delete mode 100755 src/app/startup.sh delete mode 100755 src/app/updater.sh delete mode 100644 src/docker-compose.yml delete mode 100644 src/web-nginx/Dockerfile delete mode 100644 src/web-nginx/nginx.conf diff --git a/README.md b/README.md index ce80ccc..d7d3385 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,6 @@ cd ttrss-docker git checkout static-dockerhub ``` -You're interested in ``docker-compose.yml`` stored in root directory, as opposed to ``src``. - #### Edit configuration files Configuration is done primarily through the [environment](https://git.tt-rss.org/fox/ttrss-docker-compose.wiki.git/tree/Home.md#how-do-i-set-global-configuration-options). Copy ``.env-dist`` to ``.env`` and edit any relevant variables you need changed. diff --git a/docker-compose.yml b/docker-compose.yml index 9f77c76..84fa04d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,7 +12,7 @@ services: - db:/var/lib/postgresql/data app: - image: cthulhoo/ttrss-fpm-pgsql-static + image: registry.fakecake.org/cthulhoo/ttrss-fpm-pgsql-static restart: unless-stopped env_file: - .env @@ -23,7 +23,7 @@ services: - db backups: - image: cthulhoo/ttrss-fpm-pgsql-static + image: registry.fakecake.org/cthulhoo/ttrss-fpm-pgsql-static restart: unless-stopped env_file: - .env @@ -35,7 +35,7 @@ services: command: /opt/tt-rss/dcron.sh -f updater: - image: cthulhoo/ttrss-fpm-pgsql-static + image: registry.fakecake.org/cthulhoo/ttrss-fpm-pgsql-static restart: unless-stopped env_file: - .env @@ -47,7 +47,7 @@ services: command: /opt/tt-rss/updater.sh web-nginx: - image: cthulhoo/ttrss-web-nginx + image: registry.fakecake.org/cthulhoo/ttrss-web-nginx restart: unless-stopped ports: - ${HTTP_PORT}:80 diff --git a/src/app/Dockerfile b/src/app/Dockerfile deleted file mode 100644 index 69ed693..0000000 --- a/src/app/Dockerfile +++ /dev/null @@ -1,78 +0,0 @@ -FROM alpine:3.17 -EXPOSE 9000/tcp - -ENV SCRIPT_ROOT=/opt/tt-rss - -RUN apk add --no-cache dcron php81 php81-fpm php81-phar \ - php81-pdo php81-gd php81-pgsql php81-pdo_pgsql php81-xmlwriter \ - php81-mbstring php81-intl php81-xml php81-curl php81-simplexml \ - php81-session php81-tokenizer php81-dom php81-fileinfo php81-ctype \ - php81-json php81-iconv php81-pcntl php81-posix php81-zip php81-exif \ - php81-openssl git postgresql-client sudo php81-pecl-xdebug rsync tzdata && \ - sed -i 's/\(memory_limit =\) 128M/\1 256M/' /etc/php81/php.ini && \ - sed -i -e 's/^listen = 127.0.0.1:9000/listen = 9000/' \ - -e 's/;\(clear_env\) = .*/\1 = no/i' \ - -e 's/^\(user\|group\) = .*/\1 = app/i' \ - -e 's/;\(php_admin_value\[error_log\]\) = .*/\1 = \/tmp\/error.log/' \ - -e 's/;\(php_admin_flag\[log_errors\]\) = .*/\1 = on/' \ - /etc/php81/php-fpm.d/www.conf && \ - mkdir -p /var/www ${SCRIPT_ROOT}/config.d - -ADD startup.sh ${SCRIPT_ROOT} -ADD updater.sh ${SCRIPT_ROOT} -ADD index.php ${SCRIPT_ROOT} -ADD dcron.sh ${SCRIPT_ROOT} -ADD backup.sh /etc/periodic/weekly/backup -ADD config.docker.php ${SCRIPT_ROOT} -ADD build-prepare.sh ${SCRIPT_ROOT} - -ARG ORIGIN_REPO_MAIN=https://git.tt-rss.org/fox/tt-rss.git -ARG ORIGIN_REPO_XACCEL=https://git.tt-rss.org/fox/ttrss-nginx-xaccel.git -ARG ORIGIN_COMMIT= - -ENV ORIGIN_REPO_MAIN=${ORIGIN_REPO_MAIN} -ENV ORIGIN_REPO_XACCEL=${ORIGIN_REPO_XACCEL} -ENV ORIGIN_COMMIT=${ORIGIN_COMMIT} - -RUN sh -c ${SCRIPT_ROOT}/build-prepare.sh - -ENV OWNER_UID=1000 -ENV OWNER_GID=1000 - -ENV PHP_WORKER_MAX_CHILDREN=5 -ENV PHP_WORKER_MEMORY_LIMIT=256M - -# these are applied on every startup, if set -ENV ADMIN_USER_PASS="" -# see classes/UserHelper.php ACCESS_LEVEL_* -# setting this to -2 would effectively disable built-in admin user -# unless single user mode is enabled -ENV ADMIN_USER_ACCESS_LEVEL="" - -# these are applied unless user already exists -ENV AUTO_CREATE_USER="" -ENV AUTO_CREATE_USER_PASS="" -ENV AUTO_CREATE_USER_ACCESS_LEVEL="0" - -# TODO: remove prefix from container variables not used by tt-rss itself: -# -# - TTRSS_NO_STARTUP_PLUGIN_UPDATES -> NO_STARTUP_PLUGIN_UPDATES -# - TTRSS_XDEBUG_... -> XDEBUG_... - -# don't try to update local plugins on startup -ENV TTRSS_NO_STARTUP_PLUGIN_UPDATES="" - -# TTRSS_XDEBUG_HOST defaults to host IP if unset -ENV TTRSS_XDEBUG_ENABLED="" -ENV TTRSS_XDEBUG_HOST="" -ENV TTRSS_XDEBUG_PORT="9000" - -ENV TTRSS_DB_TYPE="pgsql" -ENV TTRSS_DB_HOST="db" -ENV TTRSS_DB_PORT="5432" - -ENV TTRSS_MYSQL_CHARSET="UTF8" -ENV TTRSS_PHP_EXECUTABLE="/usr/bin/php81" -ENV TTRSS_PLUGINS="auth_internal, note, nginx_xaccel" - -CMD ${SCRIPT_ROOT}/startup.sh diff --git a/src/app/backup.sh b/src/app/backup.sh deleted file mode 100755 index a28c395..0000000 --- a/src/app/backup.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -e - -DST_DIR=/backups -KEEP_DAYS=28 -APP_ROOT=/var/www/html/tt-rss - -if pg_isready -h $TTRSS_DB_HOST -U $TTRSS_DB_USER; then - DST_FILE=ttrss-backup-$(date +%Y%m%d).sql.gz - - echo backing up tt-rss database to $DST_DIR/$DST_FILE... - - export PGPASSWORD=$TTRSS_DB_PASS - - pg_dump --clean -h $TTRSS_DB_HOST -U $TTRSS_DB_USER $TTRSS_DB_NAME | gzip > $DST_DIR/$DST_FILE - - DST_FILE=ttrss-backup-$(date +%Y%m%d).tar.gz - - echo backing up tt-rss local directories to $DST_DIR/$DST_FILE... - - tar -cz -f $DST_DIR/$DST_FILE $APP_ROOT/*.local \ - $APP_ROOT/feed-icons/ \ - $APP_ROOT/config.php - - echo cleaning up... - - find $DST_DIR -type f -name '*.gz' -mtime +$KEEP_DAYS -delete - - echo done. -else - echo backup failed: database is not ready. -fi diff --git a/src/app/build-prepare.sh b/src/app/build-prepare.sh deleted file mode 100755 index b90d75e..0000000 --- a/src/app/build-prepare.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -e - -DST_DIR=/src/tt-rss - -mkdir -p $DST_DIR - -echo requested commit: $ORIGIN_COMMIT - -echo cloning $ORIGIN_REPO_MAIN to $DST_DIR... -git clone --branch master --depth 1 $ORIGIN_REPO_MAIN $DST_DIR - -BUILD_COMMIT=$(git --git-dir=$DST_DIR/.git --no-pager log --pretty='%H' -n1 HEAD) - -echo built for: $BUILD_COMMIT - -if [ ! -z "$ORIGIN_COMMIT" -a "$ORIGIN_COMMIT" != "$BUILD_COMMIT" ]; then - echo actual build commit differs from requested commit, bailing out. - exit 1 -fi - -echo cloning $ORIGIN_REPO_XACCEL to $DST_DIR/plugins.local/nginx_xaccel... -git clone --branch master --depth 1 $ORIGIN_REPO_XACCEL $DST_DIR/plugins.local/nginx_xaccel -echo built for: $(git --git-dir=$DST_DIR/plugins.local/nginx_xaccel/.git --no-pager log --pretty='%H' -n1 HEAD) - -mkdir -p /var/www diff --git a/src/app/config.docker.php b/src/app/config.docker.php deleted file mode 100644 index fbf42e4..0000000 --- a/src/app/config.docker.php +++ /dev/null @@ -1,8 +0,0 @@ -/dev/null 2>&1; then - addgroup -g $OWNER_GID app - adduser -D -h /var/www/html -G app -u $OWNER_UID app -fi - -update-ca-certificates || true - -DST_DIR=/var/www/html/tt-rss -SRC_DIR=/src/tt-rss/ - -[ -e $DST_DIR ] && rm -f $DST_DIR/.app_is_ready - -export PGPASSWORD=$TTRSS_DB_PASS - -[ ! -e /var/www/html/index.php ] && cp ${SCRIPT_ROOT}/index.php /var/www/html - -if [ ! -d $DST_DIR ]; then - mkdir -p $DST_DIR - chown $OWNER_UID:$OWNER_GID $DST_DIR - - sudo -u app rsync -a \ - $SRC_DIR/ $DST_DIR/ -else - chown -R $OWNER_UID:$OWNER_GID $DST_DIR - - sudo -u app rsync -a --delete \ - --exclude /cache \ - --exclude /lock \ - --exclude /feed-icons \ - --exclude /plugins/af_comics/filters.local \ - --exclude /plugins.local \ - --exclude /templates.local \ - --exclude /themes.local \ - $SRC_DIR/ $DST_DIR/ - - sudo -u app rsync -a --delete \ - $SRC_DIR/plugins.local/nginx_xaccel \ - $DST_DIR/plugins.local/nginx_xaccel -fi - -for d in cache lock feed-icons plugins.local themes.local; do - sudo -u app mkdir -p $DST_DIR/$d -done - -for d in cache lock feed-icons; do - chmod 777 $DST_DIR/$d - find $DST_DIR/$d -type f -exec chmod 666 {} \; -done - -sudo -u app cp ${SCRIPT_ROOT}/config.docker.php $DST_DIR/config.php -chmod 644 $DST_DIR/config.php - -chown -R $OWNER_UID:$OWNER_GID $DST_DIR \ - /var/log/php81 - -if [ -z "$TTRSS_NO_STARTUP_PLUGIN_UPDATES" ]; then - echo updating all local plugins... - - find $DST_DIR/plugins.local -mindepth 1 -maxdepth 1 -type d | while read PLUGIN; do - if [ -d $PLUGIN/.git ]; then - echo updating $PLUGIN... - - cd $PLUGIN && \ - sudo -u app git config core.filemode false && \ - sudo -u app git config pull.rebase false && \ - sudo -u app git pull origin master || echo warning: attempt to update plugin $PLUGIN failed. - fi - done -else - echo skipping local plugin updates, disabled. -fi - -PSQL="psql -q -h $TTRSS_DB_HOST -U $TTRSS_DB_USER $TTRSS_DB_NAME" - -$PSQL -c "create extension if not exists pg_trgm" - -RESTORE_SCHEMA=${SCRIPT_ROOT}/restore-schema.sql.gz - -if [ -r $RESTORE_SCHEMA ]; then - $PSQL -c "drop schema public cascade; create schema public;" - zcat $RESTORE_SCHEMA | $PSQL -fi - -# this was previously generated -rm -f $DST_DIR/config.php.bak - -if [ ! -z "${TTRSS_XDEBUG_ENABLED}" ]; then - if [ -z "${TTRSS_XDEBUG_HOST}" ]; then - export TTRSS_XDEBUG_HOST=$(ip ro sh 0/0 | cut -d " " -f 3) - fi - echo enabling xdebug with the following parameters: - env | grep TTRSS_XDEBUG - cat > /etc/php81/conf.d/50_xdebug.ini <> /proc/1/fd/2) & - -unset ADMIN_USER_PASS -unset AUTO_CREATE_USER_PASS - -touch $DST_DIR/.app_is_ready - -exec /usr/sbin/php-fpm81 --nodaemonize --force-stderr diff --git a/src/app/updater.sh b/src/app/updater.sh deleted file mode 100755 index 219041a..0000000 --- a/src/app/updater.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh -e - -# We don't need those here (HTTP_HOST would cause false SELF_URL_PATH check failures) -unset HTTP_PORT -unset HTTP_HOST - -unset ADMIN_USER_PASS -unset AUTO_CREATE_USER_PASS - -# wait for the app container to delete .app_is_ready and perform rsync, etc. -sleep 30 - -if ! id app; then - addgroup -g $OWNER_GID app - adduser -D -h /var/www/html -G app -u $OWNER_UID app -fi - -while ! pg_isready -h $TTRSS_DB_HOST -U $TTRSS_DB_USER; do - echo waiting until $TTRSS_DB_HOST is ready... - sleep 3 -done - -sed -i.bak "s/^\(memory_limit\) = \(.*\)/\1 = ${PHP_WORKER_MEMORY_LIMIT}/" \ - /etc/php81/php.ini - -DST_DIR=/var/www/html/tt-rss - -while [ ! -s $DST_DIR/config.php -a -e $DST_DIR/.app_is_ready ]; do - echo waiting for app container... - sleep 3 -done - -sudo -E -u app /usr/bin/php81 /var/www/html/tt-rss/update_daemon2.php diff --git a/src/docker-compose.yml b/src/docker-compose.yml deleted file mode 100644 index 4e54b1a..0000000 --- a/src/docker-compose.yml +++ /dev/null @@ -1,17 +0,0 @@ -version: '3' - -services: - app: - image: cthulhoo/ttrss-fpm-pgsql-static:${BUILD_TAG} - build: - context: - ./app - restart: unless-stopped - - web-nginx: - image: cthulhoo/ttrss-web-nginx:${BUILD_TAG} - build: ./web-nginx - restart: unless-stopped - depends_on: - - app - diff --git a/src/web-nginx/Dockerfile b/src/web-nginx/Dockerfile deleted file mode 100644 index b92f8f2..0000000 --- a/src/web-nginx/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM nginx:alpine - -HEALTHCHECK CMD curl --fail http://localhost/tt-rss/index.php || exit 1 - -COPY nginx.conf /etc/nginx/templates/nginx.conf.template - -# By default, nginx will send the php requests to "app" server, but this server -# name can be overridden at runtime by passing an APP_UPSTREAM env var -ENV APP_UPSTREAM=${APP_UPSTREAM:-app} - -# It's necessary to set the following NGINX_ENVSUBST_OUTPUT_DIR env var to tell -# nginx to replace the env vars of /etc/nginx/templates/nginx.conf.template -# and put the result in /etc/nginx/nginx.conf (instead of /etc/nginx/conf.d/nginx.conf) -# See https://github.com/docker-library/docs/tree/master/nginx#using-environment-variables-in-nginx-configuration-new-in-119 -ENV NGINX_ENVSUBST_OUTPUT_DIR=/etc/nginx diff --git a/src/web-nginx/nginx.conf b/src/web-nginx/nginx.conf deleted file mode 100644 index f7d47c4..0000000 --- a/src/web-nginx/nginx.conf +++ /dev/null @@ -1,61 +0,0 @@ -worker_processes auto; -pid /var/run/nginx.pid; - -events { - worker_connections 1024; -} - -http { - include /etc/nginx/mime.types; - default_type application/octet-stream; - - access_log /dev/stdout; - error_log /dev/stderr warn; - - sendfile on; - - index index.php; - - upstream app { - server ${APP_UPSTREAM}:9000; - } - - server { - listen 80; - listen [::]:80; - - root /var/www/html; - - location /tt-rss/cache { - aio threads; - internal; - } - - location /tt-rss/backups { - internal; - } - - location ~ \.php$ { - # regex to split $uri to $fastcgi_script_name and $fastcgi_path - fastcgi_split_path_info ^(.+?\.php)(/.*)$; - - # Check that the PHP script exists before passing it - try_files $fastcgi_script_name =404; - - # Bypass the fact that try_files resets $fastcgi_path_info - # see: http://trac.nginx.org/nginx/ticket/321 - set $path_info $fastcgi_path_info; - fastcgi_param PATH_INFO $path_info; - - fastcgi_index index.php; - include fastcgi.conf; - - fastcgi_pass app; - } - - location / { - try_files $uri $uri/ =404; - } - - } -}