Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Вопрос по установке #3

Open
calambur opened this issue Sep 26, 2024 · 14 comments
Open

Вопрос по установке #3

calambur opened this issue Sep 26, 2024 · 14 comments

Comments

@calambur
Copy link

Добрый день Все сделал по написанному Дал разрешения всем файлам и папкам с подпапками Что не так если выдает такое сообщение?

PDOException Object ( [message:protected] => SQLSTATE[08006] [7] could not translate host name "postgres" to address: Name or service not known [string:Exception:private] => [code:protected] => 7 [file:protected] => /application/init.php [line:protected] => 11 [trace:Exception:private] => Array ( [0] => Array ( [file] => /application/init.php [line] => 11 [function] => __construct [class] => PDO [type] => -> ) [1] => Array ( [file] => /application/public/index.php [line] => 3 [args] => Array ( [0] => /application/init.php ) [function] => include ) ) [previous:Exception:private] => [errorInfo] => Array ( [0] => 08006 [1] => 7 [2] => could not translate host name "postgres" to address: Name or service not known ) )

@zlsl
Copy link
Owner

zlsl commented Sep 26, 2024

Добрый день Все сделал по написанному Дал разрешения всем файлам и папкам с подпапками Что не так если выдает такое сообщение?

PDOException Object ( [message:protected] => SQLSTATE[08006] [7] could not translate host name "postgres" to address: Name or service not known [string:Exception:private] => [code:protected] => 7 [file:protected] => /application/init.php [line:protected] => 11 [trace:Exception:private] => Array ( [0] => Array ( [file] => /application/init.php [line] => 11 [function] => __construct [class] => PDO [type] => -> ) [1] => Array ( [file] => /application/public/index.php [line] => 3 [args] => Array ( [0] => /application/init.php ) [function] => include ) ) [previous:Exception:private] => [errorInfo] => Array ( [0] => 08006 [1] => 7 [2] => could not translate host name "postgres" to address: Name or service not known ) )

Точно докер-контейнеры запускаете? Не видит хост БД

@calambur
Copy link
Author

Снимок экрана 2024-09-26 в 11 41 00

@calambur
Copy link
Author

WARN[0000] /volume1/flibusta/docker-compose.yml: the attribute version is obsolete, it will be ignored, please remove it to avoid potential confusion
[+] Building 3.9s (17/17) FINISHED docker:default
=> [php-fpm internal] load build definition from Dockerfile 0.2s
=> => transferring dockerfile: 354B 0.0s
=> [postgres internal] load build definition from Dockerfile 0.3s
=> => transferring dockerfile: 163B 0.0s
=> [php-fpm internal] load metadata for docker.io/phpdockerio/php74-fpm:latest 1.5s
=> [postgres internal] load metadata for docker.io/library/postgres:13.4 1.3s
=> [postgres internal] load .dockerignore 0.1s
=> => transferring context: 2B 0.0s
=> [php-fpm internal] load .dockerignore 0.1s
=> => transferring context: 2B 0.0s
=> [postgres 1/3] FROM docker.io/library/postgres:13.4@sha256:1adb50e5c24f550a9e68457a2ce60e9e4103dfc43c3b36e98310168165b443a1 0.0s
=> [postgres internal] load build context 0.2s
=> => transferring context: 34B 0.0s
=> [php-fpm 1/3] FROM docker.io/phpdockerio/php74-fpm:latest@sha256:b3edd9825dbef228a16560cdb5953ec92178bdfc45d8f324f05f7aed9e673132 0.0s
=> CACHED [php-fpm 2/3] WORKDIR /application 0.0s
=> CACHED [php-fpm 3/3] RUN apt-get update; apt-get -y --no-install-recommends install postgresql-client python php7.4-bz2 php7.4- 0.0s
=> CACHED [postgres 2/3] WORKDIR /docker-entrypoint-initdb.d 0.0s
=> CACHED [postgres 3/3] COPY init_db.sql /docker-entrypoint-initdb.d/ 0.0s
=> [php-fpm] exporting to image 0.2s
=> => exporting layers 0.0s
=> => writing image sha256:2ab0d638dd8d959aff9a867173c7e8af4afddd5218312fa70c7127a0597bd3f3 0.1s
=> => naming to docker.io/library/flibusta-php-fpm 0.1s
=> [postgres] exporting to image 0.2s
=> => exporting layers 0.0s
=> => writing image sha256:213448d159852717e1154af66d82d38571915aad48a32b155c8e00f75a433593 0.1s
=> => naming to docker.io/library/flibusta-postgres 0.1s
=> [php-fpm] resolving provenance for metadata file 0.0s
=> [postgres] resolving provenance for metadata file

@calambur
Copy link
Author

WARN[0000] /volume1/flibusta/docker-compose.yml: the attribute version is obsolete, it will be ignored, please remove it to avoid potential confusion
[+] Running 3/3
✔ Container flibusta-postgres-1 Started 1.1s
✔ Container flibusta-webserver-1 Running 0.0s
✔ Container flibusta-php-fpm-1 Running 0.0s
admin@AS6404T-DE4B:/volume1/flibusta $

@zlsl
Copy link
Owner

zlsl commented Sep 26, 2024

Это с реализацией на маках связано.
Вот аналогичная ситуация и возможное решение:
https://stackoverflow.com/questions/42018989/hostname-in-docker-compose-yml-fails-to-be-recognized-on-on-mac-but-works-on-li

@calambur
Copy link
Author

docker стоит на сервере Asustor и база там Обращение к странице с mac mini

@jbeam54
Copy link

jbeam54 commented Sep 26, 2024

Приветствую. Та же проблема. Openmediavault 6.9.16-1 (Shaitan), ядро Linux 6.1.0-0.deb11.21-amd64

@zlsl
Copy link
Owner

zlsl commented Sep 26, 2024

Скорее всего нужно вручную добавить в docker-compose.yml описание сети
Вроде такого:

services:
    postgres:
        build: phpdocker/pg
        working_dir: /application
        networks:
            ficlet:
        volumes:
            - './db:/var/lib/postgresql/data'
            - './application:/application'
        environment:
            - POSTGRES_USER=flibusta
            - POSTGRES_PASSWORD=flibusta
            - POSTGRES_DB=flibusta
        ports:
            - '27101:5432'

    webserver:
        image: 'nginx:alpine'
        working_dir: /application
        networks:
            ficlet:
        volumes:
            - './application:/application'
            - './cache:/application/cache'
            - './Flibusta.Net:/application/flibusta'
            - './FlibustaSQL/lib.a.attached.zip:/application/cache/lib.a.attached.zip'
            - './FlibustaSQL/lib.b.attached.zip:/application/cache/lib.b.attached.zip'
            - './phpdocker/nginx/nginx.conf:/etc/nginx/conf.d/default.conf'
        ports:
            - '27100:80'

    php-fpm:
        build: phpdocker/php-fpm
        working_dir: /application
        networks:
            ficlet:
        volumes:
            - './application:/application'
            - './cache:/application/cache'
            - './FlibustaSQL/lib.a.attached.zip:/application/cache/lib.a.attached.zip'
            - './FlibustaSQL/lib.b.attached.zip:/application/cache/lib.b.attached.zip'
            - './Flibusta.Net:/application/flibusta'
            - './FlibustaSQL:/application/sql'
            - './phpdocker/php-fpm/php-ini-overrides.ini:/etc/php/7.4/fpm/conf.d/99-overrides.ini'

networks:
  ficlet:

@calambur
Copy link
Author

version: '3.1'
services:
postgres:
build: phpdocker/pg
working_dir: /application
networks:
ficlet:
volumes:
- './AS6404T-CB4E:/var/lib/postgresql/data'
- './application:/application'
environment:
- POSTGRES_USER=flibusta
- POSTGRES_PASSWORD=flibusta
- POSTGRES_DB=flibusta
ports:
- '27101:5432'

webserver:
    image: 'nginx:alpine'
    working_dir: /application
    networks:
        ficlet:
    volumes:
        - './application:/application'
        - './cache:/application/cache'
        - './Flibusta.Net:/application/flibusta'
        - './FlibustaSQL/lib.a.attached.zip:/application/cache/lib.a.attached.zip'
        - './FlibustaSQL/lib.b.attached.zip:/application/cache/lib.b.attached.zip'
        - './phpdocker/nginx/nginx.conf:/etc/nginx/conf.d/default.conf'
    ports:
        - '27100:80'

php-fpm:
    build: phpdocker/php-fpm
    working_dir: /application
    networks:
        ficlet:
    volumes:
        - './application:/application'
        - './cache:/application/cache'
        - './FlibustaSQL/lib.a.attached.zip:/application/cache/lib.a.attached.zip'
        - './FlibustaSQL/lib.b.attached.zip:/application/cache/lib.b.attached.zip'
        - './Flibusta.Net:/application/flibusta'
        - './FlibustaSQL:/application/sql'
        - './phpdocker/php-fpm/php-ini-overrides.ini:/etc/php/7.4/fpm/conf.d/99-overrides.ini'

networks:
ficlet:

Эта версия рабочая Вместо AS6404T-CB4E в строке - './AS6404T-CB4E:/var/lib/postgresql/data' вставляем свой HOST

@goletsa
Copy link
Contributor

goletsa commented Sep 28, 2024

База не может подняться если каталог db не пустой (там 1 файл лежит с точкой).
Смотрите логи запускается ли postgresql контейнер нормально или висит на инициализации.
Удаляете его и все работет (проверял на Synology).
Ну и 777 на FlibustaSQL и cache как ленивое решение.

@DmitriyStoyanov
Copy link
Contributor

Кстати может как решение проблемы с базой убрать его в отдельный вольюм вместо использования локальной фс? Да и кэш можно завернуть туда же под отдельный вольюм. Не будет проблем с правами доступа к каталогу и не нужно .gitkeep файлы оставлять в гите. Могу сделать PR если вариант подходит

@DmitriyStoyanov
Copy link
Contributor

PR с переносом базы в отдельный вольюм, убив двух зайцев, проблемы прав доступа на каталог db и проблем из-за файла .gitkeep при создании базы - #10

@zlsl
Copy link
Owner

zlsl commented Oct 1, 2024

PR с переносом базы в отдельный вольюм, убив двух зайцев, проблемы прав доступа на каталог db и проблем из-за файла .gitkeep при создании базы - #10

принято, позже добавлю импорт-экспорт книжных полок.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants
@goletsa @DmitriyStoyanov @calambur @zlsl @jbeam54 and others