YOURLS / containers

📦 Container Images for YOURLS
https://yourls.org
MIT License
138 stars 42 forks source link

Latest `fpm-alpine` image is broken #231

Closed robsdedude closed 1 year ago

robsdedude commented 1 year ago

Code of Conduct

Submission validity

Self troubleshooting

Version

1.9.2

Description

I have a docker compose file that spins up yourls:1.9-fpm-alpine and mysql:8.0. The web service is then proxied through traefik. I did docker compose -f <path-to-my-compose-yaml> pull and all I got afterwards was "Bad gateway".

So I exposed the http port of the yourls container directly and curled it:

curl -vvv http://<my-domain>:9080/admin
*   Trying <my-ip>:9080...
* Connected to <my-domain> (<my-ip>) port 9080 (#0)
> GET /admin HTTP/1.1
> Host: <my-domain>:9080
> User-Agent: curl/7.81.0
> Accept: */*
> 
* Recv failure: Connection reset by peer
* Closing connection 0
curl: (56) Recv failure: Connection reset by peer

There were no errors in the logs.

yourls-database-1  | 2023-07-08 13:20:49+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.33-1.el8 started.
yourls-database-1  | 2023-07-08 13:20:49+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
yourls-database-1  | 2023-07-08 13:20:49+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.33-1.el8 started.
yourls-database-1  | '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
yourls-yourls-1    | YOURLS not found in /var/www/html - copying now...
yourls-yourls-1    | Complete! YOURLS has been successfully copied to /var/www/html
yourls-database-1  | 2023-07-08T13:20:49.683977Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
yourls-database-1  | 2023-07-08T13:20:49.685294Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.33) starting as process 1
yourls-database-1  | 2023-07-08T13:20:49.693001Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
yourls-database-1  | 2023-07-08T13:20:49.848965Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
yourls-yourls-1    | [08-Jul-2023 13:20:49] NOTICE: fpm is running, pid 1
yourls-yourls-1    | [08-Jul-2023 13:20:49] NOTICE: ready to handle connections
yourls-database-1  | 2023-07-08T13:20:50.169710Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
yourls-database-1  | 2023-07-08T13:20:50.169769Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
yourls-database-1  | 2023-07-08T13:20:50.171124Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
yourls-database-1  | 2023-07-08T13:20:50.195650Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
yourls-database-1  | 2023-07-08T13:20:50.195822Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.33'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.

Sending requests didn't make new entries appear.

Switching the image to yourls:1.9 (using apache) it started just working fine.

Before I figured this out, I played around a lot with the php.ini and /usr/local/etc/ config files to get some errors to appear in the logs, but without success.

Expectation

No response

Reproduction steps

Here is my docker compose file to reproduce the issue.

version: '3'

services:
  yourls:
    image: yourls:1.9
    restart: unless-stopped
    environment:
      - YOURLS_SITE=https://<my-domain>
      - YOURLS_DB_USER=root
      - YOURLS_DB_PASS=${MYSQL_ROOT_PASSWORD}
      - YOURLS_DB_NAME=yourls
      - YOURLS_DB_HOST=database
      - YOURLS_USER=admin
      - YOURLS_PASS=${YOURLS_ADMIN_PASSWORD}
    labels:
      - "traefik.docker.network=traefik"
      - "traefik.http.routers.yourls-http.rule=Host(`<my-domain>`)"
      - "traefik.http.routers.yourls-http.entryPoints=web"
      - "traefik.http.routers.yourls-https.rule=Host(`<my-domain>`)"
      - "traefik.http.routers.yourls-https.entryPoints=websecure"
      - "traefik.http.routers.yourls-https.tls.certResolver=default"
      # redirect http to https
      - "traefik.http.middlewares.yourls-https-redirect.redirectscheme.scheme=https"
      - "traefik.http.middlewares.yourls-https-redirect.redirectscheme.permanent=true"
      - "traefik.http.routers.yourls-http.middlewares=yourls-https-redirect@docker"
    networks:
      - traefik
      - database
    depends_on:
      - database

  database:
    image: mysql:8.0
    restart: unless-stopped
    environment:
      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
      - MYSQL_DATABASE=yourls
    volumes:
      - /docker/volumes/yourls/database:/var/lib/mysql
    labels:
      - "traefik.enable=false"
    networks:
      - database

networks:
  database:
  traefik:
    name: traefik
    external: true

Note, I have a .env file with the passwords

MYSQL_ROOT_PASSWORD=<password1>
YOURLS_ADMIN_PASSWORD=<password2>

and I redacted my domain. All the traefik related entries are likely irrelevant, but for completeness, I included them. You can observe the problem without traefik, by just adding

    ports:
      - "9000:9000"

to the yourls service.

Context

No response

LeoColomb commented 1 year ago

Thanks for this report @robsdedude. That being said, are you sure Traefik supports FastCGI (FPM) protocol? As per https://github.com/traefik/traefik/issues/9521, I don't believe so. Thus, none of the fpm variants are supported by Traefik, at least for now.

robsdedude commented 1 year ago

You are right. I thought fpm was a web server of sorts. I'm just incredibly confused by the fact that it used to work :confused:

:shrug: sorry for the noise