Initial setup proceeds, even without database
Summary
When setting up freescout for the first time, no error is detected if the database does not exist
Steps to reproduce
- Set up a working MySQL server, with no existing database
- Pass the arguments to freescout container: DB_HOST: remote-host DB_USER: root DB_PASS: root's secret DB_NAME: anything_thatdoesnt_exist
- Track freescout correctly seeing the database engine is alive, and performing initial setup
- Webpage will give SQL errors when logging in
Next, stop freescout, create the database, restart freescout and everything just works
What is the expected correct behavior?
Freescout should attempt to create the database, or fail completely
Relevant logs and/or screenshots
Sorry, didnt catch any, was very surprised this happened :dango:
Environment
- Image version / tag: latest
- Host OS: Ubuntu 20.04.3 LTS
- Kubernetes v1.19.12, database running in a different namespace
Any logs | docker-compose.yml
deployment yaml: ```apiVersion: apps/v1 kind: Deployment metadata: annotations: deployment.kubernetes.io/revision: "6" creationTimestamp: "2021-10-26T10:06:12Z" generation: 6 name: freescout namespace: desk spec: progressDeadlineSeconds: 600 replicas: 1 revisionHistoryLimit: 10 selector: matchLabels: app: freescout strategy: rollingUpdate: maxSurge: 0 maxUnavailable: 100% type: RollingUpdate template: metadata: labels: app: freescout spec: containers: - env: - name: DB_HOST value: testdb.db - name: DB_NAME value: freescout - name: DB_USER value: root - name: DB_PASS value: SuchASecret - name: DISPLAY_ERRORS value: "true" - name: SITE_URL value: http://my.url - name: DB_PORT value: "6446" - name: ADMIN_EMAIL value: [email protected] - name: ADMIN_PASS value: SuchASecret image: tiredofit/freescout imagePullPolicy: Always name: freescout resources: limits: cpu: 500m memory: 512M requests: cpu: 500m memory: 512M terminationMessagePath: /dev/termination-log terminationMessagePolicy: File volumeMounts: - mountPath: /data name: freescout-94234348-eebe-4b0b-bcd2-9e867cc4e373 dnsPolicy: ClusterFirst restartPolicy: Always schedulerName: default-scheduler securityContext: {} terminationGracePeriodSeconds: 30 volumes: - name: freescout-94234348-eebe-4b0b-bcd2-9e867cc4e373 persistentVolumeClaim: claimName: freescout-94234348-eebe-4b0b-bcd2-9e867cc4e373
</details>
<!-- Include anything additional -->
### Possible fixes
<!-- If you can, provide details to the root cause that might be responsible for the problem. -->
@tiredofit @WebSpider
I actually considered this happening due to an issue I had with another container. I rewrote the docker-compose file to prevent certain problems I've had in the past, and configured it to use an .env file for most info.
version: "3.7"
# networks, change subnet, gateway, etc to suit
networks:
fs-bridge:
driver: bridge
driver_opts:
com.docker.network.bridge.name: fs-bridge
ipam:
driver: default
config:
- subnet: 172.24.0.0/24
gateway: 172.24.0.1
# docker managed persistent volumes, change to suit your needs
volumes:
logs:
data:
modules:
mariadb:
dbbackup:
services:
freescout-app:
container_name: freescout-app
image: tiredofit/freescout:latest
restart: always
environment:
- DB_HOST=freescout-db
- DB_NAME=${DB_NAME}
- DB_USER=${DB_USER}
- DB_PASS=${DB_PASS}
- SITE_URL=${SITE_URL}
- ADMIN_EMAIL=${ADMIN_EMAIL}
- ADMIN_PASS=${ADMIN_PASS}
# - ENABLE_SSL_PROXY=${SSL}
- DISPLAY_ERRORS=${SHOW_ERR}
- TIMEZONE=${TZ}
ports:
- 80:80 # Change exposed interface/port to suit your needs
volumes:
- data:/data # Configure these volumes to match the ones you chose as options
- modules:/www/html/Modules
- logs:/www/logs
depends_on:
- freescout-db
networks:
- fs-bridge
freescout-db:
container_name: freescout-db
image: tiredofit/mariadb:latest
restart: always
environment:
- ROOT_PASS=${ROOT_PASS}
- DB_NAME=${DB_NAME}
- DB_USER=${DB_USER}
- DB_PASS=${DB_PASS}
volumes:
- mariadb:/var/lib/mysql
networks:
- fs-bridge
freescout-db-backup:
image: tiredofit/db-backup:latest
container_name: freescout-db-backup
restart: always
environment:
- DB_HOST=freescout-db
- DB_TYPE=mariadb
- DB_NAME=${DB_NAME}
- DB_USER=${DB_USER}
- DB_PASS=${DB_PASS}
- DB_DUMP_FREQ=1440
- DB_DUMP_BEGIN=0000
- DB_CLEANUP_TIME=8640
- COMPRESSION=BZ
- MD5=TRUE
volumes:
- dbbackup:/backup
depends_on:
- freescout-db
networks:
- fs-bridge
The depends_on entries ensure that the others wait for the mariadb container to be ready, the network config prevents issues with the gateway sometimes not being created, and the driver_opts name assignment makes firewall rules easier to manage and troubleshoot as you can use that name vs that br-xxxxxxxxxx junk.
@tiredofit @WebSpider
.env file:
# MariaDB
DB_NAME=freescout db name
DB_USER=freescout db user name
DB_PASS=freescout db user pass
ROOT_PASS=mariadb root pass
# Web Config
SITE_URL=http://freescout.example.com
#SSL=TRUE
SHOW_ERR=FALSE
TZ=America/Chicago
# Admin Info
[email protected]
ADMIN_PASS=admin password