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

[BUG] <title> Error 500 #465

Closed
1 task done
ebiscaia opened this issue Aug 9, 2024 · 3 comments
Closed
1 task done

[BUG] <title> Error 500 #465

ebiscaia opened this issue Aug 9, 2024 · 3 comments

Comments

@ebiscaia
Copy link

ebiscaia commented Aug 9, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Hi guys,

I have speedtest-tracker installed in k0s and recently I received a 'Error 500' page. Things were working normally since last week, when I updated everything.

Expected Behavior

speedtest-tracker to open the page normally

Steps To Reproduce

I don't know how to reproduce it as it happened during the week without any input of mine

Environment

- Alpine linux 3.20
- k0s

CPU architecture

x86-64

Docker creation

speedtest-dpl.yaml

# https://kubernetes.io/docs/concepts/workloads/controllers/deployment/
apiVersion: apps/v1
kind: Deployment
metadata:
  name: speedtest
  namespace: speedtest
  labels:
    app: speedtest
spec:
  selector:
    matchLabels:
      app: speedtest
  replicas: 1
  template:
    metadata:
      labels:
        app: speedtest
    spec:
      containers:
        - name: speedtest
          image: lscr.io/linuxserver/speedtest-tracker
          imagePullPolicy: Always
          env:
            - name: PUID
              valueFrom:
                configMapKeyRef:
                  name: speedtest-cmap
                  key: uid
            - name: PGID
              valueFrom:
                configMapKeyRef:
                  name: speedtest-cmap
                  key: gid
            - name: APP_TIMEZONE
              valueFrom:
                configMapKeyRef:
                  name: speedtest-cmap
                  key: tz
            - name: DISPLAY_TIMEZONE
              valueFrom:
                configMapKeyRef:
                  name: speedtest-cmap
                  key: tz
            - name: APP_URL
              valueFrom:
                configMapKeyRef:
                  name: speedtest-cmap
                  key: app_url
            - name: DB_CONNECTION
              valueFrom:
                configMapKeyRef:
                  name: speedtest-cmap
                  key: db_conn
            - name: DB_HOST
              valueFrom:
                configMapKeyRef:
                  name: speedtest-cmap
                  key: db_host
            - name: DB_PORT
              valueFrom:
                configMapKeyRef:
                  name: speedtest-cmap
                  key: db_port
            - name: FORCE_HTTPS
              valueFrom:
                configMapKeyRef:
                  name: speedtest-cmap
                  key: force
            - name: APP_KEY
              valueFrom:
                secretKeyRef:
                  name: speedtest-scr
                  key: appkey
            - name: APP_DEBUG
              valueFrom:
                configMapKeyRef:
                  name: speedtest-cmap
                  key: debug
            - name: SPEEDTEST_SCHEDULE
              valueFrom:
                configMapKeyRef:
                  name: speedtest-cmap
                  key: schedule
            - name: PRUNE_RESULTS_OLDER_THAN
              valueFrom:
                configMapKeyRef:
                  name: speedtest-cmap
                  key: prune
            - name: DB_DATABASE
              valueFrom:
                secretKeyRef:
                  name: mariadb-scr
                  key: database
            - name: DB_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: mariadb-scr
                  key: pass
            - name: DB_USERNAME
              valueFrom:
                secretKeyRef:
                  name: mariadb-scr
                  key: user
          ports:
            - containerPort: 80
              name: speedtest
          volumeMounts:
            - name: config
              mountPath: /config
            - name: web
              mountPath: /etc/ssl/web
            - name: localtime
              mountPath: /etc/localtime
              readOnly: yes
      volumes:
        - name: config
          persistentVolumeClaim:
            claimName: speedtest-cfg
        - name: web
          persistentVolumeClaim:
            claimName: speedtest-web
        - name: localtime
          hostPath:
            path: /etc/localtime
      restartPolicy: Always
---
# https://kubernetes.io/docs/concepts/services-networking/service/
apiVersion: v1
kind: Service
metadata:
  name: speedtest-svc
  namespace: speedtest
spec:
  selector:
    app: speedtest
  type: ClusterIP
  ports:
    - name: speedtest
      protocol: TCP
      port: 3344
      targetPort: 80
---
# https://kubernetes.io/docs/concepts/services-networking/ingress/
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: speedtest-ing
  namespace: speedtest
  #annotations:
  #  nginx.ingress.kubernetes.io/secure-backends: "true"
  #  nginx.ingress.kubernetes.io/ssl-redirect: "true"
spec:
  rules:
    - host: speedtest.eddienetworks.ddnsfree.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: speedtest-svc
                port:
                  number: 3344

speedtest-cmap.yaml

# https://kubernetes.io/docs/concepts/configuration/configmap/
apiVersion: v1
kind: ConfigMap
metadata:
  name: speedtest-cmap
  namespace: speedtest
data:
  uid: '1000'
  gid: '1000'
  tz: Australia/Melbourne
  db_conn: mysql
  db_host: mariadb-svc
  db_port: '3300'
  app_url: https://speedtest.eddienetworks.ddnsfree.com
  force: 'true'
  debug: 'true'
  schedule: '0 */1 * * *'
  prune: '120'

speedtest-scr.yaml

apiVersion: v1
kind: Secret
metadata:
  name: speedtest-scr
  namespace: speedtest
type: Opaque
data:
  appkey: Yxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx9

mariadb-dpl.yaml

# https://kubernetes.io/docs/concepts/workloads/controllers/deployment/
apiVersion: apps/v1
kind: Deployment
metadata:
  name: mariadb-dpl
  namespace: speedtest
  labels:
    app: mariadb
spec:
  selector:
    matchLabels:
      app: mariadb
  replicas: 1
  template:
    metadata:
      labels:
        app: mariadb
    spec:
      containers:
        - name: mariadb
          image: linuxserver/mariadb:10.11.8
          imagePullPolicy: Always
          env:
            - name: MYSQL_ROOT_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: mariadb-scr
                  key: root-pass
            - name: MYSQL_DATABASE
              valueFrom:
                secretKeyRef:
                  name: mariadb-scr
                  key: database
            - name: MYSQL_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: mariadb-scr
                  key: pass
            - name: MYSQL_USER
              valueFrom:
                secretKeyRef:
                  name: mariadb-scr
                  key: user
            - name: TZ
              valueFrom:
                configMapKeyRef:
                  name: speedtest-cmap
                  key: tz
            - name: PGID
              valueFrom:
                configMapKeyRef:
                  name: speedtest-cmap
                  key: gid
            - name: PUID
              valueFrom:
                configMapKeyRef:
                  name: speedtest-cmap
                  key: uid
          ports:
            - containerPort: 3306
              name: mariadb
          volumeMounts:
            - name: mariadb-vol
              mountPath: /config
      volumes:
        - name: mariadb-vol
          persistentVolumeClaim:
            claimName: speedtest-db
      restartPolicy: Always
---
# https://kubernetes.io/docs/concepts/services-networking/service/
apiVersion: v1
kind: Service
metadata:
  name: mariadb-svc
  namespace: speedtest
spec:
  selector:
    app: mariadb
  type: ClusterIP
  ports:
    - name: mariadb
      port: 3300
      targetPort: 3306

mariadb-scr.yaml

# https://kubernetes.io/docs/concepts/configuration/secret/
apiVersion: v1
kind: Secret
metadata:
  name: mariadb-scr
  namespace: speedtest
type: Opaque
data:
  root-pass: bxxxxxxxxxx0
  database: cxxxxxxxxxx= 
  user: cxxxxxx5
  pass: cxxxxxxxxxxxxxx=

Container logs

kc logs -n speedtest speedtest-69d74f4b74-47vvp
[migrations] started
[migrations] 01-nginx-site-confs-default: skipped
[migrations] done
───────────────────────────────────────

      ██╗     ███████╗██╗ ██████╗
      ██║     ██╔════╝██║██╔═══██╗
      ██║     ███████╗██║██║   ██║
      ██║     ╚════██║██║██║   ██║
      ███████╗███████║██║╚██████╔╝
      ╚══════╝╚══════╝╚═╝ ╚═════╝

   Brought to you by linuxserver.io
───────────────────────────────────────

To support the app dev(s) visit:
speedtest-tracker: https://github.com/sponsors/alexjustesen

To support LSIO projects visit:
https://www.linuxserver.io/donate/

───────────────────────────────────────
GID/UID
───────────────────────────────────────

User UID:    1000
User GID:    1000
───────────────────────────────────────
Linuxserver.io version: v0.21.2-ls40
Build-date: 2024-08-09T13:13:20+00:00
───────────────────────────────────────
    
using keys found in /config/keys
Waiting for DB to be available

In Connection.php line 825:
                                                                               
  SQLSTATE[HY000] [2002] Connection refused (Connection: mysql, SQL: select t  
  able_name as `name`, (data_length + index_length) as `size`, table_comment   
  as `comment`, engine as `engine`, table_collation as `collation` from infor  
  mation_schema.tables where table_schema = 'speedydb' and table_type in ('BA  
  SE TABLE', 'SYSTEM VERSIONED') order by table_name)                          
                                                                               

In Connector.php line 65:
                                             
  SQLSTATE[HY000] [2002] Connection refused  
                                             

**** The following active confs have different version dates than the samples that are shipped. ****
**** This may be due to user customization or an update to the samples. ****
**** You should compare the following files to the samples in the same folder and update them. ****
**** Use the link at the top of the file to view the changelog. ****
┌────────────┬────────────┬────────────────────────────────────────────────────────────────────────┐
│  old date  │  new date  │ path                                                                   │
├────────────┼────────────┼────────────────────────────────────────────────────────────────────────┤
│ 2024-05-28 │ 2024-05-27 │ /config/nginx/site-confs/default.conf                                  │
└────────────┴────────────┴────────────────────────────────────────────────────────────────────────┘
[custom-init] No custom files found, skipping...
[ls.io-init] done.

In Connection.php line 825:
                                                                               
  SQLSTATE[HY000] [2002] Connection refused (Connection: mysql, SQL: select *  
   from `cache` where `key` in (laravel_cache_illuminate:queue:restart))       
                                                                               

In Connector.php line 65:
                                             
  SQLSTATE[HY000] [2002] Connection refused  
                                             


In Connection.php line 825:
                                                                               
  SQLSTATE[HY000] [2002] Connection refused (Connection: mysql, SQL: select *  
   from `cache` where `key` in (laravel_cache_illuminate:queue:restart))       
                                                                               

In Connector.php line 65:
                                             
  SQLSTATE[HY000] [2002] Connection refused  


On the website as I turned debug mode on:
SQLSTATE[HY000] [2002] Connection refused (Connection: mysql, SQL: select * from `sessions` where `id` = g19CiR0rO24cyBuVm14ylqu7MeQ0n3kSFdYPUbXT limit 1)

and public/index.php:

// Register the Composer autoloader...
require __DIR__.'/../vendor/autoload.php';
 
// Bootstrap Laravel and handle the request...
(require_once __DIR__.'/../bootstrap/app.php')
    ->handleRequest(Request::capture());
Copy link

github-actions bot commented Aug 9, 2024

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

@j0nnymoe
Copy link
Member

j0nnymoe commented Aug 9, 2024

2 things:
Wrong repo

In Connection.php line 825:
                                                                               
  SQLSTATE[HY000] [2002] Connection refused (Connection: mysql, SQL: select t  
  able_name as `name`, (data_length + index_length) as `size`, table_comment   
  as `comment`, engine as `engine`, table_collation as `collation` from infor  
  mation_schema.tables where table_schema = 'speedydb' and table_type in ('BA  
  SE TABLE', 'SYSTEM VERSIONED') order by table_name)        

that's your issue.

@j0nnymoe j0nnymoe closed this as not planned Won't fix, can't repro, duplicate, stale Aug 9, 2024
@ebiscaia
Copy link
Author

ebiscaia commented Aug 9, 2024

Sorry, but what do you mean?

Now I see. Ill copy this to the right repo and then delete it here.

Sorry for the inconvenience

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

No branches or pull requests

2 participants